mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 04:22:34 +03:00
Base support of skins.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
488266674e
commit
981fe001d1
@ -556,12 +556,14 @@ contrib/dist/pkginfo
|
||||
contrib/dist/prototype
|
||||
|
||||
misc/Makefile
|
||||
misc/skins/Makefile
|
||||
misc/mc.ext
|
||||
|
||||
src/Makefile
|
||||
src/filehighlight/Makefile
|
||||
src/mcconfig/Makefile
|
||||
src/search/Makefile
|
||||
src/skin/Makefile
|
||||
src/tty/Makefile
|
||||
src/viewer/Makefile
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "../src/global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
#include "../src/search/search.h"
|
||||
|
@ -46,7 +46,7 @@
|
||||
#define MAX_LINE_LEN 1024
|
||||
|
||||
#include "../src/tty/tty.h" /* tty_printf() */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h" /* is_idle() */
|
||||
|
||||
#include "../src/widget.h" /* buttonbar_redraw() */
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
#include "../src/search/search.h" /* search engine */
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "edit-impl.h"
|
||||
#include "edit-widget.h"
|
||||
@ -504,7 +504,7 @@ void edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
|
||||
option_syntax_highlighting && tty_use_colors ()) {
|
||||
translate_rule_to_color (edit, edit_get_rule (edit, byte_index), color);
|
||||
} else {
|
||||
*color = tty_use_colors () ? EDITOR_NORMAL_COLOR_INDEX : 0;
|
||||
*color = tty_use_colors () ? mc_skin_color_get("editor", "_default_") : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
## Process this file with automake to create Makefile.in.
|
||||
|
||||
SUBDIRS = skins
|
||||
|
||||
LIBFILES_OUT = mc.ext
|
||||
|
||||
noinst_DATA = xterm.ad
|
||||
|
@ -1,20 +1,3 @@
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
stalelink=brightred;
|
||||
symlink=lightgray;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[executable]
|
||||
type=FILE_EXE
|
||||
|
||||
|
6
misc/skins/Makefile.am
Normal file
6
misc/skins/Makefile.am
Normal file
@ -0,0 +1,6 @@
|
||||
skindir = $(pkgdatadir)/skins
|
||||
|
||||
skin_DATA = \
|
||||
default.ini \
|
||||
far.ini
|
||||
|
77
misc/skins/default.ini
Normal file
77
misc/skins/default.ini
Normal file
@ -0,0 +1,77 @@
|
||||
[skin]
|
||||
description=Standart skin
|
||||
|
||||
[Lines]
|
||||
lefttop=┌
|
||||
righttop=┐
|
||||
centertop=─
|
||||
centerbottom=─
|
||||
leftbottom=└
|
||||
rightbottom=┘
|
||||
leftmiddle=├
|
||||
rightmiddle=┤
|
||||
centermiddle=┼
|
||||
horiz=─
|
||||
vert=│
|
||||
thinhoriz=─
|
||||
thinvert=│
|
||||
|
||||
[core]
|
||||
_default_=lightgray;blue
|
||||
selected=black;cyan;A_REVERSE
|
||||
marked=yellow;blue;A_BOLD
|
||||
markselect=yellow;cyan; A_REVERSE|A_BOLD
|
||||
reverse=black;lightgray;A_REVERSE
|
||||
gauge=white;black
|
||||
input=black;cyan
|
||||
|
||||
[dialog]
|
||||
_default_=black;lightgray;A_REVERSE
|
||||
focus=black;cyan;A_BOLD
|
||||
hotnormal=blue;lightgray
|
||||
hotfocus=blue;cyan
|
||||
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
symlink=lightgray;
|
||||
stalelink=brightred;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
hidden=black;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[menu]
|
||||
_default_=white;cyan
|
||||
entry=white;cyan;A_REVERSE
|
||||
hot=yellow;cyan
|
||||
selected=white;black;A_BOLD
|
||||
hotselected=yellow;black
|
||||
|
||||
[help]
|
||||
_default_=black;lightgray;A_REVERSE
|
||||
italic=red;lightgray;A_REVERSE
|
||||
bold=blue;lightgray;A_REVERSE
|
||||
link=black;cyan
|
||||
slink=yellow;blue;A_BOLD
|
||||
|
||||
[editor]
|
||||
bold=yellow;blue;A_BOLD
|
||||
marked=black;cyan;A_REVERSE
|
||||
whitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
|
||||
[viewer]
|
||||
underline=brightred;blue;A_UNDERLINE
|
||||
|
||||
[error]
|
||||
_default_=white;red;A_BOLD
|
||||
hotnormal=yellow;red
|
||||
hotfocus=yellow;lightgray
|
77
misc/skins/far.ini
Normal file
77
misc/skins/far.ini
Normal file
@ -0,0 +1,77 @@
|
||||
[skin]
|
||||
description=Far-like skin
|
||||
|
||||
[Lines]
|
||||
lefttop=╔
|
||||
righttop=╗
|
||||
centertop=╤
|
||||
centerbottom=╧
|
||||
leftbottom=╚
|
||||
rightbottom=╝
|
||||
leftmiddle=╟
|
||||
rightmiddle=╢
|
||||
centermiddle=┼
|
||||
horiz=═
|
||||
vert=║
|
||||
thinhoriz=─
|
||||
thinvert=│
|
||||
|
||||
[core]
|
||||
_default_=lightgray;blue
|
||||
selected=black;cyan;A_REVERSE
|
||||
marked=yellow;blue;A_BOLD
|
||||
markselect=yellow;cyan; A_REVERSE|A_BOLD
|
||||
reverse=black;lightgray;A_REVERSE
|
||||
gauge=white;black
|
||||
input=black;cyan
|
||||
|
||||
[dialog]
|
||||
_default_=black;lightgray;A_REVERSE
|
||||
focus=black;cyan;A_BOLD
|
||||
hotnormal=blue;lightgray
|
||||
hotfocus=blue;cyan
|
||||
|
||||
[filehighlight]
|
||||
directory=white;
|
||||
executable=brightgreen;
|
||||
symlink=lightgray;
|
||||
stalelink=brightred;
|
||||
device=brightmagenta;
|
||||
special=black;
|
||||
core=red;
|
||||
temp=gray;
|
||||
archive=brightmagenta;
|
||||
hidden=black;
|
||||
doc=brown;
|
||||
source=cyan;
|
||||
media=green;
|
||||
graph=brightcyan;
|
||||
database=brightred;
|
||||
|
||||
[menu]
|
||||
_default_=white;cyan
|
||||
entry=white;cyan;A_REVERSE
|
||||
hot=yellow;cyan
|
||||
selected=white;black;A_BOLD
|
||||
hotselected=yellow;black
|
||||
|
||||
[help]
|
||||
_default_=black;lightgray;A_REVERSE
|
||||
italic=red;lightgray;A_REVERSE
|
||||
bold=blue;lightgray;A_REVERSE
|
||||
link=black;cyan
|
||||
slink=yellow;blue;A_BOLD
|
||||
|
||||
[editor]
|
||||
bold=yellow;blue;A_BOLD
|
||||
marked=black;cyan;A_REVERSE
|
||||
whitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
|
||||
[viewer]
|
||||
underline=brightred;blue;A_UNDERLINE
|
||||
|
||||
[error]
|
||||
_default_=white;red;A_BOLD
|
||||
hotnormal=yellow;red
|
||||
hotfocus=yellow;lightgray
|
@ -1,4 +1,4 @@
|
||||
SUBDIRS = mcconfig search tty viewer filehighlight
|
||||
SUBDIRS = mcconfig search tty viewer filehighlight skin
|
||||
|
||||
AM_CFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) $(PCRE_CFLAGS)
|
||||
|
||||
@ -44,8 +44,9 @@ SEARCHLIB = search/libsearch.la
|
||||
TTYLIB = tty/libmctty.la
|
||||
VIEWERLIB = viewer/libmcviewer.la
|
||||
FILEHIGHLIGHTLIB=filehighlight/libmcfilehighlight.la
|
||||
SKINLIB = skin/libmcskin.la
|
||||
|
||||
mc_LDADD = $(EDITLIB) $(VFSLIB) $(FILEHIGHLIGHTLIB) \
|
||||
mc_LDADD = $(EDITLIB) $(VFSLIB) $(FILEHIGHLIGHTLIB) $(SKINLIB) \
|
||||
$(MCCONFIGLIB) $(SEARCHLIB) $(TTYLIB) $(VIEWERLIB) \
|
||||
$(INTLLIBS) $(MCLIBS) $(SLANGLIB) $(LIBICONV) $(GLIB_LIBS)
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
10
src/args.c
10
src/args.c
@ -69,6 +69,9 @@ gboolean mc_args__disable_colors = FALSE;
|
||||
/* Force colors, only used by Slang */
|
||||
gboolean mc_args__force_colors = FALSE;
|
||||
|
||||
/* Show in specified skin */
|
||||
char *mc_args__skin = NULL;
|
||||
|
||||
char *mc_args__last_wd_file = NULL;
|
||||
|
||||
/* when enabled NETCODE, use folowing file as logfile */
|
||||
@ -246,6 +249,13 @@ static const GOptionEntry argument_color_table[] = {
|
||||
"<string>"
|
||||
},
|
||||
|
||||
{
|
||||
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&mc_args__skin,
|
||||
N_("Show mc with specified skin"),
|
||||
"<string>"
|
||||
},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
#undef ARGS_COLOR_OPTIONS
|
||||
|
@ -15,6 +15,7 @@ extern gboolean mc_args__slow_terminal;
|
||||
extern gboolean mc_args__ugly_line_drawing;
|
||||
extern gboolean mc_args__disable_colors;
|
||||
extern gboolean mc_args__force_colors;
|
||||
extern char *mc_args__skin;
|
||||
extern gboolean mc_args__version;
|
||||
extern char *mc_args__last_wd_file;
|
||||
extern char *mc_args__netfs_logfile;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
|
||||
#include "../src/mcconfig/mcconfig.h" /* Load/save user formats */
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h" /* add_widget() */
|
||||
#include "widget.h" /* NORMAL_BUTTON */
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "user.h" /* expand_format */
|
||||
#include "subshell.h" /* SUBSHELL_EXIT */
|
||||
#include "tree.h" /* for tree_chdir */
|
||||
#include "../src/tty/color.h" /* DEFAULT_COLOR */
|
||||
#include "../src/skin/skin.h" /* DEFAULT_COLOR */
|
||||
#include "execute.h" /* shell_execute */
|
||||
#include "../src/strescape.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* tty_set_normal_attrs */
|
||||
#include "../src/skin/skin.h" /* tty_set_normal_attrs */
|
||||
#include "../src/tty/win.h"
|
||||
|
||||
#include "cons.saver.h"
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/util.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
#include "internal.h"
|
||||
|
||||
@ -225,7 +225,6 @@ mc_fhl_get_color (mc_fhl_t * fhl, file_entry * fe)
|
||||
mc_fhl_filter_t *mc_filter;
|
||||
int ret;
|
||||
|
||||
|
||||
if (fhl == NULL)
|
||||
return NORMAL_COLOR;
|
||||
|
||||
|
@ -31,12 +31,14 @@
|
||||
#include "../src/global.h"
|
||||
#include "../src/main.h"
|
||||
#include "../src/strescape.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "fhl.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
extern mc_skin_t mc_skin__default;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
@ -49,29 +51,8 @@
|
||||
static void
|
||||
mc_fhl_parce_fill_color_info (mc_fhl_filter_t * mc_filter, mc_fhl_t * fhl, const gchar * group_name)
|
||||
{
|
||||
gchar **colors;
|
||||
gsize colors_size;
|
||||
|
||||
colors = mc_config_get_string_list (fhl->config, "filehighlight", group_name, &colors_size);
|
||||
|
||||
if (colors == NULL)
|
||||
return;
|
||||
|
||||
if (colors[0] == NULL) {
|
||||
g_strfreev (colors);
|
||||
return;
|
||||
}
|
||||
|
||||
mc_filter->fgcolor = g_strdup (colors[0]);
|
||||
|
||||
if (colors[1] == NULL)
|
||||
mc_filter->bgcolor = NULL;
|
||||
else
|
||||
mc_filter->bgcolor = g_strdup (colors[1]);
|
||||
|
||||
g_strfreev (colors);
|
||||
|
||||
mc_filter->color_pair_index = tty_try_alloc_color_pair (mc_filter->fgcolor, mc_filter->bgcolor);
|
||||
(void) fhl;
|
||||
mc_filter->color_pair_index = mc_skin_color_get("filehighlight", group_name);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -260,41 +241,34 @@ mc_fhl_init_from_standart_files (mc_fhl_t * fhl)
|
||||
gboolean
|
||||
mc_fhl_parce_ini_file (mc_fhl_t * fhl)
|
||||
{
|
||||
gchar **ftype_names, **orig_ftype_names;
|
||||
gchar **group_names, **orig_group_names;
|
||||
gsize ftype_names_size;
|
||||
|
||||
|
||||
mc_fhl_array_free (fhl);
|
||||
fhl->filters = g_ptr_array_new ();
|
||||
|
||||
if (!mc_config_has_group (fhl->config, "filehighlight"))
|
||||
orig_group_names = group_names =
|
||||
mc_config_get_groups (fhl->config, &ftype_names_size);
|
||||
|
||||
if (group_names == NULL)
|
||||
return FALSE;
|
||||
|
||||
orig_ftype_names = ftype_names =
|
||||
mc_config_get_keys (fhl->config, "filehighlight", &ftype_names_size);
|
||||
while (*group_names) {
|
||||
|
||||
while (*ftype_names) {
|
||||
|
||||
if (!mc_config_has_group (fhl->config, *ftype_names)) {
|
||||
ftype_names++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mc_config_has_param (fhl->config, *ftype_names, "type")) {
|
||||
if (mc_config_has_param (fhl->config, *group_names, "type")) {
|
||||
/* parce filetype filter */
|
||||
mc_fhl_parce_get_file_type_id (fhl, *ftype_names);
|
||||
} else if (mc_config_has_param (fhl->config, *ftype_names, "regexp")) {
|
||||
mc_fhl_parce_get_file_type_id (fhl, *group_names);
|
||||
} else if (mc_config_has_param (fhl->config, *group_names, "regexp")) {
|
||||
/* parce regexp filter */
|
||||
mc_fhl_parce_get_regexp (fhl, *ftype_names);
|
||||
} else if (mc_config_has_param (fhl->config, *ftype_names, "extensions")) {
|
||||
mc_fhl_parce_get_regexp (fhl, *group_names);
|
||||
} else if (mc_config_has_param (fhl->config, *group_names, "extensions")) {
|
||||
/* parce extensions filter */
|
||||
mc_fhl_parce_get_extensions (fhl, *ftype_names);
|
||||
mc_fhl_parce_get_extensions (fhl, *group_names);
|
||||
}
|
||||
group_names++;
|
||||
}
|
||||
|
||||
ftype_names++;
|
||||
}
|
||||
|
||||
g_strfreev (orig_ftype_names);
|
||||
g_strfreev (orig_group_names);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
#include "../src/search/search.h"
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h" /* COLS */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h" /* KEY_M_CTRL */
|
||||
|
||||
#include "dialog.h"
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h" /* is_idle() */
|
||||
#include "../src/tty/mouse.h" /* Gpm_Event */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h" /* default_proc*/
|
||||
|
@ -49,7 +49,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/key.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/win.h" /* do_enter_ca_mode() */
|
||||
|
25
src/main.c
25
src/main.c
@ -42,13 +42,14 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* For init_key() */
|
||||
#include "../src/tty/win.h" /* xterm_flag */
|
||||
|
||||
#include "../src/mcconfig/mcconfig.h"
|
||||
#include "../src/args.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
|
||||
#include "dir.h"
|
||||
@ -1666,13 +1667,11 @@ mc_maybe_editor_or_viewer (void)
|
||||
static void
|
||||
do_nc (void)
|
||||
{
|
||||
const int midnight_colors[DLG_COLOR_NUM] =
|
||||
{
|
||||
NORMAL_COLOR, /* NORMALC */
|
||||
REVERSE_COLOR, /* FOCUSC */
|
||||
INPUT_COLOR, /* HOT_NORMALC */
|
||||
NORMAL_COLOR /* HOT_FOCUSC */
|
||||
};
|
||||
int midnight_colors[DLG_COLOR_NUM];
|
||||
midnight_colors[0] = mc_skin_color_get("dialog", "_default_");
|
||||
midnight_colors[1] = mc_skin_color_get("dialog", "focus");
|
||||
midnight_colors[2] = mc_skin_color_get("dialog", "hotnormal");
|
||||
midnight_colors[3] = mc_skin_color_get("dialog", "hotfocus");
|
||||
|
||||
midnight_dlg = create_dlg (0, 0, LINES, COLS, midnight_colors, midnight_callback,
|
||||
"[main]", NULL, DLG_WANT_IDLE);
|
||||
@ -1959,6 +1958,10 @@ main (int argc, char *argv[])
|
||||
load_setup ();
|
||||
|
||||
tty_init_colors (mc_args__disable_colors, mc_args__force_colors);
|
||||
|
||||
mc_skin_init();
|
||||
mc_filehighlight = mc_fhl_new (TRUE);
|
||||
|
||||
dlg_set_default_colors ();
|
||||
|
||||
/* create home directory */
|
||||
@ -1998,12 +2001,11 @@ main (int argc, char *argv[])
|
||||
#endif /* HAVE_SUBSHELL_SUPPORT */
|
||||
prompt = (geteuid () == 0) ? "# " : "$ ";
|
||||
|
||||
mc_filehighlight = mc_fhl_new (TRUE);
|
||||
|
||||
/* Program main loop */
|
||||
if (!midnight_shutdown)
|
||||
do_nc ();
|
||||
|
||||
mc_fhl_free (&mc_filehighlight);
|
||||
/* Save the tree store */
|
||||
tree_store_save ();
|
||||
|
||||
@ -2012,6 +2014,9 @@ main (int argc, char *argv[])
|
||||
|
||||
flush_extension_file (); /* does only free memory */
|
||||
|
||||
mc_fhl_free (&mc_filehighlight);
|
||||
mc_skin_deinit();
|
||||
|
||||
tty_shutdown ();
|
||||
|
||||
if (console_flag && !(quit & SUBSHELL_EXIT))
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* key macros */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
|
||||
#include "dialog.h"
|
||||
#include "widget.h"
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h" /* For Gpm_Event */
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
#include "../src/filehighlight/fhl.h"
|
||||
|
15
src/skin/Makefile.am
Normal file
15
src/skin/Makefile.am
Normal file
@ -0,0 +1,15 @@
|
||||
noinst_LTLIBRARIES = libmcskin.la
|
||||
|
||||
libmcskin_la_SOURCES = \
|
||||
colors.c \
|
||||
colors-old.c \
|
||||
common.c \
|
||||
ini-file.c \
|
||||
skin.h \
|
||||
internal.h
|
||||
|
||||
libmcskin_la_CFLAGS=-I../ -I$(top_srcdir)/src \
|
||||
$(GLIB_CFLAGS) $(PCRE_CFLAGS) \
|
||||
-DDATADIR=\""$(pkgdatadir)/"\" -DLOCALEDIR=\""$(localedir)"\"
|
||||
|
||||
libmcskin_la_LIBADD = $(PCRE_LIBS)
|
121
src/skin/colors-old.c
Normal file
121
src/skin/colors-old.c
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Work with colors - backward compability
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h> /* size_t */
|
||||
#include "../src/tty/color.h"
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/setup.h"
|
||||
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
configure_colors_string (const char *the_color_string)
|
||||
{
|
||||
/*
|
||||
const size_t map_len = color_map_len ();
|
||||
|
||||
size_t i;
|
||||
char **color_strings, **p;
|
||||
|
||||
if (!the_color_string)
|
||||
return;
|
||||
|
||||
color_strings = g_strsplit (the_color_string, ":", -1);
|
||||
|
||||
p = color_strings;
|
||||
|
||||
while ((p != NULL) && (*p != NULL)) {
|
||||
char **cfb;
|
||||
|
||||
// color, fore, back
|
||||
// cfb[0] - entry name
|
||||
// cfb[1] - fore color
|
||||
// cfb[2] - back color
|
||||
|
||||
char *e;
|
||||
|
||||
cfb = g_strsplit_set (*p, "=,", 3);
|
||||
p++;
|
||||
|
||||
if (cfb[0] == NULL) {
|
||||
g_strfreev (cfb);
|
||||
continue;
|
||||
}
|
||||
|
||||
// append '=' to the entry name
|
||||
e = g_strdup_printf ("%s=", cfb[0]);
|
||||
g_free (cfb[0]);
|
||||
cfb[0] = e;
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL) {
|
||||
size_t klen = strlen (color_map [i].name);
|
||||
|
||||
if (strncmp (cfb[0], color_map [i].name, klen) == 0) {
|
||||
if ((cfb[1] != NULL) && (*cfb[1] != '\0'))
|
||||
get_color (cfb[1], &color_map [i].fg);
|
||||
if ((cfb[2] != NULL) && (*cfb[2] != '\0'))
|
||||
get_color (cfb[2], &color_map [i].bg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (cfb);
|
||||
}
|
||||
|
||||
g_strfreev (color_strings);
|
||||
*/
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_colors_old_configure (void)
|
||||
{
|
||||
configure_colors_string (setup_color_string);
|
||||
configure_colors_string (term_color_string);
|
||||
configure_colors_string (getenv ("MC_COLOR_TABLE"));
|
||||
configure_colors_string (command_line_colors);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
293
src/skin/colors.c
Normal file
293
src/skin/colors.c
Normal file
@ -0,0 +1,293 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Work with colors
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
int mc_skin_color__cache[MC_SKIN_COLOR_CACHE_COUNT];
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
inline static gchar *
|
||||
mc_skin_color_make_hash_key(const gchar *group, const gchar *key)
|
||||
{
|
||||
return g_strdup_printf("%s.%s", group, key);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_from_hash(mc_skin_t *mc_skin, const gchar *group, const gchar *key)
|
||||
{
|
||||
gchar *key_name;
|
||||
mc_skin_color_t * mc_skin_color;
|
||||
|
||||
if (group == NULL || key == NULL)
|
||||
return NULL;
|
||||
|
||||
if (mc_skin == NULL)
|
||||
mc_skin = &mc_skin__default;
|
||||
|
||||
key_name = mc_skin_color_make_hash_key(group, key);
|
||||
mc_skin_color = (mc_skin_color_t *) g_hash_table_lookup (mc_skin->colors, (gpointer) key_name);
|
||||
g_free(key_name);
|
||||
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_remove_from_hash(mc_skin_t *mc_skin, const gchar *group, const gchar *key)
|
||||
{
|
||||
gchar *key_name;
|
||||
if (group == NULL || key == NULL)
|
||||
return;
|
||||
|
||||
if (mc_skin == NULL)
|
||||
mc_skin = &mc_skin__default;
|
||||
|
||||
key_name = mc_skin_color_make_hash_key(group, key);
|
||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
||||
g_free(key_name);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_add_to_hash(mc_skin_t *mc_skin, const gchar *group, const gchar *key, mc_skin_color_t *mc_skin_color)
|
||||
{
|
||||
gchar *key_name;
|
||||
|
||||
key_name = mc_skin_color_make_hash_key(group, key);
|
||||
if (key_name == NULL)
|
||||
return;
|
||||
|
||||
if ( g_hash_table_lookup (mc_skin->colors, (gpointer) key_name) != NULL )
|
||||
{
|
||||
g_hash_table_remove (mc_skin->colors, (gpointer) key_name);
|
||||
}
|
||||
|
||||
g_hash_table_insert (mc_skin->colors, (gpointer) key_name, (gpointer) mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_with_defaults(const gchar *group, const gchar *name)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash(NULL, group, name);
|
||||
if (mc_skin_color != NULL)
|
||||
return mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash(NULL, group, "_default_");
|
||||
if (mc_skin_color != NULL)
|
||||
return mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_from_hash(NULL, "core", "_default_");
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static mc_skin_color_t *
|
||||
mc_skin_color_get_from_ini_file(mc_skin_t *mc_skin, const gchar *group, const gchar *key)
|
||||
{
|
||||
gsize items_count;
|
||||
gchar **values;
|
||||
mc_skin_color_t *mc_skin_color, *tmp;
|
||||
|
||||
values = mc_config_get_string_list (mc_skin->config, group, key, &items_count);
|
||||
|
||||
if (values == NULL || *values == NULL)
|
||||
{
|
||||
if (values)
|
||||
g_strfreev(values);
|
||||
return NULL;
|
||||
}
|
||||
mc_skin_color = g_new0(mc_skin_color_t,1);
|
||||
if (mc_skin_color == NULL)
|
||||
{
|
||||
g_strfreev(values);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (items_count)
|
||||
{
|
||||
case 0:
|
||||
tmp = mc_skin_color_get_with_defaults(group, "_default_");
|
||||
if (tmp)
|
||||
{
|
||||
mc_skin_color->fgcolor = g_strdup(tmp->fgcolor);
|
||||
mc_skin_color->bgcolor = g_strdup(tmp->bgcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_strfreev(values);
|
||||
g_free(mc_skin_color);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strdup(values[0]) : NULL;
|
||||
tmp = mc_skin_color_get_with_defaults(group, "_default_");
|
||||
if (tmp)
|
||||
mc_skin_color->bgcolor = g_strdup(tmp->bgcolor);
|
||||
else
|
||||
|
||||
mc_skin_color->bgcolor = NULL;
|
||||
break;
|
||||
case 2:
|
||||
mc_skin_color->fgcolor = (values[0]) ? g_strdup(values[0]) : NULL;
|
||||
mc_skin_color->bgcolor = (values[1]) ? g_strdup(values[1]) : NULL;
|
||||
break;
|
||||
}
|
||||
g_strfreev (values);
|
||||
|
||||
mc_skin_color->pair_index = tty_try_alloc_color_pair (mc_skin_color->fgcolor, mc_skin_color->bgcolor);
|
||||
|
||||
return mc_skin_color;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_color_set_default_for_terminal(mc_skin_t *mc_skin)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
mc_skin_color = g_new0(mc_skin_color_t,1);
|
||||
if (mc_skin_color == NULL)
|
||||
return;
|
||||
|
||||
mc_skin_color->fgcolor = g_strdup("default");
|
||||
mc_skin_color->bgcolor = g_strdup("default");
|
||||
mc_skin_color->pair_index = tty_try_alloc_color_pair (mc_skin_color->fgcolor, mc_skin_color->bgcolor);
|
||||
mc_skin_color_add_to_hash(mc_skin, "skin", "terminal_default_color", mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
static void
|
||||
mc_skin_color_cache_init(void)
|
||||
{
|
||||
DEFAULT_COLOR = mc_skin_color_get("skin", "terminal_default_color");
|
||||
NORMAL_COLOR = mc_skin_color_get("core", "_default_");
|
||||
MARKED_COLOR = mc_skin_color_get("core", "marked");
|
||||
SELECTED_COLOR = mc_skin_color_get("core", "selected");
|
||||
REVERSE_COLOR = mc_skin_color_get("core", "reverse");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_color_parce_ini_file(mc_skin_t *mc_skin)
|
||||
{
|
||||
gsize items_count;
|
||||
gchar **groups, **orig_groups;
|
||||
gchar **keys, **orig_keys;
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
orig_groups = groups = mc_config_get_groups (mc_skin->config, &items_count);
|
||||
|
||||
if (groups == NULL || *groups == NULL)
|
||||
{
|
||||
if (groups)
|
||||
g_strfreev(groups);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* as first, need to set up default colors */
|
||||
mc_skin_color_set_default_for_terminal(mc_skin);
|
||||
mc_skin_color = mc_skin_color_get_from_ini_file(mc_skin, "core", "_default_");
|
||||
if (mc_skin_color == NULL)
|
||||
return FALSE;
|
||||
|
||||
mc_skin_color_add_to_hash(mc_skin, "core", "_default_", mc_skin_color);
|
||||
|
||||
|
||||
for(;*groups; groups++)
|
||||
{
|
||||
if (strcasecmp("skin",*groups) == 0)
|
||||
continue;
|
||||
if (strcasecmp("lines",*groups) == 0)
|
||||
continue;
|
||||
|
||||
orig_keys = keys = mc_config_get_keys (mc_skin->config, *groups , &items_count);
|
||||
if (keys == NULL || *keys == NULL)
|
||||
{
|
||||
if (keys)
|
||||
g_strfreev(keys);
|
||||
continue;
|
||||
}
|
||||
|
||||
for(;*keys; keys++)
|
||||
{
|
||||
mc_skin_color = mc_skin_color_get_from_ini_file(mc_skin, *groups, *keys);
|
||||
if (mc_skin_color == NULL)
|
||||
continue;
|
||||
mc_skin_color_add_to_hash(mc_skin, *groups, *keys, mc_skin_color);
|
||||
}
|
||||
g_strfreev(orig_keys);
|
||||
}
|
||||
g_strfreev(orig_groups);
|
||||
|
||||
mc_skin_color_cache_init();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_skin_color_get(const gchar *group, const gchar *name)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
|
||||
mc_skin_color = mc_skin_color_get_with_defaults(group, name);
|
||||
if (mc_skin_color == NULL)
|
||||
return 0;
|
||||
|
||||
return mc_skin_color->pair_index;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
150
src/skin/common.c
Normal file
150
src/skin/common.c
Normal file
@ -0,0 +1,150 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Interface functions
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/args.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
mc_skin_t mc_skin__default;
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
static gboolean mc_skin_is_init = FALSE;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_hash_destroy_key (gpointer data)
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_hash_destroy_value (gpointer data)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color = (mc_skin_color_t *) data;
|
||||
g_free (mc_skin_color->fgcolor);
|
||||
g_free (mc_skin_color->bgcolor);
|
||||
g_free (mc_skin_color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static char *
|
||||
mc_skin_get_default_name(void)
|
||||
{
|
||||
char *tmp_str;
|
||||
|
||||
/* from command line */
|
||||
if (mc_args__skin != NULL)
|
||||
return g_strdup(mc_args__skin);
|
||||
|
||||
/* from envirovement variable */
|
||||
tmp_str = getenv ("MC_SKIN");
|
||||
if (tmp_str != NULL)
|
||||
return g_strdup(tmp_str);
|
||||
|
||||
/* from config. Or 'default' if no present in config */
|
||||
return mc_config_get_string(mc_main_config, CONFIG_APP_SECTION, "skin" , "default");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_skin_reinit(void)
|
||||
{
|
||||
mc_skin_deinit();
|
||||
mc_skin__default.name = mc_skin_get_default_name();
|
||||
mc_skin__default.colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
mc_skin_hash_destroy_key,
|
||||
mc_skin_hash_destroy_value);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_init(void)
|
||||
{
|
||||
mc_skin__default.name = mc_skin_get_default_name();
|
||||
mc_skin__default.colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
mc_skin_hash_destroy_key,
|
||||
mc_skin_hash_destroy_value);
|
||||
|
||||
if (! mc_skin_ini_file_load(&mc_skin__default))
|
||||
{
|
||||
mc_skin_reinit();
|
||||
mc_skin_set_hardcoded_skin(&mc_skin__default);
|
||||
}
|
||||
|
||||
if (! mc_skin_ini_file_parce(&mc_skin__default))
|
||||
{
|
||||
mc_skin_reinit();
|
||||
mc_skin_set_hardcoded_skin(&mc_skin__default);
|
||||
(void) mc_skin_ini_file_parce(&mc_skin__default);
|
||||
}
|
||||
mc_skin_is_init = TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_deinit(void)
|
||||
{
|
||||
|
||||
g_free(mc_skin__default.name);
|
||||
mc_skin__default.name = NULL;
|
||||
g_hash_table_destroy (mc_skin__default.colors);
|
||||
mc_skin__default.colors = NULL;
|
||||
|
||||
g_free(mc_skin__default.description);
|
||||
mc_skin__default.description = NULL;
|
||||
|
||||
if (mc_skin__default.config)
|
||||
{
|
||||
mc_config_deinit (mc_skin__default.config);
|
||||
mc_skin__default.config = NULL;
|
||||
}
|
||||
|
||||
mc_skin_is_init = FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
156
src/skin/ini-file.c
Normal file
156
src/skin/ini-file.c
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
Skins engine.
|
||||
Reading and parce ini-files
|
||||
|
||||
Copyright (C) 2009 The Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This file is part of the Midnight Commander.
|
||||
|
||||
The Midnight Commander is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Midnight Commander is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/main.h"
|
||||
#include "skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_skin_ini_file_load_search_in_dir (mc_skin_t *mc_skin, const gchar *base_dir)
|
||||
{
|
||||
char *file_name, *file_name2;
|
||||
|
||||
file_name = g_build_filename (base_dir, "skins", mc_skin->name, NULL);
|
||||
if (exist_file (file_name)){
|
||||
mc_skin->config = mc_config_init (file_name);
|
||||
g_free(file_name);
|
||||
if (mc_skin->config == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
g_free(file_name);
|
||||
|
||||
file_name2 = g_strdup_printf("%s.ini",mc_skin->name);
|
||||
file_name = g_build_filename (base_dir, "skins", file_name2, NULL);
|
||||
g_free(file_name2);
|
||||
|
||||
if (exist_file (file_name)){
|
||||
mc_skin->config = mc_config_init (file_name);
|
||||
g_free(file_name);
|
||||
if (mc_skin->config == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
g_free(file_name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_ini_file_load (mc_skin_t *mc_skin)
|
||||
{
|
||||
char *file_name, *user_home_dir;
|
||||
|
||||
file_name = g_path_get_basename(mc_skin->name);
|
||||
|
||||
if (strcmp(file_name, mc_skin->name) != 0 )
|
||||
{
|
||||
g_free(file_name);
|
||||
if (!g_path_is_absolute (mc_skin->name))
|
||||
return FALSE;
|
||||
mc_skin->config = mc_config_init (mc_skin->name);
|
||||
if (mc_skin->config == NULL)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
g_free(file_name);
|
||||
|
||||
/* ~/.mc/skins/ */
|
||||
user_home_dir = concat_dir_and_file (home_dir, MC_BASE);
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, user_home_dir))
|
||||
{
|
||||
g_free(user_home_dir);
|
||||
return TRUE;
|
||||
}
|
||||
g_free(user_home_dir);
|
||||
|
||||
/* /etc/mc/skins/ */
|
||||
if (mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home))
|
||||
return TRUE;
|
||||
|
||||
/* /usr/share/mc/skins/ */
|
||||
return mc_skin_ini_file_load_search_in_dir (mc_skin, mc_home_alt);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_skin_ini_file_parce(mc_skin_t *mc_skin)
|
||||
{
|
||||
mc_skin->description = mc_config_get_string (mc_skin->config, "skin", "description", "- no description -");
|
||||
if (! mc_skin_color_parce_ini_file(mc_skin))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mc_skin_set_hardcoded_skin(mc_skin_t *mc_skin)
|
||||
{
|
||||
mc_skin->config = mc_config_init (NULL);
|
||||
|
||||
mc_config_set_string(mc_skin->config, "skin", "description", "hardcoded skin");
|
||||
|
||||
#define set_lines(x,y) mc_config_set_string(mc_skin->config, "Lines", x, y)
|
||||
set_lines("lefttop", "+");
|
||||
set_lines("righttop", "+");
|
||||
set_lines("centertop", "-");
|
||||
set_lines("centerbottom", "-");
|
||||
set_lines("leftbottom", "+");
|
||||
set_lines("rightbottom", "+");
|
||||
set_lines("leftmiddle", "|");
|
||||
set_lines("rightmiddle", "|");
|
||||
set_lines("centermiddle", "+");
|
||||
set_lines("horiz", "-");
|
||||
set_lines("vert", "-");
|
||||
set_lines("thinhoriz", "-");
|
||||
set_lines("thinvert", "|");
|
||||
#undef set_lines
|
||||
mc_config_set_string(mc_skin->config, "core", "_default_", "white;black;");
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
31
src/skin/internal.h
Normal file
31
src/skin/internal.h
Normal file
@ -0,0 +1,31 @@
|
||||
#ifndef MC__SKIN_INTERNAL_H
|
||||
#define MC__SKIN_INTERNAL_H
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
#define MC_SKIN_COLOR_CACHE_COUNT 5
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
typedef struct mc_skin_color_struct{
|
||||
gchar *fgcolor;
|
||||
gchar *bgcolor;
|
||||
int pair_index;
|
||||
} mc_skin_color_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern mc_skin_t mc_skin__default;
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
|
||||
gboolean mc_skin_ini_file_load(mc_skin_t *);
|
||||
gboolean mc_skin_ini_file_parce(mc_skin_t *);
|
||||
void mc_skin_set_hardcoded_skin(mc_skin_t *);
|
||||
|
||||
gboolean mc_skin_ini_file_parce_colors(mc_skin_t *);
|
||||
|
||||
#endif
|
95
src/skin/skin.h
Normal file
95
src/skin/skin.h
Normal file
@ -0,0 +1,95 @@
|
||||
#ifndef MC__SKIN_H
|
||||
#define MC__SKIN_H
|
||||
|
||||
#include "../../src/mcconfig/mcconfig.h"
|
||||
|
||||
#include "../src/tty/color.h"
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
/* Beware! When using Slang with color, not all the indexes are free.
|
||||
See color-slang.h (A_*) */
|
||||
|
||||
/* cache often used colors*/
|
||||
#define DEFAULT_COLOR mc_skin_color__cache[0]
|
||||
#define NORMAL_COLOR mc_skin_color__cache[1]
|
||||
#define MARKED_COLOR mc_skin_color__cache[2]
|
||||
#define SELECTED_COLOR mc_skin_color__cache[3]
|
||||
#define REVERSE_COLOR mc_skin_color__cache[4]
|
||||
|
||||
|
||||
#define MARKED_SELECTED_COLOR mc_skin_color_get("core", "markselect")
|
||||
#define ERROR_COLOR mc_skin_color_get("error", "_default_")
|
||||
#define MENU_ENTRY_COLOR mc_skin_color_get("menu", "_default_")
|
||||
|
||||
/* Dialog colors */
|
||||
#define COLOR_NORMAL mc_skin_color_get("dialog", "_default_")
|
||||
#define COLOR_FOCUS mc_skin_color_get("dialog", "focus")
|
||||
#define COLOR_HOT_NORMAL mc_skin_color_get("dialog", "hotnormal")
|
||||
#define COLOR_HOT_FOCUS mc_skin_color_get("dialog", "hotfocus")
|
||||
|
||||
#define VIEW_UNDERLINED_COLOR mc_skin_color_get("viewer", "underline")
|
||||
#define MENU_SELECTED_COLOR mc_skin_color_get("menu", "selected")
|
||||
#define MENU_HOT_COLOR mc_skin_color_get("menu", "hot")
|
||||
#define MENU_HOTSEL_COLOR mc_skin_color_get("menu", "hotselected")
|
||||
|
||||
#define HELP_NORMAL_COLOR mc_skin_color_get("help", "_default_")
|
||||
#define HELP_ITALIC_COLOR mc_skin_color_get("help", "italic")
|
||||
#define HELP_BOLD_COLOR mc_skin_color_get("help", "bold")
|
||||
#define HELP_LINK_COLOR mc_skin_color_get("help", "link")
|
||||
#define HELP_SLINK_COLOR mc_skin_color_get("help", "slink")
|
||||
|
||||
/*
|
||||
* This should be selectable independently. Default has to be black background
|
||||
* foreground does not matter at all.
|
||||
*/
|
||||
#define GAUGE_COLOR mc_skin_color_get("core", "gauge")
|
||||
#define INPUT_COLOR mc_skin_color_get("core", "input")
|
||||
|
||||
|
||||
/*
|
||||
* 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_get("editor", "_default_")
|
||||
#define EDITOR_BOLD_COLOR mc_skin_color_get("editor", "bold")
|
||||
#define EDITOR_MARKED_COLOR mc_skin_color_get("editor", "marked")
|
||||
#define EDITOR_WHITESPACE_COLOR mc_skin_color_get("editor", "whitespace")
|
||||
|
||||
/* color of left 8 char status per line */
|
||||
#define LINE_STATE_COLOR mc_skin_color_get("editor", "linestate")
|
||||
|
||||
/* Error dialog colors */
|
||||
#define ERROR_HOT_NORMAL mc_skin_color_get("error", "hotnormal")
|
||||
#define ERROR_HOT_FOCUS mc_skin_color_get("error", "hotfocus")
|
||||
|
||||
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
||||
typedef struct mc_skin_struct{
|
||||
gchar *name;
|
||||
gchar *description;
|
||||
|
||||
mc_config_t *config;
|
||||
|
||||
GHashTable *colors;
|
||||
|
||||
} mc_skin_t;
|
||||
|
||||
/*** global variables defined in .c file *********************************************************/
|
||||
|
||||
extern int mc_skin_color__cache[];
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
void mc_skin_init(void);
|
||||
void mc_skin_deinit(void);
|
||||
|
||||
int mc_skin_color_get(const gchar *, const gchar *);
|
||||
|
||||
|
||||
#endif
|
@ -41,7 +41,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@ else
|
||||
endif
|
||||
|
||||
TTY_SRC = \
|
||||
color-internal.c color-internal.h\
|
||||
color-internal.c color-internal.h \
|
||||
color.c color.h \
|
||||
key.c key.h keyxdef.c \
|
||||
mouse.c mouse.h \
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -30,7 +31,20 @@
|
||||
#include "../../src/tty/color.h" /* colors and attributes */
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
struct color_table_s const color_table [] = {
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
typedef struct mc_tty_color_table_struct {
|
||||
const char *name;
|
||||
int value;
|
||||
} mc_tty_color_table_t;
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
mc_tty_color_table_t const color_table [] = {
|
||||
{ "black", COLOR_BLACK },
|
||||
{ "gray", COLOR_BLACK | A_BOLD },
|
||||
{ "red", COLOR_RED },
|
||||
@ -47,63 +61,48 @@ struct color_table_s const color_table [] = {
|
||||
{ "brightcyan", COLOR_CYAN | A_BOLD },
|
||||
{ "lightgray", COLOR_WHITE },
|
||||
{ "white", COLOR_WHITE | A_BOLD },
|
||||
{ "default", 0 } /* default color of the terminal */
|
||||
{ "default", 0 }, /* default color of the terminal */
|
||||
{ NULL, 0}
|
||||
};
|
||||
|
||||
struct colorpair color_map [] = {
|
||||
{ "normal=", 0, 0 }, /* normal */ /* 1 */
|
||||
{ "selected=", 0, 0 }, /* selected */
|
||||
{ "marked=", 0, 0 }, /* marked */
|
||||
{ "markselect=", 0, 0 }, /* marked/selected */
|
||||
{ "errors=", 0, 0 }, /* errors */
|
||||
{ "menu=", 0, 0 }, /* menu entry */
|
||||
{ "reverse=", 0, 0 }, /* reverse */
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* Dialog colors */
|
||||
{ "dnormal=", 0, 0 }, /* Dialog normal */ /* 8 */
|
||||
{ "dfocus=", 0, 0 }, /* Dialog focused */
|
||||
{ "dhotnormal=", 0, 0 }, /* Dialog normal/hot */
|
||||
{ "dhotfocus=", 0, 0 }, /* Dialog focused/hot */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
{ "viewunderline=", 0, 0 }, /* _\b? sequence in view, underline in editor */
|
||||
{ "menusel=", 0, 0 }, /* Menu selected color */ /* 13 */
|
||||
{ "menuhot=", 0, 0 }, /* Color for menu hotkeys */
|
||||
{ "menuhotsel=", 0, 0 }, /* Menu hotkeys/selected entry */
|
||||
|
||||
{ "helpnormal=", 0, 0 }, /* Help normal */ /* 16 */
|
||||
{ "helpitalic=", 0, 0 }, /* Italic in help */
|
||||
{ "helpbold=", 0, 0 }, /* Bold in help */
|
||||
{ "helplink=", 0, 0 }, /* Not selected hyperlink */
|
||||
{ "helpslink=", 0, 0 }, /* Selected hyperlink */
|
||||
|
||||
{ "gauge=", 0, 0 }, /* Color of the progress bar (percentage) *//* 21 */
|
||||
{ "input=", 0, 0 },
|
||||
|
||||
{ 0, 0, 0 }, /* not usable (DEFAULT_COLOR_INDEX) *//* 23 */
|
||||
{ 0, 0, 0 }, /* unused */
|
||||
{ 0, 0, 0 }, /* not usable (A_REVERSE) */
|
||||
{ 0, 0, 0 }, /* not usable (A_REVERSE_BOLD) */
|
||||
|
||||
/* editor colors start at 27 */
|
||||
{ "editnormal=", 0, 0 }, /* normal */ /* 27 */
|
||||
{ "editbold=", 0, 0 }, /* search->found */
|
||||
{ "editmarked=", 0, 0 }, /* marked/selected */
|
||||
{ "editwhitespace=", 0, 0 }, /* whitespace */
|
||||
{ "editlinestate=", 0, 0 }, /* line number bar*/
|
||||
|
||||
/* error dialog colors start at 32 */
|
||||
{ "errdhotnormal=", 0, 0 }, /* Error dialog normal/hot */ /* 32 */
|
||||
{ "errdhotfocus=", 0, 0 }, /* Error dialog focused/hot */
|
||||
};
|
||||
|
||||
size_t
|
||||
color_table_len (void)
|
||||
const char *
|
||||
mc_tty_color_get_valid_name(const char *color_name)
|
||||
{
|
||||
return sizeof (color_table)/sizeof(color_table [0]);
|
||||
size_t i;
|
||||
|
||||
if (color_name == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i=0; color_table [i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table [i].name) == 0) {
|
||||
return color_table [i].name;
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t
|
||||
color_map_len (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_tty_color_get_index_by_name(const char *color_name)
|
||||
{
|
||||
return sizeof (color_map)/sizeof(color_map [0]);
|
||||
size_t i;
|
||||
|
||||
if (color_name == NULL)
|
||||
return -1;
|
||||
|
||||
for (i=0; color_table [i].name != NULL; i++)
|
||||
if (strcmp (color_name, color_table [i].name) == 0) {
|
||||
return color_table [i].value;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -18,87 +18,28 @@
|
||||
|
||||
extern gboolean use_colors;
|
||||
|
||||
struct color_table_s {
|
||||
const char *name;
|
||||
int value;
|
||||
};
|
||||
|
||||
extern const struct color_table_s color_table [];
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# define CTYPE const char *
|
||||
#else
|
||||
# define CTYPE int
|
||||
#endif /* HAVE_SLANG */
|
||||
|
||||
struct colorpair {
|
||||
const char *name; /* Name of the entry */
|
||||
CTYPE fg; /* foreground color */
|
||||
CTYPE bg; /* background color */
|
||||
};
|
||||
typedef struct mc_color_pair_struct {
|
||||
const char *cfg;
|
||||
const char *cbg;
|
||||
int ifg;
|
||||
int ibg;
|
||||
int pair_index;
|
||||
} mc_color_pair_t;
|
||||
|
||||
extern struct colorpair color_map [];
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# define color_value(i) color_table [i].name
|
||||
# define color_name(i) color_table [i].name
|
||||
const char *mc_tty_color_get_valid_name(const char *);
|
||||
int mc_tty_color_get_index_by_name(const char *);
|
||||
|
||||
# define color_map_fg(n) color_map [n].fg
|
||||
# define color_map_bg(n) color_map [n].bg
|
||||
#else
|
||||
# define color_value(i) color_table [i].value
|
||||
# define color_name(i) color_table [i].name
|
||||
|
||||
# define color_map_fg(n) (color_map [n].fg & COLOR_WHITE)
|
||||
# define color_map_bg(n) (color_map [n].bg & COLOR_WHITE)
|
||||
#endif /* HAVE_SLANG */
|
||||
|
||||
static const char default_colors[] = {
|
||||
"normal=lightgray,blue:"
|
||||
"selected=black,cyan:"
|
||||
"marked=yellow,blue:"
|
||||
"markselect=yellow,cyan:"
|
||||
"errors=white,red:"
|
||||
"menu=white,cyan:"
|
||||
"reverse=black,lightgray:"
|
||||
"dnormal=black,lightgray:"
|
||||
"dfocus=black,cyan:"
|
||||
"dhotnormal=blue,lightgray:"
|
||||
"dhotfocus=blue,cyan:"
|
||||
"viewunderline=brightred,blue:"
|
||||
"menuhot=yellow,cyan:"
|
||||
"menusel=white,black:"
|
||||
"menuhotsel=yellow,black:"
|
||||
"helpnormal=black,lightgray:"
|
||||
"helpitalic=red,lightgray:"
|
||||
"helpbold=blue,lightgray:"
|
||||
"helplink=black,cyan:"
|
||||
"helpslink=yellow,blue:"
|
||||
"gauge=white,black:"
|
||||
"input=black,cyan:"
|
||||
"editnormal=lightgray,blue:"
|
||||
"editbold=yellow,blue:"
|
||||
"editmarked=black,cyan:"
|
||||
"editwhitespace=brightblue,blue:"
|
||||
"editlinestate=white,cyan:"
|
||||
"errdhotnormal=yellow,red:"
|
||||
"errdhotfocus=yellow,lightgray"
|
||||
};
|
||||
|
||||
struct colors_avail {
|
||||
struct colors_avail *next;
|
||||
char *fg, *bg;
|
||||
int index;
|
||||
};
|
||||
|
||||
extern struct colors_avail c;
|
||||
extern int max_index;
|
||||
|
||||
size_t color_table_len (void);
|
||||
size_t color_map_len (void);
|
||||
|
||||
void configure_colors (void);
|
||||
void get_color (const char *cpp, CTYPE *colp);
|
||||
int alloc_color_pair (CTYPE foreground, CTYPE background);
|
||||
void mc_tty_color_init_lib (gboolean, gboolean);
|
||||
void mc_tty_color_try_alloc_pair_lib (mc_color_pair_t *);
|
||||
void mc_tty_color_set_lib (int);
|
||||
void mc_tty_color_set_normal_attrs_lib (void);
|
||||
void mc_tty_color_lowlevel_set_lib (int);
|
||||
|
||||
#endif /* MC_COLOR_INTERNAL_H */
|
||||
|
@ -39,107 +39,42 @@
|
||||
int attr_pairs [MAX_PAIRS];
|
||||
|
||||
void
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
mc_tty_color_init_lib (gboolean disable, gboolean force)
|
||||
{
|
||||
(void) force;
|
||||
|
||||
if (has_colors () && !disable) {
|
||||
const size_t map_len = color_map_len ();
|
||||
size_t i;
|
||||
|
||||
use_colors = TRUE;
|
||||
|
||||
start_color ();
|
||||
use_default_colors ();
|
||||
|
||||
configure_colors ();
|
||||
|
||||
if (map_len > MAX_PAIRS) {
|
||||
/* This message should only be seen by the developers */
|
||||
fprintf (stderr,
|
||||
"Too many defined colors, resize MAX_PAIRS on color.c");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* Use default terminal colors */
|
||||
mc_init_pair (DEFAULT_COLOR_INDEX, -1, -1);
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL) {
|
||||
mc_init_pair (i + 1, color_map_fg (i), color_map_bg (i));
|
||||
/*
|
||||
* ncurses doesn't remember bold attribute in the color pairs,
|
||||
* so we should keep track of it in a separate array.
|
||||
*/
|
||||
attr_pairs [i + 1] = color_map [i].fg & A_BOLD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Functions necessary to implement syntax highlighting */
|
||||
void
|
||||
mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
{
|
||||
init_pair (index, foreground, background == 0 ? -1 : background);
|
||||
if (index > max_index)
|
||||
max_index = index;
|
||||
}
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
{
|
||||
int fg_index, bg_index;
|
||||
int bold_attr;
|
||||
struct colors_avail *p = &c;
|
||||
|
||||
c.index = EDITOR_NORMAL_COLOR_INDEX;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
|
||||
&& ((bg && p->bg) ? !strcmp (bg, p->bg) : bg == p->bg) != 0)
|
||||
return p->index;
|
||||
if (!p->next)
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
p->next = g_new (struct colors_avail, 1);
|
||||
p = p->next;
|
||||
p->next = 0;
|
||||
p->fg = fg ? g_strdup (fg) : 0;
|
||||
p->bg = bg ? g_strdup (bg) : 0;
|
||||
if (!fg)
|
||||
/* Index in color_map array = COLOR_INDEX - 1 */
|
||||
fg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
|
||||
else
|
||||
get_color (fg, &fg_index);
|
||||
|
||||
if (!bg)
|
||||
bg_index = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].bg;
|
||||
else
|
||||
get_color (bg, &bg_index);
|
||||
|
||||
bold_attr = fg_index & A_BOLD;
|
||||
fg_index = fg_index & COLOR_WHITE;
|
||||
bg_index = bg_index & COLOR_WHITE;
|
||||
|
||||
p->index = alloc_color_pair (fg_index, bg_index);
|
||||
attr_pairs [p->index] = bold_attr;
|
||||
return p->index;
|
||||
}
|
||||
|
||||
void
|
||||
tty_setcolor (int color)
|
||||
mc_tty_color_try_alloc_pair_lib (mc_color_pair_t *mc_color_pair)
|
||||
{
|
||||
init_pair (mc_color_pair->pair_index,
|
||||
mc_color_pair->ifg,
|
||||
mc_color_pair->ibg == 0 ? -1 : mc_color_pair->ibg);
|
||||
}
|
||||
|
||||
void
|
||||
mc_tty_color_set_lib (int color)
|
||||
{
|
||||
attrset (color);
|
||||
}
|
||||
|
||||
void
|
||||
tty_lowlevel_setcolor (int color)
|
||||
mc_tty_color_lowlevel_set_lib (int color)
|
||||
{
|
||||
attrset (MY_COLOR_PAIR (color));
|
||||
}
|
||||
|
||||
void
|
||||
tty_set_normal_attrs (void)
|
||||
mc_tty_color_set_normal_attrs_lib (void)
|
||||
{
|
||||
standend ();
|
||||
}
|
||||
|
@ -10,14 +10,12 @@
|
||||
|
||||
gboolean tty_use_colors ();
|
||||
|
||||
#define MAX_PAIRS 64
|
||||
extern int attr_pairs [MAX_PAIRS];
|
||||
|
||||
#define MY_COLOR_PAIR(x) (COLOR_PAIR (x) | attr_pairs [x])
|
||||
#define IF_COLOR(co, bw) (tty_use_colors () ? MY_COLOR_PAIR (co) : bw)
|
||||
|
||||
/*
|
||||
#define MARKED_SELECTED_COLOR IF_COLOR (4, A_REVERSE | A_BOLD)
|
||||
|
||||
void mc_init_pair (int index, int foreground, int background);
|
||||
*/
|
||||
|
||||
#endif /* MC_COLOR_NCURSES_H */
|
||||
|
@ -44,6 +44,7 @@ has_colors (gboolean disable, gboolean force)
|
||||
if (force || (getenv ("COLORTERM") != NULL))
|
||||
SLtt_Use_Ansi_Colors = 1;
|
||||
|
||||
#if 0
|
||||
/* We want to allow overwriding */
|
||||
if (!disable) {
|
||||
const char *terminal = getenv ("TERM");
|
||||
@ -72,7 +73,6 @@ has_colors (gboolean disable, gboolean force)
|
||||
cts++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Setup emulated colors */
|
||||
if (SLtt_Use_Ansi_Colors != 0) {
|
||||
if (!disable) {
|
||||
@ -88,83 +88,28 @@ has_colors (gboolean disable, gboolean force)
|
||||
SLtt_set_mono (A_REVERSE, NULL, SLTT_REV_MASK);
|
||||
SLtt_set_mono (A_BOLD | A_REVERSE, NULL, SLTT_BOLD_MASK | SLTT_REV_MASK);
|
||||
}
|
||||
|
||||
#endif
|
||||
return SLtt_Use_Ansi_Colors;
|
||||
}
|
||||
|
||||
void
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
mc_tty_color_init_lib (gboolean disable, gboolean force)
|
||||
{
|
||||
/* FIXME: if S-Lang is used, has_colors() must be called regardless
|
||||
of whether we are interested in its result */
|
||||
if (has_colors (disable, force) && !disable) {
|
||||
const size_t map_len = color_map_len ();
|
||||
size_t i;
|
||||
|
||||
use_colors = TRUE;
|
||||
|
||||
configure_colors ();
|
||||
|
||||
/*
|
||||
* We are relying on undocumented feature of
|
||||
* S-Lang to make COLOR_PAIR(DEFAULT_COLOR_INDEX)
|
||||
* the default fg/bg of the terminal.
|
||||
* Hopefully, future versions of S-Lang will
|
||||
* document this feature.
|
||||
*/
|
||||
SLtt_set_color (DEFAULT_COLOR_INDEX, NULL, (char *) "default", (char *) "default");
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL)
|
||||
mc_init_pair (i + 1, color_map_fg(i), color_map_bg(i));
|
||||
}
|
||||
}
|
||||
|
||||
/* Functions necessary to implement syntax highlighting */
|
||||
void
|
||||
mc_init_pair (int index, CTYPE foreground, CTYPE background)
|
||||
mc_tty_color_try_alloc_pair_lib (mc_color_pair_t *mc_color_pair)
|
||||
{
|
||||
if (!background)
|
||||
background = "default";
|
||||
|
||||
if (!foreground)
|
||||
foreground = "default";
|
||||
|
||||
SLtt_set_color (index, (char *) "", (char *) foreground, (char *) background);
|
||||
if (index > max_index)
|
||||
max_index = index;
|
||||
}
|
||||
|
||||
int
|
||||
tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
{
|
||||
struct colors_avail *p = &c;
|
||||
|
||||
c.index = EDITOR_NORMAL_COLOR_INDEX;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? (strcmp (fg, p->fg) == 0) : (fg == p->fg)) != 0
|
||||
&& ((bg && p->bg) ? (strcmp (bg, p->bg) == 0) : (bg == p->bg)) != 0)
|
||||
return p->index;
|
||||
if (p->next == NULL)
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
p->next = g_new (struct colors_avail, 1);
|
||||
p = p->next;
|
||||
p->next = NULL;
|
||||
p->fg = fg ? g_strdup (fg) : NULL;
|
||||
p->bg = bg ? g_strdup (bg) : NULL;
|
||||
if (fg == NULL)
|
||||
/* Index in color_map array = COLOR_INDEX - 1 */
|
||||
fg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].fg;
|
||||
if (bg == NULL)
|
||||
bg = color_map[EDITOR_NORMAL_COLOR_INDEX - 1].bg;
|
||||
p->index = alloc_color_pair (fg, bg);
|
||||
return p->index;
|
||||
SLtt_set_color (mc_color_pair->pair_index, (char *) "", (char *) mc_color_pair->cfg, (char *) mc_color_pair->cbg);
|
||||
}
|
||||
|
||||
void
|
||||
tty_setcolor (int color)
|
||||
mc_tty_color_set_lib (int color)
|
||||
{
|
||||
if (!SLtt_Use_Ansi_Colors)
|
||||
SLsmg_set_color (color);
|
||||
@ -179,13 +124,13 @@ tty_setcolor (int color)
|
||||
|
||||
/* Set colorpair by index, don't interpret S-Lang "emulated attributes" */
|
||||
void
|
||||
tty_lowlevel_setcolor (int color)
|
||||
mc_tty_color_lowlevel_set_lib (int color)
|
||||
{
|
||||
SLsmg_set_color (color & 0x7F);
|
||||
}
|
||||
|
||||
void
|
||||
tty_set_normal_attrs (void)
|
||||
mc_tty_color_set_normal_attrs_lib (void)
|
||||
{
|
||||
SLsmg_normal_video ();
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ gboolean tty_use_colors ();
|
||||
|
||||
#define IF_COLOR(co, bw) (tty_use_colors () ? COLOR_PAIR (co) : bw)
|
||||
|
||||
/*
|
||||
#define MARKED_SELECTED_COLOR IF_COLOR (4, (SLtt_Use_Ansi_Colors ? A_BOLD_REVERSE : A_REVERSE | A_BOLD))
|
||||
|
||||
void mc_init_pair (int index, const char *foreground, const char *background);
|
||||
*/
|
||||
|
||||
#endif /* MC_COLOR_SLANG_H */
|
||||
|
191
src/tty/color.c
191
src/tty/color.c
@ -1,9 +1,12 @@
|
||||
/* Color setup
|
||||
/* Color setup.
|
||||
Interface functions.
|
||||
|
||||
Copyright (C) 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||
2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
Written by:
|
||||
Andrew Borodin <aborodin@vmail.ru>, 2009.
|
||||
Slava Zanko <slavazanko@gmail.com>, 2009.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -34,119 +37,133 @@
|
||||
|
||||
#include "../../src/tty/tty.h"
|
||||
#include "../../src/tty/color.h"
|
||||
|
||||
#include "../../src/tty/color-internal.h"
|
||||
|
||||
#include "../../src/setup.h" /* setup_color_string, term_color_string */
|
||||
/*** global variables ****************************************************************************/
|
||||
|
||||
char *command_line_colors = NULL;
|
||||
|
||||
/* Set if we are actually using colors */
|
||||
gboolean use_colors = FALSE;
|
||||
|
||||
struct colors_avail c;
|
||||
int max_index = 0;
|
||||
/*** file scope macro definitions ****************************************************************/
|
||||
|
||||
void
|
||||
get_color (const char *cpp, CTYPE *colp)
|
||||
{
|
||||
const size_t table_len = color_table_len ();
|
||||
size_t i;
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
for (i = 0; i < table_len; i++)
|
||||
if (strcmp (cpp, color_name (i)) == 0) {
|
||||
*colp = color_value (i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
static GHashTable *mc_tty_color__hashtable = NULL;
|
||||
static int mc_tty_color__count = 0;
|
||||
|
||||
/*** file scope functions ************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
configure_colors_string (const char *the_color_string)
|
||||
mc_tty_color_hash_destroy_key (gpointer data)
|
||||
{
|
||||
const size_t map_len = color_map_len ();
|
||||
|
||||
size_t i;
|
||||
char **color_strings, **p;
|
||||
|
||||
if (!the_color_string)
|
||||
return;
|
||||
|
||||
color_strings = g_strsplit (the_color_string, ":", -1);
|
||||
|
||||
p = color_strings;
|
||||
|
||||
while ((p != NULL) && (*p != NULL)) {
|
||||
char **cfb; /* color, fore, back */
|
||||
/* cfb[0] - entry name
|
||||
* cfb[1] - fore color
|
||||
* cfb[2] - back color
|
||||
*/
|
||||
char *e;
|
||||
|
||||
cfb = g_strsplit_set (*p, "=,", 3);
|
||||
p++;
|
||||
|
||||
if (cfb[0] == NULL) {
|
||||
g_strfreev (cfb);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* append '=' to the entry name */
|
||||
e = g_strdup_printf ("%s=", cfb[0]);
|
||||
g_free (cfb[0]);
|
||||
cfb[0] = e;
|
||||
|
||||
for (i = 0; i < map_len; i++)
|
||||
if (color_map [i].name != NULL) {
|
||||
size_t klen = strlen (color_map [i].name);
|
||||
|
||||
if (strncmp (cfb[0], color_map [i].name, klen) == 0) {
|
||||
if ((cfb[1] != NULL) && (*cfb[1] != '\0'))
|
||||
get_color (cfb[1], &color_map [i].fg);
|
||||
if ((cfb[2] != NULL) && (*cfb[2] != '\0'))
|
||||
get_color (cfb[2], &color_map [i].bg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev (cfb);
|
||||
}
|
||||
|
||||
g_strfreev (color_strings);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_tty_color_hash_destroy_value (gpointer data)
|
||||
{
|
||||
mc_color_pair_t *mc_color_pair = (mc_color_pair_t *) data;
|
||||
g_free(mc_color_pair);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** public functions ****************************************************************************/
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
configure_colors (void)
|
||||
tty_init_colors (gboolean disable, gboolean force)
|
||||
{
|
||||
configure_colors_string (default_colors);
|
||||
configure_colors_string (setup_color_string);
|
||||
configure_colors_string (term_color_string);
|
||||
configure_colors_string (getenv ("MC_COLOR_TABLE"));
|
||||
configure_colors_string (command_line_colors);
|
||||
mc_tty_color_init_lib (disable, force);
|
||||
mc_tty_color__count = 0;
|
||||
mc_tty_color__hashtable = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
mc_tty_color_hash_destroy_key,
|
||||
mc_tty_color_hash_destroy_value);
|
||||
}
|
||||
|
||||
int
|
||||
alloc_color_pair (CTYPE foreground, CTYPE background)
|
||||
{
|
||||
mc_init_pair (++max_index, foreground, background);
|
||||
return max_index;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
tty_colors_done (void)
|
||||
{
|
||||
struct colors_avail *p, *next;
|
||||
|
||||
for (p = c.next; p != NULL; p = next) {
|
||||
next = p->next;
|
||||
g_free (p->fg);
|
||||
g_free (p->bg);
|
||||
g_free (p);
|
||||
}
|
||||
c.next = NULL;
|
||||
g_hash_table_destroy (mc_tty_color__hashtable);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
tty_use_colors (void)
|
||||
{
|
||||
return use_colors;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int tty_try_alloc_color_pair (const char *fg, const char *bg)
|
||||
{
|
||||
gchar *color_pair;
|
||||
mc_color_pair_t *mc_color_pair;
|
||||
const char *c_fg, *c_bg;
|
||||
|
||||
c_fg = mc_tty_color_get_valid_name(fg);
|
||||
c_bg = mc_tty_color_get_valid_name(bg);
|
||||
|
||||
color_pair = g_strdup_printf("%s.%s",fg,bg);
|
||||
if (color_pair == NULL)
|
||||
return 0;
|
||||
|
||||
mc_color_pair = (mc_color_pair_t *) g_hash_table_lookup (mc_tty_color__hashtable, (gpointer) color_pair);
|
||||
|
||||
if (mc_color_pair != NULL){
|
||||
g_free(color_pair);
|
||||
return mc_color_pair->pair_index;
|
||||
}
|
||||
|
||||
mc_color_pair = g_new0(mc_color_pair_t,1);
|
||||
if (mc_color_pair == NULL)
|
||||
{
|
||||
g_free(color_pair);
|
||||
return 0;
|
||||
}
|
||||
|
||||
mc_color_pair->cfg = c_fg;
|
||||
mc_color_pair->cbg = c_bg;
|
||||
mc_color_pair->ifg = mc_tty_color_get_index_by_name(c_fg);
|
||||
mc_color_pair->ibg = mc_tty_color_get_index_by_name(c_bg);
|
||||
mc_color_pair->pair_index = mc_tty_color__count++;
|
||||
|
||||
mc_tty_color_try_alloc_pair_lib (mc_color_pair);
|
||||
|
||||
g_hash_table_insert (mc_tty_color__hashtable, (gpointer) color_pair, (gpointer) mc_color_pair);
|
||||
|
||||
return mc_color_pair->pair_index;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void tty_setcolor (int color)
|
||||
{
|
||||
mc_tty_color_set_lib (color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void tty_lowlevel_setcolor (int color)
|
||||
{
|
||||
mc_tty_color_lowlevel_set_lib(color);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void tty_set_normal_attrs (void)
|
||||
{
|
||||
mc_tty_color_set_normal_attrs_lib();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -1,6 +1,12 @@
|
||||
|
||||
/** \file color.h
|
||||
* \brief Header: color setup
|
||||
*
|
||||
* PLEASE FORGOT ABOUT tty/color.h!
|
||||
* Use skin engine for getting needed color pairs.
|
||||
*
|
||||
* edit/syntax.c may use this file directly, I'm agree. :)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MC_COLOR_H
|
||||
@ -14,68 +20,17 @@
|
||||
# include "../../src/tty/color-ncurses.h"
|
||||
#endif
|
||||
|
||||
/* Beware! When using Slang with color, not all the indexes are free.
|
||||
See color-slang.h (A_*) */
|
||||
#define NORMAL_COLOR IF_COLOR (1, 0)
|
||||
#define SELECTED_COLOR IF_COLOR (2, A_REVERSE)
|
||||
#define MARKED_COLOR IF_COLOR (3, A_BOLD)
|
||||
/* MARKED_SELECTED_COLOR is screen library specific */
|
||||
#define ERROR_COLOR IF_COLOR (5, A_BOLD)
|
||||
#define MENU_ENTRY_COLOR IF_COLOR (6, A_REVERSE)
|
||||
#define REVERSE_COLOR IF_COLOR (7, A_REVERSE)
|
||||
|
||||
/* Dialog colors */
|
||||
#define COLOR_NORMAL IF_COLOR (8, A_REVERSE)
|
||||
#define COLOR_FOCUS IF_COLOR (9, A_BOLD)
|
||||
#define COLOR_HOT_NORMAL IF_COLOR (10, 0)
|
||||
#define COLOR_HOT_FOCUS IF_COLOR (11, 0)
|
||||
|
||||
#define VIEW_UNDERLINED_COLOR IF_COLOR (12, A_UNDERLINE)
|
||||
#define MENU_SELECTED_COLOR IF_COLOR (13, A_BOLD)
|
||||
#define MENU_HOT_COLOR IF_COLOR (14, 0)
|
||||
#define MENU_HOTSEL_COLOR IF_COLOR (15, 0)
|
||||
|
||||
#define HELP_NORMAL_COLOR IF_COLOR (16, A_REVERSE)
|
||||
#define HELP_ITALIC_COLOR IF_COLOR (17, A_REVERSE)
|
||||
#define HELP_BOLD_COLOR IF_COLOR (18, A_REVERSE)
|
||||
#define HELP_LINK_COLOR IF_COLOR (19, 0)
|
||||
#define HELP_SLINK_COLOR IF_COLOR (20, A_BOLD)
|
||||
|
||||
/*
|
||||
* This should be selectable independently. Default has to be black background
|
||||
* foreground does not matter at all.
|
||||
*/
|
||||
#define GAUGE_COLOR IF_COLOR (21, 0)
|
||||
#define INPUT_COLOR IF_COLOR (22, 0)
|
||||
|
||||
/* For the default color any unused index may be chosen. */
|
||||
#define DEFAULT_COLOR_INDEX 23
|
||||
#define DEFAULT_COLOR IF_COLOR (DEFAULT_COLOR_INDEX, 0)
|
||||
|
||||
/*
|
||||
* editor colors - only 4 for normal, search->found, select, and whitespace
|
||||
* respectively
|
||||
* Last is defined to view color.
|
||||
*/
|
||||
#define EDITOR_NORMAL_COLOR_INDEX 27
|
||||
#define EDITOR_NORMAL_COLOR IF_COLOR (EDITOR_NORMAL_COLOR_INDEX, 0)
|
||||
#define EDITOR_BOLD_COLOR IF_COLOR (28, A_BOLD)
|
||||
#define EDITOR_MARKED_COLOR IF_COLOR (29, A_REVERSE)
|
||||
#define EDITOR_WHITESPACE_COLOR IF_COLOR (30, 0 /* irrelevant */)
|
||||
|
||||
/* color of left 8 char status per line */
|
||||
#define LINE_STATE_COLOR IF_COLOR (31, 0)
|
||||
|
||||
/* Error dialog colors */
|
||||
#define ERROR_HOT_NORMAL IF_COLOR (32, 0)
|
||||
#define ERROR_HOT_FOCUS IF_COLOR (43, 0)
|
||||
extern char *command_line_colors;
|
||||
|
||||
void tty_init_colors (gboolean disable, gboolean force);
|
||||
void tty_colors_done (void);
|
||||
|
||||
gboolean tty_use_colors (void);
|
||||
int tty_try_alloc_color_pair (const char *fg, const char *bg);
|
||||
int tty_try_alloc_color_pair (const char *, const char *);
|
||||
void tty_setcolor (int color);
|
||||
void tty_lowlevel_setcolor (int color);
|
||||
void tty_set_normal_attrs (void);
|
||||
|
||||
#define ALLOC_COLOR_PAIR_INDEX 1
|
||||
|
||||
#endif /* MC_COLOR_H */
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "dir.h"
|
||||
#include "panel.h"
|
||||
#include "main.h"
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/key.h"
|
||||
#include "../src/strutil.h"
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "../src/global.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/main.h"
|
||||
#include "../src/wtools.h"
|
||||
#include "../src/charsets.h"
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "../src/main.h"
|
||||
#include "../src/charsets.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "../src/main.h"
|
||||
#include "../src/charsets.h"
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "internal.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/skin/skin.h"
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "../src/tty/key.h" /* XCTRL and ALT macros */
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h"
|
||||
#include "../src/tty/color.h" /* INPUT_COLOR */
|
||||
#include "../src/skin/skin.h" /* INPUT_COLOR */
|
||||
#include "../src/tty/key.h" /* tty_getch() */
|
||||
|
||||
#include "dialog.h"
|
||||
|
Loading…
Reference in New Issue
Block a user