Properties: fix display ordering

This commit is contained in:
Jon Evans 2022-12-02 22:17:08 -05:00
parent 050d282c12
commit 3cf3d15590
1 changed files with 14 additions and 2 deletions

View File

@ -285,8 +285,20 @@ void PROPERTY_MANAGER::CLASS_DESC::collectPropsRecur( PROPERTY_LIST& aResult,
* We want to insert our own properties in forward order, but earlier than anything already in
* the list (which will have been added by a subclass of us)
*/
int displayOrderStart = aResult.empty() ? 0 :
aDisplayOrder.begin()->second - m_ownProperties.size();
int displayOrderStart = 0;
if( !aDisplayOrder.empty() )
{
int firstSoFar = std::min_element( aDisplayOrder.begin(), aDisplayOrder.end(),
[]( const std::pair<PROPERTY_BASE*, int>& aFirst,
const std::pair<PROPERTY_BASE*, int>& aSecond )
{
return aFirst.second < aSecond.second;
} )->second;
displayOrderStart = firstSoFar - m_ownProperties.size();
}
int idx = 0;
for( const std::pair<const wxString, std::unique_ptr<PROPERTY_BASE>>& prop : m_ownProperties )