Handle 'Simulate' button label in idle event handler
This commit is contained in:
parent
aea29fc730
commit
544da3feda
|
@ -101,6 +101,7 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent )
|
|||
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( SIM_PLOT_FRAME::onClose ), NULL, this );
|
||||
Connect( wxEVT_SIM_REPORT, wxThreadEventHandler( SIM_PLOT_FRAME::onSimReport ), NULL, this );
|
||||
Connect( wxEVT_SIM_FINISHED, wxThreadEventHandler( SIM_PLOT_FRAME::onSimFinished ), NULL, this );
|
||||
Connect( wxEVT_IDLE, wxIdleEventHandler( SIM_PLOT_FRAME::onIdle ), NULL, this );
|
||||
|
||||
NewPlotPanel();
|
||||
}
|
||||
|
@ -256,15 +257,9 @@ void SIM_PLOT_FRAME::onSignalDblClick( wxCommandEvent& event )
|
|||
void SIM_PLOT_FRAME::onSimulate( wxCommandEvent& event )
|
||||
{
|
||||
if( isSimulationRunning() )
|
||||
{
|
||||
StopSimulation();
|
||||
m_simulateBtn->SetLabel( wxT( "Simulate" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
StartSimulation();
|
||||
m_simulateBtn->SetLabel( wxT( "Stop" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -315,6 +310,15 @@ void SIM_PLOT_FRAME::onClose( wxCloseEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onIdle( wxIdleEvent& aEvent )
|
||||
{
|
||||
if( isSimulationRunning() )
|
||||
m_simulateBtn->SetLabel( wxT( "Stop" ) );
|
||||
else
|
||||
m_simulateBtn->SetLabel( wxT( "Simulate" ) );
|
||||
}
|
||||
|
||||
|
||||
void SIM_PLOT_FRAME::onSimReport( wxThreadEvent& aEvent )
|
||||
{
|
||||
m_simConsole->WriteText( aEvent.GetPayload<wxString>() );
|
||||
|
|
|
@ -92,6 +92,7 @@ class SIM_PLOT_FRAME : public SIM_PLOT_FRAME_BASE
|
|||
void onPlaceProbe( wxCommandEvent& event ) override;
|
||||
|
||||
void onClose( wxCloseEvent& aEvent );
|
||||
void onIdle( wxIdleEvent& aEvent );
|
||||
void onSimReport( wxThreadEvent& aEvent );
|
||||
void onSimFinished( wxThreadEvent& aEvent );
|
||||
|
||||
|
|
Loading…
Reference in New Issue