MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / Regenerate

Method Regenerate

src/menu.cpp:454–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452 };
453
454 void Regenerate() {
455 for (auto item : all_items)
456 cm->Remove(item);
457
458 wxMenuItemList &items = GetMenuItems();
459 // Remove everything but automation manager and the separator
460 for (size_t i = items.size() - 1; i >= 2; --i)
461 Delete(items[i]);
462
463 auto macros = config::global_scripts->GetMacros();
464 boost::push_back(macros, c->local_scripts->GetMacros());
465 if (macros.empty()) {
466 Append(-1, _("No Automation macros loaded"))->Enable(false);
467 return;
468 }
469
470 WorkItem top("");
471 for (auto macro : macros) {
472 const auto name = from_wx(macro->StrMenu(c));
473 WorkItem *parent = ⊤
474 for (auto section : agi::Split(name, wxS('/'))) {
475 std::string sectionname(section.begin(), section.end());
476
477 if (section.end() == std::string_view(name).end()) {
478 parent->subitems.emplace_back(sectionname, macro);
479 }
480 else {
481 parent = parent->FindOrMakeSubitem(sectionname);
482 }
483 }
484 }
485 top.Sort();
486 top.GenerateMenu(this, this);
487 }
488public:
489 AutomationMenu(agi::Context *c, CommandManager *cm)
490 : c(c)

Callers

nothing calls this directly

Calls 11

from_wxFunction · 0.85
SplitFunction · 0.85
StrMenuMethod · 0.80
FindOrMakeSubitemMethod · 0.80
GenerateMenuMethod · 0.80
RemoveMethod · 0.45
sizeMethod · 0.45
GetMacrosMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
SortMethod · 0.45

Tested by

no test coverage detected