Fix malformed symbol libraries when importing Eagle schematics.
KiCad library symbol text objects cannot contain carriage returns and/or line feeds which isn't the case with Eagle symbol libraries. Otherwise, the library file will be corrupt when it is saved. Fixing this in the legacy plugin would break the current file format so just replace them with underscores. Ideally these text objects should be broken into multiple text objects but the current plugin design doesn't support this.
This commit is contained in:
parent
dcb75a9b24
commit
d5290bdfe0
|
@ -1672,7 +1672,17 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymbolText( std::unique_ptr<LIB_PART>& aPart,
|
|||
|
||||
libtext->SetUnit( aGateNumber );
|
||||
libtext->SetPosition( wxPoint( etext.x.ToSchUnits(), etext.y.ToSchUnits() ) );
|
||||
libtext->SetText( aLibText->GetNodeContent().IsEmpty() ? "~~" : aLibText->GetNodeContent() );
|
||||
|
||||
// Eagle supports multiple line text in library symbols. Legacy library symbol text cannot
|
||||
// contain CRs or LFs.
|
||||
//
|
||||
// @todo Split this into multiple text objects and offset the Y position so that it looks
|
||||
// more like the original Eagle schematic.
|
||||
wxString text = aLibText->GetNodeContent();
|
||||
std::replace( text.begin(), text.end(), '\n', '_' );
|
||||
std::replace( text.begin(), text.end(), '\r', '_' );
|
||||
|
||||
libtext->SetText( text.IsEmpty() ? "~~" : text );
|
||||
loadTextAttributes( libtext.get(), etext );
|
||||
|
||||
return libtext.release();
|
||||
|
|
Loading…
Reference in New Issue