13
0

Make buttons in track headers behave more like Gtk::MenuToolButton

Make their popup menus show attached, and on mouse down, but keep the
context menu behavior on middle- and right-click for the group button
that reacted to those (probably an oversight but some users might have
got the habit of right-clicking).

This also makes the group deletion on Ctrl+click happen on mouse down
instead of mouse up which is not a great difference and avoids
complicating the code.
This commit is contained in:
Julien "_FrnchFrgg_" RIVAUD 2016-08-18 10:42:43 +02:00
parent 1d686ac978
commit 534ca81613
2 changed files with 32 additions and 15 deletions

View File

@ -178,9 +178,9 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
playlist_button.set_name ("route button"); playlist_button.set_name ("route button");
automation_button.set_name ("route button"); automation_button.set_name ("route button");
route_group_button.signal_button_release_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false); route_group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false);
playlist_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click)); playlist_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click), false);
automation_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click)); automation_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click), false);
if (is_track()) { if (is_track()) {
@ -379,7 +379,7 @@ RouteTimeAxisView::setup_processor_menu_and_curves ()
_route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_existing_processor_automation_curves)); _route->foreach_processor (sigc::mem_fun (*this, &RouteTimeAxisView::add_existing_processor_automation_curves));
} }
gint bool
RouteTimeAxisView::route_group_click (GdkEventButton *ev) RouteTimeAxisView::route_group_click (GdkEventButton *ev)
{ {
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
@ -393,9 +393,15 @@ RouteTimeAxisView::route_group_click (GdkEventButton *ev)
r.push_back (route ()); r.push_back (route ());
route_group_menu->build (r); route_group_menu->build (r);
if (ev->button == 1) {
Gtkmm2ext::anchored_menu_popup(route_group_menu->menu(),
&route_group_button,
"", 1, ev->time);
} else {
route_group_menu->menu()->popup (ev->button, ev->time); route_group_menu->menu()->popup (ev->button, ev->time);
}
return false; return true;
} }
void void
@ -472,20 +478,31 @@ RouteTimeAxisView::take_name_changed (void *src)
} }
} }
void bool
RouteTimeAxisView::playlist_click () RouteTimeAxisView::playlist_click (GdkEventButton *ev)
{ {
if (ev->button != 1) {
return true;
}
build_playlist_menu (); build_playlist_menu ();
conditionally_add_to_selection (); conditionally_add_to_selection ();
playlist_action_menu->popup (1, gtk_get_current_event_time()); Gtkmm2ext::anchored_menu_popup(playlist_action_menu, &playlist_button,
"", 1, ev->time);
return true;
} }
void bool
RouteTimeAxisView::automation_click () RouteTimeAxisView::automation_click (GdkEventButton *ev)
{ {
if (ev->button != 1) {
return true;
}
conditionally_add_to_selection (); conditionally_add_to_selection ();
build_automation_action_menu (false); build_automation_action_menu (false);
automation_action_menu->popup (1, gtk_get_current_event_time()); Gtkmm2ext::anchored_menu_popup(automation_action_menu, &automation_button,
"", 1, ev->time);
} }
void void

View File

@ -183,7 +183,7 @@ protected:
void update_diskstream_display (); void update_diskstream_display ();
gint route_group_click (GdkEventButton *); bool route_group_click (GdkEventButton *);
void processors_changed (ARDOUR::RouteProcessorChange); void processors_changed (ARDOUR::RouteProcessorChange);
@ -227,13 +227,13 @@ protected:
void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false); void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false);
void playlist_click (); bool playlist_click (GdkEventButton *);
void show_playlist_selector (); void show_playlist_selector ();
void playlist_changed (); void playlist_changed ();
void rename_current_playlist (); void rename_current_playlist ();
void automation_click (); bool automation_click (GdkEventButton *);
virtual void show_all_automation (bool apply_to_selection = false); virtual void show_all_automation (bool apply_to_selection = false);
virtual void show_existing_automation (bool apply_to_selection = false); virtual void show_existing_automation (bool apply_to_selection = false);