From da33ac899a390ac13abbc6fba36d1b5c1d65d267 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 26 Mar 2017 22:32:53 +0200 Subject: Add properties parameter to delete interface --- ingen/AtomWriter.hpp | 3 ++- ingen/Interface.hpp | 3 ++- ingen/Tee.hpp | 5 ++++- ingen/client/ClientStore.hpp | 3 ++- ingen/client/SigClientInterface.hpp | 7 ++++--- ingen/client/ThreadedSigClientInterface.hpp | 7 ++++--- src/AtomReader.cpp | 12 +++++++----- src/AtomWriter.cpp | 11 ++++++++++- src/client/ClientStore.cpp | 2 +- src/gui/BreadCrumbs.cpp | 2 +- src/gui/BreadCrumbs.hpp | 2 +- src/server/Broadcaster.hpp | 5 +++-- src/server/ClientUpdate.cpp | 2 +- src/server/ClientUpdate.hpp | 3 ++- src/server/EventWriter.cpp | 4 ++-- src/server/EventWriter.hpp | 3 ++- src/server/events/Delete.cpp | 12 +++++++----- src/server/events/Delete.hpp | 12 +++++++----- tests/TestClient.hpp | 3 ++- 19 files changed, 64 insertions(+), 37 deletions(-) diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp index e7a02049..c14e70d4 100644 --- a/ingen/AtomWriter.hpp +++ b/ingen/AtomWriter.hpp @@ -61,7 +61,8 @@ public: void move(const Raul::Path& old_path, const Raul::Path& new_path); - void del(const Raul::URI& uri); + void del(const Raul::URI& uri, + const Properties& properties = Properties()); void connect(const Raul::Path& tail, const Raul::Path& head); diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp index e396872e..2a580f0c 100644 --- a/ingen/Interface.hpp +++ b/ingen/Interface.hpp @@ -79,7 +79,8 @@ public: virtual void move(const Raul::Path& old_path, const Raul::Path& new_path) = 0; - virtual void del(const Raul::URI& uri) = 0; + virtual void del(const Raul::URI& uri, + const Properties& properties = Properties()) = 0; virtual void connect(const Raul::Path& tail, const Raul::Path& head) = 0; diff --git a/ingen/Tee.hpp b/ingen/Tee.hpp index 02596e03..b2e1244e 100644 --- a/ingen/Tee.hpp +++ b/ingen/Tee.hpp @@ -86,7 +86,10 @@ public: BROADCAST(move, old_path, new_path); } - void del(const Raul::URI& uri) { BROADCAST(del, uri); } + void del(const Raul::URI& uri, + const Properties& properties = Properties()) { + BROADCAST(del, uri, properties); + } void connect(const Raul::Path& tail, const Raul::Path& head) { diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 1887bed3..c3efb7c7 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -102,7 +102,8 @@ public: void disconnect_all(const Raul::Path& graph, const Raul::Path& path); - void del(const Raul::URI& uri); + void del(const Raul::URI& uri, + const Properties& properties = Properties()); void undo() {} void redo() {} diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp index 7e903fab..4ee3624c 100644 --- a/ingen/client/SigClientInterface.hpp +++ b/ingen/client/SigClientInterface.hpp @@ -56,7 +56,7 @@ public: INGEN_SIGNAL(delta, void, Raul::URI, Properties, Properties, Resource::Graph) INGEN_SIGNAL(object_copied, void, Raul::URI, Raul::URI) INGEN_SIGNAL(object_moved, void, Raul::Path, Raul::Path) - INGEN_SIGNAL(object_deleted, void, Raul::URI) + INGEN_SIGNAL(object_deleted, void, Raul::URI, Properties) INGEN_SIGNAL(connection, void, Raul::Path, Raul::Path) INGEN_SIGNAL(disconnection, void, Raul::Path, Raul::Path) INGEN_SIGNAL(disconnect_all, void, Raul::Path, Raul::Path) @@ -97,8 +97,9 @@ protected: void connect(const Raul::Path& tail, const Raul::Path& head) { EMIT(connection, tail, head); } - void del(const Raul::URI& uri) - { EMIT(object_deleted, uri); } + void del(const Raul::URI& uri, + const Properties& properties = Properties()) + { EMIT(object_deleted, uri, properties); } void copy(const Raul::URI& old_uri, const Raul::URI& new_uri) { EMIT(object_copied, old_uri, new_uri); } diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp index 219fd8d1..d9a88eee 100644 --- a/ingen/client/ThreadedSigClientInterface.hpp +++ b/ingen/client/ThreadedSigClientInterface.hpp @@ -94,8 +94,9 @@ public: void connect(const Raul::Path& tail, const Raul::Path& head) { push_sig(sigc::bind(connection_slot, tail, head)); } - void del(const Raul::URI& uri) - { push_sig(sigc::bind(object_deleted_slot, uri)); } + void del(const Raul::URI& uri, + const Properties& properties = Properties()) + { push_sig(sigc::bind(object_deleted_slot, uri, properties)); } void move(const Raul::Path& old_path, const Raul::Path& new_path) { push_sig(sigc::bind(object_moved_slot, old_path, new_path)); } @@ -165,7 +166,7 @@ private: sigc::slot put_slot; sigc::slot delta_slot; sigc::slot connection_slot; - sigc::slot object_deleted_slot; + sigc::slot object_deleted_slot; sigc::slot object_moved_slot; sigc::slot object_copied_slot; sigc::slot disconnection_slot; diff --git a/src/AtomReader.cpp b/src/AtomReader.cpp index 18b5877c..60662209 100644 --- a/src/AtomReader.cpp +++ b/src/AtomReader.cpp @@ -171,13 +171,13 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) const LV2_Atom_Object* body = NULL; lv2_atom_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0); + Ingen::Properties props; + if (body) { + get_props(body, props); + } + if (subject_uri && !body) { _iface.del(*subject_uri); - return true; - } else if (obj->body.otype == _uris.ingen_BundleStart) { - _iface.bundle_begin(); - } else if (obj->body.otype == _uris.ingen_BundleEnd) { - _iface.bundle_end(); } else if (body && body->body.otype == _uris.ingen_Arc) { const LV2_Atom* tail = NULL; const LV2_Atom* head = NULL; @@ -200,6 +200,8 @@ AtomReader::write(const LV2_Atom* msg, int32_t default_id) _log.warn("Delete of unknown object\n"); return false; } + } else if (!subject_uri && body) { + _iface.del(_uris.patch_wildcard, props); } } else if (obj->body.otype == _uris.patch_Put) { const LV2_Atom_Object* body = NULL; diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index 54dcd0a2..786ff820 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -363,12 +363,21 @@ AtomWriter::move(const Raul::Path& old_path, * @endcode */ void -AtomWriter::del(const Raul::URI& uri) +AtomWriter::del(const Raul::URI& uri, const Properties& properties) { LV2_Atom_Forge_Frame msg; forge_request(&msg, _uris.patch_Delete); lv2_atom_forge_key(&_forge, _uris.patch_subject); forge_uri(uri); + + if (!properties.empty()) { + LV2_Atom_Forge_Frame body; + lv2_atom_forge_key(&_forge, _uris.patch_body); + lv2_atom_forge_object(&_forge, &body, 0, 0); + forge_properties(properties); + lv2_atom_forge_pop(&_forge, &body); + } + lv2_atom_forge_pop(&_forge, &msg); finish_msg(); } diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 9f84f660..169fe2de 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -207,7 +207,7 @@ ClientStore::add_plugin(SPtr pm) /* ****** Signal Handlers ******** */ void -ClientStore::del(const Raul::URI& uri) +ClientStore::del(const Raul::URI& uri, const Properties& properties) { if (uri_is_path(uri)) { remove_object(uri_to_path(uri)); diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 447b06ba..ac89e4a2 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -180,7 +180,7 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb) } void -BreadCrumbs::object_destroyed(const Raul::URI& uri) +BreadCrumbs::object_destroyed(const Raul::URI& uri, const Properties& properties) { for (auto i = _breadcrumbs.begin(); i != _breadcrumbs.end(); ++i) { if ((*i)->path() == uri.c_str()) { diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp index e58b2c0f..59460b1c 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -103,7 +103,7 @@ private: void breadcrumb_clicked(BreadCrumb* crumb); - void object_destroyed(const Raul::URI& uri); + void object_destroyed(const Raul::URI& uri, const Properties& properties); void object_moved(const Raul::Path& old_path, const Raul::Path& new_path); Raul::Path _active_path; diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index fd8d3996..8ffc25c3 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -122,8 +122,9 @@ public: BROADCAST(move, old_path, new_path); } - void del(const Raul::URI& uri) { - BROADCAST(del, uri); + void del(const Raul::URI& uri, + const Properties& properties = Properties()) { + BROADCAST(del, uri, properties); } void connect(const Raul::Path& tail, diff --git a/src/server/ClientUpdate.cpp b/src/server/ClientUpdate.cpp index e4d9c08f..49a3b22a 100644 --- a/src/server/ClientUpdate.cpp +++ b/src/server/ClientUpdate.cpp @@ -118,7 +118,7 @@ ClientUpdate::put_preset(const URIs& uris, } void -ClientUpdate::del(const Raul::URI& subject) +ClientUpdate::del(const Raul::URI& subject, const Properties& properties) { dels.push_back(subject); } diff --git a/src/server/ClientUpdate.hpp b/src/server/ClientUpdate.hpp index ea11c2b8..027a250b 100644 --- a/src/server/ClientUpdate.hpp +++ b/src/server/ClientUpdate.hpp @@ -55,7 +55,8 @@ struct ClientUpdate { const Raul::URI& preset, const std::string& label); - void del(const Raul::URI& subject); + void del(const Raul::URI& subject, + const Properties& properties = Properties()); void send(Interface* dest); diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp index 28a8d319..5c528238 100644 --- a/src/server/EventWriter.cpp +++ b/src/server/EventWriter.cpp @@ -110,10 +110,10 @@ EventWriter::move(const Raul::Path& old_path, } void -EventWriter::del(const Raul::URI& uri) +EventWriter::del(const Raul::URI& uri, const Properties& properties) { _engine.enqueue_event( - new Events::Delete(_engine, _respondee, _request_id, now(), uri), + new Events::Delete(_engine, _respondee, _request_id, now(), uri, properties), _event_mode); } diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 18e98421..dbcc1fa4 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -83,7 +83,8 @@ public: const Atom& value, Resource::Graph ctx = Resource::Graph::DEFAULT); - virtual void del(const Raul::URI& uri); + virtual void del(const Raul::URI& uri, + const Properties& properties = Properties()); virtual void disconnect_all(const Raul::Path& graph, const Raul::Path& path); diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 5683f3a4..a6ade2c9 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -35,13 +35,15 @@ namespace Ingen { namespace Server { namespace Events { -Delete::Delete(Engine& engine, - SPtr client, - int32_t id, - FrameTime time, - const Raul::URI& uri) +Delete::Delete(Engine& engine, + SPtr client, + int32_t id, + FrameTime time, + const Raul::URI& uri, + const Properties& properties) : Event(engine, client, id, time) , _uri(uri) + , _properties(properties) , _engine_port(NULL) , _disconnect_event(NULL) { diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp index 224cad3b..e1c762ca 100644 --- a/src/server/events/Delete.hpp +++ b/src/server/events/Delete.hpp @@ -46,11 +46,12 @@ class DisconnectAll; class Delete : public Event { public: - Delete(Engine& engine, - SPtr client, - int32_t id, - FrameTime timestamp, - const Raul::URI& uri); + Delete(Engine& engine, + SPtr client, + int32_t id, + FrameTime timestamp, + const Raul::URI& uri, + const Properties& properties); ~Delete(); @@ -62,6 +63,7 @@ public: private: Raul::URI _uri; Raul::Path _path; + Properties _properties; SPtr _block; ///< Non-NULL iff a block SPtr _port; ///< Non-NULL iff a port EnginePort* _engine_port; diff --git a/tests/TestClient.hpp b/tests/TestClient.hpp index 968e4423..99ab6d82 100644 --- a/tests/TestClient.hpp +++ b/tests/TestClient.hpp @@ -48,7 +48,8 @@ public: void move(const Raul::Path& old_path, const Raul::Path& new_path) {} - void del(const Raul::URI& uri) {} + void del(const Raul::URI& uri, + const Properties& properties = Properties()) {} void connect(const Raul::Path& tail, const Raul::Path& head) {} -- cgit v1.2.1