From 1ee3df61c93a283bfa3a13ad5abefe3db551b674 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 16 Oct 2020 17:07:59 +0100 Subject: [PATCH] Improve robustness of infobar button handling. --- common/eda_base_frame.cpp | 3 +++ pcbnew/autorouter/autoplace_tool.cpp | 1 + pcbnew/router/router_tool.cpp | 8 ++++++-- pcbnew/tools/zone_filler_tool.cpp | 4 +++- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 4531fe6634..937559d22d 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -666,18 +666,21 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text ) void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg ) { + m_infoBar->RemoveAllButtons(); GetInfoBar()->ShowMessageFor( aErrorMsg, 5000, wxICON_ERROR ); } void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg ) { + m_infoBar->RemoveAllButtons(); GetInfoBar()->ShowMessageFor( aWarningMsg, 5000, wxICON_WARNING ); } void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg ) { + m_infoBar->RemoveAllButtons(); GetInfoBar()->ShowMessageFor( aMsg, 10000, wxICON_INFORMATION ); } diff --git a/pcbnew/autorouter/autoplace_tool.cpp b/pcbnew/autorouter/autoplace_tool.cpp index 8ab3f68311..f0f5da9a09 100644 --- a/pcbnew/autorouter/autoplace_tool.cpp +++ b/pcbnew/autorouter/autoplace_tool.cpp @@ -68,6 +68,7 @@ int AUTOPLACE_TOOL::autoplace( std::vector& aModules, bool aPlaceOffboa wxString msg = wxString::Format( _( "Board edges must be defined on the %s layer." ), LayerName( Edge_Cuts ) ); + frame()->GetInfoBar()->RemoveAllButtons(); frame()->GetInfoBar()->ShowMessageFor( msg, 5000, wxICON_ERROR ); return 0; } diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 44ad9c4bb8..2d29069948 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -728,10 +728,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent ) getEditFrame()->ShowBoardSetupDialog( _( "Constraints" ) ); } ) ); + infobar->RemoveAllButtons(); + infobar->AddButton( button ); + infobar->ShowMessageFor( _( "Blind/buried vias have to be enabled in " "Board Setup > Design Rules > Constraints." ), 10000, wxICON_ERROR ); - infobar->AddButton( button ); return false; } @@ -747,10 +749,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent ) getEditFrame()->ShowBoardSetupDialog( _( "Constraints" ) ); } ) ); + infobar->RemoveAllButtons(); + infobar->AddButton( button ); + infobar->ShowMessageFor( _( "Microvias have to be enabled in " "Board Setup > Design Rules > Constraints." ), 10000, wxICON_ERROR ); - infobar->AddButton( button ); return false; } diff --git a/pcbnew/tools/zone_filler_tool.cpp b/pcbnew/tools/zone_filler_tool.cpp index f821a7e3dd..2761d327e9 100644 --- a/pcbnew/tools/zone_filler_tool.cpp +++ b/pcbnew/tools/zone_filler_tool.cpp @@ -116,9 +116,11 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo getEditFrame()->ShowBoardSetupDialog( _( "Rules" ) ); } ) ); + infobar->RemoveAllButtons(); + infobar->AddButton( button ); + infobar->ShowMessageFor( _( "Zone fills may be inaccurate. DRC rules contain errors." ), 10000, wxICON_WARNING ); - infobar->AddButton( button ); } if( aReporter )