Add preliminary PTX support for Protools 10 and 11
[ardour.git] / gtk2_ardour / automation_line.cc
index cb59e6d571391f6873cc4da5be692f76f5bdb23a..2094d43eff171c7f894ec663d1f1a354983da059 100644 (file)
@@ -694,7 +694,6 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
        }
 
        /* clamp y */
-
        for (list<ControlPoint*>::iterator i = _drag_points.begin(); i != _drag_points.end(); ++i) {
                double const y = ((_height - (*i)->get_y()) / _height) + dy;
                if (y < 0) {
@@ -730,13 +729,13 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
                        line->set_steps (line_points, is_stepped());
                }
        }
-
+       double const result_frac = _last_drag_fraction + dy;
        _drag_distance += dx;
        _drag_x += dx;
-       _last_drag_fraction = fraction;
+       _last_drag_fraction = result_frac;
        did_push = with_push;
 
-       return pair<double, float> (_drag_x + dx, _last_drag_fraction + dy);
+       return pair<double, float> (_drag_x + dx, result_frac);
 }
 
 /** Should be called to indicate the end of a drag */
@@ -882,6 +881,7 @@ AutomationLine::remove_point (ControlPoint& cp)
        trackview.editor().begin_reversible_command (_("remove control point"));
        XMLNode &before = alist->get_state();
 
+       trackview.editor ().get_selection ().clear_points ();
        alist->erase (cp.model());
 
        trackview.editor().session()->add_command(
@@ -1226,7 +1226,7 @@ AutomationLine::model_to_view_coord_y (double& y) const
        if (   alist->parameter().type() == GainAutomation
            || alist->parameter().type() == EnvelopeAutomation
            || (_desc.logarithmic && _desc.lower == 0. && _desc.upper > _desc.lower)) {
-               y = gain_to_slider_position_with_max (y, Config->get_max_gain());
+               y = gain_to_slider_position_with_max (y, _desc.upper);
        } else if (alist->parameter().type() == TrimAutomation
                   || (_desc.logarithmic && _desc.lower * _desc.upper > 0 && _desc.upper > _desc.lower)) {
                const double lower_db = accurate_coefficient_to_dB (_desc.lower);