diff options
-rw-r--r-- | ingen/client/PluginUI.hpp | 8 | ||||
-rw-r--r-- | src/client/PluginUI.cpp | 28 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 3 |
3 files changed, 35 insertions, 4 deletions
diff --git a/ingen/client/PluginUI.hpp b/ingen/client/PluginUI.hpp index 48c80ca2..a4804b4c 100644 --- a/ingen/client/PluginUI.hpp +++ b/ingen/client/PluginUI.hpp @@ -54,16 +54,20 @@ public: uint32_t format, const void* buffer); + bool is_resizable() const; + Ingen::Shared::World* world() const { return _world; } SharedPtr<const NodeModel> node() const { return _node; } private: - PluginUI(Ingen::Shared::World* world, - SharedPtr<const NodeModel> node); + PluginUI(Ingen::Shared::World* world, + SharedPtr<const NodeModel> node, + const LilvNode* ui_node); Ingen::Shared::World* _world; SharedPtr<const NodeModel> _node; SuilInstance* _instance; + LilvNode* _ui_node; static SuilHost* ui_host; diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 87f25d8f..ac54b2f5 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -22,6 +22,7 @@ #include "ingen/shared/LV2URIMap.hpp" #include "ingen/shared/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" +#include "lv2/lv2plug.in/ns/extensions/ui/ui.h" using namespace std; using namespace Raul; @@ -75,16 +76,19 @@ lv2_ui_write(SuilController controller, } PluginUI::PluginUI(Ingen::Shared::World* world, - SharedPtr<const NodeModel> node) + SharedPtr<const NodeModel> node, + const LilvNode* ui_node) : _world(world) , _node(node) , _instance(NULL) + , _ui_node(lilv_node_duplicate(ui_node)) { } PluginUI::~PluginUI() { suil_instance_free(_instance); + lilv_node_free(_ui_node); } SharedPtr<PluginUI> @@ -120,7 +124,7 @@ PluginUI::create(Ingen::Shared::World* world, return SharedPtr<PluginUI>(); } - SharedPtr<PluginUI> ret(new PluginUI(world, node)); + SharedPtr<PluginUI> ret(new PluginUI(world, node, lilv_ui_get_uri(ui))); ret->_features = world->lv2_features()->lv2_features( world, const_cast<NodeModel*>(node.get())); @@ -163,5 +167,25 @@ PluginUI::port_event(uint32_t port_index, _instance, port_index, buffer_size, format, buffer); } +bool +PluginUI::is_resizable() const +{ + const LilvNode* s = _ui_node; + LilvNode* p = lilv_new_uri(_world->lilv_world(), LV2_CORE__optionalFeature); + LilvNode* fs = lilv_new_uri(_world->lilv_world(), LV2_UI__fixedSize); + LilvNode* nrs = lilv_new_uri(_world->lilv_world(), LV2_UI__noUserResize); + + LilvNodes* fs_matches = lilv_world_find_nodes(_world->lilv_world(), s, p, fs); + LilvNodes* nrs_matches = lilv_world_find_nodes(_world->lilv_world(), s, p, nrs); + + lilv_nodes_free(nrs_matches); + lilv_nodes_free(fs_matches); + lilv_node_free(nrs); + lilv_node_free(fs); + lilv_node_free(p); + + return !fs_matches && !nrs_matches; +} + } // namespace Client } // namespace Ingen diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 9719ed67..b4820008 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -307,6 +307,9 @@ NodeModule::popup_gui() _gui_widget = Glib::wrap(c_widget); _gui_window = new Gtk::Window(); + if (!_plugin_ui->is_resizable()) { + _gui_window->set_resizable(false); + } _gui_window->set_title(_node->path().chop_scheme() + " UI - Ingen"); _gui_window->set_role("plugin_ui"); _gui_window->add(*_gui_widget); |