fix pcbnew file save as problem, if previous file by same basename did not exist. Show default file ext.

This commit is contained in:
Dick Hollenbeck 2012-12-14 13:42:38 -06:00
parent 760d02e4d2
commit 1b4f7d6ce5
1 changed files with 14 additions and 7 deletions

View File

@ -415,7 +415,14 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wildcard << wxGetTranslation( PcbFileWildcard ) << wxChar( '|' ) << wildcard << wxGetTranslation( PcbFileWildcard ) << wxChar( '|' ) <<
wxGetTranslation( LegacyPcbFileWildcard ); wxGetTranslation( LegacyPcbFileWildcard );
wxFileDialog dlg( this, _( "Save Board File As" ), wxEmptyString, GetBoard()->GetFileName(), pcbFileName = GetBoard()->GetFileName();
// Match the default wildcard filter choice, with the inital file extension shown.
// That'll be the extension unless user changes filter dropdown listbox.
pcbFileName.SetExt( KiCadPcbFileExtension );
wxFileDialog dlg( this, _( "Save Board File As" ), wxEmptyString,
pcbFileName.GetFullPath(),
wildcard, wxFD_SAVE wildcard, wxFD_SAVE
/* wxFileDialog is not equipped to handle multiple wildcards and /* wxFileDialog is not equipped to handle multiple wildcards and
wxFD_OVERWRITE_PROMPT both together. wxFD_OVERWRITE_PROMPT both together.
@ -431,6 +438,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
pluginType = ( filterNdx == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD; pluginType = ( filterNdx == 1 ) ? IO_MGR::LEGACY : IO_MGR::KICAD;
// Note: on Linux wxFileDialog is not reliable for noticing a changed filename. // Note: on Linux wxFileDialog is not reliable for noticing a changed filename.
// We probably need to file a bug report or implement our own derivation.
pcbFileName = dlg.GetPath(); pcbFileName = dlg.GetPath();
@ -487,7 +495,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
else else
{ {
backupFileName.Clear(); backupFileName.Clear();
saveok = false;
} }
} }