Fix up msg panel status on save slightly

- pcbnew should use status bar on success like eeschema
- Add a helper to clear msgpanel and set it in one go to avoid redraw delays due to doing processing in between
This commit is contained in:
Marek Roszko 2020-12-08 00:27:34 -05:00
parent d7154c4334
commit abb5cb8310
4 changed files with 28 additions and 9 deletions

View File

@ -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." ) );

View File

@ -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<wxString>& 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<wxString>& 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;
}

View File

@ -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.
*/

View File

@ -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();