Tweak Tabbable Layout
* allow for left side resizable pane * automatically set attachment button sensitivity * remove right-side pane box when unused
This commit is contained in:
parent
6f331be7ca
commit
5c8bd6e977
@ -37,10 +37,11 @@ using namespace Gtk;
|
|||||||
using namespace Gtkmm2ext;
|
using namespace Gtkmm2ext;
|
||||||
using namespace ArdourWidgets;
|
using namespace ArdourWidgets;
|
||||||
|
|
||||||
Tabbable::Tabbable (const string& visible_name, string const & nontranslatable_name, Widget* w, bool tabbed_by_default)
|
Tabbable::Tabbable (const string& visible_name, string const & nontranslatable_name, Widget* w, bool tabbed_by_default, PaneLayout pl)
|
||||||
: WindowProxy (visible_name, nontranslatable_name)
|
: WindowProxy (visible_name, nontranslatable_name)
|
||||||
, _parent_notebook (0)
|
, _parent_notebook (0)
|
||||||
, tab_requested_by_state (tabbed_by_default)
|
, tab_requested_by_state (tabbed_by_default)
|
||||||
|
, _panelayout (pl)
|
||||||
{
|
{
|
||||||
if (w) {
|
if (w) {
|
||||||
_contents = w;
|
_contents = w;
|
||||||
@ -77,6 +78,10 @@ Tabbable::default_layout ()
|
|||||||
right_attachment_button.set_tweaks (ArdourButton::ExpandtoSquare);
|
right_attachment_button.set_tweaks (ArdourButton::ExpandtoSquare);
|
||||||
bottom_attachment_button.set_tweaks (ArdourButton::ExpandtoSquare);
|
bottom_attachment_button.set_tweaks (ArdourButton::ExpandtoSquare);
|
||||||
|
|
||||||
|
left_attachment_button.set_sensitive (0 != (_panelayout & (PaneLeft | AttLeft))); // Editor Mixer
|
||||||
|
right_attachment_button.set_sensitive (0 != (_panelayout & PaneRight));
|
||||||
|
bottom_attachment_button.set_sensitive (0 != (_panelayout & PaneBottom));
|
||||||
|
|
||||||
content_attachment_hbox.set_border_width(3);
|
content_attachment_hbox.set_border_width(3);
|
||||||
content_attachment_hbox.set_spacing(3);
|
content_attachment_hbox.set_spacing(3);
|
||||||
content_attachment_hbox.pack_end (right_attachment_button, false, false);
|
content_attachment_hbox.pack_end (right_attachment_button, false, false);
|
||||||
@ -95,27 +100,42 @@ Tabbable::default_layout ()
|
|||||||
toolbar_frame->add (content_header_hbox);
|
toolbar_frame->add (content_header_hbox);
|
||||||
|
|
||||||
_content_vbox.pack_start (*toolbar_frame, false, false);
|
_content_vbox.pack_start (*toolbar_frame, false, false);
|
||||||
_content_vbox.pack_start (content_hbox, true, true);
|
|
||||||
|
|
||||||
content_hbox.pack_start (content_att_left, false, false);
|
if (_panelayout & PaneLeft) {
|
||||||
content_hbox.pack_start (content_midlevel_vbox, true, true);
|
_content_vbox.pack_start (content_left_pane, true, true);
|
||||||
|
content_left_pane.add (content_att_left);
|
||||||
|
content_left_pane.add (content_midlevel_vbox);
|
||||||
|
} 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_midlevel_vbox.pack_start (content_right_pane, true, true);
|
content_midlevel_vbox.pack_start (content_right_pane, true, true);
|
||||||
content_midlevel_vbox.pack_start (content_att_bottom, false, false);
|
content_midlevel_vbox.pack_start (content_att_bottom, false, false);
|
||||||
|
|
||||||
content_right_pane.add (content_inner_vbox);
|
content_right_pane.add (content_inner_vbox);
|
||||||
content_right_pane.add (content_right_vbox);
|
|
||||||
|
|
||||||
//TODO: menu switcher here?
|
if (_panelayout & PaneRight) {
|
||||||
content_right_vbox.pack_start (content_att_right, true, true);
|
content_right_pane.add (content_right_vbox);
|
||||||
|
content_right_vbox.pack_start (content_att_right, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
content_inner_vbox.pack_start (content_toolbar, false, false);
|
content_inner_vbox.pack_start (content_toolbar, false, false);
|
||||||
content_inner_vbox.pack_start (content_innermost_hbox, true, true);
|
content_inner_vbox.pack_start (content_innermost_hbox, true, true);
|
||||||
|
|
||||||
content_right_pane.set_child_minsize (content_att_right, 160); /* rough guess at width of notebook tabs */
|
if (_panelayout & PaneRight) {
|
||||||
|
content_right_pane.set_child_minsize (content_att_right, 160); /* rough guess at width of notebook tabs */
|
||||||
|
}
|
||||||
content_right_pane.set_check_divider_position (true);
|
content_right_pane.set_check_divider_position (true);
|
||||||
content_right_pane.set_divider (0, 0.85);
|
content_right_pane.set_divider (0, 0.85);
|
||||||
|
|
||||||
|
if (_panelayout & PaneLeft) {
|
||||||
|
content_left_pane.set_child_minsize (content_att_left, 80);
|
||||||
|
}
|
||||||
|
content_left_pane.set_check_divider_position (true);
|
||||||
|
content_left_pane.set_divider (0, 0.15);
|
||||||
|
|
||||||
_content_vbox.show_all();
|
_content_vbox.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,7 +428,8 @@ Tabbable::get_state() const
|
|||||||
|
|
||||||
node.set_property (X_("tabbed"), tabbed());
|
node.set_property (X_("tabbed"), tabbed());
|
||||||
|
|
||||||
node.set_property (string_compose("%1%2", _menu_name, X_("-listpane-pos")).c_str(), content_right_pane.get_divider ());
|
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 ());
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -432,10 +453,14 @@ Tabbable::set_state (const XMLNode& node, int version)
|
|||||||
if (window_node) {
|
if (window_node) {
|
||||||
window_node->get_property (X_("tabbed"), tab_requested_by_state);
|
window_node->get_property (X_("tabbed"), tab_requested_by_state);
|
||||||
float fract;
|
float fract;
|
||||||
if ( window_node->get_property (string_compose("%1%2", _menu_name, X_("-listpane-pos")).c_str(), fract) ) {
|
if ( window_node->get_property (string_compose("%1%2", _menu_name, X_("-rightpane-pos")).c_str(), fract) ) {
|
||||||
fract = std::max (.05f, std::min (.95f, fract));
|
fract = std::max (.05f, std::min (.95f, fract));
|
||||||
content_right_pane.set_divider (0, fract);
|
content_right_pane.set_divider (0, fract);
|
||||||
}
|
}
|
||||||
|
if ( window_node->get_property (string_compose("%1%2", _menu_name, X_("-leftpane-pos")).c_str(), fract) ) {
|
||||||
|
fract = std::max (.05f, std::min (.95f, fract));
|
||||||
|
content_left_pane.set_divider (0, fract);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,17 @@ namespace ArdourWidgets {
|
|||||||
class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
|
class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true);
|
enum PaneLayout {
|
||||||
|
NoPanes = 0x0,
|
||||||
|
PaneLeft = 0x1,
|
||||||
|
PaneRight = 0x2,
|
||||||
|
PaneBottom = 0x4,
|
||||||
|
PaneLeftBtm = 0x5,
|
||||||
|
PaneRightBtm = 0x6,
|
||||||
|
AttLeft = 0x8,
|
||||||
|
};
|
||||||
|
|
||||||
|
Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true, PaneLayout pl = PaneRightBtm);
|
||||||
~Tabbable ();
|
~Tabbable ();
|
||||||
|
|
||||||
void add_to_notebook (Gtk::Notebook& notebook);
|
void add_to_notebook (Gtk::Notebook& notebook);
|
||||||
@ -113,6 +123,7 @@ protected:
|
|||||||
Gtk::EventBox content_attachments; /* a placeholder the (strip, list, props) visibility buttons for this tab */
|
Gtk::EventBox content_attachments; /* a placeholder the (strip, list, props) visibility buttons for this tab */
|
||||||
Gtk::HBox content_attachment_hbox;
|
Gtk::HBox content_attachment_hbox;
|
||||||
EventBoxExt content_tabbables; /* a placeholder for the tabbable switching buttons (used by ArdourUI) */
|
EventBoxExt content_tabbables; /* a placeholder for the tabbable switching buttons (used by ArdourUI) */
|
||||||
|
HPane content_left_pane;
|
||||||
Gtk::HBox content_hbox;
|
Gtk::HBox content_hbox;
|
||||||
EventBoxExt content_att_left; /* a placeholder for the mixer strip, if you want one */
|
EventBoxExt content_att_left; /* a placeholder for the mixer strip, if you want one */
|
||||||
Gtk::VBox content_midlevel_vbox;
|
Gtk::VBox content_midlevel_vbox;
|
||||||
@ -144,6 +155,7 @@ private:
|
|||||||
Gtk::Notebook _own_notebook;
|
Gtk::Notebook _own_notebook;
|
||||||
Gtk::Notebook* _parent_notebook;
|
Gtk::Notebook* _parent_notebook;
|
||||||
bool tab_requested_by_state;
|
bool tab_requested_by_state;
|
||||||
|
PaneLayout _panelayout;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user