From 996f9015fe055ca63823110175593317ac20c80f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Sep 2007 19:43:11 +0000 Subject: LV2 UI extension updates. LV2 GUI support in ingen. git-svn-id: http://svn.drobilla.net/lad/slv2@763 a436a847-0d15-0410-975c-d299462d15a1 --- configure.ac | 8 +-- slv2/Makefile.am | 4 +- slv2/gui.h | 60 ---------------------- slv2/plugin.h | 20 ++++---- slv2/pluginguiinstance.h | 129 ----------------------------------------------- slv2/pluginuiinstance.h | 129 +++++++++++++++++++++++++++++++++++++++++++++++ slv2/slv2.h | 4 +- slv2/types.h | 12 ++--- slv2/ui.h | 60 ++++++++++++++++++++++ slv2/value.h | 16 +++--- src/plugin.c | 30 +++++------ src/pluginguiinstance.c | 62 +++++++++++------------ src/slv2_internal.h | 14 ++--- src/value.c | 18 +++---- utils/lv2_inspect.c | 20 ++++---- 15 files changed, 293 insertions(+), 293 deletions(-) delete mode 100644 slv2/gui.h delete mode 100644 slv2/pluginguiinstance.h create mode 100644 slv2/pluginuiinstance.h create mode 100644 slv2/ui.h diff --git a/configure.ac b/configure.ac index 711ab35..33dd1ef 100644 --- a/configure.ac +++ b/configure.ac @@ -55,11 +55,11 @@ AC_ARG_ENABLE(debug, [AS_HELP_STRING(--enable-debug, [Enable debugging (false)])], [debug="$enableval"]) if test "$debug" = "yes"; then - CFLAGS="-O0 -g -DDEBUG" - CXXFLAGS="-O0 -g -DDEBUG" + CFLAGS="-O0 -g -DDEBUG -DLIBRDF_DEBUG" + CXXFLAGS="-O0 -g -DDEBUG -DLIBRDF_DEBUG" else - CFLAGS="$CFLAGS -DNDEBUG" - CXXFLAGS="$CFLAGS -DNDEBUG" + CFLAGS="$CFLAGS -DNDEBUG -DLIBRDF_DEBUG" + CXXFLAGS="$CFLAGS -DNDEBUG -DLIBRDF_DEBUG" fi # Check for strict flag diff --git a/slv2/Makefile.am b/slv2/Makefile.am index 8deb4db..9c0aa21 100644 --- a/slv2/Makefile.am +++ b/slv2/Makefile.am @@ -1,13 +1,13 @@ slv2includedir = $(includedir)/slv2 slv2include_HEADERS = \ - gui.h \ + ui.h \ lv2.h \ lv2_gui.h \ plugin.h \ pluginclass.h \ pluginclasses.h \ - pluginguiinstance.h \ + pluginuiinstance.h \ plugininstance.h \ plugins.h \ port.h \ diff --git a/slv2/gui.h b/slv2/gui.h deleted file mode 100644 index 10620c9..0000000 --- a/slv2/gui.h +++ /dev/null @@ -1,60 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_GUI_H__ -#define __SLV2_GUI_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include -#include - -/** \defgroup gui Plugin GUI helpers - * - * SLV2 provides access to plugin GUIs, but does not depend on any widget sets - * itself. Paths to libraries and opaque pointers to objects are returned, but - * the GUI extension itself (the URI of which can be had with slv2_gui_get_uri) - * defines the specifics of how to use these objects/files/etc. - * - * @{ - */ - -/** Return the URI of the GUI type (ontology) this GUI corresponds to. - * - * Returned string is shared and must not be freed by the caller. - * - * Time = O(1) - */ -const char* -slv2_gui_type_get_uri(SLV2GUIType type); - - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* __SLV2_GUI_H__ */ - diff --git a/slv2/plugin.h b/slv2/plugin.h index ed45a90..224a450 100644 --- a/slv2/plugin.h +++ b/slv2/plugin.h @@ -342,30 +342,30 @@ slv2_plugin_get_port_by_symbol(SLV2Plugin plugin, const char* symbol); -/** Get a list of all GUIs available for this plugin. +/** Get a list of all UIs available for this plugin. * - * Note this returns the URI of the GUI, and not the path/URI to its shared - * library, use slv2_plugin_gui_get_library_uri with the values returned + * Note this returns the URI of the UI, and not the path/URI to its shared + * library, use slv2_plugin_ui_get_library_uri with the values returned * here for that. * - * \param plugin The plugin to get the GUIs for. + * \param plugin The plugin to get the UIs for. * * Time = Query */ SLV2Values -slv2_plugin_get_guis(SLV2Plugin plugin); +slv2_plugin_get_uis(SLV2Plugin plugin); -/** Get the URI for a GUI library. +/** Get the URI for a UI library. * - * \param plugin The plugin that the GUI is for. - * \param gui A GUI identifier as returned by slv2_plugin_get_guis() (with type SLV2_VALUE_GUI). + * \param plugin The plugin that the UI is for. + * \param ui A UI identifier as returned by slv2_plugin_get_uis() (with type SLV2_VALUE_UI). * * Time = Query */ SLV2Value -slv2_plugin_get_gui_library_uri(SLV2Plugin plugin, - SLV2Value gui); +slv2_plugin_get_ui_library_uri(SLV2Plugin plugin, + SLV2Value ui); /** @} */ diff --git a/slv2/pluginguiinstance.h b/slv2/pluginguiinstance.h deleted file mode 100644 index 2eb9c60..0000000 --- a/slv2/pluginguiinstance.h +++ /dev/null @@ -1,129 +0,0 @@ -/* SLV2 - * Copyright (C) 2007 Dave Robillard - * Author: Lars Luthman - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) - * any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef __SLV2_PLUGINGUIINSTANCE_H__ -#define __SLV2_PLUGINGUIINSTANCE_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/** \defgroup lib Plugin GUI library access - * - * An SLV2GUIInstance is an instantiated GUI for a SLV2Plugin. GUI instances - * are loaded from dynamically loaded libraries. These functions interact - * with the GUI code in the binary library only, they do not read data files - * in any way. - * - * @{ - */ - - -typedef struct _SLV2GUIInstanceImpl* SLV2GUIInstanceImpl; - - -struct _GtkWidget; - - -/** Instance of a plugin GUI. - * - * All details are in hidden in the pimpl member to avoid making the - * implementation a part of the ABI. - */ -typedef struct _SLV2GUIInstance { - SLV2GUIInstanceImpl pimpl; ///< Private implementation -}* SLV2GUIInstance; - - - -/** Instantiate a plugin GUI. - * - * The returned object represents shared library objects loaded into memory, - * it must be cleaned up with slv2_gui_instance_free when no longer - * needed. - * - * \a plugin is not modified or directly referenced by the returned object - * (instances store only a copy of the plugin's URI). - * - * \a host_features NULL-terminated array of features the host supports. - * NULL may be passed if the host supports no additional features (unlike - * the LV2 specification - SLV2 takes care of it). - * - * \return NULL if instantiation failed. - */ -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); - - -/** Free a plugin GUI instance. - * - * \a instance is invalid after this call. - */ -void -slv2_gtk2_gui_instance_free(SLV2GUIInstance instance); - - -/** Get the widget for the GUI instance. - */ -LV2UI_Widget -slv2_gtk2_gui_instance_get_widget(SLV2GUIInstance instance); - - -/** Get the LV2UI_Descriptor of the plugin GUI instance. - * - * Normally hosts should not need to access the LV2UI_Descriptor directly, - * use the slv2_gui_instance_* functions. - * - * The returned descriptor is shared and must not be deleted. - */ -const LV2UI_Descriptor* -slv2_gtk2_gui_instance_get_descriptor(SLV2GUIInstance instance); - - -/** Get the LV2UI_Handle of the plugin GUI instance. - * - * Normally hosts should not need to access the LV2UI_Handle directly, - * use the slv2_gui_instance_* functions. - * - * The returned handle is shared and must not be deleted. - */ -LV2_Handle -slv2_gtk2_gui_instance_get_handle(SLV2GUIInstance instance); - - -/** @} */ - -#ifdef __cplusplus -} -#endif - - -#endif /* __SLV2_PLUGINGUIINSTANCE_H__ */ - diff --git a/slv2/pluginuiinstance.h b/slv2/pluginuiinstance.h new file mode 100644 index 0000000..48b915e --- /dev/null +++ b/slv2/pluginuiinstance.h @@ -0,0 +1,129 @@ +/* SLV2 + * Copyright (C) 2007 Dave Robillard + * Author: Lars Luthman + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __SLV2_PLUGINUIINSTANCE_H__ +#define __SLV2_PLUGINUIINSTANCE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/** \defgroup lib Plugin UI library access + * + * An SLV2UIInstance is an instantiated UI for a SLV2Plugin. UI instances + * are loaded from dynamically loaded libraries. These functions interact + * with the UI code in the binary library only, they do not read data files + * in any way. + * + * @{ + */ + + +typedef struct _SLV2UIInstanceImpl* SLV2UIInstanceImpl; + + +struct _GtkWidget; + + +/** Instance of a plugin UI. + * + * All details are in hidden in the pimpl member to avoid making the + * implementation a part of the ABI. + */ +typedef struct _SLV2UIInstance { + SLV2UIInstanceImpl pimpl; ///< Private implementation +}* SLV2UIInstance; + + + +/** Instantiate a plugin UI. + * + * The returned object represents shared library objects loaded into memory, + * it must be cleaned up with slv2_ui_instance_free when no longer + * needed. + * + * \a plugin is not modified or directly referenced by the returned object + * (instances store only a copy of the plugin's URI). + * + * \a host_features NULL-terminated array of features the host supports. + * NULL may be passed if the host supports no additional features (unlike + * the LV2 specification - SLV2 takes care of it). + * + * \return NULL if instantiation failed. + */ +SLV2UIInstance +slv2_plugin_ui_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); + + +/** Free a plugin UI instance. + * + * \a instance is invalid after this call. + */ +void +slv2_ui_instance_free(SLV2UIInstance instance); + + +/** Get the widget for the UI instance. + */ +LV2UI_Widget +slv2_ui_instance_get_widget(SLV2UIInstance instance); + + +/** Get the LV2UI_Descriptor of the plugin UI instance. + * + * Normally hosts should not need to access the LV2UI_Descriptor directly, + * use the slv2_ui_instance_* functions. + * + * The returned descriptor is shared and must not be deleted. + */ +const LV2UI_Descriptor* +slv2_ui_instance_get_descriptor(SLV2UIInstance instance); + + +/** Get the LV2UI_Handle of the plugin UI instance. + * + * Normally hosts should not need to access the LV2UI_Handle directly, + * use the slv2_ui_instance_* functions. + * + * The returned handle is shared and must not be deleted. + */ +LV2_Handle +slv2_ui_instance_get_handle(SLV2UIInstance instance); + + +/** @} */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __SLV2_PLUGINUIINSTANCE_H__ */ + diff --git a/slv2/slv2.h b/slv2/slv2.h index 14baa46..64c40c6 100644 --- a/slv2/slv2.h +++ b/slv2/slv2.h @@ -24,13 +24,13 @@ extern "C" { #endif #include -#include +#include #include #include #include #include #include -#include +#include #include #include #include diff --git a/slv2/types.h b/slv2/types.h index 5cb21f4..53a27c6 100644 --- a/slv2/types.h +++ b/slv2/types.h @@ -69,11 +69,11 @@ typedef enum _SLV2URIType { } SLV2URIType; -/** A type of plugin GUI (corresponding to some LV2 GUI extension). +/** A type of plugin UI (corresponding to some LV2 UI extension). */ -typedef enum _SLV2GUIType { - SLV2_GUI_TYPE_GTK2 ///< http://ll-plugins.nongnu.org/lv2/ext/gtk2gui -} SLV2GUIType; +typedef enum _SLV2UIType { + SLV2_UI_TYPE_GTK2 ///< http://ll-plugins.nongnu.org/lv2/ext/gui/dev/1#GtkGUI +} SLV2UIType; /** A port on a plugin. Opaque, but valid to compare to NULL. */ @@ -108,8 +108,8 @@ typedef struct _SLV2Value* SLV2Value; typedef void* SLV2Values; -/** A plugin GUI */ -typedef void* SLV2GUI; +/** A plugin UI */ +typedef void* SLV2UI; #ifdef __cplusplus diff --git a/slv2/ui.h b/slv2/ui.h new file mode 100644 index 0000000..ff6c394 --- /dev/null +++ b/slv2/ui.h @@ -0,0 +1,60 @@ +/* SLV2 + * Copyright (C) 2007 Dave Robillard + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef __SLV2_GUI_H__ +#define __SLV2_GUI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include +#include +#include + +/** \defgroup ui Plugin GUI helpers + * + * SLV2 provides access to plugin GUIs, but does not depend on any widget sets + * itself. Paths to libraries and opaque pointers to objects are returned, but + * the GUI extension itself (the URI of which can be had with slv2_ui_get_uri) + * defines the specifics of how to use these objects/files/etc. + * + * @{ + */ + +/** Return the URI of the GUI type (ontology) this GUI corresponds to. + * + * Returned string is shared and must not be freed by the caller. + * + * Time = O(1) + */ +const char* +slv2_ui_type_get_uri(SLV2UIType type); + + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __SLV2_GUI_H__ */ + diff --git a/slv2/value.h b/slv2/value.h index f2db361..47bb1ff 100644 --- a/slv2/value.h +++ b/slv2/value.h @@ -74,7 +74,7 @@ slv2_value_is_uri(SLV2Value value); /** Return this value as a URI string, e.g. "http://example.org/foo". * * Valid to call only if slv2_value_is_uri(\a value) or - * slv2_value_is_gui(\a value) returns true. + * slv2_value_is_ui(\a value) returns true. * Returned value is owned by \a value and must not be freed by caller. * * Time = O(1) @@ -175,24 +175,24 @@ slv2_value_as_int(SLV2Value value); /** Return whether this value is a GUI (URI and type). * * If this returns true, slv2_value_as_uri will return the URI of the GUI, - * and slv2_value_as_gui_type will return the SLV2GUIType (which can be + * and slv2_value_as_ui_type will return the SLV2UIType (which can be * used to find the URI of the corresponding GUI spec itself, with - * slv2_gui_type_get_uri). + * slv2_ui_type_get_uri). * * Time = O(1) */ bool -slv2_value_is_gui(SLV2Value value); +slv2_value_is_ui(SLV2Value value); -/** Return \a value as an SLV2GUIType. +/** Return \a value as an SLV2UIType. * - * Valid to call only if slv2_value_is_gui(\a value) returns true. + * Valid to call only if slv2_value_is_ui(\a value) returns true. * * Time = O(1) */ -SLV2GUIType -slv2_value_as_gui_type(SLV2Value value); +SLV2UIType +slv2_value_as_ui_type(SLV2Value value); /** @} */ 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 #include #include -#include +#include #include #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; } diff --git a/utils/lv2_inspect.c b/utils/lv2_inspect.c index bf02938..ee52b9b 100644 --- a/utils/lv2_inspect.c +++ b/utils/lv2_inspect.c @@ -126,16 +126,16 @@ print_plugin(SLV2Plugin p) printf("\tBundle: %s\n", slv2_plugin_get_bundle_uri(p)); printf("\tBinary: %s\n", slv2_plugin_get_library_uri(p)); - SLV2Values gui = slv2_plugin_get_guis(p); - if (slv2_values_size(gui) > 0) { + SLV2Values ui = slv2_plugin_get_uis(p); + if (slv2_values_size(ui) > 0) { printf("\tGUI:\n"); - for (unsigned i=0; i < slv2_values_size(gui); ++i) { - printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(gui, i))); + for (unsigned i=0; i < slv2_values_size(ui); ++i) { + printf("\t\t%s\n", slv2_value_as_uri(slv2_values_get_at(ui, i))); - SLV2Value binary = slv2_plugin_get_gui_library_uri(p, slv2_values_get_at(gui, i)); + SLV2Value binary = slv2_plugin_get_ui_library_uri(p, slv2_values_get_at(ui, i)); - printf("\t\t\tType: %s\n", slv2_gui_type_get_uri(slv2_value_as_gui_type( - slv2_values_get_at(gui, i)))); + printf("\t\t\tType: %s\n", slv2_ui_type_get_uri(slv2_value_as_ui_type( + slv2_values_get_at(ui, i)))); if (binary) printf("\t\t\tBinary: %s\n", slv2_value_as_uri(binary)); @@ -143,10 +143,10 @@ print_plugin(SLV2Plugin p) slv2_value_free(binary); } } - slv2_values_free(gui); + slv2_values_free(ui); - //SLV2Values gui = slv2_plugin_get_value_for_subject(p, - // ""); + //SLV2Values ui = slv2_plugin_get_value_for_subject(p, + // ""); printf("\tData URIs: "); SLV2Values data_uris = slv2_plugin_get_data_uris(p); -- cgit v1.2.1