Fix list corruption when modifying a view point in y only. Should fix #3329.
authorCarl Hetherington <carl@carlh.net>
Tue, 20 Jul 2010 16:53:30 +0000 (16:53 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 20 Jul 2010 16:53:30 +0000 (16:53 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7450 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/automation_line.cc
gtk2_ardour/automation_line.h

index da76e0abd5b4fafd70418849503975bd9bd30532..71a29af3dcd278d142e8e9d8b58f3716cb39ed1b 100644 (file)
@@ -223,6 +223,7 @@ AutomationLine::modify_point_y (ControlPoint& cp, double y)
                );
 
        cp.move_to (x, y, ControlPoint::Full);
+
        reset_line_coords (cp);
 
        if (line_points.size() > 1) {
@@ -279,12 +280,13 @@ AutomationLine::model_representation (ControlPoint& cp, ModelRepresentation& mr)
                mr.xval = (*cp.model())->when;
        } else {
                mr.xval = trackview.editor().unit_to_frame (mr.xval);
+               view_to_model_coord_x (mr.xval);
        }
 
-       /* convert to model units
+       /* convert y to model units; the x was already done above
        */
 
-       view_to_model_coord (mr.xval, mr.yval);
+       view_to_model_coord_y (mr.yval);
 
        /* part 2: find out where the model point is now
         */
@@ -835,7 +837,6 @@ AutomationLine::sync_model_with_view_point (ControlPoint& cp, bool did_push, int
        update_pending = true;
        alist->modify (cp.model(), mr.xval, mr.yval);
 
-
        /* change later points */
 
        AutomationList::iterator i = cp.model();
@@ -1206,6 +1207,19 @@ AutomationLine::set_state (const XMLNode &node, int version)
 
 void
 AutomationLine::view_to_model_coord (double& x, double& y) const
+{
+       view_to_model_coord_x (x);
+       view_to_model_coord_y (y);
+}
+
+void
+AutomationLine::view_to_model_coord_x (double& x) const
+{
+       x = _time_converter.from(x);
+}
+
+void
+AutomationLine::view_to_model_coord_y (double& y) const
 {
        /* TODO: This should be more generic ... */
        if (alist->parameter().type() == GainAutomation ||
@@ -1221,8 +1235,6 @@ AutomationLine::view_to_model_coord (double& x, double& y) const
        } else {
                y = (int)(y * alist->parameter().max());
        }
-
-       x = _time_converter.from(x);
 }
 
 void
index efc25eb84b5d247bffdd3372efd62d47fe87483a..2b63cb1295db86c37ea0eb93dc8992f70c2d1423 100644 (file)
@@ -109,6 +109,8 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
        std::string fraction_to_string (double) const;
        double string_to_fraction (std::string const &) const;
        void   view_to_model_coord (double& x, double& y) const;
+       void   view_to_model_coord_x (double &) const;
+       void   view_to_model_coord_y (double &) const;
        void   model_to_view_coord (double& x, double& y) const;
 
        void set_list(boost::shared_ptr<ARDOUR::AutomationList> list);