Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
LinearDBFormat Class Referencefinal

#include <LinearDBFormat.h>

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

Public Member Functions

 ~LinearDBFormat () override
 
void SetTickSizes (double units, double &major, double &minor, double &minorMinor, int &mDigits) const override
 
void SetLabelString (wxString &s, double d, double units, double minor, int mDigits, TickType tickType) const override
 
- Public Member Functions inherited from RulerFormat
 RulerFormat ()
 
virtual ~RulerFormat ()
 
virtual void SetTickSizes (double units, double &major, double &minor, double &minorMinor, int &mDigits) const =0
 
virtual void SetLabelString (wxString &s, double d, double units, double minor, int mDigits, TickType tickType) const =0
 

Static Public Member Functions

static const LinearDBFormatInstance ()
 

Private Member Functions

 RulerFormat ()
 

Additional Inherited Members

- Public Types inherited from RulerFormat
enum  TickType { t_major , t_minor , t_minorMinor }
 

Detailed Description

Definition at line 17 of file LinearDBFormat.h.

Constructor & Destructor Documentation

◆ ~LinearDBFormat()

LinearDBFormat::~LinearDBFormat ( )
overridedefault

Member Function Documentation

◆ Instance()

const LinearDBFormat & LinearDBFormat::Instance ( )
static

Definition at line 14 of file LinearDBFormat.cpp.

15{
16 static LinearDBFormat instance;
17 return instance;
18}

Referenced by FrequencyPlotDialog::DrawPlot(), anonymous_namespace{DynamicRangeProcessorEditor.cpp}::MakeRulerPanel(), EffectLegacyCompressorPanel::OnPaint(), FrequencyPlotDialog::Populate(), EqualizationUI::PopulateOrExchange(), EffectScienFilter::PopulateOrExchange(), and MeterPanel::SetActiveStyle().

Here is the caller graph for this function:

◆ RulerFormat()

RulerFormat::RulerFormat ( )
inlineexplicitprivate

Definition at line 22 of file RulerFormat.h.

22{}

◆ SetLabelString()

void LinearDBFormat::SetLabelString ( wxString &  s,
double  d,
double  units,
double  minor,
int  mDigits,
TickType  tickType 
) const
overridevirtual

Implements RulerFormat.

Definition at line 82 of file LinearDBFormat.cpp.

85{
86 // Replace -0 with 0
87 if (d < 0.0 && (d + mMinor > 0.0))
88 d = 0.0;
89 if (mMinor >= 1.0)
90 s.Printf(wxT("%d"), (int)floor(d + 0.5));
91 else {
92 int precision = -log10(mMinor);
93 s.Printf(wxT("%.*f"), precision, d);
94 }
95}
wxT("CloseDown"))

References wxT().

Here is the call graph for this function:

◆ SetTickSizes()

void LinearDBFormat::SetTickSizes ( double  units,
double &  major,
double &  minor,
double &  minorMinor,
int &  mDigits 
) const
overridevirtual

Implements RulerFormat.

Definition at line 20 of file LinearDBFormat.cpp.

24{
25 if (units < 0.001) {
26 minor = 0.001;
27 major = 0.005;
28 return;
29 }
30 if (units < 0.01) {
31 minor = 0.01;
32 major = 0.05;
33 return;
34 }
35 if (units < 0.1) {
36 minor = 0.1;
37 major = 0.5;
38 return;
39 }
40 if (units < 1.0) {
41 minor = 1.0;
42 major = 6.0;
43 return;
44 }
45 if (units < 3.0) {
46 minor = 3.0;
47 major = 12.0;
48 return;
49 }
50 if (units < 6.0) {
51 minor = 6.0;
52 major = 24.0;
53 return;
54 }
55 if (units < 12.0) {
56 minor = 12.0;
57 major = 48.0;
58 return;
59 }
60 if (units < 24.0) {
61 minor = 24.0;
62 major = 96.0;
63 return;
64 }
65 double d = 20.0;
66 for (;;) {
67 if (units < d) {
68 minor = d;
69 major = d * 5.0;
70 return;
71 }
72 d *= 5.0;
73 if (units < d) {
74 minor = d;
75 major = d * 5.0;
76 return;
77 }
78 d *= 2.0;
79 }
80}

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