diff options
-rw-r--r-- | ingen/client/PluginUI.hpp | 12 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 12 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 5 |
3 files changed, 20 insertions, 9 deletions
diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 83a810f3..a62b0110 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -34,7 +34,7 @@ namespace Client { class BlockModel; -/** Model for a plugin available for loading. +/** Custom user interface for a plugin. * * @ingroup IngenClient */ @@ -55,6 +55,16 @@ public: bool is_resizable() const; + /** Signal emitted when the UI sets a property. + * + * The application must connect to this signal to communicate with the + * engine and/or update itself as necessary. + */ + INGEN_SIGNAL(property_changed, void, + const Raul::URI&, // Subject + const Raul::URI&, // Predicate + const Atom&); // Object + Ingen::World* world() const { return _world; } SPtr<const BlockModel> block() const { return _block; } diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 31e1f9ae..b8c7c7b3 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -70,7 +70,7 @@ lv2_ui_write(SuilController controller, return; // Ignore feedback } - ui->world()->interface()->set_property( + ui->signal_property_changed()( port->uri(), uris.ingen_value, ui->world()->forge().make(value)); @@ -79,9 +79,9 @@ lv2_ui_write(SuilController controller, const LV2_Atom* atom = (const LV2_Atom*)buffer; Atom val = ui->world()->forge().alloc( atom->size, atom->type, LV2_ATOM_BODY_CONST(atom)); - ui->world()->interface()->set_property(port->uri(), - uris.ingen_activity, - val); + ui->signal_property_changed()(port->uri(), + uris.ingen_activity, + val); } else { ui->world()->log().warn( @@ -116,7 +116,7 @@ lv2_ui_subscribe(SuilController controller, return 1; } - ui->world()->interface()->set_property( + ui->signal_property_changed()( ui->block()->ports()[port_index]->uri(), ui->world()->uris().ingen_broadcast, ui->world()->forge().make(true)); @@ -136,7 +136,7 @@ lv2_ui_unsubscribe(SuilController controller, return 1; } - ui->world()->interface()->set_property( + ui->signal_property_changed()( ui->block()->ports()[port_index]->uri(), ui->world()->uris().ingen_broadcast, ui->world()->forge().make(false)); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index c03618cf..528b8e0f 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -228,8 +228,9 @@ NodeModule::embed_gui(bool embed) } if (!_plugin_ui) { - const PluginModel* const pm = dynamic_cast<const PluginModel*>(_block->plugin()); - _plugin_ui = pm->ui(app().world(), _block); + _plugin_ui = _block->plugin_model()->ui(app().world(), _block); + _plugin_ui->signal_property_changed().connect( + sigc::mem_fun(app(), &App::set_property)); } if (_plugin_ui) { |