Audacity 3.2.0
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ClipIndicatorPanel Class Referencefinal

#include <ClipIndicatorPanel.h>

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

Public Member Functions

 ClipIndicatorPanel (wxWindow *parent, int id)
 
void SetClipped ()
 
void Reset ()
 
- Public Member Functions inherited from wxPanelWrapper
 wxPanelWrapper ()
 
 wxPanelWrapper (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
bool Create (wxWindow *parent, wxWindowID winid=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL|wxNO_BORDER, const TranslatableString &name=XO("Panel"))
 
void SetLabel (const TranslatableString &label)
 
void SetName (const TranslatableString &name)
 
void SetToolTip (const TranslatableString &toolTip)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxPanel >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Protected Member Functions

 DECLARE_EVENT_TABLE ()
 

Private Member Functions

void OnPaint (wxPaintEvent &evt)
 

Private Attributes

const Observer::Subscription mPlaybackStartStopSubscription
 
bool mClipping = false
 

Detailed Description

Definition at line 19 of file ClipIndicatorPanel.h.

Constructor & Destructor Documentation

◆ ClipIndicatorPanel()

ClipIndicatorPanel::ClipIndicatorPanel ( wxWindow *  parent,
int  id 
)

Audacity: A Digital Audio Editor

ClipIndicatorPanel.cpp

Matthieu Hodgkinson

Definition at line 20 of file ClipIndicatorPanel.cpp.

21 : wxPanelWrapper { parent, id }
23 [this](const AudioIOEvent& evt) {
24 if (evt.type == AudioIOEvent::PLAYBACK && evt.on)
25 Reset();
26 }) }
27{
28}
static AudioIO * Get()
Definition: AudioIO.cpp:126
const Observer::Subscription mPlaybackStartStopSubscription
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
bool on
Definition: AudioIO.h:68
enum AudioIOEvent::Type type

Member Function Documentation

◆ DECLARE_EVENT_TABLE()

ClipIndicatorPanel::DECLARE_EVENT_TABLE ( )
protected

◆ OnPaint()

void ClipIndicatorPanel::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 42 of file ClipIndicatorPanel.cpp.

43{
44 using namespace DynamicRangeProcessorPanel;
45
46 wxPaintDC dc { this };
47 const auto color = mClipping ? *wxRED : *wxLIGHT_GREY;
48 dc.SetBrush(color);
49 dc.SetPen(lineColor);
50 auto rect = GetPanelRect(*this);
51 dc.DrawRoundedRectangle(rect, 2);
52
53 // This is supposed to be a LED. Add a little shine.
54 dc.SetBrush(GetColorMix(*wxWHITE, color, 0.5));
55 dc.SetPen(*wxTRANSPARENT_PEN);
56 dc.DrawRoundedRectangle(rect.Deflate(2), 2);
57}
wxColor GetColorMix(const wxColor &a, const wxColor &b, double aWeight)
wxRect GetPanelRect(const wxPanelWrapper &panel)

References DynamicRangeProcessorPanel::GetColorMix(), DynamicRangeProcessorPanel::GetPanelRect(), DynamicRangeProcessorPanel::lineColor, and mClipping.

Here is the call graph for this function:

◆ Reset()

void ClipIndicatorPanel::Reset ( )

Definition at line 36 of file ClipIndicatorPanel.cpp.

37{
38 mClipping = false;
39 Refresh();
40}

References mClipping.

◆ SetClipped()

void ClipIndicatorPanel::SetClipped ( )

Definition at line 30 of file ClipIndicatorPanel.cpp.

31{
32 mClipping = true;
33 Refresh();
34}

References mClipping.

Member Data Documentation

◆ mClipping

bool ClipIndicatorPanel::mClipping = false
private

Definition at line 33 of file ClipIndicatorPanel.h.

Referenced by OnPaint(), Reset(), and SetClipped().

◆ mPlaybackStartStopSubscription

const Observer::Subscription ClipIndicatorPanel::mPlaybackStartStopSubscription
private

Definition at line 32 of file ClipIndicatorPanel.h.


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