summaryrefslogtreecommitdiff
path: root/gtk2_ardour/route_time_axis.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-18 10:42:43 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-18 13:24:00 +0200
commit534ca8161357c3d557a342486c80c8e253ad263b (patch)
tree043601a11438a032998b31ba1dc3af58c32dc3c1 /gtk2_ardour/route_time_axis.cc
parent1d686ac978c6efd330f86d4d03f02112c778b2d2 (diff)
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.
Diffstat (limited to 'gtk2_ardour/route_time_axis.cc')
-rw-r--r--gtk2_ardour/route_time_axis.cc41
1 files changed, 29 insertions, 12 deletions
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 9bf84f8b13..7e4d4b234a 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -178,9 +178,9 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
playlist_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);
- playlist_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click));
- automation_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click));
+ route_group_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false);
+ playlist_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click), false);
+ automation_button.signal_button_press_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click), false);
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));
}
-gint
+bool
RouteTimeAxisView::route_group_click (GdkEventButton *ev)
{
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
@@ -393,9 +393,15 @@ RouteTimeAxisView::route_group_click (GdkEventButton *ev)
r.push_back (route ());
route_group_menu->build (r);
- route_group_menu->menu()->popup (ev->button, ev->time);
+ 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);
+ }
- return false;
+ return true;
}
void
@@ -472,20 +478,31 @@ RouteTimeAxisView::take_name_changed (void *src)
}
}
-void
-RouteTimeAxisView::playlist_click ()
+bool
+RouteTimeAxisView::playlist_click (GdkEventButton *ev)
{
+ if (ev->button != 1) {
+ return true;
+ }
+
build_playlist_menu ();
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
-RouteTimeAxisView::automation_click ()
+bool
+RouteTimeAxisView::automation_click (GdkEventButton *ev)
{
+ if (ev->button != 1) {
+ return true;
+ }
+
conditionally_add_to_selection ();
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