diff --git a/src/Menus.cpp b/src/Menus.cpp index c1274ac95..e6f2beb22 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -36,7 +36,6 @@ #include "Project.h" #include "ProjectHistory.h" #include "ProjectSettings.h" -#include "ProjectWindow.h" #include "UndoManager.h" #include "commands/CommandManager.h" #include "prefs/TracksPrefs.h" @@ -352,6 +351,13 @@ void MenuManager::ModifyUndoMenuItems(AudacityProject &project) } } +// Get hackcess to a protected method +class wxFrameEx : public wxFrame +{ +public: + using wxFrame::DetachMenuBar; +}; + void MenuCreator::RebuildMenuBar(AudacityProject &project) { // On OSX, we can't rebuild the menus while a modal dialog is being shown @@ -368,7 +374,7 @@ void MenuCreator::RebuildMenuBar(AudacityProject &project) // Delete the menus, since we will soon recreate them. // Rather oddly, the menus don't vanish as a result of doing this. { - auto &window = ProjectWindow::Get( project ); + auto &window = static_cast( GetProjectFrame( project ) ); wxWindowPtr menuBar{ window.GetMenuBar() }; window.DetachMenuBar(); // menuBar gets deleted here diff --git a/src/ProjectWindow.h b/src/ProjectWindow.h index 6b58c59b8..8ef7fa16c 100644 --- a/src/ProjectWindow.h +++ b/src/ProjectWindow.h @@ -79,8 +79,6 @@ public: }; PlaybackScroller &GetPlaybackScroller() { return *mPlaybackScroller; } - using wxFrame::DetachMenuBar; - void SetNormalizedWindowState(wxRect pSizeAndLocation) { mNormalizedWindowState = pSizeAndLocation; } wxRect GetNormalizedWindowState() const { return mNormalizedWindowState; }