1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

Menus.cpp does not depend directly on ProjectWindow

This commit is contained in:
Paul Licameli 2019-06-13 15:24:17 -04:00
parent 3d71edca52
commit c506536912
2 changed files with 8 additions and 4 deletions

View File

@ -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<wxFrameEx&>( GetProjectFrame( project ) );
wxWindowPtr<wxMenuBar> menuBar{ window.GetMenuBar() };
window.DetachMenuBar();
// menuBar gets deleted here

View File

@ -79,8 +79,6 @@ public:
};
PlaybackScroller &GetPlaybackScroller() { return *mPlaybackScroller; }
using wxFrame::DetachMenuBar;
void SetNormalizedWindowState(wxRect pSizeAndLocation) { mNormalizedWindowState = pSizeAndLocation; }
wxRect GetNormalizedWindowState() const { return mNormalizedWindowState; }