From d1e55ff5b7b4e7f9da32ff05898487aff7d8bdc2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 3 Apr 2020 17:58:39 -0600 Subject: [PATCH] add RouteTimeAxis::toggle_layer_display() --- gtk2_ardour/route_time_axis.cc | 22 ++++++++++++++++++++++ gtk2_ardour/route_time_axis.h | 1 + 2 files changed, 23 insertions(+) diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 6eab8137e7..d092f58a45 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2324,6 +2324,28 @@ RouteTimeAxisView::blink_rec_display (bool onoff) RouteUI::blink_rec_display (onoff); } +void +RouteTimeAxisView::toggle_layer_display () +{ + /* this is a bit of a hack, but we implement toggle via the menu items, + in order to keep them in sync with the visual state. + */ + + if (!is_track()) { + return; + } + + if (!display_menu) { + build_display_menu (); + } + + if (dynamic_cast(overlaid_menu_item)->get_active()) { + dynamic_cast(stacked_menu_item)->set_active (true); + } else { + dynamic_cast(overlaid_menu_item)->set_active (true); + } +} + void RouteTimeAxisView::set_layer_display (LayerDisplay d, bool apply_to_selection) { diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 5defd543db..de6bb441a9 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -103,6 +103,7 @@ public: void get_selectables (ARDOUR::samplepos_t start, ARDOUR::samplepos_t end, double top, double bot, std::list&, bool within = false); void get_inverted_selectables (Selection&, std::list&); void set_layer_display (LayerDisplay d, bool apply_to_selection = false); + void toggle_layer_display (); LayerDisplay layer_display () const; boost::shared_ptr find_next_region (samplepos_t pos, ARDOUR::RegionPoint, int32_t dir);