diff options
author | Carl Hetherington <carl@carlh.net> | 2012-05-31 17:08:08 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-05-31 17:08:08 +0000 |
commit | 6a388349c6d93e3d4eca9fcc8cd65b725a3dfa5d (patch) | |
tree | 94500e85a0da0ce43789696234dcdaa2b9e592b9 /gtk2_ardour/automation_line.cc | |
parent | 411a534c38b0aa8a56623acfa36fe528f18a2bd2 (diff) |
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
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r-- | gtk2_ardour/automation_line.cc | 19 |
1 files 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<ControlPoint*>::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<ControlPoint*>::iterator j = control_points.begin(); j != control_points.end(); ++j) { if (*j == *i) { + before = last; + vector<ControlPoint*>::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 */ |