diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp index 8cdc67e589..07cd18d739 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp @@ -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; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.h b/pcbnew/pcad2kicadpcb_plugin/pcb.h index 2c4ae04aaa..0f5b3f6713 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.h @@ -61,7 +61,6 @@ public: wxXmlDocument* aXmlDoc, wxString aActualConversion ); - virtual void WriteToFile( wxString aFileName ); void AddToBoard(); private: diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index b47c77b471..10247b8ab5 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -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 ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h index de91395748..f0d82622f7 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h @@ -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(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp index 23c0e461ad..500a41da0d 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp @@ -61,10 +61,6 @@ PCB_COMPONENT::~PCB_COMPONENT() } -void PCB_COMPONENT::WriteToFile( wxFile* aFile, char aFileType ) -{ -} - void PCB_COMPONENT::AddToModule( MODULE* aModule ) { diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h index 98333326f4..0d01b2a156 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h @@ -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; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp index a7e773b373..7d7a0ed70f 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp @@ -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 ) ) diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.h b/pcbnew/pcad2kicadpcb_plugin/pcb_line.h index 7c4c36c8a3..37de6a7d9c 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.h @@ -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(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index 684c7f1e40..9625d4e81a 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -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; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h index 839782d075..6719d62387 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h @@ -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(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp index e507b7f4f0..8ec8a59b9a 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp @@ -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; - - // N - 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 ) ); - - // N - 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; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h index f595a145c4..14fc7f4848 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h @@ -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(); }; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp index a24057c351..3438b4d026 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp @@ -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 ) { } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h index 1a1d3765fb..49ab0a93d5 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h @@ -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(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp index 26225d0322..a02959dfb0 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp @@ -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 ) { } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_text.h b/pcbnew/pcad2kicadpcb_plugin/pcb_text.h index 47720b5188..b85ec2950a 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_text.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_text.h @@ -48,7 +48,6 @@ public: int aLayer, wxString aDefaultMeasurementUnit, wxString aActualConversion ); - virtual void WriteToFile( wxFile* aFile, char aFileType ); void AddToModule( MODULE* aModule ); void AddToBoard();