Provide a default xaxis for DC-sweep so we can add traces before sim is run.

This commit is contained in:
Jeff Young 2023-02-25 22:42:52 +00:00
parent 1fdc81e68d
commit 8c8c5e1824
4 changed files with 12 additions and 18 deletions

View File

@ -339,37 +339,30 @@ bool NGSPICE::Command( const std::string& aCmd )
}
std::string NGSPICE::GetXAxis( SIM_TYPE aType ) const
wxString NGSPICE::GetXAxis( SIM_TYPE aType ) const
{
switch( aType )
{
case ST_AC:
case ST_NOISE:
return std::string( "frequency" );
return wxS( "frequency" );
case ST_DC:
// find plot, which ends with "-sweep"
for( auto& plot : AllPlots() )
for( wxString plot : AllPlots() )
{
const std::string sweepEnding = "-sweep";
unsigned int len = sweepEnding.length();
if( plot.length() > len
&& plot.substr( plot.length() - len, len ).compare( sweepEnding ) == 0 )
{
return std::string( plot );
}
if( plot.Lower().EndsWith( wxS( "-sweep" ) ) )
return plot;
}
break;
return wxS( "sweep" );
case ST_TRANSIENT:
return std::string( "time" );
return wxS( "time" );
default:
break;
return wxEmptyString;
}
return std::string( "" );
}

View File

@ -78,7 +78,7 @@ public:
bool Command( const std::string& aCmd ) override final;
///< @copydoc SPICE_SIMULATOR::GetXAxis()
std::string GetXAxis( SIM_TYPE aType ) const override final;
wxString GetXAxis( SIM_TYPE aType ) const override final;
///< @copydoc SPICE_SIMULATOR::AllPlots()
std::vector<std::string> AllPlots() const override final;

View File

@ -2377,6 +2377,7 @@ void SIM_PLOT_FRAME::onPlotClosed( wxAuiNotebookEvent& event )
void SIM_PLOT_FRAME::onPlotChanged( wxAuiNotebookEvent& event )
{
rebuildSignalsList();
rebuildSignalsGrid( m_filter->GetValue() );
updateCursors();
}

View File

@ -78,7 +78,7 @@ public:
virtual bool Command( const std::string& aCmd ) = 0;
///< Return X axis name for a given simulation type
virtual std::string GetXAxis( SIM_TYPE aType ) const = 0;
virtual wxString GetXAxis( SIM_TYPE aType ) const = 0;
///< Set a #SPICE_REPORTER object to receive the simulation log.
virtual void SetReporter( SPICE_REPORTER* aReporter )