13
0

Fix list corruption when modifying a view point in y only. Should fix #3329.

git-svn-id: svn://localhost/ardour2/branches/3.0@7450 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-07-20 16:53:30 +00:00
parent bf91ed99ec
commit 2aaec8beeb
2 changed files with 19 additions and 5 deletions

View 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

View 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);