1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

static MenuManager::Get()...

... not member functions of AudacityProject
This commit is contained in:
Paul Licameli 2019-05-01 13:20:52 -04:00
parent 2f0a76ed10
commit 0923bc19a9
16 changed files with 72 additions and 60 deletions

View File

@ -802,7 +802,7 @@ bool MacroCommands::ApplyCommandInBatchMode( const wxString &friendlyCommand,
{ {
AudacityProject *project = GetActiveProject(); AudacityProject *project = GetActiveProject();
// Recalc flags and enable items that may have become enabled. // Recalc flags and enable items that may have become enabled.
GetMenuManager(*project).UpdateMenus(*project, false); MenuManager::Get(*project).UpdateMenus(*project, false);
// enter batch mode... // enter batch mode...
bool prevShowMode = project->GetShowId3Dialog(); bool prevShowMode = project->GetShowId3Dialog();
project->mBatchMode++; project->mBatchMode++;

View File

@ -750,7 +750,7 @@ void MacrosWindow::UpdateMenus()
{ {
// OK even on mac, as dialog is modal. // OK even on mac, as dialog is modal.
auto p = GetActiveProject(); auto p = GetActiveProject();
GetMenuManager(*p).RebuildMenuBar(*p); MenuManager::Get(*p).RebuildMenuBar(*p);
} }
void MacrosWindow::UpdateDisplay( bool bExpanded ) void MacrosWindow::UpdateDisplay( bool bExpanded )

View File

@ -52,9 +52,6 @@
#include <wx/menu.h> #include <wx/menu.h>
MenuManager &GetMenuManager(AudacityProject &project)
{ return *project.mMenuManager; }
MenuCreator::MenuCreator() MenuCreator::MenuCreator()
{ {
} }
@ -63,6 +60,21 @@ MenuCreator::~MenuCreator()
{ {
} }
static const AudacityProject::AttachedObjects::RegisteredFactory key{
[]( AudacityProject&){
return std::make_shared< MenuManager >(); }
};
MenuManager &MenuManager::Get( AudacityProject &project )
{
return project.AttachedObjects::Get< MenuManager >( key );
}
const MenuManager &MenuManager::Get( const AudacityProject &project )
{
return Get( const_cast< AudacityProject & >( project ) );
}
MenuManager::MenuManager() MenuManager::MenuManager()
{ {
UpdatePrefs(); UpdatePrefs();
@ -563,7 +575,7 @@ void MenuManager::ModifyAllProjectToolbarMenus()
AProjectArray::iterator i; AProjectArray::iterator i;
for (i = gAudacityProjects.begin(); i != gAudacityProjects.end(); ++i) { for (i = gAudacityProjects.begin(); i != gAudacityProjects.end(); ++i) {
auto &project = **i; auto &project = **i;
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
} }
@ -647,7 +659,7 @@ void MenuManager::UpdateMenus(AudacityProject &project, bool checkActive)
if (&project != GetActiveProject()) if (&project != GetActiveProject())
return; return;
auto flags = GetMenuManager(project).GetUpdateFlags(project, checkActive); auto flags = MenuManager::Get(project).GetUpdateFlags(project, checkActive);
auto flags2 = flags; auto flags2 = flags;
// We can enable some extra items if we have select-all-on-none. // We can enable some extra items if we have select-all-on-none.
@ -730,7 +742,7 @@ void MenuCreator::RebuildAllMenuBars()
for( size_t i = 0; i < gAudacityProjects.size(); i++ ) { for( size_t i = 0; i < gAudacityProjects.size(); i++ ) {
AudacityProject *p = gAudacityProjects[i].get(); AudacityProject *p = gAudacityProjects[i].get();
GetMenuManager(*p).RebuildMenuBar(*p); MenuManager::Get(*p).RebuildMenuBar(*p);
#if defined(__WXGTK__) #if defined(__WXGTK__)
// Workaround for: // Workaround for:
// //
@ -767,7 +779,7 @@ bool MenuManager::TryToMakeActionAllowed
bool bAllowed; bool bAllowed;
if( !flags ) if( !flags )
flags = GetMenuManager(project).GetUpdateFlags(project); flags = MenuManager::Get(project).GetUpdateFlags(project);
bAllowed = ((flags & mask) == (flagsRqd & mask)); bAllowed = ((flags & mask) == (flagsRqd & mask));
if( bAllowed ) if( bAllowed )
@ -780,7 +792,7 @@ bool MenuManager::TryToMakeActionAllowed
if( mStopIfWasPaused && (MissingFlags & AudioIONotBusyFlag ) ){ if( mStopIfWasPaused && (MissingFlags & AudioIONotBusyFlag ) ){
TransportActions::StopIfPaused( project ); TransportActions::StopIfPaused( project );
// Hope this will now reflect stopped audio. // Hope this will now reflect stopped audio.
flags = GetMenuManager(project).GetUpdateFlags(project); flags = MenuManager::Get(project).GetUpdateFlags(project);
bAllowed = ((flags & mask) == (flagsRqd & mask)); bAllowed = ((flags & mask) == (flagsRqd & mask));
if( bAllowed ) if( bAllowed )
return true; return true;
@ -812,7 +824,7 @@ bool MenuManager::TryToMakeActionAllowed
// When autoselect triggers, it might not select all audio in all tracks. // When autoselect triggers, it might not select all audio in all tracks.
// So changed to DoSelectAllAudio. // So changed to DoSelectAllAudio.
SelectActions::DoSelectAllAudio(project); SelectActions::DoSelectAllAudio(project);
flags = GetMenuManager(project).GetUpdateFlags(project); flags = MenuManager::Get(project).GetUpdateFlags(project);
bAllowed = ((flags & mask) == (flagsRqd & mask)); bAllowed = ((flags & mask) == (flagsRqd & mask));
return bAllowed; return bAllowed;
} }

View File

@ -14,6 +14,7 @@
#include <wx/string.h> // member variable #include <wx/string.h> // member variable
#include "Prefs.h" #include "Prefs.h"
#include "ClientData.h"
class wxArrayString; class wxArrayString;
class AudacityProject; class AudacityProject;
@ -50,9 +51,16 @@ public:
PluginID mLastEffect{}; PluginID mLastEffect{};
}; };
class MenuManager final : public MenuCreator, private PrefsListener class MenuManager final
: public MenuCreator
, public ClientData::Base
, private PrefsListener
{ {
public: public:
static MenuManager &Get( AudacityProject &project );
static const MenuManager &Get( const AudacityProject &project );
MenuManager(); MenuManager();
static void ModifyUndoMenuItems(AudacityProject &project); static void ModifyUndoMenuItems(AudacityProject &project);
@ -89,8 +97,6 @@ private:
}; };
MenuManager &GetMenuManager(AudacityProject &project);
// Exported helper functions from various menu handling source files // Exported helper functions from various menu handling source files

View File

@ -1099,8 +1099,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
auto &viewInfo = ViewInfo::Get( *this ); auto &viewInfo = ViewInfo::Get( *this );
mMenuManager = std::make_unique<MenuManager>();
mLockPlayRegion = false; mLockPlayRegion = false;
// Make sure valgrind sees mIsSyncLocked is initialized, even // Make sure valgrind sees mIsSyncLocked is initialized, even
@ -1251,7 +1249,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
mTrackPanel->AddOverlay( mScrubOverlay ); mTrackPanel->AddOverlay( mScrubOverlay );
#endif #endif
mMenuManager->CreateMenusAndCommands(*this); MenuManager::Get( project ).CreateMenusAndCommands( project );
mTrackPanel->SetBackgroundCell(mBackgroundCell); mTrackPanel->SetBackgroundCell(mBackgroundCell);
@ -2105,7 +2103,7 @@ void AudacityProject::FixScrollbars()
mTrackPanel->Refresh(false); mTrackPanel->Refresh(false);
} }
GetMenuManager(*this).UpdateMenus(*this); MenuManager::Get( project ).UpdateMenus( project );
if (oldhstate != newhstate || oldvstate != newvstate) { if (oldhstate != newhstate || oldvstate != newvstate) {
UpdateLayout(); UpdateLayout();
@ -2353,7 +2351,7 @@ void AudacityProject::OnMenu(wxCommandEvent & event)
auto &project = *this; auto &project = *this;
auto &commandManager = CommandManager::Get( project ); auto &commandManager = CommandManager::Get( project );
bool handled = commandManager.HandleMenuID( bool handled = commandManager.HandleMenuID(
event.GetId(), GetMenuManager(*this).GetUpdateFlags(*this), event.GetId(), MenuManager::Get( project ).GetUpdateFlags( project ),
NoFlagsSpecified); NoFlagsSpecified);
if (handled) if (handled)
@ -2366,7 +2364,8 @@ void AudacityProject::OnMenu(wxCommandEvent & event)
void AudacityProject::OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event)) void AudacityProject::OnUpdateUI(wxUpdateUIEvent & WXUNUSED(event))
{ {
GetMenuManager(*this).UpdateMenus(*this); auto &project = *this;
MenuManager::Get( project ).UpdateMenus( project );
} }
void AudacityProject::MacShowUndockedToolbars(bool show) void AudacityProject::MacShowUndockedToolbars(bool show)
@ -4632,9 +4631,9 @@ void AudacityProject::InitialState()
undoManager.StateSaved(); undoManager.StateSaved();
GetMenuManager(*this).ModifyUndoMenuItems(*this); auto &menuManager = MenuManager::Get( project );
menuManager.ModifyUndoMenuItems( project );
GetMenuManager(*this).UpdateMenus(*this); menuManager.UpdateMenus( project );
} }
bool AudacityProject::UndoAvailable() bool AudacityProject::UndoAvailable()
@ -4675,9 +4674,9 @@ void AudacityProject::PushState(const wxString &desc,
mDirty = true; mDirty = true;
GetMenuManager(*this).ModifyUndoMenuItems(*this); auto &menuManager = MenuManager::Get( project );
menuManager.ModifyUndoMenuItems( project );
GetMenuManager(*this).UpdateMenus(*this); menuManager.UpdateMenus( project );
if (GetTracksFitVerticallyZoomed()) if (GetTracksFitVerticallyZoomed())
ViewActions::DoZoomFitV(*this); ViewActions::DoZoomFitV(*this);
@ -4762,7 +4761,7 @@ void AudacityProject::PopState(const UndoState &state)
HandleResize(); HandleResize();
GetMenuManager(*this).UpdateMenus(*this); MenuManager::Get( project ).UpdateMenus( project );
AutoSave(); AutoSave();
} }
@ -4777,7 +4776,7 @@ void AudacityProject::SetStateTo(unsigned int n)
HandleResize(); HandleResize();
mTrackPanel->SetFocusedTrack(NULL); mTrackPanel->SetFocusedTrack(NULL);
mTrackPanel->Refresh(false); mTrackPanel->Refresh(false);
GetMenuManager(*this).ModifyUndoMenuItems(*this); MenuManager::Get( project ).ModifyUndoMenuItems( project );
} }
// Utility function called by other zoom methods // Utility function called by other zoom methods

View File

@ -661,12 +661,7 @@ private:
private: private:
#endif #endif
private:
std::unique_ptr<MenuManager> mMenuManager;
public: public:
friend MenuManager &GetMenuManager(AudacityProject &project);
class PlaybackScroller final : public wxEvtHandler class PlaybackScroller final : public wxEvtHandler
{ {
public: public:

View File

@ -1156,7 +1156,7 @@ bool CommandManager::FilterKeyEvent(AudacityProject *project, const wxKeyEvent &
return false; return false;
} }
auto flags = GetMenuManager(*project).GetUpdateFlags(*project); auto flags = MenuManager::Get(*project).GetUpdateFlags(*project);
wxKeyEvent temp = evt; wxKeyEvent temp = evt;
@ -1248,7 +1248,7 @@ bool CommandManager::HandleCommandEntry(const CommandListEntry * entry,
NiceName.Replace(".","");// remove ... NiceName.Replace(".","");// remove ...
// NB: The call may have the side effect of changing flags. // NB: The call may have the side effect of changing flags.
bool allowed = bool allowed =
GetMenuManager(*proj).ReportIfActionNotAllowed( *proj, MenuManager::Get(*proj).ReportIfActionNotAllowed( *proj,
NiceName, flags, entry->flags, combinedMask ); NiceName, flags, entry->flags, combinedMask );
// If the function was disallowed, it STILL should count as having been // If the function was disallowed, it STILL should count as having been
// handled (by doing nothing or by telling the user of the problem). // handled (by doing nothing or by telling the user of the problem).

View File

@ -3276,7 +3276,7 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
{ {
auto flags = AlwaysEnabledFlag; auto flags = AlwaysEnabledFlag;
bool allowed = bool allowed =
GetMenuManager(*mProject).ReportIfActionNotAllowed( MenuManager::Get(*mProject).ReportIfActionNotAllowed(
*mProject, *mProject,
mEffect->GetTranslatedName(), mEffect->GetTranslatedName(),
flags, flags,

View File

@ -180,7 +180,7 @@ void DoReloadPreferences( AudacityProject &project )
for (size_t i = 0; i < gAudacityProjects.size(); i++) { for (size_t i = 0; i < gAudacityProjects.size(); i++) {
AudacityProject *p = gAudacityProjects[i].get(); AudacityProject *p = gAudacityProjects[i].get();
GetMenuManager(*p).RebuildMenuBar(*p); MenuManager::Get(*p).RebuildMenuBar(*p);
// TODO: The comment below suggests this workaround is obsolete. // TODO: The comment below suggests this workaround is obsolete.
#if defined(__WXGTK__) #if defined(__WXGTK__)
// Workaround for: // Workaround for:
@ -1018,7 +1018,7 @@ void OnPreferences(const CommandContext &context)
for (size_t i = 0; i < gAudacityProjects.size(); i++) { for (size_t i = 0; i < gAudacityProjects.size(); i++) {
AudacityProject *p = gAudacityProjects[i].get(); AudacityProject *p = gAudacityProjects[i].get();
GetMenuManager(*p).RebuildMenuBar(*p); MenuManager::Get(*p).RebuildMenuBar(*p);
// TODO: The comment below suggests this workaround is obsolete. // TODO: The comment below suggests this workaround is obsolete.
#if defined(__WXGTK__) #if defined(__WXGTK__)
// Workaround for: // Workaround for:

View File

@ -432,7 +432,7 @@ bool DoEffect(
// For now, we're limiting realtime preview to a single effect, so // For now, we're limiting realtime preview to a single effect, so
// make sure the menus reflect that fact that one may have just been // make sure the menus reflect that fact that one may have just been
// opened. // opened.
GetMenuManager(project).UpdateMenus(project, false); MenuManager::Get(project).UpdateMenus(project, false);
} }
} ); } );
@ -470,7 +470,7 @@ bool DoEffect(
// or analyze effects. // or analyze effects.
if (type == EffectTypeProcess) { if (type == EffectTypeProcess) {
wxString shortDesc = em.GetCommandName(ID); wxString shortDesc = em.GetCommandName(ID);
GetMenuManager(project).mLastEffect = ID; MenuManager::Get(project).mLastEffect = ID;
wxString lastEffectDesc; wxString lastEffectDesc;
/* i18n-hint: %s will be the name of the effect which will be /* i18n-hint: %s will be the name of the effect which will be
* repeated if this menu item is chosen */ * repeated if this menu item is chosen */
@ -575,7 +575,7 @@ void OnManageEffects(const CommandContext &context)
void OnRepeatLastEffect(const CommandContext &context) void OnRepeatLastEffect(const CommandContext &context)
{ {
auto lastEffect = GetMenuManager(context.project).mLastEffect; auto lastEffect = MenuManager::Get(context.project).mLastEffect;
if (!lastEffect.empty()) if (!lastEffect.empty())
{ {
DoEffect( lastEffect, context, kConfigured ); DoEffect( lastEffect, context, kConfigured );
@ -878,7 +878,7 @@ MenuTable::BaseItemPtr EffectMenu( AudacityProject &project )
// All of this is a bit hacky until we can get more things connected into // All of this is a bit hacky until we can get more things connected into
// the plugin manager...sorry! :-( // the plugin manager...sorry! :-(
const auto &lastEffect = GetMenuManager(project).mLastEffect; const auto &lastEffect = MenuManager::Get(project).mLastEffect;
wxString buildMenuLabel; wxString buildMenuLabel;
if (!lastEffect.empty()) { if (!lastEffect.empty()) {
buildMenuLabel.Printf(_("Repeat %s"), buildMenuLabel.Printf(_("Repeat %s"),

View File

@ -499,7 +499,7 @@ void SelectNone( AudacityProject &project )
void SelectAllIfNone( AudacityProject &project ) void SelectAllIfNone( AudacityProject &project )
{ {
auto &viewInfo = ViewInfo::Get( project ); auto &viewInfo = ViewInfo::Get( project );
auto flags = GetMenuManager( project ).GetUpdateFlags( project ); auto flags = MenuManager::Get( project ).GetUpdateFlags( project );
if(!(flags & TracksSelectedFlag) || if(!(flags & TracksSelectedFlag) ||
viewInfo.selectedRegion.isPoint()) viewInfo.selectedRegion.isPoint())
DoSelectAllAudio( project ); DoSelectAllAudio( project );

View File

@ -40,7 +40,7 @@ void OnResetToolBars(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.Reset(); toolManager.Reset();
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowTransportToolBar(const CommandContext &context) void OnShowTransportToolBar(const CommandContext &context)
@ -49,7 +49,7 @@ void OnShowTransportToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide(TransportBarID); toolManager.ShowHide(TransportBarID);
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowToolsToolBar(const CommandContext &context) void OnShowToolsToolBar(const CommandContext &context)
@ -58,7 +58,7 @@ void OnShowToolsToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( ToolsBarID ); toolManager.ShowHide( ToolsBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowRecordMeterToolBar(const CommandContext &context) void OnShowRecordMeterToolBar(const CommandContext &context)
@ -71,7 +71,7 @@ void OnShowRecordMeterToolBar(const CommandContext &context)
toolManager.Expose( MeterBarID, false ); toolManager.Expose( MeterBarID, false );
} }
toolManager.ShowHide( RecordMeterBarID ); toolManager.ShowHide( RecordMeterBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowPlayMeterToolBar(const CommandContext &context) void OnShowPlayMeterToolBar(const CommandContext &context)
@ -85,7 +85,7 @@ void OnShowPlayMeterToolBar(const CommandContext &context)
} }
toolManager.ShowHide( PlayMeterBarID ); toolManager.ShowHide( PlayMeterBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
#if 0 #if 0
@ -100,7 +100,7 @@ void OnShowMeterToolBar(const CommandContext &context)
toolManager.Expose( RecordMeterBarID, false ); toolManager.Expose( RecordMeterBarID, false );
} }
toolManager.ShowHide( MeterBarID ); toolManager.ShowHide( MeterBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
#endif #endif
@ -110,7 +110,7 @@ void OnShowMixerToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( MixerBarID ); toolManager.ShowHide( MixerBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowEditToolBar(const CommandContext &context) void OnShowEditToolBar(const CommandContext &context)
@ -119,7 +119,7 @@ void OnShowEditToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( EditBarID ); toolManager.ShowHide( EditBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowTranscriptionToolBar(const CommandContext &context) void OnShowTranscriptionToolBar(const CommandContext &context)
@ -128,7 +128,7 @@ void OnShowTranscriptionToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( TranscriptionBarID ); toolManager.ShowHide( TranscriptionBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowScrubbingToolBar(const CommandContext &context) void OnShowScrubbingToolBar(const CommandContext &context)
@ -137,7 +137,7 @@ void OnShowScrubbingToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( ScrubbingBarID ); toolManager.ShowHide( ScrubbingBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowDeviceToolBar(const CommandContext &context) void OnShowDeviceToolBar(const CommandContext &context)
@ -146,7 +146,7 @@ void OnShowDeviceToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( DeviceBarID ); toolManager.ShowHide( DeviceBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
void OnShowSelectionToolBar(const CommandContext &context) void OnShowSelectionToolBar(const CommandContext &context)
@ -155,7 +155,7 @@ void OnShowSelectionToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( SelectionBarID ); toolManager.ShowHide( SelectionBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
@ -165,7 +165,7 @@ void OnShowSpectralSelectionToolBar(const CommandContext &context)
auto &toolManager = ToolManager::Get( project ); auto &toolManager = ToolManager::Get( project );
toolManager.ShowHide( SpectralSelectionBarID ); toolManager.ShowHide( SpectralSelectionBarID );
GetMenuManager(project).ModifyToolbarMenus(project); MenuManager::Get(project).ModifyToolbarMenus(project);
} }
#endif #endif

View File

@ -197,7 +197,7 @@ namespace TransportActions {
// Stop playing or recording, if paused. // Stop playing or recording, if paused.
void StopIfPaused( AudacityProject &project ) void StopIfPaused( AudacityProject &project )
{ {
auto flags = GetMenuManager( project ).GetUpdateFlags( project ); auto flags = MenuManager::Get( project ).GetUpdateFlags( project );
if( flags & PausedFlag ) if( flags & PausedFlag )
DoStop( project ); DoStop( project );
} }

View File

@ -44,7 +44,7 @@ void DoMacMinimize(AudacityProject *project)
#endif #endif
// So that the Minimize menu command disables // So that the Minimize menu command disables
GetMenuManager(*project).UpdateMenus(*project); MenuManager::Get(*project).UpdateMenus(*project);
} }
} }

View File

@ -1067,7 +1067,7 @@ bool ControlToolBar::DoRecord(AudacityProject &project,
CommandFlag flags = AlwaysEnabledFlag; // 0 means recalc flags. CommandFlag flags = AlwaysEnabledFlag; // 0 means recalc flags.
// NB: The call may have the side effect of changing flags. // NB: The call may have the side effect of changing flags.
bool allowed = GetMenuManager(project).TryToMakeActionAllowed( bool allowed = MenuManager::Get(project).TryToMakeActionAllowed(
project, project,
flags, flags,
AudioIONotBusyFlag | CanStopAudioStreamFlag, AudioIONotBusyFlag | CanStopAudioStreamFlag,

View File

@ -299,7 +299,7 @@ void EditToolBar::OnButton(wxCommandEvent &event)
if (!p) return; if (!p) return;
auto &cm = CommandManager::Get( *p ); auto &cm = CommandManager::Get( *p );
auto flags = GetMenuManager(*p).GetUpdateFlags(*p); auto flags = MenuManager::Get(*p).GetUpdateFlags(*p);
const CommandContext context( *GetActiveProject() ); const CommandContext context( *GetActiveProject() );
cm.HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified); cm.HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified);
} }