1
1

Skin support for window frames.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2011-10-28 13:57:00 +04:00
родитель 2bb6cb2a32
Коммит 4fa4e7568d
16 изменённых файлов: 128 добавлений и 34 удалений

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

@ -89,21 +89,25 @@
#define EDITOR_MARKED_COLOR mc_skin_color__cache[49] #define EDITOR_MARKED_COLOR mc_skin_color__cache[49]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[50] #define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[50]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[51] #define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[51]
#define EDITOR_BACKGROUND mc_skin_color__cache[52]
#define EDITOR_FRAME mc_skin_color__cache[53]
#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[54]
#define EDITOR_FRAME_DRAG mc_skin_color__cache[55]
/* color of left 8 char status per line */ /* color of left 8 char status per line */
#define LINE_STATE_COLOR mc_skin_color__cache[52] #define LINE_STATE_COLOR mc_skin_color__cache[56]
#define BOOK_MARK_COLOR mc_skin_color__cache[53] #define BOOK_MARK_COLOR mc_skin_color__cache[57]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[54] #define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[58]
/* Diff colors */ /* Diff colors */
#define DFF_ADD_COLOR mc_skin_color__cache[55] #define DFF_ADD_COLOR mc_skin_color__cache[59]
#define DFF_CHG_COLOR mc_skin_color__cache[56] #define DFF_CHG_COLOR mc_skin_color__cache[60]
#define DFF_CHH_COLOR mc_skin_color__cache[57] #define DFF_CHH_COLOR mc_skin_color__cache[61]
#define DFF_CHD_COLOR mc_skin_color__cache[58] #define DFF_CHD_COLOR mc_skin_color__cache[62]
#define DFF_DEL_COLOR mc_skin_color__cache[59] #define DFF_DEL_COLOR mc_skin_color__cache[63]
#define DFF_FOLDER_COLOR mc_skin_color__cache[60] #define DFF_FOLDER_COLOR mc_skin_color__cache[64]
#define DFF_ERROR_COLOR mc_skin_color__cache[61] #define DFF_ERROR_COLOR mc_skin_color__cache[65]
#define MC_SKIN_COLOR_CACHE_COUNT 62 #define MC_SKIN_COLOR_CACHE_COUNT 66
/*** enums ***************************************************************************************/ /*** enums ***************************************************************************************/

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

@ -2,12 +2,13 @@
Skins engine. Skins engine.
Work with colors - backward compability Work with colors - backward compability
Copyright (C) 2009, 2010, 2011 Copyright (C) 2009, 2010, 2011, 2012
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2009 Slava Zanko <slavazanko@gmail.com>, 2009
Egmont Koblinger <egmont@gmail.com>, 2010 Egmont Koblinger <egmont@gmail.com>, 2010
Andrew Borodin <aborodin@vmail.ru>, 2012
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -59,7 +60,11 @@ static const mc_skin_colors_old_t old_colors[] = {
{"dhotnormal", "dialog", "dhotnormal"}, {"dhotnormal", "dialog", "dhotnormal"},
{"disabled", "core", "disabled"}, {"disabled", "core", "disabled"},
{"dnormal", "dialog", "_default_"}, {"dnormal", "dialog", "_default_"},
{"editbg", "editor", "editbg"},
{"editbold", "editor", "editbold"}, {"editbold", "editor", "editbold"},
{"editframe", "editor", "editframe"},
{"editframeactive", "editor", "editframeactive"},
{"editframedrag", "editor", "editframedrag"},
{"editlinestate", "editor", "editlinestate"}, {"editlinestate", "editor", "editlinestate"},
{"editmarked", "editor", "editmarked"}, {"editmarked", "editor", "editmarked"},
{"editnormal", "editor", "_default_"}, {"editnormal", "editor", "_default_"},

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

@ -2,12 +2,13 @@
Skins engine. Skins engine.
Work with colors Work with colors
Copyright (C) 2009, 2010, 2011 Copyright (C) 2009, 2010, 2011, 2012
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2009 Slava Zanko <slavazanko@gmail.com>, 2009
Egmont Koblinger <egmont@gmail.com>, 2010 Egmont Koblinger <egmont@gmail.com>, 2010
Andrew Borodin <aborodin@vmail.ru>, 2012
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -241,6 +242,10 @@ mc_skin_color_cache_init (void)
EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace"); EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace");
EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin"); EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin");
LINE_STATE_COLOR = mc_skin_color_get ("editor", "editlinestate"); LINE_STATE_COLOR = mc_skin_color_get ("editor", "editlinestate");
EDITOR_BACKGROUND = mc_skin_color_get ("editor", "editbg");
EDITOR_FRAME = mc_skin_color_get ("editor", "editframe");
EDITOR_FRAME_ACTIVE = mc_skin_color_get ("editor", "editframeactive");
EDITOR_FRAME_DRAG = mc_skin_color_get ("editor", "editframedrag");
BOOK_MARK_COLOR = mc_skin_color_get ("editor", "bookmark"); BOOK_MARK_COLOR = mc_skin_color_get ("editor", "bookmark");
BOOK_MARK_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound"); BOOK_MARK_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound");

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

@ -2,11 +2,12 @@
Skins engine. Skins engine.
Set of hardcoded skins Set of hardcoded skins
Copyright (C) 2009, 2011 Copyright (C) 2009, 2011, 2012
The Free Software Foundation, Inc. The Free Software Foundation, Inc.
Written by: Written by:
Slava Zanko <slavazanko@gmail.com>, 2009. Slava Zanko <slavazanko@gmail.com>, 2009
Andrew Borodin <aborodin@vmail.ru>, 2012
This file is part of the Midnight Commander. This file is part of the Midnight Commander.
@ -75,6 +76,8 @@ mc_skin_hardcoded_blackwhite_colors (mc_skin_t * mc_skin)
mc_config_set_string (mc_skin->config, "viewer", "viewunderline", "A_UNDERLINE"); mc_config_set_string (mc_skin->config, "viewer", "viewunderline", "A_UNDERLINE");
mc_config_set_string (mc_skin->config, "editor", "editbold", "A_BOLD"); mc_config_set_string (mc_skin->config, "editor", "editbold", "A_BOLD");
mc_config_set_string (mc_skin->config, "editor", "editmarked", "A_REVERSE"); mc_config_set_string (mc_skin->config, "editor", "editmarked", "A_REVERSE");
mc_config_set_string (mc_skin->config, "editor", "editframeactive", "A_BOLD");
mc_config_set_string (mc_skin->config, "editor", "editframedrag", "A_REVERSE");
mc_config_set_string (mc_skin->config, "buttonbar", "hotkey", "default"); mc_config_set_string (mc_skin->config, "buttonbar", "hotkey", "default");
mc_config_set_string (mc_skin->config, "buttonbar", "button", "A_REVERSE"); mc_config_set_string (mc_skin->config, "buttonbar", "button", "A_REVERSE");
} }

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

@ -95,6 +95,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=white;blue editrightmargin=white;blue
# editbg=
editframe=gray;
editframeactive=lightgray;
editframedrag=red;
[viewer] [viewer]
viewbold=yellow;black viewbold=yellow;black

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

@ -95,6 +95,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=white;blue editrightmargin=white;blue
# editbg=
editframe=gray;
editframeactive=lightgray;
editframedrag=white;
[viewer] [viewer]
viewbold=yellow;black viewbold=yellow;black

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

@ -103,6 +103,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;black editrightmargin=brightblue;black
# editbg=lightgray;
# editframe=lightgray;
editframeactive=white;
editframedrag=green;
[viewer] [viewer]
viewbold=yellow;blue viewbold=yellow;blue

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

@ -102,6 +102,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;black editrightmargin=brightblue;black
# editbg=
# editframe=
editframeactive=white;
editframedrag=green;
[viewer] [viewer]
viewbold=yellow;blue viewbold=yellow;blue

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

@ -104,6 +104,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;black editrightmargin=brightblue;black
# editbg=
# editframe=
editframeactive=lightgray;
editframedrag=cyan;
[viewer] [viewer]
viewbold=yellow;blue viewbold=yellow;blue

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

@ -99,6 +99,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;blue editrightmargin=brightblue;blue
# editbg=
# editframe=
editframeactive=white;
editframedrag=green;
[viewer] [viewer]
viewbold=brightred;black viewbold=brightred;black

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

@ -94,6 +94,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;black editrightmargin=brightblue;black
# editbg=
# editframe=
editframeactive=lightgray;
editframedrag=cyan;
[viewer] [viewer]
viewbold=yellow;blue viewbold=yellow;blue

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

@ -102,6 +102,10 @@
bookmark=white;red bookmark=white;red
bookmarkfound=black;green bookmarkfound=black;green
editrightmargin=brightblue;black editrightmargin=brightblue;black
# editbg=
editframe=gray;
editframeactive=lightgray;
editframedrag=brightblue;
[viewer] [viewer]
viewbold=brown;blue viewbold=brown;blue

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

@ -159,6 +159,10 @@
bookmark=;rgb551 bookmark=;rgb551
bookmarkfound=;rgb530 bookmarkfound=;rgb530
editrightmargin=rgb400;rgb553 editrightmargin=rgb400;rgb553
# editbg=
editframe=rgb530;
editframeactive=black;
editframedrag=rgb400;
[viewer] [viewer]
viewunderline=;;underline viewunderline=;;underline

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

@ -148,6 +148,10 @@
bookmark=;color239; bookmark=;color239;
bookmarkfound=;color239;bold bookmarkfound=;color239;bold
editrightmargin=color180;color235;bold editrightmargin=color180;color235;bold
# editbg=
editframe=color244;
editframeactive=color250;
editframedrag=color73;
[viewer] [viewer]
viewunderline=;;underline viewunderline=;;underline

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

@ -362,7 +362,8 @@ mc_args_new_color_group (void)
" Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n" " Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
" Popup menus: pmenunormal, pmenusel, pmenutitle\n" " Popup menus: pmenunormal, pmenusel, pmenutitle\n"
" Editor: editnormal, editbold, editmarked, editwhitespace,\n" " Editor: editnormal, editbold, editmarked, editwhitespace,\n"
" editlinestate\n" " editlinestate, editbg, editframe, editframeactive\n"
" editframedrag\n"
" Viewer: viewbold, viewunderline, viewselected\n" " Viewer: viewbold, viewunderline, viewselected\n"
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"), " Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"),
/* TRANSLATORS: don't translate color names and attributes */ /* TRANSLATORS: don't translate color names and attributes */

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

@ -145,22 +145,34 @@ edit_help (void)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void static void
edit_draw_frame (const WEdit * edit) edit_draw_frame (const WEdit * edit, gboolean active)
{ {
const Widget *w = (const Widget *) edit; const Widget *w = (const Widget *) edit;
tty_setcolor (EDITOR_NORMAL_COLOR);
if (edit->fullscreen) if (edit->fullscreen)
{ {
tty_setcolor (active ? EDITOR_FRAME_ACTIVE : EDITOR_FRAME);
/* draw lines at top and bottom */ /* draw lines at top and bottom */
tty_draw_hline (w->y, w->x, ACS_HLINE, w->cols); /* draw double lines for active window if skin supports that */
tty_draw_hline (w->y + w->lines - 1, w->x, ACS_HLINE, w->cols); tty_draw_hline (w->y, w->x, mc_tty_frm[!active ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ],
w->cols);
tty_draw_hline (w->y + w->lines - 1, w->x,
mc_tty_frm[!active ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], w->cols);
} }
else else
{ {
/* draw a frame around edit area */ /* draw a frame around edit area */
tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE); tty_setcolor (edit->drag_state != MCEDIT_DRAG_NORMAL ? EDITOR_FRAME_DRAG :
active ? EDITOR_FRAME_ACTIVE : EDITOR_FRAME);
/* draw double frame for active window if skin supports that */
tty_draw_box (w->y, w->x, w->lines, w->cols, !active);
/* draw a drag marker */
if (edit->drag_state == MCEDIT_DRAG_NORMAL)
{
tty_setcolor (EDITOR_FRAME_DRAG);
widget_move (w, w->lines - 1, w->cols - 1);
tty_print_alt_char (ACS_LRCORNER, TRUE);
}
} }
} }
@ -411,20 +423,24 @@ edit_event (Gpm_Event * event, void *data)
else if (local.y == 1 && edit->drag_state != MCEDIT_DRAG_RESIZE) else if (local.y == 1 && edit->drag_state != MCEDIT_DRAG_RESIZE)
{ {
/* click on the top line (move) */ /* click on the top line (move) */
/* start move; save x coordinate of mouse */
if ((local.type & GPM_DOWN) != 0)
edit->drag_state_start = local.x;
/* move if not fullscreen */ /* move if not fullscreen */
if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0) if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0)
{
edit->drag_state_start = local.x;
edit->drag_state = MCEDIT_DRAG_MOVE; edit->drag_state = MCEDIT_DRAG_MOVE;
edit->force |= REDRAW_COMPLETELY;
edit_update_screen (edit);
}
} }
else if (!edit->fullscreen && local.y == w->lines && local.x == w->cols) else if (!edit->fullscreen && local.y == w->lines && local.x == w->cols)
{ {
/* click on bottom-right corner (resize) */ /* click on bottom-right corner (resize) */
if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0) if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0)
{
edit->drag_state = MCEDIT_DRAG_RESIZE; edit->drag_state = MCEDIT_DRAG_RESIZE;
edit->force |= REDRAW_COMPLETELY;
edit_update_screen (edit);
}
} }
if (edit->drag_state == MCEDIT_DRAG_NORMAL) if (edit->drag_state == MCEDIT_DRAG_NORMAL)
@ -551,9 +567,16 @@ edit_event (Gpm_Event * event, void *data)
/* double click on top line (toggle fullscreen) */ /* double click on top line (toggle fullscreen) */
edit_toggle_fullscreen (edit); edit_toggle_fullscreen (edit);
edit->drag_state = MCEDIT_DRAG_NORMAL; edit->drag_state = MCEDIT_DRAG_NORMAL;
edit->force |= REDRAW_COMPLETELY;
edit_update_screen (edit);
} }
else if ((event->type & (GPM_DRAG | GPM_DOWN)) == 0) else if ((event->type & (GPM_DRAG | GPM_DOWN)) == 0)
{
/* redraw frame */
edit->drag_state = MCEDIT_DRAG_NORMAL; edit->drag_state = MCEDIT_DRAG_NORMAL;
edit->force |= REDRAW_COMPLETELY;
edit_update_screen (edit);
}
else if (!edit->fullscreen) else if (!edit->fullscreen)
{ {
Dlg_head *h = w->owner; Dlg_head *h = w->owner;
@ -569,7 +592,7 @@ edit_event (Gpm_Event * event, void *data)
/* don't use widget_set_size() here to avoid double draw */ /* don't use widget_set_size() here to avoid double draw */
w->y = y; w->y = y;
w->x = x - edit->drag_state_start; w->x = x - edit->drag_state_start;
edit->force |= REDRAW_PAGE; edit->force |= REDRAW_COMPLETELY;
} }
else if (edit->drag_state == MCEDIT_DRAG_RESIZE) else if (edit->drag_state == MCEDIT_DRAG_RESIZE)
{ {
@ -757,7 +780,7 @@ edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, vo
{ {
case DLG_DRAW: case DLG_DRAW:
/* don't use common_dialog_repaint() -- we don't need a frame */ /* don't use common_dialog_repaint() -- we don't need a frame */
tty_setcolor (EDITOR_NORMAL_COLOR); tty_setcolor (EDITOR_BACKGROUND);
dlg_erase (h); dlg_erase (h);
return MSG_HANDLED; return MSG_HANDLED;
@ -845,15 +868,22 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
{ {
case WIDGET_FOCUS: case WIDGET_FOCUS:
edit_set_buttonbar (e, find_buttonbar (e->widget.owner)); edit_set_buttonbar (e, find_buttonbar (e->widget.owner));
e->force |= REDRAW_PAGE; /* fall through */
edit_update_screen (e);
return MSG_HANDLED;
case WIDGET_DRAW: case WIDGET_DRAW:
e->force |= REDRAW_COMPLETELY; e->force |= REDRAW_COMPLETELY;
edit_update_screen (e); edit_update_screen (e);
return MSG_HANDLED; return MSG_HANDLED;
case WIDGET_UNFOCUS:
if (!EDIT_WITH_FRAME)
return MSG_NOT_HANDLED;
/* redraw frame and status */
edit_draw_frame (e, FALSE);
edit_info_status (e);
return MSG_HANDLED;
case WIDGET_KEY: case WIDGET_KEY:
{ {
int cmd, ch; int cmd, ch;
@ -999,7 +1029,7 @@ edit_update_screen (WEdit * e)
else else
{ {
if ((e->force & REDRAW_COMPLETELY) != 0) if ((e->force & REDRAW_COMPLETELY) != 0)
edit_draw_frame (e); edit_draw_frame (e, (void *) e == ((Widget *) e)->owner->current->data);
edit_info_status (e); edit_info_status (e);
} }
@ -1009,7 +1039,7 @@ edit_update_screen (WEdit * e)
e->force |= REDRAW_PAGE; e->force |= REDRAW_PAGE;
else else
{ {
if (e->force & REDRAW_COMPLETELY) if ((e->force & REDRAW_COMPLETELY) != 0)
e->force |= REDRAW_PAGE; e->force |= REDRAW_PAGE;
edit_render_keypress (e); edit_render_keypress (e);
} }
@ -1127,6 +1157,9 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
case CK_Enter: case CK_Enter:
case CK_WindowMove: case CK_WindowMove:
edit->drag_state = MCEDIT_DRAG_NORMAL; edit->drag_state = MCEDIT_DRAG_NORMAL;
/* redraw frame and status */
edit_draw_frame (edit, TRUE);
edit_info_status (edit);
default: default:
ret = TRUE; ret = TRUE;
break; break;
@ -1150,6 +1183,9 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
case CK_Enter: case CK_Enter:
case CK_WindowResize: case CK_WindowResize:
edit->drag_state = MCEDIT_DRAG_NORMAL; edit->drag_state = MCEDIT_DRAG_NORMAL;
/* redraw frame and status */
edit_draw_frame (edit, TRUE);
edit_info_status (edit);
default: default:
ret = TRUE; ret = TRUE;
break; break;