summaryrefslogtreecommitdiff
path: root/libs/pbd/stateful.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-25 17:31:57 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-25 17:31:57 +0000
commit21855b71d2eb8006fda96aefacfa60140ae747d3 (patch)
treea5a5148ef41be377a0670bf708845b7197baf5d4 /libs/pbd/stateful.cc
parent803f3a6a307bea4bdd804041a0e0a846f48938ee (diff)
Modify StatefulDiffCommand undo record to only contain the changes in one direction, as the other direction can be inferred. Breaks session history file compatibility.
git-svn-id: svn://localhost/ardour2/branches/3.0@7684 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/stateful.cc')
-rw-r--r--libs/pbd/stateful.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc
index 6ea8f19128..204e62685e 100644
--- a/libs/pbd/stateful.cc
+++ b/libs/pbd/stateful.cc
@@ -166,12 +166,16 @@ Stateful::clear_history ()
}
}
-void
-Stateful::diff (PropertyList& before, PropertyList& after, Command* cmd) const
+PropertyList *
+Stateful::get_changes_as_properties (Command* cmd) const
{
+ PropertyList* pl = new PropertyList;
+
for (OwnedPropertyList::const_iterator i = _properties->begin(); i != _properties->end(); ++i) {
- i->second->diff (before, after, cmd);
+ i->second->get_changes_as_properties (*pl, cmd);
}
+
+ return pl;
}
/** Set our property values from an XML node.
@@ -209,8 +213,13 @@ Stateful::apply_changes (const PropertyList& property_list)
for (PropertyList::const_iterator i = property_list.begin(); i != property_list.end(); ++i) {
if ((p = _properties->find (i->first)) != _properties->end()) {
- DEBUG_TRACE (DEBUG::Stateful, string_compose ("actually setting property %1\n", p->second->property_name()));
- if (apply_change (*i->second)) {
+
+ DEBUG_TRACE (
+ DEBUG::Stateful,
+ string_compose ("actually setting property %1 using %2\n", p->second->property_name(), i->second->property_name())
+ );
+
+ if (apply_changes (*i->second)) {
c.add (i->first);
}
} else {
@@ -303,14 +312,14 @@ Stateful::changed() const
}
bool
-Stateful::apply_change (const PropertyBase& prop)
+Stateful::apply_changes (const PropertyBase& prop)
{
OwnedPropertyList::iterator i = _properties->find (prop.property_id());
if (i == _properties->end()) {
return false;
}
- i->second->apply_change (&prop);
+ i->second->apply_changes (&prop);
return true;
}