diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 43c7781a57..cc3719b2a3 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -132,7 +132,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in { ClearUndoRedoList(); SetScreen( nullptr ); - m_toolManager->GetTool()->Reset( TOOL_BASE::MODEL_RELOAD ); + m_toolManager->GetTool()->Reset( TOOL_BASE::SUPERMODEL_RELOAD ); CreateScreens(); } diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index c3b24a9db8..2731b58ccd 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -71,6 +71,19 @@ bool EE_INSPECTION_TOOL::Init() } +void EE_INSPECTION_TOOL::Reset( RESET_REASON aReason ) +{ + EE_TOOL_BASE::Reset( aReason ); + + if( aReason == SUPERMODEL_RELOAD ) + { + wxCommandEvent* evt = new wxCommandEvent( EDA_EVT_CLOSE_ERC_DIALOG, wxID_ANY ); + + wxQueueEvent( m_frame, evt ); + } +} + + int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent ) { ShowERCDialog(); diff --git a/eeschema/tools/ee_inspection_tool.h b/eeschema/tools/ee_inspection_tool.h index 681a5232a0..73e2df7cef 100644 --- a/eeschema/tools/ee_inspection_tool.h +++ b/eeschema/tools/ee_inspection_tool.h @@ -45,6 +45,8 @@ public: /// @copydoc TOOL_INTERACTIVE::Init() bool Init() override; + void Reset( RESET_REASON aReason ) override; + int RunERC( const TOOL_EVENT& aEvent ); void ShowERCDialog(); diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index e0242386b9..345bf0af36 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -305,7 +305,7 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason ) m_selection.Clear(); } - if( aReason == TOOL_BASE::MODEL_RELOAD ) + if( aReason == TOOL_BASE::MODEL_RELOAD || aReason == TOOL_BASE::SUPERMODEL_RELOAD ) { getView()->GetPainter()->GetSettings()->SetHighlight( false ); diff --git a/eeschema/tools/ee_tool_base.h b/eeschema/tools/ee_tool_base.h index 1822e5e947..a83d216ff7 100644 --- a/eeschema/tools/ee_tool_base.h +++ b/eeschema/tools/ee_tool_base.h @@ -85,7 +85,7 @@ public: /// @copydoc TOOL_INTERACTIVE::Reset() void Reset( RESET_REASON aReason ) override { - if( aReason == MODEL_RELOAD ) + if( aReason == MODEL_RELOAD || aReason == SUPERMODEL_RELOAD ) { // Init variables used by every drawing tool m_frame = getEditFrame(); diff --git a/include/tool/tool_base.h b/include/tool/tool_base.h index 52003f2c99..0e4884e371 100644 --- a/include/tool/tool_base.h +++ b/include/tool/tool_base.h @@ -77,7 +77,8 @@ public: enum RESET_REASON { RUN, ///< Tool is invoked after being inactive - MODEL_RELOAD, ///< Model changes (required full reload) + MODEL_RELOAD, ///< Model changes (the sheet for a schematic) + SUPERMODEL_RELOAD, ///< For schematics, the entire schematic changed, not just the sheet GAL_SWITCH, ///< Rendering engine changes REDRAW ///< Full drawing refresh };