Use MESSAGE_TYPE::OUTDATED_SAVE for read-only infobar messages as well.

Fixes https://gitlab.com/kicad/code/kicad/issues/12252
This commit is contained in:
Jeff Young 2022-09-10 21:26:25 +01:00
parent a9877ab117
commit 5d468ca759
3 changed files with 14 additions and 3 deletions

View File

@ -510,7 +510,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
{
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_infoBar->ShowMessage( _( "Schematic is read only." ), wxICON_WARNING );
m_infoBar->ShowMessage( _( "Schematic is read only." ),
wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
}
#ifdef PROFILE
@ -688,6 +689,9 @@ bool SCH_EDIT_FRAME::saveSchematicFile( SCH_SHEET* aSheet, const wxString& aSave
// Save
wxLogTrace( traceAutoSave, "Saving file " + schematicFileName.GetFullPath() );
if( m_infoBar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE )
m_infoBar->Dismiss();
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::GuessPluginTypeFromSchPath(
schematicFileName.GetFullPath() );
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( pluginType ) );

View File

@ -262,7 +262,10 @@ bool PL_EDITOR_FRAME::LoadDrawingSheetFile( const wxString& aFullFileName )
if( fn.FileExists() && !fn.IsFileWritable() )
{
ShowInfoBarWarning( _( "Layout file is read only." ), true );
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_infoBar->ShowMessage( _( "Layout file is read only." ),
wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
}
return true;
@ -309,6 +312,9 @@ bool PL_EDITOR_FRAME::SaveDrawingSheetFile( const wxString& aFullFileName )
if( !wxRenameFile( tempFile, aFullFileName ) )
return false;
if( m_infoBar->GetMessageType() == WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE )
m_infoBar->Dismiss();
GetScreen()->SetContentModified( false );
return true;
}

View File

@ -1273,7 +1273,8 @@ void PCB_EDIT_FRAME::onBoardLoaded()
{
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_infoBar->ShowMessage( _( "Board file is read only." ), wxICON_WARNING );
m_infoBar->ShowMessage( _( "Board file is read only." ),
wxICON_WARNING, WX_INFOBAR::MESSAGE_TYPE::OUTDATED_SAVE );
}
ReCreateLayerBox();