add context menus for tabbable visibility buttons
This commit is contained in:
parent
a29fd4542e
commit
6d3ee152fe
@ -564,7 +564,28 @@
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<popup action="RulerMenuPopup">
|
||||
<popup action="editorTabbableButtonMenu">
|
||||
<menuitem action='show-editor'/>
|
||||
<menuitem action='hide-editor'/>
|
||||
<menuitem action='attach-editor'/>
|
||||
<menuitem action='detach-editor'/>
|
||||
</popup>
|
||||
|
||||
<popup action="mixerTabbableButtonMenu">
|
||||
<menuitem action='show-mixer'/>
|
||||
<menuitem action='hide-mixer'/>
|
||||
<menuitem action='attach-mixer'/>
|
||||
<menuitem action='detach-mixer'/>
|
||||
</popup>
|
||||
|
||||
<popup action="prefsTabbableButtonMenu">
|
||||
<menuitem action='show-preferences'/>
|
||||
<menuitem action='hide-preferences'/>
|
||||
<menuitem action='attach-preferences'/>
|
||||
<menuitem action='detach-preferences'/>
|
||||
</popup>
|
||||
|
||||
<popup action="RulerMenuPopup">
|
||||
<menuitem action="toggle-minsec-ruler"/>
|
||||
<menuitem action="toggle-timecode-ruler"/>
|
||||
<menuitem action="toggle-samples-ruler"/>
|
||||
|
@ -841,6 +841,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
|
||||
bool idle_ask_about_quit ();
|
||||
|
||||
void load_bindings ();
|
||||
bool tabbable_visibility_button_press (GdkEventButton* ev, std::string const& tabbable_name);
|
||||
};
|
||||
|
||||
#endif /* __ardour_gui_h__ */
|
||||
|
@ -577,6 +577,11 @@ ARDOUR_UI::build_menu_bar ()
|
||||
mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
|
||||
prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
|
||||
|
||||
/* catch context clicks so that we can show a menu on these buttons */
|
||||
|
||||
editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
|
||||
mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
|
||||
prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
|
||||
|
||||
editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
|
||||
editor_visibility_button.set_name (X_("page switch button"));
|
||||
@ -805,3 +810,21 @@ ARDOUR_UI::tabs()
|
||||
{
|
||||
return _tabs;
|
||||
}
|
||||
|
||||
bool
|
||||
ARDOUR_UI::tabbable_visibility_button_press (GdkEventButton* ev, string const& tabbable_name)
|
||||
{
|
||||
if (ev->button != 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* context menu is defined in *.menus.in
|
||||
*/
|
||||
|
||||
string menu_name = string ("/ui/") + tabbable_name + X_("TabbableButtonMenu");
|
||||
Gtk::Menu* menu = dynamic_cast<Gtk::Menu*> (ActionManager::get_widget (menu_name.c_str()));
|
||||
if (menu) {
|
||||
menu->popup (3, ev->time);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user