Formatting.

This commit is contained in:
Jeff Young 2021-06-25 20:49:19 +01:00
parent ea0c162604
commit 173c9a974c
1 changed files with 29 additions and 35 deletions

View File

@ -652,8 +652,10 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const
SIM_PLOT_PANEL* plotPanel = CurrentPlot(); SIM_PLOT_PANEL* plotPanel = CurrentPlot();
if( !plotPanel || plotPanel->GetType() != simType ) if( !plotPanel || plotPanel->GetType() != simType )
{
plotPanel = plotPanel =
dynamic_cast<SIM_PLOT_PANEL*>( NewPlotPanel( m_exporter->GetUsedSimCommand() ) ); dynamic_cast<SIM_PLOT_PANEL*>( NewPlotPanel( m_exporter->GetUsedSimCommand() ) );
}
wxASSERT( plotPanel ); wxASSERT( plotPanel );
@ -668,8 +670,8 @@ void SIM_PLOT_FRAME::addPlot( const wxString& aName, SIM_PLOT_TYPE aType, const
int baseType = aType & ~( SPT_AC_MAG | SPT_AC_PHASE ); int baseType = aType & ~( SPT_AC_MAG | SPT_AC_PHASE );
// Add two plots: magnitude & phase // Add two plots: magnitude & phase
updated |= updated |= updatePlot( aName, ( SIM_PLOT_TYPE )( baseType | SPT_AC_MAG ), aParam,
updatePlot( aName, ( SIM_PLOT_TYPE )( baseType | SPT_AC_MAG ), aParam, plotPanel ); plotPanel );
updated |= updatePlot( aName, ( SIM_PLOT_TYPE )( baseType | SPT_AC_PHASE ), aParam, updated |= updatePlot( aName, ( SIM_PLOT_TYPE )( baseType | SPT_AC_PHASE ), aParam,
plotPanel ); plotPanel );
} }
@ -1044,7 +1046,9 @@ bool SIM_PLOT_FRAME::saveWorkbook( const wxString& aPath )
const SIM_PLOT_PANEL* panel = dynamic_cast<const SIM_PLOT_PANEL*>( plotPanel ); const SIM_PLOT_PANEL* panel = dynamic_cast<const SIM_PLOT_PANEL*>( plotPanel );
if( !panel ) if( !panel )
{
file.AddLine( wxString::Format( "%llu", 0ull ) ); file.AddLine( wxString::Format( "%llu", 0ull ) );
}
else else
{ {
file.AddLine( wxString::Format( "%llu", panel->GetTraces().size() ) ); file.AddLine( wxString::Format( "%llu", panel->GetTraces().size() ) );
@ -1075,16 +1079,10 @@ SIM_PLOT_TYPE SIM_PLOT_FRAME::GetXAxisType( SIM_TYPE aType ) const
{ {
switch( aType ) switch( aType )
{ {
case ST_AC: /// @todo SPT_LOG_FREQUENCY
return SPT_LIN_FREQUENCY; case ST_AC: return SPT_LIN_FREQUENCY;
/// @todo SPT_LOG_FREQUENCY case ST_DC: return SPT_SWEEP;
case ST_TRANSIENT: return SPT_TIME;
case ST_DC:
return SPT_SWEEP;
case ST_TRANSIENT:
return SPT_TIME;
default: default:
wxASSERT_MSG( false, "Unhandled simulation type" ); wxASSERT_MSG( false, "Unhandled simulation type" );
return (SIM_PLOT_TYPE) 0; return (SIM_PLOT_TYPE) 0;
@ -1145,7 +1143,8 @@ void SIM_PLOT_FRAME::menuSaveWorkbookAs( wxCommandEvent& event )
defaultFilename = Prj().GetProjectName() + wxT( ".wbk" ); defaultFilename = Prj().GetProjectName() + wxT( ".wbk" );
wxFileDialog saveAsDlg( this, _( "Save Simulation Workbook As" ), m_savedWorkbooksPath, wxFileDialog saveAsDlg( this, _( "Save Simulation Workbook As" ), m_savedWorkbooksPath,
defaultFilename, WorkbookFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); defaultFilename, WorkbookFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveAsDlg.ShowModal() == wxID_CANCEL ) if( saveAsDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -1162,8 +1161,8 @@ void SIM_PLOT_FRAME::menuSaveImage( wxCommandEvent& event )
if( !CurrentPlot() ) if( !CurrentPlot() )
return; return;
wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "", wxFileDialog saveDlg( this, _( "Save Plot as Image" ), "", "", PngFileWildcard(),
PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -1179,8 +1178,8 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event )
const wxChar SEPARATOR = ';'; const wxChar SEPARATOR = ';';
wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "", wxFileDialog saveDlg( this, _( "Save Plot Data" ), "", "", CsvFileWildcard(),
CsvFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( saveDlg.ShowModal() == wxID_CANCEL ) if( saveDlg.ShowModal() == wxID_CANCEL )
return; return;
@ -1302,10 +1301,8 @@ void SIM_PLOT_FRAME::menuWhiteBackground( wxCommandEvent& event )
// which is only SIM_PLOT_PANEL_BASE // which is only SIM_PLOT_PANEL_BASE
SIM_PLOT_PANEL* panel = dynamic_cast<SIM_PLOT_PANEL*>( curPage ); SIM_PLOT_PANEL* panel = dynamic_cast<SIM_PLOT_PANEL*>( curPage );
if( panel != nullptr ) if( panel )
{
panel->UpdatePlotColors(); panel->UpdatePlotColors();
}
} }
} }
@ -1317,8 +1314,7 @@ void SIM_PLOT_FRAME::onPlotClose( wxAuiNotebookEvent& event )
if( idx == wxNOT_FOUND ) if( idx == wxNOT_FOUND )
return; return;
SIM_PANEL_BASE* plotPanel = SIM_PANEL_BASE* plotPanel = dynamic_cast<SIM_PANEL_BASE*>( m_plotNotebook->GetPage( idx ) );
dynamic_cast<SIM_PANEL_BASE*>( m_plotNotebook->GetPage( idx ) );
m_workbook->RemovePlotPanel( plotPanel ); m_workbook->RemovePlotPanel( plotPanel );
wxCommandEvent dummy; wxCommandEvent dummy;
@ -1558,7 +1554,10 @@ bool SIM_PLOT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
wxString msg = _( "Save changes to \"%s\" before closing?" ); wxString msg = _( "Save changes to \"%s\" before closing?" );
return HandleUnsavedChanges( this, wxString::Format( msg, filename.GetFullName() ), return HandleUnsavedChanges( this, wxString::Format( msg, filename.GetFullName() ),
[&]()->bool { return saveWorkbook( Prj().AbsolutePath ( filename.GetFullName() ) ); } ); [&]()->bool
{
return saveWorkbook( Prj().AbsolutePath ( filename.GetFullName() ) );
} );
} }
return true; return true;
@ -1659,14 +1658,9 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
struct TRACE_DESC struct TRACE_DESC
{ {
///< Name of the measured net/device wxString m_name; ///< Name of the measured net/device
wxString m_name; SIM_PLOT_TYPE m_type; ///< Type of the signal
wxString m_param; ///< Name of the signal parameter
///< Type of the signal
SIM_PLOT_TYPE m_type;
///< Name of the signal parameter
wxString m_param;
}; };
std::vector<struct TRACE_DESC> traceInfo; std::vector<struct TRACE_DESC> traceInfo;
@ -1715,8 +1709,9 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
const size_t tab = 25; //characters const size_t tab = 25; //characters
size_t padding = ( signal.length() < tab ) ? ( tab - signal.length() ) : 1; size_t padding = ( signal.length() < tab ) ? ( tab - signal.length() ) : 1;
outLine.Printf( wxT( "%s%s" ), ( signal + wxT( ":" ) ).Pad( padding, wxUniChar( ' ' ) ), outLine.Printf( wxT( "%s%s" ),
SPICE_VALUE( val ).ToSpiceString() ); ( signal + wxT( ":" ) ).Pad( padding, wxUniChar( ' ' ) ),
SPICE_VALUE( val ).ToSpiceString() );
outLine.Append( type == SPT_CURRENT ? "A\n" : "V\n" ); outLine.Append( type == SPT_CURRENT ? "A\n" : "V\n" );
@ -1765,8 +1760,7 @@ SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::SIGNAL_CONTEXT_MENU( const wxString& aSigna
{ {
SIM_PLOT_PANEL* plot = m_plotFrame->CurrentPlot(); SIM_PLOT_PANEL* plot = m_plotFrame->CurrentPlot();
AddMenuItem( this, HIDE_SIGNAL, _( "Hide Signal" ), AddMenuItem( this, HIDE_SIGNAL, _( "Hide Signal" ), _( "Erase the signal from plot screen" ),
_( "Erase the signal from plot screen" ),
KiBitmap( BITMAPS::trash ) ); KiBitmap( BITMAPS::trash ) );
TRACE* trace = plot->GetTrace( m_signal ); TRACE* trace = plot->GetTrace( m_signal );