Bugfix #1322914: pcbnew crashes when opening a file

This commit is contained in:
Maciej Suminski 2014-05-25 17:36:24 +02:00
parent c87baa9d22
commit 3087c05a5d
2 changed files with 581 additions and 587 deletions

View File

@ -91,17 +91,28 @@ class FP_CACHE_ITEM
public: public:
FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ); FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName );
wxString GetName() const { return m_file_name.GetDirs().Last(); } wxString GetName() const
wxFileName GetFileName() const { return m_file_name; } {
return m_file_name.GetDirs().Last();
}
wxFileName GetFileName() const
{
return m_file_name;
}
/// Tell if the disk content or the lib_path has changed. /// Tell if the disk content or the lib_path has changed.
bool IsModified() const; bool IsModified() const;
MODULE* GetModule() const { return m_module.get(); } MODULE* GetModule() const
void UpdateModificationTime() { m_mod_time = m_file_name.GetModificationTime(); } {
return m_module.get();
}
void UpdateModificationTime()
{
m_mod_time = m_file_name.GetModificationTime();
}
}; };
FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ) : FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ) :
m_module( aModule ) m_module( aModule )
{ {
@ -113,27 +124,24 @@ FP_CACHE_ITEM::FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName ) :
m_mod_time.Now(); m_mod_time.Now();
} }
bool FP_CACHE_ITEM::IsModified() const bool FP_CACHE_ITEM::IsModified() const
{ {
if( !m_file_name.FileExists() ) if( !m_file_name.FileExists() )
return false; return false;
wxLogTrace( traceFootprintLibrary, wxT( "File '%s', m_mod_time %s-%s, file mod time: %s-%s." ), wxLogTrace( traceFootprintLibrary, wxT( "File '%s', m_mod_time %s-%s, file mod time: %s-%s." ),
GetChars( m_file_name.GetFullPath() ), GetChars( m_file_name.GetFullPath() ), GetChars( m_mod_time.FormatDate() ),
GetChars( m_mod_time.FormatDate() ), GetChars( m_mod_time.FormatTime() ), GetChars( m_mod_time.FormatTime() ),
GetChars( m_file_name.GetModificationTime().FormatDate() ), GetChars( m_file_name.GetModificationTime().FormatDate() ),
GetChars( m_file_name.GetModificationTime().FormatTime() ) ); GetChars( m_file_name.GetModificationTime().FormatTime() ) );
return m_file_name.GetModificationTime() != m_mod_time; return m_file_name.GetModificationTime() != m_mod_time;
} }
typedef boost::ptr_map<std::string, FP_CACHE_ITEM> MODULE_MAP; typedef boost::ptr_map<std::string, FP_CACHE_ITEM> MODULE_MAP;
typedef MODULE_MAP::iterator MODULE_ITER; typedef MODULE_MAP::iterator MODULE_ITER;
typedef MODULE_MAP::const_iterator MODULE_CITER; typedef MODULE_MAP::const_iterator MODULE_CITER;
class FP_CACHE class FP_CACHE
{ {
PCB_IO* m_owner; /// Plugin object that owns the cache. PCB_IO* m_owner; /// Plugin object that owns the cache.
@ -144,10 +152,22 @@ class FP_CACHE
public: public:
FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ); FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath );
wxString GetPath() const { return m_lib_path.GetPath(); } wxString GetPath() const
wxDateTime GetLastModificationTime() const { return m_mod_time; } {
bool IsWritable() const { return m_lib_path.IsOk() && m_lib_path.IsDirWritable(); } return m_lib_path.GetPath();
MODULE_MAP& GetModules() { return m_modules; } }
wxDateTime GetLastModificationTime() const
{
return m_mod_time;
}
bool IsWritable() const
{
return m_lib_path.IsOk() && m_lib_path.IsDirWritable();
}
MODULE_MAP& GetModules()
{
return m_modules;
}
// Most all functions in this class throw IO_ERROR exceptions. There are no // Most all functions in this class throw IO_ERROR exceptions. There are no
// error codes nor user interface calls from here, nor in any PLUGIN. // error codes nor user interface calls from here, nor in any PLUGIN.
@ -191,31 +211,30 @@ public:
bool IsPath( const wxString& aPath ) const; bool IsPath( const wxString& aPath ) const;
}; };
FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath ) FP_CACHE::FP_CACHE( PCB_IO* aOwner, const wxString& aLibraryPath )
{ {
m_owner = aOwner; m_owner = aOwner;
m_lib_path.SetPath( aLibraryPath ); m_lib_path.SetPath( aLibraryPath );
} }
wxDateTime FP_CACHE::GetLibModificationTime() const wxDateTime FP_CACHE::GetLibModificationTime() const
{ {
return m_lib_path.GetModificationTime(); return m_lib_path.GetModificationTime();
} }
void FP_CACHE::Save() void FP_CACHE::Save()
{ {
if( !m_lib_path.DirExists() && !m_lib_path.Mkdir() ) if( !m_lib_path.DirExists() && !m_lib_path.Mkdir() )
{ {
THROW_IO_ERROR( wxString::Format( _( "Cannot create footprint library path '%s'" ), THROW_IO_ERROR(
wxString::Format( _( "Cannot create footprint library path '%s'" ),
m_lib_path.GetPath().GetData() ) ); m_lib_path.GetPath().GetData() ) );
} }
if( !m_lib_path.IsDirWritable() ) if( !m_lib_path.IsDirWritable() )
{ {
THROW_IO_ERROR( wxString::Format( _( "Footprint library path '%s' is read only" ), THROW_IO_ERROR(
wxString::Format( _( "Footprint library path '%s' is read only" ),
GetChars( m_lib_path.GetPath() ) ) ); GetChars( m_lib_path.GetPath() ) ) );
} }
@ -246,9 +265,7 @@ void FP_CACHE::Save()
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format(
_( "Cannot rename temporary file '%s' to footprint library file '%s'" ), _( "Cannot rename temporary file '%s' to footprint library file '%s'" ),
GetChars( tempFileName ), GetChars( tempFileName ), GetChars( fn.GetFullPath() ) );
GetChars( fn.GetFullPath() )
);
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
@ -257,17 +274,14 @@ void FP_CACHE::Save()
} }
} }
void FP_CACHE::Load() void FP_CACHE::Load()
{ {
wxDir dir( m_lib_path.GetPath() ); wxDir dir( m_lib_path.GetPath() );
if( !dir.IsOpened() ) if( !dir.IsOpened() )
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format( _( "Footprint library path '%s' does not exist" ),
_( "Footprint library path '%s' does not exist" ), GetChars( m_lib_path.GetPath() ) );
GetChars( m_lib_path.GetPath() )
);
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
@ -302,7 +316,6 @@ void FP_CACHE::Load()
} }
} }
void FP_CACHE::Remove( const wxString& aFootprintName ) void FP_CACHE::Remove( const wxString& aFootprintName )
{ {
@ -312,11 +325,8 @@ void FP_CACHE::Remove( const wxString& aFootprintName )
if( it == m_modules.end() ) if( it == m_modules.end() )
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format( _( "library '%s' has no footprint '%s' to delete" ),
_( "library '%s' has no footprint '%s' to delete" ), GetChars( m_lib_path.GetPath() ), GetChars( aFootprintName ) );
GetChars( m_lib_path.GetPath() ),
GetChars( aFootprintName )
);
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
@ -326,7 +336,6 @@ void FP_CACHE::Remove( const wxString& aFootprintName )
wxRemoveFile( fullPath ); wxRemoveFile( fullPath );
} }
bool FP_CACHE::IsPath( const wxString& aPath ) const bool FP_CACHE::IsPath( const wxString& aPath ) const
{ {
// Converts path separators to native path separators // Converts path separators to native path separators
@ -336,7 +345,6 @@ bool FP_CACHE::IsPath( const wxString& aPath ) const
return m_lib_path == newPath; return m_lib_path == newPath;
} }
bool FP_CACHE::IsModified( const wxString& aLibPath, const wxString& aFootprintName ) const bool FP_CACHE::IsModified( const wxString& aLibPath, const wxString& aFootprintName ) const
{ {
// The library is modified if the library path got deleted or changed. // The library is modified if the library path got deleted or changed.
@ -370,8 +378,7 @@ bool FP_CACHE::IsModified( const wxString& aLibPath, const wxString& aFootprintN
return true; return true;
} }
} }
} } else
else
{ {
MODULE_CITER it = m_modules.find( TO_UTF8( aFootprintName ) ); MODULE_CITER it = m_modules.find( TO_UTF8( aFootprintName ) );
@ -382,7 +389,6 @@ bool FP_CACHE::IsModified( const wxString& aLibPath, const wxString& aFootprintN
return false; return false;
} }
void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties ) void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -406,7 +412,6 @@ void PCB_IO::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* a
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
BOARD_ITEM* PCB_IO::Parse( const wxString& aClipboardSourceInput ) throw( PARSE_ERROR, IO_ERROR ) BOARD_ITEM* PCB_IO::Parse( const wxString& aClipboardSourceInput ) throw( PARSE_ERROR, IO_ERROR )
{ {
std::string input = TO_UTF8( aClipboardSourceInput ); std::string input = TO_UTF8( aClipboardSourceInput );
@ -418,9 +423,7 @@ BOARD_ITEM* PCB_IO::Parse( const wxString& aClipboardSourceInput ) throw( PARSE_
return m_parser->Parse(); return m_parser->Parse();
} }
void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
throw( IO_ERROR )
{ {
LOCALE_IO toggle; // public API function, perform anything convenient for caller LOCALE_IO toggle; // public API function, perform anything convenient for caller
@ -476,7 +479,6 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
} }
} }
void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
{ {
if( m_ctl & CTL_STD_LAYER_NAMES ) if( m_ctl & CTL_STD_LAYER_NAMES )
@ -485,14 +487,11 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
// English layer names should never need quoting. // English layer names should never need quoting.
m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetStandardLayerName( layer ) ) ); m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetStandardLayerName( layer ) ) );
} } else
else
m_out->Print( 0, " (layer %s)", m_out->Quotew( aItem->GetLayerName() ).c_str() ); m_out->Print( 0, " (layer %s)", m_out->Quotew( aItem->GetLayerName() ).c_str() );
} }
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
throw( IO_ERROR )
{ {
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings(); const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
@ -664,8 +663,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
FMTIU( aBoard->GetGridOrigin().x ).c_str(), FMTIU( aBoard->GetGridOrigin().x ).c_str(),
FMTIU( aBoard->GetGridOrigin().y ).c_str() ); FMTIU( aBoard->GetGridOrigin().y ).c_str() );
m_out->Print( aNestLevel+1, "(visible_elements %X)\n", m_out->Print( aNestLevel + 1, "(visible_elements %X)\n", dsnSettings.GetVisibleElements() );
dsnSettings.GetVisibleElements() );
aBoard->GetPlotOptions().Format( m_out, aNestLevel + 1 ); aBoard->GetPlotOptions().Format( m_out, aNestLevel + 1 );
@ -675,8 +673,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end(); for( NETINFO_MAPPING::iterator net = m_mapping->begin(), netEnd = m_mapping->end();
net != netEnd; ++net ) net != netEnd; ++net )
{ {
m_out->Print( aNestLevel, "(net %d %s)\n", m_out->Print( aNestLevel, "(net %d %s)\n", m_mapping->Translate( net->GetNet() ),
m_mapping->Translate( net->GetNet() ),
m_out->Quotew( net->GetNetname() ).c_str() ); m_out->Quotew( net->GetNetname() ).c_str() );
} }
@ -689,8 +686,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
// Save the rest of the net classes alphabetically. // Save the rest of the net classes alphabetically.
for( NETCLASSES::const_iterator it = dsnSettings.m_NetClasses.begin(); for( NETCLASSES::const_iterator it = dsnSettings.m_NetClasses.begin();
it != dsnSettings.m_NetClasses.end(); it != dsnSettings.m_NetClasses.end(); ++it )
++it )
{ {
NETCLASS netclass = *it->second; NETCLASS netclass = *it->second;
filterNetClass( *aBoard, netclass ); // Remove empty nets (from a copy of a netclass) filterNetClass( *aBoard, netclass ); // Remove empty nets (from a copy of a netclass)
@ -728,9 +724,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
Format( aBoard->GetArea( i ), aNestLevel ); Format( aBoard->GetArea( i ), aNestLevel );
} }
void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
throw( IO_ERROR )
{ {
m_out->Print( aNestLevel, "(dimension %s (width %s)", m_out->Print( aNestLevel, "(dimension %s (width %s)",
FMT_IU( aDimension->GetValue() ).c_str(), FMT_IU( aDimension->GetValue() ).c_str(),
@ -790,9 +784,7 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
throw( IO_ERROR )
{ {
unsigned i; unsigned i;
@ -856,9 +848,7 @@ void PCB_IO::format( DRAWSEGMENT* aSegment, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
throw( IO_ERROR )
{ {
switch (aModuleDrawing->GetShape()) switch (aModuleDrawing->GetShape())
{ {
@ -930,9 +920,7 @@ void PCB_IO::format( EDGE_MODULE* aModuleDrawing, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const
throw( IO_ERROR )
{ {
m_out->Print( aNestLevel, "(target %s (at %s) (size %s)", m_out->Print( aNestLevel, "(target %s (at %s) (size %s)",
( aTarget->GetShape() ) ? "x" : "plus", ( aTarget->GetShape() ) ? "x" : "plus",
@ -950,9 +938,7 @@ void PCB_IO::format( PCB_TARGET* aTarget, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
void PCB_IO::format( MODULE* aModule, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
throw( IO_ERROR )
{ {
if( ! ( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) ) if( ! ( m_ctl & CTL_OMIT_INITIAL_COMMENTS ) )
{ {
@ -967,8 +953,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
} }
} }
m_out->Print( aNestLevel, "(module %s", m_out->Print( aNestLevel, "(module %s", m_out->Quotes( aModule->GetFPID().Format() ).c_str() );
m_out->Quotes( aModule->GetFPID().Format() ).c_str() );
if( aModule->IsLocked() ) if( aModule->IsLocked() )
m_out->Print( 0, " locked" ); m_out->Print( 0, " locked" );
@ -980,10 +965,9 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
if( ! ( m_ctl & CTL_OMIT_TSTAMPS ) ) if( ! ( m_ctl & CTL_OMIT_TSTAMPS ) )
{ {
m_out->Print( 0, " (tedit %lX) (tstamp %lX)\n", m_out->Print( 0, " (tedit %lX) (tstamp %lX)\n", aModule->GetLastEditTime(),
aModule->GetLastEditTime(), aModule->GetTimeStamp() ); aModule->GetTimeStamp() );
} } else
else
m_out->Print( 0, "\n" ); m_out->Print( 0, "\n" );
if( ! ( m_ctl & CTL_OMIT_AT ) ) if( ! ( m_ctl & CTL_OMIT_AT ) )
@ -1005,8 +989,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
m_out->Quotew( aModule->GetKeywords() ).c_str() ); m_out->Quotew( aModule->GetKeywords() ).c_str() );
if( ! ( m_ctl & CTL_OMIT_PATH ) && !!aModule->GetPath() ) if( ! ( m_ctl & CTL_OMIT_PATH ) && !!aModule->GetPath() )
m_out->Print( aNestLevel+1, "(path %s)\n", m_out->Print( aNestLevel + 1, "(path %s)\n", m_out->Quotew( aModule->GetPath() ).c_str() );
m_out->Quotew( aModule->GetPath() ).c_str() );
if( aModule->GetPlacementCost90() != 0 ) if( aModule->GetPlacementCost90() != 0 )
m_out->Print( aNestLevel + 1, "(autoplace_cost90 %d)\n", aModule->GetPlacementCost90() ); m_out->Print( aNestLevel + 1, "(autoplace_cost90 %d)\n", aModule->GetPlacementCost90() );
@ -1096,9 +1079,7 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
throw( IO_ERROR )
{ {
std::string output; std::string output;
@ -1118,32 +1099,35 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
{ {
output += " *.Cu"; output += " *.Cu";
aLayerMask &= ~ALL_CU_LAYERS; // clear bits, so they are not output again below aLayerMask &= ~ALL_CU_LAYERS; // clear bits, so they are not output again below
} } else if( ( aLayerMask & cuMask ) == ( LAYER_BACK | LAYER_FRONT ) )
else if( ( aLayerMask & cuMask ) == (LAYER_BACK | LAYER_FRONT) )
{ {
output += " F&B.Cu"; output += " F&B.Cu";
aLayerMask &= ~ ( LAYER_BACK | LAYER_FRONT ); aLayerMask &= ~ ( LAYER_BACK | LAYER_FRONT );
} }
if( ( aLayerMask & (ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT)) == (ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT) ) if( ( aLayerMask & ( ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT ) )
== ( ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT ) )
{ {
output += " *.Adhes"; output += " *.Adhes";
aLayerMask &= ~ ( ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT ); aLayerMask &= ~ ( ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT );
} }
if( ( aLayerMask & (SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT)) == (SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT) ) if( ( aLayerMask & ( SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) )
== ( SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ) )
{ {
output += " *.Paste"; output += " *.Paste";
aLayerMask &= ~ ( SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT ); aLayerMask &= ~ ( SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT );
} }
if( ( aLayerMask & (SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT)) == (SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT) ) if( ( aLayerMask & ( SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ) )
== ( SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ) )
{ {
output += " *.SilkS"; output += " *.SilkS";
aLayerMask &= ~ ( SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ); aLayerMask &= ~ ( SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT );
} }
if( ( aLayerMask & (SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT)) == (SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT) ) if( ( aLayerMask & ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) )
== ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ) )
{ {
output += " *.Mask"; output += " *.Mask";
aLayerMask &= ~ ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); aLayerMask &= ~ ( SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT );
@ -1163,7 +1147,8 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
if( m_board && ! ( m_ctl & CTL_STD_LAYER_NAMES ) ) if( m_board && ! ( m_ctl & CTL_STD_LAYER_NAMES ) )
layerName = m_board->GetLayerName( layer ); layerName = m_board->GetLayerName( layer );
else // I am being called from FootprintSave() else
// I am being called from FootprintSave()
layerName = BOARD::GetStandardLayerName( layer ); layerName = BOARD::GetStandardLayerName( layer );
output += ' '; output += ' ';
@ -1174,18 +1159,24 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const
m_out->Print( aNestLevel, "%s)", output.c_str() ); m_out->Print( aNestLevel, "%s)", output.c_str() );
} }
void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
throw( IO_ERROR )
{ {
const char* shape; const char* shape;
switch (aPad->GetShape()) switch (aPad->GetShape())
{ {
case PAD_CIRCLE: shape = "circle"; break; case PAD_CIRCLE:
case PAD_RECT: shape = "rect"; break; shape = "circle";
case PAD_OVAL: shape = "oval"; break; break;
case PAD_TRAPEZOID: shape = "trapezoid"; break; case PAD_RECT:
shape = "rect";
break;
case PAD_OVAL:
shape = "oval";
break;
case PAD_TRAPEZOID:
shape = "trapezoid";
break;
default: default:
THROW_IO_ERROR( wxString::Format( _( "unknown pad type: %d" ), aPad->GetShape() ) ); THROW_IO_ERROR( wxString::Format( _( "unknown pad type: %d" ), aPad->GetShape() ) );
@ -1195,19 +1186,26 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
switch (aPad->GetAttribute()) switch (aPad->GetAttribute())
{ {
case PAD_STANDARD: type = "thru_hole"; break; case PAD_STANDARD:
case PAD_SMD: type = "smd"; break; type = "thru_hole";
case PAD_CONN: type = "connect"; break; break;
case PAD_HOLE_NOT_PLATED: type = "np_thru_hole"; break; case PAD_SMD:
type = "smd";
break;
case PAD_CONN:
type = "connect";
break;
case PAD_HOLE_NOT_PLATED:
type = "np_thru_hole";
break;
default: default:
THROW_IO_ERROR( wxString::Format( _( "unknown pad attribute: %d" ), THROW_IO_ERROR(
aPad->GetAttribute() ) ); wxString::Format( _( "unknown pad attribute: %d" ), aPad->GetAttribute() ) );
} }
m_out->Print( aNestLevel, "(pad %s %s %s", m_out->Print( aNestLevel, "(pad %s %s %s", m_out->Quotew( aPad->GetPadName() ).c_str(), type,
m_out->Quotew( aPad->GetPadName() ).c_str(), shape );
type, shape );
m_out->Print( 0, " (at %s", FMT_IU( aPad->GetPos0() ).c_str() ); m_out->Print( 0, " (at %s", FMT_IU( aPad->GetPos0() ).c_str() );
if( aPad->GetOrientation() != 0.0 ) if( aPad->GetOrientation() != 0.0 )
@ -1222,8 +1220,8 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
wxSize sz = aPad->GetDrillSize(); wxSize sz = aPad->GetDrillSize();
wxPoint shapeoffset = aPad->GetOffset(); wxPoint shapeoffset = aPad->GetOffset();
if( (sz.GetWidth() > 0) || (sz.GetHeight() > 0) || if( ( sz.GetWidth() > 0 ) || ( sz.GetHeight() > 0 ) || ( shapeoffset.x != 0 )
(shapeoffset.x != 0) || (shapeoffset.y != 0) ) || ( shapeoffset.y != 0 ) )
{ {
m_out->Print( 0, " (drill" ); m_out->Print( 0, " (drill" );
@ -1247,7 +1245,7 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
std::string output; std::string output;
// Unconnected pad is default net so don't save it. // Unconnected pad is default net so don't save it.
if( !(m_ctl & CTL_OMIT_NETS) && aPad->GetNetCode() != 0 ) if( ! ( m_ctl & CTL_OMIT_NETS ) && aPad->GetNetCode() != NETINFO_LIST::UNCONNECTED )
StrPrintf( &output, " (net %d %s)", m_mapping->Translate( aPad->GetNetCode() ), StrPrintf( &output, " (net %d %s)", m_mapping->Translate( aPad->GetNetCode() ),
m_out->Quotew( aPad->GetNetname() ).c_str() ); m_out->Quotew( aPad->GetNetname() ).c_str() );
@ -1285,12 +1283,9 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
void PCB_IO::format( TEXTE_PCB* aText, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( TEXTE_PCB* aText, int aNestLevel ) const
throw( IO_ERROR )
{ {
m_out->Print( aNestLevel, "(gr_text %s (at %s", m_out->Print( aNestLevel, "(gr_text %s (at %s", m_out->Quotew( aText->GetText() ).c_str(),
m_out->Quotew( aText->GetText() ).c_str(),
FMT_IU( aText->GetTextPosition() ).c_str() ); FMT_IU( aText->GetTextPosition() ).c_str() );
if( aText->GetOrientation() != 0.0 ) if( aText->GetOrientation() != 0.0 )
@ -1310,9 +1305,7 @@ void PCB_IO::format( TEXTE_PCB* aText, int aNestLevel ) const
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
throw( IO_ERROR )
{ {
MODULE* parent = (MODULE*) aText->GetParent(); MODULE* parent = (MODULE*) aText->GetParent();
double orient = aText->GetOrientation(); double orient = aText->GetOrientation();
@ -1320,9 +1313,14 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
switch (aText->GetType()) switch (aText->GetType())
{ {
case TEXTE_MODULE::TEXT_is_REFERENCE: type = wxT( "reference" ); break; case TEXTE_MODULE::TEXT_is_REFERENCE:
case TEXTE_MODULE::TEXT_is_VALUE: type = wxT( "value" ); break; type = wxT( "reference" );
default: type = wxT( "user" ); break;
case TEXTE_MODULE::TEXT_is_VALUE:
type = wxT( "value" );
break;
default:
type = wxT( "user" );
} }
// Due to the Pcbnew history, m_Orient is saved in screen value // Due to the Pcbnew history, m_Orient is saved in screen value
@ -1330,8 +1328,7 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
if( parent ) if( parent )
orient += parent->GetOrientation(); orient += parent->GetOrientation();
m_out->Print( aNestLevel, "(fp_text %s %s (at %s", m_out->Print( aNestLevel, "(fp_text %s %s (at %s", m_out->Quotew( type ).c_str(),
m_out->Quotew( type ).c_str(),
m_out->Quotew( aText->GetText() ).c_str(), m_out->Quotew( aText->GetText() ).c_str(),
FMT_IU( aText->GetPos0() ).c_str() ); FMT_IU( aText->GetPos0() ).c_str() );
@ -1351,9 +1348,7 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
throw( IO_ERROR )
{ {
if( aTrack->Type() == PCB_VIA_T ) if( aTrack->Type() == PCB_VIA_T )
{ {
@ -1362,8 +1357,8 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
const VIA* via = static_cast<const VIA*>( aTrack ); const VIA* via = static_cast<const VIA*>( aTrack );
BOARD* board = (BOARD*) via->GetParent(); BOARD* board = (BOARD*) via->GetParent();
wxCHECK_RET( board != 0, wxT( "Via " ) + via->GetSelectMenuText() + wxCHECK_RET( board != 0,
wxT( " has no parent." ) ); wxT( "Via " ) + via->GetSelectMenuText() + wxT( " has no parent." ) );
m_out->Print( aNestLevel, "(via" ); m_out->Print( aNestLevel, "(via" );
@ -1396,8 +1391,7 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
m_out->Print( 0, " (layers %s %s)", m_out->Print( 0, " (layers %s %s)",
m_out->Quotew( m_board->GetLayerName( layer1 ) ).c_str(), m_out->Quotew( m_board->GetLayerName( layer1 ) ).c_str(),
m_out->Quotew( m_board->GetLayerName( layer2 ) ).c_str() ); m_out->Quotew( m_board->GetLayerName( layer2 ) ).c_str() );
} } else
else
{ {
m_out->Print( aNestLevel, "(segment (start %s) (end %s) (width %s)", m_out->Print( aNestLevel, "(segment (start %s) (end %s) (width %s)",
FMT_IU( aTrack->GetStart() ).c_str(), FMT_IU( aTrack->GetEnd() ).c_str(), FMT_IU( aTrack->GetStart() ).c_str(), FMT_IU( aTrack->GetEnd() ).c_str(),
@ -1417,9 +1411,7 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
} }
void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const throw( IO_ERROR )
void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
throw( IO_ERROR )
{ {
// Save the NET info; For keepout zones, net code and net name are irrelevant // Save the NET info; For keepout zones, net code and net name are irrelevant
// so be sure a dummy value is stored, just for ZONE_CONTAINER compatibility // so be sure a dummy value is stored, just for ZONE_CONTAINER compatibility
@ -1438,9 +1430,15 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
switch (aZone->GetHatchStyle()) switch (aZone->GetHatchStyle())
{ {
default: default:
case CPolyLine::NO_HATCH: hatch = "none"; break; case CPolyLine::NO_HATCH:
case CPolyLine::DIAGONAL_EDGE: hatch = "edge"; break; hatch = "none";
case CPolyLine::DIAGONAL_FULL: hatch = "full"; break; break;
case CPolyLine::DIAGONAL_EDGE:
hatch = "edge";
break;
case CPolyLine::DIAGONAL_FULL:
hatch = "full";
break;
} }
m_out->Print( 0, " (hatch %s %s)\n", hatch.c_str(), m_out->Print( 0, " (hatch %s %s)\n", hatch.c_str(),
@ -1514,7 +1512,8 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
break; break;
default: default:
THROW_IO_ERROR( wxString::Format( _( "unknown zone corner smoothing type %d" ), THROW_IO_ERROR(
wxString::Format( _( "unknown zone corner smoothing type %d" ),
aZone->GetCornerSmoothingType() ) ); aZone->GetCornerSmoothingType() ) );
} }
m_out->Print( 0, ")" ); m_out->Print( 0, ")" );
@ -1641,18 +1640,14 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel, ")\n" ); m_out->Print( aNestLevel, ")\n" );
} }
PCB_IO::PCB_IO( int aControlFlags ) : PCB_IO::PCB_IO( int aControlFlags ) :
m_cache( 0 ), m_cache( 0 ), m_ctl( aControlFlags ), m_parser( new PCB_PARSER() ),
m_ctl( aControlFlags ),
m_parser( new PCB_PARSER() ),
m_mapping( new NETINFO_MAPPING() ) m_mapping( new NETINFO_MAPPING() )
{ {
init( 0 ); init( 0 );
m_out = &m_sf; m_out = &m_sf;
} }
PCB_IO::~PCB_IO() PCB_IO::~PCB_IO()
{ {
delete m_cache; delete m_cache;
@ -1660,7 +1655,6 @@ PCB_IO::~PCB_IO()
delete m_mapping; delete m_mapping;
} }
BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties ) BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPERTIES* aProperties )
{ {
FILE_LINE_READER reader( aFileName ); FILE_LINE_READER reader( aFileName );
@ -1680,14 +1674,12 @@ BOARD* PCB_IO::Load( const wxString& aFileName, BOARD* aAppendToMe, const PROPER
return board; return board;
} }
void PCB_IO::init( const PROPERTIES* aProperties ) void PCB_IO::init( const PROPERTIES* aProperties )
{ {
m_board = NULL; m_board = NULL;
m_props = aProperties; m_props = aProperties;
} }
void PCB_IO::cacheLib( const wxString& aLibraryPath, const wxString& aFootprintName ) void PCB_IO::cacheLib( const wxString& aLibraryPath, const wxString& aFootprintName )
{ {
if( !m_cache || m_cache->IsModified( aLibraryPath, aFootprintName ) ) if( !m_cache || m_cache->IsModified( aLibraryPath, aFootprintName ) )
@ -1699,7 +1691,6 @@ void PCB_IO::cacheLib( const wxString& aLibraryPath, const wxString& aFootprintN
} }
} }
wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath, wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
@ -1709,7 +1700,8 @@ wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath,
if( !dir.IsOpened() ) if( !dir.IsOpened() )
{ {
THROW_IO_ERROR( wxString::Format( _( "footprint library path '%s' does not exist" ), THROW_IO_ERROR(
wxString::Format( _( "footprint library path '%s' does not exist" ),
GetChars( aLibraryPath ) ) ); GetChars( aLibraryPath ) ) );
} }
@ -1720,7 +1712,6 @@ wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath,
const MODULE_MAP& mods = m_cache->GetModules(); const MODULE_MAP& mods = m_cache->GetModules();
for( MODULE_CITER it = mods.begin(); it != mods.end(); ++it ) for( MODULE_CITER it = mods.begin(); it != mods.end(); ++it )
{ {
ret.Add( FROM_UTF8( it->first.c_str() ) ); ret.Add( FROM_UTF8( it->first.c_str() ) );
@ -1742,7 +1733,6 @@ wxArrayString PCB_IO::FootprintEnumerate( const wxString& aLibraryPath,
return ret; return ret;
} }
MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName, MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFootprintName,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
@ -1765,7 +1755,6 @@ MODULE* PCB_IO::FootprintLoad( const wxString& aLibraryPath, const wxString& aFo
return new MODULE( *it->second->GetModule() ); return new MODULE( *it->second->GetModule() );
} }
void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint, void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootprint,
const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
@ -1781,10 +1770,8 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
if( !m_cache->IsWritable() ) if( !m_cache->IsWritable() )
{ {
wxString msg = wxString::Format( wxString msg = wxString::Format( _( "Library '%s' is read only" ),
_( "Library '%s' is read only" ), GetChars( aLibraryPath ) );
GetChars( aLibraryPath )
);
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
@ -1794,17 +1781,20 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
MODULE_MAP& mods = m_cache->GetModules(); MODULE_MAP& mods = m_cache->GetModules();
// Quietly overwrite module and delete module file from path for any by same name. // Quietly overwrite module and delete module file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetFootprintName(), KiCadFootprintFileExtension ); wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetFootprintName(),
KiCadFootprintFileExtension );
if( !fn.IsOk() ) if( !fn.IsOk() )
{ {
THROW_IO_ERROR( wxString::Format( _( "Footprint file name '%s' is not valid." ), THROW_IO_ERROR(
wxString::Format( _( "Footprint file name '%s' is not valid." ),
GetChars( fn.GetFullPath() ) ) ); GetChars( fn.GetFullPath() ) ) );
} }
if( fn.FileExists() && !fn.IsFileWritable() ) if( fn.FileExists() && !fn.IsFileWritable() )
{ {
THROW_IO_ERROR( wxString::Format( _( "user does not have write permission to delete file '%s' " ), THROW_IO_ERROR(
wxString::Format( _( "user does not have write permission to delete file '%s' " ),
GetChars( fn.GetFullPath() ) ) ); GetChars( fn.GetFullPath() ) ) );
} }
@ -1836,8 +1826,8 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
m_cache->Save(); m_cache->Save();
} }
void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const PROPERTIES* aProperties ) const PROPERTIES* aProperties )
{ {
LOCALE_IO toggle; // toggles on, then off, the C locale. LOCALE_IO toggle; // toggles on, then off, the C locale.
@ -1847,19 +1837,19 @@ void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFoo
if( !m_cache->IsWritable() ) if( !m_cache->IsWritable() )
{ {
THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), THROW_IO_ERROR(
aLibraryPath.GetData() ) ); wxString::Format( _( "Library '%s' is read only" ), aLibraryPath.GetData() ) );
} }
m_cache->Remove( aFootprintName ); m_cache->Remove( aFootprintName );
} }
void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties ) void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{ {
if( wxDir::Exists( aLibraryPath ) ) if( wxDir::Exists( aLibraryPath ) )
{ {
THROW_IO_ERROR( wxString::Format( _( "cannot overwrite library path '%s'" ), THROW_IO_ERROR(
wxString::Format( _( "cannot overwrite library path '%s'" ),
aLibraryPath.GetData() ) ); aLibraryPath.GetData() ) );
} }
@ -1872,7 +1862,6 @@ void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, const PROPERTIES*
m_cache->Save(); m_cache->Save();
} }
bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties ) bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{ {
wxFileName fn; wxFileName fn;
@ -1884,7 +1873,8 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
if( !fn.IsDirWritable() ) if( !fn.IsDirWritable() )
{ {
THROW_IO_ERROR( wxString::Format( _( "user does not have permission to delete directory '%s'" ), THROW_IO_ERROR(
wxString::Format( _( "user does not have permission to delete directory '%s'" ),
aLibraryPath.GetData() ) ); aLibraryPath.GetData() ) );
} }
@ -1892,7 +1882,8 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
if( dir.HasSubDirs() ) if( dir.HasSubDirs() )
{ {
THROW_IO_ERROR( wxString::Format( _( "library directory '%s' has unexpected sub-directories" ), THROW_IO_ERROR(
wxString::Format( _( "library directory '%s' has unexpected sub-directories" ),
aLibraryPath.GetData() ) ); aLibraryPath.GetData() ) );
} }
@ -1911,7 +1902,9 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
if( tmp.GetExt() != KiCadFootprintFileExtension ) if( tmp.GetExt() != KiCadFootprintFileExtension )
{ {
THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' was found in library path '%s'" ), THROW_IO_ERROR(
wxString::Format(
_( "unexpected file '%s' was found in library path '%s'" ),
files[i].GetData(), aLibraryPath.GetData() ) ); files[i].GetData(), aLibraryPath.GetData() ) );
} }
} }
@ -1929,7 +1922,8 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
// we don't want that. we want bare metal portability with no UI here. // we don't want that. we want bare metal portability with no UI here.
if( !wxRmdir( aLibraryPath ) ) if( !wxRmdir( aLibraryPath ) )
{ {
THROW_IO_ERROR( wxString::Format( _( "footprint library '%s' cannot be deleted" ), THROW_IO_ERROR(
wxString::Format( _( "footprint library '%s' cannot be deleted" ),
aLibraryPath.GetData() ) ); aLibraryPath.GetData() ) );
} }
@ -1949,7 +1943,6 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
return true; return true;
} }
bool PCB_IO::IsFootprintLibWritable( const wxString& aLibraryPath ) bool PCB_IO::IsFootprintLibWritable( const wxString& aLibraryPath )
{ {
LOCALE_IO toggle; LOCALE_IO toggle;

View File

@ -3368,7 +3368,8 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const
fprintf( m_fp, "At %s N %08X\n", texttype, me->GetLayerMask() ); fprintf( m_fp, "At %s N %08X\n", texttype, me->GetLayerMask() );
fprintf( m_fp, "Ne %d %s\n", me->GetNetCode(), EscapedUTF8( me->GetNetname() ).c_str() ); fprintf( m_fp, "Ne %d %s\n", m_mapping->Translate( me->GetNetCode() ),
EscapedUTF8( me->GetNetname() ).c_str() );
fprintf( m_fp, "Po %s\n", fmtBIUPoint( me->GetPos0() ).c_str() ); fprintf( m_fp, "Po %s\n", fmtBIUPoint( me->GetPos0() ).c_str() );
@ -3635,7 +3636,7 @@ void LEGACY_PLUGIN::saveTRACK( const TRACK* me ) const
"-1" : fmtBIU( drill ).c_str() ); "-1" : fmtBIU( drill ).c_str() );
fprintf(m_fp, "De %d %d %d %lX %X\n", fprintf(m_fp, "De %d %d %d %lX %X\n",
me->GetLayer(), type, me->GetNetCode(), me->GetLayer(), type, m_mapping->Translate( me->GetNetCode() ),
me->GetTimeStamp(), me->GetStatus() ); me->GetTimeStamp(), me->GetStatus() );
} }
@ -3649,7 +3650,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
// just for ZONE_CONTAINER compatibility // just for ZONE_CONTAINER compatibility
fprintf( m_fp, "ZInfo %lX %d %s\n", fprintf( m_fp, "ZInfo %lX %d %s\n",
me->GetTimeStamp(), me->GetTimeStamp(),
me->GetIsKeepout() ? 0 : me->GetNetCode(), me->GetIsKeepout() ? 0 : m_mapping->Translate( me->GetNetCode() ),
EscapedUTF8( me->GetIsKeepout() ? wxT("") : me->GetNetname() ).c_str() ); EscapedUTF8( me->GetIsKeepout() ? wxT("") : me->GetNetname() ).c_str() );
// Save the outline layer info // Save the outline layer info