fix up fit-selected-tracks so that we are filling the trackview area, not the entire canvas (which now includes rulers)

This commit is contained in:
Paul Davis 2014-06-09 09:08:51 -04:00
parent 6f38ff5c3c
commit c5152cfdb3

View file

@ -6915,7 +6915,13 @@ Editor::fit_tracks (TrackViewList & tracks)
++visible_tracks; ++visible_tracks;
} }
uint32_t h = (uint32_t) floor ((_visible_canvas_height - child_heights) / visible_tracks); /* compute the per-track height from:
total canvas visible height -
height that will be taken by visible children of selected
tracks - height of the ruler/hscroll area
*/
uint32_t h = (uint32_t) floor ((_visible_canvas_height - (child_heights + _trackview_group->canvas_origin().y)) / visible_tracks);
double first_y_pos = DBL_MAX; double first_y_pos = DBL_MAX;
if (h < TimeAxisView::preset_height (HeightSmall)) { if (h < TimeAxisView::preset_height (HeightSmall)) {
@ -6940,9 +6946,7 @@ Editor::fit_tracks (TrackViewList & tracks)
/* operate on all tracks, hide unselected ones that are in the middle of selected ones */ /* operate on all tracks, hide unselected ones that are in the middle of selected ones */
bool prev_was_selected = false; bool within_selected = false;
bool is_selected = tracks.contains (all.front());
bool next_is_selected;
for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t) { for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t) {
@ -6951,27 +6955,17 @@ Editor::fit_tracks (TrackViewList & tracks)
next = t; next = t;
++next; ++next;
if (next != all.end()) {
next_is_selected = tracks.contains (*next);
} else {
next_is_selected = false;
}
if ((*t)->marked_for_display ()) { if ((*t)->marked_for_display ()) {
if (is_selected) { if (tracks.contains (*t)) {
(*t)->set_height (h); (*t)->set_height (h);
first_y_pos = std::min ((*t)->y_position (), first_y_pos); first_y_pos = std::min ((*t)->y_position (), first_y_pos);
} else { within_selected = true;
if (prev_was_selected && next_is_selected) { } else if (within_selected) {
hide_track_in_display (*t); hide_track_in_display (*t);
} }
} }
} }
prev_was_selected = is_selected;
is_selected = next_is_selected;
}
/* /*
set the controls_layout height now, because waiting for its size set the controls_layout height now, because waiting for its size
request signal handler will cause the vertical adjustment setting to fail request signal handler will cause the vertical adjustment setting to fail