Browse Source

Don't try to switch projects during autosave

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4800
pull/16/head
Jon Evans 6 years ago
parent
commit
3ebd5b317b
  1. 9
      pcbnew/files.cpp
  2. 4
      pcbnew/pcb_edit_frame.h

9
pcbnew/files.cpp

@ -346,7 +346,7 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
if( id == ID_COPY_BOARD_AS ) if( id == ID_COPY_BOARD_AS )
return SavePcbCopy( filename ); return SavePcbCopy( filename );
else else
return SavePcbFile( filename, false );
return SavePcbFile( filename, false, false );
} }
return false; return false;
} }
@ -674,7 +674,8 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory )
bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
bool aChangeProject )
{ {
// please, keep it simple. prompting goes elsewhere. // please, keep it simple. prompting goes elsewhere.
@ -697,7 +698,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory )
wxFileName projectFile( pcbFileName ); wxFileName projectFile( pcbFileName );
projectFile.SetExt( ProjectFileExtension ); projectFile.SetExt( ProjectFileExtension );
if( !projectFile.FileExists() )
if( aChangeProject && !projectFile.FileExists() )
{ {
// If this is a new board, project filename won't be set yet // If this is a new board, project filename won't be set yet
if( projectFile.GetFullPath() != Prj().GetProjectFullName() ) if( projectFile.GetFullPath() != Prj().GetProjectFullName() )
@ -886,7 +887,7 @@ bool PCB_EDIT_FRAME::doAutoSave()
wxLogTrace( traceAutoSave, "Creating auto save file <" + autoSaveFileName.GetFullPath() + ">" ); wxLogTrace( traceAutoSave, "Creating auto save file <" + autoSaveFileName.GetFullPath() + ">" );
if( SavePcbFile( autoSaveFileName.GetFullPath(), false ) )
if( SavePcbFile( autoSaveFileName.GetFullPath(), false, false ) )
{ {
GetScreen()->SetModify(); GetScreen()->SetModify();
GetBoard()->SetFileName( tmpFileName.GetFullPath() ); GetBoard()->SetFileName( tmpFileName.GetFullPath() );

4
pcbnew/pcb_edit_frame.h

@ -603,9 +603,11 @@ public:
* @param aFileName The file name to write or wxEmptyString to prompt user for * @param aFileName The file name to write or wxEmptyString to prompt user for
* file name. * file name.
* @param addToHistory controsl whether or not to add the saved file to the recent file list * @param addToHistory controsl whether or not to add the saved file to the recent file list
* @param aChangeProject is true if the project should be changed to the new board filename
* @return True if file was saved successfully. * @return True if file was saved successfully.
*/ */
bool SavePcbFile( const wxString& aFileName, bool addToHistory = true );
bool SavePcbFile( const wxString& aFileName, bool addToHistory = true,
bool aChangeProject = true );
/** /**
* Function SavePcbCopy * Function SavePcbCopy

Loading…
Cancel
Save