Browse Source

Refactoring: handle panel listing mode switch in the panel level

...instead of top level.

Rename and move main/PanelListingSwitch keybind to panel/ListingSwitch.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 8 years ago
parent
commit
b56a77e02f

+ 1 - 1
lib/keybind.c

@@ -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},
@@ -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},

+ 1 - 1
lib/keybind.h

@@ -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,

+ 1 - 1
misc/mc.default.keymap

@@ -23,7 +23,6 @@ Suspend = ctrl-z
 Swap = ctrl-u
 History = alt-h
 # PanelListing =
-PanelListingSwitch = alt-t
 # PanelListingChange =
 ShowHidden = alt-dot
 SplitVertHoriz = alt-comma
@@ -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

+ 1 - 1
misc/mc.emacs.keymap

@@ -23,7 +23,6 @@ Suspend = ctrl-z
 Swap = ctrl-u
 History = alt-h
 # PanelListing =
-PanelListingSwitch = alt-t
 # PanelListingChange =
 ShowHidden = alt-dot
 SplitVertHoriz = alt-comma
@@ -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

+ 0 - 17
src/filemanager/cmd.c

@@ -1617,23 +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));
-
-    p->list_type = (p->list_type + 1) % LIST_TYPES;
-
-    if (set_panel_formats (p) == 0)
-        do_refresh ();
-}
-
-/* --------------------------------------------------------------------------------------------- */
-
 #ifdef HAVE_CHARSET
 void
 encoding_cmd (void)

+ 0 - 1
src/filemanager/cmd.h

@@ -90,7 +90,6 @@ void change_listing_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

+ 0 - 3
src/filemanager/midnight.c

@@ -1352,9 +1352,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;

+ 15 - 0
src/filemanager/panel.c

@@ -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_type = (panel->list_type + 1) % LIST_TYPES;
+
+    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;

+ 1 - 1
src/keybind-defaults.c

@@ -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"},