Fix fit to window for route groups whose first track is hidden (#3678).

git-svn-id: svn://localhost/ardour2/branches/3.0@8736 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2011-02-07 02:11:31 +00:00
parent 7ba6f98f9c
commit 5d82f64de0

View file

@ -6415,6 +6415,7 @@ Editor::fit_tracks (TrackViewList & tracks)
}
uint32_t child_heights = 0;
int visible_tracks = 0;
for (TrackSelection::iterator t = tracks.begin(); t != tracks.end(); ++t) {
@ -6423,9 +6424,10 @@ Editor::fit_tracks (TrackViewList & tracks)
}
child_heights += (*t)->effective_height() - (*t)->current_height();
++visible_tracks;
}
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / tracks.size());
uint32_t h = (uint32_t) floor ((_canvas_height - child_heights - canvas_timebars_vsize) / visible_tracks);
double first_y_pos = DBL_MAX;
if (h < TimeAxisView::preset_height (HeightSmall)) {
@ -6466,12 +6468,14 @@ Editor::fit_tracks (TrackViewList & tracks)
next_is_selected = false;
}
if (is_selected) {
(*t)->set_height (h);
first_y_pos = std::min ((*t)->y_position (), first_y_pos);
} else {
if (prev_was_selected && next_is_selected) {
hide_track_in_display (*t);
if ((*t)->marked_for_display ()) {
if (is_selected) {
(*t)->set_height (h);
first_y_pos = std::min ((*t)->y_position (), first_y_pos);
} else {
if (prev_was_selected && next_is_selected) {
hide_track_in_display (*t);
}
}
}