diff options
Diffstat (limited to 'libs/ardour/playlist.cc')
-rw-r--r-- | libs/ardour/playlist.cc | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 93a4d520e8..1b2d64baba 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -110,28 +110,46 @@ RegionListProperty::RegionListProperty (Playlist& pl) : SequenceProperty<std::list<boost::shared_ptr<Region> > > (Properties::regions.property_id, boost::bind (&Playlist::update, &pl, _1)) , _playlist (pl) { + } -boost::shared_ptr<Region> -RegionListProperty::lookup_id (const ID& id) const +RegionListProperty * +RegionListProperty::clone () const { - boost::shared_ptr<Region> ret = _playlist.region_by_id (id); - - if (!ret) { - ret = RegionFactory::region_by_id (id); - } + return new RegionListProperty (*this); +} - return ret; +RegionListProperty * +RegionListProperty::create () const +{ + return new RegionListProperty (_playlist); } -RegionListProperty* RegionListProperty::clone () const +void +RegionListProperty::get_content_as_xml (boost::shared_ptr<Region> region, XMLNode & node) const { - return new RegionListProperty (*this); + /* All regions (even those which are deleted) have their state saved by other + code, so we can just store ID here. + */ + + node.add_property ("id", region->id().to_s ()); } -RegionListProperty* RegionListProperty::create () const +boost::shared_ptr<Region> +RegionListProperty::get_content_from_xml (XMLNode const & node) const { - return new RegionListProperty (_playlist); + XMLProperty const * prop = node.property ("id"); + assert (prop); + + PBD::ID id (prop->value ()); + + boost::shared_ptr<Region> ret = _playlist.region_by_id (id); + + if (!ret) { + ret = RegionFactory::region_by_id (id); + } + + return ret; } Playlist::Playlist (Session& sess, string nom, DataType type, bool hide) @@ -2100,7 +2118,7 @@ Playlist::mark_session_dirty () } void -Playlist::rdiff (vector<StatefulDiffCommand*>& cmds) const +Playlist::rdiff (vector<Command*>& cmds) const { RegionLock rlock (const_cast<Playlist *> (this)); Stateful::rdiff (cmds); |