summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
committerDavid Robillard <d@drobilla.net>2010-02-03 04:46:56 +0000
commit87597f85c5a69a9accd3ce2ed88f2a006173e885 (patch)
treea3ffa393e9aecbc55dae64bad3bd45ee317e6d26 /src/gui
parenta645d2b8be4d7d31f6eef1649156b166a01e0c31 (diff)
downloadingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.gz
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.tar.bz2
ingen-87597f85c5a69a9accd3ce2ed88f2a006173e885.zip
Comprehensive use of cached URIs and more advanced Value (Atom) system.
Atoms (e.g. property values or port values) can now be an Atom::DICT, which maps directly to/from an RDF resource. This is now used to store control bindings as a port property, eliminating the special API. Full interned URIs used everywhere, instead of CURIEs pretending to be URIs. Avoid converting string literals to URIs all over the place. Support for binding MIDI pitch bender and MIDI channel pressure. Saving/restoring of MIDI bindings as a free side-effect of the above. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2409 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/LoadPluginWindow.cpp12
-rw-r--r--src/gui/NodeModule.cpp5
-rw-r--r--src/gui/PatchCanvas.cpp20
-rw-r--r--src/gui/PatchWindow.cpp12
-rw-r--r--src/gui/Port.cpp10
-rw-r--r--src/gui/PropertiesWindow.cpp16
-rw-r--r--src/gui/RenameWindow.cpp10
-rw-r--r--src/gui/UploadPatchWindow.cpp12
8 files changed, 58 insertions, 39 deletions
diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp
index e6cc1b4e..cdf6cc1f 100644
--- a/src/gui/LoadPluginWindow.cpp
+++ b/src/gui/LoadPluginWindow.cpp
@@ -229,16 +229,17 @@ LoadPluginWindow::new_plugin(SharedPtr<PluginModel> pm)
void
LoadPluginWindow::add_plugin(SharedPtr<PluginModel> plugin)
{
+ const LV2URIMap& uris = App::instance().uris();
Gtk::TreeModel::iterator iter = _plugins_liststore->append();
Gtk::TreeModel::Row row = *iter;
_rows.insert(make_pair(plugin->uri(), iter));
- const Atom& name = plugin->get_property("doap:name");
+ const Atom& name = plugin->get_property(uris.doap_name);
if (name.is_valid()) {
if (name.type() == Atom::STRING)
row[_plugins_columns._col_name] = name.get_string();
} else if (plugin->type() == Plugin::LADSPA) {
- App::instance().engine()->request_property(plugin->uri(), "doap:name");
+ App::instance().engine()->request_property(plugin->uri(), uris.doap_name);
}
switch (plugin->type()) {
@@ -388,12 +389,13 @@ LoadPluginWindow::filter_changed()
Gtk::TreeModel::Row model_row;
Gtk::TreeModel::iterator model_iter;
size_t num_visible = 0;
+ const LV2URIMap& uris = App::instance().uris();
for (ClientStore::Plugins::const_iterator i = App::instance().store()->plugins()->begin();
i != App::instance().store()->plugins()->end(); ++i) {
const SharedPtr<PluginModel> plugin = (*i).second;
- const Atom& name = plugin->get_property("doap:name");
+ const Atom& name = plugin->get_property(uris.doap_name);
switch (criteria) {
case CriteriaColumns::NAME:
@@ -401,7 +403,7 @@ LoadPluginWindow::filter_changed()
field = name.get_string();
break;
case CriteriaColumns::TYPE:
- field = plugin->type_uri(); break;
+ field = plugin->type_uri().str(); break;
case CriteriaColumns::URI:
field = plugin->uri().str(); break;
default:
@@ -415,7 +417,7 @@ LoadPluginWindow::filter_changed()
model_row = *model_iter;
model_row[_plugins_columns._col_name] = name.is_valid() ? name.get_string() : "";
- model_row[_plugins_columns._col_type] = plugin->type_uri();
+ model_row[_plugins_columns._col_type] = plugin->type_uri().str();
model_row[_plugins_columns._col_uri] = plugin->uri().str();
model_row[_plugins_columns._col_plugin] = plugin;
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index 277a65ad..024e054d 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -185,6 +185,7 @@ NodeModule::plugin_changed()
void
NodeModule::embed_gui(bool embed)
{
+ const LV2URIMap& uris = App::instance().uris();
if (embed) {
if (_gui_window) {
@@ -217,7 +218,7 @@ NodeModule::embed_gui(bool embed)
for (NodeModel::Ports::const_iterator p = _node->ports().begin();
p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
- App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", true);
+ App::instance().engine()->set_property((*p)->path(), uris.ingen_broadcast, true);
}
} else { // un-embed
@@ -227,7 +228,7 @@ NodeModule::embed_gui(bool embed)
for (NodeModel::Ports::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p)
if ((*p)->type().is_control() && (*p)->is_output())
- App::instance().engine()->set_property((*p)->path(), "ingen:broadcast", false);
+ App::instance().engine()->set_property((*p)->path(), uris.ingen_broadcast, false);
}
if (embed && _embed_item) {
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index 45e6ec66..cd2469d1 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -89,22 +89,22 @@ PatchCanvas::PatchCanvas(SharedPtr<PatchModel> patch, int width, int height)
// 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:AudioPort", false));
+ "audio_in", "Audio In", "http://lv2plug.in/ns/lv2core#AudioPort", false));
_menu_add_audio_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "audio_out", "Audio Out", "lv2:AudioPort", true));
+ "audio_out", "Audio Out", "http://lv2plug.in/ns/lv2core#AudioPort", true));
_menu_add_control_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "control_in", "Control In", "lv2:ControlPort", false));
+ "control_in", "Control In", "http://lv2plug.in/ns/lv2core#ControlPort", false));
_menu_add_control_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "control_out", "Control Out", "lv2:ControlPort", true));
+ "control_out", "Control Out", "http://lv2plug.in/ns/lv2core#ControlPort", true));
_menu_add_event_input->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "event_in", "Event In", "lv2ev:EventPort", false));
+ "event_in", "Event In", "http://lv2plug.in/ns/ext/event#EventPort", false));
_menu_add_event_output->signal_activate().connect(
sigc::bind(sigc::mem_fun(this, &PatchCanvas::menu_add_port),
- "event_out", "Event Out", "lv2ev:EventPort", true));
+ "event_out", "Event Out", "http://lv2plug.in/ns/ext/event#EventPort", true));
// Connect to model signals to track state
_patch->signal_new_node.connect(sigc::mem_fun(this, &PatchCanvas::add_node));
@@ -750,8 +750,7 @@ PatchCanvas::menu_add_port(const string& sym_base, const string& name_base,
Resource::Properties props = get_initial_data();
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(uris.rdf_type, is_output ? uris.lv2_OutputPort : uris.lv2_InputPort));
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);
@@ -801,8 +800,9 @@ GraphObject::Properties
PatchCanvas::get_initial_data()
{
GraphObject::Properties result;
- result.insert(make_pair("ingenui:canvas-x", Atom((float)_last_click_x)));
- result.insert(make_pair("ingenui:canvas-y", Atom((float)_last_click_y)));
+ const LV2URIMap& uris = App::instance().uris();
+ result.insert(make_pair(uris.ingenui_canvas_x, Atom((float)_last_click_x)));
+ result.insert(make_pair(uris.ingenui_canvas_y, Atom((float)_last_click_y)));
return result;
}
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index 13c1f2ff..796837e3 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -22,6 +22,7 @@
#include <boost/format.hpp>
#include "raul/AtomRDF.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
#include "App.hpp"
@@ -93,7 +94,7 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad
_menu_view_control_window->property_sensitive() = false;
string engine_name = App::instance().engine()->uri().str();
- if (engine_name == "ingen:internal")
+ if (engine_name == "http://drobilla.net/ns/ingen#internal")
engine_name = "internal engine";
_status_bar->push(string("Connected to ") + engine_name, STATUS_CONTEXT_ENGINE);
@@ -405,7 +406,7 @@ PatchWindow::event_import_location()
void
PatchWindow::event_save()
{
- const Raul::Atom& document = _patch->get_property("ingen:document");
+ const Raul::Atom& document = _patch->get_property(App::instance().uris().ingen_document);
if (!document.is_valid() || document.type() != Raul::Atom::URI) {
event_save_as();
} else {
@@ -420,6 +421,7 @@ PatchWindow::event_save()
void
PatchWindow::event_save_as()
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
while (true) {
Gtk::FileChooserDialog dialog(*this, "Save Patch", Gtk::FILE_CHOOSER_ACTION_SAVE);
@@ -435,7 +437,7 @@ PatchWindow::event_save_as()
dialog.set_filter(filt);
// Set current folder to most sensible default
- const Raul::Atom& document = _patch->get_property("ingen:document");
+ const Raul::Atom& document = _patch->get_property(uris.ingen_document);
if (document.type() == Raul::Atom::URI)
dialog.set_uri(document.get_uri());
else if (App::instance().configuration()->patch_folder().length() > 0)
@@ -468,7 +470,7 @@ PatchWindow::event_save_as()
if (!is_bundle && !is_patch)
filename += ".ingen.ttl";
- _patch->set_property("lv2:symbol", Atom(base.c_str()));
+ _patch->set_property(uris.lv2_symbol, Atom(base.c_str()));
bool confirm = true;
std::fstream fin;
@@ -485,7 +487,7 @@ PatchWindow::event_save_as()
if (confirm) {
const Glib::ustring uri = Glib::filename_to_uri(filename);
App::instance().loader()->save_patch(_patch, uri);
- _patch->set_property("ingen:document", Atom(Atom::URI, uri.c_str()));
+ _patch->set_property(uris.ingen_document, Atom(Atom::URI, uri.c_str()));
_status_bar->push(
(boost::format("Wrote %1% to %2%") % _patch->path() % uri).str(),
STATUS_CONTEXT_PATCH);
diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp
index 7367b453..d710f10d 100644
--- a/src/gui/Port.cpp
+++ b/src/gui/Port.cpp
@@ -50,7 +50,7 @@ Port::create(
{
Glib::ustring label(human_name ? "" : pm->path().symbol());
if (human_name) {
- const Raul::Atom& name = pm->get_property("lv2:name");
+ const Raul::Atom& name = pm->get_property(App::instance().uris().lv2_name);
if (name.type() == Raul::Atom::STRING) {
label = name.get_string();
} else {
@@ -205,7 +205,7 @@ Port::set_control(float value, bool signal)
} else if (model()->type() == PortType::EVENTS) {
app.engine()->set_property(model()->path(),
world->uris->ingen_value,
- Atom("<http://example.org/ev#BangEvent>", 0, NULL));
+ Atom("http://example.org/ev#BangEvent", 0, NULL));
}
}
@@ -238,13 +238,13 @@ Port::property_changed(const URI& key, const Atom& value)
ArtVpathDash*
Port::dash()
{
+ const LV2URIMap& uris = App::instance().uris();
SharedPtr<PortModel> pm = _port_model.lock();
if (!pm)
return NULL;
- const Raul::Atom& context = pm->get_property("ctx:context");
- if (!context.is_valid() || context.type() != Atom::URI
- || !strcmp(context.get_uri(), "ctx:AudioContext"))
+ const Raul::Atom& context = pm->get_property(uris.ctx_context);
+ if (!context.is_valid() || context.type() != Atom::URI || context == uris.ctx_AudioContext)
return NULL;
if (!_dash) {
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 51ca4817..8890770a 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -18,6 +18,8 @@
#include <cassert>
#include <string>
#include "raul/log.hpp"
+#include "module/ingen_module.hpp"
+#include "module/World.hpp"
#include "client/NodeModel.hpp"
#include "client/PluginModel.hpp"
#include "App.hpp"
@@ -77,6 +79,8 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model)
set_title(model->path().chop_scheme() + " Properties - Ingen");
+ Shared::World* world = ingen_get_world();
+
ostringstream ss;
unsigned n_rows = 0;
for (ObjectModel::Properties::const_iterator i = model->properties().begin();
@@ -86,7 +90,7 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model)
const Raul::Atom& value = i->second;
// Column 0: Property
- Gtk::Label* lab = manage(new Gtk::Label(i->first.str(), 0.0, 0.5));
+ Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world->qualify(i->first.str()), 0.0, 0.5));
_table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK);
// Column 1: Type
@@ -102,7 +106,8 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model)
// Column 2: Value
align = manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
Gtk::Widget* value_widget = create_value_widget(i->first, value);
- align->add(*value_widget);
+ if (value_widget)
+ align->add(*value_widget);
_table->attach(*align, 2, 3, n_rows, n_rows + 1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
_records.insert(make_pair(i->first, Record(value, combo, align, n_rows)));
}
@@ -161,6 +166,7 @@ PropertiesWindow::create_value_widget(const Raul::URI& uri, const Raul::Atom& va
return widget;
}
+ LOG(error) << "Unable to create widget for value " << value << endl;
return NULL;
}
@@ -206,9 +212,11 @@ PropertiesWindow::property_changed(const Raul::URI& predicate, const Raul::Atom&
Gtk::Widget* value_widget = create_value_widget(predicate, value);
record.value_widget->remove();
- record.value_widget->add(*value_widget);
+ if (value_widget) {
+ record.value_widget->add(*value_widget);
+ value_widget->show();
+ }
record.value = value;
- value_widget->show();
}
diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp
index c50ec213..f7fa86a9 100644
--- a/src/gui/RenameWindow.cpp
+++ b/src/gui/RenameWindow.cpp
@@ -18,6 +18,7 @@
#include <cassert>
#include <string>
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ObjectModel.hpp"
#include "client/ClientStore.hpp"
#include "App.hpp"
@@ -56,7 +57,7 @@ RenameWindow::set_object(SharedPtr<ObjectModel> object)
{
_object = object;
_symbol_entry->set_text(object->path().symbol());
- const Atom& name_atom = object->get_property("lv2:name");
+ const Atom& name_atom = object->get_property("http://lv2plug.in/ns/lv2core#name");
_label_entry->set_text(
(name_atom.type() == Atom::STRING) ? name_atom.get_string() : "");
}
@@ -125,10 +126,12 @@ RenameWindow::cancel_clicked()
void
RenameWindow::ok_clicked()
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
+
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");
+ const Atom& name_atom = _object->get_property(uris.lv2_name);
if (Symbol::is_valid(symbol_str)) {
const Symbol& symbol(symbol_str);
@@ -139,8 +142,7 @@ RenameWindow::ok_clicked()
}
if (label != "" && (!name_atom.is_valid() || label != name_atom.get_string())) {
- App::instance().engine()->set_property(path,
- "lv2:name", Atom(label));
+ App::instance().engine()->set_property(path, uris.lv2_name, Atom(label));
}
hide();
diff --git a/src/gui/UploadPatchWindow.cpp b/src/gui/UploadPatchWindow.cpp
index 300bcc71..1804ff06 100644
--- a/src/gui/UploadPatchWindow.cpp
+++ b/src/gui/UploadPatchWindow.cpp
@@ -23,6 +23,7 @@
#include <curl/curl.h>
#include "redlandmm/Query.hpp"
#include "module/World.hpp"
+#include "shared/LV2URIMap.hpp"
#include "client/ClientStore.hpp"
#include "interface/EngineInterface.hpp"
#include "serialisation/Serialiser.hpp"
@@ -72,13 +73,14 @@ UploadPatchWindow::present(SharedPtr<PatchModel> patch)
void
UploadPatchWindow::on_show()
{
+ const Shared::LV2URIMap& uris = App::instance().uris();
Gtk::Dialog::on_show();
- Raul::Atom atom = _patch->get_property("lv2:symbol");
+ Raul::Atom atom = _patch->get_property(uris.lv2_symbol);
if (atom.is_valid())
_symbol_entry->set_text(atom.get_string());
- atom = _patch->get_property("doap:name");
+ atom = _patch->get_property(uris.doap_name);
if (atom.is_valid())
_short_name_entry->set_text(atom.get_string());
}
@@ -234,12 +236,14 @@ UploadPatchWindow::upload_clicked()
{
assert(!_thread);
+ const Shared::LV2URIMap& uris = App::instance().uris();
+
Glib::ustring symbol = _symbol_entry->get_text();
Glib::ustring short_name = _short_name_entry->get_text();
GraphObject::Properties extra_rdf;
- extra_rdf.insert(make_pair("lv2:symbol", symbol));
- extra_rdf.insert(make_pair("doap:name", short_name));
+ extra_rdf.insert(make_pair(uris.lv2_symbol, symbol));
+ extra_rdf.insert(make_pair(uris.doap_name, short_name));
_response = 0;
_progress_pct = 0;