13
0

use mid-drag key events to allow Alt to force a line break

This commit is contained in:
Paul Davis 2023-07-10 12:22:16 -06:00
parent a14c534d16
commit 67d9fa885a
2 changed files with 28 additions and 2 deletions

View File

@ -7264,6 +7264,7 @@ AutomationDrawDrag::AutomationDrawDrag (Editor* editor, ArdourCanvas::Rectangle&
, direction (0)
, edge_x (0)
, did_snap (false)
, line_break_pending (false)
{
DEBUG_TRACE (DEBUG::Drags, "New AutomationDrawDrag\n");
}
@ -7344,9 +7345,13 @@ AutomationDrawDrag::maybe_add_point (GdkEvent* ev, timepos_t const & cpos)
}
if (pop_point) {
if (line_break_pending) {
line_break_pending = false;
} else {
dragging_line->pop_back();
drawn_points.pop_back ();
}
}
if (add_point) {
if (drawn_points.empty() || (pos != drawn_points.back().when)) {
@ -7382,3 +7387,22 @@ void
AutomationDrawDrag::aborted (bool)
{
}
bool
AutomationDrawDrag::mid_drag_key_event (GdkEventKey* ev)
{
if (ev->type == GDK_KEY_PRESS) {
switch (ev->keyval) {
case GDK_Alt_R:
case GDK_Alt_L:
line_break_pending = true;
return true;
default:
break;
}
}
return false;
}

View File

@ -1592,6 +1592,7 @@ class AutomationDrawDrag : public Drag
void motion (GdkEvent*, bool);
void finished (GdkEvent*, bool);
void aborted (bool);
bool mid_drag_key_event (GdkEventKey*);
private:
ArdourCanvas::Rectangle& base_rect; /* we do not own this */
@ -1600,6 +1601,7 @@ private:
int edge_x;
Evoral::ControlList::OrderedPoints drawn_points;
bool did_snap;
bool line_break_pending;
void maybe_add_point (GdkEvent*, Temporal::timepos_t const &);
};