- wx gui menu functions "Read Configuration" and "Save Configuration" implemented
- loading default bochsrc for the wx gui no longer necessary - the wx gui version of bochs now accepts the same command line arguments as the other guis
This commit is contained in:
parent
dc07804616
commit
6055c158e9
@ -1,7 +1,7 @@
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// gui/wx.cc
|
||||
// $Id: wx.cc,v 1.5 2002-08-09 06:16:43 vruppert Exp $
|
||||
// $Id: wx.cc,v 1.6 2002-08-25 15:51:45 vruppert Exp $
|
||||
//
|
||||
// wxWindows VGA display for Bochs. wx.cc implements a custom
|
||||
// wxPanel called a MyPanel, which has methods to display
|
||||
@ -116,6 +116,32 @@ MyPanel::MyRefresh ()
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
MyPanel::ReadConfiguration ()
|
||||
{
|
||||
char *bochsrc;
|
||||
long style = wxOPEN;
|
||||
wxFileDialog *fdialog = new wxFileDialog (this, "Read configuration", "", "", "*.*", style);
|
||||
if (fdialog->ShowModal() == wxID_OK) {
|
||||
bochsrc = (char *)fdialog->GetPath().c_str ();
|
||||
bx_read_configuration(bochsrc);
|
||||
}
|
||||
delete fdialog;
|
||||
}
|
||||
|
||||
void
|
||||
MyPanel::SaveConfiguration ()
|
||||
{
|
||||
char *bochsrc;
|
||||
long style = wxSAVE | wxOVERWRITE_PROMPT;
|
||||
wxFileDialog *fdialog = new wxFileDialog (this, "Save configuration", "", "", "*.*", style);
|
||||
if (fdialog->ShowModal() == wxID_OK) {
|
||||
bochsrc = (char *)fdialog->GetPath().c_str ();
|
||||
bx_write_configuration(bochsrc, 1);
|
||||
}
|
||||
delete fdialog;
|
||||
}
|
||||
|
||||
void MyPanel::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if(event.GetKeyCode() == WXK_F12) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// gui/wxmain.cc
|
||||
// $Id: wxmain.cc,v 1.5 2002-08-25 09:54:05 vruppert Exp $
|
||||
// $Id: wxmain.cc,v 1.6 2002-08-25 15:51:45 vruppert Exp $
|
||||
//
|
||||
// wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs.
|
||||
// When the application starts, the user is given a chance to choose/edit/save
|
||||
@ -159,6 +159,8 @@ bool MyApp::OnInit()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ID_Config_Read, MyFrame::OnConfigRead)
|
||||
EVT_MENU(ID_Config_Save, MyFrame::OnConfigSave)
|
||||
EVT_MENU(ID_Quit, MyFrame::OnQuit)
|
||||
EVT_MENU(ID_Help_About, MyFrame::OnAbout)
|
||||
EVT_MENU(ID_Simulate_Start, MyFrame::OnStartSim)
|
||||
@ -271,6 +273,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
thePanel = panel;
|
||||
}
|
||||
|
||||
void MyFrame::OnConfigRead(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
panel->ReadConfiguration ();
|
||||
}
|
||||
|
||||
void MyFrame::OnConfigSave(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
panel->SaveConfiguration ();
|
||||
}
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& event)
|
||||
{
|
||||
Close( TRUE );
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void MyRefresh ();
|
||||
void ReadConfiguration ();
|
||||
void SaveConfiguration ();
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
@ -47,6 +49,8 @@ class MyFrame: public wxFrame
|
||||
MyPanel *panel;
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, const long style);
|
||||
void OnConfigRead(wxCommandEvent& event);
|
||||
void OnConfigSave(wxCommandEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnStartSim(wxCommandEvent& event);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.117 2002-08-25 08:31:15 vruppert Exp $
|
||||
// $Id: main.cc,v 1.118 2002-08-25 15:51:45 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -1107,6 +1107,10 @@ void
|
||||
bx_init_main (int argc, char *argv[])
|
||||
{
|
||||
int help = 0;
|
||||
#if BX_WITH_WX
|
||||
int arg = 1;
|
||||
char *bochsrc = NULL;
|
||||
#endif
|
||||
|
||||
// To deal with initialization order problems inherent in C++, use the macros
|
||||
// SAFE_GET_IOFUNC and SAFE_GET_GENLOG to retrieve "io" and "genlog" in all
|
||||
@ -1156,6 +1160,24 @@ bx_init_main (int argc, char *argv[])
|
||||
getwd (cwd);
|
||||
BX_INFO (("Now my working directory is %s", cwd));
|
||||
#endif
|
||||
#if BX_WITH_WX
|
||||
// detect -q or -qf
|
||||
if ((argc > 1) && (!strncmp ("-q", argv[1], 2))) {
|
||||
arg++;
|
||||
if ((argc > 2) && (!strcmp(argv[1], "-qf"))) {
|
||||
bochsrc = argv[arg];
|
||||
arg++;
|
||||
}
|
||||
else if ((argc > 3) && (!strcmp ("-f", argv[arg]))) {
|
||||
bochsrc = argv[arg+1];
|
||||
arg += 2;
|
||||
}
|
||||
}
|
||||
if (bochsrc == NULL) bochsrc = bx_find_bochsrc ();
|
||||
if (bochsrc)
|
||||
bx_read_configuration (bochsrc);
|
||||
bx_parse_cmdline (arg, argc, argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1164,7 +1186,7 @@ bx_do_text_config_interface (int argc, char *argv[])
|
||||
char *bochsrc = NULL;
|
||||
int norcfile = 1;
|
||||
|
||||
// detect -f, -nocontrolpanel or -nocp argument before anything else
|
||||
// detect -q, -qf, -nocontrolpanel or -nocp argument before anything else
|
||||
int arg = 1;
|
||||
if ((argc > 1) &&
|
||||
((!strcmp ("-nocontrolpanel", argv[1]))
|
||||
@ -1238,20 +1260,6 @@ bx_do_text_config_interface (int argc, char *argv[])
|
||||
int
|
||||
bx_continue_after_control_panel (int argc, char *argv[])
|
||||
{
|
||||
#if BX_WITH_WX
|
||||
// FIXME: load default bochsrc right now. When the wxWindows interface
|
||||
// is more complete, you will be able to load a bochsrc using the
|
||||
// interface.
|
||||
char *bochsrc = bx_find_bochsrc ();
|
||||
if (bochsrc) {
|
||||
bx_read_configuration (bochsrc);
|
||||
free (bochsrc);
|
||||
} else {
|
||||
BX_PANIC (("Could not load a .bochsrc"));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if BX_DEBUGGER
|
||||
// If using the debugger, it will take control and call
|
||||
// bx_init_hardware() and cpu_loop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user