diff options
author | Robin Gareus <robin@gareus.org> | 2017-03-12 01:20:14 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-03-12 01:20:14 +0100 |
commit | 3477ecb0aa454632b39e18f024e743c2946587cb (patch) | |
tree | 16001a9164dadfa8b52982d5632c14208f1c3f7e /gtk2_ardour | |
parent | 0b6e2d1e46b9dfe72fe879d2ddddafeafda07023 (diff) |
Add API to check if a given region is part of the region-selection
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/region_selection.cc | 10 | ||||
-rw-r--r-- | gtk2_ardour/region_selection.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gtk2_ardour/region_selection.cc b/gtk2_ardour/region_selection.cc index 3161b01007..cf9542cb64 100644 --- a/gtk2_ardour/region_selection.cc +++ b/gtk2_ardour/region_selection.cc @@ -87,6 +87,16 @@ bool RegionSelection::contains (RegionView* rv) const return find (begin(), end(), rv) != end(); } +bool RegionSelection::contains (boost::shared_ptr<ARDOUR::Region> region) const +{ + for (const_iterator r = begin (); r != end (); ++r) { + if ((*r)->region () == region) { + return true; + } + } + return false; +} + /** Add a region to the selection. * @param rv Region to add. * @return false if we already had the region or if it cannot be added, diff --git a/gtk2_ardour/region_selection.h b/gtk2_ardour/region_selection.h index 3bbbe8c307..e3bf60ee96 100644 --- a/gtk2_ardour/region_selection.h +++ b/gtk2_ardour/region_selection.h @@ -47,6 +47,7 @@ class RegionSelection : public std::list<RegionView*> void sort_by_position_and_track (); bool contains (RegionView*) const; + bool contains (boost::shared_ptr<ARDOUR::Region>) const; bool involves (const TimeAxisView&) const; void clear_all(); |