From 6bef80f5e1bdf724a77ef989ce9a7205f426a378 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 22 Apr 2012 02:07:08 +0000 Subject: Show non-resizable plugin UIs properly. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4228 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginUI.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/client') 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 node) + SharedPtr 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 @@ -120,7 +124,7 @@ PluginUI::create(Ingen::Shared::World* world, return SharedPtr(); } - SharedPtr ret(new PluginUI(world, node)); + SharedPtr ret(new PluginUI(world, node, lilv_ui_get_uri(ui))); ret->_features = world->lv2_features()->lv2_features( world, const_cast(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 -- cgit v1.2.1