Eeschema Eagle Import: fixed name and reference fields placement

This commit is contained in:
Maciej Suminski 2017-10-18 10:33:51 +02:00
parent 62156b9b69
commit b77ba486ec
2 changed files with 25 additions and 22 deletions

View File

@ -1368,28 +1368,17 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
{
std::unique_ptr<LIB_TEXT> libtext( loadSymbolText( aPart, currentNode, aGateNumber ) );
LIB_FIELD* field;
if( libtext->GetText().Upper() ==">NAME" || libtext->GetText().Upper() == ">VALUE" )
if( libtext->GetText().Upper() ==">NAME" )
{
if( libtext->GetText().Upper() ==">NAME" )
{
field = aPart->GetField( REFERENCE );
foundName = true;
}
else
{
field = aPart->GetField( REFERENCE );
foundValue = true;
}
field->SetTextPos( libtext->GetPosition() );
field->SetTextSize( libtext->GetTextSize() );
field->SetTextAngle( libtext->GetTextAngle() );
field->SetBold( libtext->IsBold() );
field->SetVertJustify( libtext->GetVertJustify() );
field->SetHorizJustify( libtext->GetHorizJustify() );
field->SetVisible( true );
LIB_FIELD* field = aPart->GetField( REFERENCE );
loadFieldAttributes( field, libtext.get() );
foundName = true;
}
else if( libtext->GetText().Upper() ==">VALUE" )
{
LIB_FIELD* field = aPart->GetField( VALUE );
loadFieldAttributes( field, libtext.get() );
foundValue = true;
}
else
{
@ -1630,7 +1619,7 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr<LIB_PART>& aPart,
}
}
// emaulate the visibility of pin elements
// emulate the visibility of pin elements
if( aEPin->visible )
{
wxString visible = aEPin->visible.Get();
@ -1730,6 +1719,18 @@ void SCH_EAGLE_PLUGIN::loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttrib
}
void SCH_EAGLE_PLUGIN::loadFieldAttributes( LIB_FIELD* aField, const LIB_TEXT* aText ) const
{
aField->SetTextPos( aText->GetPosition() );
aField->SetTextSize( aText->GetTextSize() );
aField->SetTextAngle( aText->GetTextAngle() );
aField->SetBold( aText->IsBold() );
aField->SetVertJustify( aText->GetVertJustify() );
aField->SetHorizJustify( aText->GetHorizJustify() );
aField->SetVisible( true );
}
bool SCH_EAGLE_PLUGIN::CheckHeader( const wxString& aFileName )
{
// Open file and check first line

View File

@ -53,6 +53,7 @@ class LIB_PART;
class PART_LIB;
class LIB_ALIAS;
class LIB_CIRCLE;
class LIB_FIELD;
class LIB_RECTANGLE;
class LIB_POLYLINE;
class LIB_PIN;
@ -169,6 +170,7 @@ private:
LIB_TEXT* loadSymbolText( std::unique_ptr<LIB_PART>& aPart, wxXmlNode* aLibText, int aGateNumber );
void loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttribs ) const;
void loadFieldAttributes( LIB_FIELD* aField, const LIB_TEXT* aText ) const;
KIWAY* m_kiway; ///< For creating sub sheets.
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..