13
0

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.
This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2016-08-18 10:42:43 +02:00
parent 3ab6ff8be7
commit 1d686ac978
2 changed files with 7 additions and 18 deletions

View File

@ -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)
{

View File

@ -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 ();