Undo commit -r 6380.

This commit is contained in:
Wayne Stambaugh 2016-02-15 15:21:18 -05:00
parent 3d963166c7
commit af2e19d7d9
5 changed files with 39 additions and 53 deletions

View File

@ -1233,42 +1233,6 @@ void SCH_SHEET::ClearAnnotation( bool aIncludeSubSheets )
} }
bool SCH_SHEET::IsModified() const
{
if( m_screen->IsModify() )
return true;
bool retv = false;
SCH_ITEM* item = m_screen->GetDrawItems();
while( item && !retv )
{
if( item->Type() == SCH_SHEET_T )
retv = static_cast<SCH_SHEET*>( item )->IsModified();
item = item->Next();
}
return retv;
}
void SCH_SHEET::ClearModifyStatus()
{
m_screen->ClrModify();
SCH_ITEM* item = m_screen->GetDrawItems();
while( item )
{
if( item->Type() == SCH_SHEET_T )
static_cast<SCH_SHEET*>( item )->m_screen->ClrModify();
item = item->Next();
}
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem ) SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{ {
wxLogDebug( wxT( "Sheet assignment operator." ) ); wxLogDebug( wxT( "Sheet assignment operator." ) );

View File

@ -635,20 +635,6 @@ public:
void ClearAnnotation( bool aIncludeSubSheets = false ); void ClearAnnotation( bool aIncludeSubSheets = false );
/**
* Function IsModified
* checks the sheet and any of it's sub-sheets (hierarchy) for any modifications.
* @return true if the hierarchy is modified otherwise false.
*/
bool IsModified() const;
/**
* Function ClearModifyStatus
*
* clears the modification flag for everything in the sheet and all sub-sheets.
*/
void ClearModifyStatus();
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif

View File

@ -684,6 +684,18 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
} }
bool SCH_SHEET_LIST::IsModified()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
{
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
return true;
}
return false;
}
bool SCH_SHEET_LIST::IsAutoSaveRequired() bool SCH_SHEET_LIST::IsAutoSaveRequired()
{ {
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() ) for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
@ -696,6 +708,16 @@ bool SCH_SHEET_LIST::IsAutoSaveRequired()
} }
void SCH_SHEET_LIST::ClearModifyStatus()
{
for( SCH_SHEET_PATH* sheet = GetFirst(); sheet; sheet = GetNext() )
{
if( sheet->LastScreen() )
sheet->LastScreen()->ClrModify();
}
}
void SCH_SHEET_LIST::AnnotatePowerSymbols( PART_LIBS* aLibs ) void SCH_SHEET_LIST::AnnotatePowerSymbols( PART_LIBS* aLibs )
{ {
int ref = 1; int ref = 1;

View File

@ -436,6 +436,13 @@ public:
*/ */
SCH_SHEET_PATH* GetSheetByPath( const wxString aPath, bool aHumanReadable = true ); SCH_SHEET_PATH* GetSheetByPath( const wxString aPath, bool aHumanReadable = true );
/**
* Function IsModified
* checks the entire hierarchy for any modifications.
* @returns True if the hierarchy is modified otherwise false.
*/
bool IsModified();
/** /**
* Function IsAutoSaveRequired * Function IsAutoSaveRequired
* checks the entire hierarchy for any modifications that require auto save. * checks the entire hierarchy for any modifications that require auto save.
@ -443,6 +450,8 @@ public:
*/ */
bool IsAutoSaveRequired(); bool IsAutoSaveRequired();
void ClearModifyStatus();
/** /**
* Function AnnotatePowerSymbols * Function AnnotatePowerSymbols
* clear and annotates the entire hierarchy of the sheet path list. * clear and annotates the entire hierarchy of the sheet path list.

View File

@ -616,7 +616,9 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
return; return;
} }
if( g_RootSheet->IsModified() ) SCH_SHEET_LIST sheetList;
if( sheetList.IsModified() )
{ {
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() ); wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
wxString msg = wxString::Format( _( wxString msg = wxString::Format( _(
@ -667,7 +669,7 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
wxRemoveFile( fn.GetFullPath() ); wxRemoveFile( fn.GetFullPath() );
} }
g_RootSheet->ClearModifyStatus(); sheetList.ClearModifyStatus();
wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() ); wxString fileName = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
@ -787,13 +789,16 @@ void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent ) void SCH_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{ {
aEvent.Enable( g_RootSheet->IsModified() ); SCH_SHEET_LIST sheetList;
aEvent.Enable( sheetList.IsModified() );
} }
void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent ) void SCH_EDIT_FRAME::OnUpdateSaveSheet( wxUpdateUIEvent& aEvent )
{ {
aEvent.Enable( GetScreen()->IsModify() ); aEvent.Enable( GetScreen()->IsModify() );
} }