Commit 89f590a1 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Pcad2kicad: remove dead code.

parent fa0a5141
......@@ -902,38 +902,6 @@ void PCB::Parse( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, wxString aActu
}
void PCB::WriteToFile( wxString aFileName )
{
wxFile f;
int i;
f.Open( aFileName, wxFile::write );
// LIBRARY
f.Write( wxT( "PCBNEW-LibModule-V1 01/01/2001-01:01:01\n" ) );
f.Write( wxT( "\n" ) );
f.Write( wxT( "$INDEX\n" ) );
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
{
if( m_pcbComponents[i]->m_objType == wxT( 'M' ) )
f.Write( m_pcbComponents[i]->m_name.text + wxT( "\n" ) );
}
f.Write( wxT( "$EndINDEX\n" ) );
for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ )
{
if( m_pcbComponents[i]->m_objType == wxT( 'M' ) )
m_pcbComponents[i]->WriteToFile( &f, wxT( 'L' ) );
}
f.Write( wxT( "$EndLIBRARY\n" ) );
f.Close();
}
void PCB::AddToBoard()
{
int i;
......
......@@ -61,7 +61,6 @@ public:
wxXmlDocument* aXmlDoc,
wxString aActualConversion );
virtual void WriteToFile( wxString aFileName );
void AddToBoard();
private:
......
......@@ -124,22 +124,6 @@ void PCB_ARC::Parse( XNODE* aNode,
}
void PCB_ARC::WriteToFile( wxFile* aFile, char aFileType )
{
/*
* DC ox oy fx fy w DC is a Draw Circle DC Xcentre Ycentre Xpoint Ypoint Width Layer
* DA x0 y0 x1 y1 angle width layer DA is a Draw ArcX0,y0 = Start point x1,y1 = end point
*/
if( aFileType == wxT( 'L' ) ) // Library component
{
aFile->Write( wxString::Format( wxT( "DA %d %d %d %d %d %d %d\n" ),
m_positionX, m_positionY, m_startX,
m_startY, m_angle, m_width,
m_KiCadLayer ) ); // ValueString
}
}
void PCB_ARC::SetPosOffset( int aX_offs, int aY_offs )
{
PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
......
......@@ -50,7 +50,6 @@ public:
virtual void Parse( XNODE* aNode, int aLayer,
wxString aDefaultMeasurementUnit, wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
void AddToModule( MODULE* aModule );
void AddToBoard();
......
......@@ -61,10 +61,6 @@ PCB_COMPONENT::~PCB_COMPONENT()
}
void PCB_COMPONENT::WriteToFile( wxFile* aFile, char aFileType )
{
}
void PCB_COMPONENT::AddToModule( MODULE* aModule )
{
......
......@@ -65,7 +65,6 @@ public:
PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_COMPONENT();
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
virtual void AddToModule( MODULE* aModule );
virtual void AddToBoard() = 0;
......@@ -73,6 +72,7 @@ public:
int GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); }
int GetNewTimestamp() { return m_callbacks->GetNewTimestamp(); }
int GetNetCode( wxString aNetName ) { return m_callbacks->GetNetCode( aNetName ); }
protected:
PCB_CALLBACKS* m_callbacks;
BOARD* m_board;
......
......@@ -105,16 +105,6 @@ void PCB_LINE::SetPosOffset( int aX_offs, int aY_offs )
}
void PCB_LINE::WriteToFile( wxFile* aFile, char aFileType )
{
if( aFileType == wxT( 'L' ) ) // Library
{
aFile->Write( wxString::Format( wxT( "DS %d %d %d %d %d %d\n" ), m_positionX, m_positionY,
m_toX, m_toY, m_width, m_KiCadLayer ) ); // Position
}
}
void PCB_LINE::AddToModule( MODULE* aModule )
{
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
......
......@@ -51,7 +51,6 @@ public:
int aLayer,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
void AddToModule( MODULE* aModule );
void AddToBoard();
......
......@@ -495,108 +495,6 @@ wxString PCB_MODULE::ModuleLayer( int aMirror )
}
void PCB_MODULE::WriteToFile( wxFile* aFile, char aFileType )
{
char visibility, mirrored;
int i;
// transform text positions ....
CorrectTextPosition( &m_name, m_rotation );
CorrectTextPosition( &m_value, m_rotation );
// Go out
aFile->Write( wxT( "\n" ) );
aFile->Write( wxT( "$MODULE " ) + m_name.text + wxT( "\n" ) );
aFile->Write( wxString::Format( wxT( "Po %d %d %d " ), m_positionX, m_positionY, m_rotation ) +
ModuleLayer( m_mirror ) + wxT( " 00000000 00000000 ~~\n" ) ); // Position
aFile->Write( wxT( "Li " ) + m_name.text + wxT( "\n" ) ); // Modulename
aFile->Write( wxT( "Sc 00000000\n" ) ); // Timestamp
aFile->Write( wxT( "Op 0 0 0\n" ) ); // Orientation
aFile->Write( wxT( "At SMD\n" ) ); // ??
// MODULE STRINGS
if( m_name.textIsVisible == 1 )
visibility = wxT( 'V' );
else
visibility = wxT( 'I' );
if( m_name.mirror == 1 )
mirrored = wxT( 'M' );
else
mirrored = wxT( 'N' );
aFile->Write( wxString::Format( wxT( "T0 %d %d %d %d %d %d" ), m_name.correctedPositionX,
m_name.correctedPositionY,
KiROUND( m_name.textHeight / 2 ),
KiROUND( m_name.textHeight / 1.5 ),
m_name.textRotation,
/* TODO: Is it correct to use m_value.textstrokeWidth here? */
m_value.textstrokeWidth ) +
wxT( ' ' ) + mirrored + wxT( ' ' ) + visibility +
wxString::Format( wxT( " %d \"" ), m_KiCadLayer ) +
m_name.text + wxT( "\"\n" ) ); // NameString
if( m_value.textIsVisible == 1 )
visibility = wxT( 'V' );
else
visibility = wxT( 'I' );
if( m_value.mirror == 1 )
mirrored = wxT( 'M' );
else
mirrored = wxT( 'N' );
aFile->Write( wxString::Format( wxT( "T1 %d %d %d %d %d %d" ), m_value.correctedPositionX,
m_value.correctedPositionY,
KiROUND( m_value.textHeight / 2 ),
KiROUND( m_value.textHeight / 1.5 ),
m_value.textRotation, m_value.textstrokeWidth ) +
wxT( ' ' ) + mirrored + wxT( ' ' ) + visibility +
wxString::Format( wxT( " %d \"" ), m_KiCadLayer ) + m_value.text +
wxT( "\"\n" ) ); // ValueString
// TEXTS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'T' ) )
{
( (PCB_TEXT*) m_moduleObjects[i] )->m_tag = i + 2;
m_moduleObjects[i]->WriteToFile( aFile, aFileType );
}
}
// MODULE LINES
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'L' ) )
m_moduleObjects[i]->WriteToFile( aFile, aFileType );
}
// MODULE Arcs
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'A' ) )
m_moduleObjects[i]->WriteToFile( aFile, aFileType );
}
// PADS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'P' ) )
( (PCB_PAD*) m_moduleObjects[i] )->WriteToFile( aFile, aFileType, m_rotation );
}
// VIAS
for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ )
{
if( m_moduleObjects[i]->m_objType == wxT( 'V' ) )
( (PCB_VIA*) m_moduleObjects[i] )->WriteToFile( aFile, aFileType, m_rotation );
}
// END
aFile->Write( wxT( "$EndMODULE " ) + m_name.text + wxT( "\n" ) );
}
void PCB_MODULE::AddToBoard()
{
int i;
......
......@@ -62,7 +62,6 @@ public:
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
wxString aDefaultMeasurementUnit, wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void Flip();
void AddToBoard();
......
......@@ -149,118 +149,6 @@ void PCB_PAD::Parse( XNODE* aNode, wxString aDefaultMeasurementUnit,
}
void PCB_PAD::WriteToFile( wxFile* aFile, char aFileType, int aRotation )
{
PCB_PAD_SHAPE* padShape;
wxString padShapeName = wxT( "Ellipse" );
wxString s, padType;
wxUint32 layerMask;
int i;
int width = 0;
int height = 0;
if( !m_isHolePlated && m_hole )
{
aFile->Write( wxT( "$PAD\n" ) );
// Name, Shape, Xsize Ysize Xdelta Ydelta Orientation
aFile->Write( wxT( "Sh \"" ) + m_name.text + wxT( "\" " ) + s +
wxString::Format( wxT( " %d %d 0 0 %d\n" ),
m_hole, m_hole, m_rotation + aRotation ) );
// Hole size , OffsetX, OffsetY
aFile->Write( wxString::Format( wxT( "Dr %d 0 0\n" ), m_hole ) );
layerMask = ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT;
// <Pad type> N <layer mask>
aFile->Write( wxT( "At HOLE N " ) + wxString::Format( wxT( "%8X" ), layerMask ) +
wxT( "\n" ) );
// Reference
aFile->Write( wxT( "Ne 0 \"\"\n" ) );
// Position
aFile->Write( wxString::Format( wxT( "Po %d %d\n" ), m_positionX, m_positionY ) );
aFile->Write( wxT( "$EndPAD\n" ) );
}
else
{
( m_hole ) ? padType = wxT( "STD" ) : padType = wxT( "SMD" );
// form layer mask
layerMask = 0;
for( i = 0; i < (int) m_shapes.GetCount(); i++ )
{
padShape = m_shapes[i];
if( padShape->m_width > 0 && padShape->m_height > 0 )
{
if( padShape->m_KiCadLayer == LAYER_N_FRONT
|| padShape->m_KiCadLayer == LAYER_N_BACK )
{
padShapeName = padShape->m_shape;
width = padShape->m_width;
height = padShape->m_height;
// assume this is SMD pad
if( padShape->m_KiCadLayer == LAYER_N_FRONT )
layerMask = LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT;
else
layerMask = LAYER_BACK | SOLDERPASTE_LAYER_BACK | SOLDERMASK_LAYER_BACK;
break;
}
}
}
if( padType == wxT( "STD" ) )
// actually this is a thru-hole pad
layerMask = ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT;
if( width == 0 || height == 0 )
THROW_IO_ERROR( wxT( "pad with zero size" ) );
if( padShapeName == wxT( "Oval" )
|| padShapeName == wxT( "Ellipse" )
|| padShapeName == wxT( "MtHole" ) )
{
if( width != height )
s = wxT( "O" );
else
s = wxT( "C" );
}
else if( padShapeName == wxT( "Rect" )
|| padShapeName == wxT( "RndRect" ) )
s = wxT( "R" );
else if( padShapeName == wxT( "Polygon" ) )
s = wxT( "R" ); // approximation.....
aFile->Write( wxT( "$PAD\n" ) );
// Name, Shape, Xsize Ysize Xdelta Ydelta Orientation
aFile->Write( wxT( "Sh \"" ) + m_name.text + wxT( "\" " ) + s +
wxString::Format( wxT( " %d %d 0 0 %d\n" ),
width, height, m_rotation + aRotation ) );
// Hole size , OffsetX, OffsetY
aFile->Write( wxString::Format( wxT( "Dr %d 0 0\n" ), m_hole ) );
// <Pad type> N <layer mask>
aFile->Write( wxT( "At " ) + padType + wxT( " N " ) +
wxString::Format( wxT( "%8X" ), layerMask ) + wxT( "\n" ) );
// Reference
aFile->Write( wxT( "Ne 0 \"" ) + m_net + wxT( "\"\n" ) );
// Position
aFile->Write( wxString::Format( wxT( "Po %d %d\n" ), m_positionX, m_positionY ) );
aFile->Write( wxT( "$EndPAD\n" ) );
}
}
void PCB_PAD::AddToModule( MODULE* aModule, int aRotation )
{
PCB_PAD_SHAPE* padShape;
......
......@@ -51,7 +51,6 @@ public:
virtual void Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType, int aRotation );
void AddToModule( MODULE* aModule, int aRotation );
void AddToBoard();
};
......
......@@ -154,16 +154,6 @@ bool PCB_POLYGON::Parse( XNODE* aNode,
}
void PCB_POLYGON::WriteToFile( wxFile* aFile, char aFileType )
{
}
void PCB_POLYGON::WriteOutlineToFile( wxFile* aFile, char aFileType )
{
}
void PCB_POLYGON::AddToModule( MODULE* aModule )
{
}
......
......@@ -56,8 +56,6 @@ public:
wxString aActualConversion,
wxStatusBar* aStatusBar );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void WriteOutlineToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
void AddToModule( MODULE* aModule );
void AddToBoard();
......
......@@ -93,41 +93,6 @@ void PCB_TEXT::Parse( XNODE* aNode,
}
void PCB_TEXT::WriteToFile( wxFile* aFile, char aFileType )
{
char visibility, mirrored;
if( m_name.textIsVisible == 1 )
visibility = wxT( 'V' );
else
visibility = wxT( 'I' );
if( m_name.mirror == 1 )
mirrored = wxT( 'M' );
else
mirrored = wxT( 'N' );
// Simple, not the best, but acceptable text positioning.....
m_name.textPositionX = m_positionX;
m_name.textPositionY = m_positionY;
CorrectTextPosition( &m_name, m_rotation );
// Go out
if( aFileType == wxT( 'L' ) ) // Library component
{
aFile->Write( wxString::Format( wxT( "T%d %d %d %d %d %d %d " ), m_tag,
m_name.correctedPositionX,
m_name.correctedPositionY,
KiROUND( m_name.textHeight / 2 ),
KiROUND( m_name.textHeight / 1.1 ),
m_rotation, m_name.textstrokeWidth ) +
mirrored + wxT( ' ' ) + visibility +
wxString::Format( wxT( " %d \"" ), m_KiCadLayer ) +
m_name.text + wxT( "\"\n" ) ); // ValueString
}
}
void PCB_TEXT::AddToModule( MODULE* aModule )
{
}
......
......@@ -48,7 +48,6 @@ public:
int aLayer,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
void AddToModule( MODULE* aModule );
void AddToBoard();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment