summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 23:00:34 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 23:00:34 +0000
commit14401d11e598651e7caf39cce884362e58ef5941 (patch)
tree05b2c57b1f55640149ba850a2f9f1fda175dccb8 /src/libs/gui
parent9938fac4b15f8939c9056c16a3a7662575af52e1 (diff)
downloadingen-14401d11e598651e7caf39cce884362e58ef5941.tar.gz
ingen-14401d11e598651e7caf39cce884362e58ef5941.tar.bz2
ingen-14401d11e598651e7caf39cce884362e58ef5941.zip
Copy/paste of connections.
git-svn-id: http://svn.drobilla.net/lad/ingen@1426 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/LoadPluginWindow.cpp3
-rw-r--r--src/libs/gui/PatchCanvas.cpp14
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;