Eeschema Eagle Import: WIP trying to fix indirect memory leaks
This commit is contained in:
parent
1fdb13daa6
commit
956ef0fa61
|
@ -491,9 +491,9 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
||||||
|
|
||||||
while( partNode )
|
while( partNode )
|
||||||
{
|
{
|
||||||
std::unique_ptr<EPART> epart( new EPART( partNode ) );
|
std::unique_ptr<EPART> epart( new EPART(partNode) );
|
||||||
const string& name = epart->name;
|
string name = epart->name;
|
||||||
m_partlist[name] = epart.release();
|
m_partlist[name] = std::move(epart);
|
||||||
partNode = partNode->GetNext();
|
partNode = partNode->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,8 +509,8 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode )
|
||||||
|
|
||||||
while( libraryNode )
|
while( libraryNode )
|
||||||
{
|
{
|
||||||
auto elib = loadLibrary( libraryNode );
|
EAGLE_LIBRARY elib = loadLibrary( libraryNode );
|
||||||
m_eaglelibraries[elib->name] = elib;
|
m_eaglelibraries[elib.name] = elib;
|
||||||
libraryNode = libraryNode->GetNext();
|
libraryNode = libraryNode->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,13 +1016,13 @@ void SCH_EAGLE_PLUGIN::loadInstance( wxXmlNode* aInstanceNode )
|
||||||
// Assign the the LIB_ID from deviceset and device names
|
// Assign the the LIB_ID from deviceset and device names
|
||||||
|
|
||||||
|
|
||||||
EPART* epart = m_partlist[einstance.part];
|
EPART* epart = m_partlist[einstance.part].get();
|
||||||
|
|
||||||
std::string gatename = epart->deviceset + epart->device + einstance.gate;
|
std::string gatename = epart->deviceset + epart->device + einstance.gate;
|
||||||
std::string symbolname = epart->deviceset + epart->device;
|
std::string symbolname = epart->deviceset + epart->device;
|
||||||
// KiCad enumerates units starting from 1, Eagle starts with 0
|
// KiCad enumerates units starting from 1, Eagle starts with 0
|
||||||
int unit = m_eaglelibraries[epart->library]->gate_unit[gatename];
|
int unit = m_eaglelibraries[epart->library].gate_unit[gatename];
|
||||||
std::string package = m_eaglelibraries[epart->library]->package[symbolname];
|
std::string package = m_eaglelibraries[epart->library].package[symbolname];
|
||||||
|
|
||||||
// std::cout << "Instance> part: " << einstance.part << " Gate: " << einstance.gate << " " << symbolname << '\n';
|
// std::cout << "Instance> part: " << einstance.part << " Gate: " << einstance.gate << " " << symbolname << '\n';
|
||||||
|
|
||||||
|
@ -1147,15 +1147,15 @@ void SCH_EAGLE_PLUGIN::loadModuleinst( wxXmlNode* aModuleinstNode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
EAGLE_LIBRARY SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
{
|
{
|
||||||
unique_ptr<EAGLE_LIBRARY> elib( new EAGLE_LIBRARY );
|
|
||||||
|
|
||||||
std::map<std::string, wxXmlNode*> gate;
|
EAGLE_LIBRARY elib;
|
||||||
|
|
||||||
|
|
||||||
// Read the library name
|
// Read the library name
|
||||||
wxString libName = aLibraryNode->GetAttribute( "name" );
|
wxString libName = aLibraryNode->GetAttribute( "name" );
|
||||||
elib.get()->name = libName.ToStdString();
|
elib.name = libName.ToStdString();
|
||||||
|
|
||||||
////std::cout << "Importing Eagle Library "<< libName.ToStdString() << std::endl;
|
////std::cout << "Importing Eagle Library "<< libName.ToStdString() << std::endl;
|
||||||
|
|
||||||
|
@ -1180,7 +1180,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
while( symbolNode )
|
while( symbolNode )
|
||||||
{
|
{
|
||||||
wxString symbolName = symbolNode->GetAttribute( "name" );
|
wxString symbolName = symbolNode->GetAttribute( "name" );
|
||||||
elib->symbolnodes[symbolName.ToStdString()] = symbolNode;
|
elib.symbolnodes[symbolName.ToStdString()] = symbolNode;
|
||||||
symbolNode = symbolNode->GetNext();
|
symbolNode = symbolNode->GetNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,7 +1208,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
// std::cout << "Creating Kicad Symbol: " << symbolName.ToStdString() << '\n';
|
// std::cout << "Creating Kicad Symbol: " << symbolName.ToStdString() << '\n';
|
||||||
|
|
||||||
if( edevice.package )
|
if( edevice.package )
|
||||||
elib.get()->package[symbolName.ToStdString()] = edevice.package.Get();
|
elib.package[symbolName.ToStdString()] = edevice.package.Get();
|
||||||
|
|
||||||
// Create kicad symbol.
|
// Create kicad symbol.
|
||||||
unique_ptr<LIB_PART> kpart( new LIB_PART( symbolName ) );
|
unique_ptr<LIB_PART> kpart( new LIB_PART( symbolName ) );
|
||||||
|
@ -1226,11 +1226,11 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
{
|
{
|
||||||
EGATE egate = EGATE( gateNode );
|
EGATE egate = EGATE( gateNode );
|
||||||
|
|
||||||
elib.get()->gate_unit[edeviceset.name + edevice.name + egate.name] = gateindex;
|
elib.gate_unit[edeviceset.name + edevice.name + egate.name] = gateindex;
|
||||||
|
|
||||||
|
|
||||||
ispower = loadSymbol( elib->symbolnodes[egate.symbol],
|
ispower = loadSymbol( elib.symbolnodes[egate.symbol],
|
||||||
(LIB_PART*) kpart.get(), &edevice, gateindex, egate.name );
|
kpart, &edevice, gateindex, egate.name );
|
||||||
|
|
||||||
gateindex++;
|
gateindex++;
|
||||||
gateNode = gateNode->GetNext();
|
gateNode = gateNode->GetNext();
|
||||||
|
@ -1241,7 +1241,7 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
|
|
||||||
const string& name = kpart->GetName().ToStdString();
|
const string& name = kpart->GetName().ToStdString();
|
||||||
m_partlib->AddPart( kpart.get() );
|
m_partlib->AddPart( kpart.get() );
|
||||||
elib->kicadsymbols[name] = kpart.release();
|
elib.kicadsymbols[name] = kpart.release();
|
||||||
|
|
||||||
deviceNode = deviceNode->GetNext();
|
deviceNode = deviceNode->GetNext();
|
||||||
} // devicenode
|
} // devicenode
|
||||||
|
@ -1249,12 +1249,12 @@ EAGLE_LIBRARY* SCH_EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLibraryNode )
|
||||||
devicesetNode = devicesetNode->GetNext();
|
devicesetNode = devicesetNode->GetNext();
|
||||||
} // devicesetNode
|
} // devicesetNode
|
||||||
|
|
||||||
return elib.release();
|
return elib;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
LIB_PART* aPart,
|
std::unique_ptr< LIB_PART >& aPart,
|
||||||
EDEVICE* aDevice,
|
EDEVICE* aDevice,
|
||||||
int gateNumber,
|
int gateNumber,
|
||||||
string gateName )
|
string gateName )
|
||||||
|
@ -1288,14 +1288,12 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
}
|
}
|
||||||
else if( nodeName == "circle" )
|
else if( nodeName == "circle" )
|
||||||
{
|
{
|
||||||
LIB_CIRCLE* circle = loadSymbolCircle( aPart, currentNode );
|
aPart->AddDrawItem( loadSymbolCircle( aPart, currentNode, gateNumber) );
|
||||||
circle->SetUnit( gateNumber );
|
|
||||||
aPart->AddDrawItem( circle );
|
|
||||||
}
|
}
|
||||||
else if( nodeName == "pin" )
|
else if( nodeName == "pin" )
|
||||||
{
|
{
|
||||||
EPIN ePin = EPIN( currentNode );
|
EPIN ePin = EPIN( currentNode );
|
||||||
LIB_PIN* pin = loadPin( aPart, currentNode, &ePin );
|
std::unique_ptr<LIB_PIN> pin ( loadPin( aPart, currentNode, &ePin, gateNumber ) );
|
||||||
pincount++;
|
pincount++;
|
||||||
|
|
||||||
if(ePin.direction)
|
if(ePin.direction)
|
||||||
|
@ -1366,7 +1364,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
pinname.Replace("!", "~");
|
pinname.Replace("!", "~");
|
||||||
pin->SetName( pinname );
|
pin->SetName( pinname );
|
||||||
|
|
||||||
aPart->AddDrawItem( pin );
|
aPart->AddDrawItem( pin.release() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1375,27 +1373,20 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
{
|
{
|
||||||
pin->SetPartNumber( gateNumber );
|
pin->SetPartNumber( gateNumber );
|
||||||
pin->SetUnit( gateNumber );
|
pin->SetUnit( gateNumber );
|
||||||
aPart->AddDrawItem( pin );
|
aPart->AddDrawItem( pin.release() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( nodeName == "polygon" )
|
else if( nodeName == "polygon" )
|
||||||
{
|
{
|
||||||
LIB_POLYLINE* libpoly = loadSymbolPolyLine( aPart, currentNode );
|
aPart->AddDrawItem( loadSymbolPolyLine( aPart, currentNode, gateNumber ) );
|
||||||
libpoly->SetUnit( gateNumber );
|
|
||||||
aPart->AddDrawItem(libpoly);
|
|
||||||
}
|
}
|
||||||
else if( nodeName == "rectangle" )
|
else if( nodeName == "rectangle" )
|
||||||
{
|
{
|
||||||
LIB_RECTANGLE* rectangle = loadSymbolRectangle( aPart, currentNode );
|
aPart->AddDrawItem( loadSymbolRectangle( aPart, currentNode, gateNumber ));
|
||||||
rectangle->SetUnit( gateNumber );
|
|
||||||
aPart->AddDrawItem( rectangle );
|
|
||||||
}
|
}
|
||||||
else if( nodeName == "text" )
|
else if( nodeName == "text" )
|
||||||
{
|
{
|
||||||
LIB_TEXT* libtext = loadSymboltext( aPart, currentNode );
|
std::unique_ptr<LIB_TEXT> libtext ( loadSymboltext( aPart, currentNode , gateNumber) );
|
||||||
libtext->SetUnit( gateNumber );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( libtext->GetText().Upper() ==">NAME" )
|
if( libtext->GetText().Upper() ==">NAME" )
|
||||||
{
|
{
|
||||||
|
@ -1421,14 +1412,13 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aPart->AddDrawItem( libtext );
|
aPart->AddDrawItem( libtext.release() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( nodeName == "wire" )
|
else if( nodeName == "wire" )
|
||||||
{
|
{
|
||||||
LIB_ITEM* pline = loadSymbolWire( aPart, currentNode );
|
aPart->AddDrawItem( loadSymbolWire( aPart, currentNode, gateNumber ) );
|
||||||
pline->SetUnit( gateNumber );
|
|
||||||
aPart->AddDrawItem( pline );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
currentNode = currentNode->GetNext();
|
currentNode = currentNode->GetNext();
|
||||||
|
@ -1443,33 +1433,34 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle( LIB_PART* aPart, wxXmlNode* aCircleNode )
|
LIB_CIRCLE* SCH_EAGLE_PLUGIN::loadSymbolCircle( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aCircleNode , int gateNumber)
|
||||||
{
|
{
|
||||||
// Parse the circle properties
|
// Parse the circle properties
|
||||||
ECIRCLE c( aCircleNode );
|
ECIRCLE c( aCircleNode );
|
||||||
|
|
||||||
unique_ptr<LIB_CIRCLE> circle( new LIB_CIRCLE( aPart ) );
|
unique_ptr<LIB_CIRCLE> circle( new LIB_CIRCLE( aPart.get() ) );
|
||||||
|
|
||||||
circle->SetPosition( wxPoint( c.x * EUNIT_TO_MIL, c.y * EUNIT_TO_MIL ) );
|
circle->SetPosition( wxPoint( c.x * EUNIT_TO_MIL, c.y * EUNIT_TO_MIL ) );
|
||||||
circle->SetRadius( c.radius * EUNIT_TO_MIL );
|
circle->SetRadius( c.radius * EUNIT_TO_MIL );
|
||||||
circle->SetWidth( c.width * EUNIT_TO_MIL );
|
circle->SetWidth( c.width * EUNIT_TO_MIL );
|
||||||
|
circle->SetUnit( gateNumber );
|
||||||
|
|
||||||
return circle.release();
|
return circle.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( LIB_PART* aPart, wxXmlNode* aRectNode )
|
LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aRectNode , int gateNumber )
|
||||||
{
|
{
|
||||||
ERECT rect( aRectNode );
|
ERECT rect( aRectNode );
|
||||||
|
|
||||||
unique_ptr<LIB_RECTANGLE> rectangle( new LIB_RECTANGLE( aPart ) );
|
unique_ptr<LIB_RECTANGLE> rectangle( new LIB_RECTANGLE( aPart.get() ) );
|
||||||
|
|
||||||
rectangle->SetPosition( wxPoint( rect.x1 * EUNIT_TO_MIL, rect.y1 * EUNIT_TO_MIL ) );
|
rectangle->SetPosition( wxPoint( rect.x1 * EUNIT_TO_MIL, rect.y1 * EUNIT_TO_MIL ) );
|
||||||
rectangle->SetEnd( wxPoint( rect.x2 * EUNIT_TO_MIL, rect.y2 * EUNIT_TO_MIL ) );
|
rectangle->SetEnd( wxPoint( rect.x2 * EUNIT_TO_MIL, rect.y2 * EUNIT_TO_MIL ) );
|
||||||
|
|
||||||
// TODO: Manage rotation
|
// TODO: Manage rotation
|
||||||
// Probaly using a transform.
|
// Probaly using a transform.
|
||||||
|
rectangle->SetUnit( gateNumber );
|
||||||
// Eagle rectangles are filled by definition.
|
// Eagle rectangles are filled by definition.
|
||||||
rectangle->SetFillMode(FILLED_SHAPE);
|
rectangle->SetFillMode(FILLED_SHAPE);
|
||||||
|
|
||||||
|
@ -1477,7 +1468,7 @@ LIB_RECTANGLE* SCH_EAGLE_PLUGIN::loadSymbolRectangle( LIB_PART* aPart, wxXmlNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNode )
|
LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aWireNode, int gateNumber)
|
||||||
{
|
{
|
||||||
// TODO: Layer map
|
// TODO: Layer map
|
||||||
|
|
||||||
|
@ -1492,7 +1483,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNod
|
||||||
end.y = ewire.y2 * EUNIT_TO_MIL;
|
end.y = ewire.y2 * EUNIT_TO_MIL;
|
||||||
if( ewire.curve )
|
if( ewire.curve )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( aPart ) );
|
std::unique_ptr<LIB_ARC> arc( new LIB_ARC( aPart.get() ) );
|
||||||
wxRealPoint center = kicad_arc_center( begin, end, *ewire.curve*-1);
|
wxRealPoint center = kicad_arc_center( begin, end, *ewire.curve*-1);
|
||||||
|
|
||||||
arc->SetPosition(center);
|
arc->SetPosition(center);
|
||||||
|
@ -1534,7 +1525,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNod
|
||||||
arc->SetEnd( end );
|
arc->SetEnd( end );
|
||||||
arc->SetRadius(radius);
|
arc->SetRadius(radius);
|
||||||
arc->CalcRadiusAngles();
|
arc->CalcRadiusAngles();
|
||||||
arc->SetWidth(0.001);
|
arc->SetWidth(1);
|
||||||
arc->SetFillMode(FILLED_SHAPE);
|
arc->SetFillMode(FILLED_SHAPE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1544,7 +1535,7 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNod
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart ) );
|
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart.get() ) );
|
||||||
|
|
||||||
polyLine->AddPoint( begin );
|
polyLine->AddPoint( begin );
|
||||||
polyLine->AddPoint( end );
|
polyLine->AddPoint( end );
|
||||||
|
@ -1556,10 +1547,10 @@ LIB_ITEM* SCH_EAGLE_PLUGIN::loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNod
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode* aPolygonNode )
|
LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aPolygonNode, int gateNumber )
|
||||||
{
|
{
|
||||||
// TODO: Layer map
|
// TODO: Layer map
|
||||||
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart ) );
|
std::unique_ptr<LIB_POLYLINE> polyLine( new LIB_POLYLINE( aPart.get() ) );
|
||||||
|
|
||||||
EPOLYGON epoly( aPolygonNode );
|
EPOLYGON epoly( aPolygonNode );
|
||||||
wxXmlNode* vertex = aPolygonNode->GetChildren();
|
wxXmlNode* vertex = aPolygonNode->GetChildren();
|
||||||
|
@ -1578,19 +1569,20 @@ LIB_POLYLINE* SCH_EAGLE_PLUGIN::loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode*
|
||||||
}
|
}
|
||||||
|
|
||||||
polyLine->SetFillMode( FILLED_SHAPE );
|
polyLine->SetFillMode( FILLED_SHAPE );
|
||||||
|
polyLine->SetUnit( gateNumber );
|
||||||
|
|
||||||
return polyLine.release();
|
return polyLine.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( LIB_PART* aPart, wxXmlNode* aPin, EPIN* epin )
|
LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aPin, EPIN* epin , int gateNumber )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_PIN> pin( new LIB_PIN( aPart ) );
|
std::unique_ptr<LIB_PIN> pin( new LIB_PIN( aPart.get() ) );
|
||||||
|
|
||||||
epin = new EPIN( aPin );
|
|
||||||
|
|
||||||
pin->SetPosition( wxPoint( epin->x * EUNIT_TO_MIL, epin->y * EUNIT_TO_MIL ) );
|
pin->SetPosition( wxPoint( epin->x * EUNIT_TO_MIL, epin->y * EUNIT_TO_MIL ) );
|
||||||
pin->SetName( epin->name );
|
pin->SetName( epin->name );
|
||||||
|
pin->SetUnit( gateNumber );
|
||||||
|
|
||||||
int roti = 0;
|
int roti = 0;
|
||||||
|
|
||||||
|
@ -1672,12 +1664,13 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin( LIB_PART* aPart, wxXmlNode* aPin, EPIN* epin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText )
|
LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymboltext( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aLibText, int gateNumber )
|
||||||
{
|
{
|
||||||
std::unique_ptr<LIB_TEXT> libtext( new LIB_TEXT( aPart ) );
|
std::unique_ptr<LIB_TEXT> libtext( new LIB_TEXT( aPart.get() ) );
|
||||||
|
|
||||||
auto etext = ETEXT( aLibText );
|
ETEXT etext( aLibText );
|
||||||
|
|
||||||
|
libtext->SetUnit( gateNumber );
|
||||||
libtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, etext.y * EUNIT_TO_MIL ) );
|
libtext->SetPosition( wxPoint( etext.x * EUNIT_TO_MIL, etext.y * EUNIT_TO_MIL ) );
|
||||||
libtext->SetText( aLibText->GetNodeContent() );
|
libtext->SetText( aLibText->GetNodeContent() );
|
||||||
libtext->SetTextSize( wxSize( etext.size * EUNIT_TO_MIL*0.95,
|
libtext->SetTextSize( wxSize( etext.size * EUNIT_TO_MIL*0.95,
|
||||||
|
@ -1701,6 +1694,7 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText
|
||||||
|
|
||||||
eagleToKicadAlignment((EDA_TEXT*)libtext.get(), align, degrees, mirror, spin, 0);
|
eagleToKicadAlignment((EDA_TEXT*)libtext.get(), align, degrees, mirror, spin, 0);
|
||||||
|
|
||||||
|
|
||||||
return libtext.release();
|
return libtext.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <lib_draw_item.h>
|
#include <lib_draw_item.h>
|
||||||
#include <dlist.h>
|
#include <dlist.h>
|
||||||
|
|
||||||
|
#include <boost/ptr_container/ptr_map.hpp>
|
||||||
|
|
||||||
class KIWAY;
|
class KIWAY;
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
|
@ -67,14 +69,15 @@ class LIB_TEXT;
|
||||||
typedef struct EAGLE_LIBRARY
|
typedef struct EAGLE_LIBRARY
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
std::unordered_map<std::string, LIB_PART*> kicadsymbols;
|
boost::ptr_map<std::string, LIB_PART*> kicadsymbols;
|
||||||
std::unordered_map<std::string, wxXmlNode*> symbolnodes;
|
boost::ptr_map<std::string, wxXmlNode*> symbolnodes;
|
||||||
std::unordered_map<std::string, int> gate_unit;
|
std::unordered_map<std::string, int> gate_unit;
|
||||||
std::unordered_map<std::string, std::string> package;
|
std::unordered_map<std::string, std::string> package;
|
||||||
|
|
||||||
} EAGLE_LIBRARY;
|
} EAGLE_LIBRARY;
|
||||||
|
|
||||||
typedef std::map<std::string, EPART*> EPART_LIST;
|
typedef boost::ptr_map< std::string, EPART > EPART_LIST;
|
||||||
|
|
||||||
|
|
||||||
class SCH_EAGLE_PLUGIN : public SCH_PLUGIN
|
class SCH_EAGLE_PLUGIN : public SCH_PLUGIN
|
||||||
{
|
{
|
||||||
|
@ -134,7 +137,7 @@ private:
|
||||||
void loadSheet( wxXmlNode* aSheetNode );
|
void loadSheet( wxXmlNode* aSheetNode );
|
||||||
void loadInstance( wxXmlNode* aInstanceNode );
|
void loadInstance( wxXmlNode* aInstanceNode );
|
||||||
void loadModuleinst( wxXmlNode* aModuleinstNode );
|
void loadModuleinst( wxXmlNode* aModuleinstNode );
|
||||||
EAGLE_LIBRARY* loadLibrary( wxXmlNode* aLibraryNode );
|
EAGLE_LIBRARY loadLibrary( wxXmlNode* aLibraryNode );
|
||||||
void countNets( wxXmlNode* aSchematicNode );
|
void countNets( wxXmlNode* aSchematicNode );
|
||||||
void addBusEntries();
|
void addBusEntries();
|
||||||
|
|
||||||
|
@ -148,13 +151,13 @@ private:
|
||||||
SCH_JUNCTION* loadJunction( wxXmlNode* aJunction );
|
SCH_JUNCTION* loadJunction( wxXmlNode* aJunction );
|
||||||
SCH_TEXT* loadplaintext( wxXmlNode* aSchText );
|
SCH_TEXT* loadplaintext( wxXmlNode* aSchText );
|
||||||
|
|
||||||
bool loadSymbol(wxXmlNode *aSymbolNode, LIB_PART* aPart, EDEVICE* aDevice, int gateNumber, string gateName);
|
bool loadSymbol(wxXmlNode *aSymbolNode, std::unique_ptr< LIB_PART >& aPart, EDEVICE* aDevice, int gateNumber, string gateName);
|
||||||
LIB_CIRCLE* loadSymbolCircle( LIB_PART* aPart, wxXmlNode* aCircleNode );
|
LIB_CIRCLE* loadSymbolCircle( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aCircleNode, int gateNumber);
|
||||||
LIB_RECTANGLE* loadSymbolRectangle( LIB_PART* aPart, wxXmlNode* aRectNode );
|
LIB_RECTANGLE* loadSymbolRectangle( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aRectNode, int gateNumber );
|
||||||
LIB_POLYLINE* loadSymbolPolyLine( LIB_PART* aPart, wxXmlNode* aPolygonNode );
|
LIB_POLYLINE* loadSymbolPolyLine( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aPolygonNode, int gateNumber );
|
||||||
LIB_ITEM* loadSymbolWire( LIB_PART* aPart, wxXmlNode* aWireNode );
|
LIB_ITEM* loadSymbolWire( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aWireNode, int gateNumber);
|
||||||
LIB_PIN* loadPin( LIB_PART*, wxXmlNode*, EPIN* epin);
|
LIB_PIN* loadPin( std::unique_ptr< LIB_PART >& aPart, wxXmlNode*, EPIN* epin, int gateNumber);
|
||||||
LIB_TEXT* loadSymboltext( LIB_PART* aPart, wxXmlNode* aLibText );
|
LIB_TEXT* loadSymboltext( std::unique_ptr< LIB_PART >& aPart, wxXmlNode* aLibText, int gateNumber);
|
||||||
|
|
||||||
KIWAY* m_kiway; ///< For creating sub sheets.
|
KIWAY* m_kiway; ///< For creating sub sheets.
|
||||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded..
|
||||||
|
@ -163,8 +166,8 @@ private:
|
||||||
wxFileName m_filename;
|
wxFileName m_filename;
|
||||||
PART_LIB* m_partlib; ///< symbol library for imported file.
|
PART_LIB* m_partlib; ///< symbol library for imported file.
|
||||||
|
|
||||||
EPART_LIST m_partlist;
|
EPART_MAP m_partlist;
|
||||||
std::map<std::string, EAGLE_LIBRARY*> m_eaglelibraries;
|
std::map<std::string, EAGLE_LIBRARY> m_eaglelibraries;
|
||||||
|
|
||||||
EDA_RECT sheetBoundingBox;
|
EDA_RECT sheetBoundingBox;
|
||||||
std::map<std::string, int > m_NetCounts;
|
std::map<std::string, int > m_NetCounts;
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct EPART;
|
||||||
typedef std::unordered_map<string, wxXmlNode*> NODE_MAP;
|
typedef std::unordered_map<string, wxXmlNode*> NODE_MAP;
|
||||||
typedef std::map<string, MODULE*> MODULE_MAP;
|
typedef std::map<string, MODULE*> MODULE_MAP;
|
||||||
typedef std::map<string, EINSTANCE*> EINSTANCE_MAP;
|
typedef std::map<string, EINSTANCE*> EINSTANCE_MAP;
|
||||||
typedef std::map<string, EPART*> EPART_MAP;
|
typedef std::map<string, std::unique_ptr<EPART>> EPART_MAP;
|
||||||
|
|
||||||
static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const string& aName )
|
static inline wxXmlNode* getChildrenNodes( NODE_MAP& aMap, const string& aName )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue