예제 #1
0
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);
}
예제 #2
0
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);
}