From 08a6a9058d114a3208f5304799e2c84576e52f90 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 17 Mar 2011 06:32:50 +0000 Subject: Show plugin/port documentation in side pane when selected. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3103 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginModel.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++ src/client/PluginModel.hpp | 3 +++ 2 files changed, 56 insertions(+) (limited to 'src/client') diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 8e826368..aa8e2e1d 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -243,6 +243,59 @@ PluginModel::get_lv2_icon_path(SLV2Plugin plugin) } #endif +std::string +PluginModel::documentation() const +{ + std::string doc; + #ifdef HAVE_SLV2 + if (!_slv2_plugin) + return doc; + + //SLV2Value lv2_documentation = slv2_value_new_uri( + // _slv2_world, SLV2_NAMESPACE_LV2 "documentation"); + SLV2Value rdfs_comment = slv2_value_new_uri( + _slv2_world, "http://www.w3.org/2000/01/rdf-schema#comment"); + + SLV2Values vals = slv2_plugin_get_value(_slv2_plugin, + rdfs_comment); + SLV2Value val = slv2_values_get_first(vals); + if (slv2_value_is_string(val)) { + doc += slv2_value_as_string(val); + } + slv2_value_free(rdfs_comment); + slv2_values_free(vals); + #endif + return doc; +} + +std::string +PluginModel::port_documentation(uint32_t index) const +{ + std::string doc; + #ifdef HAVE_SLV2 + if (!_slv2_plugin) + return doc; + + SLV2Port port = slv2_plugin_get_port_by_index(_slv2_plugin, index); + + //SLV2Value lv2_documentation = slv2_value_new_uri( + // _slv2_world, SLV2_NAMESPACE_LV2 "documentation"); + SLV2Value rdfs_comment = slv2_value_new_uri( + _slv2_world, "http://www.w3.org/2000/01/rdf-schema#comment"); + + SLV2Values vals = slv2_port_get_value(_slv2_plugin, + port, + rdfs_comment); + SLV2Value val = slv2_values_get_first(vals); + if (slv2_value_is_string(val)) { + doc += slv2_value_as_string(val); + } + slv2_value_free(rdfs_comment); + slv2_values_free(vals); + #endif + return doc; +} + } // namespace Client } // namespace Ingen diff --git a/src/client/PluginModel.hpp b/src/client/PluginModel.hpp index 3f647a7c..006c53d9 100644 --- a/src/client/PluginModel.hpp +++ b/src/client/PluginModel.hpp @@ -86,6 +86,9 @@ public: static std::string get_lv2_icon_path(SLV2Plugin plugin); #endif + std::string documentation() const; + std::string port_documentation(uint32_t index) const; + static void set_rdf_world(Sord::World& world) { _rdf_world = &world; } -- cgit v1.2.1