From a0f774025d94324d70f4a8340524f6303dadaa4c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 5 Jun 2016 20:00:00 +0200 Subject: [PATCH] generic plugin UI: insensitive NotAutomatable --- gtk2_ardour/generic_pluginui.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index ef2de43309..995ad26b67 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -645,11 +645,17 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, control_ui->pack_start (*control_ui->button, false, true); control_ui->pack_start (control_ui->automate_button, false, false); + if (mcontrol->flags () & Controllable::NotAutomatable) { + control_ui->automate_button.set_sensitive (false); + set_tooltip(control_ui->automate_button, _("This control cannot be automated")); + } else { + control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui)); + mcontrol->alist()->automation_state_changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); + } + control_ui->button->signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::control_port_toggled), control_ui)); - control_ui->automate_button.signal_clicked().connect (bind (mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui)); mcontrol->Changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::toggle_parameter_changed, this, control_ui), gui_context()); - mcontrol->alist()->automation_state_changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); if (value > 0.5){ control_ui->button->set_active(true); @@ -728,12 +734,17 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter& param, } control_ui->pack_start (control_ui->automate_button, false, false); - control_ui->automate_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui)); + + if (mcontrol->flags () & Controllable::NotAutomatable) { + control_ui->automate_button.set_sensitive (false); + set_tooltip(control_ui->automate_button, _("This control cannot be automated")); + } else { + control_ui->automate_button.signal_clicked().connect (sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::astate_clicked), control_ui)); + mcontrol->alist()->automation_state_changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); + } automation_state_changed (control_ui); - mcontrol->alist()->automation_state_changed.connect (control_connections, invalidator (*this), boost::bind (&GenericPluginUI::automation_state_changed, this, control_ui), gui_context()); - input_controls.push_back (control_ui); input_controls_with_automation.push_back (control_ui);