From 1d686ac978c6efd330f86d4d03f02112c778b2d2 Mon Sep 17 00:00:00 2001 From: "Julien \"_FrnchFrgg_\" RIVAUD" Date: Thu, 18 Aug 2016 10:42:43 +0200 Subject: [PATCH] Make name_button behave more like a Gtk::MenuToolButton Make it popup its menu in attached mode, and on mouse down, but keep the context menu behavior on right-click. --- gtk2_ardour/mixer_strip.cc | 24 +++++++----------------- gtk2_ardour/mixer_strip.h | 1 - 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 1477357770..935542e74e 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -353,7 +353,6 @@ MixerStrip::init () number_label.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::number_button_button_press), false); name_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_press), false); - name_button.signal_button_release_event().connect (sigc::mem_fun(*this, &MixerStrip::name_button_button_release), false); group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &MixerStrip::select_route_group), false); @@ -1726,12 +1725,17 @@ MixerStrip::build_route_ops_menu () gboolean MixerStrip::name_button_button_press (GdkEventButton* ev) { - if (ev->button == 3) { + if (ev->button == 1 || ev->button == 3) { list_route_operations (); /* do not allow rename if the track is record-enabled */ rename_menu_item->set_sensitive (!is_track() || !track()->rec_enable_control()->get_value()); - route_ops_menu->popup (1, ev->time); + if (ev->button == 1) { + Gtkmm2ext::anchored_menu_popup(route_ops_menu, &name_button, "", + 1, ev->time); + } else { + route_ops_menu->popup (3, ev->time); + } return true; } @@ -1739,20 +1743,6 @@ MixerStrip::name_button_button_press (GdkEventButton* ev) return false; } -gboolean -MixerStrip::name_button_button_release (GdkEventButton* ev) -{ - if (ev->button == 1) { - list_route_operations (); - - /* do not allow rename if the track is record-enabled */ - rename_menu_item->set_sensitive (!is_track() || !track()->rec_enable_control()->get_value()); - route_ops_menu->popup (1, ev->time); - } - - return false; -} - gboolean MixerStrip::number_button_button_press (GdkEventButton* ev) { diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index eb6da17f87..c7a39393aa 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -264,7 +264,6 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox Gtk::Menu* route_ops_menu; void build_route_ops_menu (); gboolean name_button_button_press (GdkEventButton*); - gboolean name_button_button_release (GdkEventButton*); gboolean number_button_button_press (GdkEventButton*); void list_route_operations ();