From c85f3ab4c7d4c1e793519a400f10fc8499459d80 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 24 May 2011 20:52:22 +0000 Subject: Remove use of ingen-config.h in soon-to-be-public headers. Make Lilv dependency mandatory. Reduce dependency on ingen-config.h. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3316 a436a847-0d15-0410-975c-d299462d15a1 --- src/client/PluginModel.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/client/PluginModel.cpp') diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 3f0bf735..59f68caa 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -27,18 +27,14 @@ #include "PluginUI.hpp" #include "shared/LV2URIMap.hpp" -#include "ingen-config.h" - using namespace std; using namespace Raul; namespace Ingen { namespace Client { -#ifdef HAVE_LILV LilvWorld* PluginModel::_lilv_world = NULL; const LilvPlugins* PluginModel::_lilv_plugins = NULL; -#endif Sord::World* PluginModel::_rdf_world = NULL; @@ -51,11 +47,10 @@ PluginModel::PluginModel(Shared::LV2URIMap& uris, assert(_rdf_world); add_property("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", this->type_uri()); -#ifdef HAVE_LILV LilvNode* plugin_uri = lilv_new_uri(_lilv_world, uri.c_str()); _lilv_plugin = lilv_plugins_get_by_uri(_lilv_plugins, plugin_uri); lilv_node_free(plugin_uri); -#endif + if (_type == Internal) set_property("http://usefulinc.com/ns/doap#name", Atom(uri.substr(uri.find_last_of('#') + 1).c_str())); @@ -97,7 +92,6 @@ PluginModel::get_property(const URI& key) const return get_property(key); } -#ifdef HAVE_LILV if (_lilv_plugin) { boost::optional ret; LilvNode* lv2_pred = lilv_new_uri(_lilv_world, key.str().c_str()); @@ -124,7 +118,6 @@ PluginModel::get_property(const URI& key) const if (ret) return *ret; } -#endif return nil; } @@ -134,11 +127,9 @@ PluginModel::set(SharedPtr p) { _type = p->_type; -#ifdef HAVE_LILV _icon_path = p->_icon_path; if (p->_lilv_plugin) _lilv_plugin = p->_lilv_plugin; -#endif for (Properties::const_iterator v = p->properties().begin(); v != p->properties().end(); ++v) { ResourceImpl::set_property(v->first, v->second); @@ -171,7 +162,6 @@ PluginModel::human_name() const string PluginModel::port_human_name(uint32_t index) const { -#ifdef HAVE_LILV if (_lilv_plugin) { const LilvPort* port = lilv_plugin_get_port_by_index(_lilv_plugin, index); LilvNode* name = lilv_port_get_name(_lilv_plugin, port); @@ -179,11 +169,9 @@ PluginModel::port_human_name(uint32_t index) const lilv_node_free(name); return ret; } -#endif return ""; } -#ifdef HAVE_LILV bool PluginModel::has_ui() const { @@ -191,6 +179,7 @@ PluginModel::has_ui() const const bool ret = (lilv_nodes_size(uis) > 0); lilv_uis_free(uis); return ret; + } SharedPtr @@ -200,8 +189,7 @@ PluginModel::ui(Ingen::Shared::World* world, if (_type != LV2) return SharedPtr(); - SharedPtr ret = PluginUI::create(world, node, _lilv_plugin); - return ret; + return PluginUI::create(world, node, _lilv_plugin); } const string& @@ -234,13 +222,11 @@ PluginModel::get_lv2_icon_path(const LilvPlugin* plugin) lilv_node_free(svg_icon_pred); return result; } -#endif std::string PluginModel::documentation() const { std::string doc; - #ifdef HAVE_LILV if (!_lilv_plugin) return doc; @@ -257,7 +243,7 @@ PluginModel::documentation() const } lilv_node_free(rdfs_comment); lilv_nodes_free(vals); - #endif + return doc; } @@ -265,7 +251,7 @@ std::string PluginModel::port_documentation(uint32_t index) const { std::string doc; - #ifdef HAVE_LILV + if (!_lilv_plugin) return doc; @@ -285,9 +271,22 @@ PluginModel::port_documentation(uint32_t index) const } lilv_node_free(rdfs_comment); lilv_nodes_free(vals); - #endif return doc; } +const LilvPort* +PluginModel::lilv_port(uint32_t index) const +{ + return lilv_plugin_get_port_by_index(_lilv_plugin, index); +} + +void +PluginModel::set_lilv_world(LilvWorld* world) +{ + _lilv_world = world; + _lilv_plugins = lilv_world_get_all_plugins(_lilv_world); +} + + } // namespace Client } // namespace Ingen -- cgit v1.2.1