Audacity 3.2.0
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
PlayIndicatorOverlayBase Class Reference

#include <PlayIndicatorOverlay.h>

Inheritance diagram for PlayIndicatorOverlayBase:
[legend]
Collaboration diagram for PlayIndicatorOverlayBase:
[legend]

Public Member Functions

 PlayIndicatorOverlayBase (AudacityProject *project, bool isMaster)
 
virtual ~PlayIndicatorOverlayBase ()
 
void Update (int newIndicatorX)
 
- Public Member Functions inherited from Overlay
 Overlay ()=default
 
 Overlay (const Overlay &)=delete
 
Overlayoperator= (const Overlay &)=delete
 
virtual ~Overlay ()=0
 
virtual unsigned SequenceNumber () const =0
 This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect. More...
 
std::pair< wxRect, bool > GetRectangle (wxSize size)
 
virtual std::pair< wxRect, bool > DoGetRectangle (wxSize size)=0
 
virtual void Erase (wxDC &dc, wxDC &src)
 
virtual void Draw (OverlayPanel &panel, wxDC &dc)=0
 
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()
 

Protected Attributes

AudacityProject *const mProject
 
const bool mIsMaster
 
int mLastIndicatorX { -1 }
 
int mNewIndicatorX { -1 }
 
bool mNewIsCapturing { false }
 
bool mLastIsCapturing { false }
 

Private Member Functions

unsigned SequenceNumber () const override
 This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect. More...
 
std::pair< wxRect, bool > DoGetRectangle (wxSize size) override
 
void Draw (OverlayPanel &panel, wxDC &dc) override
 

Detailed Description

Definition at line 23 of file PlayIndicatorOverlay.h.

Constructor & Destructor Documentation

◆ PlayIndicatorOverlayBase()

PlayIndicatorOverlayBase::PlayIndicatorOverlayBase ( AudacityProject project,
bool  isMaster 
)

Definition at line 44 of file PlayIndicatorOverlay.cpp.

46, mIsMaster(isMaster)
47{
48}
const auto project
AudacityProject *const mProject

◆ ~PlayIndicatorOverlayBase()

PlayIndicatorOverlayBase::~PlayIndicatorOverlayBase ( )
virtual

Definition at line 50 of file PlayIndicatorOverlay.cpp.

51{
52}

Member Function Documentation

◆ DoGetRectangle()

std::pair< wxRect, bool > PlayIndicatorOverlayBase::DoGetRectangle ( wxSize  size)
overrideprivatevirtual

Implements Overlay.

Definition at line 77 of file PlayIndicatorOverlay.cpp.

78{
79 wxCoord width = 1, xx = mLastIndicatorX;
80
81 if ( !mIsMaster ) {
82 auto gAudioIO = AudioIO::Get();
83 bool rec = gAudioIO->IsCapturing();
84 auto pair = GetIndicatorBitmap( *mProject, xx, !rec );
85 xx = pair.first.x;
86 width = pair.second.GetWidth();
87 }
88
89 // May be excessive height, but little matter
90 wxRect rect( xx, 0, width, size.GetHeight());
91 return {
92 rect,
95 };
96}
static AudioIO * Get()
Definition: AudioIO.cpp:126
std::pair< wxPoint, wxBitmap > GetIndicatorBitmap(AudacityProject &project, wxCoord xx, bool playing)

References AudioIO::Get(), anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap(), mIsMaster, mLastIndicatorX, mLastIsCapturing, mNewIndicatorX, mNewIsCapturing, mProject, and size.

Here is the call graph for this function:

◆ Draw()

void PlayIndicatorOverlayBase::Draw ( OverlayPanel panel,
wxDC &  dc 
)
overrideprivatevirtual

Implements Overlay.

Definition at line 99 of file PlayIndicatorOverlay.cpp.

100{
101 // Set play/record color
102 auto gAudioIO = AudioIO::Get();
103 bool rec = gAudioIO->IsCapturing();
104 AColor::IndicatorColor(&dc, !rec);
105
106 if (mIsMaster
108 // Detect transition to recording during punch and roll; make ruler
109 // change its button color too
111 ruler.UpdateButtonStates();
112 ruler.Refresh();
113 }
115
117 if (!between_incexc(0, mLastIndicatorX, dc.GetSize().GetWidth()))
118 return;
119
120 if(auto tp = dynamic_cast<TrackPanel*>(&panel)) {
121 wxASSERT(mIsMaster);
122
123 AColor::Line(dc, mLastIndicatorX, 0, mLastIndicatorX, tp->GetSize().GetHeight());
124 }
125 else if(auto ruler = dynamic_cast<AdornedRulerPanel*>(&panel)) {
126 wxASSERT(!mIsMaster);
127
128 auto pair = GetIndicatorBitmap( *mProject, mLastIndicatorX, !rec );
129 dc.DrawBitmap( pair.second, pair.first.x, pair.first.y );
130 }
131 else
132 wxASSERT(false);
133}
static void IndicatorColor(wxDC *dc, bool bIsNotRecording)
Definition: AColor.cpp:446
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:194
This is an Audacity Specific ruler panel which additionally has border, selection markers,...
static AdornedRulerPanel & Get(AudacityProject &project)
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
Definition: TrackPanel.h:63

References anonymous_namespace{PlayIndicatorOverlay.cpp}::between_incexc(), AudioIO::Get(), AdornedRulerPanel::Get(), anonymous_namespace{PlayIndicatorOverlay.cpp}::GetIndicatorBitmap(), AColor::IndicatorColor(), AColor::Line(), mIsMaster, mLastIndicatorX, mLastIsCapturing, mNewIndicatorX, mNewIsCapturing, mProject, and anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler().

Here is the call graph for this function:

◆ SequenceNumber()

unsigned PlayIndicatorOverlayBase::SequenceNumber ( ) const
overrideprivatevirtual

This number determines an ordering of overlays, so that those with higher numbers overpaint those with lower numbers that intersect.

Implements Overlay.

Definition at line 54 of file PlayIndicatorOverlay.cpp.

55{
56 return 10;
57}

◆ Update()

void PlayIndicatorOverlayBase::Update ( int  newIndicatorX)
inline

Definition at line 31 of file PlayIndicatorOverlay.h.

31{ mNewIndicatorX = newIndicatorX; }

References mNewIndicatorX.

Member Data Documentation

◆ mIsMaster

const bool PlayIndicatorOverlayBase::mIsMaster
protected

Definition at line 41 of file PlayIndicatorOverlay.h.

Referenced by DoGetRectangle(), and Draw().

◆ mLastIndicatorX

int PlayIndicatorOverlayBase::mLastIndicatorX { -1 }
protected

Definition at line 42 of file PlayIndicatorOverlay.h.

Referenced by DoGetRectangle(), and Draw().

◆ mLastIsCapturing

bool PlayIndicatorOverlayBase::mLastIsCapturing { false }
protected

Definition at line 45 of file PlayIndicatorOverlay.h.

Referenced by DoGetRectangle(), and Draw().

◆ mNewIndicatorX

int PlayIndicatorOverlayBase::mNewIndicatorX { -1 }
protected

Definition at line 43 of file PlayIndicatorOverlay.h.

Referenced by DoGetRectangle(), Draw(), PlayIndicatorOverlay::OnTimer(), and Update().

◆ mNewIsCapturing

bool PlayIndicatorOverlayBase::mNewIsCapturing { false }
protected

Definition at line 44 of file PlayIndicatorOverlay.h.

Referenced by DoGetRectangle(), Draw(), and PlayIndicatorOverlay::OnTimer().

◆ mProject

AudacityProject* const PlayIndicatorOverlayBase::mProject
protected

The documentation for this class was generated from the following files: