From 1468931f1a68a4f55f46a532c49eb1bd06d41874 Mon Sep 17 00:00:00 2001 From: carlh Date: Wed, 13 Jul 2011 19:24:46 +0000 Subject: [PATCH] Fix crash when selecting automation points in MIDI regions with non-zero starts (#4177) and also fix problems with selection conversions between ControlPoints and PointSelection in similar regions. git-svn-id: http://subversion.ardour.org/svn/ardour2/ardour2/branches/3.0@9866 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_line.cc | 8 ++++---- gtk2_ardour/automation_line.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 979b96962..5e5d51125 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -973,7 +973,7 @@ AutomationLine::get_selectables ( for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { double const model_when = (*(*i)->model())->when; - framepos_t const session_frames_when = _time_converter.to (model_when - _offset) + _time_converter.origin_b (); + framepos_t const session_frames_when = _time_converter.to (model_when) + _time_converter.origin_b () - _offset; if (session_frames_when >= start && session_frames_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) { results.push_back (*i); @@ -1004,8 +1004,8 @@ AutomationLine::point_selection_to_control_points (PointSelection const & s) for (vector::iterator j = control_points.begin(); j != control_points.end(); ++j) { - double const rstart = trackview.editor().frame_to_unit (_time_converter.to (i->start)); - double const rend = trackview.editor().frame_to_unit (_time_converter.to (i->end)); + double const rstart = trackview.editor().frame_to_unit (_time_converter.to (i->start) - _offset); + double const rend = trackview.editor().frame_to_unit (_time_converter.to (i->end) - _offset); if ((*j)->get_x() >= rstart && (*j)->get_x() <= rend) { if ((*j)->get_y() >= bot && (*j)->get_y() <= top) { @@ -1020,7 +1020,7 @@ AutomationLine::point_selection_to_control_points (PointSelection const & s) } void -AutomationLine::set_selected_points (PointSelection& points) +AutomationLine::set_selected_points (PointSelection const & points) { for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { (*i)->set_selected (false); diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 095fa14c3..5ac63fad8 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -67,7 +67,7 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible void clear (); std::list point_selection_to_control_points (PointSelection const &); - void set_selected_points (PointSelection&); + void set_selected_points (PointSelection const &); void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list&); void get_inverted_selectables (Selection&, std::list& results); -- 2.11.4.GIT