From bc8ccfa768451ce3d37a31df3b4f7a6c26c4708a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 7 Jan 2013 20:10:18 +0000 Subject: [PATCH] fix drags of a single control point in a line where that is the only control point git-svn-id: svn://localhost/ardour2/branches/3.0@13802 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 63b9740c00..7e60bff2e3 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -507,15 +507,22 @@ AutomationLine::ContiguousControlPoints::ContiguousControlPoints (AutomationLine void AutomationLine::ContiguousControlPoints::compute_x_bounds () { - if (!empty()) { + uint32_t sz = size(); + + if (sz > 0 && sz < line.npoints()) { + /* determine the limits on x-axis motion for this contiguous range of control points */ - + if (front()->view_index() > 0) { before_x = line.nth (front()->view_index() - 1)->get_x(); } - + + /* if our last point has a point after it in the line, + we have an "after" bound + */ + if (back()->view_index() < (line.npoints() - 2)) { after_x = line.nth (back()->view_index() + 1)->get_x(); } @@ -674,8 +681,10 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool /* update actual line coordinates (will queue a redraw) */ - - line->property_points() = line_points; + + if (line_points.size() > 1) { + line->property_points() = line_points; + } } _drag_distance += dx;