summaryrefslogtreecommitdiffstats
path: root/ingen
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-03-19 13:26:38 +0100
committerDavid Robillard <d@drobilla.net>2017-03-20 02:58:56 +0100
commitf1c793f7e2148b10610a09a459d9e89b39d2d87b (patch)
treeb898407dce08af0f2f978d59a85d4887d8555b54 /ingen
parentefc0fe0a973db706d9409b345ad6fae585f4388c (diff)
downloadingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.tar.gz
ingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.tar.bz2
ingen-f1c793f7e2148b10610a09a459d9e89b39d2d87b.zip
Fix round-trip preservation of property contexts
Diffstat (limited to 'ingen')
-rw-r--r--ingen/AtomReader.hpp1
-rw-r--r--ingen/AtomWriter.hpp7
-rw-r--r--ingen/Interface.hpp6
-rw-r--r--ingen/Properties.hpp6
-rw-r--r--ingen/Resource.hpp16
-rw-r--r--ingen/Tee.hpp12
-rw-r--r--ingen/URIs.hpp3
-rw-r--r--ingen/client/ClientStore.hpp6
-rw-r--r--ingen/client/PluginUI.hpp3
-rw-r--r--ingen/client/SigClientInterface.hpp16
-rw-r--r--ingen/client/ThreadedSigClientInterface.hpp36
-rw-r--r--ingen/ingen.h68
12 files changed, 100 insertions, 80 deletions
diff --git a/ingen/AtomReader.hpp b/ingen/AtomReader.hpp
index 8a1a80aa..bcfe9ab5 100644
--- a/ingen/AtomReader.hpp
+++ b/ingen/AtomReader.hpp
@@ -51,6 +51,7 @@ private:
boost::optional<Raul::URI> atom_to_uri(const LV2_Atom* atom);
boost::optional<Raul::Path> atom_to_path(const LV2_Atom* atom);
+ Resource::Graph atom_to_context(const LV2_Atom* atom);
void get_props(const LV2_Atom_Object* obj,
Ingen::Properties& props);
diff --git a/ingen/AtomWriter.hpp b/ingen/AtomWriter.hpp
index 35db84a4..e7a02049 100644
--- a/ingen/AtomWriter.hpp
+++ b/ingen/AtomWriter.hpp
@@ -52,7 +52,8 @@ public:
void delta(const Raul::URI& uri,
const Properties& remove,
- const Properties& add);
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT);
void copy(const Raul::URI& old_uri,
const Raul::URI& new_uri);
@@ -73,7 +74,8 @@ public:
void set_property(const Raul::URI& subject,
const Raul::URI& predicate,
- const Atom& value);
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT);
void undo();
@@ -92,6 +94,7 @@ private:
void forge_properties(const Properties& properties);
void forge_arc(const Raul::Path& tail, const Raul::Path& head);
void forge_request(LV2_Atom_Forge_Frame* frame, LV2_URID type);
+ void forge_context(Resource::Graph ctx);
void finish_msg();
diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp
index e37888f9..e396872e 100644
--- a/ingen/Interface.hpp
+++ b/ingen/Interface.hpp
@@ -70,7 +70,8 @@ public:
virtual void delta(const Raul::URI& uri,
const Properties& remove,
- const Properties& add) = 0;
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT) = 0;
virtual void copy(const Raul::URI& old_uri,
const Raul::URI& new_uri) = 0;
@@ -91,7 +92,8 @@ public:
virtual void set_property(const Raul::URI& subject,
const Raul::URI& predicate,
- const Atom& value) = 0;
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT) = 0;
virtual void undo() = 0;
diff --git a/ingen/Properties.hpp b/ingen/Properties.hpp
index ef608574..437db874 100644
--- a/ingen/Properties.hpp
+++ b/ingen/Properties.hpp
@@ -29,9 +29,9 @@ namespace Ingen {
class Property : public Atom {
public:
enum class Graph {
- DEFAULT,
- EXTERNAL,
- INTERNAL
+ DEFAULT, ///< Default context for "universal" properties
+ EXTERNAL, ///< Externally visible graph properties
+ INTERNAL ///< Internally visible graph properties
};
Property(const Atom& atom, Graph ctx=Graph::DEFAULT)
diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp
index 3eb1349f..fe3d94fa 100644
--- a/ingen/Resource.hpp
+++ b/ingen/Resource.hpp
@@ -57,25 +57,19 @@ public:
static Raul::URI graph_to_uri(Graph g) {
switch (g) {
- case Graph::DEFAULT: return Raul::URI(INGEN_NS "defaultContext");
case Graph::EXTERNAL: return Raul::URI(INGEN_NS "externalContext");
case Graph::INTERNAL: return Raul::URI(INGEN_NS "internalContext");
+ default: return Raul::URI(INGEN_NS "defaultContext");
}
}
- static Graph uri_to_graph(const char* uri) {
- const char* suffix = uri + sizeof(INGEN_NS) - 1;
- if (strncmp(uri, INGEN_NS, sizeof(INGEN_NS) - 1)) {
- return Graph::DEFAULT;
- } else if (!strcmp(suffix, "defaultContext")) {
- return Graph::DEFAULT;
- } else if (!strcmp(suffix, "externalContext")) {
+ static Graph uri_to_graph(const Raul::URI& uri) {
+ if (uri == INGEN_NS "externalContext") {
return Graph::EXTERNAL;
- } else if (!strcmp(suffix, "internalContext")) {
+ } else if (uri == INGEN_NS "internalContext") {
return Graph::INTERNAL;
- } else {
- return Graph::DEFAULT;
}
+ return Graph::DEFAULT;
}
virtual ~Resource() {}
diff --git a/ingen/Tee.hpp b/ingen/Tee.hpp
index 2cbd84d6..02596e03 100644
--- a/ingen/Tee.hpp
+++ b/ingen/Tee.hpp
@@ -66,13 +66,14 @@ public:
void put(const Raul::URI& uri,
const Properties& properties,
Resource::Graph ctx = Resource::Graph::DEFAULT) {
- BROADCAST(put, uri, properties);
+ BROADCAST(put, uri, properties, ctx);
}
void delta(const Raul::URI& uri,
const Properties& remove,
- const Properties& add) {
- BROADCAST(delta, uri, remove, add);
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT) {
+ BROADCAST(delta, uri, remove, add, ctx);
}
void copy(const Raul::URI& old_uri,
@@ -104,8 +105,9 @@ public:
void set_property(const Raul::URI& subject,
const Raul::URI& predicate,
- const Atom& value) {
- BROADCAST(set_property, subject, predicate, value);
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT) {
+ BROADCAST(set_property, subject, predicate, value, ctx);
}
void undo() { BROADCAST(undo); }
diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp
index 9bc21592..b05f6270 100644
--- a/ingen/URIs.hpp
+++ b/ingen/URIs.hpp
@@ -114,9 +114,11 @@ public:
const Quark ingen_canvasX;
const Quark ingen_canvasY;
const Quark ingen_enabled;
+ const Quark ingen_externalContext;
const Quark ingen_file;
const Quark ingen_head;
const Quark ingen_incidentTo;
+ const Quark ingen_internalContext;
const Quark ingen_loadedBundle;
const Quark ingen_maxRunLoad;
const Quark ingen_meanRunLoad;
@@ -186,6 +188,7 @@ public:
const Quark patch_Set;
const Quark patch_add;
const Quark patch_body;
+ const Quark patch_context;
const Quark patch_destination;
const Quark patch_property;
const Quark patch_remove;
diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp
index 84a95b7b..1887bed3 100644
--- a/ingen/client/ClientStore.hpp
+++ b/ingen/client/ClientStore.hpp
@@ -79,7 +79,8 @@ public:
void delta(const Raul::URI& uri,
const Properties& remove,
- const Properties& add);
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT);
void copy(const Raul::URI& old_uri,
const Raul::URI& new_uri);
@@ -89,7 +90,8 @@ public:
void set_property(const Raul::URI& subject_path,
const Raul::URI& predicate,
- const Atom& value);
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT);
void connect(const Raul::Path& tail,
const Raul::Path& head);
diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp
index d4d47e3b..c44cad82 100644
--- a/ingen/client/PluginUI.hpp
+++ b/ingen/client/PluginUI.hpp
@@ -78,7 +78,8 @@ public:
INGEN_SIGNAL(property_changed, void,
const Raul::URI&, // Subject
const Raul::URI&, // Predicate
- const Atom&); // Object
+ const Atom&, // Object
+ Resource::Graph); // Context
Ingen::World* world() const { return _world; }
SPtr<const BlockModel> block() const { return _block; }
diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp
index a65806f4..7e903fab 100644
--- a/ingen/client/SigClientInterface.hpp
+++ b/ingen/client/SigClientInterface.hpp
@@ -53,14 +53,14 @@ public:
INGEN_SIGNAL(bundle_end, void)
INGEN_SIGNAL(error, void, std::string)
INGEN_SIGNAL(put, void, Raul::URI, Properties, Resource::Graph)
- INGEN_SIGNAL(delta, void, Raul::URI, Properties, Properties)
+ 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(connection, void, Raul::Path, Raul::Path)
INGEN_SIGNAL(disconnection, void, Raul::Path, Raul::Path)
INGEN_SIGNAL(disconnect_all, void, Raul::Path, Raul::Path)
- INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Atom)
+ INGEN_SIGNAL(property_change, void, Raul::URI, Raul::URI, Atom, Resource::Graph)
/** Fire pending signals. Only does anything on derived classes (that may queue) */
virtual bool emit_signals() { return false; }
@@ -90,8 +90,9 @@ protected:
void delta(const Raul::URI& uri,
const Properties& remove,
- const Properties& add)
- { EMIT(delta, uri, remove, add); }
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
+ { EMIT(delta, uri, remove, add, ctx); }
void connect(const Raul::Path& tail, const Raul::Path& head)
{ EMIT(connection, tail, head); }
@@ -111,8 +112,11 @@ protected:
void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
{ EMIT(disconnect_all, graph, path); }
- void set_property(const Raul::URI& subject, const Raul::URI& key, const Atom& value)
- { EMIT(property_change, subject, key, value); }
+ void set_property(const Raul::URI& subject,
+ const Raul::URI& key,
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
+ { EMIT(property_change, subject, key, value, ctx); }
void undo() {}
void redo() {}
diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp
index db3aad44..219fd8d1 100644
--- a/ingen/client/ThreadedSigClientInterface.hpp
+++ b/ingen/client/ThreadedSigClientInterface.hpp
@@ -87,8 +87,9 @@ public:
void delta(const Raul::URI& path,
const Properties& remove,
- const Properties& add)
- { push_sig(sigc::bind(delta_slot, path, remove, add)); }
+ const Properties& add,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
+ { push_sig(sigc::bind(delta_slot, path, remove, add, ctx)); }
void connect(const Raul::Path& tail, const Raul::Path& head)
{ push_sig(sigc::bind(connection_slot, tail, head)); }
@@ -108,8 +109,11 @@ public:
void disconnect_all(const Raul::Path& graph, const Raul::Path& path)
{ push_sig(sigc::bind(disconnect_all_slot, graph, path)); }
- void set_property(const Raul::URI& subject, const Raul::URI& key, const Atom& value)
- { push_sig(sigc::bind(property_change_slot, subject, key, value)); }
+ void set_property(const Raul::URI& subject,
+ const Raul::URI& key,
+ const Atom& value,
+ Resource::Graph ctx = Resource::Graph::DEFAULT)
+ { push_sig(sigc::bind(property_change_slot, subject, key, value, ctx)); }
/** Process all queued events - Called from GTK thread to emit signals. */
bool emit_signals() {
@@ -149,22 +153,24 @@ private:
Raul::SRSWQueue<Closure> _sigs;
- typedef Resource::Graph Graph;
+ using Graph = Resource::Graph;
+ using Path = Raul::Path;
+ using URI = Raul::URI;
sigc::slot<void> bundle_begin_slot;
sigc::slot<void> bundle_end_slot;
sigc::slot<void, int32_t, Status, std::string> response_slot;
sigc::slot<void, std::string> error_slot;
- sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot;
- sigc::slot<void, Raul::URI, Properties, Graph> put_slot;
- sigc::slot<void, Raul::URI, Properties, Properties> delta_slot;
- sigc::slot<void, Raul::Path, Raul::Path> connection_slot;
- sigc::slot<void, Raul::URI> object_deleted_slot;
- sigc::slot<void, Raul::Path, Raul::Path> object_moved_slot;
- sigc::slot<void, Raul::URI, Raul::URI> object_copied_slot;
- sigc::slot<void, Raul::Path, Raul::Path> disconnection_slot;
- sigc::slot<void, Raul::Path, Raul::Path> disconnect_all_slot;
- sigc::slot<void, Raul::URI, Raul::URI, Atom> property_change_slot;
+ sigc::slot<void, URI, URI, Raul::Symbol> new_plugin_slot;
+ sigc::slot<void, URI, Properties, Graph> put_slot;
+ sigc::slot<void, URI, Properties, Properties, Graph> delta_slot;
+ sigc::slot<void, Path, Path> connection_slot;
+ sigc::slot<void, URI> object_deleted_slot;
+ sigc::slot<void, Path, Path> object_moved_slot;
+ sigc::slot<void, URI, URI> object_copied_slot;
+ sigc::slot<void, Path, Path> disconnection_slot;
+ sigc::slot<void, Path, Path> disconnect_all_slot;
+ sigc::slot<void, URI, URI, Atom, Graph> property_change_slot;
};
} // namespace Client
diff --git a/ingen/ingen.h b/ingen/ingen.h
index e3313e28..05b9e7b2 100644
--- a/ingen/ingen.h
+++ b/ingen/ingen.h
@@ -36,38 +36,40 @@
#define INGEN_NS "http://drobilla.net/ns/ingen#"
-#define INGEN__Arc INGEN_NS "Arc"
-#define INGEN__Block INGEN_NS "Block"
-#define INGEN__BundleEnd INGEN_NS "BundleEnd"
-#define INGEN__BundleStart INGEN_NS "BundleStart"
-#define INGEN__Graph INGEN_NS "Graph"
-#define INGEN__GraphPrototype INGEN_NS "GraphPrototype"
-#define INGEN__Internal INGEN_NS "Internal"
-#define INGEN__Node INGEN_NS "Node"
-#define INGEN__Plugin INGEN_NS "Plugin"
-#define INGEN__Redo INGEN_NS "Redo"
-#define INGEN__Undo INGEN_NS "Undo"
-#define INGEN__activity INGEN_NS "activity"
-#define INGEN__arc INGEN_NS "arc"
-#define INGEN__block INGEN_NS "block"
-#define INGEN__broadcast INGEN_NS "broadcast"
-#define INGEN__canvasX INGEN_NS "canvasX"
-#define INGEN__canvasY INGEN_NS "canvasY"
-#define INGEN__enabled INGEN_NS "enabled"
-#define INGEN__file INGEN_NS "file"
-#define INGEN__head INGEN_NS "head"
-#define INGEN__incidentTo INGEN_NS "incidentTo"
-#define INGEN__loadedBundle INGEN_NS "loadedBundle"
-#define INGEN__maxRunLoad INGEN_NS "maxRunLoad"
-#define INGEN__meanRunLoad INGEN_NS "meanRunLoad"
-#define INGEN__minRunLoad INGEN_NS "minRunLoad"
-#define INGEN__numThreads INGEN_NS "numThreads"
-#define INGEN__polyphonic INGEN_NS "polyphonic"
-#define INGEN__polyphony INGEN_NS "polyphony"
-#define INGEN__prototype INGEN_NS "prototype"
-#define INGEN__sprungLayout INGEN_NS "sprungLayout"
-#define INGEN__tail INGEN_NS "tail"
-#define INGEN__uiEmbedded INGEN_NS "uiEmbedded"
-#define INGEN__value INGEN_NS "value"
+#define INGEN__Arc INGEN_NS "Arc"
+#define INGEN__Block INGEN_NS "Block"
+#define INGEN__BundleEnd INGEN_NS "BundleEnd"
+#define INGEN__BundleStart INGEN_NS "BundleStart"
+#define INGEN__Graph INGEN_NS "Graph"
+#define INGEN__GraphPrototype INGEN_NS "GraphPrototype"
+#define INGEN__Internal INGEN_NS "Internal"
+#define INGEN__Node INGEN_NS "Node"
+#define INGEN__Plugin INGEN_NS "Plugin"
+#define INGEN__Redo INGEN_NS "Redo"
+#define INGEN__Undo INGEN_NS "Undo"
+#define INGEN__activity INGEN_NS "activity"
+#define INGEN__arc INGEN_NS "arc"
+#define INGEN__block INGEN_NS "block"
+#define INGEN__broadcast INGEN_NS "broadcast"
+#define INGEN__canvasX INGEN_NS "canvasX"
+#define INGEN__canvasY INGEN_NS "canvasY"
+#define INGEN__enabled INGEN_NS "enabled"
+#define INGEN__externalContext INGEN_NS "externalContext"
+#define INGEN__file INGEN_NS "file"
+#define INGEN__head INGEN_NS "head"
+#define INGEN__incidentTo INGEN_NS "incidentTo"
+#define INGEN__internalContext INGEN_NS "internalContext"
+#define INGEN__loadedBundle INGEN_NS "loadedBundle"
+#define INGEN__maxRunLoad INGEN_NS "maxRunLoad"
+#define INGEN__meanRunLoad INGEN_NS "meanRunLoad"
+#define INGEN__minRunLoad INGEN_NS "minRunLoad"
+#define INGEN__numThreads INGEN_NS "numThreads"
+#define INGEN__polyphonic INGEN_NS "polyphonic"
+#define INGEN__polyphony INGEN_NS "polyphony"
+#define INGEN__prototype INGEN_NS "prototype"
+#define INGEN__sprungLayout INGEN_NS "sprungLayout"
+#define INGEN__tail INGEN_NS "tail"
+#define INGEN__uiEmbedded INGEN_NS "uiEmbedded"
+#define INGEN__value INGEN_NS "value"
#endif // INGEN_H