From 6f8cd634501efd70711b148b4ac0e0ce2aa5cc95 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 19 Sep 2008 14:38:46 +0000 Subject: chris goddard's region list patch; port 2.X marker drag/move changes to 3.0; compilation fixes-post-evoral git-svn-id: svn://localhost/ardour2/branches/3.0@3760 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/selection.cc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'gtk2_ardour/selection.cc') diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 2f9601fcec..3f6c282d3a 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -608,6 +608,12 @@ Selection::set (boost::shared_ptr ac) add (ac); } +bool +Selection::selected (Marker* m) +{ + return find (markers.begin(), markers.end(), m) != markers.end(); +} + bool Selection::selected (TimeAxisView* tv) { @@ -801,3 +807,31 @@ Selection::add (Marker* m) MarkersChanged(); } } + +void +Selection::add (const list& m) +{ + markers.insert (markers.end(), m.begin(), m.end()); + MarkersChanged (); +} + +void +MarkerSelection::range (nframes64_t& s, nframes64_t& e) +{ + s = max_frames; + e = 0; + + for (MarkerSelection::iterator i = begin(); i != end(); ++i) { + + if ((*i)->position() < s) { + s = (*i)->position(); + } + + if ((*i)->position() > e) { + e = (*i)->position(); + } + } + + s = std::min (s, e); + e = std::max (s, e); +} -- cgit v1.2.3