diff options
author | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2016-08-17 21:14:47 +0200 |
---|---|---|
committer | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2016-08-17 23:56:31 +0200 |
commit | 606ffe6a358cc0ad84253e315e5bd4dea20cce00 (patch) | |
tree | 0cd9ed37d5a0143790e0367e5d0a197c300dff92 /gtk2_ardour/generic_pluginui.cc | |
parent | 97020209296453f02590cce82b6160ce122aad08 (diff) |
Align the currently selected automation state on dropdown
By passing the current text of the automation button we can make the
dropdown menu align with the current mode. This will only work for
full-size automation buttons, not when use-knob is true, but in that
case it feels wrong to popup on top of the button anyway.
Also make the menu show on mouse down like a real dropdown.
Diffstat (limited to 'gtk2_ardour/generic_pluginui.cc')
-rw-r--r-- | gtk2_ardour/generic_pluginui.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index d1accfdd12..c68c699caf 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -830,9 +830,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), @@ -932,9 +933,13 @@ 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) { @@ -955,7 +960,10 @@ GenericPluginUI::astate_clicked (ControlUI* cui) items.push_back (MenuElem (_("Touch"), sigc::bind (sigc::mem_fun(*this, &GenericPluginUI::set_automation_state), (AutoState) Touch, cui))); - anchored_menu_popup(automation_menu, &cui->automate_button, "", 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 |