From 645f1a036595b8405492401263552d8615befe31 Mon Sep 17 00:00:00 2001 From: Bryce Denney Date: Fri, 30 Aug 2002 16:23:36 +0000 Subject: [PATCH] - make the "File:New Configuration" menu item call bx_reset_options(), with a little "Are you sure?" dialog. --- bochs/gui/siminterface.cc | 9 ++++++++- bochs/gui/siminterface.h | 3 ++- bochs/gui/wxmain.cc | 10 +++++++++- bochs/gui/wxmain.h | 3 ++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bochs/gui/siminterface.cc b/bochs/gui/siminterface.cc index 7e700d306..463eece79 100644 --- a/bochs/gui/siminterface.cc +++ b/bochs/gui/siminterface.cc @@ -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 () { diff --git a/bochs/gui/siminterface.h b/bochs/gui/siminterface.h index 8aeeda74f..2a0f8195d 100644 --- a/bochs/gui/siminterface.h +++ b/bochs/gui/siminterface.h @@ -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;} diff --git a/bochs/gui/wxmain.cc b/bochs/gui/wxmain.cc index b3017be32..820e1157b 100644 --- a/bochs/gui/wxmain.cc +++ b/bochs/gui/wxmain.cc @@ -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 (); diff --git a/bochs/gui/wxmain.h b/bochs/gui/wxmain.h index 36cfa4a49..66b7a6193 100644 --- a/bochs/gui/wxmain.h +++ b/bochs/gui/wxmain.h @@ -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);