diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 1babd527b2..e67b8a93b3 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -910,12 +910,12 @@ AutomationLine::get_selectables (timepos_t const & start, timepos_t const & end, double const bot_track = (1 - topfrac) * trackview.current_height (); double const top_track = (1 - botfrac) * trackview.current_height (); - for (vector::iterator i = control_points.begin(); i != control_points.end(); ++i) { + for (auto const & cp : control_points) { - timepos_t const session_samples_when = timepos_t (session_sample_position ((*i)->model())); + const timepos_t w = session_position ((*cp->model())->when); - if (session_samples_when >= start && session_samples_when <= end && (*i)->get_y() >= bot_track && (*i)->get_y() <= top_track) { - results.push_back (*i); + if (w >= start && w <= end && cp->get_y() >= bot_track && cp->get_y() <= top_track) { + results.push_back (cp); } } } @@ -1024,6 +1024,7 @@ AutomationLine::reset_callback (const Evoral::ControlList& events) ty = _height - (ty * _height); add_visible_control_point (vp, pi, px, ty, ai, np); + vp++; } @@ -1353,24 +1354,19 @@ AutomationLine::get_point_x_range () const { pair r (timepos_t::max (the_list()->time_domain()), timepos_t::zero (the_list()->time_domain())); - for (AutomationList::const_iterator i = the_list()->begin(); i != the_list()->end(); ++i) { - r.first = min (r.first, session_position (i)); - r.second = max (r.second, session_position (i)); + for (auto const & cp : *the_list()) { + const timepos_t w (session_position (cp->when)); + r.first = min (r.first, w); + r.second = max (r.second, w); } return r; } -samplepos_t -AutomationLine::session_sample_position (AutomationList::const_iterator p) const -{ - return (*p)->when.samples() + _offset.samples() + get_origin().samples(); -} - timepos_t -AutomationLine::session_position (AutomationList::const_iterator p) const +AutomationLine::session_position (timepos_t const & when) const { - return (*p)->when + _offset + get_origin(); + return when + get_origin(); } void diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index f7664e3fb0..7e1f346202 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -161,8 +161,7 @@ public: Temporal::timepos_t offset () { return _offset; } void set_width (Temporal::timecnt_t const &); - samplepos_t session_sample_position (ARDOUR::AutomationList::const_iterator) const; - Temporal::timepos_t session_position (ARDOUR::AutomationList::const_iterator) const; + Temporal::timepos_t session_position (Temporal::timepos_t const &) const; protected: diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index 39d25a9946..df472e28e0 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -284,8 +284,8 @@ TimeInfoBox::selection_changed () } else { s = timepos_t::max (selection.points.front()->line().the_list()->time_domain()); e = timepos_t::zero (s.time_domain()); - for (PointSelection::iterator i = selection.points.begin(); i != selection.points.end(); ++i) { - timepos_t const p = (*i)->line().session_position ((*i)->model ()); + for (auto const & pt : selection.points) { + const timepos_t p = pt->line().session_position ((*pt->model ())->when); s = min (s, p); e = max (e, p); }