diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index db95971e95..b8821c76ca 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -621,6 +621,18 @@ void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList ) } +void EDA_DRAW_FRAME::SetMsgPanel( + const wxString& aTextUpper, const wxString& aTextLower, int aPadding ) +{ + if( m_messagePanel ) + { + m_messagePanel->EraseMsgBox(); + + m_messagePanel->AppendMessage( aTextUpper, aTextLower, aPadding ); + } +} + + void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem ) { wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) ); diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index db7bf1f605..992cf72346 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -132,7 +132,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName ) DisplayError( this, msg ); msg.Printf( _( "Failed to create temporary file \"%s\"" ), tempFile.GetFullPath() ); - AppendMsgPanel( wxEmptyString, msg, CYAN ); + SetMsgPanel( wxEmptyString, msg ); // In case we started a file but didn't fully write it, clean up wxRemoveFile( tempFile.GetFullPath() ); @@ -153,7 +153,7 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName ) DisplayError( this, msg ); msg.Printf( _( "Failed to rename temporary file \"%s\"" ), tempFile.GetFullPath() ); - AppendMsgPanel( wxEmptyString, msg, CYAN ); + SetMsgPanel( wxEmptyString, msg ); } } @@ -284,7 +284,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in } SetStatusText( wxEmptyString ); - ClearMsgPanel(); SCH_IO_MGR::SCH_FILE_T schFileType = SCH_IO_MGR::GuessPluginTypeFromSchPath( fullFileName ); @@ -399,7 +398,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in DisplayError( this, msg ); msg.Printf( _( "Failed to load \"%s\"" ), fullFileName ); - AppendMsgPanel( wxEmptyString, msg, CYAN ); + SetMsgPanel( wxEmptyString, msg ); return false; } @@ -996,7 +995,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) DisplayError( this, msg ); msg.Printf( _( "Failed to load \"%s\"" ), aFileName ); - AppendMsgPanel( wxEmptyString, msg, CYAN ); + SetMsgPanel( wxEmptyString, msg ); return false; } diff --git a/include/eda_draw_frame.h b/include/eda_draw_frame.h index 617cee5f04..b412fa9bfd 100644 --- a/include/eda_draw_frame.h +++ b/include/eda_draw_frame.h @@ -431,6 +431,15 @@ public: void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList ); void SetMsgPanel( EDA_ITEM* aItem ); + /** + * Helper function that erases the msg panel and then appends a single message + * + * @param aTextUpper - The message upper text. + * @param aTextLower - The message lower text. + * @param aPadding - Number of spaces to pad between messages. + */ + void SetMsgPanel( const wxString& aTextUpper, const wxString& aTextLower, int aPadding = 6 ); + /** * Redraw the message panel. */ diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 5173ef8d26..f7f3bb12a1 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -845,7 +845,6 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory, GetSettingsManager()->SaveProject(); - ClearMsgPanel(); wxString upperTxt; wxString lowerTxt; @@ -868,7 +867,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory, lowerTxt.Printf( _( "Failed to create temporary file \"%s\"" ), tempFile.GetFullPath() ); - AppendMsgPanel( upperTxt, lowerTxt, CYAN ); + SetMsgPanel( upperTxt, lowerTxt ); // In case we started a file but didn't fully write it, clean up wxRemoveFile( tempFile.GetFullPath() ); @@ -887,7 +886,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory, lowerTxt.Printf( _( "Failed to rename temporary file \"%s\"" ), tempFile.GetFullPath() ); - AppendMsgPanel( upperTxt, lowerTxt, CYAN ); + SetMsgPanel( upperTxt, lowerTxt ); return false; } @@ -917,7 +916,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory, lowerTxt.Printf( _( "Wrote board file: \"%s\"" ), pcbFileName.GetFullPath() ); - AppendMsgPanel( upperTxt, lowerTxt, CYAN ); + SetStatusText( lowerTxt, 0 ); GetScreen()->ClrModify(); GetScreen()->ClrSave();