Dismiss infobar if it's dismissable on board save

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7071
This commit is contained in:
Jon Evans 2021-01-12 23:24:05 -05:00
parent ede500f117
commit d2d4ffe6d0
3 changed files with 22 additions and 0 deletions

View File

@ -275,6 +275,22 @@ void WX_INFOBAR::RemoveAllButtons()
}
bool WX_INFOBAR::HasCloseButton() const
{
wxSizer* sizer = GetSizer();
if( sizer->GetItemCount() == 0 )
return false;
if( sizer->GetItem( sizer->GetItemCount() - 1 )->IsSpacer() )
return false;
wxSizerItem* item = sizer->GetItem( sizer->GetItemCount() - 1 );
return ( item->GetWindow()->GetId() == ID_CLOSE_INFOBAR );
}
void WX_INFOBAR::onShowInfoBar( wxCommandEvent& aEvent )
{
RemoveAllButtons();

View File

@ -130,6 +130,8 @@ public:
*/
void RemoveAllButtons();
bool HasCloseButton() const;
/**
* Provide a callback to be called when the infobar is dismissed (either by user action
* or timer).

View File

@ -935,6 +935,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
SetStatusText( lowerTxt, 0 );
// Get rid of the old version conversion warning, or any other dismissable warning :)
if( m_infoBar->IsShown() && m_infoBar->HasCloseButton() )
m_infoBar->Dismiss();
GetScreen()->ClrModify();
GetScreen()->ClrSave();
return true;