From 9b2f1ad0b105fe8487a6b2e0c28e84e59cf1586f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Thu, 1 Dec 2022 23:18:42 -0500 Subject: [PATCH] Properties: show base class groups --- common/properties/property_mgr.cpp | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/common/properties/property_mgr.cpp b/common/properties/property_mgr.cpp index 3c0510de55..c7aae8a6f4 100644 --- a/common/properties/property_mgr.cpp +++ b/common/properties/property_mgr.cpp @@ -239,6 +239,37 @@ void PROPERTY_MANAGER::CLASS_DESC::rebuild() collectPropsRecur( m_allProperties, replaced, m_displayOrder, m_maskedBaseProperties ); // We need to keep properties sorted to be able to use std::set_* functions sort( m_allProperties.begin(), m_allProperties.end() ); + + std::vector displayOrder; + std::set groups; + + auto collectGroups = + [&]( std::set& aSet, std::vector& aResult ) + { + auto collectGroupsRecursive = + []( auto& aSelf, std::set& aSetR, std::vector& aResultR, + const CLASS_DESC& aClassR ) -> void + { + for( const wxString& group : aClassR.m_groups ) + { + if( !aSetR.count( group ) ) + { + aSetR.insert( group ); + aResultR.emplace_back( group ); + } + } + + for( const CLASS_DESC& base : aClassR.m_bases ) + aSelf( aSelf, aSetR, aResultR, base ); + }; + + collectGroupsRecursive( collectGroupsRecursive, aSet, aResult, *this ); + }; + + // TODO(JE): This currently relies on rebuild() happening after all properties are added + // separate out own groups vs. all groups to fix + collectGroups( groups, displayOrder ); + m_groupDisplayOrder = displayOrder; }