- make the "File:New Configuration" menu item call bx_reset_options(),

with a little "Are you sure?" dialog.
This commit is contained in:
Bryce Denney 2002-08-30 16:23:36 +00:00
parent 10cdef6ff1
commit 645f1a0365
4 changed files with 21 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.48 2002-08-29 20:13:03 bdenney Exp $
// $Id: siminterface.cc,v 1.49 2002-08-30 16:23:36 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// See siminterface.h for description of the siminterface concept.
@ -45,6 +45,7 @@ public:
*max = BXP_THIS_IS_THE_LAST-1;
}
virtual int register_param (bx_id id, bx_param_c *it);
virtual void reset_all_param ();
virtual bx_param_c *get_param (bx_id id);
virtual bx_param_num_c *get_param_num (bx_id id);
virtual bx_param_string_c *get_param_string (bx_id id);
@ -168,6 +169,12 @@ bx_real_sim_c::register_param (bx_id id, bx_param_c *it)
return 0;
}
void
bx_real_sim_c::reset_all_param ()
{
bx_reset_options ();
}
int
bx_real_sim_c::get_n_log_modules ()
{

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.52 2002-08-30 06:06:36 bdenney Exp $
// $Id: siminterface.h,v 1.53 2002-08-30 16:23:36 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Before I can describe what this file is for, I have to make the
@ -762,6 +762,7 @@ public:
virtual int set_init_done (int n) {return -1;}
virtual void get_param_id_range (int *min, int *max) {}
virtual int register_param (bx_id id, bx_param_c *it) {return -1;}
virtual void reset_all_param () {}
virtual bx_param_c *get_param (bx_id id) {return NULL;}
virtual bx_param_num_c *get_param_num (bx_id id) {return NULL;}
virtual bx_param_string_c *get_param_string (bx_id id) {return NULL;}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.17 2002-08-30 07:03:50 bdenney Exp $
// $Id: wxmain.cc,v 1.18 2002-08-30 16:23:36 bdenney Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs.
@ -135,6 +135,7 @@ bool MyApp::OnInit()
//////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Config_New, MyFrame::OnConfigNew)
EVT_MENU(ID_Config_Read, MyFrame::OnConfigRead)
EVT_MENU(ID_Config_Save, MyFrame::OnConfigSave)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
@ -310,6 +311,13 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
thePanel = panel;
}
void MyFrame::OnConfigNew(wxCommandEvent& WXUNUSED(event))
{
int answer = wxMessageBox ("This will reset all settings back to their default values.\nAre you sure you want to do this?",
"Are you sure?", wxYES_NO | wxCENTER);
if (answer == wxYES) SIM->reset_all_param ();
}
void MyFrame::OnConfigRead(wxCommandEvent& WXUNUSED(event))
{
panel->ReadConfiguration ();

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.h,v 1.11 2002-08-30 06:06:36 bdenney Exp $
// $Id: wxmain.h,v 1.12 2002-08-30 16:23:36 bdenney Exp $
/////////////////////////////////////////////////////////////////
// This file defines variables and classes that the wxWindows .cc files
// share. It should be included only by wx.cc and wxmain.cc.
@ -121,6 +121,7 @@ public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
enum StatusChange { Start, Stop, Pause, Resume };
void simStatusChanged (StatusChange change, Boolean popupNotify=false);
void OnConfigNew(wxCommandEvent& event);
void OnConfigRead(wxCommandEvent& event);
void OnConfigSave(wxCommandEvent& event);
void OnQuit(wxCommandEvent& event);