summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-05-21 08:34:09 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:44 -0400
commit4cd6d52013dc60d65c2872d9d6e87e83e85cff95 (patch)
tree4319de89570908563ac16f6479205bd671722dd6 /gtk2_ardour
parent791d0196d66c6309b0be5006ea719cfc527989d4 (diff)
make Escape (cancel drag or selection) work in mixer as well as editor
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour.keys.in4
-rw-r--r--gtk2_ardour/ardour_ui.h8
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc8
-rw-r--r--gtk2_ardour/editor.cc4
-rw-r--r--gtk2_ardour/editor_actions.cc2
-rw-r--r--gtk2_ardour/mixer.bindings1
-rw-r--r--gtk2_ardour/mixer_ui.cc10
-rw-r--r--gtk2_ardour/mixer_ui.h2
8 files changed, 35 insertions, 4 deletions
diff --git a/gtk2_ardour/ardour.keys.in b/gtk2_ardour/ardour.keys.in
index a5490ad321..98ae64418a 100644
--- a/gtk2_ardour/ardour.keys.in
+++ b/gtk2_ardour/ardour.keys.in
@@ -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
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 53abcd0f17..93dc47ff12 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -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__ */
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 08529bbe0e..de014b0d34 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -109,12 +109,20 @@ ARDOUR_UI::create_luawindow ()
}
void
+ARDOUR_UI::escape ()
+{
+ Escape (); /* EMIT SIGNAL */
+}
+
+void
ARDOUR_UI::install_actions ()
{
Glib::RefPtr<ActionGroup> main_actions = global_actions.create_action_group (X_("Main"));
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"));
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 5775dfaf83..6d54f5ca1a 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -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));
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index ed928067dc..3924ad25f8 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -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.
*/
diff --git a/gtk2_ardour/mixer.bindings b/gtk2_ardour/mixer.bindings
index 2189715026..f835655b0a 100644
--- a/gtk2_ardour/mixer.bindings
+++ b/gtk2_ardour/mixer.bindings
@@ -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>
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 249f34f8ad..a3838707ce 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -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
@@ -328,6 +332,12 @@ Mixer_UI::~Mixer_UI ()
}
void
+Mixer_UI::escape ()
+{
+ select_none ();
+}
+
+void
Mixer_UI::track_editor_selection ()
{
PublicEditor::instance().get_selection().TracksChanged.connect (sigc::mem_fun (*this, &Mixer_UI::follow_editor_selection));
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index 544578c091..ecb7b01912 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -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__ */