Skin support for window frames.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
2bb6cb2a32
Коммит
4fa4e7568d
26
lib/skin.h
26
lib/skin.h
@ -89,21 +89,25 @@
|
||||
#define EDITOR_MARKED_COLOR mc_skin_color__cache[49]
|
||||
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[50]
|
||||
#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 */
|
||||
#define LINE_STATE_COLOR mc_skin_color__cache[52]
|
||||
#define BOOK_MARK_COLOR mc_skin_color__cache[53]
|
||||
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[54]
|
||||
#define LINE_STATE_COLOR mc_skin_color__cache[56]
|
||||
#define BOOK_MARK_COLOR mc_skin_color__cache[57]
|
||||
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[58]
|
||||
|
||||
/* Diff colors */
|
||||
#define DFF_ADD_COLOR mc_skin_color__cache[55]
|
||||
#define DFF_CHG_COLOR mc_skin_color__cache[56]
|
||||
#define DFF_CHH_COLOR mc_skin_color__cache[57]
|
||||
#define DFF_CHD_COLOR mc_skin_color__cache[58]
|
||||
#define DFF_DEL_COLOR mc_skin_color__cache[59]
|
||||
#define DFF_FOLDER_COLOR mc_skin_color__cache[60]
|
||||
#define DFF_ERROR_COLOR mc_skin_color__cache[61]
|
||||
#define DFF_ADD_COLOR mc_skin_color__cache[59]
|
||||
#define DFF_CHG_COLOR mc_skin_color__cache[60]
|
||||
#define DFF_CHH_COLOR mc_skin_color__cache[61]
|
||||
#define DFF_CHD_COLOR mc_skin_color__cache[62]
|
||||
#define DFF_DEL_COLOR mc_skin_color__cache[63]
|
||||
#define DFF_FOLDER_COLOR mc_skin_color__cache[64]
|
||||
#define DFF_ERROR_COLOR mc_skin_color__cache[65]
|
||||
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 62
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 66
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
|
@ -2,12 +2,13 @@
|
||||
Skins engine.
|
||||
Work with colors - backward compability
|
||||
|
||||
Copyright (C) 2009, 2010, 2011
|
||||
Copyright (C) 2009, 2010, 2011, 2012
|
||||
The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2012
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
@ -59,7 +60,11 @@ static const mc_skin_colors_old_t old_colors[] = {
|
||||
{"dhotnormal", "dialog", "dhotnormal"},
|
||||
{"disabled", "core", "disabled"},
|
||||
{"dnormal", "dialog", "_default_"},
|
||||
{"editbg", "editor", "editbg"},
|
||||
{"editbold", "editor", "editbold"},
|
||||
{"editframe", "editor", "editframe"},
|
||||
{"editframeactive", "editor", "editframeactive"},
|
||||
{"editframedrag", "editor", "editframedrag"},
|
||||
{"editlinestate", "editor", "editlinestate"},
|
||||
{"editmarked", "editor", "editmarked"},
|
||||
{"editnormal", "editor", "_default_"},
|
||||
|
@ -2,12 +2,13 @@
|
||||
Skins engine.
|
||||
Work with colors
|
||||
|
||||
Copyright (C) 2009, 2010, 2011
|
||||
Copyright (C) 2009, 2010, 2011, 2012
|
||||
The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009
|
||||
Egmont Koblinger <egmont@gmail.com>, 2010
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2012
|
||||
|
||||
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_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin");
|
||||
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_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound");
|
||||
|
@ -2,11 +2,12 @@
|
||||
Skins engine.
|
||||
Set of hardcoded skins
|
||||
|
||||
Copyright (C) 2009, 2011
|
||||
Copyright (C) 2009, 2011, 2012
|
||||
The Free Software Foundation, Inc.
|
||||
|
||||
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.
|
||||
|
||||
@ -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, "editor", "editbold", "A_BOLD");
|
||||
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", "button", "A_REVERSE");
|
||||
}
|
||||
|
@ -95,6 +95,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=white;blue
|
||||
# editbg=
|
||||
editframe=gray;
|
||||
editframeactive=lightgray;
|
||||
editframedrag=red;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;black
|
||||
|
@ -95,6 +95,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=white;blue
|
||||
# editbg=
|
||||
editframe=gray;
|
||||
editframeactive=lightgray;
|
||||
editframedrag=white;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;black
|
||||
|
@ -103,6 +103,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
# editbg=lightgray;
|
||||
# editframe=lightgray;
|
||||
editframeactive=white;
|
||||
editframedrag=green;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;blue
|
||||
|
@ -102,6 +102,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
# editbg=
|
||||
# editframe=
|
||||
editframeactive=white;
|
||||
editframedrag=green;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;blue
|
||||
|
@ -104,6 +104,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
# editbg=
|
||||
# editframe=
|
||||
editframeactive=lightgray;
|
||||
editframedrag=cyan;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;blue
|
||||
|
@ -99,6 +99,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;blue
|
||||
# editbg=
|
||||
# editframe=
|
||||
editframeactive=white;
|
||||
editframedrag=green;
|
||||
|
||||
[viewer]
|
||||
viewbold=brightred;black
|
||||
|
@ -94,6 +94,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
# editbg=
|
||||
# editframe=
|
||||
editframeactive=lightgray;
|
||||
editframedrag=cyan;
|
||||
|
||||
[viewer]
|
||||
viewbold=yellow;blue
|
||||
|
@ -102,6 +102,10 @@
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
# editbg=
|
||||
editframe=gray;
|
||||
editframeactive=lightgray;
|
||||
editframedrag=brightblue;
|
||||
|
||||
[viewer]
|
||||
viewbold=brown;blue
|
||||
|
@ -159,6 +159,10 @@
|
||||
bookmark=;rgb551
|
||||
bookmarkfound=;rgb530
|
||||
editrightmargin=rgb400;rgb553
|
||||
# editbg=
|
||||
editframe=rgb530;
|
||||
editframeactive=black;
|
||||
editframedrag=rgb400;
|
||||
|
||||
[viewer]
|
||||
viewunderline=;;underline
|
||||
|
@ -148,6 +148,10 @@
|
||||
bookmark=;color239;
|
||||
bookmarkfound=;color239;bold
|
||||
editrightmargin=color180;color235;bold
|
||||
# editbg=
|
||||
editframe=color244;
|
||||
editframeactive=color250;
|
||||
editframedrag=color73;
|
||||
|
||||
[viewer]
|
||||
viewunderline=;;underline
|
||||
|
@ -362,7 +362,8 @@ mc_args_new_color_group (void)
|
||||
" Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
|
||||
" Popup menus: pmenunormal, pmenusel, pmenutitle\n"
|
||||
" Editor: editnormal, editbold, editmarked, editwhitespace,\n"
|
||||
" editlinestate\n"
|
||||
" editlinestate, editbg, editframe, editframeactive\n"
|
||||
" editframedrag\n"
|
||||
" Viewer: viewbold, viewunderline, viewselected\n"
|
||||
" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"),
|
||||
/* TRANSLATORS: don't translate color names and attributes */
|
||||
|
@ -145,22 +145,34 @@ edit_help (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
edit_draw_frame (const WEdit * edit)
|
||||
edit_draw_frame (const WEdit * edit, gboolean active)
|
||||
{
|
||||
const Widget *w = (const Widget *) edit;
|
||||
|
||||
tty_setcolor (EDITOR_NORMAL_COLOR);
|
||||
|
||||
if (edit->fullscreen)
|
||||
{
|
||||
tty_setcolor (active ? EDITOR_FRAME_ACTIVE : EDITOR_FRAME);
|
||||
/* draw lines at top and bottom */
|
||||
tty_draw_hline (w->y, w->x, ACS_HLINE, w->cols);
|
||||
tty_draw_hline (w->y + w->lines - 1, w->x, ACS_HLINE, w->cols);
|
||||
/* draw double lines for active window if skin supports that */
|
||||
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
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
/* 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 */
|
||||
if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0)
|
||||
{
|
||||
edit->drag_state_start = local.x;
|
||||
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)
|
||||
{
|
||||
/* click on bottom-right corner (resize) */
|
||||
if ((local.type & (GPM_DOWN | GPM_DRAG)) != 0)
|
||||
{
|
||||
edit->drag_state = MCEDIT_DRAG_RESIZE;
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit_update_screen (edit);
|
||||
}
|
||||
}
|
||||
|
||||
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) */
|
||||
edit_toggle_fullscreen (edit);
|
||||
edit->drag_state = MCEDIT_DRAG_NORMAL;
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit_update_screen (edit);
|
||||
}
|
||||
else if ((event->type & (GPM_DRAG | GPM_DOWN)) == 0)
|
||||
{
|
||||
/* redraw frame */
|
||||
edit->drag_state = MCEDIT_DRAG_NORMAL;
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit_update_screen (edit);
|
||||
}
|
||||
else if (!edit->fullscreen)
|
||||
{
|
||||
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 */
|
||||
w->y = y;
|
||||
w->x = x - edit->drag_state_start;
|
||||
edit->force |= REDRAW_PAGE;
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
}
|
||||
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:
|
||||
/* don't use common_dialog_repaint() -- we don't need a frame */
|
||||
tty_setcolor (EDITOR_NORMAL_COLOR);
|
||||
tty_setcolor (EDITOR_BACKGROUND);
|
||||
dlg_erase (h);
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -845,15 +868,22 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
{
|
||||
case WIDGET_FOCUS:
|
||||
edit_set_buttonbar (e, find_buttonbar (e->widget.owner));
|
||||
e->force |= REDRAW_PAGE;
|
||||
edit_update_screen (e);
|
||||
return MSG_HANDLED;
|
||||
/* fall through */
|
||||
|
||||
case WIDGET_DRAW:
|
||||
e->force |= REDRAW_COMPLETELY;
|
||||
edit_update_screen (e);
|
||||
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:
|
||||
{
|
||||
int cmd, ch;
|
||||
@ -999,7 +1029,7 @@ edit_update_screen (WEdit * e)
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -1009,7 +1039,7 @@ edit_update_screen (WEdit * e)
|
||||
e->force |= REDRAW_PAGE;
|
||||
else
|
||||
{
|
||||
if (e->force & REDRAW_COMPLETELY)
|
||||
if ((e->force & REDRAW_COMPLETELY) != 0)
|
||||
e->force |= REDRAW_PAGE;
|
||||
edit_render_keypress (e);
|
||||
}
|
||||
@ -1127,6 +1157,9 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
|
||||
case CK_Enter:
|
||||
case CK_WindowMove:
|
||||
edit->drag_state = MCEDIT_DRAG_NORMAL;
|
||||
/* redraw frame and status */
|
||||
edit_draw_frame (edit, TRUE);
|
||||
edit_info_status (edit);
|
||||
default:
|
||||
ret = TRUE;
|
||||
break;
|
||||
@ -1150,6 +1183,9 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
|
||||
case CK_Enter:
|
||||
case CK_WindowResize:
|
||||
edit->drag_state = MCEDIT_DRAG_NORMAL;
|
||||
/* redraw frame and status */
|
||||
edit_draw_frame (edit, TRUE);
|
||||
edit_info_status (edit);
|
||||
default:
|
||||
ret = TRUE;
|
||||
break;
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user