Eeschema: Eagle Plugin: Add loadSymboltext, and position default symbol texts.
This commit is contained in:
parent
04c7fbebdc
commit
75d9185e4a
|
@ -37,6 +37,7 @@
|
|||
#include <lib_rectangle.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_text.h>
|
||||
|
||||
#include <eagle_parser.h>
|
||||
|
||||
|
@ -649,7 +650,24 @@ LIB_PART* SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode )
|
|||
}
|
||||
else if( nodeName == "text" )
|
||||
{
|
||||
// part->AddDrawItem( loadText( part, currentNode ) );
|
||||
LIB_TEXT* libtext = loadSymboltext( part.get(), currentNode );
|
||||
|
||||
if( libtext->GetText() ==">NAME" )
|
||||
{
|
||||
auto field = part->GetReferenceField();
|
||||
field.SetOffset( libtext->GetPosition() );
|
||||
field.SetTextSize( libtext->GetTextSize() );
|
||||
field.SetTextAngle( libtext->GetTextAngle() );
|
||||
}
|
||||
else if( libtext->GetText() == ">VALUE" )
|
||||
{
|
||||
auto field = part->GetValueField();
|
||||
field.SetOffset( libtext->GetPosition() );
|
||||
field.SetTextSize( libtext->GetTextSize() );
|
||||
field.SetTextAngle( libtext->GetTextAngle() );
|
||||
}
|
||||
//else
|
||||
// part->AddDrawItem( loadlibtext( part.get(), currentNode ) );
|
||||
}
|
||||
else if( nodeName == "wire" )
|
||||
{
|
||||
|
@ -787,6 +805,19 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( LIB_PART* aPart, wxXmlNode* aPin )
|
|||
return pin.release();
|
||||
}
|
||||
|
||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText )
|
||||
{
|
||||
std::unique_ptr<LIB_TEXT> libtext( new LIB_TEXT( aPart ) );
|
||||
|
||||
auto etext = ETEXT( aLibText );
|
||||
|
||||
libtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, -etext.y * EUNIT_TO_MIL ) );
|
||||
libtext->SetText( aLibText->GetNodeContent() );
|
||||
libtext->SetTextSize(wxSize(int(etext.size*EUNIT_TO_MIL), int(etext.size*EUNIT_TO_MIL)));
|
||||
|
||||
return libtext.release();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EAGLE_PLUGIN::Save( const wxString& aFileName, SCH_SCREEN* aSchematic, KIWAY* aKiway,
|
||||
const PROPERTIES* aProperties )
|
||||
|
|
|
@ -48,6 +48,7 @@ class LIB_CIRCLE;
|
|||
class LIB_RECTANGLE;
|
||||
class LIB_POLYLINE;
|
||||
class LIB_PIN;
|
||||
class LIB_TEXT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -127,6 +128,7 @@ private:
|
|||
LIB_POLYLINE* loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode* aRectNode );
|
||||
LIB_POLYLINE* loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNode );
|
||||
LIB_PIN* loadPin( LIB_PART*, wxXmlNode* );
|
||||
LIB_TEXT* loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText );
|
||||
|
||||
KIWAY* m_kiway; ///< For creating sub sheets.
|
||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
||||
|
|
Loading…
Reference in New Issue