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

#include <RealFormat.h>

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

Public Member Functions

 ~RealFormat () 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 RealFormatLinearInstance ()
 
static const RealFormatLogInstance ()
 

Private Member Functions

 RealFormat (bool log)
 

Private Attributes

const bool mLog
 

Additional Inherited Members

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

Detailed Description

Definition at line 18 of file RealFormat.h.

Constructor & Destructor Documentation

◆ ~RealFormat()

RealFormat::~RealFormat ( )
overridedefault

◆ RealFormat()

RealFormat::RealFormat ( bool  log)
inlineprivate

Definition at line 34 of file RealFormat.h.

34: mLog{ log } {}
const bool mLog
Definition: RealFormat.h:35

Member Function Documentation

◆ LinearInstance()

const RealFormat & RealFormat::LinearInstance ( )
static

Definition at line 14 of file RealFormat.cpp.

15{
16 static RealFormat instance{ false };
17 return instance;
18}

Referenced by SpectrumVRulerControls::DoUpdateVRuler(), WaveformVRulerControls::DoUpdateVRuler(), FrequencyPlotDialog::DrawPlot(), FrequencyPlotDialog::Populate(), anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), WaveChannelVRulerControls::ScratchRuler(), MeterPanel::SetActiveStyle(), TimeFormat::SetTickSizes(), NoteTrackVRulerControls::UpdateRuler(), and TimeTrackVRulerControls::UpdateRuler().

Here is the caller graph for this function:

◆ LogInstance()

const RealFormat & RealFormat::LogInstance ( )
static

Definition at line 20 of file RealFormat.cpp.

21{
22 static RealFormat instance{ true };
23 return instance;
24}

Referenced by WaveformVRulerControls::DoUpdateVRuler(), and TimeTrackVRulerControls::UpdateRuler().

Here is the caller graph for this function:

◆ SetLabelString()

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

Implements RulerFormat.

Definition at line 60 of file RealFormat.cpp.

63{
64 // Replace -0 with 0
65 if (d < 0.0 && (d + minor > 0.0) && !mLog)
66 d = 0.0;
67 if (minor >= 1.0)
68 s.Printf(wxT("%d"), (int)floor(d + 0.5));
69 else {
70 s.Printf(wxString::Format(wxT("%%.%df"), mDigits), d);
71 }
72}
wxT("CloseDown"))

References mLog, and wxT().

Here is the call graph for this function:

◆ SetTickSizes()

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

Implements RulerFormat.

Definition at line 26 of file RealFormat.cpp.

30{
31 double d = 0.000001;
32 mDigits = 6;
33 for (;;) {
34 if (units < d) {
35 minor = d;
36 major = d * 5.0;
37 return;
38 }
39 d *= 5.0;
40 if (units < d) {
41 minor = d;
42 major = d * 2.0;
43 return;
44 }
45 d *= 2.0;
46 mDigits--;
47 // More than 10 digit numbers? Something is badly wrong.
48 // Probably units is coming in with too high a value.
49 wxASSERT(mDigits >= -10);
50 if (mDigits < -10)
51 break;
52 }
53 if (mLog) {
54 mDigits++;
55 }
56 minor = d;
57 major = d * 2.0;
58}

References mLog.

Referenced by TimeFormat::SetTickSizes().

Here is the caller graph for this function:

Member Data Documentation

◆ mLog

const bool RealFormat::mLog
private

Definition at line 35 of file RealFormat.h.

Referenced by SetLabelString(), and SetTickSizes().


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