mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 21:25:46 +01:00
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
This commit is contained in:
parent
e98cf169eb
commit
aa78fb928b
4 changed files with 71 additions and 3 deletions
|
|
@ -42,7 +42,9 @@ class RegionFactory {
|
|||
public:
|
||||
typedef std::map<PBD::ID,boost::shared_ptr<Region> > RegionMap;
|
||||
|
||||
static boost::shared_ptr<Region> wholefile_region_by_name (const std::string& name);
|
||||
static boost::shared_ptr<Region> region_by_id (const PBD::ID&);
|
||||
static boost::shared_ptr<Region> region_by_name (const std::string& name);
|
||||
static const RegionMap all_regions() { return region_map; }
|
||||
static void clear_map ();
|
||||
|
||||
|
|
|
|||
|
|
@ -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 ()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue