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

Function OnApplyMacroDirectlyByName

src/BatchProcessDialog.cpp:1471–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1469}
1470
1471void OnApplyMacroDirectlyByName(const CommandContext& context, const MacroID& Name)
1472
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 */
1492 CommandManager::Get(project).ModifyUndoMenuItems();
1493
1494 TranslatableString desc;
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 =
1506 CommandManager::repeattypeapplymacro;
1507 }
1508
1509}
1510
1511void PopulateMacrosMenu(MenuRegistry::MenuItems &items, CommandFlag flags)
1512{

Callers 2

OnRepeatLastToolFunction · 0.85
OnApplyMacroDirectlyFunction · 0.85

Calls 9

GetFunction · 0.85
ApplyMacroToProjectMethod · 0.80
ModifyUndoMenuItemsMethod · 0.80
GetCurrentStateMethod · 0.80
GetShortDescriptionMethod · 0.80
lengthMethod · 0.45
GetNameMethod · 0.45
UndoAvailableMethod · 0.45
ModifyMethod · 0.45

Tested by

no test coverage detected