From d0ea8445576bab4c99e5d84c02705b73cd4f9d89 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 28 Aug 2018 15:56:26 -0700 Subject: [PATCH] eeschema: Close ERC before placing components We have a dialog shim that raises the ERC dialog in front of the schematic frame, which is useful for keeping the ERC dialog visible during debugging. But mouse move events do not pass through to the schematic, resulting in a captured mouse pointer but no drawing updates. As a work-around we close the ERC dialog while placing new components. Previous ERC data still exist when the window is launched again. Fixes: lp:1779851 * https://bugs.launchpad.net/kicad/+bug/1779851 --- eeschema/onleftclick.cpp | 2 ++ eeschema/sch_edit_frame.cpp | 10 ++++++++++ eeschema/sch_edit_frame.h | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 6efcc73eec..cb02b474d8 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -287,6 +287,8 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_SCH_PLACE_COMPONENT: if( (item == NULL) || (item->GetFlags() == 0) ) { + // ERC dialog interferes with moving items so we close it before starting + CloseErc(); GetScreen()->SetCurItem( Load_Component( aDC, NULL, s_CmpNameList, true ) ); m_canvas->SetAutoPanRequest( true ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 73fe6e812c..1de010b582 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -810,6 +810,16 @@ void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event ) } +void SCH_EDIT_FRAME::CloseErc() +{ + // Find the ERC dialog if it's open and close it + wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this ); + + if( erc ) + erc->Close( false ); +} + + void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event ) { doUpdatePcb( "" ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 7a8931c133..ec440ad35f 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -912,6 +912,11 @@ private: void OnUpdateHierarchySheet( wxUpdateUIEvent& aEvent ); void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent ); + /** + * Close the ERC dialog if it is open. + */ + void CloseErc(); + /** * Set the main window title bar text. *