summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-22 06:26:38 +0000
committerDavid Robillard <d@drobilla.net>2011-04-22 06:26:38 +0000
commit0e069818d39bdf323d6b694730997e71ab12905e (patch)
tree970bce00e73fa9d31669c80051dc568eb3f7ece0
parent138a87e915ad3aff184730415105f94c874174bf (diff)
downloadingen-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
-rw-r--r--src/client/PluginUI.cpp57
-rw-r--r--src/client/PluginUI.hpp9
-rw-r--r--src/client/wscript2
-rw-r--r--src/gui/wscript1
-rw-r--r--wscript2
5 files changed, 47 insertions, 24 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);
}
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<NodeModel> 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<NodeModel> _node;
- SLV2UIInstance _instance;
+ SuilInstance _instance;
- static SLV2UIHost ui_host;
+ static SuilHost ui_host;
SharedPtr<Shared::LV2Features::FeatureArray> _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')
diff --git a/src/gui/wscript b/src/gui/wscript
index 9eb4666d..59682ade 100644
--- a/src/gui/wscript
+++ b/src/gui/wscript
@@ -64,6 +64,7 @@ def build(bld):
LV2CORE
SLV2
SOUP
+ SUIL
''')
# Glade XML UI definition
diff --git a/wscript b/wscript
index e76e2296..c617cd40 100644
--- a/wscript
+++ b/wscript
@@ -50,6 +50,8 @@ def configure(conf):
atleast_version='0.120.0', mandatory=False)
autowaf.check_pkg(conf, 'slv2', uselib_store='SLV2',
atleast_version='0.7.0', mandatory=True)
+ autowaf.check_pkg(conf, 'suil', uselib_store='SUIL',
+ atleast_version='0.0.0', mandatory=False)
autowaf.check_pkg(conf, 'raul', uselib_store='RAUL',
atleast_version='0.8.0', mandatory=True)
autowaf.check_pkg(conf, 'sord', uselib_store='SORD',