From b0be11acd51a0776cf19e217147a4f1e8df01dae Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Mon, 22 Mar 2010 21:55:10 +0300 Subject: [PATCH] Merged tty_draw_double_box() function into tty_draw_box() one. Signed-off-by: Andrew Borodin --- lib/tty/tty.c | 35 +++++++++-------------------------- lib/tty/tty.h | 3 +-- src/dialog.c | 5 +---- src/viewer/display.c | 2 +- 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/lib/tty/tty.c b/lib/tty/tty.c index 9f9a824ab..c4625b310 100644 --- a/lib/tty/tty.c +++ b/lib/tty/tty.c @@ -138,37 +138,20 @@ tty_print_one_vline (gboolean single) } void -tty_draw_box (int y, int x, int ys, int xs) +tty_draw_box (int y, int x, int ys, int xs, gboolean single) { - tty_draw_vline (y, x, mc_tty_frm[MC_TTY_FRM_VERT], ys); - tty_draw_vline (y, x + xs - 1, mc_tty_frm[MC_TTY_FRM_VERT], ys); - tty_draw_hline (y, x, mc_tty_frm[MC_TTY_FRM_HORIZ], xs); - tty_draw_hline (y + ys - 1, x, mc_tty_frm[MC_TTY_FRM_HORIZ], xs); + tty_draw_vline (y, x, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys); + tty_draw_vline (y, x + xs - 1, mc_tty_frm[single ? MC_TTY_FRM_VERT : MC_TTY_FRM_DVERT], ys); + tty_draw_hline (y, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs); + tty_draw_hline (y + ys - 1, x, mc_tty_frm[single ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], xs); tty_gotoyx (y, x); - tty_print_alt_char (ACS_ULCORNER, TRUE); + tty_print_alt_char (ACS_ULCORNER, single); tty_gotoyx (y + ys - 1, x); - tty_print_alt_char (ACS_LLCORNER, TRUE); + tty_print_alt_char (ACS_LLCORNER, single); tty_gotoyx (y, x + xs - 1); - tty_print_alt_char (ACS_URCORNER, TRUE); + tty_print_alt_char (ACS_URCORNER, single); tty_gotoyx (y + ys - 1, x + xs - 1); - tty_print_alt_char (ACS_LRCORNER, TRUE); -} - -void -tty_draw_double_box (int y, int x, int ys, int xs) -{ - tty_draw_vline (y, x, mc_tty_frm[MC_TTY_FRM_DVERT], ys); - tty_draw_vline (y, x + xs - 1, mc_tty_frm[MC_TTY_FRM_DVERT], ys); - tty_draw_hline (y, x, mc_tty_frm[MC_TTY_FRM_DHORIZ], xs); - tty_draw_hline (y + ys - 1, x, mc_tty_frm[MC_TTY_FRM_DHORIZ], xs); - tty_gotoyx (y, x); - tty_print_alt_char (ACS_ULCORNER, FALSE); - tty_gotoyx (y + ys - 1, x); - tty_print_alt_char (ACS_LLCORNER], FALSE); - tty_gotoyx (y, x + xs - 1); - tty_print_alt_char (ACS_URCORNER, FALSE); - tty_gotoyx (y + ys - 1, x + xs - 1); - tty_print_alt_char (ACS_LRCORNER, FALSE); + tty_print_alt_char (ACS_LRCORNER, single); } char * diff --git a/lib/tty/tty.h b/lib/tty/tty.h index 67c65e4b1..b93bd6c3c 100644 --- a/lib/tty/tty.h +++ b/lib/tty/tty.h @@ -75,8 +75,7 @@ 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); -extern void tty_draw_double_box (int y, int x, int rows, int cols); +extern void tty_draw_box (int y, int x, int rows, int cols, gboolean single); extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch); extern int mc_tty_frm[]; diff --git a/src/dialog.c b/src/dialog.c index 2c3139e06..e10232695 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -65,10 +65,7 @@ static void dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t message, void draw_box (Dlg_head *h, int y, int x, int ys, int xs, gboolean single) { - if (single) - tty_draw_box (h->y + y, h->x + x, ys, xs); - else - tty_draw_double_box (h->y + y, h->x + x, ys, xs); + tty_draw_box (h->y + y, h->x + x, ys, xs, single); } void diff --git a/src/viewer/display.c b/src/viewer/display.c index decd356d3..d7c0e85ce 100644 --- a/src/viewer/display.c +++ b/src/viewer/display.c @@ -341,7 +341,7 @@ mcview_display_clean (mcview_t * view) tty_setcolor (NORMAL_COLOR); widget_erase ((Widget *) view); if (view->dpy_frame_size != 0) - tty_draw_double_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols); + tty_draw_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols, FALSE); } /* --------------------------------------------------------------------------------------------- */