Put a limit on the tallest that a region can be in the summary.
authorCarl Hetherington <carl@carlh.net>
Mon, 15 Jun 2009 01:36:46 +0000 (01:36 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 15 Jun 2009 01:36:46 +0000 (01:36 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5195 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_summary.cc

index c35e0a113398e8d9a114e4944ece9c5793f00511..4211b391a210eb59a538d2a2a5bd1044da94f285 100644 (file)
@@ -157,14 +157,24 @@ EditorSummary::render (cairo_t* cr)
        /* compute total height of all tracks */
        
        int h = 0;
+       int max_height = 0;
        for (PublicEditor::TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) {
-               h += (*i)->effective_height ();
+               int const t = (*i)->effective_height ();
+               h += t;
+               max_height = max (max_height, t);
        }
 
        nframes_t const start = _session->current_start_frame ();
        _pixels_per_frame = static_cast<double> (_width) / (_session->current_end_frame() - start);
        _vertical_scale = static_cast<double> (_height) / h;
 
+       /* tallest a region should ever be in the summary, in pixels */
+       int const tallest_region_pixels = 12;
+
+       if (max_height * _vertical_scale > tallest_region_pixels) {
+               _vertical_scale = static_cast<double> (tallest_region_pixels) / max_height;
+       }
+
        /* render regions */
 
        double y = 0;