13
0

handle Escape signal in all EditingContexts (including MidiCueEditor)

This commit is contained in:
Paul Davis 2024-06-07 10:05:25 -06:00
parent f2e1697058
commit dc44d10b48
4 changed files with 20 additions and 0 deletions

View File

@ -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()

View File

@ -624,6 +624,9 @@ public:
uint32_t autoscroll_cnt;
ArdourCanvas::Rect autoscroll_boundary;
PBD::ScopedConnection escape_connection;
virtual void escape () {}
private:
static std::stack<EditingContext*> ec_stack;

View File

@ -1418,3 +1418,13 @@ MidiCueEditor::midi_action (void (MidiView::*method)())
(view->*method) ();
}
void
MidiCueEditor::escape ()
{
if (!view) {
return;
}
view->clear_note_selection ();
}

View File

@ -122,6 +122,8 @@ class MidiCueEditor : public CueEditor
void mouse_mode_toggled (Editing::MouseMode);
void escape ();
private:
ArdourCanvas::GtkCanvasViewport* _canvas_viewport;
ArdourCanvas::GtkCanvas* _canvas;