Initialize SCH_SHEET members earlier.

m_borderWidth is used for autoplacing fields.
Fixes sheet filename being in extreme locations in some cases.
This commit is contained in:
Alex Shvartzkop 2024-01-15 19:52:52 +03:00
parent d3f40dde3f
commit ad7258721b
1 changed files with 11 additions and 11 deletions

View File

@ -83,6 +83,11 @@ SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, VECTOR2I aSize,
m_size = aSize;
m_screen = nullptr;
m_borderWidth = 0;
m_borderColor = COLOR4D::UNSPECIFIED;
m_backgroundColor = COLOR4D::UNSPECIFIED;
m_fieldsAutoplaced = aAutoplaceFields;
for( int i = 0; i < SHEET_MANDATORY_FIELDS; ++i )
{
m_fields.emplace_back( aPos, i, this, GetDefaultFieldName( i ) );
@ -96,12 +101,7 @@ SCH_SHEET::SCH_SHEET( EDA_ITEM* aParent, const VECTOR2I& aPos, VECTOR2I aSize,
m_fields.back().SetLayer( LAYER_SHEETFIELDS );
}
m_fieldsAutoplaced = aAutoplaceFields;
AutoAutoplaceFields( nullptr );
m_borderWidth = 0;
m_borderColor = COLOR4D::UNSPECIFIED;
m_backgroundColor = COLOR4D::UNSPECIFIED;
}
@ -116,6 +116,11 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
m_fieldsAutoplaced = aSheet.m_fieldsAutoplaced;
m_screen = aSheet.m_screen;
m_borderWidth = aSheet.m_borderWidth;
m_borderColor = aSheet.m_borderColor;
m_backgroundColor = aSheet.m_backgroundColor;
m_instances = aSheet.m_instances;
for( SCH_SHEET_PIN* pin : aSheet.m_pins )
{
m_pins.emplace_back( new SCH_SHEET_PIN( *pin ) );
@ -125,11 +130,6 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
for( SCH_FIELD& field : m_fields )
field.SetParent( this );
m_borderWidth = aSheet.m_borderWidth;
m_borderColor = aSheet.m_borderColor;
m_backgroundColor = aSheet.m_backgroundColor;
m_instances = aSheet.m_instances;
if( m_screen )
m_screen->IncRefCount();
}