From b7be42375dd1ea35c043515fb7c9b7da342de058 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 24 Feb 2022 20:29:23 +0000 Subject: [PATCH] Add an infobar warning when trying to fill a zone which is not connected. --- pcbnew/tools/zone_filler_tool.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index 39d3ab6d00..13883c13ca 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -268,8 +268,21 @@ int ZONE_FILLER_TOOL::ZoneFillDirty( const TOOL_EVENT& aEvent ) if( outlines == 0 ) { - // TODO: why does this trash memory? - // frame->ShowInfoBarWarning( _( "Zone has no connections." ) ); + WX_INFOBAR* infobar = frame->GetInfoBar(); + +#ifdef __WXMAC__ + // I haven't a clue why this is needed, but if you start another operation before the + // animation is over then you end up accessing deleted view items. + infobar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE ); +#endif + + infobar->RemoveAllButtons(); + infobar->ShowMessageFor( _( "Zone has no connections." ), 4000, wxICON_WARNING ); + +#ifdef __WXMAC__ + infobar->SetShowHideEffects( wxSHOW_EFFECT_ROLL_TO_BOTTOM, wxSHOW_EFFECT_ROLL_TO_TOP ); + infobar->SetEffectDuration( 300 ); +#endif break; } }