Add macro group helper functions

This commit is contained in:
WarmUpTill
2025-12-09 18:54:14 +01:00
committed by WarmUpTill
parent 266e470509
commit 21c34356ed
4 changed files with 35 additions and 30 deletions

View File

@@ -147,20 +147,7 @@ void AdvSceneSwitcher::on_macroAdd_clicked()
static void addGroupSubitems(std::vector<std::shared_ptr<Macro>> &macros,
const std::shared_ptr<Macro> &group)
{
std::vector<std::shared_ptr<Macro>> subitems;
subitems.reserve(group->GroupSize());
// Find all subitems
auto allMacros = GetTopLevelMacros();
for (auto it = allMacros.begin(); it < allMacros.end(); it++) {
if ((*it)->Name() != group->Name()) {
continue;
}
for (uint32_t i = 1; i <= group->GroupSize(); i++) {
subitems.emplace_back(*std::next(it, i));
}
break;
}
auto subitems = GetGroupMacroEntries(group.get());
// Remove subitems which were already selected to avoid duplicates
for (const auto &subitem : subitems) {