summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ingen/shared/URIs.hpp1
-rw-r--r--src/client/PluginModel.cpp3
-rw-r--r--src/gui/NodeMenu.cpp4
-rw-r--r--src/gui/NodeModule.cpp39
-rw-r--r--src/gui/NodeModule.hpp1
-rw-r--r--src/shared/URIs.cpp1
6 files changed, 26 insertions, 23 deletions
diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp
index 8f5b830e..0014961f 100644
--- a/ingen/shared/URIs.hpp
+++ b/ingen/shared/URIs.hpp
@@ -81,6 +81,7 @@ public:
const Quark ingen_sampleRate;
const Quark ingen_selected;
const Quark ingen_source;
+ const Quark ingen_uiEmbedded;
const Quark ingen_value;
const Quark lv2_AudioPort;
const Quark lv2_CVPort;
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 4381d979..6a5912a8 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -195,8 +195,9 @@ SharedPtr<PluginUI>
PluginModel::ui(Ingen::Shared::World* world,
SharedPtr<const NodeModel> node) const
{
- if (_type != LV2)
+ if (!_lilv_plugin) {
return SharedPtr<PluginUI>();
+ }
return PluginUI::create(world, node, _lilv_plugin);
}
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();
diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp
index 9d78a2d1..415fc421 100644
--- a/src/shared/URIs.cpp
+++ b/src/shared/URIs.cpp
@@ -85,6 +85,7 @@ URIs::URIs(Ingen::Forge& f, LV2URIMap* map)
, ingen_sampleRate (forge, map, NS_INGEN "sampleRate")
, ingen_selected (forge, map, NS_INGEN "selected")
, ingen_source (forge, map, NS_INGEN "source")
+ , ingen_uiEmbedded (forge, map, NS_INGEN "uiEmbedded")
, ingen_value (forge, map, NS_INGEN "value")
, lv2_AudioPort (forge, map, LV2_CORE__AudioPort)
, lv2_CVPort (forge, map, LV2_CORE__CVPort)