summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/generic_pluginui.cc5
-rw-r--r--gtk2_ardour/plugin_ui.cc30
-rw-r--r--gtk2_ardour/plugin_ui.h3
-rw-r--r--libs/ardour/ardour/lv2_plugin.h1
-rw-r--r--libs/ardour/ardour/plugin.h1
-rw-r--r--libs/ardour/lv2_plugin.cc13
6 files changed, 50 insertions, 3 deletions
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc
index 6306c051e5..17825c1373 100644
--- a/gtk2_ardour/generic_pluginui.cc
+++ b/gtk2_ardour/generic_pluginui.cc
@@ -101,6 +101,9 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
VBox* v1_box = manage (new VBox);
VBox* v2_box = manage (new VBox);
pack_end (plugin_analysis_expander, false, false);
+ if (!plugin->get_docs().empty()) {
+ pack_end (description_expander, false, false);
+ }
v1_box->pack_start (*smaller_hbox, false, true);
v2_box->pack_start (focus_button, false, true);
@@ -265,7 +268,7 @@ GenericPluginUI::build ()
}
const std::string param_docs = plugin->get_parameter_docs(i);
- if (param_docs != "") {
+ if (!param_docs.empty()) {
ARDOUR_UI::instance()->set_tip(cui, param_docs.c_str());
}
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index b4a412aa3f..9357fc7136 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -452,6 +452,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
, save_button (_("Save"))
, delete_button (_("Delete"))
, bypass_button (ArdourButton::led_default_elements)
+ , description_expander (_("Description"))
, plugin_analysis_expander (_("Plugin analysis"))
, latency_gui (0)
, latency_dialog (0)
@@ -499,6 +500,9 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
ARDOUR_UI::instance()->set_tip (focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME));
ARDOUR_UI::instance()->set_tip (bypass_button, _("Click to enable/disable this plugin"));
+ description_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_description));
+ description_expander.set_expanded(false);
+
plugin_analysis_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_plugin_analysis));
plugin_analysis_expander.set_expanded(false);
@@ -663,10 +667,33 @@ PlugUIBase::focus_toggled (GdkEventButton*)
}
void
+PlugUIBase::toggle_description()
+{
+ if (description_expander.get_expanded() &&
+ !description_expander.get_child()) {
+ const std::string text = plugin->get_docs();
+ if (text.empty()) {
+ return;
+ }
+
+ Gtk::Label* label = manage(new Gtk::Label(text));
+ label->set_line_wrap(true);
+ label->set_line_wrap_mode(Pango::WRAP_WORD);
+ description_expander.add(*label);
+ description_expander.show_all();
+ }
+
+ if (!description_expander.get_expanded()) {
+ description_expander.remove();
+ }
+}
+
+
+void
PlugUIBase::toggle_plugin_analysis()
{
if (plugin_analysis_expander.get_expanded() &&
- !plugin_analysis_expander.get_child()) {
+ !plugin_analysis_expander.get_child()) {
// Create the GUI
if (eqgui == 0) {
eqgui = new PluginEqGui (insert);
@@ -684,7 +711,6 @@ PlugUIBase::toggle_plugin_analysis()
}
if (!plugin_analysis_expander.get_expanded()) {
-
// Hide & remove from expander
eqgui->hide ();
diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h
index 2f98a28f6d..a65fd1a223 100644
--- a/gtk2_ardour/plugin_ui.h
+++ b/gtk2_ardour/plugin_ui.h
@@ -125,6 +125,8 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
ArdourButton bypass_button;
/** a button to acquire keyboard focus */
Gtk::EventBox focus_button;
+ /** an expander containing the plugin description */
+ Gtk::Expander description_expander;
/** an expander containing the plugin analysis graph */
Gtk::Expander plugin_analysis_expander;
/** a label indicating the plugin latency */
@@ -150,6 +152,7 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
void delete_plugin_setting ();
bool focus_toggled(GdkEventButton*);
bool bypass_button_release(GdkEventButton*);
+ void toggle_description ();
void toggle_plugin_analysis ();
void processor_active_changed (boost::weak_ptr<ARDOUR::Processor> p);
void plugin_going_away ();
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index b72b7d605b..a4de7c4ae1 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -56,6 +56,7 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
framecnt_t signal_latency () const;
void set_parameter (uint32_t port, float val);
float get_parameter (uint32_t port) const;
+ std::string get_docs() 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;
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index bade84341b..069a579ff7 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -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_docs() const { return ""; }
virtual std::string get_parameter_docs(uint32_t which) const { return ""; }
virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0;
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index bd628e46bd..c6509f0203 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -585,6 +585,19 @@ LV2Plugin::get_parameter(uint32_t which) const
}
std::string
+LV2Plugin::get_docs() const
+{
+ LilvNodes* comments = lilv_plugin_get_value(_impl->plugin, _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 "";
+}
+
+std::string
LV2Plugin::get_parameter_docs(uint32_t which) const
{
LilvNodes* comments = lilv_port_get_value(