diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 68d4f06a9a..9f9840d66c 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -132,7 +132,7 @@ Mixer_UI::instance () } Mixer_UI::Mixer_UI () - : Tabbable (_content, _("Mixer"), X_("mixer")) + : Tabbable (_("Mixer"), X_("mixer"), &_content) , plugin_search_clear_button (X_("Clear")) , _mixer_scene_release (0) , no_track_list_redisplay (false) diff --git a/gtk2_ardour/public_editor.cc b/gtk2_ardour/public_editor.cc index 7756a8f493..7efad6055a 100644 --- a/gtk2_ardour/public_editor.cc +++ b/gtk2_ardour/public_editor.cc @@ -33,7 +33,7 @@ ARDOUR::DataType PublicEditor::pbdid_dragged_dt = ARDOUR::DataType::NIL; PublicEditor::PublicEditor (Gtk::Widget& content) : EditingContext (X_("Editor")) - , Tabbable (content, _("Editor"), X_("editor")) + , Tabbable (_("Editor"), X_("editor"), &content) { _suspend_route_redisplay_counter.store (0); } diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc index 451c093eb3..bf876031ea 100644 --- a/gtk2_ardour/rc_option_editor.cc +++ b/gtk2_ardour/rc_option_editor.cc @@ -2363,7 +2363,7 @@ MidiPortOptions::pretty_name_edit (std::string const & path, string const & new_ RCOptionEditor::RCOptionEditor () : OptionEditorContainer (Config) /* pack self-as-vbox into tabbable */ - , Tabbable (*this, _("Preferences"), X_("preferences"), /* detached by default */ false) + , Tabbable (_("Preferences"), X_("preferences"), this, /* detached by default */ false) , _rc_config (Config) , _mixer_strip_visibility ("mixer-element-visibility") , _cairo_image_surface (0) diff --git a/gtk2_ardour/recorder_ui.cc b/gtk2_ardour/recorder_ui.cc index ea3da4736b..0cd62b76f2 100644 --- a/gtk2_ardour/recorder_ui.cc +++ b/gtk2_ardour/recorder_ui.cc @@ -78,7 +78,7 @@ using namespace Menu_Helpers; #define PX_SCALE(px) std::max ((float)px, rintf ((float)px* UIConfiguration::instance ().get_ui_scale ())) RecorderUI::RecorderUI () - : Tabbable (_content, _("Recorder"), X_("recorder")) + : Tabbable (_("Recorder"), X_("recorder"), &_content) , _toolbar_sep (1.0) , _btn_rec_all (_("All")) , _btn_rec_none (_("None")) diff --git a/gtk2_ardour/trigger_page.cc b/gtk2_ardour/trigger_page.cc index f1d4c0243b..4b9fcd26b3 100644 --- a/gtk2_ardour/trigger_page.cc +++ b/gtk2_ardour/trigger_page.cc @@ -65,7 +65,7 @@ using namespace Gtk; using namespace std; TriggerPage::TriggerPage () - : Tabbable (_content, _("Cues"), X_("trigger")) + : Tabbable (_("Cues"), X_("trigger"), &_content) , _cue_area_frame (0.5, 0, 1.0, 0) , _cue_box (16, 16 * TriggerBox::default_triggers_per_box) , _master_widget (16, 16) diff --git a/libs/widgets/tabbable.cc b/libs/widgets/tabbable.cc index 634c116dd9..b687aeaf3b 100644 --- a/libs/widgets/tabbable.cc +++ b/libs/widgets/tabbable.cc @@ -37,13 +37,17 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace ArdourWidgets; -Tabbable::Tabbable (Gtk::Widget& w, const string& visible_name, string const & nontranslatable_name, bool tabbed_by_default) +Tabbable::Tabbable (const string& visible_name, string const & nontranslatable_name, Widget* w, bool tabbed_by_default) : WindowProxy (visible_name, nontranslatable_name) - , _contents (w) , _parent_notebook (0) , tab_requested_by_state (tabbed_by_default) { - default_layout (); + if (w) { + _contents = w; + } else { + _contents = &_content_vbox; + default_layout (); + } } Tabbable::~Tabbable () @@ -119,13 +123,13 @@ Tabbable::use_own_window (bool and_pack_it) Gtk::Window* win = get (true); if (and_pack_it) { - Gtk::Container* parent = _contents.get_parent(); + Gtk::Container* parent = _contents->get_parent(); if (parent) { - _contents.hide (); - parent->remove (_contents); + _contents->hide (); + parent->remove (*_contents); } - _own_notebook.append_page (_contents); - _contents.show (); + _own_notebook.append_page (*_contents); + _contents->show (); } return win; @@ -179,7 +183,7 @@ Tabbable::get (bool create) void Tabbable::show_own_window (bool and_pack_it) { - Gtk::Widget* parent = _contents.get_parent(); + Gtk::Widget* parent = _contents->get_parent(); Gtk::Allocation alloc; if (parent) { @@ -231,7 +235,7 @@ void Tabbable::change_visibility () { if (tabbed()) { - _parent_notebook->set_current_page (_parent_notebook->page_num (_contents)); + _parent_notebook->set_current_page (_parent_notebook->page_num (*_contents)); return; } @@ -299,22 +303,22 @@ Tabbable::attach () save_pos_and_size (); - _contents.hide (); - _contents.get_parent()->remove (_contents); + _contents->hide (); + _contents->get_parent()->remove (*_contents); /* leave the window around */ _window->hide (); } - _parent_notebook->append_page (_contents); - _parent_notebook->set_tab_detachable (_contents); - _parent_notebook->set_tab_reorderable (_contents); - _parent_notebook->set_current_page (_parent_notebook->page_num (_contents)); + _parent_notebook->append_page (*_contents); + _parent_notebook->set_tab_detachable (*_contents); + _parent_notebook->set_tab_reorderable (*_contents); + _parent_notebook->set_current_page (_parent_notebook->page_num (*_contents)); signal_tabbed_changed (true); - _contents.show (); + _contents->show (); /* have to force this on, which is semantically correct, since * the user has effectively asked for it. @@ -339,7 +343,7 @@ Tabbable::tabbed () const return false; } - if (_parent_notebook && (_parent_notebook->page_num (_contents) >= 0)) { + if (_parent_notebook && (_parent_notebook->page_num (*_contents) >= 0)) { return true; } @@ -350,8 +354,8 @@ void Tabbable::hide_tab () { if (tabbed()) { - _contents.hide(); - _parent_notebook->remove_page (_contents); + _contents->hide(); + _parent_notebook->remove_page (*_contents); StateChange (*this); } } @@ -360,12 +364,12 @@ void Tabbable::show_tab () { if (!window_visible() && _parent_notebook) { - if (_contents.get_parent() == 0) { + if (_contents->get_parent() == 0) { tab_requested_by_state = true; add_to_notebook (*_parent_notebook); } - _parent_notebook->set_current_page (_parent_notebook->page_num (_contents)); - _contents.show (); + _parent_notebook->set_current_page (_parent_notebook->page_num (*_contents)); + _contents->show (); current_toplevel()->present (); } } diff --git a/libs/widgets/widgets/tabbable.h b/libs/widgets/widgets/tabbable.h index 5a96d10f83..f7e0242fe4 100644 --- a/libs/widgets/widgets/tabbable.h +++ b/libs/widgets/widgets/tabbable.h @@ -48,7 +48,7 @@ namespace ArdourWidgets { class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy { public: - Tabbable (Gtk::Widget&, const std::string& user_visible_name, std::string const & untranslated_name, bool tabbed_by_default = true); + Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true); ~Tabbable (); void add_to_notebook (Gtk::Notebook& notebook); @@ -58,7 +58,7 @@ public: void attach (); void detach (); - Gtk::Widget& contents() const { return _contents; } + Gtk::Widget& contents() const { return *_contents; } /* this is where ArdourUI packs the tab switchers * (record/cues/edit/mix) into my toolbar area, @@ -127,7 +127,6 @@ protected: EventBoxExt content_att_bottom; /* a placeholder for the property box, if you want one */ /* clang-format on */ - /* visibility controls */ ArdourWidgets::ArdourButton left_attachment_button; ArdourWidgets::ArdourButton right_attachment_button; @@ -143,7 +142,7 @@ private: void window_unmapped (); Gtk::VBox _content_vbox; /* this is the root widget for a full-featured tabbable, which contains: */ - Gtk::Widget& _contents; /* for most Tabbables this will be content_vbox; but rc_options, for example, does something different. */ + Gtk::Widget* _contents; /* for most Tabbables this will be content_vbox; but rc_options, for example, does something different. */ Gtk::Notebook _own_notebook; Gtk::Notebook* _parent_notebook; bool tab_requested_by_state;