Fix multiple creation of identical automation tracks. Fixes #3482.

git-svn-id: svn://localhost/ardour2/branches/3.0@7848 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-09-27 18:56:26 +00:00
parent 8000b39c8c
commit 74cc8f6067
6 changed files with 16 additions and 12 deletions

View File

@ -193,9 +193,7 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Ro
controls_base_unselected_name = X_("AutomationTrackControlsBase");
controls_ebox.set_name (controls_base_unselected_name);
XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (
_control->parameter(), Stateful::loading_state_version
);
XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (_control->parameter());
if (xml_node) {
set_state (*xml_node, Stateful::loading_state_version);
@ -404,7 +402,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView* state_parent = get_parent_with_state ();
assert(state_parent);
XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter());
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
@ -995,7 +993,7 @@ AutomationTimeAxisView::get_state_node ()
TimeAxisView* state_parent = get_parent_with_state ();
if (state_parent) {
return state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
return state_parent->get_automation_child_xml_node (_control->parameter());
} else {
return 0;
}

View File

@ -2391,7 +2391,7 @@ RouteTimeAxisView::create_gain_automation_child (const Evoral::Parameter& param,
error << "Route has no gain automation, unable to add automation track view." << endmsg;
return;
}
gain_track.reset (new AutomationTimeAxisView (_session,
_route, _route->amp(), c,
_editor,

View File

@ -117,7 +117,7 @@ public:
/* make sure we get the right version of this */
XMLNode* get_automation_child_xml_node (Evoral::Parameter param, int version) { return RouteUI::get_automation_child_xml_node (param, version); }
XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
AutomationTracks automation_tracks() { return _automation_tracks; }

View File

@ -94,6 +94,7 @@ RouteUI::init ()
{
self_destruct = true;
xml_node = 0;
_xml_node_version = Stateful::current_state_version;
mute_menu = 0;
solo_menu = 0;
sends_menu = 0;
@ -1266,12 +1267,15 @@ 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 */
_xml_node_version = Stateful::loading_state_version;
}
}
}
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,15 +1286,16 @@ RouteUI::get_automation_child_xml_node (Evoral::Parameter param, int version)
for (iter = kids.begin(); iter != kids.end(); ++iter) {
if (version < 3000) {
if (_xml_node_version < 3000) {
if ((*iter)->name() == sym) {
return *iter;
}
} else {
if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
XMLProperty* type = (*iter)->property("automation-id");
if (type && type->value() == sym)
if (type && type->value() == sym) {
return *iter;
}
}
}
}

View File

@ -110,8 +110,9 @@ class RouteUI : public virtual AxisView
XMLNode *xml_node;
void ensure_xml_node ();
int _xml_node_version;
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int);
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter);
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);

View File

@ -206,7 +206,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
/* call this on the parent */
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int) { return 0; }
virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter) { return 0; }
virtual LayerDisplay layer_display () const { return Overlaid; }
virtual StreamView* view () const { return 0; }