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

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)
 
MenuTable::BaseItemPtrs PopulateMacrosMenu (CommandFlag flags)
 
const ReservedCommandFlagHasLastToolFlag ()
 

Variables

AttachedWindows::RegisteredFactory sMacrosWindowKey
 

Function Documentation

◆ HasLastToolFlag()

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

Definition at line 1520 of file BatchProcessDialog.cpp.

1520 { static ReservedCommandFlag flag{
1521 [](const AudacityProject &project) {
1522 auto& menuManager = MenuManager::Get(project);
1523 if (menuManager.mLastToolRegistration == MenuCreator::repeattypeunique) return true;
1524 return !menuManager.mLastTool.empty();
1525 }
1526 }; return flag;
1527}
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
@ repeattypeunique
Definition: Menus.h:62
static MenuManager & Get(AudacityProject &project)
Definition: Menus.cpp:69

References flag, MenuManager::Get(), and MenuCreator::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 1453 of file BatchProcessDialog.cpp.

1454{
1455 const MacroID& Name = context.parameter.GET();
1456 OnApplyMacroDirectlyByName(context, Name);
1457}
wxString MacroID
Definition: Menus.h:32
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 1459 of file BatchProcessDialog.cpp.

1461{
1462 auto &project = context.project;
1463 auto &window = ProjectWindow::Get( project );
1464 //wxLogDebug( "Macro was: %s", context.parameter);
1465 ApplyMacroDialog dlg( &window, project );
1466 //const auto &Name = context.parameter;
1467
1468// We used numbers previously, but macros could get renumbered, making
1469// macros containing macros unpredictable.
1470#ifdef MACROS_BY_NUMBERS
1471 long item=0;
1472 // Take last three letters (of e.g. Macro007) and convert to a number.
1473 Name.Mid( Name.length() - 3 ).ToLong( &item, 10 );
1474 dlg.ApplyMacroToProject( item, false );
1475#else
1476 dlg.ApplyMacroToProject( Name, false );
1477#endif
1478 /* i18n-hint: %s will be the name of the macro which will be
1479 * repeated if this menu item is chosen */
1481
1484 auto shortDesc = em.GetCommandName(Name);
1485 auto& undoManager = UndoManager::Get(project);
1486 auto& commandManager = CommandManager::Get(project);
1487 int cur = undoManager.GetCurrentState();
1488 if (undoManager.UndoAvailable()) {
1489 undoManager.GetShortDescription(cur, &desc);
1490 commandManager.Modify(wxT("RepeatLastTool"), XXO("&Repeat %s")
1491 .Format(desc));
1492 auto& menuManager = MenuManager::Get(project);
1493 menuManager.mLastTool = Name;
1494 menuManager.mLastToolRegistration = MenuCreator::repeattypeapplymacro;
1495 }
1496
1497}
wxT("CloseDown"))
const TranslatableString desc
Definition: ExportPCM.cpp:55
XXO("&Cut/Copy/Paste Toolbar")
Shows progress in executing commands in MacroCommands.
AudacityProject & project
static CommandManager & Get(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.
@ repeattypeapplymacro
Definition: Menus.h:63
static void ModifyUndoMenuItems(AudacityProject &project)
Definition: Menus.cpp:455
static ProjectWindow & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71

References ApplyMacroDialog::ApplyMacroToProject(), desc, EffectManager::Get(), UndoManager::Get(), CommandManager::Get(), MenuManager::Get(), ProjectWindow::Get(), EffectManager::GetCommandName(), MenuManager::ModifyUndoMenuItems(), CommandContext::project, MenuCreator::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 1440 of file BatchProcessDialog.cpp.

1441{
1442 auto &project = context.project;
1443 CommandManager::Get(project).RegisterLastTool(context); //Register Palette 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( false );
1450 }
1451}
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, 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 1427 of file BatchProcessDialog.cpp.

1428{
1429 auto &project = context.project;
1430 CommandManager::Get(project).RegisterLastTool(context); //Register Macros as Last Tool
1431 auto macrosWindow = &GetAttachedWindows(project)
1432 .AttachedWindows::Get< MacrosWindow >( sMacrosWindowKey );
1433 if (macrosWindow) {
1434 macrosWindow->Show();
1435 macrosWindow->Raise();
1436 macrosWindow->UpdateDisplay( true );
1437 }
1438}

References CommandManager::Get(), GetAttachedWindows(), CommandContext::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 1403 of file BatchProcessDialog.cpp.

1404{
1405 auto& menuManager = MenuManager::Get(context.project);
1406 switch (menuManager.mLastToolRegistration) {
1408 {
1409 auto lastEffect = menuManager.mLastTool;
1410 if (!lastEffect.empty())
1411 {
1413 lastEffect, context, menuManager.mRepeatToolFlags);
1414 }
1415 }
1416 break;
1419 menuManager.mLastToolRegisteredId);
1420 break;
1422 OnApplyMacroDirectlyByName(context, menuManager.mLastTool);
1423 break;
1424 }
1425}
void DoRepeatProcess(const CommandContext &context, int)
@ repeattypeplugin
Definition: Menus.h:61
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1143

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

Referenced by PluginMenuItems().

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

◆ PopulateMacrosMenu()

MenuTable::BaseItemPtrs anonymous_namespace{BatchProcessDialog.cpp}::PopulateMacrosMenu ( CommandFlag  flags)

Definition at line 1499 of file BatchProcessDialog.cpp.

1500{
1502 auto names = MacroCommands::GetNames(); // these names come from filenames
1503 int i;
1504
1505 // This finder scope may be redundant, but harmless
1506 for (i = 0; i < (int)names.size(); i++) {
1508 result.push_back( MenuTable::Command( MacroID,
1509 Verbatim( names[i] ), // file name verbatim
1511 flags,
1513 ) );
1514 }
1515
1516 return result;
1517}
static TranslatableStrings names
Definition: TagsEditor.cpp:152
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
std::vector< BaseItemPtr > BaseItemPtrs
Definition: Registry.h:75
void OnApplyMacroDirectly(const CommandContext &context)
Options && AllowInMacros(int value=1) &&

References CommandManager::Options::AllowInMacros(), MenuTable::Command, MacroCommands::GetNames(), ApplyMacroDialog::MacroIdOfName(), names, OnApplyMacroDirectly(), 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 = ProjectWindow::Get( parent );
&window, parent, true
);
}
}
#define safenew
Definition: MemoryX.h:10

Definition at line 1391 of file BatchProcessDialog.cpp.

Referenced by OnApplyMacrosPalette(), and OnManageMacros().