skip LV2 ports on GUI according to port-properties: notOnGUI and reportsLatency
[ardour.git] / gtk2_ardour / automation_line.cc
index 7e34738001a50b6e39a6575b3830c9ab651287e8..7e60bff2e34ffc0c98a125780eef574dea03776b 100644 (file)
@@ -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();
                }
@@ -583,13 +590,12 @@ AutomationLine::start_drag_common (double x, float fraction)
  *  @return x position and y fraction that were actually used (once clamped).
  */
 pair<double, float>
-AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool with_push)
+AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool with_push, uint32_t& final_index)
 {
        if (_drag_points.empty()) {
                return pair<double,float> (x,fraction);
        }
 
-
        double dx = ignore_x ? 0 : (x - _drag_x);
        double dy = fraction - _last_drag_fraction;
 
@@ -663,15 +669,19 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
                        (*ccp)->move (dx, dy);
                }
                if (with_push) {
-                       uint32_t i = contiguous_points.back()->back()->view_index () + 1;
+                       final_index = contiguous_points.back()->back()->view_index () + 1;
                        ControlPoint* p;
+                       uint32_t i = final_index;
                        while ((p = nth (i)) != 0 && p->can_slide()) {
                                p->move_to (p->get_x() + dx, p->get_y(), ControlPoint::Full);
                                reset_line_coords (*p);
                                ++i;
                        }
                }
-               
+
+               /* update actual line coordinates (will queue a redraw)
+                */
+
                if (line_points.size() > 1) {
                        line->property_points() = line_points;
                }
@@ -688,7 +698,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
 
 /** Should be called to indicate the end of a drag */
 void
-AutomationLine::end_drag ()
+AutomationLine::end_drag (bool with_push, uint32_t final_index)
 {
        if (!_drag_had_movement) {
                return;
@@ -696,6 +706,16 @@ AutomationLine::end_drag ()
 
        alist->freeze ();
        sync_model_with_view_points (_drag_points);
+
+       if (with_push) {
+               ControlPoint* p;
+               uint32_t i = final_index;
+               while ((p = nth (i)) != 0 && p->can_slide()) {
+                       sync_model_with_view_point (*p);
+                       ++i;
+               }
+       }
+
        alist->thaw ();
 
        update_pending = false;
@@ -821,9 +841,7 @@ AutomationLine::remove_point (ControlPoint& cp)
  *  @param result Filled in with selectable things; in this case, ControlPoints.
  */
 void
-AutomationLine::get_selectables (
-       framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results
-       )
+AutomationLine::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results)
 {
        /* convert fractions to display coordinates with 0 at the top of the track */
        double const bot_track = (1 - topfrac) * trackview.current_height ();