summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-12-19 21:37:50 +0000
committerDavid Robillard <d@drobilla.net>2009-12-19 21:37:50 +0000
commit19045ab92aa7e996971584a0dc8780d1d58b498b (patch)
tree619c73deb7fd64ce31c5167490d1ae186dbb2695 /src/gui
parent4613a2e15f1122ecf6830171de0ab18dc22fefff (diff)
downloadingen-19045ab92aa7e996971584a0dc8780d1d58b498b.tar.gz
ingen-19045ab92aa7e996971584a0dc8780d1d58b498b.tar.bz2
ingen-19045ab92aa7e996971584a0dc8780d1d58b498b.zip
New ingen module (library, not e.g. LV2 plugin) design.
Much cleaner interface and general usage of Ingen as a library. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2314 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/App.cpp46
-rw-r--r--src/gui/App.hpp3
-rw-r--r--src/gui/ConnectWindow.cpp58
-rw-r--r--src/gui/ConnectWindow.hpp4
-rw-r--r--src/gui/PatchCanvas.cpp2
-rw-r--r--src/gui/ThreadedLoader.cpp25
-rw-r--r--src/gui/ThreadedLoader.hpp1
-rw-r--r--src/gui/gui.cpp32
-rw-r--r--src/gui/gui.hpp40
9 files changed, 53 insertions, 158 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index 29b00283..f42ddcb4 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -30,7 +30,6 @@
#include "module/World.hpp"
#include "engine/Engine.hpp"
#include "interface/EngineInterface.hpp"
-#include "serialisation/serialisation.hpp"
#include "client/ObjectModel.hpp"
#include "client/PatchModel.hpp"
#include "client/ClientStore.hpp"
@@ -102,10 +101,10 @@ App::~App()
}
void
-App::init(int argc, char** argv, Ingen::Shared::World* world)
+App::init(Ingen::Shared::World* world)
{
Gnome::Canvas::init();
- _main = new Gtk::Main(argc, argv);
+ _main = new Gtk::Main(world->argc, world->argv);
if (!_instance)
_instance = new App(world);
@@ -121,19 +120,19 @@ App::init(int argc, char** argv, Ingen::Shared::World* world)
// Set style for embedded node GUIs
const string rc_style =
- "style \"ingen_embedded_node_gui_style\" {"
- " bg[NORMAL] = \"#212222\""
- " bg[ACTIVE] = \"#505050\""
- " bg[PRELIGHT] = \"#525454\""
- " bg[SELECTED] = \"#99A0A0\""
- " bg[INSENSITIVE] = \"#F03030\""
- " fg[NORMAL] = \"#FFFFFF\""
- " fg[ACTIVE] = \"#FFFFFF\""
- " fg[PRELIGHT] = \"#FFFFFF\""
- " fg[SELECTED] = \"#FFFFFF\""
- " fg[INSENSITIVE] = \"#FFFFFF\""
- "}\n"
- "widget \"*ingen_embedded_node_gui_container*\" style \"ingen_embedded_node_gui_style\"\n";
+ "style \"ingen_embedded_node_gui_style\" {\n"
+ "bg[NORMAL] = \"#212222\"\n"
+ "bg[ACTIVE] = \"#505050\"\n"
+ "bg[PRELIGHT] = \"#525454\"\n"
+ "bg[SELECTED] = \"#99A0A0\"\n"
+ "bg[INSENSITIVE] = \"#F03030\"\n"
+ "fg[NORMAL] = \"#FFFFFF\"\n"
+ "fg[ACTIVE] = \"#FFFFFF\"\n"
+ "fg[PRELIGHT] = \"#FFFFFF\"\n"
+ "fg[SELECTED] = \"#FFFFFF\"\n"
+ "fg[INSENSITIVE] = \"#FFFFFF\"\n"
+ "}\n"
+ "widget \"*ingen_embedded_node_gui_container*\" style \"ingen_embedded_node_gui_style\"\n";
Gtk::RC::parse_string(rc_style);
@@ -168,7 +167,7 @@ App::attach(SharedPtr<SigClientInterface> client,
_client = client;
_handle = handle;
- _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client));
+ _store = SharedPtr<ClientStore>(new ClientStore(_world->engine, client));
_loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(_world->engine));
_patch_tree_window->init(*_store);
@@ -197,17 +196,10 @@ App::detach()
const SharedPtr<Serialiser>&
App::serialiser()
{
- if (!_serialiser) {
- if (!_world->serialisation_module)
- _world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation");
+ if (!_world->serialiser)
+ _world->load("ingen_serialisation");
- if (_world->serialisation_module)
- _serialiser = SharedPtr<Serialiser>(Ingen::Serialisation::new_serialiser(_world, _store));
-
- if (!_serialiser)
- cerr << "WARNING: Failed to load ingen_serialisation module, save disabled." << endl;
- }
- return _serialiser;
+ return _world->serialiser;
}
diff --git a/src/gui/App.hpp b/src/gui/App.hpp
index 0e21d423..bf55d51b 100644
--- a/src/gui/App.hpp
+++ b/src/gui/App.hpp
@@ -111,7 +111,7 @@ public:
static inline App& instance() { assert(_instance); return *_instance; }
- static void init(int argc, char** argv, Ingen::Shared::World* world);
+ static void init(Ingen::Shared::World* world);
static void run();
Ingen::Shared::World* world() { return _world; }
@@ -145,7 +145,6 @@ protected:
SharedPtr<Client::SigClientInterface> _client;
SharedPtr<Raul::Deletable> _handle;
SharedPtr<Client::ClientStore> _store;
- SharedPtr<Serialisation::Serialiser> _serialiser;
SharedPtr<ThreadedLoader> _loader;
Configuration* _configuration;
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index c939f5ea..1416bf2c 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -24,6 +24,7 @@
#include "raul/Process.hpp"
#include "ingen-config.h"
#include "interface/EngineInterface.hpp"
+#include "module/Module.hpp"
#include "module/World.hpp"
#include "engine/tuning.hpp"
#include "engine/Engine.hpp"
@@ -40,7 +41,6 @@
#include "client/ClientStore.hpp"
#include "client/PatchModel.hpp"
#include "client/ThreadedSigClientInterface.hpp"
-#include "module/Module.hpp"
#include "App.hpp"
#include "WindowFactory.hpp"
#include "ConnectWindow.hpp"
@@ -55,9 +55,6 @@ namespace Ingen {
namespace GUI {
-// ConnectWindow
-
-
ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: Dialog(cobject)
, _xml(xml)
@@ -67,7 +64,6 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::
, _finished_connecting(false)
, _widgets_loaded(false)
, _connect_stage(0)
- , _new_engine(NULL)
{
}
@@ -112,7 +108,7 @@ ConnectWindow::set_connected_to(SharedPtr<Shared::EngineInterface> engine)
_connect_button->set_sensitive(true);
_disconnect_button->set_sensitive(false);
- if (_new_engine)
+ if (App::instance().world()->local_engine)
_internal_radio->set_sensitive(true);
else
_internal_radio->set_sensitive(false);
@@ -181,6 +177,8 @@ ConnectWindow::connect(bool existing)
if (existing)
uri = world->engine->uri().str();
+ cout << "CONNECT EXISTING " << existing << " URI " << uri << endl;
+
// Create client-side listener
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
SharedPtr<Raul::Deletable> client;
@@ -247,36 +245,15 @@ ConnectWindow::connect(bool existing)
} else
#endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP)
if (_mode == INTERNAL) {
- if ( ! world->local_engine) {
- assert(_new_engine);
- world->local_engine = SharedPtr<Engine>(_new_engine(world));
- }
-
- if ( ! world->engine) {
- SharedPtr<QueuedEngineInterface> interface(
- new QueuedEngineInterface(*world->local_engine, Ingen::event_queue_size));
- world->engine = interface;
- world->local_engine->add_event_source(interface);
- }
+ if (!world->local_engine)
+ world->load("ingen_engine");
SharedPtr<SigClientInterface> client(new SigClientInterface());
- Ingen::Driver* (*new_driver)(
- Ingen::Engine& engine,
- const std::string server_name,
- const std::string client_name,
- void* jack_client) = NULL;
-
- if (!world->local_engine->audio_driver()) {
- bool found = _engine_jack_module->get_symbol(
- "new_jack_audio_driver", (void*&)(new_driver));
- if (found) {
- world->local_engine->set_driver(PortType::AUDIO,
- SharedPtr<Driver>(new_driver(*world->local_engine, "default", "", 0)));
- }
- }
+ if (!world->local_engine->audio_driver())
+ world->load("ingen_jack");
- world->local_engine->activate(1); // FIXME: parallelism
+ world->local_engine->activate();
App::instance().attach(client);
App::instance().register_callbacks();
@@ -365,17 +342,6 @@ ConnectWindow::load_widgets()
_progress_bar->set_pulse_step(0.01);
_widgets_loaded = true;
- _engine_module = Ingen::Shared::load_module("ingen_engine");
- if (!_engine_module)
- cerr << "Unable to load ingen_engine module, internal engine unavailable." << endl;
- bool found = _engine_module->get_symbol("new_engine", (void*&)_new_engine);
- if (!found) {
- cerr << "Unable to find module entry point, internal engine unavailable." << endl;
- _engine_module.reset();
- }
-
- _engine_jack_module = Ingen::Shared::load_module("ingen_engine_jack");
-
server_toggled();
}
@@ -454,14 +420,8 @@ ConnectWindow::gtk_callback()
}
}
- /* Connecting to engine */
if (_connect_stage == 0) {
-
_attached = false;
-
- assert(App::instance().engine());
- assert(App::instance().client());
-
App::instance().client()->signal_response_ok.connect(
sigc::mem_fun(this, &ConnectWindow::on_response));
diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp
index 42332813..c94c287a 100644
--- a/src/gui/ConnectWindow.hpp
+++ b/src/gui/ConnectWindow.hpp
@@ -87,10 +87,6 @@ private:
bool _widgets_loaded;
int _connect_stage;
- SharedPtr<Glib::Module> _engine_module;
- SharedPtr<Glib::Module> _engine_jack_module;
- Ingen::Engine* (*_new_engine)(Ingen::Shared::World* world);
-
Gtk::Image* _icon;
Gtk::ProgressBar* _progress_bar;
Gtk::Label* _progress_label;
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp
index aaab8bdf..c83bc04c 100644
--- a/src/gui/PatchCanvas.cpp
+++ b/src/gui/PatchCanvas.cpp
@@ -306,7 +306,7 @@ PatchCanvas::show_port_names(bool b)
{
_show_port_names = b;
for (ItemList::iterator i = _items.begin(); i != _items.end(); ++i) {
- boost::shared_ptr<Module> m = boost::dynamic_pointer_cast<Module>(*i);
+ boost::shared_ptr<FlowCanvas::Module> m = boost::dynamic_pointer_cast<FlowCanvas::Module>(*i);
if (m)
m->set_show_port_labels(b);
}
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 1a2a209e..ae5c995f 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -19,6 +19,7 @@
#include <string>
#include "module/World.hpp"
#include "module/Module.hpp"
+#include "module/ingen_module.hpp"
#include "App.hpp"
#include "ThreadedLoader.hpp"
#include "client/PatchModel.hpp"
@@ -46,24 +47,12 @@ ThreadedLoader::ThreadedLoader(SharedPtr<EngineInterface> engine)
SharedPtr<Parser>
ThreadedLoader::parser()
{
- if (_parser)
- return _parser;
+ Ingen::Shared::World* world = ingen_get_world();
- World* world = App::instance().world();
- if (!world->serialisation_module)
- world->serialisation_module = Ingen::Shared::load_module("ingen_serialisation");
+ if (!world->parser)
+ world->load("ingen_serialisation");
- if (world->serialisation_module) {
- Parser* (*new_parser)() = NULL;
-
- bool found = App::instance().world()->serialisation_module->get_symbol(
- "new_parser", (void*&)new_parser);
-
- if (found)
- _parser = SharedPtr<Parser>(new_parser());
- }
-
- return _parser;
+ return world->parser;
}
@@ -90,6 +79,8 @@ ThreadedLoader::load_patch(bool merge,
{
_mutex.lock();
+ Ingen::Shared::World* world = ingen_get_world();
+
Glib::ustring engine_base = "";
if (engine_parent) {
if (merge)
@@ -110,7 +101,7 @@ ThreadedLoader::load_patch(bool merge,
false)));
} else {
_events.push_back(sigc::hide_return(sigc::bind(
- sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document),
+ sigc::mem_fun(world->parser.get(), &Ingen::Serialisation::Parser::parse_document),
App::instance().world(),
App::instance().world()->engine.get(),
document_uri,
diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp
index 6f7e331f..be86c95b 100644
--- a/src/gui/ThreadedLoader.hpp
+++ b/src/gui/ThreadedLoader.hpp
@@ -78,7 +78,6 @@ private:
void _whipped();
SharedPtr<EngineInterface> _engine;
- SharedPtr<Parser> _parser;
DeprecatedLoader _deprecated_loader;
Glib::Mutex _mutex;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index ab6a1297..d1ad6c99 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -15,29 +15,27 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "gui.hpp"
-#include "ConnectWindow.hpp"
+#include "module/Module.hpp"
#include "App.hpp"
-#include "Configuration.hpp"
-namespace Ingen {
-namespace GUI {
+struct IngenGUIModule : public Ingen::Shared::Module {
+ void load(Ingen::Shared::World* world) {
+ Ingen::GUI::App::init(world);
+ Ingen::GUI::App::run();
+ }
+};
+static IngenGUIModule* module = NULL;
-void
-init(int argc, char** argv, Ingen::Shared::World* world)
-{
- App::init(argc, argv, world);
-}
+extern "C" {
+Ingen::Shared::Module*
+ingen_module_load() {
+ if (!module)
+ module = new IngenGUIModule();
-void
-run()
-{
- App::run();
+ return module;
}
-
-} // namespace GUI
-} // namespace Ingen
+} // extern "C"
diff --git a/src/gui/gui.hpp b/src/gui/gui.hpp
deleted file mode 100644
index 19eabe0b..00000000
--- a/src/gui/gui.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef INGEN_GUI_H
-#define INGEN_GUI_H
-
-namespace Ingen {
-
-namespace Shared { class World; }
-
-namespace GUI {
-
-
-extern "C" {
-
- void init(int argc, char** argv, Ingen::Shared::World* world);
- void run();
-
-}
-
-
-} // namesace GUI
-} // namespace Ingen
-
-#endif // INGEN_GUI_H
-