1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 08:27:13 +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:
Paul Licameli
2019-01-06 11:31:52 -05:00
parent 702b8b1e9d
commit 512c27d422
18 changed files with 233 additions and 123 deletions

View File

@@ -430,8 +430,7 @@ static CommandHandlerObject &findCommandHandler(AudacityProject &project) {
// Menu definitions
#define FN(X) findCommandHandler, \
static_cast<CommandFunctorPointer>(& ViewActions::Handler :: X)
#define FN(X) (& ViewActions::Handler :: X)
MenuTable::BaseItemPtr ToolbarsMenu( AudacityProject& );
@@ -442,7 +441,8 @@ MenuTable::BaseItemPtr ViewMenu( AudacityProject& )
static const auto checkOff = Options{}.CheckState( false );
return Menu( XO("&View"),
return FinderScope( findCommandHandler ).Eval(
Menu( XO("&View"),
Menu( XO("&Zoom"),
Command( wxT("ZoomIn"), XXO("Zoom &In"), FN(OnZoomIn),
ZoomInAvailableFlag, wxT("Ctrl+1") ),
@@ -547,7 +547,7 @@ MenuTable::BaseItemPtr ViewMenu( AudacityProject& )
Command( wxT("ShowEffectsRack"), XXO("Show Effects Rack"),
FN(OnShowEffectsRack), AlwaysEnabledFlag, checkOff )
#endif
);
) );
}
#undef FN