Avoid CamelCase in color names
[ardour.git] / gtk2_ardour / generic_pluginui.cc
index 0caf475afac3cfd494d4ff217032c3e22d1dbbf0..2be161035f277e5eddfdec1babb0b08141003966 100644 (file)
@@ -87,6 +87,7 @@ GenericPluginUI::GenericPluginUI (boost::shared_ptr<PluginInsert> pi, bool scrol
        set_latency_label ();
 
        smaller_hbox->pack_start (latency_button, false, false, 4);
+       smaller_hbox->pack_start (pin_management_button, false, false, 4);
        smaller_hbox->pack_start (_preset_combo, false, false);
        smaller_hbox->pack_start (_preset_modified, false, false);
        smaller_hbox->pack_start (add_button, false, false);
@@ -554,7 +555,7 @@ GenericPluginUI::ControlUI::ControlUI (const Evoral::Parameter& p)
        , 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
@@ -587,15 +588,17 @@ GenericPluginUI::automation_state_changed (ControlUI* cui)
        // 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;
@@ -829,9 +832,10 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
                        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),
@@ -931,14 +935,19 @@ GenericPluginUI::build_control_ui (const Evoral::Parameter&             param,
        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) {
                automation_menu = manage (new Menu);
                automation_menu->set_name ("ArdourContextMenu");
+               automation_menu->set_reserve_toggle_size(false);
        }
 
        MenuList& items (automation_menu->items());
@@ -953,7 +962,10 @@ GenericPluginUI::astate_clicked (ControlUI* cui)
        items.push_back (MenuElem (_("Touch"),
                                   sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui)));
 
-       automation_menu->popup (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