Don't restore saved window state if saving is turned off

This commit is contained in:
Jon Evans 2020-08-30 12:44:23 -04:00
parent 046fef2cc1
commit 921703c711
2 changed files with 7 additions and 4 deletions

View File

@ -452,6 +452,9 @@ void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars
void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName ) void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
{ {
if( !Pgm().GetCommonSettings()->m_Session.remember_open_files )
return;
const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName ); const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
if( state != nullptr ) if( state != nullptr )
@ -643,7 +646,7 @@ void EDA_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
wxString currentlyOpenedFile = GetCurrentFileName(); wxString currentlyOpenedFile = GetCurrentFileName();
if( !currentlyOpenedFile.IsEmpty() ) if( Pgm().GetCommonSettings()->m_Session.remember_open_files && !currentlyOpenedFile.IsEmpty() )
{ {
wxFileName rfn( currentlyOpenedFile ); wxFileName rfn( currentlyOpenedFile );
rfn.MakeRelativeTo( Prj().GetProjectPath() ); rfn.MakeRelativeTo( Prj().GetProjectPath() );

View File

@ -300,8 +300,8 @@ const PROJECT_FILE_STATE* PROJECT_LOCAL_SETTINGS::GetFileState( const wxString&
} }
void PROJECT_LOCAL_SETTINGS::SaveFileState( const wxString& aFileName, const WINDOW_SETTINGS* aWindowCfg, void PROJECT_LOCAL_SETTINGS::SaveFileState( const wxString& aFileName,
bool aOpen ) const WINDOW_SETTINGS* aWindowCfg, bool aOpen )
{ {
auto it = std::find_if( m_files.begin(), m_files.end(), auto it = std::find_if( m_files.begin(), m_files.end(),
[&aFileName]( const PROJECT_FILE_STATE& a ) [&aFileName]( const PROJECT_FILE_STATE& a )
@ -327,4 +327,4 @@ void PROJECT_LOCAL_SETTINGS::SaveFileState( const wxString& aFileName, const WIN
void PROJECT_LOCAL_SETTINGS::ClearFileState() void PROJECT_LOCAL_SETTINGS::ClearFileState()
{ {
m_files.clear(); m_files.clear();
} }