From 2b653ecf3311207d8fcde41132aa557cb46231fe Mon Sep 17 00:00:00 2001 From: Slava Zanko Date: Wed, 3 Feb 2010 14:55:36 +0200 Subject: [PATCH] Ticket #1991: toggle panels view Added keybinding for switch panels view (horizontally/vertically). Default value for keybind is [main] CmdTogglePanelsView = alt-comma Signed-off-by: Slava Zanko --- misc/mc.keymap.default | 1 + misc/mc.keymap.emacs | 1 + src/cmddef.h | 1 + src/keybind.c | 2 ++ src/layout.c | 2 +- src/layout.h | 1 + src/main.c | 11 +++++++++++ 7 files changed, 18 insertions(+), 1 deletion(-) diff --git a/misc/mc.keymap.default b/misc/mc.keymap.default index 690f1fe45..536beb727 100644 --- a/misc/mc.keymap.default +++ b/misc/mc.keymap.default @@ -229,6 +229,7 @@ CmdSwapPanel = ctrl-u CmdHistory = alt-h CmdToggleListing = alt-t CmdToggleShowHidden = alt-dot +CmdTogglePanelsSplit = alt-comma ShowCommandLine = ctrl-o CmdCopyCurrentPathname = alt-a CmdCopyOtherPathname = alt-shift-a diff --git a/misc/mc.keymap.emacs b/misc/mc.keymap.emacs index 10529180f..009d22b93 100644 --- a/misc/mc.keymap.emacs +++ b/misc/mc.keymap.emacs @@ -233,6 +233,7 @@ CmdSwapPanel = ctrl-u CmdHistory = alt-h CmdToggleListing = alt-t CmdToggleShowHidden = alt-dot +CmdTogglePanelsSplit = alt-comma ShowCommandLine = ctrl-o CmdCopyCurrentPathname = alt-a CmdCopyOtherPathname = alt-shift-a diff --git a/src/cmddef.h b/src/cmddef.h index b38135a00..e25deb222 100644 --- a/src/cmddef.h +++ b/src/cmddef.h @@ -366,6 +366,7 @@ #define CK_ViewFileCmd 7071 #define CK_HelpCmd 7072 #define CK_MenuCmd 7073 +#define CK_TogglePanelsSplit 7074 /* panels */ #define CK_PanelChdirOtherPanel 8001 diff --git a/src/keybind.c b/src/keybind.c index 131064d7a..4e24448cb 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -366,6 +366,7 @@ static name_keymap_t command_names[] = { { "CmdCopyCurrentTagged", CK_CopyCurrentTagged }, { "CmdCopyOtherTagged", CK_CopyOtherTagged }, { "CmdToggleShowHidden", CK_ToggleShowHidden }, + { "CmdTogglePanelsSplit", CK_TogglePanelsSplit }, /* panel */ { "PanelChdirOtherPanel", CK_PanelChdirOtherPanel }, @@ -830,6 +831,7 @@ const global_keymap_t default_main_map[] = { /* View output */ { XCTRL ('o'), CK_ShowCommandLine, "C-o" }, { ALT ('.'), CK_ToggleShowHidden, "M-." }, + { ALT (','), CK_TogglePanelsSplit, "M-," }, { XCTRL ('x'), CK_StartExtMap1, "C-x" }, /* Select/unselect group */ { KEY_KP_ADD, CK_SelectCmd, "+" }, diff --git a/src/layout.c b/src/layout.c index 9c1acec56..a24f05436 100644 --- a/src/layout.c +++ b/src/layout.c @@ -509,7 +509,7 @@ init_layout (void) radio_widget->sel = horizontal_split; } -static void +void layout_change (void) { setup_panels (); diff --git a/src/layout.h b/src/layout.h index c0c579dec..1e206f827 100644 --- a/src/layout.h +++ b/src/layout.h @@ -9,6 +9,7 @@ #include "panel.h" #include "widget.h" +void layout_change (void); void layout_cmd (void); void setup_panels (void); void destroy_panels (void); diff --git a/src/main.c b/src/main.c index ad1e3ad19..43aa28a86 100644 --- a/src/main.c +++ b/src/main.c @@ -903,6 +903,14 @@ toggle_show_hidden (void) update_panels (UP_RELOAD, UP_KEEPSEL); } +static void +toggle_panels_split (void) +{ + horizontal_split = !horizontal_split; + layout_change (); + do_refresh(); +} + void toggle_kilobyte_si (void) { @@ -1348,6 +1356,9 @@ midnight_execute_cmd (Widget *sender, unsigned long command) case CK_ToggleShowHidden: toggle_show_hidden (); break; + case CK_TogglePanelsSplit: + toggle_panels_split (); + break; case CK_TreeCmd: tree_cmd (); break;