summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/NodeModule.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-10-03 23:55:17 +0000
committerDavid Robillard <d@drobilla.net>2007-10-03 23:55:17 +0000
commit93197523aaf7b35350a2a26430be7301ad0502b8 (patch)
treeffe2be522ff0340107c16ce03ffe43fc4bddf43e /src/libs/gui/NodeModule.cpp
parent8d56b7e97a7da0bcae1160b65153cc13fdf2428c (diff)
downloadingen-93197523aaf7b35350a2a26430be7301ad0502b8.tar.gz
ingen-93197523aaf7b35350a2a26430be7301ad0502b8.tar.bz2
ingen-93197523aaf7b35350a2a26430be7301ad0502b8.zip
Initialise GUI controls for popped up GUIs as well.
git-svn-id: http://svn.drobilla.net/lad/ingen@819 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/NodeModule.cpp')
-rw-r--r--src/libs/gui/NodeModule.cpp48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp
index 61fb5984..d3bb9de3 100644
--- a/src/libs/gui/NodeModule.cpp
+++ b/src/libs/gui/NodeModule.cpp
@@ -106,7 +106,7 @@ void
NodeModule::control_change(uint32_t index, float control)
{
if (_slv2_ui) {
- const LV2UI_Descriptor* ui_descriptor = slv2_ui_instance_get_descriptor(_slv2_ui);
+ const LV2UI_Descriptor* const ui_descriptor = slv2_ui_instance_get_descriptor(_slv2_ui);
LV2UI_Handle ui_handle = slv2_ui_instance_get_handle(_slv2_ui);
ui_descriptor->port_event(ui_handle, index, 4, &control);
}
@@ -194,12 +194,7 @@ NodeModule::embed_gui(bool embed)
}
if (embed && _gui_item) {
- uint32_t index=0;
- for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) {
- if ((*p)->is_control())
- control_change(index, (*p)->value());
- ++index;
- }
+ initialise_gui_values();
set_base_color(0x212222FF);
} else {
set_default_base_color();
@@ -259,18 +254,25 @@ NodeModule::popup_gui()
{
#ifdef HAVE_SLV2
if (_node->plugin()->type() == PluginModel::LV2) {
- // FIXME: check type
-
- SLV2UIInstance ui = _node->plugin()->ui(App::instance().engine().get(), _node.get());
- if (ui) {
- cerr << "Showing LV2 GUI" << endl;
- // FIXME: leak
- GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(ui);
- Gtk::Widget* widget = Glib::wrap(c_widget);
+ if (_slv2_ui) {
+ cerr << "LV2 GUI already embedded" << endl;
+ return false;
+ }
+
+ _slv2_ui = _node->plugin()->ui(App::instance().engine().get(), _node.get());
+ if (_slv2_ui) {
+ cerr << "Popping up LV2 GUI" << endl;
+
+ // FIXME: leaks
+
+ GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_slv2_ui);
+ _gui = Glib::wrap(c_widget);
Gtk::Window* win = new Gtk::Window();
- win->add(*widget);
- widget->show_all();
+ win->add(*_gui);
+ _gui->show_all();
+ initialise_gui_values();
+
win->present();
return true;
} else {
@@ -283,6 +285,18 @@ NodeModule::popup_gui()
void
+NodeModule::initialise_gui_values()
+{
+ uint32_t index=0;
+ for (PortModelList::const_iterator p = _node->ports().begin(); p != _node->ports().end(); ++p) {
+ if ((*p)->is_control())
+ control_change(index, (*p)->value());
+ ++index;
+ }
+}
+
+
+void
NodeModule::show_control_window()
{
App::instance().window_factory()->present_controls(_node);