From 9a145a88ce13fdb83ce71f1c1e57cbad27e5fa94 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Sun, 21 Mar 2010 11:58:45 +0300 Subject: [PATCH] Added capability to draw single or double lines. Fixed tty_print_alt_char() to draw single or double vertical or horizintal lines. Added argument to tty_print_one_hline() and tty_print_one_vline() functions to draw single or double lines. Signed-off-by: Andrew Borodin --- lib/tty/tty-ncurses.c | 4 ++-- lib/tty/tty-slang.c | 4 ++-- lib/tty/tty.c | 8 ++++---- lib/tty/tty.h | 4 ++-- src/screen.c | 8 ++++---- src/viewer/hex.c | 2 +- src/widget.c | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index 2db928793..8d8971155 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -343,9 +343,9 @@ void tty_print_alt_char (int c, gboolean single) { if ((chtype) c == ACS_VLINE) - c = mc_tty_ugly_frm[MC_TTY_FRM_thinvert]; + c = mc_tty_ugly_frm[single ? MC_TTY_FRM_thinvert: MC_TTY_FRM_vert]; else if ((chtype) c == ACS_HLINE) - c = mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]; + c = mc_tty_ugly_frm[single ? MC_TTY_FRM_thinhoriz : MC_TTY_FRM_horiz]; else if ((chtype) c == ACS_LTEE) c = mc_tty_ugly_frm[single ? MC_TTY_FRM_grpleftmiddle : MC_TTY_FRM_leftmiddle]; else if ((chtype) c == ACS_RTEE) diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index e60d81647..a6ab9e45c 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -503,10 +503,10 @@ tty_print_alt_char (int c, gboolean single) : SLsmg_write_char ((unsigned int) y) switch (c) { case ACS_VLINE: - DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinvert]); + DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_thinvert : MC_TTY_FRM_vert]); break; case ACS_HLINE: - DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]); + DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_thinhoriz : MC_TTY_FRM_horiz]); break; case ACS_LTEE: DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grpleftmiddle : MC_TTY_FRM_leftmiddle]); diff --git a/lib/tty/tty.c b/lib/tty/tty.c index 3576b1f38..493dc5992 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -126,15 +126,15 @@ tty_got_interrupt (void) } void -tty_print_one_hline (void) +tty_print_one_hline (gboolean single) { - tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz], FALSE); + tty_print_alt_char (ACS_HLINE, single); } void -tty_print_one_vline (void) +tty_print_one_vline (gboolean single) { - tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert], FALSE); + tty_print_alt_char (ACS_VLINE, single); } void diff --git a/lib/tty/tty.h b/lib/tty/tty.h index 0e869adc5..997660120 100644 --- a/lib/tty/tty.h +++ b/lib/tty/tty.h @@ -71,8 +71,8 @@ extern void tty_print_anychar (int c); extern void tty_print_string (const char *s); extern void tty_printf (const char *s, ...); -extern void tty_print_one_vline (void); -extern void tty_print_one_hline (void); +extern void tty_print_one_vline (gboolean single); +extern void tty_print_one_hline (gboolean single); extern void tty_draw_hline (int y, int x, int ch, int len); extern void tty_draw_vline (int y, int x, int ch, int len); extern void tty_draw_box (int y, int x, int rows, int cols); diff --git a/src/screen.c b/src/screen.c index 92059b599..06ff4cd17 100644 --- a/src/screen.c +++ b/src/screen.c @@ -747,7 +747,7 @@ format_file (char *dest, int limit, WPanel * panel, int file_index, int width, i tty_setcolor (SELECTED_COLOR); else tty_setcolor (NORMAL_COLOR); - tty_print_one_vline (); + tty_print_one_vline (TRUE); length++; } } @@ -803,7 +803,7 @@ repaint_file (WPanel * panel, int file_index, int mv, int attr, int isstatus) else { tty_setcolor (NORMAL_COLOR); - tty_print_one_vline (); + tty_print_one_vline (TRUE); } } } @@ -1515,7 +1515,7 @@ paint_frame (WPanel * panel) if (side) { tty_setcolor (NORMAL_COLOR); - tty_print_one_vline (); + tty_print_one_vline (TRUE); width = panel->widget.cols - panel->widget.cols / 2 - 1; } else if (panel->split) @@ -1551,7 +1551,7 @@ paint_frame (WPanel * panel) else { tty_setcolor (NORMAL_COLOR); - tty_print_one_vline (); + tty_print_one_vline (TRUE); width--; } } diff --git a/src/viewer/hex.c b/src/viewer/hex.c index b7fe88039..cae92e820 100644 --- a/src/viewer/hex.c +++ b/src/viewer/hex.c @@ -199,7 +199,7 @@ mcview_display_hex (mcview_t * view) { if (view->data_area.width >= 80 && col < width) { - tty_print_one_vline (); + tty_print_one_vline (TRUE); col += 1; } if (col < width) diff --git a/src/widget.c b/src/widget.c index f906a2562..34e9c4605 100644 --- a/src/widget.c +++ b/src/widget.c @@ -2254,14 +2254,14 @@ listbox_drawscroll (WListbox * l) /* Are we at the top? */ widget_move (&l->widget, 0, l->widget.cols); if (l->top == 0) - tty_print_one_vline (); + tty_print_one_vline (TRUE); else tty_print_char ('^'); /* Are we at the bottom? */ widget_move (&l->widget, max_line, l->widget.cols); if ((l->top + l->widget.lines == l->count) || (l->widget.lines >= l->count)) - tty_print_one_vline (); + tty_print_one_vline (TRUE); else tty_print_char ('v'); @@ -2273,7 +2273,7 @@ listbox_drawscroll (WListbox * l) { widget_move (&l->widget, i, l->widget.cols); if (i != line) - tty_print_one_vline (); + tty_print_one_vline (TRUE); else tty_print_char ('*'); }