Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
FreqGauge Class Referencefinal

#include <FreqWindow.h>

Inheritance diagram for FreqGauge:

Public Member Functions

 FreqGauge (wxWindow *parent, wxWindowID winid)
 
void SetRange (int range, int bar=12, int gap=3)
 
void SetValue (int value)
 
void Reset ()
 

Private Attributes

wxRect mRect
 
int mRange
 
int mCur
 
int mLast
 
int mInterval
 
int mBar
 
int mGap
 
int mMargin
 

Detailed Description

Definition at line 86 of file FreqWindow.h.

Constructor & Destructor Documentation

FreqGauge::FreqGauge ( wxWindow *  parent,
wxWindowID  winid 
)

Definition at line 1150 of file FreqWindow.cpp.

References mRange.

1151 : wxStatusBar(parent, winid, wxST_SIZEGRIP)
1152 {
1153  mRange = 0;
1154 }
int mRange
Definition: FreqWindow.h:97

Member Function Documentation

void FreqGauge::Reset ( )

Definition at line 1193 of file FreqWindow.cpp.

References mRange.

Referenced by SpectrumAnalyst::Calculate().

1194 {
1195  mRange = 0;
1196  Refresh(true);
1197 }
int mRange
Definition: FreqWindow.h:97
void FreqGauge::SetRange ( int  range,
int  bar = 12,
int  gap = 3 
)

Definition at line 1156 of file FreqWindow.cpp.

References gap, mBar, mGap, mInterval, mLast, mMargin, mRange, and mRect.

Referenced by SpectrumAnalyst::Calculate().

1157 {
1158  mRange = range;
1159  mBar = bar;
1160  mGap = gap;
1161 
1162  GetFieldRect(0, mRect);
1163  mRect.Inflate(-1);
1164 
1165  mInterval = mRange / (mRect.width / (mBar + mGap));
1166  mRect.width = mBar;
1167  mMargin = mRect.x;
1168  mLast = -1;
1169 
1170  Update();
1171 }
int mRange
Definition: FreqWindow.h:97
int mMargin
Definition: FreqWindow.h:103
int mInterval
Definition: FreqWindow.h:100
wxRect mRect
Definition: FreqWindow.h:96
static const int gap
Definition: Meter.cpp:176
int mLast
Definition: FreqWindow.h:99
void FreqGauge::SetValue ( int  value)

Definition at line 1173 of file FreqWindow.cpp.

References mBar, mCur, mGap, mInterval, mLast, mMargin, and mRect.

Referenced by SpectrumAnalyst::Calculate().

1174 {
1175  mCur = value / mInterval;
1176 
1177  if (mCur != mLast)
1178  {
1179  wxClientDC dc(this);
1180  dc.SetPen(*wxTRANSPARENT_PEN);
1181  dc.SetBrush(wxColour(100, 100, 220));
1182 
1183  while (mLast < mCur)
1184  {
1185  mLast++;
1186  mRect.x = mMargin + mLast * (mBar + mGap);
1187  dc.DrawRectangle(mRect);
1188  }
1189  Update();
1190  }
1191 }
int mMargin
Definition: FreqWindow.h:103
int mInterval
Definition: FreqWindow.h:100
wxRect mRect
Definition: FreqWindow.h:96
int mCur
Definition: FreqWindow.h:98
int mLast
Definition: FreqWindow.h:99

Member Data Documentation

int FreqGauge::mBar
private

Definition at line 101 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().

int FreqGauge::mCur
private

Definition at line 98 of file FreqWindow.h.

Referenced by SetValue().

int FreqGauge::mGap
private

Definition at line 102 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().

int FreqGauge::mInterval
private

Definition at line 100 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().

int FreqGauge::mLast
private

Definition at line 99 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().

int FreqGauge::mMargin
private

Definition at line 103 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().

int FreqGauge::mRange
private

Definition at line 97 of file FreqWindow.h.

Referenced by FreqGauge(), Reset(), and SetRange().

wxRect FreqGauge::mRect
private

Definition at line 96 of file FreqWindow.h.

Referenced by SetRange(), and SetValue().


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