Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
Settings Struct Reference
Inheritance diagram for Settings:
[legend]
Collaboration diagram for Settings:
[legend]

Public Member Functions

void UpdatePrefs () override
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Public Attributes

wxFont gFont
 
bool mInitialized { false }
 

Additional Inherited Members

- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 

Detailed Description

Definition at line 33 of file TrackInfo.cpp.

Member Function Documentation

◆ UpdatePrefs()

void Settings::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 38 of file TrackInfo.cpp.

39 {
40 // Calculation of best font size depends on language, so it should be redone in case
41 // the language preference changed.
42
43 // wxWidgets seems to need a window to do this portably.
44 if ( !wxTheApp )
45 return;
46 auto window = wxTheApp->GetTopWindow();
47 if ( !window )
48 return;
49
50 int fontSize = 10;
51 gFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
52
53 int allowableWidth =
54 // PRL: was it correct to include the margin?
56 - 2; // 2 to allow for left/right borders
57 int textWidth;
58 do {
59 gFont.SetPointSize(fontSize);
60 window->GetTextExtent(_("Stereo, 999999Hz"),
61 &textWidth, nullptr, nullptr, nullptr, &gFont);
62 fontSize--;
63 } while (textWidth >= allowableWidth);
64
65 mInitialized = true;
66 }
#define _(s)
Definition: Internat.h:73
@ kTrackInfoWidth
Definition: ZoomInfo.h:30
@ kLeftMargin
Definition: ZoomInfo.h:27
bool mInitialized
Definition: TrackInfo.cpp:36
wxFont gFont
Definition: TrackInfo.cpp:34

References _, gFont, kLeftMargin, kTrackInfoWidth, and mInitialized.

Referenced by settings().

Here is the caller graph for this function:

Member Data Documentation

◆ gFont

wxFont Settings::gFont

Definition at line 34 of file TrackInfo.cpp.

Referenced by UpdatePrefs().

◆ mInitialized

bool Settings::mInitialized { false }

Definition at line 36 of file TrackInfo.cpp.

Referenced by settings(), and UpdatePrefs().


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