diff options
author | Carl Hetherington <carl@carlh.net> | 2010-06-14 23:59:21 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-06-14 23:59:21 +0000 |
commit | 1f829f45ef1503126a01e2c16b6c9032f5f17d1c (patch) | |
tree | ff3ecf1a14ed2ce761894cc363d834fc81de5ec5 /gtk2_ardour/editor_summary.cc | |
parent | c158c44fab4d5cd0a6fade9213b262849d90dc31 (diff) |
Summary tweaks: plot tracks as well as regions (as suggested by Chris);
remove the restriction on maximum track height; represent empty editor
space in the summary.
git-svn-id: svn://localhost/ardour2/branches/3.0@7257 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_summary.cc')
-rw-r--r-- | gtk2_ardour/editor_summary.cc | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc index 5c2135ac43..f9a35c4462 100644 --- a/gtk2_ardour/editor_summary.cc +++ b/gtk2_ardour/editor_summary.cc @@ -143,39 +143,42 @@ EditorSummary::render (cairo_t* cr) _start = theoretical_start > 0 ? theoretical_start : 0; _end = _session->current_end_frame() + session_length * _overhang_fraction; - /* compute total height of all tracks */ - - int h = 0; - int max_height = 0; - for (TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { - int const t = (*i)->effective_height (); - h += t; - max_height = max (max_height, t); - } + /* compute x and y scale */ if (_end != _start) { _x_scale = static_cast<double> (_width) / (_end - _start); } else { _x_scale = 1; } - _y_scale = static_cast<double> (_height) / h; - /* tallest a region should ever be in the summary, in pixels */ - int const tallest_region_pixels = _height / 16; + double h = 0; + for (TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + h += (*i)->effective_height (); + } - if (max_height * _y_scale > tallest_region_pixels) { - _y_scale = static_cast<double> (tallest_region_pixels) / max_height; + double vh = _editor->canvas_height() - _editor->get_canvas_timebars_vsize(); + if (vh > h) { + _y_scale = _height / vh; + } else { + _y_scale = _height / h; } - /* render regions */ + /* render tracks and regions */ double y = 0; for (TrackViewList::const_iterator i = _editor->track_views.begin(); i != _editor->track_views.end(); ++i) { + + double const h = (*i)->effective_height () * _y_scale; + cairo_set_source_rgb (cr, 0.2, 0.2, 0.2); + cairo_set_line_width (cr, h - 2); + cairo_move_to (cr, 0, y + h / 2); + cairo_line_to (cr, _width, y + h / 2); + cairo_stroke (cr); + StreamView* s = (*i)->view (); if (s) { - double const h = (*i)->effective_height () * _y_scale; - cairo_set_line_width (cr, h); + cairo_set_line_width (cr, h * 0.6); s->foreach_regionview (sigc::bind ( sigc::mem_fun (*this, &EditorSummary::render_region), |