| 627 | const GroupItemBase *pToMerge, const OrderingHint &hint, |
| 628 | bool &doFlush, void *pComputedItemContext); |
| 629 | void VisitItems( |
| 630 | VisitorBase &visitor, CollectedItems &collection, |
| 631 | Path &path, const GroupItemBase &group, |
| 632 | const GroupItemBase *pToMerge, const OrderingHint &hint, |
| 633 | bool &doFlush, void *pComputedItemContext) |
| 634 | { |
| 635 | // Make a NEW collection for this subtree, sharing the memo cache |
| 636 | CollectedItems newCollection{ {}, collection.computedItems }; |
| 637 | |
| 638 | // Gather items at this level |
| 639 | // (The ordering hint is irrelevant when not merging items in) |
| 640 | CollectItems(newCollection, group, {}, |
| 641 | pComputedItemContext); |
| 642 | |
| 643 | path.push_back(group.name.GET()); |
| 644 | |
| 645 | // Merge with the registry |
| 646 | if ( pToMerge ) |
| 647 | { |
| 648 | ItemOrdering itemOrdering{ path }; |
| 649 | newCollection.MergeItems(itemOrdering, *pToMerge, hint, |
| 650 | pComputedItemContext); |
| 651 | |
| 652 | // Remember the NEW ordering, if there was any need to use the old. |
| 653 | // This makes a side effect in preferences. |
| 654 | if ( itemOrdering.gotOrdering ) { |
| 655 | wxString newValue; |
| 656 | for ( const auto &item : newCollection.items ) { |
| 657 | const auto &name = item.visitNow->name; |
| 658 | if ( !name.empty() ) |
| 659 | newValue += newValue.empty() |
| 660 | ? name.GET() |
| 661 | : ',' + name.GET(); |
| 662 | } |
| 663 | if (newValue != itemOrdering.strValue) { |
| 664 | gPrefs->Write( itemOrdering.key, newValue ); |
| 665 | doFlush = true; |
| 666 | } |
| 667 | } |
| 668 | } |
| 669 | |
| 670 | // Now visit them |
| 671 | for ( const auto &item : newCollection.items ) |
| 672 | VisitItem(visitor, collection, path, |
| 673 | item.visitNow, item.mergeLater, item.hint, |
| 674 | doFlush, pComputedItemContext); |
| 675 | |
| 676 | path.pop_back(); |
| 677 | } |
| 678 | void VisitItem( |
| 679 | VisitorBase &visitor, CollectedItems &collection, |
| 680 | Path &path, const BaseItem *pItem, |
no test coverage detected