EDA_BASE_FRAME::ShowInfoBarMsg: add option to show a close button.

Same for EDA_BASE_FRAME::ShowInfoBarError and EDA_BASE_FRAME::ShowInfoBarWarning
This commit is contained in:
jean-pierre charras 2020-12-04 14:45:14 +01:00
parent 821128cb8e
commit c47871e775
3 changed files with 48 additions and 7 deletions

View File

@ -683,23 +683,35 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
}
void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg )
void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton )
{
m_infoBar->RemoveAllButtons();
if( aShowCloseButton )
m_infoBar->AddCloseButton();
GetInfoBar()->ShowMessageFor( aErrorMsg, 8000, wxICON_ERROR );
}
void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg )
void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg, bool aShowCloseButton )
{
m_infoBar->RemoveAllButtons();
if( aShowCloseButton )
m_infoBar->AddCloseButton();
GetInfoBar()->ShowMessageFor( aWarningMsg, 8000, wxICON_WARNING );
}
void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg )
void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg, bool aShowCloseButton )
{
m_infoBar->RemoveAllButtons();
if( aShowCloseButton )
m_infoBar->AddCloseButton();
GetInfoBar()->ShowMessageFor( aMsg, 10000, wxICON_INFORMATION );
}

View File

@ -908,7 +908,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
// If incrementing tries to go below zero, tell user why the value is repeated
if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) )
m_frame->ShowInfoBarMsg( _( "Label value cannot go below zero" ) );
m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true );
}
newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),

View File

@ -330,11 +330,40 @@ public:
void PrintMsg( const wxString& text );
/**
* @return the WX_INFOBAR that can be displayed on the top of the canvas
*/
WX_INFOBAR* GetInfoBar() { return m_infoBar; }
void ShowInfoBarError( const wxString& aErrorMsg );
void ShowInfoBarWarning( const wxString& aWarningMsg );
void ShowInfoBarMsg( const wxString& aMsg );
/**
* Show the WX_INFOBAR displayed on the top of the canvas with a message
* and a Error icon on the left of the infobar. The infobar will be closed
* after a timeaout
* @param aErrorMsg is the message to display
* @param aShowCloseButton = true to show a close button on the right of the
* WX_INFOBAR
*/
void ShowInfoBarError( const wxString& aErrorMsg, bool aShowCloseButton = false );
/**
* Show the WX_INFOBAR displayed on the top of the canvas with a message
* and a Warning icon on the left of the infobar. The infobar will be closed
* after a timeaout
* @param aErrorMsg is the message to display
* @param aShowCloseButton = true to show a close button on the right of the
* WX_INFOBAR
*/
void ShowInfoBarWarning( const wxString& aWarningMsg, bool aShowCloseButton = false );
/**
* Show the WX_INFOBAR displayed on the top of the canvas with a message
* and a Info icon on the left of the infobar. The infobar will be closed
* after a timeaout
* @param aErrorMsg is the message to display
* @param aShowCloseButton = true to show a close button on the right of the
* WX_INFOBAR
*/
void ShowInfoBarMsg( const wxString& aMsg, bool aShowCloseButton = false );
/**
* Returns the settings object used in SaveSettings(), and is overloaded in