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 1412 of file BatchProcessDialog.cpp.

Function Documentation

◆ HasLastToolFlag()

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

Definition at line 1527 of file BatchProcessDialog.cpp.

1527 { static ReservedCommandFlag flag{
1528 [](const AudacityProject &project) {
1529 auto& commandManager = CommandManager::Get(project);
1530 if (commandManager.mLastToolRegistration ==
1532 return true;
1533 return !commandManager.mLastTool.empty();
1534 }
1535 }; return flag;
1536}
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 1465 of file BatchProcessDialog.cpp.

1466{
1467 const MacroID& Name = context.parameter.GET();
1468 OnApplyMacroDirectlyByName(context, Name);
1469}
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 1471 of file BatchProcessDialog.cpp.

1473{
1474 auto &project = context.project;
1475 auto &window = GetProjectFrame(project);
1476 //wxLogDebug( "Macro was: %s", context.parameter);
1477 ApplyMacroDialog dlg( &window, project );
1478 //const auto &Name = context.parameter;
1479
1480// We used numbers previously, but macros could get renumbered, making
1481// macros containing macros unpredictable.
1482#ifdef MACROS_BY_NUMBERS
1483 long item=0;
1484 // Take last three letters (of e.g. Macro007) and convert to a number.
1485 Name.Mid( Name.length() - 3 ).ToLong( &item, 10 );
1486 dlg.ApplyMacroToProject( item, false );
1487#else
1488 dlg.ApplyMacroToProject( Name, false );
1489#endif
1490 /* i18n-hint: %s will be the name of the macro which will be
1491 * repeated if this menu item is chosen */
1493
1495 auto shortDesc = PluginManager::Get().GetName(Name);
1496 auto& undoManager = UndoManager::Get(project);
1497 auto& commandManager = CommandManager::Get(project);
1498 int cur = undoManager.GetCurrentState();
1499 if (undoManager.UndoAvailable()) {
1500 undoManager.GetShortDescription(cur, &desc);
1501 commandManager.Modify(wxT("RepeatLastTool"), XXO("&Repeat %s")
1502 .Format(desc));
1503 auto& commandManager = CommandManager::Get(project);
1504 commandManager.mLastTool = Name;
1505 commandManager.mLastToolRegistration =
1507 }
1508
1509}
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
Abstract base class used in importing a file.
TranslatableString GetName(const PluginID &ID) const
static PluginManager & Get()
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, PluginManager::Get(), CommandManager::Get(), UndoManager::Get(), PluginManager::GetName(), 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 1452 of file BatchProcessDialog.cpp.

1453{
1454 auto &project = context.project;
1455 CommandManager::Get(project).RegisterLastTool(context); //Register Palette as Last Tool
1456 auto macrosWindow = &GetAttachedWindows(project)
1457 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
1458 if (macrosWindow) {
1459 macrosWindow->Show();
1460 macrosWindow->Raise();
1461 macrosWindow->UpdateDisplay( false );
1462 }
1463}
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 1439 of file BatchProcessDialog.cpp.

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

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 1417 of file BatchProcessDialog.cpp.

1418{
1419 auto& commandManager = CommandManager::Get(context.project);
1420 switch (commandManager.mLastToolRegistration) {
1422 {
1423 auto lastEffect = commandManager.mLastTool;
1424 if (!lastEffect.empty())
1426 lastEffect, context.project, commandManager.mRepeatToolFlags);
1427 }
1428 break;
1431 commandManager.mLastToolRegisteredId);
1432 break;
1434 OnApplyMacroDirectlyByName(context, commandManager.mLastTool);
1435 break;
1436 }
1437}
void DoRepeatProcess(const CommandContext &context, int)
bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags)
Definition: DoEffect.cpp:30

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 1511 of file BatchProcessDialog.cpp.

1512{
1513 using namespace MenuRegistry;
1514 auto names = MacroCommands::GetNames(); // these names come from filenames
1515 for (const auto &name : names) {
1518 Verbatim(name), // file name verbatim
1520 flags,
1522 ));
1523 }
1524}
wxString name
Definition: TagsEditor.cpp:166
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 1403 of file BatchProcessDialog.cpp.

Referenced by OnApplyMacrosPalette(), and OnManageMacros().