From 58c32367ee2c2f4e103ec47b733ee7fae1202869 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 26 Jul 2017 12:03:24 +0200 Subject: [PATCH] filter useless autosave tests, and optimization of autosave test in Eechema --- common/basicframe.cpp | 2 +- eeschema/sch_sheet_path.cpp | 12 ------------ eeschema/sch_sheet_path.h | 9 +-------- eeschema/schframe.cpp | 12 ++++++++---- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 6608750044..c24c6eb582 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -168,7 +168,7 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent ) if( !wxFrame::ProcessEvent( aEvent ) ) return false; - if( IsShown() && m_hasAutoSave && + if( IsShown() && m_hasAutoSave && IsActive() && (m_autoSaveState != isAutoSaveRequired()) && (m_autoSaveInterval > 0) ) { if( !m_autoSaveState ) diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 108b244ce9..bc2a0f0fe0 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -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() { for( SCH_SHEET_PATHS_ITER it = begin(); it != end(); ++it ) diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h index eff5aae68c..ec891b97a1 100644 --- a/eeschema/sch_sheet_path.h +++ b/eeschema/sch_sheet_path.h @@ -1,7 +1,7 @@ /* * 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 * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * @@ -355,13 +355,6 @@ public: */ 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(); /** diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index aa08851c88..ec547ea4ef 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -1,8 +1,8 @@ /* * 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) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * 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 ) { - 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;