From 5d468ca7598a3028c7e24106d5a6b887da434764 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 10 Sep 2022 21:26:25 +0100 Subject: [PATCH] Use MESSAGE_TYPE::OUTDATED_SAVE for read-only infobar messages as well. Fixes https://gitlab.com/kicad/code/kicad/issues/12252 --- eeschema/files-io.cpp | 6 +++++- pagelayout_editor/files.cpp | 8 +++++++- pcbnew/pcb_edit_frame.cpp | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 98af79265f..c5051d66e9 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -510,7 +510,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& 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 ) ); diff --git a/pagelayout_editor/files.cpp b/pagelayout_editor/files.cpp index 1a3f109737..d63d5f95ca 100644 --- a/pagelayout_editor/files.cpp +++ b/pagelayout_editor/files.cpp @@ -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; } diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 4f4cfa7877..f37c39f813 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -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();