summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/Makefile.am6
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp12
-rw-r--r--src/libs/engine/QueuedEngineInterface.cpp5
-rw-r--r--src/libs/engine/QueuedEngineInterface.hpp3
-rw-r--r--src/libs/engine/events.hpp2
-rw-r--r--src/libs/engine/events/DestroyEvent.cpp35
-rw-r--r--src/libs/engine/events/DestroyEvent.hpp6
-rw-r--r--src/libs/engine/events/DisconnectAllEvent.cpp183
-rw-r--r--src/libs/engine/events/DisconnectAllEvent.hpp (renamed from src/libs/engine/events/DisconnectNodeEvent.hpp)24
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp135
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.cpp151
-rw-r--r--src/libs/engine/events/DisconnectPortEvent.hpp71
-rw-r--r--src/libs/engine/events/Makefile.am6
-rw-r--r--src/libs/engine/events/RenameEvent.hpp5
14 files changed, 234 insertions, 410 deletions
diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am
index b53b28e1..9ddfe88a 100644
--- a/src/libs/engine/Makefile.am
+++ b/src/libs/engine/Makefile.am
@@ -135,10 +135,8 @@ libingen_engine_la_SOURCES = \
events/DeactivateEvent.hpp \
events/DestroyEvent.cpp \
events/DestroyEvent.hpp \
- events/DisconnectNodeEvent.cpp \
- events/DisconnectNodeEvent.hpp \
- events/DisconnectPortEvent.cpp \
- events/DisconnectPortEvent.hpp \
+ events/DisconnectAllEvent.cpp \
+ events/DisconnectAllEvent.hpp \
events/DisconnectionEvent.cpp \
events/DisconnectionEvent.hpp \
events/EnablePatchEvent.cpp \
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index 20971e5a..c5ea7dae 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -101,7 +101,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, "/ingen/rename", "iss", rename_cb, this);
lo_server_add_method(_server, "/ingen/connect", "iss", connect_cb, this);
lo_server_add_method(_server, "/ingen/disconnect", "iss", disconnect_cb, this);
- lo_server_add_method(_server, "/ingen/disconnect_all", "is", disconnect_all_cb, this);
+ lo_server_add_method(_server, "/ingen/disconnect_all", "iss", disconnect_all_cb, this);
lo_server_add_method(_server, "/ingen/set_port_value", NULL, set_port_value_cb, this);
lo_server_add_method(_server, "/ingen/set_port_value_immediate", NULL, set_port_value_immediate_cb, this);
lo_server_add_method(_server, "/ingen/enable_port_broadcasting", NULL, enable_port_broadcasting_cb, this);
@@ -594,16 +594,18 @@ OSCEngineReceiver::_disconnect_cb(const char* path, const char* types, lo_arg**
/** \page engine_osc_namespace
- * <p> \b /ingen/disconnect_all - Disconnect all connections to/from a node.
+ * <p> \b /ingen/disconnect_all - Disconnect all connections to/from a node/port.
* \arg \b response-id (integer)
- * \arg \b node-path (string) - Full path of node. </p> \n \n
+ * \arg \b patch-path (string) - The (parent) patch in which to disconnect object. </p> \n \n
+ * \arg \b node-path (string) - Full path of object. </p> \n \n
*/
int
OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* node_path = &argv[1]->s;
+ const char* patch_path = &argv[1]->s;
+ const char* object_path = &argv[2]->s;
- disconnect_all(node_path);
+ disconnect_all(patch_path, object_path);
return 0;
}
diff --git a/src/libs/engine/QueuedEngineInterface.cpp b/src/libs/engine/QueuedEngineInterface.cpp
index a2603665..feb08c9c 100644
--- a/src/libs/engine/QueuedEngineInterface.cpp
+++ b/src/libs/engine/QueuedEngineInterface.cpp
@@ -227,9 +227,10 @@ QueuedEngineInterface::disconnect(const string& src_port_path,
void
-QueuedEngineInterface::disconnect_all(const string& node_path)
+QueuedEngineInterface::disconnect_all(const string& patch_path,
+ const string& node_path)
{
- push_queued(new DisconnectNodeEvent(_engine, _responder, now(), node_path));
+ push_queued(new DisconnectAllEvent(_engine, _responder, now(), patch_path, node_path));
}
diff --git a/src/libs/engine/QueuedEngineInterface.hpp b/src/libs/engine/QueuedEngineInterface.hpp
index ea4be595..54b3b5fd 100644
--- a/src/libs/engine/QueuedEngineInterface.hpp
+++ b/src/libs/engine/QueuedEngineInterface.hpp
@@ -116,7 +116,8 @@ public:
virtual void disconnect(const string& src_port_path,
const string& dst_port_path);
- virtual void disconnect_all(const string& node_path);
+ virtual void disconnect_all(const string& patch_path,
+ const string& node_path);
virtual void set_port_value(const string& port_path,
const string& type_uri,
diff --git a/src/libs/engine/events.hpp b/src/libs/engine/events.hpp
index 54b23cce..a2ea50a5 100644
--- a/src/libs/engine/events.hpp
+++ b/src/libs/engine/events.hpp
@@ -28,7 +28,7 @@
#include "CreatePortEvent.hpp"
#include "DeactivateEvent.hpp"
#include "DestroyEvent.hpp"
-#include "DisconnectNodeEvent.hpp"
+#include "DisconnectAllEvent.hpp"
#include "DisconnectionEvent.hpp"
#include "EnablePatchEvent.hpp"
#include "EnablePortBroadcastingEvent.hpp"
diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp
index eef7ea0e..bc28501e 100644
--- a/src/libs/engine/events/DestroyEvent.cpp
+++ b/src/libs/engine/events/DestroyEvent.cpp
@@ -25,8 +25,7 @@
#include "PluginImpl.hpp"
#include "AudioDriver.hpp"
#include "MidiDriver.hpp"
-#include "DisconnectNodeEvent.hpp"
-#include "DisconnectPortEvent.hpp"
+#include "DisconnectAllEvent.hpp"
#include "ClientBroadcaster.hpp"
#include "ObjectStore.hpp"
#include "QueuedEventSource.hpp"
@@ -44,8 +43,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, Frame
, _patch_port_listnode(NULL)
, _ports_array(NULL)
, _compiled_patch(NULL)
- , _disconnect_node_event(NULL)
- , _disconnect_port_event(NULL)
+ , _disconnect_event(NULL)
{
assert(_source);
}
@@ -53,8 +51,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr<Responder> responder, Frame
DestroyEvent::~DestroyEvent()
{
- delete _disconnect_node_event;
- delete _disconnect_port_event;
+ delete _disconnect_event;
}
@@ -80,8 +77,8 @@ DestroyEvent::pre_process()
if (_patch_node_listnode) {
assert(_patch_node_listnode->elem() == _node.get());
- _disconnect_node_event = new DisconnectNodeEvent(_engine, _node.get());
- _disconnect_node_event->pre_process();
+ _disconnect_event = new DisconnectAllEvent(_engine, _node->parent_patch(), _node.get());
+ _disconnect_event->pre_process();
if (_node->parent_patch()->enabled()) {
// FIXME: is this called multiple times?
@@ -101,10 +98,8 @@ DestroyEvent::pre_process()
if (_patch_port_listnode) {
assert(_patch_port_listnode->elem() == _port.get());
- //_port->remove_from_store();
-
- _disconnect_port_event = new DisconnectPortEvent(_engine, _port->parent_patch(), _port.get());
- _disconnect_port_event->pre_process();
+ _disconnect_event = new DisconnectAllEvent(_engine, _port->parent_patch(), _port.get());
+ _disconnect_event->pre_process();
if (_port->parent_patch()->enabled()) {
// FIXME: is this called multiple times?
@@ -128,8 +123,8 @@ DestroyEvent::execute(ProcessContext& context)
if (_patch_node_listnode) {
assert(_node);
- if (_disconnect_node_event)
- _disconnect_node_event->execute(context);
+ if (_disconnect_event)
+ _disconnect_event->execute(context);
if (_node->parent_patch()->compiled_patch())
_engine.maid()->push(_node->parent_patch()->compiled_patch());
@@ -138,8 +133,8 @@ DestroyEvent::execute(ProcessContext& context)
} else if (_patch_port_listnode) {
assert(_port);
- if (_disconnect_port_event)
- _disconnect_port_event->execute(context);
+ if (_disconnect_event)
+ _disconnect_event->execute(context);
if (_port->parent_patch()->compiled_patch())
_engine.maid()->push(_port->parent_patch()->compiled_patch());
@@ -183,8 +178,8 @@ DestroyEvent::post_process()
_node->deactivate();
_responder->respond_ok();
_engine.broadcaster()->bundle_begin();
- if (_disconnect_node_event)
- _disconnect_node_event->post_process();
+ if (_disconnect_event)
+ _disconnect_event->post_process();
_engine.broadcaster()->send_destroyed(_path);
_engine.broadcaster()->bundle_end();
_engine.maid()->push(_patch_node_listnode);
@@ -192,8 +187,8 @@ DestroyEvent::post_process()
assert(_port);
_responder->respond_ok();
_engine.broadcaster()->bundle_begin();
- if (_disconnect_port_event)
- _disconnect_port_event->post_process();
+ if (_disconnect_event)
+ _disconnect_event->post_process();
_engine.broadcaster()->send_destroyed(_path);
_engine.broadcaster()->bundle_end();
_engine.maid()->push(_patch_port_listnode);
diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp
index 134290b1..5d87f27c 100644
--- a/src/libs/engine/events/DestroyEvent.hpp
+++ b/src/libs/engine/events/DestroyEvent.hpp
@@ -38,8 +38,7 @@ class GraphObjectImpl;
class NodeImpl;
class PortImpl;
class DriverPort;
-class DisconnectNodeEvent;
-class DisconnectPortEvent;
+class DisconnectAllEvent;
class CompiledPatch;
@@ -67,8 +66,7 @@ private:
Raul::List<PortImpl*>::Node* _patch_port_listnode;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
CompiledPatch* _compiled_patch; ///< Patch's new process order
- DisconnectNodeEvent* _disconnect_node_event;
- DisconnectPortEvent* _disconnect_port_event;
+ DisconnectAllEvent* _disconnect_event;
SharedPtr< Table<Path, SharedPtr<Shared::GraphObject> > > _removed_table;
};
diff --git a/src/libs/engine/events/DisconnectAllEvent.cpp b/src/libs/engine/events/DisconnectAllEvent.cpp
new file mode 100644
index 00000000..a536fffc
--- /dev/null
+++ b/src/libs/engine/events/DisconnectAllEvent.cpp
@@ -0,0 +1,183 @@
+/* This file is part of Ingen.
+ * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
+ *
+ * Ingen is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <boost/format.hpp>
+#include <raul/Array.hpp>
+#include <raul/List.hpp>
+#include <raul/Maid.hpp>
+#include <raul/Path.hpp>
+#include "ClientBroadcaster.hpp"
+#include "ConnectionImpl.hpp"
+#include "DisconnectAllEvent.hpp"
+#include "DisconnectionEvent.hpp"
+#include "Engine.hpp"
+#include "InputPort.hpp"
+#include "NodeImpl.hpp"
+#include "ObjectStore.hpp"
+#include "OutputPort.hpp"
+#include "PatchImpl.hpp"
+#include "PortImpl.hpp"
+#include "Responder.hpp"
+#include "util.hpp"
+
+namespace Ingen {
+
+
+DisconnectAllEvent::DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path)
+ : QueuedEvent(engine, responder, timestamp)
+ , _parent_path(parent_path)
+ , _path(node_path)
+ , _parent(NULL)
+ , _node(NULL)
+ , _port(NULL)
+ , _lookup(true)
+ , _error(NO_ERROR)
+{
+}
+
+
+/** Internal version for use by other events.
+ */
+DisconnectAllEvent::DisconnectAllEvent(Engine& engine, PatchImpl* parent, GraphObjectImpl* object)
+ : QueuedEvent(engine)
+ , _parent_path(parent->path())
+ , _path(object->path())
+ , _parent(parent)
+ , _node(dynamic_cast<NodeImpl*>(object))
+ , _port(dynamic_cast<PortImpl*>(object))
+ , _lookup(false)
+ , _error(NO_ERROR)
+{
+}
+
+
+DisconnectAllEvent::~DisconnectAllEvent()
+{
+ for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
+ delete (*i);
+}
+
+
+void
+DisconnectAllEvent::pre_process()
+{
+ if (_lookup) {
+ _parent = _engine.object_store()->find_patch(_parent_path);
+
+ if (_parent == NULL) {
+ _error = PARENT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ GraphObjectImpl* object = _engine.object_store()->find_object(_path);
+
+ if (object == NULL) {
+ _error = OBJECT_NOT_FOUND;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ if (object->parent_patch() != _parent && object->parent()->parent_patch() != _parent) {
+ _error = INVALID_PARENT_PATH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
+ // Only one of these will succeed
+ _node = dynamic_cast<NodeImpl*>(object);
+ _port = dynamic_cast<PortImpl*>(object);
+
+ assert((_node || _port) && !(_node && _port));
+ }
+
+ if (_node) {
+ for (PatchImpl::Connections::const_iterator i = _parent->connections().begin();
+ i != _parent->connections().end(); ++i) {
+ ConnectionImpl* c = (ConnectionImpl*)i->get();
+ if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node)
+ && !c->pending_disconnection()) {
+ DisconnectionEvent* ev = new DisconnectionEvent(_engine,
+ SharedPtr<Responder>(new Responder()), _time, c->src_port(), c->dst_port());
+ ev->pre_process();
+ _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
+ c->pending_disconnection(true);
+ }
+ }
+ } else { // _port
+ for (PatchImpl::Connections::const_iterator i = _parent->connections().begin();
+ i != _parent->connections().end(); ++i) {
+ ConnectionImpl* c = (ConnectionImpl*)i->get();
+ if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) {
+ DisconnectionEvent* ev = new DisconnectionEvent(_engine,
+ SharedPtr<Responder>(new Responder()), _time, c->src_port(), c->dst_port());
+ ev->pre_process();
+ _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
+ c->pending_disconnection(true);
+ }
+ }
+ }
+
+ QueuedEvent::pre_process();
+}
+
+
+void
+DisconnectAllEvent::execute(ProcessContext& context)
+{
+ QueuedEvent::execute(context);
+
+ if (_error == NO_ERROR) {
+ for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
+ (*i)->execute(context);
+ }
+}
+
+
+void
+DisconnectAllEvent::post_process()
+{
+ if (_error == NO_ERROR) {
+ if (_responder)
+ _responder->respond_ok();
+ for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin();
+ i != _disconnection_events.end(); ++i)
+ (*i)->post_process();
+ } else {
+ if (_responder) {
+ boost::format fmt("Unable to disconnect %1% (%2%)");
+ fmt % _path;
+ switch (_error) {
+ case INVALID_PARENT_PATH:
+ fmt % string("Invalid parent path: ").append(_parent_path);
+ break;
+ case PARENT_NOT_FOUND:
+ fmt % string("Unable to find parent: ").append(_parent_path);
+ break;
+ case OBJECT_NOT_FOUND:
+ fmt % string("Unable to find object");
+ default:
+ break;
+ }
+ _responder->respond_error(fmt.str());
+ }
+ }
+}
+
+
+} // namespace Ingen
+
diff --git a/src/libs/engine/events/DisconnectNodeEvent.hpp b/src/libs/engine/events/DisconnectAllEvent.hpp
index 6d38c768..6b75e6df 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.hpp
+++ b/src/libs/engine/events/DisconnectAllEvent.hpp
@@ -40,26 +40,36 @@ class OutputPort;
*
* \ingroup engine
*/
-class DisconnectNodeEvent : public QueuedEvent
+class DisconnectAllEvent : public QueuedEvent
{
public:
- DisconnectNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path);
- DisconnectNodeEvent(Engine& engine, NodeImpl* node);
- ~DisconnectNodeEvent();
+ DisconnectAllEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& parent_path, const string& node_path);
+ DisconnectAllEvent(Engine& engine, PatchImpl* parent, GraphObjectImpl* object);
+ ~DisconnectAllEvent();
void pre_process();
void execute(ProcessContext& context);
void post_process();
private:
- Raul::Path _node_path;
- PatchImpl* _patch;
+ enum ErrorType {
+ NO_ERROR,
+ INVALID_PARENT_PATH,
+ PARENT_NOT_FOUND,
+ OBJECT_NOT_FOUND,
+ };
+
+ Raul::Path _parent_path;
+ Raul::Path _path;
+ PatchImpl* _parent;
NodeImpl* _node;
+ PortImpl* _port;
Raul::List<DisconnectionEvent*> _disconnection_events;
- bool _succeeded;
bool _lookup;
bool _disconnect_parent;
+
+ ErrorType _error;
};
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
deleted file mode 100644
index 4fa92af0..00000000
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <raul/Array.hpp>
-#include <raul/List.hpp>
-#include <raul/Maid.hpp>
-#include <raul/Path.hpp>
-#include "ClientBroadcaster.hpp"
-#include "ConnectionImpl.hpp"
-#include "DisconnectNodeEvent.hpp"
-#include "DisconnectionEvent.hpp"
-#include "Engine.hpp"
-#include "InputPort.hpp"
-#include "NodeImpl.hpp"
-#include "ObjectStore.hpp"
-#include "OutputPort.hpp"
-#include "PatchImpl.hpp"
-#include "PortImpl.hpp"
-#include "Responder.hpp"
-#include "util.hpp"
-
-namespace Ingen {
-
-
-DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& node_path)
-: QueuedEvent(engine, responder, timestamp),
- _node_path(node_path),
- _patch(NULL),
- _node(NULL),
- _succeeded(true),
- _lookup(true)
-{
-}
-
-
-/** Internal version, disconnects parent port as well (in the case of InputNode, etc).
- */
-DisconnectNodeEvent::DisconnectNodeEvent(Engine& engine, NodeImpl* node)
-: QueuedEvent(engine),
- _node_path(node->path()),
- _patch(node->parent_patch()),
- _node(node),
- _succeeded(true),
- _lookup(false)
-{
-}
-
-
-DisconnectNodeEvent::~DisconnectNodeEvent()
-{
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- delete (*i);
-}
-
-
-void
-DisconnectNodeEvent::pre_process()
-{
- if (_lookup) {
- _patch = _engine.object_store()->find_patch(_node_path.parent());
-
- if (_patch == NULL) {
- _succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- _node = _engine.object_store()->find_node(_node_path);
-
- if (_node == NULL) {
- _succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- for (PatchImpl::Connections::const_iterator i = _patch->connections().begin(); i != _patch->connections().end(); ++i) {
- ConnectionImpl* c = (ConnectionImpl*)i->get();
- if ((c->src_port()->parent_node() == _node || c->dst_port()->parent_node() == _node) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time,
- c->src_port(), c->dst_port());
- ev->pre_process();
- _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
- c->pending_disconnection(true);
- }
- }
-
- _succeeded = true;
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectNodeEvent::execute(ProcessContext& context)
-{
- QueuedEvent::execute(context);
-
- if (_succeeded) {
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- (*i)->execute(context);
- }
-}
-
-
-void
-DisconnectNodeEvent::post_process()
-{
- if (_succeeded) {
- if (_responder)
- _responder->respond_ok();
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- (*i)->post_process();
- } else {
- if (_responder)
- _responder->respond_error("Unable to disconnect all ports.");
- }
-}
-
-
-} // namespace Ingen
-
diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp
deleted file mode 100644
index 617d86a2..00000000
--- a/src/libs/engine/events/DisconnectPortEvent.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <iostream>
-#include <raul/Maid.hpp>
-#include <raul/List.hpp>
-#include <raul/Path.hpp>
-#include <raul/Array.hpp>
-#include "Responder.hpp"
-#include "Engine.hpp"
-#include "NodeImpl.hpp"
-#include "ConnectionImpl.hpp"
-#include "DisconnectionEvent.hpp"
-#include "PortImpl.hpp"
-#include "InputPort.hpp"
-#include "OutputPort.hpp"
-#include "PatchImpl.hpp"
-#include "ClientBroadcaster.hpp"
-#include "util.hpp"
-#include "ObjectStore.hpp"
-#include "DisconnectPortEvent.hpp"
-
-using std::cerr; using std::endl;
-
-namespace Ingen {
-
-
-DisconnectPortEvent::DisconnectPortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path)
-: QueuedEvent(engine, responder, timestamp),
- _port_path(port_path),
- _patch(NULL),
- _port(NULL),
- _process_order(NULL),
- _succeeded(true),
- _lookup(true)
-{
-}
-
-
-DisconnectPortEvent::DisconnectPortEvent(Engine& engine, PatchImpl* patch, Port* port)
-: QueuedEvent(engine),
- _port_path(port->path()),
- _patch(patch),
- _port(port),
- _process_order(NULL),
- _succeeded(true),
- _lookup(false)
-{
- //cerr << "DisconnectPortEvent(Engine& engine, )\n";
-}
-
-
-DisconnectPortEvent::~DisconnectPortEvent()
-{
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- delete (*i);
-}
-
-
-void
-DisconnectPortEvent::pre_process()
-{
- // cerr << "Preparing disconnection event...\n";
-
- if (_lookup) {
-
- /* FIXME: Double lookup */
-
- _patch = _engine.object_store()->find_patch(_port_path.parent().parent());
-
- if (_patch == NULL) {
- _succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- _port = _engine.object_store()->find_port(_port_path);
-
- if (_port == NULL) {
- _succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
- }
-
- if (_patch == NULL) {
- _succeeded = false;
- QueuedEvent::pre_process();
- return;
- }
-
- for (PatchImpl::Connections::const_iterator i = _patch->connections().begin();
- i != _patch->connections().end(); ++i) {
- ConnectionImpl* c = (ConnectionImpl*)i->get();
- if ((c->src_port() == _port || c->dst_port() == _port) && !c->pending_disconnection()) {
- DisconnectionEvent* ev = new DisconnectionEvent(_engine, SharedPtr<Responder>(new Responder()), _time,
- c->src_port(), c->dst_port());
- ev->pre_process();
- _disconnection_events.push_back(new Raul::List<DisconnectionEvent*>::Node(ev));
- c->pending_disconnection(true);
- }
- }
-
- _succeeded = true;
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectPortEvent::execute(ProcessContext& context)
-{
- QueuedEvent::execute(context);
-
- if (_succeeded) {
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- (*i)->execute(context);
- }
-}
-
-
-void
-DisconnectPortEvent::post_process()
-{
- if (_succeeded) {
- if (_responder)
- _responder->respond_ok();
- for (Raul::List<DisconnectionEvent*>::iterator i = _disconnection_events.begin(); i != _disconnection_events.end(); ++i)
- (*i)->post_process();
- } else {
- if (_responder)
- _responder->respond_error("Unable to disconnect port.");
- }
-}
-
-
-} // namespace Ingen
-
diff --git a/src/libs/engine/events/DisconnectPortEvent.hpp b/src/libs/engine/events/DisconnectPortEvent.hpp
deleted file mode 100644
index de75ddf2..00000000
--- a/src/libs/engine/events/DisconnectPortEvent.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef DISCONNECTPORTEVENT_H
-#define DISCONNECTPORTEVENT_H
-
-#include <string>
-#include <raul/Path.hpp>
-#include "QueuedEvent.hpp"
-#include <raul/List.hpp>
-
-namespace Raul { template <typename T> class Array; }
-
-namespace Ingen {
-
-
-class PatchImpl;
-class NodeImpl;
-class Connection;
-class PortImpl;
-class DisconnectionEvent;
-
-using std::string;
-
-
-/** An event to disconnect all connections to a Port.
- *
- * \ingroup engine
- */
-class DisconnectPortEvent : public QueuedEvent
-{
-public:
- DisconnectPortEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& port_path);
- DisconnectPortEvent(Engine& engine, PatchImpl* patch, Port* port);
- ~DisconnectPortEvent();
-
- void pre_process();
- void execute(ProcessContext& context);
- void post_process();
-
-private:
- Path _port_path;
- PatchImpl* _patch;
- Port* _port;
- Raul::List<DisconnectionEvent*> _disconnection_events;
-
- Raul::Array<NodeImpl*>* _process_order; // Patch's new process order
-
- bool _succeeded;
- bool _lookup;
-};
-
-
-} // namespace Ingen
-
-
-#endif // DISCONNECTPORTEVENT_H
diff --git a/src/libs/engine/events/Makefile.am b/src/libs/engine/events/Makefile.am
index f437be2c..18b02d8c 100644
--- a/src/libs/engine/events/Makefile.am
+++ b/src/libs/engine/events/Makefile.am
@@ -17,10 +17,8 @@ EXTRA_DIST = \
DeactivateEvent.hpp \
DestroyEvent.cpp \
DestroyEvent.hpp \
- DisconnectNodeEvent.cpp \
- DisconnectNodeEvent.hpp \
- DisconnectPortEvent.cpp \
- DisconnectPortEvent.hpp \
+ DisconnectAllEvent.cpp \
+ DisconnectAllEvent.hpp \
DisconnectionEvent.cpp \
DisconnectionEvent.hpp \
EnablePatchEvent.cpp \
diff --git a/src/libs/engine/events/RenameEvent.hpp b/src/libs/engine/events/RenameEvent.hpp
index fae3a060..dbfc6d53 100644
--- a/src/libs/engine/events/RenameEvent.hpp
+++ b/src/libs/engine/events/RenameEvent.hpp
@@ -30,12 +30,7 @@ template<typename T> class ListNode;
namespace Ingen {
-class GraphObjectImpl;
class PatchImpl;
-class NodeImpl;
-class Plugin;
-class DisconnectNodeEvent;
-class DisconnectPortEvent;
/** An event to change the name of an GraphObjectImpl.