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

Method OnUpdate

src/toolbars/SelectionBar.cpp:454–494  ·  view source on GitHub ↗

Called when one of the format drop downs is changed.

Source from the content-addressed store, hash-verified

452
453// Called when one of the format drop downs is changed.
454void SelectionBar::OnUpdate(wxCommandEvent &evt)
455{
456 evt.Skip(false);
457
458 wxWindow *w = FindFocus();
459
460 auto focusedCtrlIt =
461 std::find(mTimeControls.begin(), mTimeControls.end(), w);
462
463 const auto focusedCtrlIdx =
464 focusedCtrlIt != mTimeControls.end() ?
465 std::distance(mTimeControls.begin(), focusedCtrlIt) :
466 -1;
467
468 auto format = evt.GetString();
469
470 // Save format name before recreating the controls so they resize properly
471 if (mTimeControls.front())
472 {
473 auto &formats = ProjectNumericFormats::Get(mProject);
474 formats.SetSelectionFormat(format);
475 // Then my Subscription is called
476 }
477
478 // ReCreateButtons() will get rid of our sizers and controls
479 // so reset pointers first.
480 std::fill(mTimeControls.begin(), mTimeControls.end(), nullptr);
481
482 ToolBar::ReCreateButtons();
483
484 ValuesToControls();
485
486 UpdateTimeControlsFormat(format);
487
488 if (focusedCtrlIdx >= 0 && mTimeControls[focusedCtrlIdx])
489 mTimeControls[focusedCtrlIdx]->SetFocus();
490
491 RegenerateTooltips();
492
493 Updated();
494}
495
496void SelectionBar::OnIdle( wxIdleEvent &evt )
497{

Callers

nothing calls this directly

Calls 8

FindFocusFunction · 0.85
GetFunction · 0.85
SkipMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetStringMethod · 0.45
SetSelectionFormatMethod · 0.45
SetFocusMethod · 0.45

Tested by

no test coverage detected