Audacity 3.2.0
|
Maintains the list of commands for batch/macro processing. See also MacrosWindow and ApplyMacroDialog. More...
#include <BatchCommands.h>
Public Member Functions | |
MacroCommands (AudacityProject &project) | |
AudacityProject & | GetProject () |
bool | ApplyMacro (const MacroCommandsCatalog &catalog, const wxString &filename={}) |
bool | ApplyCommand (const TranslatableString &friendlyCommand, const CommandID &command, const wxString ¶ms, CommandContext const *pContext=nullptr) |
bool | ApplyCommandInBatchMode (const TranslatableString &friendlyCommand, const CommandID &command, const wxString ¶ms, CommandContext const *pContext=nullptr) |
bool | ApplyEffectCommand (const PluginID &ID, const TranslatableString &friendlyCommand, const CommandID &command, const wxString ¶ms, const CommandContext &Context) |
bool | ReportAndSkip (const TranslatableString &friendlyCommand, const wxString ¶ms) |
void | AbortBatch () |
void | ResetMacro () |
void | RestoreMacro (const wxString &name) |
wxString | ReadMacro (const wxString ¯o, wxWindow *parent=nullptr) |
wxString | WriteMacro (const wxString ¯o, wxWindow *parent=nullptr) |
bool | AddMacro (const wxString ¯o) |
bool | DeleteMacro (const wxString &name) |
bool | RenameMacro (const wxString &oldmacro, const wxString &newmacro) |
void | AddToMacro (const CommandID &command, int before=-1) |
void | AddToMacro (const CommandID &command, const wxString ¶ms, int before=-1) |
void | DeleteFromMacro (int index) |
CommandID | GetCommand (int index) |
wxString | GetParams (int index) |
int | GetCount () |
wxString | GetMessage () |
void | AddToMessage (const wxString &msgIn) |
bool | IsFixed (const wxString &name) |
void | Split (const wxString &str, wxString &command, wxString ¶m) |
wxString | Join (const wxString &command, const wxString ¶m) |
Static Public Member Functions | |
static void | MigrateLegacyChains () |
static wxArrayString | GetNames () |
static wxArrayStringEx | GetNamesOfDefaultMacros () |
static wxString | GetCurrentParamsFor (const CommandID &command) |
static wxString | PromptForParamsFor (const CommandID &command, const wxString ¶ms, AudacityProject &project) |
static wxString | PromptForPresetFor (const CommandID &command, const wxString ¶ms, wxWindow *parent) |
Private Attributes | |
AudacityProject & | mProject |
CommandIDs | mCommandMacro |
wxArrayString | mParamsMacro |
bool | mAbort |
wxString | mMessage |
wxString | mFileName |
Maintains the list of commands for batch/macro processing. See also MacrosWindow and ApplyMacroDialog.
Definition at line 60 of file BatchCommands.h.
MacroCommands::MacroCommands | ( | AudacityProject & | project | ) |
Definition at line 57 of file BatchCommands.cpp.
References AddMacro(), GetNames(), GetNamesOfDefaultMacros(), make_iterator_range(), name, names, ResetMacro(), RestoreMacro(), and WriteMacro().
void MacroCommands::AbortBatch | ( | ) |
Definition at line 770 of file BatchCommands.cpp.
References mAbort.
bool MacroCommands::AddMacro | ( | const wxString & | macro | ) |
Definition at line 267 of file BatchCommands.cpp.
References FileNames::MacroDir(), name, and wxT().
Referenced by MacroCommands(), and MacrosWindow::OnAdd().
void MacroCommands::AddToMacro | ( | const CommandID & | command, |
const wxString & | params, | ||
int | before = -1 |
||
) |
Definition at line 780 of file BatchCommands.cpp.
References mCommandMacro, mParamsMacro, and params.
void MacroCommands::AddToMacro | ( | const CommandID & | command, |
int | before = -1 |
||
) |
Definition at line 775 of file BatchCommands.cpp.
References AddToMacro(), and GetCurrentParamsFor().
Referenced by AddToMacro(), MacrosWindow::InsertCommandAt(), MacrosWindow::OnDown(), MacrosWindow::OnEditCommandParams(), MacrosWindow::OnUp(), and RestoreMacro().
|
inline |
bool MacroCommands::ApplyCommand | ( | const TranslatableString & | friendlyCommand, |
const CommandID & | command, | ||
const wxString & | params, | ||
CommandContext const * | pContext = nullptr |
||
) |
!pContext || &pContext->project == &GetProject()
Definition at line 579 of file BatchCommands.cpp.
References _, AlwaysEnabledFlag, ApplyEffectCommand(), AudacityMessageBox(), PluginManager::Get(), PluginManager::GetByCommandIdentifier(), GetProject(), CommandDispatch::HandleTextualCommand(), mProject, params, CommandContext::project, CommandContext::Status(), TranslatableString::Translation(), and XO().
Referenced by ApplyCommandInBatchMode().
bool MacroCommands::ApplyCommandInBatchMode | ( | const TranslatableString & | friendlyCommand, |
const CommandID & | command, | ||
const wxString & | params, | ||
CommandContext const * | pContext = nullptr |
||
) |
!pContext || &pContext->project == &GetProject()
Definition at line 619 of file BatchCommands.cpp.
References ApplyCommand(), CommandManager::Get(), ProjectSettings::Get(), GetProject(), mProject, params, CommandContext::project, project, settings(), and CommandManager::UpdateMenus().
Referenced by ApplyMacro().
bool MacroCommands::ApplyEffectCommand | ( | const PluginID & | ID, |
const TranslatableString & | friendlyCommand, | ||
const CommandID & | command, | ||
const wxString & | params, | ||
const CommandContext & | Context | ||
) |
Definition at line 523 of file BatchCommands.cpp.
References AudacityMessageBox(), CommandDispatch::DoAudacityCommand(), EffectUI::DoEffect(), PluginManager::Get(), EffectAndCommandPluginManager::Get(), PluginManager::GetPlugin(), PluginDescriptor::GetPluginType(), EffectManager::kConfigured, EffectManager::kDontRepeatLast, EffectManager::kSkipState, mProject, params, PluginTypeAudacityCommand, CommandContext::project, project, ReportAndSkip(), SelectUtilities::SelectAllIfNoneAndAllowed(), EffectAndCommandPluginManager::SetBatchProcessing(), and XO().
Referenced by ApplyCommand().
bool MacroCommands::ApplyMacro | ( | const MacroCommandsCatalog & | catalog, |
const wxString & | filename = {} |
||
) |
Definition at line 643 of file BatchCommands.cpp.
References ApplyCommandInBatchMode(), MacroCommandsCatalog::ByCommandId(), MacroCommandsCatalog::end(), ProjectHistory::Get(), UndoManager::Get(), gPrefs, GuardedCall(), mAbort, MacroReentryCount, mCommandMacro, mFileName, ProjectHistory::ModifyState(), mParamsMacro, mProject, name, ProjectHistory::PushState(), audacity::BasicSettings::Read(), UndoStackElem::state, TranslatableString::Stripped(), valueRestorer(), Verbatim(), wxLOG_COMPONENT, wxT(), and XO().
Referenced by ApplyMacroDialog::ApplyMacroToProject(), and ApplyMacroDialog::OnApplyToFiles().
void MacroCommands::DeleteFromMacro | ( | int | index | ) |
Definition at line 790 of file BatchCommands.cpp.
References mCommandMacro, and mParamsMacro.
Referenced by MacrosWindow::OnDelete(), MacrosWindow::OnDown(), MacrosWindow::OnEditCommandParams(), and MacrosWindow::OnUp().
bool MacroCommands::DeleteMacro | ( | const wxString & | name | ) |
Definition at line 279 of file BatchCommands.cpp.
References FileNames::LegacyChainDir(), FileNames::MacroDir(), name, and wxT().
Referenced by MacrosWindow::OnRemove().
CommandID MacroCommands::GetCommand | ( | int | index | ) |
Definition at line 103 of file BatchCommands.cpp.
References mCommandMacro, and wxT().
Referenced by MacrosWindow::OnDown(), MacrosWindow::OnEditCommandParams(), MacrosWindow::OnUp(), and MacrosWindow::PopulateList().
int MacroCommands::GetCount | ( | ) |
Definition at line 121 of file BatchCommands.cpp.
References mCommandMacro.
Referenced by MacrosWindow::PopulateList().
|
static |
Definition at line 446 of file BatchCommands.cpp.
References PluginManager::Get(), EffectAndCommandPluginManager::Get(), PluginManager::GetByCommandIdentifier(), and EffectAndCommandPluginManager::GetEffectParameters().
Referenced by AddToMacro(), and MacroCommandDialog::OnItemSelected().
|
inline |
|
static |
Definition at line 866 of file BatchCommands.cpp.
References FileNames::MacroDir(), MigrateLegacyChains(), names, and wxT().
Referenced by MacroCommands(), ApplyMacroDialog::PopulateMacros(), and anonymous_namespace{BatchProcessDialog.cpp}::PopulateMacrosMenu().
|
static |
Definition at line 78 of file BatchCommands.cpp.
References FadeEnds, and MP3Conversion.
Referenced by IsFixed(), and MacroCommands().
wxString MacroCommands::GetParams | ( | int | index | ) |
Definition at line 112 of file BatchCommands.cpp.
References mParamsMacro, and wxT().
Referenced by MacrosWindow::OnDown(), MacrosWindow::OnEditCommandParams(), MacrosWindow::OnUp(), and MacrosWindow::PopulateList().
|
inline |
Definition at line 64 of file BatchCommands.h.
References mProject.
Referenced by ApplyCommand(), and ApplyCommandInBatchMode().
bool MacroCommands::IsFixed | ( | const wxString & | name | ) |
Definition at line 886 of file BatchCommands.cpp.
References GetNamesOfDefaultMacros(), make_iterator_range(), and name.
Referenced by MacrosWindow::OnMacrosBeginEdit(), and MacrosWindow::ShowActiveMacro().
wxString MacroCommands::Join | ( | const wxString & | command, |
const wxString & | param | ||
) |
Definition at line 916 of file BatchCommands.cpp.
References wxT().
|
static |
Definition at line 833 of file BatchCommands.cpp.
References FileNames::DoCopyFile(), FileNames::LegacyChainDir(), FileNames::MacroDir(), name, and wxT().
Referenced by GetNames().
|
static |
Definition at line 457 of file BatchCommands.cpp.
References EffectUI::DialogFactory(), PluginManager::Get(), EffectAndCommandPluginManager::Get(), PluginManager::GetByCommandIdentifier(), EffectAndCommandPluginManager::GetEffectParameters(), GetProjectFrame(), Effect::IsBatchProcessing(), params, project, EffectAndCommandPluginManager::PromptUser(), EffectAndCommandPluginManager::SetBatchProcessing(), settings(), and EffectUIServices::ShowHostInterface().
Referenced by MacrosWindow::OnEditCommandParams(), and MacroCommandDialog::OnEditParams().
|
static |
Definition at line 486 of file BatchCommands.cpp.
References EffectManager::Get(), PluginManager::Get(), PluginManager::GetByCommandIdentifier(), EffectManager::GetPreset(), EffectPresetsDialog::GetSelected(), params, preset, and EffectPresetsDialog::SetSelected().
Referenced by MacroCommandDialog::OnUsePreset().
wxString MacroCommands::ReadMacro | ( | const wxString & | macro, |
wxWindow * | parent = nullptr |
||
) |
Definition at line 126 of file BatchCommands.cpp.
References AudacityMessageBox(), fn, FileNames::MacroDir(), mCommandMacro, mParamsMacro, name, ResetMacro(), SelectFile(), FileNames::TextFiles, WriteMacro(), wxT(), and XO().
Referenced by ApplyMacroDialog::ApplyMacroToProject(), ApplyMacroDialog::OnApplyToFiles(), MacrosWindow::OnImport(), and MacrosWindow::ShowActiveMacro().
bool MacroCommands::RenameMacro | ( | const wxString & | oldmacro, |
const wxString & | newmacro | ||
) |
Definition at line 294 of file BatchCommands.cpp.
References FileNames::MacroDir(), and wxT().
Referenced by MacrosWindow::OnMacrosEndEdit().
bool MacroCommands::ReportAndSkip | ( | const TranslatableString & | friendlyCommand, |
const wxString & | params | ||
) |
Definition at line 808 of file BatchCommands.cpp.
References AudacityMessageBox(), gPrefs, params, audacity::BasicSettings::Read(), wxT(), and XO().
Referenced by ApplyEffectCommand().
void MacroCommands::ResetMacro | ( | ) |
Definition at line 800 of file BatchCommands.cpp.
References mCommandMacro, and mParamsMacro.
Referenced by MacroCommands(), ReadMacro(), and RestoreMacro().
void MacroCommands::RestoreMacro | ( | const wxString & | name | ) |
Definition at line 86 of file BatchCommands.cpp.
References AddToMacro(), FadeEnds, MP3Conversion, name, ResetMacro(), and wxT().
Referenced by MacroCommands(), and MacrosWindow::OnRestore().
void MacroCommands::Split | ( | const wxString & | str, |
wxString & | command, | ||
wxString & | param | ||
) |
Definition at line 894 of file BatchCommands.cpp.
wxString MacroCommands::WriteMacro | ( | const wxString & | macro, |
wxWindow * | parent = nullptr |
||
) |
Definition at line 208 of file BatchCommands.cpp.
References fn, FileNames::MacroDir(), mCommandMacro, mParamsMacro, name, SelectFile(), FileNames::TextFiles, wxT(), and XO().
Referenced by MacrosWindow::ChangeOK(), MacroCommands(), MacrosWindow::OnExport(), ReadMacro(), and MacrosWindow::SaveChanges().
|
private |
Definition at line 128 of file BatchCommands.h.
Referenced by AbortBatch(), and ApplyMacro().
|
private |
Definition at line 126 of file BatchCommands.h.
Referenced by AddToMacro(), ApplyMacro(), DeleteFromMacro(), GetCommand(), GetCount(), ReadMacro(), ResetMacro(), and WriteMacro().
|
private |
Definition at line 131 of file BatchCommands.h.
Referenced by ApplyMacro().
|
private |
Definition at line 129 of file BatchCommands.h.
Referenced by AddToMessage(), and GetMessage().
|
private |
Definition at line 127 of file BatchCommands.h.
Referenced by AddToMacro(), ApplyMacro(), DeleteFromMacro(), GetParams(), ReadMacro(), ResetMacro(), and WriteMacro().
|
private |
Definition at line 124 of file BatchCommands.h.
Referenced by ApplyCommand(), ApplyCommandInBatchMode(), ApplyEffectCommand(), ApplyMacro(), and GetProject().