1
1

Added color for disabled widget.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2010-06-29 13:42:39 +04:00
родитель 7869478668
Коммит 298e83f40b
13 изменённых файлов: 94 добавлений и 76 удалений

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

@ -1,5 +1,5 @@
#ifndef MC__SKIN_H #ifndef MC_SKIN_H
#define MC__SKIN_H #define MC_SKIN_H
#include "lib/global.h" #include "lib/global.h"
@ -18,72 +18,73 @@
#define MARKED_COLOR mc_skin_color__cache[2] #define MARKED_COLOR mc_skin_color__cache[2]
#define SELECTED_COLOR mc_skin_color__cache[3] #define SELECTED_COLOR mc_skin_color__cache[3]
#define MARKED_SELECTED_COLOR mc_skin_color__cache[4] #define MARKED_SELECTED_COLOR mc_skin_color__cache[4]
#define REVERSE_COLOR mc_skin_color__cache[5] #define DISABLED_COLOR mc_skin_color__cache[5]
#define COMMAND_MARK_COLOR mc_skin_color__cache[6] #define REVERSE_COLOR mc_skin_color__cache[6]
#define COMMAND_MARK_COLOR mc_skin_color__cache[7]
/* Dialog colors */ /* Dialog colors */
#define COLOR_NORMAL mc_skin_color__cache[7] #define COLOR_NORMAL mc_skin_color__cache[8]
#define COLOR_FOCUS mc_skin_color__cache[8] #define COLOR_FOCUS mc_skin_color__cache[9]
#define COLOR_HOT_NORMAL mc_skin_color__cache[9] #define COLOR_HOT_NORMAL mc_skin_color__cache[10]
#define COLOR_HOT_FOCUS mc_skin_color__cache[10] #define COLOR_HOT_FOCUS mc_skin_color__cache[11]
/* Error dialog colors */ /* Error dialog colors */
#define ERROR_COLOR mc_skin_color__cache[11] #define ERROR_COLOR mc_skin_color__cache[12]
#define ERROR_HOT_NORMAL mc_skin_color__cache[12] #define ERROR_HOT_NORMAL mc_skin_color__cache[13]
#define ERROR_HOT_FOCUS mc_skin_color__cache[13] #define ERROR_HOT_FOCUS mc_skin_color__cache[14]
/* Menu colors */ /* Menu colors */
#define MENU_ENTRY_COLOR mc_skin_color__cache[14] #define MENU_ENTRY_COLOR mc_skin_color__cache[15]
#define MENU_SELECTED_COLOR mc_skin_color__cache[15] #define MENU_SELECTED_COLOR mc_skin_color__cache[16]
#define MENU_HOT_COLOR mc_skin_color__cache[16] #define MENU_HOT_COLOR mc_skin_color__cache[17]
#define MENU_HOTSEL_COLOR mc_skin_color__cache[17] #define MENU_HOTSEL_COLOR mc_skin_color__cache[18]
#define MENU_INACTIVE_COLOR mc_skin_color__cache[18] #define MENU_INACTIVE_COLOR mc_skin_color__cache[19]
/* /*
* This should be selectable independently. Default has to be black background * This should be selectable independently. Default has to be black background
* foreground does not matter at all. * foreground does not matter at all.
*/ */
#define GAUGE_COLOR mc_skin_color__cache[19] #define GAUGE_COLOR mc_skin_color__cache[20]
#define INPUT_COLOR mc_skin_color__cache[20] #define INPUT_COLOR mc_skin_color__cache[21]
#define INPUT_UNCHANGED_COLOR mc_skin_color__cache[21] #define INPUT_UNCHANGED_COLOR mc_skin_color__cache[22]
#define INPUT_MARK_COLOR mc_skin_color__cache[22] #define INPUT_MARK_COLOR mc_skin_color__cache[23]
#define HELP_NORMAL_COLOR mc_skin_color__cache[23] #define HELP_NORMAL_COLOR mc_skin_color__cache[24]
#define HELP_ITALIC_COLOR mc_skin_color__cache[24] #define HELP_ITALIC_COLOR mc_skin_color__cache[25]
#define HELP_BOLD_COLOR mc_skin_color__cache[25] #define HELP_BOLD_COLOR mc_skin_color__cache[26]
#define HELP_LINK_COLOR mc_skin_color__cache[26] #define HELP_LINK_COLOR mc_skin_color__cache[27]
#define HELP_SLINK_COLOR mc_skin_color__cache[27] #define HELP_SLINK_COLOR mc_skin_color__cache[28]
#define VIEW_UNDERLINED_COLOR mc_skin_color__cache[28] #define VIEW_UNDERLINED_COLOR mc_skin_color__cache[29]
/* /*
* editor colors - only 4 for normal, search->found, select, and whitespace * editor colors - only 4 for normal, search->found, select, and whitespace
* respectively * respectively
* Last is defined to view color. * Last is defined to view color.
*/ */
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[29] #define EDITOR_NORMAL_COLOR mc_skin_color__cache[30]
#define EDITOR_BOLD_COLOR mc_skin_color__cache[30] #define EDITOR_BOLD_COLOR mc_skin_color__cache[31]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[31] #define EDITOR_MARKED_COLOR mc_skin_color__cache[32]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[32] #define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[33]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[33] #define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[34]
/* color of left 8 char status per line */ /* color of left 8 char status per line */
#define LINE_STATE_COLOR mc_skin_color__cache[34] #define LINE_STATE_COLOR mc_skin_color__cache[35]
#define BOOK_MARK_COLOR mc_skin_color__cache[35] #define BOOK_MARK_COLOR mc_skin_color__cache[36]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[36] #define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[37]
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[37] #define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[38]
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[38] #define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[39]
/* Diff colors */ /* Diff colors */
#define DFF_ADD_COLOR mc_skin_color__cache[39] #define DFF_ADD_COLOR mc_skin_color__cache[40]
#define DFF_CHG_COLOR mc_skin_color__cache[40] #define DFF_CHG_COLOR mc_skin_color__cache[41]
#define DFF_CHH_COLOR mc_skin_color__cache[41] #define DFF_CHH_COLOR mc_skin_color__cache[42]
#define DFF_CHD_COLOR mc_skin_color__cache[42] #define DFF_CHD_COLOR mc_skin_color__cache[43]
#define DFF_DEL_COLOR mc_skin_color__cache[43] #define DFF_DEL_COLOR mc_skin_color__cache[44]
#define DFF_FOLDER_COLOR mc_skin_color__cache[44] #define DFF_FOLDER_COLOR mc_skin_color__cache[45]
#define DFF_ERROR_COLOR mc_skin_color__cache[45] #define DFF_ERROR_COLOR mc_skin_color__cache[46]
#define MC_SKIN_COLOR_CACHE_COUNT 46 #define MC_SKIN_COLOR_CACHE_COUNT 47
/*** enums ***************************************************************************************/ /*** enums ***************************************************************************************/
@ -112,5 +113,4 @@ void mc_skin_lines_parse_ini_file (mc_skin_t *);
gchar *mc_skin_get(const gchar *, const gchar *, const gchar *); gchar *mc_skin_get(const gchar *, const gchar *, const gchar *);
#endif /* MC_SKIN_H */
#endif

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

@ -55,6 +55,7 @@ static const mc_skin_colors_old_t old_colors[] = {
{"marked", "core", "marked"}, {"marked", "core", "marked"},
{"selected", "core", "selected"}, {"selected", "core", "selected"},
{"markselect", "core", "markselect"}, {"markselect", "core", "markselect"},
{"disabled", "core", "disabled"},
{"reverse", "core", "reverse"}, {"reverse", "core", "reverse"},
{"dnormal", "dialog", "_default_"}, {"dnormal", "dialog", "_default_"},
{"dfocus", "dialog", "dfocus"}, {"dfocus", "dialog", "dfocus"},

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

@ -201,6 +201,7 @@ mc_skin_color_cache_init (void)
MARKED_COLOR = mc_skin_color_get ("core", "marked"); MARKED_COLOR = mc_skin_color_get ("core", "marked");
SELECTED_COLOR = mc_skin_color_get ("core", "selected"); SELECTED_COLOR = mc_skin_color_get ("core", "selected");
MARKED_SELECTED_COLOR = mc_skin_color_get ("core", "markselect"); MARKED_SELECTED_COLOR = mc_skin_color_get ("core", "markselect");
DISABLED_COLOR = mc_skin_color_get ("core", "disabled");
REVERSE_COLOR = mc_skin_color_get ("core", "reverse"); REVERSE_COLOR = mc_skin_color_get ("core", "reverse");
COMMAND_MARK_COLOR = mc_skin_color_get ("core", "commandlinemark"); COMMAND_MARK_COLOR = mc_skin_color_get ("core", "commandlinemark");

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

@ -54,6 +54,7 @@ mc_skin_hardcoded_blackwhite_colors (mc_skin_t * mc_skin)
mc_config_set_string (mc_skin->config, "core", "selected", "A_REVERSE"); mc_config_set_string (mc_skin->config, "core", "selected", "A_REVERSE");
mc_config_set_string (mc_skin->config, "core", "marked", "A_BOLD"); mc_config_set_string (mc_skin->config, "core", "marked", "A_BOLD");
mc_config_set_string (mc_skin->config, "core", "markselect", "A_BOLD_REVERSE"); mc_config_set_string (mc_skin->config, "core", "markselect", "A_BOLD_REVERSE");
mc_config_set_string (mc_skin->config, "core", "disabled", "default");
mc_config_set_string (mc_skin->config, "core", "reverse", "A_REVERSE"); mc_config_set_string (mc_skin->config, "core", "reverse", "A_REVERSE");
mc_config_set_string (mc_skin->config, "dialog", "_default_", "A_REVERSE"); mc_config_set_string (mc_skin->config, "dialog", "_default_", "A_REVERSE");
mc_config_set_string (mc_skin->config, "dialog", "dfocus", "A_BOLD"); mc_config_set_string (mc_skin->config, "dialog", "dfocus", "A_BOLD");

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

@ -33,6 +33,7 @@
input=black;cyan input=black;cyan
inputunchanged=gray;cyan inputunchanged=gray;cyan
inputmark=cyan;black inputmark=cyan;black
disabled=gray;blue
reverse=black;lightgray reverse=black;lightgray
commandlinemark=black;lightgray commandlinemark=black;lightgray

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

@ -33,6 +33,7 @@
input=black;cyan input=black;cyan
inputunchanged=gray;cyan inputunchanged=gray;cyan
inputmark=cyan;black inputmark=cyan;black
disabled=gray;lightgray
reverse=black;lightgray reverse=black;lightgray
commandlinemark=black;lightgray commandlinemark=black;lightgray

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

@ -31,10 +31,11 @@
markselect=yellow;cyan markselect=yellow;cyan
gauge=white;black gauge=white;black
input=black;cyan input=black;cyan
reverse=black;lightgray
inputunchanged=gray;cyan inputunchanged=gray;cyan
inputmark=cyan;black inputmark=cyan;black
commandlinemark=black;lightgray commandlinemark=black;lightgray
disabled=gray;lightgray
reverse=black;lightgray
[dialog] [dialog]
_default_=black;lightgray _default_=black;lightgray

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

@ -35,6 +35,7 @@
input=black;cyan input=black;cyan
inputunchanged=gray;cyan inputunchanged=gray;cyan
inputmark=cyan;black inputmark=cyan;black
disabled=gray;lightgray
reverse=black;lightgray reverse=black;lightgray
commandlinemark=black;lightgray commandlinemark=black;lightgray

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

@ -31,6 +31,7 @@
markselect=yellow; markselect=yellow;
gauge=;yellow gauge=;yellow
input=brightgreen; input=brightgreen;
disabled=gray;blue
reverse=brightgreen;blue reverse=brightgreen;blue
[dialog] [dialog]

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

@ -31,6 +31,7 @@
markselect=brown;blue markselect=brown;blue
gauge=black;lightgray gauge=black;lightgray
input=lightgray;black input=lightgray;black
disabled=gray;darkgray
reverse=blue;black reverse=blue;black
[dialog] [dialog]

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

@ -325,7 +325,7 @@ mc_args_new_color_group (void)
_("--colors KEYWORD={FORE},{BACK}\n\n" _("--colors KEYWORD={FORE},{BACK}\n\n"
"{FORE} and {BACK} can be omitted, and the default will be used\n" "{FORE} and {BACK} can be omitted, and the default will be used\n"
"\n" "Keywords:\n" "\n" "Keywords:\n"
" Global: errors, reverse, gauge, viewunderline\n" " Global: errors, disabled, reverse, gauge, viewunderline\n"
" input, inputmark, inputunchanged, commandlinemark\n" " input, inputmark, inputunchanged, commandlinemark\n"
" File display: normal, selected, marked, markselect\n" " File display: normal, selected, marked, markselect\n"
" Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n" " Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"

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

@ -314,21 +314,17 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
old_horizontal_split = -1; old_horizontal_split = -1;
old_output_lines = -1; old_output_lines = -1;
tty_setcolor (COLOR_HOT_NORMAL);
update_split (); update_split ();
dlg_move (h, 6, 13); dlg_move (h, 6, 13);
tty_print_char ('='); tty_print_char ('=');
if (console_flag) if (console_flag)
{ {
if (old_output_lines != _output_lines) old_output_lines = _output_lines;
{ tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
old_output_lines = _output_lines; dlg_move (h, 9, 6);
tty_setcolor (COLOR_NORMAL); tty_print_string (output_lines_label);
dlg_move (h, 9, 6); dlg_move (h, 9, 6 + 3 + output_lines_label_len);
tty_print_string (output_lines_label); tty_printf ("%02d", _output_lines);
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
tty_printf ("%02d", _output_lines);
}
} }
return MSG_HANDLED; return MSG_HANDLED;
@ -370,13 +366,10 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
update_split (); update_split ();
if (console_flag) if (console_flag)
{ {
if (old_output_lines != _output_lines) old_output_lines = _output_lines;
{ tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
old_output_lines = _output_lines; dlg_move (h, 9, 6 + 3 + output_lines_label_len);
tty_setcolor (COLOR_NORMAL); tty_printf ("%02d", _output_lines);
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
tty_printf ("%02d", _output_lines);
}
} }
return MSG_HANDLED; return MSG_HANDLED;

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

@ -69,7 +69,9 @@ widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey)
Dlg_head *h = w->owner; Dlg_head *h = w->owner;
int color; int color;
if (hotkey) if ((w->options & W_DISABLED) != 0)
color = DISABLED_COLOR;
else if (hotkey)
{ {
if (focused) if (focused)
color = DLG_HOT_FOCUSC (h); color = DLG_HOT_FOCUSC (h);
@ -754,14 +756,15 @@ label_callback (Widget * w, widget_msg_t msg, int parm)
{ {
char *p = l->text, *q, c = 0; char *p = l->text, *q, c = 0;
int y = 0; int y = 0;
gboolean disabled = (w->options & W_DISABLED) != 0;
if (!l->text) if (!l->text)
return MSG_HANDLED; return MSG_HANDLED;
if (l->transparent) if (l->transparent)
tty_setcolor (DEFAULT_COLOR); tty_setcolor (disabled ? DISABLED_COLOR : DEFAULT_COLOR);
else else
tty_setcolor (DLG_NORMALC (h)); tty_setcolor (disabled ? DISABLED_COLOR : DLG_NORMALC (h));
for (;;) for (;;)
{ {
@ -1035,20 +1038,22 @@ static void
draw_history_button (WInput * in) draw_history_button (WInput * in)
{ {
char c; char c;
gboolean disabled = (((Widget *) in)->options & W_DISABLED) != 0;
c = in->history->next ? (in->history->prev ? '|' : 'v') : '^'; c = in->history->next ? (in->history->prev ? '|' : 'v') : '^';
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH); widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH);
#ifdef LARGE_HISTORY_BUTTON #ifdef LARGE_HISTORY_BUTTON
{ {
Dlg_head *h; Dlg_head *h;
h = in->widget.owner; h = in->widget.owner;
tty_setcolor (NORMAL_COLOR); tty_setcolor (disabled ? DISABLED_COLOR : NORMAL_COLOR);
tty_print_string ("[ ]"); tty_print_string ("[ ]");
/* Too distracting: tty_setcolor (MARKED_COLOR); */ /* Too distracting: tty_setcolor (MARKED_COLOR); */
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1); widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
tty_print_char (c); tty_print_char (c);
} }
#else #else
tty_setcolor (MARKED_COLOR); tty_setcolor (disabled ? DISABLED_COLOR : MARKED_COLOR);
tty_print_char (c); tty_print_char (c);
#endif #endif
} }
@ -1147,7 +1152,9 @@ update_input (WInput * in, int clear_first)
if (has_history) if (has_history)
draw_history_button (in); draw_history_button (in);
if (in->first) if ((((Widget *) in)->options & W_DISABLED) != 0)
tty_setcolor (DISABLED_COLOR);
else if (in->first)
tty_setcolor (in->unchanged_color); tty_setcolor (in->unchanged_color);
else else
tty_setcolor (in->color); tty_setcolor (in->color);
@ -2453,8 +2460,9 @@ static void
listbox_draw (WListbox * l, gboolean focused) listbox_draw (WListbox * l, gboolean focused)
{ {
const Dlg_head *h = l->widget.owner; const Dlg_head *h = l->widget.owner;
const int normalc = DLG_NORMALC (h); const gboolean disabled = (((Widget *) l)->options & W_DISABLED) != 0;
int selc = focused ? DLG_HOT_FOCUSC (h) : DLG_FOCUSC (h); const int normalc = disabled ? DISABLED_COLOR : DLG_NORMALC (h);
int selc = disabled ? DISABLED_COLOR : focused ? DLG_HOT_FOCUSC (h) : DLG_FOCUSC (h);
GList *le; GList *le;
int pos; int pos;
@ -3134,7 +3142,12 @@ buttonbar_callback (Widget * w, widget_msg_t msg, int parm)
break; break;
tty_setcolor (BUTTONBAR_HOTKEY_COLOR); tty_setcolor (BUTTONBAR_HOTKEY_COLOR);
tty_printf ("%2d", i + 1); /* don't show num of undefined button */
if ((bb->labels[i].text == NULL) || (bb->labels[i].text[0] == '\0'))
tty_print_string (" ");
else
tty_printf ("%2d", i + 1);
tty_setcolor (BUTTONBAR_BUTTON_COLOR); tty_setcolor (BUTTONBAR_BUTTON_COLOR);
text = (bb->labels[i].text != NULL) ? bb->labels[i].text : ""; text = (bb->labels[i].text != NULL) ? bb->labels[i].text : "";
tty_print_string (str_fit_to_term (text, width - 2, J_LEFT_FIT)); tty_print_string (str_fit_to_term (text, width - 2, J_LEFT_FIT));
@ -3246,15 +3259,18 @@ groupbox_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_NOT_HANDLED; return MSG_NOT_HANDLED;
case WIDGET_DRAW: case WIDGET_DRAW:
tty_setcolor (COLOR_NORMAL); {
gboolean disabled = (w->options & W_DISABLED) != 0;
tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL);
draw_box (g->widget.owner, g->widget.y - g->widget.owner->y, draw_box (g->widget.owner, g->widget.y - g->widget.owner->y,
g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE); g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE);
tty_setcolor (COLOR_HOT_NORMAL); tty_setcolor (disabled ? DISABLED_COLOR : COLOR_HOT_NORMAL);
dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y, dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y,
g->widget.x - g->widget.owner->x + 1); g->widget.x - g->widget.owner->x + 1);
tty_print_string (g->title); tty_print_string (g->title);
return MSG_HANDLED; return MSG_HANDLED;
}
case WIDGET_DESTROY: case WIDGET_DESTROY:
g_free (g->title); g_free (g->title);