From a8cb0ee11699e85f5f085323f44b84b5c0196113 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 4 Dec 2022 17:20:34 -0500 Subject: [PATCH] Properties: Use insertion order as display order --- common/properties/property_mgr.cpp | 4 ++-- include/properties/property_mgr.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/properties/property_mgr.cpp b/common/properties/property_mgr.cpp index cf26f8d1b1..66588bee2a 100644 --- a/common/properties/property_mgr.cpp +++ b/common/properties/property_mgr.cpp @@ -136,6 +136,7 @@ void PROPERTY_MANAGER::AddProperty( PROPERTY_BASE* aProperty, const wxString& aG TYPE_ID hash = aProperty->OwnerHash(); CLASS_DESC& classDesc = getClass( hash ); classDesc.m_ownProperties.emplace( name, aProperty ); + classDesc.m_ownDisplayOrder.emplace_back( aProperty ); aProperty->SetGroup( aGroup ); @@ -301,9 +302,8 @@ void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult, int idx = 0; - for( const std::pair>& prop : m_ownProperties ) + for( PROPERTY_BASE* property : m_ownDisplayOrder ) { - PROPERTY_BASE* property = prop.second.get(); PROPERTY_SET::key_type propertyKey = std::make_pair( property->OwnerHash(), property->Name() ); // Do not store replaced properties diff --git a/include/properties/property_mgr.h b/include/properties/property_mgr.h index ac54719a1b..9fd4931956 100644 --- a/include/properties/property_mgr.h +++ b/include/properties/property_mgr.h @@ -252,10 +252,16 @@ private: ///< All properties (both unique to the type and inherited) std::vector m_allProperties; + ///< Compiled display order for all properties PROPERTY_DISPLAY_ORDER m_displayOrder; + ///< List of property groups provided by this class in display order std::vector m_groupDisplayOrder; + ///< Non-owning list of classes's direct properties in display order + std::vector m_ownDisplayOrder; + + ///< The property groups provided by this class std::set m_groups; ///< Replaced properties (TYPE_ID / name)