use Tabbable::change_visibility to make tab/window control buttons do the right thing
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 20 Nov 2015 14:28:05 +0000 (09:28 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:25 +0000 (15:31 -0500)
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc

index 730594d09b18c31262b643b694aa8a71ad8d6f38..2636bc015df083edadb8e7c75ae8e9d558b5cf51 100644 (file)
@@ -376,6 +376,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void hide_tabbable (Gtkmm2ext::Tabbable*);
        void detach_tabbable (Gtkmm2ext::Tabbable*);
        void attach_tabbable (Gtkmm2ext::Tabbable*);
+       void change_tabbable_visibility (Gtkmm2ext::Tabbable*);
 
        void tabbable_state_change (Gtkmm2ext::Tabbable&);
 
index bb7140bf740bfd4380e4a50ff57558c66295738b..869bda877b1498851010cbf2a5244c8b62904e5a 100644 (file)
@@ -328,6 +328,16 @@ ARDOUR_UI::unload_session (bool hide_stuff)
        return 0;
 }
 
+void
+ARDOUR_UI::change_tabbable_visibility (Tabbable* t)
+{
+       if (!t) {
+               return;
+       }
+
+       t->change_visibility();
+}
+
 void
 ARDOUR_UI::show_tabbable (Tabbable* t)
 {
index 14891eee4cdaeb12ec7d3ccbea5dd44d02153329..da88fab6b19f268cc749bc470ffbdb48ec6007f9 100644 (file)
@@ -238,6 +238,14 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
        global_actions.register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
 
+       /* These "change" actions are not intended to be used inside menus, but
+          are for the tab/window control buttons, which have somewhat odd
+          semantics.
+       */
+       global_actions.register_action (common_actions, X_("change-editor-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::change_tabbable_visibility), editor));
+       global_actions.register_action (common_actions, X_("change-mixer-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::change_tabbable_visibility), mixer));
+       global_actions.register_action (common_actions, X_("change-preferences-visibility"), _("Change"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::change_tabbable_visibility), rc_option_editor));
+
        /* windows visibility actions */
 
        global_actions.register_toggle_action (common_actions, X_("ToggleMaximalEditor"), _("Maximise Editor Space"), sigc::mem_fun (*this, &ARDOUR_UI::toggle_editing_space));
@@ -560,11 +568,11 @@ ARDOUR_UI::build_menu_bar ()
        prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
 
 
-       editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("show-editor")));
+       editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
        editor_visibility_button.set_name (X_("page switch button"));
-       mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("show-mixer")));
+       mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
        mixer_visibility_button.set_name (X_("page switch button"));
-       prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("show-preferences")));
+       prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
        prefs_visibility_button.set_name (X_("page switch button"));
 
        Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,