1
1
add frm_* vars
    read frame lines from ini
[Lines]
lefttop
righttop
centertop
centerbottom
leftbottom
rightbottom
leftmiddle
rightmiddle
centermiddle
horiz
vert
thinhoriz
thinvert

    fix draw frames in stickchar mode

Signed-off-by: Ilia Maslakov <il.smind@google.com>
Этот коммит содержится в:
Ilia Maslakov 2009-08-23 20:42:28 +00:00 коммит произвёл Ilia Maslakov
родитель 5a8923e44d
Коммит 465d4d2cc5
9 изменённых файлов: 142 добавлений и 25 удалений

Просмотреть файл

@ -90,18 +90,14 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
/* menu separator */
tty_setcolor (MENU_ENTRY_COLOR);
if (!tty_is_slow ()) {
widget_move (&menubar->widget, y, x - 1);
tty_print_alt_char (ACS_LTEE);
}
widget_move (&menubar->widget, y, x - 1);
tty_print_alt_char (ACS_LTEE);
tty_draw_hline (menubar->widget.y + y, menubar->widget.x + x,
tty_is_slow () ? ' ' : ACS_HLINE, menubar->max_entry_len + 2);
ACS_HLINE, menubar->max_entry_len + 2);
if (!tty_is_slow ()) {
widget_move (&menubar->widget, y, x + menubar->max_entry_len + 2);
tty_print_alt_char (ACS_RTEE);
}
widget_move (&menubar->widget, y, x + menubar->max_entry_len + 2);
tty_print_alt_char (ACS_RTEE);
} else {
/* menu text */
tty_setcolor (color);

Просмотреть файл

@ -715,8 +715,7 @@ mini_info_separator (WPanel *panel)
tty_setcolor (NORMAL_COLOR);
tty_draw_hline (panel->widget.y + y, panel->widget.x + 1,
tty_is_slow () ? '-' : ACS_HLINE,
panel->widget.cols - 2);
ACS_HLINE, panel->widget.cols - 2);
/* Status displays total marked size.
* Centered in panel, full format. */
display_total_marked_size (panel, y, -1, FALSE);
@ -769,7 +768,7 @@ show_dir (WPanel *panel)
panel->widget.y, panel->widget.x,
panel->widget.lines, panel->widget.cols);
if (show_mini_info && !tty_is_slow ()) {
if (show_mini_info) {
widget_move (&panel->widget, llines (panel) + 2, 0);
tty_print_alt_char (ACS_LTEE);
widget_move (&panel->widget, llines (panel) + 2,

Просмотреть файл

@ -34,6 +34,7 @@
#include "../src/tty/key.h"
#include "../src/tty/mouse.h" /* To make view.h happy */
#include "args.h"
#include "dir.h"
#include "panel.h"
#include "main.h"
@ -581,12 +582,29 @@ setup_init (void)
return profile;
}
int
setup_srt_to_char (char* str)
{
int res = -1;
if (!str)
return (int) ' ';
res = g_utf8_get_char_validated (str, -1);
if ( res < 0 ) {
return (int) *str;
} else {
return res;
}
}
void
load_setup (void)
{
char *profile;
int i;
char *buffer;
char *frm_val = NULL;
profile = setup_init ();
@ -680,6 +698,49 @@ load_setup (void)
if ( get_codepage_id( display_codepage ) )
utf8_display = str_isutf8 (get_codepage_id( display_codepage ));
#endif /* HAVE_CHARSET */
if (!mc_args__ugly_line_drawing) {
frm_val = mc_config_get_string(mc_main_config, "Frames", "horiz", " ");
ugly_frm_horiz = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "vert", " ");
ugly_frm_vert = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "lefttop", " ");
ugly_frm_lefttop = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "righttop", " ");
ugly_frm_righttop = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "leftbottom", " ");
ugly_frm_leftbottom = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "rightbottom", " ");
ugly_frm_rightbottom = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "thinvert", " ");
ugly_frm_thinvert = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "thinhoriz", "-");
ugly_frm_thinhoriz = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "rightmiddle", " ");
ugly_frm_rightmiddle = setup_srt_to_char (frm_val);
g_free (frm_val);
frm_val = mc_config_get_string(mc_main_config, "Frames", "leftmiddle", " ");
ugly_frm_leftmiddle = setup_srt_to_char (frm_val);
g_free (frm_val);
}
}
#if defined(USE_VFS) && defined (USE_NETCODE)

Просмотреть файл

@ -257,8 +257,7 @@ static void show_tree (WTree *tree)
/* Loop for every line */
for (i = 0; i < tree_lines; i++){
/* Move to the beginning of the line */
tty_draw_hline (tree->widget.y + y + i, tree->widget.x + x,
' ', tree_cols);
tty_draw_hline (tree->widget.y + y + i, tree->widget.x + x, ' ', tree_cols);
if (!current)
continue;

Просмотреть файл

@ -11,6 +11,9 @@
/* If true lines are shown by spaces */
extern gboolean slow_tty;
/* If true use +, -, | for line drawing */
extern gboolean ugly_line_drawing;
/* The mouse is currently: TRUE - enabled, FALSE - disabled */
extern gboolean mouse_enabled;

Просмотреть файл

@ -216,8 +216,12 @@ tty_getyx (int *py, int *px)
void
tty_draw_hline (int y, int x, int ch, int len)
{
if (ch == ACS_HLINE && slow_tty) {
ch = ugly_frm_thinhoriz;
}
if ((y >= 0) && (x >= 0))
move (y, x);
move (y, x);
hline (ch, len);
}
@ -290,6 +294,14 @@ tty_print_anychar (int c)
{
unsigned char str[6 + 1];
if (c == ACS_RTEE && (ugly_line_drawing || slow_tty)) {
c = ugly_frm_rightmiddle;
}
if (c == ACS_LTEE && (ugly_line_drawing || slow_tty)) {
c = ugly_frm_leftmiddle;
}
if ( c > 255 ) {
int res = g_unichar_to_utf8 (c, (char *)str);
if ( res == 0 ) {

Просмотреть файл

@ -197,6 +197,7 @@ void
tty_init (gboolean slow, gboolean ugly_lines)
{
slow_tty = slow;
ugly_line_drawing = ugly_lines;
SLtt_get_terminfo ();
SLutf8_enable (-1);
@ -386,6 +387,10 @@ tty_getyx (int *py, int *px)
void
tty_draw_hline (int y, int x, int ch, int len)
{
if (ch == ACS_HLINE && (ugly_line_drawing || slow_tty)) {
ch = ugly_frm_thinhoriz;
}
if ((y < 0) || (x < 0)) {
y = SLsmg_get_row ();
x = SLsmg_get_column ();
@ -435,7 +440,8 @@ tty_draw_vline (int y, int x, int ch, int len)
void
tty_draw_box (int y, int x, int rows, int cols)
{
if (slow_tty)
/* this fix slang drawing stickchars bug */
if (ugly_line_drawing || slow_tty)
tty_draw_box_slow (y, x, rows, cols);
else
SLsmg_draw_box (y, x, rows, cols);
@ -468,7 +474,18 @@ tty_print_char (int c)
void
tty_print_alt_char (int c)
{
SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), c);
if (c == ACS_RTEE && (ugly_line_drawing || slow_tty)) {
c = ugly_frm_rightmiddle;
}
if (c == ACS_LTEE && (ugly_line_drawing || slow_tty)) {
c = ugly_frm_leftmiddle;
}
if (ugly_line_drawing || slow_tty) {
tty_print_char (c);
} else {
SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), c);
}
}
void

Просмотреть файл

@ -49,6 +49,17 @@ gboolean slow_tty = FALSE;
/* If true use +, -, | for line drawing */
gboolean ugly_line_drawing = FALSE;
int ugly_frm_thinvert = '|';
int ugly_frm_thinhoriz = '-';
int ugly_frm_vert = '|';
int ugly_frm_horiz = '-';
int ugly_frm_lefttop = '+';
int ugly_frm_righttop = '+';
int ugly_frm_leftbottom = '+';
int ugly_frm_rightbottom = '+';
int ugly_frm_leftmiddle = '+';
int ugly_frm_rightmiddle = '+';
/*** file scope macro definitions **************************************/
/*** file scope type declarations **************************************/
@ -121,8 +132,8 @@ tty_got_interrupt(void)
void
tty_print_one_hline (void)
{
if (slow_tty)
tty_print_char (' ');
if (ugly_line_drawing || slow_tty)
tty_print_char (ugly_frm_thinhoriz);
else
tty_print_alt_char (ACS_HLINE);
}
@ -130,8 +141,8 @@ tty_print_one_hline (void)
void
tty_print_one_vline (void)
{
if (slow_tty)
tty_print_char (' ');
if (ugly_line_drawing || slow_tty)
tty_print_char (ugly_frm_thinvert);
else
tty_print_alt_char (ACS_VLINE);
}
@ -139,8 +150,16 @@ tty_print_one_vline (void)
void
tty_draw_box_slow (int y, int x, int ys, int xs)
{
tty_draw_hline (y, x, ' ', xs);
tty_draw_vline (y, x, ' ', ys);
tty_draw_vline (y, x + xs - 1, ' ', ys);
tty_draw_hline (y + ys - 1, x, ' ', xs);
tty_draw_vline (y, x, ugly_frm_vert, ys);
tty_draw_vline (y, x + xs - 1, ugly_frm_vert, ys);
tty_draw_hline (y, x, ugly_frm_horiz, xs);
tty_draw_hline (y + ys - 1, x, ugly_frm_horiz, xs);
tty_gotoyx (y, x);
tty_print_char (ugly_frm_lefttop);
tty_gotoyx (y + ys - 1, x);
tty_print_char (ugly_frm_leftbottom);
tty_gotoyx (y, x + xs - 1);
tty_print_char (ugly_frm_righttop);
tty_gotoyx (y + ys - 1, x + xs - 1);
tty_print_char (ugly_frm_rightbottom);
}

Просмотреть файл

@ -77,6 +77,17 @@ extern void tty_draw_box (int y, int x, int rows, int cols);
extern void tty_draw_box_slow (int y, int x, int ys, int xs);
extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
extern int ugly_frm_thinvert;
extern int ugly_frm_thinhoriz;
extern int ugly_frm_vert;
extern int ugly_frm_horiz;
extern int ugly_frm_lefttop;
extern int ugly_frm_righttop;
extern int ugly_frm_leftbottom;
extern int ugly_frm_rightbottom;
extern int ugly_frm_leftmiddle;
extern int ugly_frm_rightmiddle;
extern char *tty_tgetstr (const char *name);
extern void tty_beep (void);