diff options
author | Carl Hetherington <carl@carlh.net> | 2010-08-26 01:44:11 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-08-26 01:44:11 +0000 |
commit | c243a02c998f585295f2179657673e2cf0fa4428 (patch) | |
tree | 1a18ca901b5f7fb1270938e2fb62f7e2636400ef /libs/ardour/playlist.cc | |
parent | df2fd9491904aba95e08e1e26552be609530ee83 (diff) |
Fix crossfade undo using the stateful diff system. Fixes #3257.
git-svn-id: svn://localhost/ardour2/branches/3.0@7694 d708f5d6-7413-0410-9779-e7cbd77b26cf
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); |