add Editor-level action to toggle track layer display

This commit is contained in:
Paul Davis 2020-04-03 18:54:37 -06:00
parent c2b026831c
commit 0ecf1e40ea
4 changed files with 35 additions and 0 deletions

View File

@ -432,6 +432,8 @@
<separator/>
<menuitem action="toggle-layer-display"/>
<menu action="PrimaryClockMenu">
<menuitem action='focus-on-clock'/>
<menuitem action="primary-clock-timecode"/>

View File

@ -1509,6 +1509,7 @@ private:
bool select_new_marker;
void toggle_all_existing_automation ();
void toggle_layer_display ();
void reverse_selection ();
void edit_envelope ();

View File

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

View File

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