13
0

prepare plugin reset (#6297)

This commit is contained in:
Robin Gareus 2015-05-04 20:48:41 +02:00
parent fbea6c2542
commit 9790d2b5dd
2 changed files with 26 additions and 0 deletions

View File

@ -418,6 +418,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
, add_button (_("Add"))
, save_button (_("Save"))
, delete_button (_("Delete"))
, reset_button (_("Reset"))
, bypass_button (ArdourButton::led_default_elements)
, description_expander (_("Description"))
, plugin_analysis_expander (_("Plugin analysis"))
@ -431,6 +432,7 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
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 (delete_button, _("Delete the current preset"));
ARDOUR_UI::instance()->set_tip (reset_button, _("Reset parameters to default (if no parameters are in automation play mode)"));
ARDOUR_UI::instance()->set_tip (bypass_button, _("Disable signal processing by the plugin"));
_no_load_preset = 0;
@ -446,6 +448,10 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
delete_button.set_name ("generic button");
delete_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::delete_plugin_setting));
reset_button.set_name ("generic button");
reset_button.signal_clicked.connect (sigc::mem_fun (*this, &PlugUIBase::reset_plugin_parameters));
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");
@ -479,6 +485,10 @@ PlugUIBase::PlugUIBase (boost::shared_ptr<PluginInsert> pi)
plugin->PresetRemoved.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::preset_added_or_removed, this), gui_context ());
plugin->PresetLoaded.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::update_preset, this), gui_context ());
plugin->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::parameter_changed, this, _1, _2), gui_context ());
insert->AutomationStateChanged.connect (*this, invalidator (*this), boost::bind (&PlugUIBase::automation_state_changed, this), gui_context());
automation_state_changed();
}
PlugUIBase::~PlugUIBase()
@ -636,6 +646,18 @@ PlugUIBase::delete_plugin_setting ()
#endif
}
void
PlugUIBase::automation_state_changed ()
{
reset_button.set_sensitive (insert->can_reset_all_parameters());
}
void
PlugUIBase::reset_plugin_parameters ()
{
insert->reset_parameters_to_default ();
}
bool
PlugUIBase::bypass_button_release (GdkEventButton*)
{

View File

@ -125,6 +125,8 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
ArdourButton save_button;
/** a button to delete the current preset (if it is a user one) */
ArdourButton delete_button;
/** a button to delete the reset the plugin params */
ArdourButton reset_button;
/** a button to bypass the plugin */
ArdourButton bypass_button;
/** a button to acquire keyboard focus */
@ -160,12 +162,14 @@ class PlugUIBase : public virtual sigc::trackable, public PBD::ScopedConnectionL
void add_plugin_setting ();
void save_plugin_setting ();
void delete_plugin_setting ();
void reset_plugin_parameters ();
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 ();
void automation_state_changed ();
virtual void parameter_changed (uint32_t, float);
void preset_added_or_removed ();
void update_preset_modified ();