13
0

Fix 8061 (partly): Don't scroll down if no further tracks to scroll to

The issue remains if a track is selected by a "fit-selection" action second
last track covers the whole trackview. Then when scrolling one track up, the
huge track disappears and a smaller track follows, that covers a lot less
space.

-> Proper redraw of the track view is still needed.
This commit is contained in:
Johannes Mueller 2020-04-27 21:14:30 +02:00
parent 24d3bf25a9
commit 81cbf36c56

View File

@ -1462,6 +1462,8 @@ Editor::select_topmost_track ()
bool
Editor::scroll_down_one_track (bool skip_child_views)
{
uint32_t needed_height = 0;
TrackViewList::reverse_iterator next = track_views.rend();
const double top_of_trackviews = vertical_adjustment.get_value();
@ -1470,6 +1472,8 @@ Editor::scroll_down_one_track (bool skip_child_views)
continue;
}
needed_height += (*t)->effective_height();
/* If this is the upper-most visible trackview, we want to display
* the one above it (next)
*
@ -1491,10 +1495,13 @@ Editor::scroll_down_one_track (bool skip_child_views)
TimeAxisView::Children kids = (*t)->get_child_list();
TimeAxisView::Children::reverse_iterator nkid = kids.rend();
uint32_t needed_for_kids = 0;
for (TimeAxisView::Children::reverse_iterator ci = kids.rbegin(); ci != kids.rend(); ++ci) {
if ((*ci)->hidden()) {
continue;
}
needed_for_kids += (*ci)->current_height();
std::pair<TimeAxisView*,double> dev;
dev = (*ci)->covers_y_position (top_of_trackviews);
@ -1506,12 +1513,15 @@ Editor::scroll_down_one_track (bool skip_child_views)
*/
nkid = kids.rend();
}
needed_height -= (*t)->effective_height();
needed_height += needed_for_kids;
break;
}
nkid = ci;
}
if (nkid != kids.rend()) {
if (nkid != kids.rend() && needed_height > trackviews_height()) {
ensure_time_axis_view_is_visible (**nkid, true);
return true;
}
@ -1522,7 +1532,7 @@ Editor::scroll_down_one_track (bool skip_child_views)
/* move to the track below the first one that covers the */
if (next != track_views.rend()) {
if (next != track_views.rend() && needed_height > trackviews_height()) {
ensure_time_axis_view_is_visible (**next, true);
return true;
}