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();
}
* @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;
(*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;
}
/** 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;
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;
* @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 ();