mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Simplify the FN macros in src/menus/*.cpp...
... Eliminate repetitious passing of the finder function into each of the calls to Command and CommandGroup.
This commit is contained in:
@@ -821,15 +821,15 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &) {
|
||||
|
||||
// Menu definitions
|
||||
|
||||
#define FN(X) findCommandHandler, \
|
||||
static_cast<CommandFunctorPointer>(& ClipActions::Handler :: X)
|
||||
#define FN(X) (& ClipActions::Handler :: X)
|
||||
|
||||
MenuTable::BaseItemPtr ClipSelectMenu( AudacityProject& )
|
||||
{
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
return Menu( XO("Clip B&oundaries"),
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
Menu( XO("Clip B&oundaries"),
|
||||
Command( wxT("SelPrevClipBoundaryToCursor"),
|
||||
XXO("Pre&vious Clip Boundary to Cursor"),
|
||||
FN(OnSelectPrevClipBoundaryToCursor),
|
||||
@@ -844,7 +844,7 @@ MenuTable::BaseItemPtr ClipSelectMenu( AudacityProject& )
|
||||
Command( wxT("SelNextClip"), XXO("N&ext Clip"), FN(OnSelectNextClip),
|
||||
WaveTracksExistFlag,
|
||||
Options{ wxT("Alt+."), XO("Select Next Clip") } )
|
||||
);
|
||||
) );
|
||||
}
|
||||
|
||||
MenuTable::BaseItemPtr ClipCursorItems( AudacityProject & )
|
||||
@@ -852,7 +852,8 @@ MenuTable::BaseItemPtr ClipCursorItems( AudacityProject & )
|
||||
using namespace MenuTable;
|
||||
using Options = CommandManager::Options;
|
||||
|
||||
return Items(
|
||||
return FinderScope( findCommandHandler ).Eval(
|
||||
Items(
|
||||
Command( wxT("CursPrevClipBoundary"), XXO("Pre&vious Clip Boundary"),
|
||||
FN(OnCursorPrevClipBoundary),
|
||||
WaveTracksExistFlag,
|
||||
@@ -861,19 +862,20 @@ MenuTable::BaseItemPtr ClipCursorItems( AudacityProject & )
|
||||
FN(OnCursorNextClipBoundary),
|
||||
WaveTracksExistFlag,
|
||||
Options{}.LongName( XO("Cursor to Next Clip Boundary") ) )
|
||||
);
|
||||
) );
|
||||
}
|
||||
|
||||
MenuTable::BaseItemPtr ExtraClipCursorItems( AudacityProject & )
|
||||
{
|
||||
using namespace MenuTable;
|
||||
|
||||
return Items(
|
||||
return 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") )
|
||||
);
|
||||
) );
|
||||
}
|
||||
|
||||
#undef FN
|
||||
|
||||
Reference in New Issue
Block a user