Fix fit tracks

The track-height change needs to be applied so that
vertical_adjustment max range is set correctly.
Otherwise vertical_adjustment.set_value() may fail
or scroll to the wrong position.

In 5b3eacd421 `redisplay_track_views()` was moved from
EditorRoutes to Editor. The call was delegated to the idle
thread, potentially collecting multiple calls before performing
the update.

This resulted in "Fit selection" to set the y-offset before the
height-change was applied.
This commit is contained in:
Robin Gareus 2022-01-27 19:56:10 +01:00
parent 15f0e4dbbf
commit 5cebd64924
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 28 additions and 1 deletions

View File

@ -5600,6 +5600,22 @@ Editor::queue_redisplay_track_views ()
}
}
void
Editor::process_redisplay_track_views ()
{
if (_tvl_redisplay_connection.connected ()) {
_tvl_redisplay_connection.disconnect ();
redisplay_track_views ();
}
}
void
Editor::redisplay_track_views_now ()
{
_tvl_redisplay_connection.disconnect ();
redisplay_track_views ();
}
void
Editor::resume_route_redisplay ()
{
@ -5882,6 +5898,8 @@ Editor::redisplay_track_views ()
return false;
}
_tvl_redisplay_on_resume = false;
TrackViewStripableSorter cmp;
track_views.sort (cmp);

View File

@ -1236,8 +1236,11 @@ private:
TrackViewList get_tracks_for_range_action () const;
Gtk::VBox list_vpacker;
void queue_redisplay_track_views ();
bool redisplay_track_views ();
void process_redisplay_track_views ();
void redisplay_track_views_now ();
bool redisplay_track_views (); // do not call this directly, use above wrappers
bool _tvl_no_redisplay;
bool _tvl_redisplay_on_resume;

View File

@ -957,6 +957,9 @@ Editor::ensure_time_axis_view_is_visible (TimeAxisView const & track, bool at_to
return;
}
/* apply any pending [height] changes */
process_redisplay_track_views ();
/* compute visible area of trackview group, as offsets from top of
* trackview group.
*/

View File

@ -8506,6 +8506,9 @@ Editor::fit_tracks (TrackViewList & tracks)
}
}
/* apply height changes, so that scrolling works */
process_redisplay_track_views ();
/*
set the controls_layout height now, because waiting for its size
request signal handler will cause the vertical adjustment setting to fail