diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index d470f40d1..909c699a1 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -722,16 +722,16 @@ bool MacroCommands::ApplyEffectCommand( // and apply the effect... res = PluginActions::DoAudacityCommand(ID, Context, - MenuCommandHandler::OnEffectFlags::kConfigured | - MenuCommandHandler::OnEffectFlags::kSkipState | - MenuCommandHandler::OnEffectFlags::kDontRepeatLast); + PluginActions::kConfigured | + PluginActions::kSkipState | + PluginActions::kDontRepeatLast); else // and apply the effect... res = PluginActions::DoEffect(ID, Context, - MenuCommandHandler::OnEffectFlags::kConfigured | - MenuCommandHandler::OnEffectFlags::kSkipState | - MenuCommandHandler::OnEffectFlags::kDontRepeatLast); + PluginActions::kConfigured | + PluginActions::kSkipState | + PluginActions::kDontRepeatLast); } return res; diff --git a/src/Menus.cpp b/src/Menus.cpp index f546215f9..e7e423d88 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -811,7 +811,7 @@ void MenuManager::UpdateMenus(AudacityProject &project, bool checkActive) /// selecting and unselecting depending if you are on the start of a /// block or not. -void MenuCommandHandler::RebuildAllMenuBars() +void MenuCreator::RebuildAllMenuBars() { for( size_t i = 0; i < gAudacityProjects.size(); i++ ) { AudacityProject *p = gAudacityProjects[i].get(); diff --git a/src/Menus.h b/src/Menus.h index 58be8d7c2..53f4b1ba1 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -49,26 +49,6 @@ struct MenuCommandHandler final MenuCommandHandler(); ~MenuCommandHandler(); -public: - -// Effect Menu - -struct OnEffectFlags -{ - - // No flags specified - static const int kNone = 0x00; - // Flag used to disable prompting for configuration parameteres. - static const int kConfigured = 0x01; - // Flag used to disable saving the state after processing. - static const int kSkipState = 0x02; - // Flag used to disable "Repeat Last Effect" - static const int kDontRepeatLast = 0x04; -}; - -static void RebuildAllMenuBars(); - -public: void UpdatePrefs() override; }; @@ -80,6 +60,8 @@ public: void CreateMenusAndCommands(AudacityProject &project); void RebuildMenuBar(AudacityProject &project); + static void RebuildAllMenuBars(); + public: CommandFlag mLastFlags; @@ -173,6 +155,16 @@ void DoRemoveTracks( AudacityProject & ); } namespace PluginActions { + enum : unsigned { + // No flags specified + kNone = 0x00, + // Flag used to disable prompting for configuration parameteres. + kConfigured = 0x01, + // Flag used to disable saving the state after processing. + kSkipState = 0x02, + // Flag used to disable "Repeat Last Effect" + kDontRepeatLast = 0x04, + }; bool DoEffect( const PluginID & ID, const CommandContext & context, unsigned flags ); bool DoAudacityCommand( diff --git a/src/Project.cpp b/src/Project.cpp index 95ad589fe..1618748bd 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3124,7 +3124,7 @@ void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory) #ifdef EXPERIMENTAL_DRAG_DROP_PLUG_INS // Is it a plug-in? if (PluginManager::Get().DropFile(fileName)) { - MenuCommandHandler::RebuildAllMenuBars(); + MenuCreator::RebuildAllMenuBars(); } else // No, so import. @@ -4419,7 +4419,7 @@ bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArr PluginActions::DoEffect( EffectManager::Get().GetEffectByIdentifier(wxT("Normalize")), context, - MenuCommandHandler::OnEffectFlags::kConfigured); + PluginActions::kConfigured); } // This is a no-fail: diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 748280795..96076b7ca 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -1536,7 +1536,7 @@ bool CommandManager::HandleMenuID(int id, CommandFlag flags, CommandMask mask) factories.push_back(&keyConfigPrefsFactory); GlobalPrefsDialog dialog(GetActiveProject(), factories); dialog.ShowModal(); - MenuCommandHandler::RebuildAllMenuBars(); + MenuCreator::RebuildAllMenuBars(); return true; } #endif @@ -1589,7 +1589,7 @@ bool CommandManager::HandleTextualCommand(const wxString & Str, const CommandCon { return PluginActions::DoEffect( plug->GetID(), context, - MenuCommandHandler::OnEffectFlags::kConfigured); + PluginActions::kConfigured); } plug = pm.GetNextPlugin(PluginTypeEffect); } diff --git a/src/effects/Effect.cpp b/src/effects/Effect.cpp index 22749247d..63fa348f3 100644 --- a/src/effects/Effect.cpp +++ b/src/effects/Effect.cpp @@ -769,7 +769,7 @@ bool Effect::Apply() // // It should callback to the EffectManager to kick off the processing return PluginActions::DoEffect(GetID(), context, - MenuCommandHandler::OnEffectFlags::kConfigured); + PluginActions::kConfigured); } void Effect::Preview() diff --git a/src/effects/EffectRack.cpp b/src/effects/EffectRack.cpp index b64e86ea9..93f6d4ca7 100644 --- a/src/effects/EffectRack.cpp +++ b/src/effects/EffectRack.cpp @@ -307,7 +307,7 @@ void EffectRack::OnApply(wxCommandEvent & WXUNUSED(evt)) { if (!PluginActions::DoEffect(mEffects[i]->GetID(), *project, - AudacityProject::OnEffectFlags::kConfigured)) + PluginActions::kConfigured)) // If any effect fails (or throws), then stop. return; } diff --git a/src/menus/PluginMenus.cpp b/src/menus/PluginMenus.cpp index 25bcdf853..5dba41515 100644 --- a/src/menus/PluginMenus.cpp +++ b/src/menus/PluginMenus.cpp @@ -23,7 +23,7 @@ void DoManagePluginsMenu (AudacityProject &project, EffectType type) { if (PluginManager::Get().ShowManager(&project, type)) - MenuCommandHandler::RebuildAllMenuBars(); + MenuCreator::RebuildAllMenuBars(); } bool CompareEffectsByName(const PluginDescriptor *a, const PluginDescriptor *b) @@ -404,7 +404,7 @@ bool DoEffect( // Make sure there's no activity since the effect is about to be applied // to the project's tracks. Mainly for Apply during RTP, but also used // for batch commands - if (flags & MenuCommandHandler::OnEffectFlags::kConfigured) + if (flags & kConfigured) { TransportActions::DoStop(project); project.SelectAllIfNone(); @@ -443,22 +443,22 @@ bool DoEffect( success = em.DoEffect(ID, &project, rate, tracks, trackFactory, &selectedRegion, - (flags & MenuCommandHandler::OnEffectFlags::kConfigured) == 0); + (flags & kConfigured) == 0); if (!success) return false; if (em.GetSkipStateFlag()) - flags = flags | MenuCommandHandler::OnEffectFlags::kSkipState; + flags = flags | kSkipState; - if (!(flags & MenuCommandHandler::OnEffectFlags::kSkipState)) + if (!(flags & kSkipState)) { wxString shortDesc = em.GetCommandName(ID); wxString longDesc = em.GetCommandDescription(ID); project.PushState(longDesc, shortDesc); } - if (!(flags & MenuCommandHandler::OnEffectFlags::kDontRepeatLast)) + if (!(flags & kDontRepeatLast)) { // Only remember a successful effect, don't remember insert, // or analyze effects. @@ -515,7 +515,7 @@ bool DoAudacityCommand( if (!plug) return false; - if (flags & MenuCommandHandler::OnEffectFlags::kConfigured) + if (flags & kConfigured) { TransportActions::DoStop(project); // SelectAllIfNone(); @@ -525,7 +525,7 @@ bool DoAudacityCommand( bool success = em.DoAudacityCommand(ID, context, &project, - (flags & MenuCommandHandler::OnEffectFlags::kConfigured) == 0); + (flags & kConfigured) == 0); if (!success) return false; @@ -571,8 +571,7 @@ void OnRepeatLastEffect(const CommandContext &context) auto lastEffect = GetMenuManager(context.project).mLastEffect; if (!lastEffect.IsEmpty()) { - DoEffect(lastEffect, - context, MenuCommandHandler::OnEffectFlags::kConfigured); + DoEffect( lastEffect, context, kConfigured ); } } @@ -682,8 +681,7 @@ void OnAudacityCommand(const CommandContext & ctx) wxLogDebug( "Command was: %s", ctx.parameter); // Not configured, so prompt user. DoAudacityCommand(EffectManager::Get().GetEffectByIdentifier(ctx.parameter), - ctx, - MenuCommandHandler::OnEffectFlags::kNone); + ctx, kNone); } }; // struct Handler diff --git a/src/menus/TrackMenus.cpp b/src/menus/TrackMenus.cpp index 305816521..2df5f91a4 100644 --- a/src/menus/TrackMenus.cpp +++ b/src/menus/TrackMenus.cpp @@ -716,7 +716,7 @@ void OnStereoToMono(const CommandContext &context) PluginActions::DoEffect( EffectManager::Get().GetEffectByIdentifier(wxT("StereoToMono")), context, - MenuCommandHandler::OnEffectFlags::kConfigured); + PluginActions::kConfigured); } void OnMixAndRender(const CommandContext &context) diff --git a/src/menus/ViewMenus.cpp b/src/menus/ViewMenus.cpp index efc6c02dd..f76974fe3 100644 --- a/src/menus/ViewMenus.cpp +++ b/src/menus/ViewMenus.cpp @@ -223,7 +223,7 @@ void OnShowExtraMenus(const CommandContext &context) gPrefs->Write(wxT("/GUI/ShowExtraMenus"), checked); gPrefs->Flush(); commandManager->Check(wxT("ShowExtraMenus"), checked); - MenuCommandHandler::RebuildAllMenuBars(); + MenuCreator::RebuildAllMenuBars(); } void OnShowClipping(const CommandContext &context) diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp index cdc775477..6477e19b1 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveTrackControls.cpp @@ -798,7 +798,7 @@ void WaveTrackMenuTable::OnSpectrogramSettings(wxCommandEvent &) //Bug 1725 Toolbar was left greyed out. //This solution is overkill, but does fix the problem and is what the //prefs dialog normally does. - MenuCommandHandler::RebuildAllMenuBars(); + MenuCreator::RebuildAllMenuBars(); mpData->result = RefreshCode::RefreshAll; } }