| 521 | } |
| 522 | |
| 523 | bool MacroCommands::ApplyEffectCommand( |
| 524 | const PluginID & ID, const TranslatableString &friendlyCommand, |
| 525 | const CommandID & command, const wxString & params, |
| 526 | const CommandContext & Context) |
| 527 | { |
| 528 | static_cast<void>(command);//compiler food. |
| 529 | |
| 530 | //Possibly end processing here, if in batch-debug |
| 531 | if( ReportAndSkip(friendlyCommand, params)) |
| 532 | return true; |
| 533 | |
| 534 | const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID); |
| 535 | if (!plug) |
| 536 | return false; |
| 537 | |
| 538 | AudacityProject *project = &mProject; |
| 539 | |
| 540 | // IF nothing selected, THEN select everything depending |
| 541 | // on preferences setting. |
| 542 | // (most effects require that you have something selected). |
| 543 | if( plug->GetPluginType() != PluginTypeAudacityCommand ) |
| 544 | { |
| 545 | if( !SelectUtilities::SelectAllIfNoneAndAllowed( *project ) ) |
| 546 | { |
| 547 | AudacityMessageBox( |
| 548 | // i18n-hint: %s will be replaced by the name of an action, such as "Remove Tracks". |
| 549 | XO("\"%s\" requires one or more tracks to be selected.").Format(friendlyCommand)); |
| 550 | return false; |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | bool res = false; |
| 555 | |
| 556 | auto cleanup = EffectAndCommandPluginManager::Get().SetBatchProcessing(ID); |
| 557 | |
| 558 | // transfer the parameters to the effect... |
| 559 | if (EffectAndCommandPluginManager::Get().SetEffectParameters(ID, params)) |
| 560 | { |
| 561 | if( plug->GetPluginType() == PluginTypeAudacityCommand ) |
| 562 | // and apply the effect... |
| 563 | res = CommandDispatch::DoAudacityCommand(ID, |
| 564 | Context, |
| 565 | EffectManager::kConfigured | |
| 566 | EffectManager::kSkipState | |
| 567 | EffectManager::kDontRepeatLast); |
| 568 | else |
| 569 | // and apply the effect... |
| 570 | res = EffectUI::DoEffect( |
| 571 | ID, Context.project, |
| 572 | EffectManager::kConfigured | EffectManager::kSkipState | |
| 573 | EffectManager::kDontRepeatLast); |
| 574 | } |
| 575 | |
| 576 | return res; |
| 577 | } |
| 578 | |
| 579 | bool MacroCommands::ApplyCommand( const TranslatableString &friendlyCommand, |
| 580 | const CommandID & command, const wxString & params, |
nothing calls this directly
no test coverage detected