151{
152
157 }
158
160 auto width = viewInfo.GetTracksUsableWidth();
161
166 if (scrubber.HasMark()) {
167 auto position = scrubber.GetScrubStartPosition();
168 const auto offset = viewInfo.GetLeftOffset();
169 if(position >= viewInfo.GetLeftOffset() &&
170 position < offset + width)
172 }
173 }
174 else {
177 auto &scroller = window.GetPlaybackScroller();
178
179 const double playPos = scroller.GetRecentStreamTime();
180
182 const Mode mode = scroller.GetMode();
183 const bool pinned = ( mode == Mode::Pinned || mode == Mode::Right );
184
185
186
187 const auto tolerance = pinned
189 : 0;
190 bool onScreen = playPos >= 0.0 &&
192 playPos,
193 viewInfo.GetScreenEndTime() + tolerance);
194
197
198
199 if( viewInfo.bUpdateTrackIndicator &&
200 playPos >= 0 && !onScreen ) {
201
202
204 if (!pinned &&
206 !gAudioIO->IsPaused() &&
207
208
209
210
211 (!scrubber.IsScrubbing() || !scrubber.IsPaused())
212 )
213 {
214 auto newPos = playPos;
215 if (playPos < viewInfo.hpos) {
216
217
218
219
220 newPos = viewInfo.OffsetTimeByPixels( newPos, -width );
221 newPos = std::max(newPos, viewport.ScrollingLowerBoundTime());
222 }
223 viewport.SetHorizontalThumb(newPos);
224
225 onScreen = playPos >= 0.0 &&
227 playPos,
228 viewInfo.GetScreenEndTime());
229 }
230 }
231
232
233
234
235 viewport.UpdateScrollbarsForTracks();
236
237 if (onScreen)
239 viewInfo.TimeToPosition(playPos, viewInfo.GetLeftOffset());
240 else
242
244 }
245
248}
constexpr auto kTimerInterval
static AdornedRulerPanel & Get(AudacityProject &project)
std::shared_ptr< PlayIndicatorOverlayBase > mPartner
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectAudioManager & Get(AudacityProject &project)
PlayMode GetLastPlayMode() const
static Scrubber & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
bool between_incexc(LOW l, MID m, HIGH h)