summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-02 20:37:50 +0000
committerDavid Robillard <d@drobilla.net>2010-02-02 20:37:50 +0000
commita645d2b8be4d7d31f6eef1649156b166a01e0c31 (patch)
tree3d83c08e9a5460cc6582482bcfc673dff956a1e7 /src/gui
parent653679e967f11a0e008521885fcaf6994d2961fa (diff)
downloadingen-a645d2b8be4d7d31f6eef1649156b166a01e0c31.tar.gz
ingen-a645d2b8be4d7d31f6eef1649156b166a01e0c31.tar.bz2
ingen-a645d2b8be4d7d31f6eef1649156b166a01e0c31.zip
Use Glib string interning (quarks) to make Path/URI operator== very fast.
This avoids a ton of string comparison overhead in Ingen when setting various properties (e.g. "ingen:value" was compared several times every time a port value was changed, now this is just a single pointer comparison and the full round trip of a value change does no string comparison at all, but is still property based and RDFey). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2408 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/App.hpp3
-rw-r--r--src/gui/BreadCrumbs.hpp2
-rw-r--r--src/gui/ControlPanel.cpp9
-rw-r--r--src/gui/Controls.cpp12
-rw-r--r--src/gui/LoadPatchWindow.cpp9
-rw-r--r--src/gui/LoadPluginWindow.cpp15
-rw-r--r--src/gui/LoadSubpatchWindow.cpp15
-rw-r--r--src/gui/NewSubpatchWindow.cpp12
-rw-r--r--src/gui/NodeControlWindow.cpp4
-rw-r--r--src/gui/NodeMenu.cpp6
-rw-r--r--src/gui/NodeModule.cpp56
-rw-r--r--src/gui/ObjectMenu.cpp9
-rw-r--r--src/gui/PatchCanvas.cpp43
-rw-r--r--src/gui/PatchCanvas.hpp2
-rw-r--r--src/gui/PatchPortModule.cpp44
-rw-r--r--src/gui/PatchPortModule.hpp2
-rw-r--r--src/gui/PatchTreeWindow.cpp13
-rw-r--r--src/gui/PatchView.cpp9
-rw-r--r--src/gui/Port.cpp50
-rw-r--r--src/gui/Port.hpp14
-rw-r--r--src/gui/PortMenu.cpp17
-rw-r--r--src/gui/PortPropertiesWindow.cpp11
-rw-r--r--src/gui/RenameWindow.cpp23
-rw-r--r--src/gui/UploadPatchWindow.cpp4
24 files changed, 233 insertions, 151 deletions
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 0de1a7ea..78839772 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -113,7 +113,8 @@ public:
static void init(Ingen::Shared::World* world);
static void run();
- Ingen::Shared::World* world() { return _world; }
+ inline Ingen::Shared::World* world() { return _world; }
+ inline Ingen::Shared::LV2URIMap& uris() { return *_world->uris; }
protected:
diff --git a/src/gui/BreadCrumbs.hpp b/src/gui/BreadCrumbs.hpp
index 492a634b..c66d98a2 100644
--- a/src/gui/BreadCrumbs.hpp
+++ b/src/gui/BreadCrumbs.hpp
@@ -80,7 +80,7 @@ private:
void set_path(const Raul::Path& path) {
remove();
- const std::string text = (path.is_root()) ? "/" : path.name().c_str();
+ const char* text = (path.is_root()) ? "/" : path.symbol();
Gtk::Label* lab = manage(new Gtk::Label(text));
lab->set_padding(0, 0);
lab->show();
diff --git a/src/gui/ControlPanel.cpp b/src/gui/ControlPanel.cpp
index e393b7ca..bcbc0824 100644
--- a/src/gui/ControlPanel.cpp
+++ b/src/gui/ControlPanel.cpp
@@ -16,6 +16,7 @@
*/
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PortModel.hpp"
#include "client/PluginModel.hpp"
@@ -185,7 +186,9 @@ ControlPanel::value_changed_atom(SharedPtr<PortModel> port, const Raul::Atom& va
{
if (_callback_enabled) {
if (_all_voices_radio->get_active()) {
- App::instance().engine()->set_property(port->path(), "ingen:value", val);
+ App::instance().engine()->set_property(port->path(),
+ App::instance().uris().ingen_value,
+ val);
port->value(val);
} else {
int voice = _voice_spinbutton->get_value_as_int();
@@ -213,7 +216,7 @@ ControlPanel::specific_voice_selected()
void
ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate.str() == "ingen:polyphony" && value.type() == Atom::INT)
+ if (predicate == App::instance().uris().ingen_polyphony && value.type() == Atom::INT)
_voice_spinbutton->set_range(0, value.get_int32() - 1);
}
@@ -221,7 +224,7 @@ ControlPanel::parent_property_changed(const Raul::URI& predicate, const Raul::At
void
ControlPanel::variable_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
- if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL) {
+ if (predicate == App::instance().uris().ingen_polyphony && value.type() == Atom::BOOL) {
if (value.get_bool())
_voice_control_box->show();
else
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 8564fbed..d5ebc11f 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -19,6 +19,7 @@
#include <algorithm>
#include "raul/log.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PluginModel.hpp"
#include "client/NodeModel.hpp"
#include "client/PortModel.hpp"
@@ -136,7 +137,7 @@ SliderControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_slider);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_slider->set_draw_value(false);
@@ -221,9 +222,10 @@ SliderControl::port_property_change(const URI& key, const Atom& value)
{
_enable_signal = false;
- if (key.str() == "lv2:minimum" && value.type() == Atom::FLOAT)
+ const Shared::LV2URIMap& uris = App::instance().uris();
+ if (key == uris.lv2_minimum && value.type() == Atom::FLOAT)
set_range(value.get_float(), _slider->get_adjustment()->get_upper());
- else if (key.str() == "lv2:maximum" && value.type() == Atom::FLOAT)
+ else if (key == uris.lv2_maximum && value.type() == Atom::FLOAT)
set_range(_slider->get_adjustment()->get_lower(), value.get_float());
_enable_signal = true;
@@ -318,7 +320,7 @@ ToggleControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_checkbutton);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_checkbutton->signal_toggled().connect(sigc::mem_fun(*this, &ToggleControl::toggled));
set_value(pm->value());
@@ -383,7 +385,7 @@ StringControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
assert(_name_label);
assert(_entry);
- set_name(pm->path().name());
+ set_name(pm->path().symbol());
_entry->signal_activate().connect(sigc::mem_fun(*this, &StringControl::activated));
set_value(pm->value());
diff --git a/src/gui/LoadPatchWindow.cpp b/src/gui/LoadPatchWindow.cpp
index cb3aaf06..db65968b 100644
--- a/src/gui/LoadPatchWindow.cpp
+++ b/src/gui/LoadPatchWindow.cpp
@@ -18,12 +18,13 @@
#include <sys/types.h>
#include <dirent.h>
#include <boost/optional/optional.hpp>
-#include "LoadPatchWindow.hpp"
#include "interface/EngineInterface.hpp"
-#include "client/PatchModel.hpp"
+#include "shared/LV2URIMap.hpp"
#include "shared/runtime_paths.hpp"
+#include "client/PatchModel.hpp"
#include "App.hpp"
#include "Configuration.hpp"
+#include "LoadPatchWindow.hpp"
#include "ThreadedLoader.hpp"
using namespace Ingen::Serialisation;
@@ -136,7 +137,9 @@ LoadPatchWindow::ok_clicked()
optional<Symbol> symbol;
if (_poly_from_user_radio->get_active())
- _initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int()));
+ _initial_data.insert(make_pair(
+ App::instance().uris().ingen_polyphony,
+ _poly_spinbutton->get_value_as_int()));
if (!_patch->path().is_root()) {
parent = _patch->path().parent();
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index a72277b3..e6cc1b4e 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -19,6 +19,7 @@
#include <algorithm>
#include <ctype.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
#include "App.hpp"
@@ -324,6 +325,7 @@ LoadPluginWindow::generate_module_name(SharedPtr<PluginModel> plugin, int offset
void
LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
{
+ const LV2URIMap& uris = App::instance().uris();
Gtk::TreeModel::Row row = *iter;
SharedPtr<PluginModel> plugin = row.get_value(_plugins_columns._col_plugin);
bool polyphonic = _polyphonic_checkbutton->get_active();
@@ -341,18 +343,18 @@ LoadPluginWindow::load_plugin(const Gtk::TreeModel::iterator& iter)
} else {
Path path = _patch->path().base() + Path::nameify(name);
Resource::Properties props = _initial_data;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Atom(Atom::URI, plugin->uri().str())));
- props.insert(make_pair("ingen:polyphonic", polyphonic));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, plugin->uri()));
+ props.insert(make_pair(uris.ingen_polyphonic, polyphonic));
App::instance().engine()->put(path, props);
if (_selection->get_selected_rows().size() == 1)
_node_name_entry->set_text(generate_module_name(plugin, _plugin_name_offset + 1));
// Cascade next node
- Atom& x = _initial_data.find("ingenui:canvas-x")->second;
+ Atom& x = _initial_data.find(uris.ingenui_canvas_x)->second;
x = Atom(x.get_float() + 20.0f);
- Atom& y = _initial_data.find("ingenui:canvas-y")->second;
+ Atom& y = _initial_data.find(uris.ingenui_canvas_y)->second;
y = Atom(y.get_float() + 20.0f);
}
}
@@ -445,7 +447,8 @@ LoadPluginWindow::plugin_property_changed(const URI& plugin,
const URI& predicate,
const Atom& value)
{
- if (predicate.str() == "doap:name") {
+ const LV2URIMap& uris = App::instance().uris();
+ if (predicate == uris.doap_name) {
Rows::const_iterator i = _rows.find(plugin);
if (i != _rows.end() && value.type() == Atom::STRING)
(*i->second)[_plugins_columns._col_name] = value.get_string();
diff --git a/src/gui/LoadSubpatchWindow.cpp b/src/gui/LoadSubpatchWindow.cpp
index ef56a945..d299e327 100644
--- a/src/gui/LoadSubpatchWindow.cpp
+++ b/src/gui/LoadSubpatchWindow.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <boost/optional.hpp>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PatchModel.hpp"
#include "shared/runtime_paths.hpp"
@@ -158,18 +159,20 @@ LoadSubpatchWindow::ok_clicked()
symbol = Symbol::symbolify(name_str);
}
+ const LV2URIMap& uris = App::instance().uris();
+
if (_poly_from_user_radio->get_active()) {
- _initial_data.insert(make_pair("ingen:polyphony", (int)_poly_spinbutton->get_value_as_int()));
+ _initial_data.insert(make_pair(uris.ingen_polyphony, (int)_poly_spinbutton->get_value_as_int()));
} else if (_poly_from_parent_radio->get_active()) {
- _initial_data.insert(make_pair("ingen:polyphony", (int)_patch->poly()));
+ _initial_data.insert(make_pair(uris.ingen_polyphony, (int)_patch->poly()));
}
- std::list<Glib::ustring> uris = get_uris();
- for (std::list<Glib::ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
+ std::list<Glib::ustring> uri_list = get_uris();
+ for (std::list<Glib::ustring>::iterator i = uri_list.begin(); i != uri_list.end(); ++i) {
// Cascade
- Atom& x = _initial_data.find("ingenui:canvas-x")->second;
+ Atom& x = _initial_data.find(uris.ingenui_canvas_x)->second;
x = Atom(x.get_float() + 20.0f);
- Atom& y = _initial_data.find("ingenui:canvas-y")->second;
+ Atom& y = _initial_data.find(uris.ingenui_canvas_y)->second;
y = Atom(y.get_float() + 20.0f);
App::instance().loader()->load_patch(false, *i, Path("/"),
diff --git a/src/gui/NewSubpatchWindow.cpp b/src/gui/NewSubpatchWindow.cpp
index 960eeacb..5a933b31 100644
--- a/src/gui/NewSubpatchWindow.cpp
+++ b/src/gui/NewSubpatchWindow.cpp
@@ -17,6 +17,7 @@
#include "App.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
#include "NewSubpatchWindow.hpp"
@@ -91,17 +92,18 @@ NewSubpatchWindow::name_changed()
void
NewSubpatchWindow::ok_clicked()
{
+ App& app = App::instance();
const Path path = _patch->path().base() + Path::nameify(_name_entry->get_text());
const uint32_t poly = _poly_spinbutton->get_value_as_int();
Resource::Properties props;
- props.insert(make_pair("rdf:type", Atom(Atom::URI, "ingen:Patch")));
- props.insert(make_pair("ingen:polyphony", Atom(int32_t(poly))));
- App::instance().engine()->put(ResourceImpl::meta_uri(path), props);
+ props.insert(make_pair(app.uris().rdf_type, app.uris().ingen_Patch));
+ props.insert(make_pair(app.uris().ingen_polyphony, Atom(int32_t(poly))));
+ app.engine()->put(ResourceImpl::meta_uri(path), props);
props = _initial_data;
- props.insert(make_pair("ingen:enabled", bool(true)));
- App::instance().engine()->put(path, props);
+ props.insert(make_pair(app.uris().ingen_enabled, bool(true)));
+ app.engine()->put(path, props);
hide();
}
diff --git a/src/gui/NodeControlWindow.cpp b/src/gui/NodeControlWindow.cpp
index 07066d7d..4fce6636 100644
--- a/src/gui/NodeControlWindow.cpp
+++ b/src/gui/NodeControlWindow.cpp
@@ -17,6 +17,7 @@
#include <cmath>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "App.hpp"
#include "NodeControlWindow.hpp"
@@ -111,7 +112,8 @@ NodeControlWindow::on_show()
for (NodeModel::Ports::const_iterator i = _node->ports().begin();
i != _node->ports().end(); ++i)
if ((*i)->type().is_control() && (*i)->is_input())
- App::instance().engine()->request_property((*i)->path(), "ingen:value");
+ App::instance().engine()->request_property((*i)->path(),
+ App::instance().uris().ingen_value);
if (_position_stored)
move(_x, _y);
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index c801d3e7..ae735ad6 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -17,6 +17,7 @@
#include <gtkmm.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
#include "App.hpp"
@@ -145,7 +146,8 @@ NodeMenu::on_menu_randomize()
float min = 0.0f, max = 1.0f;
nm->port_value_range(*i, min, max);
const float val = ((rand() / (float)RAND_MAX) * (max - min) + min);
- App::instance().engine()->set_property((*i)->path(), "ingen:value", val);
+ App::instance().engine()->set_property((*i)->path(),
+ App::instance().uris().ingen_value, val);
}
}
@@ -178,7 +180,7 @@ NodeMenu::on_preset_activated(const std::string uri)
SLV2Value val = slv2_results_get_binding_value(values, 1);
App::instance().engine()->set_property(
node->path().base() + slv2_value_as_string(sym),
- "ingen:value",
+ App::instance().uris().ingen_value,
slv2_value_as_float(val));
}
App::instance().engine()->bundle_end();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index d9680237..277a65ad 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -20,6 +20,7 @@
#include "raul/log.hpp"
#include "raul/Atom.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
@@ -45,7 +46,7 @@ namespace GUI {
NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node)
- : FlowCanvas::Module(canvas, node->path().name(), 0, 0, true, canvas->show_port_names())
+ : FlowCanvas::Module(canvas, node->path().symbol(), 0, 0, true, canvas->show_port_names())
, _node(node)
, _gui_widget(NULL)
, _gui_window(NULL)
@@ -128,17 +129,17 @@ NodeModule::show_human_names(bool b)
}
if (!b)
- set_name(node()->symbol());
+ set_name(node()->symbol().c_str());
uint32_t index = 0;
for (PortVector::const_iterator i = ports().begin(); i != ports().end(); ++i) {
- string name = node()->port(index)->symbol();
+ Glib::ustring label(node()->port(index)->symbol().c_str());
if (b) {
- string hn = ((PluginModel*)node()->plugin())->port_human_name(index);
+ Glib::ustring hn = ((PluginModel*)node()->plugin())->port_human_name(index);
if (hn != "")
- name = hn;
+ label = hn;
}
- (*i)->set_name(name);
+ (*i)->set_name(label);
++index;
}
@@ -243,28 +244,21 @@ NodeModule::embed_gui(bool embed)
void
NodeModule::rename()
{
- set_name(_node->path().name());
- resize();
+ if (App::instance().configuration()->name_style() == Configuration::PATH) {
+ set_name(_node->path().symbol());
+ resize();
+ }
}
void
NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit)
{
- uint32_t index = _ports.size(); // FIXME: kludge, engine needs to tell us this
-
- string name = port->path().name();
- if (App::instance().configuration()->name_style() == Configuration::HUMAN && node()->plugin()) {
- string hn = ((PluginModel*)node()->plugin())->port_human_name(index);
- if (hn != "")
- name = hn;
- }
-
- Module::add_port(boost::shared_ptr<Port>(
- new Port(PtrCast<NodeModule>(shared_from_this()), port, name)));
+ Module::add_port(Port::create(PtrCast<NodeModule>(shared_from_this()), port,
+ App::instance().configuration()->name_style() == Configuration::HUMAN));
port->signal_value_changed.connect(sigc::bind<0>(
- sigc::mem_fun(this, &NodeModule::value_changed), index));
+ sigc::mem_fun(this, &NodeModule::value_changed), port->index()));
if (resize_to_fit)
resize();
@@ -379,14 +373,16 @@ NodeModule::store_location()
const float x = static_cast<float>(property_x());
const float y = static_cast<float>(property_y());
- const Atom& existing_x = _node->get_property("ingenui:canvas-x");
- const Atom& existing_y = _node->get_property("ingenui:canvas-y");
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Atom& existing_x = _node->get_property(uris.ingenui_canvas_x);
+ const Atom& existing_y = _node->get_property(uris.ingenui_canvas_y);
if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
|| existing_x.get_float() != x || existing_y.get_float() != y) {
Shared::Resource::Properties props;
- props.insert(make_pair("ingenui:canvas-x", Atom(x)));
- props.insert(make_pair("ingenui:canvas-y", Atom(y)));
+ props.insert(make_pair(uris.ingenui_canvas_x, Atom(x)));
+ props.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
App::instance().engine()->put(_node->path(), props);
}
}
@@ -395,18 +391,19 @@ NodeModule::store_location()
void
NodeModule::set_property(const URI& key, const Atom& value)
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
switch (value.type()) {
case Atom::FLOAT:
- if (key.str() == "ingenui:canvas-x") {
+ if (key == uris.ingenui_canvas_x) {
move_to(value.get_float(), property_y());
- } else if (key.str() == "ingenui:canvas-y") {
+ } else if (key == uris.ingenui_canvas_y) {
move_to(property_x(), value.get_float());
}
break;
case Atom::BOOL:
- if (key.str() == "ingen:polyphonic") {
+ if (key == uris.ingen_polyphonic) {
set_stacked_border(value.get_bool());
- } else if (key.str() == "ingen:selected") {
+ } else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool())
_canvas.lock()->select_item(shared_from_this());
@@ -422,10 +419,11 @@ NodeModule::set_property(const URI& key, const Atom& value)
void
NodeModule::set_selected(bool b)
{
+ const LV2URIMap& uris = App::instance().uris();
if (b != selected()) {
Module::set_selected(b);
if (App::instance().signal())
- App::instance().engine()->set_property(_node->path(), "ingen:selected", b);
+ App::instance().engine()->set_property(_node->path(), uris.ingen_selected, b);
}
}
diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp
index 781c4359..5151fadc 100644
--- a/src/gui/ObjectMenu.cpp
+++ b/src/gui/ObjectMenu.cpp
@@ -17,6 +17,7 @@
#include <gtkmm.h>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ObjectModel.hpp"
#include "App.hpp"
#include "ObjectMenu.hpp"
@@ -93,16 +94,18 @@ void
ObjectMenu::on_menu_polyphonic()
{
if (_enable_signal)
- App::instance().engine()->set_property(
- _object->path(), "ingen:polyphonic", bool(_polyphonic_menuitem->get_active()));
+ App::instance().engine()->set_property(_object->path(),
+ App::instance().uris().ingen_polyphonic,
+ bool(_polyphonic_menuitem->get_active()));
}
void
ObjectMenu::property_changed(const URI& predicate, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
_enable_signal = false;
- if (predicate.str() == "ingen:polyphonic" && value.type() == Atom::BOOL)
+ if (predicate == uris.ingen_polyphonic && value.type() == Atom::BOOL)
_polyphonic_menuitem->set_active(value.get_bool());
_enable_signal = true;
}
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 6e7374d0..45e6ec66 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -22,6 +22,7 @@
#include "flowcanvas/Canvas.hpp"
#include "flowcanvas/Ellipse.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "shared/Builder.hpp"
#include "shared/ClashAvoider.hpp"
#include "serialisation/Serialiser.hpp"
@@ -651,12 +652,14 @@ PatchCanvas::paste()
ClientStore clipboard;
clipboard.set_plugins(App::instance().store()->plugins());
+ const LV2URIMap& uris = App::instance().uris();
+
// mkdir -p
string to_create = _patch->path().chop_scheme().substr(1);
string created = "/";
Resource::Properties props;
- props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Patch")));
- props.insert(make_pair("ingen:polyphony", Raul::Atom(int32_t(_patch->poly()))));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Patch));
+ props.insert(make_pair(uris.ingen_polyphony, Raul::Atom(int32_t(_patch->poly()))));
clipboard.put(Path(), props);
size_t first_slash;
while (to_create != "/" && to_create != ""
@@ -685,18 +688,18 @@ PatchCanvas::paste()
for (Store::iterator i = clipboard.begin(); i != clipboard.end(); ++i) {
if (_patch->path().is_root() && i->first.is_root())
continue;
- GraphObject::Properties::iterator x = i->second->properties().find("ingenui:canvas-x");
+ GraphObject::Properties::iterator x = i->second->properties().find(uris.ingenui_canvas_x);
if (x != i->second->properties().end())
x->second = x->second.get_float() + (20.0f * _paste_count);
- GraphObject::Properties::iterator y = i->second->properties().find("ingenui:canvas-y");
+ GraphObject::Properties::iterator y = i->second->properties().find(uris.ingenui_canvas_y);
if (y != i->second->properties().end())
y->second = y->second.get_float() + (20.0f * _paste_count);
if (i->first.parent().is_root()) {
- GraphObject::Properties::iterator s = i->second->properties().find("ingen:selected");
+ GraphObject::Properties::iterator s = i->second->properties().find(uris.ingen_selected);
if (s != i->second->properties().end())
s->second = true;
else
- i->second->properties().insert(make_pair("ingen:selected", true));
+ i->second->properties().insert(make_pair(uris.ingen_selected, true));
}
builder.build(i->second);
}
@@ -737,18 +740,20 @@ PatchCanvas::generate_port_name(
void
PatchCanvas::menu_add_port(const string& sym_base, const string& name_base,
- const string& type, bool is_output)
+ const Raul::URI& type, bool is_output)
{
string sym, name;
generate_port_name(sym_base, sym, name_base, name);
const Path& path = _patch->path().base() + sym;
+ const LV2URIMap& uris = App::instance().uris();
+
Resource::Properties props = get_initial_data();
- props.insert(make_pair("rdf:type", Atom(Atom::URI, type)));
- props.insert(make_pair("rdf:type",
+ props.insert(make_pair(uris.rdf_type, type));
+ props.insert(make_pair(uris.rdf_type,
Atom(Atom::URI, is_output ? "lv2:OutputPort" : "lv2:InputPort")));
- props.insert(make_pair("lv2:index", Atom(int32_t(_patch->num_ports()))));
- props.insert(make_pair("lv2:name", Atom(name.c_str())));
+ props.insert(make_pair(uris.lv2_index, Atom(int32_t(_patch->num_ports()))));
+ props.insert(make_pair(uris.lv2_name, Atom(name.c_str())));
App::instance().engine()->put(path, props);
}
@@ -760,19 +765,21 @@ PatchCanvas::load_plugin(WeakPtr<PluginModel> weak_plugin)
if (!plugin)
return;
- string name = plugin->default_node_symbol();
- unsigned offset = App::instance().store()->child_name_offset(_patch->path(), name);
+ Raul::Symbol symbol = plugin->default_node_symbol();
+ unsigned offset = App::instance().store()->child_name_offset(_patch->path(), symbol);
if (offset != 0) {
std::stringstream ss;
- ss << name << "_" << offset;
- name = ss.str();
+ ss << symbol << "_" << offset;
+ symbol = ss.str();
}
- const Path path = _patch->path().base() + name;
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Path path = _patch->path().child(symbol);
// FIXME: polyphony?
GraphObject::Properties props = get_initial_data();
- props.insert(make_pair("rdf:type", Raul::Atom(Raul::Atom::URI, "ingen:Node")));
- props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, plugin->uri().str())));
+ props.insert(make_pair(uris.rdf_type, uris.ingen_Node));
+ props.insert(make_pair(uris.rdf_instanceOf, plugin->uri()));
App::instance().engine()->put(path, props);
}
diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp
index 12587c2b..e4cfd1a8 100644
--- a/src/gui/PatchCanvas.hpp
+++ b/src/gui/PatchCanvas.hpp
@@ -93,7 +93,7 @@ private:
void menu_add_port(
const string& sym_base, const string& name_base,
- const string& type, bool is_output);
+ const Raul::URI& type, bool is_output);
void menu_load_plugin();
void menu_new_patch();
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 6981f2ef..b1a71cf2 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -19,6 +19,7 @@
#include <utility>
#include "PatchPortModule.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/NodeModel.hpp"
#include "App.hpp"
@@ -38,7 +39,7 @@ namespace GUI {
PatchPortModule::PatchPortModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model)
- : FlowCanvas::Module(canvas, model->path().name(), 0, 0, false) // FIXME: coords?
+ : FlowCanvas::Module(canvas, "", 0, 0, false) // FIXME: coords?
, _model(model)
, _human_name_visible(false)
{
@@ -57,7 +58,7 @@ boost::shared_ptr<PatchPortModule>
PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortModel> model, bool human)
{
boost::shared_ptr<PatchPortModule> ret(new PatchPortModule(canvas, model));
- boost::shared_ptr<Port> port(new Port(ret, model, model->symbol(), true));
+ boost::shared_ptr<Port> port(Port::create(ret, model, human, true));
ret->add_port(port);
ret->set_port(port);
@@ -71,11 +72,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod
m != model->properties().end(); ++m)
ret->set_property(m->first, m->second);
- if (human)
- ret->show_human_names(human);
- else
- ret->resize();
-
+ ret->resize();
return ret;
}
@@ -97,14 +94,16 @@ PatchPortModule::store_location()
const float x = static_cast<float>(property_x());
const float y = static_cast<float>(property_y());
- const Atom& existing_x = _model->get_property("ingenui:canvas-x");
- const Atom& existing_y = _model->get_property("ingenui:canvas-y");
+ const LV2URIMap& uris = App::instance().uris();
+
+ const Atom& existing_x = _model->get_property(uris.ingenui_canvas_x);
+ const Atom& existing_y = _model->get_property(uris.ingenui_canvas_y);
if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
|| existing_x.get_float() != x || existing_y.get_float() != y) {
Shared::Resource::Properties props;
- props.insert(make_pair("ingenui:canvas-x", Atom(x)));
- props.insert(make_pair("ingenui:canvas-y", Atom(y)));
+ props.insert(make_pair(uris.ingenui_canvas_x, Atom(x)));
+ props.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
App::instance().engine()->put(_model->meta_uri(), props);
}
}
@@ -113,13 +112,14 @@ PatchPortModule::store_location()
void
PatchPortModule::show_human_names(bool b)
{
+ const LV2URIMap& uris = App::instance().uris();
using namespace std;
_human_name_visible = b;
- const Atom& name = _model->get_property("lv2:name");
- if (b && name.is_valid())
+ const Atom& name = _model->get_property(uris.lv2_name);
+ if (b && name.type() == Atom::STRING)
set_name(name.get_string());
else
- set_name(_model->symbol());
+ set_name(_model->symbol().c_str());
resize();
}
@@ -136,24 +136,25 @@ PatchPortModule::set_name(const std::string& n)
void
PatchPortModule::set_property(const URI& key, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
switch (value.type()) {
case Atom::FLOAT:
- if (key.str() == "ingenui:canvas-x") {
+ if (key == uris.ingenui_canvas_x) {
move_to(value.get_float(), property_y());
- } else if (key.str() == "ingenui:canvas-y") {
+ } else if (key == uris.ingenui_canvas_y) {
move_to(property_x(), value.get_float());
}
break;
case Atom::STRING:
- if (key.str() == "lv2:name" && _human_name_visible) {
+ if (key == uris.lv2_name && _human_name_visible) {
set_name(value.get_string());
- } else if (key.str() == "lv2:symbol" && !_human_name_visible) {
+ } else if (key == uris.lv2_symbol && !_human_name_visible) {
set_name(value.get_string());
}
case Atom::BOOL:
- if (key.str() == "ingen:polyphonic") {
+ if (key == uris.ingen_polyphonic) {
set_stacked_border(value.get_bool());
- } else if (key.str() == "ingen:selected") {
+ } else if (key == uris.ingen_selected) {
if (value.get_bool() != selected()) {
if (value.get_bool()) {
_canvas.lock()->select_item(shared_from_this());
@@ -173,7 +174,8 @@ PatchPortModule::set_selected(bool b)
if (b != selected()) {
Module::set_selected(b);
if (App::instance().signal())
- App::instance().engine()->set_property(_model->path(), "ingen:selected", b);
+ App::instance().engine()->set_property(_model->path(),
+ App::instance().uris().ingen_selected, b);
}
}
diff --git a/src/gui/PatchPortModule.hpp b/src/gui/PatchPortModule.hpp
index a5884b4b..e85b7c90 100644
--- a/src/gui/PatchPortModule.hpp
+++ b/src/gui/PatchPortModule.hpp
@@ -41,7 +41,7 @@ class Port;
class PortMenu;
-/** A "module" to represent a patch's port on it's own canvas.
+/** A "module" to represent a patch's port on its own canvas.
*
* Translation: This is the nameless single port pseudo module thingy.
*
diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp
index feb0606c..0ccc7344 100644
--- a/src/gui/PatchTreeWindow.cpp
+++ b/src/gui/PatchTreeWindow.cpp
@@ -18,6 +18,7 @@
#include "raul/log.hpp"
#include "raul/Path.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ClientStore.hpp"
#include "client/PatchModel.hpp"
#include "App.hpp"
@@ -93,7 +94,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
if (pm->path().is_root()) {
row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str();
} else {
- row[_patch_tree_columns.name_col] = pm->path().name();
+ row[_patch_tree_columns.name_col] = pm->symbol().c_str();
}
row[_patch_tree_columns.enabled_col] = pm->enabled();
row[_patch_tree_columns.patch_model_col] = pm;
@@ -105,7 +106,7 @@ PatchTreeWindow::add_patch(SharedPtr<PatchModel> pm)
if (c != children.end()) {
Gtk::TreeModel::iterator iter = _patch_treestore->append(c->children());
Gtk::TreeModel::Row row = *iter;
- row[_patch_tree_columns.name_col] = pm->path().name();
+ row[_patch_tree_columns.name_col] = pm->symbol().c_str();
row[_patch_tree_columns.enabled_col] = pm->enabled();
row[_patch_tree_columns.patch_model_col] = pm;
_patches_treeview->expand_row(_patch_treestore->get_path(iter), true);
@@ -191,7 +192,8 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str)
assert(pm);
if (_enable_signal)
- App::instance().engine()->set_property(pm->path(), "ingen:enabled", (bool)!pm->enabled());
+ App::instance().engine()->set_property(pm->path(),
+ App::instance().uris().ingen_enabled, (bool)!pm->enabled());
}
@@ -199,8 +201,9 @@ void
PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value,
SharedPtr<PatchModel> patch)
{
+ const LV2URIMap& uris = App::instance().uris();
_enable_signal = false;
- if (key.str() == "ingen:enabled" && value.type() == Atom::BOOL) {
+ if (key == uris.ingen_enabled && value.type() == Atom::BOOL) {
Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), patch);
if (i != _patch_treestore->children().end()) {
Gtk::TreeModel::Row row = *i;
@@ -223,7 +226,7 @@ PatchTreeWindow::patch_moved(SharedPtr<PatchModel> patch)
if (i != _patch_treestore->children().end()) {
Gtk::TreeModel::Row row = *i;
- row[_patch_tree_columns.name_col] = patch->path().name();
+ row[_patch_tree_columns.name_col] = patch->symbol().c_str();
} else {
LOG(error) << "Unable to find patch " << patch->path() << endl;
}
diff --git a/src/gui/PatchView.cpp b/src/gui/PatchView.cpp
index 6fce3797..434d455c 100644
--- a/src/gui/PatchView.cpp
+++ b/src/gui/PatchView.cpp
@@ -19,6 +19,7 @@
#include <fstream>
#include "raul/log.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "App.hpp"
#include "PatchView.hpp"
@@ -187,7 +188,8 @@ PatchView::process_toggled()
if (!_enable_signal)
return;
- App::instance().engine()->set_property(_patch->path(), "ingen:enabled",
+ App::instance().engine()->set_property(_patch->path(),
+ App::instance().uris().ingen_enabled,
(bool)_process_but->get_active());
}
@@ -195,7 +197,8 @@ PatchView::process_toggled()
void
PatchView::poly_changed()
{
- App::instance().engine()->set_property(_patch->meta().uri(), "ingen:polyphony",
+ App::instance().engine()->set_property(_patch->meta().uri(),
+ App::instance().uris().ingen_polyphony,
_poly_spin->get_value_as_int());
}
@@ -211,7 +214,7 @@ void
PatchView::property_changed(const Raul::URI& predicate, const Raul::Atom& value)
{
_enable_signal = false;
- if (predicate.str() == "ingen:enabled") {
+ if (predicate == App::instance().uris().ingen_enabled) {
if (value.type() == Atom::BOOL)
_process_but->set_active(value.get_bool());
else
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 70cade09..7367b453 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -17,8 +17,9 @@
#include <cassert>
#include "raul/log.hpp"
-#include "interface/EngineInterface.hpp"
#include "flowcanvas/Module.hpp"
+#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/PortModel.hpp"
#include "App.hpp"
@@ -39,6 +40,29 @@ namespace GUI {
ArtVpathDash* Port::_dash;
+
+SharedPtr<Port>
+Port::create(
+ boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ bool human_name,
+ bool flip)
+{
+ Glib::ustring label(human_name ? "" : pm->path().symbol());
+ if (human_name) {
+ const Raul::Atom& name = pm->get_property("lv2:name");
+ if (name.type() == Raul::Atom::STRING) {
+ label = name.get_string();
+ } else {
+ const SharedPtr<const NodeModel> parent(PtrCast<const NodeModel>(pm->parent()));
+ if (parent && parent->plugin_model())
+ label = parent->plugin_model()->port_human_name(pm->index());
+ }
+ }
+ return SharedPtr<Port>(new Port(module, pm, label, flip));
+}
+
+
/** @a flip Make an input port appear as an output port, and vice versa.
*/
Port::Port(
@@ -117,7 +141,8 @@ Port::create_menu()
void
Port::moved()
{
- set_name(model()->path().name());
+ if (App::instance().configuration()->name_style() == Configuration::PATH)
+ set_name(model()->symbol().c_str());
module().lock()->resize();
}
@@ -164,18 +189,22 @@ void
Port::set_control(float value, bool signal)
{
if (signal) {
+ App& app = App::instance();
+ Ingen::Shared::World* const world = app.world();
if (model()->type() == PortType::CONTROL) {
- App::instance().engine()->set_property(model()->path(), "ingen:value", Atom(value));
- PatchWindow* pw = App::instance().window_factory()->patch_window(
+ app.engine()->set_property(model()->path(),
+ world->uris->ingen_value, Atom(value));
+ PatchWindow* pw = app.window_factory()->patch_window(
PtrCast<PatchModel>(model()->parent()));
if (!pw)
- pw = App::instance().window_factory()->patch_window(
+ pw = app.window_factory()->patch_window(
PtrCast<PatchModel>(model()->parent()->parent()));
if (pw)
pw->show_port_status(model().get(), value);
} else if (model()->type() == PortType::EVENTS) {
- App::instance().engine()->set_property(model()->path(), "ingen:value",
+ app.engine()->set_property(model()->path(),
+ world->uris->ingen_value,
Atom("<http://example.org/ev#BangEvent>", 0, NULL));
}
}
@@ -187,15 +216,16 @@ Port::set_control(float value, bool signal)
void
Port::property_changed(const URI& key, const Atom& value)
{
+ const LV2URIMap& uris = App::instance().uris();
if (value.type() == Atom::FLOAT) {
- if (key.str() == "ingen:value")
+ if (key == uris.ingen_value && !_pressed)
set_control(value.get_float(), false);
- else if (key.str() == "lv2:minimum")
+ else if (key == uris.lv2_minimum)
set_control_min(value.get_float());
- else if (key.str() == "lv2:maximum")
+ else if (key == uris.lv2_maximum)
set_control_max(value.get_float());
} else if (value.type() == Atom::BOOL) {
- if ((key.str() == "lv2:toggled"))
+ if ((key == uris.lv2_toggled))
set_toggled(value.get_bool());
} else if (value.type() == Atom::URI) {
ArtVpathDash* dash = this->dash();
diff --git a/src/gui/Port.hpp b/src/gui/Port.hpp
index ae105fb0..2d1d21ff 100644
--- a/src/gui/Port.hpp
+++ b/src/gui/Port.hpp
@@ -41,10 +41,11 @@ namespace GUI {
class Port : public FlowCanvas::Port
{
public:
- Port(boost::shared_ptr<FlowCanvas::Module> module,
- SharedPtr<PortModel> pm,
- const std::string& name,
- bool flip=false);
+ static SharedPtr<Port> create(
+ boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ bool human_name,
+ bool flip=false);
~Port();
@@ -60,6 +61,11 @@ public:
ArtVpathDash* dash();
private:
+ Port(boost::shared_ptr<FlowCanvas::Module> module,
+ SharedPtr<PortModel> pm,
+ const std::string& name,
+ bool flip=false);
+
void property_changed(const Raul::URI& key, const Raul::Atom& value);
bool on_event(GdkEvent* ev);
diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp
index ffa3422f..d52500bc 100644
--- a/src/gui/PortMenu.cpp
+++ b/src/gui/PortMenu.cpp
@@ -18,6 +18,7 @@
#include <gtkmm.h>
#include "raul/SharedPtr.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/PortModel.hpp"
#include "App.hpp"
@@ -98,27 +99,29 @@ PortMenu::on_menu_disconnect()
void
PortMenu::on_menu_set_min()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
- const Raul::Atom& value = model->get_property("ingen:value");
- std::cout << model->path() << " SET MIN " << value << std::endl;
+ const Raul::Atom& value = model->get_property(uris.ingen_value);
if (value.is_valid())
- App::instance().engine()->set_property(_object->path(), "lv2:minimum", value);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_minimum, value);
}
void
PortMenu::on_menu_set_max()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
- const Raul::Atom& value = model->get_property("ingen:value");
+ const Raul::Atom& value = model->get_property(uris.ingen_value);
if (value.is_valid())
- App::instance().engine()->set_property(_object->path(), "lv2:maximum", value);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_maximum, value);
}
void
PortMenu::on_menu_reset_range()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> model = PtrCast<PortModel>(_object);
SharedPtr<NodeModel> parent = PtrCast<NodeModel>(_object->parent());
@@ -126,10 +129,10 @@ PortMenu::on_menu_reset_range()
parent->default_port_value_range(model, min, max);
if (!isnan(min))
- App::instance().engine()->set_property(_object->path(), "lv2:minimum", min);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_minimum, min);
if (!isnan(max))
- App::instance().engine()->set_property(_object->path(), "lv2:maximum", max);
+ App::instance().engine()->set_property(_object->path(), uris.lv2_maximum, max);
}
diff --git a/src/gui/PortPropertiesWindow.cpp b/src/gui/PortPropertiesWindow.cpp
index 8b5af899..14cd9b1f 100644
--- a/src/gui/PortPropertiesWindow.cpp
+++ b/src/gui/PortPropertiesWindow.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <string>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
#include "App.hpp"
@@ -94,12 +95,13 @@ PortPropertiesWindow::present(SharedPtr<PortModel> pm)
void
PortPropertiesWindow::property_change(const URI& key, const Atom& value)
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
//_enable_signal = false;
if (value.type() == Atom::FLOAT) {
- if (key.str() == "lv2:minimum")
+ if (key == uris.lv2_minimum)
_min_spinner->set_value(value.get_float());
- else if (key.str() == "lv2:maximum")
+ else if (key == uris.lv2_maximum)
_max_spinner->set_value(value.get_float());
}
@@ -155,9 +157,10 @@ PortPropertiesWindow::cancel()
void
PortPropertiesWindow::ok()
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
Shared::Resource::Properties props;
- props.insert(make_pair("lv2:minimum", float(_min_spinner->get_value())));
- props.insert(make_pair("lv2:maximum", float(_max_spinner->get_value())));
+ props.insert(make_pair(uris.lv2_minimum, float(_min_spinner->get_value())));
+ props.insert(make_pair(uris.lv2_maximum, float(_max_spinner->get_value())));
App::instance().engine()->put(_port_model->meta().uri(), props);
hide();
}
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index 32210466..c50ec213 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -55,7 +55,7 @@ void
RenameWindow::set_object(SharedPtr<ObjectModel> object)
{
_object = object;
- _symbol_entry->set_text(object->path().name());
+ _symbol_entry->set_text(object->path().symbol());
const Atom& name_atom = object->get_property("lv2:name");
_label_entry->set_text(
(name_atom.type() == Atom::STRING) ? name_atom.get_string() : "");
@@ -125,19 +125,22 @@ RenameWindow::cancel_clicked()
void
RenameWindow::ok_clicked()
{
- const string& symbol = _symbol_entry->get_text();
- const string& label = _label_entry->get_text();
- Path path = _object->path();
- const Atom& name_atom = _object->get_property("lv2:name");
-
- if (Path::is_valid_name(symbol) && symbol != _object->path().name()) {
- path = _object->path().parent().base() + symbol;
- App::instance().engine()->move(_object->path(), path);
+ const string& symbol_str = _symbol_entry->get_text();
+ const string& label = _label_entry->get_text();
+ Path path = _object->path();
+ const Atom& name_atom = _object->get_property("lv2:name");
+
+ if (Symbol::is_valid(symbol_str)) {
+ const Symbol& symbol(symbol_str);
+ if (symbol != _object->symbol()) {
+ path = _object->path().parent().child(symbol);
+ App::instance().engine()->move(_object->path(), path);
+ }
}
if (label != "" && (!name_atom.is_valid() || label != name_atom.get_string())) {
App::instance().engine()->set_property(path,
- "lv2:name", Atom(Atom::STRING, label));
+ "lv2:name", Atom(label));
}
hide();
diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp
index 08e5b726..300bcc71 100644
--- a/src/gui/UploadPatchWindow.cpp
+++ b/src/gui/UploadPatchWindow.cpp
@@ -238,8 +238,8 @@ UploadPatchWindow::upload_clicked()
Glib::ustring short_name = _short_name_entry->get_text();
GraphObject::Properties extra_rdf;
- extra_rdf.insert(make_pair("lv2:symbol", Atom(Atom::STRING, symbol)));
- extra_rdf.insert(make_pair("doap:name", Atom(Atom::STRING, short_name)));
+ extra_rdf.insert(make_pair("lv2:symbol", symbol));
+ extra_rdf.insert(make_pair("doap:name", short_name));
_response = 0;
_progress_pct = 0;