From 9e7f097af6c027b5ebe2b604022dab570b8361fb Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 26 Jun 2015 15:30:37 +0200 Subject: [PATCH] Continue lilv patching... --- source/modules/lilv/lilv-0.21.3/lilv/lilv.h | 36 ++++++ source/modules/lilv/lilv-0.21.3/src/plugin.c | 126 +++++++++++++++++++ 2 files changed, 162 insertions(+) diff --git a/source/modules/lilv/lilv-0.21.3/lilv/lilv.h b/source/modules/lilv/lilv-0.21.3/lilv/lilv.h index 34f4d7b1e..4b8d98309 100644 --- a/source/modules/lilv/lilv-0.21.3/lilv/lilv.h +++ b/source/modules/lilv/lilv-0.21.3/lilv/lilv.h @@ -1802,6 +1802,42 @@ lilv_ui_get_optional_features(const LilvUI* ui); LILV_API const LilvNodes* lilv_ui_get_extension_data(const LilvUI* ui); +/** + Custom calls +*/ +LILV_API LilvNode* +lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin); + +LILV_API LilvNode* +lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin); + +LILV_API const LilvNodes* +lilv_ui_get_supported_features(const LilvUI* ui); + +LILV_API const LilvNodes* +lilv_ui_get_required_features(const LilvUI* ui); + +LILV_API const LilvNodes* +lilv_ui_get_optional_features(const LilvUI* ui); + +LILV_API const LilvNodes* +lilv_ui_get_extension_data(const LilvUI* ui); + /** @} @} diff --git a/source/modules/lilv/lilv-0.21.3/src/plugin.c b/source/modules/lilv/lilv-0.21.3/src/plugin.c index 5e5a2c8fd..c7119907f 100644 --- a/source/modules/lilv/lilv-0.21.3/src/plugin.c +++ b/source/modules/lilv/lilv-0.21.3/src/plugin.c @@ -31,6 +31,7 @@ #define NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#" #define NS_FOAF (const uint8_t*)"http://xmlns.com/foaf/0.1/" +#define NS_MOD (const uint8_t*)"http://portalmod.com/ns/modgui#" /** Ownership of `uri` is taken */ LilvPlugin* @@ -908,6 +909,131 @@ lilv_plugin_get_author_homepage(const LilvPlugin* plugin) return NULL; } +static const SordNode* +lilv_plugin_get_modgui(const LilvPlugin* p) +{ + lilv_plugin_load_if_necessary(p); + + SordNode* mod_gui = sord_new_uri( + p->world->world, NS_MOD "gui"); + + SordIter* gui = lilv_world_query_internal( + p->world, + p->plugin_uri->node, + mod_gui, + NULL); + + sord_node_free(p->world->world, mod_gui); + + if (sord_iter_end(gui)) { + sord_iter_free(gui); + return NULL; + } + + const SordNode* Gui = sord_iter_get_node(gui, SORD_OBJECT); + + sord_iter_free(gui); + return Gui; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_resources_directory(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_res = sord_new_uri(sworld, NS_MOD "resourcesDirectory"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_res); + sord_node_free(sworld, modgui_res); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_stylesheet(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_style = sord_new_uri(sworld, NS_MOD "stylesheet"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_style); + sord_node_free(sworld, modgui_style); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_icon_template(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "iconTemplate"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); + sord_node_free(sworld, modgui_tmpl); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_settings_template(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "settingsTemplate"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); + sord_node_free(sworld, modgui_tmpl); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_template_data(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_tmpl = sord_new_uri(sworld, NS_MOD "templateData"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_tmpl); + sord_node_free(sworld, modgui_tmpl); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_screenshot(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_scr = sord_new_uri(sworld, NS_MOD "screenshot"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_scr); + sord_node_free(sworld, modgui_scr); + return ret; + } + return NULL; +} + +LILV_API LilvNode* +lilv_plugin_get_modgui_thumbnail(const LilvPlugin* plugin) +{ + const SordNode* modgui = lilv_plugin_get_modgui(plugin); + if (modgui) { + SordWorld* sworld = plugin->world->world; + SordNode* modgui_thumb = sord_new_uri(sworld, NS_MOD "thumbnail"); + LilvNode* ret = lilv_plugin_get_one(plugin, modgui, modgui_thumb); + sord_node_free(sworld, modgui_thumb); + return ret; + } + return NULL; +} + LILV_API bool lilv_plugin_is_replaced(const LilvPlugin* plugin) {