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 MenuOrItems (const TranslatableString &label) -> std::unique_ptr< MenuHelper::Group >
 
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 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 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],
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],
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.
void push_back(value_type ptr)
Definition: Composite.h:62
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 Menu
Items will appear in a main toolbar menu or in a sub-menu.
constexpr auto Command
Options && IsEffect(bool value=true) &&
Options && Parameter(const CommandParameter &value) &&
Options && AllowInMacros(int value=1) &&

References CommandManager::Options::AllowInMacros(), MenuTable::Command, PluginManager::Get(), PluginDescriptor::GetID(), PluginDescriptor::GetPath(), PluginManager::GetPlugin(), PluginDescriptor::GetPluginType(), CommandManager::Options::IsEffect(), MenuTable::Menu, name, names, CommandManager::Options::Parameter(), PluginTypeEffect, Composite::Base< Component, ComponentPointer, ComponentArgs >::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 MenuTable;
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 if(names.empty())
336 return;
337
338 const auto inSubmenu = !path.empty() && (names.size() > 1);
339 auto items = MenuOrItems(inSubmenu ? path.back() : TranslatableString{});
340 AddEffectMenuItemGroup(*items, names, group, flags, onMenuCommand);
341 parentTable->push_back(move(items));
342
343 names.clear();
344 group.clear();
345 flags.clear();
346 };
347
348 for(auto plug : plugs)
349 {
350 if(groupBy == GroupBy::Publisher)
351 {
352 const auto vendorName = effectManager.GetVendorName(plug->GetID());
353 if(path.empty() || path[0] != vendorName)
354 {
355 doAddGroup();
356 path = { vendorName };
357 }
358 }
359 else if(groupBy == GroupBy::Type)
360 {
361 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
362 if(path.empty() || path[0] != effectFamilyName)
363 {
364 doAddGroup();
365 path = { effectFamilyName };
366 }
367 }
368 else if(groupBy == GroupBy::TypePublisher)
369 {
370 const auto effectFamilyName = effectManager.GetEffectFamilyName(plug->GetID());
371 const auto vendorName = effectManager.GetVendorName(plug->GetID());
372 if(path.empty() || path[0] != effectFamilyName)
373 {
374 doAddGroup();
375 path = { effectFamilyName, vendorName };
376 auto menu = Menu("", effectFamilyName);
377 parentTable = menu.get();
378 table.push_back(move(menu));
379 }
380 else if(path[1] != vendorName)
381 {
382 doAddGroup();
383 path[1] = vendorName;
384 }
385 }
386
387 group.push_back(plug->GetID());
388 names.push_back(plug->GetSymbol().Msgid());
389 flags.push_back(FixBatchFlags( batchflags, plug ) );
390 }
391 doAddGroup();
392}
XO("Cut/Copy/Paste")
wxArrayString PluginIDs
Definition: Menus.h:33
static EffectManager & Get()
Holds a msgid for the translation catalog; may also bind format arguments.
auto MenuOrItems(const TranslatableString &label) -> std::unique_ptr< MenuHelper::Group >
Definition: MenuHelper.cpp:257
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(), FixBatchFlags(), EffectManager::Get(), MenuTable::Menu, MenuOrItems(), names, Composite::Base< Component, ComponentPointer, ComponentArgs >::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 482 of file MenuHelper.cpp.

483{
484 auto &em = EffectManager::Get();
485 auto aType = em.GetEffectFamilyName(a->GetID());
486 auto bType = em.GetEffectFamilyName(b->GetID());
487 auto aVendor = em.GetVendorName(a->GetID());
488 auto bVendor = em.GetVendorName(b->GetID());
489
490 if (aType.empty())
491 aType = XO("Uncategorized");
492 if (bType.empty())
493 bType = XO("Uncategorized");
494 if (aVendor.empty())
495 aVendor = XO("Unknown");
496 if (bVendor.empty())
497 bVendor = XO("Unknown");
498
499 return
500 std::make_tuple(
501 aType.Translation(), aVendor.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
502 std::make_tuple(
503 bType.Translation(), bVendor.Translation(), b->GetSymbol().Translation(), b->GetPath() );
504}
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 394 of file MenuHelper.cpp.

395{
396 return
397 std::make_pair( a->GetSymbol().Translation(), a->GetPath() ) <
398 std::make_pair( b->GetSymbol().Translation(), b->GetPath() );
399}

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 401 of file MenuHelper.cpp.

403{
404 auto &em = EffectManager::Get();
405
406 auto akey = em.GetVendorName(a->GetID());
407 auto bkey = em.GetVendorName(b->GetID());
408
409 if (akey.empty())
410 akey = XO("Uncategorized");
411 if (bkey.empty())
412 bkey = XO("Uncategorized");
413
414 return
415 std::make_tuple(
416 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
417 std::make_tuple(
418 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
419}

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 421 of file MenuHelper.cpp.

423{
424 auto &em = EffectManager::Get();
425 auto akey = em.GetVendorName(a->GetID());
426 auto bkey = em.GetVendorName(b->GetID());
427
428 if (a->IsEffectDefault())
429 akey = {};
430 if (b->IsEffectDefault())
431 bkey = {};
432
433 return
434 std::make_tuple(
435 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
436 std::make_tuple(
437 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
438}

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 464 of file MenuHelper.cpp.

465{
466 auto &em = EffectManager::Get();
467 auto akey = em.GetEffectFamilyName(a->GetID());
468 auto bkey = em.GetEffectFamilyName(b->GetID());
469
470 if (akey.empty())
471 akey = XO("Uncategorized");
472 if (bkey.empty())
473 bkey = XO("Uncategorized");
474
475 return
476 std::make_tuple(
477 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
478 std::make_tuple(
479 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
480}

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 440 of file MenuHelper.cpp.

442{
443 auto &em = EffectManager::Get();
444 auto akey = em.GetEffectFamilyName(a->GetID());
445 auto bkey = em.GetEffectFamilyName(b->GetID());
446
447 if (akey.empty())
448 akey = XO("Uncategorized");
449 if (bkey.empty())
450 bkey = XO("Uncategorized");
451
452 if (a->IsEffectDefault())
453 akey = {};
454 if (b->IsEffectDefault())
455 bkey = {};
456
457 return
458 std::make_tuple(
459 akey.Translation(), a->GetSymbol().Translation(), a->GetPath() ) <
460 std::make_tuple(
461 bkey.Translation(), b->GetSymbol().Translation(), b->GetPath() );
462}

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 531 of file MenuHelper.cpp.

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

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 516 of file MenuHelper.cpp.

517{
518 if (plug->IsEffectDefault()
519#ifdef EXPERIMENTAL_DA
520 // Move Nyquist prompt into nyquist group.
521 && (plug->GetSymbol() !=
522 ComponentInterfaceSymbol("Nyquist Effects Prompt"))
523 && (plug->GetSymbol() != ComponentInterfaceSymbol("Nyquist Tools Prompt"))
525#endif
526 )
527 return true;
528 return false;
529}
#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 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 506 of file MenuHelper.cpp.

507{
508 if( PluginManager::Get().IsPluginLoaded(plug->GetID()) && EffectManager::Get().IsHidden(plug->GetID()) )
509 return false;
510 if ( !plug->IsEnabled() ){
511 return false;// don't add to menus!
512 }
513 return true;
514}
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 267 of file MenuHelper.cpp.

271{
272 return [=](MenuHelper::Group& items, std::vector<const PluginDescriptor*>& plugs)
273 {
274 for(auto& p : list)
275 {
276 TranslatableStrings groupNames;
277 PluginIDs groupPlugs;
278 std::vector<CommandFlag> groupFlags;
279
280 auto srcNames = p.second;
281 std::sort(srcNames.begin(), srcNames.end(), TranslationLess);
282
283 for(auto& name : srcNames)
284 {
285 auto it = std::find_if(plugs.begin(), plugs.end(), [&name](const PluginDescriptor* other)
286 {
287 return name == other->GetSymbol().Msgid();
288 });
289 if(it == plugs.end())
290 continue;
291
292 auto plug = *it;
293 if(plug->IsEffectInteractive())
294 groupNames.push_back(name + XO("..."));
295 else
296 groupNames.push_back( name );
297
298 groupPlugs.push_back(plug->GetID());
299 groupFlags.push_back(FixBatchFlags( batchflags, plug ) );
300 }
301
302 if (!groupNames.empty())
303 {
304 auto temp = MenuOrItems(p.first);
306 groupNames, groupPlugs, groupFlags,
307 onMenuCommand);
308 items.push_back(move(temp));
309 }
310 }
311 };
312}
bool TranslationLess(const TranslatableString &a, const TranslatableString &b)
A commonly needed sort comparator, which depends on the language setting.
Common abstract base class for items that group other items.
Definition: Registry.h:170

References AddEffectMenuItemGroup(), FixBatchFlags(), MenuOrItems(), name, Composite::Base< Component, ComponentPointer, ComponentArgs >::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 541 of file MenuHelper.cpp.

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

References IsEnabledPlugin(), and name.

Referenced by MenuHelper::PopulateEffectsMenu().

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

◆ MenuOrItems()

auto anonymous_namespace{MenuHelper.cpp}::MenuOrItems ( const TranslatableString label) -> std::unique_ptr<MenuHelper::Group>

Definition at line 257 of file MenuHelper.cpp.

259{
260 using namespace MenuTable;
261 if (label.empty())
262 return Items("");
263 else
264 return Menu("", label);
265}
TranslatableString label
Definition: TagsEditor.cpp:165
constexpr auto Items

References TranslatableString::empty(), MenuTable::Items, label, and MenuTable::Menu.

Referenced by AddGroupedEffectMenuItems(), and MakeAddGroupItems().

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