Set tooltips on generic UI controls for LV2 plugin controls with documentation (rdfs:comment property).
git-svn-id: svn://localhost/ardour2/branches/3.0@12042 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6e2dd99a04
commit
8439514ffa
@ -264,6 +264,11 @@ GenericPluginUI::build ()
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::string param_docs = plugin->get_parameter_docs(i);
|
||||
if (param_docs != "") {
|
||||
ARDOUR_UI::instance()->set_tip(cui, param_docs.c_str());
|
||||
}
|
||||
|
||||
if (cui->controller || cui->clickbox || cui->combo) {
|
||||
// Get all of the controls into a list, so that
|
||||
// we can lay them out a bit more nicely later.
|
||||
|
@ -50,14 +50,15 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||
const char* name () const;
|
||||
const char* maker () const;
|
||||
|
||||
uint32_t num_ports () const;
|
||||
uint32_t parameter_count () const;
|
||||
float default_value (uint32_t port);
|
||||
framecnt_t signal_latency () const;
|
||||
void set_parameter (uint32_t port, float val);
|
||||
float get_parameter (uint32_t port) const;
|
||||
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
|
||||
uint32_t nth_parameter (uint32_t port, bool& ok) const;
|
||||
uint32_t num_ports () const;
|
||||
uint32_t parameter_count () const;
|
||||
float default_value (uint32_t port);
|
||||
framecnt_t signal_latency () const;
|
||||
void set_parameter (uint32_t port, float val);
|
||||
float get_parameter (uint32_t port) const;
|
||||
std::string get_parameter_docs(uint32_t which) const;
|
||||
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
|
||||
uint32_t nth_parameter (uint32_t port, bool& ok) const;
|
||||
|
||||
const void* extension_data (const char* uri) const;
|
||||
|
||||
|
@ -118,6 +118,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent
|
||||
virtual uint32_t parameter_count () const = 0;
|
||||
virtual float default_value (uint32_t port) = 0;
|
||||
virtual float get_parameter(uint32_t which) const = 0;
|
||||
virtual std::string get_parameter_docs(uint32_t which) const { return ""; }
|
||||
|
||||
virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0;
|
||||
virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0;
|
||||
|
@ -108,6 +108,7 @@ public:
|
||||
LilvNode* lv2_sampleRate;
|
||||
LilvNode* lv2_toggled;
|
||||
LilvNode* midi_MidiEvent;
|
||||
LilvNode* rdfs_comment;
|
||||
LilvNode* ui_GtkUI;
|
||||
LilvNode* ui_external;
|
||||
};
|
||||
@ -583,6 +584,23 @@ LV2Plugin::get_parameter(uint32_t which) const
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
std::string
|
||||
LV2Plugin::get_parameter_docs(uint32_t which) const
|
||||
{
|
||||
LilvNodes* comments = lilv_port_get_value(
|
||||
_impl->plugin,
|
||||
lilv_plugin_get_port_by_index(_impl->plugin, which),
|
||||
_world.rdfs_comment);
|
||||
|
||||
if (comments) {
|
||||
const std::string docs(lilv_node_as_string(lilv_nodes_get_first(comments)));
|
||||
lilv_nodes_free(comments);
|
||||
return docs;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
uint32_t
|
||||
LV2Plugin::nth_parameter(uint32_t n, bool& ok) const
|
||||
{
|
||||
@ -1466,6 +1484,7 @@ LV2World::LV2World()
|
||||
lv2_toggled = lilv_new_uri(world, LILV_NS_LV2 "toggled");
|
||||
lv2_enumeration = lilv_new_uri(world, LILV_NS_LV2 "enumeration");
|
||||
midi_MidiEvent = lilv_new_uri(world, LILV_URI_MIDI_EVENT);
|
||||
rdfs_comment = lilv_new_uri(world, LILV_NS_RDFS "comment");
|
||||
ui_GtkUI = lilv_new_uri(world, NS_UI "GtkUI");
|
||||
ui_external = lilv_new_uri(world, NS_UI "external");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user