summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-18 03:49:35 +0000
committerDavid Robillard <d@drobilla.net>2008-08-18 03:49:35 +0000
commitaf759288a2517f9acf4c28f79d9c43be0086a221 (patch)
treeb5852382a750fa5f8a6bc60f27edf9881960374f /src/libs/gui
parent77d608d6ca282795b348a615932b1abbd47b0472 (diff)
downloadingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.gz
ingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.bz2
ingen-af759288a2517f9acf4c28f79d9c43be0086a221.zip
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
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/App.cpp2
-rw-r--r--src/libs/gui/App.hpp11
-rw-r--r--src/libs/gui/NodeModule.cpp3
-rw-r--r--src/libs/gui/PatchCanvas.cpp30
-rw-r--r--src/libs/gui/PatchPortModule.cpp3
5 files changed, 31 insertions, 18 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index 34f04f35..408b7503 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -339,7 +339,9 @@ App::gtk_main_iteration()
if (_world->local_engine) {
_world->local_engine->main_iteration();
} else {
+ _enable_signal = false;
_client->emit_signals();
+ _enable_signal = true;
}
animate();
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index a13259ad..04666285 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -91,9 +91,13 @@ public:
bool gtk_main_iteration();
void show_about();
void quit();
-
+
void port_activity(Port* port);
+ bool signal() const { return _enable_signal; }
+ void enable_signals() { _enable_signal = true; }
+ void disable_signals() { _enable_signal = false; }
+
ConnectWindow* connect_window() const { return _connect_window; }
MessagesWindow* messages_dialog() const { return _messages_window; }
PatchTreeWindow* patch_tree() const { return _patch_tree_window; }
@@ -157,11 +161,6 @@ protected:
typedef std::map<Port*, bool> ActivityPorts;
ActivityPorts _activity_ports;
- /** Used to avoid feedback loops with (eg) process checkbutton
- * FIXME: This should probably be implemented globally:
- * disable all command sending while handling events to avoid feedback
- * issues with widget event callbacks? This same pattern is duplicated
- * too much... */
bool _enable_signal;
};
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index c38a898b..207bdd18 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -333,7 +333,8 @@ NodeModule::set_selected(bool b)
{
if (b != selected()) {
Module::set_selected(b);
- App::instance().engine()->set_property(_node->path(), "ingen:selected", b);
+ if (App::instance().signal())
+ App::instance().engine()->set_property(_node->path(), "ingen:selected", b);
}
}
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<Glib::ustring>(), _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();
diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp
index b23ac5c7..76bc8812 100644
--- a/src/libs/gui/PatchPortModule.cpp
+++ b/src/libs/gui/PatchPortModule.cpp
@@ -147,7 +147,8 @@ PatchPortModule::set_selected(bool b)
{
if (b != selected()) {
Module::set_selected(b);
- App::instance().engine()->set_property(_port->path(), "ingen:selected", b);
+ if (App::instance().signal())
+ App::instance().engine()->set_property(_port->path(), "ingen:selected", b);
}
}