Improve robustness of infobar button handling.

This commit is contained in:
Jeff Young 2020-10-16 17:07:59 +01:00
parent ebc8e2c921
commit 1ee3df61c9
4 changed files with 13 additions and 3 deletions

View File

@ -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 );
}

View File

@ -68,6 +68,7 @@ int AUTOPLACE_TOOL::autoplace( std::vector<MODULE*>& 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;
}

View File

@ -728,10 +728,12 @@ int ROUTER_TOOL::onViaCommand( const TOOL_EVENT& aEvent )
getEditFrame<PCB_EDIT_FRAME>()->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<PCB_EDIT_FRAME>()->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;
}

View File

@ -116,9 +116,11 @@ void ZONE_FILLER_TOOL::FillAllZones( wxWindow* aCaller, PROGRESS_REPORTER* aRepo
getEditFrame<PCB_EDIT_FRAME>()->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 )