summaryrefslogtreecommitdiff
path: root/libs/pbd
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-11-16 23:03:59 +0000
committerCarl Hetherington <carl@carlh.net>2011-11-16 23:03:59 +0000
commit0c9c47086c49d27a38cef5f5cc819e1aec56857c (patch)
tree0fafbaa13412cc26011e547c1ce779cbf294f3a8 /libs/pbd
parent58dbe9ed13cede08f9e11f428fa6c188325db009 (diff)
Slightly unpleasant fix for creation of tracks from
templates; it would be nice if we could set things up using the Route's logic for setting names of its children, rather than repeating the same logic in XML-land (#4303). git-svn-id: svn://localhost/ardour2/branches/3.0@10655 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r--libs/pbd/controllable.cc5
-rw-r--r--libs/pbd/pbd/xml++.h1
-rw-r--r--libs/pbd/xml++.cc10
3 files changed, 12 insertions, 4 deletions
diff --git a/libs/pbd/controllable.cc b/libs/pbd/controllable.cc
index 51877ee206..d4ceefe330 100644
--- a/libs/pbd/controllable.cc
+++ b/libs/pbd/controllable.cc
@@ -129,10 +129,7 @@ Controllable::set_state (const XMLNode& node, int /*version*/)
Stateful::save_extra_xml (node);
- if (!set_id (node)) {
- error << _("Controllable state node has no ID property") << endmsg;
- return -1;
- }
+ set_id (node);
if ((prop = node.property (X_("flags"))) != 0) {
_flags = (Flag) string_2_enum (prop->value(), _flags);
diff --git a/libs/pbd/pbd/xml++.h b/libs/pbd/pbd/xml++.h
index e0b6a885d2..6a5097780e 100644
--- a/libs/pbd/pbd/xml++.h
+++ b/libs/pbd/pbd/xml++.h
@@ -102,6 +102,7 @@ public:
XMLProperty* add_property(const char* name, const long value);
void remove_property(const std::string&);
+ void remove_property_recursively(const std::string&);
/** Remove all nodes with the name passed to remove_nodes */
void remove_nodes(const std::string&);
diff --git a/libs/pbd/xml++.cc b/libs/pbd/xml++.cc
index 1b006fd63d..58a0c4e747 100644
--- a/libs/pbd/xml++.cc
+++ b/libs/pbd/xml++.cc
@@ -422,6 +422,16 @@ XMLNode::remove_property(const string& n)
}
}
+/** Remove any property with the given name from this node and its children */
+void
+XMLNode::remove_property_recursively(const string& n)
+{
+ remove_property (n);
+ for (XMLNodeIterator i = _children.begin(); i != _children.end(); ++i) {
+ (*i)->remove_property_recursively (n);
+ }
+}
+
void
XMLNode::remove_nodes(const string& n)
{