Code clarity. (No functional changes.)

This commit is contained in:
Jeff Young 2022-10-10 12:04:19 +01:00
parent 6d958c5a3b
commit be6f08deca
5 changed files with 15 additions and 10 deletions

View File

@ -122,7 +122,7 @@ void EDA_BASE_FRAME::commonInit( FRAME_T aFrameType )
m_settingsManager = nullptr;
m_fileHistory = nullptr;
m_supportsAutoSave = false;
m_autoSaveState = false;
m_autoSavePending = false;
m_undoRedoCountMax = DEFAULT_MAX_UNDO_ITEMS;
m_isClosing = false;
m_isNonUserClose = false;
@ -273,20 +273,20 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
return true;
if( !m_isClosing && m_supportsAutoSave && IsShown() && IsActive()
&& m_autoSaveState != isAutoSaveRequired()
&& GetAutoSaveInterval() > 0 )
&& m_autoSavePending != isAutoSaveRequired()
&& GetAutoSaveInterval() > 0 )
{
if( !m_autoSaveState )
if( !m_autoSavePending )
{
wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
m_autoSaveTimer->Start( GetAutoSaveInterval() * 1000, wxTIMER_ONE_SHOT );
m_autoSaveState = true;
m_autoSavePending = true;
}
else if( m_autoSaveTimer->IsRunning() )
{
wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
m_autoSaveTimer->Stop();
m_autoSaveState = false;
m_autoSavePending = false;
}
}

View File

@ -300,7 +300,7 @@ void EDA_DRAW_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
else
{
m_autoSaveTimer->Stop();
m_autoSaveState = false;
m_autoSavePending = false;
}
}

View File

@ -1142,14 +1142,19 @@ bool SCH_EDIT_FRAME::doAutoSave()
fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
if( saveSchematicFile( screens.GetSheet( i ), fn.GetFullPath() ) )
{
// This was only an auto-save, not a real save. Reset the modified flag.
screens.GetScreen( i )->SetContentModified();
}
else
{
autoSaveOk = false;
}
}
if( autoSaveOk && updateAutoSaveFile() )
{
m_autoSaveState = false;
m_autoSavePending = false;
if( !Kiface().IsSingle() &&
GetSettingsManager()->GetCommonSettings()->m_Backup.backup_on_autosave )

View File

@ -723,7 +723,7 @@ private:
FILE_HISTORY* m_fileHistory; // The frame's recently opened file list
bool m_supportsAutoSave;
bool m_autoSaveState;
bool m_autoSavePending;
wxTimer* m_autoSaveTimer;
int m_undoRedoCountMax; // undo/Redo command Max depth

View File

@ -1246,7 +1246,7 @@ bool PCB_EDIT_FRAME::doAutoSave()
GetScreen()->SetContentModified();
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
UpdateTitle();
m_autoSaveState = false;
m_autoSavePending = false;
if( !Kiface().IsSingle() &&
GetSettingsManager()->GetCommonSettings()->m_Backup.backup_on_autosave )