Audacity 3.2.0
Classes | Typedefs | Enumerations | Functions
anonymous_namespace{MenuHelper.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 , TypePublisher }
 
enum class  SortBy { Name , PublisherName , TypeName }
 

Functions

EffectsMenuGroups LoadEffectsMenuGroups (const wxString &path)
 
CommandFlag FixBatchFlags (CommandFlag batchflags, const PluginDescriptor *plug)
 
void AddEffectMenuItemGroup (MenuHelper::Group &table, const TranslatableStrings &names, const PluginIDs &plugs, const std::vector< CommandFlag > &flags, void(*onMenuCommand)(const CommandContext &))
 
void AddSortedEffectMenuItems (MenuHelper::Group &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, SortBy sortBy, void(*onMenuCommand)(const CommandContext &))
 
auto MakeAddGroupItems (const EffectsMenuGroups &list, CommandFlag batchflags, void(*onMenuCommand)(const CommandContext &)) -> auto
 
void AddGroupedEffectMenuItems (MenuHelper::Group &table, std::vector< const PluginDescriptor * > &plugs, CommandFlag batchflags, GroupBy groupBy, void(*onMenuCommand)(const CommandContext &))
 
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)
 
bool ComapareEffectsByTypeAndPublisher (const PluginDescriptor *a, const PluginDescriptor *b)
 
bool IsEnabledPlugin (const PluginDescriptor *plug)
 
bool IsDefaultPlugin (const PluginDescriptor *plug)
 
bool IsBundledPlugin (const PluginDescriptor *plug)
 
auto MakeGroupsFilter (const EffectsMenuGroups &list) -> auto
 

Typedef Documentation

◆ EffectsMenuGroups

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

Definition at line 12 of file MenuHelper.cpp.

Enumeration Type Documentation

◆ GroupBy

enum class anonymous_namespace{MenuHelper.cpp}::GroupBy
strong

◆ SortBy

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

Function Documentation

◆ AddEffectMenuItemGroup()

void anonymous_namespace{MenuHelper.cpp}::AddEffectMenuItemGroup ( MenuHelper::Group table,
const TranslatableStrings names,
const PluginIDs plugs,
const std::vector< CommandFlag > &  flags,
void(*)(const CommandContext &)  onMenuCommand 
)

Definition at line 132 of file MenuHelper.cpp.

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 MenuRegistry;
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 auto subMenu = Menu("", name);
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],
173 Options{}
174 .IsEffect()
176 .Parameter( plugs[i] ) ) );
177
178 i++;
179 }
180 table.push_back(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],
194 Options{}
195 .IsEffect()
197 .Parameter( plugs[i] ) ) );
198 }
199 }
200}
const TranslatableString name
Definition: Distortion.cpp:76
@ PluginTypeEffect
static TranslatableStrings names
Definition: TagsEditor.cpp:153
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
PluginType GetPluginType() const
const wxString & GetID() const
const PluginPath & GetPath() const
const PluginDescriptor * GetPlugin(const PluginID &ID) const
static PluginManager & Get()
wxString Translation() const
constexpr auto Command
Definition: MenuRegistry.h:456
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition: MenuRegistry.h:445
auto push_back(Arg &&arg) -> std::enable_if_t< Traits< Base, Derived > ::template enables_item_type_v< Arg >, void >
Definition: Composite.h:104
Options && AllowInMacros(int value=1) &&
Definition: MenuRegistry.h:69
Options && IsEffect(bool value=true) &&
Definition: MenuRegistry.h:50
Options && Parameter(const CommandParameter &value) &&
Definition: MenuRegistry.h:52

References MenuRegistry::Options::AllowInMacros(), MenuRegistry::Command, PluginManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginManager::GetPlugin(), PluginDescriptor::GetPluginType(), MenuRegistry::Options::IsEffect(), MenuRegistry::Menu, name, names, MenuRegistry::Options::Parameter(), PluginTypeEffect, Composite::Builder< Base, Derived, BaseArgs >::push_back(), TranslatableString::Translation(), and Verbatim().

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{MenuHelper.cpp}::AddGroupedEffectMenuItems ( MenuHelper::Group table,
std::vector< const PluginDescriptor * > &  plugs,
CommandFlag  batchflags,
GroupBy  groupBy,
void(*)(const CommandContext &)  onMenuCommand 
)

Definition at line 314 of file MenuHelper.cpp.

320{
321 using namespace MenuRegistry;
322
323 const auto UnknownGroupName = XO("Unknown");
324 auto& effectManager = EffectManager::Get();
325
326 std::vector<TranslatableString> path;
327
328 auto *parentTable = &table;
329 std::vector<TranslatableString> names;
330 PluginIDs group;
331 std::vector<CommandFlag> flags;
332
333 auto doAddGroup = [&]
334 {
335 using namespace MenuRegistry;
336 if(names.empty())
337 return;
338
339 const auto inSubmenu = !path.empty() && (names.size() > 1);
340 const auto label = inSubmenu ? path.back() : TranslatableString{};
341 if (label.empty()) {
342 auto items = Items("");
343 AddEffectMenuItemGroup(*items, names, group, flags, onMenuCommand);
344 parentTable->push_back(move(items));
345 }
346 else {
347 auto items = Menu("", label);
348 AddEffectMenuItemGroup(*items, names, group, flags, onMenuCommand);
349 parentTable->push_back(move(items));
350 }
351
352 names.clear();
353 group.clear();
354 flags.clear();
355 };
356
357 for(auto plug : plugs)
358 {
359 if(groupBy == GroupBy::Publisher)
360 {
361 const auto vendorName = effectManager.GetVendorName(plug->GetID());
362 if(path.empty() || path[0] != vendorName)
363 {
364 doAddGroup();
365 path = { vendorName };
366 }
367 }
368 else if(groupBy == GroupBy::Type)
369 {
370 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
371 if(path.empty() || path[0] != effectFamilyName)
372 {
373 doAddGroup();
374 path = { effectFamilyName };
375 }
376 }
377 else if(groupBy == GroupBy::TypePublisher)
378 {
379 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
380 const auto vendorName = effectManager.GetVendorName(plug->GetID());
381 if(path.empty() || path[0] != effectFamilyName)
382 {
383 doAddGroup();
384 path = { effectFamilyName, vendorName };
385 auto menu = Menu("", effectFamilyName);
386 parentTable = menu.get();
387 table.push_back(move(menu));
388 }
389 else if(path[1] != vendorName)
390 {
391 doAddGroup();
392 path[1] = vendorName;
393 }
394 }
395
396 group.push_back(plug->GetID());
397 names.push_back(plug->GetSymbol().Msgid());
398 flags.push_back(FixBatchFlags( batchflags, plug ) );
399 }
400 doAddGroup();
401}
XO("Cut/Copy/Paste")
wxArrayString PluginIDs
TranslatableString label
Definition: TagsEditor.cpp:165
static EffectManager & Get()
Holds a msgid for the translation catalog; may also bind format arguments.
constexpr auto Items
Definition: MenuRegistry.h:427
void AddEffectMenuItemGroup(MenuHelper::Group &table, const TranslatableStrings &names, const PluginIDs &plugs, const std::vector< CommandFlag > &flags, void(*onMenuCommand)(const CommandContext &))
Definition: MenuHelper.cpp:132
CommandFlag FixBatchFlags(CommandFlag batchflags, const PluginDescriptor *plug)
Definition: MenuHelper.cpp:124

References AddEffectMenuItemGroup(), TranslatableString::empty(), FixBatchFlags(), EffectManager::Get(), MenuRegistry::Items, label, MenuRegistry::Menu, names, Composite::Builder< Base, Derived, BaseArgs >::push_back(), and XO().

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ AddSortedEffectMenuItems()

void anonymous_namespace{MenuHelper.cpp}::AddSortedEffectMenuItems ( MenuHelper::Group table,
std::vector< const PluginDescriptor * > &  plugs,
CommandFlag  batchflags,
SortBy  sortBy,
void(*)(const CommandContext &)  onMenuCommand 
)

Definition at line 202 of file MenuHelper.cpp.

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}
std::vector< TranslatableString > TranslatableStrings
const TranslatableString & Msgid() const
TranslatableString GetVendorName(const PluginID &ID)
TranslatableString GetEffectFamilyName(const PluginID &ID)
Abstract base class used in importing a file.
const ComponentInterfaceSymbol & GetSymbol() const
bool IsEffectDefault() const
bool IsEffectInteractive() 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 MenuHelper::PopulateEffectsMenu().

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

◆ ComapareEffectsByTypeAndPublisher()

bool anonymous_namespace{MenuHelper.cpp}::ComapareEffectsByTypeAndPublisher ( const PluginDescriptor a,
const PluginDescriptor b 
)

Definition at line 491 of file MenuHelper.cpp.

492{
493 auto &em = EffectManager::Get();
494 auto aType = em.GetEffectFamilyName(a->GetID());
495 auto bType = em.GetEffectFamilyName(b->GetID());
496 auto aVendor = em.GetVendorName(a->GetID());
497 auto bVendor = em.GetVendorName(b->GetID());
498
499 if (aType.empty())
500 aType = XO("Uncategorized");
501 if (bType.empty())
502 bType = XO("Uncategorized");
503 if (aVendor.empty())
504 aVendor = XO("Unknown");
505 if (bVendor.empty())
506 bVendor = XO("Unknown");
507
508 return
509 std::make_tuple(
510 aType.Translation(), aVendor.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
511 std::make_tuple(
512 bType.Translation(), bVendor.Translation(), b->GetSymbol().Translation(), b->GetPath() );
513}
const wxString Translation() const

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ CompareEffectsByName()

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

Definition at line 403 of file MenuHelper.cpp.

404{
405 return
406 std::make_pair( a->GetSymbol().Translation(), a->GetPath() ) <
407 std::make_pair( b->GetSymbol().Translation(), b->GetPath() );
408}

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ CompareEffectsByPublisher()

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

Definition at line 410 of file MenuHelper.cpp.

412{
413 auto &em = EffectManager::Get();
414
415 auto akey = em.GetVendorName(a->GetID());
416 auto bkey = em.GetVendorName(b->GetID());
417
418 if (akey.empty())
419 akey = XO("Uncategorized");
420 if (bkey.empty())
421 bkey = XO("Uncategorized");
422
423 return
424 std::make_tuple(
425 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
426 std::make_tuple(
427 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
428}

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ CompareEffectsByPublisherAndName()

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

Definition at line 430 of file MenuHelper.cpp.

432{
433 auto &em = EffectManager::Get();
434 auto akey = em.GetVendorName(a->GetID());
435 auto bkey = em.GetVendorName(b->GetID());
436
437 if (a->IsEffectDefault())
438 akey = {};
439 if (b->IsEffectDefault())
440 bkey = {};
441
442 return
443 std::make_tuple(
444 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
445 std::make_tuple(
446 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
447}

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ CompareEffectsByType()

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

Definition at line 473 of file MenuHelper.cpp.

474{
475 auto &em = EffectManager::Get();
476 auto akey = em.GetEffectFamilyName(a->GetID());
477 auto bkey = em.GetEffectFamilyName(b->GetID());
478
479 if (akey.empty())
480 akey = XO("Uncategorized");
481 if (bkey.empty())
482 bkey = XO("Uncategorized");
483
484 return
485 std::make_tuple(
486 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
487 std::make_tuple(
488 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
489}

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ CompareEffectsByTypeAndName()

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

Definition at line 449 of file MenuHelper.cpp.

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

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

Here is the call graph for this function:

◆ FixBatchFlags()

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

Definition at line 124 of file MenuHelper.cpp.

125{
126 if ( plug->GetSymbol().Msgid() == XO( "Noise Reduction" ) )
127 return ( batchflags | NoiseReductionTimeSelectedFlag() ) & ~TimeSelectedFlag();
128 return batchflags;
129}
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:

◆ IsBundledPlugin()

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

Definition at line 532 of file MenuHelper.cpp.

533{
534 if(IsDefaultPlugin(plug))
535 return true;
536 auto applicationResourcePath = wxFileName(FileNames::ResourcesDir());
537 auto pluginPath = wxFileName(plug->GetPath());
538 pluginPath.MakeAbsolute();
539 return pluginPath.GetPath().StartsWith(applicationResourcePath.GetPath());
540}
FILES_API FilePath ResourcesDir()
bool IsDefaultPlugin(const PluginDescriptor *plug)
Definition: MenuHelper.cpp:525

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ IsDefaultPlugin()

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

Definition at line 525 of file MenuHelper.cpp.

526{
527 if (plug->IsEffectDefault())
528 return true;
529 return false;
530}

References PluginDescriptor::IsEffectDefault().

Referenced by IsBundledPlugin(), and MenuHelper::PopulateEffectsMenu().

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

◆ IsEnabledPlugin()

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

Definition at line 515 of file MenuHelper.cpp.

516{
517 if( PluginManager::Get().IsPluginLoaded(plug->GetID()) && EffectManager::Get().IsHidden(plug->GetID()) )
518 return false;
519 if ( !plug->IsEnabled() ){
520 return false;// don't add to menus!
521 }
522 return true;
523}
bool IsHidden(const PluginID &ID)
bool IsEnabled() const

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

Referenced by MakeGroupsFilter(), and MenuHelper::PopulateEffectsMenu().

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

◆ LoadEffectsMenuGroups()

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

Definition at line 112 of file MenuHelper.cpp.

113{
114 EffectsMenuGroups result;
116
117 XMLFileReader reader;
118 reader.Parse(&handler, path);
119 return result;
120}
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: MenuHelper.cpp:12

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

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ MakeAddGroupItems()

auto anonymous_namespace{MenuHelper.cpp}::MakeAddGroupItems ( const EffectsMenuGroups list,
CommandFlag  batchflags,
void(*)(const CommandContext &)  onMenuCommand 
) -> auto

Definition at line 257 of file MenuHelper.cpp.

261{
262 return [=](MenuHelper::Group& items, std::vector<const PluginDescriptor*>& plugs)
263 {
264 for(auto& p : list)
265 {
266 TranslatableStrings groupNames;
267 PluginIDs groupPlugs;
268 std::vector<CommandFlag> groupFlags;
269
270 auto srcNames = p.second;
271 std::sort(srcNames.begin(), srcNames.end(), TranslationLess);
272
273 for(auto& name : srcNames)
274 {
275 auto it = std::find_if(plugs.begin(), plugs.end(), [&name](const PluginDescriptor* other)
276 {
277 return name == other->GetSymbol().Msgid();
278 });
279 if(it == plugs.end())
280 continue;
281
282 auto plug = *it;
283 if(plug->IsEffectInteractive())
284 groupNames.push_back(name + XO("..."));
285 else
286 groupNames.push_back( name );
287
288 groupPlugs.push_back(plug->GetID());
289 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
290 }
291
292 if (!groupNames.empty())
293 {
294 using namespace MenuRegistry;
295 if (p.first.empty()) {
296 auto temp = Items("");
298 groupNames, groupPlugs, groupFlags,
299 onMenuCommand);
300 items.push_back(move(temp));
301 }
302 else {
303 auto temp = Menu("", p.first);
305 groupNames, groupPlugs, groupFlags,
306 onMenuCommand);
307 items.push_back(move(temp));
308 }
309 }
310 }
311 };
312}
bool TranslationLess(const TranslatableString &a, const TranslatableString &b)
A commonly needed sort comparator, which depends on the language setting.
Has variadic and range constructors that check types.
Definition: Registry.h:292

References AddEffectMenuItemGroup(), FixBatchFlags(), MenuRegistry::Items, MenuRegistry::Menu, name, Composite::Builder< Base, Derived, BaseArgs >::push_back(), TranslationLess(), and XO().

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ MakeGroupsFilter()

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

Definition at line 542 of file MenuHelper.cpp.

543{
544 return [=](const PluginDescriptor* plug)
545 {
546 if(!IsEnabledPlugin(plug))
547 return false;
548
549 for(auto& p : list)
550 {
551 for(auto& name : p.second)
552 {
553 if(name == plug->GetSymbol().Msgid())
554 return true;
555 }
556 }
557 return false;
558 };
559}
bool IsEnabledPlugin(const PluginDescriptor *plug)
Definition: MenuHelper.cpp:515

References IsEnabledPlugin(), and name.

Referenced by MenuHelper::PopulateEffectsMenu().

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