From af759288a2517f9acf4c28f79d9c43be0086a221 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 18 Aug 2008 03:49:35 +0000 Subject: More copy/paste and serialisation work. Don't die on invalid path for set_property and set_variable (return error to client). Working paste to subpatches, paste of connected patch ports and modules. git-svn-id: http://svn.drobilla.net/lad/ingen@1428 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/PatchCanvas.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src/libs/gui/PatchCanvas.cpp') diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 46cde832..135a28c8 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -584,26 +584,36 @@ PatchCanvas::paste() Builder builder(*App::instance().engine()); ClientStore clipboard; - ClashAvoider avoider(*App::instance().store().get(), clipboard); - clipboard.new_patch("/", _patch->poly()); clipboard.set_plugins(App::instance().store()->plugins()); - parser->parse_string(App::instance().world(), &avoider, str, "/"); + clipboard.new_patch("/", _patch->poly()); + + ClashAvoider avoider(*App::instance().store().get(), _patch->path(), clipboard); + //parser->parse_string(App::instance().world(), &avoider, str, _patch->path().base()); + parser->parse_string(App::instance().world(), &avoider, str, "/", + boost::optional(), _patch->path()); for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { - if (i->first == "/") + if (_patch->path() == "/" && i->first == "/") { + //cout << "SKIPPING ROOT " << _patch->path() << " :: " << i->first << endl; + continue; + } else if (i->first.parent() != "/") { + //cout << "SKIPPING NON ROOTED OBJECT " << i->first << endl; continue; + } GraphObject::Variables::iterator x = i->second->variables().find("ingenuity:canvas-x"); if (x != i->second->variables().end()) x->second = x->second.get_float() + 20.0f; GraphObject::Variables::iterator y = i->second->variables().find("ingenuity:canvas-y"); if (y != i->second->variables().end()) y->second = y->second.get_float() + 20.0f; - GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected"); - if (s != i->second->properties().end()) - s->second = true; - else - i->second->properties().insert(make_pair("ingen:selected", true)); - builder.build(i->second); + if (i->first.parent() == "/") { + GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected"); + if (s != i->second->properties().end()) + s->second = true; + else + i->second->properties().insert(make_pair("ingen:selected", true)); + } + builder.build(_patch->path(), i->second); } for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin(); -- cgit v1.2.1