diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/World.cpp | 15 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 37 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 1 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 8 |
4 files changed, 45 insertions, 16 deletions
diff --git a/src/World.cpp b/src/World.cpp index cccb5044..8b6a58ea 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -42,7 +42,6 @@ class Store; namespace Serialisation { class Parser; class Serialiser; } - /** Load a dynamic module from the default path. * * This will check in the directories specified in the environment variable @@ -135,6 +134,20 @@ public: rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); rdf_world->add_prefix("xsd", "http://www.w3.org/2001/XMLSchema#"); + + // Load internal 'plugin' information into lilv world + LilvNode* rdf_type = lilv_new_uri( + lilv_world, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); + LilvNode* ingen_Plugin = lilv_new_uri( + lilv_world, "http://drobilla.net/ns/ingen#Plugin"); + LilvNodes* internals = lilv_world_find_nodes( + lilv_world, NULL, rdf_type, ingen_Plugin); + LILV_FOREACH(nodes, i, internals) { + const LilvNode* internal = lilv_nodes_get(internals, i); + lilv_world_load_resource(lilv_world, internal); + } + lilv_node_free(rdf_type); + lilv_node_free(ingen_Plugin); } ~Impl() 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"); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 17631794..ef3b3c8c 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -325,6 +325,7 @@ GraphBox::set_documentation(const std::string& doc, bool html) #else Gtk::TextView* view = Gtk::manage(new Gtk::TextView()); view->get_buffer()->set_text(doc); + view->set_wrap_mode(Gtk::WRAP_WORD); _doc_scrolledwindow->add(*view); view->show(); #endif diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 5542bef6..1409368e 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -41,6 +41,7 @@ #include "SubgraphModule.hpp" #include "WidgetFactory.hpp" #include "WindowFactory.hpp" +#include "ingen_config.h" using namespace std; @@ -441,9 +442,12 @@ NodeModule::on_selected(gboolean selected) if (selected && win->documentation_is_visible()) { GraphWindow* win = app().window_factory()->parent_graph_window(block()); std::string doc; - bool html = false; + bool html = false; +#ifdef HAVE_WEBKIT + html = true; +#endif if (block()->plugin_model()) { - doc = block()->plugin_model()->documentation(&html); + doc = block()->plugin_model()->documentation(html); } win->set_documentation(doc, html); } |