From 6754aa8a74594db5d36210e9b3bf750a7c516d54 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 207fdb6052..b13d2b839e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -846,6 +846,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 fc130c6bac..1d21a632a4 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -922,6 +922,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. *