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 ...@@ -388,7 +388,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString msg; wxString msg;
bool saveok = true; bool saveok = true;
FILE* dest;
if( aFileName == wxEmptyString ) if( aFileName == wxEmptyString )
{ {
...@@ -447,7 +446,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -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" ) ); dest = wxFopen( pcbFileName.GetFullPath(), wxT( "wt" ) );
if( dest == 0 ) if( dest == 0 )
...@@ -466,6 +468,24 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -466,6 +468,24 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
fclose( dest ); 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: */ /* Display the file names: */
m_messagePanel->EraseMsgBox(); m_messagePanel->EraseMsgBox();
...@@ -481,7 +501,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF ...@@ -481,7 +501,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
upperTxt = _( "Backup file: " ) + backupFileName.GetFullPath(); upperTxt = _( "Backup file: " ) + backupFileName.GetFullPath();
} }
if( dest ) if( saveok )
lowerTxt = _( "Wrote board file: " ); lowerTxt = _( "Wrote board file: " );
else else
lowerTxt = _( "Failed to create " ); lowerTxt = _( "Failed to create " );
......
...@@ -1160,7 +1160,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile ) ...@@ -1160,7 +1160,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
// Switch the locale to standard C (needed to print floating point numbers // Switch the locale to standard C (needed to print floating point numbers
// like 1.3) // like 1.3)
SetLocaleTo_C_standard(); LOCALE_IO toggle;
/* Writing file header. */ /* Writing file header. */
fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION, fprintf( aFile, "PCBNEW-BOARD Version %d date %s\n\n", BOARD_FILE_VERSION,
...@@ -1179,7 +1179,6 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile ) ...@@ -1179,7 +1179,6 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
rc = GetBoard()->Save( aFile ); rc = GetBoard()->Save( aFile );
SetLocaleTo_Default(); // revert to the current locale
wxEndBusyCursor(); wxEndBusyCursor();
if( !rc ) 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