diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 006e08f87a..ea26a0cbd3 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -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 ); }