1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-21 08:27:13 +01:00

Command manager stores checkmark predicates...

... and we use them to simplify (the misnamed) MenuManager::ModifyToolbarMenus.

It looked wrong that statically constructed menu descriptions should ever hold
constant boolean checkmark values, rather than functions to re-eveluate the
checkmark state as needed.
This commit is contained in:
Paul Licameli
2020-02-01 11:14:22 -05:00
parent c3bbdbc50f
commit 7f4d61257a
8 changed files with 89 additions and 98 deletions

View File

@@ -389,8 +389,6 @@ BaseItemSharedPtr ViewMenu()
{
using Options = CommandManager::Options;
static const auto checkOff = Options{}.CheckState( false );
static BaseItemSharedPtr menu{
( FinderScope{ findCommandHandler },
Menu( wxT("View"), XO("&View"),
@@ -448,7 +446,10 @@ BaseItemSharedPtr ViewMenu()
#if defined(EXPERIMENTAL_EFFECTS_RACK)
,
Command( wxT("ShowEffectsRack"), XXO("Show Effects Rack"),
FN(OnShowEffectsRack), AlwaysEnabledFlag, checkOff )
FN(OnShowEffectsRack), AlwaysEnabledFlag,
Options{}.CheckTest( [](AudacityProject &project){
auto &rack = EffectRack::Get( project );
return rack.IsShown(); } ) )
#endif
)
) ) };