Merge branch '1660_color_keywords'
* 1660_color_keywords: Applied MC indentation policy. Ticket #1660: color keyword names unification.
Этот коммит содержится в:
Коммит
6fca4b04b0
@ -3076,7 +3076,7 @@ El formato de la definición de color es:
|
||||
.fi
|
||||
.PP
|
||||
los colores son opcionales, y las palabras claves son: normal, selected,
|
||||
marked, markselect, errors, input, reverse menu, menusel, menuhot, menuhotsel,
|
||||
marked, markselect, errors, input, reverse menunormal, menusel, menuhot, menuhotsel,
|
||||
menuinactive, gauge; los colores por defecto son: dnormal, dfocus, dhotnormal,
|
||||
dhotfocus; los colores de Ayuda son: helpnormal, helpitalic, helpbold, helplink,
|
||||
helpslink; color del visor: viewunderline; colores del editor: editnormal,
|
||||
@ -3093,8 +3093,8 @@ en los componentes normales, mientras que el color
|
||||
.I dhotfocus
|
||||
se utiliza para el color resaltado en el componente seleccionado.
|
||||
.PP
|
||||
Los menús utilizan el mismo esquema equivalente con los nombres menu, menusel,
|
||||
menuhot, menuhotsel and menuinactive en lugar de los anteriores.
|
||||
Los menús utilizan el mismo esquema equivalente con los nombres menunormal,
|
||||
menusel, menuhot, menuhotsel and menuinactive en lugar de los anteriores.
|
||||
.PP
|
||||
La ayuda utiliza los siguientes colores:
|
||||
.I helpnormal
|
||||
@ -3344,7 +3344,7 @@ Color del texto seleccionado.
|
||||
.I editwhitespace
|
||||
Color de las tabulaciones y espacios al final de línea resaltados.
|
||||
.TP
|
||||
.I linestate
|
||||
.I editlinestate
|
||||
Color de la línea de estado.
|
||||
|
||||
.PP
|
||||
|
@ -2827,7 +2827,7 @@ A színmeghatározás formátuma:
|
||||
.fi
|
||||
.PP
|
||||
A színek opcionálisak, a kulcsszavak a következők: normal, selected,
|
||||
marked, markselect, errors, input, reverse, gauge; A menü színek: menu,
|
||||
marked, markselect, errors, input, reverse, gauge; A menü színek: menunormal,
|
||||
menusel, menuhot, menuhotsel, menuinactive; A dialog színek: dnormal, dfocus,
|
||||
dhotnormal, dhotfocus; Súgó színek: helpnormal, helpitalic, helpbold,
|
||||
helplink, helpslink; Fájlnéző színek: viewunderline; Speciális kijelölés
|
||||
@ -2853,7 +2853,7 @@ aholis a
|
||||
.I dhotfocus
|
||||
színt használjuk a jelenleg kiválasztott komponensekhez.
|
||||
.PP
|
||||
A menük azonos sémát használnak a menu, menusel, menuhot, menuhotsel és a
|
||||
A menük azonos sémát használnak a menunormal, menusel, menuhot, menuhotsel és a
|
||||
menuinactive részeknél.
|
||||
.PP
|
||||
A súgó a következő színeket használja:
|
||||
|
@ -2865,7 +2865,7 @@ Il formato della definizione dei colori è:
|
||||
.fi
|
||||
.PP
|
||||
I colori sono opzionali e le parolechiave sono: normal, selected, marked,
|
||||
markselect, errors, input, reverse, gauge. I colori dei menu sono: menu,
|
||||
markselect, errors, input, reverse, gauge. I colori dei menu sono: menunormal,
|
||||
menusel, menuhot, menuhotsel, menuinactive. I colori delle finestre di
|
||||
dialogo sono: dnormal, dfocus, dhotnormal, dhotfocus. I colori dell'aiuto
|
||||
sono: helpnormal, helpitalic, helpbold, helplink, helpslink.
|
||||
@ -2894,7 +2894,7 @@ nei componenti normali, mentre il colore
|
||||
viene usato per il colore evidenziato nel componente correntemente
|
||||
selezionato.
|
||||
.PP
|
||||
I menu usano lo stesso schema ma usano invece i selettori menu, menusel,
|
||||
I menu usano lo stesso schema ma usano invece i selettori menunormal, menusel,
|
||||
menuhot, menuhotsel e menuinactive.
|
||||
.PP
|
||||
L'aiuto usa i seguenti colori:
|
||||
|
@ -3233,7 +3233,7 @@ The format for the color definition is:
|
||||
.fi
|
||||
.PP
|
||||
The colors are optional, and the keywords are: normal, selected, marked,
|
||||
markselect, errors, input, reverse, gauge. Menu colors are: menu,
|
||||
markselect, errors, input, reverse, gauge. Menu colors are: menunormal,
|
||||
menusel, menuhot, menuhotsel, menuinactive. Dialog colors are: dnormal, dfocus,
|
||||
dhotnormal, dhotfocus. Help colors are: helpnormal, helpitalic,
|
||||
helpbold, helplink, helpslink. Viewer color is: viewunderline. Editor
|
||||
@ -3259,7 +3259,7 @@ components, whereas the
|
||||
color is used for the highlighted color in the currently selected
|
||||
component.
|
||||
.PP
|
||||
Menus use the same scheme but uses the menu, menusel, menuhot, menuhotsel
|
||||
Menus use the same scheme but uses the menunormal, menusel, menuhot, menuhotsel
|
||||
and menuinactive tags instead.
|
||||
.PP
|
||||
Help uses the following colors:
|
||||
@ -3434,7 +3434,7 @@ Color of hotkeys in focused element
|
||||
.PP
|
||||
Section
|
||||
.B [menu]
|
||||
describes the elements that are placed on menu. This section describes
|
||||
describes the elements that are placed in menu. This section describes
|
||||
system menu (called by F9) and user-defined menus (called by F2 in panels
|
||||
and by F11 in editor).
|
||||
.TP
|
||||
@ -3499,7 +3499,7 @@ Color of selected text
|
||||
.I editwhitespace
|
||||
Color of tabs and trailing spaces highlighting
|
||||
.TP
|
||||
.I linestate
|
||||
.I editlinestate
|
||||
Color for line state area
|
||||
|
||||
.PP
|
||||
|
@ -2502,7 +2502,7 @@ Format definicji kolorów jest następujący:
|
||||
.fi
|
||||
.PP
|
||||
Kolory są opcjonalne, a słowa kluczowe są następujące: normal, selected,
|
||||
marked, markselect, errors, input, reverse menu, menusel, menuhot, menuhotsel,
|
||||
marked, markselect, errors, input, reverse menunormal, menusel, menuhot, menuhotsel,
|
||||
menuinactive, gauge; kolory okien dialogowych: dnormal, dfocus, dhotnormal,
|
||||
dhotfocus; Kolory pomocy: helpnormal, helpitalic, helpbold, helplink,
|
||||
helpslink; Kolory podglądu: viewunderline; Specjalne tryby podświetlenia:
|
||||
@ -2521,7 +2521,7 @@ a
|
||||
.I dhotfocus
|
||||
jest używany do wyświetlania owych w aktualnie wybranym.
|
||||
.PP
|
||||
Menu używa tego samego schematu, ale jako nazw kolorów używa menu, menusel,
|
||||
Menu używa tego samego schematu, ale jako nazw kolorów używa menunormal, menusel,
|
||||
menuhot, menuhotsel i menuinactive.
|
||||
.PP
|
||||
Pomoc używa następujących kolorów:
|
||||
|
@ -3523,7 +3523,7 @@ xterm=menu=magenta:marked=,magenta:markselect=,red
|
||||
Цвета не являются обязательными, а в качестве ключевых слов (keywords)
|
||||
могут использоваться: для задания цветовой палитры в панелях: normal,
|
||||
selected, marked, markselect, errors, input, reverse, gauge; Цвета
|
||||
пунктов меню: menu, menusel, menuhot, menuhotsel, menuinactive; Цвета
|
||||
пунктов меню: menunormal, menusel, menuhot, menuhotsel, menuinactive; Цвета
|
||||
в окне диалога: dnormal, dfocus, dhotnormal, dhotfocus; Цвета в окне подсказки:
|
||||
helpnormal, helpitalic, helpbold, helplink, helpslink; в окне программы
|
||||
просмотра: viewunderline; специальные подсветки: executable, directory,
|
||||
@ -3556,7 +3556,7 @@ editmarked.
|
||||
компонентах окна.
|
||||
.PP
|
||||
В меню используется та же самая схема, только в качестве названий
|
||||
элементов используются menu, menusel, menuhot, menuhotsel и menuinactive.
|
||||
элементов используются menunormal, menusel, menuhot, menuhotsel и menuinactive.
|
||||
.PP
|
||||
Окно подсказки использует следующие цвета:
|
||||
.I helpnormal
|
||||
@ -3798,7 +3798,7 @@ base_color=normal=white,default:marked=magenta,default
|
||||
.I editwhitespace
|
||||
Подсветка знаков табуляции и "висящих" пробелов
|
||||
.TP
|
||||
.I linestate
|
||||
.I editlinestate
|
||||
Цвет области отображения состояния строки.
|
||||
|
||||
|
||||
|
@ -2998,7 +2998,7 @@ xterm=menu=magenta:marked=,magenta:markselect=,red
|
||||
.PP
|
||||
Боје су необавезне, док кључне речи могу бити: normal, selected,
|
||||
marked, markselect, errors, input, reverse, gauge. Боје менија су:
|
||||
menu, menusel, menuhot, menuhotsel, menuinactive. Боје дијалога су:
|
||||
menunormal, menusel, menuhot, menuhotsel, menuinactive. Боје дијалога су:
|
||||
dnormal, dfocus, dhotnormal, dhotfocus. Боје помоћи су: helpnormal, helpitalic,
|
||||
helpbold, helplink, helpslink. Боја прегледача је: viewunderline.
|
||||
Посебне боје за истицање су: executable, directory, link, stalelink,
|
||||
@ -3022,7 +3022,7 @@ editmarked.
|
||||
.I dhotfocus
|
||||
се користи за боју истицања у тренутно изабраној контроли.
|
||||
.PP
|
||||
Менији користе исту шему, али користе изнаке menu, menusel, menuhot, menuhotsel
|
||||
Менији користе исту шему, али користе изнаке menunormal, menusel, menuhot, menuhotsel
|
||||
и menuinactive.
|
||||
.PP
|
||||
Помоћ користи следеће боје:
|
||||
|
@ -41,7 +41,8 @@
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
typedef struct mc_skin_colors_old_struct {
|
||||
typedef struct mc_skin_colors_old_struct
|
||||
{
|
||||
const char *old_color;
|
||||
const char *group;
|
||||
const char *key;
|
||||
@ -49,7 +50,7 @@ typedef struct mc_skin_colors_old_struct {
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
|
||||
mc_skin_colors_old_t old_colors[] = {
|
||||
static const mc_skin_colors_old_t old_colors[] = {
|
||||
{"normal", "core", "_default_"},
|
||||
{"marked", "core", "marked"},
|
||||
{"selected", "core", "selected"},
|
||||
@ -62,7 +63,7 @@ mc_skin_colors_old_t old_colors[] = {
|
||||
{"errors", "error", "_default_"},
|
||||
{"errdhotnormal", "error", "errdhotnormal"},
|
||||
{"errdhotfocus", "error", "errdhotfocus"},
|
||||
{"menu", "menu", "_default_"},
|
||||
{"menunormal", "menu", "_default_"},
|
||||
{"menuhot", "menu", "menuhot"},
|
||||
{"menusel", "menu", "menusel"},
|
||||
{"menuhotsel", "menu", "menuhotsel"},
|
||||
@ -79,7 +80,7 @@ mc_skin_colors_old_t old_colors[] = {
|
||||
{"editbold", "editor", "editbold"},
|
||||
{"editmarked", "editor", "editmarked"},
|
||||
{"editwhitespace", "editor", "editwhitespace"},
|
||||
{"editlinestate", "editor", "linestate"},
|
||||
{"editlinestate", "editor", "editlinestate"},
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@ -93,15 +94,15 @@ mc_skin_colors_old_transform (const char *old_color, const char **group, const c
|
||||
int lc_index;
|
||||
|
||||
if (old_color != NULL)
|
||||
for (lc_index = 0; old_colors[lc_index].old_color; lc_index++) {
|
||||
if (strcasecmp (old_color, old_colors[lc_index].old_color) == 0) {
|
||||
for (lc_index = 0; old_colors[lc_index].old_color; lc_index++)
|
||||
if (strcasecmp (old_color, old_colors[lc_index].old_color) == 0)
|
||||
{
|
||||
if (group != NULL)
|
||||
*group = old_colors[lc_index].group;
|
||||
if (key != NULL)
|
||||
*key = old_colors[lc_index].key;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -122,17 +123,20 @@ mc_skin_colors_old_configure_one (mc_skin_t * mc_skin, const char *the_color_str
|
||||
if (colors == NULL)
|
||||
return;
|
||||
|
||||
for (; *colors; colors++) {
|
||||
for (; *colors; colors++)
|
||||
{
|
||||
key_val = g_strsplit_set (*colors, "=,", 3);
|
||||
|
||||
if (!key_val)
|
||||
continue;
|
||||
|
||||
if (key_val[1] == NULL
|
||||
|| !mc_skin_colors_old_transform (key_val[0], &skin_group, &skin_key)) {
|
||||
|| !mc_skin_colors_old_transform (key_val[0], &skin_group, &skin_key))
|
||||
{
|
||||
g_strfreev (key_val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key_val[2] != NULL)
|
||||
skin_val = g_strdup_printf ("%s;%s", key_val[1], key_val[2]);
|
||||
else
|
||||
|
@ -89,7 +89,8 @@ mc_skin_color_add_to_hash (mc_skin_t * mc_skin, const gchar * group, const gchar
|
||||
gchar *kname;
|
||||
|
||||
kname = g_strdup_printf ("%s.%s", group, key);
|
||||
if (kname != NULL) {
|
||||
if (kname != NULL)
|
||||
{
|
||||
if (g_hash_table_lookup (mc_skin->colors, (gpointer) kname) != NULL)
|
||||
g_hash_table_remove (mc_skin->colors, (gpointer) kname);
|
||||
|
||||
@ -127,24 +128,30 @@ mc_skin_color_get_from_ini_file (mc_skin_t * mc_skin, const gchar * group, const
|
||||
|
||||
values = mc_config_get_string_list (mc_skin->config, group, key, &items_count);
|
||||
|
||||
if (values == NULL || *values == NULL) {
|
||||
if (values == NULL || *values == NULL)
|
||||
{
|
||||
if (values != NULL)
|
||||
g_strfreev (values);
|
||||
return NULL;
|
||||
}
|
||||
mc_skin_color = g_try_new0 (mc_skin_color_t, 1);
|
||||
if (mc_skin_color == NULL) {
|
||||
if (mc_skin_color == NULL)
|
||||
{
|
||||
g_strfreev (values);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (items_count) {
|
||||
switch (items_count)
|
||||
{
|
||||
case 0:
|
||||
tmp = mc_skin_color_get_with_defaults (group, "_default_");
|
||||
if (tmp) {
|
||||
if (tmp)
|
||||
{
|
||||
mc_skin_color->fgcolor = g_strdup (tmp->fgcolor);
|
||||
mc_skin_color->bgcolor = g_strdup (tmp->bgcolor);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
g_strfreev (values);
|
||||
g_free (mc_skin_color);
|
||||
return NULL;
|
||||
@ -175,7 +182,8 @@ mc_skin_color_set_default_for_terminal (mc_skin_t * mc_skin)
|
||||
{
|
||||
mc_skin_color_t *mc_skin_color;
|
||||
mc_skin_color = g_try_new0 (mc_skin_color_t, 1);
|
||||
if (mc_skin_color != NULL) {
|
||||
if (mc_skin_color != NULL)
|
||||
{
|
||||
mc_skin_color->fgcolor = g_strdup ("default");
|
||||
mc_skin_color->bgcolor = g_strdup ("default");
|
||||
mc_skin_color->pair_index =
|
||||
@ -226,7 +234,7 @@ mc_skin_color_cache_init (void)
|
||||
EDITOR_MARKED_COLOR = mc_skin_color_get ("editor", "editmarked");
|
||||
EDITOR_WHITESPACE_COLOR = mc_skin_color_get ("editor", "editwhitespace");
|
||||
EDITOR_RIGHT_MARGIN_COLOR = mc_skin_color_get ("editor", "editrightmargin");
|
||||
LINE_STATE_COLOR = mc_skin_color_get ("editor", "linestate");
|
||||
LINE_STATE_COLOR = mc_skin_color_get ("editor", "editlinestate");
|
||||
|
||||
BOOK_MARK_COLOR = mc_skin_color_get ("editor", "bookmark");
|
||||
BOOK_MARK_FOUND_COLOR = mc_skin_color_get ("editor", "bookmarkfound");
|
||||
@ -240,8 +248,7 @@ static gboolean
|
||||
mc_skin_color_check_inisection (const gchar * group)
|
||||
{
|
||||
return !((strcasecmp ("skin", group) == 0)
|
||||
|| (strcasecmp ("lines", group) == 0)
|
||||
|| (strncasecmp ("widget-", group, 7) == 0));
|
||||
|| (strcasecmp ("lines", group) == 0) || (strncasecmp ("widget-", group, 7) == 0));
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -251,7 +258,7 @@ mc_skin_color_check_bw_mode (mc_skin_t * mc_skin)
|
||||
{
|
||||
gchar **groups, **orig_groups;
|
||||
|
||||
if ( tty_use_colors () && !mc_args__disable_colors)
|
||||
if (tty_use_colors () && !mc_args__disable_colors)
|
||||
return;
|
||||
|
||||
orig_groups = groups = mc_config_get_groups (mc_skin->config, NULL);
|
||||
@ -259,7 +266,8 @@ mc_skin_color_check_bw_mode (mc_skin_t * mc_skin)
|
||||
if (groups == NULL)
|
||||
return;
|
||||
|
||||
for (; *groups != NULL; groups++) {
|
||||
for (; *groups != NULL; groups++)
|
||||
{
|
||||
if (mc_skin_color_check_inisection (*groups))
|
||||
mc_config_del_group (mc_skin->config, *groups);
|
||||
}
|
||||
@ -286,7 +294,8 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin)
|
||||
if (groups == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (*groups == NULL) {
|
||||
if (*groups == NULL)
|
||||
{
|
||||
g_strfreev (groups);
|
||||
return FALSE;
|
||||
}
|
||||
@ -300,7 +309,8 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin)
|
||||
tty_color_set_defaults (mc_skin_color->fgcolor, mc_skin_color->bgcolor);
|
||||
mc_skin_color_add_to_hash (mc_skin, "core", "_default_", mc_skin_color);
|
||||
|
||||
for (; *groups != NULL; groups++) {
|
||||
for (; *groups != NULL; groups++)
|
||||
{
|
||||
if (!mc_skin_color_check_inisection (*groups))
|
||||
continue;
|
||||
|
||||
@ -308,12 +318,14 @@ mc_skin_color_parse_ini_file (mc_skin_t * mc_skin)
|
||||
if (keys == NULL)
|
||||
continue;
|
||||
|
||||
if(*keys == NULL) {
|
||||
if (*keys == NULL)
|
||||
{
|
||||
g_strfreev (keys);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (; *keys; keys++) {
|
||||
for (; *keys; keys++)
|
||||
{
|
||||
mc_skin_color = mc_skin_color_get_from_ini_file (mc_skin, *groups, *keys);
|
||||
if (mc_skin_color != NULL)
|
||||
mc_skin_color_add_to_hash (mc_skin, *groups, *keys, mc_skin_color);
|
||||
|
@ -79,7 +79,7 @@
|
||||
editbold=yellow;brightgreen
|
||||
editmarked=black;white
|
||||
editwhitespace=brightblue;black
|
||||
linestate=white;cyan
|
||||
editlinestate=white;cyan
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=white;blue
|
||||
|
@ -83,7 +83,7 @@
|
||||
editbold=yellow;brightgreen
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
editlinestate=white;cyan
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
|
@ -79,7 +79,7 @@
|
||||
editbold=yellow;brightgreen
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
editlinestate=white;cyan
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
|
@ -85,7 +85,7 @@
|
||||
editbold=yellow;brightgreen
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
editlinestate=white;cyan
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;black
|
||||
|
@ -79,7 +79,7 @@
|
||||
editbold=yellow;blue
|
||||
editmarked=brightgreen;red
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=brightgreen
|
||||
editlinestate=brightgreen
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
editrightmargin=brightblue;blue
|
||||
|
@ -82,7 +82,7 @@
|
||||
editbold=brown;blue
|
||||
editmarked=black;cyan
|
||||
editwhitespace=brightblue;blue
|
||||
linestate=white;cyan
|
||||
editlinestate=white;cyan
|
||||
bookmark=white;red
|
||||
bookmarkfound=black;green
|
||||
|
||||
|
174
src/args.c
174
src/args.c
@ -74,7 +74,7 @@ char *mc_args__netfs_logfile = NULL;
|
||||
/* keymap file */
|
||||
char *mc_args__keymap_file = NULL;
|
||||
|
||||
/* Debug level*/
|
||||
/* Debug level */
|
||||
int mc_args__debug_level = 0;
|
||||
|
||||
|
||||
@ -97,38 +97,33 @@ static const GOptionEntry argument_main_table[] = {
|
||||
"version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&mc_args__version,
|
||||
N_("Displays the current version"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
/* options for wrappers */
|
||||
{
|
||||
"datadir", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&mc_args__show_datadirs,
|
||||
N_("Print data directory"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
||||
&mc_args__last_wd_file,
|
||||
N_("Print last working directory to specified file"),
|
||||
"<file>"
|
||||
},
|
||||
"<file>"},
|
||||
|
||||
#ifdef HAVE_SUBSHELL_SUPPORT
|
||||
{
|
||||
"subshell", 'U', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&use_subshell,
|
||||
N_("Enables subshell support (default)"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"nosubshell", 'u', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&mc_args__nouse_subshell,
|
||||
N_("Disables subshell support"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
#endif
|
||||
|
||||
/* debug options */
|
||||
@ -137,15 +132,13 @@ static const GOptionEntry argument_main_table[] = {
|
||||
"ftplog", 'l', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
||||
&mc_args__netfs_logfile,
|
||||
N_("Log ftp dialog to specified file"),
|
||||
"<file>"
|
||||
},
|
||||
"<file>"},
|
||||
#ifdef ENABLE_VFS_SMB
|
||||
{
|
||||
"debuglevel", 'D', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT,
|
||||
&mc_args__debug_level,
|
||||
N_("Set debug level"),
|
||||
"<integer>"
|
||||
},
|
||||
"<integer>"},
|
||||
#endif /* ENABLE_VFS_SMB */
|
||||
#endif
|
||||
|
||||
@ -154,15 +147,13 @@ static const GOptionEntry argument_main_table[] = {
|
||||
"view", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
||||
&view_one_file,
|
||||
N_("Launches the file viewer on a file"),
|
||||
"<file>"
|
||||
},
|
||||
"<file>"},
|
||||
|
||||
{
|
||||
"edit", 'e', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
||||
&edit_one_file,
|
||||
N_("Edits one file"),
|
||||
"<file>"
|
||||
},
|
||||
"<file>"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
@ -176,55 +167,49 @@ static const GOptionEntry argument_terminal_table[] = {
|
||||
"xterm", 'x', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__force_xterm,
|
||||
N_("Forces xterm features"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"nomouse", 'd', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__nomouse,
|
||||
N_("Disable mouse support in text version"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
{
|
||||
"termcap", 't', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&SLtt_Try_Termcap,
|
||||
N_("Tries to use termcap instead of terminfo"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
#endif
|
||||
|
||||
{
|
||||
"slow", 's', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__slow_terminal,
|
||||
N_("To run on slow terminals"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"stickchars", 'a', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__ugly_line_drawing,
|
||||
N_("Use stickchars to draw"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"resetsoft", 'k', ARGS_TERM_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&reset_hp_softkeys,
|
||||
N_("Resets soft keys on HP terminals"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"keymap", 'K', ARGS_TERM_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&mc_args__keymap_file,
|
||||
N_("Load definitions of key bindings from specified file"),
|
||||
"<file>"
|
||||
},
|
||||
"<file>"},
|
||||
|
||||
{NULL}
|
||||
};
|
||||
|
||||
#undef ARGS_TERM_OPTIONS
|
||||
|
||||
GOptionGroup *color_group;
|
||||
@ -236,32 +221,29 @@ static const GOptionEntry argument_color_table[] = {
|
||||
"nocolor", 'b', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__disable_colors,
|
||||
N_("Requests to run in black and white"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"color", 'c', ARGS_COLOR_OPTIONS, G_OPTION_ARG_NONE,
|
||||
&mc_args__force_colors,
|
||||
N_("Request to run in color mode"),
|
||||
NULL
|
||||
},
|
||||
NULL},
|
||||
|
||||
{
|
||||
"colors", 'C', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&command_line_colors,
|
||||
N_("Specifies a color configuration"),
|
||||
"<string>"
|
||||
},
|
||||
"<string>"},
|
||||
|
||||
{
|
||||
"skin", 'S', ARGS_COLOR_OPTIONS, G_OPTION_ARG_STRING,
|
||||
&mc_args__skin,
|
||||
N_("Show mc with specified skin"),
|
||||
"<string>"
|
||||
},
|
||||
"<string>"},
|
||||
|
||||
{NULL}
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
#undef ARGS_COLOR_OPTIONS
|
||||
|
||||
static gchar *mc_args__loc__colors_string = NULL;
|
||||
@ -273,81 +255,80 @@ static gchar *mc_args__loc__usage_string = NULL;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
static void
|
||||
mc_args_clean_temp_help_strings(void)
|
||||
mc_args_clean_temp_help_strings (void)
|
||||
{
|
||||
g_free(mc_args__loc__colors_string);
|
||||
g_free (mc_args__loc__colors_string);
|
||||
mc_args__loc__colors_string = NULL;
|
||||
|
||||
g_free(mc_args__loc__footer_string);
|
||||
g_free (mc_args__loc__footer_string);
|
||||
mc_args__loc__footer_string = NULL;
|
||||
|
||||
g_free(mc_args__loc__header_string);
|
||||
g_free (mc_args__loc__header_string);
|
||||
mc_args__loc__header_string = NULL;
|
||||
|
||||
g_free(mc_args__loc__usage_string);
|
||||
g_free (mc_args__loc__usage_string);
|
||||
mc_args__loc__usage_string = NULL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static GOptionGroup *
|
||||
mc_args_new_color_group(void)
|
||||
mc_args_new_color_group (void)
|
||||
{
|
||||
/*
|
||||
* FIXME: undocumented keywords: viewunderline, editnormal, editbold,
|
||||
* and editmarked. To preserve translations, lines should be split.
|
||||
*/
|
||||
|
||||
mc_args__loc__colors_string = g_strdup_printf("%s%s",
|
||||
mc_args__loc__colors_string = g_strdup_printf ("%s%s",
|
||||
/* TRANSLATORS: don't translate keywords and names of colors */
|
||||
_( "--colors KEYWORD={FORE},{BACK}\n\n"
|
||||
_("--colors KEYWORD={FORE},{BACK}\n\n"
|
||||
"{FORE} and {BACK} can be omitted, and the default will be used\n"
|
||||
"\n" "Keywords:\n"
|
||||
" Global: errors, reverse, gauge, input, viewunderline\n"
|
||||
" File display: normal, selected, marked, markselect\n"
|
||||
" Dialog boxes: dnormal, dfocus, dhotnormal, dhotfocus, errdhotnormal,\n"
|
||||
" errdhotfocus\n"
|
||||
" Menus: menu, menuhot, menusel, menuhotsel, menuinactive\n"
|
||||
" Menus: menunormal, menuhot, menusel, menuhotsel, menuinactive\n"
|
||||
" Editor: editnormal, editbold, editmarked, editwhitespace,\n"
|
||||
" editlinestate\n"),
|
||||
/* TRANSLATORS: don't translate keywords and names of colors */
|
||||
_( " Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
|
||||
_
|
||||
(" Help: helpnormal, helpitalic, helpbold, helplink, helpslink\n"
|
||||
"\n" "Colors:\n"
|
||||
" black, gray, red, brightred, green, brightgreen, brown,\n"
|
||||
" yellow, blue, brightblue, magenta, brightmagenta, cyan,\n"
|
||||
" brightcyan, lightgray and white\n\n")
|
||||
);
|
||||
" brightcyan, lightgray and white\n\n"));
|
||||
|
||||
return g_option_group_new ("color", mc_args__loc__colors_string,
|
||||
_("Color options"),NULL, NULL);
|
||||
_("Color options"), NULL, NULL);
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gchar *
|
||||
mc_args_add_usage_info(void)
|
||||
mc_args_add_usage_info (void)
|
||||
{
|
||||
mc_args__loc__usage_string = g_strdup_printf("[%s] %s\n %s - %s\n",
|
||||
mc_args__loc__usage_string = g_strdup_printf ("[%s] %s\n %s - %s\n",
|
||||
_("+number"),
|
||||
_("[this_dir] [other_panel_dir]"),
|
||||
_("+number"),
|
||||
_("Set initial line number for the internal editor")
|
||||
);
|
||||
_
|
||||
("Set initial line number for the internal editor"));
|
||||
return mc_args__loc__usage_string;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
mc_args_add_extended_info_to_help(void)
|
||||
mc_args_add_extended_info_to_help (void)
|
||||
{
|
||||
mc_args__loc__footer_string = g_strdup_printf("%s",
|
||||
mc_args__loc__footer_string = g_strdup_printf ("%s",
|
||||
_
|
||||
("\n"
|
||||
"Please send any bug reports (including the output of `mc -V')\n"
|
||||
"to mc-devel@gnome.org\n")
|
||||
);
|
||||
"to mc-devel@gnome.org\n"));
|
||||
mc_args__loc__header_string = g_strdup_printf (_("GNU Midnight Commander %s\n"), VERSION);
|
||||
|
||||
#if GLIB_CHECK_VERSION(2,12,0)
|
||||
@ -360,13 +341,15 @@ mc_args_add_extended_info_to_help(void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
mc_args_process(void)
|
||||
mc_args_process (void)
|
||||
{
|
||||
if (mc_args__version){
|
||||
if (mc_args__version)
|
||||
{
|
||||
show_version ();
|
||||
return FALSE;
|
||||
}
|
||||
if (mc_args__show_datadirs){
|
||||
if (mc_args__show_datadirs)
|
||||
{
|
||||
printf ("%s (%s)\n", mc_home, mc_home_alt);
|
||||
return FALSE;
|
||||
}
|
||||
@ -388,18 +371,19 @@ mc_args_process(void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gchar *
|
||||
mc_args__convert_help_to_syscharset(const gchar *charset, const gchar *error_message, const gchar *help_str)
|
||||
mc_args__convert_help_to_syscharset (const gchar * charset, const gchar * error_message,
|
||||
const gchar * help_str)
|
||||
{
|
||||
GString *buffer = g_string_new("");
|
||||
GIConv conv = g_iconv_open ( charset, "UTF-8");
|
||||
gchar *full_help_str = g_strdup_printf("%s\n\n%s\n",error_message,help_str);
|
||||
GString *buffer = g_string_new ("");
|
||||
GIConv conv = g_iconv_open (charset, "UTF-8");
|
||||
gchar *full_help_str = g_strdup_printf ("%s\n\n%s\n", error_message, help_str);
|
||||
|
||||
str_convert (conv, full_help_str, buffer);
|
||||
|
||||
g_free(full_help_str);
|
||||
g_free (full_help_str);
|
||||
g_iconv_close (conv);
|
||||
|
||||
return g_string_free(buffer, FALSE);
|
||||
return g_string_free (buffer, FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -409,45 +393,45 @@ mc_args__convert_help_to_syscharset(const gchar *charset, const gchar *error_mes
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
mc_args_handle(int *argc, char ***argv, const gchar *translation_domain)
|
||||
mc_args_handle (int *argc, char ***argv, const gchar * translation_domain)
|
||||
{
|
||||
GError *error = NULL;
|
||||
const gchar *_system_codepage = str_detect_termencoding();
|
||||
const gchar *_system_codepage = str_detect_termencoding ();
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
if (!str_isutf8 (_system_codepage))
|
||||
bind_textdomain_codeset ("mc", "UTF-8");
|
||||
#endif
|
||||
|
||||
context = g_option_context_new (mc_args_add_usage_info());
|
||||
context = g_option_context_new (mc_args_add_usage_info ());
|
||||
|
||||
g_option_context_set_ignore_unknown_options (context, FALSE);
|
||||
|
||||
mc_args_add_extended_info_to_help();
|
||||
mc_args_add_extended_info_to_help ();
|
||||
|
||||
main_group = g_option_group_new ("main", _("Main options"),
|
||||
_("Main options"),NULL, NULL);
|
||||
main_group = g_option_group_new ("main", _("Main options"), _("Main options"), NULL, NULL);
|
||||
|
||||
g_option_group_add_entries (main_group, argument_main_table);
|
||||
g_option_context_set_main_group (context, main_group);
|
||||
g_option_group_set_translation_domain(main_group, translation_domain);
|
||||
g_option_group_set_translation_domain (main_group, translation_domain);
|
||||
|
||||
|
||||
terminal_group = g_option_group_new ("terminal", _("Terminal options"),
|
||||
_("Terminal options"),NULL, NULL);
|
||||
_("Terminal options"), NULL, NULL);
|
||||
|
||||
g_option_group_add_entries (terminal_group, argument_terminal_table);
|
||||
g_option_context_add_group (context, terminal_group);
|
||||
g_option_group_set_translation_domain(terminal_group, translation_domain);
|
||||
g_option_group_set_translation_domain (terminal_group, translation_domain);
|
||||
|
||||
|
||||
color_group = mc_args_new_color_group();
|
||||
color_group = mc_args_new_color_group ();
|
||||
|
||||
g_option_group_add_entries (color_group, argument_color_table);
|
||||
g_option_context_add_group (context, color_group);
|
||||
g_option_group_set_translation_domain(color_group, translation_domain);
|
||||
g_option_group_set_translation_domain (color_group, translation_domain);
|
||||
|
||||
if (! g_option_context_parse (context, argc, argv, &error)) {
|
||||
if (!g_option_context_parse (context, argc, argv, &error))
|
||||
{
|
||||
if (error != NULL)
|
||||
{
|
||||
gchar *full_help_str;
|
||||
@ -456,33 +440,35 @@ mc_args_handle(int *argc, char ***argv, const gchar *translation_domain)
|
||||
#if GLIB_CHECK_VERSION(2,14,0)
|
||||
help_str = g_option_context_get_help (context, TRUE, NULL);
|
||||
#else
|
||||
help_str = g_strdup("");
|
||||
help_str = g_strdup ("");
|
||||
#endif
|
||||
if ( !str_isutf8 (_system_codepage))
|
||||
full_help_str = mc_args__convert_help_to_syscharset(_system_codepage,error->message, help_str);
|
||||
if (!str_isutf8 (_system_codepage))
|
||||
full_help_str =
|
||||
mc_args__convert_help_to_syscharset (_system_codepage, error->message,
|
||||
help_str);
|
||||
else
|
||||
full_help_str = g_strdup_printf("%s\n\n%s\n",error->message,help_str);
|
||||
full_help_str = g_strdup_printf ("%s\n\n%s\n", error->message, help_str);
|
||||
|
||||
fprintf(stderr, "%s",full_help_str);
|
||||
fprintf (stderr, "%s", full_help_str);
|
||||
|
||||
g_free(help_str);
|
||||
g_free(full_help_str);
|
||||
g_free (help_str);
|
||||
g_free (full_help_str);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_option_context_free (context);
|
||||
mc_args_clean_temp_help_strings();
|
||||
mc_args_clean_temp_help_strings ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_option_context_free (context);
|
||||
mc_args_clean_temp_help_strings();
|
||||
mc_args_clean_temp_help_strings ();
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
if (!str_isutf8 (_system_codepage))
|
||||
bind_textdomain_codeset ("mc", _system_codepage);
|
||||
#endif
|
||||
|
||||
return mc_args_process();
|
||||
return mc_args_process ();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user