summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/NodeMenu.cpp4
-rw-r--r--src/gui/NodeModule.cpp39
-rw-r--r--src/gui/NodeModule.hpp1
3 files changed, 22 insertions, 22 deletions
diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp
index f63384d3..0d58d40c 100644
--- a/src/gui/NodeMenu.cpp
+++ b/src/gui/NodeMenu.cpp
@@ -67,6 +67,10 @@ NodeMenu::init(App& app, SharedPtr<const NodeModel> node)
if (plugin && plugin->type() == PluginModel::LV2 && plugin->has_ui()) {
_popup_gui_menuitem->show();
_embed_gui_menuitem->show();
+ const Raul::Atom& ui_embedded = node->get_property(
+ _app->uris().ingen_uiEmbedded);
+ _embed_gui_menuitem->set_active(
+ ui_embedded.is_valid() && ui_embedded.get_bool());
} else {
_popup_gui_menuitem->hide();
_embed_gui_menuitem->hide();
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index bdd5f32f..87b3ba5d 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -88,7 +88,7 @@ NodeModule::show_menu(GdkEventButton* ev)
WidgetFactory::get_widget_derived("object_menu", _menu);
_menu->init(app(), _node);
_menu->signal_embed_gui.connect(
- sigc::mem_fun(this, &NodeModule::embed_gui));
+ sigc::mem_fun(this, &NodeModule::on_embed_gui_toggled));
_menu->signal_popup_gui.connect(
sigc::hide_return(sigc::mem_fun(this, &NodeModule::popup_gui)));
_menu->popup(ev->button, ev->time);
@@ -190,11 +190,18 @@ NodeModule::plugin_changed()
}
void
+NodeModule::on_embed_gui_toggled(bool embed)
+{
+ embed_gui(embed);
+ app().engine()->set_property(_node->path(),
+ app().uris().ingen_uiEmbedded,
+ app().forge().make(embed));
+}
+
+void
NodeModule::embed_gui(bool embed)
{
- const URIs& uris = app().uris();
if (embed) {
-
if (_gui_window) {
warn << "LV2 GUI already popped up, cannot embed" << endl;
return;
@@ -220,30 +227,12 @@ NodeModule::embed_gui(bool embed)
if (_gui_widget) {
_gui_widget->show_all();
-
- for (NodeModel::Ports::const_iterator p = _node->ports().begin();
- p != _node->ports().end(); ++p)
- if ((*p)->is_output() && app().can_control(p->get()))
- app().engine()->set_property((*p)->path(),
- uris.ingen_broadcast,
- app().forge().make(true));
+ set_control_values();
}
} else { // un-embed
-
Ganv::Module::embed(NULL);
_plugin_ui.reset();
-
- for (NodeModel::Ports::const_iterator p = _node->ports().begin();
- p != _node->ports().end(); ++p)
- if ((*p)->is_output() && app().can_control(p->get()))
- app().engine()->set_property((*p)->path(),
- uris.ingen_broadcast,
- app().forge().make(false));
- }
-
- if (embed) {
- set_control_values();
}
}
@@ -415,6 +404,12 @@ NodeModule::property_changed(const URI& key, const Atom& value)
if (value.get_bool() != get_selected()) {
set_selected(value.get_bool());
}
+ } else if (key == uris.ingen_uiEmbedded) {
+ if (value.get_bool() && !_gui_widget) {
+ embed_gui(true);
+ } else if (!value.get_bool() && _gui_widget) {
+ embed_gui(false);
+ }
}
} else if (value.type() == uris.forge.String) {
if (key == uris.lv2_name
diff --git a/src/gui/NodeModule.hpp b/src/gui/NodeModule.hpp
index a0dd3417..6d83230a 100644
--- a/src/gui/NodeModule.hpp
+++ b/src/gui/NodeModule.hpp
@@ -73,6 +73,7 @@ protected:
bool on_event(GdkEvent* ev);
void show_control_window();
+ void on_embed_gui_toggled(bool embed);
void embed_gui(bool embed);
bool popup_gui();
void on_gui_window_close();