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

View File

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

View File

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

View File

@ -26,6 +26,9 @@ PanelListingSwitch = alt-t
PanelListingChange =
ShowHidden = alt-dot
SplitVertHoriz = alt-comma
SplitEqual = alt-equal
SplitMore = alt-shift-right
SplitLess = alt-shift-left
Shell = ctrl-o
PutCurrentPath = alt-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
setup_cmdline (void)
{

View File

@ -51,10 +51,12 @@ extern int nice_rotating_dash;
extern panels_layout_t panels_layout;
/*** declarations of public functions ************************************************************/
void layout_change (void);
void layout_box (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 setup_cmdline (void);
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:
toggle_panels_split ();
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:
panel_tree_cmd ();
break;