Browse Source

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
6.0.7
Marek Roszko 5 years ago
parent
commit
abb5cb8310
  1. 12
      common/eda_draw_frame.cpp
  2. 9
      eeschema/files-io.cpp
  3. 9
      include/eda_draw_frame.h
  4. 7
      pcbnew/files.cpp

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

9
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<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;
}

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

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

Loading…
Cancel
Save