diff --git a/src/Dependencies.cpp b/src/Dependencies.cpp index 5d759d953..ff330ae8f 100644 --- a/src/Dependencies.cpp +++ b/src/Dependencies.cpp @@ -42,6 +42,7 @@ AliasedFile s. #include #include #include +#include #include #include #include diff --git a/src/Lyrics.cpp b/src/Lyrics.cpp index 10327e93f..bb2c7b395 100644 --- a/src/Lyrics.cpp +++ b/src/Lyrics.cpp @@ -19,6 +19,7 @@ #include "Internat.h" #include "Project.h" // for GetActiveProject #include "LabelTrack.h" +#include "commands/CommandManager.h" BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl) diff --git a/src/Menus.cpp b/src/Menus.cpp index 6c0de8717..97a877cd4 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -68,6 +68,7 @@ menu items. #include "Dependencies.h" #include "float_cast.h" #include "LabelTrack.h" +#include "commands/CommandManager.h" #ifdef USE_MIDI #include "import/ImportMIDI.h" #endif // USE_MIDI @@ -849,7 +850,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project) // // to show the Redo's on stack. // // "UndoHistory" might already be enabled, but add this check for RedoAvailableFlag. // if (flags & RedoAvailableFlag) - // mCommandManager.Enable(wxT("UndoHistory"), true); + // GetCommandManager()->Enable(wxT("UndoHistory"), true); // So for now, enable the command regardless of stack. It will just show empty sometimes. // FOR REDESIGN, clearly there are some limitations with the flags/mask bitmaps. @@ -2641,8 +2642,8 @@ void MenuManager::UpdateMenus(AudacityProject &project, bool checkActive) #if 0 if (flags & CutCopyAvailableFlag) { - mCommandManager.Enable(wxT("Copy"), true); - mCommandManager.Enable(wxT("Cut"), true); + GetCommandManager()->Enable(wxT("Copy"), true); + GetCommandManager()->Enable(wxT("Cut"), true); } #endif diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index a6333a561..17c1b1f7b 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -47,6 +47,7 @@ #include "../images/AudacityLogo48x48.xpm" #endif +#include "commands/CommandManager.h" // class MixerTrackSlider diff --git a/src/Project.cpp b/src/Project.cpp index f1422c2f5..bf3c738a3 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -117,6 +117,7 @@ scroll information. It also has some status flags. #include "TrackPanel.h" #include "WaveTrack.h" #include "DirManager.h" +#include "commands/CommandManager.h" #include "effects/Effect.h" #include "prefs/PrefsDialog.h" #include "widgets/LinkingHtmlWindow.h" @@ -939,6 +940,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id, NumericConverter::BANDWIDTH, gPrefs->Read(wxT("/BandwidthSelectionFormatName"), wxT("")) ) ), mUndoManager(std::make_unique()) + , mCommandManager( std::make_unique() ) { if (!gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleRate"), &mRate, AudioIO::GetOptimalSupportedSampleRate())) { // The default given above can vary with host/devices. So unless there is an entry for @@ -1570,7 +1572,7 @@ void AudacityProject::AS_SetSnapTo(int snap) mSnapTo = snap; // LLL: TODO - what should this be changed to??? -// mCommandManager.Check(wxT("Snap"), mSnapTo); +// GetCommandManager()->Check(wxT("Snap"), mSnapTo); gPrefs->Write(wxT("/SnapTo"), mSnapTo); gPrefs->Flush(); @@ -2358,7 +2360,7 @@ void AudacityProject::OnMenu(wxCommandEvent & event) return; } #endif - bool handled = mCommandManager.HandleMenuID( + bool handled = GetCommandManager()->HandleMenuID( event.GetId(), GetMenuManager(*this).GetUpdateFlags(*this), NoFlagsSpecified); diff --git a/src/Project.h b/src/Project.h index e5c55a531..5c9070d21 100644 --- a/src/Project.h +++ b/src/Project.h @@ -28,7 +28,6 @@ #include "ViewInfo.h" #include "TrackPanelListener.h" #include "AudioIOListener.h" -#include "commands/CommandManager.h" #include "effects/EffectManager.h" #include "xml/XMLTagHandler.h" #include "toolbars/SelectionBarListener.h" @@ -170,8 +169,6 @@ class WaveTrack; #include "./commands/CommandFlag.h" #include "../include/audacity/EffectInterface.h" -#include "./commands/CommandManager.h" - class MenuCommandHandler; class MenuManager; @@ -347,8 +344,10 @@ public: // Converts number of minutes to human readable format wxString GetHoursMinsString(int iMinutes); - CommandManager *GetCommandManager() { return &mCommandManager; } - const CommandManager *GetCommandManager() const { return &mCommandManager; } + CommandManager *GetCommandManager() + { return mCommandManager.get(); } + const CommandManager *GetCommandManager() const + { return mCommandManager.get(); } // Keyboard capture static bool HasKeyboardCapture(const wxWindow *handler); @@ -653,7 +652,7 @@ private: // Commands - CommandManager mCommandManager; + std::unique_ptr mCommandManager; // Window elements diff --git a/src/Shuttle.cpp b/src/Shuttle.cpp index 2e50f4edc..29ccaeed6 100644 --- a/src/Shuttle.cpp +++ b/src/Shuttle.cpp @@ -69,7 +69,6 @@ preferences. //#include "Project.h" #include "Shuttle.h" #include "WrappedType.h" -//#include "commands/CommandManager.h" //#include "effects/Effect.h" diff --git a/src/commands/ScreenshotCommand.cpp b/src/commands/ScreenshotCommand.cpp index 991f722f0..102ed897e 100644 --- a/src/commands/ScreenshotCommand.cpp +++ b/src/commands/ScreenshotCommand.cpp @@ -44,6 +44,7 @@ small calculations of rectangles. #include "../Prefs.h" #include "../ShuttleGui.h" #include "CommandContext.h" +#include "CommandManager.h" static const IdentInterfaceSymbol diff --git a/src/prefs/KeyConfigPrefs.h b/src/prefs/KeyConfigPrefs.h index da84e5d10..e09fa9a3e 100644 --- a/src/prefs/KeyConfigPrefs.h +++ b/src/prefs/KeyConfigPrefs.h @@ -14,6 +14,7 @@ #include "../Experimental.h" +class CommandManager; class ShuttleGui; #include @@ -25,7 +26,6 @@ class ShuttleGui; #include #include -#include "../commands/CommandManager.h" #include "../widgets/KeyView.h" #include "PrefsPanel.h" diff --git a/src/toolbars/EditToolBar.cpp b/src/toolbars/EditToolBar.cpp index ec61620d8..ba4354e0f 100644 --- a/src/toolbars/EditToolBar.cpp +++ b/src/toolbars/EditToolBar.cpp @@ -59,6 +59,7 @@ #include "../Experimental.h" #include "../commands/CommandContext.h" +#include "../commands/CommandManager.h" IMPLEMENT_CLASS(EditToolBar, ToolBar); diff --git a/src/toolbars/ToolBar.cpp b/src/toolbars/ToolBar.cpp index 896068832..792b68881 100644 --- a/src/toolbars/ToolBar.cpp +++ b/src/toolbars/ToolBar.cpp @@ -50,6 +50,7 @@ in which buttons can be placed. #include "../Project.h" #include "../Theme.h" #include "../commands/Keyboard.h" +#include "../commands/CommandManager.h" #include "../widgets/AButton.h" #include "../widgets/Grabber.h" #include "../Prefs.h" diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index 0fbc9eb34..847e4eb11 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -33,6 +33,8 @@ Paul Licameli split from TrackPanel.cpp #include "../../widgets/Ruler.h" #include "../../commands/CommandFunctors.h" #include "../../commands/CommandContext.h" +#include "../../commands/CommandManager.h" + #include diff --git a/src/tracks/ui/SelectHandle.cpp b/src/tracks/ui/SelectHandle.cpp index 87e629426..f1f38fa6f 100644 --- a/src/tracks/ui/SelectHandle.cpp +++ b/src/tracks/ui/SelectHandle.cpp @@ -27,6 +27,7 @@ Paul Licameli split from TrackPanel.cpp #include "../../TrackPanelMouseEvent.h" #include "../../ViewInfo.h" #include "../../WaveTrack.h" +#include "../../commands/CommandManager.h" #include "../../commands/Keyboard.h" #include "../../ondemand/ODManager.h" #include "../../prefs/SpectrogramSettings.h" diff --git a/src/tracks/ui/TrackButtonHandles.cpp b/src/tracks/ui/TrackButtonHandles.cpp index b8fc577e0..ff2709615 100644 --- a/src/tracks/ui/TrackButtonHandles.cpp +++ b/src/tracks/ui/TrackButtonHandles.cpp @@ -16,6 +16,7 @@ Paul Licameli split from TrackPanel.cpp #include "../../RefreshCode.h" #include "../../Track.h" #include "../../TrackPanel.h" +#include "../../commands/CommandManager.h" MinimizeButtonHandle::MinimizeButtonHandle ( const std::shared_ptr &pTrack, const wxRect &rect ) diff --git a/src/tracks/ui/TrackControls.cpp b/src/tracks/ui/TrackControls.cpp index 537841495..e2a78abcc 100644 --- a/src/tracks/ui/TrackControls.cpp +++ b/src/tracks/ui/TrackControls.cpp @@ -23,6 +23,7 @@ Paul Licameli split from TrackPanel.cpp #include #include "../../commands/CommandType.h" #include "../../commands/Command.h" +#include "../../commands/CommandManager.h" #include "../../ShuttleGui.h" diff --git a/src/widgets/KeyView.h b/src/widgets/KeyView.h index e7960446c..8f77147c6 100644 --- a/src/widgets/KeyView.h +++ b/src/widgets/KeyView.h @@ -16,6 +16,8 @@ #include #include +#include "../commands/Keyboard.h" + // Class holding all information about a node. Rather than a real tree // we store these in an array and simulate a tree. class KeyNode