diff options
author | David Robillard <d@drobilla.net> | 2018-01-21 00:41:34 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-01-21 00:56:50 +0100 |
commit | 44f7ad5222d824d81dc743045d5887418847e74e (patch) | |
tree | 1b41535ac00b8b225a25dba2873b064cb074bfa9 /src/gui | |
parent | 90fca083052880479ad90d870e556f0648e32106 (diff) | |
download | ingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.gz ingen-44f7ad5222d824d81dc743045d5887418847e74e.tar.bz2 ingen-44f7ad5222d824d81dc743045d5887418847e74e.zip |
Add URI class and remove use of Raul::URI
Diffstat (limited to 'src/gui')
34 files changed, 174 insertions, 173 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 1473320b..a8128d8d 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -177,7 +177,7 @@ App::attach(SPtr<SigClientInterface> client) if (_world->conf().option("dump").get<int32_t>()) { _dumper = SPtr<StreamWriter>(new StreamWriter(_world->uri_map(), _world->uris(), - Raul::URI("ingen:/client"), + URI("ingen:/client"), stderr, ColorContext::Color::CYAN)); @@ -207,7 +207,7 @@ void App::request_plugins_if_necessary() { if (!_requested_plugins) { - _world->interface()->get(Raul::URI("ingen:/plugins")); + _world->interface()->get(URI("ingen:/plugins")); _requested_plugins = true; } } @@ -251,10 +251,10 @@ App::error_message(const std::string& str) } void -App::set_property(const Raul::URI& subject, - const Raul::URI& key, - const Atom& value, - Resource::Graph ctx) +App::set_property(const URI& subject, + const URI& key, + const Atom& value, + Resource::Graph ctx) { // Send message to server interface()->set_property(subject, key, value, ctx); @@ -278,7 +278,7 @@ App::set_tooltip(Gtk::Widget* widget, const LilvNode* node) } void -App::put(const Raul::URI& uri, +App::put(const URI& uri, const Properties& properties, Resource::Graph ctx) { @@ -292,12 +292,12 @@ App::put(const Raul::URI& uri, } void -App::property_change(const Raul::URI& subject, - const Raul::URI& key, - const Atom& value, - Resource::Graph ctx) +App::property_change(const URI& subject, + const URI& key, + const Atom& value, + Resource::Graph ctx) { - if (subject != Raul::URI("ingen:/engine")) { + if (subject != URI("ingen:/engine")) { return; } else if (key == uris().param_sampleRate && value.type() == forge().Int) { _sample_rate = value.get<int32_t>(); diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 22451846..573925e6 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -33,7 +33,6 @@ #include "ingen/types.hpp" #include "lilv/lilv.h" #include "raul/Deletable.hpp" -#include "raul/URI.hpp" namespace Ingen { @@ -100,10 +99,10 @@ public: return old; } - void set_property(const Raul::URI& subject, - const Raul::URI& key, - const Atom& value, - Resource::Graph ctx = Resource::Graph::DEFAULT); + void set_property(const URI& subject, + const URI& key, + const Atom& value, + Resource::Graph ctx = Resource::Graph::DEFAULT); /** Set the tooltip for a widget from its RDF documentation. */ void set_tooltip(Gtk::Widget* widget, const LilvNode* node); @@ -147,14 +146,14 @@ protected: bool animate(); void response(int32_t id, Ingen::Status status, const std::string& subject); - void put(const Raul::URI& uri, + void put(const URI& uri, const Properties& properties, Resource::Graph ctx); - void property_change(const Raul::URI& subject, - const Raul::URI& key, - const Atom& value, - Resource::Graph ctx = Resource::Graph::DEFAULT); + void property_change(const URI& subject, + const URI& key, + const Atom& value, + Resource::Graph ctx = Resource::Graph::DEFAULT); static Gtk::Main* _main; diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 693b81e1..3f69e998 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -200,7 +200,7 @@ BreadCrumbs::message(const Message& msg) } void -BreadCrumbs::object_destroyed(const Raul::URI& uri) +BreadCrumbs::object_destroyed(const URI& uri) { 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 22bbd7af..467d3bfc 100644 --- a/src/gui/BreadCrumbs.hpp +++ b/src/gui/BreadCrumbs.hpp @@ -104,7 +104,7 @@ private: void breadcrumb_clicked(BreadCrumb* crumb); void message(const Message& msg); - void object_destroyed(const Raul::URI& uri); + void object_destroyed(const URI& uri); void object_moved(const Raul::Path& old_path, const Raul::Path& new_path); Raul::Path _active_path; diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 7cacb498..8f235264 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -141,7 +141,7 @@ ConnectWindow::set_connected_to(SPtr<Ingen::Interface> engine) _progress_bar->set_fraction(1.0); _progress_label->set_text("Connected to engine"); _url_entry->set_sensitive(false); - _url_entry->set_text(engine->uri()); + _url_entry->set_text(engine->uri().string()); _connect_button->set_sensitive(false); _disconnect_button->set_label("gtk-disconnect"); _disconnect_button->set_sensitive(true); @@ -190,7 +190,7 @@ ConnectWindow::set_connecting_widget_states() } bool -ConnectWindow::connect_remote(const Raul::URI& uri) +ConnectWindow::connect_remote(const URI& uri) { Ingen::World* world = _app->world(); @@ -241,12 +241,12 @@ ConnectWindow::connect(bool existing) uri_str = _url_entry->get_text(); } - if (!Raul::URI::is_valid(uri_str)) { + if (!URI::is_valid(uri_str)) { error((fmt("Invalid socket URI %1%") % uri_str).str()); return; } - _connect_uri = Raul::URI(uri_str); + _connect_uri = URI(uri_str); } else if (_mode == Mode::LAUNCH_REMOTE) { const std::string port = std::to_string(_port_spinbutton->get_value_as_int()); @@ -257,7 +257,7 @@ ConnectWindow::connect(bool existing) return; } - _connect_uri = Raul::URI(std::string("tcp://localhost:") + port); + _connect_uri = URI(std::string("tcp://localhost:") + port); } else if (_mode == Mode::INTERNAL) { if (!world->engine()) { @@ -310,7 +310,7 @@ ConnectWindow::activate() return; } - _app->interface()->set_property(Raul::URI("ingen:/driver"), + _app->interface()->set_property(URI("ingen:/driver"), _app->uris().ingen_enabled, _app->forge().make(true)); } @@ -322,7 +322,7 @@ ConnectWindow::deactivate() return; } - _app->interface()->set_property(Raul::URI("ingen:/driver"), + _app->interface()->set_property(URI("ingen:/driver"), _app->uris().ingen_enabled, _app->forge().make(false)); } @@ -376,8 +376,8 @@ ConnectWindow::load_widgets() sigc::mem_fun(this, &ConnectWindow::quit_clicked)); _url_entry->set_text(_app->world()->conf().option("connect").ptr<char>()); - if (Raul::URI::is_valid(_url_entry->get_text())) { - _connect_uri = Raul::URI(_url_entry->get_text()); + if (URI::is_valid(_url_entry->get_text())) { + _connect_uri = URI(_url_entry->get_text()); } _port_spinbutton->set_range(1, std::numeric_limits<uint16_t>::max()); @@ -499,7 +499,7 @@ ConnectWindow::gtk_callback() _ping_id = g_random_int_range(1, std::numeric_limits<int32_t>::max()); _app->interface()->set_response_id(_ping_id); - _app->interface()->get(Raul::URI("ingen:/engine")); + _app->interface()->get(URI("ingen:/engine")); last = now; attempts = 0; next_stage(); @@ -515,13 +515,13 @@ ConnectWindow::gtk_callback() _connect_stage = -1; } else if (ms_since_last > 1000) { _app->interface()->set_response_id(_ping_id); - _app->interface()->get(Raul::URI("ingen:/engine")); + _app->interface()->get(URI("ingen:/engine")); last = now; ++attempts; } } } else if (_connect_stage == 3) { - _app->interface()->get(Raul::URI(main_uri() + "/")); + _app->interface()->get(URI(main_uri().string() + "/")); next_stage(); } else if (_connect_stage == 4) { if (_app->store()->size() > 0) { diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 015a6e76..08560361 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -70,7 +70,7 @@ private: void disconnect(); void next_stage(); - bool connect_remote(const Raul::URI& uri); + bool connect_remote(const URI& uri); void connect(bool existing); void activate(); void deactivate(); @@ -101,7 +101,7 @@ private: Gtk::Button* _quit_button; Mode _mode; - Raul::URI _connect_uri; + URI _connect_uri; int32_t _ping_id; bool _attached; bool _finished_connecting; diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index def101a7..6f9969be 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -216,7 +216,7 @@ GraphBox::init_box(App& app) { _app = &app; - const Raul::URI engine_uri(_app->interface()->uri()); + const URI engine_uri(_app->interface()->uri()); if (engine_uri == "ingen:/clients/event_writer") { _status_bar->push("Running internal engine", STATUS_CONTEXT_ENGINE); } else { @@ -381,7 +381,7 @@ GraphBox::graph_port_removed(SPtr<const PortModel> port) } void -GraphBox::property_changed(const Raul::URI& predicate, const Atom& value) +GraphBox::property_changed(const URI& predicate, const Atom& value) { if (predicate == _app->uris().ingen_sprungLayout) { if (value.type() == _app->uris().forge.Bool) { @@ -506,7 +506,7 @@ GraphBox::event_save() if (!document.is_valid() || document.type() != _app->uris().forge.URI) { event_save_as(); } else { - save_graph(Raul::URI(document.ptr<char>())); + save_graph(URI(document.ptr<char>())); } } @@ -537,9 +537,9 @@ GraphBox::confirm(const Glib::ustring& message, } void -GraphBox::save_graph(const Raul::URI& uri) +GraphBox::save_graph(const URI& uri) { - if (_app->interface()->uri().substr(0, 3) == "tcp") { + if (_app->interface()->uri().string().substr(0, 3) == "tcp") { _status_bar->push( (boost::format("Saved %1% to %2% on client") % _graph->path() % uri).str(), @@ -642,7 +642,7 @@ GraphBox::event_save_as() if (confirmed) { const Glib::ustring uri = Glib::filename_to_uri(filename); - save_graph(Raul::URI(uri)); + save_graph(URI(uri)); const_cast<GraphModel*>(_graph.get())->set_property( uris.ingen_file, @@ -876,7 +876,7 @@ void GraphBox::event_animate_signals_toggled() { _app->interface()->set_property( - Raul::URI("ingen:/clients/this"), + URI("ingen:/clients/this"), _app->uris().ingen_broadcast, _app->forge().make((bool)_menu_animate_signals->get_active())); } diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index ee054e17..fd9bf9c0 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -40,6 +40,8 @@ class Path; namespace Ingen { +class URI; + namespace Client { class GraphModel; class PortModel; @@ -97,7 +99,7 @@ public: private: void graph_port_added(SPtr<const Client::PortModel> port); void graph_port_removed(SPtr<const Client::PortModel> port); - void property_changed(const Raul::URI& predicate, const Atom& value); + void property_changed(const URI& predicate, const Atom& value); void show_status(const Client::ObjectModel* model); void error(const Glib::ustring& message, @@ -106,7 +108,7 @@ private: bool confirm(const Glib::ustring& message, const Glib::ustring& secondary_text=""); - void save_graph(const Raul::URI& uri); + void save_graph(const URI& uri); void event_import(); void event_save(); diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 4c7c34c8..a17915a5 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -320,7 +320,7 @@ GraphCanvas::add_plugin(SPtr<PluginModel> p) } void -GraphCanvas::remove_plugin(const Raul::URI& uri) +GraphCanvas::remove_plugin(const URI& uri) { // Flag menus as dirty so they will be rebuilt when needed next _menu_dirty = true; @@ -683,7 +683,7 @@ GraphCanvas::paste() {{uris.rdf_type, Property(uris.ingen_Graph)}}); // Parse clipboard text into clipboard store - boost::optional<Raul::URI> base_uri = parser->parse_string( + boost::optional<URI> base_uri = parser->parse_string( _app.world(), &clipboard, str, main_uri()); // Figure out the copy graph base path @@ -693,7 +693,7 @@ GraphCanvas::paste() if (base[base.size() - 1] == '/') { base = base.substr(0, base.size() - 1); } - copy_root = uri_to_path(Raul::URI(base)); + copy_root = uri_to_path(URI(base)); } // Find the minimum x and y coordinate of objects to be pasted @@ -730,7 +730,7 @@ GraphCanvas::paste() const SPtr<Node> node = c.second; const Raul::Path& old_path = copy_root.child(node->path()); - const Raul::URI& old_uri = path_to_uri(old_path); + const URI& old_uri = path_to_uri(old_path); const Raul::Path& new_path = avoider.map_path(parent.child(node->path())); Properties props{{uris.lv2_prototype, @@ -793,8 +793,10 @@ GraphCanvas::generate_port_name( } void -GraphCanvas::menu_add_port(const string& sym_base, const string& name_base, - const Raul::URI& type, bool is_output) +GraphCanvas::menu_add_port(const string& sym_base, + const string& name_base, + const URI& type, + bool is_output) { string sym, name; generate_port_name(sym_base, sym, name_base, name); diff --git a/src/gui/GraphCanvas.hpp b/src/gui/GraphCanvas.hpp index f283354e..a7340744 100644 --- a/src/gui/GraphCanvas.hpp +++ b/src/gui/GraphCanvas.hpp @@ -63,7 +63,7 @@ public: bool show_port_names() const { return _show_port_names; } void add_plugin(SPtr<Client::PluginModel> p); - void remove_plugin(const Raul::URI& uri); + void remove_plugin(const URI& uri); void add_block(SPtr<const Client::BlockModel> bm); void remove_block(SPtr<const Client::BlockModel> bm); void add_port(SPtr<const Client::PortModel> pm); @@ -90,7 +90,7 @@ private: void menu_add_port(const std::string& sym_base, const std::string& name_base, - const Raul::URI& type, + const URI& type, bool is_output); void menu_load_plugin(); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 7dc24a20..5987b0e3 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -130,7 +130,7 @@ GraphPortModule::set_name(const std::string& n) } void -GraphPortModule::property_changed(const Raul::URI& key, const Atom& value) +GraphPortModule::property_changed(const URI& key, const Atom& value) { const URIs& uris = app().uris(); if (value.type() == uris.forge.Float) { diff --git a/src/gui/GraphPortModule.hpp b/src/gui/GraphPortModule.hpp index 79229be6..97bc2e5b 100644 --- a/src/gui/GraphPortModule.hpp +++ b/src/gui/GraphPortModule.hpp @@ -20,7 +20,6 @@ #include <string> #include "ganv/Module.hpp" -#include "raul/URI.hpp" #include "Port.hpp" @@ -68,7 +67,7 @@ protected: void set_port(Port* port) { _port = port; } - void property_changed(const Raul::URI& key, const Atom& value); + void property_changed(const URI& key, const Atom& value); SPtr<const Client::PortModel> _model; Port* _port; diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index e5522a74..1eb6557b 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -88,7 +88,7 @@ GraphTreeWindow::add_graph(SPtr<GraphModel> pm) Gtk::TreeModel::iterator iter = _graph_treestore->append(); Gtk::TreeModel::Row row = *iter; if (pm->path().is_root()) { - row[_graph_tree_columns.name_col] = _app->interface()->uri(); + row[_graph_tree_columns.name_col] = _app->interface()->uri().string(); } else { row[_graph_tree_columns.name_col] = pm->symbol().c_str(); } @@ -193,7 +193,7 @@ GraphTreeWindow::event_graph_enabled_toggled(const Glib::ustring& path_str) } void -GraphTreeWindow::graph_property_changed(const Raul::URI& key, +GraphTreeWindow::graph_property_changed(const URI& key, const Atom& value, SPtr<GraphModel> graph) { diff --git a/src/gui/GraphTreeWindow.hpp b/src/gui/GraphTreeWindow.hpp index af767a2a..005f39a8 100644 --- a/src/gui/GraphTreeWindow.hpp +++ b/src/gui/GraphTreeWindow.hpp @@ -49,7 +49,7 @@ public: void new_object(SPtr<Client::ObjectModel> object); - void graph_property_changed(const Raul::URI& key, + void graph_property_changed(const URI& key, const Atom& value, SPtr<Client::GraphModel> graph); diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index cb722066..e6361249 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -135,7 +135,7 @@ GraphView::poly_changed() } void -GraphView::property_changed(const Raul::URI& predicate, const Atom& value) +GraphView::property_changed(const URI& predicate, const Atom& value) { _enable_signal = false; if (predicate == _app->uris().ingen_enabled) { diff --git a/src/gui/GraphView.hpp b/src/gui/GraphView.hpp index 54d47c72..03569831 100644 --- a/src/gui/GraphView.hpp +++ b/src/gui/GraphView.hpp @@ -27,7 +27,6 @@ #include <gtkmm/toolitem.h> #include "ingen/types.hpp" -#include "raul/URI.hpp" namespace Raul { class Atom; } @@ -77,7 +76,7 @@ private: void poly_changed(); void clear_clicked(); - void property_changed(const Raul::URI& predicate, const Atom& value); + void property_changed(const URI& predicate, const Atom& value); App* _app; diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 0eb65f8d..c96634cc 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -296,7 +296,7 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, row[_plugins_columns._col_type] = ""; } - row[_plugins_columns._col_uri] = plugin->uri(); + row[_plugins_columns._col_uri] = plugin->uri().string(); row[_plugins_columns._col_plugin] = plugin; } @@ -498,9 +498,9 @@ LoadPluginWindow::on_key_press_event(GdkEventKey* event) } void -LoadPluginWindow::plugin_property_changed(const Raul::URI& plugin, - const Raul::URI& predicate, - const Atom& value) +LoadPluginWindow::plugin_property_changed(const URI& plugin, + const URI& predicate, + const Atom& value) { const URIs& uris = _app->uris(); if (predicate == uris.doap_name) { diff --git a/src/gui/LoadPluginWindow.hpp b/src/gui/LoadPluginWindow.hpp index 71ac76e2..3874b8dd 100644 --- a/src/gui/LoadPluginWindow.hpp +++ b/src/gui/LoadPluginWindow.hpp @@ -116,9 +116,9 @@ private: void new_plugin(SPtr<const Client::PluginModel> pm); - void plugin_property_changed(const Raul::URI& plugin, - const Raul::URI& predicate, - const Atom& value); + void plugin_property_changed(const URI& plugin, + const URI& predicate, + const Atom& value); void plugin_activated(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* col); void plugin_selection_changed(); @@ -132,7 +132,7 @@ private: SPtr<const Client::GraphModel> _graph; - typedef std::map<Raul::URI, Gtk::TreeModel::iterator> Rows; + typedef std::map<URI, Gtk::TreeModel::iterator> Rows; Rows _rows; Glib::RefPtr<Gtk::ListStore> _plugins_liststore; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 73564f9d..1b1b1677 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -137,7 +137,7 @@ NodeMenu::init(App& app, SPtr<const Client::BlockModel> block) } void -NodeMenu::add_preset(const Raul::URI& uri, const std::string& label) +NodeMenu::add_preset(const URI& uri, const std::string& label) { if (_presets_menu) { _presets_menu->items().push_back( @@ -225,7 +225,7 @@ NodeMenu::on_save_preset_activated() _app->forge().alloc(basename) }, { _app->uris().lv2_prototype, _app->forge().make_urid(block()->uri()) }}; - _app->interface()->put(Raul::URI(real_uri), props); + _app->interface()->put(URI(real_uri), props); } } @@ -234,7 +234,7 @@ NodeMenu::on_preset_activated(const std::string& uri) { _app->set_property(block()->uri(), _app->uris().pset_preset, - _app->forge().make_urid(Raul::URI(uri))); + _app->forge().make_urid(URI(uri))); } bool diff --git a/src/gui/NodeMenu.hpp b/src/gui/NodeMenu.hpp index c8ac3daf..5d9f1e6d 100644 --- a/src/gui/NodeMenu.hpp +++ b/src/gui/NodeMenu.hpp @@ -52,7 +52,7 @@ protected: return dynamic_ptr_cast<const Client::BlockModel>(_object); } - void add_preset(const Raul::URI& uri, const std::string& label); + void add_preset(const URI& uri, const std::string& label); void on_menu_disconnect(); void on_menu_embed_gui(); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 2e81128a..dadffff0 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -457,7 +457,7 @@ NodeModule::store_location(double ax, double ay) } void -NodeModule::property_changed(const Raul::URI& key, const Atom& value) +NodeModule::property_changed(const URI& key, const Atom& value) { const URIs& uris = app().uris(); if (value.type() == uris.forge.Float) { diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp index f2381999..863b6ffb 100644 --- a/src/gui/NodeModule.hpp +++ b/src/gui/NodeModule.hpp @@ -79,7 +79,7 @@ protected: bool on_selected(gboolean selected); void rename(); - void property_changed(const Raul::URI& key, const Atom& value); + void property_changed(const URI& key, const Atom& value); void new_port_view(SPtr<const Client::PortModel> port); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index c113cac9..bfce4248 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -119,7 +119,7 @@ ObjectMenu::on_menu_polyphonic() } void -ObjectMenu::property_changed(const Raul::URI& predicate, const Atom& value) +ObjectMenu::property_changed(const URI& predicate, const Atom& value) { const URIs& uris = _app->uris(); _enable_signal = false; diff --git a/src/gui/ObjectMenu.hpp b/src/gui/ObjectMenu.hpp index a9766614..a9b07fd5 100644 --- a/src/gui/ObjectMenu.hpp +++ b/src/gui/ObjectMenu.hpp @@ -55,7 +55,7 @@ protected: void on_menu_destroy(); void on_menu_properties(); - void property_changed(const Raul::URI& predicate, const Atom& value); + void property_changed(const URI& predicate, const Atom& value); App* _app; SPtr<const Client::ObjectModel> _object; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index 9622a7f5..9742cee3 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -246,7 +246,7 @@ Port::build_enum_menu() } void -Port::on_uri_activated(const Raul::URI& uri) +Port::on_uri_activated(const URI& uri) { _app.set_property(model()->uri(), _app.world()->uris().ingen_value, @@ -278,7 +278,7 @@ Port::build_uri_menu() LilvNodes* range = lilv_world_find_nodes( world->lilv_world(), designation, rdfs_range, nullptr); LILV_FOREACH(nodes, r, range) { - ranges.insert(Raul::URI(lilv_node_as_string(lilv_nodes_get(range, r)))); + ranges.insert(URI(lilv_node_as_string(lilv_nodes_get(range, r)))); } RDFS::classes(world, ranges, false); @@ -450,7 +450,7 @@ Port::port_properties_changed() } void -Port::property_changed(const Raul::URI& key, const Atom& value) +Port::property_changed(const URI& key, const Atom& value) { const URIs& uris = _app.uris(); if (value.type() == uris.forge.Float) { @@ -495,7 +495,7 @@ Port::property_changed(const Raul::URI& key, const Atom& value) } void -Port::property_removed(const Raul::URI& key, const Atom& value) +Port::property_removed(const URI& key, const Atom& value) { const URIs& uris = _app.uris(); if (key == uris.lv2_minimum || key == uris.lv2_maximum) { diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp index 5f683412..c714feae 100644 --- a/src/gui/Port.hpp +++ b/src/gui/Port.hpp @@ -27,11 +27,12 @@ namespace Raul { class Atom; -class URI; } namespace Ingen { +class URI; + namespace Client { class PortModel; } namespace GUI { @@ -78,13 +79,13 @@ private: Gtk::Menu* build_uri_menu(); GraphBox* get_graph_box() const; - void property_changed(const Raul::URI& key, const Atom& value); - void property_removed(const Raul::URI& key, const Atom& value); + void property_changed(const URI& key, const Atom& value); + void property_removed(const URI& key, const Atom& value); void moved(); void on_value_changed(double value); void on_scale_point_activated(float f); - void on_uri_activated(const Raul::URI& uri); + void on_uri_activated(const URI& uri); bool on_event(GdkEvent* ev); void port_properties_changed(); void set_type_tag(); diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index db939b73..4d47b3ae 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -39,7 +39,7 @@ using namespace Client; namespace GUI { -typedef std::set<Raul::URI> URISet; +typedef std::set<URI> URISet; PropertiesWindow::PropertiesWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& xml) @@ -100,7 +100,7 @@ PropertiesWindow::present(SPtr<const ObjectModel> model) } void -PropertiesWindow::add_property(const Raul::URI& key, const Atom& value) +PropertiesWindow::add_property(const URI& key, const Atom& value) { World* world = _app->world(); @@ -114,7 +114,9 @@ PropertiesWindow::add_property(const Raul::URI& key, const Atom& value) name = world->rdf_world()->prefixes().qualify(key); } Gtk::Label* label = new Gtk::Label( - std::string("<a href=\"") + key + "\">" + name + "</a>", 1.0, 0.5); + std::string("<a href=\"") + key.string() + "\">" + name + "</a>", + 1.0, + 0.5); label->set_use_markup(true); _app->set_tooltip(label, prop); _table->attach(*Gtk::manage(label), 0, 1, n_rows, n_rows + 1, @@ -144,7 +146,7 @@ PropertiesWindow::add_property(const Raul::URI& key, const Atom& value) bool PropertiesWindow::datatype_supported(const RDFS::URISet& types, - Raul::URI* widget_type) + URI* widget_type) { if (types.find(_app->uris().atom_Int) != types.end()) { *widget_type = _app->uris().atom_Int; @@ -211,8 +213,8 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model) world->lilv_world(), LILV_NS_RDFS "Datatype"); // Populate key combo - const URISet props = RDFS::properties(world, model); - std::map<std::string, Raul::URI> entries; + const URISet props = RDFS::properties(world, model); + std::map<std::string, URI> entries; for (const auto& p : props) { LilvNode* prop = lilv_new_uri(world->lilv_world(), p.c_str()); const std::string label = RDFS::label(world, prop); @@ -228,7 +230,7 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model) if (RDFS::is_a(world, range, rdfs_DataType)) { // Range is a datatype, show if type or any subtype is supported RDFS::datatypes(_app->world(), ranges, false); - Raul::URI widget_type("urn:nothing"); + URI widget_type("urn:nothing"); if (datatype_supported(ranges, &widget_type)) { entries.emplace(label, p); } @@ -243,7 +245,7 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model) for (const auto& e : entries) { Gtk::ListStore::iterator ki = _key_store->append(); Gtk::ListStore::Row row = *ki; - row[_combo_columns.uri_col] = e.second; + row[_combo_columns.uri_col] = e.second.string(); row[_combo_columns.label_col] = e.first; } @@ -263,23 +265,23 @@ PropertiesWindow::set_object(SPtr<const ObjectModel> model) } Gtk::Widget* -PropertiesWindow::create_value_widget(const Raul::URI& key, - const char* type_uri, - const Atom& value) +PropertiesWindow::create_value_widget(const URI& key, + const char* type_uri, + const Atom& value) { - if (!type_uri || !Raul::URI::is_valid(type_uri)) { + if (!type_uri || !URI::is_valid(type_uri)) { return nullptr; } - Raul::URI type(type_uri); + URI type(type_uri); Ingen::World* world = _app->world(); LilvWorld* lworld = world->lilv_world(); // See if type is a datatype we support - std::set<Raul::URI> types{type}; + std::set<URI> types{type}; RDFS::datatypes(_app->world(), types, false); - Raul::URI widget_type("urn:nothing"); + URI widget_type("urn:nothing"); const bool supported = datatype_supported(types, &widget_type); if (supported) { type = widget_type; @@ -390,7 +392,7 @@ PropertiesWindow::on_show() } void -PropertiesWindow::change_property(const Raul::URI& key, const Atom& value) +PropertiesWindow::change_property(const URI& key, const Atom& value) { auto r = _records.find(key); if (r == _records.end()) { @@ -413,7 +415,7 @@ PropertiesWindow::change_property(const Raul::URI& key, const Atom& value) } void -PropertiesWindow::remove_property(const Raul::URI& key, const Atom& value) +PropertiesWindow::remove_property(const URI& key, const Atom& value) { // Bleh, there doesn't seem to be an easy way to remove a Gtk::Table row... _records.clear(); @@ -449,8 +451,8 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget) } } else if (type == forge.URI || type == forge.URID) { URIEntry* uri_entry = dynamic_cast<URIEntry*>(value_widget); - if (uri_entry && Raul::URI::is_valid(uri_entry->get_text())) { - return _app->forge().make_urid(Raul::URI(uri_entry->get_text())); + if (uri_entry && URI::is_valid(uri_entry->get_text())) { + return _app->forge().make_urid(URI(uri_entry->get_text())); } else { _app->log().error(fmt("Invalid URI <%1%>\n") % uri_entry->get_text()); } @@ -465,7 +467,7 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget) } void -PropertiesWindow::on_change(const Raul::URI& key) +PropertiesWindow::on_change(const URI& key) { auto r = _records.find(key); if (r == _records.end()) { @@ -512,7 +514,7 @@ PropertiesWindow::key_changed() const URISet ranges = RDFS::range(_app->world(), prop, true); for (const auto& r : ranges) { Gtk::Widget* value_widget = create_value_widget( - Raul::URI(key_uri), r.c_str(), Atom()); + URI(key_uri), r.c_str(), Atom()); if (value_widget) { _add_button->set_sensitive(true); @@ -542,7 +544,7 @@ PropertiesWindow::add_clicked() if (value.is_valid()) { // Send property to engine Properties properties; - properties.emplace(Raul::URI(key_uri.c_str()), Property(value)); + properties.emplace(URI(key_uri.c_str()), Property(value)); _app->interface()->put(_model->uri(), properties); } } @@ -560,8 +562,8 @@ PropertiesWindow::apply_clicked() Properties remove; Properties add; for (const auto& r : _records) { - const Raul::URI& uri = r.first; - const Record& record = r.second; + const URI& uri = r.first; + const Record& record = r.second; if (record.present_button->get_active()) { if (!_model->has_property(uri, record.value)) { add.emplace(uri, record.value); diff --git a/src/gui/PropertiesWindow.hpp b/src/gui/PropertiesWindow.hpp index c9a2c9f4..f4a8dd0d 100644 --- a/src/gui/PropertiesWindow.hpp +++ b/src/gui/PropertiesWindow.hpp @@ -76,19 +76,19 @@ private: Gtk::TreeModelColumn<Glib::ustring> uri_col; }; - void add_property(const Raul::URI& key, const Atom& value); - void change_property(const Raul::URI& key, const Atom& value); - void remove_property(const Raul::URI& key, const Atom& value); - void on_change(const Raul::URI& key); + void add_property(const URI& key, const Atom& value); + void change_property(const URI& key, const Atom& value); + void remove_property(const URI& key, const Atom& value); + void on_change(const URI& key); - bool datatype_supported(const std::set<Raul::URI>& types, - Raul::URI* widget_type); + bool datatype_supported(const std::set<URI>& types, + URI* widget_type); - bool class_supported(const std::set<Raul::URI>& types); + bool class_supported(const std::set<URI>& types); - Gtk::Widget* create_value_widget(const Raul::URI& key, - const char* type_uri, - const Atom& value = Atom()); + Gtk::Widget* create_value_widget(const URI& key, + const char* type_uri, + const Atom& value = Atom()); Atom get_value(LV2_URID type, Gtk::Widget* value_widget); @@ -103,7 +103,7 @@ private: void apply_clicked(); void ok_clicked(); - typedef std::map<Raul::URI, Record> Records; + typedef std::map<URI, Record> Records; Records _records; SPtr<const Client::ObjectModel> _model; diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp index b524aed7..71b3441a 100644 --- a/src/gui/RDFS.cpp +++ b/src/gui/RDFS.cpp @@ -76,7 +76,7 @@ closure(World* world, const LilvNode* pred, URISet& types, bool super) LILV_FOREACH(nodes, m, matches) { const LilvNode* klass_node = lilv_nodes_get(matches, m); if (lilv_node_is_uri(klass_node)) { - Raul::URI klass(lilv_node_as_uri(klass_node)); + URI klass(lilv_node_as_uri(klass_node)); if (!types.count(klass)) { ++added; klasses.insert(klass); @@ -120,12 +120,12 @@ types(World* world, SPtr<const Client::ObjectModel> model) // Start with every rdf:type URISet types; - types.insert(Raul::URI(LILV_NS_RDFS "Resource")); + types.insert(URI(LILV_NS_RDFS "Resource")); PropRange range = model->properties().equal_range(world->uris().rdf_type); for (auto t = range.first; t != range.second; ++t) { if (t->second.type() == world->forge().URI || t->second.type() == world->forge().URID) { - const Raul::URI type(world->forge().str(t->second, false)); + const URI type(world->forge().str(t->second, false)); types.insert(type); if (world->uris().ingen_Graph == type) { // Add lv2:Plugin as a type for graphs so plugin properties show up @@ -170,7 +170,7 @@ properties(World* world, SPtr<const Client::ObjectModel> model) continue; } - const Raul::URI domain(lilv_node_as_uri(domain_node)); + const URI domain(lilv_node_as_uri(domain_node)); if (types.count(domain)) { ++n_matching_domains; } @@ -179,7 +179,7 @@ properties(World* world, SPtr<const Client::ObjectModel> model) if (lilv_nodes_size(domains) == 0 || ( n_matching_domains > 0 && n_matching_domains == lilv_nodes_size(domains))) { - properties.insert(Raul::URI(lilv_node_as_uri(prop))); + properties.insert(URI(lilv_node_as_uri(prop))); } lilv_nodes_free(domains); @@ -210,7 +210,7 @@ instances(World* world, const URISet& types) continue; } const std::string label = RDFS::label(world, object); - result.emplace(label, Raul::URI(lilv_node_as_string(object))); + result.emplace(label, URI(lilv_node_as_string(object))); } lilv_node_free(type); } @@ -230,7 +230,7 @@ range(World* world, const LilvNode* prop, bool recursive) URISet ranges; LILV_FOREACH(nodes, n, nodes) { - ranges.insert(Raul::URI(lilv_node_as_string(lilv_nodes_get(nodes, n)))); + ranges.insert(URI(lilv_node_as_string(lilv_nodes_get(nodes, n)))); } if (recursive) { diff --git a/src/gui/RDFS.hpp b/src/gui/RDFS.hpp index 7208c638..f59bbdf5 100644 --- a/src/gui/RDFS.hpp +++ b/src/gui/RDFS.hpp @@ -23,7 +23,6 @@ #include "ingen/types.hpp" #include "lilv/lilv.h" -#include "raul/URI.hpp" namespace Ingen { @@ -36,10 +35,10 @@ namespace GUI { namespace RDFS { /** Set of URIs. */ -typedef std::set<Raul::URI> URISet; +typedef std::set<URI> URISet; /** Label => Resource map. */ -typedef std::map<std::string, Raul::URI> Objects; +typedef std::map<std::string, URI> Objects; /** Return the label of `node`. */ std::string label(World* world, const LilvNode* node); diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 93c97cbd..891502f7 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -14,6 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include <cassert> #include <string> #include "ingen/Log.hpp" @@ -30,11 +31,11 @@ namespace Ingen { namespace GUI { ThreadedLoader::ThreadedLoader(App& app, SPtr<Interface> engine) - : _app(app) - , _sem(0) - , _engine(std::move(engine)) - , _exit_flag(false) - , _thread(&ThreadedLoader::run, this) + : _app(app) + , _sem(0) + , _engine(std::move(engine)) + , _exit_flag(false) + , _thread(&ThreadedLoader::run, this) { if (!parser()) { app.log().warn("Parser unavailable, graph loading disabled\n"); @@ -85,13 +86,12 @@ ThreadedLoader::load_graph(bool merge, } } - _events.push_back( - sigc::hide_return( - sigc::bind(sigc::mem_fun(this, &ThreadedLoader::load_graph_event), - document_uri, - engine_parent, - engine_symbol, - engine_data))); + _events.push_back(sigc::hide_return( + sigc::bind(sigc::mem_fun(this, &ThreadedLoader::load_graph_event), + document_uri, + engine_parent, + engine_symbol, + engine_data))); _mutex.unlock(); _sem.post(); @@ -114,15 +114,14 @@ ThreadedLoader::load_graph_event(const Glib::ustring& document_uri, } void -ThreadedLoader::save_graph(SPtr<const Client::GraphModel> model, - const std::string& filename) +ThreadedLoader::save_graph(SPtr<const Client::GraphModel> model, const URI& uri) { _mutex.lock(); - _events.push_back( - sigc::hide_return( - sigc::bind(sigc::mem_fun(this, &ThreadedLoader::save_graph_event), - model, filename))); + _events.push_back(sigc::hide_return( + sigc::bind(sigc::mem_fun(this, &ThreadedLoader::save_graph_event), + model, + uri))); _mutex.unlock(); _sem.post(); @@ -130,15 +129,16 @@ ThreadedLoader::save_graph(SPtr<const Client::GraphModel> model, void ThreadedLoader::save_graph_event(SPtr<const Client::GraphModel> model, - const std::string& filename) + const URI& uri) { + assert(uri.scheme() == "file"); if (_app.serialiser()) { std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex()); - if (filename.find(".ingen") != std::string::npos) { - _app.serialiser()->write_bundle(model, filename); + if (uri.string().find(".ingen") != std::string::npos) { + _app.serialiser()->write_bundle(model, uri); } else { - _app.serialiser()->start_to_file(model->path(), filename); + _app.serialiser()->start_to_file(model->path(), std::string(uri.path())); _app.serialiser()->serialise(model); _app.serialiser()->finish(); } diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index c0a4ed6a..64968230 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -32,6 +32,9 @@ #include "raul/Semaphore.hpp" namespace Ingen { + +class URI; + namespace GUI { /** Thread for loading graph files. @@ -59,8 +62,7 @@ public: boost::optional<Raul::Symbol> engine_symbol, boost::optional<Properties> engine_data); - void save_graph(SPtr<const Client::GraphModel> model, - const std::string& filename); + void save_graph(SPtr<const Client::GraphModel> model, const URI& uri); SPtr<Parser> parser(); @@ -71,7 +73,7 @@ private: boost::optional<Properties> engine_data); void save_graph_event(SPtr<const Client::GraphModel> model, - const std::string& filename); + const URI& filename); /** Returns nothing and takes no parameters (because they have all been bound) */ typedef sigc::slot<void> Closure; diff --git a/src/gui/URIEntry.cpp b/src/gui/URIEntry.cpp index 3c236572..0b81afd7 100644 --- a/src/gui/URIEntry.cpp +++ b/src/gui/URIEntry.cpp @@ -23,14 +23,12 @@ namespace Ingen { namespace GUI { -URIEntry::URIEntry(App* app, - std::set<Raul::URI> types, - const std::string& value) - : Gtk::HBox(false, 4) - , _app(app) - , _types(std::move(types)) - , _menu_button(Gtk::manage(new Gtk::Button("≡"))) - , _entry(Gtk::manage(new Gtk::Entry())) +URIEntry::URIEntry(App* app, std::set<URI> types, const std::string& value) + : Gtk::HBox(false, 4) + , _app(app) + , _types(std::move(types)) + , _menu_button(Gtk::manage(new Gtk::Button("≡"))) + , _entry(Gtk::manage(new Gtk::Entry())) { pack_start(*_entry, true, true); pack_start(*_menu_button, false, true); diff --git a/src/gui/URIEntry.hpp b/src/gui/URIEntry.hpp index 90df2160..2f55a3d9 100644 --- a/src/gui/URIEntry.hpp +++ b/src/gui/URIEntry.hpp @@ -36,9 +36,7 @@ public: * If `types` is given, then a menu button will be shown which pops up a * enu for easily choosing known values with valid types. */ - URIEntry(App* app, - std::set<Raul::URI> types, - const std::string& value); + URIEntry(App* app, std::set<URI> types, const std::string& value); std::string get_text() { return _entry->get_text(); } Glib::SignalProxy0<void> signal_changed() { return _entry->signal_changed(); } @@ -58,10 +56,10 @@ private: void uri_chosen(const std::string& uri); bool menu_button_event(GdkEvent* ev); - App* _app; - const std::set<Raul::URI> _types; - Gtk::Button* _menu_button; - Gtk::Entry* _entry; + App* _app; + const std::set<URI> _types; + Gtk::Button* _menu_button; + Gtk::Entry* _entry; }; } // namespace GUI |