Audacity 3.2.0
Classes | Typedefs | Enumerations | Functions | Variables
anonymous_namespace{PluginMenus.cpp} Namespace Reference

Classes

struct  EffectsMenuGroupsHandler
 
struct  MenuSectionBuilder
 

Typedefs

using EffectsMenuGroups = std::vector< std::pair< TranslatableString, std::vector< TranslatableString > > >
 

Enumerations

enum class  GroupBy { Publisher , Type }
 
enum class  SortBy { Name , PublisherName , TypeName }
 

Functions

EffectsMenuGroups LoadEffectsMenuGroups (const wxString &path)
 
CommandFlag FixBatchFlags (CommandFlag batchflags, const PluginDescriptor *plug)
 
bool IsEnabledPlugin (const PluginDescriptor *plug)
 
bool IsDefaultPlugin (const PluginDescriptor *plug)
 
bool IsBundledPlugin (const PluginDescriptor *plug)
 
auto MakeGroupsFilter (const EffectsMenuGroups &list) -> auto
 
void AddEffectMenuItemGroup (MenuTable::BaseItemPtrs &table, const TranslatableStrings &names, const PluginIDs &plugs, const std::vector< CommandFlag > &flags, bool useSubgroups)
 
void AddGroupedEffectMenuItems (MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, CommandFlag realflags, GroupBy groupBy, bool useSubgroups)
 
void AddSortedEffectMenuItems (MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, CommandFlag realflags, SortBy sortBy, bool useSubgroups)
 
auto MakeAddGroupItems (const EffectsMenuGroups &list, CommandFlag batchflags, CommandFlag realflags) -> auto
 
bool ShowManager (PluginManager &pm, wxWindow *parent)
 
void DoManagePluginsMenu (AudacityProject &project)
 
void DoManageRealtimeEffectsSidePanel (AudacityProject &project)
 
bool CompareEffectsByName (const PluginDescriptor *a, const PluginDescriptor *b)
 
bool CompareEffectsByPublisher (const PluginDescriptor *a, const PluginDescriptor *b)
 
bool CompareEffectsByPublisherAndName (const PluginDescriptor *a, const PluginDescriptor *b)
 
bool CompareEffectsByTypeAndName (const PluginDescriptor *a, const PluginDescriptor *b)
 
bool CompareEffectsByType (const PluginDescriptor *a, const PluginDescriptor *b)
 
MenuTable::BaseItemPtrs PopulateEffectsMenu (EffectType type, CommandFlag batchflags, CommandFlag realflags)
 
MenuTable::BaseItemPtrs PopulateMacrosMenu (CommandFlag flags)
 
const ReservedCommandFlagHasLastGeneratorFlag ()
 
BaseItemSharedPtr GenerateMenu ()
 
static const ReservedCommandFlagIsRealtimeNotActiveFlag ()
 
const ReservedCommandFlagHasLastEffectFlag ()
 
static const ReservedCommandFlagHasTrackFocusFlag ()
 
BaseItemSharedPtr EffectMenu ()
 
const ReservedCommandFlagHasLastAnalyzerFlag ()
 
BaseItemSharedPtr AnalyzeMenu ()
 
const ReservedCommandFlagHasLastToolFlag ()
 
BaseItemSharedPtr ToolsMenu ()
 
BaseItemSharedPtr ExtraScriptablesIMenu ()
 
BaseItemSharedPtr ExtraScriptablesIIMenu ()
 

Variables

AttachedWindows::RegisteredFactory sMacrosWindowKey
 
AttachedItem sAttachment1
 
AttachedItem sAttachment2
 
AttachedItem sAttachment3
 
AttachedItem sAttachment4
 
AttachedItem sAttachment5
 
AttachedItem sAttachment6
 

Typedef Documentation

◆ EffectsMenuGroups

using anonymous_namespace{PluginMenus.cpp}::EffectsMenuGroups = typedef std::vector<std::pair<TranslatableString, std::vector<TranslatableString> >>

Definition at line 40 of file PluginMenus.cpp.

Enumeration Type Documentation

◆ GroupBy

enum class anonymous_namespace{PluginMenus.cpp}::GroupBy
strong
Enumerator
Publisher 
Type 

Definition at line 127 of file PluginMenus.cpp.

◆ SortBy

enum class anonymous_namespace{PluginMenus.cpp}::SortBy
strong

Function Documentation

◆ AddEffectMenuItemGroup()

void anonymous_namespace{PluginMenus.cpp}::AddEffectMenuItemGroup ( MenuTable::BaseItemPtrs table,
const TranslatableStrings names,
const PluginIDs plugs,
const std::vector< CommandFlag > &  flags,
bool  useSubgroups 
)

Definition at line 1049 of file PluginMenus.cpp.

1055{
1056 const int namesCnt = (int) names.size();
1057 int perGroup;
1058
1059#if defined(__WXGTK__)
1060 gPrefs->Read(wxT("/Effects/MaxPerGroup"), &perGroup, 15);
1061#else
1062 gPrefs->Read(wxT("/Effects/MaxPerGroup"), &perGroup, 0);
1063#endif
1064
1065 int groupCnt = namesCnt;
1066 for (int i = 0; i < namesCnt; i++)
1067 {
1068 // compare full translations not msgids!
1069 while (i + 1 < namesCnt && names[i].Translation() == names[i + 1].Translation())
1070 {
1071 i++;
1072 groupCnt--;
1073 }
1074 }
1075
1076 if (namesCnt > 0 && !useSubgroups)
1077 {
1078 perGroup = 0;
1079 }
1080
1081 int max = perGroup;
1082 int items = perGroup;
1083
1084 if (max > groupCnt)
1085 {
1086 max = 0;
1087 }
1088
1089 using namespace MenuTable;
1090 // This finder scope may be redundant, but harmless
1092 auto pTable = &table;
1093 BaseItemPtrs temp1;
1094
1095 int groupNdx = 0;
1096 for (int i = 0; i < namesCnt; i++)
1097 {
1098 if (max > 0 && items == max)
1099 {
1100 // start collecting items for the next submenu
1101 pTable = &temp1;
1102 }
1103
1104 // compare full translations not msgids!
1105 if (i + 1 < namesCnt && names[i].Translation() == names[i + 1].Translation())
1106 {
1107 // collect a sub-menu for like-named items
1108 const auto name = names[i];
1109 const auto translation = name.Translation();
1110 BaseItemPtrs temp2;
1111 // compare full translations not msgids!
1112 while (i < namesCnt && names[i].Translation() == translation)
1113 {
1114 const PluginDescriptor *plug =
1115 PluginManager::Get().GetPlugin(plugs[i]);
1116 if( plug->GetPluginType() == PluginTypeEffect )
1117 temp2.push_back( Command( plug->GetID(),
1118 Verbatim( plug->GetPath() ),
1119 FN(OnEffect),
1120 flags[i],
1122 .IsEffect()
1123 .AllowInMacros()
1124 .Parameter( plugs[i] ) ) );
1125
1126 i++;
1127 }
1128 pTable->push_back( Menu( wxEmptyString, name, std::move( temp2 ) ) );
1129 i--;
1130 }
1131 else
1132 {
1133 // collect one item
1134 const PluginDescriptor *plug =
1135 PluginManager::Get().GetPlugin(plugs[i]);
1136 if( plug->GetPluginType() == PluginTypeEffect )
1137 pTable->push_back( Command(
1138 plug->GetID(),
1139 names[i],
1140 FN(OnEffect),
1141 flags[i],
1143 .IsEffect()
1144 .AllowInMacros()
1145 .Parameter( plugs[i] ) ) );
1146 }
1147
1148 if (max > 0)
1149 {
1150 items--;
1151 if (items == 0 || i + 1 == namesCnt)
1152 {
1153 int end = groupNdx + max;
1154 if (end + 1 > groupCnt)
1155 {
1156 end = groupCnt;
1157 }
1158 // Done collecting
1159 table.push_back( Menu( wxEmptyString,
1160 XXO("Plugin %d to %d").Format( groupNdx + 1, end ),
1161 std::move( temp1 )
1162 ) );
1163 items = max;
1164 pTable = &table;
1165 groupNdx += max;
1166 }
1167 }
1168 }
1169}
wxT("CloseDown"))
static TransactionScope::Factory::Scope scope
const TranslatableString name
Definition: Distortion.cpp:82
#define XXO(s)
Definition: Internat.h:44
@ PluginTypeEffect
static CommandHandlerObject & findCommandHandler(AudacityProject &)
#define FN(X)
FileConfig * gPrefs
Definition: Prefs.cpp:71
static TranslatableStrings names
Definition: TagsEditor.cpp:151
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
Abstract base class used in importing a file.
PluginType GetPluginType() const
const wxString & GetID() const
const PluginPath & GetPath() const
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
wxString Translation() const
std::unique_ptr< MenuItem > Menu(const Identifier &internalName, const TranslatableString &title, Args &&... args)
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159
std::vector< BaseItemPtr > BaseItemPtrs
Definition: Registry.h:73
Options && IsEffect(bool value=true) &&

References MenuTable::Command(), PackedArray::end(), findCommandHandler(), FN, PluginManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginManager::GetPlugin(), PluginDescriptor::GetPluginType(), gPrefs, CommandManager::Options::IsEffect(), MenuTable::Menu(), name, names, PluginTypeEffect, scope, TranslatableString::Translation(), Verbatim(), wxT(), and XXO.

Referenced by AddGroupedEffectMenuItems(), AddSortedEffectMenuItems(), and MakeAddGroupItems().

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

◆ AddGroupedEffectMenuItems()

void anonymous_namespace{PluginMenus.cpp}::AddGroupedEffectMenuItems ( MenuTable::BaseItemPtrs table,
std::vector< const PluginDescriptor * > &  plugs,
CommandFlag  batchflags,
CommandFlag  realflags,
GroupBy  groupBy,
bool  useSubgroups 
)

Definition at line 213 of file PluginMenus.cpp.

220{
222 TranslatableString current;
223
224 size_t pluginCnt = plugs.size();
225
226 TranslatableStrings groupNames;
227 PluginIDs groupPlugs;
228 std::vector<CommandFlag> groupFlags;
229
230 for (size_t i = 0; i < pluginCnt; i++)
231 {
232 const PluginDescriptor *plug = plugs[i];
233
234 auto name = plug->GetSymbol().Msgid();
235
236 if (plug->IsEffectInteractive())
237 name += XO("...");
238
239 if (groupBy == GroupBy::Publisher/*wxT("groupby:publisher")*/)
240 {
241 current = EffectManager::Get().GetVendorName(plug->GetID());
242 if (current.empty())
243 {
244 current = XO("Unknown");
245 }
246 }
247 else if (groupBy == GroupBy::Type /*wxT("groupby:type")*/)
248 {
249 current = EffectManager::Get().GetEffectFamilyName(plug->GetID());
250 if (current.empty())
251 {
252 current = XO("Unknown");
253 }
254 }
255
256 if (current != last)
257 {
258 using namespace MenuTable;
259 BaseItemPtrs temp;
260 bool bInSubmenu = !last.empty() && (groupNames.size() > 1);
261
263 groupNames,
264 groupPlugs, groupFlags, useSubgroups);
265
266 table.push_back( MenuOrItems( wxEmptyString,
267 ( bInSubmenu ? last : TranslatableString{} ), std::move( temp )
268 ) );
269
270 groupNames.clear();
271 groupPlugs.clear();
272 groupFlags.clear();
273 last = current;
274 }
275
276 groupNames.push_back( name );
277 groupPlugs.push_back(plug->GetID());
278 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
279 }
280
281 if (groupNames.size() > 0)
282 {
283 using namespace MenuTable;
284 BaseItemPtrs temp;
285 bool bInSubmenu = groupNames.size() > 1;
286
288 groupNames, groupPlugs, groupFlags, useSubgroups);
289
290 table.push_back( MenuOrItems( wxEmptyString,
291 ( bInSubmenu ? current : TranslatableString{} ), std::move( temp )
292 ) );
293 }
294}
#define XO(s)
Definition: Internat.h:31
wxArrayString PluginIDs
Definition: Menus.h:34
std::vector< TranslatableString > TranslatableStrings
const TranslatableString & Msgid() const
static EffectManager & Get()
TranslatableString GetVendorName(const PluginID &ID)
TranslatableString GetEffectFamilyName(const PluginID &ID)
const ComponentInterfaceSymbol & GetSymbol() const
bool IsEffectInteractive() const
Holds a msgid for the translation catalog; may also bind format arguments.
BaseItemPtr MenuOrItems(const Identifier &internalName, const TranslatableString &title, Args &&... args)
CommandFlag FixBatchFlags(CommandFlag batchflags, const PluginDescriptor *plug)
void AddEffectMenuItemGroup(MenuTable::BaseItemPtrs &table, const TranslatableStrings &names, const PluginIDs &plugs, const std::vector< CommandFlag > &flags, bool useSubgroups)

References AddEffectMenuItemGroup(), TranslatableString::empty(), FixBatchFlags(), EffectManager::Get(), EffectManager::GetEffectFamilyName(), PluginDescriptor::GetID(), PluginDescriptor::GetSymbol(), EffectManager::GetVendorName(), PluginDescriptor::IsEffectInteractive(), MenuTable::MenuOrItems(), ComponentInterfaceSymbol::Msgid(), name, and XO.

Referenced by PopulateEffectsMenu().

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

◆ AddSortedEffectMenuItems()

void anonymous_namespace{PluginMenus.cpp}::AddSortedEffectMenuItems ( MenuTable::BaseItemPtrs table,
std::vector< const PluginDescriptor * > &  plugs,
CommandFlag  batchflags,
CommandFlag  realflags,
SortBy  sortBy,
bool  useSubgroups 
)

Definition at line 296 of file PluginMenus.cpp.

303{
304 size_t pluginCnt = plugs.size();
305
306 TranslatableStrings groupNames;
307 PluginIDs groupPlugs;
308 std::vector<CommandFlag> groupFlags;
309
310 for (size_t i = 0; i < pluginCnt; i++)
311 {
312 const PluginDescriptor *plug = plugs[i];
313
314 auto name = plug->GetSymbol().Msgid();
315
316 if (plug->IsEffectInteractive())
317 name += XO("...");
318
319 TranslatableString group;
320 if (sortBy == SortBy::PublisherName/* wxT("sortby:publisher:name")*/)
321 {
322 group = EffectManager::Get().GetVendorName(plug->GetID());
323 }
324 else if (sortBy == SortBy::TypeName /*wxT("sortby:type:name")*/)
325 {
327 }
328
329 if (plug->IsEffectDefault())
330 {
331 group = {};
332 }
333
334 groupNames.push_back(
335 group.empty()
336 ? name
337 : XO("%s: %s").Format( group, name )
338 );
339
340 groupPlugs.push_back(plug->GetID());
341 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
342 }
343
344 if (groupNames.size() > 0)
345 {
347 table, groupNames, groupPlugs, groupFlags, useSubgroups);
348 }
349}
bool IsEffectDefault() const

References AddEffectMenuItemGroup(), TranslatableString::empty(), FixBatchFlags(), EffectManager::Get(), EffectManager::GetEffectFamilyName(), PluginDescriptor::GetID(), PluginDescriptor::GetSymbol(), EffectManager::GetVendorName(), PluginDescriptor::IsEffectDefault(), PluginDescriptor::IsEffectInteractive(), ComponentInterfaceSymbol::Msgid(), name, and XO.

Referenced by PopulateEffectsMenu().

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

◆ AnalyzeMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::AnalyzeMenu ( )

Definition at line 1350 of file PluginMenus.cpp.

1351{
1352 // All of this is a bit hacky until we can get more things connected into
1353 // the plugin manager...sorry! :-(
1354
1356
1357 static BaseItemSharedPtr menu{
1359 Menu( wxT("Analyze"), XXO("&Analyze"),
1360 Section( "Manage",
1361 Command( wxT("ManageAnalyzers"), XXO("Plugin Manager"),
1362 FN(OnManageAnalyzers), AudioIONotBusyFlag() )
1363 ),
1364
1365 Section("RepeatLast",
1366 // Delayed evaluation:
1367 [](AudacityProject &project)
1368 {
1369 const auto &lastAnalyzer = MenuManager::Get(project).mLastAnalyzer;
1370 TranslatableString buildMenuLabel;
1371 if (!lastAnalyzer.empty())
1372 buildMenuLabel = XO("Repeat %s")
1373 .Format(EffectManager::Get().GetCommandName(lastAnalyzer));
1374 else
1375 buildMenuLabel = XO("Repeat Last Analyzer");
1376
1377 return Command(wxT("RepeatLastAnalyzer"), buildMenuLabel,
1378 FN(OnRepeatLastAnalyzer),
1381 Options{}.IsGlobal(), findCommandHandler);
1382 }
1383 ),
1384
1385 Section( "Analyzers",
1386 Items( "Windows" ),
1387
1388 // Delayed evaluation:
1389 [](AudacityProject&)
1390 { return Items( wxEmptyString, PopulateEffectsMenu(
1394 ); }
1395 )
1396 ) ) };
1397 return menu;
1398}
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & TimeSelectedFlag()
const ReservedCommandFlag & WaveTracksSelectedFlag()
@ EffectTypeAnalyze
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
PluginID mLastAnalyzer
Definition: Menus.h:54
static MenuManager & Get(AudacityProject &project)
Definition: Menus.cpp:71
std::unique_ptr< MenuPart > Section(const Identifier &internalName, Args &&... args)
std::unique_ptr< MenuItems > Items(const Identifier &internalName, Args &&... args)
std::shared_ptr< BaseItem > BaseItemSharedPtr
Definition: Registry.h:72
std::vector< CommandFlagOptions > & Options()
Definition: Menus.cpp:535
MenuTable::BaseItemPtrs PopulateEffectsMenu(EffectType type, CommandFlag batchflags, CommandFlag realflags)
const ReservedCommandFlag & HasLastAnalyzerFlag()
static const ReservedCommandFlag & IsRealtimeNotActiveFlag()

References AudioIONotBusyFlag(), MenuTable::Command(), EffectTypeAnalyze, findCommandHandler(), FN, EffectManager::Get(), MenuManager::Get(), HasLastAnalyzerFlag(), IsRealtimeNotActiveFlag(), MenuTable::Items(), MenuTable::Menu(), MenuCreator::mLastAnalyzer, anonymous_namespace{Menus.cpp}::Options(), PopulateEffectsMenu(), MenuTable::Section(), TimeSelectedFlag(), WaveTracksSelectedFlag(), wxT(), XO, and XXO.

Here is the call graph for this function:

◆ CompareEffectsByName()

bool anonymous_namespace{PluginMenus.cpp}::CompareEffectsByName ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 443 of file PluginMenus.cpp.

444{
445 return
446 std::make_pair( a->GetSymbol().Translation(), a->GetPath() ) <
447 std::make_pair( b->GetSymbol().Translation(), b->GetPath() );
448}
const wxString Translation() const

References PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), and ComponentInterfaceSymbol::Translation().

Referenced by PopulateEffectsMenu().

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

◆ CompareEffectsByPublisher()

bool anonymous_namespace{PluginMenus.cpp}::CompareEffectsByPublisher ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 450 of file PluginMenus.cpp.

452{
453 auto &em = EffectManager::Get();
454
455 auto akey = em.GetVendorName(a->GetID());
456 auto bkey = em.GetVendorName(b->GetID());
457
458 if (akey.empty())
459 akey = XO("Uncategorized");
460 if (bkey.empty())
461 bkey = XO("Uncategorized");
462
463 return
464 std::make_tuple(
465 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
466 std::make_tuple(
467 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
468}

References EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), ComponentInterfaceSymbol::Translation(), and XO.

Referenced by PopulateEffectsMenu().

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

◆ CompareEffectsByPublisherAndName()

bool anonymous_namespace{PluginMenus.cpp}::CompareEffectsByPublisherAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 470 of file PluginMenus.cpp.

472{
473 auto &em = EffectManager::Get();
474 auto akey = em.GetVendorName(a->GetID());
475 auto bkey = em.GetVendorName(b->GetID());
476
477 if (a->IsEffectDefault())
478 akey = {};
479 if (b->IsEffectDefault())
480 bkey = {};
481
482 return
483 std::make_tuple(
484 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
485 std::make_tuple(
486 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
487}

References EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), PluginDescriptor::IsEffectDefault(), and ComponentInterfaceSymbol::Translation().

Referenced by PopulateEffectsMenu().

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

◆ CompareEffectsByType()

bool anonymous_namespace{PluginMenus.cpp}::CompareEffectsByType ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 513 of file PluginMenus.cpp.

514{
515 auto &em = EffectManager::Get();
516 auto akey = em.GetEffectFamilyName(a->GetID());
517 auto bkey = em.GetEffectFamilyName(b->GetID());
518
519 if (akey.empty())
520 akey = XO("Uncategorized");
521 if (bkey.empty())
522 bkey = XO("Uncategorized");
523
524 return
525 std::make_tuple(
526 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
527 std::make_tuple(
528 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
529}

References EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), ComponentInterfaceSymbol::Translation(), and XO.

Referenced by PopulateEffectsMenu().

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

◆ CompareEffectsByTypeAndName()

bool anonymous_namespace{PluginMenus.cpp}::CompareEffectsByTypeAndName ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 489 of file PluginMenus.cpp.

491{
492 auto &em = EffectManager::Get();
493 auto akey = em.GetEffectFamilyName(a->GetID());
494 auto bkey = em.GetEffectFamilyName(b->GetID());
495
496 if (akey.empty())
497 akey = XO("Uncategorized");
498 if (bkey.empty())
499 bkey = XO("Uncategorized");
500
501 if (a->IsEffectDefault())
502 akey = {};
503 if (b->IsEffectDefault())
504 bkey = {};
505
506 return
507 std::make_tuple(
508 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
509 std::make_tuple(
510 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
511}

References EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginDescriptor::GetSymbol(), PluginDescriptor::IsEffectDefault(), ComponentInterfaceSymbol::Translation(), and XO.

Here is the call graph for this function:

◆ DoManagePluginsMenu()

void anonymous_namespace{PluginMenus.cpp}::DoManagePluginsMenu ( AudacityProject project)

Definition at line 424 of file PluginMenus.cpp.

425{
426 auto &window = GetProjectFrame( project );
427 auto &pm = PluginManager::Get();
428 if (ShowManager(pm, &window))
430}
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 ...
static void RebuildAllMenuBars()
Definition: Menus.cpp:687
bool ShowManager(PluginManager &pm, wxWindow *parent)

References PluginManager::Get(), GetProjectFrame(), MenuCreator::RebuildAllMenuBars(), and ShowManager().

Referenced by PluginActions::Handler::OnManageAnalyzers(), PluginActions::Handler::OnManageEffects(), PluginActions::Handler::OnManageGenerators(), and PluginActions::Handler::OnManageTools().

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

◆ DoManageRealtimeEffectsSidePanel()

void anonymous_namespace{PluginMenus.cpp}::DoManageRealtimeEffectsSidePanel ( AudacityProject project)

Definition at line 432 of file PluginMenus.cpp.

433{
434 auto &trackFocus = TrackFocus::Get(project);
435 auto &projectWindow = ProjectWindow::Get(project);
436
437 if (projectWindow.IsEffectsPanelShown())
438 projectWindow.HideEffectsPanel();
439 else
440 projectWindow.ShowEffectsPanel(trackFocus.Get(), true);
441}
static ProjectWindow & Get(AudacityProject &project)
Track * Get()

References TrackFocus::Get(), and ProjectWindow::Get().

Referenced by PluginActions::Handler::OnAddRealtimeEffects().

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

◆ EffectMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::EffectMenu ( )

Definition at line 1285 of file PluginMenus.cpp.

1286{
1287 // All of this is a bit hacky until we can get more things connected into
1288 // the plugin manager...sorry! :-(
1289
1290 static BaseItemSharedPtr menu{
1292 Menu( wxT("Effect"), XXO("Effe&ct"),
1293 Section( "Manage",
1294 Command( wxT("ManageEffects"), XXO("Plugin Manager"),
1295 FN(OnManageEffects), AudioIONotBusyFlag() )
1296 ),
1297
1298 Section( "RealtimeEffects",
1299 Command ( wxT("AddRealtimeEffects"), XXO("Add Realtime Effects"),
1300 FN(OnAddRealtimeEffects), HasTrackFocusFlag(), wxT("E") )
1301 ),
1302
1303 Section( "RepeatLast",
1304 // Delayed evaluation:
1305 [](AudacityProject &project)
1306 {
1307 const auto &lastEffect = MenuManager::Get(project).mLastEffect;
1308 TranslatableString buildMenuLabel;
1309 if (!lastEffect.empty())
1310 buildMenuLabel = XO("Repeat %s")
1311 .Format( EffectManager::Get().GetCommandName(lastEffect) );
1312 else
1313 buildMenuLabel = XO("Repeat Last Effect");
1314
1315 return Command( wxT("RepeatLastEffect"), buildMenuLabel,
1316 FN(OnRepeatLastEffect),
1319 wxT("Ctrl+R"), findCommandHandler );
1320 }
1321 ),
1322
1323 Section( "Effects",
1324 // Delayed evaluation:
1325 [](AudacityProject &)
1326 { return Items( wxEmptyString, PopulateEffectsMenu(
1330 ); }
1331 )
1332 ) ) };
1333 return menu;
1334}
@ EffectTypeProcess
PluginID mLastEffect
Definition: Menus.h:53
const ReservedCommandFlag & HasLastEffectFlag()
static const ReservedCommandFlag & HasTrackFocusFlag()

References AudioIONotBusyFlag(), MenuTable::Command(), EffectTypeProcess, findCommandHandler(), FN, EffectManager::Get(), MenuManager::Get(), HasLastEffectFlag(), HasTrackFocusFlag(), IsRealtimeNotActiveFlag(), MenuTable::Items(), MenuTable::Menu(), MenuCreator::mLastEffect, PopulateEffectsMenu(), MenuTable::Section(), TimeSelectedFlag(), WaveTracksSelectedFlag(), wxT(), XO, and XXO.

Here is the call graph for this function:

◆ ExtraScriptablesIIMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::ExtraScriptablesIIMenu ( )

Definition at line 1591 of file PluginMenus.cpp.

1592{
1593 // Less useful to VI users.
1594 static BaseItemSharedPtr menu{
1596 // i18n-hint: Scriptables are commands normally used from Python, Perl etc.
1597 Menu( wxT("Scriptables2"), XXO("Scripta&bles II"),
1598 Command( wxT("Select"), XXO("Select..."), FN(OnAudacityCommand),
1600 Command( wxT("SetTrack"), XXO("Set Track..."), FN(OnAudacityCommand),
1602 Command( wxT("GetInfo"), XXO("Get Info..."), FN(OnAudacityCommand),
1604 Command( wxT("Message"), XXO("Message..."), FN(OnAudacityCommand),
1606 Command( wxT("Help"), XXO("Help..."), FN(OnAudacityCommand),
1608 Command( wxT("Import2"), XXO("Import..."), FN(OnAudacityCommand),
1610 Command( wxT("Export2"), XXO("Export..."), FN(OnAudacityCommand),
1612 Command( wxT("OpenProject2"), XXO("Open Project..."),
1613 FN(OnAudacityCommand),
1615 Command( wxT("SaveProject2"), XXO("Save Project..."),
1616 FN(OnAudacityCommand),
1618 Command( wxT("Drag"), XXO("Move Mouse..."), FN(OnAudacityCommand),
1620 Command( wxT("CompareAudio"), XXO("Compare Audio..."),
1621 FN(OnAudacityCommand),
1623 // i18n-hint: Screenshot in the help menu has a much bigger dialog.
1624 Command( wxT("Screenshot"), XXO("Screenshot (short format)..."),
1625 FN(OnAudacityCommand),
1627 ) ) };
1628 return menu;
1629}

References AudioIONotBusyFlag(), MenuTable::Command(), findCommandHandler(), FN, MenuTable::Menu(), wxT(), and XXO.

Here is the call graph for this function:

◆ ExtraScriptablesIMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::ExtraScriptablesIMenu ( )

Definition at line 1539 of file PluginMenus.cpp.

1540{
1541 // These are the more useful to VI user Scriptables.
1542 static BaseItemSharedPtr menu{
1544 // i18n-hint: Scriptables are commands normally used from Python, Perl etc.
1545 Menu( wxT("Scriptables1"), XXO("Script&ables I"),
1546 // Note that the PLUGIN_SYMBOL must have a space between words,
1547 // whereas the short-form used here must not.
1548 // (So if you did write "CompareAudio" for the PLUGIN_SYMBOL name, then
1549 // you would have to use "Compareaudio" here.)
1550 Command( wxT("SelectTime"), XXO("Select Time..."), FN(OnAudacityCommand),
1552 Command( wxT("SelectFrequencies"), XXO("Select Frequencies..."),
1553 FN(OnAudacityCommand),
1555 Command( wxT("SelectTracks"), XXO("Select Tracks..."),
1556 FN(OnAudacityCommand),
1558 Command( wxT("SetTrackStatus"), XXO("Set Track Status..."),
1559 FN(OnAudacityCommand),
1561 Command( wxT("SetTrackAudio"), XXO("Set Track Audio..."),
1562 FN(OnAudacityCommand),
1564 Command( wxT("SetTrackVisuals"), XXO("Set Track Visuals..."),
1565 FN(OnAudacityCommand),
1567 Command( wxT("GetPreference"), XXO("Get Preference..."),
1568 FN(OnAudacityCommand),
1570 Command( wxT("SetPreference"), XXO("Set Preference..."),
1571 FN(OnAudacityCommand),
1573 Command( wxT("SetClip"), XXO("Set Clip..."), FN(OnAudacityCommand),
1575 Command( wxT("SetEnvelope"), XXO("Set Envelope..."),
1576 FN(OnAudacityCommand),
1578 Command( wxT("SetLabel"), XXO("Set Label..."), FN(OnAudacityCommand),
1580 Command( wxT("SetProject"), XXO("Set Project..."), FN(OnAudacityCommand),
1582 ) ) };
1583 return menu;
1584}

References AudioIONotBusyFlag(), MenuTable::Command(), findCommandHandler(), FN, MenuTable::Menu(), wxT(), and XXO.

Here is the call graph for this function:

◆ FixBatchFlags()

CommandFlag anonymous_namespace{PluginMenus.cpp}::FixBatchFlags ( CommandFlag  batchflags,
const PluginDescriptor plug 
)

Definition at line 142 of file PluginMenus.cpp.

143{
144 if ( plug->GetSymbol().Msgid() == XO( "Noise Reduction" ) )
145 return ( batchflags | NoiseReductionTimeSelectedFlag() ) & ~TimeSelectedFlag();
146 return batchflags;
147}
const ReservedCommandFlag & NoiseReductionTimeSelectedFlag()

References PluginDescriptor::GetSymbol(), ComponentInterfaceSymbol::Msgid(), NoiseReductionTimeSelectedFlag(), and XO.

Referenced by AddGroupedEffectMenuItems(), AddSortedEffectMenuItems(), and MakeAddGroupItems().

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

◆ GenerateMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::GenerateMenu ( )

Definition at line 1207 of file PluginMenus.cpp.

1208{
1209 // All of this is a bit hacky until we can get more things connected into
1210 // the plugin manager...sorry! :-(
1211
1213
1214 static BaseItemSharedPtr menu{
1216 Menu( wxT("Generate"), XXO("&Generate"),
1217 Section( "Manage",
1218 Command( wxT("ManageGenerators"), XXO("Plugin Manager"),
1219 FN(OnManageGenerators), AudioIONotBusyFlag() )
1220 ),
1221
1222 Section("RepeatLast",
1223 // Delayed evaluation:
1224 [](AudacityProject &project)
1225 {
1226 const auto &lastGenerator = MenuManager::Get(project).mLastGenerator;
1227 TranslatableString buildMenuLabel;
1228 if (!lastGenerator.empty())
1229 buildMenuLabel = XO("Repeat %s")
1230 .Format(EffectManager::Get().GetCommandName(lastGenerator));
1231 else
1232 buildMenuLabel = XO("Repeat Last Generator");
1233
1234 return Command(wxT("RepeatLastGenerator"), buildMenuLabel,
1235 FN(OnRepeatLastGenerator),
1238 Options{}.IsGlobal(), findCommandHandler);
1239 }
1240 ),
1241
1242 Section( "Generators",
1243 // Delayed evaluation:
1244 [](AudacityProject &)
1245 { return Items( wxEmptyString, PopulateEffectsMenu(
1249 ); }
1250 )
1251 ) ) };
1252 return menu;
1253}
@ EffectTypeGenerate
PluginID mLastGenerator
Definition: Menus.h:52
const ReservedCommandFlag & HasLastGeneratorFlag()

References AudioIONotBusyFlag(), MenuTable::Command(), EffectTypeGenerate, findCommandHandler(), FN, EffectManager::Get(), MenuManager::Get(), HasLastGeneratorFlag(), MenuTable::Items(), MenuTable::Menu(), MenuCreator::mLastGenerator, anonymous_namespace{Menus.cpp}::Options(), PopulateEffectsMenu(), MenuTable::Section(), wxT(), XO, and XXO.

Here is the call graph for this function:

◆ HasLastAnalyzerFlag()

const ReservedCommandFlag & anonymous_namespace{PluginMenus.cpp}::HasLastAnalyzerFlag ( )

Definition at line 1342 of file PluginMenus.cpp.

1342 { static ReservedCommandFlag flag{
1343 [](const AudacityProject &project) {
1345 return !MenuManager::Get(project).mLastAnalyzer.empty();
1346 }
1347 }; return flag;
1348}
static std::once_flag flag
int mLastAnalyzerRegistration
Definition: Menus.h:55
@ repeattypeunique
Definition: Menus.h:63

References flag, MenuManager::Get(), MenuCreator::mLastAnalyzer, MenuCreator::mLastAnalyzerRegistration, and MenuCreator::repeattypeunique.

Referenced by AnalyzeMenu().

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

◆ HasLastEffectFlag()

const ReservedCommandFlag & anonymous_namespace{PluginMenus.cpp}::HasLastEffectFlag ( )

Definition at line 1268 of file PluginMenus.cpp.

1268 { static ReservedCommandFlag flag{
1269 [](const AudacityProject &project) {
1270 return !MenuManager::Get(project).mLastEffect.empty();
1271 }
1272 }; return flag;
1273}

References flag, MenuManager::Get(), and MenuCreator::mLastEffect.

Referenced by EffectMenu().

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

◆ HasLastGeneratorFlag()

const ReservedCommandFlag & anonymous_namespace{PluginMenus.cpp}::HasLastGeneratorFlag ( )

Definition at line 1201 of file PluginMenus.cpp.

1201 { static ReservedCommandFlag flag{
1202 [](const AudacityProject &project){
1203 return !MenuManager::Get( project ).mLastGenerator.empty();
1204 }
1205 }; return flag; }

References flag, MenuManager::Get(), and MenuCreator::mLastGenerator.

Referenced by GenerateMenu().

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

◆ HasLastToolFlag()

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

Definition at line 1406 of file PluginMenus.cpp.

1406 { static ReservedCommandFlag flag{
1407 [](const AudacityProject &project) {
1408 auto& menuManager = MenuManager::Get(project);
1409 if (menuManager.mLastToolRegistration == MenuCreator::repeattypeunique) return true;
1410 return !menuManager.mLastTool.empty();
1411 }
1412 }; return flag;
1413}

References flag, MenuManager::Get(), and MenuCreator::repeattypeunique.

Referenced by ToolsMenu().

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

◆ HasTrackFocusFlag()

static const ReservedCommandFlag & anonymous_namespace{PluginMenus.cpp}::HasTrackFocusFlag ( )
static

Definition at line 1276 of file PluginMenus.cpp.

1276 { static ReservedCommandFlag flag{
1277 [](const AudacityProject &project) {
1278 auto& trackFocus = TrackFocus::Get(const_cast<AudacityProject&>(project));
1279 return (trackFocus.Get() != nullptr);
1280 }
1281 };
1282 return flag;
1283}

References flag, and TrackFocus::Get().

Referenced by EffectMenu().

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

◆ IsBundledPlugin()

bool anonymous_namespace{PluginMenus.cpp}::IsBundledPlugin ( const PluginDescriptor plug)

Definition at line 175 of file PluginMenus.cpp.

176{
177 if(IsDefaultPlugin(plug))
178 return true;
179 auto applicationResourcePath = wxFileName(FileNames::ResourcesDir());
180 auto pluginPath = wxFileName(plug->GetPath());
181 pluginPath.MakeAbsolute();
182 return pluginPath.GetPath().StartsWith(applicationResourcePath.GetPath());
183}
FILES_API FilePath ResourcesDir()
bool IsDefaultPlugin(const PluginDescriptor *plug)

References PluginDescriptor::GetPath(), IsDefaultPlugin(), and FileNames::ResourcesDir().

Referenced by PopulateEffectsMenu().

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

◆ IsDefaultPlugin()

bool anonymous_namespace{PluginMenus.cpp}::IsDefaultPlugin ( const PluginDescriptor plug)

Definition at line 160 of file PluginMenus.cpp.

161{
162 if (plug->IsEffectDefault()
163#ifdef EXPERIMENTAL_DA
164 // Move Nyquist prompt into nyquist group.
165 && (plug->GetSymbol() !=
166 ComponentInterfaceSymbol("Nyquist Effects Prompt"))
167 && (plug->GetSymbol() != ComponentInterfaceSymbol("Nyquist Tools Prompt"))
169#endif
170 )
171 return true;
172 return false;
173}
#define NYQUIST_PROMPT_ID
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...

References PluginDescriptor::GetSymbol(), PluginDescriptor::IsEffectDefault(), and NYQUIST_PROMPT_ID.

Referenced by IsBundledPlugin(), and PopulateEffectsMenu().

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

◆ IsEnabledPlugin()

bool anonymous_namespace{PluginMenus.cpp}::IsEnabledPlugin ( const PluginDescriptor plug)

Definition at line 150 of file PluginMenus.cpp.

151{
152 if( PluginManager::Get().IsPluginLoaded(plug->GetID()) && EffectManager::Get().IsHidden(plug->GetID()) )
153 return false;
154 if ( !plug->IsEnabled() ){
155 return false;// don't add to menus!
156 }
157 return true;
158}
bool IsHidden(const PluginID &ID)
bool IsEnabled() const

References PluginManager::Get(), EffectManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::IsEnabled(), and EffectManager::IsHidden().

Referenced by MakeGroupsFilter(), and PopulateEffectsMenu().

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

◆ IsRealtimeNotActiveFlag()

static const ReservedCommandFlag & anonymous_namespace{PluginMenus.cpp}::IsRealtimeNotActiveFlag ( )
static

Definition at line 1256 of file PluginMenus.cpp.

1256 { static ReservedCommandFlag flag{
1257 [](const AudacityProject &project){
1258 return !RealtimeEffectManager::Get(project).IsActive();
1259 }
1260}; return flag; } //lll
static RealtimeEffectManager & Get(AudacityProject &project)
bool IsActive() const noexcept
To be called only from main thread.

References flag, RealtimeEffectManager::Get(), and RealtimeEffectManager::IsActive().

Referenced by AnalyzeMenu(), and EffectMenu().

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

◆ LoadEffectsMenuGroups()

EffectsMenuGroups anonymous_namespace{PluginMenus.cpp}::LoadEffectsMenuGroups ( const wxString &  path)

Definition at line 117 of file PluginMenus.cpp.

118{
119 EffectsMenuGroups result;
121
122 XMLFileReader reader;
123 reader.Parse(&handler, path);
124 return result;
125}
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:19
bool Parse(XMLTagHandler *baseHandler, const FilePath &fname)
std::vector< std::pair< TranslatableString, std::vector< TranslatableString > > > EffectsMenuGroups
Definition: PluginMenus.cpp:40

References cloud::audiocom::anonymous_namespace{AuthorizationHandler.cpp}::handler, and XMLFileReader::Parse().

Referenced by PopulateEffectsMenu().

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

◆ MakeAddGroupItems()

auto anonymous_namespace{PluginMenus.cpp}::MakeAddGroupItems ( const EffectsMenuGroups list,
CommandFlag  batchflags,
CommandFlag  realflags 
) -> auto

Definition at line 351 of file PluginMenus.cpp.

352{
353 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugs)
354 {
355 for(auto& p : list)
356 {
357 TranslatableStrings groupNames;
358 PluginIDs groupPlugs;
359 std::vector<CommandFlag> groupFlags;
360
361 auto srcNames = p.second;
362 std::sort(srcNames.begin(), srcNames.end(), TranslationLess);
363
364 for(auto& name : srcNames)
365 {
366 auto it = std::find_if(plugs.begin(), plugs.end(), [&name](const PluginDescriptor* other)
367 {
368 return name == other->GetSymbol().Msgid();
369 });
370 if(it == plugs.end())
371 continue;
372
373 auto plug = *it;
374 if(plug->IsEffectInteractive())
375 groupNames.push_back(name + XO("..."));
376 else
377 groupNames.push_back( name );
378
379 groupPlugs.push_back(plug->GetID());
380 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
381 }
382
383 if (!groupNames.empty())
384 {
385 using namespace MenuTable;
386 BaseItemPtrs temp;
387
389 groupNames, groupPlugs, groupFlags, false);
390
391 items.push_back( MenuOrItems( wxEmptyString,
392 p.first, std::move( temp )
393 ) );
394 }
395 }
396 };
397}
bool TranslationLess(const TranslatableString &a, const TranslatableString &b)
A commonly needed sort comparator, which depends on the language setting.

References AddEffectMenuItemGroup(), FixBatchFlags(), MenuTable::MenuOrItems(), name, TranslationLess(), and XO.

Referenced by PopulateEffectsMenu().

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

◆ MakeGroupsFilter()

auto anonymous_namespace{PluginMenus.cpp}::MakeGroupsFilter ( const EffectsMenuGroups list) -> auto

Definition at line 185 of file PluginMenus.cpp.

186{
187 return [=](const PluginDescriptor* plug)
188 {
189 if(!IsEnabledPlugin(plug))
190 return false;
191
192 for(auto& p : list)
193 {
194 for(auto& name : p.second)
195 {
196 if(name == plug->GetSymbol().Msgid())
197 return true;
198 }
199 }
200 return false;
201 };
202}
bool IsEnabledPlugin(const PluginDescriptor *plug)

References IsEnabledPlugin(), and name.

Referenced by PopulateEffectsMenu().

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

◆ PopulateEffectsMenu()

MenuTable::BaseItemPtrs anonymous_namespace{PluginMenus.cpp}::PopulateEffectsMenu ( EffectType  type,
CommandFlag  batchflags,
CommandFlag  realflags 
)

The effects come from a plug in list This code iterates through the list, adding effects into the menu.

Definition at line 534 of file PluginMenus.cpp.

538{
541
542 const auto groupby = EffectsGroupBy.Read();
543
544 std::vector<MenuSectionBuilder> sections;
545
546 auto MakeAddSortedItems = [=](SortBy sortby, bool useSubgroups)
547 {
548 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugins)
549 {
550 return AddSortedEffectMenuItems(items, plugins, batchflags, realflags, sortby, useSubgroups);
551 };
552 };
553
554 auto MakeAddGroupedItems = [=](GroupBy groupBy, bool useSubgroups)
555 {
556 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugins)
557 {
558 return AddGroupedEffectMenuItems(items, plugins, batchflags, realflags, groupBy, useSubgroups);
559 };
560 };
561
562 auto DefaultFilter = [](auto plug) { return IsEnabledPlugin(plug) && IsDefaultPlugin(plug); };
563 if(groupby == "default")
564 {
565 if(type == EffectTypeProcess)
566 {
567 static auto effectMenuDefaults = [] {
568 wxFileName path = wxFileName(FileNames::ResourcesDir(), wxT("EffectsMenuDefaults.xml"));
569 return LoadEffectsMenuGroups(path.GetFullPath());
570 }();
571 static auto groupsFilter = MakeGroupsFilter(effectMenuDefaults);
572
573 sections.emplace_back(
574 MenuSectionBuilder {
575 {},
576 [=](auto plug) { return IsEnabledPlugin(plug) && groupsFilter(plug); },
577 nullptr,
578 MakeAddGroupItems(effectMenuDefaults, batchflags, realflags)
579 });
580 sections.emplace_back(
581 MenuSectionBuilder {
582 {},
585 MakeAddGroupedItems(GroupBy::Publisher, false )
586 });
587 }
588 else//Generators/Analyzers
589 {
590 sections.emplace_back(
591 MenuSectionBuilder {
592 {},
593 [](auto plug){ return IsEnabledPlugin(plug) && IsBundledPlugin(plug); } ,
595 MakeAddSortedItems(SortBy::Name, false )
596 });
597 sections.emplace_back(
598 MenuSectionBuilder {
599 {},
602 MakeAddGroupedItems(GroupBy::Publisher, true )
603 });
604 }
605 }
606 else if(groupby == "sortby:publisher:name")
607 {
608 sections.emplace_back(
609 MenuSectionBuilder {
610 {},
611 DefaultFilter,
613 MakeAddSortedItems(SortBy::PublisherName, false)
614 });
615 sections.emplace_back(
616 MenuSectionBuilder {
617 {},
620 MakeAddSortedItems(SortBy::PublisherName, true )
621 });
622 }
623 else if(groupby == "sortby:type:name")
624 {
625 sections.emplace_back(
626 MenuSectionBuilder {
627 {},
628 DefaultFilter,
630 MakeAddSortedItems(SortBy::TypeName, false)
631 });
632 sections.emplace_back(
633 MenuSectionBuilder {
634 {},
637 MakeAddSortedItems(SortBy::TypeName, true )
638 });
639 }
640 else if(groupby == "groupby:publisher")
641 {
642 sections.emplace_back(
643 MenuSectionBuilder {
644 {},
645 DefaultFilter,
647 MakeAddGroupedItems(GroupBy::Publisher, false)
648 });
649 sections.emplace_back(
650 MenuSectionBuilder {
651 {},
654 MakeAddGroupedItems(GroupBy::Publisher, true )
655 });
656 }
657 else if(groupby == "groupby:type")
658 {
659 sections.emplace_back(
660 MenuSectionBuilder {
661 {},
662 DefaultFilter,
664 MakeAddGroupedItems(GroupBy::Type, false)
665 });
666 sections.emplace_back(
667 MenuSectionBuilder {
668 {},
671 MakeAddGroupedItems(GroupBy::Type, true )
672 });
673 }
674 else //if(groupby == "sortby:name")
675 {
676 sections.emplace_back(
677 MenuSectionBuilder {
678 {},
679 DefaultFilter,
681 MakeAddSortedItems(SortBy::Name, false)
682 });
683 sections.emplace_back(
684 MenuSectionBuilder {
685 {},
688 MakeAddSortedItems(SortBy::Name, true)
689 });
690 }
691 for(auto& plugin : pm.EffectsOfType(type))
692 {
693 for(auto& section : sections)
694 {
695 if(section.filter(&plugin))
696 {
697 section.plugins.push_back(&plugin);
698 break;
699 }
700 }
701 }
702
703 for(auto& section : sections)
704 {
705 if(section.compare != nullptr)
706 std::sort(section.plugins.begin(), section.plugins.end(), section.compare);
707
709 section.add(items, section.plugins);
710
711 if(items.empty())
712 continue;
713
714 if(result.empty())
715 result.push_back(MenuTable::Items( "", std::move( items ) ));
716 else
717 result.push_back(MenuTable::Section( "", std::move( items ) ));
718 }
719
720 return result;
721}
ChoiceSetting EffectsGroupBy
wxString Read() const
Definition: Prefs.cpp:354
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:42
Range EffectsOfType(EffectType type)
bool CompareEffectsByType(const PluginDescriptor *a, const PluginDescriptor *b)
bool CompareEffectsByName(const PluginDescriptor *a, const PluginDescriptor *b)
bool CompareEffectsByPublisherAndName(const PluginDescriptor *a, const PluginDescriptor *b)
EffectsMenuGroups LoadEffectsMenuGroups(const wxString &path)
void AddSortedEffectMenuItems(MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, CommandFlag realflags, SortBy sortBy, bool useSubgroups)
auto MakeGroupsFilter(const EffectsMenuGroups &list) -> auto
bool IsBundledPlugin(const PluginDescriptor *plug)
auto MakeAddGroupItems(const EffectsMenuGroups &list, CommandFlag batchflags, CommandFlag realflags) -> auto
bool CompareEffectsByPublisher(const PluginDescriptor *a, const PluginDescriptor *b)
void AddGroupedEffectMenuItems(MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, CommandFlag realflags, GroupBy groupBy, bool useSubgroups)

References AddGroupedEffectMenuItems(), AddSortedEffectMenuItems(), CompareEffectsByName(), CompareEffectsByPublisher(), CompareEffectsByPublisherAndName(), CompareEffectsByType(), EffectsGroupBy, PluginManager::EffectsOfType(), EffectTypeProcess, PluginManager::Get(), IsBundledPlugin(), IsDefaultPlugin(), IsEnabledPlugin(), MenuTable::Items(), LoadEffectsMenuGroups(), MakeAddGroupItems(), MakeGroupsFilter(), ChoiceSetting::Read(), FileNames::ResourcesDir(), MenuTable::Section(), and wxT().

Referenced by AnalyzeMenu(), EffectMenu(), GenerateMenu(), and ToolsMenu().

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

◆ PopulateMacrosMenu()

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

Definition at line 1171 of file PluginMenus.cpp.

1172{
1174 auto names = MacroCommands::GetNames(); // these names come from filenames
1175 int i;
1176
1177 // This finder scope may be redundant, but harmless
1179 for (i = 0; i < (int)names.size(); i++) {
1181 result.push_back( MenuTable::Command( MacroID,
1182 Verbatim( names[i] ), // file name verbatim
1183 FN(OnApplyMacroDirectly),
1184 flags,
1186 ) );
1187 }
1188
1189 return result;
1190}
wxString MacroID
Definition: Menus.h:33
static CommandID MacroIdOfName(const wxString &MacroName)
static wxArrayString GetNames()
Options && AllowInMacros(int value=1) &&

References CommandManager::Options::AllowInMacros(), MenuTable::Command(), findCommandHandler(), FN, MacroCommands::GetNames(), ApplyMacroDialog::MacroIdOfName(), names, scope, and Verbatim().

Referenced by ToolsMenu().

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

◆ ShowManager()

bool anonymous_namespace{PluginMenus.cpp}::ShowManager ( PluginManager pm,
wxWindow *  parent 
)

Definition at line 417 of file PluginMenus.cpp.

419{
420 PluginRegistrationDialog dlg(parent);
421 return dlg.ShowModal() == wxID_OK;
422}

Referenced by DoManagePluginsMenu().

Here is the caller graph for this function:

◆ ToolsMenu()

BaseItemSharedPtr anonymous_namespace{PluginMenus.cpp}::ToolsMenu ( )

Definition at line 1415 of file PluginMenus.cpp.

1416{
1418
1419 static BaseItemSharedPtr menu{
1421 Menu( wxT("Tools"), XXO("T&ools"),
1422 Section( "Manage",
1423 Command( wxT("ManageTools"), XXO("Plugin Manager"),
1424 FN(OnManageTools), AudioIONotBusyFlag() ),
1425
1426 //Separator(),
1427
1428 Section( "RepeatLast",
1429 // Delayed evaluation:
1430 [](AudacityProject &project)
1431 {
1432 const auto &lastTool = MenuManager::Get(project).mLastTool;
1433 TranslatableString buildMenuLabel;
1434 if (!lastTool.empty())
1435 buildMenuLabel = XO("Repeat %s")
1436 .Format( EffectManager::Get().GetCommandName(lastTool) );
1437 else
1438 buildMenuLabel = XO("Repeat Last Tool");
1439
1440 return Command( wxT("RepeatLastTool"), buildMenuLabel,
1441 FN(OnRepeatLastTool),
1444 Options{}.IsGlobal(), findCommandHandler );
1445 }
1446 ),
1447
1448 Command( wxT("ManageMacros"), XXO("&Macro Manager"),
1449 FN(OnManageMacros), AudioIONotBusyFlag() ),
1450
1451 Menu( wxT("Macros"), XXO("&Apply Macro"),
1452 // Palette has no access key to ensure first letter navigation of
1453 // sub menu
1454 Section( "",
1455 Command( wxT("ApplyMacrosPalette"), XXO("Palette..."),
1456 FN(OnApplyMacrosPalette), AudioIONotBusyFlag() )
1457 ),
1458
1459 Section( "",
1460 // Delayed evaluation:
1461 [](AudacityProject&)
1462 { return Items( wxEmptyString, PopulateMacrosMenu( AudioIONotBusyFlag() ) ); }
1463 )
1464 )
1465 ),
1466
1467 Section( "Other",
1468 Command( wxT("ConfigReset"), XXO("Reset &Configuration"),
1469 FN(OnResetConfig),
1471
1472 Command( wxT("FancyScreenshot"), XXO("&Screenshot..."),
1473 FN(OnScreenshot), AudioIONotBusyFlag() ),
1474
1475 // PRL: team consensus for 2.2.0 was, we let end users have this diagnostic,
1476 // as they used to in 1.3.x
1477 //#ifdef IS_ALPHA
1478 // TODO: What should we do here? Make benchmark a plug-in?
1479 // Easy enough to do. We'd call it mod-self-test.
1480 Command( wxT("Benchmark"), XXO("&Run Benchmark..."),
1481 FN(OnBenchmark), AudioIONotBusyFlag() )
1482 //#endif
1483 ),
1484
1485 Section( "Tools",
1486 // Delayed evaluation:
1487 [](AudacityProject&)
1488 { return Items( wxEmptyString, PopulateEffectsMenu(
1492 ); }
1493 )
1494
1495#ifdef IS_ALPHA
1496 ,
1497 Section( "",
1498 Command( wxT("SimulateRecordingErrors"),
1499 XXO("Simulate Recording Errors"),
1500 FN(OnSimulateRecordingErrors),
1502 Options{}.CheckTest(
1503 [](AudacityProject&){
1504 return AudioIO::Get()->mSimulateRecordingErrors; } ) ),
1505 Command( wxT("DetectUpstreamDropouts"),
1506 XXO("Detect Upstream Dropouts"),
1507 FN(OnDetectUpstreamDropouts),
1509 Options{}.CheckTest(
1510 [](AudacityProject&){
1512 .load(std::memory_order_relaxed); } ) )
1513 )
1514#endif
1515
1516#if defined(IS_ALPHA) || defined(END_USER_JOURNALLING)
1517 ,
1518 Section( "",
1519 Command( wxT("WriteJournal"),
1520 /* i18n-hint a "journal" is a text file that records
1521 the user's interactions with the application */
1522 XXO("Write Journal"),
1523 FN(OnWriteJournal),
1525 Options{}.CheckTest( [](AudacityProject&){
1526 return Journal::RecordEnabled(); } ) )
1527 )
1528#endif
1529
1530 ) ) };
1531 return menu;
1532}
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:35
@ EffectTypeTool
static AudioIO * Get()
Definition: AudioIO.cpp:133
bool mSimulateRecordingErrors
Definition: AudioIO.h:382
std::atomic< bool > mDetectUpstreamDropouts
Definition: AudioIO.h:386
PluginID mLastTool
Definition: Menus.h:57
bool RecordEnabled()
Definition: Journal.cpp:204
const ReservedCommandFlag & HasLastToolFlag()
MenuTable::BaseItemPtrs PopulateMacrosMenu(CommandFlag flags)

References AlwaysEnabledFlag, AudioIONotBusyFlag(), MenuTable::Command(), EffectTypeTool, findCommandHandler(), FN, AudioIO::Get(), EffectManager::Get(), MenuManager::Get(), HasLastToolFlag(), MenuTable::Items(), AudioIoCallback::mDetectUpstreamDropouts, MenuTable::Menu(), MenuCreator::mLastTool, AudioIoCallback::mSimulateRecordingErrors, anonymous_namespace{Menus.cpp}::Options(), PopulateEffectsMenu(), PopulateMacrosMenu(), Journal::RecordEnabled(), MenuTable::Section(), wxT(), XO, and XXO.

Here is the call graph for this function:

Variable Documentation

◆ sAttachment1

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment1
Initial value:

Definition at line 1262 of file PluginMenus.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment2
Initial value:
{
wxT(""),
}

Definition at line 1336 of file PluginMenus.cpp.

◆ sAttachment3

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment3
Initial value:
{
wxT(""),
}

Definition at line 1400 of file PluginMenus.cpp.

◆ sAttachment4

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment4
Initial value:
{
wxT(""),
}

Definition at line 1534 of file PluginMenus.cpp.

◆ sAttachment5

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment5
Initial value:
{
wxT("Optional/Extra/Part2"),
}
BaseItemSharedPtr ExtraScriptablesIMenu()

Definition at line 1586 of file PluginMenus.cpp.

◆ sAttachment6

AttachedItem anonymous_namespace{PluginMenus.cpp}::sAttachment6
Initial value:
{
wxT("Optional/Extra/Part2"),
}
BaseItemSharedPtr ExtraScriptablesIIMenu()

Definition at line 1631 of file PluginMenus.cpp.

◆ sMacrosWindowKey

AttachedWindows::RegisteredFactory anonymous_namespace{PluginMenus.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 408 of file PluginMenus.cpp.

Referenced by PluginActions::Handler::OnApplyMacrosPalette(), and PluginActions::Handler::OnManageMacros().