Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
LadspaEffectMeter Class Referencefinal
Inheritance diagram for LadspaEffectMeter:
[legend]
Collaboration diagram for LadspaEffectMeter:
[legend]

Public Member Functions

 LadspaEffectMeter (wxWindow *parent, const float &val, float min, float max)
 
void Disconnect ()
 
virtual ~LadspaEffectMeter ()
 

Private Member Functions

void OnErase (wxEraseEvent &evt)
 
void OnPaint (wxPaintEvent &evt)
 
void OnIdle (wxIdleEvent &evt)
 
void OnSize (wxSizeEvent &evt)
 

Private Attributes

bool mConnected { true }
 
const float & mVal
 
float mMin
 
float mMax
 
float mLastValue
 

Detailed Description

Definition at line 48 of file LadspaEditor.cpp.

Constructor & Destructor Documentation

◆ LadspaEffectMeter()

LadspaEffectMeter::LadspaEffectMeter ( wxWindow *  parent,
const float &  val,
float  min,
float  max 
)

Definition at line 84 of file LadspaEditor.cpp.

85: wxWindow{ parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
86 wxSIMPLE_BORDER },
87 mVal(val)
88{
89 mMin = min;
90 mMax = max;
92 SetBackgroundColour(*wxWHITE);
93 SetMinSize({ 20, 20 });
94}
int min(int a, int b)
const float & mVal

◆ ~LadspaEffectMeter()

LadspaEffectMeter::~LadspaEffectMeter ( )
virtual

Definition at line 96 of file LadspaEditor.cpp.

97{
98}

Member Function Documentation

◆ Disconnect()

void LadspaEffectMeter::Disconnect ( )
inline

Definition at line 53 of file LadspaEditor.cpp.

54 {
55 // Stop using mVal, it might be dangling now
56 mConnected = false;
57 }

References mConnected.

◆ OnErase()

void LadspaEffectMeter::OnErase ( wxEraseEvent &  evt)
private

Definition at line 109 of file LadspaEditor.cpp.

110{
111 // Just ignore it to prevent flashing
112}

◆ OnIdle()

void LadspaEffectMeter::OnIdle ( wxIdleEvent &  evt)
private

Definition at line 100 of file LadspaEditor.cpp.

101{
102 evt.Skip();
103 if (!mConnected)
104 return;
105 if (mLastValue != mVal)
106 Refresh(false);
107}

References mConnected, mLastValue, and mVal.

◆ OnPaint()

void LadspaEffectMeter::OnPaint ( wxPaintEvent &  evt)
private

Definition at line 114 of file LadspaEditor.cpp.

115{
116 if (!mConnected)
117 return;
118
119 wxPaintDC dc(this);
120
121 // Cache some metrics
122 wxRect r = GetClientRect();
123 wxCoord x = r.GetLeft();
124 wxCoord y = r.GetTop();
125 wxCoord w = r.GetWidth();
126 wxCoord h = r.GetHeight();
127
128 // These use unscaled value, min, and max
129 float val = mVal;
130 if (val > mMax)
131 val = mMax;
132 if (val < mMin)
133 val = mMin;
134 val -= mMin;
135
136 // Setup for erasing the background
137 dc.SetPen(*wxTRANSPARENT_PEN);
138 dc.SetBrush(wxColour(100, 100, 220));
139 dc.Clear();
140 dc.DrawRectangle(x, y, (w * (val / fabs(mMax - mMin))), h);
141
143}

References mConnected, mLastValue, mMax, mMin, and mVal.

◆ OnSize()

void LadspaEffectMeter::OnSize ( wxSizeEvent &  evt)
private

Definition at line 145 of file LadspaEditor.cpp.

146{
147 Refresh(false);
148}

Member Data Documentation

◆ mConnected

bool LadspaEffectMeter::mConnected { true }
private

Definition at line 68 of file LadspaEditor.cpp.

Referenced by Disconnect(), OnIdle(), and OnPaint().

◆ mLastValue

float LadspaEffectMeter::mLastValue
private

Definition at line 72 of file LadspaEditor.cpp.

Referenced by OnIdle(), and OnPaint().

◆ mMax

float LadspaEffectMeter::mMax
private

Definition at line 71 of file LadspaEditor.cpp.

Referenced by OnPaint().

◆ mMin

float LadspaEffectMeter::mMin
private

Definition at line 70 of file LadspaEditor.cpp.

Referenced by OnPaint().

◆ mVal

const float& LadspaEffectMeter::mVal
private

Definition at line 69 of file LadspaEditor.cpp.

Referenced by OnIdle(), and OnPaint().


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