summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-04 01:28:27 +0000
committerDavid Robillard <d@drobilla.net>2007-10-04 01:28:27 +0000
commit2f991988c6b3d91652461fe70447e343fb3aa916 (patch)
treee4cd972696c68e6a4758f6df74401b9147c53e41 /src/libs/engine/events
parent93197523aaf7b35350a2a26430be7301ad0502b8 (diff)
downloadingen-2f991988c6b3d91652461fe70447e343fb3aa916.tar.gz
ingen-2f991988c6b3d91652461fe70447e343fb3aa916.tar.bz2
ingen-2f991988c6b3d91652461fe70447e343fb3aa916.zip
Fixed port menu (load fancy dynamic menu from Glade).
Renaming of JACK ports. git-svn-id: http://svn.drobilla.net/lad/ingen@820 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp23
-rw-r--r--src/libs/engine/events/RenameEvent.cpp47
2 files changed, 45 insertions, 25 deletions
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index b1f76dd6..26f31549 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -15,26 +15,23 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "DisconnectNodeEvent.hpp"
-#include <iostream>
-#include <raul/List.hpp>
#include <raul/Array.hpp>
+#include <raul/List.hpp>
#include <raul/Maid.hpp>
-#include "Responder.hpp"
-#include "Engine.hpp"
-#include "Node.hpp"
+#include <raul/Path.hpp>
+#include "ClientBroadcaster.hpp"
#include "Connection.hpp"
+#include "DisconnectNodeEvent.hpp"
#include "DisconnectionEvent.hpp"
-#include "Port.hpp"
+#include "Engine.hpp"
#include "InputPort.hpp"
+#include "Node.hpp"
+#include "ObjectStore.hpp"
#include "OutputPort.hpp"
#include "Patch.hpp"
-#include "ClientBroadcaster.hpp"
+#include "Port.hpp"
+#include "Responder.hpp"
#include "util.hpp"
-#include "ObjectStore.hpp"
-#include <raul/Path.hpp>
-
-using std::cerr; using std::endl;
namespace Ingen {
@@ -75,8 +72,6 @@ DisconnectNodeEvent::pre_process()
{
typedef Raul::List<Connection*>::const_iterator ConnectionListIterator;
- // cerr << "Preparing disconnection event...\n";
-
if (_lookup) {
_patch = _engine.object_store()->find_patch(_node_path.parent());
diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp
index 1ec3b0d1..9e5ef543 100644
--- a/src/libs/engine/events/RenameEvent.cpp
+++ b/src/libs/engine/events/RenameEvent.cpp
@@ -15,15 +15,17 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <raul/Path.hpp>
+#include "ClientBroadcaster.hpp"
+#include "Engine.hpp"
+#include "Node.hpp"
+#include "ObjectStore.hpp"
+#include "Patch.hpp"
#include "RenameEvent.hpp"
#include "Responder.hpp"
-#include "Patch.hpp"
-#include "Node.hpp"
#include "Tree.hpp"
-#include "Engine.hpp"
-#include "ClientBroadcaster.hpp"
-#include <raul/Path.hpp>
-#include "ObjectStore.hpp"
+#include "AudioDriver.hpp"
+#include "MidiDriver.hpp"
using namespace std;
@@ -34,7 +36,7 @@ RenameEvent::RenameEvent(Engine& engine, SharedPtr<Responder> responder, SampleC
: QueuedEvent(engine, responder, timestamp),
_old_path(path),
_name(name),
- _new_path(_old_path.parent().base() + name),
+ _new_path("/"),
_parent_patch(NULL),
_store_iterator(engine.object_store()->objects().end()),
_error(NO_ERROR)
@@ -55,19 +57,27 @@ RenameEvent::~RenameEvent()
void
RenameEvent::pre_process()
{
- if (_name.find("/") != string::npos) {
+ if ((!Raul::Path::is_valid_name(_name)) || _name.find("/") != string::npos) {
_error = INVALID_NAME;
QueuedEvent::pre_process();
return;
}
+ _new_path = _old_path.parent().base() + _name;
+
_store_iterator = _engine.object_store()->find(_old_path);
if (_store_iterator == _engine.object_store()->objects().end()) {
_error = OBJECT_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
-
+
+ if (_engine.object_store()->find_object(_new_path)) {
+ _error = OBJECT_EXISTS;
+ QueuedEvent::pre_process();
+ return;
+ }
+
Table<Path,GraphObject*> removed = _engine.object_store()->remove(_store_iterator);
assert(removed.size() > 0);
@@ -81,7 +91,6 @@ RenameEvent::pre_process()
else
child_new_path = _new_path.base() + child_old_path.substr(_old_path.length()+1);
- cerr << "Renamed " << child_old_path << " -> " << child_new_path << endl;
i->second->set_path(child_new_path);
i->first = child_new_path;
}
@@ -95,8 +104,24 @@ RenameEvent::pre_process()
void
RenameEvent::execute(ProcessContext& context)
{
- //cout << "Executing rename event...";
QueuedEvent::execute(context);
+
+ Port* port = dynamic_cast<Port*>(_store_iterator->second);
+ if (port && port->parent()->parent() == NULL) {
+ DriverPort* driver_port = NULL;
+
+ if (port->type() == DataType::FLOAT)
+ driver_port = _engine.audio_driver()->driver_port(_new_path);
+ else if (port->type() == DataType::MIDI)
+ driver_port = _engine.midi_driver()->driver_port(_new_path);
+
+ if (driver_port) {
+ cerr << "DRIVER PORT :)!" << endl;
+ driver_port->set_name(_new_path);
+ } else {
+ cerr << "NO DRIVER PORT :(" << endl;
+ }
+ }
}