From 69ee24c22b7661a95f4a696b99fc2de2317d7a41 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 2 May 2022 12:02:04 -0600 Subject: [PATCH] editor: improved handling of tempo map changes This splits apart the actual signal handler from the work that needs to be done to update the GUI in response to a tempo map change. This allows us to do the visual update when we are manipulating the thread-local write copy of the map during e.g. a drag operation. --- gtk2_ardour/editor.h | 1 + gtk2_ardour/editor_tempodisplay.cc | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 189e8c8c28..73ea53b4b8 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1875,6 +1875,7 @@ private: void update_tempo_curves (double min_tempo, double max_tempo, samplecnt_t sr); void tempo_map_changed (); + void tempo_map_visual_update (); void redisplay_grid (bool immediate_redraw); diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index f8678681c1..77d5b48822 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -449,12 +449,19 @@ Editor::update_tempo_curves (double min_tempo, double max_tempo, samplecnt_t sr) void Editor::tempo_map_changed () +{ + TempoMap::fetch (); + tempo_map_visual_update (); +} + +void +Editor::tempo_map_visual_update () { TempoMap::Metrics metrics; - TempoMap::fetch()->get_metrics (metrics); + TempoMap::use()->get_metrics (metrics); draw_metric_marks (metrics); - compute_bbt_ruler_scale (_leftmost_sample, _leftmost_sample + current_page_samples()); + draw_tempo_marks (); update_tempo_based_rulers (); maybe_draw_grid_lines (); } @@ -839,5 +846,7 @@ void Editor::mid_tempo_change () { std::cerr << "============== MID TEMPO\n"; - draw_tempo_marks (); + TempoMap::SharedPtr map (TempoMap::use()); + map->dump (std::cerr); + tempo_map_visual_update (); }