diff options
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/LoadPluginWindow.cpp | 3 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 14 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index 436de188..b63de230 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -288,7 +288,8 @@ LoadPluginWindow::plugin_selection_changed() if (iter) { Gtk::TreeModel::Row row = *iter; boost::shared_ptr<PluginModel> p = row.get_value(_plugins_columns._col_plugin_model); - _plugin_name_offset = PatchModel::child_name_offset(*App::instance().store().get(), _patch, p->default_node_name()); + _plugin_name_offset = App::instance().store()->child_name_offset( + _patch->path(), p->default_node_name()); _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); } else { _plugin_name_offset = 0; diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index 040cf3c7..46cde832 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -24,6 +24,7 @@ #include <flowcanvas/Ellipse.hpp> #include "interface/EngineInterface.hpp" #include "shared/Builder.hpp" +#include "shared/ClashAvoider.hpp" #include "serialisation/Serialiser.hpp" #include "client/PluginModel.hpp" #include "client/PatchModel.hpp" @@ -583,15 +584,14 @@ 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(), &clipboard, str, "/"); + parser->parse_string(App::instance().world(), &avoider, str, "/"); + for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) { if (i->first == "/") continue; - /*GraphObject::Properties::iterator s = i->second->properties().find("ingen:symbol"); - const string sym = string(s->second.get_string()) + "_copy"; - s->second = sym;*/ 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; @@ -605,6 +605,10 @@ PatchCanvas::paste() i->second->properties().insert(make_pair("ingen:selected", true)); builder.build(i->second); } + + for (ClientStore::ConnectionRecords::const_iterator i = clipboard.connection_records().begin(); + i != clipboard.connection_records().end(); ++i) + App::instance().engine()->connect(i->first, i->second); } @@ -659,7 +663,7 @@ void PatchCanvas::load_plugin(SharedPtr<PluginModel> plugin) { string name = plugin->default_node_name(); - unsigned offset = PatchModel::child_name_offset(*App::instance().store().get(), _patch, name); + unsigned offset = App::instance().store()->child_name_offset(_patch->path(), name); if (offset != 0) { std::stringstream ss; ss << name << "_" << offset; |