From 4af98827fdf51151cb8bcc409df502a0282ad5e1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 15 Oct 2022 11:17:48 +0100 Subject: [PATCH] Revert change for 11299, and update removed-pad items after zone fills. Fixes https://gitlab.com/kicad/code/kicad/issues/12645 --- pcbnew/pcb_track.cpp | 2 +- pcbnew/tools/zone_filler_tool.cpp | 41 ++++++++++++++++++++++++++----- pcbnew/tools/zone_filler_tool.h | 2 ++ 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index b114061c7f..e6c458ca9a 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -613,7 +613,7 @@ bool PCB_VIA::FlashLayer( int aLayer ) const // Must be static to keep from raising its ugly head in performance profiles static std::initializer_list connectedTypes = { PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T, - PCB_PAD_T }; + PCB_PAD_T, PCB_ZONE_T, PCB_FP_ZONE_T }; // Do not check zones. Doing so results in race conditions when the via collides with // two different zones of different priorities. diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index ddce50ae61..c1e4b1e171 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -96,7 +98,8 @@ void ZONE_FILLER_TOOL::CheckAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRep board()->BuildConnectivity(); - canvas()->Refresh(); + refresh(); + m_fillInProgress = false; } @@ -174,7 +177,8 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo if( filler.IsDebug() ) frame->UpdateUserInterface(); - canvas()->Refresh(); + refresh(); + m_fillInProgress = false; // wxWidgets has keyboard focus issues after the progress reporter. Re-setting the focus @@ -256,7 +260,8 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent ) if( filler.IsDebug() ) frame->UpdateUserInterface(); - canvas()->Refresh(); + refresh(); + m_fillInProgress = false; // wxWidgets has keyboard focus issues after the progress reporter. Re-setting the focus @@ -311,7 +316,8 @@ int ZONE_FILLER_TOOL::ZoneFill( const TOOL_EVENT& aEvent ) board()->BuildConnectivity( reporter.get() ); - canvas()->Refresh(); + refresh(); + m_fillInProgress = false; return 0; } @@ -340,7 +346,8 @@ int ZONE_FILLER_TOOL::ZoneUnfill( const TOOL_EVENT& aEvent ) } commit.Push( _( "Unfill Zone" ), ZONE_FILL_OP ); - canvas()->Refresh(); + + refresh(); return 0; } @@ -358,12 +365,34 @@ int ZONE_FILLER_TOOL::ZoneUnfillAll( const TOOL_EVENT& aEvent ) } commit.Push( _( "Unfill All Zones" ), ZONE_FILL_OP ); - canvas()->Refresh(); + + refresh(); return 0; } +void ZONE_FILLER_TOOL::refresh() +{ + canvas()->GetView()->UpdateAllItemsConditionally( KIGFX::REPAINT, + [&]( KIGFX::VIEW_ITEM* aItem ) -> bool + { + if( PCB_VIA* via = dynamic_cast( aItem ) ) + { + return via->GetRemoveUnconnected(); + } + else if( PAD* pad = dynamic_cast( aItem ) ) + { + return pad->GetRemoveUnconnected(); + } + + return false; + } ); + + canvas()->Refresh(); +} + + void ZONE_FILLER_TOOL::setTransitions() { // Zone actions diff --git a/pcbnew/tools/zone_filler_tool.h b/pcbnew/tools/zone_filler_tool.h index 10ea6186d8..d867ca0e97 100644 --- a/pcbnew/tools/zone_filler_tool.h +++ b/pcbnew/tools/zone_filler_tool.h @@ -68,6 +68,8 @@ private: ///< Refocus on an idle event (used after the Progress Reporter messes up the focus). void singleShotRefocus( wxIdleEvent& ); + void refresh(); + ///< Set up handlers for various events. void setTransitions() override;