From 6a388349c6d93e3d4eca9fcc8cd65b725a3dfa5d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 31 May 2012 17:08:08 +0000 Subject: [PATCH] Allow movement of several vertically-colinear points at the same time. git-svn-id: svn://localhost/ardour2/branches/3.0@12506 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 7e8d70b8c8..9840a5adae 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -478,7 +478,9 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool double dy = fraction - _last_drag_fraction; for (list::iterator i = points.begin(); i != points.end(); ++i) { - /* Find the points before and after this one on the control_points list */ + /* Find the points that aren't being moved before and after + this one on the control_points list + */ ControlPoint* before = 0; ControlPoint* after = 0; @@ -487,16 +489,29 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool for (vector::iterator j = control_points.begin(); j != control_points.end(); ++j) { if (*j == *i) { + before = last; + vector::iterator k = j; + + /* Next point */ ++k; + + /* Now move past any points that are being moved this time */ + while (find (points.begin(), points.end(), *k) != points.end() && k != control_points.end ()) { + ++k; + } + if (k != control_points.end()) { after = *k; } break; } - last = *j; + if (find (points.begin(), points.end(), *j) == points.end ()) { + /* This point isn't being moved, so it's the `last' point we've seen */ + last = *j; + } } /* Clamp dx for this point */