Handle 'Simulate' button label in idle event handler

This commit is contained in:
Maciej Suminski 2016-08-11 14:41:19 +02:00
parent aea29fc730
commit 544da3feda
2 changed files with 11 additions and 6 deletions

View File

@ -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>() );

View File

@ -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 );