MCPcopy Create free account
hub / github.com/audacity/audacity / PromptForPresetFor

Method PromptForPresetFor

src/BatchCommands.cpp:486–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486wxString 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
523bool MacroCommands::ApplyEffectCommand(
524 const PluginID & ID, const TranslatableString &friendlyCommand,

Callers

nothing calls this directly

Calls 10

GetFunction · 0.85
moveFunction · 0.85
GetPresetMethod · 0.80
emptyMethod · 0.45
LayoutMethod · 0.45
FitMethod · 0.45
SetSizeMethod · 0.45
SetSelectedMethod · 0.45
ShowModalMethod · 0.45
GetSelectedMethod · 0.45

Tested by

no test coverage detected