diff options
author | Carl Hetherington <carl@carlh.net> | 2012-04-22 14:03:07 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-04-22 14:03:07 +0000 |
commit | a4434809e147d7f091fd488d047c531ff4c344c9 (patch) | |
tree | 2ffc14ef55a0ca310b4f772bcb87d662084a752c /gtk2_ardour/automation_line.cc | |
parent | 82c867bf2a6f4de102707b812a87d68e3bd6e170 (diff) |
Use a list of ControlPoints to hold the automation selection,
rather than a time range. This makes more sense now that we
display every point on an automation line, rather than just
a subset. Makes the code a fair bit simpler, and should fix
some unexpected behaviours, especially when cutting automation
points.
git-svn-id: svn://localhost/ardour2/branches/3.0@12054 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r-- | gtk2_ardour/automation_line.cc | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 2f91c113bd..2af484b409 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -731,38 +731,6 @@ AutomationLine::get_inverted_selectables (Selection&, list<Selectable*>& /*resul // hmmm .... } -/** Take a PointSelection and find ControlPoints that fall within it */ -list<ControlPoint*> -AutomationLine::point_selection_to_control_points (PointSelection const & s) -{ - list<ControlPoint*> cp; - - for (PointSelection::const_iterator i = s.begin(); i != s.end(); ++i) { - - if (i->track != &trackview) { - continue; - } - - double const bot = (1 - i->high_fract) * trackview.current_height (); - double const top = (1 - i->low_fract) * trackview.current_height (); - - for (vector<ControlPoint*>::iterator j = control_points.begin(); j != control_points.end(); ++j) { - - 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) { - cp.push_back (*j); - } - } - } - - } - - return cp; -} - void AutomationLine::set_selected_points (PointSelection const & points) { @@ -770,11 +738,8 @@ AutomationLine::set_selected_points (PointSelection const & points) (*i)->set_selected (false); } - if (!points.empty()) { - list<ControlPoint*> cp = point_selection_to_control_points (points); - for (list<ControlPoint*>::iterator i = cp.begin(); i != cp.end(); ++i) { - (*i)->set_selected (true); - } + for (PointSelection::const_iterator i = points.begin(); i != points.end(); ++i) { + (*i)->set_selected (true); } set_colors (); @@ -1147,13 +1112,19 @@ AutomationLine::get_point_x_range () const pair<framepos_t, framepos_t> r (max_framepos, 0); for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) { - r.first = min (r.first, _time_converter->to ((*i)->when) + _offset + _time_converter->origin_b ()); - r.second = max (r.second, _time_converter->to ((*i)->when) + _offset + _time_converter->origin_b ()); + r.first = min (r.first, session_position (i)); + r.second = max (r.second, session_position (i)); } return r; } +framepos_t +AutomationLine::session_position (AutomationList::const_iterator p) const +{ + return _time_converter->to ((*p)->when) + _offset + _time_converter->origin_b (); +} + void AutomationLine::set_offset (framepos_t off) { |