summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-09 03:05:13 +0000
committerDavid Robillard <d@drobilla.net>2013-01-09 03:05:13 +0000
commit67067320cb53f3c84bb7901e446f3d1798667e57 (patch)
treeefaf94976fbef5f7ed9843bcd8056ee3289167ea /src/client
parent19b6f2d1c1e8ddcc52b45b4a2c17d4f0317ceabc (diff)
downloadingen-67067320cb53f3c84bb7901e446f3d1798667e57.tar.gz
ingen-67067320cb53f3c84bb7901e446f3d1798667e57.tar.bz2
ingen-67067320cb53f3c84bb7901e446f3d1798667e57.zip
Load internal plugin data files and rework documentation code to work the same as LV2 plugins (fix #671).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4910 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/PluginModel.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp
index 87d1aa92..63113e54 100644
--- a/src/client/PluginModel.cpp
+++ b/src/client/PluginModel.cpp
@@ -273,27 +273,38 @@ PluginModel::get_lv2_icon_path(const LilvPlugin* plugin)
return result;
}
+static std::string
+heading(const std::string& text, bool html)
+{
+ if (html) {
+ return std::string("<h2>") + text + "</h2>\n";
+ } else {
+ return text + ":\n\n";
+ }
+}
+
std::string
-PluginModel::documentation(bool* html) const
+PluginModel::documentation(bool html) const
{
std::string doc;
- if (!_lilv_plugin) {
- return doc;
- }
+
+ LilvNode* subject = (_lilv_plugin)
+ ? lilv_node_duplicate(lilv_plugin_get_uri(_lilv_plugin))
+ : lilv_new_uri(_lilv_world, uri().c_str());
LilvNode* lv2_documentation = lilv_new_uri(_lilv_world,
LILV_NS_LV2 "documentation");
LilvNode* rdfs_comment = lilv_new_uri(_lilv_world,
LILV_NS_RDFS "comment");
- LilvNodes* vals = lilv_plugin_get_value(_lilv_plugin, lv2_documentation);
- if (vals) {
- *html = true;
- doc += std::string("<h2>") + human_name() + "</h2>\n";
- } else {
- *html = false;
- vals = lilv_plugin_get_value(_lilv_plugin, rdfs_comment);
+ LilvNodes* vals = lilv_world_find_nodes(
+ _lilv_world, subject, lv2_documentation, NULL);
+ if (!vals) {
+ vals = lilv_world_find_nodes(
+ _lilv_world, subject, rdfs_comment, NULL);
+ // TODO: If not html, must convert to plain text
}
+ doc += heading(human_name(), html);
if (vals) {
const LilvNode* val = lilv_nodes_get_first(vals);
@@ -303,7 +314,7 @@ PluginModel::documentation(bool* html) const
}
lilv_node_free(rdfs_comment);
lilv_node_free(lv2_documentation);
-
+ lilv_node_free(subject);
lilv_nodes_free(vals);
return doc;
@@ -317,7 +328,7 @@ PluginModel::port_documentation(uint32_t index) const
if (!_lilv_plugin)
return doc;
- const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
+ const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index);
//LilvNode lv2_documentation = lilv_new_uri(
// _lilv_world, LILV_NAMESPACE_LV2 "documentation");