Fix fit to window for route groups whose first track is hidden (#3678).
authorCarl Hetherington <carl@carlh.net>
Mon, 7 Feb 2011 02:11:31 +0000 (02:11 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 7 Feb 2011 02:11:31 +0000 (02:11 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8736 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_ops.cc

index bc7c625a804eadca9ceb6969d3f88f36655f9159..d15180fd42fadd58932186c21a12582d8b2d55f0 100644 (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);
+                               }
                        }
                }