From 80fee5c311fdbdeda573ec81f59158a5fc87d0a1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 14 Aug 2012 04:23:23 +0000 Subject: Update for latest Raul. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4687 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/BreadCrumbs.cpp | 8 ++++---- src/gui/ConnectWindow.cpp | 37 +++++++++++++++++++------------------ src/gui/LoadPluginWindow.cpp | 16 +++++++--------- src/gui/NewSubpatchWindow.cpp | 7 ++----- src/gui/NodeMenu.cpp | 7 ++++--- src/gui/NodeModule.cpp | 2 +- src/gui/PatchBox.cpp | 4 ++-- src/gui/PatchCanvas.cpp | 22 ++++++++++++---------- src/gui/PatchTreeWindow.cpp | 2 +- src/gui/PortMenu.cpp | 2 +- src/gui/PortPropertiesWindow.cpp | 2 +- src/gui/PropertiesWindow.cpp | 14 +++++++------- src/gui/RenameWindow.cpp | 14 ++++++-------- src/gui/ThreadedLoader.cpp | 2 +- src/gui/WindowFactory.cpp | 2 +- src/gui/ingen_gui_lv2.cpp | 4 ++-- 16 files changed, 71 insertions(+), 74 deletions(-) (limited to 'src/gui') diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 8dbb9e21..e496e32b 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -88,7 +88,7 @@ BreadCrumbs::build(Path path, SharedPtr view) if (suffix[0] == '/') suffix = suffix.substr(1); const string name = suffix.substr(0, suffix.find("/")); - _full_path = _full_path.base() + name; + _full_path = _full_path.child(Raul::Symbol(name)); BreadCrumb* but = create_crumb(_full_path, view); pack_start(*but, false, false, 1); _breadcrumbs.push_back(but); @@ -116,18 +116,18 @@ BreadCrumbs::build(Path path, SharedPtr view) _breadcrumbs.clear(); // Add root - BreadCrumb* root_but = create_crumb("/", view); + BreadCrumb* root_but = create_crumb(Raul::Path("/"), view); pack_start(*root_but, false, false, 1); _breadcrumbs.push_front(root_but); root_but->set_active(root_but->path() == _active_path); - Path working_path = "/"; + Path working_path("/"); string suffix = path.substr(1); while (suffix.length() > 0) { if (suffix[0] == '/') suffix = suffix.substr(1); const string name = suffix.substr(0, suffix.find("/")); - working_path = working_path.base() + name; + working_path = working_path.child(Raul::Symbol(name)); BreadCrumb* but = create_crumb(working_path, view); pack_start(*but, false, false, 1); _breadcrumbs.push_back(but); diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index 3b683cf9..4257b8c5 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -16,6 +16,7 @@ #include #include +#include #include @@ -39,8 +40,6 @@ using namespace Ingen::Client; using namespace std; using namespace Raul; -namespace Raul { class Deletable; } - namespace Ingen { namespace GUI { @@ -164,15 +163,16 @@ ConnectWindow::connect(bool existing) #ifdef HAVE_SOCKET if (_mode == CONNECT_REMOTE) { - string uri = "unix:///tmp/ingen.sock"; + Raul::URI uri("unix:///tmp/ingen.sock"); if (_widgets_loaded) { const std::string& user_uri = _url_entry->get_text(); - if (Raul::URI::is_valid(user_uri)) - uri = user_uri; + if (Raul::URI::is_valid(user_uri)) { + uri = Raul::URI(user_uri); + } } if (existing) { - uri = world->interface()->uri().str(); + uri = world->interface()->uri(); } SharedPtr tsci; @@ -193,12 +193,13 @@ ConnectWindow::connect(bool existing) return; } else if (_mode == LAUNCH_REMOTE) { int port = _port_spinbutton->get_value_as_int(); - char port_str[8]; - snprintf(port_str, sizeof(port_str), "%u", port); + std::stringstream ss; + ss << port; + const std::string port_str = ss.str(); const string cmd = string("ingen -e -E ").append(port_str); if (Raul::Process::launch(cmd)) { - const std::string engine_uri = string("tcp://localhost:").append(port_str); + const Raul::URI engine_uri(string("tcp://localhost:") + port_str); SharedPtr tsci(new ThreadedSigClientInterface(1024)); world->set_interface(world->new_interface(engine_uri, tsci)); @@ -255,16 +256,16 @@ ConnectWindow::disconnect() void ConnectWindow::activate() { - _app->interface()->set_property("ingen:driver", - "ingen:enabled", + _app->interface()->set_property(Raul::URI("ingen:driver"), + _app->uris().ingen_enabled, _app->forge().make(true)); } void ConnectWindow::deactivate() { - _app->interface()->set_property("ingen:driver", - "ingen:enabled", + _app->interface()->set_property(Raul::URI("ingen:driver"), + _app->uris().ingen_enabled, _app->forge().make(false)); } @@ -390,7 +391,7 @@ ConnectWindow::gtk_callback() _ping_id = g_random_int(); _app->interface()->set_response_id(_ping_id); - _app->interface()->get("ingen:engine"); + _app->interface()->get(Raul::URI("ingen:engine")); if (_widgets_loaded) { _progress_label->set_text("Connecting to engine..."); @@ -407,7 +408,7 @@ ConnectWindow::gtk_callback() (now.tv_usec - last.tv_usec) * 0.001f; if (ms_since_last > 1000) { _app->interface()->set_response_id(_ping_id); - _app->interface()->get("ingen:engine"); + _app->interface()->get(Raul::URI("ingen:engine")); last = now; } } @@ -419,18 +420,18 @@ ConnectWindow::gtk_callback() } else if (_connect_stage == 3) { if (_app->store()->size() > 0) { SharedPtr root = PtrCast( - _app->store()->object("/")); + _app->store()->object(Raul::Path("/"))); if (root) { set_connected_to(_app->interface()); _app->window_factory()->present_patch(root); - _app->interface()->get("ingen:plugins"); + _app->interface()->get(Raul::URI("ingen:plugins")); if (_widgets_loaded) _progress_label->set_text(string("Loading plugins...")); ++_connect_stage; } } } else if (_connect_stage == 4) { - _app->interface()->get("ingen:plugins"); + _app->interface()->get(Raul::URI("ingen:plugins")); hide(); if (_widgets_loaded) _progress_label->set_text("Connected to engine"); diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 691da285..b7e118bd 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -132,12 +132,10 @@ LoadPluginWindow::name_changed() { // Toggle add button sensitivity according name legality if (_selection->get_selected_rows().size() == 1) { - string name = _node_name_entry->get_text(); - if (!Symbol::is_valid(name)) { + const string sym = _node_name_entry->get_text(); + if (!Symbol::is_valid(sym)) { _add_button->property_sensitive() = false; - } else if (_app->store()->find_child(_patch, name)) { - _add_button->property_sensitive() = false; - } else if (name.length() == 0) { + } else if (_app->store()->find_child(_patch, Symbol(sym))) { _add_button->property_sensitive() = false; } else { _add_button->property_sensitive() = true; @@ -247,7 +245,7 @@ LoadPluginWindow::set_row(Gtk::TreeModel::Row& row, break; } - row[_plugins_columns._col_uri] = plugin->uri().str(); + row[_plugins_columns._col_uri] = plugin->uri(); row[_plugins_columns._col_plugin] = plugin; } @@ -349,7 +347,7 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter) props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); props.insert(make_pair(uris.ingen_prototype, - _app->forge().alloc_uri(plugin->uri().str()))); + _app->forge().alloc_uri(plugin->uri()))); props.insert(make_pair(uris.ingen_polyphonic, _app->forge().make(polyphonic))); _app->interface()->put(GraphObject::path_to_uri(path), props); @@ -405,10 +403,10 @@ LoadPluginWindow::filter_changed() field = name.get_string(); break; case CriteriaColumns::TYPE: - field = plugin->type_uri().str(); + field = plugin->type_uri(); break; case CriteriaColumns::URI: - field = plugin->uri().str(); + field = plugin->uri(); break; default: throw; diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp index 3c1546d5..0026f8ef 100644 --- a/src/gui/NewSubpatchWindow.cpp +++ b/src/gui/NewSubpatchWindow.cpp @@ -78,13 +78,10 @@ NewSubpatchWindow::name_changed() if (!Symbol::is_valid(name)) { _message_label->set_text("Name contains invalid characters."); _ok_button->property_sensitive() = false; - } else if (_app->store()->find(_patch->path().base() + name) - != _app->store()->end()) { + } else if (_app->store()->find(_patch->path().child(Symbol(name))) + != _app->store()->end()) { _message_label->set_text("An object already exists with that name."); _ok_button->property_sensitive() = false; - } else if (name.length() == 0) { - _message_label->set_text(""); - _ok_button->property_sensitive() = false; } else { _message_label->set_text(""); _ok_button->property_sensitive() = true; diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 5c573d9b..08f88c8b 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -129,8 +129,8 @@ NodeMenu::init(App& app, SharedPtr node) else _randomize_menuitem->hide(); - if (plugin && (plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Controller" - || plugin->uri().str() == "http://drobilla.net/ns/ingen-internals#Trigger")) + if (plugin && (plugin->uri() == "http://drobilla.net/ns/ingen-internals#Controller" + || plugin->uri() == "http://drobilla.net/ns/ingen-internals#Trigger")) _learn_menuitem->show(); else _learn_menuitem->hide(); @@ -200,7 +200,8 @@ NodeMenu::on_preset_activated(const std::string& uri) const LilvNode* val = lilv_nodes_get_first(values); const LilvNode* sym = lilv_nodes_get_first(symbols); _app->interface()->set_property( - node->path().base() + lilv_node_as_string(sym), + GraphObject::path_to_uri( + node->path().child(Raul::Symbol(lilv_node_as_string(sym)))), _app->uris().ingen_value, _app->forge().make(lilv_node_as_float(val))); } diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index af63164f..f6df0673 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -321,7 +321,7 @@ NodeModule::popup_gui() if (!_plugin_ui->is_resizable()) { _gui_window->set_resizable(false); } - _gui_window->set_title(_node->path().str() + " UI - Ingen"); + _gui_window->set_title(_node->path() + " UI - Ingen"); _gui_window->set_role("plugin_ui"); _gui_window->add(*_gui_widget); _gui_widget->show_all(); diff --git a/src/gui/PatchBox.cpp b/src/gui/PatchBox.cpp index 30330fd5..c5a5a6c2 100644 --- a/src/gui/PatchBox.cpp +++ b/src/gui/PatchBox.cpp @@ -174,7 +174,7 @@ PatchBox::init_box(App& app) { _app = &app; - std::string engine_name = _app->interface()->uri().str(); + std::string engine_name = _app->interface()->uri(); if (engine_name == "http://drobilla.net/ns/ingen#internal") { engine_name = "internal engine"; } @@ -584,7 +584,7 @@ PatchBox::event_draw() _view->canvas()->export_dot(filename.c_str()); _status_bar->push( (boost::format("Rendered %1% to %2%") - % _patch->path().str() % filename).str(), + % _patch->path() % filename).str(), STATUS_CONTEXT_PATCH); } } diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index eaab0b0c..936fb259 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -96,25 +96,27 @@ PatchCanvas::PatchCanvas(App& app, xml->get_widget("canvas_menu_new_patch", _menu_new_patch); xml->get_widget("canvas_menu_edit", _menu_edit); + const URIs& uris = _app.uris(); + // Add port menu items _menu_add_audio_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_in", "Audio In", LV2_CORE__AudioPort, false)); + "audio_in", "Audio In", uris.lv2_AudioPort, false)); _menu_add_audio_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "audio_out", "Audio Out", LV2_CORE__AudioPort, true)); + "audio_out", "Audio Out", uris.lv2_AudioPort, true)); _menu_add_control_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_in", "Control In", LV2_CORE__ControlPort, false)); + "control_in", "Control In", uris.lv2_ControlPort, false)); _menu_add_control_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "control_out", "Control Out", LV2_CORE__ControlPort, true)); + "control_out", "Control Out", uris.lv2_ControlPort, true)); _menu_add_event_input->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_in", "Event In", LV2_ATOM__AtomPort, false)); + "event_in", "Event In", uris.atom_AtomPort, false)); _menu_add_event_output->signal_activate().connect( sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port), - "event_out", "Event Out", LV2_ATOM__AtomPort, true)); + "event_out", "Event Out", uris.atom_AtomPort, true)); signal_event.connect( sigc::mem_fun(this, &PatchCanvas::on_event)); @@ -729,7 +731,7 @@ PatchCanvas::paste() && (first_slash = to_create.find("/")) != string::npos) { created += to_create.substr(0, first_slash); assert(Path::is_valid(created)); - clipboard.put(created, props); + clipboard.put(GraphObject::path_to_uri(Path(created)), props); to_create = to_create.substr(first_slash + 1); } @@ -800,13 +802,13 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base, { string sym, name; generate_port_name(sym_base, sym, name_base, name); - const Path& path = _patch->path().base() + sym; + const Path& path = _patch->path().child(Raul::Symbol(sym)); const URIs& uris = _app.uris(); Resource::Properties props = get_initial_data(); props.insert(make_pair(uris.rdf_type, - _app.forge().alloc_uri(type.str()))); + _app.forge().alloc_uri(type))); if (type == uris.atom_AtomPort) { props.insert(make_pair(uris.atom_bufferType, uris.atom_Sequence)); @@ -842,7 +844,7 @@ PatchCanvas::load_plugin(WeakPtr weak_plugin) GraphObject::Properties props = get_initial_data(); props.insert(make_pair(uris.rdf_type, uris.ingen_Node)); props.insert(make_pair(uris.ingen_prototype, - uris.forge.alloc_uri(plugin->uri().str()))); + uris.forge.alloc_uri(plugin->uri()))); _app.interface()->put(GraphObject::path_to_uri(path), props); } diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index bd7b62b7..24c56f1e 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -92,7 +92,7 @@ PatchTreeWindow::add_patch(SharedPtr pm) Gtk::TreeModel::iterator iter = _patch_treestore->append(); Gtk::TreeModel::Row row = *iter; if (pm->path().is_root()) { - row[_patch_tree_columns.name_col] = _app->interface()->uri().str(); + row[_patch_tree_columns.name_col] = _app->interface()->uri(); } else { row[_patch_tree_columns.name_col] = pm->symbol().c_str(); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index b2a7cc21..a5b907c3 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -147,7 +147,7 @@ PortMenu::on_menu_expose() SharedPtr node = PtrCast(port->parent()); const std::string label = node->label() + " " + node->port_label(port); - const Raul::Path path = node->path().str() + "_" + port->symbol().c_str(); + const Raul::Path path = Raul::Path(node->path() + Raul::Symbol("_" + port->symbol())); Ingen::Resource r(*_object.get()); r.remove_property(uris.lv2_index, uris.wildcard); diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp index 900c93c2..e0e95a67 100644 --- a/src/gui/PortPropertiesWindow.cpp +++ b/src/gui/PortPropertiesWindow.cpp @@ -65,7 +65,7 @@ PortPropertiesWindow::present(SharedPtr pm) _port_model = pm; - set_title(pm->path().str() + " Properties - Ingen"); + set_title(pm->path() + " Properties - Ingen"); float min = 0.0f, max = 1.0f; boost::shared_ptr parent = PtrCast(_port_model->parent()); diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index a79e2737..8fdb8f78 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -114,7 +114,7 @@ get_types(World* world, SharedPtr model) URISet types; PropRange range = model->properties().equal_range(world->uris().rdf_type); for (PropIter t = range.first; t != range.second; ++t) { - types.insert(t->second.get_uri()); + types.insert(Raul::URI(t->second.get_uri())); } LilvNode* rdfs_subClassOf = lilv_new_uri( @@ -133,7 +133,7 @@ get_types(World* world, SharedPtr model) LILV_FOREACH(nodes, s, sups) { const LilvNode* super_node = lilv_nodes_get(sups, s); if (lilv_node_is_uri(super_node)) { - Raul::URI super = lilv_node_as_uri(super_node); + Raul::URI super(lilv_node_as_uri(super_node)); if (!types.count(super)) { ++added; supers.insert(super); @@ -182,7 +182,7 @@ get_properties(World* world, SharedPtr model) if (n_matching_domains > 0 && n_matching_domains == lilv_nodes_size(domains)) { - properties.insert(lilv_node_as_uri(prop)); + properties.insert(Raul::URI(lilv_node_as_uri(prop))); } lilv_nodes_free(domains); @@ -224,9 +224,9 @@ PropertiesWindow::add_property(const Raul::URI& uri, const Raul::Atom& value) LilvNode* prop = lilv_new_uri(world->lilv_world(), uri.c_str()); Glib::ustring lab_text = get_label(world, prop); if (lab_text.empty()) { - lab_text = world->rdf_world()->prefixes().qualify(uri.str()); + lab_text = world->rdf_world()->prefixes().qualify(uri); } - lab_text = Glib::ustring("" + lab_text = Glib::ustring("" + lab_text + ""; Gtk::Label* lab = manage(new Gtk::Label(lab_text, 1.0, 0.5)); lab->set_use_markup(true); @@ -254,7 +254,7 @@ PropertiesWindow::set_object(SharedPtr model) reset(); _model = model; - set_title(model->path().str() + " Properties - Ingen"); + set_title(model->path() + " Properties - Ingen"); World* world = _app->world(); @@ -282,7 +282,7 @@ PropertiesWindow::set_object(SharedPtr model) // At least one applicable object, add property to key combo Gtk::ListStore::iterator ki = _key_store->append(); Gtk::ListStore::Row row = *ki; - row[_combo_columns.uri_col] = p->str(); + row[_combo_columns.uri_col] = *p; row[_combo_columns.label_col] = label; break; } diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index 31ebbf22..926135a8 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -64,7 +64,7 @@ RenameWindow::set_object(SharedPtr object) { _object = object; _symbol_entry->set_text(object->path().symbol()); - const Atom& name_atom = object->get_property(LV2_CORE__name); + const Atom& name_atom = object->get_property(_app->uris().lv2_name); _label_entry->set_text( (name_atom.type() == _app->forge().String) ? name_atom.get_string() : ""); } @@ -82,14 +82,12 @@ RenameWindow::values_changed() { const string& symbol = _symbol_entry->get_text(); const string& label = _label_entry->get_text(); - if (symbol.length() == 0) { - _message_label->set_text("Symbol must be at least 1 character"); + if (!Symbol::is_valid(symbol)) { + _message_label->set_text("Invalid symbol"); _ok_button->property_sensitive() = false; - } else if (!Symbol::is_valid(symbol)) { - _message_label->set_text("Symbol contains invalid characters"); - _ok_button->property_sensitive() = false; - } else if (_object->symbol().c_str() != symbol && - _app->store()->object(_object->parent()->path().child(symbol))) { + } else if (_object->symbol() != symbol && + _app->store()->object( + _object->parent()->path().child(Raul::Symbol(symbol)))) { _message_label->set_text("An object already exists with that path"); _ok_button->property_sensitive() = false; } else if (label.empty()) { diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 054838c6..961ed340 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -78,7 +78,7 @@ ThreadedLoader::load_patch(bool merge, Glib::ustring engine_base = ""; if (engine_parent) { if (merge) - engine_base = engine_parent.get().str(); + engine_base = engine_parent.get(); else engine_base = engine_parent.get().base(); } diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 0834f666..98af4c19 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -204,7 +204,7 @@ WindowFactory::present_load_plugin(SharedPtr patch, _load_plugin_win->set_default_size(width - width / 8, height / 2); } _load_plugin_win->set_title( - string("Load Plugin - ") + patch->path().str() + " - Ingen"); + string("Load Plugin - ") + patch->path() + " - Ingen"); _load_plugin_win->present(patch, data); } diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 069b8031..3dcb6d71 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -129,7 +129,7 @@ instantiate(const LV2UI_Descriptor* descriptor, *ui->client.get())); // Request plugins - ui->world->interface()->get("ingen:plugins"); + ui->world->interface()->get(Raul::URI("ingen:plugins")); // Create empty root patch model Ingen::Resource::Properties props; @@ -139,7 +139,7 @@ instantiate(const LV2UI_Descriptor* descriptor, // Create a PatchBox for the root and set as the UI widget SharedPtr root = PtrCast( - ui->app->store()->object("/")); + ui->app->store()->object(Raul::Path("/"))); ui->view = Ingen::GUI::PatchBox::create(*ui->app, root); ui->view->unparent(); *widget = ui->view->gobj(); -- cgit v1.2.1