Use MTC instead of MIDI Timecode as the string for the external sync button. Fixes...
[ardour.git] / gtk2_ardour / route_ui.cc
index 6a79ce028269778688c29eacc6fb4b544cdc0a34..b7fef2d6ff371d933d86ca662a29513282633f5d 100644 (file)
@@ -1266,12 +1266,40 @@ RouteUI::ensure_xml_node ()
                if ((xml_node = _route->extra_xml ("GUI")) == 0) {
                        xml_node = new XMLNode ("GUI");
                        _route->add_extra_xml (*xml_node);
+               } else {
+                       /* the Route has one, so it must have been loaded */
+                       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);
+                       }
                }
        }
 }
 
 XMLNode*
-RouteUI::get_automation_child_xml_node (Evoral::Parameter param, int version)
+RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
 {
        ensure_xml_node ();
 
@@ -1282,16 +1310,11 @@ RouteUI::get_automation_child_xml_node (Evoral::Parameter param, int version)
 
        for (iter = kids.begin(); iter != kids.end(); ++iter) {
 
-               if (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;
-                       }
                }
        }