Consolidate Plugin-GUI toolbar layout, consistent layout & spacing

This commit is contained in:
Robin Gareus 2020-09-15 23:42:17 +02:00
parent 42643d264e
commit f8ce5ecbc6
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
6 changed files with 128 additions and 185 deletions

View file

@ -421,52 +421,17 @@ AUPluginUI::AUPluginUI (boost::shared_ptr<PluginInsert> insert)
/* stuff some stuff into the top of the window */ /* stuff some stuff into the top of the window */
HBox* smaller_hbox = manage (new HBox);
smaller_hbox->set_spacing (6);
smaller_hbox->pack_start (latency_button, false, false, 4);
smaller_hbox->pack_start (pin_management_button, false, false, 4);
smaller_hbox->pack_start (preset_label, false, false, 4);
smaller_hbox->pack_start (_preset_modified, false, false);
smaller_hbox->pack_start (_preset_combo, false, false);
smaller_hbox->pack_start (add_button, false, false);
smaller_hbox->pack_start (save_button, false, false);
smaller_hbox->pack_start (delete_button, false, false);
if (has_descriptive_presets ()) {
smaller_hbox->pack_start (preset_browser_button, false, false);
}
#if 0
/* one day these might be useful with an AU plugin, but not yet */
smaller_hbox->pack_start (automation_mode_label, false, false);
smaller_hbox->pack_start (automation_mode_selector, false, false);
#endif
if (insert->controls().size() > 0) {
smaller_hbox->pack_start (reset_button, false, false);
}
smaller_hbox->pack_start (bypass_button, false, true);
VBox* v1_box = manage (new VBox);
VBox* v2_box = manage (new VBox);
v1_box->pack_start (*smaller_hbox, false, true);
v2_box->pack_start (focus_button, false, true);
top_box.set_homogeneous (false); top_box.set_homogeneous (false);
top_box.set_spacing (6); top_box.set_spacing (6);
top_box.set_border_width (6); top_box.set_border_width (6);
add_common_widgets (&top_box);
top_box.pack_end (*v2_box, false, false); set_spacing (0);
top_box.pack_end (*v1_box, false, false);
set_spacing (6);
pack_start (top_box, false, false); pack_start (top_box, false, false);
pack_start (low_box, true, true); pack_start (low_box, true, true);
preset_label.show (); top_box.show_all ();
_preset_combo.show ();
automation_mode_label.show ();
automation_mode_selector.show ();
bypass_button.show ();
top_box.show (); top_box.show ();
low_box.show (); low_box.show ();
@ -1113,7 +1078,7 @@ AUPluginUI::parent_cocoa_window ()
gtk_widget_translate_coordinates( gtk_widget_translate_coordinates(
GTK_WIDGET(low_box.gobj()), GTK_WIDGET(low_box.gobj()),
GTK_WIDGET(low_box.get_parent()->gobj()), GTK_WIDGET(low_box.get_parent()->gobj()),
8, 6, &xx, &yy); 0, 0, &xx, &yy);
[au_view setFrame:NSMakeRect(xx, yy, req_width, req_height)]; [au_view setFrame:NSMakeRect(xx, yy, req_width, req_height)];
last_au_frame = [au_view frame]; last_au_frame = [au_view frame];

View file

@ -92,32 +92,15 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
, _piano_channel (*manage (new Adjustment (0, 1, 16, 1, 1))) , _piano_channel (*manage (new Adjustment (0, 1, 16, 1, 1)))
{ {
set_name ("PluginEditor"); set_name ("PluginEditor");
set_border_width (10); set_border_width (6);
//set_homogeneous (false); //set_homogeneous (false);
pack_start (main_contents, true, true); pack_start (main_contents, true, true);
settings_box.set_homogeneous (false);
HBox* constraint_hbox = manage (new HBox);
HBox* smaller_hbox = manage (new HBox); HBox* smaller_hbox = manage (new HBox);
smaller_hbox->set_spacing (4); smaller_hbox->set_spacing (6);
Label* combo_label = manage (new Label (_("<span size=\"large\">Presets</span>"))); smaller_hbox->set_border_width (0);
combo_label->set_use_markup (true); add_common_widgets (smaller_hbox, false);
smaller_hbox->pack_start (latency_button, false, false, 4);
smaller_hbox->pack_start (pin_management_button, false, false, 4);
smaller_hbox->pack_start (_preset_modified, false, false);
smaller_hbox->pack_start (_preset_combo, false, false);
smaller_hbox->pack_start (add_button, false, false);
smaller_hbox->pack_start (save_button, false, false);
smaller_hbox->pack_start (delete_button, false, false);
if (pi->controls().size() > 0 && has_descriptive_presets ()) {
smaller_hbox->pack_start (preset_browser_button, false, false);
}
if (pi->controls().size() > 0) {
smaller_hbox->pack_start (reset_button, false, false, 4);
}
smaller_hbox->pack_start (bypass_button, false, true, 4);
automation_manual_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Off)); automation_manual_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Off));
automation_manual_all_button.set_name (X_("generic button")); automation_manual_all_button.set_name (X_("generic button"));
@ -130,11 +113,6 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch)); automation_latch_all_button.set_text (GainMeterBase::astate_string (ARDOUR::Latch));
automation_latch_all_button.set_name (X_("generic button")); automation_latch_all_button.set_name (X_("generic button"));
constraint_hbox->set_spacing (5);
constraint_hbox->set_homogeneous (false);
VBox* v1_box = manage (new VBox);
VBox* v2_box = manage (new VBox);
if (pi->is_instrument ()) { if (pi->is_instrument ()) {
_piano = new APianoKeyboard (); _piano = new APianoKeyboard ();
_piano->set_flags(Gtk::CAN_FOCUS); _piano->set_flags(Gtk::CAN_FOCUS);
@ -171,8 +149,11 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
pack_end (description_expander, false, false); pack_end (description_expander, false, false);
} }
v1_box->set_spacing (6); settings_box.set_homogeneous (false);
v1_box->pack_start (*smaller_hbox, false, true); settings_box.set_spacing (0);
settings_box.set_border_width (0);
settings_box.pack_start (*smaller_hbox, false, false);
if (pi->controls().size() > 0) { if (pi->controls().size() > 0) {
HBox* automation_hbox = manage (new HBox); HBox* automation_hbox = manage (new HBox);
automation_hbox->set_spacing (6); automation_hbox->set_spacing (6);
@ -183,20 +164,13 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
automation_hbox->pack_start (automation_play_all_button, false, false); automation_hbox->pack_start (automation_play_all_button, false, false);
automation_hbox->pack_start (automation_write_all_button, false, false); automation_hbox->pack_start (automation_write_all_button, false, false);
automation_hbox->pack_start (automation_touch_all_button, false, false); automation_hbox->pack_start (automation_touch_all_button, false, false);
v1_box->pack_start (*automation_hbox, false, true); settings_box.pack_start (*automation_hbox, false, false, 6);
} }
v2_box->pack_start (focus_button, false, true);
main_contents.pack_start (settings_box, false, false); main_contents.pack_start (settings_box, false, false);
constraint_hbox->pack_end (*v2_box, false, false);
constraint_hbox->pack_end (*v1_box, false, false);
main_contents.pack_start (*constraint_hbox, false, false);
pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)), gui_context()); pi->ActiveChanged.connect (active_connection, invalidator (*this), boost::bind (&GenericPluginUI::processor_active_changed, this, boost::weak_ptr<Processor>(pi)), gui_context());
_bypass_button.set_active (!pi->enabled());
bypass_button.set_active (!pi->enabled());
/* ScrolledWindow will wrap hpacker in a Viewport */ /* ScrolledWindow will wrap hpacker in a Viewport */
scroller.add (hpacker); scroller.add (hpacker);

View file

@ -308,21 +308,7 @@ LV2PluginUI::LV2PluginUI(boost::shared_ptr<PluginInsert> pi,
{ {
_ardour_buttons_box.set_spacing (6); _ardour_buttons_box.set_spacing (6);
_ardour_buttons_box.set_border_width (6); _ardour_buttons_box.set_border_width (6);
_ardour_buttons_box.pack_end (focus_button, false, false); add_common_widgets (&_ardour_buttons_box);
_ardour_buttons_box.pack_end (bypass_button, false, false, 4);
if (pi->controls().size() > 0) {
_ardour_buttons_box.pack_end (reset_button, false, false, 4);
}
if (has_descriptive_presets ()) {
_ardour_buttons_box.pack_end (preset_browser_button, false, false);
}
_ardour_buttons_box.pack_end (delete_button, false, false);
_ardour_buttons_box.pack_end (save_button, false, false);
_ardour_buttons_box.pack_end (add_button, false, false);
_ardour_buttons_box.pack_end (_preset_combo, false, false);
_ardour_buttons_box.pack_end (_preset_modified, false, false);
_ardour_buttons_box.pack_end (pin_management_button, false, false);
_ardour_buttons_box.pack_start (latency_button, false, false, 4);
plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&LV2PluginUI::queue_port_update, this), gui_context ()); plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&LV2PluginUI::queue_port_update, this), gui_context ());
} }

View file

@ -461,13 +461,13 @@ PluginUIWindow::plugin_going_away ()
PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi) PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
: insert (pi) : insert (pi)
, plugin (insert->plugin()) , plugin (insert->plugin())
, add_button (_("Add")) , _add_button (_("Add"))
, save_button (_("Save")) , _save_button (_("Save"))
, delete_button (_("Delete")) , _delete_button (_("Delete"))
, preset_browser_button (_("Preset Browser")) , _preset_browser_button (_("Preset Browser"))
, reset_button (_("Reset")) , _reset_button (_("Reset"))
, bypass_button (ArdourButton::led_default_elements) , _bypass_button (ArdourButton::led_default_elements)
, pin_management_button (_("Pinout")) , _pin_management_button (_("Pinout"))
, description_expander (_("Description")) , description_expander (_("Description"))
, plugin_analysis_expander (_("Plugin analysis")) , plugin_analysis_expander (_("Plugin analysis"))
, cpuload_expander (_("CPU Profile")) , cpuload_expander (_("CPU Profile"))
@ -481,70 +481,70 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
_preset_modified.set_size_request (16, -1); _preset_modified.set_size_request (16, -1);
_preset_combo.set_text("(default)"); _preset_combo.set_text("(default)");
set_tooltip (_preset_combo, _("Presets (if any) for this plugin\n(Both factory and user-created)")); set_tooltip (_preset_combo, _("Presets (if any) for this plugin\n(Both factory and user-created)"));
set_tooltip (add_button, _("Save a new preset")); set_tooltip (_add_button, _("Save a new preset"));
set_tooltip (save_button, _("Save the current preset")); set_tooltip (_save_button, _("Save the current preset"));
set_tooltip (delete_button, _("Delete the current preset")); set_tooltip (_delete_button, _("Delete the current preset"));
set_tooltip (preset_browser_button, _("Show Preset Browser Dialog")); set_tooltip (_preset_browser_button, _("Show Preset Browser Dialog"));
set_tooltip (reset_button, _("Reset parameters to default (if no parameters are in automation play mode)")); set_tooltip (_reset_button, _("Reset parameters to default (if no parameters are in automation play mode)"));
set_tooltip (pin_management_button, _("Show Plugin Pin Management Dialog")); set_tooltip (_pin_management_button, _("Show Plugin Pin Management Dialog"));
set_tooltip (bypass_button, _("Disable signal processing by the plugin")); set_tooltip (_bypass_button, _("Disable signal processing by the plugin"));
set_tooltip (latency_button, _("Edit Plugin Delay/Latency Compensation")); set_tooltip (_latency_button, _("Edit Plugin Delay/Latency Compensation"));
_no_load_preset = 0; _no_load_preset = 0;
update_preset_list (); update_preset_list ();
update_preset (); update_preset ();
latency_button.set_icon (ArdourIcon::LatencyClock); _latency_button.set_icon (ArdourIcon::LatencyClock);
latency_button.add_elements (ArdourButton::Text); _latency_button.add_elements (ArdourButton::Text);
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 ();
add_button.set_name ("generic button"); _add_button.set_name ("generic button");
add_button.set_icon (ArdourIcon::PsetAdd); _add_button.set_icon (ArdourIcon::PsetAdd);
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 ("generic button"); _save_button.set_name ("generic button");
save_button.set_icon (ArdourIcon::PsetSave); _save_button.set_icon (ArdourIcon::PsetSave);
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 ("generic button"); _delete_button.set_name ("generic button");
delete_button.set_icon (ArdourIcon::PsetDelete); _delete_button.set_icon (ArdourIcon::PsetDelete);
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));
preset_browser_button.set_name ("generic button"); _preset_browser_button.set_name ("generic button");
preset_browser_button.set_icon (ArdourIcon::PsetBrowse); _preset_browser_button.set_icon (ArdourIcon::PsetBrowse);
preset_browser_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::browse_presets)); _preset_browser_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::browse_presets));
reset_button.set_name ("generic button"); _reset_button.set_name ("generic button");
reset_button.set_icon (ArdourIcon::PluginReset); _reset_button.set_icon (ArdourIcon::PluginReset);
reset_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::reset_plugin_parameters)); _reset_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::reset_plugin_parameters));
pin_management_button.set_name ("generic button"); _pin_management_button.set_name ("generic button");
pin_management_button.set_icon (ArdourIcon::PluginPinout); _pin_management_button.set_icon (ArdourIcon::PluginPinout);
pin_management_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::manage_pins)); _pin_management_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::manage_pins));
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());
bypass_button.set_name ("plugin bypass button"); _bypass_button.set_name ("plugin bypass button");
bypass_button.set_text (_("Bypass")); _bypass_button.set_text (_("Bypass"));
bypass_button.set_icon (ArdourIcon::PluginBypass); _bypass_button.set_icon (ArdourIcon::PluginBypass);
bypass_button.set_active (!pi->enabled ()); _bypass_button.set_active (!pi->enabled ());
bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false); _bypass_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::bypass_button_release), false);
focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); _focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
focus_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::focus_toggled)); _focus_button.signal_button_release_event().connect (sigc::mem_fun(*this, &PlugUIBase::focus_toggled));
focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK); _focus_button.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
/* these images are not managed, so that we can remove them at will */ /* these images are not managed, so that we can remove them at will */
focus_out_image = new Image (get_icon (X_("computer_keyboard"))); _focus_out_image = new Image (get_icon (X_("computer_keyboard")));
focus_in_image = new Image (get_icon (X_("computer_keyboard_active"))); _focus_in_image = new Image (get_icon (X_("computer_keyboard_active")));
focus_button.add (*focus_out_image); _focus_button.add (*_focus_out_image);
set_tooltip (focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME)); set_tooltip (_focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME));
set_tooltip (bypass_button, _("Click to enable/disable this plugin")); set_tooltip (_bypass_button, _("Click to enable/disable this plugin"));
description_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_description)); description_expander.property_expanded().signal_changed().connect( sigc::mem_fun(*this, &PlugUIBase::toggle_description));
description_expander.set_expanded(false); description_expander.set_expanded(false);
@ -577,6 +577,9 @@ PlugUIBase::~PlugUIBase()
delete latency_gui; delete latency_gui;
delete latency_dialog; delete latency_dialog;
delete preset_dialog; delete preset_dialog;
delete _focus_out_image;
delete _focus_in_image;
} }
void void
@ -587,13 +590,38 @@ PlugUIBase::plugin_going_away ()
plugin.reset (); plugin.reset ();
} }
void
PlugUIBase::add_common_widgets (Gtk::HBox* b, bool with_focus)
{
if (with_focus) {
b->pack_end (_focus_button, false, false);
}
b->pack_end (_bypass_button, false, false, with_focus ? 4 : 0);
if (insert->controls().size() > 0) {
b->pack_end (_reset_button, false, false, 4);
}
if (has_descriptive_presets ()) {
b->pack_end (_preset_browser_button, false, false);
}
b->pack_end (_delete_button, false, false);
b->pack_end (_save_button, false, false);
b->pack_end (_add_button, false, false);
b->pack_end (_preset_combo, false, false);
b->pack_end (_preset_modified, false, false);
b->pack_end (_pin_management_button, false, false);
b->pack_start (_latency_button, false, false, 4);
}
void void
PlugUIBase::set_latency_label () PlugUIBase::set_latency_label ()
{ {
samplecnt_t const l = insert->effective_latency (); samplecnt_t const l = insert->effective_latency ();
float const sr = insert->session().sample_rate (); float const sr = insert->session().sample_rate ();
latency_button.set_text (samples_as_time_string (l, sr, true)); _latency_button.set_text (samples_as_time_string (l, sr, true));
} }
void void
@ -606,7 +634,7 @@ PlugUIBase::latency_button_clicked ()
different WM's as possible. different WM's as possible.
*/ */
latency_dialog->set_keep_above (true); latency_dialog->set_keep_above (true);
Window* win = dynamic_cast<Window*> (bypass_button.get_toplevel ()); Window* win = dynamic_cast<Window*> (_bypass_button.get_toplevel ());
if (win) { if (win) {
latency_dialog->set_transient_for (*win); latency_dialog->set_transient_for (*win);
} }
@ -624,7 +652,7 @@ PlugUIBase::processor_active_changed (boost::weak_ptr<Processor> weak_p)
boost::shared_ptr<Processor> p (weak_p.lock()); boost::shared_ptr<Processor> p (weak_p.lock());
if (p) { if (p) {
bypass_button.set_active (!p->enabled ()); _bypass_button.set_active (!p->enabled ());
} }
} }
@ -680,7 +708,7 @@ PlugUIBase::delete_plugin_setting ()
void void
PlugUIBase::automation_state_changed () PlugUIBase::automation_state_changed ()
{ {
reset_button.set_sensitive (insert->can_reset_all_parameters()); _reset_button.set_sensitive (insert->can_reset_all_parameters());
} }
void void
@ -713,7 +741,7 @@ PlugUIBase::browse_presets ()
} }
preset_dialog = new ArdourWindow (_("Select Preset")); preset_dialog = new ArdourWindow (_("Select Preset"));
preset_dialog->set_keep_above (true); preset_dialog->set_keep_above (true);
Window* win = dynamic_cast<Window*> (preset_browser_button.get_toplevel ()); Window* win = dynamic_cast<Window*> (_preset_browser_button.get_toplevel ());
if (win) { if (win) {
preset_dialog->set_transient_for (*win); preset_dialog->set_transient_for (*win);
} }
@ -737,7 +765,7 @@ PlugUIBase::manage_pins ()
bool bool
PlugUIBase::bypass_button_release (GdkEventButton*) PlugUIBase::bypass_button_release (GdkEventButton*)
{ {
bool view_says_bypassed = (bypass_button.active_state() != 0); bool view_says_bypassed = (_bypass_button.active_state() != 0);
if (view_says_bypassed != insert->enabled ()) { if (view_says_bypassed != insert->enabled ()) {
insert->enable (view_says_bypassed); insert->enable (view_says_bypassed);
@ -751,17 +779,17 @@ PlugUIBase::focus_toggled (GdkEventButton*)
{ {
if (Keyboard::the_keyboard().some_magic_widget_has_focus()) { if (Keyboard::the_keyboard().some_magic_widget_has_focus()) {
Keyboard::the_keyboard().magic_widget_drop_focus(); Keyboard::the_keyboard().magic_widget_drop_focus();
focus_button.remove (); _focus_button.remove ();
focus_button.add (*focus_out_image); _focus_button.add (*_focus_out_image);
focus_out_image->show (); _focus_out_image->show ();
set_tooltip (focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME)); set_tooltip (_focus_button, string_compose (_("Click to allow the plugin to receive keyboard events that %1 would normally use as a shortcut"), PROGRAM_NAME));
KeyboardFocused (false); KeyboardFocused (false);
} else { } else {
Keyboard::the_keyboard().magic_widget_grab_focus(); Keyboard::the_keyboard().magic_widget_grab_focus();
focus_button.remove (); _focus_button.remove ();
focus_button.add (*focus_in_image); _focus_button.add (*_focus_in_image);
focus_in_image->show (); _focus_in_image->show ();
set_tooltip (focus_button, string_compose (_("Click to allow normal use of %1 keyboard shortcuts"), PROGRAM_NAME)); set_tooltip (_focus_button, string_compose (_("Click to allow normal use of %1 keyboard shortcuts"), PROGRAM_NAME));
KeyboardFocused (true); KeyboardFocused (true);
} }
@ -903,7 +931,7 @@ PlugUIBase::update_preset ()
} }
--_no_load_preset; --_no_load_preset;
delete_button.set_sensitive (!p.uri.empty() && p.user); _delete_button.set_sensitive (!p.uri.empty() && p.user);
update_preset_modified (); update_preset_modified ();
} }
@ -913,7 +941,7 @@ PlugUIBase::update_preset_modified ()
Plugin::PresetRecord p = plugin->last_preset(); Plugin::PresetRecord p = plugin->last_preset();
if (p.uri.empty()) { if (p.uri.empty()) {
save_button.set_sensitive (false); _save_button.set_sensitive (false);
_preset_modified.set_text (""); _preset_modified.set_text ("");
return; return;
} }
@ -922,7 +950,7 @@ PlugUIBase::update_preset_modified ()
if (_preset_modified.get_text().empty() == c) { if (_preset_modified.get_text().empty() == c) {
_preset_modified.set_text (c ? "*" : ""); _preset_modified.set_text (c ? "*" : "");
} }
save_button.set_sensitive (c && p.user); _save_button.set_sensitive (c && p.user);
} }
void void

View file

@ -120,28 +120,30 @@ protected:
boost::shared_ptr<ARDOUR::PluginInsert> insert; boost::shared_ptr<ARDOUR::PluginInsert> insert;
boost::shared_ptr<ARDOUR::Plugin> plugin; boost::shared_ptr<ARDOUR::Plugin> plugin;
/* UI elements that can subclasses can add to their widgets */ void add_common_widgets (Gtk::HBox*, bool with_focus = true);
/* UI elements that subclasses can add to their widgets */
/** a ComboBoxText which lists presets and manages their selection */ /** a ComboBoxText which lists presets and manages their selection */
ArdourWidgets::ArdourDropdown _preset_combo; ArdourWidgets::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 */
ArdourWidgets::ArdourButton add_button; ArdourWidgets::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 */
ArdourWidgets::ArdourButton save_button; ArdourWidgets::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) */
ArdourWidgets::ArdourButton delete_button; ArdourWidgets::ArdourButton _delete_button;
/** a button to show a preset browser */ /** a button to show a preset browser */
ArdourWidgets::ArdourButton preset_browser_button; ArdourWidgets::ArdourButton _preset_browser_button;
/** a button to delete the reset the plugin params */ /** a button to delete the reset the plugin params */
ArdourWidgets::ArdourButton reset_button; ArdourWidgets::ArdourButton _reset_button;
/** a button to bypass the plugin */ /** a button to bypass the plugin */
ArdourWidgets::ArdourButton bypass_button; ArdourWidgets::ArdourButton _bypass_button;
/** and self-explaining button :) */ /** and self-explaining button :) */
ArdourWidgets::ArdourButton pin_management_button; ArdourWidgets::ArdourButton _pin_management_button;
/** a button to acquire keyboard focus */ /** a button to acquire keyboard focus */
Gtk::EventBox focus_button; Gtk::EventBox _focus_button;
/** an expander containing the plugin description */ /** an expander containing the plugin description */
Gtk::Expander description_expander; Gtk::Expander description_expander;
/** an expander containing the plugin analysis graph */ /** an expander containing the plugin analysis graph */
@ -149,7 +151,7 @@ protected:
/** an expander containing the plugin cpu profile */ /** an expander containing the plugin cpu profile */
Gtk::Expander cpuload_expander; Gtk::Expander cpuload_expander;
/** a button which, when clicked, opens the latency GUI */ /** a button which, when clicked, opens the latency GUI */
ArdourWidgets::ArdourButton latency_button; ArdourWidgets::ArdourButton _latency_button;
/** a button which sets all controls' automation setting to Manual */ /** a button which sets all controls' automation setting to Manual */
ArdourWidgets::ArdourButton automation_manual_all_button; ArdourWidgets::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 */
@ -170,8 +172,6 @@ protected:
PluginPresetsUI* preset_gui; PluginPresetsUI* preset_gui;
ArdourWindow* preset_dialog; ArdourWindow* preset_dialog;
Gtk::Image* focus_out_image;
Gtk::Image* focus_in_image;
int _no_load_preset; int _no_load_preset;
virtual void preset_selected (ARDOUR::Plugin::PresetRecord preset); virtual void preset_selected (ARDOUR::Plugin::PresetRecord preset);
@ -199,6 +199,10 @@ protected:
PBD::ScopedConnection preset_added_connection; PBD::ScopedConnection preset_added_connection;
PBD::ScopedConnection preset_removed_connection; PBD::ScopedConnection preset_removed_connection;
PBD::ScopedConnectionList control_connections; PBD::ScopedConnectionList control_connections;
private:
Gtk::Image* _focus_out_image;
Gtk::Image* _focus_in_image;
}; };
class GenericPluginUI : public PlugUIBase, public Gtk::VBox class GenericPluginUI : public PlugUIBase, public Gtk::VBox
@ -215,7 +219,7 @@ public:
private: private:
Gtk::VBox main_contents; Gtk::VBox main_contents;
Gtk::HBox settings_box; Gtk::VBox settings_box;
Gtk::HBox hpacker; Gtk::HBox hpacker;
Gtk::Menu* automation_menu; Gtk::Menu* automation_menu;

View file

@ -40,21 +40,7 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> insert, boost:
Gtk::HBox* box = manage (new Gtk::HBox); Gtk::HBox* box = manage (new Gtk::HBox);
box->set_spacing (6); box->set_spacing (6);
box->set_border_width (6); box->set_border_width (6);
box->pack_end (focus_button, false, false); add_common_widgets (box);
box->pack_end (bypass_button, false, false, 4);
if (insert->controls().size() > 0) {
box->pack_end (reset_button, false, false, 4);
}
if (has_descriptive_presets ()) {
box->pack_end (preset_browser_button, false, false);
}
box->pack_end (delete_button, false, false);
box->pack_end (save_button, false, false);
box->pack_end (add_button, false, false);
box->pack_end (_preset_combo, false, false);
box->pack_end (_preset_modified, false, false);
box->pack_end (pin_management_button, false, false);
box->pack_end (latency_button, false, false);
pack_start (*box, false, false); pack_start (*box, false, false);
box->signal_size_allocate().connect (sigc::mem_fun (*this, &VSTPluginUI::top_box_allocated)); box->signal_size_allocate().connect (sigc::mem_fun (*this, &VSTPluginUI::top_box_allocated));