Ticket #1648: implemented single-line boxes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Sergei E. Ovsyannikov 2010-03-17 22:19:03 +03:00 committed by Andrew Borodin
parent 3c19b9f002
commit d8fb069e85
19 changed files with 126 additions and 51 deletions

View File

@ -114,6 +114,18 @@ mc_skin_hardcoded_ugly_lines (mc_skin_t * mc_skin)
set_lines ("vert", "|");
set_lines ("thinhoriz", "-");
set_lines ("thinvert", "|");
set_lines ("grouplefttop", "+");
set_lines ("grouprighttop", "+");
set_lines ("groupcentertop", "-");
set_lines ("groupcenterbottom", "-");
set_lines ("groupleftbottom", "+");
set_lines ("grouprightbottom", "+");
set_lines ("groupleftmiddle", "|");
set_lines ("grouprightmiddle", "|");
set_lines ("groupcentermiddle", "+");
set_lines ("grouphoriz", "-");
set_lines ("groupvert", "|");
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -54,7 +54,7 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
ret = mc_tty_normalize_lines_char (frm_val);
g_free (frm_val);
/*
switch (ret) {
case 0x80:
ret = ACS_HLINE;
@ -86,7 +86,7 @@ mc_skin_lines_load_frm (mc_skin_t * mc_skin, const char *name)
default:
break;
}
*/
return ret;
}
@ -117,6 +117,17 @@ mc_skin_lines_parse_ini_file (mc_skin_t * mc_skin)
mc_tty_ugly_frm[MC_TTY_FRM_centermiddle] = mc_skin_lines_load_frm (mc_skin, "centermiddle");
mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle] = mc_skin_lines_load_frm (mc_skin, "leftmiddle");
mc_tty_ugly_frm[MC_TTY_FRM_grphoriz] = mc_skin_lines_load_frm (mc_skin, "grouphoriz");
mc_tty_ugly_frm[MC_TTY_FRM_grpvert] = mc_skin_lines_load_frm (mc_skin, "groupvert");
mc_tty_ugly_frm[MC_TTY_FRM_grplefttop] = mc_skin_lines_load_frm (mc_skin, "grouplefttop");
mc_tty_ugly_frm[MC_TTY_FRM_grprighttop] = mc_skin_lines_load_frm (mc_skin, "grouprighttop");
mc_tty_ugly_frm[MC_TTY_FRM_grpleftbottom] = mc_skin_lines_load_frm (mc_skin, "groupleftbottom");
mc_tty_ugly_frm[MC_TTY_FRM_grprightbottom] = mc_skin_lines_load_frm (mc_skin, "grouprightbottom");
mc_tty_ugly_frm[MC_TTY_FRM_grprightmiddle] = mc_skin_lines_load_frm (mc_skin, "grouprightmiddle");
mc_tty_ugly_frm[MC_TTY_FRM_grpcentertop] = mc_skin_lines_load_frm (mc_skin, "groupcentertop");
mc_tty_ugly_frm[MC_TTY_FRM_grpcenterbottom] = mc_skin_lines_load_frm (mc_skin, "groupcenterbottom");
mc_tty_ugly_frm[MC_TTY_FRM_grpcentermiddle] = mc_skin_lines_load_frm (mc_skin, "groupcentermiddle");
mc_tty_ugly_frm[MC_TTY_FRM_grpleftmiddle] = mc_skin_lines_load_frm (mc_skin, "groupleftmiddle");
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -496,7 +496,7 @@ tty_print_char (int c)
}
void
tty_print_alt_char (int c)
tty_print_alt_char (int c, gboolean single)
{
#define DRAW(x, y) (x == y) \
? SLsmg_draw_object (SLsmg_get_row(), SLsmg_get_column(), x) \
@ -509,25 +509,25 @@ tty_print_alt_char (int c)
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]);
break;
case ACS_LTEE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftmiddle]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grpleftmiddle : MC_TTY_FRM_leftmiddle]);
break;
case ACS_RTEE:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightmiddle]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grprightmiddle : MC_TTY_FRM_rightmiddle]);
break;
case ACS_ULCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_lefttop]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grplefttop : MC_TTY_FRM_lefttop]);
break;
case ACS_LLCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grpleftbottom : MC_TTY_FRM_leftbottom]);
break;
case ACS_URCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_righttop]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grprighttop : MC_TTY_FRM_righttop]);
break;
case ACS_LRCORNER:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grprightbottom : MC_TTY_FRM_rightbottom]);
break;
case ACS_PLUS:
DRAW (c, mc_tty_ugly_frm[MC_TTY_FRM_centermiddle]);
DRAW (c, mc_tty_ugly_frm[single ? MC_TTY_FRM_grpcentermiddle : MC_TTY_FRM_centermiddle]);
break;
default:
SLsmg_write_char ((unsigned int) c);

View File

@ -128,30 +128,45 @@ tty_got_interrupt (void)
void
tty_print_one_hline (void)
{
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz]);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinhoriz], FALSE);
}
void
tty_print_one_vline (void)
{
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert]);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_thinvert], FALSE);
}
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_ugly_frm[MC_TTY_FRM_vert], ys);
tty_draw_vline (y, x + xs - 1, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys);
tty_draw_hline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
tty_draw_hline (y + ys - 1, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
tty_gotoyx (y, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_lefttop]);
tty_gotoyx (y + ys - 1, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_leftbottom]);
tty_gotoyx (y, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_righttop]);
tty_gotoyx (y + ys - 1, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_rightbottom]);
if (single) {
tty_draw_vline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_grpvert], ys);
tty_draw_vline (y, x + xs - 1, mc_tty_ugly_frm[MC_TTY_FRM_grpvert], ys);
tty_draw_hline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_grphoriz], xs);
tty_draw_hline (y + ys - 1, x, mc_tty_ugly_frm[MC_TTY_FRM_grphoriz], xs);
tty_gotoyx (y, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_grplefttop], single);
tty_gotoyx (y + ys - 1, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_grpleftbottom], single);
tty_gotoyx (y, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_grprighttop], single);
tty_gotoyx (y + ys - 1, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_grprightbottom], single);
} else {
tty_draw_vline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys);
tty_draw_vline (y, x + xs - 1, mc_tty_ugly_frm[MC_TTY_FRM_vert], ys);
tty_draw_hline (y, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
tty_draw_hline (y + ys - 1, x, mc_tty_ugly_frm[MC_TTY_FRM_horiz], xs);
tty_gotoyx (y, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_lefttop], single);
tty_gotoyx (y + ys - 1, x);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_leftbottom], single);
tty_gotoyx (y, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_righttop], single);
tty_gotoyx (y + ys - 1, x + xs - 1);
tty_print_alt_char (mc_tty_ugly_frm[MC_TTY_FRM_rightbottom], single);
}
}
char *

View File

@ -66,7 +66,7 @@ extern void tty_set_alt_charset (gboolean alt_charset);
extern void tty_display_8bit (gboolean what);
extern void tty_print_char (int c);
extern void tty_print_alt_char (int c);
extern void tty_print_alt_char (int c, gboolean single);
extern void tty_print_anychar (int c);
extern void tty_print_string (const char *s);
extern void tty_printf (const char *s, ...);
@ -75,7 +75,7 @@ extern void tty_print_one_vline (void);
extern void tty_print_one_hline (void);
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_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_ugly_frm[];
@ -94,6 +94,19 @@ typedef enum {
MC_TTY_FRM_leftmiddle,
MC_TTY_FRM_rightmiddle,
MC_TTY_FRM_centermiddle,
MC_TTY_FRM_grpvert,
MC_TTY_FRM_grphoriz,
MC_TTY_FRM_grplefttop,
MC_TTY_FRM_grprighttop,
MC_TTY_FRM_grpleftbottom,
MC_TTY_FRM_grprightbottom,
MC_TTY_FRM_grpcentertop,
MC_TTY_FRM_grpcenterbottom,
MC_TTY_FRM_grpleftmiddle,
MC_TTY_FRM_grprightmiddle,
MC_TTY_FRM_grpcentermiddle,
MC_TTY_FRM_MAX
} mc_tty_frm_t;

View File

@ -16,6 +16,18 @@
thinhoriz=
thinvert=
grouplefttop=
grouprighttop=
groupcentertop=
groupcenterbottom=
groupleftbottom=
grouprightbottom=
groupleftmiddle=
grouprightmiddle=
groupcentermiddle=
grouphoriz=
groupvert=
[core]
_default_=lightgray;blue
selected=black;cyan

View File

@ -16,6 +16,18 @@
thinhoriz=
thinvert=
grouplefttop=
grouprighttop=
groupcentertop=
groupcenterbottom=
groupleftbottom=
grouprightbottom=
groupleftmiddle=
grouprightmiddle=
groupcentermiddle=
grouphoriz=
groupvert=
[core]
_default_=lightgray;blue
selected=black;cyan

View File

@ -131,8 +131,8 @@ static void chmod_refresh (Dlg_head *h)
tty_setcolor (COLOR_NORMAL);
draw_box (h, PY, PX, PERMISSIONS + 2, 33);
draw_box (h, FY, FX, 10, 25);
draw_box (h, PY, PX, PERMISSIONS + 2, 33, TRUE);
draw_box (h, FY, FX, 10, 25, TRUE);
dlg_move (h, FY + 1, FX + 2);
tty_print_string (_("Name"));

View File

@ -106,9 +106,9 @@ chown_refresh (Dlg_head * h)
tty_setcolor (COLOR_NORMAL);
draw_box (h, UY, UX, 12, 21);
draw_box (h, GY, GX, 12, 21);
draw_box (h, TY, TX, 12, 19);
draw_box (h, UY, UX, 12, 21, TRUE);
draw_box (h, GY, GX, 12, 21, TRUE);
draw_box (h, TY, TX, 12, 19, TRUE);
dlg_move (h, TY + 1, TX + 1);
tty_print_string (_(" Name "));

View File

@ -63,9 +63,9 @@ static void dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t message,
/* draw box in window */
void
draw_box (Dlg_head *h, int y, int x, int ys, int xs)
draw_box (Dlg_head *h, int y, int x, int ys, int xs, gboolean single)
{
tty_draw_box (h->y + y, h->x + x, ys, xs);
tty_draw_box (h->y + y, h->x + x, ys, xs, single);
}
void
@ -107,7 +107,7 @@ common_dialog_repaint (struct Dlg_head *h)
tty_setcolor (DLG_NORMALC (h));
dlg_erase (h);
draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space);
draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE);
if (h->title) {
tty_setcolor (DLG_HOT_NORMALC (h));

View File

@ -167,7 +167,7 @@ struct Widget {
};
/* draw box in window */
void draw_box (Dlg_head *h, int y, int x, int ys, int xs);
void draw_box (Dlg_head *h, int y, int x, int ys, int xs, gboolean single);
/* Flags for create_dlg: */
#define DLG_REVERSE (1 << 5) /* Tab order is opposite to the add order */

View File

@ -181,9 +181,9 @@ hotlist_refresh (Dlg_head * dlg)
common_dialog_repaint (dlg);
tty_setcolor (COLOR_NORMAL);
draw_box (dlg, 2, 5, dlg->lines - (hotlist_state.moving ? 6 : 10),
dlg->cols - (UX * 2));
dlg->cols - (UX * 2), TRUE);
if (!hotlist_state.moving)
draw_box (dlg, dlg->lines - 8, 5, 3, dlg->cols - (UX * 2));
draw_box (dlg, dlg->lines - 8, 5, 3, dlg->cols - (UX * 2), TRUE);
}
/* If current->data is 0, then we are dealing with a VFS pathname */

View File

@ -63,7 +63,7 @@ static void info_box (Dlg_head *h, struct WInfo *info)
tty_setcolor (NORMAL_COLOR);
widget_erase (&info->widget);
draw_box (h, info->widget.y, info->widget.x,
info->widget.lines, info->widget.cols);
info->widget.lines, info->widget.cols, FALSE);
}
static void

View File

@ -145,13 +145,13 @@ menubar_paint_idx (WMenuBar *menubar, unsigned int idx, int color)
tty_setcolor (MENU_ENTRY_COLOR);
widget_move (&menubar->widget, y, x - 1);
tty_print_alt_char (ACS_LTEE);
tty_print_alt_char (ACS_LTEE, TRUE);
tty_draw_hline (menubar->widget.y + y, menubar->widget.x + x,
ACS_HLINE, menu->max_entry_len + 3);
widget_move (&menubar->widget, y, x + menu->max_entry_len + 3);
tty_print_alt_char (ACS_RTEE);
tty_print_alt_char (ACS_RTEE, TRUE);
} else {
/* menu text */
tty_setcolor (color);
@ -194,7 +194,7 @@ menubar_draw_drop (WMenuBar *menubar)
tty_setcolor (MENU_ENTRY_COLOR);
draw_box (menubar->widget.parent,
menubar->widget.y + 1, menubar->widget.x + column,
count + 2, menu->max_entry_len + 5);
count + 2, menu->max_entry_len + 5, TRUE);
/* draw items except selected */
for (i = 0; i < count; i++)

View File

@ -115,7 +115,7 @@ panelize_callback (Dlg_head *h, Widget *sender,
case DLG_DRAW:
common_dialog_repaint (h);
tty_setcolor (COLOR_NORMAL);
draw_box (h, UY, UX, h->lines - 10, h->cols - 10);
draw_box (h, UY, UX, h->lines - 10, h->cols - 10, TRUE);
return MSG_HANDLED;
default:

View File

@ -984,14 +984,14 @@ show_dir (WPanel * panel)
gchar *tmp;
set_colors (panel);
draw_box (panel->widget.parent,
panel->widget.y, panel->widget.x, panel->widget.lines, panel->widget.cols);
panel->widget.y, panel->widget.x, panel->widget.lines, panel->widget.cols, FALSE);
if (show_mini_info)
{
widget_move (&panel->widget, llines (panel) + 2, 0);
tty_print_alt_char (ACS_LTEE);
tty_print_alt_char (ACS_LTEE, FALSE);
widget_move (&panel->widget, llines (panel) + 2, panel->widget.cols - 1);
tty_print_alt_char (ACS_RTEE);
tty_print_alt_char (ACS_RTEE, FALSE);
}
widget_move (&panel->widget, 0, 1);

View File

@ -990,7 +990,7 @@ tree_frame (Dlg_head *h, WTree *tree)
widget_erase ((Widget*) tree);
if (tree->is_panel) {
draw_box (h, tree->widget.y, tree->widget.x, tree->widget.lines,
tree->widget.cols);
tree->widget.cols, FALSE);
if (show_mini_info)
tty_draw_hline (tree->widget.y + tlines (tree) + 1,

View File

@ -342,7 +342,7 @@ mcview_display_clean (mcview_t * view)
widget_erase ((Widget *) view);
if (view->dpy_frame_size != 0)
{
tty_draw_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);
/* draw_double_box (view->widget.parent, view->widget.y,
view->widget.x, view->widget.lines, view->widget.cols); */
}

View File

@ -871,9 +871,9 @@ hline_callback (Widget * w, widget_msg_t msg, int parm)
if (l->auto_adjust_cols)
{
widget_move (w, 0, 0);
tty_print_alt_char (ACS_LTEE);
tty_print_alt_char (ACS_LTEE, FALSE);
widget_move (w, 0, w->cols - 1);
tty_print_alt_char (ACS_RTEE);
tty_print_alt_char (ACS_RTEE, FALSE);
}
return MSG_HANDLED;
@ -3022,7 +3022,7 @@ groupbox_callback (Widget * w, widget_msg_t msg, int parm)
case WIDGET_DRAW:
tty_setcolor (COLOR_NORMAL);
draw_box (g->widget.parent, g->widget.y - g->widget.parent->y,
g->widget.x - g->widget.parent->x, g->widget.lines, g->widget.cols);
g->widget.x - g->widget.parent->x, g->widget.lines, g->widget.cols, TRUE);
tty_setcolor (COLOR_HOT_NORMAL);
dlg_move (g->widget.parent, g->widget.y - g->widget.parent->y,