dragging: add possibility of handling key events mid-drag
Currently only called from a canvas automation track event handler.
This commit is contained in:
parent
6453049c0a
commit
a14c534d16
@ -410,6 +410,18 @@ Editor::canvas_automation_track_event (GdkEvent *event, ArdourCanvas::Item* item
|
||||
ret = leave_handler (item, event, AutomationTrackItem);
|
||||
break;
|
||||
|
||||
case GDK_KEY_PRESS:
|
||||
if (_drags->active()) {
|
||||
return _drags->mid_drag_key_event (&event->key);
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_KEY_RELEASE:
|
||||
if (_drags->active()) {
|
||||
return _drags->mid_drag_key_event (&event->key);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -157,6 +157,21 @@ DragManager::preview_video () const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
DragManager::mid_drag_key_event (GdkEventKey* ev)
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
for (auto & drag : _drags) {
|
||||
if (drag->mid_drag_key_event (ev)) {
|
||||
handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void
|
||||
DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c)
|
||||
{
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
~DragManager ();
|
||||
|
||||
bool motion_handler (GdkEvent *, bool);
|
||||
|
||||
bool mid_drag_key_event (GdkEventKey*);
|
||||
void abort ();
|
||||
void add (Drag *);
|
||||
void set (Drag *, GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
|
||||
@ -238,6 +238,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool mid_drag_key_event (GdkEventKey*) { return false; }
|
||||
|
||||
bool initially_vertical() const {
|
||||
return _initially_vertical;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user