Audacity 3.2.0
Typedefs | Functions | Variables
anonymous_namespace{BatchProcessDialog.cpp} Namespace Reference

Typedefs

using MacroID = wxString
 

Functions

void OnApplyMacroDirectlyByName (const CommandContext &context, const MacroID &Name)
 
void OnRepeatLastTool (const CommandContext &context)
 
void OnManageMacros (const CommandContext &context)
 
void OnApplyMacrosPalette (const CommandContext &context)
 
void OnApplyMacroDirectly (const CommandContext &context)
 
void PopulateMacrosMenu (MenuRegistry::MenuItems &items, CommandFlag flags)
 
const ReservedCommandFlagHasLastToolFlag ()
 

Variables

AttachedWindows::RegisteredFactory sMacrosWindowKey
 

Typedef Documentation

◆ MacroID

using anonymous_namespace{BatchProcessDialog.cpp}::MacroID = typedef wxString

Definition at line 1411 of file BatchProcessDialog.cpp.

Function Documentation

◆ HasLastToolFlag()

const ReservedCommandFlag & anonymous_namespace{BatchProcessDialog.cpp}::HasLastToolFlag ( )

Definition at line 1529 of file BatchProcessDialog.cpp.

1529 { static ReservedCommandFlag flag{
1530 [](const AudacityProject &project) {
1531 auto& commandManager = CommandManager::Get(project);
1532 if (commandManager.mLastToolRegistration ==
1534 return true;
1535 return !commandManager.mLastTool.empty();
1536 }
1537 }; return flag;
1538}
const auto project
static std::once_flag flag
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static CommandManager & Get(AudacityProject &project)

References flag, CommandManager::Get(), project, and CommandManager::repeattypeunique.

Referenced by PluginMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnApplyMacroDirectly()

void anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectly ( const CommandContext context)

Definition at line 1466 of file BatchProcessDialog.cpp.

1467{
1468 const MacroID& Name = context.parameter.GET();
1469 OnApplyMacroDirectlyByName(context, Name);
1470}
CommandParameter parameter
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
Definition: Identifier.h:66
void OnApplyMacroDirectlyByName(const CommandContext &context, const MacroID &Name)

References Identifier::GET(), OnApplyMacroDirectlyByName(), and CommandContext::parameter.

Referenced by PopulateMacrosMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnApplyMacroDirectlyByName()

void anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacroDirectlyByName ( const CommandContext context,
const MacroID Name 
)

Definition at line 1472 of file BatchProcessDialog.cpp.

1474{
1475 auto &project = context.project;
1476 auto &window = GetProjectFrame(project);
1477 //wxLogDebug( "Macro was: %s", context.parameter);
1478 ApplyMacroDialog dlg( &window, project );
1479 //const auto &Name = context.parameter;
1480
1481// We used numbers previously, but macros could get renumbered, making
1482// macros containing macros unpredictable.
1483#ifdef MACROS_BY_NUMBERS
1484 long item=0;
1485 // Take last three letters (of e.g. Macro007) and convert to a number.
1486 Name.Mid( Name.length() - 3 ).ToLong( &item, 10 );
1487 dlg.ApplyMacroToProject( item, false );
1488#else
1489 dlg.ApplyMacroToProject( Name, false );
1490#endif
1491 /* i18n-hint: %s will be the name of the macro which will be
1492 * repeated if this menu item is chosen */
1494
1497 auto shortDesc = em.GetCommandName(Name);
1498 auto& undoManager = UndoManager::Get(project);
1499 auto& commandManager = CommandManager::Get(project);
1500 int cur = undoManager.GetCurrentState();
1501 if (undoManager.UndoAvailable()) {
1502 undoManager.GetShortDescription(cur, &desc);
1503 commandManager.Modify(wxT("RepeatLastTool"), XXO("&Repeat %s")
1504 .Format(desc));
1505 auto& commandManager = CommandManager::Get(project);
1506 commandManager.mLastTool = Name;
1507 commandManager.mLastToolRegistration =
1509 }
1510
1511}
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
Shows progress in executing commands in MacroCommands.
AudacityProject & project
EffectManager is the class that handles effects and effect categories.
Definition: EffectManager.h:48
static EffectManager & Get()
TranslatableString GetCommandName(const PluginID &ID)
Abstract base class used in importing a file.
Holds a msgid for the translation catalog; may also bind format arguments.
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71
const TranslatableString desc
Definition: ExportPCM.cpp:51

References ApplyMacroDialog::ApplyMacroToProject(), anonymous_namespace{ExportPCM.cpp}::desc, EffectManager::Get(), CommandManager::Get(), UndoManager::Get(), EffectManager::GetCommandName(), GetProjectFrame(), CommandManager::ModifyUndoMenuItems(), CommandContext::project, project, CommandManager::repeattypeapplymacro, wxT(), and XXO().

Referenced by OnApplyMacroDirectly(), and OnRepeatLastTool().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnApplyMacrosPalette()

void anonymous_namespace{BatchProcessDialog.cpp}::OnApplyMacrosPalette ( const CommandContext context)

Definition at line 1453 of file BatchProcessDialog.cpp.

1454{
1455 auto &project = context.project;
1456 CommandManager::Get(project).RegisterLastTool(context); //Register Palette as Last Tool
1457 auto macrosWindow = &GetAttachedWindows(project)
1458 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
1459 if (macrosWindow) {
1460 macrosWindow->Show();
1461 macrosWindow->Raise();
1462 macrosWindow->UpdateDisplay( false );
1463 }
1464}
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
void RegisterLastTool(const CommandContext &context)
void UpdateDisplay(bool bExpanded)
AttachedWindows::RegisteredFactory sMacrosWindowKey

References CommandManager::Get(), GetAttachedWindows(), CommandContext::project, project, CommandManager::RegisterLastTool(), sMacrosWindowKey, and MacrosWindow::UpdateDisplay().

Referenced by PluginMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnManageMacros()

void anonymous_namespace{BatchProcessDialog.cpp}::OnManageMacros ( const CommandContext context)

Definition at line 1440 of file BatchProcessDialog.cpp.

1441{
1442 auto &project = context.project;
1443 CommandManager::Get(project).RegisterLastTool(context); //Register Macros as Last Tool
1444 auto macrosWindow = &GetAttachedWindows(project)
1445 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
1446 if (macrosWindow) {
1447 macrosWindow->Show();
1448 macrosWindow->Raise();
1449 macrosWindow->UpdateDisplay( true );
1450 }
1451}

References CommandManager::Get(), GetAttachedWindows(), CommandContext::project, project, CommandManager::RegisterLastTool(), sMacrosWindowKey, and MacrosWindow::UpdateDisplay().

Referenced by PluginMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRepeatLastTool()

void anonymous_namespace{BatchProcessDialog.cpp}::OnRepeatLastTool ( const CommandContext context)

Definition at line 1416 of file BatchProcessDialog.cpp.

1417{
1418 auto& commandManager = CommandManager::Get(context.project);
1419 switch (commandManager.mLastToolRegistration) {
1421 {
1422 auto lastEffect = commandManager.mLastTool;
1423 if (!lastEffect.empty())
1424 {
1426 lastEffect, context, commandManager.mRepeatToolFlags);
1427 }
1428 }
1429 break;
1432 commandManager.mLastToolRegisteredId);
1433 break;
1435 OnApplyMacroDirectlyByName(context, commandManager.mLastTool);
1436 break;
1437 }
1438}
void DoRepeatProcess(const CommandContext &context, int)
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1148

References EffectUI::DoEffect(), CommandManager::DoRepeatProcess(), CommandManager::Get(), OnApplyMacroDirectlyByName(), CommandContext::project, CommandManager::repeattypeapplymacro, CommandManager::repeattypeplugin, and CommandManager::repeattypeunique.

Referenced by PluginMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PopulateMacrosMenu()

void anonymous_namespace{BatchProcessDialog.cpp}::PopulateMacrosMenu ( MenuRegistry::MenuItems items,
CommandFlag  flags 
)

Definition at line 1513 of file BatchProcessDialog.cpp.

1514{
1515 using namespace MenuRegistry;
1516 auto names = MacroCommands::GetNames(); // these names come from filenames
1517 for (const auto &name : names) {
1520 Verbatim(name), // file name verbatim
1522 flags,
1524 ));
1525 }
1526}
const TranslatableString name
Definition: Distortion.cpp:76
static TranslatableStrings names
Definition: TagsEditor.cpp:153
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
static CommandID MacroIdOfName(const wxString &MacroName)
static wxArrayString GetNames()
constexpr auto Command
Definition: MenuRegistry.h:456
void OnApplyMacroDirectly(const CommandContext &context)
auto push_back(Arg &&arg) -> std::enable_if_t< Traits< Base, Derived > ::template enables_item_type_v< Arg >, void >
Definition: Composite.h:105
Options && AllowInMacros(int value=1) &&
Definition: MenuRegistry.h:69

References MenuRegistry::Options::AllowInMacros(), MenuRegistry::Command, MacroCommands::GetNames(), ApplyMacroDialog::MacroIdOfName(), name, names, OnApplyMacroDirectly(), Composite::Builder< Base, Derived, BaseArgs >::push_back(), and Verbatim().

Referenced by PluginMenuItems().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ sMacrosWindowKey

AttachedWindows::RegisteredFactory anonymous_namespace{BatchProcessDialog.cpp}::sMacrosWindowKey
Initial value:
{
[]( AudacityProject &parent ) -> wxWeakRef< wxWindow > {
auto &window = GetProjectFrame(parent);
&window, parent, true
);
}
}
#define safenew
Definition: MemoryX.h:10

Definition at line 1402 of file BatchProcessDialog.cpp.

Referenced by OnApplyMacrosPalette(), and OnManageMacros().