diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-04 22:46:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-01-04 22:46:51 +0000 |
commit | 72393f101ba2cae980838dd0d857719719ecc3d7 (patch) | |
tree | a54069a53df9879b75bfd6ae3455fd60cc1a1d30 /libs | |
parent | 1f6684237c1711858c4853016131a70a6ef0edf9 (diff) |
allow region list selection of whole file regions to select every instance of a region that has any source relationship with that whole file region (from a logic feature that came up while writing the manual)
git-svn-id: svn://localhost/ardour2/branches/3.0@13779 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/playlist.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/region.h | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 11 | ||||
-rw-r--r-- | libs/ardour/region.cc | 19 |
4 files changed, 32 insertions, 0 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h index f3277c6b9c..754e48cc25 100644 --- a/libs/ardour/ardour/playlist.h +++ b/libs/ardour/ardour/playlist.h @@ -132,6 +132,7 @@ public: void remove_region_by_source (boost::shared_ptr<Source>); void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); + void get_source_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&); void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, framepos_t pos); void split_region (boost::shared_ptr<Region>, framepos_t position); void split (framepos_t at); diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 85cdce6e92..bc8e7383f2 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -200,6 +200,7 @@ class Region bool overlap_equivalent (boost::shared_ptr<const Region>) const; bool region_list_equivalent (boost::shared_ptr<const Region>) const; bool source_equivalent (boost::shared_ptr<const Region>) const; + bool any_source_equivalent (boost::shared_ptr<const Region>) const; bool uses_source (boost::shared_ptr<const Source>) const; std::string source_string () const; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 4e731ee06c..c5d52f7345 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -845,6 +845,17 @@ Playlist::flush_notifications (bool from_undo) } void + Playlist::get_source_equivalent_regions (boost::shared_ptr<Region> other, vector<boost::shared_ptr<Region> >& results) + { + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + + if ((*i) && (*i)->any_source_equivalent (other)) { + results.push_back (*i); + } + } + } + + void Playlist::partition (framepos_t start, framepos_t end, bool cut) { RegionList thawlist; diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index c74ce4e419..952e8b5c9c 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1407,6 +1407,25 @@ Region::source_equivalent (boost::shared_ptr<const Region> other) const return true; } +bool +Region::any_source_equivalent (boost::shared_ptr<const Region> other) const +{ + if (!other) { + return false; + } + + SourceList::const_iterator i; + SourceList::const_iterator io; + + for (i = _sources.begin(), io = other->_sources.begin(); i != _sources.end() && io != other->_sources.end(); ++i, ++io) { + if ((*i)->id() == (*io)->id()) { + return true; + } + } + + return false; +} + std::string Region::source_string () const { |