From 2c25a379945425a09637306e01d63ac8de0d03cd Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 31 Jan 2020 22:33:16 -0500 Subject: [PATCH] Revert to a465ce0046e1726b3d2d926091b91714e154a91e --- src/FreqWindow.cpp | 54 ------------ src/HistoryWindow.cpp | 83 ------------------ src/LyricsWindow.cpp | 44 ---------- src/Menus.cpp | 87 +++++++++---------- src/MixerBoard.cpp | 42 --------- src/effects/Contrast.cpp | 56 +----------- src/menus/ClipMenus.cpp | 36 +++----- src/menus/EditMenus.cpp | 25 +++--- src/menus/ExtraMenus.cpp | 91 ++++++++++++-------- src/menus/FileMenus.cpp | 13 +-- src/menus/HelpMenus.cpp | 13 +-- src/menus/LabelMenus.cpp | 15 +--- src/menus/NavigationMenus.cpp | 22 ++--- src/menus/PluginMenus.cpp | 112 +++++++++++++++--------- src/menus/SelectMenus.cpp | 68 +++++++-------- src/menus/ToolbarMenus.cpp | 155 ++++++++++++++++------------------ src/menus/TrackMenus.cpp | 21 ++--- src/menus/TransportMenus.cpp | 125 +++++++++++++++++++++------ src/menus/ViewMenus.cpp | 117 ++++++++++++++++++++++--- src/menus/WindowMenus.cpp | 33 ++++---- src/tracks/ui/Scrubbing.cpp | 122 ++------------------------ src/tracks/ui/Scrubbing.h | 6 +- 22 files changed, 546 insertions(+), 794 deletions(-) diff --git a/src/FreqWindow.cpp b/src/FreqWindow.cpp index c029ce377..2ff939d20 100644 --- a/src/FreqWindow.cpp +++ b/src/FreqWindow.cpp @@ -67,13 +67,11 @@ the mouse around. #include "ShuttleGui.h" #include "AColor.h" -#include "CommonCommandFlags.h" #include "FFT.h" #include "PitchName.h" #include "prefs/GUISettings.h" #include "Prefs.h" #include "Project.h" -#include "ProjectWindow.h" #include "WaveClip.h" #include "ViewInfo.h" #include "AllThemeResources.h" @@ -1139,55 +1137,3 @@ void FreqPlot::OnMouseEvent(wxMouseEvent & event) freqWindow->PlotMouseEvent(event); } -// Remaining code hooks this add-on into the application -#include "commands/CommandContext.h" -#include "commands/CommandManager.h" -#include "commands/ScreenshotCommand.h" - -namespace { - -AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{ - []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { - auto &window = ProjectWindow::Get( parent ); - return safenew FrequencyPlotDialog( - &window, -1, parent, XO("Frequency Analysis"), - wxPoint{ 150, 150 } - ); - } -}; - -// Define our extra menu item that invokes that factory -struct Handler : CommandHandlerObject { - void OnPlotSpectrum(const CommandContext &context) - { - auto &project = context.project; - auto freqWindow = - &project.AttachedWindows::Get< FrequencyPlotDialog >( sFrequencyWindowKey ); - - if( ScreenshotCommand::MayCapture( freqWindow ) ) - return; - freqWindow->Show(true); - freqWindow->Raise(); - freqWindow->SetFocus(); - } -}; - -CommandHandlerObject &findCommandHandler(AudacityProject &) { - // Handler is not stateful. Doesn't need a factory registered with - // AudacityProject. - static Handler instance; - return instance; -} - -// Register that menu item - -using namespace MenuTable; -AttachedItem sAttachment{ wxT("Analyze/Analyzers/Windows"), - ( FinderScope{ findCommandHandler }, - Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."), - &Handler::OnPlotSpectrum, - AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ) ) -}; - -} - diff --git a/src/HistoryWindow.cpp b/src/HistoryWindow.cpp index d84ea2d2f..3b0801233 100644 --- a/src/HistoryWindow.cpp +++ b/src/HistoryWindow.cpp @@ -35,7 +35,6 @@ undo memory so as to free up space. #include "AudioIO.h" #include "Clipboard.h" -#include "CommonCommandFlags.h" #include "../images/Arrow.xpm" #include "../images/Empty9x16.xpm" #include "UndoManager.h" @@ -317,85 +316,3 @@ void HistoryDialog::OnSize(wxSizeEvent & WXUNUSED(event)) if (mList->GetItemCount() > 0) mList->EnsureVisible(mSelected); } - -// Remaining code hooks this add-on into the application -#include "commands/CommandContext.h" -#include "commands/CommandManager.h" - -namespace { - -// History window attached to each project is built on demand by: -AudacityProject::AttachedWindows::RegisteredFactory sHistoryWindowKey{ - []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { - auto &undoManager = UndoManager::Get( parent ); - return safenew HistoryDialog( &parent, &undoManager ); - } -}; - -// Define our extra menu item that invokes that factory -struct Handler : CommandHandlerObject { - void OnHistory(const CommandContext &context) - { - auto &project = context.project; - - auto historyWindow = &project.AttachedWindows::Get( sHistoryWindowKey ); - historyWindow->Show(); - historyWindow->Raise(); - } -}; - -CommandHandlerObject &findCommandHandler(AudacityProject &) { - // Handler is not stateful. Doesn't need a factory registered with - // AudacityProject. - static Handler instance; - return instance; -} - -// Register that menu item - -using namespace MenuTable; -AttachedItem sAttachment{ wxT("View/Windows"), - // History window should be available either for UndoAvailableFlag - // or RedoAvailableFlag, - // but we can't make the AddItem flags and mask have both, - // because they'd both have to be true for the - // command to be enabled. - // If user has Undone the entire stack, RedoAvailableFlag is on - // but UndoAvailableFlag is off. - // If user has done things but not Undone anything, - // RedoAvailableFlag is off but UndoAvailableFlag is on. - // So in either of those cases, - // (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask - // would fail. - // The only way to fix this in the current architecture - // is to hack in special cases for RedoAvailableFlag - // in AudacityProject::UpdateMenus() (ugly) - // and CommandManager::HandleCommandEntry() (*really* ugly -- - // shouldn't know about particular command names and flags). - // Here's the hack that would be necessary in - // AudacityProject::UpdateMenus(), if somebody decides to do it: - // // Because EnableUsingFlags requires all the flag bits match the - // // corresponding mask bits, - // // "UndoHistory" specifies only - // // AudioIONotBusyFlag | UndoAvailableFlag, because that - // // covers the majority of cases where it should be enabled. - // // If history is not empty but we've Undone the whole stack, - // // we also want to enable, - // // to show the Redo's on stack. - // // "UndoHistory" might already be enabled, - // // but add this check for RedoAvailableFlag. - // if (flags & RedoAvailableFlag) - // 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. - - /* i18n-hint: Clicking this menu item shows the various editing steps - that have been taken.*/ - ( FinderScope{ findCommandHandler }, - Command( wxT("UndoHistory"), XXO("&History..."), &Handler::OnHistory, - AudioIONotBusyFlag() ) ) -}; - -} diff --git a/src/LyricsWindow.cpp b/src/LyricsWindow.cpp index 157501190..75914fc6b 100644 --- a/src/LyricsWindow.cpp +++ b/src/LyricsWindow.cpp @@ -12,7 +12,6 @@ #include "LyricsWindow.h" #include "Lyrics.h" #include "AudioIOBase.h" -#include "CommonCommandFlags.h" #include "Prefs.h" // for RTL_WORKAROUND #include "Project.h" #include "ProjectAudioIO.h" @@ -168,46 +167,3 @@ void LyricsWindow::OnTimer(wxCommandEvent &event) // Let other listeners get the notification event.Skip(); } - -// Remaining code hooks this add-on into the application -#include "commands/CommandContext.h" -#include "commands/CommandManager.h" - -namespace { - -// Lyrics window attached to each project is built on demand by: -AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{ - []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { - return safenew LyricsWindow( &parent ); - } -}; - -// Define our extra menu item that invokes that factory -struct Handler : CommandHandlerObject { - void OnKaraoke(const CommandContext &context) - { - auto &project = context.project; - - auto lyricsWindow = &project.AttachedWindows::Get( sLyricsWindowKey ); - lyricsWindow->Show(); - lyricsWindow->Raise(); - } -}; - -CommandHandlerObject &findCommandHandler(AudacityProject &) { - // Handler is not stateful. Doesn't need a factory registered with - // AudacityProject. - static Handler instance; - return instance; -} - -// Register that menu item - -using namespace MenuTable; -AttachedItem sAttachment{ wxT("View/Windows"), - ( FinderScope{ findCommandHandler }, - Command( wxT("Karaoke"), XXO("&Karaoke..."), &Handler::OnKaraoke, - LabelTracksExistFlag() ) ) -}; - -} diff --git a/src/Menus.cpp b/src/Menus.cpp index f4061f8e1..23f38d0b4 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -42,7 +42,6 @@ #include "widgets/AudacityMessageBox.h" #include "widgets/ErrorDialog.h" -#include #include #include @@ -945,6 +944,29 @@ void Visit( Visitor &visitor, BaseItem *pTopItem, GroupItem *pRegistry ) /// changes in configured preferences - for example changes in key-bindings /// affect the short-cut key legend that appears beside each command, +MenuTable::BaseItemSharedPtr FileMenu(); + +MenuTable::BaseItemSharedPtr EditMenu(); + +MenuTable::BaseItemSharedPtr SelectMenu(); + +MenuTable::BaseItemSharedPtr ViewMenu(); + +MenuTable::BaseItemSharedPtr TransportMenu(); + +MenuTable::BaseItemSharedPtr TracksMenu(); + +MenuTable::BaseItemSharedPtr GenerateMenu(); +MenuTable::BaseItemSharedPtr EffectMenu(); +MenuTable::BaseItemSharedPtr AnalyzeMenu(); +MenuTable::BaseItemSharedPtr ToolsMenu(); + +MenuTable::BaseItemSharedPtr WindowMenu(); + +MenuTable::BaseItemSharedPtr ExtraMenu(); + +MenuTable::BaseItemSharedPtr HelpMenu(); + namespace { static Registry::GroupItem &sRegistry() { @@ -959,49 +981,26 @@ MenuTable::AttachedItem::AttachedItem( Registry::RegisterItem( sRegistry(), placement, std::move( pItem ) ); } +// Table of menu factories. +// TODO: devise a registration system instead. +static const auto menuTree = MenuTable::Items( MenuPathStart + , FileMenu() + , EditMenu() + , SelectMenu() + , ViewMenu() + , TransportMenu() + , TracksMenu() + , GenerateMenu() + , EffectMenu() + , AnalyzeMenu() + , ToolsMenu() + , WindowMenu() + , ExtraMenu() + , HelpMenu() +); + namespace { - -// Once only, cause initial population of preferences for the ordering -// of some menu items that used to be given in tables but are now separately -// registered in several .cpp files; the sequence of registration depends -// on unspecified accidents of static initialization order across -// compilation units, so we need something specific here to preserve old -// default appearance of menus. -// But this needs only to mention some strings -- there is no compilation or -// link dependency of this source file on those other implementation files. -void InitializeMenuOrdering() -{ - using Pair = std::pair; - static const Pair pairs [] = { - {wxT(""), wxT( -"File,Edit,Select,View,Transport,Tracks,Generate,Effect,Analyze,Tools,Window,Optional,Help" - )}, - {wxT("/Optional/Extra/Part1"), wxT( -"Transport,Tools,Mixer,Edit,PlayAtSpeed,Seek,Device,Select" - )}, - {wxT("/Optional/Extra/Part2"), wxT( -"Navigation,Focus,Cursor,Track,Scriptables1,Scriptables2" - )}, - {wxT("/View/Windows"), wxT("UndoHistory,Karaoke,MixerBoard")}, - {wxT("/Analyze/Analyzers/Windows"), wxT("ContrastAnalyser,PlotSpectrum")}, - {wxT("/Transport/Basic"),wxT("Play,Record,Scrubbing,Cursor")}, - }; - - bool doFlush = false; - for (auto pair : pairs) { - const auto key = wxString{'/'} + MenuPathStart + pair.first; - if ( gPrefs->Read(key).empty() ) { - gPrefs->Write( key, pair.second ); - doFlush = true; - } - } - - if (doFlush) - gPrefs->Flush(); -} - using namespace MenuTable; - struct MenuItemVisitor : MenuVisitor { MenuItemVisitor( AudacityProject &proj, CommandManager &man ) @@ -1103,9 +1102,6 @@ struct MenuItemVisitor : MenuVisitor void MenuCreator::CreateMenusAndCommands(AudacityProject &project) { - static std::once_flag flag; - std::call_once( flag, InitializeMenuOrdering ); - auto &commandManager = CommandManager::Get( project ); // The list of defaults to exclude depends on @@ -1129,7 +1125,6 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project) void MenuManager::Visit( MenuVisitor &visitor ) { - static const auto menuTree = MenuTable::Items( MenuPathStart ); Registry::Visit( visitor, menuTree.get(), &sRegistry() ); } diff --git a/src/MixerBoard.cpp b/src/MixerBoard.cpp index b68902b5d..7f4557124 100644 --- a/src/MixerBoard.cpp +++ b/src/MixerBoard.cpp @@ -33,7 +33,6 @@ #include "NoteTrack.h" #endif -#include "CommonCommandFlags.h" #include "KeyboardCapture.h" #include "Prefs.h" // for RTL_WORKAROUND #include "Project.h" @@ -1485,46 +1484,5 @@ void MixerBoardFrame::Recreate( AudacityProject *pProject ) this->SetSize( siz2 ); } -// Remaining code hooks this add-on into the application -#include "commands/CommandContext.h" -namespace { - -// Mixer board window attached to each project is built on demand by: -AudacityProject::AttachedWindows::RegisteredFactory sMixerBoardKey{ - []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { - return safenew MixerBoardFrame( &parent ); - } -}; - -// Define our extra menu item that invokes that factory -struct Handler : CommandHandlerObject { - void OnMixerBoard(const CommandContext &context) - { - auto &project = context.project; - - auto mixerBoardFrame = &project.AttachedWindows::Get( sMixerBoardKey ); - mixerBoardFrame->Show(); - mixerBoardFrame->Raise(); - mixerBoardFrame->SetFocus(); - } -}; - -CommandHandlerObject &findCommandHandler(AudacityProject &) { - // Handler is not stateful. Doesn't need a factory registered with - // AudacityProject. - static Handler instance; - return instance; -} - -// Register that menu item - -using namespace MenuTable; -AttachedItem sAttachment{ wxT("View/Windows"), - ( FinderScope{ findCommandHandler }, - Command( wxT("MixerBoard"), XXO("&Mixer Board..."), &Handler::OnMixerBoard, - PlayableTracksExistFlag()) ) -}; - -} diff --git a/src/effects/Contrast.cpp b/src/effects/Contrast.cpp index 2a64815fa..ba67e5687 100644 --- a/src/effects/Contrast.cpp +++ b/src/effects/Contrast.cpp @@ -12,12 +12,11 @@ #include "../Audacity.h" #include "Contrast.h" -#include "../CommonCommandFlags.h" #include "../WaveTrack.h" #include "../Prefs.h" #include "../Project.h" #include "../ProjectSettings.h" -#include "../ProjectWindow.h" +#include "../ProjectWindowBase.h" #include "../ShuttleGui.h" #include "../FileNames.h" #include "../ViewInfo.h" @@ -649,56 +648,3 @@ void ContrastDialog::OnReset(wxCommandEvent & /*event*/) mPassFailText->ChangeValue(wxT("")); mDiffText->ChangeValue(wxT("")); } - -// Remaining code hooks this add-on into the application -#include "commands/CommandContext.h" -#include "commands/CommandManager.h" -#include "../commands/ScreenshotCommand.h" - -namespace { - -// Contrast window attached to each project is built on demand by: -AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey{ - []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { - auto &window = ProjectWindow::Get( parent ); - return safenew ContrastDialog( - &window, -1, XO("Contrast Analysis (WCAG 2 compliance)"), - wxPoint{ 150, 150 } - ); - } -}; - -// Define our extra menu item that invokes that factory -struct Handler : CommandHandlerObject { - void OnContrast(const CommandContext &context) - { - auto &project = context.project; - auto contrastDialog = - &project.AttachedWindows::Get< ContrastDialog >( sContrastDialogKey ); - - contrastDialog->CentreOnParent(); - if( ScreenshotCommand::MayCapture( contrastDialog ) ) - return; - contrastDialog->Show(); - } -}; - -CommandHandlerObject &findCommandHandler(AudacityProject &) { - // Handler is not stateful. Doesn't need a factory registered with - // AudacityProject. - static Handler instance; - return instance; -} - -// Register that menu item - -using namespace MenuTable; -AttachedItem sAttachment{ wxT("Analyze/Analyzers/Windows"), - ( FinderScope{ findCommandHandler }, - Command( wxT("ContrastAnalyser"), XXO("Contrast..."), - &Handler::OnContrast, - AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(), - wxT("Ctrl+Shift+T") ) ) -}; - -} diff --git a/src/menus/ClipMenus.cpp b/src/menus/ClipMenus.cpp index 01a23595e..84b125cf3 100644 --- a/src/menus/ClipMenus.cpp +++ b/src/menus/ClipMenus.cpp @@ -823,13 +823,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& ClipActions::Handler :: X) -namespace { -using namespace MenuTable; - -// Register menu items - -BaseItemSharedPtr ClipSelectMenu() +// Under /MenuBar/Select +MenuTable::BaseItemSharedPtr ClipSelectMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu { @@ -853,13 +850,10 @@ BaseItemSharedPtr ClipSelectMenu() return menu; } -AttachedItem sAttachment1{ - wxT("Select/Basic"), - Shared( ClipSelectMenu() ) -}; - -BaseItemSharedPtr ClipCursorItems() +// Under /MenuBar/Transport/Cursor +MenuTable::BaseItemSharedPtr ClipCursorItems() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr items{ @@ -877,14 +871,11 @@ BaseItemSharedPtr ClipCursorItems() return items; } -AttachedItem sAttachment2{ - { wxT("Transport/Basic/Cursor"), - { OrderingHint::Before, wxT("CursProjectStart") } }, - Shared( ClipCursorItems() ) -}; - -BaseItemSharedPtr ExtraClipCursorItems() +// Under /MenuBar/Optional/Extra/Cursor +MenuTable::BaseItemSharedPtr ExtraClipCursorItems() { + using namespace MenuTable; + static BaseItemSharedPtr items{ ( FinderScope{ findCommandHandler }, Items( wxT("Clip"), @@ -896,11 +887,4 @@ BaseItemSharedPtr ExtraClipCursorItems() return items; } -AttachedItem sAttachment3{ - { wxT("Optional/Extra/Part2/Cursor"), { OrderingHint::End, {} } }, - Shared( ExtraClipCursorItems() ) -}; - -} - #undef FN diff --git a/src/menus/EditMenus.cpp b/src/menus/EditMenus.cpp index 23c1304fb..7e05ad92c 100644 --- a/src/menus/EditMenus.cpp +++ b/src/menus/EditMenus.cpp @@ -997,6 +997,8 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& EditActions::Handler :: X) +MenuTable::BaseItemSharedPtr LabelEditMenus(); + static const ReservedCommandFlag &CutCopyAvailableFlag() { static ReservedCommandFlag flag{ [](const AudacityProject &project){ @@ -1022,10 +1024,10 @@ static const ReservedCommandFlag cutCopyOptions() }; return flag; } -namespace { -using namespace MenuTable; -BaseItemSharedPtr EditMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr EditMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto NotBusyTimeAndTracksFlags = @@ -1139,6 +1141,8 @@ BaseItemSharedPtr EditMenu() ////////////////////////////////////////////////////////////////////////// + LabelEditMenus(), + Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata), AudioIONotBusyFlag() ) @@ -1160,13 +1164,10 @@ BaseItemSharedPtr EditMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( EditMenu() ) -}; - -BaseItemSharedPtr ExtraEditMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraEditMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto flags = AudioIONotBusyFlag() | TracksSelectedFlag() | TimeSelectedFlag(); @@ -1221,10 +1222,4 @@ RegisteredMenuItemEnabler selectWaveTracks2{{ selectAll }}; -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part1"), - Shared( ExtraEditMenu() ) -}; - -} #undef FN diff --git a/src/menus/ExtraMenus.cpp b/src/menus/ExtraMenus.cpp index 92021bd98..8c151c763 100644 --- a/src/menus/ExtraMenus.cpp +++ b/src/menus/ExtraMenus.cpp @@ -136,23 +136,55 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& ExtraActions::Handler :: X) -namespace { -using namespace MenuTable; +// Imported menu item definitions -BaseItemSharedPtr ExtraMixerMenu(); -BaseItemSharedPtr ExtraDeviceMenu(); +MenuTable::BaseItemSharedPtr ExtraEditMenu(); +MenuTable::BaseItemSharedPtr ExtraSelectionMenu(); +MenuTable::BaseItemSharedPtr ExtraCursorMenu(); +MenuTable::BaseItemSharedPtr ExtraSeekMenu(); +MenuTable::BaseItemSharedPtr ExtraToolsMenu(); +MenuTable::BaseItemSharedPtr ExtraTransportMenu(); +MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu(); +MenuTable::BaseItemSharedPtr ExtraTrackMenu(); +MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu(); +MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu(); +MenuTable::BaseItemSharedPtr ExtraWindowItems(); +MenuTable::BaseItemSharedPtr ExtraGlobalCommands(); +MenuTable::BaseItemSharedPtr ExtraFocusMenu(); +MenuTable::BaseItemSharedPtr ExtraMenu(); +MenuTable::BaseItemSharedPtr ExtraMixerMenu(); +MenuTable::BaseItemSharedPtr ExtraDeviceMenu(); +MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject & ); -BaseItemSharedPtr ExtraMenu() +MenuTable::BaseItemSharedPtr ExtraMenu() { + using namespace MenuTable; + // Table of menu factories. // TODO: devise a registration system instead. static BaseItemSharedPtr extraItems{ Items( wxEmptyString, Section( "Part1", - ExtraMixerMenu() + ExtraTransportMenu() + , ExtraToolsMenu() + , ExtraMixerMenu() + , ExtraEditMenu() + , ExtraPlayAtSpeedMenu() + , ExtraSeekMenu() , ExtraDeviceMenu() + , ExtraSelectionMenu() ), - Section( "Part2" ) + Section( "Part2", + ExtraGlobalCommands() + , ExtraFocusMenu() + , ExtraCursorMenu() + , ExtraTrackMenu() + , ExtraScriptablesIMenu() + , ExtraScriptablesIIMenu() + + // Delayed evaluation: + , ExtraMiscItems + ) ) }; static const auto pred = @@ -164,14 +196,10 @@ BaseItemSharedPtr ExtraMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( ExtraMenu() ) -}; - -// Under /MenuBar/Optional/Extra/Part1 -BaseItemSharedPtr ExtraMixerMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraMixerMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Mixer"), XO("Mi&xer"), @@ -191,9 +219,10 @@ BaseItemSharedPtr ExtraMixerMenu() return menu; } -// Under /MenuBar/Optional/Extra/Part1 -BaseItemSharedPtr ExtraDeviceMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraDeviceMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Device"), XO("De&vice"), @@ -212,9 +241,10 @@ BaseItemSharedPtr ExtraDeviceMenu() return menu; } -// Under /MenuBar/Optional/Extra/Part2 -BaseItemPtr ExtraMiscItems() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project ) { + using namespace MenuTable; using Options = CommandManager::Options; constexpr auto key = @@ -228,24 +258,15 @@ BaseItemPtr ExtraMiscItems() // Not a menu. return ( FinderScope{ findCommandHandler }, Items( wxT("Misc"), - // Delayed evaluation - []( AudacityProject &project ) { - return - // Accel key is not bindable. - Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"), - FN(OnFullScreen), - AlwaysEnabledFlag, - Options{ key }.CheckState( - GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) ); - } + // Accel key is not bindable. + Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"), + FN(OnFullScreen), + AlwaysEnabledFlag, + Options{ key }.CheckState( + GetProjectFrame( project ).wxTopLevelWindow::IsFullScreen() ) ), + + ExtraWindowItems() ) ); } -AttachedItem sAttachment2{ - Placement{ wxT("Optional/Extra/Part2"), { OrderingHint::End } }, - Shared( ExtraMiscItems() ) -}; - -} - #undef FN diff --git a/src/menus/FileMenus.cpp b/src/menus/FileMenus.cpp index d7b60c039..c60ceeb14 100644 --- a/src/menus/FileMenus.cpp +++ b/src/menus/FileMenus.cpp @@ -551,11 +551,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& FileActions::Handler :: X) -namespace { -using namespace MenuTable; - -BaseItemSharedPtr FileMenu() +// under /MenuBar +MenuTable::BaseItemSharedPtr FileMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu{ @@ -706,10 +705,4 @@ BaseItemSharedPtr FileMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( FileMenu() ) -}; -} - #undef FN diff --git a/src/menus/HelpMenus.cpp b/src/menus/HelpMenus.cpp index c950cc652..11c80e7a4 100644 --- a/src/menus/HelpMenus.cpp +++ b/src/menus/HelpMenus.cpp @@ -523,10 +523,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& HelpActions::Handler :: X) -namespace { -using namespace MenuTable; -BaseItemSharedPtr HelpMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr HelpMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Help"), XO("&Help"), @@ -602,11 +602,4 @@ BaseItemSharedPtr HelpMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( HelpMenu() ) -}; - -} - #undef FN diff --git a/src/menus/LabelMenus.cpp b/src/menus/LabelMenus.cpp index 02c4ee368..d9163668f 100644 --- a/src/menus/LabelMenus.cpp +++ b/src/menus/LabelMenus.cpp @@ -585,9 +585,8 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& LabelEditActions::Handler :: X) -namespace { -using namespace MenuTable; -BaseItemSharedPtr LabelEditMenus() +// Under /MenuBar/Edit +MenuTable::BaseItemSharedPtr LabelEditMenus() { using namespace MenuTable; using Options = CommandManager::Options; @@ -602,7 +601,7 @@ BaseItemSharedPtr LabelEditMenus() static BaseItemSharedPtr menus{ ( FinderScope{ findCommandHandler }, - Items( wxT("LabelEditMenus"), + Items( wxEmptyString, Menu( wxT("Labels"), XO("&Labels"), Section( "", @@ -688,12 +687,4 @@ BaseItemSharedPtr LabelEditMenus() return menus; } -AttachedItem sAttachment1{ - { wxT("Edit/Other"), - { OrderingHint::Before, wxT("EditMetaData") } }, - Shared( LabelEditMenus() ) -}; - -} - #undef FN diff --git a/src/menus/NavigationMenus.cpp b/src/menus/NavigationMenus.cpp index 52e0d1ffb..a7c41698e 100644 --- a/src/menus/NavigationMenus.cpp +++ b/src/menus/NavigationMenus.cpp @@ -555,11 +555,11 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) { #define FN(X) (& NavigationActions::Handler :: X) -namespace { -using namespace MenuTable; -BaseItemSharedPtr ExtraGlobalCommands() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraGlobalCommands() { // Ceci n'est pas un menu + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr items{ @@ -575,13 +575,10 @@ BaseItemSharedPtr ExtraGlobalCommands() return items; } -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part2"), - Shared( ExtraGlobalCommands() ) -}; - -BaseItemSharedPtr ExtraFocusMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraFocusMenu() { + using namespace MenuTable; static const auto FocusedTracksFlags = TracksExistFlag() | TrackPanelHasFocus(); static BaseItemSharedPtr menu{ @@ -613,11 +610,4 @@ BaseItemSharedPtr ExtraFocusMenu() return menu; } -AttachedItem sAttachment3{ - wxT("Optional/Extra/Part2"), - Shared( ExtraFocusMenu() ) -}; - -} - #undef FN diff --git a/src/menus/PluginMenus.cpp b/src/menus/PluginMenus.cpp index 34cfdf07b..60473a51a 100644 --- a/src/menus/PluginMenus.cpp +++ b/src/menus/PluginMenus.cpp @@ -5,6 +5,7 @@ #include "../BatchProcessDialog.h" #include "../Benchmark.h" #include "../CommonCommandFlags.h" +#include "../FreqWindow.h" #include "../Menus.h" #include "../PluginManager.h" #include "../Prefs.h" @@ -15,6 +16,7 @@ #include "../commands/CommandContext.h" #include "../commands/CommandManager.h" #include "../commands/ScreenshotCommand.h" +#include "../effects/Contrast.h" #include "../effects/EffectManager.h" #include "../effects/EffectUI.h" #include "../effects/RealtimeEffectManager.h" @@ -23,6 +25,26 @@ // private helper classes and functions namespace { +AudacityProject::AttachedWindows::RegisteredFactory sContrastDialogKey{ + []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { + auto &window = ProjectWindow::Get( parent ); + return safenew ContrastDialog( + &window, -1, XO("Contrast Analysis (WCAG 2 compliance)"), + wxPoint{ 150, 150 } + ); + } +}; + +AudacityProject::AttachedWindows::RegisteredFactory sFrequencyWindowKey{ + []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { + auto &window = ProjectWindow::Get( parent ); + return safenew FrequencyPlotDialog( + &window, -1, parent, XO("Frequency Analysis"), + wxPoint{ 150, 150 } + ); + } +}; + AudacityProject::AttachedWindows::RegisteredFactory sMacrosWindowKey{ []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { auto &window = ProjectWindow::Get( parent ); @@ -434,6 +456,31 @@ void OnManageAnalyzers(const CommandContext &context) DoManagePluginsMenu(project, EffectTypeAnalyze); } +void OnContrast(const CommandContext &context) +{ + auto &project = context.project; + auto contrastDialog = + &project.AttachedWindows::Get< ContrastDialog >( sContrastDialogKey ); + + contrastDialog->CentreOnParent(); + if( ScreenshotCommand::MayCapture( contrastDialog ) ) + return; + contrastDialog->Show(); +} + +void OnPlotSpectrum(const CommandContext &context) +{ + auto &project = context.project; + auto freqWindow = + &project.AttachedWindows::Get< FrequencyPlotDialog >( sFrequencyWindowKey ); + + if( ScreenshotCommand::MayCapture( freqWindow ) ) + return; + freqWindow->Show(true); + freqWindow->Raise(); + freqWindow->SetFocus(); +} + void OnManageTools(const CommandContext &context ) { auto &project = context.project; @@ -701,10 +748,9 @@ MenuTable::BaseItemPtrs PopulateMacrosMenu( CommandFlag flags ) // Menu definitions // Under /MenuBar -namespace { -using namespace MenuTable; -BaseItemSharedPtr GenerateMenu() +MenuTable::BaseItemSharedPtr GenerateMenu() { + using namespace MenuTable; // All of this is a bit hacky until we can get more things connected into // the plugin manager...sorry! :-( @@ -738,13 +784,10 @@ static const ReservedCommandFlag } }; return flag; } //lll -AttachedItem sAttachment1{ - wxT(""), - Shared( GenerateMenu() ) -}; - -BaseItemSharedPtr EffectMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr EffectMenu() { + using namespace MenuTable; // All of this is a bit hacky until we can get more things connected into // the plugin manager...sorry! :-( @@ -791,13 +834,10 @@ BaseItemSharedPtr EffectMenu() return menu; } -AttachedItem sAttachment2{ - wxT(""), - Shared( EffectMenu() ) -}; - -BaseItemSharedPtr AnalyzeMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr AnalyzeMenu() { + using namespace MenuTable; // All of this is a bit hacky until we can get more things connected into // the plugin manager...sorry! :-( @@ -812,7 +852,11 @@ BaseItemSharedPtr AnalyzeMenu() #endif Section( "Analyzers", - Items( "Windows" ), + Command( wxT("ContrastAnalyser"), XXO("Contrast..."), FN(OnContrast), + AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(), + wxT("Ctrl+Shift+T") ), + Command( wxT("PlotSpectrum"), XXO("Plot Spectrum..."), FN(OnPlotSpectrum), + AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag() ), // Delayed evaluation: [](AudacityProject&) @@ -826,13 +870,10 @@ BaseItemSharedPtr AnalyzeMenu() return menu; } -AttachedItem sAttachment3{ - wxT(""), - Shared( AnalyzeMenu() ) -}; - -BaseItemSharedPtr ToolsMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr ToolsMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu{ @@ -913,13 +954,11 @@ BaseItemSharedPtr ToolsMenu() return menu; } -AttachedItem sAttachment4{ - wxT(""), - Shared( ToolsMenu() ) -}; - -BaseItemSharedPtr ExtraScriptablesIMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu() { + using namespace MenuTable; + // These are the more useful to VI user Scriptables. static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, @@ -965,13 +1004,11 @@ BaseItemSharedPtr ExtraScriptablesIMenu() return menu; } -AttachedItem sAttachment5{ - wxT("Optional/Extra/Part2"), - Shared( ExtraScriptablesIMenu() ) -}; - -BaseItemSharedPtr ExtraScriptablesIIMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu() { + using namespace MenuTable; + // Less useful to VI users. static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, @@ -1009,11 +1046,4 @@ BaseItemSharedPtr ExtraScriptablesIIMenu() return menu; } -AttachedItem sAttachment6{ - wxT("Optional/Extra/Part2"), - Shared( ExtraScriptablesIIMenu() ) -}; - -} - #undef FN diff --git a/src/menus/SelectMenus.cpp b/src/menus/SelectMenus.cpp index d54986b61..f1005e8ba 100644 --- a/src/menus/SelectMenus.cpp +++ b/src/menus/SelectMenus.cpp @@ -1028,10 +1028,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) { #define FN(X) (& SelectActions::Handler :: X) -namespace { -using namespace MenuTable; -BaseItemSharedPtr SelectMenu() +MenuTable::BaseItemSharedPtr ClipSelectMenu(); + +// Under /MenuBar +MenuTable::BaseItemSharedPtr SelectMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, @@ -1110,8 +1112,14 @@ BaseItemSharedPtr SelectMenu() Command( wxT("NextLowerPeakFrequency"), XXO("Next &Lower Peak Frequency"), FN(OnNextLowerPeakFrequency), TracksExistFlag() ) - ) + ), #endif + + ////////////////////////////////////////////////////////////////////////// + + ClipSelectMenu() + + ////////////////////////////////////////////////////////////////////////// ), Section( "", @@ -1136,13 +1144,10 @@ BaseItemSharedPtr SelectMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( SelectMenu() ) -}; - -BaseItemSharedPtr ExtraSelectionMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraSelectionMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Select"), XO("&Selection"), @@ -1182,15 +1187,12 @@ BaseItemSharedPtr ExtraSelectionMenu() return menu; } -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part1"), - Shared( ExtraSelectionMenu() ) -}; -} +MenuTable::BaseItemSharedPtr ClipCursorItems(); -namespace { -BaseItemSharedPtr CursorMenu() +// Under /MenuBar/Transport +MenuTable::BaseItemSharedPtr CursorMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto CanStopFlags = AudioIONotBusyFlag() | CanStopAudioStreamFlag(); @@ -1220,6 +1222,8 @@ BaseItemSharedPtr CursorMenu() TracksSelectedFlag(), Options{ wxT("K"), XO("Cursor to Track End") } ), + ClipCursorItems(), + Command( wxT("CursProjectStart"), XXO("&Project Start"), FN(OnSkipStart), CanStopFlags, @@ -1231,13 +1235,13 @@ BaseItemSharedPtr CursorMenu() return menu; } -AttachedItem sAttachment0{ - wxT("Transport/Basic"), - Shared( CursorMenu() ) -}; +MenuTable::BaseItemSharedPtr ExtraClipCursorItems(); -BaseItemSharedPtr ExtraCursorMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraCursorMenu() { + using namespace MenuTable; + static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Cursor"), XO("&Cursor"), @@ -1258,18 +1262,17 @@ BaseItemSharedPtr ExtraCursorMenu() TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+,") ), Command( wxT("CursorLongJumpRight"), XXO("Cursor Long Ju&mp Right"), FN(OnCursorLongJumpRight), - TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") ) + TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+.") ), + + ExtraClipCursorItems() ) ) }; return menu; } -AttachedItem sAttachment4{ - wxT("Optional/Extra/Part2"), - Shared( ExtraCursorMenu() ) -}; - -BaseItemSharedPtr ExtraSeekMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraSeekMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Seek"), XO("See&k"), @@ -1286,11 +1289,4 @@ BaseItemSharedPtr ExtraSeekMenu() return menu; } -AttachedItem sAttachment5{ - wxT("Optional/Extra/Part1"), - Shared( ExtraSeekMenu() ) -}; - -} - #undef FN diff --git a/src/menus/ToolbarMenus.cpp b/src/menus/ToolbarMenus.cpp index 4b76301fd..0ac0221f7 100644 --- a/src/menus/ToolbarMenus.cpp +++ b/src/menus/ToolbarMenus.cpp @@ -253,100 +253,95 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& ToolbarActions::Handler :: X) -namespace{ -using namespace MenuTable; -BaseItemSharedPtr ToolbarsMenu() +// Under /MenuBar/View +MenuTable::BaseItemSharedPtr ToolbarsMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto checkOff = Options{}.CheckState( false ); static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, - Section( wxT("Toolbars"), - Menu( wxT("Toolbars"), XO("&Toolbars"), - Section( "Reset", - /* i18n-hint: (verb)*/ - Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"), - FN(OnResetToolBars), AlwaysEnabledFlag ) - ), + Menu( wxT("Toolbars"), XO("&Toolbars"), + Section( "Reset", + /* i18n-hint: (verb)*/ + Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"), + FN(OnResetToolBars), AlwaysEnabledFlag ) + ), - Section( "Other", - /* i18n-hint: Clicking this menu item shows the toolbar - with the big buttons on it (play record etc)*/ - Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"), - FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows a toolbar - that has some tools in it*/ - Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"), - FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - with the recording level meters*/ - Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"), - FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - with the playback level meter*/ - Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"), - FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff ) + Section( "Other", + /* i18n-hint: Clicking this menu item shows the toolbar + with the big buttons on it (play record etc)*/ + Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"), + FN(OnShowTransportToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows a toolbar + that has some tools in it*/ + Command( wxT("ShowToolsTB"), XXO("T&ools Toolbar"), + FN(OnShowToolsToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + with the recording level meters*/ + Command( wxT("ShowRecordMeterTB"), XXO("&Recording Meter Toolbar"), + FN(OnShowRecordMeterToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + with the playback level meter*/ + Command( wxT("ShowPlayMeterTB"), XXO("&Playback Meter Toolbar"), + FN(OnShowPlayMeterToolBar), AlwaysEnabledFlag, checkOff ) - /* --i18nhint: Clicking this menu item shows the toolbar - which has sound level meters*/ - //Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"), - // FN(OnShowMeterToolBar), AlwaysEnabledFlag, checkOff ), + /* --i18nhint: Clicking this menu item shows the toolbar + which has sound level meters*/ + //Command( wxT("ShowMeterTB"), XXO("Co&mbined Meter Toolbar"), + // FN(OnShowMeterToolBar), AlwaysEnabledFlag, checkOff ), - , - - /* i18n-hint: Clicking this menu item shows the toolbar - with the mixer*/ - Command( wxT("ShowMixerTB"), XXO("Mi&xer Toolbar"), - FN(OnShowMixerToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar for editing*/ - Command( wxT("ShowEditTB"), XXO("&Edit Toolbar"), - FN(OnShowEditToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - for transcription (currently just vary play speed)*/ - Command( wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar"), - FN(OnShowTranscriptionToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - that enables Scrub or Seek playback and Scrub Ruler*/ - Command( wxT("ShowScrubbingTB"), XXO("Scru&b Toolbar"), - FN(OnShowScrubbingToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - that manages devices*/ - Command( wxT("ShowDeviceTB"), XXO("&Device Toolbar"), - FN(OnShowDeviceToolBar), AlwaysEnabledFlag, checkOff ), - /* i18n-hint: Clicking this menu item shows the toolbar - for selecting a time range of audio*/ - Command( wxT("ShowSelectionTB"), XXO("&Selection Toolbar"), - FN(OnShowSelectionToolBar), AlwaysEnabledFlag, checkOff ) - #ifdef EXPERIMENTAL_TIMER_TOOLBAR , - /* i18n-hint: Clicking this menu item shows the toolbar - for viewing actual time of the cursor*/ - Command( wxT("ShowTimerToolBarTB"), XXO("&Timer Toolbar"), - FN(OnShowTimerToolBar), AlwaysEnabledFlag, checkOff ) - #endif - #ifdef EXPERIMENTAL_SPECTRAL_EDITING - , - Command( wxT("ShowSpectralSelectionTB"), - /* i18n-hint: Clicking this menu item shows the toolbar - for selecting a frequency range of audio*/ - XXO("Spe&ctral Selection Toolbar"), - FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff ) - #endif - ) + + /* i18n-hint: Clicking this menu item shows the toolbar + with the mixer*/ + Command( wxT("ShowMixerTB"), XXO("Mi&xer Toolbar"), + FN(OnShowMixerToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar for editing*/ + Command( wxT("ShowEditTB"), XXO("&Edit Toolbar"), + FN(OnShowEditToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + for transcription (currently just vary play speed)*/ + Command( wxT("ShowTranscriptionTB"), XXO("Pla&y-at-Speed Toolbar"), + FN(OnShowTranscriptionToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + that enables Scrub or Seek playback and Scrub Ruler*/ + Command( wxT("ShowScrubbingTB"), XXO("Scru&b Toolbar"), + FN(OnShowScrubbingToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + that manages devices*/ + Command( wxT("ShowDeviceTB"), XXO("&Device Toolbar"), + FN(OnShowDeviceToolBar), AlwaysEnabledFlag, checkOff ), + /* i18n-hint: Clicking this menu item shows the toolbar + for selecting a time range of audio*/ + Command( wxT("ShowSelectionTB"), XXO("&Selection Toolbar"), + FN(OnShowSelectionToolBar), AlwaysEnabledFlag, checkOff ) + #ifdef EXPERIMENTAL_TIMER_TOOLBAR + , + /* i18n-hint: Clicking this menu item shows the toolbar + for viewing actual time of the cursor*/ + Command( wxT("ShowTimerToolBarTB"), XXO("&Timer Toolbar"), + FN(OnShowTimerToolBar), AlwaysEnabledFlag, checkOff ) + #endif + #ifdef EXPERIMENTAL_SPECTRAL_EDITING + , + Command( wxT("ShowSpectralSelectionTB"), + /* i18n-hint: Clicking this menu item shows the toolbar + for selecting a frequency range of audio*/ + XXO("Spe&ctral Selection Toolbar"), + FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff ) + #endif ) ) ) }; return menu; } -AttachedItem sAttachment1{ - Placement{ wxT("View/Other"), { OrderingHint::Begin } }, - Shared( ToolbarsMenu() ) -}; - -BaseItemSharedPtr ExtraToolsMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraToolsMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Tools"), XO("T&ools"), @@ -370,10 +365,4 @@ BaseItemSharedPtr ExtraToolsMenu() return menu; } -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part1"), - Shared( ExtraToolsMenu() ) -}; -} - #undef FN diff --git a/src/menus/TrackMenus.cpp b/src/menus/TrackMenus.cpp index 2312050ce..3da7cc54a 100644 --- a/src/menus/TrackMenus.cpp +++ b/src/menus/TrackMenus.cpp @@ -1278,11 +1278,10 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& TrackActions::Handler :: X) // Under /MenuBar -namespace { -using namespace MenuTable; -BaseItemSharedPtr TracksMenu() +MenuTable::BaseItemSharedPtr TracksMenu() { // Tracks Menu (formerly Project Menu) + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu{ @@ -1438,13 +1437,10 @@ BaseItemSharedPtr TracksMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( TracksMenu() ) -}; - -BaseItemSharedPtr ExtraTrackMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraTrackMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Track"), XO("&Track"), @@ -1495,11 +1491,4 @@ BaseItemSharedPtr ExtraTrackMenu() return menu; } -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part2"), - Shared( ExtraTrackMenu() ) -}; - -} - #undef FN diff --git a/src/menus/TransportMenus.cpp b/src/menus/TransportMenus.cpp index e05fe6db1..0d7e38303 100644 --- a/src/menus/TransportMenus.cpp +++ b/src/menus/TransportMenus.cpp @@ -28,6 +28,7 @@ #include "../commands/CommandManager.h" #include "../toolbars/ControlToolBar.h" #include "../toolbars/TranscriptionToolBar.h" +#include "../tracks/ui/Scrubbing.h" #include "../widgets/AudacityMessageBox.h" #include "../widgets/ErrorDialog.h" @@ -189,6 +190,57 @@ void DoMoveToLabel(AudacityProject &project, bool next) } } + +void DoKeyboardScrub(AudacityProject& project, bool backwards, bool keyUp) +{ + static double initT0 = 0; + static double initT1 = 0; + + if (keyUp) { + auto &scrubber = Scrubber::Get(project); + if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) { + auto gAudioIO = AudioIOBase::Get(); + auto time = gAudioIO->GetStreamTime(); + auto &viewInfo = ViewInfo::Get(project); + auto &selection = viewInfo.selectedRegion; + + // If the time selection has not changed during scrubbing + // set the cursor position + if (selection.t0() == initT0 && selection.t1() == initT1) { + double endTime = TrackList::Get(project).GetEndTime(); + time = std::min(time, endTime); + time = std::max(time, 0.0); + selection.setTimes(time, time); + ProjectHistory::Get(project).ModifyState(false); + } + + scrubber.Cancel(); + ProjectAudioManager::Get(project).Stop(); + } + } + else { // KeyDown + auto gAudioIO = AudioIOBase::Get(); + auto &scrubber = Scrubber::Get(project); + if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() != backwards) { + // change direction + scrubber.SetBackwards(backwards); + } + else if (!gAudioIO->IsBusy() && !scrubber.HasMark()) { + auto &viewInfo = ViewInfo::Get(project); + auto &selection = viewInfo.selectedRegion; + double endTime = TrackList::Get(project).GetEndTime(); + double t0 = selection.t0(); + + if ((!backwards && t0 >= 0 && t0 < endTime) || + (backwards && t0 > 0 && t0 <= endTime)) { + initT0 = t0; + initT1 = selection.t1(); + scrubber.StartKeyboardScrubbing(t0, backwards); + } + } + } +} + } // Menu handler functions @@ -785,6 +837,32 @@ void OnPlayCutPreview(const CommandContext &context) ); } +void OnKeyboardScrubBackwards(const CommandContext &context) +{ + auto &project = context.project; + auto evt = context.pEvt; + if (evt) + DoKeyboardScrub(project, true, evt->GetEventType() == wxEVT_KEY_UP); + else { // called from menu, so simulate keydown and keyup + DoKeyboardScrub(project, true, false); + DoKeyboardScrub(project, true, true); + } +} + + +void OnKeyboardScrubForwards(const CommandContext &context) +{ + auto &project = context.project; + auto evt = context.pEvt; + if (evt) + DoKeyboardScrub(project, false, evt->GetEventType() == wxEVT_KEY_UP); + else { // called from menu, so simulate keydown and keyup + DoKeyboardScrub(project, false, false); + DoKeyboardScrub(project, false, true); + } +} + + void OnPlayAtSpeed(const CommandContext &context) { auto &project = context.project; @@ -890,11 +968,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& TransportActions::Handler :: X) +MenuTable::BaseItemSharedPtr CursorMenu(); + // Under /MenuBar -namespace { -using namespace MenuTable; -BaseItemSharedPtr TransportMenu() +MenuTable::BaseItemSharedPtr TransportMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto checkOff = Options{}.CheckState( false ); @@ -957,7 +1036,12 @@ BaseItemSharedPtr TransportMenu() // PRL: caution, this is a duplicated command name! Command( wxT("Pause"), XXO("&Pause"), FN(OnPause), CanStopAudioStreamFlag(), wxT("P") ) - ) + ), + + // Scrubbing sub-menu + Scrubber::Menu(), + + CursorMenu() ), Section( "Other", @@ -1014,13 +1098,10 @@ BaseItemSharedPtr TransportMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( TransportMenu() ) -}; - -BaseItemSharedPtr ExtraTransportMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraTransportMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Transport"), XO("T&ransport"), @@ -1058,18 +1139,21 @@ BaseItemSharedPtr ExtraTransportMenu() wxT("Ctrl+Shift+F7") ), Command( wxT("PlayCutPreview"), XXO("Play C&ut Preview"), FN(OnPlayCutPreview), - CaptureNotBusyFlag(), wxT("C") ) + CaptureNotBusyFlag(), wxT("C") ), + Command(wxT("KeyboardScrubBackwards"), XXO("Scrub Bac&kwards"), + FN(OnKeyboardScrubBackwards), + CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("U\twantKeyup")), + Command(wxT("KeyboardScrubForwards"), XXO("Scrub For&wards"), + FN(OnKeyboardScrubForwards), + CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("I\twantKeyup")) ) ) }; return menu; } -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part1"), - Shared( ExtraTransportMenu() ) -}; - -BaseItemSharedPtr ExtraPlayAtSpeedMenu() +// Under /MenuBar/Optional/Extra +MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu() { + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("PlayAtSpeed"), XO("&Play-at-Speed"), @@ -1100,11 +1184,4 @@ BaseItemSharedPtr ExtraPlayAtSpeedMenu() return menu; } -AttachedItem sAttachment3{ - wxT("Optional/Extra/Part1"), - Shared( ExtraPlayAtSpeedMenu() ) -}; - -} - #undef FN diff --git a/src/menus/ViewMenus.cpp b/src/menus/ViewMenus.cpp index e4b3baa00..e8ab97110 100644 --- a/src/menus/ViewMenus.cpp +++ b/src/menus/ViewMenus.cpp @@ -2,7 +2,10 @@ #include "../Experimental.h" #include "../CommonCommandFlags.h" +#include "../HistoryWindow.h" +#include "../LyricsWindow.h" #include "../Menus.h" +#include "../MixerBoard.h" #include "../Prefs.h" #include "../Project.h" #include "../ProjectHistory.h" @@ -28,6 +31,25 @@ // private helper classes and functions namespace { +AudacityProject::AttachedWindows::RegisteredFactory sMixerBoardKey{ + []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { + return safenew MixerBoardFrame( &parent ); + } +}; + +AudacityProject::AttachedWindows::RegisteredFactory sHistoryWindowKey{ + []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { + auto &undoManager = UndoManager::Get( parent ); + return safenew HistoryDialog( &parent, &undoManager ); + } +}; + +AudacityProject::AttachedWindows::RegisteredFactory sLyricsWindowKey{ + []( AudacityProject &parent ) -> wxWeakRef< wxWindow > { + return safenew LyricsWindow( &parent ); + } +}; + double GetZoomOfSelection( const AudacityProject &project ) { auto &viewInfo = ViewInfo::Get( project ); @@ -303,6 +325,34 @@ void OnGoSelEnd(const CommandContext &context) selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2)); } +void OnHistory(const CommandContext &context) +{ + auto &project = context.project; + + auto historyWindow = &project.AttachedWindows::Get( sHistoryWindowKey ); + historyWindow->Show(); + historyWindow->Raise(); +} + +void OnKaraoke(const CommandContext &context) +{ + auto &project = context.project; + + auto lyricsWindow = &project.AttachedWindows::Get( sLyricsWindowKey ); + lyricsWindow->Show(); + lyricsWindow->Raise(); +} + +void OnMixerBoard(const CommandContext &context) +{ + auto &project = context.project; + + auto mixerBoardFrame = &project.AttachedWindows::Get( sMixerBoardKey ); + mixerBoardFrame->Show(); + mixerBoardFrame->Raise(); + mixerBoardFrame->SetFocus(); +} + void OnShowExtraMenus(const CommandContext &context) { auto &project = context.project; @@ -382,11 +432,12 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) { #define FN(X) (& ViewActions::Handler :: X) +MenuTable::BaseItemSharedPtr ToolbarsMenu(); + // Under /MenuBar -namespace { -using namespace MenuTable; -BaseItemSharedPtr ViewMenu() +MenuTable::BaseItemSharedPtr ViewMenu() { + using namespace MenuTable; using Options = CommandManager::Options; static const auto checkOff = Options{}.CheckState( false ); @@ -436,7 +487,59 @@ BaseItemSharedPtr ViewMenu() ) ), - Section( "Windows" ), + Section( "Windows", + // History window should be available either for UndoAvailableFlag + // or RedoAvailableFlag, + // but we can't make the AddItem flags and mask have both, + // because they'd both have to be true for the + // command to be enabled. + // If user has Undone the entire stack, RedoAvailableFlag is on + // but UndoAvailableFlag is off. + // If user has done things but not Undone anything, + // RedoAvailableFlag is off but UndoAvailableFlag is on. + // So in either of those cases, + // (AudioIONotBusyFlag | UndoAvailableFlag | RedoAvailableFlag) mask + // would fail. + // The only way to fix this in the current architecture + // is to hack in special cases for RedoAvailableFlag + // in AudacityProject::UpdateMenus() (ugly) + // and CommandManager::HandleCommandEntry() (*really* ugly -- + // shouldn't know about particular command names and flags). + // Here's the hack that would be necessary in + // AudacityProject::UpdateMenus(), if somebody decides to do it: + // // Because EnableUsingFlags requires all the flag bits match the + // // corresponding mask bits, + // // "UndoHistory" specifies only + // // AudioIONotBusyFlag | UndoAvailableFlag, because that + // // covers the majority of cases where it should be enabled. + // // If history is not empty but we've Undone the whole stack, + // // we also want to enable, + // // to show the Redo's on stack. + // // "UndoHistory" might already be enabled, + // // but add this check for RedoAvailableFlag. + // if (flags & RedoAvailableFlag) + // 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. + + /* i18n-hint: Clicking this menu item shows the various editing steps + that have been taken.*/ + Command( wxT("UndoHistory"), XXO("&History..."), FN(OnHistory), + AudioIONotBusyFlag() ), + + Command( wxT("Karaoke"), XXO("&Karaoke..."), FN(OnKaraoke), + LabelTracksExistFlag() ), + Command( wxT("MixerBoard"), XXO("&Mixer Board..."), FN(OnMixerBoard), + PlayableTracksExistFlag() ) + ), + + Section( "", + ////////////////////////////////////////////////////////////////////////// + + ToolbarsMenu() + ), Section( "Other", Command( wxT("ShowExtraMenus"), XXO("&Extra Menus (on/off)"), @@ -456,10 +559,4 @@ BaseItemSharedPtr ViewMenu() } -AttachedItem sAttachment1{ - wxT(""), - Shared( ViewMenu() ) -}; -} - #undef FN diff --git a/src/menus/WindowMenus.cpp b/src/menus/WindowMenus.cpp index 38b3afe43..fc733ff85 100644 --- a/src/menus/WindowMenus.cpp +++ b/src/menus/WindowMenus.cpp @@ -118,13 +118,13 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) { #define FN(X) (& WindowActions::Handler :: X) -namespace { -using namespace MenuTable; -BaseItemSharedPtr WindowMenu() +// Under /MenuBar +MenuTable::BaseItemSharedPtr WindowMenu() { ////////////////////////////////////////////////////////////////////////// // poor imitation of the Mac Windows Menu ////////////////////////////////////////////////////////////////////////// + using namespace MenuTable; static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Window"), XO("&Window"), @@ -149,13 +149,10 @@ BaseItemSharedPtr WindowMenu() return menu; } -AttachedItem sAttachment1{ - wxT(""), - Shared( WindowMenu() ) -}; - -BaseItemSharedPtr ExtraWindowItems() +// Under /MenuBar/Optional/Extra/Misc +MenuTable::BaseItemSharedPtr ExtraWindowItems() { + using namespace MenuTable; static BaseItemSharedPtr items{ ( FinderScope{ findCommandHandler }, Items( wxT("MacWindows"), @@ -168,17 +165,19 @@ BaseItemSharedPtr ExtraWindowItems() return items; } -AttachedItem sAttachment2{ - Placement{ wxT("Optional/Extra/Part2/Misc"), OrderingHint::End }, - Shared( ExtraWindowItems() ) -}; - -} - #undef FN #else -// Not WXMAC. +// Not WXMAC. Stub functions. +MenuTable::BaseItemSharedPtr WindowMenu() +{ + return nullptr; +} + +MenuTable::BaseItemSharedPtr ExtraWindowItems() +{ + return nullptr; +} #endif diff --git a/src/tracks/ui/Scrubbing.cpp b/src/tracks/ui/Scrubbing.cpp index ac55f491f..1d6da3906 100644 --- a/src/tracks/ui/Scrubbing.cpp +++ b/src/tracks/ui/Scrubbing.cpp @@ -21,7 +21,6 @@ Paul Licameli split from TrackPanel.cpp #include "../../Project.h" #include "../../ProjectAudioIO.h" #include "../../ProjectAudioManager.h" -#include "../../ProjectHistory.h" #include "../../ProjectSettings.h" #include "../../ProjectStatus.h" #include "../../Track.h" @@ -1128,99 +1127,21 @@ bool Scrubber::CanScrub() const HasWaveDataPred( *mProject ); } -void Scrubber::DoKeyboardScrub(bool backwards, bool keyUp) -{ - auto &project = *mProject; - - static double initT0 = 0; - static double initT1 = 0; - - if (keyUp) { - auto &scrubber = Scrubber::Get(project); - if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() == backwards) { - auto gAudioIO = AudioIOBase::Get(); - auto time = gAudioIO->GetStreamTime(); - auto &viewInfo = ViewInfo::Get(project); - auto &selection = viewInfo.selectedRegion; - - // If the time selection has not changed during scrubbing - // set the cursor position - if (selection.t0() == initT0 && selection.t1() == initT1) { - double endTime = TrackList::Get(project).GetEndTime(); - time = std::min(time, endTime); - time = std::max(time, 0.0); - selection.setTimes(time, time); - ProjectHistory::Get(project).ModifyState(false); - } - - scrubber.Cancel(); - ProjectAudioManager::Get(project).Stop(); - } - } - else { // KeyDown - auto gAudioIO = AudioIOBase::Get(); - auto &scrubber = Scrubber::Get(project); - if (scrubber.IsKeyboardScrubbing() && scrubber.IsBackwards() != backwards) { - // change direction - scrubber.SetBackwards(backwards); - } - else if (!gAudioIO->IsBusy() && !scrubber.HasMark()) { - auto &viewInfo = ViewInfo::Get(project); - auto &selection = viewInfo.selectedRegion; - double endTime = TrackList::Get(project).GetEndTime(); - double t0 = selection.t0(); - - if ((!backwards && t0 >= 0 && t0 < endTime) || - (backwards && t0 > 0 && t0 <= endTime)) { - initT0 = t0; - initT1 = selection.t1(); - scrubber.StartKeyboardScrubbing(t0, backwards); - } - } - } -} - -void Scrubber::OnKeyboardScrubBackwards(const CommandContext &context) -{ - auto evt = context.pEvt; - if (evt) - DoKeyboardScrub(true, evt->GetEventType() == wxEVT_KEY_UP); - else { // called from menu, so simulate keydown and keyup - DoKeyboardScrub(true, false); - DoKeyboardScrub(true, true); - } -} - -void Scrubber::OnKeyboardScrubForwards(const CommandContext &context) -{ - auto evt = context.pEvt; - if (evt) - DoKeyboardScrub(false, evt->GetEventType() == wxEVT_KEY_UP); - else { // called from menu, so simulate keydown and keyup - DoKeyboardScrub(false, false); - DoKeyboardScrub(false, true); - } -} - -namespace { - -static const auto finder = - [](AudacityProject &project) -> CommandHandlerObject& - { return Scrubber::Get( project ); }; - -using namespace MenuTable; -BaseItemSharedPtr ToolbarMenu() +MenuTable::BaseItemSharedPtr Scrubber::Menu() { + using namespace MenuTable; using Options = CommandManager::Options; static BaseItemSharedPtr menu { ( - FinderScope{ finder }, - Menu( wxT("Scrubbing"), + FinderScope{ + [](AudacityProject &project) -> CommandHandlerObject& + { return Scrubber::Get( project ); } }, + MenuTable::Menu( wxT("Scrubbing"), XO("Scru&bbing"), []{ BaseItemPtrs ptrs; for (const auto &item : menuItems()) { - ptrs.push_back( Command( item.name, item.label, + ptrs.push_back( MenuTable::Command( item.name, item.label, item.memFn, item.flags, item.StatusTest @@ -1239,35 +1160,6 @@ BaseItemSharedPtr ToolbarMenu() return menu; } -AttachedItem sAttachment{ - wxT("Transport/Basic"), - Shared( ToolbarMenu() ) -}; - -BaseItemSharedPtr KeyboardScrubbingItems() -{ - using Options = CommandManager::Options; - - static BaseItemSharedPtr items{ - ( FinderScope{ finder }, - Items( wxT("KeyboardScrubbing"), - Command(wxT("KeyboardScrubBackwards"), XXO("Scrub Bac&kwards"), - &Scrubber::OnKeyboardScrubBackwards, - CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("U\twantKeyup")), - Command(wxT("KeyboardScrubForwards"), XXO("Scrub For&wards"), - &Scrubber::OnKeyboardScrubForwards, - CaptureNotBusyFlag() | CanStopAudioStreamFlag(), wxT("I\twantKeyup")) - ) ) }; - return items; -} - -AttachedItem sAttachment2{ - wxT("Optional/Extra/Part1/Transport"), - Shared( KeyboardScrubbingItems() ) -}; - -} - void Scrubber::PopulatePopupMenu(wxMenu &menu) { int id = CMD_ID; diff --git a/src/tracks/ui/Scrubbing.h b/src/tracks/ui/Scrubbing.h index ddeab8e1b..9be0ea08c 100644 --- a/src/tracks/ui/Scrubbing.h +++ b/src/tracks/ui/Scrubbing.h @@ -117,6 +117,8 @@ public: // This returns the same as the enabled state of the menu items: bool CanScrub() const; + // For the toolbar + static MenuTable::BaseItemSharedPtr Menu(); // For popup void PopulatePopupMenu(wxMenu &menu); @@ -125,10 +127,6 @@ public: void OnSeek(const CommandContext&); void OnToggleScrubRuler(const CommandContext&); - void OnKeyboardScrubBackwards(const CommandContext&); - void OnKeyboardScrubForwards(const CommandContext&); - void DoKeyboardScrub(bool backwards, bool keyUp); - // Convenience wrapper for the above template void Thunk(wxCommandEvent &)