diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp
index ea87e92b5e..75d140158d 100644
--- a/eeschema/sim/sim_plot_frame.cpp
+++ b/eeschema/sim/sim_plot_frame.cpp
@@ -185,6 +185,15 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_toolSettings = m_toolBar->AddTool( wxID_ANY, _( "Sim Parameters" ),
KiBitmap( BITMAPS::config ), _( "Simulation parameters and settings" ), wxITEM_NORMAL );
+ Connect( m_toolSimulate->GetId(), wxEVT_UPDATE_UI,
+ wxUpdateUIEventHandler( SIM_PLOT_FRAME::menuSimulateUpdate ), NULL, this );
+ Connect( m_toolAddSignals->GetId(), wxEVT_UPDATE_UI,
+ wxUpdateUIEventHandler( SIM_PLOT_FRAME::menuAddSignalsUpdate ), NULL, this );
+ Connect( m_toolProbe->GetId(), wxEVT_UPDATE_UI,
+ wxUpdateUIEventHandler( SIM_PLOT_FRAME::menuProbeUpdate ), NULL, this );
+ Connect( m_toolTune->GetId(), wxEVT_UPDATE_UI,
+ wxUpdateUIEventHandler( SIM_PLOT_FRAME::menuTuneUpdate ), NULL, this );
+
Connect( m_toolSimulate->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler( SIM_PLOT_FRAME::onSimulate ), NULL, this );
Connect( m_toolAddSignals->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
@@ -204,9 +213,8 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onTune, this, m_tuneValue->GetId() );
Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onShowNetlist, this,
m_showNetlist->GetId() );
- Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_settings->GetId() );
+ Bind( wxEVT_COMMAND_MENU_SELECTED, &SIM_PLOT_FRAME::onSettings, this, m_toolSettings->GetId() );
- updateToolbar();
m_toolBar->Realize();
#ifndef wxHAS_NATIVE_TABART
@@ -225,6 +233,8 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxSafeYield();
setSubWindowsSashSize();
+ UpdateWindowUI();
+
// Ensure the window is on top
Raise();
@@ -360,7 +370,6 @@ void SIM_PLOT_FRAME::updateTitle()
void SIM_PLOT_FRAME::updateFrame()
{
- updateToolbar();
updateTitle();
}
@@ -800,16 +809,6 @@ bool SIM_PLOT_FRAME::updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, con
}
-void SIM_PLOT_FRAME::updateToolbar()
-{
- m_toolBar->EnableTool( ID_SIM_RUN,
- m_exporter->CommandToSimType( getCurrentSimCommand() ) != ST_UNKNOWN );
- m_toolBar->EnableTool( ID_SIM_ADD_SIGNALS, m_simFinished );
- m_toolBar->EnableTool( ID_SIM_PROBE, m_simFinished );
- m_toolBar->EnableTool( ID_SIM_TUNE, m_simFinished );
-}
-
-
void SIM_PLOT_FRAME::updateSignalList()
{
m_signals->ClearAll();
@@ -1330,6 +1329,30 @@ void SIM_PLOT_FRAME::menuWhiteBackground( wxCommandEvent& event )
}
+void SIM_PLOT_FRAME::menuSimulateUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable( m_exporter->CommandToSimType( getCurrentSimCommand() ) != ST_UNKNOWN );
+}
+
+
+void SIM_PLOT_FRAME::menuAddSignalsUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable( m_simFinished );
+}
+
+
+void SIM_PLOT_FRAME::menuProbeUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable( m_simFinished );
+}
+
+
+void SIM_PLOT_FRAME::menuTuneUpdate( wxUpdateUIEvent& event )
+{
+ event.Enable( m_simFinished );
+}
+
+
void SIM_PLOT_FRAME::onPlotClose( wxAuiNotebookEvent& event )
{
int idx = event.GetSelection();
diff --git a/eeschema/sim/sim_plot_frame.h b/eeschema/sim/sim_plot_frame.h
index f483362237..f640485bc7 100644
--- a/eeschema/sim/sim_plot_frame.h
+++ b/eeschema/sim/sim_plot_frame.h
@@ -191,11 +191,6 @@ private:
bool updatePlot( const wxString& aName, SIM_PLOT_TYPE aType, const wxString& aParam,
SIM_PLOT_PANEL* aPlotPanel );
- /**
- * Update the toolbar.
- */
- void updateToolbar();
-
/**
* Update the list of currently plotted signals.
*/
@@ -275,12 +270,17 @@ private:
void menuShowLegendUpdate( wxUpdateUIEvent& event ) override;
void menuShowDotted( wxCommandEvent& event ) override;
void menuShowDottedUpdate( wxUpdateUIEvent& event ) override;
- void menuWhiteBackground( wxCommandEvent& event ) override;
- void menuShowWhiteBackgroundUpdate( wxUpdateUIEvent& event ) override
+ void menuWhiteBackground( wxCommandEvent& event ) override;
+ void menuShowWhiteBackgroundUpdate( wxUpdateUIEvent& event ) override
{
event.Check( m_plotUseWhiteBg );
}
+ void menuSimulateUpdate( wxUpdateUIEvent& event ) override;
+ void menuAddSignalsUpdate( wxUpdateUIEvent& event ) override;
+ void menuProbeUpdate( wxUpdateUIEvent& event ) override;
+ void menuTuneUpdate( wxUpdateUIEvent& event ) override;
+
// Event handlers
void onPlotClose( wxAuiNotebookEvent& event ) override;
void onPlotClosed( wxAuiNotebookEvent& event ) override;
diff --git a/eeschema/sim/sim_plot_frame_base.cpp b/eeschema/sim/sim_plot_frame_base.cpp
index cdda9d9eeb..f3352baeb5 100644
--- a/eeschema/sim/sim_plot_frame_base.cpp
+++ b/eeschema/sim/sim_plot_frame_base.cpp
@@ -73,8 +73,8 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_simulationMenu->AppendSeparator();
- m_settings = new wxMenuItem( m_simulationMenu, ID_MENU_SET_SIMUL, wxString( _("Settings...") ) , wxEmptyString, wxITEM_NORMAL );
- m_simulationMenu->Append( m_settings );
+ m_boardAdapter = new wxMenuItem( m_simulationMenu, ID_MENU_SET_SIMUL, wxString( _("Settings...") ) , wxEmptyString, wxITEM_NORMAL );
+ m_simulationMenu->Append( m_boardAdapter );
m_mainMenu->Append( m_simulationMenu, _("Simulation") );
@@ -279,6 +279,10 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
m_fileMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveImage ), this, m_saveImage->GetId());
m_fileMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuSaveCsv ), this, m_saveCsv->GetId());
m_fileMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuExit ), this, m_exitSim->GetId());
+ this->Connect( m_runSimulation->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuSimulateUpdate ) );
+ this->Connect( m_addSignals->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuAddSignalsUpdate ) );
+ this->Connect( m_probeSignals->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuProbeUpdate ) );
+ this->Connect( m_tuneValue->GetId(), wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuTuneUpdate ) );
m_viewMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomIn ), this, m_zoomIn->GetId());
m_viewMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomOut ), this, m_zoomOut->GetId());
m_viewMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME_BASE::menuZoomFit ), this, m_zoomFit->GetId());
@@ -301,6 +305,10 @@ SIM_PLOT_FRAME_BASE::SIM_PLOT_FRAME_BASE( wxWindow* parent, wxWindowID id, const
SIM_PLOT_FRAME_BASE::~SIM_PLOT_FRAME_BASE()
{
// Disconnect Events
+ this->Disconnect( ID_MENU_RUN_SIM, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuSimulateUpdate ) );
+ this->Disconnect( ID_MENU_ADD_SIGNAL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuAddSignalsUpdate ) );
+ this->Disconnect( ID_MENU_PROBE_SIGNALS, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuProbeUpdate ) );
+ this->Disconnect( ID_MENU_TUNE_SIGNALS, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuTuneUpdate ) );
this->Disconnect( ID_MENU_SHOW_GRID, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowGridUpdate ) );
this->Disconnect( ID_MENU_SHOW_LEGEND, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowLegendUpdate ) );
this->Disconnect( ID_MENU_DOTTED, wxEVT_UPDATE_UI, wxUpdateUIEventHandler( SIM_PLOT_FRAME_BASE::menuShowDottedUpdate ) );
diff --git a/eeschema/sim/sim_plot_frame_base.fbp b/eeschema/sim/sim_plot_frame_base.fbp
index 09a79bfb28..6d69d6e5b0 100644
--- a/eeschema/sim/sim_plot_frame_base.fbp
+++ b/eeschema/sim/sim_plot_frame_base.fbp
@@ -191,7 +191,7 @@
menuExit
-
-