bool ExecMenuCommand::Apply(CommandExecutionContext context) { CommandManager *cmdManager = context.GetProject()->GetCommandManager(); wxString cmdName = GetString(wxT("CommandName")); auto cmdFlags = AlwaysEnabledFlag; // TODO ? auto cmdMask = AlwaysEnabledFlag; return cmdManager->HandleTextualCommand(cmdName, cmdFlags, cmdMask); }
void EditToolBar::OnButton(wxCommandEvent &event) { int id = event.GetId()-first_ETB_ID; // Be sure the pop-up happens even if there are exceptions, except for buttons which toggle. auto cleanup = finally( [&] { mButtons[id]->InteractionOver();}); AudacityProject *p = GetActiveProject(); if (!p) return; CommandManager* cm = p->GetCommandManager(); if (!cm) return; auto flags = GetMenuManager(*p).GetUpdateFlags(*p); const CommandContext context( *GetActiveProject() ); cm->HandleTextualCommand(EditToolbarButtonList[id].commandName, context, flags, NoFlagsSpecified); }