Fix loading inserts from 2.0 sessions.

git-svn-id: svn://localhost/ardour2/trunk@2029 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard
2007-06-23 22:12:16 +00:00
parent 4b9c53bb98
commit 66722dd874
5 changed files with 13 additions and 22 deletions

View File

@@ -131,7 +131,7 @@ AutomationList::AutomationList (const AutomationList& other, double start, doubl
mark_dirty ();
AutomationListCreated(this);
AutomationListCreated(this);
}
AutomationList::AutomationList (const XMLNode& node)

View File

@@ -55,7 +55,7 @@ using namespace PBD;
sigc::signal<void,Insert*> Insert::InsertCreated;
// Always saved as Insert, but may be Redirect in legacy sessions
// Always saved as Insert, but may be Redirect or Send in legacy sessions
const string Insert::state_node_name = "Insert";
Insert::Insert(Session& session, const string& name, Placement p)
@@ -177,14 +177,8 @@ Insert::set_state (const XMLNode& node)
{
const XMLProperty *prop;
if (node.name() != state_node_name) {
error << string_compose(_("incorrect XML node \"%1\" passed to Redirect object"), node.name()) << endmsg;
return -1;
}
if ((prop = node.property ("name")) == 0) {
warning << _("XML node describing an insert is missing the `name' field") << endmsg;
} else {
// may not exist for legacy sessions
if ((prop = node.property ("name")) != 0) {
set_name(prop->value());
}
@@ -202,7 +196,7 @@ Insert::set_state (const XMLNode& node)
if ((prop = (*niter)->property ("path")) != 0) {
old_set_automation_state (*(*niter));
} else {
Automatable::set_automation_state (*(*niter));
set_automation_state (*(*niter));
}
if ((prop = (*niter)->property ("visible")) != 0) {

View File

@@ -128,7 +128,7 @@ PortInsert::set_state(const XMLNode& node)
const XMLProperty *prop;
if ((prop = node.property ("type")) == 0) {
error << _("XML node describing insert is missing the `type' field") << endmsg;
error << _("XML node describing port insert is missing the `type' field") << endmsg;
return -1;
}

View File

@@ -72,12 +72,9 @@ Redirect::state (bool full_state)
int
Redirect::set_state (const XMLNode& node)
{
Insert::set_state(node);
const XMLProperty *prop;
if (node.name() != "Insert" && node.name() != "Redirect") {
error << string_compose(_("incorrect XML node \"%1\" passed to Redirect object"), node.name()) << endmsg;
return -1;
}
Insert::set_state(node);
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
@@ -87,6 +84,11 @@ Redirect::set_state (const XMLNode& node)
if ((*niter)->name() == IO::state_node_name) {
have_io = true;
_io->set_state(**niter);
// legacy sessions: use IO name
if ((prop = node.property ("name")) == 0) {
set_name(_io->name());
}
}
}

View File

@@ -109,11 +109,6 @@ Send::set_state(const XMLNode& node)
Redirect::set_state (*insert_node);
if (niter == nlist.end()) {
error << _("XML node describing a send is missing a Redirect node") << endmsg;
return -1;
}
return 0;
}