mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +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:
@@ -823,12 +823,13 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||
|
||||
#define FN(X) (& ClipActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemPtr ClipSelectMenu( AudacityProject& )
|
||||
MenuTable::BaseItemSharedPtr ClipSelectMenu()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
static BaseItemSharedPtr menu{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
Menu( XO("Clip B&oundaries"),
|
||||
Command( wxT("SelPrevClipBoundaryToCursor"),
|
||||
XXO("Pre&vious Clip Boundary to Cursor"),
|
||||
@@ -844,15 +845,17 @@ MenuTable::BaseItemPtr ClipSelectMenu( AudacityProject& )
|
||||
Command( wxT("SelNextClip"), XXO("N&ext Clip"), FN(OnSelectNextClip),
|
||||
WaveTracksExistFlag,
|
||||
Options{ wxT("Alt+."), XO("Select Next Clip") } )
|
||||
) );
|
||||
) ) };
|
||||
return menu;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemPtr ClipCursorItems( AudacityProject & )
|
||||
MenuTable::BaseItemSharedPtr ClipCursorItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
Items(
|
||||
Command( wxT("CursPrevClipBoundary"), XXO("Pre&vious Clip Boundary"),
|
||||
FN(OnCursorPrevClipBoundary),
|
||||
@@ -862,20 +865,23 @@ MenuTable::BaseItemPtr ClipCursorItems( AudacityProject & )
|
||||
FN(OnCursorNextClipBoundary),
|
||||
WaveTracksExistFlag,
|
||||
Options{}.LongName( XO("Cursor to Next Clip Boundary") ) )
|
||||
) );
|
||||
) ) };
|
||||
return items;
|
||||
}
|
||||
|
||||
MenuTable::BaseItemPtr ExtraClipCursorItems( AudacityProject & )
|
||||
MenuTable::BaseItemSharedPtr ExtraClipCursorItems()
|
||||
{
|
||||
using namespace MenuTable;
|
||||
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
static BaseItemSharedPtr items{
|
||||
FinderScope( findCommandHandler ).Eval(
|
||||
Items(
|
||||
Command( wxT("ClipLeft"), XXO("Clip L&eft"), FN(OnClipLeft),
|
||||
TracksExistFlag | TrackPanelHasFocus, wxT("\twantKeyup") ),
|
||||
Command( wxT("ClipRight"), XXO("Clip Rig&ht"), FN(OnClipRight),
|
||||
TracksExistFlag | TrackPanelHasFocus, wxT("\twantKeyup") )
|
||||
) );
|
||||
) ) };
|
||||
return items;
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
||||
Reference in New Issue
Block a user