diff options
author | Carl Hetherington <carl@carlh.net> | 2011-11-16 23:03:59 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-11-16 23:03:59 +0000 |
commit | 0c9c47086c49d27a38cef5f5cc819e1aec56857c (patch) | |
tree | 0fafbaa13412cc26011e547c1ce779cbf294f3a8 /libs/ardour/io.cc | |
parent | 58dbe9ed13cede08f9e11f428fa6c188325db009 (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/ardour/io.cc')
-rw-r--r-- | libs/ardour/io.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 4f1b03dfda..23c7594d40 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -1478,10 +1478,14 @@ IO::name_from_state (const XMLNode& node) void IO::set_name_in_state (XMLNode& node, const string& new_name) { - const XMLProperty* prop; - - if ((prop = node.property ("name")) != 0) { - node.add_property ("name", new_name); + node.add_property (X_("name"), new_name); + XMLNodeList children = node.children (); + for (XMLNodeIterator i = children.begin(); i != children.end(); ++i) { + if ((*i)->name() == X_("Port")) { + string const old_name = (*i)->property(X_("name"))->value(); + string const old_name_second_part = old_name.substr (old_name.find_first_of ("/") + 1); + (*i)->add_property (X_("name"), string_compose ("%1/%2", new_name, old_name_second_part)); + } } } |