MCPcopy Create free account
hub / github.com/audacity/audacity / OnUpdate

Method OnUpdate

src/toolbars/TimeToolBar.cpp:291–324  ·  view source on GitHub ↗

Called when the format drop downs is changed. This causes recreation of the toolbar contents.

Source from the content-addressed store, hash-verified

289// Called when the format drop downs is changed.
290// This causes recreation of the toolbar contents.
291void TimeToolBar::OnUpdate(wxCommandEvent &evt)
292{
293 evt.Skip(false);
294
295 ToolBar::ReCreateButtons();
296
297 // Reset to allow resizing to work
298 SetMinSize(wxDefaultSize);
299 SetMaxSize(wxDefaultSize);
300
301 // Save format name before recreating the controls so they resize properly
302 auto &formats = ProjectNumericFormats::Get(mProject);
303 formats.SetAudioTimeFormat(evt.GetString());
304 // Then my subscription is called
305
306 // During initialization, the desired size will have already been set at this point
307 // and the "best" size" would override it, so we simply send a size event to force
308 // the content to fit inside the toolbar.
309 if (mSettingInitialSize) {
310 mSettingInitialSize = false;
311 SendSizeEvent();
312 }
313 // Otherwise we want the toolbar to resize to fit around the content
314 else {
315 // Fit() while retaining height
316 SetSize(GetBestSize().x, GetSize().y);
317 }
318
319 // Go set the new size limits
320 SetResizingLimits();
321
322 // Inform others the toobar has changed
323 Updated();
324}
325
326void TimeToolBar::OnSize(wxSizeEvent &evt)
327{

Callers

nothing calls this directly

Calls 4

GetFunction · 0.85
SkipMethod · 0.80
SetAudioTimeFormatMethod · 0.45
GetStringMethod · 0.45

Tested by

no test coverage detected