Fix sim bug running a command the first time when no command in doc.
Fixes https://gitlab.com/kicad/code/kicad/issues/11366
This commit is contained in:
parent
bfd3b40672
commit
8069e5d5d6
|
@ -1511,20 +1511,25 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event )
|
|||
const wxString& newCommand = dlg.GetSimCommand();
|
||||
SIM_TYPE newSimType = NGSPICE_CIRCUIT_MODEL::CommandToSimType( newCommand );
|
||||
|
||||
// If it is a new simulation type, open a new plot
|
||||
// For the DC sim, check if sweep source type has changed (char 4 will contain 'v',
|
||||
// 'i', 'r' or 't'.
|
||||
if( !plotPanelWindow
|
||||
|| ( plotPanelWindow && plotPanelWindow->GetType() != newSimType )
|
||||
|| ( newSimType == ST_DC
|
||||
&& oldCommand.Lower().GetChar( 4 ) != newCommand.Lower().GetChar( 4 ) ) )
|
||||
if( !plotPanelWindow )
|
||||
{
|
||||
m_circuitModel->SetSimCommandOverride( newCommand );
|
||||
plotPanelWindow = NewPlotPanel( newCommand );
|
||||
}
|
||||
// If it is a new simulation type, open a new plot. For the DC sim, check if sweep
|
||||
// source type has changed (char 4 will contain 'v', 'i', 'r' or 't'.
|
||||
else if( plotPanelWindow->GetType() != newSimType
|
||||
|| ( newSimType == ST_DC
|
||||
&& oldCommand.Lower().GetChar( 4 ) != newCommand.Lower().GetChar( 4 ) ) )
|
||||
{
|
||||
plotPanelWindow = NewPlotPanel( newCommand );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_workbook->GetPageIndex( plotPanelWindow ) == 0 )
|
||||
m_circuitModel->SetSimCommandOverride( newCommand );
|
||||
|
||||
// Update simulation command in the current plot
|
||||
m_circuitModel->SetSimCommandOverride( newCommand );
|
||||
m_workbook->SetSimCommand( plotPanelWindow, newCommand );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue