| 603 | } |
| 604 | |
| 605 | std::shared_ptr<Macro> |
| 606 | MacroTreeModel::FindEndOfGroup(const std::shared_ptr<Macro> &m, |
| 607 | bool above) const |
| 608 | { |
| 609 | auto endOfGroup = Neighbor(m, above); |
| 610 | if (!endOfGroup) { |
| 611 | return m; |
| 612 | } |
| 613 | |
| 614 | if (above) { |
| 615 | while (!endOfGroup->IsGroup()) { |
| 616 | endOfGroup = Neighbor(endOfGroup, above); |
| 617 | } |
| 618 | } else { |
| 619 | while (endOfGroup->IsSubitem() && |
| 620 | GetItemMacroIndex(endOfGroup) + 1 != |
| 621 | (int)_macros.size()) { |
| 622 | endOfGroup = Neighbor(endOfGroup, above); |
| 623 | } |
| 624 | if (!endOfGroup->IsSubitem()) { |
| 625 | endOfGroup = Neighbor(endOfGroup, !above); |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | return endOfGroup; |
| 630 | } |
| 631 | |
| 632 | std::shared_ptr<Macro> MacroTreeModel::GetCurrentMacro() const |
| 633 | { |