, meterinfo (0)
, knobtable (0)
{
- automate_button.set_name ("PluginAutomateButton");
+ automate_button.set_name ("plugin automation state button");
set_tooltip (automate_button, _("Automation control"));
/* XXX translators: use a string here that will be at least as long
// don't lock to avoid deadlock because we're triggered by
// AutomationControl::Changed() while the automation lock is taken
+ AutoState state = insert->get_parameter_automation_state (cui->parameter());
+
+ cui->automate_button.set_active((state != ARDOUR::Off));
+
if (cui->knobtable) {
cui->automate_button.set_text (
- GainMeterBase::astate_string (
- insert->get_parameter_automation_state (cui->parameter()))
- );
+ GainMeterBase::astate_string (state));
return;
}
- switch (insert->get_parameter_automation_state (cui->parameter()) & (ARDOUR::Off|Play|Touch|Write)) {
+ switch (state & (ARDOUR::Off|Play|Touch|Write)) {
case ARDOUR::Off:
cui->automate_button.set_text (S_("Automation|Manual"));
break;
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));
+ control_ui->automate_button.signal_button_press_event().connect (
+ sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::astate_button_event),
+ control_ui),
+ false);
mcontrol->alist()->automation_state_changed.connect (
control_connections,
invalidator (*this),
return control_ui;
}
-void
-GenericPluginUI::astate_clicked (ControlUI* cui)
+bool
+GenericPluginUI::astate_button_event (GdkEventButton* ev, ControlUI* cui)
{
+ if (ev->button != 1) {
+ return true;
+ }
+
using namespace Menu_Helpers;
if (automation_menu == 0) {
items.push_back (MenuElem (_("Touch"),
sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui)));
- automation_menu->popup (
- boost::bind (&Gtkmm2ext::position_menu_anchored, automation_menu, &cui->automate_button, "", _1, _2, _3),
- 1, gtk_get_current_event_time());
+ anchored_menu_popup(automation_menu, &cui->automate_button, cui->automate_button.get_text(),
+ 1, ev->time);
+
+ return true;
}
void