summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-24 04:52:21 +0000
committerDavid Robillard <d@drobilla.net>2007-09-24 04:52:21 +0000
commit97faa683045e44563d25befe463e76f42c7d1a9b (patch)
tree1d1a476ee29075d835af8add80435c06bdcc9a20
parent5b706499e0a2ad3056afd2f9db1487ad169ec059 (diff)
downloadingen-97faa683045e44563d25befe463e76f42c7d1a9b.tar.gz
ingen-97faa683045e44563d25befe463e76f42c7d1a9b.tar.bz2
ingen-97faa683045e44563d25befe463e76f42c7d1a9b.zip
Avoid thread creation and glade stuff on module/port creation (defer until menu requested).
git-svn-id: http://svn.drobilla.net/lad/ingen@776 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/libs/gui/App.cpp2
-rw-r--r--src/libs/gui/App.hpp4
-rw-r--r--src/libs/gui/ConnectWindow.cpp20
-rw-r--r--src/libs/gui/NodeModule.cpp19
-rw-r--r--src/libs/gui/NodeModule.hpp2
-rw-r--r--src/libs/gui/Port.cpp17
-rw-r--r--src/libs/gui/Port.hpp2
-rw-r--r--src/libs/module/Module.cpp4
8 files changed, 41 insertions, 29 deletions
diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp
index b07352d7..feeae181 100644
--- a/src/libs/gui/App.cpp
+++ b/src/libs/gui/App.cpp
@@ -130,7 +130,7 @@ App::run(int argc, char** argv,
void
-App::attach(const SharedPtr<EngineInterface>& engine, const SharedPtr<SigClientInterface>& client)
+App::attach(SharedPtr<EngineInterface> engine, SharedPtr<SigClientInterface> client)
{
assert( ! _engine);
assert( ! _client);
diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp
index a300d04e..298fc44e 100644
--- a/src/libs/gui/App.hpp
+++ b/src/libs/gui/App.hpp
@@ -77,8 +77,8 @@ public:
void error_message(const string& msg);
- void attach(const SharedPtr<EngineInterface>& engine,
- const SharedPtr<SigClientInterface>& client);
+ void attach(SharedPtr<EngineInterface> engine,
+ SharedPtr<SigClientInterface> client);
void detach();
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index e61b72d8..e8f93354 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -112,21 +112,19 @@ ConnectWindow::start(SharedPtr<Ingen::Engine> engine, SharedPtr<Shared::EngineIn
if (engine) {
- engine->activate(1); // FIXME
-
Glib::signal_timeout().connect(
sigc::mem_fun(engine.get(), &Ingen::Engine::main_iteration), 1000);
ThreadedSigClientInterface* tsci = new ThreadedSigClientInterface(Ingen::event_queue_size);
SharedPtr<SigClientInterface> client(tsci);
+ Glib::signal_timeout().connect(
+ sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);
+
if (interface)
App::instance().attach(interface, client);
-
+
_connect_stage = 0;
-
- Glib::signal_timeout().connect(
- sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);
}
if (interface) {
@@ -243,7 +241,7 @@ ConnectWindow::connect()
assert(_new_engine);
_engine = SharedPtr<Ingen::Engine>(_new_engine(App::instance().world()));
- _engine->start_jack_driver();
+ //_engine->start_jack_driver();
SharedPtr<Ingen::EngineInterface> engine_interface = _engine->new_queued_interface();
@@ -252,16 +250,16 @@ ConnectWindow::connect()
App::instance().attach(engine_interface, client);
- _engine->activate(1); // FIXME
+ /*_engine->activate(1); // FIXME
Glib::signal_timeout().connect(
- sigc::mem_fun(_engine.get(), &Ingen::Engine::main_iteration), 1000);
+ sigc::mem_fun(_engine.get(), &Ingen::Engine::main_iteration), 1000);*/
Glib::signal_timeout().connect(
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
- Glib::signal_timeout().connect(
- sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);
+ /*Glib::signal_timeout().connect(
+ sigc::mem_fun(tsci, &ThreadedSigClientInterface::emit_signals), 10, G_PRIORITY_HIGH_IDLE);*/
}
}
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index c80952b5..b59e1e23 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -42,19 +42,12 @@ NodeModule::NodeModule(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeMode
, _gui_item(NULL)
{
assert(_node);
-
- Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
- xml->get_widget_derived("object_menu", _menu);
- _menu->init(node);
- set_menu(_menu);
node->signal_new_port.connect(sigc::bind(sigc::mem_fun(this, &NodeModule::add_port), true));
node->signal_removed_port.connect(sigc::mem_fun(this, &NodeModule::remove_port));
node->signal_metadata.connect(sigc::mem_fun(this, &NodeModule::set_metadata));
node->signal_polyphonic.connect(sigc::mem_fun(this, &NodeModule::set_stacked_border));
node->signal_renamed.connect(sigc::mem_fun(this, &NodeModule::rename));
-
- _menu->signal_embed_gui.connect(sigc::mem_fun(this, &NodeModule::embed_gui));
set_stacked_border(node->polyphonic());
}
@@ -71,6 +64,18 @@ NodeModule::~NodeModule()
}
+void
+NodeModule::create_menu()
+{
+ Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
+ xml->get_widget_derived("object_menu", _menu);
+ _menu->init(_node);
+ _menu->signal_embed_gui.connect(sigc::mem_fun(this, &NodeModule::embed_gui));
+
+ set_menu(_menu);
+}
+
+
boost::shared_ptr<NodeModule>
NodeModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<NodeModel> node)
{
diff --git a/src/libs/gui/NodeModule.hpp b/src/libs/gui/NodeModule.hpp
index 8bc1bb52..b35822f4 100644
--- a/src/libs/gui/NodeModule.hpp
+++ b/src/libs/gui/NodeModule.hpp
@@ -79,6 +79,8 @@ protected:
void embed_gui(bool embed);
void gui_size_request(Gtk::Requisition* req);
+
+ void create_menu();
SharedPtr<NodeModel> _node;
NodeMenu* _menu;
diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp
index b6c64cf0..a75d9cee 100644
--- a/src/libs/gui/Port.cpp
+++ b/src/libs/gui/Port.cpp
@@ -44,12 +44,6 @@ Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm
{
assert(module);
assert(_port_model);
-
- PortMenu* menu = NULL;
- Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
- xml->get_widget_derived("object_menu", menu);
- menu->init(pm);
- set_menu(menu);
_port_model->signal_renamed.connect(sigc::mem_fun(this, &Port::renamed));
@@ -73,6 +67,17 @@ Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm
void
+Port::create_menu()
+{
+ PortMenu* menu = NULL;
+ Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
+ xml->get_widget_derived("object_menu", menu);
+ menu->init(_port_model);
+ set_menu(menu);
+}
+
+
+void
Port::renamed()
{
set_name(_port_model->path().name());
diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp
index 8da6ce49..5e7b6bbe 100644
--- a/src/libs/gui/Port.hpp
+++ b/src/libs/gui/Port.hpp
@@ -43,6 +43,8 @@ public:
virtual ~Port() {}
SharedPtr<PortModel> model() const { return _port_model; }
+
+ void create_menu();
virtual void set_control(float value, bool signal);
void control_changed(float value);
diff --git a/src/libs/module/Module.cpp b/src/libs/module/Module.cpp
index 1c6c7788..8f445340 100644
--- a/src/libs/module/Module.cpp
+++ b/src/libs/module/Module.cpp
@@ -56,7 +56,7 @@ load_module(const string& name)
string filename = Glib::Module::build_path(dir, name);
if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY);
+ module = new Glib::Module(filename, Glib::MODULE_BIND_LAZY|Glib::MODULE_BIND_LOCAL);
if (*module) {
return SharedPtr<Glib::Module>(module);
@@ -71,7 +71,7 @@ load_module(const string& name)
// Try default directory if not found
module = new Glib::Module(
Glib::Module::build_path(INGEN_MODULE_DIR, name),
- Glib::MODULE_BIND_LAZY);
+ Glib::MODULE_BIND_LAZY|Glib::MODULE_BIND_LOCAL);
if (*module) {
return SharedPtr<Glib::Module>(module);