Ticket #4120: draw shadows for dialog boxes and menus.

Thanks Aleš Janda <ales.janda@kyblsoft.cz> for the original patch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2020-07-19 19:47:15 +03:00
parent da9966fb55
commit 8b4386df83
44 changed files with 261 additions and 85 deletions

View File

@ -43,6 +43,9 @@ Alexander Serkov <serkov@ukrpost.net>
Alessandro Rubini <rubini@ipvvis.unipv.it>
Mouse support.
Aleš Janda <ales.janda@kyblsoft.cz>
Shadows of dialog windows and menus.
Alexander Dong <ado@software-ag.de>
OS/2 port.

View File

@ -2113,13 +2113,17 @@ overwriting files, execution by pressing enter, quitting the program,
directory hotlist entries deletion and history cleanup.
.\"NODE " Appearance"
.SH " Appearance"
In this dialog you can select the skin to be used.
In this dialog you can select the skin to be used and enable shadow
for dialogs and drop down menus.
.PP
See the
.\"LINK2"
Skins
.\"Skins"
section for technical details about the skin definition files.
.PP
.I Shadows.
If this option is enabled, all dialogs and drop down menus will have a shadow.
.\"NODE " Display bits"
.SH " Display bits"
This is used to configure the range of visible characters on the

View File

@ -2411,12 +2411,17 @@ Commander, выделены цветом, определённым ключев
на подтверждение.
.\"NODE " Appearance"
.SH " Оформление"
Используя это диалоговое окно, вы можете выбрать скин.
Используя это диалоговое окно, вы можете выбрать скин и разрещить отрисовку
теней у диалоговых окон и выпадающих меню.
.PP
Для получения более подробной информации о скинах обратитесь к разделу
.\"LINK2"
Внешний вид\&.
.\"Skins"
.PP
.I Тени.
Если эта опция включена, все диалоговые окна и выпадающие меню будут иметь
тени.
.\"NODE " Display bits"
.SH " Биты символов..."
Этот пункт меню используется для задания диапазона отображаемых на

View File

@ -85,6 +85,7 @@ mc_global_t mc_global = {
.tty =
{
.skin = NULL,
.shadows = TRUE,
.setup_color_string = NULL,
.term_color_string = NULL,
.color_terminal_string = NULL,

View File

@ -230,6 +230,8 @@ typedef struct
{
/* Use the specified skin */
char *skin;
/* Dialog window and frop down menu have a shadow */
gboolean shadows;
char *setup_color_string;
char *term_color_string;

View File

@ -22,92 +22,93 @@
#define REVERSE_COLOR mc_skin_color__cache[6]
#define COMMAND_MARK_COLOR mc_skin_color__cache[7]
#define HEADER_COLOR mc_skin_color__cache[8]
#define SHADOW_COLOR mc_skin_color__cache[9]
/* Dialog colors */
#define COLOR_NORMAL mc_skin_color__cache[9]
#define COLOR_FOCUS mc_skin_color__cache[10]
#define COLOR_HOT_NORMAL mc_skin_color__cache[11]
#define COLOR_HOT_FOCUS mc_skin_color__cache[12]
#define COLOR_TITLE mc_skin_color__cache[13]
#define COLOR_NORMAL mc_skin_color__cache[10]
#define COLOR_FOCUS mc_skin_color__cache[11]
#define COLOR_HOT_NORMAL mc_skin_color__cache[12]
#define COLOR_HOT_FOCUS mc_skin_color__cache[13]
#define COLOR_TITLE mc_skin_color__cache[14]
/* Error dialog colors */
#define ERROR_COLOR mc_skin_color__cache[14]
#define ERROR_FOCUS mc_skin_color__cache[15]
#define ERROR_HOT_NORMAL mc_skin_color__cache[16]
#define ERROR_HOT_FOCUS mc_skin_color__cache[17]
#define ERROR_TITLE mc_skin_color__cache[18]
#define ERROR_COLOR mc_skin_color__cache[15]
#define ERROR_FOCUS mc_skin_color__cache[16]
#define ERROR_HOT_NORMAL mc_skin_color__cache[17]
#define ERROR_HOT_FOCUS mc_skin_color__cache[18]
#define ERROR_TITLE mc_skin_color__cache[19]
/* Menu colors */
#define MENU_ENTRY_COLOR mc_skin_color__cache[19]
#define MENU_SELECTED_COLOR mc_skin_color__cache[20]
#define MENU_HOT_COLOR mc_skin_color__cache[21]
#define MENU_HOTSEL_COLOR mc_skin_color__cache[22]
#define MENU_INACTIVE_COLOR mc_skin_color__cache[23]
#define MENU_ENTRY_COLOR mc_skin_color__cache[20]
#define MENU_SELECTED_COLOR mc_skin_color__cache[21]
#define MENU_HOT_COLOR mc_skin_color__cache[22]
#define MENU_HOTSEL_COLOR mc_skin_color__cache[23]
#define MENU_INACTIVE_COLOR mc_skin_color__cache[24]
/* Popup menu colors */
#define PMENU_ENTRY_COLOR mc_skin_color__cache[24]
#define PMENU_SELECTED_COLOR mc_skin_color__cache[25]
#define PMENU_HOT_COLOR mc_skin_color__cache[26] /* unused: not implemented yet */
#define PMENU_HOTSEL_COLOR mc_skin_color__cache[27] /* unused: not implemented yet */
#define PMENU_TITLE_COLOR mc_skin_color__cache[28]
#define PMENU_ENTRY_COLOR mc_skin_color__cache[25]
#define PMENU_SELECTED_COLOR mc_skin_color__cache[26]
#define PMENU_HOT_COLOR mc_skin_color__cache[27] /* unused: not implemented yet */
#define PMENU_HOTSEL_COLOR mc_skin_color__cache[28] /* unused: not implemented yet */
#define PMENU_TITLE_COLOR mc_skin_color__cache[29]
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[29]
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[30]
#define BUTTONBAR_HOTKEY_COLOR mc_skin_color__cache[30]
#define BUTTONBAR_BUTTON_COLOR mc_skin_color__cache[31]
#define STATUSBAR_COLOR mc_skin_color__cache[31]
#define STATUSBAR_COLOR mc_skin_color__cache[32]
/*
* This should be selectable independently. Default has to be black background
* foreground does not matter at all.
*/
#define GAUGE_COLOR mc_skin_color__cache[32]
#define INPUT_COLOR mc_skin_color__cache[33]
#define INPUT_UNCHANGED_COLOR mc_skin_color__cache[34]
#define INPUT_MARK_COLOR mc_skin_color__cache[35]
#define INPUT_HISTORY_COLOR mc_skin_color__cache[36]
#define COMMAND_HISTORY_COLOR mc_skin_color__cache[37]
#define GAUGE_COLOR mc_skin_color__cache[33]
#define INPUT_COLOR mc_skin_color__cache[34]
#define INPUT_UNCHANGED_COLOR mc_skin_color__cache[35]
#define INPUT_MARK_COLOR mc_skin_color__cache[36]
#define INPUT_HISTORY_COLOR mc_skin_color__cache[37]
#define COMMAND_HISTORY_COLOR mc_skin_color__cache[38]
#define HELP_NORMAL_COLOR mc_skin_color__cache[38]
#define HELP_ITALIC_COLOR mc_skin_color__cache[39]
#define HELP_BOLD_COLOR mc_skin_color__cache[40]
#define HELP_LINK_COLOR mc_skin_color__cache[41]
#define HELP_SLINK_COLOR mc_skin_color__cache[42]
#define HELP_TITLE_COLOR mc_skin_color__cache[43]
#define HELP_NORMAL_COLOR mc_skin_color__cache[39]
#define HELP_ITALIC_COLOR mc_skin_color__cache[40]
#define HELP_BOLD_COLOR mc_skin_color__cache[41]
#define HELP_LINK_COLOR mc_skin_color__cache[42]
#define HELP_SLINK_COLOR mc_skin_color__cache[43]
#define HELP_TITLE_COLOR mc_skin_color__cache[44]
#define VIEW_NORMAL_COLOR mc_skin_color__cache[44]
#define VIEW_BOLD_COLOR mc_skin_color__cache[45]
#define VIEW_UNDERLINED_COLOR mc_skin_color__cache[46]
#define VIEW_SELECTED_COLOR mc_skin_color__cache[47]
#define VIEW_NORMAL_COLOR mc_skin_color__cache[45]
#define VIEW_BOLD_COLOR mc_skin_color__cache[46]
#define VIEW_UNDERLINED_COLOR mc_skin_color__cache[47]
#define VIEW_SELECTED_COLOR mc_skin_color__cache[48]
/*
* 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[48]
#define EDITOR_BOLD_COLOR mc_skin_color__cache[49]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[50]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[51]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[52]
#define EDITOR_BACKGROUND mc_skin_color__cache[53]
#define EDITOR_FRAME mc_skin_color__cache[54]
#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[55]
#define EDITOR_FRAME_DRAG mc_skin_color__cache[56]
#define EDITOR_NORMAL_COLOR mc_skin_color__cache[49]
#define EDITOR_BOLD_COLOR mc_skin_color__cache[50]
#define EDITOR_MARKED_COLOR mc_skin_color__cache[51]
#define EDITOR_WHITESPACE_COLOR mc_skin_color__cache[52]
#define EDITOR_RIGHT_MARGIN_COLOR mc_skin_color__cache[53]
#define EDITOR_BACKGROUND mc_skin_color__cache[54]
#define EDITOR_FRAME mc_skin_color__cache[55]
#define EDITOR_FRAME_ACTIVE mc_skin_color__cache[56]
#define EDITOR_FRAME_DRAG mc_skin_color__cache[57]
/* color of left 8 char status per line */
#define LINE_STATE_COLOR mc_skin_color__cache[57]
#define BOOK_MARK_COLOR mc_skin_color__cache[58]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[59]
#define LINE_STATE_COLOR mc_skin_color__cache[58]
#define BOOK_MARK_COLOR mc_skin_color__cache[59]
#define BOOK_MARK_FOUND_COLOR mc_skin_color__cache[60]
/* Diff colors */
#define DFF_ADD_COLOR mc_skin_color__cache[60]
#define DFF_CHG_COLOR mc_skin_color__cache[61]
#define DFF_CHH_COLOR mc_skin_color__cache[62]
#define DFF_CHD_COLOR mc_skin_color__cache[63]
#define DFF_DEL_COLOR mc_skin_color__cache[64]
#define DFF_ERROR_COLOR mc_skin_color__cache[65]
#define DFF_ADD_COLOR mc_skin_color__cache[61]
#define DFF_CHG_COLOR mc_skin_color__cache[62]
#define DFF_CHH_COLOR mc_skin_color__cache[63]
#define DFF_CHD_COLOR mc_skin_color__cache[64]
#define DFF_DEL_COLOR mc_skin_color__cache[65]
#define DFF_ERROR_COLOR mc_skin_color__cache[66]
#define MC_SKIN_COLOR_CACHE_COUNT 66
#define MC_SKIN_COLOR_CACHE_COUNT 67
/*** enums ***************************************************************************************/

View File

@ -249,6 +249,7 @@ mc_skin_color_cache_init (void)
REVERSE_COLOR = mc_skin_color_get ("core", "reverse");
HEADER_COLOR = mc_skin_color_get ("core", "header");
COMMAND_MARK_COLOR = mc_skin_color_get ("core", "commandlinemark");
SHADOW_COLOR = mc_skin_color_get ("core", "shadow");
COLOR_NORMAL = mc_skin_color_get ("dialog", "_default_");
COLOR_FOCUS = mc_skin_color_get ("dialog", "dfocus");

View File

@ -42,6 +42,8 @@ char *mc_tty_normalize_from_utf8 (const char *);
void tty_init_xterm_support (gboolean is_xterm);
int tty_lowlevel_getch (void);
void tty_colorize_area (int y, int x, int rows, int cols, int color);
/*** inline functions ****************************************************************************/
#endif /* MC_TTY_INTERNAL_H */

View File

@ -48,6 +48,7 @@
#include "tty-internal.h" /* mc_tty_normalize_from_utf8() */
#include "tty.h"
#include "color.h" /* tty_setcolor */
#include "color-internal.h"
#include "key.h"
#include "mouse.h"
@ -119,6 +120,44 @@ sigwinch_handler (int dummy)
(void) n;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Get visible part of area.
*
* @returns TRUE if any part of area is in screen bounds, FALSE otherwise.
*/
static gboolean
tty_clip (int *y, int *x, int *rows, int *cols)
{
if (*y < 0)
{
*rows += *y;
if (*rows <= 0)
return FALSE;
*y = 0;
}
if (*x < 0)
{
*cols += *x;
if (*cols <= 0)
return FALSE;
*x = 0;
}
if (*y + *rows > LINES)
*rows = LINES - *y;
if (*x + *cols > COLS)
*cols = COLS - *x;
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -494,30 +533,8 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
{
int i;
if (y < 0)
{
rows += y;
if (rows <= 0)
return;
y = 0;
}
if (x < 0)
{
cols += x;
if (cols <= 0)
return;
x = 0;
}
if (y + rows > LINES)
rows = LINES - y;
if (x + cols > COLS)
cols = COLS - x;
if (!tty_clip (&y, &x, &rows, &cols))
return;
for (i = 0; i < rows; i++)
{
@ -533,6 +550,38 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
/* --------------------------------------------------------------------------------------------- */
void
tty_colorize_area (int y, int x, int rows, int cols, int color)
{
cchar_t *ctext;
wchar_t wch[10]; /* TODO not sure if the length is correct */
attr_t attrs;
short color_pair;
if (!use_colors || !tty_clip (&y, &x, &rows, &cols))
return;
tty_setcolor (color);
ctext = g_malloc (sizeof (cchar_t) * (cols + 1));
for (int row = 0; row < rows; row++)
{
mvin_wchnstr (y + row, x, ctext, cols);
for (int col = 0; col < cols; col++)
{
getcchar (&ctext[col], wch, &attrs, &color_pair, NULL);
setcchar (&ctext[col], wch, attrs, color, NULL);
}
mvadd_wchnstr (y + row, x, ctext, cols);
}
g_free (ctext);
}
/* --------------------------------------------------------------------------------------------- */
void
tty_set_alt_charset (gboolean alt_charset)
{

View File

@ -622,6 +622,15 @@ tty_fill_region (int y, int x, int rows, int cols, unsigned char ch)
/* --------------------------------------------------------------------------------------------- */
void
tty_colorize_area (int y, int x, int rows, int cols, int color)
{
if (use_colors)
SLsmg_set_color_in_region (color, y, x, rows, cols);
}
/* --------------------------------------------------------------------------------------------- */
void
tty_set_alt_charset (gboolean alt_charset)
{

View File

@ -264,6 +264,17 @@ tty_draw_box (int y, int x, int ys, int xs, gboolean single)
/* --------------------------------------------------------------------------------------------- */
void
tty_draw_box_shadow (int y, int x, int rows, int cols, int shadow_color)
{
/* draw right shadow */
tty_colorize_area (y + 1, x + cols, rows - 1, 2, shadow_color);
/* draw bottom shadow */
tty_colorize_area (y + rows, x + 2, 1, cols, shadow_color);
}
/* --------------------------------------------------------------------------------------------- */
char *
mc_tty_normalize_from_utf8 (const char *str)
{

View File

@ -126,6 +126,7 @@ extern void tty_print_one_hline (gboolean single);
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, gboolean single);
extern void tty_draw_box_shadow (int y, int x, int rows, int cols, int shadow_color);
extern void tty_fill_region (int y, int x, int rows, int cols, unsigned char ch);
extern int tty_resize (int fd);

View File

@ -76,6 +76,9 @@ frame_draw (const WFrame * f)
colors = widget_get_colors (w);
if (mc_global.tty.shadows)
tty_draw_box_shadow (w->y, w->x, w->lines, w->cols, SHADOW_COLOR);
tty_setcolor (colors[FRAME_COLOR_NORMAL]);
tty_fill_region (w->y, w->x, w->lines, w->cols, ' ');
tty_draw_box (w->y + d, w->x + d, w->lines - 2 * d, w->cols - 2 * d, f->single);

View File

@ -187,6 +187,10 @@ menubar_draw_drop (const WMenuBar * menubar)
if (column + menu->max_entry_len + 5 > (gsize) w->cols)
column = w->cols - menu->max_entry_len - 5;
if (mc_global.tty.shadows)
tty_draw_box_shadow (w->y + 1, w->x + column, count + 2, menu->max_entry_len + 5,
SHADOW_COLOR);
tty_setcolor (MENU_ENTRY_COLOR);
tty_draw_box (w->y + 1, w->x + column, count + 2, menu->max_entry_len + 5, FALSE);

View File

@ -39,6 +39,7 @@
header = yellow;black
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = brightcyan;blue

View File

@ -39,6 +39,7 @@
header = yellow;black
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = brightcyan;blue

View File

@ -39,6 +39,7 @@
header = yellow;blue
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -39,6 +39,7 @@
header = yellow;blue
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -41,6 +41,7 @@
header = yellow;blue
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -41,6 +41,7 @@
header = yellow;blue
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -36,6 +36,7 @@
header = brightred;
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = brightcyan;blue

View File

@ -45,6 +45,7 @@
reverse =
commandlinemark = ;main1
header = main2
shadow = black;gray12
[dialog]
_default_ = black;bgdarker

View File

@ -45,6 +45,7 @@
reverse =
commandlinemark = ;main1
header = main2
shadow = black;gray12
[dialog]
_default_ = black;bgdarker

View File

@ -42,6 +42,7 @@
header = yellow;color237
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -39,6 +39,7 @@
header = yellow;blue
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = black;lightgray

View File

@ -81,6 +81,7 @@
disabled = color8;color7
#inputhistory =
#commandhistory =
shadow = color7;color0
[dialog]
_default_ = color0;color7

View File

@ -81,6 +81,7 @@
disabled = color8;color7
#inputhistory =
#commandhistory =
shadow = color7;color0
[dialog]
_default_ = color0;color7

View File

@ -81,6 +81,7 @@
disabled = color8;color7
#inputhistory =
#commandhistory =
shadow = color7;color0
[dialog]
_default_ = color0;color7

View File

@ -81,6 +81,7 @@
disabled = color8;color7
#inputhistory =
#commandhistory =
shadow = color7;color0
[dialog]
_default_ = color0;color7

View File

@ -81,6 +81,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color240;color0
[dialog]
_default_ = color252;color239

View File

@ -81,6 +81,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color240;color0
[dialog]
_default_ = color252;color239

View File

@ -81,6 +81,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color240;color0
[dialog]
_default_ = color252;color239

View File

@ -81,6 +81,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color240;color0
[dialog]
_default_ = color252;color239

View File

@ -39,6 +39,7 @@
header = lightgray;black
inputhistory =
commandhistory =
shadow = gray;black
[dialog]
_default_ = lightgray;black

View File

@ -94,6 +94,7 @@
reverse = ;rgb452
commandlinemark = white;gray
header = red;;italic
shadow = black;rgb221
[dialog]
_default_ = black;rgb553

View File

@ -65,6 +65,8 @@
DialogFocus = #69880c
Input = #b5c400
PaleFg = #555
ShadowFg = #7f7f55
ShadowBg = #4c1002
Error = #840000
ErrorFocus = #b00
Top = #ff9909
@ -106,6 +108,7 @@
reverse = #000;Bottom
commandlinemark = #000;DialogFocus
header = HeaderFg
shadow = ShadowFg;ShadowBg
[dialog]
_default_ = #000;Dialog

View File

@ -65,6 +65,8 @@
DialogFocus = #b3de85
Input = Main
PaleFg = #777
ShadowFg = #000
ShadowBg = #797f73
Error = #c62b41
ErrorFocus = #e16d7e
Top = #f699a6
@ -106,6 +108,7 @@
reverse = #000;Bottom
commandlinemark = #000;DialogFocus
header = HeaderFg
shadow = ShadowFg;ShadowBg
[dialog]
_default_ = #000;Dialog

View File

@ -65,6 +65,8 @@
DialogFocus = #f864f6
Input = #d7ffad
PaleFg = #777
ShadowFg = #000
ShadowBg = #7f7659
Error = #d40707
ErrorFocus = #db7b7b
Top = #46cef3
@ -106,6 +108,7 @@
reverse = #000;Bottom
commandlinemark = #000;DialogFocus
header = HeaderFg
shadow = ShadowFg;ShadowBg
[dialog]
_default_ = #000;Dialog

View File

@ -65,6 +65,8 @@
DialogFocus = #afbad8
Input = Main
PaleFg = #777
ShadowFg = #000
ShadowBg = #727176
Error = #3c4766
ErrorFocus = #586896
Top = #6b99d7
@ -106,6 +108,7 @@
reverse = #000;Bottom
commandlinemark = #000;DialogFocus
header = HeaderFg
shadow = ShadowFg;ShadowBg
[dialog]
_default_ = #000;Dialog

View File

@ -82,6 +82,8 @@
#commandhistory =
#commandlinemark = black;lightgray
shadow = color239;black
[dialog]
_default_ = black;color250
dhotnormal = color88;;

View File

@ -48,6 +48,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color239;black
[dialog]
_default_ = color252;color239

View File

@ -47,6 +47,7 @@
disabled = color246;color239
#inputhistory =
#commandhistory =
shadow = color239;black
[dialog]
_default_ = color252;color239

View File

@ -42,6 +42,7 @@
#include "lib/global.h"
#include "lib/tty/tty.h"
#include "lib/tty/color.h" /* tty_use_colors() */
#include "lib/tty/key.h" /* XCTRL and ALT macros */
#include "lib/skin.h" /* INPUT_COLOR */
#include "lib/mcconfig.h" /* Load/save user formats */
@ -119,6 +120,8 @@ static gchar *current_skin_name;
static WListbox *bg_list = NULL;
#endif /* ENABLE_BACKGROUND */
static unsigned long shadows_id;
/* --------------------------------------------------------------------------------------------- */
/*** file scope functions ************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -272,6 +275,38 @@ sel_skin_button (WButton * button, int action)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
appearance_box_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
switch (msg)
{
case MSG_INIT:
if (!tty_use_colors ())
{
Widget *shadow;
shadow = widget_find_by_id (w, shadows_id);
CHECK (shadow)->state = FALSE;
widget_disable (shadow, TRUE);
}
return MSG_HANDLED;
case MSG_NOTIFY:
if (sender != NULL && sender->id == shadows_id)
{
mc_global.tty.shadows = CHECK (sender)->state;
repaint_screen ();
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
default:
return dlg_default_callback (w, sender, msg, parm, data);
}
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
@ -590,6 +625,8 @@ configure_box (void)
void
appearance_box (void)
{
gboolean shadows = mc_global.tty.shadows;
current_skin_name = g_strdup (mc_skin__default.name);
skin_names = mc_skin_list ();
@ -602,6 +639,8 @@ appearance_box (void)
QUICK_BUTTON (str_fit_to_term (skin_name_to_label (current_skin_name), 20, J_LEFT_FIT),
B_USER, sel_skin_button, NULL),
QUICK_STOP_COLUMNS,
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("&Shadows"), &mc_global.tty.shadows, &shadows_id),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
/* *INDENT-ON* */
@ -610,14 +649,17 @@ appearance_box (void)
quick_dialog_t qdlg = {
-1, -1, 54,
N_("Appearance"), "[Appearance]",
quick_widgets, dlg_default_callback, NULL
quick_widgets, appearance_box_callback, NULL
};
if (quick_dialog (&qdlg) == B_ENTER)
mc_config_set_string (mc_global.main_config, CONFIG_APP_SECTION, "skin",
current_skin_name);
else
{
skin_apply (NULL);
mc_global.tty.shadows = shadows;
}
}
g_free (current_skin_name);

View File

@ -360,6 +360,7 @@ static const struct
#endif /* USE_INTERNAL_EDIT */
{ "editor_ask_filename_before_edit", &editor_ask_filename_before_edit },
{ "nice_rotating_dash", &nice_rotating_dash },
{ "shadows", &mc_global.tty.shadows },
{ "mcview_remember_file_position", &mcview_remember_file_position },
{ "auto_fill_mkdir_name", &auto_fill_mkdir_name },
{ "copymove_persistent_attr", &copymove_persistent_attr },