diff options
author | David Robillard <d@drobilla.net> | 2007-07-25 06:07:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-07-25 06:07:42 +0000 |
commit | 75911e8ae28f011727ce303961a1adb56643689d (patch) | |
tree | ed83fcfc6bf11a6c5d48ef2337f7458fe29ea7a3 /src/libs/gui | |
parent | 68861e30d860010424112ebaacf960a7839a009a (diff) | |
download | ingen-75911e8ae28f011727ce303961a1adb56643689d.tar.gz ingen-75911e8ae28f011727ce303961a1adb56643689d.tar.bz2 ingen-75911e8ae28f011727ce303961a1adb56643689d.zip |
Fix running with ingen -eg.
Start basic framework of an Ingen "Core" system/library (in module library for now).
git-svn-id: http://svn.drobilla.net/lad/ingen@624 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r-- | src/libs/gui/App.cpp | 28 | ||||
-rw-r--r-- | src/libs/gui/App.hpp | 17 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.cpp | 5 | ||||
-rw-r--r-- | src/libs/gui/ConnectWindow.hpp | 8 | ||||
-rw-r--r-- | src/libs/gui/LoadRemotePatchWindow.cpp | 7 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 3 | ||||
-rw-r--r-- | src/libs/gui/ThreadedLoader.cpp | 6 | ||||
-rw-r--r-- | src/libs/gui/UploadPatchWindow.cpp | 3 | ||||
-rw-r--r-- | src/libs/gui/gui.cpp | 20 | ||||
-rw-r--r-- | src/libs/gui/gui.hpp | 3 |
10 files changed, 52 insertions, 48 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index acebf04e..7b1204d2 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -16,6 +16,7 @@ */ #include "../../../config/config.h" +#include "module/module.h" #include "App.hpp" #include <cassert> #include <string> @@ -44,6 +45,9 @@ /*#ifdef HAVE_LASH #include "LashController.hpp" #endif*/ +#ifdef HAVE_SLV2 +#include <slv2/slv2.h> +#endif using std::cerr; using std::cout; using std::endl; using std::string; namespace Ingen { namespace Client { class PluginModel; } } @@ -59,10 +63,11 @@ class Port; App* App::_instance = 0; -App::App() +App::App(Ingen::Shared::World* world) : _configuration(new Configuration()), _about_dialog(NULL), _window_factory(new WindowFactory()), + _world(world), _enable_signal(true) { Glib::RefPtr<Gnome::Glade::Xml> glade_xml = GladeFactory::new_glade_reference(); @@ -73,18 +78,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/ns/lv2core#"); - _rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); - _rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#"); + Raul::RDF::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("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); + PluginModel::set_slv2_world(world->slv2_world); #endif } @@ -93,9 +99,9 @@ App::~App() { } - void App::run(int argc, char** argv, + Ingen::Shared::World* world, SharedPtr<Engine> engine, SharedPtr<Shared::EngineInterface> interface) { @@ -103,7 +109,7 @@ App::run(int argc, char** argv, Gtk::Main main(argc, argv); if (!_instance) - _instance = new App(); + _instance = new App(world); /* Load settings */ _instance->configuration()->load_settings(); diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 97bbb661..4ef36718 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -28,13 +28,14 @@ #include <libglademm.h> #include <raul/RDFWorld.hpp> #include <raul/SharedPtr.hpp> -using std::string; using std::map; using std::list; -using std::cerr; using std::endl; + +using namespace std; namespace Ingen { class Engine; namespace Shared { class EngineInterface; + class World; } namespace Client { class PatchModel; @@ -92,8 +93,6 @@ public: Configuration* configuration() const { return _configuration; } WindowFactory* window_factory() const { return _window_factory; } - Raul::RDF::World* rdf_world() { return &_rdf_world; } - const SharedPtr<EngineInterface>& engine() const { return _engine; } const SharedPtr<SigClientInterface>& client() const { return _client; } const SharedPtr<Store>& store() const { return _store; } @@ -102,15 +101,17 @@ public: static inline App& instance() { assert(_instance); return *_instance; } static void run(int argc, char** argv, + Ingen::Shared::World* world, SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface); + Ingen::Shared::World* world() { return _world; } + protected: - App(); + App(Ingen::Shared::World* world); + static App* _instance; - static void instantiate(int argc, char** argv); - SharedPtr<EngineInterface> _engine; SharedPtr<SigClientInterface> _client; SharedPtr<Store> _store; @@ -125,7 +126,7 @@ protected: Gtk::Dialog* _about_dialog; WindowFactory* _window_factory; - Raul::RDF::World _rdf_world; + Ingen::Shared::World* _world; /** Used to avoid feedback loops with (eg) process checkbutton * FIXME: Maybe this should be globally implemented at the Controller level, diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index 86660d40..ca9dbbbc 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -229,7 +229,7 @@ ConnectWindow::connect() } else if (_mode == INTERNAL) { assert(_new_engine); - SharedPtr<Ingen::Engine> engine(_new_engine()); + SharedPtr<Ingen::Engine> engine(_new_engine(App::instance().world())); engine->start_jack_driver(); @@ -371,7 +371,8 @@ ConnectWindow::gtk_callback() //App::instance().engine()->register_client(App::instance().engine()->client_hooks()); // FIXME //auto_ptr<ClientInterface> client(new ThreadedSigClientInterface(); - App::instance().engine()->register_client("FIXME_CLIENT_URI", App::instance().client()); + // FIXME: client URI + App::instance().engine()->register_client("", App::instance().client()); App::instance().engine()->load_plugins(); ++_connect_stage; } else if (_connect_stage == 3) { diff --git a/src/libs/gui/ConnectWindow.hpp b/src/libs/gui/ConnectWindow.hpp index 5a0e67ad..fe26d549 100644 --- a/src/libs/gui/ConnectWindow.hpp +++ b/src/libs/gui/ConnectWindow.hpp @@ -18,6 +18,12 @@ #ifndef CONNECT_WINDOW_H #define CONNECT_WINDOW_H +#include "../../../config/config.h" + +#ifdef HAVE_SLV2 +#include <slv2/slv2.h> +#endif + #include <gtkmm.h> #include <libglademm/xml.h> #include <libglademm.h> @@ -70,7 +76,7 @@ private: int _connect_stage; SharedPtr<Glib::Module> _engine_module; - Ingen::Engine* (*_new_engine)(); + Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world); Gtk::Image* _icon; Gtk::ProgressBar* _progress_bar; diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp index 096f6d61..77a03386 100644 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ b/src/libs/gui/LoadRemotePatchWindow.cpp @@ -15,6 +15,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "module/module.h" #include "LoadRemotePatchWindow.hpp" #include <sys/types.h> #include <dirent.h> @@ -65,17 +66,17 @@ LoadRemotePatchWindow::present(SharedPtr<PatchModel> patch, MetadataMap data) set_patch(patch); _initial_data = data; - RDF::Model model(*App::instance().rdf_world(), + RDF::Model model(App::instance().world()->rdf_world, "http://rdf.drobilla.net/ingen_patches/index.ttl", "http://rdf.drobilla.net/ingen_patches/"); - RDF::Query query(*App::instance().rdf_world(), Glib::ustring( + RDF::Query query(App::instance().world()->rdf_world, Glib::ustring( "SELECT DISTINCT ?name ?uri WHERE {" " ?uri a ingen:Patch ;" " doap:name ?name ." "}")); - RDF::Query::Results results = query.run(*App::instance().rdf_world(), model); + RDF::Query::Results results = query.run(App::instance().world()->rdf_world, model); for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Gtk::TreeModel::iterator iter = _liststore->append(); diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index ba7a58ce..8f6b53e9 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -16,6 +16,7 @@ */ #include "../../../../config/config.h" +#include "module/module.h" #include <cassert> #include <flowcanvas/Canvas.hpp> @@ -425,7 +426,7 @@ PatchCanvas::destroy_selection() void PatchCanvas::copy_selection() { - Serializer serializer(*App::instance().rdf_world()); + Serializer serializer(App::instance().world()->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/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp index 653f18b0..63c5bf3c 100644 --- a/src/libs/gui/ThreadedLoader.cpp +++ b/src/libs/gui/ThreadedLoader.cpp @@ -19,7 +19,7 @@ #include <cassert> #include <string> #include "client/PatchModel.hpp" -#include "module/Module.hpp" +#include "module/module.h" #include "App.hpp" #include "ThreadedLoader.hpp" using std::cout; using std::endl; @@ -32,7 +32,7 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine) : _serialisation_module(Ingen::Shared::load_module("ingen_serialisation")) , _engine(engine) , _deprecated_loader(engine) - , _serializer(*App::instance().rdf_world()) + , _serializer(App::instance().world()->rdf_world) { set_name("Loader"); @@ -97,7 +97,7 @@ ThreadedLoader::load_patch(bool merge, _events.push_back(sigc::hide_return(sigc::bind( sigc::mem_fun(_loader.get(), &Ingen::Serialisation::Loader::load), App::instance().engine(), - App::instance().rdf_world(), + &App::instance().world()->rdf_world, data_base_uri, engine_parent, (engine_name) ? engine_name.get() : "", diff --git a/src/libs/gui/UploadPatchWindow.cpp b/src/libs/gui/UploadPatchWindow.cpp index 46be0987..aec4d8e6 100644 --- a/src/libs/gui/UploadPatchWindow.cpp +++ b/src/libs/gui/UploadPatchWindow.cpp @@ -22,6 +22,7 @@ #include <boost/optional/optional.hpp> #include <curl/curl.h> #include <raul/RDFQuery.hpp> +#include "module/module.h" #include "interface/EngineInterface.hpp" #include "client/Serializer.hpp" #include "client/PatchModel.hpp" @@ -247,7 +248,7 @@ UploadPatchWindow::upload_clicked() _upload_progress->set_fraction(0.0); _upload_progress->set_text(""); - Serializer s(*App::instance().rdf_world()); + Serializer s(App::instance().world()->rdf_world); s.start_to_string(); s.serialize(_patch); const string str = s.finish(); diff --git a/src/libs/gui/gui.cpp b/src/libs/gui/gui.cpp index 689adf62..ca160e00 100644 --- a/src/libs/gui/gui.cpp +++ b/src/libs/gui/gui.cpp @@ -25,27 +25,11 @@ namespace GUI { void run(int argc, char** argv, + Ingen::Shared::World* world, SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface) { - App::run(argc, argv, engine, interface); -#if 0 - Gnome::Canvas::init(); - Gtk::Main gtk_main(argc, argv); - Gtk::Window::set_default_icon_from_file(PKGDATADIR "/ingen.svg"); - - /* Instantiate singleton (bad, FIXME) */ - App::instantiate(argc, argv); - - /* Load settings */ - App::instance().configuration()->load_settings(); - App::instance().configuration()->apply_settings(); - - App::instance().connect_window()->start(); - gtk_main.run(); - - return 0; -#endif + App::run(argc, argv, world, engine, interface); } diff --git a/src/libs/gui/gui.hpp b/src/libs/gui/gui.hpp index 992aa9d4..d99e4091 100644 --- a/src/libs/gui/gui.hpp +++ b/src/libs/gui/gui.hpp @@ -18,6 +18,8 @@ #ifndef INGEN_GUI_H #define INGEN_GUI_H +#include "../../../config/config.h" +#include "module/module.h" #include <raul/SharedPtr.hpp> namespace Ingen { @@ -32,6 +34,7 @@ namespace GUI { extern "C" { void run(int argc, char** argv, + Ingen::Shared::World* world, SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineInterface> interface); |