diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-09 09:08:51 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-09 09:08:51 -0400 |
commit | 0c5dae881c41dec399c7bfeb4c1c25b209122c5c (patch) | |
tree | 7631a14a209bead794db00c5aa190b9e9b2fe2d8 /gtk2_ardour | |
parent | f0c18abf55a19c101bd2c4f9bccbe182df060b25 (diff) |
fix up fit-selected-tracks so that we are filling the trackview area, not the entire canvas (which now includes rulers)
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 0c689452de..db871744f3 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6860,7 +6860,13 @@ Editor::fit_tracks (TrackViewList & 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; if (h < TimeAxisView::preset_height (HeightSmall)) { @@ -6885,9 +6891,7 @@ Editor::fit_tracks (TrackViewList & tracks) /* operate on all tracks, hide unselected ones that are in the middle of selected ones */ - bool prev_was_selected = false; - bool is_selected = tracks.contains (all.front()); - bool next_is_selected; + bool within_selected = false; for (TrackViewList::iterator t = all.begin(); t != all.end(); ++t) { @@ -6895,26 +6899,16 @@ Editor::fit_tracks (TrackViewList & tracks) next = t; ++next; - - if (next != all.end()) { - next_is_selected = tracks.contains (*next); - } else { - next_is_selected = false; - } - + if ((*t)->marked_for_display ()) { - if (is_selected) { + if (tracks.contains (*t)) { (*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); - } + within_selected = true; + } else if (within_selected) { + hide_track_in_display (*t); } } - - prev_was_selected = is_selected; - is_selected = next_is_selected; } /* |