13
0

make Escape (cancel drag or selection) work in mixer as well as editor

This commit is contained in:
Paul Davis 2016-05-21 08:34:09 -04:00
parent 791d0196d6
commit 4cd6d52013
8 changed files with 35 additions and 4 deletions

View File

@ -269,7 +269,9 @@ This mode provides many different operations on both regions and control points,
@edit|Editor/editor-delete|Delete|delete
@edit|Editor/alternate-editor-delete|BackSpace|backspace (delete)
@select|Editor/escape|Escape|break drag or deselect all
;; this one is super-global, so we put it in the session group but don't show
;; it on cheat sheets etc.
@-sess|Main/Escape|Escape|break drag or deselect all
;; keypad

View File

@ -202,6 +202,12 @@ public:
static ARDOUR_UI *instance () { return theArdourUI; }
/* signal emitted when escape key is pressed. All UI components that
need to respond to Escape in some way (e.g. break drag, clear
selection, etc) should connect to and handle this.
*/
PBD::Signal0<void> Escape;
PublicEditor& the_editor() { return *editor;}
Mixer_UI* the_mixer() { return mixer; }
@ -877,6 +883,8 @@ private:
void step_up_through_tabs ();
void step_down_through_tabs ();
void escape ();
};
#endif /* __ardour_gui_h__ */

View File

@ -108,6 +108,12 @@ ARDOUR_UI::create_luawindow ()
return 0;
}
void
ARDOUR_UI::escape ()
{
Escape (); /* EMIT SIGNAL */
}
void
ARDOUR_UI::install_actions ()
{
@ -115,6 +121,8 @@ ARDOUR_UI::install_actions ()
Glib::RefPtr<ActionGroup> main_menu_actions = global_actions.create_action_group (X_("Main_menu"));
Glib::RefPtr<Action> act;
global_actions.register_action (main_actions, X_("Escape"), _("Escape"), sigc::mem_fun (*this, &ARDOUR_UI::escape));
/* menus + submenus that need action items */
global_actions.register_action (main_menu_actions, X_("Session"), _("Session"));

View File

@ -804,6 +804,10 @@ Editor::Editor ()
BasicUI::AccessAction.connect (*this, invalidator (*this), boost::bind (&Editor::access_action, this, _1, _2), gui_context());
/* handle escape */
ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Editor::escape, this), gui_context());
/* problematic: has to return a value and thus cannot be x-thread */
Session::AskAboutPlaylistDeletion.connect_same_thread (*this, boost::bind (&Editor::playlist_deletion_dialog, this, _1));

View File

@ -153,8 +153,6 @@ Editor::register_actions ()
/* add named actions for the editor */
myactions.register_action (editor_actions, "escape", _("Break drag or deselect all"), sigc::mem_fun (*this, &Editor::escape));
/* We don't bother registering "unlock" because it would be insensitive
when required. Editor::unlock() must be invoked directly.
*/

View File

@ -17,6 +17,5 @@
<Binding key="Return" action="Mixer/toggle-processors"/>
<Binding key="Primary-a" action="Mixer/select-all-processors"/>
<Binding key="slash" action="Mixer/ab-plugins"/>
<Binding key="Escape" action="Mixer/select-none"/>
</Press>
</Bindings>

View File

@ -308,6 +308,10 @@ Mixer_UI::Mixer_UI ()
MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context());
/* handle escape */
ARDOUR_UI::instance()->Escape.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::escape, this), gui_context());
#ifndef DEFER_PLUGIN_SELECTOR_LOAD
_plugin_selector = new PluginSelector (PluginManager::instance ());
#else
@ -327,6 +331,12 @@ Mixer_UI::~Mixer_UI ()
delete _plugin_selector;
}
void
Mixer_UI::escape ()
{
select_none ();
}
void
Mixer_UI::track_editor_selection ()
{

View File

@ -374,6 +374,8 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p
bool _show_mixer_list;
mutable boost::weak_ptr<ARDOUR::VCA> spilled_vca;
void escape ();
};
#endif /* __ardour_mixer_ui_h__ */