diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 1e9b1dd595..c5c5df48f7 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -533,6 +533,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in GetScreen()->m_Initialized = true; } + // Load any exclusions from the project file + ResolveERCExclusions(); + m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); SetSheetNumberAndCount(); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 65b11debcd..e15e4ea1f9 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -648,6 +648,8 @@ void SCH_EDIT_FRAME::doCloseWindow() if( m_toolManager ) m_toolManager->ShutdownAllTools(); + RecordERCExclusions(); + // Close the find dialog and preserve it's setting if it is displayed. if( m_findReplaceDialog ) { @@ -719,10 +721,17 @@ void SCH_EDIT_FRAME::RecordERCExclusions() void SCH_EDIT_FRAME::ResolveERCExclusions() { + SCH_SHEET_LIST sheetList = Schematic().GetSheets(); + for( SCH_MARKER* marker : Schematic().ResolveERCExclusions() ) { - // JEY TODO: need to get the right screen.... - GetScreen()->Append( marker ); + SCH_SHEET_PATH errorPath; + (void) sheetList.GetItem( marker->GetRCItem()->GetMainItemID(), &errorPath ); + + if( errorPath.LastScreen() ) + errorPath.LastScreen()->Append( marker ); + else + Schematic().RootScreen()->Append( marker ); } // Update the view for the current screen