diff options
-rw-r--r-- | src/gui/ingen_gui.cpp | 19 | ||||
-rw-r--r-- | src/gui/wscript | 4 | ||||
-rw-r--r-- | src/ingen/ingen.cpp | 38 | ||||
-rw-r--r-- | src/server/wscript | 2 | ||||
-rw-r--r-- | src/wscript | 2 | ||||
-rw-r--r-- | wscript | 4 |
6 files changed, 44 insertions, 25 deletions
diff --git a/src/gui/ingen_gui.cpp b/src/gui/ingen_gui.cpp index 097de5cf..83e41a7e 100644 --- a/src/gui/ingen_gui.cpp +++ b/src/gui/ingen_gui.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard <http://drobilla.net/> + Copyright 2007-2018 David Robillard <http://drobilla.net/> Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -14,7 +14,10 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ +#include "ingen/Configuration.hpp" #include "ingen/Module.hpp" +#include "ingen/client/ThreadedSigClientInterface.hpp" + #include "App.hpp" namespace Ingen { @@ -22,8 +25,22 @@ namespace GUI { struct GUIModule : public Module { void load(World* world) { + using Client::SigClientInterface; + using Client::ThreadedSigClientInterface; + + std::string uri = world->conf().option("connect").ptr<char>(); + if (!world->interface()) { + SPtr<SigClientInterface> client(new ThreadedSigClientInterface()); + world->set_interface(world->new_interface(URI(uri), client)); + } else if (!dynamic_ptr_cast<Client::SigClientInterface>( + world->interface()->respondee())) { + SPtr<SigClientInterface> client(new ThreadedSigClientInterface()); + world->interface()->set_respondee(client); + } + app = GUI::App::create(world); } + void run(World* world) { app->run(); } diff --git a/src/gui/wscript b/src/gui/wscript index 3c804d05..160afc03 100644 --- a/src/gui/wscript +++ b/src/gui/wscript @@ -9,6 +9,10 @@ def options(ctx): help='use light coloured theme') def configure(conf): + autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', + atleast_version='2.14.0', mandatory=False) + autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', + atleast_version='2.14.0', mandatory=False) autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='GTKMM', atleast_version='2.12.0', mandatory=False) autowaf.check_pkg(conf, 'gtkmm-2.4', uselib_store='NEW_GTKMM', diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index dfad1bb1..d812d862 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -22,8 +22,6 @@ #include <memory> #include <string> -#include <glibmm/thread.h> - #include "raul/Path.hpp" #include "ingen_config.h" @@ -34,7 +32,6 @@ #include "ingen/Log.hpp" #include "ingen/Parser.hpp" #include "ingen/World.hpp" -#include "ingen/client/ThreadedSigClientInterface.hpp" #include "ingen/paths.hpp" #include "ingen/runtime_paths.hpp" #include "ingen/types.hpp" @@ -45,6 +42,12 @@ using namespace std; using namespace Ingen; +class DummyInterface : public Interface +{ + URI uri() const override { return URI("ingen:dummy"); } + void message(const Message& msg) override {} +}; + unique_ptr<Ingen::World> world; static void @@ -111,7 +114,6 @@ main(int argc, char** argv) } // Run engine - SPtr<Interface> engine_interface; if (conf.option("engine").get<int32_t>()) { if (world->conf().option("threads").get<int32_t>() < 1) { cerr << "ingen: error: threads must be > 0" << endl; @@ -122,33 +124,33 @@ main(int argc, char** argv) ingen_try(bool(world->engine()), "Unable to create engine"); world->engine()->listen(); - - engine_interface = world->interface(); } - // If we don't have a local engine interface (for GUI), use network - if (!engine_interface) { - ingen_try(world->load_module("client"), "Failed to load client module"); #ifdef HAVE_SOCKET - Client::SocketClient::register_factories(world.get()); + Client::SocketClient::register_factories(world.get()); #endif + + // Load GUI if requested + if (conf.option("gui").get<int32_t>()) { + ingen_try(world->load_module("client"), "Failed to load client module"); + ingen_try(world->load_module("gui"), "Failed to load GUI module"); + } + + // If we don't have a local engine interface (from the GUI), use network + SPtr<Interface> engine_interface(world->interface()); + SPtr<Interface> dummy_client(new DummyInterface()); + if (!engine_interface) { const char* const uri = conf.option("connect").ptr<char>(); ingen_try(URI::is_valid(uri), (fmt("Invalid URI <%1%>") % uri).str().c_str()); - SPtr<Interface> client(new Client::ThreadedSigClientInterface()); - engine_interface = world->new_interface(URI(uri), client); + engine_interface = world->new_interface(URI(uri), dummy_client); if (!engine_interface && !conf.option("gui").get<int32_t>()) { cerr << (fmt("ingen: error: Failed to connect to `%1%'\n") % uri); return EXIT_FAILURE; } - } - world->set_interface(engine_interface); - - // Load GUI if requested - if (conf.option("gui").get<int32_t>()) { - ingen_try(world->load_module("gui"), "Failed to load GUI module"); + world->set_interface(engine_interface); } // Activate the engine, if we have one diff --git a/src/server/wscript b/src/server/wscript index c19168f2..8d1ec90d 100644 --- a/src/server/wscript +++ b/src/server/wscript @@ -63,7 +63,7 @@ def build(bld): use = 'libingen libingen_socket', cxxflags = bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS, linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS) - core_libs = 'GLIBMM LV2 LILV RAUL SERD SORD' + core_libs = 'LV2 LILV RAUL SERD SORD' autowaf.use_lib(bld, obj, core_libs) if bld.env.HAVE_JACK: diff --git a/src/wscript b/src/wscript index 2fe39652..07379b83 100644 --- a/src/wscript +++ b/src/wscript @@ -43,4 +43,4 @@ def build(bld): lib = lib, cxxflags = bld.env.PTHREAD_CFLAGS + bld.env.INGEN_TEST_CXXFLAGS, linkflags = bld.env.PTHREAD_LINKFLAGS + bld.env.INGEN_TEST_LINKFLAGS) - autowaf.use_lib(bld, obj, 'GLIBMM LV2 LILV RAUL SERD SORD SRATOM') + autowaf.use_lib(bld, obj, 'LV2 LILV RAUL SERD SORD SRATOM') @@ -77,10 +77,6 @@ def configure(conf): autowaf.check_pkg(conf, 'lv2', uselib_store='LV2', atleast_version='1.15.3', mandatory=True) - autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', - atleast_version='2.14.0', mandatory=True) - autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', - atleast_version='2.14.0', mandatory=True) autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV', atleast_version='0.21.5', mandatory=True) autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL', |