Merge branch '3810_keep_panelization'

* 3810_keep_panelization:
  File panel: unification of terminology.
  Refactoring: handle panel listing mode switch in the panel level
  Refactoring: ret rid of set_basic_panel_listing_to().
  (listing_cmd): reset panel filter.
  Ticket #3810: keep panelization while switching panel listing mode.
This commit is contained in:
Andrew Borodin 2017-04-24 16:18:39 +03:00
commit ed1ed00073
19 changed files with 119 additions and 140 deletions

View File

@ -840,7 +840,7 @@ si hemos elegido la disposición horizontal de paneles en las opciones de
.\"LINK2"
presentación\&).
.\"Layout"
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Listado..."
La vista en modo
.B "Listado"
@ -1995,7 +1995,7 @@ campos de
del
.\"LINK2"
Modo de Listado
.\"Listing Mode..."
.\"Listing Format..."
aplicables al usuario actual de Midnight Commander serán resaltados
usando el color indicado por medio de la palabra clave
.I selected.
@ -2107,7 +2107,7 @@ colores
distintivos. Si se habilita el resaltado de permisos, los
.\"LINK2"
campos del listado
.\"Listing Mode..."
.\"Listing Format..."
.I perm
y
.I mode

View File

@ -663,7 +663,7 @@ A könyvtárpanelek megjelenése változtatható a
és
.B "Jobb"
menükben.
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Fájllista..."
A fájllista módozatok a fájlok megjelenítésének beállítására szolgálnak,
négy különböző listázási mód használható:
@ -1764,7 +1764,7 @@ Ha pl. a jogosultságokat kérted, a
láthatók a
.\"LINK2"
Fájllistában
.\"Listing Mode..."
.\"Listing Format..."
a
.I kiválasztás
színével. Ez különösen előnyös, ha a könyvtárunkban más felhasználó

View File

@ -680,7 +680,7 @@ se la divisione pannello nella finestra
aspetto
.\"Layout"
del menu opzioni è orizzontale).
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Modalità lista..."
La modalità lista serve a mostrare un elenco di file; ci sono quattro
modalità elenco disponibili:
@ -1765,7 +1765,7 @@ e
.I modalità
.\"LINK2"
dello schermo
.\"Listing Mode..."
.\"Listing Format..."
valide per l'utente che usa il Midnight Commander
sono evidenziati con il colore definito con la parolachiave
.IR selezionata .

View File

@ -513,9 +513,9 @@ respectively.
.TP
.B Alt\-t
toggle the current display listing to show the next display listing
mode.
format.
With this it is possible to quickly switch to brief listing, long
listing, user defined listing mode, and back to the default.
listing, user defined listing format, and back to the default.
.TP
.B C\-\\\\ (control\-backslash)
show the
@ -815,10 +815,10 @@ when the horizontal panel split is chosen from the
Layout
.\"Layout"
options dialog).
.\"NODE " Listing Mode..."
.SH " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Listing Format..."
The listing mode view is used to display a listing of files, there are
four different listing modes available:
four different listing formats available:
.BR Full ,
.BR Brief ,
.B Long
@ -2118,7 +2118,7 @@ and
.I mode
.\"LINK2"
display fields
.\"Listing Mode..."
.\"Listing Format..."
which apply to the user running Midnight Commander are highlighted with
the color defined by the
.I selected

View File

@ -564,7 +564,7 @@ Wygląd panelu katalogowego może zostać zmieniony poprzez menu
i
.BR right .
.PP
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Tryby wyświetlania (Listing modes)"
Tryby wyświetlania są używane do zmienia ustawień przy wyświetlaniu.
Dostępne są cztery różne tryby:

View File

@ -814,7 +814,7 @@ Commander\-ом (например, символ '+').
.B "Левая" (или "Верхняя")
и
.B "Правая" (или "Нижняя").
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Формат списка..."
Этот пункт меню предназначен для определения формата вывода списка
файлов в панели. Вы можете выбрать один из 4 вариантов представления
@ -2268,7 +2268,7 @@ Midnight Commander'а текущие настройки панелей соха
в
.\"LINK2"
форматах вывода\&,
.\"Listing Mode..."
.\"Listing Format..."
показывающие права пользователя, запустившего программу Midnight
Commander, выделены цветом, определенным ключевым словом
.I selected.

View File

@ -650,7 +650,7 @@ C\-t) у наредбени ред.
Изглед
.\"Layout"
изабрана положена подела окна).
.\"NODE " Listing Mode..."
.\"NODE " Listing Format..."
.SH " Режим списка..."
Поглед режима списка се користи за приказ списка датотека; постоје
четири различита режима списка:
@ -1747,7 +1747,7 @@ L Набраја садржај компримоване архиве врсте
Ако је укључено истицање дозвола, делови
.\"LINK2"
поља приказа
.\"Listing Mode..."
.\"Listing Format..."
.I perm (дозволе)
и
.IR "mode (окталне дозволе)",

View File

@ -147,7 +147,6 @@ static name_keymap_t command_names[] = {
{"ViewFiltered", CK_ViewFiltered},
{"Find", CK_Find},
{"DirSize", CK_DirSize},
{"PanelListingSwitch", CK_PanelListingSwitch},
{"CompareDirs", CK_CompareDirs},
#ifdef USE_DIFF_VIEW
{"CompareFiles", CK_CompareFiles},
@ -179,7 +178,7 @@ static name_keymap_t command_names[] = {
{"OptionsLayout", CK_OptionsLayout},
{"OptionsAppearance", CK_OptionsAppearance},
{"Link", CK_Link},
{"PanelListingChange", CK_PanelListingChange},
{"SetupListingFormat", CK_SetupListingFormat},
{"PanelListing", CK_PanelListing},
#ifdef LISTMODE_EDITOR
{"ListMode", CK_ListMode}.
@ -234,6 +233,7 @@ static name_keymap_t command_names[] = {
{"SortBySize", CK_SortBySize},
{"SortByMTime", CK_SortByMTime},
{"CdParentSmart", CK_CdParentSmart},
{"CycleListingFormat", CK_CycleListingFormat},
/* dialog */
{"Ok", CK_Ok},

View File

@ -137,7 +137,7 @@ enum
CK_Find,
CK_DirSize,
CK_HotListAdd,
CK_PanelListingChange,
CK_SetupListingFormat,
CK_CompareDirs,
CK_OptionsVfs,
CK_OptionsConfirm,
@ -165,7 +165,6 @@ enum
CK_VfsList,
CK_SaveSetup,
CK_LinkSymbolic,
CK_PanelListingSwitch,
CK_ShowHidden,
CK_PanelTree,
CK_Tree,
@ -208,6 +207,7 @@ enum
CK_SortByMTime,
CK_ScrollLeft,
CK_ScrollRight,
CK_CycleListingFormat,
/* dialog */
CK_Ok = 300L,

View File

@ -23,8 +23,7 @@ Suspend = ctrl-z
Swap = ctrl-u
History = alt-h
# PanelListing =
PanelListingSwitch = alt-t
# PanelListingChange =
# SetupListingFormat =
ShowHidden = alt-dot
SplitVertHoriz = alt-comma
SplitEqual = alt-equal
@ -80,6 +79,7 @@ PutCurrentLink = r
PutOtherLink = ctrl-r
[panel]
CycleListingFormat = alt-t
Search = ctrl-s; alt-s
Mark = insert; ctrl-t
MarkUp = shift-up

View File

@ -23,8 +23,7 @@ Suspend = ctrl-z
Swap = ctrl-u
History = alt-h
# PanelListing =
PanelListingSwitch = alt-t
# PanelListingChange =
# SetupListingFormat =
ShowHidden = alt-dot
SplitVertHoriz = alt-comma
SplitEqual = alt-equal
@ -80,6 +79,7 @@ PutCurrentLink = r
PutOtherLink = ctrl-r
[panel]
CycleListingFormat = alt-t
Search = ctrl-s; alt-s
Mark = insert; ctrl-t
MarkUp = shift-up

View File

@ -72,7 +72,7 @@
#include "command.h" /* For cmdline */
#include "dir.h"
#include "panel.h" /* LIST_TYPES */
#include "panel.h" /* LIST_FORMATS */
#include "tree.h"
#include "layout.h" /* for get_nth_panel_name proto */
#include "midnight.h" /* current_panel */
@ -95,13 +95,13 @@
static unsigned long configure_old_esc_mode_id, configure_time_out_id;
/* Index in list_types[] for "brief" */
static const int panel_listing_brief_idx = 1;
/* Index in list_types[] for "user defined" */
static const int panel_listing_user_idx = 3;
/* Index in list_formats[] for "brief" */
static const int panel_list_brief_idx = 1;
/* Index in list_formats[] for "user defined" */
static const int panel_list_user_idx = 3;
static char **status_format;
static unsigned long panel_listing_types_id, panel_user_format_id, panel_brief_cols_id;
static unsigned long panel_list_formats_id, panel_user_format_id, panel_brief_cols_id;
static unsigned long mini_user_status_id, mini_user_format_id;
#ifdef HAVE_CHARSET
@ -279,7 +279,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
switch (msg)
{
case MSG_NOTIFY:
if (sender != NULL && sender->id == panel_listing_types_id)
if (sender != NULL && sender->id == panel_list_formats_id)
{
WCheck *ch;
WInput *in1, *in2, *in3;
@ -294,8 +294,8 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
input_update (in1, FALSE);
input_update (in2, FALSE);
input_update (in3, FALSE);
widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_listing_user_idx);
widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_listing_brief_idx);
widget_disable (WIDGET (in1), RADIO (sender)->sel != panel_list_user_idx);
widget_disable (WIDGET (in2), RADIO (sender)->sel != panel_list_brief_idx);
return MSG_HANDLED;
}
@ -314,7 +314,7 @@ panel_listing_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
{
WRadio *r;
r = RADIO (dlg_find_by_id (h, panel_listing_types_id));
r = RADIO (dlg_find_by_id (h, panel_list_formats_id));
widget_disable (WIDGET (in), TRUE);
input_assign_text (in, status_format[r->sel]);
}
@ -724,10 +724,10 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
p = get_nth_panel_name (num);
panel = g_new (WPanel, 1);
panel->list_type = list_full;
panel->list_format = list_full;
panel->user_format = g_strdup (DEFAULT_USER_FORMAT);
panel->user_mini_status = FALSE;
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
section = g_strconcat ("Temporal:", p, (char *) NULL);
if (!mc_config_has_group (mc_global.main_config, section))
@ -747,7 +747,7 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
char *mini_user_format = NULL;
/* Controls whether the array strings have been translated */
const char *list_types[LIST_TYPES] = {
const char *list_formats[LIST_FORMATS] = {
N_("&Full file list"),
N_("&Brief file list:"),
N_("&Long file list"),
@ -757,7 +757,7 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
quick_widget_t quick_widgets[] = {
/* *INDENT-OFF* */
QUICK_START_COLUMNS,
QUICK_RADIO (LIST_TYPES, list_types, &result, &panel_listing_types_id),
QUICK_RADIO (LIST_FORMATS, list_formats, &result, &panel_list_formats_id),
QUICK_NEXT_COLUMN,
QUICK_SEPARATOR (FALSE),
QUICK_LABELED_INPUT (_ ("columns"), input_label_right, panel_brief_cols_in,
@ -768,7 +768,7 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
&panel_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
QUICK_SEPARATOR (TRUE),
QUICK_CHECKBOX (N_("User &mini status"), &mini_user_status, &mini_user_status_id),
QUICK_INPUT (panel->user_status_format[panel->list_type], "mini_input",
QUICK_INPUT (panel->user_status_format[panel->list_format], "mini_input",
&mini_user_format, &mini_user_format_id, FALSE, FALSE, INPUT_COMPLETE_NONE),
QUICK_BUTTONS_OK_CANCEL,
QUICK_END
@ -777,20 +777,20 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
quick_dialog_t qdlg = {
-1, -1, 48,
N_("Listing mode"), "[Listing Mode...]",
N_("Listing format"), "[Listing Format...]",
quick_widgets, panel_listing_callback, NULL
};
mini_user_status = panel->user_mini_status;
result = panel->list_type;
result = panel->list_format;
status_format = panel->user_status_format;
g_snprintf (panel_brief_cols_in, sizeof (panel_brief_cols_in), "%d", panel->brief_cols);
if ((int) panel->list_type != panel_listing_brief_idx)
if ((int) panel->list_format != panel_list_brief_idx)
quick_widgets[4].state = WST_DISABLED;
if ((int) panel->list_type != panel_listing_user_idx)
if ((int) panel->list_format != panel_list_user_idx)
quick_widgets[6].state = WST_DISABLED;
if (!mini_user_status)
@ -822,7 +822,7 @@ panel_listing_box (WPanel * panel, int num, char **userp, char **minip, gboolean
int i;
g_free (panel->user_format);
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
g_free (panel->user_status_format[i]);
g_free (panel);
}

View File

@ -475,23 +475,23 @@ nice_cd (const char *text, const char *xtext, const char *help,
/* --------------------------------------------------------------------------------------------- */
static void
configure_panel_listing (WPanel * p, int list_type, int brief_cols, gboolean use_msformat,
configure_panel_listing (WPanel * p, int list_format, int brief_cols, gboolean use_msformat,
char **user, char **status)
{
p->user_mini_status = use_msformat;
p->list_type = list_type;
p->list_format = list_format;
if (list_type == list_brief)
if (list_format == list_brief)
p->brief_cols = brief_cols;
if (list_type == list_user || use_msformat)
if (list_format == list_user || use_msformat)
{
g_free (p->user_format);
p->user_format = *user;
*user = NULL;
g_free (p->user_status_format[list_type]);
p->user_status_format[list_type] = *status;
g_free (p->user_status_format[list_format]);
p->user_status_format[list_format] = *status;
*status = NULL;
set_panel_formats (p);
@ -508,38 +508,6 @@ switch_to_listing (int panel_index)
{
if (get_display_type (panel_index) != view_listing)
set_display_type (panel_index, view_listing);
else
{
WPanel *p;
p = PANEL (get_panel_widget (panel_index));
if (p->is_panelized)
{
p->is_panelized = FALSE;
panel_reload (p);
}
}
}
/* --------------------------------------------------------------------------------------------- */
/** Handle the tree internal listing modes switching */
static gboolean
set_basic_panel_listing_to (int panel_index, int listing_mode)
{
WPanel *p;
gboolean ok;
p = PANEL (get_panel_widget (panel_index));
switch_to_listing (panel_index);
p->list_type = listing_mode;
ok = set_panel_formats (p) == 0;
if (ok)
do_refresh ();
return ok;
}
/* --------------------------------------------------------------------------------------------- */
@ -1586,15 +1554,22 @@ quick_cmd_no_menu (void)
void
listing_cmd (void)
{
WPanel *p;
switch_to_listing (MENU_PANEL_IDX);
p = PANEL (get_panel_widget (MENU_PANEL_IDX));
p->is_panelized = FALSE;
set_panel_filter_to (p, NULL); /* including panel reload */
}
/* --------------------------------------------------------------------------------------------- */
void
change_listing_cmd (void)
setup_listing_format_cmd (void)
{
int list_type;
int list_format;
gboolean use_msformat;
int brief_cols;
char *user, *status;
@ -1603,12 +1578,12 @@ change_listing_cmd (void)
if (SELECTED_IS_PANEL)
p = MENU_PANEL_IDX == 0 ? left_panel : right_panel;
list_type = panel_listing_box (p, MENU_PANEL_IDX, &user, &status, &use_msformat, &brief_cols);
if (list_type != -1)
list_format = panel_listing_box (p, MENU_PANEL_IDX, &user, &status, &use_msformat, &brief_cols);
if (list_format != -1)
{
switch_to_listing (MENU_PANEL_IDX);
p = MENU_PANEL_IDX == 0 ? left_panel : right_panel;
configure_panel_listing (p, list_type, brief_cols, use_msformat, &user, &status);
configure_panel_listing (p, list_format, brief_cols, use_msformat, &user, &status);
g_free (user);
g_free (status);
}
@ -1642,20 +1617,6 @@ quick_view_cmd (void)
/* --------------------------------------------------------------------------------------------- */
void
toggle_listing_cmd (void)
{
int current;
WPanel *p;
current = get_current_index ();
p = PANEL (get_panel_widget (current));
set_basic_panel_listing_to (current, (p->list_type + 1) % LIST_TYPES);
}
/* --------------------------------------------------------------------------------------------- */
#ifdef HAVE_CHARSET
void
encoding_cmd (void)

View File

@ -86,11 +86,10 @@ void save_setup_cmd (void);
void user_file_menu_cmd (void);
void info_cmd (void);
void listing_cmd (void);
void change_listing_cmd (void);
void setup_listing_format_cmd (void);
void quick_cmd_no_menu (void);
void info_cmd_no_menu (void);
void quick_view_cmd (void);
void toggle_listing_cmd (void);
#ifdef HAVE_CHARSET
void encoding_cmd (void);
#endif

View File

@ -179,7 +179,7 @@ listmode_cmd (void)
return;
g_free (current_panel->user_format);
current_panel->list_type = list_user;
current_panel->list_format = list_user;
current_panel->user_format = newmode;
set_panel_formats (current_panel);
@ -200,7 +200,8 @@ create_panel_menu (void)
entries = g_list_prepend (entries, menu_entry_create (_("&Tree"), CK_PanelTree));
entries = g_list_prepend (entries, menu_separator_create ());
entries =
g_list_prepend (entries, menu_entry_create (_("&Listing mode..."), CK_PanelListingChange));
g_list_prepend (entries,
menu_entry_create (_("&Listing format..."), CK_SetupListingFormat));
entries = g_list_prepend (entries, menu_entry_create (_("&Sort order..."), CK_Sort));
entries = g_list_prepend (entries, menu_entry_create (_("&Filter..."), CK_Filter));
#ifdef HAVE_CHARSET
@ -1112,8 +1113,8 @@ midnight_execute_cmd (Widget * sender, long command)
case CK_HotListAdd:
add2hotlist_cmd ();
break;
case CK_PanelListingChange:
change_listing_cmd ();
case CK_SetupListingFormat:
setup_listing_format_cmd ();
break;
case CK_ChangeMode:
chmod_cmd ();
@ -1352,9 +1353,6 @@ midnight_execute_cmd (Widget * sender, long command)
case CK_LinkSymbolic:
link_cmd (LINK_SYMLINK_ABSOLUTE);
break;
case CK_PanelListingSwitch:
toggle_listing_cmd ();
break;
case CK_ShowHidden:
toggle_show_hidden ();
break;

View File

@ -953,7 +953,7 @@ repaint_file (WPanel * panel, int file_index, gboolean mv, int attr, gboolean is
{
if (!panel_is_split && fln > 0)
{
if (panel->list_type != list_long)
if (panel->list_format != list_long)
width = fln;
else
{
@ -1489,7 +1489,7 @@ panel_destroy (WPanel * p)
delete_format (p->status_format);
g_free (p->user_format);
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
g_free (p->user_status_format[i]);
g_free (p->dir.list);
@ -1576,7 +1576,7 @@ panel_print_header (const WPanel * panel)
{
g_string_set_size (format_txt, 0);
if (panel->list_type == list_long
if (panel->list_format == list_long
&& strcmp (format->id, panel->sort_field->id) == 0)
g_string_append (format_txt,
panel->sort_info.reverse
@ -1611,7 +1611,7 @@ panel_print_header (const WPanel * panel)
g_string_free (format_txt, TRUE);
if (panel->list_type != list_long)
if (panel->list_format != list_long)
panel_paint_sort_info (panel);
}
@ -1911,7 +1911,7 @@ static const char *
panel_format (WPanel * panel)
{
switch (panel->list_type)
switch (panel->list_format)
{
case list_long:
return "full perm space nlink space owner space group space size space mtime space name";
@ -1946,9 +1946,9 @@ static const char *
mini_status_format (WPanel * panel)
{
if (panel->user_mini_status)
return panel->user_status_format[panel->list_type];
return panel->user_status_format[panel->list_format];
switch (panel->list_type)
switch (panel->list_format)
{
case list_long:
return "full perm space nlink space owner space group space size space mtime space name";
@ -2858,6 +2858,18 @@ do_enter (WPanel * panel)
return do_enter_on_file_entry (selection (panel));
}
/* --------------------------------------------------------------------------------------------- */
static void
panel_cycle_listing_format (WPanel * panel)
{
panel->list_format = (panel->list_format + 1) % LIST_FORMATS;
if (set_panel_formats (panel) == 0)
do_refresh ();
}
/* --------------------------------------------------------------------------------------------- */
static void
@ -3436,6 +3448,9 @@ panel_execute_cmd (WPanel * panel, long command)
switch (command)
{
case CK_CycleListingFormat:
panel_cycle_listing_format (panel);
break;
case CK_PanelOtherCd:
chdir_other_panel (panel);
break;
@ -4318,7 +4333,7 @@ panel_new_with_dir (const char *panel_name, const vfs_path_t * vpath)
panel->codepage = SELECT_CHARSET_NO_TRANSLATE;
#endif
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
panel->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
panel->search_buffer[0] = '\0';
@ -4469,8 +4484,8 @@ set_panel_formats (WPanel * p)
}
if (retcode & 0x02)
{
g_free (p->user_status_format[p->list_type]);
p->user_status_format[p->list_type] = g_strdup (DEFAULT_USER_FORMAT);
g_free (p->user_status_format[p->list_format]);
p->user_status_format[p->list_format] = g_strdup (DEFAULT_USER_FORMAT);
}
return retcode;

View File

@ -21,7 +21,7 @@
#define selection(p) (&(p->dir.list[p->selected]))
#define DEFAULT_USER_FORMAT "half type name | size | perm"
#define LIST_TYPES 4
#define LIST_FORMATS 4
#define UP_KEEPSEL ((char *) -1)
@ -33,7 +33,7 @@ typedef enum
list_brief, /* Name */
list_long, /* Like ls -l */
list_user /* User defined */
} list_type_t;
} list_format_t;
typedef enum
{
@ -93,7 +93,7 @@ typedef struct
Widget widget;
dir_list dir; /* Directory contents */
list_type_t list_type; /* listing type */
list_format_t list_format; /* listing type */
int active; /* If panel is currently selected */
vfs_path_t *cwd_vpath; /* Current Working Directory */
vfs_path_t *lwd_vpath; /* Last Working Directory */
@ -119,7 +119,7 @@ typedef struct
gboolean user_mini_status; /* Is user_status_format used */
char *user_format; /* User format */
char *user_status_format[LIST_TYPES]; /* User format for status line */
char *user_status_format[LIST_FORMATS]; /* User format for status line */
struct format_e *format; /* Display format */
struct format_e *status_format; /* Mini status format */

View File

@ -115,7 +115,6 @@ static const global_keymap_ini_t default_main_keymap[] = {
/* Panel refresh */
{"Reread", "ctrl-r"},
/* Switch listing between long, user defined and full formats */
{"PanelListingSwitch", "alt-t"},
/* Swap panels */
{"Swap", "ctrl-u"},
/* Resize panels */
@ -168,6 +167,7 @@ static const global_keymap_ini_t default_main_x_keymap[] = {
/* panel */
static const global_keymap_ini_t default_panel_keymap[] = {
{"CycleListingFormat", "alt-t"},
{"PanelOtherCd", "alt-o"},
{"PanelOtherCdLink", "alt-l"},
{"CopySingle", "f15"},

View File

@ -231,8 +231,8 @@ static char *panels_profile_name = NULL; /* ${XDG_CACHE_HOME}/mc/panels.i
static const struct
{
const char *key;
int list_type;
} list_types [] = {
int list_format;
} list_formats [] = {
{ "full", list_full },
{ "brief", list_brief },
{ "long", list_long },
@ -1471,13 +1471,18 @@ panel_load_setup (WPanel * panel, const char *section)
g_free (buffer);
/* Load the listing mode */
buffer = mc_config_get_string (mc_global.panels_config, section, "list_mode", "full");
panel->list_type = list_full;
for (i = 0; list_types[i].key != NULL; i++)
if (g_ascii_strcasecmp (list_types[i].key, buffer) == 0)
/* Load the listing format */
buffer = mc_config_get_string (mc_global.panels_config, section, "list_format", NULL);
if (buffer == NULL)
{
panel->list_type = list_types[i].list_type;
/* fallback to old option */
buffer = mc_config_get_string (mc_global.panels_config, section, "list_mode", "full");
}
panel->list_format = list_full;
for (i = 0; list_formats[i].key != NULL; i++)
if (g_ascii_strcasecmp (list_formats[i].key, buffer) == 0)
{
panel->list_format = list_formats[i].list_format;
break;
}
g_free (buffer);
@ -1489,7 +1494,7 @@ panel_load_setup (WPanel * panel, const char *section)
panel->user_format =
mc_config_get_string (mc_global.panels_config, section, "user_format", DEFAULT_USER_FORMAT);
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
{
g_free (panel->user_status_format[i]);
g_snprintf (buffer2, sizeof (buffer2), "user_status%lld", (long long) i);
@ -1516,10 +1521,11 @@ panel_save_setup (WPanel * panel, const char *section)
mc_config_set_string (mc_global.panels_config, section, "sort_order", panel->sort_field->id);
for (i = 0; list_types[i].key != NULL; i++)
if (list_types[i].list_type == (int) panel->list_type)
for (i = 0; list_formats[i].key != NULL; i++)
if (list_formats[i].list_format == (int) panel->list_format)
{
mc_config_set_string (mc_global.panels_config, section, "list_mode", list_types[i].key);
mc_config_set_string (mc_global.panels_config, section, "list_format",
list_formats[i].key);
break;
}
@ -1527,7 +1533,7 @@ panel_save_setup (WPanel * panel, const char *section)
mc_config_set_string (mc_global.panels_config, section, "user_format", panel->user_format);
for (i = 0; i < LIST_TYPES; i++)
for (i = 0; i < LIST_FORMATS; i++)
{
g_snprintf (buffer, sizeof (buffer), "user_status%lld", (long long) i);
mc_config_set_string (mc_global.panels_config, section, buffer,