summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-29 22:20:01 -0400
committerDavid Robillard <d@drobilla.net>2016-07-29 22:20:01 -0400
commitd035a293b7e4555597bcf5940e8a98f278a2143e (patch)
tree3bc0443934f0c7bb8efdccf90d114d4ab8a2063c /src
parent50a6edb088ead6d8f6287aeca55e4d704add61a2 (diff)
downloadingen-d035a293b7e4555597bcf5940e8a98f278a2143e.tar.gz
ingen-d035a293b7e4555597bcf5940e8a98f278a2143e.tar.bz2
ingen-d035a293b7e4555597bcf5940e8a98f278a2143e.zip
Use more terse patch:Put for canvas positions
Fix the semantics of PUT events for existing objects to match the documentation.
Diffstat (limited to 'src')
-rw-r--r--src/gui/GraphPortModule.cpp15
-rw-r--r--src/gui/NodeModule.cpp11
-rw-r--r--src/gui/SubgraphModule.cpp15
-rw-r--r--src/server/EventWriter.cpp9
-rw-r--r--src/server/events/Delta.cpp12
5 files changed, 15 insertions, 47 deletions
diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp
index 2fb502ea..dd402f9b 100644
--- a/src/gui/GraphPortModule.cpp
+++ b/src/gui/GraphPortModule.cpp
@@ -105,17 +105,10 @@ GraphPortModule::store_location(double ax, double ay)
if (x != _model->get_property(uris.ingen_canvasX) ||
y != _model->get_property(uris.ingen_canvasY))
{
- Resource::Properties remove;
- remove.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(uris.patch_wildcard)));
- remove.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(uris.patch_wildcard)));
- Resource::Properties add;
- add.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(x, Resource::Graph::INTERNAL)));
- add.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(y, Resource::Graph::INTERNAL)));
- app().interface()->delta(_model->uri(), remove, add);
+ app().interface()->put(
+ _model->uri(),
+ {{uris.ingen_canvasX, Resource::Property(x, Resource::Graph::INTERNAL)},
+ {uris.ingen_canvasY, Resource::Property(y, Resource::Graph::INTERNAL)}});
}
}
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 04a46a9f..746083fb 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -420,15 +420,8 @@ NodeModule::store_location(double ax, double ay)
if (x != _block->get_property(uris.ingen_canvasX) ||
y != _block->get_property(uris.ingen_canvasY))
{
- Resource::Properties remove;
- remove.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(uris.patch_wildcard)));
- remove.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(uris.patch_wildcard)));
- Resource::Properties add;
- add.insert(make_pair(uris.ingen_canvasX, x));
- add.insert(make_pair(uris.ingen_canvasY, y));
- app().interface()->delta(_block->uri(), remove, add);
+ app().interface()->put(_block->uri(), {{uris.ingen_canvasX, x},
+ {uris.ingen_canvasY, y}});
}
}
diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp
index 395779cf..1dc4fe49 100644
--- a/src/gui/SubgraphModule.cpp
+++ b/src/gui/SubgraphModule.cpp
@@ -70,17 +70,10 @@ SubgraphModule::store_location(double ax, double ay)
if (x != _block->get_property(uris.ingen_canvasX) ||
y != _block->get_property(uris.ingen_canvasY))
{
- Resource::Properties remove;
- remove.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(uris.patch_wildcard)));
- remove.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(uris.patch_wildcard)));
- Resource::Properties add;
- add.insert(make_pair(uris.ingen_canvasX,
- Resource::Property(x, Resource::Graph::EXTERNAL)));
- add.insert(make_pair(uris.ingen_canvasY,
- Resource::Property(y, Resource::Graph::EXTERNAL)));
- app().interface()->delta(_block->uri(), remove, add);
+ app().interface()->put(
+ _graph->uri(),
+ {{uris.ingen_canvasX, Resource::Property(x, Resource::Graph::EXTERNAL)},
+ {uris.ingen_canvasY, Resource::Property(y, Resource::Graph::EXTERNAL)}});
}
}
diff --git a/src/server/EventWriter.cpp b/src/server/EventWriter.cpp
index 1f225d6e..9732f04c 100644
--- a/src/server/EventWriter.cpp
+++ b/src/server/EventWriter.cpp
@@ -126,15 +126,10 @@ EventWriter::set_property(const Raul::URI& uri,
const Raul::URI& predicate,
const Atom& value)
{
- Resource::Properties remove{
- { predicate, _engine.world()->uris().patch_wildcard.urid }};
-
- Resource::Properties add{{ predicate, value }};
-
_engine.enqueue_event(
new Events::Delta(_engine, _respondee, _request_id, now(),
- Events::Delta::Type::SET, Resource::Graph::DEFAULT,
- uri, add, remove));
+ Events::Delta::Type::PUT, Resource::Graph::DEFAULT,
+ uri, {{predicate, value}}, {}));
}
void
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 0ef63d64..641525e1 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -298,15 +298,9 @@ Delta::pre_process()
}
// Remove all added properties if this is a put or set
- if (_object) {
- if (_type == Type::PUT) {
- for (const auto& p : _properties) {
- _object->remove_property(p.first, p.second);
- }
- } else if (_type == Type::SET) {
- for (const auto& p : _properties) {
- _object->remove_property(p.first, uris.patch_wildcard);
- }
+ if (_object && (_type == Type::PUT || _type == Type::SET)) {
+ for (const auto& p : _properties) {
+ _object->remove_property(p.first, uris.patch_wildcard);
}
}