diff options
author | David Robillard <d@drobilla.net> | 2011-04-22 06:26:38 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-04-22 06:26:38 +0000 |
commit | 0e069818d39bdf323d6b694730997e71ab12905e (patch) | |
tree | 970bce00e73fa9d31669c80051dc568eb3f7ece0 /src/client/PluginUI.cpp | |
parent | 138a87e915ad3aff184730415105f94c874174bf (diff) | |
download | ingen-0e069818d39bdf323d6b694730997e71ab12905e.tar.gz ingen-0e069818d39bdf323d6b694730997e71ab12905e.tar.bz2 ingen-0e069818d39bdf323d6b694730997e71ab12905e.zip |
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
Diffstat (limited to 'src/client/PluginUI.cpp')
-rw-r--r-- | src/client/PluginUI.cpp | 57 |
1 files changed, 37 insertions, 20 deletions
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<PluginUI> @@ -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<PluginUI> 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); } |