1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-06 15:19:29 +02:00

Simplify populating of Scrub menu

This commit is contained in:
Paul Licameli 2018-10-18 19:44:28 -04:00
parent 83ede10891
commit 32efcd43c4

View File

@ -1159,26 +1159,22 @@ static CommandHandlerObject &findme(AudacityProject &project)
void Scrubber::AddMenuItems()
{
auto cm = mProject->GetCommandManager();
using Options = CommandManager::Options;
cm->BeginSubMenu(_("Scru&bbing"));
for (const auto &item : menuItems) {
if (item.StatusTest)
cm->AddItem( item.name, wxGetTranslation(item.label),
// No menu items yet have dialogs
false,
findme, static_cast<CommandFunctorPointer>(item.memFn),
item.flags,
CommandManager::Options{}.CheckState( false ) );
else
// The start item
cm->AddItem( item.name, wxGetTranslation(item.label),
// No menu items yet have dialogs
false,
findme, static_cast<CommandFunctorPointer>(item.memFn),
item.flags );
cm->AddItem( item.name, wxGetTranslation(item.label),
// No menu items yet have dialogs
false,
findme, static_cast<CommandFunctorPointer>(item.memFn),
item.flags,
item.StatusTest
? // a checkmark item
Options{}.CheckState( (this->*item.StatusTest)() )
: // not a checkmark item
Options{} );
}
cm->EndSubMenu();
CheckMenuItems();
}
void Scrubber::PopulatePopupMenu(wxMenu &menu)