Remove a few call sites of SCH_SHEET::SetSize

This function is dangerous and should be used only by parsers, and not even
those, really.

For new objects, the size can be passed to the constructor.
This commit is contained in:
Simon Richter 2022-04-18 07:57:35 +02:00
parent 26370583fa
commit 1e505d4c22
3 changed files with 12 additions and 6 deletions

View File

@ -424,8 +424,10 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
addItem( symbol );
}
SCH_SHEET* s = new SCH_SHEET( nullptr, MILS_POINT( 4000, 1300 ) );
s->SetSize( wxSize( Mils2iu( 800 ), Mils2iu( 1300 ) ) );
SCH_SHEET* s = new SCH_SHEET(
/* aParent */ nullptr,
/* aPosition */ MILS_POINT( 4000, 1300 ),
/* aSize */ wxSize( Mils2iu( 800 ), Mils2iu( 1300 ) ) );
s->GetFields().at( SHEETNAME ).SetText( wxT( "SHEET" ) );
s->GetFields().at( SHEETFILENAME ).SetText( _( "/path/to/sheet" ) );
s->AutoplaceFields( nullptr, false );

View File

@ -1457,10 +1457,12 @@ void SCH_ALTIUM_PLUGIN::ParseSheetSymbol( int aIndex,
{
ASCH_SHEET_SYMBOL elem( aProperties );
SCH_SHEET* sheet = new SCH_SHEET( m_currentSheet, elem.location + m_sheetOffset );
SCH_SHEET* sheet = new SCH_SHEET(
/* aParent */ m_currentSheet,
/* aPosition */ elem.location + m_sheetOffset,
/* aSize */ elem.size );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
sheet->SetSize( elem.size );
sheet->SetBorderColor( GetColorFromInt( elem.color ) );
if( elem.isSolid )

View File

@ -2141,11 +2141,13 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets( LAYER_ID
wxCHECK_MSG( m_sheetMap.find( aCadstarSheetID ) == m_sheetMap.end(), ,
"Sheet already loaded!" );
SCH_SHEET* sheet = new SCH_SHEET( aParentSheet.Last(), aPosition );
SCH_SHEET* sheet = new SCH_SHEET(
/* aParent */ aParentSheet.Last(),
/* aPosition */ aPosition,
/* aSize */ wxSize( aSheetSize ) );
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );
SCH_SHEET_PATH instance( aParentSheet );
sheet->SetSize( (wxSize) aSheetSize );
sheet->SetScreen( screen );
wxString name = Sheets.SheetNames.at( aCadstarSheetID );