15#include "../../AdornedRulerPanel.h"
21#include "../../ProjectAudioManager.h"
22#include "../../ProjectWindow.h"
25#include "../../TrackPanel.h"
35 template <
class LOW,
class MID,
class HIGH >
38 return (m >= l && m < h);
63 wxCoord xx,
bool playing)
66 playing ? bmpPlayPointer : bmpRecordPointer
68 const int IndicatorHalfWidth = bmp.GetWidth() / 2;
70 { xx - IndicatorHalfWidth - 1,
83 bool rec = gAudioIO->IsCapturing();
86 width = pair.second.GetWidth();
90 wxRect rect( xx, 0, width,
size.GetHeight());
103 bool rec = gAudioIO->IsCapturing();
111 ruler.UpdateButtonStates();
120 if(
auto tp =
dynamic_cast<TrackPanel*
>(&panel)) {
129 dc.DrawBitmap( pair.second, pair.first.x, pair.first.y );
137 auto result = std::make_shared< PlayIndicatorOverlay >( &parent );
160 auto width = viewInfo.GetTracksUsableWidth();
166 if (scrubber.HasMark()) {
167 auto position = scrubber.GetScrubStartPosition();
168 const auto offset = viewInfo.GetLeftOffset();
169 if(position >= viewInfo.GetLeftOffset() &&
170 position < offset + width)
177 auto &scroller = window.GetPlaybackScroller();
179 const double playPos = scroller.GetRecentStreamTime();
182 const Mode mode = scroller.GetMode();
183 const bool pinned = ( mode == Mode::Pinned || mode == Mode::Right );
187 const auto tolerance = pinned
190 bool onScreen = playPos >= 0.0 &&
193 viewInfo.GetScreenEndTime() + tolerance);
199 if( viewInfo.bUpdateTrackIndicator &&
200 playPos >= 0 && !onScreen ) {
206 !gAudioIO->IsPaused() &&
211 (!scrubber.IsScrubbing() || !scrubber.IsPaused())
214 auto newPos = playPos;
215 if (playPos < viewInfo.hpos) {
220 newPos = viewInfo.OffsetTimeByPixels( newPos, -width );
221 newPos = std::max(newPos, viewport.ScrollingLowerBoundTime());
223 viewport.SetHorizontalThumb(newPos);
225 onScreen = playPos >= 0.0 &&
228 viewInfo.GetScreenEndTime());
235 viewport.UpdateScrollbarsForTracks();
239 viewInfo.TimeToPosition(playPos, viewInfo.GetLeftOffset());
static const AudacityProject::AttachedObjects::RegisteredFactory sOverlayKey
constexpr auto kTimerInterval
declares abstract base class Track, TrackList, and iterators over TrackList
static void IndicatorColor(wxDC *dc, bool bIsNotRecording)
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
This is an Audacity Specific ruler panel which additionally has border, selection markers,...
wxRect GetInnerRect() const
static AdornedRulerPanel & Get(AudacityProject &project)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
void AddOverlay(const std::weak_ptr< Overlay > &pOverlay)
void Draw(OverlayPanel &panel, wxDC &dc) override
std::pair< wxRect, bool > DoGetRectangle(wxSize size) override
PlayIndicatorOverlayBase(AudacityProject *project, bool isMaster)
unsigned SequenceNumber() const override
This number determines an ordering of overlays, so that those with higher numbers overpaint those wit...
virtual ~PlayIndicatorOverlayBase()
AudacityProject *const mProject
Observer::Subscription mSubscription
PlayIndicatorOverlay(AudacityProject *project)
std::shared_ptr< PlayIndicatorOverlayBase > mPartner
void OnTimer(Observer::Message)
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectAudioManager & Get(AudacityProject &project)
PlayMode GetLastPlayMode() const
PlaybackScroller & GetPlaybackScroller()
static ProjectWindow & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
wxBitmap & Bitmap(int iIndex)
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
static TrackPanel & Get(AudacityProject &project)
static ViewInfo & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
bool between_incexc(LOW l, MID m, HIGH h)
std::pair< wxPoint, wxBitmap > GetIndicatorBitmap(AudacityProject &project, wxCoord xx, bool playing)
Default message type for Publisher.