Ticket #2465 (dynamically resize panels)

added new panel's action to dynamically resize panels:
    SplitEqual - make equal size of panels
    SplitMore - enlarge left/up panel
    SplitLess - enlarge right/down panel

changed misc/mc.keymap.default, misc/mc.keymap.emacs

Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
This commit is contained in:
Ilia Maslakov 2012-02-06 19:14:22 +04:00
parent 7c0a526916
commit 5e688eec94
7 changed files with 77 additions and 7 deletions

View File

@ -194,6 +194,9 @@ static name_keymap_t command_names[] = {
{"HotListAdd", CK_HotListAdd}, {"HotListAdd", CK_HotListAdd},
{"ShowHidden", CK_ShowHidden}, {"ShowHidden", CK_ShowHidden},
{"SplitVertHoriz", CK_SplitVertHoriz}, {"SplitVertHoriz", CK_SplitVertHoriz},
{"SplitEqual", CK_SplitEqual},
{"SplitMore", CK_SplitMore},
{"SplitLess", CK_SplitLess},
{"PutCurrentPath", CK_PutCurrentPath}, {"PutCurrentPath", CK_PutCurrentPath},
{"PutOtherPath", CK_PutOtherPath}, {"PutOtherPath", CK_PutOtherPath},
{"PutCurrentTagged", CK_PutCurrentTagged}, {"PutCurrentTagged", CK_PutCurrentTagged},
@ -324,9 +327,6 @@ static name_keymap_t command_names[] = {
/* diff viewer */ /* diff viewer */
{"ShowSymbols", CK_ShowSymbols}, {"ShowSymbols", CK_ShowSymbols},
{"SplitFull", CK_SplitFull}, {"SplitFull", CK_SplitFull},
{"SplitEqual", CK_SplitEqual},
{"SplitMore", CK_SplitMore},
{"SplitLess", CK_SplitLess},
{"Tab2", CK_Tab2}, {"Tab2", CK_Tab2},
{"Tab3", CK_Tab3}, {"Tab3", CK_Tab3},
{"Tab4", CK_Tab4}, {"Tab4", CK_Tab4},

View File

@ -164,6 +164,9 @@ enum
CK_Tree, CK_Tree,
CK_Undelete, CK_Undelete,
CK_SplitVertHoriz, CK_SplitVertHoriz,
CK_SplitEqual,
CK_SplitMore,
CK_SplitLess,
CK_CompareFiles, CK_CompareFiles,
CK_OptionsPanel, CK_OptionsPanel,
CK_LinkSymbolicRelative, CK_LinkSymbolicRelative,
@ -304,9 +307,6 @@ enum
/* diff viewer */ /* diff viewer */
CK_ShowSymbols = 700, CK_ShowSymbols = 700,
CK_SplitFull, CK_SplitFull,
CK_SplitEqual,
CK_SplitMore,
CK_SplitLess,
CK_Tab2, CK_Tab2,
CK_Tab3, CK_Tab3,
CK_Tab4, CK_Tab4,

View File

@ -26,6 +26,9 @@ PanelListingSwitch = alt-t
PanelListingChange = PanelListingChange =
ShowHidden = alt-dot ShowHidden = alt-dot
SplitVertHoriz = alt-comma SplitVertHoriz = alt-comma
SplitEqual = alt-equal
SplitMore = alt-shift-right
SplitLess = alt-shift-left
Shell = ctrl-o Shell = ctrl-o
PutCurrentPath = alt-a PutCurrentPath = alt-a
PutOtherPath = alt-shift-a PutOtherPath = alt-shift-a

View File

@ -26,6 +26,9 @@ PanelListingSwitch = alt-t
PanelListingChange = PanelListingChange =
ShowHidden = alt-dot ShowHidden = alt-dot
SplitVertHoriz = alt-comma SplitVertHoriz = alt-comma
SplitEqual = alt-equal
SplitMore = alt-shift-right
SplitLess = alt-shift-left
Shell = ctrl-o Shell = ctrl-o
PutCurrentPath = alt-a PutCurrentPath = alt-a
PutOtherPath = alt-shift-a PutOtherPath = alt-shift-a

View File

@ -753,6 +753,59 @@ setup_panels (void)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
void
panels_split_equal (void)
{
if (panels_layout.horizontal_split)
panels_layout.horizontal_equal = TRUE;
else
panels_layout.vertical_equal = TRUE;
layout_change ();
do_refresh ();
}
/* --------------------------------------------------------------------------------------------- */
void
panels_split_more (void)
{
if (panels_layout.horizontal_split)
{
panels_layout.horizontal_equal = FALSE;
panels_layout.top_panel_size++;
}
else
{
panels_layout.vertical_equal = FALSE;
panels_layout.left_panel_size++;
}
layout_change ();
}
/* --------------------------------------------------------------------------------------------- */
void
panels_split_less (void)
{
if (panels_layout.horizontal_split)
{
panels_layout.horizontal_equal = FALSE;
panels_layout.top_panel_size--;
}
else
{
panels_layout.vertical_equal = FALSE;
panels_layout.left_panel_size--;
}
layout_change ();
}
/* --------------------------------------------------------------------------------------------- */
void void
setup_cmdline (void) setup_cmdline (void)
{ {

View File

@ -51,10 +51,12 @@ extern int nice_rotating_dash;
extern panels_layout_t panels_layout; extern panels_layout_t panels_layout;
/*** declarations of public functions ************************************************************/ /*** declarations of public functions ************************************************************/
void layout_change (void); void layout_change (void);
void layout_box (void); void layout_box (void);
void setup_panels (void); void setup_panels (void);
void panels_split_equal (void);
void panels_split_more (void);
void panels_split_less (void);
void destroy_panels (void); void destroy_panels (void);
void setup_cmdline (void); void setup_cmdline (void);
void set_display_type (int num, panel_view_mode_t type); void set_display_type (int num, panel_view_mode_t type);

View File

@ -1294,6 +1294,15 @@ midnight_execute_cmd (Widget * sender, unsigned long command)
case CK_SplitVertHoriz: case CK_SplitVertHoriz:
toggle_panels_split (); toggle_panels_split ();
break; break;
case CK_SplitEqual:
panels_split_equal ();
break;
case CK_SplitMore:
panels_split_more ();
break;
case CK_SplitLess:
panels_split_less ();
break;
case CK_PanelTree: case CK_PanelTree:
panel_tree_cmd (); panel_tree_cmd ();
break; break;