From 17ad0ca1ad23b336b0fa5952f42dfad95397fc47 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 1 Aug 2016 15:44:14 -0400 Subject: Rename main graph and control/notify ports --- src/AtomWriter.cpp | 38 +++++++++++++++++++------------------- src/Parser.cpp | 2 +- src/Serialiser.cpp | 35 +++++++++++++++++------------------ src/gui/ConnectWindow.cpp | 2 +- src/gui/GraphCanvas.cpp | 8 ++++---- src/gui/ingen_gui_lv2.cpp | 4 ++-- src/ingen/ingen.cpp | 10 +++++----- src/server/LV2Plugin.cpp | 2 +- src/server/events/CreateGraph.cpp | 7 ++++--- src/server/events/Delete.cpp | 2 +- src/server/ingen_lv2.cpp | 6 +++--- 11 files changed, 58 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/AtomWriter.cpp b/src/AtomWriter.cpp index a0f2abba..584b17b7 100644 --- a/src/AtomWriter.cpp +++ b/src/AtomWriter.cpp @@ -157,7 +157,7 @@ AtomWriter::forge_request(LV2_Atom_Forge_Frame* frame, LV2_URID type) * @code{.ttl} * [] * a patch:Put ; - * patch:subject ; + * patch:subject ; * patch:body [ * a ingen:Block ; * lv2:prototype @@ -197,7 +197,7 @@ AtomWriter::put(const Raul::URI& uri, * @code{.ttl} * [] * a patch:Patch ; - * patch:subject ; + * patch:subject ; * patch:add [ * lv2:name "Osckillator" ; * ingen:canvasX 32.0 ; @@ -255,8 +255,8 @@ AtomWriter::delta(const Raul::URI& uri, * @code{.ttl} * [] * a patch:Copy ; - * patch:subject ; - * patch:destination . + * patch:subject ; + * patch:destination . * @endcode */ void @@ -285,8 +285,8 @@ AtomWriter::copy(const Raul::URI& old_uri, * @code{.ttl} * [] * a patch:Move ; - * patch:subject ; - * patch:destination . + * patch:subject ; + * patch:destination . * @endcode */ void @@ -315,7 +315,7 @@ AtomWriter::move(const Raul::Path& old_path, * @code{.ttl} * [] * a patch:Delete ; - * patch:subject . + * patch:subject . * @endcode */ void @@ -338,7 +338,7 @@ AtomWriter::del(const Raul::URI& uri) * @code{.ttl} * [] * a patch:Set ; - * patch:subject ; + * patch:subject ; * patch:property lv2:name ; * patch:value "Oscwellator" . * @endcode @@ -409,7 +409,7 @@ AtomWriter::redo() * @code{.ttl} * [] * a patch:Get ; - * patch:subject . + * patch:subject . * @endcode */ void @@ -438,11 +438,11 @@ AtomWriter::get(const Raul::URI& uri) * @code{.ttl} * [] * a patch:Put ; - * patch:subject ; + * patch:subject ; * patch:body [ * a ingen:Arc ; - * ingen:tail ; - * ingen:head ; + * ingen:tail ; + * ingen:head ; * ] . * @endcode */ @@ -471,8 +471,8 @@ AtomWriter::connect(const Raul::Path& tail, * a patch:Delete ; * patch:body [ * a ingen:Arc ; - * ingen:tail ; - * ingen:head ; + * ingen:tail ; + * ingen:head ; * ] . * @endcode */ @@ -501,10 +501,10 @@ AtomWriter::disconnect(const Raul::Path& tail, * @code{.ttl} * [] * a patch:Delete ; - * patch:subject ; + * patch:subject ; * patch:body [ * a ingen:Arc ; - * ingen:incidentTo + * ingen:incidentTo * ] . * @endcode */ @@ -545,7 +545,7 @@ AtomWriter::set_response_id(int32_t id) * [] * a patch:Get ; * patch:sequenceNumber 42 ; - * patch:subject . + * patch:subject . * @endcode * * Might receive a response like: @@ -553,7 +553,7 @@ AtomWriter::set_response_id(int32_t id) * [] * a patch:Response ; * patch:sequenceNumber 42 ; - * patch:subject ; + * patch:subject ; * patch:body 0 . * @endcode * @@ -563,7 +563,7 @@ AtomWriter::set_response_id(int32_t id) * * Note that a response is only a status response, operations that manipulate * the graph may generate new data on the stream, e.g. the above get request - * would also receive a put that describes /graph/osc in the stream immediately + * would also receive a put that describes /main/osc in the stream immediately * following the response. */ void diff --git a/src/Parser.cpp b/src/Parser.cpp index 31ab4245..5f9ae6e1 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -312,7 +312,7 @@ parse_block(Ingen::World* world, &ignored); const std::string sub_uri_str = (const char*)sub_uri.buf; - const std::string sub_file = sub_uri_str + "/graph.ttl"; + const std::string sub_file = sub_uri_str + "/main.ttl"; const SerdNode sub_base = serd_node_from_string( SERD_URI, (const uint8_t*)sub_file.c_str()); diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp index ea090f8c..ed1a5504 100644 --- a/src/Serialiser.cpp +++ b/src/Serialiser.cpp @@ -68,7 +68,7 @@ struct Serialiser::Impl { enum class Mode { TO_FILE, TO_STRING }; - void start_to_filename(const std::string& filename); + void start_to_file(const Raul::Path& root, const std::string& filename); std::set serialise_graph(SPtr p, const Sord::Node& id); @@ -125,12 +125,12 @@ Serialiser::Impl::write_manifest(const std::string& bundle_path, const string manifest_path(Glib::build_filename(bundle_path, "manifest.ttl")); const string binary_path(Glib::Module::build_path("", "ingen_lv2")); - start_to_filename(manifest_path); + start_to_file(Raul::Path("/"), manifest_path); Sord::World& world = _model->world(); const URIs& uris = _world.uris(); - const string filename("graph.ttl"); + const string filename("main.ttl"); const Sord::URI subject(world, filename, _base_uri); _model->add_statement(subject, @@ -155,7 +155,7 @@ Serialiser::Impl::write_plugins(const std::string& bundle_path, { const string plugins_path(Glib::build_filename(bundle_path, "plugins.ttl")); - start_to_filename(plugins_path); + start_to_file(Raul::Path("/"), plugins_path); Sord::World& world = _model->world(); const URIs& uris = _world.uris(); @@ -200,25 +200,24 @@ Serialiser::Impl::write_bundle(SPtr graph, _world.log().info(fmt("Writing bundle %1%\n") % path); - if (path[path.length() - 1] != '/') + if (path.back() != '/') path.append("/"); g_mkdir_with_parents(path.c_str(), 0744); - const string root_file = Glib::build_filename(path, "graph.ttl"); - - start_to_filename(root_file); + const string main_file = Glib::build_filename(path, "main.ttl"); const Raul::Path old_root_path = _root_path; - _root_path = graph->path(); + + start_to_file(graph->path(), main_file); std::set plugins = serialise_graph( - graph, Sord::URI(_model->world(), root_file, _base_uri)); + graph, Sord::URI(_model->world(), main_file, _base_uri)); - _root_path = old_root_path; finish(); - write_manifest(path, graph); write_plugins(path, plugins); + + _root_path = old_root_path; } /** Begin a serialization to a file. @@ -226,7 +225,7 @@ Serialiser::Impl::write_bundle(SPtr graph, * This must be called before any serializing methods. */ void -Serialiser::Impl::start_to_filename(const string& filename) +Serialiser::Impl::start_to_file(const Raul::Path& root, const string& filename) { assert(filename.find(":") == string::npos || filename.substr(0, 5) == "file:"); if (filename.find(":") == string::npos) { @@ -235,8 +234,9 @@ Serialiser::Impl::start_to_filename(const string& filename) _base_uri = filename; } - _model = new Sord::Model(*_world.rdf_world(), _base_uri); - _mode = Mode::TO_FILE; + _model = new Sord::Model(*_world.rdf_world(), _base_uri); + _mode = Mode::TO_FILE; + _root_path = root; } void @@ -251,8 +251,7 @@ Serialiser::start_to_string(const Raul::Path& root, const string& base_uri) void Serialiser::start_to_file(const Raul::Path& root, const string& filename) { - me->_root_path = root; - me->start_to_filename(filename); + me->start_to_file(root, filename); } std::string @@ -559,7 +558,7 @@ Serialiser::Impl::serialise_properties(Sord::Node id, const Sord::URI key(_model->world(), p.first); if (!skip_property(_world.uris(), key)) { if (p.second.type() == _world.uris().atom_URI && - !strncmp((const char*)p.second.get_body(), "ingen:/graph/", 13)) { + !strncmp((const char*)p.second.get_body(), "ingen:/main/", 13)) { /* Value is a graph URI relative to the running engine. Chop the prefix and save the path relative to the graph file. This allows saving references to bundle resources. */ diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 9b735dd9..3078ff05 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -505,7 +505,7 @@ ConnectWindow::gtk_callback() } } } else if (_connect_stage == 3) { - _app->interface()->get(Raul::URI(Node::root_graph_uri() + "/")); + _app->interface()->get(Raul::URI(Node::main_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 df950eb7..ea989c36 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -565,8 +565,8 @@ destroy_node(GanvNode* node, void* data) } else { GraphPortModule* port_module = dynamic_cast(module); if (port_module && - strcmp(port_module->port()->path().symbol(), "control_in") && - strcmp(port_module->port()->path().symbol(), "control_out")) { + strcmp(port_module->port()->path().symbol(), "control") && + strcmp(port_module->port()->path().symbol(), "notify")) { app->interface()->del(port_module->port()->uri()); } } @@ -667,12 +667,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_graph_uri(), + clipboard.put(Node::main_uri(), {{uris.rdf_type, Resource::Property(uris.ingen_Graph)}}); // Parse clipboard text into clipboard store boost::optional base_uri = parser->parse_string( - _app.world(), &clipboard, str, Node::root_graph_uri()); + _app.world(), &clipboard, str, Node::main_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 6d1dfdba..682df7a1 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -147,7 +147,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_graph_uri(), props); + ui->app->store()->put(Ingen::Node::main_uri(), props); // Create a GraphBox for the root and set as the UI widget SPtr root = @@ -158,7 +158,7 @@ instantiate(const LV2UI_Descriptor* descriptor, *widget = ui->view->gobj(); // Request the actual root graph - ui->world->interface()->get(Ingen::Node::root_graph_uri()); + ui->world->interface()->get(Ingen::Node::main_uri()); return ui; } diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index b5605197..a6ba7f41 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(); engine_interface->get(Raul::URI("ingen:/plugins")); - engine_interface->get(Node::root_graph_uri()); + engine_interface->get(Node::main_uri()); std::lock_guard lock(world->rdf_mutex()); world->parser()->parse_file( @@ -185,14 +185,14 @@ main(int argc, char** argv) const char* path = conf.option("server-load").ptr(); if (serd_uri_string_has_scheme((const uint8_t*)path)) { std::cout << "Loading " << path << " (server side)" << std::endl; - engine_interface->copy(Raul::URI(path), Node::root_graph_uri()); + engine_interface->copy(Raul::URI(path), Node::main_uri()); } else { SerdNode uri = serd_node_new_file_uri( (const uint8_t*)path, NULL, NULL, true); std::cout << "Loading " << (const char*)uri.buf << " (server side)" << std::endl; engine_interface->copy(Raul::URI((const char*)uri.buf), - Node::root_graph_uri()); + Node::main_uri()); serd_node_free(&uri); } } @@ -202,12 +202,12 @@ main(int argc, char** argv) const char* path = conf.option("save").ptr(); if (serd_uri_string_has_scheme((const uint8_t*)path)) { std::cout << "Saving to " << path << std::endl; - engine_interface->copy(Node::root_graph_uri(), Raul::URI(path)); + engine_interface->copy(Node::main_uri(), Raul::URI(path)); } else { SerdNode uri = serd_node_new_file_uri( (const uint8_t*)path, NULL, NULL, true); std::cout << "Saving to " << (const char*)uri.buf << std::endl; - engine_interface->copy(Node::root_graph_uri(), + engine_interface->copy(Node::main_uri(), Raul::URI((const char*)uri.buf)); serd_node_free(&uri); } diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp index ce920f4e..9450373f 100644 --- a/src/server/LV2Plugin.cpp +++ b/src/server/LV2Plugin.cpp @@ -69,7 +69,7 @@ const Raul::Symbol LV2Plugin::symbol() const { string working = uri(); - if (working[working.length() - 1] == '/') + if (working.back() == '/') working = working.substr(0, working.length() - 1); while (working.length() > 0) { diff --git a/src/server/events/CreateGraph.cpp b/src/server/events/CreateGraph.cpp index d14e2f1f..b5cffcb0 100644 --- a/src/server/events/CreateGraph.cpp +++ b/src/server/events/CreateGraph.cpp @@ -51,7 +51,6 @@ CreateGraph::build_child_events() // Properties common to both ports Resource::Properties control_properties; - control_properties.put(uris.lv2_name, uris.forge.alloc("Control")); control_properties.put(uris.rdf_type, uris.atom_AtomPort); control_properties.put(uris.atom_bufferType, uris.atom_Sequence); control_properties.put(uris.atom_supports, uris.patch_Message); @@ -60,6 +59,7 @@ CreateGraph::build_child_events() // Add control input Resource::Properties in_properties(control_properties); + in_properties.put(uris.lv2_name, uris.forge.alloc("Control")); in_properties.put(uris.rdf_type, uris.lv2_InputPort); in_properties.put(uris.lv2_index, uris.forge.make(0)); in_properties.put(uris.ingen_canvasX, uris.forge.make(32.0f), @@ -71,11 +71,12 @@ CreateGraph::build_child_events() SPtr( new Events::CreatePort( _engine, _request_client, -1, _time, - _path.child(Raul::Symbol("control_in")), + _path.child(Raul::Symbol("control")), in_properties))); // Add control out Resource::Properties out_properties(control_properties); + out_properties.put(uris.lv2_name, uris.forge.alloc("Notify")); out_properties.put(uris.rdf_type, uris.lv2_OutputPort); out_properties.put(uris.lv2_index, uris.forge.make(1)); out_properties.put(uris.ingen_canvasX, uris.forge.make(128.0f), @@ -86,7 +87,7 @@ CreateGraph::build_child_events() _child_events.push_back( SPtr( new Events::CreatePort(_engine, _request_client, -1, _time, - _path.child(Raul::Symbol("control_out")), + _path.child(Raul::Symbol("notify")), out_properties))); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 7b27e11f..915c56fc 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -59,7 +59,7 @@ Delete::~Delete() bool Delete::pre_process() { - if (_path.is_root() || _path == "/control_in" || _path == "/control_out") { + if (_path.is_root() || _path == "/control" || _path == "/notify") { return Event::pre_process_done(Status::NOT_DELETABLE, _path); } diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index 217833bc..dbbc8a55 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -127,7 +127,7 @@ public: graph_port->set_driver_buffer(lv2_buf, nframes * sizeof(float)); } else if (graph_port->buffer_type() == uris.atom_Sequence) { graph_port->set_driver_buffer(lv2_buf, lv2_atom_total_size((LV2_Atom*)lv2_buf)); - if (graph_port->symbol() == "control_in") { // TODO: Safe to use index? + if (graph_port->symbol() == "control") { // TODO: Safe to use index? LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)lv2_buf; bool enqueued = false; LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { @@ -687,7 +687,7 @@ ingen_save(LV2_Handle instance, LV2_URID atom_Path = plugin->map->map(plugin->map->handle, LV2_ATOM__Path); - char* real_path = make_path->path(make_path->handle, "graph.ttl"); + char* real_path = make_path->path(make_path->handle, "main.ttl"); char* state_path = map_path->abstract_path(map_path->handle, real_path); Ingen::Store::iterator root = plugin->world->store()->find(Raul::Path("/")); @@ -755,7 +755,7 @@ ingen_restore(LV2_Handle instance, const uint32_t n_ports = engine->root_graph()->num_ports_non_rt(); for (int32_t i = n_ports - 1; i >= 0; --i) { PortImpl* port = engine->root_graph()->port_impl(i); - if (port->symbol() != "control_in" && port->symbol() != "control_out") { + if (port->symbol() != "control" && port->symbol() != "notify") { plugin->world->interface()->del(port->uri()); } } -- cgit v1.2.1