| 484 | } |
| 485 | |
| 486 | wxString MacroCommands::PromptForPresetFor(const CommandID & command, const wxString & params, wxWindow *parent) |
| 487 | { |
| 488 | const PluginID& ID = PluginManager::Get().GetByCommandIdentifier(command); |
| 489 | if (ID.empty()) |
| 490 | { |
| 491 | return wxEmptyString; // effect not found. |
| 492 | } |
| 493 | |
| 494 | EffectManager::EffectPresetDialog dialog = |
| 495 | [parent]( |
| 496 | EffectPlugin& effect, |
| 497 | const wxString& preset) -> std::optional<wxString> { |
| 498 | EffectPresetsDialog dlg(parent, &effect); |
| 499 | dlg.Layout(); |
| 500 | dlg.Fit(); |
| 501 | dlg.SetSize(dlg.GetMinSize()); |
| 502 | dlg.CenterOnParent(); |
| 503 | dlg.SetSelected(preset); |
| 504 | |
| 505 | if (dlg.ShowModal()) |
| 506 | return std::make_optional(dlg.GetSelected()); |
| 507 | else |
| 508 | return {}; |
| 509 | }; |
| 510 | wxString preset = |
| 511 | EffectManager::Get().GetPreset(ID, params, std::move(dialog)); |
| 512 | |
| 513 | // Preset will be empty if the user cancelled the dialog, so return the original |
| 514 | // parameter value. |
| 515 | if (preset.empty()) |
| 516 | { |
| 517 | return params; |
| 518 | } |
| 519 | |
| 520 | return preset; |
| 521 | } |
| 522 | |
| 523 | bool MacroCommands::ApplyEffectCommand( |
| 524 | const PluginID & ID, const TranslatableString &friendlyCommand, |
nothing calls this directly
no test coverage detected