From 752ae4d5193bab80b1c760774e5912fba10bb7b8 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 28 May 2021 12:07:04 -0700 Subject: [PATCH] Rename modification flag routines Differentiates better between the EDA_ITEM IsModified(), referring to items themselves changing and the EDA_SCREEN IsContentModified(), referring to whether we have made any unsaved changes. --- common/dialogs/dialog_page_settings.cpp | 2 +- eeschema/dialogs/dialog_edit_components_libid.cpp | 2 +- eeschema/dialogs/dialog_symbol_remap.cpp | 2 +- eeschema/files-io.cpp | 12 ++++++------ eeschema/sch_edit_frame.cpp | 4 ++-- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 2 +- eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp | 4 ++-- eeschema/sch_screen.cpp | 2 +- eeschema/sch_sheet_path.cpp | 6 +++--- eeschema/sheet.cpp | 2 +- eeschema/symbol_editor/symbol_edit_frame.cpp | 6 +++--- eeschema/symbol_editor/symbol_editor.cpp | 8 ++++---- eeschema/symbol_editor/symbol_library_manager.cpp | 10 +++++----- gerbview/clear_gbr_drawlayers.cpp | 2 +- include/base_screen.h | 5 ++--- pagelayout_editor/files.cpp | 6 +++--- pagelayout_editor/pl_editor_frame.cpp | 4 ++-- pagelayout_editor/pl_editor_frame.h | 2 +- pcbnew/dialogs/dialog_export_step.cpp | 2 +- pcbnew/files.cpp | 8 ++++---- pcbnew/footprint_edit_frame.cpp | 4 ++-- pcbnew/footprint_editor_utils.cpp | 4 ++-- pcbnew/footprint_libraries_utils.cpp | 4 ++-- pcbnew/fp_tree_synchronizing_adapter.cpp | 6 +++--- pcbnew/initpcb.cpp | 4 ++-- pcbnew/load_select_footprint.cpp | 2 +- pcbnew/pcb_base_frame.cpp | 2 +- pcbnew/pcb_edit_frame.cpp | 4 ++-- pcbnew/specctra_import_export/specctra_export.cpp | 4 ++-- pcbnew/tools/footprint_editor_control.cpp | 4 ++-- 30 files changed, 64 insertions(+), 65 deletions(-) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 28bbab9149..a41294eb64 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -210,7 +210,7 @@ bool DIALOG_PAGES_SETTINGS::TransferDataFromWindow() if( SavePageSettings() ) { - m_screen->SetModify(); + m_screen->SetContentModified(); if( LocalPrjConfigChanged() ) m_parent->SaveProjectSettings(); diff --git a/eeschema/dialogs/dialog_edit_components_libid.cpp b/eeschema/dialogs/dialog_edit_components_libid.cpp index e8dcacfa49..9144676bf7 100644 --- a/eeschema/dialogs/dialog_edit_components_libid.cpp +++ b/eeschema/dialogs/dialog_edit_components_libid.cpp @@ -750,7 +750,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow() cmp.m_Component->SetLibId( id ); cmp.m_Component->SetLibSymbol( symbol->Flatten().release() ); cmp.m_Screen->Append( cmp.m_Component ); - cmp.m_Screen->SetModify(); + cmp.m_Screen->SetContentModified(); if ( m_checkBoxUpdateFields->IsChecked() ) { diff --git a/eeschema/dialogs/dialog_symbol_remap.cpp b/eeschema/dialogs/dialog_symbol_remap.cpp index 490fa5c260..6276f9cc11 100644 --- a/eeschema/dialogs/dialog_symbol_remap.cpp +++ b/eeschema/dialogs/dialog_symbol_remap.cpp @@ -269,7 +269,7 @@ void DIALOG_SYMBOL_REMAP::remapSymbolsToLibTable( REPORTER& aReporter ) symbol->GetLibId().GetLibItemName().wx_str(), symbol->GetLibId().GetLibNickname().wx_str() ); aReporter.Report( msg, RPT_SEVERITY_ACTION ); - screen->SetModify(); + screen->SetContentModified(); } } } diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 352274c00e..d0f513fa5f 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -188,7 +188,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName ) UpdateFileHistory( schematicFileName.GetFullPath() ); } - screen->ClrModify(); + screen->SetContentModified( false ); UpdateTitle(); msg.Printf( _( "File \"%s\" saved." ), screen->GetFileName() ); @@ -379,7 +379,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in if( is_new ) { // mark new, unsaved file as modified. - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); GetScreen()->SetFileName( fullFileName ); } else @@ -1050,7 +1050,7 @@ bool SCH_EDIT_FRAME::doAutoSave() for( size_t i = 0; i < screens.GetCount(); i++ ) { // Only create auto save files for the schematics that have been modified. - if( !screens.GetScreen( i )->IsModify() ) + if( !screens.GetScreen( i )->IsContentModified() ) continue; tmpFileName = fn = screens.GetScreen( i )->GetFileName(); @@ -1061,7 +1061,7 @@ bool SCH_EDIT_FRAME::doAutoSave() screens.GetScreen( i )->SetFileName( fn.GetFullPath() ); if( SaveEEFile( screens.GetSheet( i ), false ) ) - screens.GetScreen( i )->SetModify(); + screens.GetScreen( i )->SetContentModified(); else autoSaveOk = false; @@ -1145,7 +1145,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) Schematic().Root().SetFileName( newfilename.GetFullPath() ); GetScreen()->SetFileName( newfilename.GetFullPath() ); - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); // Only fix junctions for CADSTAR importer for now as it may cause issues with // other importers @@ -1194,7 +1194,7 @@ bool SCH_EDIT_FRAME::AskToSaveChanges() // Save any currently open and modified project files. for( SCH_SCREEN* screen = screenList.GetFirst(); screen; screen = screenList.GetNext() ) { - if( screen->IsModify() ) + if( screen->IsContentModified() ) { if( !HandleUnsavedChanges( this, _( "The current schematic has been modified. " "Save changes?" ), diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 8fd5a6bf32..480ff78c3c 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -782,7 +782,7 @@ void SCH_EDIT_FRAME::OnModify() if( !GetScreen() ) return; - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); if( ADVANCED_CFG::GetCfg().m_RealTimeConnectivity && CONNECTION_GRAPH::m_allowRealTime ) RecalculateConnections( NO_CLEANUP ); @@ -1217,7 +1217,7 @@ void SCH_EDIT_FRAME::AddItemToScreenAndUndoList( SCH_SCREEN* aScreen, SCH_ITEM* aItem->ClearFlags( IS_NEW ); - aScreen->SetModify(); + aScreen->SetContentModified(); UpdateItem( aItem ); if( !aItem->IsMoving() && aItem->IsConnectable() ) diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index ea6e01c6f2..105da27da8 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -1912,7 +1912,7 @@ void SCH_SEXPR_PARSER::parseSchSheetInstances( SCH_SHEET* aRootSheet, SCH_SCREEN // Set the file as modified so the user can be warned. if( numReplacements > 0 ) - aScreen->SetModify(); + aScreen->SetContentModified(); NeedRIGHT(); break; diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 1ac235fa33..5ae5c08202 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -1563,7 +1563,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader ) // Set the file as modified so the user can be warned. if( m_rootSheet->GetScreen() ) - m_rootSheet->GetScreen()->SetModify(); + m_rootSheet->GetScreen()->SetContentModified(); } symbol->SetUnit( unit ); @@ -1577,7 +1577,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader ) // Set the file as modified so the user can be warned. if( m_rootSheet->GetScreen() ) - m_rootSheet->GetScreen()->SetModify(); + m_rootSheet->GetScreen()->SetContentModified(); } symbol->SetConvert( convert ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index b8527e9cf3..a1d3397a83 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -296,7 +296,7 @@ void SCH_SCREEN::DeleteItem( SCH_ITEM* aItem ) // Markers are not saved in the file, no need to flag as modified. // TODO: Maybe we should have a listing somewhere of items that aren't saved? if( aItem->Type() != SCH_MARKER_T ) - SetModify(); + SetContentModified(); Remove( aItem ); diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 197674cd61..5913167b39 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -566,7 +566,7 @@ void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet, bool aCheckIntegrity ) for( SCH_SHEET* sheet : badSheets ) { m_currentSheetPath.LastScreen()->Remove( sheet ); - m_currentSheetPath.LastScreen()->SetModify(); + m_currentSheetPath.LastScreen()->SetContentModified(); } } @@ -622,7 +622,7 @@ bool SCH_SHEET_LIST::IsModified() const { for( const SCH_SHEET_PATH& sheet : *this ) { - if( sheet.LastScreen() && sheet.LastScreen()->IsModify() ) + if( sheet.LastScreen() && sheet.LastScreen()->IsContentModified() ) return true; } @@ -635,7 +635,7 @@ void SCH_SHEET_LIST::ClearModifyStatus() for( const SCH_SHEET_PATH& sheet : *this ) { if( sheet.LastScreen() ) - sheet.LastScreen()->ClrModify(); + sheet.LastScreen()->SetContentModified( false ); } } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index f69d1a2f65..771e440d39 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -95,7 +95,7 @@ bool SCH_EDIT_FRAME::checkForNoFullyDefinedLibIds( SCH_SHEET* aSheet ) void SCH_EDIT_FRAME::InitSheet( SCH_SHEET* aSheet, const wxString& aNewFilename ) { aSheet->SetScreen( new SCH_SCREEN( &Schematic() ) ); - aSheet->GetScreen()->SetModify(); + aSheet->GetScreen()->SetContentModified(); aSheet->GetScreen()->SetFileName( aNewFilename ); } diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 4d2d0fcbcd..bd43de1f98 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -781,7 +781,7 @@ SYMBOL_LIBRARY_MANAGER& SYMBOL_EDIT_FRAME::GetLibManager() void SYMBOL_EDIT_FRAME::OnModify() { - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); storeCurrentPart(); m_treePane->GetLibTree()->RefreshLibTree(); @@ -1043,7 +1043,7 @@ bool SYMBOL_EDIT_FRAME::backupFile( const wxFileName& aOriginalFile, const wxStr void SYMBOL_EDIT_FRAME::storeCurrentPart() { - if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsModify() ) + if( m_my_part && !GetCurLib().IsEmpty() && GetScreen()->IsContentModified() ) m_libMgr->UpdatePart( m_my_part, GetCurLib() ); // UpdatePart() makes a copy } @@ -1235,7 +1235,7 @@ bool SYMBOL_EDIT_FRAME::IsContentModified() const wxCHECK( m_libMgr, false ); // Test if the currently edited part is modified - if( GetScreen() && GetScreen()->IsModify() && GetCurPart() ) + if( GetScreen() && GetScreen()->IsContentModified() && GetCurPart() ) return true; // Test if any library has been modified diff --git a/eeschema/symbol_editor/symbol_editor.cpp b/eeschema/symbol_editor/symbol_editor.cpp index 2dd368684c..0e78a061bd 100644 --- a/eeschema/symbol_editor/symbol_editor.cpp +++ b/eeschema/symbol_editor/symbol_editor.cpp @@ -140,7 +140,7 @@ void SYMBOL_EDIT_FRAME::updateTitle() if( IsSymbolFromSchematic() ) { title = wxString::Format( _( "%s%s [from schematic]" ) + wxT( " \u2014 " ), - GetScreen() && GetScreen()->IsModify() ? "*" : "", + GetScreen() && GetScreen()->IsContentModified() ? "*" : "", m_reference ); } else @@ -150,7 +150,7 @@ void SYMBOL_EDIT_FRAME::updateTitle() bool readOnly = m_libMgr && m_libMgr->IsLibraryReadOnly( GetCurLib() ); title = wxString::Format( wxT( "%s%s %s\u2014 " ), - GetScreen() && GetScreen()->IsModify() ? "*" : "", + GetScreen() && GetScreen()->IsContentModified() ? "*" : "", GetCurPart()->GetLibId().Format().c_str(), readOnly ? _( "[Read Only Library]" ) + wxT( " " ) : "" ); } @@ -253,7 +253,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConver return true; } - if( GetScreen()->IsModify() && GetCurPart() ) + if( GetScreen()->IsContentModified() && GetCurPart() ) { if( !HandleUnsavedChanges( this, _( "The current symbol has been modified. " "Save changes?" ), @@ -522,7 +522,7 @@ void SYMBOL_EDIT_FRAME::Save() else { schframe->SaveSymbolToSchematic( *m_my_part ); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); } } else diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index 134367c7e4..2153d90061 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -298,7 +298,7 @@ bool SYMBOL_LIBRARY_MANAGER::ClearLibraryModified( const wxString& aLibrary ) co SCH_SCREEN* screen = partBuf->GetScreen(); if( screen ) - screen->ClrModify(); + screen->SetContentModified( false ); } return true; @@ -316,7 +316,7 @@ bool SYMBOL_LIBRARY_MANAGER::ClearPartModified( const wxString& aAlias, auto partBuf = libI->second.GetBuffer( aAlias ); wxCHECK( partBuf, false ); - partBuf->GetScreen()->ClrModify(); + partBuf->GetScreen()->SetContentModified( false ); return true; } @@ -456,7 +456,7 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibra wxCHECK( bufferedPart, false ); *bufferedPart = *aPart; - partBuf->GetScreen()->SetModify(); + partBuf->GetScreen()->SetContentModified(); } else // New symbol { @@ -466,7 +466,7 @@ bool SYMBOL_LIBRARY_MANAGER::UpdatePart( LIB_PART* aPart, const wxString& aLibra SCH_SCREEN* screen = new SCH_SCREEN; libBuf.CreateBuffer( partCopy, screen ); - screen->SetModify(); + screen->SetContentModified(); } return true; @@ -863,7 +863,7 @@ void SYMBOL_LIBRARY_MANAGER::PART_BUFFER::SetOriginal( LIB_PART* aPart ) bool SYMBOL_LIBRARY_MANAGER::PART_BUFFER::IsModified() const { - return m_screen && m_screen->IsModify(); + return m_screen && m_screen->IsContentModified(); } diff --git a/gerbview/clear_gbr_drawlayers.cpp b/gerbview/clear_gbr_drawlayers.cpp index 4fb449ae02..e6c805eb89 100644 --- a/gerbview/clear_gbr_drawlayers.cpp +++ b/gerbview/clear_gbr_drawlayers.cpp @@ -42,7 +42,7 @@ bool GERBVIEW_FRAME::Clear_DrawLayers( bool query ) if( GetGerberLayout() == NULL ) return false; - if( query && GetScreen()->IsModify() ) + if( query && GetScreen()->IsContentModified() ) { if( !IsOK( this, _( "Current data will be lost?" ) ) ) return false; diff --git a/include/base_screen.h b/include/base_screen.h index 02f04386ba..0a90f77d8e 100644 --- a/include/base_screen.h +++ b/include/base_screen.h @@ -56,9 +56,8 @@ public: void InitDataPoints( const wxSize& aPageSizeInternalUnits ); - void SetModify() { m_flagModified = true; } - void ClrModify() { m_flagModified = false; } - bool IsModify() const { return m_flagModified; } + void SetContentModified( bool aModified = true ) { m_flagModified = aModified; } + bool IsContentModified() const { return m_flagModified; } /** * Return the class name. diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index fca8ce31aa..00332b0f4b 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -133,7 +133,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) } else { - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); HardRedraw(); msg.Printf( _( "File \"%s\" inserted" ), filename ); SetStatusText( msg ); @@ -237,7 +237,7 @@ bool PL_EDITOR_FRAME::LoadPageLayoutDescrFile( const wxString& aFullFileName ) SetCurrentFileName( aFullFileName ); UpdateFileHistory( aFullFileName ); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); wxFileName fn = aFullFileName; m_infoBar->Dismiss(); @@ -291,7 +291,7 @@ bool PL_EDITOR_FRAME::SavePageLayoutDescrFile( const wxString& aFullFileName ) if( !wxRenameFile( tempFile.GetFullPath(), aFullFileName ) ) return false; - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); return true; } diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index caed9888e0..ee8744d42d 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -330,7 +330,7 @@ bool PL_EDITOR_FRAME::OpenProjectFiles( const std::vector& aFileSet, i bool PL_EDITOR_FRAME::IsContentModified() const { - return GetScreen() && GetScreen()->IsModify(); + return GetScreen() && GetScreen()->IsContentModified(); } @@ -872,7 +872,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddPageLayoutItem( int aType ) void PL_EDITOR_FRAME::OnNewPageLayout() { ClearUndoRedoList(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); GetCanvas()->DisplayWorksheet(); m_propertiesPagelayout->CopyPrmsFromItemToPanel( nullptr ); diff --git a/pagelayout_editor/pl_editor_frame.h b/pagelayout_editor/pl_editor_frame.h index 5334d728fc..da1380c013 100644 --- a/pagelayout_editor/pl_editor_frame.h +++ b/pagelayout_editor/pl_editor_frame.h @@ -255,7 +255,7 @@ public: */ void OnModify() { - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); } /** diff --git a/pcbnew/dialogs/dialog_export_step.cpp b/pcbnew/dialogs/dialog_export_step.cpp index 24c37f17ee..af462fe175 100644 --- a/pcbnew/dialogs/dialog_export_step.cpp +++ b/pcbnew/dialogs/dialog_export_step.cpp @@ -199,7 +199,7 @@ void PCB_EDIT_FRAME::OnExportSTEP( wxCommandEvent& event ) { wxFileName brdFile = GetBoard()->GetFileName(); - if( GetScreen()->IsModify() || brdFile.GetFullPath().empty() ) + if( GetScreen()->IsContentModified() || brdFile.GetFullPath().empty() ) { if( !doAutoSave() ) { diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 5bb0f6cf54..4e4f2a7d86 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -350,7 +350,7 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id ) if( !IsOK( this, msg ) ) return false; - GetScreen()->ClrModify(); // do not prompt the user for changes + GetScreen()->SetContentModified( false ); // do not prompt the user for changes if( OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ) ) { @@ -772,7 +772,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in if( loadedBoard->IsModified() ) OnModify(); else - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); if( ( pluginType == IO_MGR::LEGACY && loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) || @@ -1064,7 +1064,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory, if( m_infoBar->IsShown() && m_infoBar->HasCloseButton() ) m_infoBar->Dismiss(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); UpdateTitle(); return true; } @@ -1178,7 +1178,7 @@ bool PCB_EDIT_FRAME::doAutoSave() if( SavePcbFile( autoSaveFileName.GetFullPath(), false, false ) ) { - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); GetBoard()->SetFileName( tmpFileName.GetFullPath() ); UpdateTitle(); m_autoSaveState = false; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 1b3b744896..6b69b77e6e 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -318,7 +318,7 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME() bool FOOTPRINT_EDIT_FRAME::IsContentModified() const { - return GetScreen() && GetScreen()->IsModify() && GetBoard() && GetBoard()->GetFirstFootprint(); + return GetScreen() && GetScreen()->IsContentModified() && GetBoard() && GetBoard()->GetFirstFootprint(); } @@ -408,7 +408,7 @@ void FOOTPRINT_EDIT_FRAME::ClearModify() if( GetBoard()->GetFirstFootprint() ) m_footprintNameWhenLoaded = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); } diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index f9dd8c9db0..22ab7d425a 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -86,7 +86,7 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID ) Update3DView( true, true ); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); UpdateView(); GetCanvas()->Refresh(); @@ -252,7 +252,7 @@ bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileS if( GetBoard()->GetFirstFootprint() ) GetBoard()->GetFirstFootprint()->ClearFlags(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); Zoom_Automatique( false ); GetCanvas()->Refresh(); diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index e9ad5e7556..58032bd254 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -1052,7 +1052,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintAs( FOOTPRINT* aFootprint ) bool FOOTPRINT_EDIT_FRAME::RevertFootprint() { - if( GetScreen()->IsModify() && m_revertModule ) + if( GetScreen()->IsContentModified() && m_revertModule ) { wxString msg = wxString::Format( _( "Revert \"%s\" to last version saved?" ), GetLoadedFPID().GetLibItemName().wx_str() ); @@ -1067,7 +1067,7 @@ bool FOOTPRINT_EDIT_FRAME::RevertFootprint() Update3DView( true, true ); ClearUndoRedoList(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); UpdateView(); GetCanvas()->Refresh(); diff --git a/pcbnew/fp_tree_synchronizing_adapter.cpp b/pcbnew/fp_tree_synchronizing_adapter.cpp index 2417dec04c..0e5d339c16 100644 --- a/pcbnew/fp_tree_synchronizing_adapter.cpp +++ b/pcbnew/fp_tree_synchronizing_adapter.cpp @@ -180,7 +180,7 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::GetValue( wxVariant& aVariant, wxDataViewIte node->m_Name = m_frame->GetLoadedFPID().GetLibItemName(); // mark modified part with an asterisk - if( m_frame->GetScreen()->IsModify() ) + if( m_frame->GetScreen()->IsContentModified() ) aVariant = node->m_Name + " *"; else aVariant = node->m_Name; @@ -253,7 +253,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign #endif // mark modified libs with bold font - if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) + if( m_frame->GetScreen()->IsContentModified() && !m_frame->IsCurrentFPFromBoard() ) aAttr.SetBold( true ); } break; @@ -271,7 +271,7 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::GetAttr( wxDataViewItem const& aItem, unsign #endif // mark modified part with bold font - if( m_frame->GetScreen()->IsModify() && !m_frame->IsCurrentFPFromBoard() ) + if( m_frame->GetScreen()->IsContentModified() && !m_frame->IsCurrentFPFromBoard() ) aAttr.SetBold( true ); } break; diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 9550780dad..6116fee7eb 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -58,7 +58,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery, bool aFinal ) // Clear undo and redo lists because we want a full deletion ClearUndoRedoList(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); if( !aFinal ) { @@ -120,7 +120,7 @@ bool FOOTPRINT_EDIT_FRAME::Clear_Pcb( bool aQuery ) // Clear undo and redo lists because we want a full deletion ClearUndoRedoList(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); BOARD* board = new BOARD; diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index b5f4ad4368..301309e441 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -158,7 +158,7 @@ bool FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard( FOOTPRINT* aFootprint ) m_adapter->SetPreselectNode( newFootprint->GetFPID(), 0 ); ClearUndoRedoList(); - GetScreen()->ClrModify(); + GetScreen()->SetContentModified( false ); // Update the save items if needed. if( !is_last_fp_from_brd ) diff --git a/pcbnew/pcb_base_frame.cpp b/pcbnew/pcb_base_frame.cpp index 674ed679c4..15b888f8b8 100644 --- a/pcbnew/pcb_base_frame.cpp +++ b/pcbnew/pcb_base_frame.cpp @@ -689,7 +689,7 @@ void PCB_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVars void PCB_BASE_FRAME::OnModify() { - GetScreen()->SetModify(); + GetScreen()->SetContentModified(); GetBoard()->IncrementTimeStamp(); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index e9d5c7ada7..eb0c3b58a7 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -449,14 +449,14 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings ) bool PCB_EDIT_FRAME::IsContentModified() const { - return GetScreen() && GetScreen()->IsModify(); + return GetScreen() && GetScreen()->IsContentModified(); } bool PCB_EDIT_FRAME::isAutoSaveRequired() const { if( GetScreen() ) - return GetScreen()->IsModify(); + return GetScreen()->IsContentModified(); return false; } diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index e636b9bc4c..9a5c953c35 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -87,7 +87,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) wxString errorText; BASE_SCREEN* screen = GetScreen(); - bool wasModified = screen->IsModify(); + bool wasModified = screen->IsContentModified(); db.SetPCB( SPECCTRA_DB::MakePCB() ); @@ -122,7 +122,7 @@ bool PCB_EDIT_FRAME::ExportSpecctraFile( const wxString& aFullFilename ) // modified flag, yet their actions cancel each other out, so it should // be ok to clear the modify flag. if( !wasModified ) - screen->ClrModify(); + screen->SetContentModified( false ); if( ok ) { diff --git a/pcbnew/tools/footprint_editor_control.cpp b/pcbnew/tools/footprint_editor_control.cpp index f9e24ae5a2..34be2fafd9 100644 --- a/pcbnew/tools/footprint_editor_control.cpp +++ b/pcbnew/tools/footprint_editor_control.cpp @@ -158,7 +158,7 @@ int FOOTPRINT_EDITOR_CONTROL::NewFootprint( const TOOL_EVENT& aEvent ) newFootprint->ClearFlags(); m_frame->Zoom_Automatique( false ); - m_frame->GetScreen()->SetModify(); + m_frame->GetScreen()->SetContentModified(); // If selected from the library tree then go ahead and save it there if( !selected.GetLibNickname().empty() ) @@ -218,7 +218,7 @@ int FOOTPRINT_EDITOR_CONTROL::CreateFootprint( const TOOL_EVENT& aEvent ) newFootprint->ClearFlags(); m_frame->Zoom_Automatique( false ); - m_frame->GetScreen()->SetModify(); + m_frame->GetScreen()->SetContentModified(); // If selected from the library tree then go ahead and save it there if( !selected.GetLibNickname().empty() )