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 47 of file TrackInfo.cpp.

Member Function Documentation

◆ UpdatePrefs()

void Settings::UpdatePrefs ( )
inlineoverridevirtual

Implements PrefsListener.

Definition at line 52 of file TrackInfo.cpp.

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

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 48 of file TrackInfo.cpp.

Referenced by UpdatePrefs().

◆ mInitialized

bool Settings::mInitialized { false }

Definition at line 50 of file TrackInfo.cpp.

Referenced by settings(), and UpdatePrefs().


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