From d11de353434634a2ca4e91865ccf0b536e5f9d72 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 14 Oct 2009 01:20:31 +0300 Subject: [PATCH 1/4] Ticket #1716: Adding fully featured skin As David Martin proposed, this skin support all newest features May be used as modern skin, but with some restrictions (must be UTF-8 system codepage) Also, changed src/screen.c for demonstrate skin features :) Signed-off-by: Slava Zanko --- misc/skins/Makefile.am | 1 + misc/skins/featured.ini | 91 +++++++++++++++++++++++++++++++++++++++++ src/screen.c | 32 +++++++++++++-- 3 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 misc/skins/featured.ini diff --git a/misc/skins/Makefile.am b/misc/skins/Makefile.am index 2300f53a7..c3cc4a858 100644 --- a/misc/skins/Makefile.am +++ b/misc/skins/Makefile.am @@ -2,6 +2,7 @@ skindir = $(pkgdatadir)/skins skin_DATA = \ default.ini \ + featured.ini \ double-lines.ini EXTRA_DIST = \ diff --git a/misc/skins/featured.ini b/misc/skins/featured.ini new file mode 100644 index 000000000..fda5dfc2b --- /dev/null +++ b/misc/skins/featured.ini @@ -0,0 +1,91 @@ +# Please, use this skin in UTF-8 system codepage only. + +[skin] + description=Enhanced standart skin + +[Lines] + lefttop=╔ + righttop=╗ + centertop=╤ + centerbottom=╧ + leftbottom=╚ + rightbottom=╝ + leftmiddle=╟ + rightmiddle=╢ + centermiddle=┼ + horiz=═ + vert=║ + thinhoriz=─ + thinvert=│ + +[core] + _default_=lightgray;blue + selected=black;cyan + marked=yellow;blue + markselect=yellow;cyan; + gauge=white;black + input=black;cyan + reverse=black;lightgray + +[dialog] + _default_=black;lightgray + dfocus=black;cyan + dhotnormal=blue;lightgray + dhotfocus=blue;cyan + +[error] + _default_=white;red + errdhotnormal=yellow;red + errdhotfocus=yellow;lightgray + + +[filehighlight] + directory=white; + executable=brightgreen; + symlink=lightgray; + stalelink=brightred; + device=brightmagenta; + special=black; + core=red; + temp=gray; + archive=brightmagenta; + doc=brown; + source=cyan; + media=green; + graph=brightcyan; + database=brightred; + +[menu] + _default_=white;cyan + menuhot=yellow;cyan + menusel=white;black + menuhotsel=yellow;black + +[help] + _default_=black;lightgray + helpitalic=red;lightgray + helpbold=blue;lightgray + helplink=black;cyan + helpslink=yellow;blue + +[editor] + _default_=lightgray;blue + editbold=yellow;blue + editmarked=black;cyan + editwhitespace=brightblue;blue + linestate=white;cyan + +[viewer] + viewunderline=brightred;blue + +[widget-common] + sort-sign-up = ↑ + sort-sign-down = ↓ + +[widget-panel] + hiddenfiles-sign-show = ⋅ + hiddenfiles-sign-hide = • + history-prev-item-sign = « + history-next-item-sign = » + history-show-list-sign = v + diff --git a/src/screen.c b/src/screen.c index 7331ae283..ac368731e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -118,6 +118,12 @@ static const char *mini_status_format (WPanel *panel); static char *panel_sort_up_sign = NULL; static char *panel_sort_down_sign = NULL; +static char *panel_hiddenfiles_sign_show = NULL; +static char *panel_hiddenfiles_sign_hide = NULL; +static char *panel_history_prev_item_sign = NULL; +static char *panel_history_next_item_sign = NULL; +static char *panel_history_show_list_sign = NULL; + /* This macro extracts the number of available lines in a panel */ #define llines(p) (p->widget.lines-3 - (show_mini_info ? 2 : 0)) @@ -901,6 +907,7 @@ show_free_space (WPanel *panel) static void show_dir (WPanel *panel) { + gchar *tmp; set_colors (panel); draw_box (panel->widget.parent, panel->widget.y, panel->widget.x, @@ -924,10 +931,14 @@ show_dir (WPanel *panel) min (max (panel->widget.cols - 10, 0), panel->widget.cols))); + tmp = (show_dot_files) ? panel_hiddenfiles_sign_show : panel_hiddenfiles_sign_hide; + widget_move (&panel->widget, 0, 1); - tty_print_char ('<'); + tty_print_string (panel_history_prev_item_sign); widget_move (&panel->widget, 0, panel->widget.cols - 4); - tty_print_string (".v>"); + tmp = g_strdup_printf("%s%s%s",tmp,panel_history_show_list_sign,panel_history_next_item_sign); + tty_print_string (tmp); + g_free(tmp); if (!show_mini_info) { if (panel->marked == 0) { @@ -3381,8 +3392,14 @@ panel_get_user_possible_fields(gsize *array_size) void panel_init(void) { - panel_sort_up_sign = mc_config_get_string(mc_skin__default.config,"widget-common","sort-sign-up","'"); - panel_sort_down_sign = mc_config_get_string(mc_skin__default.config,"widget-common","sort-sign-down",","); + panel_sort_up_sign = mc_skin_get("widget-common","sort-sign-up","'"); + panel_sort_down_sign = mc_skin_get("widget-common","sort-sign-down",","); + + panel_hiddenfiles_sign_show = mc_skin_get("widget-panel", "hiddenfiles-sign-show", "."); + panel_hiddenfiles_sign_hide = mc_skin_get("widget-panel", "hiddenfiles-sign-hide", "."); + panel_history_prev_item_sign = mc_skin_get("widget-panel", "history-prev-item-sign", "<"); + panel_history_next_item_sign = mc_skin_get("widget-panel", "history-next-item-sign", ">"); + panel_history_show_list_sign = mc_skin_get("widget-panel", "history-show-list-sign", "^"); } void @@ -3390,4 +3407,11 @@ panel_deinit(void) { g_free(panel_sort_up_sign); g_free(panel_sort_down_sign); + + g_free(panel_hiddenfiles_sign_show); + g_free(panel_hiddenfiles_sign_hide); + g_free(panel_history_prev_item_sign); + g_free(panel_history_next_item_sign); + g_free(panel_history_show_list_sign); + } From ff5dd64c6bf28549cf18cf94893c8937e7c71635 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 15 Oct 2009 10:31:24 +0300 Subject: [PATCH 2/4] Fix showing widget elements with 'mc -a' option. Signed-off-by: Slava Zanko --- src/skin/common.c | 11 +++++++++++ src/skin/skin.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/skin/common.c b/src/skin/common.c index 2de791e14..8cb05b4a3 100644 --- a/src/skin/common.c +++ b/src/skin/common.c @@ -177,3 +177,14 @@ mc_skin_deinit (void) } /* --------------------------------------------------------------------------------------------- */ + +gchar * +mc_skin_get(const gchar *group, const gchar *key, const gchar *default_value) +{ + if (mc_args__ugly_line_drawing) { + return g_strdup(default_value); + } + return mc_config_get_string(mc_skin__default.config, group, key, default_value); +} + +/* --------------------------------------------------------------------------------------------- */ diff --git a/src/skin/skin.h b/src/skin/skin.h index f152bc6ca..1bd026d39 100644 --- a/src/skin/skin.h +++ b/src/skin/skin.h @@ -92,4 +92,7 @@ int mc_skin_color_get (const gchar *, const gchar *); void mc_skin_lines_parse_ini_file (mc_skin_t *); +gchar *mc_skin_get(const gchar *, const gchar *, const gchar *); + + #endif From bd29603b41c88d57b56191c79eea001f007d43bc Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 15 Oct 2009 09:53:59 +0300 Subject: [PATCH 3/4] Relative to Ticket #1643: restore patch 'Mouse support in first line when menu is hidden' Signed-off-by: Slava Zanko --- src/screen.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/screen.c b/src/screen.c index ac368731e..632212e16 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2962,19 +2962,6 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir) return MOU_NORMAL; } - /* sort on clicked column */ - if (event->type & GPM_DOWN && event->y == 2) { - mouse_sort_col(event,panel); - return MOU_NORMAL; - } - - /* rest of the upper frame, the menu is invisible - call menu */ - if (mouse_down && event->y == 1 && !menubar_visible) { - *redir = 1; - event->x += panel->widget.x; - return (*(the_menubar->widget.mouse)) (event, the_menubar); - } - /* "<" button */ if (mouse_down && event->y == 1 && event->x == 2) { directory_history_prev (panel); @@ -2993,6 +2980,12 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir) return MOU_NORMAL; } + /* sort on clicked column */ + if (event->type & GPM_DOWN && event->y == 2) { + mouse_sort_col(event,panel); + return MOU_NORMAL; + } + /* rest of the upper frame, the menu is invisible - call menu */ if (mouse_down && event->y == 1 && !menubar_visible) { *redir = 1; From 8fe4dc26c26298dba05cb47927a5d664c24ed976 Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Thu, 15 Oct 2009 10:14:07 +0300 Subject: [PATCH 4/4] Cosmetic changes of panel interfase (relative to history list): * Panel widget: History list button changed from v to [^] * Change drawing of history control elements for panel. Now if panel is active, show in reverse color just panel path. * Add reaction on mouse click on [] chars at top of panel * Added call of repaint_screen() function for correctly show panels content after click by mouse on 'hidden files' indicator. Signed-off-by: Slava Zanko --- misc/skins/featured.ini | 2 +- src/screen.c | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/misc/skins/featured.ini b/misc/skins/featured.ini index fda5dfc2b..96850894b 100644 --- a/misc/skins/featured.ini +++ b/misc/skins/featured.ini @@ -87,5 +87,5 @@ hiddenfiles-sign-hide = • history-prev-item-sign = « history-next-item-sign = » - history-show-list-sign = v + history-show-list-sign = ^ diff --git a/src/screen.c b/src/screen.c index 632212e16..f525edf84 100644 --- a/src/screen.c +++ b/src/screen.c @@ -921,6 +921,17 @@ show_dir (WPanel *panel) tty_print_alt_char (ACS_RTEE); } + widget_move (&panel->widget, 0, 1); + tty_print_string (panel_history_prev_item_sign); + + tmp = (show_dot_files) ? panel_hiddenfiles_sign_show : panel_hiddenfiles_sign_hide; + tmp = g_strdup_printf("%s[%s]%s",tmp,panel_history_show_list_sign,panel_history_next_item_sign); + + widget_move (&panel->widget, 0, panel->widget.cols - 6); + tty_print_string (tmp); + + g_free(tmp); + if (panel->active) tty_setcolor (REVERSE_COLOR); @@ -928,18 +939,9 @@ show_dir (WPanel *panel) tty_printf (" %s ", str_term_trim (strip_home_and_password (panel->cwd), - min (max (panel->widget.cols - 10, 0), + min (max (panel->widget.cols - 12, 0), panel->widget.cols))); - tmp = (show_dot_files) ? panel_hiddenfiles_sign_show : panel_hiddenfiles_sign_hide; - - widget_move (&panel->widget, 0, 1); - tty_print_string (panel_history_prev_item_sign); - widget_move (&panel->widget, 0, panel->widget.cols - 4); - tmp = g_strdup_printf("%s%s%s",tmp,panel_history_show_list_sign,panel_history_next_item_sign); - tty_print_string (tmp); - g_free(tmp); - if (!show_mini_info) { if (panel->marked == 0) { /* Show size of curret file in the bottom of panel */ @@ -949,7 +951,7 @@ show_dir (WPanel *panel) g_snprintf (buffer, sizeof (buffer), " %s ", size_trunc_sep (panel->dir.list [panel->selected].st.st_size)); tty_setcolor (NORMAL_COLOR); - widget_move (&panel->widget, panel->widget.lines - 1, 2); + widget_move (&panel->widget, panel->widget.lines - 1, 4); tty_print_string (buffer); } } else { @@ -2957,8 +2959,9 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir) const gboolean mouse_down = (event->type & GPM_DOWN) != 0; /* "." button show/hide hidden files */ - if (event->type & GPM_DOWN && event->x == panel->widget.cols - 3 && event->y == 1) { + if (event->type & GPM_DOWN && event->x == panel->widget.cols - 5 && event->y == 1) { toggle_show_hidden(); + repaint_screen (); return MOU_NORMAL; } @@ -2974,8 +2977,8 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir) return MOU_NORMAL; } - /* "v" button */ - if (mouse_down && event->y == 1 && event->x == panel->widget.cols - 2) { + /* "^" button */ + if (mouse_down && event->y == 1 && event->x >= panel->widget.cols - 4 && event->x <= panel->widget.cols - 2) { directory_history_list (panel); return MOU_NORMAL; } @@ -3393,6 +3396,7 @@ panel_init(void) panel_history_prev_item_sign = mc_skin_get("widget-panel", "history-prev-item-sign", "<"); panel_history_next_item_sign = mc_skin_get("widget-panel", "history-next-item-sign", ">"); panel_history_show_list_sign = mc_skin_get("widget-panel", "history-show-list-sign", "^"); + } void