summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-17 06:32:50 +0000
committerDavid Robillard <d@drobilla.net>2011-03-17 06:32:50 +0000
commit08a6a9058d114a3208f5304799e2c84576e52f90 (patch)
tree87d103383c852535c63105d89fa27d906779f313 /src/client
parent69191cb00b87c5fda9e65d592a3b73ce80da9b0e (diff)
downloadingen-08a6a9058d114a3208f5304799e2c84576e52f90.tar.gz
ingen-08a6a9058d114a3208f5304799e2c84576e52f90.tar.bz2
ingen-08a6a9058d114a3208f5304799e2c84576e52f90.zip
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
Diffstat (limited to 'src/client')
-rw-r--r--src/client/PluginModel.cpp53
-rw-r--r--src/client/PluginModel.hpp3
2 files changed, 56 insertions, 0 deletions
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;
}