Loading pcbnew/files.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -456,8 +456,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF pcbFileName = GetScreen()->GetFileName(); #if defined( USE_NEW_PCBNEW_LOAD ) || defined( USE_NEW_PCBNEW_SAVE ) if( pcbFileName.GetExt().IsEmpty() ) pcbFileName.SetExt( IO_MGR::GetFileExtension( (IO_MGR::PCB_FILE_T) wildcardIndex ) ); #endif if( !IsWritable( pcbFileName ) ) return false; Loading @@ -468,9 +470,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF backupFileName = pcbFileName; backupFileName.SetExt( pcbBackupFileExtension ); /* If an old backup file exists, delete it. If an old board file exists, rename * it to the backup file name */ // If an old backup file exists, delete it. If an old board file exists, rename // it to the backup file name. if( pcbFileName.FileExists() ) { // Remove the old file xxx.000 if it exists. Loading pcbnew/legacy_plugin.cpp +29 −7 Original line number Diff line number Diff line Loading @@ -317,11 +317,15 @@ void LEGACY_PLUGIN::checkVersion() int ver = 1; // if sccanf fails sscanf( line, "PCBNEW-BOARD Version %d", &ver ); #if !defined(DEBUG) if( ver > LEGACY_BOARD_FILE_VERSION ) { m_error.Printf( VERSION_ERROR_FORMAT, ver ); // "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." m_error.Printf( VERSION_ERROR_FORMAT, m_reader->GetSource().GetData(), ver, LEGACY_BOARD_FILE_VERSION ); THROW_IO_ERROR( m_error ); } #endif m_loading_format_version = ver; } Loading @@ -343,8 +347,14 @@ void LEGACY_PLUGIN::loadGENERAL() { #if defined(USE_PCBNEW_NANOMETRES) diskToBiu = 1000000.0; #elif defined(DEBUG) // mm to deci-mils: // advanced testing of round tripping only, not supported in non DEBUG build diskToBiu = 10000/25.4; #else THROW_IO_ERROR( _( "May not load new *.brd file into 'PCBNew compiled for deci-mils'" ) ); THROW_IO_ERROR( _( "May not load millimeter *.brd file into 'PCBNew compiled for deci-mils'" ) ); #endif } } Loading Loading @@ -1887,7 +1897,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType ) // optional 7th drill parameter (must be optional in an old format?) data = strtok( (char*) data, delims ); BIU drill = data ? biuParse( data ) : -1; // SetDefault() if -1 BIU drill = data ? biuParse( data ) : -1; // SetDefault() if < 0 // Read the 2nd line to determine the exact type, one of: // PCB_TRACE_T, PCB_VIA_T, or PCB_ZONE_T. The type field in 2nd line Loading Loading @@ -1952,7 +1962,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType ) newTrack->SetWidth( width ); newTrack->SetShape( shape ); if( drill <= 0 ) if( drill < 0 ) newTrack->SetDrillDefault(); else newTrack->SetDrill( drill ); Loading Loading @@ -2619,6 +2629,17 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) if( nptrptr ) *nptrptr = nptr; #if defined(DEBUG) if( diskToBiu == 10000/25.4 ) { // this is the special reverse trip mm -> deci-mils testing run, // only available in DEBUG mode. return BIU( wxRound( fval * diskToBiu ) ); } #endif // There should be no rounding issues here, since the values in the file initially // came from integers via biuFmt(). In fact this product should be an integer, exactly. return BIU( fval * diskToBiu ); Loading Loading @@ -2911,6 +2932,8 @@ void LEGACY_PLUGIN::saveSETUP() const fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( m_board->GetOriginAxisPosition() ).c_str() ); fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() ); { STRING_FORMATTER sf; Loading @@ -2924,8 +2947,6 @@ void LEGACY_PLUGIN::saveSETUP() const fprintf( m_fp, "PcbPlotParams %s\n", TO_UTF8( record ) ); } fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() ); fprintf( m_fp, "$EndSETUP\n\n" ); } Loading Loading @@ -3454,7 +3475,8 @@ void LEGACY_PLUGIN::saveTRACK( const TRACK* me ) const fmtBIUPoint( me->GetStart() ).c_str(), fmtBIUPoint( me->GetEnd() ).c_str(), fmtBIU( me->GetWidth() ).c_str(), fmtBIU( me->GetDrill() ).c_str() ); me->GetDrill() == UNDEFINED_DRILL_DIAMETER ? "-1" : fmtBIU( me->GetDrill() ).c_str() ); fprintf(m_fp, "De %d %d %d %lX %X\n", me->GetLayer(), type, me->GetNet(), Loading Loading
pcbnew/files.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -456,8 +456,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF pcbFileName = GetScreen()->GetFileName(); #if defined( USE_NEW_PCBNEW_LOAD ) || defined( USE_NEW_PCBNEW_SAVE ) if( pcbFileName.GetExt().IsEmpty() ) pcbFileName.SetExt( IO_MGR::GetFileExtension( (IO_MGR::PCB_FILE_T) wildcardIndex ) ); #endif if( !IsWritable( pcbFileName ) ) return false; Loading @@ -468,9 +470,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF backupFileName = pcbFileName; backupFileName.SetExt( pcbBackupFileExtension ); /* If an old backup file exists, delete it. If an old board file exists, rename * it to the backup file name */ // If an old backup file exists, delete it. If an old board file exists, rename // it to the backup file name. if( pcbFileName.FileExists() ) { // Remove the old file xxx.000 if it exists. Loading
pcbnew/legacy_plugin.cpp +29 −7 Original line number Diff line number Diff line Loading @@ -317,11 +317,15 @@ void LEGACY_PLUGIN::checkVersion() int ver = 1; // if sccanf fails sscanf( line, "PCBNEW-BOARD Version %d", &ver ); #if !defined(DEBUG) if( ver > LEGACY_BOARD_FILE_VERSION ) { m_error.Printf( VERSION_ERROR_FORMAT, ver ); // "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." m_error.Printf( VERSION_ERROR_FORMAT, m_reader->GetSource().GetData(), ver, LEGACY_BOARD_FILE_VERSION ); THROW_IO_ERROR( m_error ); } #endif m_loading_format_version = ver; } Loading @@ -343,8 +347,14 @@ void LEGACY_PLUGIN::loadGENERAL() { #if defined(USE_PCBNEW_NANOMETRES) diskToBiu = 1000000.0; #elif defined(DEBUG) // mm to deci-mils: // advanced testing of round tripping only, not supported in non DEBUG build diskToBiu = 10000/25.4; #else THROW_IO_ERROR( _( "May not load new *.brd file into 'PCBNew compiled for deci-mils'" ) ); THROW_IO_ERROR( _( "May not load millimeter *.brd file into 'PCBNew compiled for deci-mils'" ) ); #endif } } Loading Loading @@ -1887,7 +1897,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType ) // optional 7th drill parameter (must be optional in an old format?) data = strtok( (char*) data, delims ); BIU drill = data ? biuParse( data ) : -1; // SetDefault() if -1 BIU drill = data ? biuParse( data ) : -1; // SetDefault() if < 0 // Read the 2nd line to determine the exact type, one of: // PCB_TRACE_T, PCB_VIA_T, or PCB_ZONE_T. The type field in 2nd line Loading Loading @@ -1952,7 +1962,7 @@ void LEGACY_PLUGIN::loadTrackList( TRACK* aInsertBeforeMe, int aStructType ) newTrack->SetWidth( width ); newTrack->SetShape( shape ); if( drill <= 0 ) if( drill < 0 ) newTrack->SetDrillDefault(); else newTrack->SetDrill( drill ); Loading Loading @@ -2619,6 +2629,17 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) if( nptrptr ) *nptrptr = nptr; #if defined(DEBUG) if( diskToBiu == 10000/25.4 ) { // this is the special reverse trip mm -> deci-mils testing run, // only available in DEBUG mode. return BIU( wxRound( fval * diskToBiu ) ); } #endif // There should be no rounding issues here, since the values in the file initially // came from integers via biuFmt(). In fact this product should be an integer, exactly. return BIU( fval * diskToBiu ); Loading Loading @@ -2911,6 +2932,8 @@ void LEGACY_PLUGIN::saveSETUP() const fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( m_board->GetOriginAxisPosition() ).c_str() ); fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() ); { STRING_FORMATTER sf; Loading @@ -2924,8 +2947,6 @@ void LEGACY_PLUGIN::saveSETUP() const fprintf( m_fp, "PcbPlotParams %s\n", TO_UTF8( record ) ); } fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() ); fprintf( m_fp, "$EndSETUP\n\n" ); } Loading Loading @@ -3454,7 +3475,8 @@ void LEGACY_PLUGIN::saveTRACK( const TRACK* me ) const fmtBIUPoint( me->GetStart() ).c_str(), fmtBIUPoint( me->GetEnd() ).c_str(), fmtBIU( me->GetWidth() ).c_str(), fmtBIU( me->GetDrill() ).c_str() ); me->GetDrill() == UNDEFINED_DRILL_DIAMETER ? "-1" : fmtBIU( me->GetDrill() ).c_str() ); fprintf(m_fp, "De %d %d %d %lX %X\n", me->GetLayer(), type, me->GetNet(), Loading