Audacity 3.2.0
MenuHelper.cpp
Go to the documentation of this file.
1#include "MenuHelper.h"
2#include "PluginManager.h"
5#include "BatchCommands.h"
7
8#include "XMLFileReader.h"
9
10namespace {
11
12using EffectsMenuGroups = std::vector<std::pair<TranslatableString, std::vector<TranslatableString>>>;
13
15{
16 std::vector<const PluginDescriptor*> plugins;
17
18 std::function<bool(const PluginDescriptor*)> filter;
19 std::function<bool(const PluginDescriptor*, const PluginDescriptor*)> compare;
20 std::function<void(MenuTable::BaseItemPtrs&, std::vector<const PluginDescriptor*>&)> add;
21};
22
23enum class GroupBy
24{
26 Type,
28};
29
30enum class SortBy
31{
32 Name,
35};
36
38{
40 {
41 std::optional<std::string> textContent;
42 std::vector<TranslatableString>& effects;
43
44 EffectsHandler(std::vector<TranslatableString>& effects) : effects(effects) { }
45
46 bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override { return true; }
47 void HandleXMLContent(const std::string_view& text) override { textContent = text; }
48 void HandleXMLEndTag(const std::string_view& tag) override
49 {
50 if(textContent.has_value() && tag == "Effect")
51 effects.emplace_back(TranslatableString { *textContent, {} });
52 textContent.reset();
53 }
54 XMLTagHandler* HandleXMLChild(const std::string_view& tag) override
55 {
56 if(tag == "Effect")
57 return this;
58 return nullptr;
59 }
60
61 };
62
64 {
65 std::optional<std::string> textContent;
66 std::unique_ptr<EffectsHandler> effectsHandler;
67 std::pair<TranslatableString, std::vector<TranslatableString>>& group;
68
69 GroupHandler(std::pair<TranslatableString, std::vector<TranslatableString>>& group) : group(group) { }
70
71 bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override { return true; }
72 void HandleXMLContent(const std::string_view& text) override { textContent = text; }
73 void HandleXMLEndTag(const std::string_view& tag) override
74 {
75 if(textContent.has_value() && tag == "Name")
76 group.first = TranslatableString { *textContent, { } };
77 textContent.reset();
78 }
79 XMLTagHandler* HandleXMLChild(const std::string_view& tag) override
80 {
81 if(tag == "Effects")
82 {
83 effectsHandler = std::make_unique<EffectsHandler>(group.second);
84 return &*effectsHandler;
85 }
86 if(tag == "Name")
87 return this;
88
89 return nullptr;
90 }
91 };
92
94 std::unique_ptr<GroupHandler> groupHandler;
95
96 EffectsMenuGroupsHandler(EffectsMenuGroups& groups) : groups(groups) { }
97
98 bool HandleXMLTag(const std::string_view& tag, const AttributesList& attrs) override { return true; }
99
100 XMLTagHandler* HandleXMLChild(const std::string_view& tag) override
101 {
102 if(tag == "Group")
103 {
104 groups.resize(groups.size() + 1);
105 groupHandler = std::make_unique<GroupHandler>(groups.back());
106 return &*groupHandler;
107 }
108 return nullptr;
109 }
110};
111
113{
114 EffectsMenuGroups result;
116
117 XMLFileReader reader;
118 reader.Parse(&handler, path);
119 return result;
120}
121
122// Some weird special case stuff just for Noise Reduction so that there is
123// more informative help
125{
126 if ( plug->GetSymbol().Msgid() == XO( "Noise Reduction" ) )
127 return ( batchflags | NoiseReductionTimeSelectedFlag() ) & ~TimeSelectedFlag();
128 return batchflags;
129}
130
131
135 const PluginIDs & plugs,
136 const std::vector<CommandFlag> & flags,
137 void (*onMenuCommand)(const CommandContext&))
138{
139 const int namesCnt = (int) names.size();
140
141 int groupCnt = namesCnt;
142 for (int i = 0; i < namesCnt; i++)
143 {
144 // compare full translations not msgids!
145 while (i + 1 < namesCnt && names[i].Translation() == names[i + 1].Translation())
146 {
147 i++;
148 groupCnt--;
149 }
150 }
151
152 using namespace MenuTable;
153
154 for (int i = 0; i < namesCnt; i++)
155 {
156 // compare full translations not msgids!
157 if (i + 1 < namesCnt && names[i].Translation() == names[i + 1].Translation())
158 {
159 // collect a sub-menu for like-named items
160 const auto name = names[i];
161 const auto translation = name.Translation();
162 BaseItemPtrs submenu;
163 // compare full translations not msgids!
164 while (i < namesCnt && names[i].Translation() == translation)
165 {
166 const PluginDescriptor *plug =
167 PluginManager::Get().GetPlugin(plugs[i]);
168 if( plug->GetPluginType() == PluginTypeEffect )
169 submenu.push_back( Command( plug->GetID(),
170 Verbatim( plug->GetPath() ),
171 onMenuCommand,
172 flags[i],
174 .IsEffect()
176 .Parameter( plugs[i] ) ) );
177
178 i++;
179 }
180 table.push_back( Menu( wxEmptyString, name, std::move( submenu ) ) );
181 i--;
182 }
183 else
184 {
185 // collect one item
186 const PluginDescriptor *plug =
187 PluginManager::Get().GetPlugin(plugs[i]);
188 if( plug->GetPluginType() == PluginTypeEffect )
189 table.push_back( Command(
190 plug->GetID(),
191 names[i],
192 onMenuCommand,
193 flags[i],
195 .IsEffect()
197 .Parameter( plugs[i] ) ) );
198 }
199 }
200}
201
204 std::vector<const PluginDescriptor*> & plugs,
205 CommandFlag batchflags,
206 SortBy sortBy,
207 void (*onMenuCommand)(const CommandContext&))
208{
209 size_t pluginCnt = plugs.size();
210
211 TranslatableStrings groupNames;
212 PluginIDs groupPlugs;
213 std::vector<CommandFlag> groupFlags;
214
215 for (size_t i = 0; i < pluginCnt; i++)
216 {
217 const PluginDescriptor *plug = plugs[i];
218
219 auto name = plug->GetSymbol().Msgid();
220
221 if (plug->IsEffectInteractive())
222 name += XO("...");
223
224 TranslatableString group;
225 if (sortBy == SortBy::PublisherName/* wxT("sortby:publisher:name")*/)
226 {
227 group = EffectManager::Get().GetVendorName(plug->GetID());
228 }
229 else if (sortBy == SortBy::TypeName /*wxT("sortby:type:name")*/)
230 {
232 }
233
234 if (plug->IsEffectDefault())
235 {
236 group = {};
237 }
238
239 groupNames.push_back(
240 group.empty()
241 ? name
242 : XO("%s: %s").Format( group, name )
243 );
244
245 groupPlugs.push_back(plug->GetID());
246 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
247 }
248
249 if (groupNames.size() > 0)
250 {
252 table, groupNames, groupPlugs, groupFlags,
253 onMenuCommand);
254 }
255}
256
258 const Identifier &id, const TranslatableString &label,
260{
261 using namespace MenuTable;
262 if (label.empty())
263 return Items(id, move(ptrs));
264 else
265 return Menu(id, label, move(ptrs));
266}
267
269 const EffectsMenuGroups& list,
270 CommandFlag batchflags,
271 void (*onMenuCommand)(const CommandContext&)) -> auto
272{
273 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugs)
274 {
275 for(auto& p : list)
276 {
277 TranslatableStrings groupNames;
278 PluginIDs groupPlugs;
279 std::vector<CommandFlag> groupFlags;
280
281 auto srcNames = p.second;
282 std::sort(srcNames.begin(), srcNames.end(), TranslationLess);
283
284 for(auto& name : srcNames)
285 {
286 auto it = std::find_if(plugs.begin(), plugs.end(), [&name](const PluginDescriptor* other)
287 {
288 return name == other->GetSymbol().Msgid();
289 });
290 if(it == plugs.end())
291 continue;
292
293 auto plug = *it;
294 if(plug->IsEffectInteractive())
295 groupNames.push_back(name + XO("..."));
296 else
297 groupNames.push_back( name );
298
299 groupPlugs.push_back(plug->GetID());
300 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
301 }
302
303 if (!groupNames.empty())
304 {
305 using namespace MenuTable;
306 BaseItemPtrs temp;
307
309 groupNames, groupPlugs, groupFlags,
310 onMenuCommand);
311
312 items.push_back( MenuOrItems( wxEmptyString,
313 p.first, std::move( temp )
314 ) );
315 }
316 }
317 };
318}
319
322 std::vector<const PluginDescriptor*>& plugs,
323 CommandFlag batchflags,
324 GroupBy groupBy,
325 void (*onMenuCommand)(const CommandContext&))
326{
327 using namespace MenuTable;
328
329 const auto UnknownGroupName = XO("Unknown");
330 auto& effectManager = EffectManager::Get();
331
332 std::vector<TranslatableString> path;
333
334 BaseItemPtrs* parentTable = &table;
335 std::vector<TranslatableString> names;
336 PluginIDs group;
337 std::vector<CommandFlag> flags;
338
339 auto doAddGroup = [&]
340 {
341 if(names.empty())
342 return;
343
344 const auto inSubmenu = !path.empty() && (names.size() > 1);
345 BaseItemPtrs items;
346 AddEffectMenuItemGroup(items, names, group, flags, onMenuCommand);
347 parentTable->push_back( MenuOrItems( wxEmptyString,
348 inSubmenu ? path.back() : TranslatableString{}, std::move( items )));
349
350 names.clear();
351 group.clear();
352 flags.clear();
353 };
354
355 for(auto plug : plugs)
356 {
357 if(groupBy == GroupBy::Publisher)
358 {
359 const auto vendorName = effectManager.GetVendorName(plug->GetID());
360 if(path.empty() || path[0] != vendorName)
361 {
362 doAddGroup();
363 path = { vendorName };
364 }
365 }
366 else if(groupBy == GroupBy::Type)
367 {
368 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
369 if(path.empty() || path[0] != effectFamilyName)
370 {
371 doAddGroup();
372 path = { effectFamilyName };
373 }
374 }
375 else if(groupBy == GroupBy::TypePublisher)
376 {
377 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
378 const auto vendorName = effectManager.GetVendorName(plug->GetID());
379 if(path.empty() || path[0] != effectFamilyName)
380 {
381 doAddGroup();
382 path = { effectFamilyName, vendorName };
383 auto menu = Menu("", effectFamilyName, BaseItemPtrs{});
384 parentTable = &menu->items;
385 table.push_back(std::move(menu));
386 }
387 else if(path[1] != vendorName)
388 {
389 doAddGroup();
390 path[1] = vendorName;
391 }
392 }
393
394 group.push_back(plug->GetID());
395 names.push_back(plug->GetSymbol().Msgid());
396 flags.push_back(FixBatchFlags( batchflags, plug ) );
397 }
398 doAddGroup();
399}
400
402{
403 return
404 std::make_pair( a->GetSymbol().Translation(), a->GetPath() ) <
405 std::make_pair( b->GetSymbol().Translation(), b->GetPath() );
406}
407
409 const PluginDescriptor *a, const PluginDescriptor *b)
410{
411 auto &em = EffectManager::Get();
412
413 auto akey = em.GetVendorName(a->GetID());
414 auto bkey = em.GetVendorName(b->GetID());
415
416 if (akey.empty())
417 akey = XO("Uncategorized");
418 if (bkey.empty())
419 bkey = XO("Uncategorized");
420
421 return
422 std::make_tuple(
423 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
424 std::make_tuple(
425 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
426}
427
429 const PluginDescriptor *a, const PluginDescriptor *b)
430{
431 auto &em = EffectManager::Get();
432 auto akey = em.GetVendorName(a->GetID());
433 auto bkey = em.GetVendorName(b->GetID());
434
435 if (a->IsEffectDefault())
436 akey = {};
437 if (b->IsEffectDefault())
438 bkey = {};
439
440 return
441 std::make_tuple(
442 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
443 std::make_tuple(
444 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
445}
446
448 const PluginDescriptor *a, const PluginDescriptor *b)
449{
450 auto &em = EffectManager::Get();
451 auto akey = em.GetEffectFamilyName(a->GetID());
452 auto bkey = em.GetEffectFamilyName(b->GetID());
453
454 if (akey.empty())
455 akey = XO("Uncategorized");
456 if (bkey.empty())
457 bkey = XO("Uncategorized");
458
459 if (a->IsEffectDefault())
460 akey = {};
461 if (b->IsEffectDefault())
462 bkey = {};
463
464 return
465 std::make_tuple(
466 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
467 std::make_tuple(
468 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
469}
470
472{
473 auto &em = EffectManager::Get();
474 auto akey = em.GetEffectFamilyName(a->GetID());
475 auto bkey = em.GetEffectFamilyName(b->GetID());
476
477 if (akey.empty())
478 akey = XO("Uncategorized");
479 if (bkey.empty())
480 bkey = XO("Uncategorized");
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}
488
490{
491 auto &em = EffectManager::Get();
492 auto aType = em.GetEffectFamilyName(a->GetID());
493 auto bType = em.GetEffectFamilyName(b->GetID());
494 auto aVendor = em.GetVendorName(a->GetID());
495 auto bVendor = em.GetVendorName(b->GetID());
496
497 if (aType.empty())
498 aType = XO("Uncategorized");
499 if (bType.empty())
500 bType = XO("Uncategorized");
501 if (aVendor.empty())
502 aVendor = XO("Unknown");
503 if (bVendor.empty())
504 bVendor = XO("Unknown");
505
506 return
507 std::make_tuple(
508 aType.Translation(), aVendor.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
509 std::make_tuple(
510 bType.Translation(), bVendor.Translation(), b->GetSymbol().Translation(), b->GetPath() );
511}
512
514{
515 if( PluginManager::Get().IsPluginLoaded(plug->GetID()) && EffectManager::Get().IsHidden(plug->GetID()) )
516 return false;
517 if ( !plug->IsEnabled() ){
518 return false;// don't add to menus!
519 }
520 return true;
521}
522
524{
525 if (plug->IsEffectDefault()
526#ifdef EXPERIMENTAL_DA
527 // Move Nyquist prompt into nyquist group.
528 && (plug->GetSymbol() !=
529 ComponentInterfaceSymbol("Nyquist Effects Prompt"))
530 && (plug->GetSymbol() != ComponentInterfaceSymbol("Nyquist Tools Prompt"))
532#endif
533 )
534 return true;
535 return false;
536}
537
539{
540 if(IsDefaultPlugin(plug))
541 return true;
542 auto applicationResourcePath = wxFileName(FileNames::ResourcesDir());
543 auto pluginPath = wxFileName(plug->GetPath());
544 pluginPath.MakeAbsolute();
545 return pluginPath.GetPath().StartsWith(applicationResourcePath.GetPath());
546}
547
548auto MakeGroupsFilter(const EffectsMenuGroups& list) -> auto
549{
550 return [=](const PluginDescriptor* plug)
551 {
552 if(!IsEnabledPlugin(plug))
553 return false;
554
555 for(auto& p : list)
556 {
557 for(auto& name : p.second)
558 {
559 if(name == plug->GetSymbol().Msgid())
560 return true;
561 }
562 }
563 return false;
564 };
565}
566
567}
568
570 EffectType type,
571 CommandFlag batchflags,
572 const wxString& groupby,
573 void (*onMenuCommand)(const CommandContext&),
574 std::function<bool(const PluginDescriptor&)> pred)
575{
578
579 std::vector<MenuSectionBuilder> sections;
580
581 auto MakeAddSortedItems = [=](SortBy sortby)
582 {
583 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugins)
584 {
585 return AddSortedEffectMenuItems(items, plugins, batchflags, sortby, onMenuCommand);
586 };
587 };
588
589 auto MakeAddGroupedItems = [=](GroupBy groupBy)
590 {
591 return [=](MenuTable::BaseItemPtrs& items, std::vector<const PluginDescriptor*>& plugins)
592 {
593 return AddGroupedEffectMenuItems(items, plugins, batchflags, groupBy, onMenuCommand);
594 };
595 };
596
597 auto DefaultFilter = [](auto plug) { return IsEnabledPlugin(plug) && IsDefaultPlugin(plug); };
598 if(groupby == "default")
599 {
600 if(type == EffectTypeProcess)
601 {
602 static auto effectMenuDefaults = [] {
603 wxFileName path = wxFileName(FileNames::ResourcesDir(), wxT("EffectsMenuDefaults.xml"));
604 return LoadEffectsMenuGroups(path.GetFullPath());
605 }();
606 static auto groupsFilter = MakeGroupsFilter(effectMenuDefaults);
607
608 sections.emplace_back(
609 MenuSectionBuilder {
610 {},
611 [=](auto plug) { return IsBundledPlugin(plug) && groupsFilter(plug); },
612 nullptr,
613 MakeAddGroupItems(effectMenuDefaults, batchflags, onMenuCommand)
614 });
615 sections.emplace_back(
616 MenuSectionBuilder {
617 {},
620 MakeAddGroupedItems(GroupBy::Publisher)
621 });
622 }
623 else//Generators/Analyzers
624 {
625 sections.emplace_back(
626 MenuSectionBuilder {
627 {},
628 [](auto plug){ return IsEnabledPlugin(plug) && IsBundledPlugin(plug); } ,
630 MakeAddSortedItems(SortBy::Name)
631 });
632 sections.emplace_back(
633 MenuSectionBuilder {
634 {},
637 MakeAddGroupedItems(GroupBy::Publisher)
638 });
639 }
640 }
641 else if(groupby == "sortby:publisher:name")
642 {
643 sections.emplace_back(
644 MenuSectionBuilder {
645 {},
646 DefaultFilter,
648 MakeAddSortedItems(SortBy::PublisherName)
649 });
650 sections.emplace_back(
651 MenuSectionBuilder {
652 {},
655 MakeAddSortedItems(SortBy::PublisherName)
656 });
657 }
658 else if(groupby == "sortby:type:name")
659 {
660 sections.emplace_back(
661 MenuSectionBuilder {
662 {},
663 DefaultFilter,
665 MakeAddSortedItems(SortBy::TypeName)
666 });
667 sections.emplace_back(
668 MenuSectionBuilder {
669 {},
672 MakeAddSortedItems(SortBy::TypeName)
673 });
674 }
675 else if(groupby == "groupby:publisher")
676 {
677 sections.emplace_back(
678 MenuSectionBuilder {
679 {},
680 DefaultFilter,
682 MakeAddGroupedItems(GroupBy::Publisher)
683 });
684 sections.emplace_back(
685 MenuSectionBuilder {
686 {},
689 MakeAddGroupedItems(GroupBy::Publisher)
690 });
691 }
692 else if(groupby == "groupby:type")
693 {
694 sections.emplace_back(
695 MenuSectionBuilder {
696 {},
697 DefaultFilter,
699 MakeAddGroupedItems(GroupBy::Type)
700 });
701 sections.emplace_back(
702 MenuSectionBuilder {
703 {},
706 MakeAddGroupedItems(GroupBy::Type)
707 });
708 }
709 else if(groupby == "groupby:type:publisher")
710 {
711 sections.emplace_back(
712 MenuSectionBuilder {
713 {},
714 DefaultFilter,
716 MakeAddGroupedItems(GroupBy::Type)
717 });
718 sections.push_back(
719 MenuSectionBuilder {
720 {},
723 MakeAddGroupedItems(GroupBy::TypePublisher)
724 });
725 }
726 else //if(groupby == "sortby:name")
727 {
728 sections.emplace_back(
729 MenuSectionBuilder {
730 {},
731 DefaultFilter,
733 MakeAddSortedItems(SortBy::Name)
734 });
735 sections.emplace_back(
736 MenuSectionBuilder {
737 {},
740 MakeAddSortedItems(SortBy::Name)
741 });
742 }
743 for(auto& plugin : pm.EffectsOfType(type))
744 {
745 if(pred && !pred(plugin))
746 continue;
747
748 for(auto& section : sections)
749 {
750 if(section.filter(&plugin))
751 {
752 section.plugins.push_back(&plugin);
753 break;
754 }
755 }
756 }
757
758 for(auto& section : sections)
759 {
760 if(section.compare != nullptr)
761 std::sort(section.plugins.begin(), section.plugins.end(), section.compare);
762
764 section.add(items, section.plugins);
765
766 if(items.empty())
767 continue;
768
769 if(result.empty())
770 result.push_back(MenuTable::Items( "", std::move( items ) ));
771 else
772 result.push_back(MenuTable::Section( "", std::move( items ) ));
773 }
774
775 return result;
776}
wxT("CloseDown"))
std::bitset< NCommandFlags > CommandFlag
Definition: CommandFlag.h:30
const ReservedCommandFlag & NoiseReductionTimeSelectedFlag()
const TranslatableString name
Definition: Distortion.cpp:76
EffectType
@ EffectTypeProcess
XO("Cut/Copy/Paste")
wxArrayString PluginIDs
Definition: Menus.h:33
@ PluginTypeEffect
#define NYQUIST_PROMPT_ID
TranslatableString label
Definition: TagsEditor.cpp:164
static TranslatableStrings names
Definition: TagsEditor.cpp:152
bool TranslationLess(const TranslatableString &a, const TranslatableString &b)
A commonly needed sort comparator, which depends on the language setting.
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
std::vector< TranslatableString > TranslatableStrings
std::vector< Attribute > AttributesList
Definition: XMLTagHandler.h:40
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
const TranslatableString & Msgid() const
const wxString Translation() const
static EffectManager & Get()
TranslatableString GetVendorName(const PluginID &ID)
TranslatableString GetEffectFamilyName(const PluginID &ID)
bool IsHidden(const PluginID &ID)
Abstract base class used in importing a file.
An explicitly nonlocalized string, not meant for the user to see.
Definition: Identifier.h:22
const ComponentInterfaceSymbol & GetSymbol() const
PluginType GetPluginType() const
bool IsEffectDefault() const
bool IsEffectInteractive() const
const wxString & GetID() const
bool IsEnabled() const
const PluginPath & GetPath() const
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
Definition: PluginManager.h:47
Range EffectsOfType(EffectType type)
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
Reads a file and passes the results through an XMLTagHandler.
Definition: XMLFileReader.h:19
bool Parse(XMLTagHandler *baseHandler, const FilePath &fname)
This class is an interface which should be implemented by classes which wish to be able to load and s...
Definition: XMLTagHandler.h:42
FILES_API FilePath ResourcesDir()
MenuTable::BaseItemPtrs PopulateEffectsMenu(EffectType type, CommandFlag batchflags, const wxString &groupby, void(*onMenuCommand)(const CommandContext &), std::function< bool(const PluginDescriptor &)> pred={})
Definition: MenuHelper.cpp:569
constexpr auto Section
constexpr auto Menu
constexpr auto Items
constexpr auto Command
std::unique_ptr< BaseItem > BaseItemPtr
Definition: Registry.h:73
std::vector< BaseItemPtr > BaseItemPtrs
Definition: Registry.h:75
EffectsMenuGroups LoadEffectsMenuGroups(const wxString &path)
Definition: MenuHelper.cpp:112
void AddSortedEffectMenuItems(MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, SortBy sortBy, void(*onMenuCommand)(const CommandContext &))
Definition: MenuHelper.cpp:202
bool IsDefaultPlugin(const PluginDescriptor *plug)
Definition: MenuHelper.cpp:523
bool CompareEffectsByTypeAndName(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:447
bool ComapareEffectsByTypeAndPublisher(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:489
bool CompareEffectsByPublisherAndName(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:428
bool CompareEffectsByPublisher(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:408
bool CompareEffectsByName(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:401
void AddGroupedEffectMenuItems(MenuTable::BaseItemPtrs &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, GroupBy groupBy, void(*onMenuCommand)(const CommandContext &))
Definition: MenuHelper.cpp:320
bool IsEnabledPlugin(const PluginDescriptor *plug)
Definition: MenuHelper.cpp:513
CommandFlag FixBatchFlags(CommandFlag batchflags, const PluginDescriptor *plug)
Definition: MenuHelper.cpp:124
bool IsBundledPlugin(const PluginDescriptor *plug)
Definition: MenuHelper.cpp:538
auto MakeAddGroupItems(const EffectsMenuGroups &list, CommandFlag batchflags, void(*onMenuCommand)(const CommandContext &)) -> auto
Definition: MenuHelper.cpp:268
auto MakeGroupsFilter(const EffectsMenuGroups &list) -> auto
Definition: MenuHelper.cpp:548
void AddEffectMenuItemGroup(MenuTable::BaseItemPtrs &table, const TranslatableStrings &names, const PluginIDs &plugs, const std::vector< CommandFlag > &flags, void(*onMenuCommand)(const CommandContext &))
Definition: MenuHelper.cpp:132
std::vector< std::pair< TranslatableString, std::vector< TranslatableString > > > EffectsMenuGroups
Definition: MenuHelper.cpp:12
static Registry::BaseItemPtr MenuOrItems(const Identifier &id, const TranslatableString &label, Registry::BaseItemPtrs ptrs)
Definition: MenuHelper.cpp:257
bool CompareEffectsByType(const PluginDescriptor *a, const PluginDescriptor *b)
Definition: MenuHelper.cpp:471
Options && IsEffect(bool value=true) &&
Options && Parameter(const CommandParameter &value) &&
Options && AllowInMacros(int value=1) &&
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
Definition: MenuHelper.cpp:54
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
Definition: MenuHelper.cpp:46
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
Definition: MenuHelper.cpp:71
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
Definition: MenuHelper.cpp:79
std::pair< TranslatableString, std::vector< TranslatableString > > & group
Definition: MenuHelper.cpp:67
GroupHandler(std::pair< TranslatableString, std::vector< TranslatableString > > &group)
Definition: MenuHelper.cpp:69
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
Definition: MenuHelper.cpp:100
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
Definition: MenuHelper.cpp:98
std::function< bool(const PluginDescriptor *)> filter
Definition: MenuHelper.cpp:18
std::function< bool(const PluginDescriptor *, const PluginDescriptor *)> compare
Definition: MenuHelper.cpp:19
std::vector< const PluginDescriptor * > plugins
Definition: MenuHelper.cpp:16
std::function< void(MenuTable::BaseItemPtrs &, std::vector< const PluginDescriptor * > &)> add
Definition: MenuHelper.cpp:20