Flexible Layout, resizable bottom pane.

This commit is contained in:
Robin Gareus 2024-11-16 19:30:04 +01:00
parent 438a514c2b
commit 983466fc38
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 43 additions and 16 deletions

View File

@ -80,7 +80,7 @@ Tabbable::default_layout ()
left_attachment_button.set_sensitive (0 != (_panelayout & (PaneLeft | AttLeft)));
right_attachment_button.set_sensitive (0 != (_panelayout & PaneRight));
bottom_attachment_button.set_sensitive (0 != (_panelayout & AttBottom));
bottom_attachment_button.set_sensitive (0 != (_panelayout & (PaneBottom | AttBottom)));
content_attachment_hbox.set_border_width(3);
content_attachment_hbox.set_spacing(3);
@ -101,18 +101,25 @@ Tabbable::default_layout ()
_content_vbox.pack_start (*toolbar_frame, false, false);
Widget* midlevel = 0 == (_panelayout & PaneBottom) ? (Widget*)&content_midlevel_vbox : (Widget*)&content_midlevel_vpane;
if (_panelayout & PaneLeft) {
_content_vbox.pack_start (content_left_pane, true, true);
content_left_pane.add (content_att_left);
content_left_pane.add (content_midlevel_vbox);
content_left_pane.add (*midlevel);
} else {
_content_vbox.pack_start (content_hbox, true, true);
content_hbox.pack_start (content_att_left, false, false);
content_hbox.pack_start (content_midlevel_vbox, true, true);
content_hbox.pack_start (*midlevel, true, true);
}
content_midlevel_vbox.pack_start (content_right_pane, true, true);
content_midlevel_vbox.pack_start (content_att_bottom, false, false);
if (_panelayout & PaneBottom) {
content_midlevel_vpane.add (content_right_pane);
content_midlevel_vpane.add (content_att_bottom);
} else {
content_midlevel_vbox.pack_start (content_right_pane, true, true);
content_midlevel_vbox.pack_start (content_att_bottom, false, false);
}
content_right_pane.add (content_inner_vbox);
@ -136,6 +143,12 @@ Tabbable::default_layout ()
content_left_pane.set_check_divider_position (true);
content_left_pane.set_divider (0, 0.15);
if (_panelayout & PaneBottom) {
content_midlevel_vpane.set_child_minsize (content_right_pane, 300);
}
content_midlevel_vpane.set_check_divider_position (true);
content_midlevel_vpane.set_divider (0, 0.85);
_content_vbox.show_all();
}
@ -428,8 +441,15 @@ Tabbable::get_state() const
node.set_property (X_("tabbed"), tabbed());
node.set_property (string_compose("%1%2", _menu_name, X_("-rightpane-pos")).c_str(), content_right_pane.get_divider ());
node.set_property (string_compose("%1%2", _menu_name, X_("-leftpane-pos")).c_str(), content_left_pane.get_divider ());
if (_panelayout & PaneRight) {
node.set_property (string_compose("%1%2", _menu_name, X_("-rightpane-pos")).c_str(), content_right_pane.get_divider ());
}
if (_panelayout & PaneLeft) {
node.set_property (string_compose("%1%2", _menu_name, X_("-leftpane-pos")).c_str(), content_left_pane.get_divider ());
}
if (_panelayout & PaneBottom) {
node.set_property (string_compose("%1%2", _menu_name, X_("-bottompane-pos")).c_str(), content_midlevel_vpane.get_divider ());
}
return node;
}
@ -461,6 +481,10 @@ Tabbable::set_state (const XMLNode& node, int version)
fract = std::max (.05f, std::min (.95f, fract));
content_left_pane.set_divider (0, fract);
}
if ( window_node->get_property (string_compose("%1%2", _menu_name, X_("-bottompane-pos")).c_str(), fract) ) {
fract = std::max (.05f, std::min (.95f, fract));
content_midlevel_vpane.set_divider (0, fract);
}
}

View File

@ -49,13 +49,14 @@ class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
{
public:
enum PaneLayout {
NoPanes = 0x0, ///< disable all attachment buttons, do not pack any panes or attachments
PaneLeft = 0x1, ///< left side attachment is a resizable pane
PaneRight = 0x2, ///< pack a resizable Pane on the right-side
AttBottom = 0x4, ///< bottom is a fixed size EBox attachment
PaneLeftBtm = 0x5,
PaneRightBtm = 0x6,
AttLeft = 0x8, ///< if PaneLeft is not set, pack a fixed size Ebox on the left (Editor-Mixer)
NoPanes = 0x00, ///< disable all attachment buttons, do not pack any panes or attachments
PaneLeft = 0x01, ///< left side attachment is a resizable pane
PaneRight = 0x02, ///< pack a resizable Pane on the right-side
PaneBottom = 0x04, ///< bottom Ebox is a resizable Pane
AttLeft = 0x08, ///< if PaneLeft is not set, pack a fixed size Ebox on the left (Editor-Mixer)
AttBottom = 0x10, ///< bottom is a fixed size EBox attachment
PaneLeftBtm = 0x11,
PaneRightBtm = 0x12,
};
Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true, PaneLayout pl = PaneRightBtm);
@ -130,7 +131,7 @@ protected:
* | |
* | +--content_hbox--OR--content_left_pane--------------------------------------------------------+ |
* | | | |
* | | +--att_left--+ +--content_midlevel_vbox-------------------------------------------------+ | |
* | | +--att_left--+ +--content_midlevel_vbox--OR-content_midlevel_vpane----------------------+ | |
* | | $ (EBOX) | | +--content_right_pane------------------------------------------------+ | | |
* | | | | | | +--content_inner_vbox-----------------+ +--content_right_vbox--+ | | | |
* | | | O | | | | | | | | | | |
@ -147,7 +148,8 @@ protected:
* | | | | N | | | +---------------------------------+ | | +------------------+ | | | | |
* | | | (STRIP) | E | | +-------------------------------------+ +----------------------+ | | | |
* | | | |<->| +--------------------------------------------------------------------+ | | |
* | | | | | | | |
* | | | | | 🡅 OPTIONAL 🡅 | | |
* | | | | | 🡇 PANE 🡇 | | |
* | | | | | +-content_att_bottom-------------------------------------------------+ | | |
* | | | | | $ (EBOX) | | | |
* | | | | | | OPTIONAL BOTTOM (PROPERTIES) | | | |
@ -171,6 +173,7 @@ protected:
HPane content_left_pane;
Gtk::HBox content_hbox;
EventBoxExt content_att_left; /* a placeholder for the mixer strip, if you want one */
VPane content_midlevel_vpane;
Gtk::VBox content_midlevel_vbox;
HPane content_right_pane;
Gtk::VBox content_inner_vbox;