diff options
author | David Robillard <d@drobilla.net> | 2008-08-15 23:34:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-15 23:34:41 +0000 |
commit | ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5 (patch) | |
tree | 9e235f0c3b7a355e3cc661720359cd3d9eb18fb9 /src/libs/gui | |
parent | 4d5a589570a65d508170c59b4c738b441e216a93 (diff) | |
download | ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.tar.gz ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.tar.bz2 ingen-ab2aa4d4922ab1a62b7a43013d09b2d9d144b3c5.zip |
Push serialiser down into core ('world').
HTTP access to patches (serialised on demand).
git-svn-id: http://svn.drobilla.net/lad/ingen@1393 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/App.cpp | 26 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 14 | ||||
-rw-r--r-- | src/libs/gui/LoadPluginWindow.cpp | 4 | ||||
-rw-r--r-- | src/libs/gui/NewSubpatchWindow.cpp | 3 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 18 | ||||
-rw-r--r-- | src/libs/gui/PatchTreeWindow.cpp | 2 | ||||
-rw-r--r-- | src/libs/gui/PatchTreeWindow.hpp | 6 | ||||
-rw-r--r-- | src/libs/gui/ThreadedLoader.cpp | 4 | ||||
-rw-r--r-- | src/libs/gui/UploadPatchWindow.cpp | 2 |
9 files changed, 38 insertions, 41 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index a00f93a5..b558f706 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -29,6 +29,7 @@ #include "module/Module.hpp" #include "module/World.hpp" #include "interface/EngineInterface.hpp" +#include "serialisation/serialisation.hpp" #include "client/ObjectModel.hpp" #include "client/PatchModel.hpp" #include "client/Store.hpp" @@ -66,26 +67,23 @@ App* App::_instance = 0; App::App(Ingen::Shared::World* world) - : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation")) - , _configuration(new Configuration()) + : _configuration(new Configuration()) , _about_dialog(NULL) , _window_factory(new WindowFactory()) , _world(world) , _enable_signal(true) { - if (_serialisation_module) { - Serialiser* (*new_serialiser)(Ingen::Shared::World*) = NULL; + // FIXME: defer loading of serialisation module until needed + if (!world->serialisation_module) + world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation"); - bool found = _serialisation_module->get_symbol("new_serialiser", (void*&)new_serialiser); + if (world->serialisation_module) + if (!world->serialiser) + world->serialiser = SharedPtr<Serialiser>( + Ingen::Serialisation::new_serialiser(world)); - if (found) - _serialiser = SharedPtr<Serialiser>(new_serialiser(world)); - } - - if ( ! _serialiser) { + if (!world->serialiser) cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl; - cerr << "(If you are running from the source tree, source set_dev_environment.sh)" << endl; - } Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference(); @@ -176,7 +174,9 @@ App::attach(SharedPtr<SigClientInterface> client) _world->engine->register_client(client.get()); _client = client; - _store = SharedPtr<Store>(new Store(_world->engine, client)); + assert(!_world->store); + _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client)); + _world->store = _store; _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine)); _patch_tree_window->init(*_store); diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 44878925..f7a3ead1 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -29,6 +29,7 @@ #include <raul/SharedPtr.hpp> #include <redlandmm/World.hpp> #include <module/World.hpp> +#include <interface/Store.hpp> using namespace std; @@ -41,7 +42,7 @@ namespace Ingen { namespace Client { class PatchModel; class PluginModel; - class Store; + class ClientStore; class SigClientInterface; } namespace Serialisation { @@ -103,12 +104,10 @@ public: const SharedPtr<EngineInterface> engine() const { return _world->engine; } const SharedPtr<SigClientInterface>& client() const { return _client; } - const SharedPtr<Store>& store() const { return _store; } + const SharedPtr<ClientStore>& store() const { return _store; } const SharedPtr<ThreadedLoader>& loader() const { return _loader; } - const SharedPtr<Serialiser>& serialiser() const { return _serialiser; } + const SharedPtr<Serialiser>& serialiser() const { return _world->serialiser; } - SharedPtr<Glib::Module> serialisation_module() { return _serialisation_module; } - static inline App& instance() { assert(_instance); return *_instance; } static void run(int argc, char** argv, Ingen::Shared::World* world); @@ -138,12 +137,9 @@ protected: static App* _instance; - SharedPtr<Glib::Module> _serialisation_module; - SharedPtr<SigClientInterface> _client; - SharedPtr<Store> _store; + SharedPtr<ClientStore> _store; SharedPtr<ThreadedLoader> _loader; - SharedPtr<Serialiser> _serialiser; Configuration* _configuration; diff --git a/src/libs/gui/LoadPluginWindow.cpp b/src/libs/gui/LoadPluginWindow.cpp index 99ab54c2..c518f25f 100644 --- a/src/libs/gui/LoadPluginWindow.cpp +++ b/src/libs/gui/LoadPluginWindow.cpp @@ -129,7 +129,7 @@ LoadPluginWindow::name_changed() if (!Path::is_valid_name(name)) { //m_message_label->set_text("Name contains invalid characters."); _add_button->property_sensitive() = false; - } else if (_patch->find_child(name)) { + } else if (App::instance().store()->find_child(_patch, name)) { //m_message_label->set_text("An object already exists with that name."); _add_button->property_sensitive() = false; } else if (name.length() == 0) { @@ -288,7 +288,7 @@ LoadPluginWindow::plugin_selection_changed() if (iter) { Gtk::TreeModel::Row row = *iter; boost::shared_ptr<PluginModel> p = row.get_value(_plugins_columns._col_plugin_model); - _plugin_name_offset = _patch->child_name_offset(p->default_node_name()); + _plugin_name_offset = PatchModel::child_name_offset(*App::instance().store().get(), _patch, p->default_node_name()); _node_name_entry->set_text(generate_module_name(_plugin_name_offset)); } else { _plugin_name_offset = 0; diff --git a/src/libs/gui/NewSubpatchWindow.cpp b/src/libs/gui/NewSubpatchWindow.cpp index 69c8471e..def57975 100644 --- a/src/libs/gui/NewSubpatchWindow.cpp +++ b/src/libs/gui/NewSubpatchWindow.cpp @@ -71,7 +71,8 @@ NewSubpatchWindow::name_changed() if (!Path::is_valid_name(name)) { _message_label->set_text("Name contains invalid characters."); _ok_button->property_sensitive() = false; - } else if (_patch->find_child(name)) { + } else if (App::instance().store()->find(_patch->path().base() + name) + != App::instance().store()->objects().end()) { _message_label->set_text("An object already exists with that name."); _ok_button->property_sensitive() = false; } else if (name.length() == 0) { diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index a43ebcf3..d7ffd78b 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -41,7 +41,7 @@ #include "SubpatchModule.hpp" #include "GladeFactory.hpp" #include "WindowFactory.hpp" -using Ingen::Client::Store; +using Ingen::Client::ClientStore; using Ingen::Serialisation::Serialiser; using Ingen::Client::PluginModel; @@ -159,10 +159,10 @@ PatchCanvas::build_internal_menu() _menu->reorder_child(*internal_menu_item, 2); } - const Store::Plugins& plugins = App::instance().store()->plugins(); + const ClientStore::Plugins& plugins = App::instance().store()->plugins(); // Add Internal plugins - for (Store::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { + for (ClientStore::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { SharedPtr<PluginModel> p = i->second; if (p->type() == Plugin::Internal) { _internal_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(p->name(), @@ -200,10 +200,10 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, } } - const Store::Plugins& plugins = App::instance().store()->plugins(); + const ClientStore::Plugins& plugins = App::instance().store()->plugins(); // Add LV2 plugins - for (Store::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { + for (ClientStore::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { SLV2Plugin p = i->second->slv2_plugin(); if (p && slv2_plugin_get_class(p) == plugin_class) { @@ -256,8 +256,8 @@ PatchCanvas::build() boost::dynamic_pointer_cast<PatchCanvas>(shared_from_this()); // Create modules for nodes - for (ObjectModel::const_iterator i = _patch->children_begin(); - i != _patch->children_end(); ++i) { + for (ObjectModel::const_iterator i = App::instance().store()->children_begin(_patch); + i != App::instance().store()->children_end(_patch); ++i) { SharedPtr<NodeModel> node = PtrCast<NodeModel>(i->second); if (node && node->parent() == _patch) add_node(node); @@ -539,7 +539,7 @@ PatchCanvas::destroy_selection() void PatchCanvas::copy_selection() { - Serialiser serialiser(*App::instance().world()->rdf_world); + Serialiser serialiser(*App::instance().world()); serialiser.start_to_string(""); for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) { @@ -617,7 +617,7 @@ void PatchCanvas::load_plugin(SharedPtr<PluginModel> plugin) { string name = plugin->default_node_name(); - unsigned offset = _patch->child_name_offset(name); + unsigned offset = PatchModel::child_name_offset(*App::instance().store().get(), _patch, name); if (offset != 0) { std::stringstream ss; ss << name << "_" << offset; diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp index 595c83b8..85f4f19c 100644 --- a/src/libs/gui/PatchTreeWindow.cpp +++ b/src/libs/gui/PatchTreeWindow.cpp @@ -66,7 +66,7 @@ PatchTreeWindow::PatchTreeWindow(BaseObjectType* cobject, void -PatchTreeWindow::init(Store& store) +PatchTreeWindow::init(ClientStore& store) { store.signal_new_object.connect(sigc::mem_fun(this, &PatchTreeWindow::new_object)); } diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp index 534f4607..85d803cd 100644 --- a/src/libs/gui/PatchTreeWindow.hpp +++ b/src/libs/gui/PatchTreeWindow.hpp @@ -23,9 +23,9 @@ #include <raul/Path.hpp> namespace Ingen { namespace Client { - class Store; + class ClientStore; } } -using Ingen::Client::Store; +using Ingen::Client::ClientStore; namespace Ingen { namespace GUI { @@ -43,7 +43,7 @@ class PatchTreeWindow : public Gtk::Window public: PatchTreeWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade); - void init(Store& store); + void init(ClientStore& store); void new_object(SharedPtr<ObjectModel> object); diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index 949cde1a..1c85d637 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -36,10 +36,10 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) set_name("Loader"); // FIXME: rework this so the thread is only present when it's doing something (save mem) - if (App::instance().serialisation_module()) { + if (App::instance().world()->serialisation_module) { Loader* (*new_loader)() = NULL; - bool found = App::instance().serialisation_module()->get_symbol( + bool found = App::instance().world()->serialisation_module->get_symbol( "new_loader", (void*&)new_loader); if (found) diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp index 16fa0665..b14f7e2c 100644 --- a/src/libs/gui/UploadPatchWindow.cpp +++ b/src/libs/gui/UploadPatchWindow.cpp @@ -247,7 +247,7 @@ UploadPatchWindow::upload_clicked() _upload_progress->set_fraction(0.0); _upload_progress->set_text(""); - Serialiser s(*App::instance().world()->rdf_world); + Serialiser s(*App::instance().world()); const string uri = string("http://rdf.drobilla.net/ingen_patches/") .append(symbol).append(".ingen.ttl"); |