75{
76
77
78
79 class FontEnumerator : public wxFontEnumerator
80 {
81 public:
82 explicit FontEnumerator(wxArrayString* fontNames) :
83 mFontNames(fontNames) {}
84
85 bool OnFacename(const wxString& font) override
86 {
87 mFontNames->push_back(font);
88 return true;
89 }
90
91 private:
92 wxArrayString* mFontNames;
93 };
94
95 wxArrayString facenames;
96 FontEnumerator fontEnumerator(&facenames);
97 fontEnumerator.EnumerateFacenames(wxFONTENCODING_SYSTEM, false);
98
99 wxString facename =
gPrefs->Read(
wxT(
"/GUI/LabelFontFacename"),
wxT(
""));
100
101
102
103
105
106 long fontsize =
gPrefs->Read(
wxT(
"/GUI/LabelFontSize"),
108
109
111 dlg.SetName();
113 wxListBox *lb;
114 wxSpinCtrl *sc;
115
116 S.StartVerticalLay(
true);
117 {
118 S.StartMultiColumn(2, wxEXPAND);
119 {
122
123
124 S.AddPrompt(
XXO(
"Face name"));
125 lb =
safenew wxListBox(
S.GetParent(), wxID_ANY,
126 wxDefaultPosition,
127 wxDefaultSize,
128 facenames,
129 wxLB_SINGLE);
130
133 .Name(
XO(
"Face name"))
134 .Position( wxALIGN_LEFT | wxEXPAND | wxALL )
135 .AddWindow(lb);
136
137
138 S.AddPrompt(
XXO(
"Face size"));
139 sc =
safenew wxSpinCtrl(
S.GetParent(), wxID_ANY,
140 wxString::Format(
wxT(
"%ld"), fontsize),
141 wxDefaultPosition,
142 wxDefaultSize,
143 wxSP_ARROW_KEYS,
144 8, 48, fontsize);
146 .Name(
XO(
"Face size"))
147 .Position( wxALIGN_LEFT | wxALL )
148 .AddWindow(sc);
149 }
151 S.AddStandardButtons();
152 }
154
155 dlg.Layout();
156 dlg.Fit();
157 dlg.CenterOnParent();
158 if (dlg.ShowModal() == wxID_CANCEL)
159 return;
160
161 gPrefs->Write(
wxT(
"/GUI/LabelFontFacename"), lb->GetStringSelection());
162 gPrefs->Write(
wxT(
"/GUI/LabelFontSize"), sc->GetValue());
164
166
168}
XXO("&Cut/Copy/Paste Toolbar")
IteratorRange< Iterator > make_iterator_range(const Iterator &i1, const Iterator &i2)
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
static wxFont GetFont(const wxString &faceName, int size=DefaultFontSize)
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.