use Tabbable::change_visibility to make tab/window control buttons do the right thing

This commit is contained in:
Paul Davis 2015-11-20 09:28:05 -05:00
parent 361c8421df
commit 64de2b415a
3 changed files with 22 additions and 3 deletions

View 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&);

View 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)
{

View 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,