diff options
author | David Robillard <d@drobilla.net> | 2007-09-22 19:43:11 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-22 19:43:11 +0000 |
commit | 996f9015fe055ca63823110175593317ac20c80f (patch) | |
tree | 526d4bb1c4dd2ed8c5a05dcacabe78e1d000bd22 /src | |
parent | 106b0784b8c8347bbbebcedc421030effdc26fd0 (diff) | |
download | lilv-996f9015fe055ca63823110175593317ac20c80f.tar.gz lilv-996f9015fe055ca63823110175593317ac20c80f.tar.bz2 lilv-996f9015fe055ca63823110175593317ac20c80f.zip |
LV2 UI extension updates.
LV2 GUI support in ingen.
git-svn-id: http://svn.drobilla.net/lad/slv2@763 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/plugin.c | 30 | ||||
-rw-r--r-- | src/pluginguiinstance.c | 62 | ||||
-rw-r--r-- | src/slv2_internal.h | 14 | ||||
-rw-r--r-- | src/value.c | 18 |
4 files changed, 62 insertions, 62 deletions
diff --git a/src/plugin.c b/src/plugin.c index fa7ebe6..51ae77e 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -560,18 +560,18 @@ slv2_plugin_get_port_by_symbol(SLV2Plugin p, SLV2Values -slv2_plugin_get_guis(SLV2Plugin plugin) +slv2_plugin_get_uis(SLV2Plugin plugin) { if (!plugin->rdf) slv2_plugin_load(plugin); SLV2Values result = slv2_plugin_get_value(plugin, SLV2_URI, - "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#gui"); + "http://ll-plugins.nongnu.org/lv2/ext/gui/dev/1#gui"); for (int i=0; i < raptor_sequence_size(result); ++i) { SLV2Value val = (SLV2Value)raptor_sequence_get_at(result, i); - val->type = SLV2_VALUE_GUI; - val->val.gui_type_val = SLV2_GUI_TYPE_GTK2; + val->type = SLV2_VALUE_UI; + val->val.ui_type_val = SLV2_UI_TYPE_GTK2; } return result; @@ -579,16 +579,16 @@ slv2_plugin_get_guis(SLV2Plugin plugin) SLV2Value -slv2_plugin_get_gui_library_uri(SLV2Plugin plugin, - SLV2Value gui) +slv2_plugin_get_ui_library_uri(SLV2Plugin plugin, + SLV2Value ui) { - assert(gui->type == SLV2_VALUE_GUI); + assert(ui->type == SLV2_VALUE_UI); if (!plugin->rdf) slv2_plugin_load(plugin); - SLV2Values values = slv2_plugin_get_value_for_subject(plugin, gui, SLV2_URI, - "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui#binary"); + SLV2Values values = slv2_plugin_get_value_for_subject(plugin, ui, SLV2_URI, + "http://ll-plugins.nongnu.org/lv2/ext/gui/dev/1#binary"); if (!values || slv2_values_size(values) == 0) { slv2_values_free(values); @@ -609,20 +609,20 @@ slv2_plugin_get_gui_library_uri(SLV2Plugin plugin, const char* -slv2_gui_type_get_uri(SLV2GUIType type) +slv2_ui_type_get_uri(SLV2UIType type) { - if (type == SLV2_GUI_TYPE_GTK2) - return "http://ll-plugins.nongnu.org/lv2/ext/gtk2gui"; + if (type == SLV2_UI_TYPE_GTK2) + return "http://ll-plugins.nongnu.org/ext/gui/dev/1#GtkUI"; else return NULL; } void* -slv2_plugin_load_gui(SLV2Plugin plugin, - SLV2Value gui) +slv2_plugin_load_ui(SLV2Plugin plugin, + SLV2Value ui) { - SLV2Value lib_uri = slv2_plugin_get_gui_library_uri(plugin, gui); + SLV2Value lib_uri = slv2_plugin_get_ui_library_uri(plugin, ui); if (!lib_uri) return NULL; diff --git a/src/pluginguiinstance.c b/src/pluginguiinstance.c index a29e64d..ee6de5b 100644 --- a/src/pluginguiinstance.c +++ b/src/pluginguiinstance.c @@ -26,27 +26,27 @@ #include <dlfcn.h> #include <slv2/types.h> #include <slv2/plugin.h> -#include <slv2/pluginguiinstance.h> +#include <slv2/pluginuiinstance.h> #include <slv2/util.h> #include "slv2_internal.h" -SLV2GUIInstance -slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, - SLV2Value gui, - LV2UI_Write_Function write_function, - LV2UI_Command_Function command_function, - LV2UI_Program_Change_Function program_function, - LV2UI_Program_Save_Function save_function, - LV2UI_Controller controller, - const LV2_Host_Feature* const* host_features) +SLV2UIInstance +slv2_plugin_ui_instantiate(SLV2Plugin plugin, + SLV2Value ui, + LV2UI_Write_Function write_function, + LV2UI_Command_Function command_function, + LV2UI_Program_Change_Function program_function, + LV2UI_Program_Save_Function save_function, + LV2UI_Controller controller, + const LV2_Host_Feature* const* host_features) { - assert(gui->type == SLV2_VALUE_GUI); + assert(ui->type == SLV2_VALUE_UI); - if (gui->val.gui_type_val != SLV2_GUI_TYPE_GTK2) + if (ui->val.ui_type_val != SLV2_UI_TYPE_GTK2) return NULL; - struct _SLV2GUIInstance* result = NULL; + struct _SLV2UIInstance* result = NULL; bool local_host_features = (host_features == NULL); if (local_host_features) { @@ -54,7 +54,7 @@ slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, ((LV2_Host_Feature**)host_features)[0] = NULL; } - const char* const lib_uri = slv2_value_as_uri(slv2_plugin_get_gui_library_uri(plugin, gui)); + const char* const lib_uri = slv2_value_as_uri(slv2_plugin_get_ui_library_uri(plugin, ui)); const char* const lib_path = slv2_uri_to_path(lib_uri); if (!lib_path) @@ -63,7 +63,7 @@ slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, dlerror(); void* lib = dlopen(lib_path, RTLD_NOW); if (!lib) { - fprintf(stderr, "Unable to open GUI library %s (%s)\n", lib_path, dlerror()); + fprintf(stderr, "Unable to open UI library %s (%s)\n", lib_path, dlerror()); return NULL; } @@ -71,35 +71,35 @@ slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, if (!df) { fprintf(stderr, "Could not find symbol 'lv2ui_descriptor', " - "%s is not a LV2 plugin GUI.\n", lib_path); + "%s is not a LV2 plugin UI.\n", lib_path); dlclose(lib); return NULL; } else { // Search for plugin by URI - // FIXME: Bundle in plugin GUI only, boo + // FIXME: Bundle in plugin UI only, boo const char* bundle_path = slv2_uri_to_path(slv2_plugin_get_bundle_uri(plugin)); - printf("GUI bundle path: %s\n", bundle_path); + printf("UI bundle path: %s\n", bundle_path); for (uint32_t i=0; 1; ++i) { const LV2UI_Descriptor* ld = df(i); if (!ld) { - fprintf(stderr, "Did not find GUI %s in %s\n", - slv2_value_as_uri(gui), lib_path); + fprintf(stderr, "Did not find UI %s in %s\n", + slv2_value_as_uri(ui), lib_path); dlclose(lib); break; // return NULL - } else if (!strcmp(ld->URI, slv2_value_as_uri(gui))) { + } else if (!strcmp(ld->URI, slv2_value_as_uri(ui))) { - printf("Found GUI %s at index %u in:\n\t%s\n\n", + printf("Found UI %s at index %u in:\n\t%s\n\n", librdf_uri_as_string(plugin->plugin_uri), i, lib_path); assert(ld->instantiate); - // Create SLV2GUIInstance to return - result = malloc(sizeof(struct _SLV2GUIInstance)); - struct _SLV2GUIInstanceImpl* impl = malloc(sizeof(struct _SLV2GUIInstanceImpl)); + // Create SLV2UIInstance to return + result = malloc(sizeof(struct _SLV2UIInstance)); + struct _SLV2UIInstanceImpl* impl = malloc(sizeof(struct _SLV2UIInstanceImpl)); impl->lv2ui_descriptor = ld; impl->lv2ui_handle = ld->instantiate(ld, slv2_plugin_get_uri(plugin), @@ -131,7 +131,7 @@ slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, // Failed to create a widget, but still got a handle - this means that // the plugin is buggy if (result->pimpl->widget == NULL) { - slv2_gtk2_gui_instance_free(result); + slv2_ui_instance_free(result); return NULL; } @@ -143,9 +143,9 @@ slv2_plugin_gtk2_gui_instantiate(SLV2Plugin plugin, void -slv2_gtk2_gui_instance_free(SLV2GUIInstance instance) +slv2_ui_instance_free(SLV2UIInstance instance) { - struct _SLV2GUIInstance* i = (struct _SLV2GUIInstance*)instance; + struct _SLV2UIInstance* i = (struct _SLV2UIInstance*)instance; i->pimpl->lv2ui_descriptor->cleanup(i->pimpl->lv2ui_handle); i->pimpl->lv2ui_descriptor = NULL; dlclose(i->pimpl->lib_handle); @@ -157,19 +157,19 @@ slv2_gtk2_gui_instance_free(SLV2GUIInstance instance) LV2UI_Widget -slv2_gtk2_gui_instance_get_widget(SLV2GUIInstance instance) { +slv2_ui_instance_get_widget(SLV2UIInstance instance) { return instance->pimpl->widget; } const LV2UI_Descriptor* -slv2_gtk2_gui_instance_get_descriptor(SLV2GUIInstance instance) { +slv2_ui_instance_get_descriptor(SLV2UIInstance instance) { return instance->pimpl->lv2ui_descriptor; } LV2_Handle -slv2_gtk2_gui_instance_get_handle(SLV2GUIInstance instance) { +slv2_ui_instance_get_handle(SLV2UIInstance instance) { return instance->pimpl->lv2ui_handle; } diff --git a/src/slv2_internal.h b/src/slv2_internal.h index 1dedc50..1a34699 100644 --- a/src/slv2_internal.h +++ b/src/slv2_internal.h @@ -99,7 +99,7 @@ struct _InstanceImpl { /* ********* GUI Instance ********* */ -struct _SLV2GUIInstanceImpl { +struct _SLV2UIInstanceImpl { void* lib_handle; const LV2UI_Descriptor* lv2ui_descriptor; LV2UI_Handle lv2ui_handle; @@ -171,8 +171,8 @@ slv2_world_load_file(SLV2World world, librdf_uri* file_uri); /* ********* GUI ********* */ -struct _SLV2GUI { - SLV2GUIType type; +struct _SLV2UI { + SLV2UIType type; char* uri; }; @@ -186,16 +186,16 @@ typedef enum _SLV2ValueType { SLV2_VALUE_STRING, SLV2_VALUE_INT, SLV2_VALUE_FLOAT, - SLV2_VALUE_GUI + SLV2_VALUE_UI } SLV2ValueType; struct _SLV2Value { SLV2ValueType type; char* str_val; ///< always present union { - int int_val; - float float_val; - SLV2GUIType gui_type_val; + int int_val; + float float_val; + SLV2UIType ui_type_val; } val; }; diff --git a/src/value.c b/src/value.c index 9a3254d..c18074f 100644 --- a/src/value.c +++ b/src/value.c @@ -90,7 +90,7 @@ slv2_value_get_turtle_token(SLV2Value value) char* result = NULL; switch (value->type) { - case SLV2_VALUE_GUI: + case SLV2_VALUE_UI: case SLV2_VALUE_URI: len = strlen(value->str_val) + 3; result = calloc(len, sizeof(char)); @@ -119,14 +119,14 @@ slv2_value_get_turtle_token(SLV2Value value) bool slv2_value_is_uri(SLV2Value value) { - return (value->type == SLV2_VALUE_URI || value->type == SLV2_VALUE_GUI); + return (value->type == SLV2_VALUE_URI || value->type == SLV2_VALUE_UI); } const char* slv2_value_as_uri(SLV2Value value) { - assert(slv2_value_is_uri(value) || slv2_value_is_gui(value)); + assert(slv2_value_is_uri(value) || slv2_value_is_ui(value)); return value->str_val; } @@ -187,16 +187,16 @@ slv2_value_as_float(SLV2Value value) bool -slv2_value_is_gui(SLV2Value value) +slv2_value_is_ui(SLV2Value value) { - return (value->type == SLV2_VALUE_GUI); + return (value->type == SLV2_VALUE_UI); } -SLV2GUIType -slv2_value_as_gui_type(SLV2Value value) +SLV2UIType +slv2_value_as_ui_type(SLV2Value value) { - assert(slv2_value_is_gui(value)); - return value->val.gui_type_val; + assert(slv2_value_is_ui(value)); + return value->val.ui_type_val; } |