Use tty_draw_box instead of draw_box() to draw frames.

* (draw_box): remove.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-04-23 14:10:20 +04:00 committed by Slava Zanko
parent a35ee6aebc
commit 6d31d85f0d
7 changed files with 19 additions and 26 deletions

View File

@ -2,7 +2,7 @@
Dialog box features module for the Midnight Commander Dialog box features module for the Midnight Commander
Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, Copyright (C) 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2007, 2009, 2010, 2011 2005, 2007, 2009, 2010, 2011, 2013
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -587,17 +587,6 @@ dlg_find_widget_by_id (gconstpointer a, gconstpointer b)
/*** public functions ****************************************************************************/ /*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
/** draw box in window */
void
draw_box (const WDialog * h, int y, int x, int ys, int xs, gboolean single)
{
const Widget *wh = WIDGET (h);
tty_draw_box (wh->y + y, wh->x + x, ys, xs, single);
}
/* --------------------------------------------------------------------------------------------- */
/** Clean the dialog area, draw the frame and the title */ /** Clean the dialog area, draw the frame and the title */
void void
dlg_default_repaint (WDialog * h) dlg_default_repaint (WDialog * h)
@ -613,7 +602,7 @@ dlg_default_repaint (WDialog * h)
tty_setcolor (h->color[DLG_COLOR_NORMAL]); tty_setcolor (h->color[DLG_COLOR_NORMAL]);
dlg_erase (h); dlg_erase (h);
draw_box (h, space, space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE); tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE);
if (h->title != NULL) if (h->title != NULL)
{ {

View File

@ -124,9 +124,6 @@ extern const global_keymap_t *dialog_map;
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
/* draw box in window */
void draw_box (const WDialog * h, int y, int x, int ys, int xs, gboolean single);
/* Creates a dialog head */ /* Creates a dialog head */
WDialog *create_dlg (gboolean modal, int y1, int x1, int lines, int cols, WDialog *create_dlg (gboolean modal, int y1, int x1, int lines, int cols,
const int *colors, widget_cb_fn callback, mouse_h mouse_handler, const int *colors, widget_cb_fn callback, mouse_h mouse_handler,

View File

@ -2,7 +2,7 @@
Widgets for the Midnight Commander Widgets for the Midnight Commander
Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, Copyright (C) 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2009, 2010, 2011 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
Authors: Authors:
@ -11,7 +11,7 @@
Jakub Jelinek, 1995 Jakub Jelinek, 1995
Andrej Borsenkow, 1996 Andrej Borsenkow, 1996
Norbert Warmuth, 1997 Norbert Warmuth, 1997
Andrew Borodin <aborodin@vmail.ru>, 2009, 2010 Andrew Borodin <aborodin@vmail.ru>, 2009, 2010, 2013
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -67,16 +67,18 @@ groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
case MSG_DRAW: case MSG_DRAW:
{ {
Widget *wo = WIDGET (w->owner); gboolean disabled;
gboolean disabled = (w->options & W_DISABLED) != 0; disabled = (w->options & W_DISABLED) != 0;
tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL); tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL);
draw_box (w->owner, w->y - wo->y, w->x - wo->x, w->lines, w->cols, TRUE); tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE);
if (g->title != NULL) if (g->title != NULL)
{ {
Widget *wo = WIDGET (w->owner);
tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE); tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE);
widget_move (w->owner, w->y - wo->y, w->x - wo->x + 1); widget_move (wo, w->y - wo->y, w->x - wo->x + 1);
tty_print_string (g->title); tty_print_string (g->title);
} }
return MSG_HANDLED; return MSG_HANDLED;

View File

@ -188,7 +188,7 @@ menubar_draw_drop (WMenuBar * menubar)
column = w->cols - menu->max_entry_len - 5; column = w->cols - menu->max_entry_len - 5;
tty_setcolor (MENU_ENTRY_COLOR); tty_setcolor (MENU_ENTRY_COLOR);
draw_box (w->owner, w->y + 1, w->x + column, count + 2, menu->max_entry_len + 5, FALSE); tty_draw_box (w->y + 1, w->x + column, count + 2, menu->max_entry_len + 5, FALSE);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
menubar_paint_idx (menubar, i, menubar_paint_idx (menubar, i,

View File

@ -7,6 +7,7 @@
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2013 Slava Zanko <slavazanko@gmail.com>, 2013
Andrew Borodin <aborodin@vmail.ru>, 2013
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -86,7 +87,7 @@ info_box (WInfo * info)
tty_set_normal_attrs (); tty_set_normal_attrs ();
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
widget_erase (w); widget_erase (w);
draw_box (w->owner, w->y, w->x, w->lines, w->cols, FALSE); tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);
widget_move (w, 0, (w->cols - len - 2) / 2); widget_move (w, 0, (w->cols - len - 2) / 2);
tty_printf (" %s ", title); tty_printf (" %s ", title);

View File

@ -9,6 +9,7 @@
Miguel de Icaza, 1995 Miguel de Icaza, 1995
Timur Bakeyev, 1997, 1999 Timur Bakeyev, 1997, 1999
Slava Zanko <slavazanko@gmail.com>, 2013 Slava Zanko <slavazanko@gmail.com>, 2013
Andrew Borodin <aborodin@vmail.ru>, 2013
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -1247,7 +1248,7 @@ show_dir (WPanel * panel)
gchar *tmp; gchar *tmp;
set_colors (panel); set_colors (panel);
draw_box (w->owner, w->y, w->x, w->lines, w->cols, FALSE); tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);
if (panels_options.show_mini_info) if (panels_options.show_mini_info)
{ {

View File

@ -15,6 +15,7 @@
Norbert Warmuth, 1997 Norbert Warmuth, 1997
Miguel de Icaza, 1996, 1999 Miguel de Icaza, 1996, 1999
Slava Zanko <slavazanko@gmail.com>, 2013 Slava Zanko <slavazanko@gmail.com>, 2013
Andrew Borodin <aborodin@vmail.ru>, 2013
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -1157,6 +1158,8 @@ tree_frame (WDialog * h, WTree * tree)
{ {
Widget *w = WIDGET (tree); Widget *w = WIDGET (tree);
(void) h;
tty_setcolor (NORMAL_COLOR); tty_setcolor (NORMAL_COLOR);
widget_erase (w); widget_erase (w);
if (tree->is_panel) if (tree->is_panel)
@ -1164,7 +1167,7 @@ tree_frame (WDialog * h, WTree * tree)
const char *title = _("Directory tree"); const char *title = _("Directory tree");
const int len = str_term_width1 (title); const int len = str_term_width1 (title);
draw_box (h, w->y, w->x, w->lines, w->cols, FALSE); tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);
widget_move (w, 0, (w->cols - len - 2) / 2); widget_move (w, 0, (w->cols - len - 2) / 2);
tty_printf (" %s ", title); tty_printf (" %s ", title);