diff --git a/src/Menus.cpp b/src/Menus.cpp index 87166fb86..9228b56a0 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -138,8 +138,6 @@ ConditionalGroupItem::ConditionalGroupItem( } ConditionalGroupItem::~ConditionalGroupItem() {} -SeparatorItem::~SeparatorItem() {} - CommandItem::CommandItem(const CommandID &name_, const TranslatableString &label_in_, CommandFunctorPointer callback_, @@ -427,10 +425,6 @@ struct MenuItemVisitor : MenuVisitor pCommandList->flags, pCommandList->isEffect); } else - if (dynamic_cast( pItem )) { - manager.AddSeparator(); - } - else if (const auto pSpecial = dynamic_cast( pItem )) { const auto pCurrentMenu = manager.CurrentMenu(); diff --git a/src/commands/CommandManager.h b/src/commands/CommandManager.h index 29345f1f5..35ae36479 100644 --- a/src/commands/CommandManager.h +++ b/src/commands/CommandManager.h @@ -633,13 +633,6 @@ namespace MenuTable { Condition condition; }; - // Describes a separator between menu items - struct SeparatorItem final : SingleItem - { - SeparatorItem() : SingleItem{ wxEmptyString } {} - ~SeparatorItem() override; - }; - // usage: // auto scope = FinderScope( findCommandHandler ); // return Items( ... ); @@ -772,6 +765,17 @@ namespace MenuTable { { return std::make_unique< MenuItems >( internalName, std::forward(args)... ); } + // Like Items, but insert a menu separator between the menu section and + // any other items or sections before or after it in the same (innermost, + // enclosing) menu. + // It's not necessary that the sisters of sections be other sections, but it + // might clarify the logical groupings. + template< typename... Args > + inline std::unique_ptr< MenuSection > Section( + const wxString &internalName, Args&&... args ) + { return std::make_unique< MenuSection >( + internalName, std::forward(args)... ); } + // Menu items can be constructed two ways, as for group items // Items will appear in a main toolbar menu or in a sub-menu. // The name is untranslated. Try to keep the name stable across Audacity @@ -830,9 +834,6 @@ namespace MenuTable { return std::make_unique( internalName, title, std::move( items ) ); } - inline std::unique_ptr Separator() - { return std::make_unique(); } - template< typename Handler > inline std::unique_ptr Command( const CommandID &name, diff --git a/src/menus/EditMenus.cpp b/src/menus/EditMenus.cpp index 764c78c64..263e96f97 100644 --- a/src/menus/EditMenus.cpp +++ b/src/menus/EditMenus.cpp @@ -1055,6 +1055,7 @@ MenuTable::BaseItemSharedPtr EditMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Edit"), XO("&Edit"), + Section( "", Command( wxT("Undo"), XXO("&Undo"), FN(OnUndo), AudioIONotBusyFlag() | UndoAvailableFlag(), wxT("Ctrl+Z") ), @@ -1065,10 +1066,10 @@ MenuTable::BaseItemSharedPtr EditMenu() [](AudacityProject &project, wxMenu&) { // Change names in the CommandManager as a side-effect MenuManager::ModifyUndoMenuItems(project); - }), - - Separator(), + }) + ), + Section( "", // Basic Edit commands /* i18n-hint: (verb)*/ Command( wxT("Cut"), XXO("Cu&t"), FN(OnCut), @@ -1085,11 +1086,12 @@ MenuTable::BaseItemSharedPtr EditMenu() AudioIONotBusyFlag(), wxT("Ctrl+V") ), /* i18n-hint: (verb)*/ Command( wxT("Duplicate"), XXO("Duplic&ate"), FN(OnDuplicate), - NotBusyTimeAndTracksFlags, wxT("Ctrl+D") ), - - Separator(), + NotBusyTimeAndTracksFlags, wxT("Ctrl+D") ) + ), + Section( "", Menu( wxT("RemoveSpecial"), XO("R&emove Special"), + Section( "", /* i18n-hint: (verb) Do a special kind of cut*/ Command( wxT("SplitCut"), XXO("Spl&it Cut"), FN(OnSplitCut), NotBusyTimeAndTracksFlags, @@ -1097,10 +1099,10 @@ MenuTable::BaseItemSharedPtr EditMenu() /* i18n-hint: (verb) Do a special kind of DELETE*/ Command( wxT("SplitDelete"), XXO("Split D&elete"), FN(OnSplitDelete), NotBusyTimeAndTracksFlags, - Options{ wxT("Ctrl+Alt+K") }.UseStrictFlags() ), - - Separator(), + Options{ wxT("Ctrl+Alt+K") }.UseStrictFlags() ) + ), + Section( "", /* i18n-hint: (verb)*/ Command( wxT("Silence"), XXO("Silence Audi&o"), FN(OnSilence), AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag(), @@ -1109,28 +1111,31 @@ MenuTable::BaseItemSharedPtr EditMenu() Command( wxT("Trim"), XXO("Tri&m Audio"), FN(OnTrim), AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag(), Options{ wxT("Ctrl+T") }.UseStrictFlags() ) - ), - - Separator(), + ) + ) + ), + Section( "", ////////////////////////////////////////////////////////////////////////// Menu( wxT("Clip"), XO("Clip B&oundaries"), + Section( "", /* i18n-hint: (verb) It's an item on a menu. */ Command( wxT("Split"), XXO("Sp&lit"), FN(OnSplit), AudioIONotBusyFlag() | WaveTracksSelectedFlag(), Options{ wxT("Ctrl+I") }.UseStrictFlags() ), Command( wxT("SplitNew"), XXO("Split Ne&w"), FN(OnSplitNew), AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag(), - Options{ wxT("Ctrl+Alt+I") }.UseStrictFlags() ), - - Separator(), + Options{ wxT("Ctrl+Alt+I") }.UseStrictFlags() ) + ), + Section( "", /* i18n-hint: (verb)*/ Command( wxT("Join"), XXO("&Join"), FN(OnJoin), NotBusyTimeAndTracksFlags, wxT("Ctrl+J") ), Command( wxT("Disjoin"), XXO("Detac&h at Silences"), FN(OnDisjoin), NotBusyTimeAndTracksFlags, wxT("Ctrl+Alt+J") ) + ) ), ////////////////////////////////////////////////////////////////////////// @@ -1138,16 +1143,23 @@ MenuTable::BaseItemSharedPtr EditMenu() LabelEditMenus(), Command( wxT("EditMetaData"), XXO("&Metadata..."), FN(OnEditMetadata), - AudioIONotBusyFlag() ), + AudioIONotBusyFlag() ) ////////////////////////////////////////////////////////////////////////// #ifndef __WXMAC__ - Separator(), + ), + + Section( "", +#else + , #endif Command( wxT("Preferences"), XXO("Pre&ferences..."), FN(OnPreferences), AudioIONotBusyFlag(), prefKey ) + + ) + ) ) }; return menu; } diff --git a/src/menus/ExtraMenus.cpp b/src/menus/ExtraMenus.cpp index f1ea4dd9a..78214a271 100644 --- a/src/menus/ExtraMenus.cpp +++ b/src/menus/ExtraMenus.cpp @@ -162,8 +162,9 @@ MenuTable::BaseItemSharedPtr ExtraMenu() // Table of menu factories. // TODO: devise a registration system instead. - static BaseItemSharedPtr extraItems{ Items( wxEmptyString - , ExtraTransportMenu() + static BaseItemSharedPtr extraItems{ Items( wxEmptyString, + Section( "", + ExtraTransportMenu() , ExtraToolsMenu() , ExtraMixerMenu() , ExtraEditMenu() @@ -171,10 +172,10 @@ MenuTable::BaseItemSharedPtr ExtraMenu() , ExtraSeekMenu() , ExtraDeviceMenu() , ExtraSelectionMenu() + ), - , MenuTable::Separator() - - , ExtraGlobalCommands() + Section( "", + ExtraGlobalCommands() , ExtraFocusMenu() , ExtraCursorMenu() , ExtraTrackMenu() @@ -183,6 +184,7 @@ MenuTable::BaseItemSharedPtr ExtraMenu() // Delayed evaluation: , ExtraMiscItems + ) ) }; static const auto pred = diff --git a/src/menus/FileMenus.cpp b/src/menus/FileMenus.cpp index c775f021a..d3eb02a75 100644 --- a/src/menus/FileMenus.cpp +++ b/src/menus/FileMenus.cpp @@ -560,6 +560,7 @@ MenuTable::BaseItemSharedPtr FileMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("File"), XO("&File"), + Section( "", /*i18n-hint: "New" is an action (verb) to create a NEW project*/ Command( wxT("New"), XXO("&New"), FN(OnNew), AudioIONotBusyFlag(), wxT("Ctrl+N") ), @@ -614,10 +615,10 @@ MenuTable::BaseItemSharedPtr FileMenu() ///////////////////////////////////////////////////////////////////////////// Command( wxT("Close"), XXO("&Close"), FN(OnClose), - AudioIONotBusyFlag(), wxT("Ctrl+W") ), - - Separator(), + AudioIONotBusyFlag(), wxT("Ctrl+W") ) + ), + Section( "", Menu( wxT("Save"), XO("&Save Project"), Command( wxT("Save"), XXO("&Save Project"), FN(OnSave), AudioIONotBusyFlag() | UnsavedChangesFlag(), wxT("Ctrl+S") ), @@ -632,10 +633,10 @@ MenuTable::BaseItemSharedPtr FileMenu() XXO("&Save Compressed Copy of Project..."), FN(OnSaveCompressed), AudioIONotBusyFlag() ) #endif - ), - - Separator(), + ) + ), + Section( "", Menu( wxT("Export"), XO("&Export"), // Enable Export audio commands only when there are audio tracks. Command( wxT("ExportMp3"), XXO("Export as MP&3"), FN(OnExportMp3), @@ -681,26 +682,25 @@ MenuTable::BaseItemSharedPtr FileMenu() #endif // USE_MIDI Command( wxT("ImportRaw"), XXO("&Raw Data..."), FN(OnImportRaw), AudioIONotBusyFlag() ) - ), - - Separator(), - -///////////////////////////////////////////////////////////////////////////// + ) + ), + Section( "", Command( wxT("PageSetup"), XXO("Pa&ge Setup..."), FN(OnPageSetup), AudioIONotBusyFlag() | TracksExistFlag() ), /* i18n-hint: (verb) It's item on a menu. */ Command( wxT("Print"), XXO("&Print..."), FN(OnPrint), - AudioIONotBusyFlag() | TracksExistFlag() ), - - Separator(), + AudioIONotBusyFlag() | TracksExistFlag() ) + ), + Section( "", // On the Mac, the Exit item doesn't actually go here...wxMac will // pull it out // and put it in the Audacity menu for us based on its ID. /* i18n-hint: (verb) It's item on a menu. */ Command( wxT("Exit"), XXO("E&xit"), FN(OnExit), AlwaysEnabledFlag, wxT("Ctrl+Q") ) + ) ) ) }; return menu; } diff --git a/src/menus/HelpMenus.cpp b/src/menus/HelpMenus.cpp index bd5e217b4..0d8fc9eec 100644 --- a/src/menus/HelpMenus.cpp +++ b/src/menus/HelpMenus.cpp @@ -395,12 +395,14 @@ void OnMenuTree(const CommandContext &context) needSeparator.back() = true; } else { + MaybeEmitSeparator(); Indent(); // using GET for alpha only diagnostic tool info += item.name.GET(); Return(); indentation = wxString{ ' ', TAB * ++level }; needSeparator.push_back( false ); + firstItem.push_back( true ); } } @@ -414,32 +416,38 @@ void OnMenuTree(const CommandContext &context) needSeparator.back() = true; } else { + firstItem.pop_back(); needSeparator.pop_back(); indentation = wxString{ ' ', TAB * --level }; } } void Visit( SingleItem &item, const Path& ) override + { + MaybeEmitSeparator(); + + // using GET for alpha only diagnostic tool + Indent(); + info += item.name.GET(); + Return(); + } + + void MaybeEmitSeparator() { static const wxString separatorName{ '=', 20 }; bool separate = false; if ( !needSeparator.empty() ) { - separate = needSeparator.back(); + separate = needSeparator.back() && !firstItem.back(); needSeparator.back() = false; + firstItem.back() = false; } - if ( separate || dynamic_cast(&item) ) { + if ( separate ) { Indent(); info += separatorName; Return(); } - if ( !dynamic_cast(&item) ) { - // using GET for alpha only diagnostic tool - Indent(); - info += item.name.GET(); - Return(); - } } void Indent() { info += indentation; } @@ -449,6 +457,7 @@ void OnMenuTree(const CommandContext &context) wxString indentation; wxString info; + std::vector firstItem; std::vector needSeparator; } visitor{ project }; @@ -521,6 +530,7 @@ MenuTable::BaseItemSharedPtr HelpMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Help"), XO("&Help"), + Section( "", // QuickFix menu item not in Audacity 2.3.1 whilst we discuss further. #ifdef EXPERIMENTAL_DA // DA: Has QuickFix menu item. @@ -529,16 +539,21 @@ MenuTable::BaseItemSharedPtr HelpMenu() // DA: 'Getting Started' rather than 'Quick Help'. Command( wxT("QuickHelp"), XXO("&Getting Started"), FN(OnQuickHelp) ), // DA: Emphasise it is the Audacity Manual (No separate DA manual). - Command( wxT("Manual"), XXO("Audacity &Manual"), FN(OnManual) ), + Command( wxT("Manual"), XXO("Audacity &Manual"), FN(OnManual) ) #else Command( wxT("QuickHelp"), XXO("&Quick Help..."), FN(OnQuickHelp), AlwaysEnabledFlag ), Command( wxT("Manual"), XXO("&Manual..."), FN(OnManual), - AlwaysEnabledFlag ), + AlwaysEnabledFlag ) #endif + ), - Separator(), - +#ifdef __WXMAC__ + Items +#else + Section +#endif + ( "", Menu( wxT("Diagnostics"), XO("&Diagnostics"), Command( wxT("DeviceInfo"), XXO("Au&dio Device Info..."), FN(OnAudioDeviceInfo), @@ -565,10 +580,13 @@ MenuTable::BaseItemSharedPtr HelpMenu() FN(OnMenuTree), AlwaysEnabledFlag ) #endif - ), - + ) #ifndef __WXMAC__ - Separator(), + ), + + Section( "", +#else + , #endif // DA: Does not fully support update checking. @@ -579,6 +597,7 @@ MenuTable::BaseItemSharedPtr HelpMenu() #endif Command( wxT("About"), XXO("&About Audacity..."), FN(OnAbout), AlwaysEnabledFlag ) + ) ) ) }; return menu; } diff --git a/src/menus/LabelMenus.cpp b/src/menus/LabelMenus.cpp index 2044a9764..fbeebd127 100644 --- a/src/menus/LabelMenus.cpp +++ b/src/menus/LabelMenus.cpp @@ -604,10 +604,12 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() Items( wxEmptyString, Menu( wxT("Labels"), XO("&Labels"), + Section( "", Command( wxT("EditLabels"), XXO("&Edit Labels..."), FN(OnEditLabels), - AudioIONotBusyFlag() ), + AudioIONotBusyFlag() ) + ), - Separator(), + Section( "", Command( wxT("AddLabel"), XXO("Add Label at &Selection"), FN(OnAddLabel), AlwaysEnabledFlag, wxT("Ctrl+B") ), @@ -622,18 +624,21 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() ), Command( wxT("PasteNewLabel"), XXO("Paste Te&xt to New Label"), FN(OnPasteNewLabel), - AudioIONotBusyFlag(), wxT("Ctrl+Alt+V") ), + AudioIONotBusyFlag(), wxT("Ctrl+Alt+V") ) - Separator(), + ), + Section( "", Command( wxT("TypeToCreateLabel"), XXO("&Type to Create a Label (on/off)"), FN(OnToggleTypeToCreateLabel), AlwaysEnabledFlag, checkOff ) + ) ), // first menu ///////////////////////////////////////////////////////////////////////////// Menu( wxT("Labeled"), XO("La&beled Audio"), + Section( "", /* i18n-hint: (verb)*/ Command( wxT("CutLabels"), XXO("&Cut"), FN(OnCutLabels), AudioIONotBusyFlag() | LabelsSelectedFlag() | WaveTracksExistFlag() | @@ -642,9 +647,10 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() Command( wxT("DeleteLabels"), XXO("&Delete"), FN(OnDeleteLabels), AudioIONotBusyFlag() | LabelsSelectedFlag() | WaveTracksExistFlag() | TimeSelectedFlag() | IsNotSyncLockedFlag(), - Options{ wxT("Alt+K"), XO("Label Delete") } ), + Options{ wxT("Alt+K"), XO("Label Delete") } ) + ), - Separator(), + Section( "", /* i18n-hint: (verb) A special way to cut out a piece of audio*/ Command( wxT("SplitCutLabels"), XXO("&Split Cut"), @@ -652,9 +658,11 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() Options{ wxT("Alt+Shift+X"), XO("Label Split Cut") } ), Command( wxT("SplitDeleteLabels"), XXO("Sp&lit Delete"), FN(OnSplitDeleteLabels), NotBusyLabelsAndWaveFlags, - Options{ wxT("Alt+Shift+K"), XO("Label Split Delete") } ), + Options{ wxT("Alt+Shift+K"), XO("Label Split Delete") } ) - Separator(), + ), + + Section( "", Command( wxT("SilenceLabels"), XXO("Silence &Audio"), FN(OnSilenceLabels), NotBusyLabelsAndWaveFlags, @@ -662,10 +670,10 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() /* i18n-hint: (verb)*/ Command( wxT("CopyLabels"), XXO("Co&py"), FN(OnCopyLabels), NotBusyLabelsAndWaveFlags, - Options{ wxT("Alt+Shift+C"), XO("Label Copy") } ), - - Separator(), + Options{ wxT("Alt+Shift+C"), XO("Label Copy") } ) + ), + Section( "", /* i18n-hint: (verb)*/ Command( wxT("SplitLabels"), XXO("Spli&t"), FN(OnSplitLabels), AudioIONotBusyFlag() | LabelsSelectedFlag() | WaveTracksExistFlag(), @@ -677,6 +685,7 @@ MenuTable::BaseItemSharedPtr LabelEditMenus() Command( wxT("DisjoinLabels"), XXO("Detac&h at Silences"), FN(OnDisjoinLabels), NotBusyLabelsAndWaveFlags, wxT("Alt+Shift+J") ) + ) ) // second menu ) ) }; // two menus diff --git a/src/menus/PluginMenus.cpp b/src/menus/PluginMenus.cpp index 04f5ee2bf..080f1bb46 100644 --- a/src/menus/PluginMenus.cpp +++ b/src/menus/PluginMenus.cpp @@ -394,12 +394,18 @@ MenuTable::BaseItemPtrs PopulateEffectsMenu( std::sort( defplugs.begin(), defplugs.end(), comp1 ); std::sort( optplugs.begin(), optplugs.end(), comp2 ); - AddEffectMenuItems( result, defplugs, batchflags, realflags, true ); + MenuTable::BaseItemPtrs section1; + AddEffectMenuItems( section1, defplugs, batchflags, realflags, true ); - if (defplugs.size() && optplugs.size()) - result.push_back( MenuTable::Separator() ); + MenuTable::BaseItemPtrs section2; + AddEffectMenuItems( section2, optplugs, batchflags, realflags, false ); - AddEffectMenuItems( result, optplugs, batchflags, realflags, false ); + bool section = !section1.empty() && !section2.empty(); + result.push_back( MenuTable::Items( "", std::move( section1 ) ) ); + if ( section ) + result.push_back( MenuTable::Section( "", std::move( section2 ) ) ); + else + result.push_back( MenuTable::Items( "", std::move( section2 ) ) ); return result; } @@ -752,13 +758,13 @@ MenuTable::BaseItemSharedPtr GenerateMenu() ( FinderScope{ findCommandHandler }, Menu( wxT("Generate"), XO("&Generate"), #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT + Section( "", Command( wxT("ManageGenerators"), XXO("Add / Remove Plug-ins..."), - FN(OnManageGenerators), AudioIONotBusyFlag() ), - - Separator(), - + FN(OnManageGenerators), AudioIONotBusyFlag() ) + ), #endif + Section( "", // Delayed evaluation: [](AudacityProject &) { return Items( wxEmptyString, PopulateEffectsMenu( @@ -766,6 +772,7 @@ MenuTable::BaseItemSharedPtr GenerateMenu() AudioIONotBusyFlag(), AudioIONotBusyFlag()) ); } + ) ) ) }; return menu; } @@ -788,13 +795,13 @@ MenuTable::BaseItemSharedPtr EffectMenu() ( FinderScope{ findCommandHandler }, Menu( wxT("Effect"), XO("Effe&ct"), #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT + Section( "", Command( wxT("ManageEffects"), XXO("Add / Remove Plug-ins..."), - FN(OnManageEffects), AudioIONotBusyFlag() ), - - Separator(), - + FN(OnManageEffects), AudioIONotBusyFlag() ) + ), #endif + Section( "", // Delayed evaluation: [](AudacityProject &project) { @@ -811,10 +818,10 @@ MenuTable::BaseItemSharedPtr EffectMenu() AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag() | HasLastEffectFlag(), wxT("Ctrl+R"), findCommandHandler ); - }, - - Separator(), + } + ), + Section( "", // Delayed evaluation: [](AudacityProject &) { return Items( wxEmptyString, PopulateEffectsMenu( @@ -822,6 +829,7 @@ MenuTable::BaseItemSharedPtr EffectMenu() AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag(), IsRealtimeNotActiveFlag() ) ); } + ) ) ) }; return menu; @@ -838,13 +846,13 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu() ( FinderScope{ findCommandHandler }, Menu( wxT("Analyze"), XO("&Analyze"), #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT + Section( "", Command( wxT("ManageAnalyzers"), XXO("Add / Remove Plug-ins..."), - FN(OnManageAnalyzers), AudioIONotBusyFlag() ), - - Separator(), - + FN(OnManageAnalyzers), AudioIONotBusyFlag() ) + ), #endif + Section( "", Command( wxT("ContrastAnalyser"), XXO("Contrast..."), FN(OnContrast), AudioIONotBusyFlag() | WaveTracksSelectedFlag() | TimeSelectedFlag(), wxT("Ctrl+Shift+T") ), @@ -858,6 +866,7 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu() AudioIONotBusyFlag() | TimeSelectedFlag() | WaveTracksSelectedFlag(), IsRealtimeNotActiveFlag() ) ); } + ) ) ) }; return menu; } @@ -871,7 +880,7 @@ MenuTable::BaseItemSharedPtr ToolsMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Tools"), XO("T&ools"), - + Section( "", #ifdef EXPERIMENTAL_EFFECT_MANAGEMENT Command( wxT("ManageTools"), XXO("Add / Remove Plug-ins..."), FN(OnManageTools), AudioIONotBusyFlag() ), @@ -886,18 +895,20 @@ MenuTable::BaseItemSharedPtr ToolsMenu() Menu( wxT("Macros"), XO("&Apply Macro"), // Palette has no access key to ensure first letter navigation of // sub menu + Section( "", Command( wxT("ApplyMacrosPalette"), XXO("Palette..."), - FN(OnApplyMacrosPalette), AudioIONotBusyFlag() ), - - Separator(), + FN(OnApplyMacrosPalette), AudioIONotBusyFlag() ) + ), + Section( "", // Delayed evaluation: [](AudacityProject&) { return Items( wxEmptyString, PopulateMacrosMenu( AudioIONotBusyFlag() ) ); } - ), - - Separator(), + ) + ) + ), + Section( "", Command( wxT("FancyScreenshot"), XXO("&Screenshot..."), FN(OnScreenshot), AudioIONotBusyFlag() ), @@ -907,11 +918,11 @@ MenuTable::BaseItemSharedPtr ToolsMenu() // TODO: What should we do here? Make benchmark a plug-in? // Easy enough to do. We'd call it mod-self-test. Command( wxT("Benchmark"), XXO("&Run Benchmark..."), - FN(OnBenchmark), AudioIONotBusyFlag() ), + FN(OnBenchmark), AudioIONotBusyFlag() ) //#endif + ), - Separator(), - + Section( "", // Delayed evaluation: [](AudacityProject&) { return Items( wxEmptyString, PopulateEffectsMenu( @@ -919,12 +930,11 @@ MenuTable::BaseItemSharedPtr ToolsMenu() AudioIONotBusyFlag(), AudioIONotBusyFlag() ) ); } + ) #ifdef IS_ALPHA - , - - Separator(), - + , + Section( "", Command( wxT("SimulateRecordingErrors"), XXO("Simulate Recording Errors"), FN(OnSimulateRecordingErrors), @@ -939,6 +949,7 @@ MenuTable::BaseItemSharedPtr ToolsMenu() Options{}.CheckTest( [](AudacityProject&){ return AudioIO::Get()->mDetectUpstreamDropouts; } ) ) + ) #endif ) ) }; return menu; diff --git a/src/menus/SelectMenus.cpp b/src/menus/SelectMenus.cpp index 7ba9b8656..004b09512 100644 --- a/src/menus/SelectMenus.cpp +++ b/src/menus/SelectMenus.cpp @@ -1039,6 +1039,7 @@ MenuTable::BaseItemSharedPtr SelectMenu() ( FinderScope{ findCommandHandler }, /* i18n-hint: (verb) It's an item on a menu. */ Menu( wxT("Select"), XO("&Select"), + Section( "", Command( wxT("SelectAll"), XXO("&All"), FN(OnSelectAll), TracksExistFlag(), Options{ wxT("Ctrl+A"), XO("Select All") } ), @@ -1066,6 +1067,7 @@ MenuTable::BaseItemSharedPtr SelectMenu() ////////////////////////////////////////////////////////////////////////// Menu( wxT("Region"), XO("R&egion"), + Section( "", Command( wxT("SetLeftSelection"), XXO("&Left at Playback Position"), FN(OnSetLeftSelection), TracksExistFlag(), Options{ wxT("["), XO("Set Selection Left at Play Position") } ), @@ -1080,10 +1082,10 @@ MenuTable::BaseItemSharedPtr SelectMenu() Options{ wxT("Shift+K"), XO("Select Cursor to Track End") } ), Command( wxT("SelTrackStartToEnd"), XXO("Track Start to En&d"), FN(OnSelectTrackStartToEnd), AlwaysEnabledFlag, - Options{}.LongName( XO("Select Track Start to End") ) ), - - Separator(), + Options{}.LongName( XO("Select Track Start to End") ) ) + ), + Section( "", // GA: Audacity had 'Store Re&gion' here previously. There is no // one-step way to restore the 'Saved Cursor Position' in Select Menu, // so arguably using the word 'Selection' to do duty for both saving @@ -1094,6 +1096,7 @@ MenuTable::BaseItemSharedPtr SelectMenu() // Audacity had 'Retrieve Regio&n' here previously. Command( wxT("SelRestore"), XXO("Retrieve Selectio&n"), FN(OnSelectionRestore), TracksExistFlag() ) + ) ), ////////////////////////////////////////////////////////////////////////// @@ -1114,12 +1117,12 @@ MenuTable::BaseItemSharedPtr SelectMenu() ////////////////////////////////////////////////////////////////////////// - ClipSelectMenu(), + ClipSelectMenu() ////////////////////////////////////////////////////////////////////////// + ), - Separator(), - + Section( "", Command( wxT("SelCursorStoredCursor"), XXO("Cursor to Stored &Cursor Position"), FN(OnSelectCursorStoredCursor), TracksExistFlag(), @@ -1127,15 +1130,16 @@ MenuTable::BaseItemSharedPtr SelectMenu() Command( wxT("StoreCursorPosition"), XXO("Store Cursor Pos&ition"), FN(OnCursorPositionStore), - WaveTracksExistFlag() ), + WaveTracksExistFlag() ) // Save cursor position is used in some selections. // Maybe there should be a restore for it? + ), - Separator(), - + Section( "", Command( wxT("ZeroCross"), XXO("At &Zero Crossings"), FN(OnZeroCrossing), TracksSelectedFlag(), Options{ wxT("Z"), XO("Select Zero Crossing") } ) + ) ) ) }; return menu; } diff --git a/src/menus/ToolbarMenus.cpp b/src/menus/ToolbarMenus.cpp index 9d243c327..d860ca63f 100644 --- a/src/menus/ToolbarMenus.cpp +++ b/src/menus/ToolbarMenus.cpp @@ -264,12 +264,13 @@ MenuTable::BaseItemSharedPtr ToolbarsMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Toolbars"), XO("&Toolbars"), + Section( "", /* i18n-hint: (verb)*/ Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"), - FN(OnResetToolBars), AlwaysEnabledFlag ), - - Separator(), + FN(OnResetToolBars), AlwaysEnabledFlag ) + ), + Section( "", /* i18n-hint: Clicking this menu item shows the toolbar with the big buttons on it (play record etc)*/ Command( wxT("ShowTransportTB"), XXO("&Transport Toolbar"), @@ -332,6 +333,7 @@ MenuTable::BaseItemSharedPtr ToolbarsMenu() XXO("Spe&ctral Selection Toolbar"), FN(OnShowSpectralSelectionToolBar), AlwaysEnabledFlag, checkOff ) #endif + ) ) ) }; return menu; } diff --git a/src/menus/TrackMenus.cpp b/src/menus/TrackMenus.cpp index 43a359d68..1d9bf1aac 100644 --- a/src/menus/TrackMenus.cpp +++ b/src/menus/TrackMenus.cpp @@ -1287,6 +1287,7 @@ MenuTable::BaseItemSharedPtr TracksMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Tracks"), XO("&Tracks"), + Section( "", Menu( wxT("Add"), XO("Add &New"), Command( wxT("NewMonoTrack"), XXO("&Mono Track"), FN(OnNewWaveTrack), AudioIONotBusyFlag(), wxT("Ctrl+Shift+N") ), @@ -1296,12 +1297,12 @@ MenuTable::BaseItemSharedPtr TracksMenu() FN(OnNewLabelTrack), AudioIONotBusyFlag() ), Command( wxT("NewTimeTrack"), XXO("&Time Track"), FN(OnNewTimeTrack), AudioIONotBusyFlag() ) - ), + ) + ), ////////////////////////////////////////////////////////////////////////// - Separator(), - + Section( "", Menu( wxT("Mix"), XO("Mi&x"), // Delayed evaluation // Stereo to Mono is an oddball command that is also subject to control @@ -1329,15 +1330,15 @@ MenuTable::BaseItemSharedPtr TracksMenu() ), Command( wxT("Resample"), XXO("&Resample..."), FN(OnResample), - AudioIONotBusyFlag() | WaveTracksSelectedFlag() ), - - Separator(), + AudioIONotBusyFlag() | WaveTracksSelectedFlag() ) + ), + Section( "", Command( wxT("RemoveTracks"), XXO("Remo&ve Tracks"), FN(OnRemoveTracks), - AudioIONotBusyFlag() | AnyTracksSelectedFlag() ), - - Separator(), + AudioIONotBusyFlag() | AnyTracksSelectedFlag() ) + ), + Section( "", Menu( wxT("Mute"), XO("M&ute/Unmute"), Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"), FN(OnMuteAllTracks), AudioIONotBusyFlag(), wxT("Ctrl+U") ), @@ -1359,35 +1360,35 @@ MenuTable::BaseItemSharedPtr TracksMenu() Command( wxT("PanCenter"), XXO("&Center"), FN(OnPanCenter), TracksSelectedFlag(), Options{}.LongName( XO("Pan Center") ) ) - ), - - Separator(), - - ////////////////////////////////////////////////////////////////////////// + ) + ), + Section( "", Menu( wxT("Align"), XO("&Align Tracks"), // XO("Just Move Tracks"), + Section( "", // Mutual alignment of tracks independent of selection or zero CommandGroup(wxT("Align"), { { wxT("EndToEnd"), XO("&Align End to End") }, { wxT("Together"), XO("Align &Together") }, }, - FN(OnAlignNoSync), AudioIONotBusyFlag() | TracksSelectedFlag()), - - Separator(), + FN(OnAlignNoSync), AudioIONotBusyFlag() | TracksSelectedFlag()) + ), + Section( "", // Alignment commands using selection or zero CommandGroup(wxT("Align"), alignLabels(), - FN(OnAlign), AudioIONotBusyFlag() | TracksSelectedFlag()), - - Separator(), + FN(OnAlign), AudioIONotBusyFlag() | TracksSelectedFlag()) + ), + Section( "", Command( wxT("MoveSelectionWithTracks"), XXO("&Move Selection with Tracks (on/off)"), FN(OnMoveSelectionWithTracks), AlwaysEnabledFlag, Options{}.CheckTest( wxT("/GUI/MoveSelectionWithTracks"), false ) ) + ) ), #if 0 @@ -1419,17 +1420,19 @@ MenuTable::BaseItemSharedPtr TracksMenu() ) ////////////////////////////////////////////////////////////////////////// + ) #ifdef EXPERIMENTAL_SYNC_LOCK + , - , - Separator(), - + Section( "", Command( wxT("SyncLock"), XXO("Sync-&Lock Tracks (on/off)"), FN(OnSyncLock), AlwaysEnabledFlag, Options{}.CheckTest( wxT("/GUI/SyncLockTracks"), false ) ) + ) #endif + ) ) }; return menu; } diff --git a/src/menus/TransportMenus.cpp b/src/menus/TransportMenus.cpp index 6cd82f692..95a118ed6 100644 --- a/src/menus/TransportMenus.cpp +++ b/src/menus/TransportMenus.cpp @@ -986,6 +986,7 @@ MenuTable::BaseItemSharedPtr TransportMenu() /* i18n-hint: 'Transport' is the name given to the set of controls that play, record, pause etc. */ Menu( wxT("Transport"), XO("Tra&nsport"), + Section( "", Menu( wxT("Play"), XO("Pl&aying"), /* i18n-hint: (verb) Start or Stop audio playback*/ Command( wxT("PlayStop"), XXO("Pl&ay/Stop"), FN(OnPlayStop), @@ -1040,25 +1041,24 @@ MenuTable::BaseItemSharedPtr TransportMenu() // Scrubbing sub-menu Scrubber::Menu(), - CursorMenu(), - - Separator(), - - ////////////////////////////////////////////////////////////////////////// + CursorMenu() + ), + Section( "", Menu( wxT("PlayRegion"), XO("Pla&y Region"), Command( wxT("LockPlayRegion"), XXO("&Lock"), FN(OnLockPlayRegion), PlayRegionNotLockedFlag() ), Command( wxT("UnlockPlayRegion"), XXO("&Unlock"), FN(OnUnlockPlayRegion), PlayRegionLockedFlag() ) - ), - - Separator(), + ) + ), + Section( "", Command( wxT("RescanDevices"), XXO("R&escan Audio Devices"), FN(OnRescanDevices), AudioIONotBusyFlag() | CanStopAudioStreamFlag() ), Menu( wxT("Options"), XO("Transport &Options"), + Section( "", // Sound Activated recording options Command( wxT("SoundActivationLevel"), XXO("Sound Activation Le&vel..."), FN(OnSoundActivated), @@ -1066,9 +1066,10 @@ MenuTable::BaseItemSharedPtr TransportMenu() Command( wxT("SoundActivation"), XXO("Sound A&ctivated Recording (on/off)"), FN(OnToggleSoundActivated), - AudioIONotBusyFlag() | CanStopAudioStreamFlag(), checkOff ), - Separator(), + AudioIONotBusyFlag() | CanStopAudioStreamFlag(), checkOff ) + ), + Section( "", Command( wxT("PinnedHead"), XXO("Pinned Play/Record &Head (on/off)"), FN(OnTogglePinnedHead), // Switching of scrolling on and off is permitted @@ -1090,7 +1091,9 @@ MenuTable::BaseItemSharedPtr TransportMenu() FN(OnToggleAutomatedInputLevelAdjustment), AudioIONotBusyFlag() | CanStopAudioStreamFlag(), checkOff ) #endif + ) ) + ) ) ) }; return menu; } diff --git a/src/menus/ViewMenus.cpp b/src/menus/ViewMenus.cpp index a71859e9e..0e6b4b00d 100644 --- a/src/menus/ViewMenus.cpp +++ b/src/menus/ViewMenus.cpp @@ -445,7 +445,9 @@ MenuTable::BaseItemSharedPtr ViewMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("View"), XO("&View"), + Section( "", Menu( wxT("Zoom"), XO("&Zoom"), + Section( "", Command( wxT("ZoomIn"), XXO("Zoom &In"), FN(OnZoomIn), ZoomInAvailableFlag(), wxT("Ctrl+1") ), Command( wxT("ZoomNormal"), XXO("Zoom &Normal"), FN(OnZoomNormal), @@ -455,11 +457,13 @@ MenuTable::BaseItemSharedPtr ViewMenu() Command( wxT("ZoomSel"), XXO("&Zoom to Selection"), FN(OnZoomSel), TimeSelectedFlag(), wxT("Ctrl+E") ), Command( wxT("ZoomToggle"), XXO("Zoom &Toggle"), FN(OnZoomToggle), - TracksExistFlag(), wxT("Shift+Z") ), - Separator(), + TracksExistFlag(), wxT("Shift+Z") ) + ), + Section( "", Command( wxT("AdvancedVZoom"), XXO("Advanced &Vertical Zooming"), FN(OnAdvancedVZoom), AlwaysEnabledFlag, Options{}.CheckTest( wxT("/GUI/VerticalZooming"), false ) ) + ) ), Menu( wxT("TrackSize"), XO("T&rack Size"), @@ -480,10 +484,10 @@ MenuTable::BaseItemSharedPtr ViewMenu() Command( wxT("SkipSelEnd"), XXO("Selection En&d"), FN(OnGoSelEnd), TimeSelectedFlag(), Options{ wxT("Ctrl+]"), XO("Skip to Selection End") } ) - ), - - Separator(), + ) + ), + Section( "", // History window should be available either for UndoAvailableFlag // or RedoAvailableFlag, // but we can't make the AddItem flags and mask have both, @@ -528,16 +532,16 @@ MenuTable::BaseItemSharedPtr ViewMenu() Command( wxT("Karaoke"), XXO("&Karaoke..."), FN(OnKaraoke), LabelTracksExistFlag() ), Command( wxT("MixerBoard"), XXO("&Mixer Board..."), FN(OnMixerBoard), - PlayableTracksExistFlag() ), - - Separator(), + PlayableTracksExistFlag() ) + ), + Section( "", ////////////////////////////////////////////////////////////////////////// - ToolbarsMenu(), - - Separator(), + ToolbarsMenu() + ), + Section( "", Command( wxT("ShowExtraMenus"), XXO("&Extra Menus (on/off)"), FN(OnShowExtraMenus), AlwaysEnabledFlag, Options{}.CheckTest( wxT("/GUI/ShowExtraMenus"), false ) ), @@ -549,6 +553,7 @@ MenuTable::BaseItemSharedPtr ViewMenu() Command( wxT("ShowEffectsRack"), XXO("Show Effects Rack"), FN(OnShowEffectsRack), AlwaysEnabledFlag, checkOff ) #endif + ) ) ) }; return menu; diff --git a/src/menus/WindowMenus.cpp b/src/menus/WindowMenus.cpp index 5740209f2..42f5e8f17 100644 --- a/src/menus/WindowMenus.cpp +++ b/src/menus/WindowMenus.cpp @@ -128,6 +128,7 @@ MenuTable::BaseItemSharedPtr WindowMenu() static BaseItemSharedPtr menu{ ( FinderScope{ findCommandHandler }, Menu( wxT("Window"), XO("&Window"), + Section( "", /* i18n-hint: Standard Macintosh Window menu item: Make (the current * window) shrink to an icon on the dock */ Command( wxT("MacMinimize"), XXO("&Minimize"), FN(OnMacMinimize), @@ -135,14 +136,15 @@ MenuTable::BaseItemSharedPtr WindowMenu() /* i18n-hint: Standard Macintosh Window menu item: Make (the current * window) full sized */ Command( wxT("MacZoom"), XXO("&Zoom"), - FN(OnMacZoom), NotMinimizedFlag() ), - - Separator(), + FN(OnMacZoom), NotMinimizedFlag() ) + ), + Section( "", /* i18n-hint: Standard Macintosh Window menu item: Make all project * windows un-hidden */ Command( wxT("MacBringAllToFront"), XXO("&Bring All to Front"), FN(OnMacBringAllToFront), AlwaysEnabledFlag ) + ) ) ) }; return menu; }