From ed1032ca54a55c48d2f7c9709b77a4f4da935e99 Mon Sep 17 00:00:00 2001
From: David Robillard
Date: Tue, 12 May 2009 21:58:35 +0000
Subject: Bring EngineInterface and ClientInterface closer together.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1990 a436a847-0d15-0410-975c-d299462d15a1
---
src/bindings/Client.hpp | 6 ++---
src/client/ClientStore.cpp | 21 ++++++++++++++---
src/client/ClientStore.hpp | 5 ++--
src/client/HTTPEngineSender.cpp | 2 +-
src/client/HTTPEngineSender.hpp | 2 +-
src/client/OSCClientReceiver.cpp | 12 +++++-----
src/client/OSCClientReceiver.hpp | 4 ++--
src/client/OSCEngineSender.cpp | 4 ++--
src/client/OSCEngineSender.hpp | 2 +-
src/client/SigClientInterface.hpp | 8 +++----
src/client/ThreadedSigClientInterface.hpp | 10 ++++----
src/common/interface/ClientInterface.hpp | 5 ----
src/common/interface/CommonInterface.hpp | 5 ++++
src/common/interface/EngineInterface.hpp | 16 -------------
src/engine/ClientBroadcaster.cpp | 6 ++---
src/engine/ClientBroadcaster.hpp | 2 +-
src/engine/HTTPClientSender.cpp | 4 ++--
src/engine/HTTPClientSender.hpp | 6 ++---
src/engine/OSCClientSender.cpp | 12 +++++-----
src/engine/OSCClientSender.hpp | 6 ++---
src/engine/OSCEngineReceiver.cpp | 14 ++++++------
src/engine/QueuedEngineInterface.cpp | 8 +++----
src/engine/QueuedEngineInterface.hpp | 2 +-
src/engine/events/ClearPatchEvent.cpp | 2 +-
src/engine/events/RenameEvent.cpp | 38 +++++++++++--------------------
src/engine/events/RenameEvent.hpp | 13 +++++++----
src/gui/RenameWindow.cpp | 2 +-
src/shared/ClashAvoider.cpp | 15 ++++++++++++
src/shared/ClashAvoider.hpp | 5 ++++
29 files changed, 125 insertions(+), 112 deletions(-)
(limited to 'src')
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index dc58b9b7..b510e54e 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -52,10 +52,10 @@ public:
uint32_t index,
bool is_output) {}
- virtual void patch_cleared(const std::string& path) {}
+ virtual void clear_patch(const std::string& path) {}
- virtual void object_renamed(const std::string& old_path,
- const std::string& new_path) {}
+ virtual void rename(const std::string& old_path,
+ const std::string& new_path) {}
virtual void connect(const std::string& src_port_path,
const std::string& dst_port_path) {}
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 2acb2124..c73150d0 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -49,7 +49,7 @@ ClientStore::ClientStore(SharedPtr engine, SharedPtrsignal_new_patch.connect(sigc::mem_fun(this, &ClientStore::new_patch));
emitter->signal_new_node.connect(sigc::mem_fun(this, &ClientStore::new_node));
emitter->signal_new_port.connect(sigc::mem_fun(this, &ClientStore::new_port));
- emitter->signal_patch_cleared.connect(sigc::mem_fun(this, &ClientStore::patch_cleared));
+ emitter->signal_clear_patch.connect(sigc::mem_fun(this, &ClientStore::clear_patch));
emitter->signal_connection.connect(sigc::mem_fun(this, &ClientStore::connect));
emitter->signal_disconnection.connect(sigc::mem_fun(this, &ClientStore::disconnect));
emitter->signal_variable_change.connect(sigc::mem_fun(this, &ClientStore::set_variable));
@@ -377,8 +377,16 @@ ClientStore::destroy(const std::string& path)
}
void
-ClientStore::rename(const Path& old_path, const Path& new_path)
+ClientStore::rename(const std::string& old_path_str, const std::string& new_path_str)
{
+ if (!Path::is_valid(old_path_str) || !Path::is_valid(new_path_str)) {
+ cerr << "[Store] Bad path renaming " << old_path_str << " to " << new_path_str << endl;
+ return;
+ }
+
+ Path old_path(old_path_str);
+ Path new_path(new_path_str);
+
iterator parent = find(old_path);
if (parent == end()) {
cerr << "[Store] Failed to find object " << old_path << " to rename." << endl;
@@ -491,8 +499,15 @@ ClientStore::new_port(const string& path, const string& type, uint32_t index, bo
void
-ClientStore::patch_cleared(const Path& path)
+ClientStore::clear_patch(const std::string& path_str)
{
+ if (!Path::is_valid(path_str)) {
+ cerr << "[Store] Illegal path in clear: " << path_str << endl;
+ return;
+ }
+
+ Path path(path_str);
+
iterator i = find(path);
if (i != end()) {
assert((*i).second->path() == path);
diff --git a/src/client/ClientStore.hpp b/src/client/ClientStore.hpp
index 9fb677ea..d3ab2978 100644
--- a/src/client/ClientStore.hpp
+++ b/src/client/ClientStore.hpp
@@ -76,6 +76,7 @@ public:
void new_patch(const string& path, uint32_t poly);
void new_node(const string& path, const string& plugin_uri);
void new_port(const string& path, const string& type, uint32_t index, bool is_output);
+ void rename(const string& old_path, const string& new_path);
void set_variable(const string& subject_path, const string& predicate, const Atom& value);
void set_property(const string& subject_path, const string& predicate, const Atom& value);
void set_port_value(const string& port_path, const Raul::Atom& value);
@@ -119,8 +120,8 @@ private:
void bundle_end() {}
// Slots for SigClientInterface signals
- void rename(const Path& old_path, const Path& new_path);
- void patch_cleared(const Path& path);
+ void object_renamed(const Path& old_path, const Path& new_path);
+ void clear_patch(const std::string& path);
void activity(const Path& path);
bool attempt_connection(const Path& src_port_path, const Path& dst_port_path, bool add_orphan=false);
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index cd616042..4a54183d 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -185,7 +185,7 @@ HTTPEngineSender::disconnect(const string& src_port_path,
void
HTTPEngineSender::disconnect_all(const string& parent_patch_path,
- const string& node_path)
+ const string& path)
{
}
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index 4ad5fb4f..88f3a132 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -108,7 +108,7 @@ public:
const string& dst_port_path);
void disconnect_all(const string& parent_patch_path,
- const string& node_path);
+ const string& path);
void set_port_value(const string& port_path,
const Raul::Atom& value);
diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp
index e76f0081..445c92cc 100644
--- a/src/client/OSCClientReceiver.cpp
+++ b/src/client/OSCClientReceiver.cpp
@@ -145,8 +145,8 @@ OSCClientReceiver::setup_callbacks()
lo_server_thread_add_method(_st, "/ingen/plugin", "sss", plugin_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_patch", "si", new_patch_cb, this);
lo_server_thread_add_method(_st, "/ingen/destroyed", "s", destroyed_cb, this);
- lo_server_thread_add_method(_st, "/ingen/patch_cleared", "s", patch_cleared_cb, this);
- lo_server_thread_add_method(_st, "/ingen/object_renamed", "ss", object_renamed_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/clear_patch", "s", clear_patch_cb, this);
+ lo_server_thread_add_method(_st, "/ingen/rename", "ss", rename_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_connection", "ss", connection_cb, this);
lo_server_thread_add_method(_st, "/ingen/disconnection", "ss", disconnection_cb, this);
lo_server_thread_add_method(_st, "/ingen/new_node", "ss", new_node_cb, this);
@@ -188,17 +188,17 @@ OSCClientReceiver::_destroyed_cb(const char* path, const char* types, lo_arg** a
int
-OSCClientReceiver::_patch_cleared_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- _target->patch_cleared((const char*)&argv[0]->s);
+ _target->clear_patch((const char*)&argv[0]->s);
return 0;
}
int
-OSCClientReceiver::_object_renamed_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
+OSCClientReceiver::_rename_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- _target->object_renamed((const char*)&argv[0]->s, (const char*)&argv[1]->s);
+ _target->rename((const char*)&argv[0]->s, (const char*)&argv[1]->s);
return 0;
}
diff --git a/src/client/OSCClientReceiver.hpp b/src/client/OSCClientReceiver.hpp
index 9203f096..c0ea2f43 100644
--- a/src/client/OSCClientReceiver.hpp
+++ b/src/client/OSCClientReceiver.hpp
@@ -85,8 +85,8 @@ private:
LO_HANDLER(plugin_list_end);
LO_HANDLER(new_patch);
LO_HANDLER(destroyed);
- LO_HANDLER(patch_cleared);
- LO_HANDLER(object_renamed);
+ LO_HANDLER(clear_patch);
+ LO_HANDLER(rename);
LO_HANDLER(connection);
LO_HANDLER(disconnection);
LO_HANDLER(new_node);
diff --git a/src/client/OSCEngineSender.cpp b/src/client/OSCEngineSender.cpp
index 592702a3..0dfa9d5b 100644
--- a/src/client/OSCEngineSender.cpp
+++ b/src/client/OSCEngineSender.cpp
@@ -277,12 +277,12 @@ OSCEngineSender::disconnect(const string& src_port_path,
void
OSCEngineSender::disconnect_all(const string& parent_patch_path,
- const string& node_path)
+ const string& path)
{
send("/ingen/disconnect_all", "iss",
next_id(),
parent_patch_path.c_str(),
- node_path.c_str(),
+ path.c_str(),
LO_ARGS_END);
}
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index 22de8e70..620a73da 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -112,7 +112,7 @@ public:
const string& dst_port_path);
void disconnect_all(const string& parent_patch_path,
- const string& node_path);
+ const string& path);
void set_port_value(const string& port_path,
const Raul::Atom& value);
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index 580de7b2..ff54bab5 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -58,7 +58,7 @@ public:
sigc::signal signal_new_patch;
sigc::signal signal_new_node;
sigc::signal signal_new_port;
- sigc::signal signal_patch_cleared;
+ sigc::signal signal_clear_patch;
sigc::signal signal_object_renamed;
sigc::signal signal_object_destroyed;
sigc::signal signal_connection;
@@ -122,10 +122,10 @@ protected:
void destroy(const string& path)
{ if (_enabled) signal_object_destroyed.emit(path); }
- void patch_cleared(const string& path)
- { if (_enabled) signal_patch_cleared.emit(path); }
+ void clear_patch(const string& path)
+ { if (_enabled) signal_clear_patch.emit(path); }
- void object_renamed(const string& old_path, const string& new_path)
+ void rename(const string& old_path, const string& new_path)
{ if (_enabled) signal_object_renamed.emit(old_path, new_path); }
void disconnect(const string& src_port_path, const string& dst_port_path)
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index ff4b202c..1e4a2beb 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -57,7 +57,7 @@ public:
, new_node_slot(signal_new_node.make_slot())
, new_port_slot(signal_new_port.make_slot())
, connection_slot(signal_connection.make_slot())
- , patch_cleared_slot(signal_patch_cleared.make_slot())
+ , clear_patch_slot(signal_clear_patch.make_slot())
, object_destroyed_slot(signal_object_destroyed.make_slot())
, object_renamed_slot(signal_object_renamed.make_slot())
, disconnection_slot(signal_disconnection.make_slot())
@@ -114,10 +114,10 @@ public:
void destroy(const string& path)
{ push_sig(sigc::bind(object_destroyed_slot, path)); }
- void patch_cleared(const string& path)
- { push_sig(sigc::bind(patch_cleared_slot, path)); }
+ void clear_patch(const string& path)
+ { push_sig(sigc::bind(clear_patch_slot, path)); }
- void object_renamed(const string& old_path, const string& new_path)
+ void rename(const string& old_path, const string& new_path)
{ push_sig(sigc::bind(object_renamed_slot, old_path, new_path)); }
void disconnect(const string& src_port_path, const string& dst_port_path)
@@ -166,7 +166,7 @@ private:
sigc::slot new_node_slot;
sigc::slot new_port_slot;
sigc::slot connection_slot;
- sigc::slot patch_cleared_slot;
+ sigc::slot clear_patch_slot;
sigc::slot object_destroyed_slot;
sigc::slot object_renamed_slot;
sigc::slot disconnection_slot;
diff --git a/src/common/interface/ClientInterface.hpp b/src/common/interface/ClientInterface.hpp
index 80a48dc9..23e3c375 100644
--- a/src/common/interface/ClientInterface.hpp
+++ b/src/common/interface/ClientInterface.hpp
@@ -65,11 +65,6 @@ public:
const std::string& type_uri,
const std::string& symbol) = 0;
- virtual void patch_cleared(const std::string& path) = 0;
-
- virtual void object_renamed(const std::string& old_path,
- const std::string& new_path) = 0;
-
virtual void activity(const std::string& path) = 0;
virtual void program_add(const std::string& node_path,
diff --git a/src/common/interface/CommonInterface.hpp b/src/common/interface/CommonInterface.hpp
index d25e173d..9bbef09d 100644
--- a/src/common/interface/CommonInterface.hpp
+++ b/src/common/interface/CommonInterface.hpp
@@ -58,6 +58,9 @@ public:
uint32_t index,
bool is_output) = 0;
+ virtual void rename(const std::string& old_path,
+ const std::string& new_path) = 0;
+
virtual void connect(const std::string& src_port_path,
const std::string& dst_port_path) = 0;
@@ -80,6 +83,8 @@ public:
const Raul::Atom& value) = 0;
virtual void destroy(const std::string& path) = 0;
+
+ virtual void clear_patch(const std::string& patch_path) = 0;
};
diff --git a/src/common/interface/EngineInterface.hpp b/src/common/interface/EngineInterface.hpp
index dc5be1dc..2e84e4e3 100644
--- a/src/common/interface/EngineInterface.hpp
+++ b/src/common/interface/EngineInterface.hpp
@@ -54,10 +54,6 @@ public:
virtual void deactivate() = 0;
virtual void quit() = 0;
- // Bundles
- virtual void bundle_begin() = 0;
- virtual void bundle_end() = 0;
-
// Object commands
/** DEPRECATED */
@@ -65,22 +61,10 @@ public:
const std::string& plugin_type,
const std::string& library_name,
const std::string& plugin_label) = 0;
-
- virtual void rename(const std::string& old_path,
- const std::string& new_symbol) = 0;
-
- virtual void clear_patch(const std::string& patch_path) = 0;
virtual void disconnect_all(const std::string& parent_patch_path,
const std::string& path) = 0;
- virtual void set_port_value(const std::string& port_path,
- const Raul::Atom& value) = 0;
-
- virtual void set_voice_value(const std::string& port_path,
- uint32_t voice,
- const Raul::Atom& value) = 0;
-
virtual void set_program(const std::string& node_path,
uint32_t bank,
uint32_t program) = 0;
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index ee76eb53..c9f881aa 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -140,10 +140,10 @@ ClientBroadcaster::send_destroyed(const string& path)
void
-ClientBroadcaster::send_patch_cleared(const string& patch_path)
+ClientBroadcaster::send_clear_patch(const string& patch_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->patch_cleared(patch_path);
+ (*i).second->clear_patch(patch_path);
}
void
@@ -242,7 +242,7 @@ void
ClientBroadcaster::send_rename(const string& old_path, const string& new_path)
{
for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i)
- (*i).second->object_renamed(old_path, new_path);
+ (*i).second->rename(old_path, new_path);
}
diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp
index a4ef004c..80405d24 100644
--- a/src/engine/ClientBroadcaster.hpp
+++ b/src/engine/ClientBroadcaster.hpp
@@ -68,7 +68,7 @@ public:
void send_plugins(const NodeFactory::Plugins& plugin_list);
void send_object(const GraphObjectImpl* p, bool recursive);
void send_destroyed(const string& path);
- void send_patch_cleared(const string& patch_path);
+ void send_clear_patch(const string& patch_path);
void send_connection(const SharedPtr connection);
void send_disconnection(const string& src_port_path, const string& dst_port_path);
void send_rename(const string& old_path, const string& new_path);
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index f9329ebd..4b7a2045 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -75,7 +75,7 @@ HTTPClientSender::destroy(const std::string& path)
void
-HTTPClientSender::patch_cleared(const std::string& patch_path)
+HTTPClientSender::clear_patch(const std::string& patch_path)
{
send_chunk(string("<").append(patch_path).append("> ingen:empty true ."));
}
@@ -202,7 +202,7 @@ HTTPClientSender::new_patch(const std::string& path, uint32_t poly)
void
-HTTPClientSender::object_renamed(const std::string& old_path, const std::string& new_path)
+HTTPClientSender::rename(const std::string& old_path, const std::string& new_path)
{
string msg = string(
"@prefix rdf: .\n"
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 9a1ce10c..364549ee 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -88,12 +88,12 @@ public:
uint32_t index,
bool is_output);
- virtual void patch_cleared(const std::string& path);
+ virtual void clear_patch(const std::string& path);
virtual void destroy(const std::string& path);
- virtual void object_renamed(const std::string& old_path,
- const std::string& new_path);
+ virtual void rename(const std::string& old_path,
+ const std::string& new_path);
virtual void connect(const std::string& src_port_path,
const std::string& dst_port_path);
diff --git a/src/engine/OSCClientSender.cpp b/src/engine/OSCClientSender.cpp
index 2e058ed5..1357258e 100644
--- a/src/engine/OSCClientSender.cpp
+++ b/src/engine/OSCClientSender.cpp
@@ -175,13 +175,13 @@ OSCClientSender::destroy(const std::string& path)
/** \page client_osc_namespace
- * \b /ingen/patch_cleared - Notification a patch has been cleared (all children destroyed)
+ *
\b /ingen/clear_patch - Notification a patch has been cleared (all children destroyed)
* \arg \b path (string) - Path of patch (which is now empty)
\n \n
*/
void
-OSCClientSender::patch_cleared(const std::string& patch_path)
+OSCClientSender::clear_patch(const std::string& patch_path)
{
- send("/ingen/patch_cleared", "s", patch_path.c_str(), LO_ARGS_END);
+ send("/ingen/clear_patch", "s", patch_path.c_str(), LO_ARGS_END);
}
@@ -350,14 +350,14 @@ OSCClientSender::new_patch(const std::string& path, uint32_t poly)
/** \page client_osc_namespace
- * \b /ingen/object_renamed - Notification of an object's renaming
+ *
\b /ingen/rename - Notification of an object's renaming
* \arg \b old-path (string) - Old path of object
* \arg \b new-path (string) - New path of object
\n \n
*/
void
-OSCClientSender::object_renamed(const std::string& old_path, const std::string& new_path)
+OSCClientSender::rename(const std::string& old_path, const std::string& new_path)
{
- send("/ingen/object_renamed", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END);
+ send("/ingen/rename", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END);
}
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 6b8cc1bf..6d93b381 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -87,12 +87,12 @@ public:
uint32_t index,
bool is_output);
- virtual void patch_cleared(const std::string& path);
+ virtual void clear_patch(const std::string& path);
virtual void destroy(const std::string& path);
- virtual void object_renamed(const std::string& old_path,
- const std::string& new_path);
+ virtual void rename(const std::string& old_path,
+ const std::string& new_path);
virtual void connect(const std::string& src_port_path,
const std::string& dst_port_path);
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index 26b8aeeb..e2377d95 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -390,16 +390,16 @@ OSCEngineReceiver::_new_patch_cb(const char* path, const char* types, lo_arg** a
/** \page engine_osc_namespace
* \b /ingen/rename - Rename an Object (only Nodes, for now)
* \arg \b response-id (integer)
- * \arg \b path - Object's path
- * \arg \b name - New name for object
\n \n
+ * \arg \b old-path - Object's path
+ * \arg \b new-path - Object's new path
\n \n
*/
int
OSCEngineReceiver::_rename_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* object_path = &argv[1]->s;
- const char* name = &argv[2]->s;
+ const char* old_path = &argv[1]->s;
+ const char* new_path = &argv[2]->s;
- rename(object_path, name);
+ rename(old_path, new_path);
return 0;
}
@@ -412,7 +412,7 @@ OSCEngineReceiver::_rename_cb(const char* path, const char* types, lo_arg** argv
int
OSCEngineReceiver::_clear_patch_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
{
- const char* patch_path = &argv[1]->s;
+ const char* patch_path = &argv[1]->s;
clear_patch(patch_path);
return 0;
@@ -533,7 +533,7 @@ OSCEngineReceiver::_disconnect_cb(const char* path, const char* types, lo_arg**
* \b /ingen/disconnect_all - Disconnect all connections to/from a node/port.
* \arg \b response-id (integer)
* \arg \b patch-path (string) - The (parent) patch in which to disconnect object.
\n \n
- * \arg \b node-path (string) - Full path of object. \n \n
+ * \arg \b object-path (string) - Full path of object. \n \n
*/
int
OSCEngineReceiver::_disconnect_all_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg)
diff --git a/src/engine/QueuedEngineInterface.cpp b/src/engine/QueuedEngineInterface.cpp
index 9a2cea1b..00d142c9 100644
--- a/src/engine/QueuedEngineInterface.cpp
+++ b/src/engine/QueuedEngineInterface.cpp
@@ -191,9 +191,9 @@ QueuedEngineInterface::new_node_deprecated(const string& path,
void
QueuedEngineInterface::rename(const string& old_path,
- const string& new_symbol)
+ const string& new_path)
{
- push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_symbol));
+ push_queued(new RenameEvent(_engine, _responder, now(), old_path, new_path));
}
@@ -230,9 +230,9 @@ QueuedEngineInterface::disconnect(const string& src_port_path,
void
QueuedEngineInterface::disconnect_all(const string& patch_path,
- const string& node_path)
+ const string& path)
{
- push_queued(new DisconnectAllEvent(_engine, _responder, now(), patch_path, node_path));
+ push_queued(new DisconnectAllEvent(_engine, _responder, now(), patch_path, path));
}
diff --git a/src/engine/QueuedEngineInterface.hpp b/src/engine/QueuedEngineInterface.hpp
index ec5bf602..ed50f7c8 100644
--- a/src/engine/QueuedEngineInterface.hpp
+++ b/src/engine/QueuedEngineInterface.hpp
@@ -106,7 +106,7 @@ public:
const string& dst_port_path);
virtual void disconnect_all(const string& patch_path,
- const string& node_path);
+ const string& path);
virtual void set_port_value(const string& port_path,
const Raul::Atom& value);
diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp
index 9122281b..2be2e4a8 100644
--- a/src/engine/events/ClearPatchEvent.cpp
+++ b/src/engine/events/ClearPatchEvent.cpp
@@ -136,7 +136,7 @@ ClearPatchEvent::post_process()
// Reply
_responder->respond_ok();
- _engine.broadcaster()->send_patch_cleared(_patch_path);
+ _engine.broadcaster()->send_clear_patch(_patch_path);
// Unregister and destroy driver ports
if (_driver_ports) {
diff --git a/src/engine/events/RenameEvent.cpp b/src/engine/events/RenameEvent.cpp
index 4112527b..8ce1bf9c 100644
--- a/src/engine/events/RenameEvent.cpp
+++ b/src/engine/events/RenameEvent.cpp
@@ -31,20 +31,14 @@ using namespace std;
namespace Ingen {
-RenameEvent::RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name)
-: QueuedEvent(engine, responder, timestamp),
- _old_path(path),
- _name(name),
- _new_path("/"),
- _parent_patch(NULL),
- _store_iterator(engine.engine_store()->end()),
- _error(NO_ERROR)
+RenameEvent::RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& new_path)
+ : QueuedEvent(engine, responder, timestamp)
+ , _old_path(path)
+ , _new_path(new_path)
+ , _parent_patch(NULL)
+ , _store_iterator(engine.engine_store()->end())
+ , _error(NO_ERROR)
{
- /*
- if (_old_path.parent() == "/")
- _new_path = string("/") + _name;
- else
- _new_path = _old_path.parent() +"/"+ _name;*/
}
@@ -56,14 +50,12 @@ RenameEvent::~RenameEvent()
void
RenameEvent::pre_process()
{
- if ((!Raul::Path::is_valid_name(_name)) || _name.find("/") != string::npos) {
- _error = INVALID_NAME;
+ if ((!Raul::Path::is_valid(_new_path) || !_old_path.parent().is_parent_of(_new_path))) {
+ _error = BAD_PATH;
QueuedEvent::pre_process();
return;
}
- _new_path = _old_path.parent().base() + _name;
-
_store_iterator = _engine.engine_store()->find(_old_path);
if (_store_iterator == _engine.engine_store()->end()) {
_error = OBJECT_NOT_FOUND;
@@ -90,7 +82,7 @@ RenameEvent::pre_process()
if (child_old_path == _old_path)
child_new_path = _new_path;
else
- child_new_path = _new_path.base() + child_old_path.substr(_old_path.length()+1);
+ child_new_path = Path(_new_path).base() + child_old_path.substr(_old_path.length()+1);
PtrCast(i->second)->set_path(child_new_path);
i->first = child_new_path;
@@ -116,12 +108,8 @@ RenameEvent::execute(ProcessContext& context)
else if (port->type() == DataType::EVENT)
driver_port = _engine.midi_driver()->driver_port(_new_path);
- if (driver_port) {
- cerr << "DRIVER PORT :)!" << endl;
+ if (driver_port)
driver_port->set_name(_new_path);
- } else {
- cerr << "NO DRIVER PORT :(" << endl;
- }
}
}
@@ -141,8 +129,8 @@ RenameEvent::post_process()
msg.append("Could not find object ").append(_old_path);
else if (_error == OBJECT_NOT_RENAMABLE)
msg.append(_old_path).append(" is not renamable");
- else if (_error == INVALID_NAME)
- msg.append(_name).append(" is not a valid name");
+ else if (_error == BAD_PATH)
+ msg.append(_new_path).append(" is not a valid target path");
_responder->respond_error(msg);
}
diff --git a/src/engine/events/RenameEvent.hpp b/src/engine/events/RenameEvent.hpp
index db6d01b9..2cbf6902 100644
--- a/src/engine/events/RenameEvent.hpp
+++ b/src/engine/events/RenameEvent.hpp
@@ -40,7 +40,7 @@ class PatchImpl;
class RenameEvent : public QueuedEvent
{
public:
- RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& path, const string& name);
+ RenameEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& old_path, const string& new_path);
~RenameEvent();
void pre_process();
@@ -48,11 +48,16 @@ public:
void post_process();
private:
- enum ErrorType { NO_ERROR, OBJECT_NOT_FOUND, OBJECT_EXISTS, OBJECT_NOT_RENAMABLE, INVALID_NAME };
+ enum ErrorType {
+ NO_ERROR,
+ OBJECT_NOT_FOUND,
+ OBJECT_EXISTS,
+ OBJECT_NOT_RENAMABLE,
+ BAD_PATH
+ };
Path _old_path;
- string _name;
- Path _new_path;
+ string _new_path;
PatchImpl* _parent_patch;
EngineStore::iterator _store_iterator;
ErrorType _error;
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index a58ec2c2..92adb322 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -120,7 +120,7 @@ RenameWindow::ok_clicked()
assert(name.length() > 0);
assert(name.find("/") == string::npos);
- App::instance().engine()->rename(_object->path(), name);
+ App::instance().engine()->rename(_object->path(), _object->path().parent().base() + name);
hide();
}
diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp
index 41da3eeb..39338e99 100644
--- a/src/shared/ClashAvoider.cpp
+++ b/src/shared/ClashAvoider.cpp
@@ -167,6 +167,14 @@ ClashAvoider::new_port(const std::string& path,
}
+void
+ClashAvoider::rename(const std::string& old_path,
+ const std::string& new_path)
+{
+ _target.rename(map_path(old_path), map_path(new_path));
+}
+
+
void
ClashAvoider::connect(const std::string& src_port_path,
const std::string& dst_port_path)
@@ -225,5 +233,12 @@ ClashAvoider::destroy(const std::string& path)
}
+void
+ClashAvoider::clear_patch(const std::string& path)
+{
+ _target.clear_patch(map_path(path));
+}
+
+
} // namespace Shared
} // namespace Ingen
diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp
index 1ddee704..3d154e8d 100644
--- a/src/shared/ClashAvoider.hpp
+++ b/src/shared/ClashAvoider.hpp
@@ -61,6 +61,9 @@ public:
uint32_t index,
bool is_output);
+ void rename(const std::string& old_path,
+ const std::string& new_path);
+
void connect(const std::string& src_port_path,
const std::string& dst_port_path);
@@ -83,6 +86,8 @@ public:
const Raul::Atom& value);
void destroy(const std::string& path);
+
+ void clear_patch(const std::string& path);
private:
const std::string map_path(const Raul::Path& in);
--
cgit v1.2.1