1
0
mirror of https://github.com/MidnightCommander/mc synced 2025-03-21 23:32:57 +03:00

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 : 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

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

@ -663,7 +663,7 @@ A könyvtárpanelek megjelenése változtatható a
és és
.B "Jobb" .B "Jobb"
menükben. menükben.
.\"NODE " Listing Mode..." .\"NODE " Listing Format..."
.SH " Fájllista..." .SH " Fájllista..."
A fájllista módozatok a fájlok megjelenítésének beállítására szolgálnak, 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ó: 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 láthatók a
.\"LINK2" .\"LINK2"
Fájllistában Fájllistában
.\"Listing Mode..." .\"Listing Format..."
a a
.I kiválasztás .I kiválasztás
színével. Ez különösen előnyös, ha a könyvtárunkban más felhasználó színével. Ez különösen előnyös, ha a könyvtárunkban más felhasználó

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

@ -513,9 +513,9 @@ respectively.
.TP .TP
.B Alt\-t .B Alt\-t
toggle the current display listing to show the next display listing 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 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 .TP
.B C\-\\\\ (control\-backslash) .B C\-\\\\ (control\-backslash)
show the show the
@ -815,10 +815,10 @@ when the horizontal panel split is chosen from the
Layout Layout
.\"Layout" .\"Layout"
options dialog). options dialog).
.\"NODE " Listing Mode..." .\"NODE " Listing Format..."
.SH " Listing Mode..." .SH " Listing Format..."
The listing mode view is used to display a listing of files, there are 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 Full ,
.BR Brief , .BR Brief ,
.B Long .B Long
@ -2118,7 +2118,7 @@ and
.I mode .I mode
.\"LINK2" .\"LINK2"
display fields display fields
.\"Listing Mode..." .\"Listing Format..."
which apply to the user running Midnight Commander are highlighted with which apply to the user running Midnight Commander are highlighted with
the color defined by the the color defined by the
.I selected .I selected

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

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

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

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

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

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

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

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

@ -475,23 +475,23 @@ nice_cd (const char *text, const char *xtext, const char *help,
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
static void 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) char **user, char **status)
{ {
p->user_mini_status = use_msformat; 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; p->brief_cols = brief_cols;
if (list_type == list_user || use_msformat) if (list_format == list_user || use_msformat)
{ {
g_free (p->user_format); g_free (p->user_format);
p->user_format = *user; p->user_format = *user;
*user = NULL; *user = NULL;
g_free (p->user_status_format[list_type]); g_free (p->user_status_format[list_format]);
p->user_status_format[list_type] = *status; p->user_status_format[list_format] = *status;
*status = NULL; *status = NULL;
set_panel_formats (p); set_panel_formats (p);
@ -508,38 +508,6 @@ switch_to_listing (int panel_index)
{ {
if (get_display_type (panel_index) != view_listing) if (get_display_type (panel_index) != view_listing)
set_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 void
listing_cmd (void) listing_cmd (void)
{ {
WPanel *p;
switch_to_listing (MENU_PANEL_IDX); 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 void
change_listing_cmd (void) setup_listing_format_cmd (void)
{ {
int list_type; int list_format;
gboolean use_msformat; gboolean use_msformat;
int brief_cols; int brief_cols;
char *user, *status; char *user, *status;
@ -1603,12 +1578,12 @@ change_listing_cmd (void)
if (SELECTED_IS_PANEL) if (SELECTED_IS_PANEL)
p = MENU_PANEL_IDX == 0 ? left_panel : right_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); list_format = panel_listing_box (p, MENU_PANEL_IDX, &user, &status, &use_msformat, &brief_cols);
if (list_type != -1) if (list_format != -1)
{ {
switch_to_listing (MENU_PANEL_IDX); switch_to_listing (MENU_PANEL_IDX);
p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; 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 (user);
g_free (status); 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 #ifdef HAVE_CHARSET
void void
encoding_cmd (void) encoding_cmd (void)

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

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

@ -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_is_split && fln > 0)
{ {
if (panel->list_type != list_long) if (panel->list_format != list_long)
width = fln; width = fln;
else else
{ {
@ -1489,7 +1489,7 @@ panel_destroy (WPanel * p)
delete_format (p->status_format); delete_format (p->status_format);
g_free (p->user_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->user_status_format[i]);
g_free (p->dir.list); g_free (p->dir.list);
@ -1576,7 +1576,7 @@ panel_print_header (const WPanel * panel)
{ {
g_string_set_size (format_txt, 0); 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) && strcmp (format->id, panel->sort_field->id) == 0)
g_string_append (format_txt, g_string_append (format_txt,
panel->sort_info.reverse panel->sort_info.reverse
@ -1611,7 +1611,7 @@ panel_print_header (const WPanel * panel)
g_string_free (format_txt, TRUE); g_string_free (format_txt, TRUE);
if (panel->list_type != list_long) if (panel->list_format != list_long)
panel_paint_sort_info (panel); panel_paint_sort_info (panel);
} }
@ -1911,7 +1911,7 @@ static const char *
panel_format (WPanel * panel) panel_format (WPanel * panel)
{ {
switch (panel->list_type) switch (panel->list_format)
{ {
case list_long: case list_long:
return "full perm space nlink space owner space group space size space mtime space name"; 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) mini_status_format (WPanel * panel)
{ {
if (panel->user_mini_status) 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: case list_long:
return "full perm space nlink space owner space group space size space mtime space name"; 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)); 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 static void
@ -3436,6 +3448,9 @@ panel_execute_cmd (WPanel * panel, long command)
switch (command) switch (command)
{ {
case CK_CycleListingFormat:
panel_cycle_listing_format (panel);
break;
case CK_PanelOtherCd: case CK_PanelOtherCd:
chdir_other_panel (panel); chdir_other_panel (panel);
break; break;
@ -4318,7 +4333,7 @@ panel_new_with_dir (const char *panel_name, const vfs_path_t * vpath)
panel->codepage = SELECT_CHARSET_NO_TRANSLATE; panel->codepage = SELECT_CHARSET_NO_TRANSLATE;
#endif #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->user_status_format[i] = g_strdup (DEFAULT_USER_FORMAT);
panel->search_buffer[0] = '\0'; panel->search_buffer[0] = '\0';
@ -4469,8 +4484,8 @@ set_panel_formats (WPanel * p)
} }
if (retcode & 0x02) if (retcode & 0x02)
{ {
g_free (p->user_status_format[p->list_type]); g_free (p->user_status_format[p->list_format]);
p->user_status_format[p->list_type] = g_strdup (DEFAULT_USER_FORMAT); p->user_status_format[p->list_format] = g_strdup (DEFAULT_USER_FORMAT);
} }
return retcode; return retcode;

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

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

@ -231,8 +231,8 @@ static char *panels_profile_name = NULL; /* ${XDG_CACHE_HOME}/mc/panels.i
static const struct static const struct
{ {
const char *key; const char *key;
int list_type; int list_format;
} list_types [] = { } list_formats [] = {
{ "full", list_full }, { "full", list_full },
{ "brief", list_brief }, { "brief", list_brief },
{ "long", list_long }, { "long", list_long },
@ -1471,13 +1471,18 @@ panel_load_setup (WPanel * panel, const char *section)
g_free (buffer); g_free (buffer);
/* Load the listing mode */ /* Load the listing format */
buffer = mc_config_get_string (mc_global.panels_config, section, "list_mode", "full"); buffer = mc_config_get_string (mc_global.panels_config, section, "list_format", NULL);
panel->list_type = list_full; if (buffer == NULL)
for (i = 0; list_types[i].key != NULL; i++) {
if (g_ascii_strcasecmp (list_types[i].key, buffer) == 0) /* 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_type = list_types[i].list_type; panel->list_format = list_formats[i].list_format;
break; break;
} }
g_free (buffer); g_free (buffer);
@ -1489,7 +1494,7 @@ panel_load_setup (WPanel * panel, const char *section)
panel->user_format = panel->user_format =
mc_config_get_string (mc_global.panels_config, section, "user_format", DEFAULT_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_free (panel->user_status_format[i]);
g_snprintf (buffer2, sizeof (buffer2), "user_status%lld", (long long) 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); mc_config_set_string (mc_global.panels_config, section, "sort_order", panel->sort_field->id);
for (i = 0; list_types[i].key != NULL; i++) for (i = 0; list_formats[i].key != NULL; i++)
if (list_types[i].list_type == (int) panel->list_type) 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; 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); 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); g_snprintf (buffer, sizeof (buffer), "user_status%lld", (long long) i);
mc_config_set_string (mc_global.panels_config, section, buffer, mc_config_set_string (mc_global.panels_config, section, buffer,