diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index bb6b03ed80..cda8efb8f1 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -38,6 +38,7 @@ #include "editing_context.h" #include "editing_convert.h" #include "editor_drag.h" +#include "gui_thread.h" #include "keyboard.h" #include "midi_region_view.h" #include "note_base.h" @@ -154,6 +155,10 @@ EditingContext::EditingContext (std::string const & name) _cursors->set_cursor_set (UIConfiguration::instance().get_icon_set()); std::cerr << "Set cursor set to " << UIConfiguration::instance().get_icon_set() << std::endl; } + + /* handle escape */ + + ARDOUR_UI::instance()->Escape.connect (escape_connection, MISSING_INVALIDATOR, boost::bind (&EditingContext::escape, this), gui_context()); } EditingContext::~EditingContext() diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 1d700f8f2b..6fd199e888 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -624,6 +624,9 @@ public: uint32_t autoscroll_cnt; ArdourCanvas::Rect autoscroll_boundary; + PBD::ScopedConnection escape_connection; + virtual void escape () {} + private: static std::stack ec_stack; diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index 55b380365e..7c72305c5d 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -1418,3 +1418,13 @@ MidiCueEditor::midi_action (void (MidiView::*method)()) (view->*method) (); } + +void +MidiCueEditor::escape () +{ + if (!view) { + return; + } + + view->clear_note_selection (); +} diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index d04093576e..593e074327 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -122,6 +122,8 @@ class MidiCueEditor : public CueEditor void mouse_mode_toggled (Editing::MouseMode); + void escape (); + private: ArdourCanvas::GtkCanvasViewport* _canvas_viewport; ArdourCanvas::GtkCanvas* _canvas;