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

Method RebuildMenuBar

src/MenuCreator.cpp:461–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459};
460
461void MenuCreator::RebuildMenuBar()
462{
463 auto &project = mProject;
464 // On OSX, we can't rebuild the menus while a modal dialog is being shown
465 // since the enabled state for menus like Quit and Preference gets out of
466 // sync with wxWidgets idea of what it should be.
467#if defined(__WXMAC__) && defined(_DEBUG)
468 {
469 wxDialog *dlg =
470 wxDynamicCast(wxGetTopLevelParent(wxWindow::FindFocus()), wxDialog);
471 assert((!dlg || !dlg->IsModal()));
472 }
473#endif
474
475 // Delete the menus, since we will soon recreate them.
476 // Rather oddly, the menus don't vanish as a result of doing this.
477 {
478 auto &window = static_cast<wxFrameEx&>( GetProjectFrame( project ) );
479 wxWindowPtr<wxMenuBar> menuBar{ window.GetMenuBar() };
480 window.DetachMenuBar();
481 // menuBar gets deleted here
482 }
483
484 PurgeData();
485 CreateMenusAndCommands();
486}
487
488constexpr auto JournalCode = wxT("CM"); // for CommandManager
489

Callers 4

UpdateMenusMethod · 0.80
RebuildAllMenuBarsMethod · 0.80
DoReloadPreferencesFunction · 0.80
OnPreferencesFunction · 0.80

Calls 2

FindFocusFunction · 0.85
GetMenuBarMethod · 0.80

Tested by

no test coverage detected