summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-05-25 09:12:44 +0000
committerDavid Robillard <d@drobilla.net>2015-05-25 09:12:44 +0000
commitccb7d738d37fb21245a563cd41727f2609f0bc07 (patch)
treef13f750311b3b768b87b6dd64b47cd82584a6262 /src
parent4f00b8a2ae7148b3a13fd6af0e79eb9b6abf5634 (diff)
downloadingen-ccb7d738d37fb21245a563cd41727f2609f0bc07.tar.gz
ingen-ccb7d738d37fb21245a563cd41727f2609f0bc07.tar.bz2
ingen-ccb7d738d37fb21245a563cd41727f2609f0bc07.zip
Use ingen:/ as base URI on the wire.
This allows referring to non-graph items, which are converted to bundle-relative URIs on save, resolving issue #1049. Change root graph URI to ingen:/graph. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5687 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/Configuration.cpp1
-rw-r--r--src/Serialiser.cpp20
-rw-r--r--src/SocketReader.cpp5
-rw-r--r--src/SocketWriter.cpp4
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/GraphCanvas.cpp4
-rw-r--r--src/gui/ingen_gui_lv2.cpp4
-rw-r--r--src/ingen/ingen.cpp2
-rw-r--r--src/server/events/Copy.cpp2
9 files changed, 28 insertions, 16 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index f2d47674..a2d70dc4 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -59,6 +59,7 @@ Configuration::Configuration(Forge& forge)
add("jackServer", "jack-server", 's', "JACK server name", GLOBAL, forge.String, forge.alloc(""));
add("uuid", "uuid", 'u', "JACK session UUID", SESSION, forge.String, Atom());
add("load", "load", 'l', "Load graph", SESSION, forge.String, Atom());
+ add("execute", "execute", 'x', "File of commands to execute", SESSION, forge.String, Atom());
add("path", "path", 'L', "Target path for loaded graph", SESSION, forge.String, Atom());
add("queueSize", "queue-size", 'q', "Event queue size", GLOBAL, forge.Int, forge.make(4096));
add("humanNames", "human-names", 0, "Show human names in GUI", GUI, forge.Bool, forge.make(true));
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index d5e54f3d..4ef8eaed 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -516,10 +516,22 @@ Serialiser::Impl::serialise_properties(Sord::Node id,
for (const auto& p : props) {
const Sord::URI key(_model->world(), p.first);
if (!skip_property(_world.uris(), key)) {
- sratom_write(_sratom, unmap, 0,
- sord_node_to_serd_node(id.c_obj()),
- sord_node_to_serd_node(key.c_obj()),
- p.second.type(), p.second.size(), p.second.get_body());
+ if (p.second.type() == _world.uris().atom_URI &&
+ !strncmp((const char*)p.second.get_body(), "ingen:/", 7)) {
+ /* Value is an ingen:/ URI, relative to the running engine.
+ Chop the prefix and save the path relative to the bundle.
+ This allows saving references to bundle resources. */
+ sratom_write(_sratom, unmap, 0,
+ sord_node_to_serd_node(id.c_obj()),
+ sord_node_to_serd_node(key.c_obj()),
+ p.second.type(), p.second.size(),
+ (const char*)p.second.get_body() + 7);
+ } else {
+ sratom_write(_sratom, unmap, 0,
+ sord_node_to_serd_node(id.c_obj()),
+ sord_node_to_serd_node(key.c_obj()),
+ p.second.type(), p.second.size(), p.second.get_body());
+ }
}
}
diff --git a/src/SocketReader.cpp b/src/SocketReader.cpp
index 85f55f08..d57cda29 100644
--- a/src/SocketReader.cpp
+++ b/src/SocketReader.cpp
@@ -113,9 +113,8 @@ SocketReader::run()
// Lock RDF world
std::lock_guard<std::mutex> lock(_world.rdf_mutex());
- // Use <ingen:/root/> as base URI so e.g. </foo/bar> will be a path
- base_uri = sord_new_uri(
- world->c_obj(), (const uint8_t*)"ingen:/root/");
+ // Use <ingen:/> as base URI, so relative URIs are like bundle paths
+ base_uri = sord_new_uri(world->c_obj(), (const uint8_t*)"ingen:/");
// Make a model and reader to parse the next Turtle message
_env = world->prefixes().c_obj();
diff --git a/src/SocketWriter.cpp b/src/SocketWriter.cpp
index 4d9e7405..23c28394 100644
--- a/src/SocketWriter.cpp
+++ b/src/SocketWriter.cpp
@@ -48,8 +48,8 @@ SocketWriter::SocketWriter(URIMap& map,
, _uri(uri)
, _socket(sock)
{
- // Use <ingen:/root/> as base URI so e.g. </foo/bar> will be a path
- _base = serd_node_from_string(SERD_URI, (const uint8_t*)"ingen:/root/");
+ // Use <ingen:/> as base URI, so relative URIs are like bundle paths
+ _base = serd_node_from_string(SERD_URI, (const uint8_t*)"ingen:/");
serd_uri_parse(_base.buf, &_base_uri);
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 6555ce35..cb3012c3 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -482,7 +482,7 @@ ConnectWindow::gtk_callback()
}
}
} else if (_connect_stage == 3) {
- _app->interface()->get(Raul::URI(Node::root_uri() + "/"));
+ _app->interface()->get(Raul::URI(Node::root_graph_uri() + "/"));
next_stage();
} else if (_connect_stage == 4) {
if (_app->store()->size() > 0) {
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 0725aa67..9987e0b8 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -635,12 +635,12 @@ GraphCanvas::paste()
// Make a client store to serve as clipboard
ClientStore clipboard(_app.world()->uris(), _app.log());
clipboard.set_plugins(_app.store()->plugins());
- clipboard.put(Node::root_uri(),
+ clipboard.put(Node::root_graph_uri(),
{{uris.rdf_type, Resource::Property(uris.ingen_Graph)}});
// Parse clipboard text into clipboard store
boost::optional<Raul::URI> base_uri = parser->parse_string(
- _app.world(), &clipboard, str, Node::root_uri());
+ _app.world(), &clipboard, str, Node::root_graph_uri());
// Figure out the copy graph base path
Raul::Path copy_root("/");
diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp
index 386f30c0..c81d48a0 100644
--- a/src/gui/ingen_gui_lv2.cpp
+++ b/src/gui/ingen_gui_lv2.cpp
@@ -148,7 +148,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
props.insert(std::make_pair(ui->app->uris().rdf_type,
Ingen::Resource::Property(
ui->app->uris().ingen_Graph)));
- ui->app->store()->put(Ingen::Node::root_uri(), props);
+ ui->app->store()->put(Ingen::Node::root_graph_uri(), props);
// Create a GraphBox for the root and set as the UI widget
SPtr<const Ingen::Client::GraphModel> root =
@@ -159,7 +159,7 @@ instantiate(const LV2UI_Descriptor* descriptor,
*widget = ui->view->gobj();
// Request the actual root graph
- ui->world->interface()->get(Ingen::Node::root_uri());
+ ui->world->interface()->get(Ingen::Node::root_graph_uri());
return ui;
}
diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp
index 357f42b5..24cfb029 100644
--- a/src/ingen/ingen.cpp
+++ b/src/ingen/ingen.cpp
@@ -176,7 +176,7 @@ main(int argc, char** argv)
const string graph = conf.option("load").ptr<char>();
engine_interface->get(Raul::URI("ingen:/plugins"));
- engine_interface->get(Node::root_uri());
+ engine_interface->get(Node::root_graph_uri());
std::lock_guard<std::mutex> lock(world->rdf_mutex());
world->parser()->parse_file(
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index 92d3b3ec..14009163 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -48,7 +48,7 @@ Copy::pre_process()
{
if (_old_path.empty() ||
!Node::uri_is_path(_new_uri) ||
- _new_uri == Node::root_uri()) {
+ _new_uri == Node::root_graph_uri()) {
return Event::pre_process_done(Status::BAD_REQUEST);
}