mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 08:27:13 +01:00
Most functions defining menus compute once and cache the result...
... Except a few where project or plugin manager state or preferences are needed to compute the items, so evaluation is delayed, often inside lambdas Comment "Delayed evaluation" wherever there are exceptions
This commit is contained in:
@@ -1276,13 +1276,14 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||
|
||||
#define FN(X) (& TrackActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
|
||||
MenuTable::BaseItemSharedPtr TracksMenu()
|
||||
{
|
||||
// Tracks Menu (formerly Project Menu)
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
Menu( XO("&Tracks"),
|
||||
Menu( XO("Add &New"),
|
||||
Command( wxT("NewMonoTrack"), XXO("&Mono Track"), FN(OnNewWaveTrack),
|
||||
@@ -1373,7 +1374,7 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
|
||||
|
||||
Separator(),
|
||||
|
||||
// Alignment commands using selection or zero
|
||||
// Alignment commands using selection or zero
|
||||
CommandGroup(wxT("Align"),
|
||||
alignLabels,
|
||||
FN(OnAlign), AudioIONotBusyFlag | TracksSelectedFlag),
|
||||
@@ -1427,14 +1428,15 @@ MenuTable::BaseItemPtr TracksMenu( AudacityProject & )
|
||||
Options{}.CheckTest( wxT("/GUI/SyncLockTracks"), false ) )
|
||||
|
||||
#endif
|
||||
) );
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemPtr ExtraTrackMenu( AudacityProject & )
|
||||
MenuTable::BaseItemSharedPtr ExtraTrackMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
Menu( XO("&Track"),
|
||||
Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
|
||||
FN(OnTrackPan),
|
||||
@@ -1479,7 +1481,8 @@ MenuTable::BaseItemPtr ExtraTrackMenu( AudacityProject & )
|
||||
Command( wxT("TrackMoveBottom"), XXO("Move Focused Track to &Bottom"),
|
||||
FN(OnTrackMoveBottom),
|
||||
AudioIONotBusyFlag | TrackPanelHasFocus | TracksExistFlag )
|
||||
) );
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
||||
Reference in New Issue
Block a user