diff options
author | Carl Hetherington <carl@carlh.net> | 2010-11-12 22:32:36 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-11-12 22:32:36 +0000 |
commit | 08b303c334bc74ec9c5a4dc5292cc59f377e3f75 (patch) | |
tree | ee6c4a1a67a0e2ba08b5c8c616423010079bc160 /gtk2_ardour/route_ui.cc | |
parent | a0b75ed66eddcd06b36cc8bfe3edf6280b887dad (diff) |
Convert 2.X route extra-xml to 3.0 format when it is loaded, to prevent multiple near-duplicate extra XML nodes in the resultant 3.0 session file.
git-svn-id: svn://localhost/ardour2/branches/3.0@8014 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/route_ui.cc')
-rw-r--r-- | gtk2_ardour/route_ui.cc | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index b69c6aaeeb..b7fef2d6ff 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -94,7 +94,6 @@ RouteUI::init () { self_destruct = true; xml_node = 0; - _xml_node_version = Stateful::current_state_version; mute_menu = 0; solo_menu = 0; sends_menu = 0; @@ -1269,7 +1268,32 @@ RouteUI::ensure_xml_node () _route->add_extra_xml (*xml_node); } else { /* the Route has one, so it must have been loaded */ - _xml_node_version = Stateful::loading_state_version; + if (Stateful::loading_state_version < 3000) { + /* the GUI extra XML is in 2.X format; we must convert it to the new + format to avoid problems later + */ + + XMLNode* new_xml_node = new XMLNode (X_("GUI")); + XMLPropertyList old_gui_props = xml_node->properties (); + for (XMLPropertyIterator i = old_gui_props.begin(); i != old_gui_props.end(); ++i) { + new_xml_node->add_property ((*i)->name().c_str (), (*i)->value().c_str ()); + } + + XMLNodeList old_children = xml_node->children (); + for (XMLNodeConstIterator i = old_children.begin(); i != old_children.end(); ++i) { + XMLNode* new_child = new XMLNode (AutomationTimeAxisView::state_node_name); + new_child->add_property (X_("automation-id"), (*i)->name()); + + XMLPropertyList old_props = (*i)->properties (); + for (XMLPropertyIterator j = old_props.begin(); j != old_props.end(); ++j) { + new_child->add_property ((*j)->name().c_str (), (*j)->value().c_str ()); + } + + new_xml_node->add_child_nocopy (*new_child); + } + + _route->add_extra_xml (*new_xml_node); + } } } } @@ -1286,17 +1310,11 @@ RouteUI::get_automation_child_xml_node (Evoral::Parameter param) for (iter = kids.begin(); iter != kids.end(); ++iter) { - if (_xml_node_version < 3000) { - if ((*iter)->name() == sym) { + if ((*iter)->name() == AutomationTimeAxisView::state_node_name) { + XMLProperty* type = (*iter)->property("automation-id"); + if (type && type->value() == sym) { return *iter; } - } else { - if ((*iter)->name() == AutomationTimeAxisView::state_node_name) { - XMLProperty* type = (*iter)->property("automation-id"); - if (type && type->value() == sym) { - return *iter; - } - } } } |