Commit d5a17363 authored by Dick Hollenbeck's avatar Dick Hollenbeck

minor

parent 74ccc4b5
......@@ -388,7 +388,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString msg;
bool saveok = true;
FILE* dest;
if( aFileName == wxEmptyString )
{
......@@ -447,7 +446,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
}
}
/* Create the file */
#if !defined(USE_NEW_PCBNEW_SAVE)
// Create the file
FILE* dest;
dest = wxFopen( pcbFileName.GetFullPath(), wxT( "wt" ) );
if( dest == 0 )
......@@ -466,6 +468,24 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
fclose( dest );
}
#else
try
{
IO_MGR::Save( IO_MGR::KICAD, pcbFileName.GetFullPath(), GetBoard(), NULL ); // overload
}
catch( IO_ERROR ioe )
{
wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
ioe.errorText.GetData() );
wxMessageBox( msg, _( "Save Board File" ), wxICON_ERROR );
saveok = false;
}
#endif
/* Display the file names: */
m_messagePanel->EraseMsgBox();
......@@ -481,7 +501,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
upperTxt = _( "Backup file: " ) + backupFileName.GetFullPath();
}
if( dest )
if( saveok )
lowerTxt = _( "Wrote board file: " );
else
lowerTxt = _( "Failed to create " );
......
......@@ -1160,7 +1160,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// Switch the locale to standard C (needed to print floating point numbers
// like 1.3)
SetLocaleTo_C_standard();
LOCALE_IO toggle;
/* Writing file header. */
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
......@@ -1179,7 +1179,6 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
rc = GetBoard()->Save( aFile );
SetLocaleTo_Default(); // revert to the current locale
wxEndBusyCursor();
if( !rc )
......
This diff is collapsed.
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