12using EffectsMenuGroups = std::vector<std::pair<TranslatableString, std::vector<TranslatableString>>>;
16 std::vector<const PluginDescriptor*>
plugins;
44 EffectsHandler(std::vector<TranslatableString>& effects) : effects(effects) { }
50 if(textContent.has_value() && tag ==
"Effect")
67 std::pair<TranslatableString, std::vector<TranslatableString>>&
group;
75 if(textContent.has_value() && tag ==
"Name")
83 effectsHandler = std::make_unique<EffectsHandler>(group.second);
84 return &*effectsHandler;
104 groups.resize(groups.size() + 1);
105 groupHandler = std::make_unique<GroupHandler>(groups.back());
106 return &*groupHandler;
136 const std::vector<CommandFlag> & flags,
139 const int namesCnt = (int)
names.size();
141 int groupCnt = namesCnt;
142 for (
int i = 0; i < namesCnt; i++)
145 while (i + 1 < namesCnt &&
names[i].Translation() ==
names[i + 1].Translation())
154 for (
int i = 0; i < namesCnt; i++)
157 if (i + 1 < namesCnt &&
names[i].Translation() ==
names[i + 1].Translation())
164 while (i < namesCnt &&
names[i].Translation() == translation)
180 table.push_back(
Menu( wxEmptyString,
name, std::move( submenu ) ) );
204 std::vector<const PluginDescriptor*> & plugs,
209 size_t pluginCnt = plugs.size();
213 std::vector<CommandFlag> groupFlags;
215 for (
size_t i = 0; i < pluginCnt; i++)
225 if (sortBy == SortBy::PublisherName)
229 else if (sortBy == SortBy::TypeName )
239 groupNames.push_back(
245 groupPlugs.push_back(plug->
GetID());
249 if (groupNames.size() > 0)
252 table, groupNames, groupPlugs, groupFlags,
263 return Items(
id, move(ptrs));
279 std::vector<CommandFlag> groupFlags;
281 auto srcNames = p.second;
284 for(
auto&
name : srcNames)
288 return name == other->GetSymbol().Msgid();
290 if(it == plugs.end())
294 if(plug->IsEffectInteractive())
295 groupNames.push_back(
name +
XO(
"..."));
297 groupNames.push_back(
name );
299 groupPlugs.push_back(plug->GetID());
303 if (!groupNames.empty())
309 groupNames, groupPlugs, groupFlags,
313 p.first, std::move( temp )
322 std::vector<const PluginDescriptor*>& plugs,
329 const auto UnknownGroupName =
XO(
"Unknown");
332 std::vector<TranslatableString> path;
335 std::vector<TranslatableString>
names;
337 std::vector<CommandFlag> flags;
339 auto doAddGroup = [&]
344 const auto inSubmenu = !path.empty() && (
names.size() > 1);
347 parentTable->push_back(
MenuOrItems( wxEmptyString,
355 for(
auto plug : plugs)
357 if(groupBy == GroupBy::Publisher)
359 const auto vendorName = effectManager.GetVendorName(plug->GetID());
360 if(path.empty() || path[0] != vendorName)
363 path = { vendorName };
366 else if(groupBy == GroupBy::Type)
368 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
369 if(path.empty() || path[0] != effectFamilyName)
372 path = { effectFamilyName };
375 else if(groupBy == GroupBy::TypePublisher)
377 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
378 const auto vendorName = effectManager.GetVendorName(plug->GetID());
379 if(path.empty() || path[0] != effectFamilyName)
382 path = { effectFamilyName, vendorName };
384 parentTable = &menu->items;
385 table.push_back(std::move(menu));
387 else if(path[1] != vendorName)
390 path[1] = vendorName;
394 group.push_back(plug->GetID());
395 names.push_back(plug->GetSymbol().Msgid());
413 auto akey = em.GetVendorName(a->
GetID());
414 auto bkey = em.GetVendorName(b->
GetID());
417 akey =
XO(
"Uncategorized");
419 bkey =
XO(
"Uncategorized");
432 auto akey = em.GetVendorName(a->
GetID());
433 auto bkey = em.GetVendorName(b->
GetID());
451 auto akey = em.GetEffectFamilyName(a->
GetID());
452 auto bkey = em.GetEffectFamilyName(b->
GetID());
455 akey =
XO(
"Uncategorized");
457 bkey =
XO(
"Uncategorized");
474 auto akey = em.GetEffectFamilyName(a->
GetID());
475 auto bkey = em.GetEffectFamilyName(b->
GetID());
478 akey =
XO(
"Uncategorized");
480 bkey =
XO(
"Uncategorized");
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());
498 aType =
XO(
"Uncategorized");
500 bType =
XO(
"Uncategorized");
502 aVendor =
XO(
"Unknown");
504 bVendor =
XO(
"Unknown");
526#ifdef EXPERIMENTAL_DA
543 auto pluginPath = wxFileName(plug->
GetPath());
544 pluginPath.MakeAbsolute();
545 return pluginPath.GetPath().StartsWith(applicationResourcePath.GetPath());
557 for(
auto&
name : p.second)
559 if(
name == plug->GetSymbol().Msgid())
572 const wxString& groupby,
579 std::vector<MenuSectionBuilder> sections;
581 auto MakeAddSortedItems = [=](
SortBy sortby)
589 auto MakeAddGroupedItems = [=](
GroupBy groupBy)
598 if(groupby ==
"default")
602 static auto effectMenuDefaults = [] {
608 sections.emplace_back(
611 [=](
auto plug) {
return IsBundledPlugin(plug) && groupsFilter(plug); },
615 sections.emplace_back(
620 MakeAddGroupedItems(GroupBy::Publisher)
625 sections.emplace_back(
630 MakeAddSortedItems(SortBy::Name)
632 sections.emplace_back(
637 MakeAddGroupedItems(GroupBy::Publisher)
641 else if(groupby ==
"sortby:publisher:name")
643 sections.emplace_back(
648 MakeAddSortedItems(SortBy::PublisherName)
650 sections.emplace_back(
655 MakeAddSortedItems(SortBy::PublisherName)
658 else if(groupby ==
"sortby:type:name")
660 sections.emplace_back(
665 MakeAddSortedItems(SortBy::TypeName)
667 sections.emplace_back(
672 MakeAddSortedItems(SortBy::TypeName)
675 else if(groupby ==
"groupby:publisher")
677 sections.emplace_back(
682 MakeAddGroupedItems(GroupBy::Publisher)
684 sections.emplace_back(
689 MakeAddGroupedItems(GroupBy::Publisher)
692 else if(groupby ==
"groupby:type")
694 sections.emplace_back(
699 MakeAddGroupedItems(GroupBy::Type)
701 sections.emplace_back(
706 MakeAddGroupedItems(GroupBy::Type)
709 else if(groupby ==
"groupby:type:publisher")
711 sections.emplace_back(
716 MakeAddGroupedItems(GroupBy::Type)
723 MakeAddGroupedItems(GroupBy::TypePublisher)
728 sections.emplace_back(
733 MakeAddSortedItems(SortBy::Name)
735 sections.emplace_back(
740 MakeAddSortedItems(SortBy::Name)
745 if(pred && !pred(plugin))
748 for(
auto& section : sections)
750 if(section.filter(&plugin))
752 section.plugins.push_back(&plugin);
758 for(
auto& section : sections)
760 if(section.compare !=
nullptr)
761 std::sort(section.plugins.begin(), section.plugins.end(), section.compare);
764 section.add(items, section.plugins);
std::bitset< NCommandFlags > CommandFlag
const ReservedCommandFlag & NoiseReductionTimeSelectedFlag()
const TranslatableString name
#define NYQUIST_PROMPT_ID
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
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)
An explicitly nonlocalized string, not meant for the user to see.
const ComponentInterfaceSymbol & GetSymbol() const
PluginType GetPluginType() const
bool IsEffectDefault() const
bool IsEffectInteractive() const
const wxString & GetID() const
const PluginPath & GetPath() const
PluginManager maintains a list of all plug ins. That covers modules, effects, generators,...
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.
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...
FILES_API FilePath ResourcesDir()
std::unique_ptr< BaseItem > BaseItemPtr
std::vector< BaseItemPtr > BaseItemPtrs
AuthorizationHandler handler
Options && IsEffect(bool value=true) &&
Options && Parameter(const CommandParameter &value) &&
Options && AllowInMacros(int value=1) &&
std::optional< std::string > textContent
void HandleXMLEndTag(const std::string_view &tag) override
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
std::vector< TranslatableString > & effects
EffectsHandler(std::vector< TranslatableString > &effects)
void HandleXMLContent(const std::string_view &text) override
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
void HandleXMLEndTag(const std::string_view &tag) override
std::unique_ptr< EffectsHandler > effectsHandler
std::optional< std::string > textContent
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
void HandleXMLContent(const std::string_view &text) override
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
std::pair< TranslatableString, std::vector< TranslatableString > > & group
GroupHandler(std::pair< TranslatableString, std::vector< TranslatableString > > &group)
XMLTagHandler * HandleXMLChild(const std::string_view &tag) override
std::unique_ptr< GroupHandler > groupHandler
EffectsMenuGroupsHandler(EffectsMenuGroups &groups)
bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs) override
EffectsMenuGroups & groups