Gracefully handle Quit when simulator window is open.

This commit is contained in:
Jeff Young 2023-01-13 13:38:23 +00:00
parent 4391fc7a7a
commit 7fbad183db
2 changed files with 13 additions and 7 deletions

View File

@ -149,6 +149,8 @@ SIM_PLOT_FRAME::SIM_PLOT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_circuitModel.reset( new NGSPICE_CIRCUIT_MODEL( &m_schematicFrame->Schematic() ) );
Bind( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SIM_PLOT_FRAME::menuExit ), this, wxID_EXIT );
Bind( EVT_SIM_UPDATE, &SIM_PLOT_FRAME::onSimUpdate, this );
Bind( EVT_SIM_REPORT, &SIM_PLOT_FRAME::onSimReport, this );
Bind( EVT_SIM_STARTED, &SIM_PLOT_FRAME::onSimStarted, this );
@ -1204,7 +1206,6 @@ void SIM_PLOT_FRAME::menuSaveWorkbookAs( wxCommandEvent& event )
saveWorkbook( Prj().AbsolutePath( saveAsDlg.GetPath() ) );
}
void SIM_PLOT_FRAME::menuSaveImage( wxCommandEvent& event )
{
if( !GetCurrentPlot() )
@ -1946,6 +1947,16 @@ void SIM_PLOT_FRAME::SIGNAL_CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
}
void SIM_PLOT_FRAME::menuExit( wxCommandEvent& event )
{
if( event.GetId() == wxID_EXIT )
Kiway().OnKiCadExit();
if( event.GetId() == wxID_CLOSE )
Close( false );
}
wxDEFINE_EVENT( EVT_SIM_UPDATE, wxCommandEvent );
wxDEFINE_EVENT( EVT_SIM_REPORT, wxCommandEvent );

View File

@ -249,12 +249,7 @@ private:
void menuOpenWorkbook( wxCommandEvent& event ) override;
void menuSaveWorkbook( wxCommandEvent& event ) override;
void menuSaveWorkbookAs( wxCommandEvent& event ) override;
void menuExit( wxCommandEvent& event ) override
{
Close();
}
void menuExit( wxCommandEvent& event ) override;
void menuSaveImage( wxCommandEvent& event ) override;
void menuSaveCsv( wxCommandEvent& event ) override;
void menuZoomIn( wxCommandEvent& event ) override;