diff --git a/gtk2_ardour/dark.colors b/gtk2_ardour/dark.colors
index a7da390fe5..512f530b10 100644
--- a/gtk2_ardour/dark.colors
+++ b/gtk2_ardour/dark.colors
@@ -337,9 +337,7 @@
-
-
-
+
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc
index 85d183ab88..056aea9753 100644
--- a/gtk2_ardour/generic_pluginui.cc
+++ b/gtk2_ardour/generic_pluginui.cc
@@ -83,8 +83,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr pi, bool scrol
Label* combo_label = manage (new Label (_("Presets")));
combo_label->set_use_markup (true);
- latency_button.add (latency_label);
- latency_button.signal_clicked().connect (sigc::mem_fun (*this, &PlugUIBase::latency_button_clicked));
+ latency_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::latency_button_clicked));
set_latency_label ();
smaller_hbox->pack_start (latency_button, false, false, 10);
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index b4e8e0001e..76efb71f1f 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -426,7 +426,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi)
, eqgui (0)
{
_preset_modified.set_size_request (16, -1);
- _preset_combo.signal_changed().connect(sigc::mem_fun(*this, &PlugUIBase::preset_selected));
+ _preset_combo.set_text("(default)");
ARDOUR_UI::instance()->set_tip (_preset_combo, _("Presets (if any) for this plugin\n(Both factory and user-created)"));
ARDOUR_UI::instance()->set_tip (add_button, _("Save a new preset"));
ARDOUR_UI::instance()->set_tip (save_button, _("Save the current preset"));
@@ -437,14 +437,14 @@ PlugUIBase::PlugUIBase (boost::shared_ptr pi)
update_preset_list ();
update_preset ();
- add_button.set_name ("PluginAddButton");
- add_button.signal_clicked().connect (sigc::mem_fun (*this, &PlugUIBase::add_plugin_setting));
+ add_button.set_name ("generic button");
+ add_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::add_plugin_setting));
- save_button.set_name ("PluginSaveButton");
- save_button.signal_clicked().connect(sigc::mem_fun(*this, &PlugUIBase::save_plugin_setting));
+ save_button.set_name ("generic button");
+ save_button.signal_clicked.connect(sigc::mem_fun(*this, &PlugUIBase::save_plugin_setting));
- delete_button.set_name ("PluginDeleteButton");
- delete_button.signal_clicked().connect (sigc::mem_fun (*this, &PlugUIBase::delete_plugin_setting));
+ delete_button.set_name ("generic button");
+ delete_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::delete_plugin_setting));
insert->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr(insert)), gui_context());
@@ -509,7 +509,7 @@ PlugUIBase::set_latency_label ()
t = string_compose (_("latency (%1 ms)"), (float) l / ((float) sr / 1000.0f));
}
- latency_label.set_text (t);
+ latency_button.set_text (t);
}
void
@@ -545,20 +545,13 @@ PlugUIBase::processor_active_changed (boost::weak_ptr weak_p)
}
void
-PlugUIBase::preset_selected ()
+PlugUIBase::preset_selected (Plugin::PresetRecord preset)
{
if (_no_load_preset) {
return;
}
-
- if (_preset_combo.get_active_text().length() > 0) {
- const Plugin::PresetRecord* pr = plugin->preset_by_label (_preset_combo.get_active_text());
- if (pr) {
- plugin->load_preset (*pr);
- } else {
- warning << string_compose(_("Plugin preset %1 not found"),
- _preset_combo.get_active_text()) << endmsg;
- }
+ if (!preset.label.empty()) {
+ plugin->load_preset (preset);
} else {
// blank selected = no preset
plugin->clear_preset();
@@ -605,7 +598,7 @@ void
PlugUIBase::save_plugin_setting ()
{
#ifndef NO_PLUGIN_STATE
- string const name = _preset_combo.get_active_text ();
+ string const name = _preset_combo.get_text ();
plugin->remove_preset (name);
Plugin::PresetRecord const r = plugin->save_preset (name);
if (!r.uri.empty ()) {
@@ -625,7 +618,7 @@ void
PlugUIBase::delete_plugin_setting ()
{
#ifndef NO_PLUGIN_STATE
- plugin->remove_preset (_preset_combo.get_active_text ());
+ plugin->remove_preset (_preset_combo.get_text ());
#else
if (!seen_saving_message) {
info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
@@ -736,18 +729,23 @@ PlugUIBase::toggle_plugin_analysis()
void
PlugUIBase::update_preset_list ()
{
- vector preset_labels;
+ using namespace Menu_Helpers;
+
vector presets = plugin->get_presets();
++_no_load_preset;
+ // Add a menu entry for each preset
+ _preset_combo.clear_items();
for (vector::const_iterator i = presets.begin(); i != presets.end(); ++i) {
- preset_labels.push_back (i->label);
+ _preset_combo.AddMenuElem(
+ MenuElem(i->label, sigc::bind(sigc::mem_fun(*this, &PlugUIBase::preset_selected), *i)));
}
- preset_labels.push_back("");
-
- set_popdown_strings (_preset_combo, preset_labels);
+ // Add an empty entry for un-setting current preset (see preset_selected)
+ Plugin::PresetRecord no_preset;
+ _preset_combo.AddMenuElem(
+ MenuElem("", sigc::bind(sigc::mem_fun(*this, &PlugUIBase::preset_selected), no_preset)));
--_no_load_preset;
}
@@ -758,7 +756,11 @@ PlugUIBase::update_preset ()
Plugin::PresetRecord p = plugin->last_preset();
++_no_load_preset;
- _preset_combo.set_active_text (p.label);
+ if (p.uri.empty()) {
+ _preset_combo.set_text ("(none)");
+ } else {
+ _preset_combo.set_text (p.label);
+ }
--_no_load_preset;
save_button.set_sensitive (!p.uri.empty() && p.user);
diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h
index 58dc6ce2a3..6ae548d8fb 100644
--- a/gtk2_ardour/plugin_ui.h
+++ b/gtk2_ardour/plugin_ui.h
@@ -49,9 +49,10 @@
#include "ardour/plugin.h"
#include "ardour/variant.h"
-#include "automation_controller.h"
#include "ardour_button.h"
+#include "ardour_dropdown.h"
#include "ardour_window.h"
+#include "automation_controller.h"
namespace ARDOUR {
class PluginInsert;
@@ -115,15 +116,15 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
/* UI elements that can subclasses can add to their widgets */
/** a ComboBoxText which lists presets and manages their selection */
- Gtk::ComboBoxText _preset_combo;
+ ArdourDropdown _preset_combo;
/** a label which has a * in if the current settings are different from the preset being shown */
Gtk::Label _preset_modified;
/** a button to add a preset */
- Gtk::Button add_button;
+ ArdourButton add_button;
/** a button to save the current settings as a new user preset */
- Gtk::Button save_button;
+ ArdourButton save_button;
/** a button to delete the current preset (if it is a user one) */
- Gtk::Button delete_button;
+ ArdourButton delete_button;
/** a button to bypass the plugin */
ArdourButton bypass_button;
/** a button to acquire keyboard focus */
@@ -132,10 +133,8 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
Gtk::Expander description_expander;
/** an expander containing the plugin analysis graph */
Gtk::Expander plugin_analysis_expander;
- /** a label indicating the plugin latency */
- Gtk::Label latency_label;
/** a button which, when clicked, opens the latency GUI */
- Gtk::Button latency_button;
+ ArdourButton latency_button;
/** a button which sets all controls' automation setting to Manual */
ArdourButton automation_manual_all_button;
/** a button which sets all controls' automation setting to Play */
@@ -157,7 +156,7 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
Gtk::Image* focus_in_image;
int _no_load_preset;
- virtual void preset_selected ();
+ virtual void preset_selected (ARDOUR::Plugin::PresetRecord preset);
void add_plugin_setting ();
void save_plugin_setting ();
void delete_plugin_setting ();
diff --git a/gtk2_ardour/vst_plugin_ui.cc b/gtk2_ardour/vst_plugin_ui.cc
index a35df5df07..3b1f999a7c 100644
--- a/gtk2_ardour/vst_plugin_ui.cc
+++ b/gtk2_ardour/vst_plugin_ui.cc
@@ -60,12 +60,12 @@ VSTPluginUI::~VSTPluginUI ()
}
void
-VSTPluginUI::preset_selected ()
+VSTPluginUI::preset_selected (Plugin::PresetRecord preset)
{
#ifdef GDK_WINDOWING_X11
_socket.grab_focus ();
#endif
- PlugUIBase::preset_selected ();
+ PlugUIBase::preset_selected (preset);
}
int
diff --git a/gtk2_ardour/vst_plugin_ui.h b/gtk2_ardour/vst_plugin_ui.h
index 7339186975..8996fe0a21 100644
--- a/gtk2_ardour/vst_plugin_ui.h
+++ b/gtk2_ardour/vst_plugin_ui.h
@@ -52,7 +52,7 @@ protected:
private:
bool configure_handler (GdkEventConfigure *);
- void preset_selected ();
+ void preset_selected (ARDOUR::Plugin::PresetRecord preset);
};
#endif