Remove m_simulator null-check -- most of code already assumes it exists

This commit is contained in:
Mikolaj Wielgus 2021-07-06 20:58:29 +02:00 committed by Wayne Stambaugh
parent 0446d35f0d
commit 4f384085e2
2 changed files with 7 additions and 14 deletions

View File

@ -497,12 +497,6 @@ void SIM_PLOT_FRAME::StopSimulation()
} }
bool SIM_PLOT_FRAME::IsSimulationRunning()
{
return m_simulator ? m_simulator->IsRunning() : false;
}
SIM_PANEL_BASE* SIM_PLOT_FRAME::NewPlotPanel( wxString aSimCommand ) SIM_PANEL_BASE* SIM_PLOT_FRAME::NewPlotPanel( wxString aSimCommand )
{ {
SIM_PANEL_BASE* plotPanel = nullptr; SIM_PANEL_BASE* plotPanel = nullptr;
@ -963,7 +957,7 @@ bool SIM_PLOT_FRAME::loadWorkbook( const wxString& aPath )
{ {
wxThread::This()->Sleep( 50 ); wxThread::This()->Sleep( 50 );
} }
while( IsSimulationRunning() ); while( m_simulator->IsRunning() );
if( !file.GetNextLine().ToLong( &tracesCount ) ) if( !file.GetNextLine().ToLong( &tracesCount ) )
{ {
@ -1395,7 +1389,7 @@ void SIM_PLOT_FRAME::onSignalRClick( wxListEvent& event )
void SIM_PLOT_FRAME::onSimulate( wxCommandEvent& event ) void SIM_PLOT_FRAME::onSimulate( wxCommandEvent& event )
{ {
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
StopSimulation(); StopSimulation();
else else
StartSimulation(); StartSimulation();
@ -1457,7 +1451,7 @@ void SIM_PLOT_FRAME::onSettings( wxCommandEvent& event )
void SIM_PLOT_FRAME::onAddSignal( wxCommandEvent& event ) void SIM_PLOT_FRAME::onAddSignal( wxCommandEvent& event )
{ {
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
{ {
DisplayInfoMessage( this, _( "Simulator is running. Try later" ) ); DisplayInfoMessage( this, _( "Simulator is running. Try later" ) );
return; return;
@ -1481,7 +1475,7 @@ void SIM_PLOT_FRAME::onProbe( wxCommandEvent& event )
if( m_schematicFrame == NULL ) if( m_schematicFrame == NULL )
return; return;
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
{ {
DisplayInfoMessage( this, _( "Simulator is running. Try later" ) ); DisplayInfoMessage( this, _( "Simulator is running. Try later" ) );
return; return;
@ -1591,7 +1585,7 @@ bool SIM_PLOT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
void SIM_PLOT_FRAME::doCloseWindow() void SIM_PLOT_FRAME::doCloseWindow()
{ {
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
m_simulator->Stop(); m_simulator->Stop();
// Cancel a running simProbe or simTune tool // Cancel a running simProbe or simTune tool
@ -1672,7 +1666,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
if( !plotPanelWindow || plotPanelWindow->GetType() != simType ) if( !plotPanelWindow || plotPanelWindow->GetType() != simType )
plotPanelWindow = NewPlotPanel( m_exporter->GetUsedSimCommand() ); plotPanelWindow = NewPlotPanel( m_exporter->GetUsedSimCommand() );
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
return; return;
// If there are any signals plotted, update them // If there are any signals plotted, update them
@ -1748,7 +1742,7 @@ void SIM_PLOT_FRAME::onSimFinished( wxCommandEvent& aEvent )
void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent ) void SIM_PLOT_FRAME::onSimUpdate( wxCommandEvent& aEvent )
{ {
if( IsSimulationRunning() ) if( m_simulator->IsRunning() )
StopSimulation(); StopSimulation();
if( CurrentPlot() != m_lastSimPlot ) if( CurrentPlot() != m_lastSimPlot )

View File

@ -71,7 +71,6 @@ public:
void StartSimulation( const wxString& aSimCommand = wxEmptyString ); void StartSimulation( const wxString& aSimCommand = wxEmptyString );
void StopSimulation(); void StopSimulation();
bool IsSimulationRunning();
/** /**
* Create a new plot panel for a given simulation type and adds it to the main notebook. * Create a new plot panel for a given simulation type and adds it to the main notebook.