mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-15 16:14:11 +02:00
Reimplement commit 512c27d, fixing menus & shortcut keys on Windows
This commit is contained in:
parent
ff2d20f335
commit
9639ba84f4
@ -645,8 +645,7 @@ namespace MenuTable {
|
||||
// return Items( ... );
|
||||
//
|
||||
// or:
|
||||
// return FinderScope( findCommandHandler )
|
||||
// .Eval( Items( ... ) );
|
||||
// return ( FinderScope( findCommandHandler ), Items( ... ) );
|
||||
//
|
||||
// where findCommandHandler names a function.
|
||||
// This is used before a sequence of many calls to Command() and
|
||||
@ -663,10 +662,6 @@ namespace MenuTable {
|
||||
FinderScope( CommandHandlerFinder finder )
|
||||
: ValueRestorer( sFinder, finder )
|
||||
{}
|
||||
|
||||
// See usage comment above about this pass-through function
|
||||
template< typename Value > Value&& Eval( Value &&value ) const
|
||||
{ return std::forward<Value>(value); }
|
||||
};
|
||||
|
||||
// Describes one command in a menu
|
||||
|
@ -830,7 +830,7 @@ MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu {
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Clip"), XO("Clip B&oundaries"),
|
||||
Command( wxT("SelPrevClipBoundaryToCursor"),
|
||||
XXO("Pre&vious Clip Boundary to Cursor"),
|
||||
@ -857,7 +857,7 @@ MenuTable::BaseItemSharedPtr ClipCursorItems()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Clip"),
|
||||
Command( wxT("CursPrevClipBoundary"), XXO("Pre&vious Clip Boundary"),
|
||||
FN(OnCursorPrevClipBoundary),
|
||||
@ -877,7 +877,7 @@ MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
||||
using namespace MenuTable;
|
||||
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Clip"),
|
||||
Command( wxT("ClipLeft"), XXO("Clip L&eft"), FN(OnClipLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(), wxT("\twantKeyup") ),
|
||||
|
@ -1053,7 +1053,7 @@ MenuTable::BaseItemSharedPtr EditMenu()
|
||||
;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Edit"), XO("&Edit"),
|
||||
Command( wxT("Undo"), XXO("&Undo"), FN(OnUndo),
|
||||
AudioIONotBusyFlag() | UndoAvailableFlag(), wxT("Ctrl+Z") ),
|
||||
@ -1160,7 +1160,7 @@ MenuTable::BaseItemSharedPtr ExtraEditMenu()
|
||||
static const auto flags =
|
||||
AudioIONotBusyFlag() | TracksSelectedFlag() | TimeSelectedFlag();
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Edit"), XO("&Edit"),
|
||||
Command( wxT("DeleteKey"), XXO("&Delete Key"), FN(OnDelete),
|
||||
(flags | NoAutoSelect()),
|
||||
|
@ -199,7 +199,7 @@ MenuTable::BaseItemSharedPtr ExtraMixerMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Mixer"), XO("Mi&xer"),
|
||||
Command( wxT("OutputGain"), XXO("Ad&just Playback Volume..."),
|
||||
FN(OnOutputGain), AlwaysEnabledFlag ),
|
||||
@ -222,7 +222,7 @@ MenuTable::BaseItemSharedPtr ExtraDeviceMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Device"), XO("De&vice"),
|
||||
Command( wxT("InputDevice"), XXO("Change &Recording Device..."),
|
||||
FN(OnInputDevice),
|
||||
@ -254,7 +254,7 @@ MenuTable::BaseItemPtr ExtraMiscItems( AudacityProject &project )
|
||||
;
|
||||
|
||||
// Not a menu.
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
return ( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Misc"),
|
||||
// Accel key is not bindable.
|
||||
Command( wxT("FullScreenOnOff"), XXO("&Full Screen (on/off)"),
|
||||
|
@ -558,7 +558,7 @@ MenuTable::BaseItemSharedPtr FileMenu()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("File"), XO("&File"),
|
||||
/*i18n-hint: "New" is an action (verb) to create a NEW project*/
|
||||
Command( wxT("New"), XXO("&New"), FN(OnNew),
|
||||
|
@ -486,7 +486,7 @@ MenuTable::BaseItemSharedPtr HelpMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Help"), XO("&Help"),
|
||||
// QuickFix menu item not in Audacity 2.3.1 whilst we discuss further.
|
||||
#ifdef EXPERIMENTAL_DA
|
||||
|
@ -600,7 +600,7 @@ MenuTable::BaseItemSharedPtr LabelEditMenus()
|
||||
// Returns TWO menus.
|
||||
|
||||
static BaseItemSharedPtr menus{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxEmptyString,
|
||||
|
||||
Menu( wxT("Labels"), XO("&Labels"),
|
||||
|
@ -563,7 +563,7 @@ MenuTable::BaseItemSharedPtr ExtraGlobalCommands()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("Navigation"),
|
||||
Command( wxT("PrevWindow"), XXO("Move Backward Through Active Windows"),
|
||||
FN(OnPrevWindow), AlwaysEnabledFlag,
|
||||
@ -582,7 +582,7 @@ MenuTable::BaseItemSharedPtr ExtraFocusMenu()
|
||||
static const auto FocusedTracksFlags = TracksExistFlag() | TrackPanelHasFocus();
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Focus"), XO("F&ocus"),
|
||||
Command( wxT("PrevFrame"),
|
||||
XXO("Move &Backward from Toolbars to Tracks"), FN(OnPrevFrame),
|
||||
|
@ -749,7 +749,7 @@ MenuTable::BaseItemSharedPtr GenerateMenu()
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Generate"), XO("&Generate"),
|
||||
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
|
||||
Command( wxT("ManageGenerators"), XXO("Add / Remove Plug-ins..."),
|
||||
@ -785,7 +785,7 @@ MenuTable::BaseItemSharedPtr EffectMenu()
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Effect"), XO("Effe&ct"),
|
||||
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
|
||||
Command( wxT("ManageEffects"), XXO("Add / Remove Plug-ins..."),
|
||||
@ -835,7 +835,7 @@ MenuTable::BaseItemSharedPtr AnalyzeMenu()
|
||||
// the plugin manager...sorry! :-(
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Analyze"), XO("&Analyze"),
|
||||
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
|
||||
Command( wxT("ManageAnalyzers"), XXO("Add / Remove Plug-ins..."),
|
||||
@ -869,7 +869,7 @@ MenuTable::BaseItemSharedPtr ToolsMenu()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Tools"), XO("T&ools"),
|
||||
|
||||
#ifdef EXPERIMENTAL_EFFECT_MANAGEMENT
|
||||
@ -951,7 +951,7 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIMenu()
|
||||
|
||||
// These are the more useful to VI user Scriptables.
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
// i18n-hint: Scriptables are commands normally used from Python, Perl etc.
|
||||
Menu( wxT("Scriptables1"), XO("Script&ables I"),
|
||||
// Note that the PLUGIN_SYMBOL must have a space between words,
|
||||
@ -1001,7 +1001,7 @@ MenuTable::BaseItemSharedPtr ExtraScriptablesIIMenu()
|
||||
|
||||
// Less useful to VI users.
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Scriptables2"), XO("Scripta&bles II"),
|
||||
Command( wxT("Select"), XXO("Select..."), FN(OnAudacityCommand),
|
||||
AudioIONotBusyFlag() ),
|
||||
|
@ -1036,7 +1036,7 @@ MenuTable::BaseItemSharedPtr SelectMenu()
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
/* i18n-hint: (verb) It's an item on a menu. */
|
||||
Menu( wxT("Select"), XO("&Select"),
|
||||
Command( wxT("SelectAll"), XXO("&All"), FN(OnSelectAll),
|
||||
@ -1145,7 +1145,7 @@ MenuTable::BaseItemSharedPtr ExtraSelectionMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Select"), XO("&Selection"),
|
||||
Command( wxT("SnapToOff"), XXO("Snap-To &Off"), FN(OnSnapToOff),
|
||||
AlwaysEnabledFlag ),
|
||||
@ -1198,7 +1198,7 @@ MenuTable::BaseItemSharedPtr CursorMenu()
|
||||
// selection. 'Cursor to' does neither. 'Center at' might describe it better
|
||||
// than 'Skip'.
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Cursor"), XO("&Cursor to"),
|
||||
Command( wxT("CursSelStart"), XXO("Selection Star&t"),
|
||||
FN(OnCursorSelStart),
|
||||
@ -1239,7 +1239,7 @@ MenuTable::BaseItemSharedPtr ExtraCursorMenu()
|
||||
using namespace MenuTable;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Cursor"), XO("&Cursor"),
|
||||
Command( wxT("CursorLeft"), XXO("Cursor &Left"), FN(OnCursorLeft),
|
||||
TracksExistFlag() | TrackPanelHasFocus(),
|
||||
@ -1270,7 +1270,7 @@ MenuTable::BaseItemSharedPtr ExtraSeekMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Seek"), XO("See&k"),
|
||||
Command( wxT("SeekLeftShort"), XXO("Short Seek &Left During Playback"),
|
||||
FN(OnSeekLeftShort), AudioIOBusyFlag(), wxT("Left\tallowDup") ),
|
||||
|
@ -262,7 +262,7 @@ MenuTable::BaseItemSharedPtr ToolbarsMenu()
|
||||
static const auto checkOff = Options{}.CheckState( false );
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Toolbars"), XO("&Toolbars"),
|
||||
/* i18n-hint: (verb)*/
|
||||
Command( wxT("ResetToolbars"), XXO("Reset Toolb&ars"),
|
||||
@ -341,7 +341,7 @@ MenuTable::BaseItemSharedPtr ExtraToolsMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Tools"), XO("T&ools"),
|
||||
Command( wxT("SelectTool"), XXO("&Selection Tool"), FN(OnSelectTool),
|
||||
AlwaysEnabledFlag, wxT("F1") ),
|
||||
|
@ -1285,7 +1285,7 @@ MenuTable::BaseItemSharedPtr TracksMenu()
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Tracks"), XO("&Tracks"),
|
||||
Menu( wxT("Add"), XO("Add &New"),
|
||||
Command( wxT("NewMonoTrack"), XXO("&Mono Track"), FN(OnNewWaveTrack),
|
||||
@ -1439,7 +1439,7 @@ MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Track"), XO("&Track"),
|
||||
Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
|
||||
FN(OnTrackPan),
|
||||
|
@ -982,7 +982,7 @@ MenuTable::BaseItemSharedPtr TransportMenu()
|
||||
static const auto CanStopFlags = AudioIONotBusyFlag() | CanStopAudioStreamFlag();
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
/* i18n-hint: 'Transport' is the name given to the set of controls that
|
||||
play, record, pause etc. */
|
||||
Menu( wxT("Transport"), XO("Tra&nsport"),
|
||||
@ -1100,7 +1100,7 @@ MenuTable::BaseItemSharedPtr ExtraTransportMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Transport"), XO("T&ransport"),
|
||||
// PlayStop is already in the menus.
|
||||
/* i18n-hint: (verb) Start playing audio*/
|
||||
@ -1152,7 +1152,7 @@ MenuTable::BaseItemSharedPtr ExtraPlayAtSpeedMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("PlayAtSpeed"), XO("&Play-at-Speed"),
|
||||
/* i18n-hint: 'Normal Play-at-Speed' doesn't loop or cut preview. */
|
||||
Command( wxT("PlayAtSpeed"), XXO("Normal Pl&ay-at-Speed"),
|
||||
|
@ -443,7 +443,7 @@ MenuTable::BaseItemSharedPtr ViewMenu()
|
||||
static const auto checkOff = Options{}.CheckState( false );
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("View"), XO("&View"),
|
||||
Menu( wxT("Zoom"), XO("&Zoom"),
|
||||
Command( wxT("ZoomIn"), XXO("Zoom &In"), FN(OnZoomIn),
|
||||
|
@ -126,7 +126,7 @@ MenuTable::BaseItemSharedPtr WindowMenu()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Menu( wxT("Window"), XO("&Window"),
|
||||
/* i18n-hint: Standard Macintosh Window menu item: Make (the current
|
||||
* window) shrink to an icon on the dock */
|
||||
@ -152,7 +152,7 @@ MenuTable::BaseItemSharedPtr ExtraWindowItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
( FinderScope{ findCommandHandler },
|
||||
Items( wxT("MacWindows"),
|
||||
/* i18n-hint: Shrink all project windows to icons on the Macintosh
|
||||
tooldock */
|
||||
|
@ -1132,11 +1132,10 @@ MenuTable::BaseItemSharedPtr Scrubber::Menu()
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
static BaseItemSharedPtr menu {
|
||||
FinderScope(
|
||||
static BaseItemSharedPtr menu { (
|
||||
FinderScope{
|
||||
[](AudacityProject &project) -> CommandHandlerObject&
|
||||
{ return Scrubber::Get( project ); }
|
||||
).Eval(
|
||||
{ return Scrubber::Get( project ); } },
|
||||
MenuTable::Menu( wxT("Scrubbing"),
|
||||
XO("Scru&bbing"),
|
||||
[]{
|
||||
@ -1155,7 +1154,8 @@ MenuTable::BaseItemSharedPtr Scrubber::Menu()
|
||||
}
|
||||
return ptrs;
|
||||
}()
|
||||
) ) };
|
||||
)
|
||||
) };
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user