Use Ardour widgets consistently in plugin UI.
Several reasons: * This previously looked horribly inconsistent. * The Gtk selector was broken for plugins with many presets, making it impossible to select presets. For whatever reason, the use of a menu fixes this bug. * Towards a hierarchical menu for banked presets.
This commit is contained in:
parent
7eb849ad21
commit
0cb096a978
@ -337,9 +337,7 @@
|
|||||||
<ColorAlias name="piano roll black outline" alias="color 33"/>
|
<ColorAlias name="piano roll black outline" alias="color 33"/>
|
||||||
<ColorAlias name="piano roll white" alias="color 45"/>
|
<ColorAlias name="piano roll white" alias="color 45"/>
|
||||||
<ColorAlias name="play head" alias="color 9"/>
|
<ColorAlias name="play head" alias="color 9"/>
|
||||||
<ColorAlias name="plugin bypass button: fill" alias="color 71"/>
|
<ColorAlias name="plugin bypass button: led active" alias="color 8"/>
|
||||||
<ColorAlias name="plugin bypass button: fill active" alias="color 42"/>
|
|
||||||
<ColorAlias name="plugin bypass button: led active" alias="color 9"/>
|
|
||||||
<ColorAlias name="processor automation line" alias="color 77"/>
|
<ColorAlias name="processor automation line" alias="color 77"/>
|
||||||
<ColorAlias name="processor control button: fill" alias="color 29"/>
|
<ColorAlias name="processor control button: fill" alias="color 29"/>
|
||||||
<ColorAlias name="processor control button: fill active" alias="color 46"/>
|
<ColorAlias name="processor control button: fill active" alias="color 46"/>
|
||||||
|
@ -83,8 +83,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
|
|||||||
Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
|
Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>")));
|
||||||
combo_label->set_use_markup (true);
|
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 ();
|
set_latency_label ();
|
||||||
|
|
||||||
smaller_hbox->pack_start (latency_button, false, false, 10);
|
smaller_hbox->pack_start (latency_button, false, false, 10);
|
||||||
|
@ -426,7 +426,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
|
|||||||
, eqgui (0)
|
, eqgui (0)
|
||||||
{
|
{
|
||||||
_preset_modified.set_size_request (16, -1);
|
_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 (_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 (add_button, _("Save a new preset"));
|
||||||
ARDOUR_UI::instance()->set_tip (save_button, _("Save the current preset"));
|
ARDOUR_UI::instance()->set_tip (save_button, _("Save the current preset"));
|
||||||
@ -437,14 +437,14 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
|
|||||||
update_preset_list ();
|
update_preset_list ();
|
||||||
update_preset ();
|
update_preset ();
|
||||||
|
|
||||||
add_button.set_name ("PluginAddButton");
|
add_button.set_name ("generic button");
|
||||||
add_button.signal_clicked().connect (sigc::mem_fun (*this, &PlugUIBase::add_plugin_setting));
|
add_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::add_plugin_setting));
|
||||||
|
|
||||||
save_button.set_name ("PluginSaveButton");
|
save_button.set_name ("generic button");
|
||||||
save_button.signal_clicked().connect(sigc::mem_fun(*this, &PlugUIBase::save_plugin_setting));
|
save_button.signal_clicked.connect(sigc::mem_fun(*this, &PlugUIBase::save_plugin_setting));
|
||||||
|
|
||||||
delete_button.set_name ("PluginDeleteButton");
|
delete_button.set_name ("generic button");
|
||||||
delete_button.signal_clicked().connect (sigc::mem_fun (*this, &PlugUIBase::delete_plugin_setting));
|
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<Processor>(insert)), gui_context());
|
insert->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&PlugUIBase::processor_active_changed, this, boost::weak_ptr<Processor>(insert)), gui_context());
|
||||||
|
|
||||||
@ -509,7 +509,7 @@ PlugUIBase::set_latency_label ()
|
|||||||
t = string_compose (_("latency (%1 ms)"), (float) l / ((float) sr / 1000.0f));
|
t = string_compose (_("latency (%1 ms)"), (float) l / ((float) sr / 1000.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
latency_label.set_text (t);
|
latency_button.set_text (t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -545,20 +545,13 @@ PlugUIBase::processor_active_changed (boost::weak_ptr<Processor> weak_p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PlugUIBase::preset_selected ()
|
PlugUIBase::preset_selected (Plugin::PresetRecord preset)
|
||||||
{
|
{
|
||||||
if (_no_load_preset) {
|
if (_no_load_preset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!preset.label.empty()) {
|
||||||
if (_preset_combo.get_active_text().length() > 0) {
|
plugin->load_preset (preset);
|
||||||
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;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// blank selected = no preset
|
// blank selected = no preset
|
||||||
plugin->clear_preset();
|
plugin->clear_preset();
|
||||||
@ -605,7 +598,7 @@ void
|
|||||||
PlugUIBase::save_plugin_setting ()
|
PlugUIBase::save_plugin_setting ()
|
||||||
{
|
{
|
||||||
#ifndef NO_PLUGIN_STATE
|
#ifndef NO_PLUGIN_STATE
|
||||||
string const name = _preset_combo.get_active_text ();
|
string const name = _preset_combo.get_text ();
|
||||||
plugin->remove_preset (name);
|
plugin->remove_preset (name);
|
||||||
Plugin::PresetRecord const r = plugin->save_preset (name);
|
Plugin::PresetRecord const r = plugin->save_preset (name);
|
||||||
if (!r.uri.empty ()) {
|
if (!r.uri.empty ()) {
|
||||||
@ -625,7 +618,7 @@ void
|
|||||||
PlugUIBase::delete_plugin_setting ()
|
PlugUIBase::delete_plugin_setting ()
|
||||||
{
|
{
|
||||||
#ifndef NO_PLUGIN_STATE
|
#ifndef NO_PLUGIN_STATE
|
||||||
plugin->remove_preset (_preset_combo.get_active_text ());
|
plugin->remove_preset (_preset_combo.get_text ());
|
||||||
#else
|
#else
|
||||||
if (!seen_saving_message) {
|
if (!seen_saving_message) {
|
||||||
info << string_compose (_("Plugin presets are not supported in this build of %1. Consider paying for a newer version"),
|
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
|
void
|
||||||
PlugUIBase::update_preset_list ()
|
PlugUIBase::update_preset_list ()
|
||||||
{
|
{
|
||||||
vector<string> preset_labels;
|
using namespace Menu_Helpers;
|
||||||
|
|
||||||
vector<ARDOUR::Plugin::PresetRecord> presets = plugin->get_presets();
|
vector<ARDOUR::Plugin::PresetRecord> presets = plugin->get_presets();
|
||||||
|
|
||||||
++_no_load_preset;
|
++_no_load_preset;
|
||||||
|
|
||||||
|
// Add a menu entry for each preset
|
||||||
|
_preset_combo.clear_items();
|
||||||
for (vector<ARDOUR::Plugin::PresetRecord>::const_iterator i = presets.begin(); i != presets.end(); ++i) {
|
for (vector<ARDOUR::Plugin::PresetRecord>::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("");
|
// Add an empty entry for un-setting current preset (see preset_selected)
|
||||||
|
Plugin::PresetRecord no_preset;
|
||||||
set_popdown_strings (_preset_combo, preset_labels);
|
_preset_combo.AddMenuElem(
|
||||||
|
MenuElem("", sigc::bind(sigc::mem_fun(*this, &PlugUIBase::preset_selected), no_preset)));
|
||||||
|
|
||||||
--_no_load_preset;
|
--_no_load_preset;
|
||||||
}
|
}
|
||||||
@ -758,7 +756,11 @@ PlugUIBase::update_preset ()
|
|||||||
Plugin::PresetRecord p = plugin->last_preset();
|
Plugin::PresetRecord p = plugin->last_preset();
|
||||||
|
|
||||||
++_no_load_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;
|
--_no_load_preset;
|
||||||
|
|
||||||
save_button.set_sensitive (!p.uri.empty() && p.user);
|
save_button.set_sensitive (!p.uri.empty() && p.user);
|
||||||
|
@ -49,9 +49,10 @@
|
|||||||
#include "ardour/plugin.h"
|
#include "ardour/plugin.h"
|
||||||
#include "ardour/variant.h"
|
#include "ardour/variant.h"
|
||||||
|
|
||||||
#include "automation_controller.h"
|
|
||||||
#include "ardour_button.h"
|
#include "ardour_button.h"
|
||||||
|
#include "ardour_dropdown.h"
|
||||||
#include "ardour_window.h"
|
#include "ardour_window.h"
|
||||||
|
#include "automation_controller.h"
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
class PluginInsert;
|
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 */
|
/* UI elements that can subclasses can add to their widgets */
|
||||||
|
|
||||||
/** a ComboBoxText which lists presets and manages their selection */
|
/** 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 */
|
/** a label which has a * in if the current settings are different from the preset being shown */
|
||||||
Gtk::Label _preset_modified;
|
Gtk::Label _preset_modified;
|
||||||
/** a button to add a preset */
|
/** 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 */
|
/** 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) */
|
/** 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 */
|
/** a button to bypass the plugin */
|
||||||
ArdourButton bypass_button;
|
ArdourButton bypass_button;
|
||||||
/** a button to acquire keyboard focus */
|
/** a button to acquire keyboard focus */
|
||||||
@ -132,10 +133,8 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
|
|||||||
Gtk::Expander description_expander;
|
Gtk::Expander description_expander;
|
||||||
/** an expander containing the plugin analysis graph */
|
/** an expander containing the plugin analysis graph */
|
||||||
Gtk::Expander plugin_analysis_expander;
|
Gtk::Expander plugin_analysis_expander;
|
||||||
/** a label indicating the plugin latency */
|
|
||||||
Gtk::Label latency_label;
|
|
||||||
/** a button which, when clicked, opens the latency GUI */
|
/** 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 */
|
/** a button which sets all controls' automation setting to Manual */
|
||||||
ArdourButton automation_manual_all_button;
|
ArdourButton automation_manual_all_button;
|
||||||
/** a button which sets all controls' automation setting to Play */
|
/** 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;
|
Gtk::Image* focus_in_image;
|
||||||
int _no_load_preset;
|
int _no_load_preset;
|
||||||
|
|
||||||
virtual void preset_selected ();
|
virtual void preset_selected (ARDOUR::Plugin::PresetRecord preset);
|
||||||
void add_plugin_setting ();
|
void add_plugin_setting ();
|
||||||
void save_plugin_setting ();
|
void save_plugin_setting ();
|
||||||
void delete_plugin_setting ();
|
void delete_plugin_setting ();
|
||||||
|
@ -60,12 +60,12 @@ VSTPluginUI::~VSTPluginUI ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VSTPluginUI::preset_selected ()
|
VSTPluginUI::preset_selected (Plugin::PresetRecord preset)
|
||||||
{
|
{
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
_socket.grab_focus ();
|
_socket.grab_focus ();
|
||||||
#endif
|
#endif
|
||||||
PlugUIBase::preset_selected ();
|
PlugUIBase::preset_selected (preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -52,7 +52,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
bool configure_handler (GdkEventConfigure *);
|
bool configure_handler (GdkEventConfigure *);
|
||||||
void preset_selected ();
|
void preset_selected (ARDOUR::Plugin::PresetRecord preset);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user