Added color for disabled widget.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
7869478668
Коммит
298e83f40b
92
lib/skin.h
92
lib/skin.h
@ -1,5 +1,5 @@
|
||||
#ifndef MC__SKIN_H
|
||||
#define MC__SKIN_H
|
||||
#ifndef MC_SKIN_H
|
||||
#define MC_SKIN_H
|
||||
|
||||
#include "lib/global.h"
|
||||
|
||||
@ -18,72 +18,73 @@
|
||||
#define MARKED_COLOR mc_skin_color__cache[2]
|
||||
#define SELECTED_COLOR mc_skin_color__cache[3]
|
||||
#define MARKED_SELECTED_COLOR mc_skin_color__cache[4]
|
||||
#define REVERSE_COLOR mc_skin_color__cache[5]
|
||||
#define COMMAND_MARK_COLOR mc_skin_color__cache[6]
|
||||
#define DISABLED_COLOR mc_skin_color__cache[5]
|
||||
#define REVERSE_COLOR mc_skin_color__cache[6]
|
||||
#define COMMAND_MARK_COLOR mc_skin_color__cache[7]
|
||||
|
||||
/* Dialog colors */
|
||||
#define COLOR_NORMAL mc_skin_color__cache[7]
|
||||
#define COLOR_FOCUS mc_skin_color__cache[8]
|
||||
#define COLOR_HOT_NORMAL mc_skin_color__cache[9]
|
||||
#define COLOR_HOT_FOCUS mc_skin_color__cache[10]
|
||||
#define COLOR_NORMAL mc_skin_color__cache[8]
|
||||
#define COLOR_FOCUS mc_skin_color__cache[9]
|
||||
#define COLOR_HOT_NORMAL mc_skin_color__cache[10]
|
||||
#define COLOR_HOT_FOCUS mc_skin_color__cache[11]
|
||||
|
||||
/* Error dialog colors */
|
||||
#define ERROR_COLOR mc_skin_color__cache[11]
|
||||
#define ERROR_HOT_NORMAL mc_skin_color__cache[12]
|
||||
#define ERROR_HOT_FOCUS mc_skin_color__cache[13]
|
||||
#define ERROR_COLOR mc_skin_color__cache[12]
|
||||
#define ERROR_HOT_NORMAL mc_skin_color__cache[13]
|
||||
#define ERROR_HOT_FOCUS mc_skin_color__cache[14]
|
||||
|
||||
/* Menu colors */
|
||||
#define MENU_ENTRY_COLOR mc_skin_color__cache[14]
|
||||
#define MENU_SELECTED_COLOR mc_skin_color__cache[15]
|
||||
#define MENU_HOT_COLOR mc_skin_color__cache[16]
|
||||
#define MENU_HOTSEL_COLOR mc_skin_color__cache[17]
|
||||
#define MENU_INACTIVE_COLOR mc_skin_color__cache[18]
|
||||
#define MENU_ENTRY_COLOR mc_skin_color__cache[15]
|
||||
#define MENU_SELECTED_COLOR mc_skin_color__cache[16]
|
||||
#define MENU_HOT_COLOR mc_skin_color__cache[17]
|
||||
#define MENU_HOTSEL_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
|
||||
* foreground does not matter at all.
|
||||
*/
|
||||
#define GAUGE_COLOR mc_skin_color__cache[19]
|
||||
#define INPUT_COLOR mc_skin_color__cache[20]
|
||||
#define INPUT_UNCHANGED_COLOR mc_skin_color__cache[21]
|
||||
#define INPUT_MARK_COLOR mc_skin_color__cache[22]
|
||||
#define GAUGE_COLOR mc_skin_color__cache[20]
|
||||
#define INPUT_COLOR mc_skin_color__cache[21]
|
||||
#define INPUT_UNCHANGED_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_ITALIC_COLOR mc_skin_color__cache[24]
|
||||
#define HELP_BOLD_COLOR mc_skin_color__cache[25]
|
||||
#define HELP_LINK_COLOR mc_skin_color__cache[26]
|
||||
#define HELP_SLINK_COLOR mc_skin_color__cache[27]
|
||||
#define HELP_NORMAL_COLOR mc_skin_color__cache[24]
|
||||
#define HELP_ITALIC_COLOR mc_skin_color__cache[25]
|
||||
#define HELP_BOLD_COLOR mc_skin_color__cache[26]
|
||||
#define HELP_LINK_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
|
||||
* respectively
|
||||
* Last is defined to view color.
|
||||
*/
|
||||
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[29]
|
||||
#define EDITOR_BOLD_COLOR mc_skin_color__cache[30]
|
||||
#define EDITOR_MARKED_COLOR mc_skin_color__cache[31]
|
||||
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[32]
|
||||
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[33]
|
||||
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[30]
|
||||
#define EDITOR_BOLD_COLOR mc_skin_color__cache[31]
|
||||
#define EDITOR_MARKED_COLOR mc_skin_color__cache[32]
|
||||
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[33]
|
||||
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[34]
|
||||
/* color of left 8 char status per line */
|
||||
#define LINE_STATE_COLOR mc_skin_color__cache[34]
|
||||
#define BOOK_MARK_COLOR mc_skin_color__cache[35]
|
||||
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[36]
|
||||
#define LINE_STATE_COLOR mc_skin_color__cache[35]
|
||||
#define BOOK_MARK_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_BUTTON_COLOR mc_skin_color__cache[38]
|
||||
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[38]
|
||||
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[39]
|
||||
|
||||
/* Diff colors */
|
||||
#define DFF_ADD_COLOR mc_skin_color__cache[39]
|
||||
#define DFF_CHG_COLOR mc_skin_color__cache[40]
|
||||
#define DFF_CHH_COLOR mc_skin_color__cache[41]
|
||||
#define DFF_CHD_COLOR mc_skin_color__cache[42]
|
||||
#define DFF_DEL_COLOR mc_skin_color__cache[43]
|
||||
#define DFF_FOLDER_COLOR mc_skin_color__cache[44]
|
||||
#define DFF_ERROR_COLOR mc_skin_color__cache[45]
|
||||
#define DFF_ADD_COLOR mc_skin_color__cache[40]
|
||||
#define DFF_CHG_COLOR mc_skin_color__cache[41]
|
||||
#define DFF_CHH_COLOR mc_skin_color__cache[42]
|
||||
#define DFF_CHD_COLOR mc_skin_color__cache[43]
|
||||
#define DFF_DEL_COLOR mc_skin_color__cache[44]
|
||||
#define DFF_FOLDER_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 ***************************************************************************************/
|
||||
|
||||
@ -112,5 +113,4 @@ void mc_skin_lines_parse_ini_file (mc_skin_t *);
|
||||
|
||||
gchar *mc_skin_get(const gchar *, const gchar *, const gchar *);
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* MC_SKIN_H */
|
||||
|
@ -55,6 +55,7 @@ static const mc_skin_colors_old_t old_colors[] = {
|
||||
{"marked", "core", "marked"},
|
||||
{"selected", "core", "selected"},
|
||||
{"markselect", "core", "markselect"},
|
||||
{"disabled", "core", "disabled"},
|
||||
{"reverse", "core", "reverse"},
|
||||
{"dnormal", "dialog", "_default_"},
|
||||
{"dfocus", "dialog", "dfocus"},
|
||||
|
@ -201,6 +201,7 @@ mc_skin_color_cache_init (void)
|
||||
MARKED_COLOR = mc_skin_color_get ("core", "marked");
|
||||
SELECTED_COLOR = mc_skin_color_get ("core", "selected");
|
||||
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");
|
||||
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", "marked", "A_BOLD");
|
||||
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, "dialog", "_default_", "A_REVERSE");
|
||||
mc_config_set_string (mc_skin->config, "dialog", "dfocus", "A_BOLD");
|
||||
|
@ -33,6 +33,7 @@
|
||||
input=black;cyan
|
||||
inputunchanged=gray;cyan
|
||||
inputmark=cyan;black
|
||||
disabled=gray;blue
|
||||
reverse=black;lightgray
|
||||
commandlinemark=black;lightgray
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
input=black;cyan
|
||||
inputunchanged=gray;cyan
|
||||
inputmark=cyan;black
|
||||
disabled=gray;lightgray
|
||||
reverse=black;lightgray
|
||||
commandlinemark=black;lightgray
|
||||
|
||||
|
@ -31,10 +31,11 @@
|
||||
markselect=yellow;cyan
|
||||
gauge=white;black
|
||||
input=black;cyan
|
||||
reverse=black;lightgray
|
||||
inputunchanged=gray;cyan
|
||||
inputmark=cyan;black
|
||||
commandlinemark=black;lightgray
|
||||
disabled=gray;lightgray
|
||||
reverse=black;lightgray
|
||||
|
||||
[dialog]
|
||||
_default_=black;lightgray
|
||||
|
@ -35,6 +35,7 @@
|
||||
input=black;cyan
|
||||
inputunchanged=gray;cyan
|
||||
inputmark=cyan;black
|
||||
disabled=gray;lightgray
|
||||
reverse=black;lightgray
|
||||
commandlinemark=black;lightgray
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
markselect=yellow;
|
||||
gauge=;yellow
|
||||
input=brightgreen;
|
||||
disabled=gray;blue
|
||||
reverse=brightgreen;blue
|
||||
|
||||
[dialog]
|
||||
|
@ -31,6 +31,7 @@
|
||||
markselect=brown;blue
|
||||
gauge=black;lightgray
|
||||
input=lightgray;black
|
||||
disabled=gray;darkgray
|
||||
reverse=blue;black
|
||||
|
||||
[dialog]
|
||||
|
@ -325,7 +325,7 @@ mc_args_new_color_group (void)
|
||||
_("--colors KEYWORD={FORE},{BACK}\n\n"
|
||||
"{FORE} and {BACK} can be omitted, and the default will be used\n"
|
||||
"\n" "Keywords:\n"
|
||||
" Global: errors, reverse, gauge, viewunderline\n"
|
||||
" Global: errors, disabled, reverse, gauge, viewunderline\n"
|
||||
" input, inputmark, inputunchanged, commandlinemark\n"
|
||||
" File display: normal, selected, marked, markselect\n"
|
||||
" Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
|
||||
|
27
src/layout.c
27
src/layout.c
@ -314,21 +314,17 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
||||
old_horizontal_split = -1;
|
||||
old_output_lines = -1;
|
||||
|
||||
tty_setcolor (COLOR_HOT_NORMAL);
|
||||
update_split ();
|
||||
dlg_move (h, 6, 13);
|
||||
tty_print_char ('=');
|
||||
if (console_flag)
|
||||
{
|
||||
if (old_output_lines != _output_lines)
|
||||
{
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (h, 9, 6);
|
||||
tty_print_string (output_lines_label);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
dlg_move (h, 9, 6);
|
||||
tty_print_string (output_lines_label);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -370,13 +366,10 @@ layout_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *d
|
||||
update_split ();
|
||||
if (console_flag)
|
||||
{
|
||||
if (old_output_lines != _output_lines)
|
||||
{
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
old_output_lines = _output_lines;
|
||||
tty_setcolor (console_flag ? COLOR_NORMAL : DISABLED_COLOR);
|
||||
dlg_move (h, 9, 6 + 3 + output_lines_label_len);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
|
||||
|
38
src/widget.c
38
src/widget.c
@ -69,7 +69,9 @@ widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey)
|
||||
Dlg_head *h = w->owner;
|
||||
int color;
|
||||
|
||||
if (hotkey)
|
||||
if ((w->options & W_DISABLED) != 0)
|
||||
color = DISABLED_COLOR;
|
||||
else if (hotkey)
|
||||
{
|
||||
if (focused)
|
||||
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;
|
||||
int y = 0;
|
||||
gboolean disabled = (w->options & W_DISABLED) != 0;
|
||||
|
||||
if (!l->text)
|
||||
return MSG_HANDLED;
|
||||
|
||||
if (l->transparent)
|
||||
tty_setcolor (DEFAULT_COLOR);
|
||||
tty_setcolor (disabled ? DISABLED_COLOR : DEFAULT_COLOR);
|
||||
else
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
tty_setcolor (disabled ? DISABLED_COLOR : DLG_NORMALC (h));
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -1035,20 +1038,22 @@ static void
|
||||
draw_history_button (WInput * in)
|
||||
{
|
||||
char c;
|
||||
gboolean disabled = (((Widget *) in)->options & W_DISABLED) != 0;
|
||||
|
||||
c = in->history->next ? (in->history->prev ? '|' : 'v') : '^';
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH);
|
||||
#ifdef LARGE_HISTORY_BUTTON
|
||||
{
|
||||
Dlg_head *h;
|
||||
h = in->widget.owner;
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
tty_setcolor (disabled ? DISABLED_COLOR : NORMAL_COLOR);
|
||||
tty_print_string ("[ ]");
|
||||
/* Too distracting: tty_setcolor (MARKED_COLOR); */
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
|
||||
tty_print_char (c);
|
||||
}
|
||||
#else
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
tty_setcolor (disabled ? DISABLED_COLOR : MARKED_COLOR);
|
||||
tty_print_char (c);
|
||||
#endif
|
||||
}
|
||||
@ -1147,7 +1152,9 @@ update_input (WInput * in, int clear_first)
|
||||
if (has_history)
|
||||
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);
|
||||
else
|
||||
tty_setcolor (in->color);
|
||||
@ -2453,8 +2460,9 @@ static void
|
||||
listbox_draw (WListbox * l, gboolean focused)
|
||||
{
|
||||
const Dlg_head *h = l->widget.owner;
|
||||
const int normalc = DLG_NORMALC (h);
|
||||
int selc = focused ? DLG_HOT_FOCUSC (h) : DLG_FOCUSC (h);
|
||||
const gboolean disabled = (((Widget *) l)->options & W_DISABLED) != 0;
|
||||
const int normalc = disabled ? DISABLED_COLOR : DLG_NORMALC (h);
|
||||
int selc = disabled ? DISABLED_COLOR : focused ? DLG_HOT_FOCUSC (h) : DLG_FOCUSC (h);
|
||||
|
||||
GList *le;
|
||||
int pos;
|
||||
@ -3134,7 +3142,12 @@ buttonbar_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
break;
|
||||
|
||||
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);
|
||||
text = (bb->labels[i].text != NULL) ? bb->labels[i].text : "";
|
||||
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;
|
||||
|
||||
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,
|
||||
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,
|
||||
g->widget.x - g->widget.owner->x + 1);
|
||||
tty_print_string (g->title);
|
||||
return MSG_HANDLED;
|
||||
}
|
||||
|
||||
case WIDGET_DESTROY:
|
||||
g_free (g->title);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user