filter useless autosave tests, and optimization of autosave test in Eechema

This commit is contained in:
jean-pierre charras 2017-07-26 12:03:24 +02:00
parent f9abb112af
commit 58c32367ee
4 changed files with 10 additions and 25 deletions

View File

@ -168,7 +168,7 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
if( !wxFrame::ProcessEvent( aEvent ) ) if( !wxFrame::ProcessEvent( aEvent ) )
return false; return false;
if( IsShown() && m_hasAutoSave && if( IsShown() && m_hasAutoSave && IsActive() &&
(m_autoSaveState != isAutoSaveRequired()) && (m_autoSaveInterval > 0) ) (m_autoSaveState != isAutoSaveRequired()) && (m_autoSaveInterval > 0) )
{ {
if( !m_autoSaveState ) if( !m_autoSaveState )

View File

@ -502,18 +502,6 @@ bool SCH_SHEET_LIST::IsModified()
} }
bool SCH_SHEET_LIST::IsAutoSaveRequired()
{
for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )
{
if( (*it).LastScreen() && (*it).LastScreen()->IsSave() )
return true;
}
return false;
}
void SCH_SHEET_LIST::ClearModifyStatus() void SCH_SHEET_LIST::ClearModifyStatus()
{ {
for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it ) for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it )

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
@ -355,13 +355,6 @@ public:
*/ */
bool IsModified(); bool IsModified();
/**
* Function IsAutoSaveRequired
* checks the entire hierarchy for any modifications that require auto save.
* @return True if the hierarchy is modified otherwise false.
*/
bool IsAutoSaveRequired();
void ClearModifyStatus(); void ClearModifyStatus();
/** /**

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -1267,9 +1267,13 @@ bool SCH_EDIT_FRAME::isAutoSaveRequired() const
if( g_RootSheet != NULL ) if( g_RootSheet != NULL )
{ {
SCH_SHEET_LIST sheetList( g_RootSheet ); SCH_SCREENS screenList;
return sheetList.IsAutoSaveRequired(); for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() )
{
if( screen->IsSave() )
return true;
}
} }
return false; return false;