From 0e069818d39bdf323d6b694730997e71ab12905e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 22 Apr 2011 06:26:38 +0000 Subject: Remove UI instance API from SLV2 (apps should implement UIs via Suil now). Remove UI extension API and header from public APIs entirely. Rework UI instance API to support multiple UIs and a more precise notion of embedding support. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3186 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginUI.cpp | 57 ++++++++++++++++++++++++++++++++----------------- src/client/PluginUI.hpp | 9 +++++--- src/client/wscript | 2 +- 3 files changed, 44 insertions(+), 24 deletions(-) (limited to 'src/client') diff --git a/src/client/PluginUI.cpp b/src/client/PluginUI.cpp index 6315bdd2..c5f184d5 100644 --- a/src/client/PluginUI.cpp +++ b/src/client/PluginUI.cpp @@ -34,14 +34,14 @@ using namespace Raul; namespace Ingen { namespace Client { -SLV2UIHost PluginUI::ui_host = NULL; +SuilHost PluginUI::ui_host = NULL; static void -lv2_ui_write(LV2UI_Controller controller, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void* buffer) +lv2_ui_write(SuilController controller, + uint32_t port_index, + uint32_t buffer_size, + uint32_t format, + const void* buffer) { PluginUI* const ui = (PluginUI*)controller; @@ -111,7 +111,7 @@ PluginUI::PluginUI(Ingen::Shared::World* world, PluginUI::~PluginUI() { - slv2_ui_instance_free(_instance); + suil_instance_free(_instance); } SharedPtr @@ -120,13 +120,27 @@ PluginUI::create(Ingen::Shared::World* world, SLV2Plugin plugin) { if (!PluginUI::ui_host) { - PluginUI::ui_host = slv2_ui_host_new(lv2_ui_write, NULL, NULL, NULL); + PluginUI::ui_host = suil_host_new(lv2_ui_write, NULL, NULL, NULL); } - SLV2Value gtk_ui = slv2_value_new_uri( - world->slv2_world(), "http://lv2plug.in/ns/extensions/ui#GtkUI"); - - SLV2UI ui = slv2_plugin_get_default_ui(plugin, gtk_ui); + static const char* gtk_ui_uri = "http://lv2plug.in/ns/extensions/ui#GtkUI"; + + SLV2Value gtk_ui = slv2_value_new_uri(world->slv2_world(), gtk_ui_uri); + + SLV2UIs uis = slv2_plugin_get_uis(plugin); + SLV2UI ui = NULL; + SLV2Value ui_type = NULL; + SLV2_FOREACH(u, uis) { + SLV2UI this_ui = slv2_uis_get(uis, u); + if (slv2_ui_is_supported(this_ui, + suil_ui_supported, + gtk_ui, + &ui_type)) { + // TODO: Multiple UI support + ui = this_ui; + break; + } + } if (!ui) { slv2_value_free(gtk_ui); @@ -136,12 +150,15 @@ PluginUI::create(Ingen::Shared::World* world, SharedPtr ret(new PluginUI(world, node)); ret->_features = world->lv2_features()->lv2_features(world, node.get()); - SLV2UIInstance instance = slv2_ui_instance_new( - plugin, - ui, - gtk_ui, - ui_host, + SuilInstance instance = suil_instance_new( + PluginUI::ui_host, ret.get(), + slv2_value_as_uri(gtk_ui), + slv2_value_as_uri(slv2_plugin_get_uri(plugin)), + slv2_value_as_uri(slv2_ui_get_uri(ui)), + slv2_value_as_uri(ui_type), + slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_bundle_uri(ui))), + slv2_uri_to_path(slv2_value_as_uri(slv2_ui_get_binary_uri(ui))), ret->_features->array()); slv2_value_free(gtk_ui); @@ -156,10 +173,10 @@ PluginUI::create(Ingen::Shared::World* world, return ret; } -LV2UI_Widget +SuilWidget PluginUI::get_widget() { - return (LV2UI_Widget*)slv2_ui_instance_get_widget(_instance); + return (SuilWidget*)suil_instance_get_widget(_instance); } void @@ -168,7 +185,7 @@ PluginUI::port_event(uint32_t port_index, uint32_t format, const void* buffer) { - slv2_ui_instance_port_event( + suil_instance_port_event( _instance, port_index, buffer_size, format, buffer); } diff --git a/src/client/PluginUI.hpp b/src/client/PluginUI.hpp index e07da923..f9dc0bbb 100644 --- a/src/client/PluginUI.hpp +++ b/src/client/PluginUI.hpp @@ -19,8 +19,11 @@ #define INGEN_CLIENT_PLUGINUI_HPP #include "raul/SharedPtr.hpp" + #include "slv2/slv2.h" +#include "suil/suil.h" + #include "LV2Features.hpp" namespace Ingen { @@ -45,7 +48,7 @@ public: SharedPtr node, SLV2Plugin plugin); - LV2UI_Widget get_widget(); + SuilWidget get_widget(); void port_event(uint32_t port_index, uint32_t buffer_size, @@ -61,9 +64,9 @@ private: Ingen::Shared::World* _world; SharedPtr _node; - SLV2UIInstance _instance; + SuilInstance _instance; - static SLV2UIHost ui_host; + static SuilHost ui_host; SharedPtr _features; }; diff --git a/src/client/wscript b/src/client/wscript index 06258b67..bc771d2c 100644 --- a/src/client/wscript +++ b/src/client/wscript @@ -36,5 +36,5 @@ def build(bld): obj.target = 'ingen_client' obj.install_path = '${LIBDIR}' obj.use = 'libingen_shared' - autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 RAUL SORD SOUP SIGCPP LIBLO SOUP') + autowaf.use_lib(bld, obj, 'GLIBMM LV2CORE SLV2 SUIL RAUL SORD SOUP SIGCPP LIBLO SOUP') -- cgit v1.2.1