From 544da3feda449bb7b76a2ae885ba3de1e88f98b6 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 11 Aug 2016 14:41:19 +0200 Subject: [PATCH] Handle 'Simulate' button label in idle event handler --- eeschema/sim/sim_plot_frame.cpp | 16 ++++++++++------ eeschema/sim/sim_plot_frame.h | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index ca52f0931d..c01d170767 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -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() ); diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h index 66e1871e07..6132d343e3 100644 --- a/eeschema/sim/sim_plot_frame.h +++ b/eeschema/sim/sim_plot_frame.h @@ -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 );