diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-11-05 20:36:44 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-11-05 20:36:44 +0000 |
commit | aa78fb928b116c63a883679d2d199063a68c9bce (patch) | |
tree | 219975c4b246712ab212f478845949c2ac53db32 /libs/ardour/region_factory.cc | |
parent | e98cf169ebe49a0ca5705ed6f059c41edd117ac8 (diff) |
try to sensibly handle repeated imports of the same file. the same thing might be required for embeds
git-svn-id: svn://localhost/ardour2/branches/3.0@7975 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region_factory.cc')
-rw-r--r-- | libs/ardour/region_factory.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libs/ardour/region_factory.cc b/libs/ardour/region_factory.cc index 44615e2182..6f49d8c5b3 100644 --- a/libs/ardour/region_factory.cc +++ b/libs/ardour/region_factory.cc @@ -327,13 +327,34 @@ RegionFactory::region_by_id (const PBD::ID& id) RegionMap::iterator i = region_map.find (id); if (i == region_map.end()) { - cerr << "ID " << id << " not found in region map\n"; return boost::shared_ptr<Region>(); } return i->second; } - + +boost::shared_ptr<Region> +RegionFactory::wholefile_region_by_name (const std::string& name) +{ + for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) { + if (i->second->whole_file() && i->second->name() == name) { + return i->second; + } + } + return boost::shared_ptr<Region>(); +} + +boost::shared_ptr<Region> +RegionFactory::region_by_name (const std::string& name) +{ + for (RegionMap::iterator i = region_map.begin(); i != region_map.end(); ++i) { + if (i->second->name() == name) { + return i->second; + } + } + return boost::shared_ptr<Region>(); +} + void RegionFactory::clear_map () { |