diff options
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 31 |
4 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index ecddc52058..5dce3f45b7 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -432,6 +432,8 @@ <separator/> + <menuitem action="toggle-layer-display"/> + <menu action="PrimaryClockMenu"> <menuitem action='focus-on-clock'/> <menuitem action="primary-clock-timecode"/> diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 18e67b8cbc..618a96d93f 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1509,6 +1509,7 @@ private: bool select_new_marker; void toggle_all_existing_automation (); + void toggle_layer_display (); void reverse_selection (); void edit_envelope (); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 1993568dd0..eaeda52d19 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -257,6 +257,7 @@ Editor::register_actions () reg_sens (editor_actions, "select-prev-stripable", _("Select Previous Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_prev_stripable), false)); reg_sens (editor_actions, "toggle-all-existing-automation", _("Toggle All Existing Automation"), sigc::mem_fun (*this, &Editor::toggle_all_existing_automation)); + reg_sens (editor_actions, "toggle-layer-display", _("Toggle Layer Display"), sigc::mem_fun (*this, &Editor::toggle_layer_display)); act = reg_sens (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), sigc::mem_fun(*this, &Editor::toggle_record_enable)); ActionManager::track_selection_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 09101347e0..92385e41b7 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -8531,3 +8531,34 @@ Editor::toggle_all_existing_automation () tvl.foreach_stripable_time_axis (boost::bind (&StripableTimeAxisView::hide_all_automation, _1, false)); } } + +void +Editor::toggle_layer_display () +{ + TrackViewList & tvl (selection->tracks.empty() ? track_views : selection->tracks); + bool seen_stacked = false; + bool seen_overlaid = false; + + for (TrackViewList::const_iterator t = tvl.begin(); t != tvl.end(); ++t) { + RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*t); + + if (!rtav || !rtav->is_track()) { + continue; + } + + if (rtav->layer_display () == Stacked) { + seen_stacked = true; + } else if (rtav->layer_display() == Overlaid) { + seen_overlaid = true; + } + } + + if (seen_stacked && seen_overlaid) { + /* inconsistent current display - go to overlaid */ + tvl.foreach_route_time_axis (boost::bind (&RouteTimeAxisView::set_layer_display, _1, Overlaid)); + + } else { + tvl.foreach_route_time_axis (boost::bind (&RouteTimeAxisView::toggle_layer_display, _1)); + } + +} |