From 42936aa5d924ca89fe3d887fd0ffeb7a281b547e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 16 Aug 2008 18:45:27 +0000 Subject: Add missing Store.cpp. More serialisation work. git-svn-id: http://svn.drobilla.net/lad/ingen@1402 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/App.cpp | 42 ++++++++++++++++---------------------- src/libs/gui/App.hpp | 4 +++- src/libs/gui/PatchCanvas.cpp | 2 +- src/libs/gui/UploadPatchWindow.cpp | 3 ++- 4 files changed, 24 insertions(+), 27 deletions(-) (limited to 'src/libs/gui') diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index a0a877d5..34f04f35 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -73,18 +73,6 @@ App::App(Ingen::Shared::World* world) , _world(world) , _enable_signal(true) { - // FIXME: defer loading of serialisation module until needed - if (!world->serialisation_module) - world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - - if (world->serialisation_module) - if (!world->serialiser) - world->serialiser = SharedPtr( - Ingen::Serialisation::new_serialiser(world)); - - if (!world->serialiser) - cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl; - Glib::RefPtr glade_xml = GladeFactory::new_glade_reference(); glade_xml->get_widget_derived("connect_win", _connect_window); @@ -93,18 +81,7 @@ App::App(Ingen::Shared::World* world) glade_xml->get_widget("about_win", _about_dialog); _about_dialog->property_program_name() = "Ingen"; - Redland::World& rdf_world = *world->rdf_world; - - 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/ns/lv2core#"); - rdf_world.add_prefix("lv2_midi", "http://lv2plug.in/ns/ext/midi"); - rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#"); - rdf_world.add_prefix("dc", "http://purl.org/dc/elements/1.1/"); - - PluginModel::set_rdf_world(rdf_world); + PluginModel::set_rdf_world(*world->rdf_world); #ifdef HAVE_SLV2 PluginModel::set_slv2_world(world->slv2_world); @@ -197,6 +174,23 @@ App::detach() _world->engine.reset(); } } + + +const SharedPtr& +App::serialiser() +{ + if (!_serialiser) { + if (!_world->serialisation_module) + _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); + + if (_world->serialisation_module) + _serialiser = SharedPtr(Ingen::Serialisation::new_serialiser(_world, _store)); + + if (!_serialiser) + cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl; + } + return _serialiser; +} void diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index c6a6c66c..a13259ad 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -106,7 +106,8 @@ public: const SharedPtr& client() const { return _client; } const SharedPtr& store() const { return _store; } const SharedPtr& loader() const { return _loader; } - const SharedPtr& serialiser() const { return _world->serialiser; } + + const SharedPtr& serialiser(); static inline App& instance() { assert(_instance); return *_instance; } @@ -139,6 +140,7 @@ protected: SharedPtr _client; SharedPtr _store; + SharedPtr _serialiser; SharedPtr _loader; Configuration* _configuration; diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index c92eeb43..59011721 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -539,7 +539,7 @@ PatchCanvas::destroy_selection() void PatchCanvas::copy_selection() { - Serialiser serialiser(*App::instance().world()); + Serialiser serialiser(*App::instance().world(), App::instance().store()); serialiser.start_to_string(""); for (list >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) { diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp index b14f7e2c..2ca54f3c 100644 --- a/src/libs/gui/UploadPatchWindow.cpp +++ b/src/libs/gui/UploadPatchWindow.cpp @@ -24,6 +24,7 @@ #include #include "module/global.hpp" #include "module/World.hpp" +#include "client/ClientStore.hpp" #include "interface/EngineInterface.hpp" #include "serialisation/Serialiser.hpp" #include "client/PatchModel.hpp" @@ -247,7 +248,7 @@ UploadPatchWindow::upload_clicked() _upload_progress->set_fraction(0.0); _upload_progress->set_text(""); - Serialiser s(*App::instance().world()); + Serialiser s(*App::instance().world(), App::instance().store()); const string uri = string("http://rdf.drobilla.net/ingen_patches/") .append(symbol).append(".ingen.ttl"); -- cgit v1.2.1