summaryrefslogtreecommitdiff
path: root/libs/pbd/property_list.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/property_list.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/property_list.cc')
-rw-r--r--libs/pbd/property_list.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/libs/pbd/property_list.cc b/libs/pbd/property_list.cc
index 5c0de4bacf..efae95e45e 100644
--- a/libs/pbd/property_list.cc
+++ b/libs/pbd/property_list.cc
@@ -27,6 +27,20 @@ using namespace PBD;
PropertyList::PropertyList()
: _property_owner (true)
{
+
+}
+
+PropertyList::PropertyList (PropertyList const & other)
+ : std::map<PropertyID, PropertyBase*> (other)
+ , _property_owner (other._property_owner)
+{
+ if (_property_owner) {
+ /* make our own copies of the properties */
+ clear ();
+ for (std::map<PropertyID, PropertyBase*>::const_iterator i = other.begin(); i != other.end(); ++i) {
+ insert (std::make_pair (i->first, i->second->clone ()));
+ }
+ }
}
PropertyList::~PropertyList ()
@@ -39,13 +53,13 @@ PropertyList::~PropertyList ()
}
void
-PropertyList::get_changes (XMLNode* history_node)
+PropertyList::get_changes_as_xml (XMLNode* history_node)
{
for (const_iterator i = begin(); i != end(); ++i) {
- DEBUG_TRACE (DEBUG::Properties, string_compose ("Add before/after to %1 for %2\n",
+ DEBUG_TRACE (DEBUG::Properties, string_compose ("Add changes to %1 for %2\n",
history_node->name(),
i->second->property_name()));
- i->second->get_change (history_node);
+ i->second->get_changes_as_xml (history_node);
}
}
@@ -53,7 +67,15 @@ bool
PropertyList::add (PropertyBase* prop)
{
return insert (value_type (prop->property_id(), prop)).second;
-}
+}
+
+void
+PropertyList::invert ()
+{
+ for (iterator i = begin(); i != end(); ++i) {
+ i->second->invert ();
+ }
+}
OwnedPropertyList::OwnedPropertyList ()
{