From 9a6532def285e08e7de5ce8f44115c9278f918e5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 2 Jan 2010 01:32:14 +0000 Subject: [PATCH] Stop automation drags when they hit their lowest point, so as to prevent automation curves being lost by dragging things too far downwards. git-svn-id: svn://localhost/ardour2/branches/3.0@6434 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 0c568ee55a..ac50ac44db 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -767,10 +767,17 @@ AutomationLine::drag_motion (nframes_t x, float fraction, bool with_push) drag_distance += dx; drag_x = x; - double const dy = fraction - _last_drag_fraction; - + double dy = fraction - _last_drag_fraction; _last_drag_fraction = fraction; + /* clamp y so that the "lowest" point hits the bottom but goes no further */ + for (list::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) { + double const y = ((_height - (*i)->get_y()) / _height) + dy; + if (y < 0) { + dy -= y; + } + } + for (list::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) { modify_view_point (