From c1515dd31caaab11c2cca951c8d667fc7a356e21 Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Fri, 29 Oct 2021 18:59:07 +0100 Subject: [PATCH] CADSTAR Sch: Fix block names - load as stand-alone text items instead KiCad doesn't support multi-line text in fields, so we can't load it as a text field (even if that would be the closest thing). We should update this when KiCad supports multi-line text in fields. --- .../cadstar/cadstar_sch_archive_loader.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp index 99115481a9..83553c745e 100644 --- a/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp +++ b/eeschema/sch_plugins/cadstar/cadstar_sch_archive_loader.cpp @@ -2201,6 +2201,8 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID, if( block.HasBlockLabel ) { + //@todo use below code when KiCad supports multi-line fields + /* // Add the block label as a separate field SCH_FIELD blockNameField( getKiCadPoint( block.BlockLabel.Position ), 2, loadedSheet, wxString( "Block name" ) ); @@ -2214,7 +2216,23 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadChildSheets( LAYER_ID aCadstarSheetID, block.BlockLabel.OrientAngle, block.BlockLabel.Mirror ); - fields.push_back( blockNameField ); + fields.push_back( blockNameField );*/ + + // For now as as a text item (supports multi-line properly) + SCH_TEXT* kiTxt = new SCH_TEXT(); + + kiTxt->SetParent( m_schematic ); + kiTxt->SetPosition( getKiCadPoint( block.BlockLabel.Position ) ); + kiTxt->SetText( block.Name ); + + applyTextSettings( kiTxt, + block.BlockLabel.TextCodeID, + block.BlockLabel.Alignment, + block.BlockLabel.Justification, + block.BlockLabel.OrientAngle, + block.BlockLabel.Mirror ); + + loadItemOntoKiCadSheet( aCadstarSheetID, kiTxt ); } loadedSheet->SetFields( fields );