Eeschema: adjusted component sorting to work better
This commit is contained in:
parent
46b72d807b
commit
469c1c14ef
|
@ -406,6 +406,29 @@ void SCH_BUS_ENTRY_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aLi
|
|||
}
|
||||
|
||||
|
||||
bool SCH_BUS_ENTRY_BASE::operator <( const SCH_ITEM& aItem ) const
|
||||
{
|
||||
if( Type() != aItem.Type() )
|
||||
return Type() < aItem.Type();
|
||||
|
||||
auto component = static_cast<const SCH_BUS_ENTRY_BASE*>( &aItem );
|
||||
|
||||
if( GetLayer() != component->GetLayer() )
|
||||
return GetLayer() < component->GetLayer();
|
||||
|
||||
if( GetPosition().x != component->GetPosition().x )
|
||||
return GetPosition().x < component->GetPosition().x;
|
||||
|
||||
if( GetPosition().y != component->GetPosition().y )
|
||||
return GetPosition().y < component->GetPosition().y;
|
||||
|
||||
if( m_End().x != component->m_End().x )
|
||||
return m_End().x < component->m_End().x;
|
||||
|
||||
return m_End().y < component->m_End().y;
|
||||
}
|
||||
|
||||
|
||||
bool SCH_BUS_WIRE_ENTRY::ConnectionPropagatesTo( const EDA_ITEM* aItem ) const
|
||||
{
|
||||
// Don't generate connections between bus entries and buses, since there is
|
||||
|
|
|
@ -111,6 +111,8 @@ public:
|
|||
|
||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
bool operator <( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
|
|
@ -498,3 +498,26 @@ wxPoint SCH_FIELD::GetPosition() const
|
|||
|
||||
return component->GetTransform().TransformCoordinate( pos ) + component->GetPosition();
|
||||
}
|
||||
|
||||
|
||||
bool SCH_FIELD::operator <( const SCH_ITEM& aItem ) const
|
||||
{
|
||||
if( Type() != aItem.Type() )
|
||||
return Type() < aItem.Type();
|
||||
|
||||
auto field = static_cast<const SCH_FIELD*>( &aItem );
|
||||
|
||||
if( GetId() != field->GetId() )
|
||||
return GetId() < field->GetId();
|
||||
|
||||
if( GetText() != field->GetText() )
|
||||
return GetText() < field->GetText();
|
||||
|
||||
if( GetLibPosition().x != field->GetLibPosition().x )
|
||||
return GetLibPosition().x < field->GetLibPosition().x;
|
||||
|
||||
if( GetLibPosition().y != field->GetLibPosition().y )
|
||||
return GetLibPosition().y < field->GetLibPosition().y;
|
||||
|
||||
return GetName() < field->GetName();
|
||||
}
|
||||
|
|
|
@ -201,6 +201,8 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
bool operator <( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
|
|
@ -692,16 +692,19 @@ bool SCH_LINE::operator <( const SCH_ITEM& aItem ) const
|
|||
|
||||
auto line = static_cast<const SCH_LINE*>( &aItem );
|
||||
|
||||
if( GetLength() != line->GetLength() )
|
||||
return GetLength() < line->GetLength();
|
||||
if( GetLayer() != line->GetLayer() )
|
||||
return GetLayer() < line->GetLayer();
|
||||
|
||||
if( m_start.x != line->m_start.x )
|
||||
return m_start.x < line->m_start.x;
|
||||
if( GetStartPoint().x != line->GetStartPoint().x )
|
||||
return GetStartPoint().x < line->GetStartPoint().x;
|
||||
|
||||
if( m_start.y != line->m_start.y )
|
||||
return m_start.y < line->m_start.y;
|
||||
if( GetStartPoint().y != line->GetStartPoint().y )
|
||||
return GetStartPoint().y < line->GetStartPoint().y;
|
||||
|
||||
return false;
|
||||
if( GetEndPoint().x != line->GetEndPoint().x )
|
||||
return GetEndPoint().x < line->GetEndPoint().x;
|
||||
|
||||
return GetEndPoint().y < line->GetEndPoint().y;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -971,6 +971,23 @@ SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_SHEET::operator <( const SCH_ITEM& aItem ) const
|
||||
{
|
||||
if( Type() != aItem.Type() )
|
||||
return Type() < aItem.Type();
|
||||
|
||||
auto sheet = static_cast<const SCH_SHEET*>( &aItem );
|
||||
|
||||
if (m_name != sheet->m_name)
|
||||
return m_name < sheet->m_name;
|
||||
|
||||
if (m_fileName != sheet->m_fileName)
|
||||
return m_fileName < sheet->m_fileName;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void SCH_SHEET::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -534,6 +534,8 @@ public:
|
|||
|
||||
SCH_SHEET& operator=( const SCH_ITEM& aSheet );
|
||||
|
||||
bool operator <( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
wxPoint GetPosition() const override { return m_pos; }
|
||||
|
|
|
@ -270,6 +270,8 @@ bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
|
|||
|
||||
auto other = static_cast<const SCH_TEXT*>( &aItem );
|
||||
|
||||
if( GetLayer() != other->GetLayer() )
|
||||
return GetLayer() < other->GetLayer();
|
||||
|
||||
if( GetPosition().x != other->GetPosition().x )
|
||||
return GetPosition().x < other->GetPosition().x;
|
||||
|
|
Loading…
Reference in New Issue