summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
committerDavid Robillard <d@drobilla.net>2007-05-01 04:01:04 +0000
commit3e5fef2e59776923f175a4260adf18c559ab861f (patch)
tree5c83291c595830ac472e5661de83d4560513a9d6 /src/progs/ingenuity
parent71b5ad39baceacb5d7aa75050fd8c76bfb16fb76 (diff)
downloadingen-3e5fef2e59776923f175a4260adf18c559ab861f.tar.gz
ingen-3e5fef2e59776923f175a4260adf18c559ab861f.tar.bz2
ingen-3e5fef2e59776923f175a4260adf18c559ab861f.zip
Converted Raul (and thus Ingen and Machina) to use Redland over Raptor/Rasqal independently.
Fixed patch loading for Ingen (local only, still something wrong with remote...). git-svn-id: http://svn.drobilla.net/lad/ingen@486 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r--src/progs/ingenuity/App.cpp12
-rw-r--r--src/progs/ingenuity/App.h5
-rw-r--r--src/progs/ingenuity/ControlGroups.cpp4
-rw-r--r--src/progs/ingenuity/LoadPluginWindow.cpp8
-rw-r--r--src/progs/ingenuity/LoadRemotePatchWindow.cpp18
-rw-r--r--src/progs/ingenuity/LoadSubpatchWindow.cpp2
-rw-r--r--src/progs/ingenuity/PatchCanvas.cpp2
-rw-r--r--src/progs/ingenuity/PortPropertiesWindow.cpp16
-rw-r--r--src/progs/ingenuity/ThreadedLoader.cpp5
-rw-r--r--src/progs/ingenuity/UploadPatchWindow.cpp2
-rw-r--r--src/progs/ingenuity/main.cpp1
11 files changed, 51 insertions, 24 deletions
diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp
index 4bd12efa..e1e4912d 100644
--- a/src/progs/ingenuity/App.cpp
+++ b/src/progs/ingenuity/App.cpp
@@ -71,8 +71,19 @@ App::App()
glade_xml->get_widget_derived("config_win", _config_window);
glade_xml->get_widget("about_win", _about_dialog);
+ _rdf_world.add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#");
+ _rdf_world.add_prefix("ingen", "http://drobilla.net/ns/ingen#");
+ _rdf_world.add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
+ _rdf_world.add_prefix("lv2", "http://lv2plug.in/ontology#");
+ _rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
+ _rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#");
_config_window->configuration(_configuration);
+
+#ifdef HAVE_SLV2
+ SLV2World slv2_world = slv2_world_new_using_rdf_world(_rdf_world.world());
+ PluginModel::set_slv2_world(slv2_world);
+#endif
}
@@ -80,6 +91,7 @@ App::~App()
{
}
+
void
App::instantiate()
{
diff --git a/src/progs/ingenuity/App.h b/src/progs/ingenuity/App.h
index 62968864..aaf33893 100644
--- a/src/progs/ingenuity/App.h
+++ b/src/progs/ingenuity/App.h
@@ -26,6 +26,7 @@
#include <libgnomecanvasmm.h>
#include <gtkmm.h>
#include <libglademm.h>
+#include <raul/RDFWorld.h>
#include <raul/SharedPtr.h>
using std::string; using std::map; using std::list;
using std::cerr; using std::endl;
@@ -85,6 +86,8 @@ public:
PatchTreeWindow* patch_tree() const { return _patch_tree_window; }
Configuration* configuration() const { return _configuration; }
WindowFactory* window_factory() const { return _window_factory; }
+
+ Raul::RDF::World* rdf_world() { return &_rdf_world; }
const SharedPtr<ModelEngineInterface>& engine() const { return _engine; }
const SharedPtr<SigClientInterface>& client() const { return _client; }
@@ -112,6 +115,8 @@ protected:
Gtk::Dialog* _about_dialog;
WindowFactory* _window_factory;
+ Raul::RDF::World _rdf_world;
+
/** Used to avoid feedback loops with (eg) process checkbutton
* FIXME: Maybe this should be globally implemented at the Controller level,
* disable all command sending while handling events to avoid feedback
diff --git a/src/progs/ingenuity/ControlGroups.cpp b/src/progs/ingenuity/ControlGroups.cpp
index 4958f5be..f775709a 100644
--- a/src/progs/ingenuity/ControlGroups.cpp
+++ b/src/progs/ingenuity/ControlGroups.cpp
@@ -108,8 +108,8 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm)
float min = 0.0f;
float max = 1.0f;
- const Atom& min_atom = pm->get_metadata("min");
- const Atom& max_atom = pm->get_metadata("max");
+ const Atom& min_atom = pm->get_metadata("ingen:minimum");
+ const Atom& max_atom = pm->get_metadata("ingen:maximum");
if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) {
min = min_atom.get_float();
max = max_atom.get_float();
diff --git a/src/progs/ingenuity/LoadPluginWindow.cpp b/src/progs/ingenuity/LoadPluginWindow.cpp
index 3607ba23..d0311446 100644
--- a/src/progs/ingenuity/LoadPluginWindow.cpp
+++ b/src/progs/ingenuity/LoadPluginWindow.cpp
@@ -191,6 +191,14 @@ LoadPluginWindow::plugin_compare(const Gtk::TreeModel::iterator& a_i,
SharedPtr<PluginModel> a = a_i->get_value(_plugins_columns._col_plugin_model);
SharedPtr<PluginModel> b = b_i->get_value(_plugins_columns._col_plugin_model);
+ // FIXME: haaack
+ if (!a && !b)
+ return 0;
+ else if (!a)
+ return 1;
+ else if (!b)
+ return -1;
+
if (a->type() == b->type())
return strcmp(a->name().c_str(), b->name().c_str());
else
diff --git a/src/progs/ingenuity/LoadRemotePatchWindow.cpp b/src/progs/ingenuity/LoadRemotePatchWindow.cpp
index ec49f70f..12006f3f 100644
--- a/src/progs/ingenuity/LoadRemotePatchWindow.cpp
+++ b/src/progs/ingenuity/LoadRemotePatchWindow.cpp
@@ -63,24 +63,22 @@ LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data)
set_patch(patch);
_initial_data = data;
+
+ RDF::Model model(*App::instance().rdf_world(),
+ "http://rdf.drobilla.net/ingen_patches/index.ttl");
- Namespaces namespaces;
- namespaces["ingen"] = "http://drobilla.net/ns/ingen#";
- namespaces["rdfs"] = "http://www.w3.org/2000/01/rdf-schema#";
- namespaces["doap"] = "http://usefulinc.com/ns/doap#";
-
- RDFQuery query(namespaces, Glib::ustring(
+ RDF::Query query(*App::instance().rdf_world(), Glib::ustring(
"SELECT DISTINCT ?name ?uri FROM <> WHERE {"
" ?uri a ingen:Patch ;"
" doap:name ?name ."
"}"));
- RDFQuery::Results results = query.run("http://rdf.drobilla.net/ingen_patches/index.ttl");
+ RDF::Query::Results results = query.run(*App::instance().rdf_world(), model);
- for (RDFQuery::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
Gtk::TreeModel::iterator iter = _liststore->append();
- (*iter)[_columns._col_name] = (*i)["name"];
- (*iter)[_columns._col_uri] = (*i)["uri"];
+ (*iter)[_columns._col_name] = (*i)["name"].to_string();
+ (*iter)[_columns._col_uri] = (*i)["uri"].to_string();
}
_treeview->columns_autosize();
diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp
index 22beb70f..37648ca8 100644
--- a/src/progs/ingenuity/LoadSubpatchWindow.cpp
+++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp
@@ -156,7 +156,7 @@ LoadSubpatchWindow::ok_clicked()
else if (_poly_from_parent_radio->get_active())
poly = _patch->poly();
- App::instance().loader()->load_patch(false, get_filename(), "/",
+ App::instance().loader()->load_patch(false, get_uri(), "/",
_initial_data, _patch->path(), name, poly);
hide();
diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp
index af99d4d1..38fd0d87 100644
--- a/src/progs/ingenuity/PatchCanvas.cpp
+++ b/src/progs/ingenuity/PatchCanvas.cpp
@@ -405,7 +405,7 @@ PatchCanvas::destroy_selection()
void
PatchCanvas::copy_selection()
{
- Serializer serializer;
+ Serializer serializer(*App::instance().rdf_world());
serializer.start_to_string();
for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) {
diff --git a/src/progs/ingenuity/PortPropertiesWindow.cpp b/src/progs/ingenuity/PortPropertiesWindow.cpp
index b7a78ebc..3a490a74 100644
--- a/src/progs/ingenuity/PortPropertiesWindow.cpp
+++ b/src/progs/ingenuity/PortPropertiesWindow.cpp
@@ -66,8 +66,8 @@ PortPropertiesWindow::init(ControlGroup* control, SharedPtr<PortModel> pm)
float min = 0.0f;
float max = 1.0f;
- const Atom& min_atom = pm->get_metadata("min");
- const Atom& max_atom = pm->get_metadata("max");
+ const Atom& min_atom = pm->get_metadata("ingen:minimum");
+ const Atom& max_atom = pm->get_metadata("ingen_maximum");
if (min_atom.type() == Atom::FLOAT && max_atom.type() == Atom::FLOAT) {
min = min_atom.get_float();
max = max_atom.get_float();
@@ -108,9 +108,9 @@ PortPropertiesWindow::metadata_update(const string& key, const Atom& value)
{
_enable_signal = false;
- if ( (key == "min") && value.type() == Atom::FLOAT)
+ if ( (key == "ingen:minimum") && value.type() == Atom::FLOAT)
_min_spinner->set_value(value.get_float());
- else if ( (key == "max") && value.type() == Atom::FLOAT)
+ else if ( (key == "ingen:maximum") && value.type() == Atom::FLOAT)
_max_spinner->set_value(value.get_float());
_enable_signal = true;
@@ -131,7 +131,7 @@ PortPropertiesWindow::min_changed()
_control->set_range(min, max);
if (_enable_signal)
- App::instance().engine()->set_metadata(_port_model->path(), "min", min);
+ App::instance().engine()->set_metadata(_port_model->path(), "ingen:minimum", min);
}
@@ -149,15 +149,15 @@ PortPropertiesWindow::max_changed()
_control->set_range(min, max);
if (_enable_signal)
- App::instance().engine()->set_metadata(_port_model->path(), "max", max);
+ App::instance().engine()->set_metadata(_port_model->path(), "ingen:maximum", max);
}
void
PortPropertiesWindow::cancel()
{
- App::instance().engine()->set_metadata(_port_model->path(), "min", _initial_min);
- App::instance().engine()->set_metadata(_port_model->path(), "max", _initial_max);
+ App::instance().engine()->set_metadata(_port_model->path(), "ingen:minimum", _initial_min);
+ App::instance().engine()->set_metadata(_port_model->path(), "ingen:maximum", _initial_max);
delete this;
}
diff --git a/src/progs/ingenuity/ThreadedLoader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp
index 0ba2bb33..118d252f 100644
--- a/src/progs/ingenuity/ThreadedLoader.cpp
+++ b/src/progs/ingenuity/ThreadedLoader.cpp
@@ -20,6 +20,7 @@
#include <cassert>
#include <string>
#include "PatchModel.h"
+#include "App.h"
using std::cout; using std::endl;
namespace Ingenuity {
@@ -27,7 +28,8 @@ namespace Ingenuity {
ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine)
: _deprecated_loader(engine)
- , _loader(engine)
+ , _loader(engine, App::instance().rdf_world())
+ , _serializer(*App::instance().rdf_world())
{
// FIXME: rework this so the thread is only present when it's doing something (save mem)
start();
@@ -77,6 +79,7 @@ ThreadedLoader::load_patch(bool merge,
} else {
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_loader, &Loader::load),
+ App::instance().rdf_world(),
data_base_uri,
engine_parent,
(engine_name) ? engine_name.get() : "",
diff --git a/src/progs/ingenuity/UploadPatchWindow.cpp b/src/progs/ingenuity/UploadPatchWindow.cpp
index 3eccd600..6c68236d 100644
--- a/src/progs/ingenuity/UploadPatchWindow.cpp
+++ b/src/progs/ingenuity/UploadPatchWindow.cpp
@@ -246,7 +246,7 @@ UploadPatchWindow::upload_clicked()
_upload_progress->set_fraction(0.0);
_upload_progress->set_text("");
- Serializer s;
+ Serializer s(*App::instance().rdf_world());
s.start_to_string();
s.serialize(_patch);
const string str = s.finish();
diff --git a/src/progs/ingenuity/main.cpp b/src/progs/ingenuity/main.cpp
index 4e5789c8..8170833f 100644
--- a/src/progs/ingenuity/main.cpp
+++ b/src/progs/ingenuity/main.cpp
@@ -45,6 +45,7 @@ main(int argc, char** argv)
Gnome::Canvas::init();
Gtk::Main gtk_main(argc, argv);
+ Gtk::Window::set_default_icon_from_file(PKGDATADIR "/ingen-icon.svg");
/* Instantiate all singletons */
App::instantiate();