Remove "Order" field hack (partly reverts da1a89fc)

This commit is contained in:
Roberto Fernandez Bautista 2020-11-28 23:26:51 +00:00 committed by Wayne Stambaugh
parent dadfe03804
commit afcaa60faa
2 changed files with 4 additions and 30 deletions

View File

@ -967,36 +967,10 @@ void SCH_SCREEN::GetSheets( std::vector<SCH_ITEM*>* aItems )
std::sort( aItems->begin(), aItems->end(), std::sort( aItems->begin(), aItems->end(),
[]( EDA_ITEM* a, EDA_ITEM* b ) -> bool []( EDA_ITEM* a, EDA_ITEM* b ) -> bool
{ {
long a_order = 0; if( a->GetPosition().x == b->GetPosition().x )
long b_order = 0; return a->GetPosition().y < b->GetPosition().y;
else
for( const SCH_FIELD& field : static_cast<SCH_SHEET*>( a )->GetFields() )
{
if( field.GetName().CmpNoCase( wxT( "Order" ) ) == 0 )
{
field.GetText().ToLong( &a_order );
break;
}
}
for( const SCH_FIELD& field : static_cast<SCH_SHEET*>( b )->GetFields() )
{
if( field.GetName().CmpNoCase( wxT( "Order" ) ) == 0 )
{
field.GetText().ToLong( &b_order );
break;
}
}
if( a_order == b_order )
{
if( a->GetPosition().x == b->GetPosition().x )
return a->GetPosition().y < b->GetPosition().y;
return a->GetPosition().x < b->GetPosition().x; return a->GetPosition().x < b->GetPosition().x;
}
return a_order < b_order;
} ); } );
} }

View File

@ -412,7 +412,7 @@ public:
void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems ); void GetHierarchicalItems( std::vector<SCH_ITEM*>* aItems );
/** /**
* Similar to GetItems().OfType( SCH_SHEET_T ), but return the sheets in a * Similar to Items().OfType( SCH_SHEET_T ), but return the sheets in a
* deterministic order (L-R, T-B) for sheet numbering. * deterministic order (L-R, T-B) for sheet numbering.
* @param aItems * @param aItems
*/ */