cvpcb LEGACY_PLUGIN usage factoring

This commit is contained in:
Dick Hollenbeck 2012-04-16 21:58:03 -05:00
parent 3341669fc6
commit 51a83a7a66
5 changed files with 121 additions and 248 deletions

View File

@ -17,8 +17,7 @@
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <class_DisplayFootprintsFrame.h>
#include <richio.h>
#include <filter_reader.h>
#include <io_mgr.h>
#include <wildcards_and_files_ext.h>
@ -29,122 +28,50 @@
* @param CmpName - Module name
* @return - a pointer to the loaded module or NULL.
*/
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName )
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
{
int Found = 0;
unsigned ii;
char* Line;
char Name[255];
wxString tmp, msg;
wxFileName fn;
MODULE* Module = NULL;
CVPCB_MAINFRAME* parent = ( CVPCB_MAINFRAME* ) GetParent();
for( ii = 0; ii < parent->m_ModuleLibNames.GetCount(); ii++ )
try
{
fn = parent->m_ModuleLibNames[ii];
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
for( unsigned i = 0; i < parent->m_ModuleLibNames.GetCount(); ++i )
{
wxFileName fn = parent->m_ModuleLibNames[i];
fn.SetExt( FootprintLibFileExtension );
tmp = wxGetApp().FindLibraryPath( fn );
wxString libPath = wxGetApp().FindLibraryPath( fn );
if( !tmp )
if( !libPath )
{
msg.Printf( _( "PCB foot print library file <%s> could not be \
found in the default search paths." ),
GetChars( fn.GetFullName() ) );
wxString msg = wxString::Format(
_("PCB foot print library file <%s> could not be found in the default search paths." ),
fn.GetFullName().GetData() );
// @todo we should not be using wxMessageBox directly.
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
}
FILE* file = wxFopen( tmp, wxT( "rt" ) );
MODULE* footprint = pi->FootprintLoad( libPath, aFootprintName );
if( file == NULL )
if( footprint )
{
msg.Printf( _( "Could not open PCB foot print library file <%s>." ),
GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
continue;
footprint->SetPosition( wxPoint( 0, 0 ) );
return footprint;
}
FILE_LINE_READER fileReader( file, tmp );
FILTER_READER reader( fileReader );
/* Read header. */
reader.ReadLine();
Line = reader.Line();
StrPurge( Line );
if( strnicmp( Line, FOOTPRINT_LIBRARY_HEADER, FOOTPRINT_LIBRARY_HEADER_CNT ) != 0 )
}
}
catch( IO_ERROR ioe )
{
msg.Printf( _( "<%s> is not a valid KiCad PCB foot print library." ),
GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
fclose( file );
DisplayError( this, ioe.errorText );
return NULL;
}
Found = 0;
while( !Found && reader.ReadLine() )
{
Line = reader.Line();
if( strncmp( Line, "$MODULE", 6 ) == 0 )
break;
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
{
while( reader.ReadLine() )
{
Line = reader.Line();
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
break;
StrPurge( Line );
if( stricmp( Line, TO_UTF8( CmpName ) ) == 0 )
{
Found = 1;
break;
}
}
}
}
while( Found && reader.ReadLine() )
{
Line = reader.Line();
if( Line[0] != '$' )
continue;
if( Line[1] != 'M' )
continue;
if( strnicmp( Line, "$MODULE", 7 ) != 0 )
continue;
/* Read component name. */
sscanf( Line + 7, " %s", Name );
if( stricmp( Name, TO_UTF8( CmpName ) ) == 0 )
{
Module = new MODULE( GetBoard() );
// Switch the locale to standard C (needed to print floating
// point numbers like 1.3)
SetLocaleTo_C_standard();
Module->ReadDescr( &reader );
SetLocaleTo_Default(); // revert to the current locale
Module->SetPosition( wxPoint( 0, 0 ) );
return Module;
}
}
file = NULL;
}
msg.Printf( _( "Module %s not found" ), CmpName.GetData() );
wxString msg = wxString::Format( _( "Footprint '%s' not found" ), aFootprintName.GetData() );
DisplayError( this, msg );
return NULL;
}

View File

@ -15,6 +15,7 @@
#include <../pcbnew/class_track.h>
#include <../pcbnew/class_drawsegment.h>
#include <io_mgr.h>
#include <gerbview.h>
#include <class_board_design_settings.h>
#include <class_gerber_draw_item.h>
@ -26,32 +27,35 @@
*/
class GBR_TO_PCB_EXPORTER
{
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
FILE * m_file; // .brd file to write to
BOARD* m_pcb; // the board to populate and export
public:
GBR_TO_PCB_EXPORTER(GERBVIEW_FRAME * aFrame, FILE * aFile );
GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName );
~GBR_TO_PCB_EXPORTER();
/**
* Function ExportPcb
* saves a board from a gerber load.
*/
bool ExportPcb( int* LayerLookUpTable );
BOARD* GetBoard() { return m_pcb; }
private:
bool WriteSetup( ); // Write the SETUP section data file
bool WriteGeneralDescrPcb( );
void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer );
void cleanBoard();
GERBVIEW_FRAME* m_gerbview_frame; // the maint gerber frame
wxString m_file_name; // BOARD file to write to
BOARD* m_pcb; // the board to populate and export
};
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME * aFrame, FILE * aFile )
GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString& aFileName )
{
m_gerbview_frame = aFrame;
m_file = aFile;
m_file_name = aFileName;
m_pcb = new BOARD();
}
@ -84,12 +88,12 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
return;
}
wxString FullFileName, msg;
wxString fileName, msg;
wxString PcbExt( wxT( ".brd" ) );
msg = wxT( "*" ) + PcbExt;
FullFileName = EDA_FileSelector( _( "Board file name:" ),
fileName = EDA_FileSelector( _( "Board file name:" ),
wxEmptyString,
wxEmptyString,
PcbExt,
@ -98,7 +102,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
wxFD_SAVE,
false
);
if( FullFileName == wxEmptyString )
if( fileName == wxEmptyString )
return;
/* Install a dialog frame to choose the mapping
@ -111,24 +115,15 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
if( ok != wxID_OK )
return;
if( wxFileExists( FullFileName ) )
if( wxFileExists( fileName ) )
{
if( !IsOK( this, _( "Ok to change the existing file ?" ) ) )
return;
}
FILE * file = wxFopen( FullFileName, wxT( "wt" ) );
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
if( file == NULL )
{
msg = _( "Unable to create " ) + FullFileName;
DisplayError( this, msg );
return;
}
GBR_TO_PCB_EXPORTER gbr_exporter( this, file );
gbr_exporter.ExportPcb( dlg->GetLayersLookUpTable() );
fclose( file );
}
@ -162,54 +157,6 @@ void GBR_TO_PCB_EXPORTER::cleanBoard()
}
bool GBR_TO_PCB_EXPORTER::WriteSetup( )
{
fprintf( m_file, "$SETUP\n" );
fprintf( m_file, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
fprintf( m_file, "Layers %d\n", m_pcb->GetCopperLayerCount() );
fprintf( m_file, "$EndSETUP\n\n" );
return true;
}
bool GBR_TO_PCB_EXPORTER::WriteGeneralDescrPcb( )
{
int nbLayers;
// Print the copper layer count
nbLayers = m_pcb->GetCopperLayerCount();
if( nbLayers <= 1 ) // Minimal layers count in Pcbnew is 2
{
nbLayers = 2;
m_pcb->SetCopperLayerCount(2);
}
fprintf( m_file, "$GENERAL\n" );
fprintf( m_file, "encoding utf-8\n");
fprintf( m_file, "LayerCount %d\n", nbLayers );
// Compute and print the board bounding box
EDA_RECT bbbox = m_pcb->ComputeBoundingBox();
fprintf( m_file, "Di %d %d %d %d\n",
bbbox.GetX(), bbbox.GetY(),
bbbox.GetRight(),
bbbox.GetBottom() );
fprintf( m_file, "$EndGENERAL\n\n" );
return true;
}
/* Routine to save the board
* @param frame = pointer to the main frame
* @param File = FILE * pointer to an already opened file
* @param LayerLookUpTable = look up table: Pcbnew layer for each gerber layer
* @return 1 if OK, 0 if fail
*/
bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
{
BOARD* gerberPcb = m_gerbview_frame->GetBoard();
@ -235,22 +182,21 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable )
cleanBoard();
m_pcb->SetCopperLayerCount( LayerLookUpTable[32] );
// Switch the locale to standard C (needed to print floating point numbers)
SetLocaleTo_C_standard();
try
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
pi->Save( m_file_name, m_pcb );
}
catch( IO_ERROR ioe )
{
DisplayError( m_gerbview_frame, ioe.errorText );
return false;
}
// write PCB header
fprintf( m_file, "PCBNEW-BOARD Version %d date %s\n\n", LEGACY_BOARD_FILE_VERSION,
TO_UTF8( DateAndTime() ) );
WriteGeneralDescrPcb( );
WriteSetup( );
// write items on file
m_pcb->Save( m_file );
SetLocaleTo_Default(); // revert to the current locale
return true;
}
void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer )
{
DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, PCB_LINE_T );

View File

@ -848,7 +848,7 @@ public:
* ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentTrackWidth()
int GetCurrentTrackWidth() const
{
return m_TrackWidthList[m_TrackWidthSelector];
}

View File

@ -2710,8 +2710,6 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES*
init( aProperties );
m_board = aBoard;
FILE* fp = wxFopen( aFileName, wxT( "w" ) );
if( !fp )
{
@ -2728,12 +2726,13 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES*
if( m_props )
{
// @todo move the header production into this source file.
wxString header = (*m_props)["header"];
// save a file header, if caller provided one (with trailing \n hopefully).
fprintf( m_fp, "%s", TO_UTF8( header ) );
}
saveAllSections();
SaveBOARD( aBoard );
}
@ -2751,19 +2750,19 @@ do { \
} while(0)
void LEGACY_PLUGIN::saveAllSections() const
void LEGACY_PLUGIN::SaveBOARD( const BOARD* aBoard ) const
{
saveGENERAL();
saveGENERAL( aBoard );
saveSHEET();
saveSHEET( aBoard );
saveSETUP();
saveSETUP( aBoard );
saveBOARD();
saveBOARD_ITEMS( aBoard );
}
void LEGACY_PLUGIN::saveGENERAL() const
void LEGACY_PLUGIN::saveGENERAL( const BOARD* aBoard ) const
{
fprintf( m_fp, "$GENERAL\n" );
fprintf( m_fp, "encoding utf-8\n" );
@ -2776,7 +2775,7 @@ void LEGACY_PLUGIN::saveGENERAL() const
#endif
// Write copper layer count
fprintf( m_fp, "LayerCount %d\n", m_board->GetCopperLayerCount() );
fprintf( m_fp, "LayerCount %d\n", aBoard->GetCopperLayerCount() );
/* No, EnabledLayers has this information, plus g_TabAllCopperLayerMask is
global and globals are not allowed in a plugin.
@ -2785,34 +2784,35 @@ void LEGACY_PLUGIN::saveGENERAL() const
g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS );
*/
fprintf( m_fp, "EnabledLayers %08X\n", m_board->GetEnabledLayers() );
fprintf( m_fp, "EnabledLayers %08X\n", aBoard->GetEnabledLayers() );
if( m_board->GetEnabledLayers() != m_board->GetVisibleLayers() )
fprintf( m_fp, "VisibleLayers %08X\n", m_board->GetVisibleLayers() );
if( aBoard->GetEnabledLayers() != aBoard->GetVisibleLayers() )
fprintf( m_fp, "VisibleLayers %08X\n", aBoard->GetVisibleLayers() );
fprintf( m_fp, "Links %d\n", m_board->GetRatsnestsCount() );
fprintf( m_fp, "NoConn %d\n", m_board->m_NbNoconnect );
fprintf( m_fp, "Links %d\n", aBoard->GetRatsnestsCount() );
fprintf( m_fp, "NoConn %d\n", aBoard->m_NbNoconnect );
// Write Bounding box info
EDA_RECT bbbox = m_board->ComputeBoundingBox();
EDA_RECT bbbox = ((BOARD*)aBoard)->ComputeBoundingBox();
fprintf( m_fp, "Di %s %s\n",
fmtBIUPair( bbbox.GetX(), bbbox.GetY() ).c_str(),
fmtBIUPair( bbbox.GetRight(), bbbox.GetBottom() ).c_str() );
fprintf( m_fp, "Ndraw %d\n", m_board->m_Drawings.GetCount() );
fprintf( m_fp, "Ntrack %d\n", m_board->GetNumSegmTrack() );
fprintf( m_fp, "Nzone %d\n", m_board->GetNumSegmZone() );
fprintf( m_fp, "BoardThickness %s\n", fmtBIU( m_board->GetDesignSettings().m_BoardThickness ).c_str() );
fprintf( m_fp, "Nmodule %d\n", m_board->m_Modules.GetCount() );
fprintf( m_fp, "Nnets %d\n", m_board->GetNetCount() );
fprintf( m_fp, "Ndraw %d\n", aBoard->m_Drawings.GetCount() );
fprintf( m_fp, "Ntrack %d\n", aBoard->GetNumSegmTrack() );
fprintf( m_fp, "Nzone %d\n", aBoard->GetNumSegmZone() );
fprintf( m_fp, "BoardThickness %s\n", fmtBIU( aBoard->GetDesignSettings().m_BoardThickness ).c_str() );
fprintf( m_fp, "Nmodule %d\n", aBoard->m_Modules.GetCount() );
fprintf( m_fp, "Nnets %d\n", aBoard->GetNetCount() );
fprintf( m_fp, "$EndGENERAL\n\n" );
}
void LEGACY_PLUGIN::saveSHEET() const
void LEGACY_PLUGIN::saveSHEET( const BOARD* aBoard ) const
{
const PAGE_INFO& pageInfo = m_board->GetPageSettings();
const TITLE_BLOCK& tb = m_board->GetTitleBlock();
const PAGE_INFO& pageInfo = aBoard->GetPageSettings();
const TITLE_BLOCK& tb = ((BOARD*)aBoard)->GetTitleBlock();
fprintf( m_fp, "$SHEETDESCR\n" );
@ -2837,10 +2837,10 @@ void LEGACY_PLUGIN::saveSHEET() const
}
void LEGACY_PLUGIN::saveSETUP() const
void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
{
NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault();
const BOARD_DESIGN_SETTINGS& bds = m_board->GetDesignSettings();
NETCLASS* netclass_default = aBoard->m_NetClasses.GetDefault();
const BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
fprintf( m_fp, "$SETUP\n" );
@ -2849,32 +2849,32 @@ void LEGACY_PLUGIN::saveSETUP() const
fprintf( m_fp,, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT );
*/
fprintf( m_fp, "Layers %d\n", m_board->GetCopperLayerCount() );
fprintf( m_fp, "Layers %d\n", aBoard->GetCopperLayerCount() );
unsigned layerMask = ALL_CU_LAYERS & m_board->GetEnabledLayers();
unsigned layerMask = ALL_CU_LAYERS & aBoard->GetEnabledLayers();
for( int layer = 0; layerMask; ++layer, layerMask >>= 1 )
{
if( layerMask & 1 )
{
fprintf( m_fp, "Layer[%d] %s %s\n", layer,
TO_UTF8( m_board->GetLayerName( layer ) ),
LAYER::ShowType( m_board->GetLayerType( layer ) ) );
TO_UTF8( aBoard->GetLayerName( layer ) ),
LAYER::ShowType( aBoard->GetLayerType( layer ) ) );
}
}
// Save current default track width, for compatibility with older Pcbnew version;
fprintf( m_fp, "TrackWidth %s\n", fmtBIU( m_board->GetCurrentTrackWidth() ).c_str() );
fprintf( m_fp, "TrackWidth %s\n", fmtBIU( aBoard->GetCurrentTrackWidth() ).c_str() );
// Save custom tracks width list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < m_board->m_TrackWidthList.size(); ii++ )
fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( m_board->m_TrackWidthList[ii] ).c_str() );
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( aBoard->m_TrackWidthList[ii] ).c_str() );
fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() );
// ZONE_SETTINGS
fprintf( m_fp, "ZoneClearence %s\n", fmtBIU( m_board->GetZoneSettings().m_ZoneClearance ).c_str() );
fprintf( m_fp, "Zone_45_Only %d\n", m_board->GetZoneSettings().m_Zone_45_Only );
fprintf( m_fp, "ZoneClearence %s\n", fmtBIU( aBoard->GetZoneSettings().m_ZoneClearance ).c_str() );
fprintf( m_fp, "Zone_45_Only %d\n", aBoard->GetZoneSettings().m_Zone_45_Only );
fprintf( m_fp, "TrackMinWidth %s\n", fmtBIU( bds.m_TrackMinWidth ).c_str() );
@ -2889,10 +2889,10 @@ void LEGACY_PLUGIN::saveSETUP() const
// Save custom vias diameters list (the first is not saved here: this is
// the netclass value
for( unsigned ii = 1; ii < m_board->m_ViasDimensionsList.size(); ii++ )
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
fprintf( m_fp, "ViaSizeList %s %s\n",
fmtBIU( m_board->m_ViasDimensionsList[ii].m_Diameter ).c_str(),
fmtBIU( m_board->m_ViasDimensionsList[ii].m_Drill ).c_str() );
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Diameter ).c_str(),
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility:
fprintf( m_fp, "MicroViaSize %s\n", fmtBIU( netclass_default->GetuViaDiameter() ).c_str() );
@ -2926,14 +2926,14 @@ void LEGACY_PLUGIN::saveSETUP() const
}
*/
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( m_board->GetOriginAxisPosition() ).c_str() );
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetOriginAxisPosition() ).c_str() );
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );
{
STRING_FORMATTER sf;
m_board->GetPlotOptions().Format( &sf, 0 );
aBoard->GetPlotOptions().Format( &sf, 0 );
wxString record = FROM_UTF8( sf.GetString().c_str() );
@ -2947,22 +2947,22 @@ void LEGACY_PLUGIN::saveSETUP() const
}
void LEGACY_PLUGIN::saveBOARD() const
void LEGACY_PLUGIN::saveBOARD_ITEMS( const BOARD* aBoard ) const
{
// save the nets
int netcount = m_board->GetNetCount();
int netcount = aBoard->GetNetCount();
for( int i = 0; i < netcount; ++i )
saveNETINFO_ITEM( m_board->FindNet( i ) );
saveNETINFO_ITEM( aBoard->FindNet( i ) );
// Saved nets do not include netclass names, so save netclasses after nets.
saveNETCLASSES();
saveNETCLASSES( &aBoard->m_NetClasses );
// save the modules
for( MODULE* m = m_board->m_Modules; m; m = (MODULE*) m->Next() )
for( MODULE* m = aBoard->m_Modules; m; m = (MODULE*) m->Next() )
SaveMODULE( m );
// save the graphics owned by the board (not owned by a module)
for( BOARD_ITEM* gr = m_board->m_Drawings; gr; gr = gr->Next() )
for( BOARD_ITEM* gr = aBoard->m_Drawings; gr; gr = gr->Next() )
{
switch( gr->Type() )
{
@ -2987,19 +2987,19 @@ void LEGACY_PLUGIN::saveBOARD() const
// save the tracks & vias
fprintf( m_fp, "$TRACK\n" );
for( TRACK* track = m_board->m_Track; track; track = track->Next() )
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
saveTRACK( track );
fprintf( m_fp, "$EndTRACK\n" );
// save the old obsolete zones which were done by segments (tracks)
fprintf( m_fp, "$ZONE\n" );
for( SEGZONE* zone = m_board->m_Zone; zone; zone = zone->Next() )
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
saveTRACK( zone );
fprintf( m_fp, "$EndZONE\n" );
// save the polygon (which are the newer technology) zones
for( int i=0; i < m_board->GetAreaCount(); ++i )
saveZONE_CONTAINER( m_board->GetArea( i ) );
for( int i=0; i < aBoard->GetAreaCount(); ++i )
saveZONE_CONTAINER( aBoard->GetArea( i ) );
fprintf( m_fp, "$EndBOARD\n" );
@ -3018,15 +3018,13 @@ void LEGACY_PLUGIN::saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const
}
void LEGACY_PLUGIN::saveNETCLASSES() const
void LEGACY_PLUGIN::saveNETCLASSES( const NETCLASSES* aNetClasses ) const
{
const NETCLASSES& nc = m_board->m_NetClasses;
// save the default first.
saveNETCLASS( nc.GetDefault() );
saveNETCLASS( aNetClasses->GetDefault() );
// the rest will be alphabetical in the *.brd file.
for( NETCLASSES::const_iterator it = nc.begin(); it != nc.end(); ++it )
for( NETCLASSES::const_iterator it = aNetClasses->begin(); it != aNetClasses->end(); ++it )
{
NETCLASS* netclass = it->second;
saveNETCLASS( netclass );

View File

@ -40,6 +40,7 @@ class NETINFO;
class TEXTE_PCB;
class TRACK;
class NETCLASS;
class NETCLASSES;
class ZONE_CONTAINER;
class DIMENSION;
class NETINFO_ITEM;
@ -114,6 +115,8 @@ public:
MODULE* LoadMODULE();
void SaveMODULE( const MODULE* aModule ) const;
void SaveModule3D( const MODULE* aModule ) const;
void SaveBOARD( const BOARD* aBoard ) const;
protected:
@ -247,18 +250,17 @@ protected:
*/
std::string fmtDEG( double aAngle ) const;
void saveAllSections() const;
void saveGENERAL() const;
void saveSHEET() const;
void saveSETUP() const;
void saveBOARD() const;
void saveGENERAL( const BOARD* aBoard ) const;
void saveSHEET( const BOARD* aBoard ) const;
void saveSETUP( const BOARD* aBoard ) const;
void saveBOARD_ITEMS( const BOARD* aBoard ) const;
void saveMODULE_TEXT( const TEXTE_MODULE* aText ) const;
void saveMODULE_EDGE( const EDGE_MODULE* aGraphic ) const;
void savePAD( const D_PAD* aPad ) const;
void saveNETINFO_ITEM( const NETINFO_ITEM* aNet ) const;
void saveNETCLASSES() const;
void saveNETCLASSES( const NETCLASSES* aNetClasses ) const;
void saveNETCLASS( const NETCLASS* aNetclass ) const;
void savePCB_TEXT( const TEXTE_PCB* aText ) const;