2002-08-28 07:20:23 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2006-10-21 19:36:07 +04:00
|
|
|
// $Id: wxdialog.cc,v 1.101 2006-10-21 15:36:07 vruppert Exp $
|
2002-08-28 07:20:23 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2002-11-14 08:13:40 +03:00
|
|
|
|
|
|
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
|
|
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
|
|
|
// is used to know when we are exporting symbols and when we are importing.
|
|
|
|
#define BX_PLUGGABLE
|
2002-08-28 07:20:23 +04:00
|
|
|
|
2002-11-19 08:47:45 +03:00
|
|
|
#include "config.h" // definitions based on configure script
|
|
|
|
#if BX_WITH_WX
|
|
|
|
|
2002-08-30 11:03:50 +04:00
|
|
|
// For compilers that support precompilation, includes <wx/wx.h>.
|
|
|
|
#include <wx/wxprec.h>
|
2002-08-28 07:20:23 +04:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
#ifndef WX_PRECOMP
|
2002-08-30 11:03:50 +04:00
|
|
|
#include <wx/wx.h>
|
2002-08-28 07:20:23 +04:00
|
|
|
#endif
|
2002-08-30 11:03:50 +04:00
|
|
|
#include <wx/spinctrl.h>
|
2002-09-03 02:12:31 +04:00
|
|
|
#include <wx/config.h>
|
2002-09-13 21:43:57 +04:00
|
|
|
#include <wx/confbase.h>
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
#include <wx/notebook.h>
|
2002-08-28 07:20:23 +04:00
|
|
|
|
|
|
|
#include "osdep.h" // workarounds for missing stuff
|
|
|
|
#include "gui/siminterface.h" // interface to the simulator
|
|
|
|
#include "bxversion.h" // get version string
|
|
|
|
#include "wxdialog.h" // custom dialog boxes
|
2004-10-03 13:11:28 +04:00
|
|
|
#include "wxmain.h" // wxwidgets shared stuff
|
2002-08-28 07:20:23 +04:00
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// constants, prototypes
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ID_ShowDialog_1 = 1,
|
|
|
|
ID_ShowDialog_2,
|
|
|
|
ID_ShowDialog_3,
|
|
|
|
ID_Button1,
|
|
|
|
ID_Button2,
|
|
|
|
ID_MY_LAST_ID
|
|
|
|
};
|
|
|
|
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
wxSize longTextSize (300, -1); // width=300, height=default
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
wxSize normalTextSize (180, -1); // width=200, height=default
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
|
2002-08-28 07:20:23 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// LogMsgAskDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
2002-08-28 11:54:53 +04:00
|
|
|
// Structure:
|
|
|
|
// vertSizer:
|
|
|
|
// context text field,
|
|
|
|
// message text field
|
|
|
|
// don't-ask checkbox
|
|
|
|
// buttonSizer:
|
|
|
|
// continue button
|
|
|
|
// die button
|
|
|
|
// dumpcore button
|
|
|
|
// debugger button
|
|
|
|
// help button
|
|
|
|
//
|
2002-08-28 07:20:23 +04:00
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(LogMsgAskDialog, wxDialog)
|
|
|
|
EVT_BUTTON(ID_Continue, LogMsgAskDialog::OnEvent)
|
|
|
|
EVT_BUTTON(ID_Die, LogMsgAskDialog::OnEvent)
|
|
|
|
EVT_BUTTON(ID_DumpCore, LogMsgAskDialog::OnEvent)
|
|
|
|
EVT_BUTTON(ID_Debugger, LogMsgAskDialog::OnEvent)
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
EVT_BUTTON(wxID_HELP, LogMsgAskDialog::OnEvent)
|
2002-08-28 07:20:23 +04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
LogMsgAskDialog::LogMsgAskDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& title)
|
|
|
|
: wxDialog (parent, id, title, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
|
|
|
for (int i=0; i<N_BUTTONS; i++) enabled[i] = TRUE;
|
|
|
|
vertSizer = new wxBoxSizer(wxVERTICAL);
|
2006-03-18 19:30:52 +03:00
|
|
|
context = new wxStaticText (this, -1, wxT(""));
|
2002-08-28 07:20:23 +04:00
|
|
|
wxFont font = context->GetFont ();
|
|
|
|
font.SetWeight (wxBOLD);
|
|
|
|
font.SetPointSize (2 + font.GetPointSize ());
|
|
|
|
context->SetFont (font);
|
2006-03-18 19:30:52 +03:00
|
|
|
message = new wxStaticText (this, -1, wxT(""));
|
2002-08-28 07:20:23 +04:00
|
|
|
message->SetFont (font);
|
|
|
|
dontAsk = new wxCheckBox (this, -1, LOG_MSG_DONT_ASK_STRING);
|
|
|
|
btnSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
// fill vertical sizer
|
|
|
|
vertSizer->Add (context, 0, wxGROW|wxALIGN_LEFT|wxLEFT|wxTOP, 30);
|
|
|
|
vertSizer->Add (message, 0, wxGROW|wxALIGN_LEFT|wxLEFT, 30);
|
|
|
|
vertSizer->Add (dontAsk, 0, wxALIGN_CENTER|wxTOP, 30);
|
|
|
|
vertSizer->Add (btnSizer, 0, wxALIGN_CENTER|wxTOP, 30);
|
|
|
|
// Some object creation and layout is postponed until Init()
|
|
|
|
// so that caller has time to configure the dialog.
|
|
|
|
}
|
|
|
|
|
2006-03-19 18:35:20 +03:00
|
|
|
void LogMsgAskDialog::SetContext(wxString s)
|
|
|
|
{
|
|
|
|
ChangeStaticText(vertSizer, context, wxString(LOG_MSG_CONTEXT) + s);
|
2002-08-28 07:20:23 +04:00
|
|
|
}
|
|
|
|
|
2006-03-19 18:35:20 +03:00
|
|
|
void LogMsgAskDialog::SetMessage(wxString s)
|
|
|
|
{
|
|
|
|
ChangeStaticText(vertSizer, message, wxString(LOG_MSG_MSG) + s);
|
2002-08-28 07:20:23 +04:00
|
|
|
}
|
|
|
|
|
2006-03-19 18:35:20 +03:00
|
|
|
void LogMsgAskDialog::Init()
|
2002-08-28 07:20:23 +04:00
|
|
|
{
|
|
|
|
static const int ids[N_BUTTONS] = LOG_MSG_ASK_IDS;
|
2006-03-19 12:24:10 +03:00
|
|
|
static const wxString names[N_BUTTONS] = LOG_MSG_ASK_NAMES;
|
2002-08-28 07:20:23 +04:00
|
|
|
for (int i=0; i<N_BUTTONS; i++) {
|
|
|
|
if (!enabled[i]) continue;
|
2006-03-19 12:24:10 +03:00
|
|
|
wxButton *btn = new wxButton(this, ids[i], names[i]);
|
|
|
|
btnSizer->Add(btn, 1, wxALL, 5);
|
2002-08-28 07:20:23 +04:00
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
wxSize ms = message->GetSize();
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogMessage(wxT("message size is %d,%d"), ms.GetWidth(), ms.GetHeight());
|
2002-08-28 07:20:23 +04:00
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(vertSizer);
|
2006-03-19 12:24:10 +03:00
|
|
|
vertSizer->Fit(this);
|
|
|
|
wxSize size = vertSizer->GetMinSize();
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
|
2002-08-28 07:20:23 +04:00
|
|
|
int margin = 10;
|
|
|
|
SetSizeHints (size.GetWidth () + margin, size.GetHeight () + margin);
|
|
|
|
Center ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Event handler for dialog buttons. Just translate the wx ids into
|
2006-10-21 19:36:07 +04:00
|
|
|
// enum values and return them with EndModal() to make the dialog
|
2002-08-28 07:20:23 +04:00
|
|
|
// go away.
|
|
|
|
void LogMsgAskDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId ();
|
|
|
|
int ret = -1;
|
|
|
|
switch (id) {
|
2003-10-24 19:39:57 +04:00
|
|
|
case ID_Continue: ret = BX_LOG_ASK_CHOICE_CONTINUE; break;
|
|
|
|
case ID_Die: ret = BX_LOG_ASK_CHOICE_DIE; break;
|
|
|
|
case ID_DumpCore: ret = BX_LOG_ASK_CHOICE_DUMP_CORE; break;
|
|
|
|
case ID_Debugger: ret = BX_LOG_ASK_CHOICE_ENTER_DEBUG; break;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
case wxID_HELP: ShowHelp (); return;
|
2002-08-28 07:20:23 +04:00
|
|
|
default:
|
|
|
|
return; // without EndModal
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogMessage(wxT("you pressed button id=%d, return value=%d"), id, ret);
|
2002-08-28 07:20:23 +04:00
|
|
|
EndModal (ret);
|
|
|
|
}
|
|
|
|
|
2002-08-28 11:54:53 +04:00
|
|
|
void LogMsgAskDialog::ShowHelp ()
|
|
|
|
{
|
2003-08-26 21:25:26 +04:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this );
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// FloppyConfigDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Structure:
|
|
|
|
// vertSizer:
|
|
|
|
// instructions
|
|
|
|
// radioSizer (vert):
|
|
|
|
// phys0
|
|
|
|
// phys1
|
|
|
|
// diskImageSizer (horiz):
|
|
|
|
// disk image file
|
|
|
|
// filename
|
|
|
|
// browse button
|
2002-08-30 00:13:05 +04:00
|
|
|
// create button
|
2002-08-28 11:54:53 +04:00
|
|
|
// capacitySizer (horizontal):
|
|
|
|
// capacity text
|
|
|
|
// capacity choice box
|
|
|
|
// hint text
|
|
|
|
// buttonSizer:
|
|
|
|
// cancel button
|
|
|
|
// ok button
|
|
|
|
// help button
|
|
|
|
//
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(FloppyConfigDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, FloppyConfigDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, FloppyConfigDialog::OnEvent)
|
2005-11-24 21:51:55 +03:00
|
|
|
EVT_CHOICE(-1, FloppyConfigDialog::OnEvent)
|
2002-08-28 11:54:53 +04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
FloppyConfigDialog::FloppyConfigDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
2006-03-18 19:30:52 +03:00
|
|
|
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
2002-08-28 11:54:53 +04:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
|
|
|
validate = NULL;
|
|
|
|
n_rbtns = 0;
|
|
|
|
wxButton *btn;
|
|
|
|
vertSizer = new wxBoxSizer (wxVERTICAL);
|
|
|
|
instr = new wxStaticText (this, -1, FLOPPY_CONFIG_INSTRS);
|
|
|
|
radioSizer = new wxBoxSizer (wxVERTICAL);
|
|
|
|
diskImageSizer = new wxBoxSizer (wxHORIZONTAL);
|
|
|
|
capacitySizer = new wxBoxSizer (wxHORIZONTAL);
|
|
|
|
wxStaticText *hint = new wxStaticText (this, -1, FLOPPY_CONFIG_HINT);
|
|
|
|
buttonSizer = new wxBoxSizer (wxHORIZONTAL);
|
|
|
|
// add top level components to vertSizer
|
|
|
|
vertSizer->Add (instr, 0, wxTOP|wxLEFT, 30);
|
|
|
|
vertSizer->Add (radioSizer, 0, wxLEFT, 50);
|
|
|
|
vertSizer->Add (capacitySizer, 0, wxTOP|wxLEFT, 30);
|
|
|
|
vertSizer->Add (hint, 0, wxTOP|wxLEFT, 30);
|
|
|
|
vertSizer->Add (buttonSizer, 0, wxALIGN_RIGHT|wxTOP, 30);
|
|
|
|
// contents of capacitySizer
|
2006-03-19 12:24:10 +03:00
|
|
|
wxStaticText *captext = new wxStaticText(this, -1, FLOPPY_CONFIG_CAP);
|
|
|
|
capacity = new wxChoice(this, ID_Capacity);
|
|
|
|
capacitySizer->Add(captext, 0, wxALL, 5);
|
|
|
|
capacitySizer->Add(capacity, 0, wxALL|wxADJUST_MINSIZE, 5);
|
2002-08-28 11:54:53 +04:00
|
|
|
// contents of buttonSizer
|
2006-03-19 12:24:10 +03:00
|
|
|
btn = new wxButton(this, wxID_HELP, wxT("Help"));
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
2002-08-30 00:41:45 +04:00
|
|
|
// use wxID_CANCEL because pressing ESC produces this same code
|
2006-03-19 12:24:10 +03:00
|
|
|
btn = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
|
|
|
CreateBtn = new wxButton(this, ID_Create, wxT("Create Image"));
|
|
|
|
buttonSizer->Add(CreateBtn, 0, wxALL, 5);
|
|
|
|
btn = new wxButton(this, wxID_OK, wxT("Ok"));
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
2002-08-28 11:54:53 +04:00
|
|
|
// create filename and diskImageRadioBtn so that we can tweak them before
|
|
|
|
// Init comes. However don't add it to any sizer yet because it needs to go
|
|
|
|
// in after the last radio button.
|
2006-03-18 19:30:52 +03:00
|
|
|
filename = new wxTextCtrl (this, ID_FilenameText, wxT(""), wxDefaultPosition, longTextSize);
|
2002-08-28 11:54:53 +04:00
|
|
|
diskImageRadioBtn = new wxRadioButton (this, ID_Filename, FLOPPY_CONFIG_DISKIMG);
|
|
|
|
|
|
|
|
// the radioSizer contents will be added by successive calls to
|
|
|
|
// AddRadio(). The diskImageSizer will be added last, in Init().
|
|
|
|
}
|
|
|
|
|
2002-09-01 19:27:33 +04:00
|
|
|
void FloppyConfigDialog::AddRadio (
|
|
|
|
const wxString& description,
|
|
|
|
const wxString& filename)
|
2002-08-28 11:54:53 +04:00
|
|
|
{
|
2002-08-30 10:06:36 +04:00
|
|
|
if (n_rbtns >= FLOPPY_MAX_RBTNS) {
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogError(wxT("AddRadio failed: increase FLOPPY_MAX_RBTNS in wxdialog.h"));
|
2002-08-28 11:54:53 +04:00
|
|
|
return;
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
rbtn[n_rbtns] = new wxRadioButton(this, -1, description);
|
2002-08-28 11:54:53 +04:00
|
|
|
equivalentFilename[n_rbtns] = filename;
|
2006-03-18 19:30:52 +03:00
|
|
|
radioSizer->Add(rbtn[n_rbtns]);
|
2002-08-28 11:54:53 +04:00
|
|
|
n_rbtns++;
|
|
|
|
}
|
|
|
|
|
2006-03-19 18:35:20 +03:00
|
|
|
void FloppyConfigDialog::SetDriveName (wxString name)
|
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
SetTitle(wxString(FLOPPY_CONFIG_TITLE) + name);
|
|
|
|
ChangeStaticText(vertSizer, instr, wxString(FLOPPY_CONFIG_INSTRS) + name +
|
|
|
|
wxT("."));
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
|
2006-03-19 12:24:10 +03:00
|
|
|
void FloppyConfigDialog::SetCapacityChoices(int n, char *choices[])
|
2002-08-28 11:54:53 +04:00
|
|
|
{
|
|
|
|
for (int i=0; i<n; i++)
|
2006-03-19 12:24:10 +03:00
|
|
|
capacity->Append(wxString(choices[i], wxConvUTF8));
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
|
2005-11-24 21:51:55 +03:00
|
|
|
void FloppyConfigDialog::SetCapacity (int cap)
|
|
|
|
{
|
|
|
|
capacity->SetSelection(cap);
|
|
|
|
CreateBtn->Enable(floppy_type_n_sectors[cap] > 0);
|
|
|
|
}
|
|
|
|
|
2002-08-28 11:54:53 +04:00
|
|
|
void FloppyConfigDialog::Init()
|
|
|
|
{
|
|
|
|
// add contents of diskImageSizer
|
2006-03-18 19:30:52 +03:00
|
|
|
diskImageSizer->Add(diskImageRadioBtn);
|
|
|
|
diskImageSizer->Add(filename, 1, wxGROW);
|
2002-09-03 00:13:52 +04:00
|
|
|
wxButton *btn = new wxButton (this, ID_Browse, BTNLABEL_BROWSE);
|
2006-03-18 19:30:52 +03:00
|
|
|
diskImageSizer->Add(btn, 0, wxALL, 5);
|
|
|
|
radioSizer->Add(diskImageSizer);
|
2002-08-28 11:54:53 +04:00
|
|
|
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(vertSizer);
|
2006-03-18 19:30:52 +03:00
|
|
|
vertSizer->Fit(this);
|
|
|
|
wxSize size = vertSizer->GetMinSize();
|
|
|
|
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
|
2002-08-28 11:54:53 +04:00
|
|
|
int margin = 5;
|
2006-03-18 19:30:52 +03:00
|
|
|
SetSizeHints (size.GetWidth() + margin, size.GetHeight() + margin);
|
|
|
|
Center();
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
FloppyConfigDialog::GetRadio () {
|
|
|
|
int i;
|
|
|
|
for (i=0; i<n_rbtns; i++) {
|
2006-03-18 19:30:52 +03:00
|
|
|
if (rbtn[i]->GetValue())
|
2002-08-28 11:54:53 +04:00
|
|
|
return i;
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
if (diskImageRadioBtn->GetValue()) {
|
2002-08-28 11:54:53 +04:00
|
|
|
return i;
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogError(wxT("GetRadio() found nothing selected"));
|
2002-08-28 11:54:53 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FloppyConfigDialog::SetRadio (int n) {
|
|
|
|
if (n < n_rbtns) {
|
|
|
|
rbtn[n]->SetValue (TRUE);
|
|
|
|
} else {
|
|
|
|
diskImageRadioBtn->SetValue (TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-01 19:27:33 +04:00
|
|
|
void FloppyConfigDialog::SetFilename (wxString f) {
|
2002-08-28 11:54:53 +04:00
|
|
|
// search equivalentFilename[] for matches. if it matches, select the
|
|
|
|
// radio button instead.
|
|
|
|
for (int i=0; i<n_rbtns; i++) {
|
2006-03-19 12:24:10 +03:00
|
|
|
if (!f.Cmp(equivalentFilename[i])) {
|
|
|
|
rbtn[i]->SetValue(TRUE);
|
2002-08-28 11:54:53 +04:00
|
|
|
return; // leaving filename text field unchanged
|
|
|
|
}
|
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
filename->SetValue(f);
|
|
|
|
diskImageRadioBtn->SetValue(TRUE);
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
|
2002-09-01 19:27:33 +04:00
|
|
|
wxString
|
2006-03-19 12:24:10 +03:00
|
|
|
FloppyConfigDialog::GetFilename()
|
2002-08-28 11:54:53 +04:00
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
int n = GetRadio();
|
2002-08-28 11:54:53 +04:00
|
|
|
if (n < n_rbtns) {
|
|
|
|
return equivalentFilename[n];
|
|
|
|
} else {
|
2006-03-19 12:24:10 +03:00
|
|
|
return filename->GetValue();
|
2002-08-28 11:54:53 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId ();
|
|
|
|
switch (id) {
|
|
|
|
case ID_FilenameText:
|
|
|
|
// when you type into the filename field, ensure that the radio
|
|
|
|
// button associated with that field is chosen.
|
|
|
|
diskImageRadioBtn->SetValue (TRUE);
|
|
|
|
break;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
case wxID_OK:
|
2002-08-28 11:54:53 +04:00
|
|
|
// probably should validate before allowing ok
|
|
|
|
if (validate!=NULL && !(*validate)(this))
|
|
|
|
return; // validation failed, don't leave yet
|
2002-09-04 16:29:04 +04:00
|
|
|
EndModal (wxID_OK);
|
2002-08-28 11:54:53 +04:00
|
|
|
break;
|
|
|
|
case ID_Browse:
|
2005-11-26 12:22:58 +03:00
|
|
|
if (BrowseTextCtrl(filename)) {
|
2006-03-18 19:30:52 +03:00
|
|
|
capacity->SetSelection(capacity->FindString(wxT("auto")));
|
2005-11-26 12:22:58 +03:00
|
|
|
}
|
2002-08-28 11:54:53 +04:00
|
|
|
break;
|
2005-11-24 21:51:55 +03:00
|
|
|
case ID_Capacity:
|
|
|
|
{
|
2005-11-25 19:24:47 +03:00
|
|
|
int cap = capacity->GetSelection();
|
2005-11-24 21:51:55 +03:00
|
|
|
CreateBtn->Enable(floppy_type_n_sectors[cap] > 0);
|
|
|
|
}
|
|
|
|
break;
|
2002-08-30 00:13:05 +04:00
|
|
|
case ID_Create:
|
2002-08-30 03:28:52 +04:00
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
int cap = capacity->GetSelection();
|
2005-11-25 19:24:47 +03:00
|
|
|
char name[1024];
|
2006-03-19 12:24:10 +03:00
|
|
|
strncpy(name, filename->GetValue().mb_str(wxConvUTF8), sizeof(name));
|
2002-08-30 03:28:52 +04:00
|
|
|
if (CreateImage (0, floppy_type_n_sectors[cap], name)) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxString msg(wxT("Created a "));
|
|
|
|
msg += capacity->GetString(cap);
|
|
|
|
msg += wxT(" disk image called '");
|
|
|
|
msg += filename->GetValue();
|
|
|
|
msg += wxT("'.");
|
2006-03-18 19:30:52 +03:00
|
|
|
wxMessageBox(msg, wxT("Image Created"), wxOK | wxICON_INFORMATION, this);
|
2005-11-25 19:24:47 +03:00
|
|
|
}
|
2002-08-30 03:28:52 +04:00
|
|
|
}
|
2002-08-30 00:13:05 +04:00
|
|
|
break;
|
2002-08-30 00:41:45 +04:00
|
|
|
case wxID_CANCEL:
|
2006-03-18 19:30:52 +03:00
|
|
|
EndModal(wxID_CANCEL);
|
2002-08-28 11:54:53 +04:00
|
|
|
break;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
case wxID_HELP:
|
2002-08-28 11:54:53 +04:00
|
|
|
ShowHelp();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-18 19:30:52 +03:00
|
|
|
void FloppyConfigDialog::ShowHelp()
|
2002-08-28 07:20:23 +04:00
|
|
|
{
|
2003-08-26 21:25:26 +04:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this );
|
2002-08-28 07:20:23 +04:00
|
|
|
}
|
|
|
|
|
2002-09-01 23:38:08 +04:00
|
|
|
|
2002-09-19 08:52:03 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// AdvancedLogOptionsDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Structure:
|
|
|
|
// vertSizer:
|
|
|
|
// logfileSizer
|
|
|
|
// prompt
|
|
|
|
// logfile
|
|
|
|
// browse button
|
|
|
|
// prompt (multiline)
|
|
|
|
// applyDefault button
|
|
|
|
// scrollWin
|
|
|
|
// scrollpanel
|
|
|
|
// gridSizer 5 columns
|
|
|
|
// device
|
|
|
|
// debug
|
|
|
|
// info
|
|
|
|
// error
|
|
|
|
// panic
|
|
|
|
// etc.
|
|
|
|
// buttonSizer:
|
|
|
|
// help
|
|
|
|
// cancel
|
|
|
|
// ok
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(AdvancedLogOptionsDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, AdvancedLogOptionsDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, AdvancedLogOptionsDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, AdvancedLogOptionsDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
AdvancedLogOptionsDialog::AdvancedLogOptionsDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
2006-03-26 19:52:31 +04:00
|
|
|
: wxDialog(parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
2002-09-19 08:52:03 +04:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
|
|
|
//static int integers[LOG_OPTS_N_CHOICES_NORMAL] = {0, 1, 2, 3};
|
2006-03-19 12:24:10 +03:00
|
|
|
static wxString names[] = ADVLOG_OPTS_TYPE_NAMES;
|
2006-03-26 19:52:31 +04:00
|
|
|
SetTitle(ADVLOG_OPTS_TITLE);
|
|
|
|
vertSizer = new wxBoxSizer(wxVERTICAL);
|
2002-09-19 08:52:03 +04:00
|
|
|
// top level objects
|
2006-03-26 19:52:31 +04:00
|
|
|
logfileSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
vertSizer->Add(logfileSizer, 0, wxTOP|wxLEFT, 20);
|
|
|
|
wxStaticText *text = new wxStaticText(this, -1, ADVLOG_OPTS_PROMPT);
|
|
|
|
vertSizer->Add(text, 0, wxALL, 10);
|
|
|
|
applyDefault = new wxButton(this, ID_ApplyDefault, ADVLOG_DEFAULTS);
|
|
|
|
vertSizer->Add(applyDefault, 0, wxALL|wxALIGN_RIGHT, 10);
|
|
|
|
headerSizer = new wxGridSizer(ADVLOG_OPTS_N_TYPES + 1);
|
|
|
|
vertSizer->Add(headerSizer, 0, wxALL|wxGROW, 10);
|
|
|
|
scrollWin = new wxScrolledWindow(this, -1);
|
|
|
|
vertSizer->Add(scrollWin, 1, wxALL|wxGROW, 10);
|
|
|
|
buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
vertSizer->Add(buttonSizer, 0, wxALIGN_RIGHT);
|
2002-09-19 08:52:03 +04:00
|
|
|
|
|
|
|
// logfileSizer contents
|
2006-03-26 19:52:31 +04:00
|
|
|
text = new wxStaticText(this, -1, ADVLOG_OPTS_LOGFILE);
|
|
|
|
logfileSizer->Add(text);
|
|
|
|
logfile = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, longTextSize);
|
|
|
|
logfileSizer->Add(logfile);
|
|
|
|
wxButton *btn = new wxButton(this, ID_Browse, BTNLABEL_BROWSE);
|
|
|
|
logfileSizer->Add(btn, 0, wxALL, 5);
|
2002-09-19 08:52:03 +04:00
|
|
|
|
|
|
|
// to get the scrollWin geometry right, first build everything on a wxPanel,
|
|
|
|
// with gridSizer as the main sizer.
|
2006-03-26 19:52:31 +04:00
|
|
|
scrollPanel = new wxPanel(scrollWin, -1);
|
|
|
|
gridSizer = new wxGridSizer(ADVLOG_OPTS_N_TYPES + 1);
|
2002-09-19 08:52:03 +04:00
|
|
|
// add title row
|
|
|
|
int typemax = ADVLOG_OPTS_N_TYPES;
|
2006-03-26 19:52:31 +04:00
|
|
|
text = new wxStaticText(this, -1, wxT("Device"));
|
|
|
|
headerSizer->Add(text, 0, wxALIGN_LEFT);
|
2002-09-19 08:52:03 +04:00
|
|
|
int type;
|
|
|
|
for (type=0; type < typemax; type++) {
|
2006-03-26 19:52:31 +04:00
|
|
|
text = new wxStaticText(this, -1, names[type]);
|
|
|
|
headerSizer->Add(text, 0, wxALIGN_LEFT);
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
// add rows of choice boxes, one for each device
|
2006-03-26 19:52:31 +04:00
|
|
|
int devmax = SIM->get_n_log_modules();
|
2002-09-20 21:53:14 +04:00
|
|
|
action = new wxChoice** [devmax]; // array of pointers
|
2002-09-19 08:52:03 +04:00
|
|
|
for (int dev=0; dev<devmax; dev++) {
|
2006-10-21 19:36:07 +04:00
|
|
|
if (strcmp(SIM->get_prefix(dev), "[ ]")) {
|
|
|
|
action[dev] = new wxChoice* [ADVLOG_OPTS_N_TYPES];
|
|
|
|
// name of device in first column
|
|
|
|
gridSizer->Add(new wxStaticText(scrollPanel, -1, wxString(SIM->get_prefix(dev), wxConvUTF8)));
|
|
|
|
// wxChoice in every other column
|
|
|
|
for (type=0; type < typemax; type++) {
|
|
|
|
action[dev][type] = makeLogOptionChoiceBox(scrollPanel, -1, type);
|
|
|
|
gridSizer->Add(action[dev][type], 1, wxALL|wxGROW|wxADJUST_MINSIZE, 2);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
action[dev] = NULL;
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
}
|
2006-03-26 19:52:31 +04:00
|
|
|
headerSizer->Fit(this);
|
|
|
|
headerSizer->SetSizeHints(this);
|
|
|
|
scrollPanel->SetAutoLayout(TRUE);
|
|
|
|
scrollPanel->SetSizer(gridSizer);
|
|
|
|
gridSizer->Fit(scrollPanel);
|
|
|
|
gridSizer->SetSizeHints(scrollPanel);
|
|
|
|
wxSize size = scrollPanel->GetBestSize();
|
2002-09-20 21:53:14 +04:00
|
|
|
// now we know how big the panel wants to be, and we can set the scrollbar
|
|
|
|
// and scrollWin size accordingly
|
2002-09-19 08:52:03 +04:00
|
|
|
|
|
|
|
// finally set up the scroll window outside
|
2006-03-26 19:52:31 +04:00
|
|
|
scrollWin->SetScrollbars(1, 1, size.GetWidth(), size.GetHeight());
|
2002-09-19 08:52:03 +04:00
|
|
|
|
2002-09-20 21:53:14 +04:00
|
|
|
// now that we know the desired width of the panel, use it to set the
|
|
|
|
// width of the scrollWin. I tried several things before arriving at
|
|
|
|
// a solution, and I'll list them for educational purposes.
|
|
|
|
//
|
|
|
|
// failure #1: this had no effect at all. sizer took precedence.
|
2006-03-26 19:52:31 +04:00
|
|
|
// scrollWin->SetSize(500, 500);
|
2002-09-20 21:53:14 +04:00
|
|
|
// failure #2: this changed scrollWin size but sizer was not notified so
|
|
|
|
// the overall window didn't expand to make space for it.
|
2006-03-26 19:52:31 +04:00
|
|
|
// scrollWin->SetSizeHints(500, 500);
|
2002-09-20 21:53:14 +04:00
|
|
|
// success: tell the sizer to change the scrollWin's size, and it works
|
2006-03-26 19:52:31 +04:00
|
|
|
vertSizer->SetItemMinSize(scrollWin, size.GetWidth()+30, 400);
|
2002-09-19 08:52:03 +04:00
|
|
|
|
|
|
|
// buttonSizer contents
|
2006-03-26 19:52:31 +04:00
|
|
|
btn = new wxButton(this, wxID_HELP, BTNLABEL_HELP);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
2002-09-19 08:52:03 +04:00
|
|
|
// use wxID_CANCEL because pressing ESC produces this same code
|
2006-03-26 19:52:31 +04:00
|
|
|
btn = new wxButton(this, wxID_CANCEL, BTNLABEL_CANCEL);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
|
|
|
btn = new wxButton(this, wxID_OK, BTNLABEL_OK);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
|
2002-09-20 21:53:14 +04:00
|
|
|
AdvancedLogOptionsDialog::~AdvancedLogOptionsDialog()
|
|
|
|
{
|
2006-03-26 19:52:31 +04:00
|
|
|
int dev, ndev = SIM->get_n_log_modules();
|
2002-09-21 01:25:09 +04:00
|
|
|
for (dev=0; dev<ndev; dev++) {
|
|
|
|
delete [] action[dev];
|
|
|
|
}
|
|
|
|
delete [] action;
|
2002-09-20 21:53:14 +04:00
|
|
|
}
|
|
|
|
|
2002-09-19 08:52:03 +04:00
|
|
|
void AdvancedLogOptionsDialog::Init()
|
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
CopyParamToGui();
|
2002-09-19 08:52:03 +04:00
|
|
|
// lay it out!
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(vertSizer);
|
2006-03-18 19:30:52 +03:00
|
|
|
vertSizer->Fit(this);
|
|
|
|
wxSize size = vertSizer->GetMinSize();
|
|
|
|
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
|
2002-09-19 08:52:03 +04:00
|
|
|
int margin = 5;
|
2006-03-18 19:30:52 +03:00
|
|
|
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
|
|
|
|
Center();
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
|
2006-03-05 13:24:29 +03:00
|
|
|
void AdvancedLogOptionsDialog::CopyParamToGui() {
|
|
|
|
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
|
2006-03-19 12:24:10 +03:00
|
|
|
SetLogfile(wxString(logfile->getptr(), wxConvUTF8));
|
2002-09-20 21:53:14 +04:00
|
|
|
// copy log action settings from siminterface to gui
|
2006-03-05 13:24:29 +03:00
|
|
|
int dev, ndev = SIM->get_n_log_modules();
|
|
|
|
int type, ntype = SIM->get_max_log_level();
|
2002-09-20 21:53:14 +04:00
|
|
|
for (dev=0; dev<ndev; dev++) {
|
|
|
|
for (type=0; type<ntype; type++) {
|
2006-03-05 13:24:29 +03:00
|
|
|
SetAction(dev, type, SIM->get_log_action(dev, type));
|
2002-09-20 21:53:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-05 13:24:29 +03:00
|
|
|
void AdvancedLogOptionsDialog::CopyGuiToParam() {
|
2002-09-20 21:53:14 +04:00
|
|
|
char buf[1024];
|
2006-03-26 19:52:31 +04:00
|
|
|
safeWxStrcpy(buf, GetLogfile(), sizeof(buf));
|
2006-03-05 13:24:29 +03:00
|
|
|
bx_param_string_c *logfile = SIM->get_param_string(BXPN_LOG_FILENAME);
|
2006-03-26 19:52:31 +04:00
|
|
|
logfile->set(buf);
|
2002-09-20 21:53:14 +04:00
|
|
|
// copy log action settings from gui to siminterface
|
2006-03-26 19:52:31 +04:00
|
|
|
int dev, ndev = SIM->get_n_log_modules();
|
|
|
|
int type, ntype = SIM->get_max_log_level();
|
2002-09-20 21:53:14 +04:00
|
|
|
for (dev=0; dev<ndev; dev++) {
|
|
|
|
for (type=0; type<ntype; type++) {
|
2006-03-26 19:52:31 +04:00
|
|
|
SIM->set_log_action(dev, type, GetAction(dev, type));
|
2002-09-20 21:53:14 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-26 19:52:31 +04:00
|
|
|
void AdvancedLogOptionsDialog::SetAction(int dev, int evtype, int act) {
|
2006-10-21 19:36:07 +04:00
|
|
|
if (action[dev] == NULL) return;
|
2002-09-20 21:53:14 +04:00
|
|
|
// find the choice whose client data matches "act".
|
2002-09-19 08:52:03 +04:00
|
|
|
int *ptr;
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogDebug(wxT("SetAction dev=%d type=%d act=%d"), dev, evtype, act);
|
2002-09-20 21:53:14 +04:00
|
|
|
wxChoice *control = action[dev][evtype];
|
2006-03-26 19:52:31 +04:00
|
|
|
for (int i=0; i < control->GetCount(); i++) {
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogDebug(wxT("reading action[%d][%d]->GetClientData(%d)"), dev, evtype, i);
|
|
|
|
ptr = (int*) control->GetClientData(i);
|
2002-09-19 08:52:03 +04:00
|
|
|
if (ptr == NULL) continue;
|
2002-09-20 21:53:14 +04:00
|
|
|
if (act == *ptr) { // found it!
|
2006-03-18 19:30:52 +03:00
|
|
|
control->SetSelection(i);
|
2002-09-19 08:52:03 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this can happen if one of the choices that is excluded by
|
|
|
|
// ADVLOG_OPTS_EXCLUDE() is used, for example.
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("warning: SetAction type=%d act=%d not found"), evtype, act);
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
|
2006-03-26 19:52:31 +04:00
|
|
|
int AdvancedLogOptionsDialog::GetAction(int dev, int evtype) {
|
2006-10-21 19:36:07 +04:00
|
|
|
if (action[dev] == NULL) return LOG_OPTS_NO_CHANGE;
|
2006-03-26 19:52:31 +04:00
|
|
|
int sel = action[dev][evtype]->GetSelection();
|
|
|
|
int *ptrToChoice = (int*)action[dev][evtype]->GetClientData(sel);
|
|
|
|
wxASSERT(ptrToChoice != NULL);
|
2002-09-19 08:52:03 +04:00
|
|
|
return *ptrToChoice;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AdvancedLogOptionsDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
2006-03-26 19:52:31 +04:00
|
|
|
int id = event.GetId();
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogMessage(wxT("you pressed button id=%d"), id);
|
2002-09-19 08:52:03 +04:00
|
|
|
switch (id) {
|
|
|
|
case ID_Browse:
|
2006-03-26 19:52:31 +04:00
|
|
|
BrowseTextCtrl(logfile);
|
2002-09-19 08:52:03 +04:00
|
|
|
break;
|
2002-09-20 21:53:14 +04:00
|
|
|
case ID_ApplyDefault: {
|
2006-03-26 19:52:31 +04:00
|
|
|
int lev, nlev = SIM->get_max_log_level();
|
2002-09-20 21:53:14 +04:00
|
|
|
// copy default settings to every device
|
|
|
|
for (lev=0; lev<nlev; lev++) {
|
2006-03-26 19:52:31 +04:00
|
|
|
int action = SIM->get_default_log_action(lev);
|
|
|
|
int dev, ndev = SIM->get_n_log_modules();
|
2002-09-20 21:53:14 +04:00
|
|
|
for (dev=0; dev<ndev; dev++)
|
2006-03-26 19:52:31 +04:00
|
|
|
SetAction(dev, lev, action);
|
2002-09-20 21:53:14 +04:00
|
|
|
}
|
2002-09-19 08:52:03 +04:00
|
|
|
break;
|
2002-09-20 21:53:14 +04:00
|
|
|
}
|
2002-09-19 08:52:03 +04:00
|
|
|
case wxID_OK:
|
2006-03-26 19:52:31 +04:00
|
|
|
CopyGuiToParam();
|
|
|
|
EndModal(wxID_OK);
|
2002-09-19 08:52:03 +04:00
|
|
|
break;
|
|
|
|
case wxID_CANCEL:
|
2006-03-26 19:52:31 +04:00
|
|
|
EndModal(wxID_CANCEL);
|
2002-09-19 08:52:03 +04:00
|
|
|
break;
|
|
|
|
case wxID_HELP:
|
|
|
|
ShowHelp();
|
|
|
|
break;
|
|
|
|
default:
|
2006-03-26 19:52:31 +04:00
|
|
|
event.Skip();
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-26 19:52:31 +04:00
|
|
|
void AdvancedLogOptionsDialog::ShowHelp()
|
2002-09-19 08:52:03 +04:00
|
|
|
{
|
2003-08-26 21:25:26 +04:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this );
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
|
2002-09-03 00:13:52 +04:00
|
|
|
|
2002-09-16 19:28:19 +04:00
|
|
|
#if BX_DEBUGGER
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// DebugLogDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Structure:
|
|
|
|
// mainSizer:
|
|
|
|
// wxTextCtrl log (multiline with vert scrollbar)
|
|
|
|
// "Type a debugger command"
|
|
|
|
// commandSizer:
|
|
|
|
// wxTextCtrl command
|
|
|
|
// Execute button
|
|
|
|
// buttonSizer:
|
|
|
|
// help
|
|
|
|
// cancel
|
|
|
|
// ok
|
|
|
|
//
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(DebugLogDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, DebugLogDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, DebugLogDialog::OnEvent)
|
|
|
|
EVT_KEY_DOWN(DebugLogDialog::OnKeyEvent)
|
|
|
|
EVT_KEY_UP(DebugLogDialog::OnKeyEvent)
|
2004-12-04 16:49:27 +03:00
|
|
|
EVT_CHAR(DebugLogDialog::OnKeyEvent)
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
EVT_TEXT(-1, DebugLogDialog::OnEvent)
|
|
|
|
EVT_TEXT_ENTER(-1, DebugLogDialog::OnEnterEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
DebugLogDialog::DebugLogDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
2006-03-18 19:30:52 +03:00
|
|
|
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
2002-12-08 12:16:18 +03:00
|
|
|
lengthMax = DEBUG_LOG_DEFAULT_LENGTH_MAX;
|
|
|
|
lengthTolerance = DEBUG_LOG_DEFAULT_TOLERANCE;
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
SetTitle (DEBUG_LOG_TITLE);
|
|
|
|
mainSizer = new wxBoxSizer (wxVERTICAL);
|
2006-03-18 19:30:52 +03:00
|
|
|
log = new wxTextCtrl (this, -1, wxT(""),
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
wxDefaultPosition, wxSize(400, 300),
|
|
|
|
wxTE_MULTILINE | wxTE_RICH | wxTE_READONLY);
|
|
|
|
mainSizer->Add (log, 1, wxALL|wxGROW, 10);
|
|
|
|
wxStaticText *text = new wxStaticText (this, -1, DEBUG_CMD_PROMPT);
|
|
|
|
mainSizer->Add (text, 0, wxTOP|wxLEFT, 10);
|
|
|
|
commandSizer = new wxBoxSizer (wxHORIZONTAL);
|
|
|
|
mainSizer->Add (commandSizer, 0, wxALL|wxGROW, 5);
|
|
|
|
buttonSizer = new wxBoxSizer (wxHORIZONTAL);
|
|
|
|
mainSizer->Add (buttonSizer, 0, wxALIGN_RIGHT);
|
|
|
|
|
|
|
|
// commandSizer contents
|
2006-03-18 19:30:52 +03:00
|
|
|
command = new wxTextCtrl (this, ID_DebugCommand, wxT(""),
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxTE_PROCESS_ENTER);
|
|
|
|
commandSizer->Add (command, 1, wxGROW);
|
|
|
|
wxButton *btn;
|
|
|
|
btn = new wxButton (this, ID_Execute, BTNLABEL_EXECUTE);
|
|
|
|
commandSizer->Add (btn, 0, wxALL, 5);
|
|
|
|
|
|
|
|
// buttonSizer contents
|
|
|
|
btn = new wxButton (this, wxID_OK, BTNLABEL_CLOSE);
|
|
|
|
buttonSizer->Add (btn, 0, wxALL, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugLogDialog::Init()
|
|
|
|
{
|
|
|
|
// lay it out!
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(mainSizer);
|
2006-03-18 19:30:52 +03:00
|
|
|
mainSizer->Fit(this);
|
|
|
|
wxSize size = mainSizer->GetMinSize();
|
|
|
|
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
int margin = 5;
|
2006-03-18 19:30:52 +03:00
|
|
|
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
|
|
|
|
Center();
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
|
|
|
|
2002-09-16 20:04:15 +04:00
|
|
|
void DebugLogDialog::Execute(bool clear)
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
{
|
|
|
|
// send to debugger
|
|
|
|
theFrame->DebugCommand (command->GetValue ());
|
|
|
|
// display what they typed on the log screen
|
2002-09-16 20:04:15 +04:00
|
|
|
if (clear) command->Clear ();
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
|
|
|
|
2002-12-08 12:16:18 +03:00
|
|
|
void DebugLogDialog::CheckLogLength ()
|
|
|
|
{
|
|
|
|
// truncate the text control periodically to avoid a
|
|
|
|
// serious memory leak.
|
|
|
|
wxString str = log->GetValue ();
|
|
|
|
Bit32u len = str.Length ();
|
|
|
|
if (len > lengthMax + lengthTolerance) {
|
|
|
|
// Truncate the string. Start from length - lengthMax, search
|
|
|
|
// forward until we find the first \n.
|
2003-09-13 20:49:09 +04:00
|
|
|
for (int i = len - lengthMax; i<(int)(len-1); i++) {
|
2002-12-08 12:16:18 +03:00
|
|
|
if (str.GetChar (i) == '\n') {
|
|
|
|
// remove the \n and everything before it. Done.
|
|
|
|
//printf ("truncating from 0 to %d\n", i+1);
|
|
|
|
//printf ("\n");
|
|
|
|
log->Remove (0, i+1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// no newline found?!
|
|
|
|
//printf ("no newline found! truncating from 0 to %d", len - lengthMax);
|
|
|
|
//printf ("\n");
|
|
|
|
log->Remove (0, len - lengthMax);
|
|
|
|
} else {
|
|
|
|
//printf ("log length is %d, no truncation yet", len);
|
|
|
|
//printf ("\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
void DebugLogDialog::AppendCommand (const char *cmd)
|
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
log->AppendText(wxT(">>> "));
|
2006-05-22 20:35:03 +04:00
|
|
|
log->AppendText(wxString(cmd, wxConvUTF8));
|
2006-03-18 19:30:52 +03:00
|
|
|
log->AppendText(wxT("\n"));
|
|
|
|
int n = log->GetLastPosition();
|
2002-09-16 20:04:15 +04:00
|
|
|
if (n>0) n--;
|
2006-03-18 19:30:52 +03:00
|
|
|
log->ShowPosition(n);
|
|
|
|
CheckLogLength();
|
2002-09-16 20:04:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebugLogDialog::AppendText (wxString text) {
|
|
|
|
log->AppendText (text);
|
|
|
|
int n = log->GetLastPosition ();
|
|
|
|
if (n>0) n--;
|
|
|
|
log->ShowPosition (n);
|
2002-12-08 12:16:18 +03:00
|
|
|
CheckLogLength ();
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebugLogDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
int id = event.GetId();
|
|
|
|
//wxLogMessage(wxT("event was from id=%d, type=%d"), id, (int)event.GetEventType ());
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
switch (id) {
|
|
|
|
case wxID_OK:
|
|
|
|
Show(FALSE);
|
|
|
|
break;
|
2002-09-16 20:04:15 +04:00
|
|
|
case ID_Execute: // pressed execute button
|
2006-03-18 19:30:52 +03:00
|
|
|
Execute(false);
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
break;
|
|
|
|
default:
|
2006-03-18 19:30:52 +03:00
|
|
|
event.Skip();
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DebugLogDialog::OnKeyEvent(wxKeyEvent& event)
|
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("key event"));
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
2002-09-16 19:28:19 +04:00
|
|
|
#endif
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// ParamDialog
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(ParamDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, ParamDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, ParamDialog::OnEvent)
|
2002-09-23 00:56:12 +04:00
|
|
|
EVT_CHOICE(-1, ParamDialog::OnEvent)
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
EVT_TEXT(-1, ParamDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
ParamDialog::ParamDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
2006-03-18 19:30:52 +03:00
|
|
|
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
2002-09-03 12:53:41 +04:00
|
|
|
idHash = new wxHashTable (wxKEY_INTEGER);
|
|
|
|
paramHash = new wxHashTable (wxKEY_INTEGER);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
nbuttons = 0;
|
2003-09-02 23:34:48 +04:00
|
|
|
runtime = 0;
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
|
|
|
|
// top level objects
|
|
|
|
mainSizer = new wxBoxSizer (wxVERTICAL);
|
|
|
|
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
// create buttonSizer, which will hold all the buttons.
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
buttonSizer = new wxBoxSizer (wxHORIZONTAL);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
|
2002-09-21 01:25:09 +04:00
|
|
|
ParamDialog::~ParamDialog()
|
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
paramHash->BeginFind();
|
2002-09-21 01:25:09 +04:00
|
|
|
wxNode *node;
|
2006-03-18 19:30:52 +03:00
|
|
|
while ((node = paramHash->Next()) != NULL) {
|
2002-09-21 01:25:09 +04:00
|
|
|
// assume that no ParamStruct appears in the hash table under multiple
|
|
|
|
// keys. If so, we will delete it twice and corrupt memory.
|
2006-03-18 19:30:52 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
|
|
|
// wxLogDebug(wxT("deleting ParamStruct id=%d for param %s"), pstr->id, pstr->param->get_name());
|
2002-09-21 01:25:09 +04:00
|
|
|
delete pstr;
|
|
|
|
}
|
|
|
|
delete idHash;
|
|
|
|
delete paramHash;
|
|
|
|
}
|
|
|
|
|
2002-09-14 02:03:05 +04:00
|
|
|
wxButton*
|
|
|
|
ParamDialog::AddButton (int id, wxString label)
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
{
|
|
|
|
wxButton *btn = new wxButton (this, id, label);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
buttonSizer->Add (btn, 0, wxALL, 5);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
nbuttons++;
|
2002-09-14 02:03:05 +04:00
|
|
|
return btn;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// add the standard HELP, CANCEL, OK buttons.
|
|
|
|
void ParamDialog::AddDefaultButtons ()
|
|
|
|
{
|
|
|
|
AddButton (wxID_HELP, BTNLABEL_HELP);
|
|
|
|
AddButton (wxID_CANCEL, BTNLABEL_CANCEL);
|
|
|
|
AddButton (wxID_OK, BTNLABEL_OK);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ParamDialog::Init()
|
|
|
|
{
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
// if nobody has made any buttons, then create some now
|
2006-03-03 23:29:50 +03:00
|
|
|
if (nbuttons==0) AddDefaultButtons();
|
|
|
|
mainSizer->Add(buttonSizer, 0, wxALIGN_RIGHT);
|
|
|
|
EnableChanged();
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
// lay it out!
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(mainSizer);
|
2006-03-03 23:29:50 +03:00
|
|
|
mainSizer->Fit(this);
|
|
|
|
wxSize size = mainSizer->GetMinSize();
|
2006-03-18 19:30:52 +03:00
|
|
|
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
int margin = 5;
|
2006-03-18 19:30:52 +03:00
|
|
|
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
|
2006-03-03 23:29:50 +03:00
|
|
|
Center();
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int _next_id = ID_LAST_USER_DEFINED;
|
|
|
|
|
|
|
|
int ParamDialog::genId () {
|
|
|
|
return ++_next_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ParamDialog::isGeneratedId (int id) {
|
|
|
|
return (id >= ID_LAST_USER_DEFINED && id < _next_id);
|
|
|
|
}
|
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
void ParamDialog::AddParamList(char *nameList[], bx_param_c *base, wxFlexGridSizer *sizer, bool plain)
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
{
|
2006-03-08 21:10:41 +03:00
|
|
|
int i = 0;
|
|
|
|
while (nameList[i] != NULL) {
|
|
|
|
bx_param_c *param = SIM->get_param(nameList[i], base);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
if (param != NULL) {
|
2006-03-08 21:10:41 +03:00
|
|
|
AddParam(param, sizer, plain);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
}
|
2006-03-08 21:10:41 +03:00
|
|
|
i++;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
// support "legacy" addparam functions. Easier than changing them.
|
2002-10-16 23:27:17 +04:00
|
|
|
void ParamDialog::AddParam (bx_param_c *param, wxFlexGridSizer *sizer, bool plain)
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
{
|
|
|
|
AddParamContext context;
|
|
|
|
context.depth = 0;
|
|
|
|
context.parent = this;
|
|
|
|
context.vertSizer = mainSizer;
|
|
|
|
context.gridSizer = sizer;
|
|
|
|
AddParam (param, plain, &context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParamDialog::AddParam (
|
|
|
|
bx_param_c *param_generic,
|
|
|
|
bool plain,
|
|
|
|
AddParamContext *context)
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
{
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
AddParamContext defaultContext;
|
|
|
|
if (context == NULL) {
|
|
|
|
context = &defaultContext;
|
|
|
|
context->depth = 0;
|
|
|
|
context->parent = this;
|
|
|
|
context->vertSizer = mainSizer;
|
|
|
|
context->gridSizer = NULL;
|
|
|
|
}
|
|
|
|
wxASSERT (context->parent != NULL);
|
|
|
|
wxASSERT (context->vertSizer != NULL);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
if (param_generic == NULL)
|
|
|
|
return; // param not registered, probably this option was not compiled in
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("AddParam for param '%s'"), param_generic->get_name());
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
if (context->gridSizer == NULL) {
|
|
|
|
// create a gridSizer if none exists yet. add it to default vertSizer.
|
|
|
|
context->gridSizer = new wxFlexGridSizer (3);
|
|
|
|
context->vertSizer->Add (context->gridSizer);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
wxFlexGridSizer *sizer = context->gridSizer;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ParamStruct *pstr = new ParamStruct ();
|
|
|
|
pstr->param = param_generic;
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
pstr->id = genId ();
|
|
|
|
pstr->label = NULL;
|
|
|
|
pstr->u.window = NULL;
|
|
|
|
pstr->browseButton = NULL;
|
2006-02-19 18:43:03 +03:00
|
|
|
int type = param_generic->get_type();
|
2006-05-30 20:05:51 +04:00
|
|
|
const char *prompt;
|
2006-02-19 18:43:03 +03:00
|
|
|
if (type == BXT_LIST) {
|
|
|
|
bx_list_c *list = (bx_list_c*)pstr->param;
|
|
|
|
prompt = list->get_title()->getptr();
|
|
|
|
} else {
|
|
|
|
prompt = pstr->param->get_label();
|
|
|
|
}
|
2006-05-30 21:41:43 +04:00
|
|
|
if (!prompt) prompt = pstr->param->get_name();
|
|
|
|
const char *description = pstr->param->get_description();
|
2002-09-23 00:56:12 +04:00
|
|
|
wxASSERT (prompt != NULL);
|
2006-03-19 12:24:10 +03:00
|
|
|
#define ADD_LABEL(x) sizer->Add(pstr->label = new wxStaticText(context->parent, -1, wxString(x, wxConvUTF8)), 0, wxALIGN_RIGHT|wxALL, 3)
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
switch (type) {
|
|
|
|
case BXT_PARAM_BOOL: {
|
|
|
|
bx_param_bool_c *param = (bx_param_bool_c*) param_generic;
|
2006-03-19 12:24:10 +03:00
|
|
|
if (!plain) ADD_LABEL(prompt);
|
2006-03-18 19:30:52 +03:00
|
|
|
wxCheckBox *ckbx = new wxCheckBox (context->parent, pstr->id, wxT(""));
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ckbx->SetValue (param->get ());
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) ckbx->SetToolTip(wxString(description, wxConvUTF8));
|
2003-09-04 20:58:27 +04:00
|
|
|
sizer->Add (ckbx, 0, wxALL, 2);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
if (!plain) sizer->Add (1, 1); // spacer
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
pstr->u.checkbox = ckbx;
|
2002-09-03 12:53:41 +04:00
|
|
|
idHash->Put (pstr->id, pstr);
|
|
|
|
paramHash->Put (pstr->param->get_id (), pstr);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_NUM: {
|
|
|
|
bx_param_num_c *param = (bx_param_num_c*) param_generic;
|
2002-09-23 00:56:12 +04:00
|
|
|
if (!plain) ADD_LABEL (prompt);
|
2003-09-06 02:07:54 +04:00
|
|
|
if (param->get_options () & param->USE_SPIN_CONTROL) {
|
|
|
|
wxSpinCtrl *spinctrl = new wxSpinCtrl (context->parent, pstr->id);
|
|
|
|
spinctrl->SetValue (param->get ());
|
|
|
|
int max = (param->get_max () < (1<<24))?param->get_max ():(1<<24)-1;
|
|
|
|
spinctrl->SetRange (param->get_min (), SPINCTRL_FIX_MAX (max));
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) spinctrl->SetToolTip(wxString(description, wxConvUTF8));
|
2003-09-06 02:07:54 +04:00
|
|
|
sizer->Add (spinctrl, 0, wxALL, 2);
|
|
|
|
if (!plain) sizer->Add (1, 1); // spacer
|
|
|
|
pstr->u.spin = spinctrl;
|
|
|
|
} else {
|
2006-03-18 19:30:52 +03:00
|
|
|
wxTextCtrl *textctrl = new wxTextCtrl (context->parent, pstr->id, wxT(""), wxDefaultPosition, normalTextSize);
|
2003-09-06 02:07:54 +04:00
|
|
|
const char *format = param->get_format ();
|
|
|
|
if (!format)
|
|
|
|
format = strdup(param->get_base () == 16 ? "0x%X" : "%d");
|
|
|
|
SetTextCtrl (textctrl, format, param->get ());
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) textctrl->SetToolTip(wxString(description, wxConvUTF8));
|
2003-09-06 02:07:54 +04:00
|
|
|
sizer->Add (textctrl, 0, wxALL, 2);
|
|
|
|
if (!plain) sizer->Add (1, 1); // spacer
|
|
|
|
pstr->u.text = textctrl;
|
|
|
|
}
|
2002-09-03 12:53:41 +04:00
|
|
|
idHash->Put (pstr->id, pstr);
|
|
|
|
paramHash->Put (pstr->param->get_id (), pstr);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_ENUM: {
|
|
|
|
bx_param_enum_c *param = (bx_param_enum_c*) param_generic;
|
2002-09-23 00:56:12 +04:00
|
|
|
if (!plain) ADD_LABEL (prompt);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
wxChoice *choice = new wxChoice (context->parent, pstr->id);
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) choice->SetToolTip(wxString(description, wxConvUTF8));
|
2003-09-04 20:58:27 +04:00
|
|
|
sizer->Add (choice, 0, wxADJUST_MINSIZE, 2);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
if (!plain) sizer->Add (1, 1); // spacer
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
// fill in the choices
|
|
|
|
int i=0;
|
|
|
|
char *ptr;
|
2006-03-19 12:24:10 +03:00
|
|
|
while (NULL != (ptr = param->get_choice(i++)))
|
|
|
|
choice->Append(wxString(ptr, wxConvUTF8));
|
|
|
|
choice->SetSelection (param->get() - param->get_min());
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
pstr->u.choice = choice;
|
2006-03-19 12:24:10 +03:00
|
|
|
idHash->Put(pstr->id, pstr);
|
|
|
|
paramHash->Put(pstr->param->get_id(), pstr);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_STRING: {
|
|
|
|
bx_param_string_c *param = (bx_param_string_c*) param_generic;
|
2002-09-23 00:56:12 +04:00
|
|
|
if (!plain) ADD_LABEL (prompt);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
bool isFilename = param->get_options ()->get () & param->IS_FILENAME;
|
2006-03-18 19:30:52 +03:00
|
|
|
wxTextCtrl *txtctrl = new wxTextCtrl (context->parent, pstr->id, wxT(""), wxDefaultPosition, isFilename? longTextSize : normalTextSize);
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) txtctrl->SetToolTip(wxString(description, wxConvUTF8));
|
|
|
|
if (param->get_options()->get() & param->RAW_BYTES) {
|
|
|
|
char *value = param->getptr();
|
2003-08-25 19:21:19 +04:00
|
|
|
wxString buffer;
|
|
|
|
char sep_string[2];
|
2006-03-19 12:24:10 +03:00
|
|
|
sep_string[0] = param->get_separator();
|
2003-08-25 19:21:19 +04:00
|
|
|
sep_string[1] = 0;
|
2006-03-19 12:24:10 +03:00
|
|
|
for (int i=0; i<param->get_maxsize(); i++) {
|
2003-08-25 19:21:19 +04:00
|
|
|
wxString eachbyte;
|
2006-03-19 18:35:20 +03:00
|
|
|
eachbyte.Printf(wxT("%02x"), (unsigned int)0xff&value[i]);
|
2006-03-19 12:24:10 +03:00
|
|
|
if (i > 0)
|
|
|
|
buffer += wxString(sep_string, wxConvUTF8);
|
2003-08-25 19:21:19 +04:00
|
|
|
buffer += eachbyte;
|
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
txtctrl->SetValue(buffer);
|
2003-08-25 19:21:19 +04:00
|
|
|
} else {
|
2006-03-19 12:24:10 +03:00
|
|
|
txtctrl->SetValue(wxString(param->getptr(), wxConvUTF8));
|
|
|
|
txtctrl->SetMaxLength(param->get_maxsize());
|
2003-08-25 19:21:19 +04:00
|
|
|
}
|
2003-09-04 20:58:27 +04:00
|
|
|
sizer->Add (txtctrl, 0, wxALL, 2);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
if (!plain) {
|
|
|
|
if (isFilename) {
|
|
|
|
// create Browse button
|
|
|
|
pstr->browseButtonId = genId ();
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
pstr->browseButton = new wxButton (context->parent,
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
pstr->browseButtonId, BTNLABEL_BROWSE);
|
2003-09-04 20:58:27 +04:00
|
|
|
sizer->Add (pstr->browseButton, 0, wxALL, 2);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
idHash->Put (pstr->browseButtonId, pstr); // register under button id
|
|
|
|
} else {
|
|
|
|
sizer->Add (1, 1); // spacer
|
|
|
|
}
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
pstr->u.text = txtctrl;
|
2002-09-03 12:53:41 +04:00
|
|
|
idHash->Put (pstr->id, pstr);
|
|
|
|
paramHash->Put (pstr->param->get_id (), pstr);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_LIST: {
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
bx_list_c *list = (bx_list_c*) param_generic;
|
2006-03-19 12:24:10 +03:00
|
|
|
if (list->get_options()->get() & bx_list_c::USE_TAB_WINDOW) {
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
// put each item in a separate tab of a tabbed window
|
2006-03-19 12:24:10 +03:00
|
|
|
wxNotebook *notebook = new wxNotebook(context->parent, -1);
|
2005-05-17 22:07:04 +04:00
|
|
|
#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION < 6
|
2006-03-19 12:24:10 +03:00
|
|
|
wxNotebookSizer *nbsizer = new wxNotebookSizer(notebook);
|
2005-05-17 22:07:04 +04:00
|
|
|
#endif
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
// put all items in the list into a separate page of the notebook.
|
|
|
|
for (int i=0; i<list->get_size (); i++) {
|
2006-02-18 19:53:18 +03:00
|
|
|
bx_list_c *child = (bx_list_c*)list->get(i);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
wxASSERT (child->get_type() == BXT_LIST);
|
|
|
|
// the child must be a list! I could support other things but
|
|
|
|
// I don't see any reason to. It wouldn't make sense to devote
|
|
|
|
// a whole tab to a single parameter.
|
2006-03-19 12:24:10 +03:00
|
|
|
wxPanel *panel = new wxPanel(notebook);
|
|
|
|
wxBoxSizer *boxsz = new wxBoxSizer(wxVERTICAL);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
AddParamContext newcontext;
|
|
|
|
newcontext.depth = 1 + context->depth;
|
|
|
|
newcontext.parent = panel;
|
|
|
|
newcontext.vertSizer = boxsz;
|
|
|
|
newcontext.gridSizer = NULL; // will be created if needed
|
|
|
|
// the child itself is a list. Add the child's children in
|
|
|
|
// this new context.
|
|
|
|
bx_list_c *childl = (bx_list_c *)child;
|
|
|
|
for (int j=0; j<childl->get_size(); j++)
|
|
|
|
AddParam (childl->get(j), plain, &newcontext);
|
2006-02-18 19:53:18 +03:00
|
|
|
const char *pagename = child->get_title()->getptr();
|
2006-03-19 12:24:10 +03:00
|
|
|
if (!pagename) pagename = child->get_name();
|
|
|
|
panel->SetAutoLayout(TRUE);
|
|
|
|
panel->SetSizer(boxsz);
|
|
|
|
notebook->AddPage(panel, wxString(pagename, wxConvUTF8));
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
}
|
2005-05-17 22:07:04 +04:00
|
|
|
#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION < 6
|
2006-03-19 12:24:10 +03:00
|
|
|
context->vertSizer->Add(nbsizer, 0, wxALL|wxGROW, 10);
|
2005-05-17 22:07:04 +04:00
|
|
|
#else
|
2006-03-19 12:24:10 +03:00
|
|
|
context->vertSizer->Add(notebook, 0, wxALL|wxGROW, 10);
|
2005-05-17 22:07:04 +04:00
|
|
|
#endif
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
// clear gridSizer variable so that any future parameters force
|
|
|
|
// creation of a new one.
|
|
|
|
context->gridSizer = NULL;
|
|
|
|
// add to hashes
|
|
|
|
pstr->u.notebook = notebook;
|
2006-03-19 12:24:10 +03:00
|
|
|
idHash->Put(pstr->id, pstr);
|
|
|
|
paramHash->Put(pstr->param->get_id(), pstr);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
} else {
|
2003-08-23 19:28:06 +04:00
|
|
|
wxString boxTitle;
|
2006-03-19 12:24:10 +03:00
|
|
|
if (list->get_options()->get() & bx_list_c::USE_BOX_TITLE) {
|
|
|
|
boxTitle = wxString(prompt, wxConvUTF8);
|
2003-08-23 19:28:06 +04:00
|
|
|
} else {
|
2006-03-18 19:30:52 +03:00
|
|
|
boxTitle = wxT("");
|
2003-08-23 19:28:06 +04:00
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
wxStaticBox *box = new wxStaticBox(context->parent, -1, boxTitle);
|
|
|
|
wxStaticBoxSizer *boxsz = new wxStaticBoxSizer(box, wxVERTICAL);
|
- fixed up ParamDialog to correctly handle "trees" of parameters. A
bx_list_c can now be displayed as either a wxStaticBox with the
child parameters inside, or as a wxNotebook with each child
parameter in a separate tab. (The children can also be lists of
course.) The default display is the wxStaticBox type, but if you
set the option bit bx_list_c::USE_TAB_WINDOW in the list,
ParamDialog will use the wxNotebook display instead.
- to get the param trees working, I created a new struct
AddParamContext, which is passed to AddParam(). This struct is
critical when AddParam calls itself recursively to display lists
within lists.
- use the wxNotebook display feature for the ATA0,1,2,3 controller
dialog box. Now instead of being hundreds of pixels tall, it is
reasonable height with three different tabs. This fixed bug
#619074: "wx: ATA interface editor too tall" and was the whole
reason I started messing with this at all.
plus some minor cleanups
- when I added the enum constant bx_list_c::USE_TAB_WINDOW, I also
removed the BX_ prefix from all the other enum constants that are
used in parameter options in siminterface.cc. Since these constants
are enums within a class, there is no possibility of namespace
conflicts so the prefix is not needed.
- added wxADJUST_MINSIZE to all wxChoice controls, since that tells
wxWindows to adjust its size to the length of the longest string.
- instead of calling SetSize or SetSizeHints on every textcontrol with
a hardcoded width, I am using just two wxSize specifications for
everything: either normalTextSize or longTextSize.
- edit names of a few menus and params. For example now instead of
the tab saying "Master ATA device on channel 0" it will say
"First HD/CD on channel 0".
Modified Files:
main.cc gui/control.cc gui/gui.cc gui/siminterface.cc gui/siminterface.h
gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
2002-10-06 06:37:28 +04:00
|
|
|
AddParamContext newcontext;
|
|
|
|
newcontext.depth = 1 + context->depth;
|
|
|
|
newcontext.parent = context->parent;
|
|
|
|
newcontext.gridSizer = NULL; // it will be created if necessary
|
|
|
|
newcontext.vertSizer = boxsz;
|
|
|
|
// put all items in the list inside the boxsz sizer.
|
|
|
|
for (int i=0; i<list->get_size (); i++) {
|
|
|
|
bx_param_c *child = list->get (i);
|
|
|
|
AddParam (child, plain, &newcontext);
|
|
|
|
}
|
|
|
|
// add the boxsz to vertSizer
|
|
|
|
context->vertSizer->Add (boxsz, 0, wxALL|wxGROW, 10);
|
|
|
|
// clear gridSizer variable so that any future parameters force
|
|
|
|
// creation of a new one.
|
|
|
|
context->gridSizer = NULL;
|
|
|
|
// add to hashes
|
|
|
|
pstr->u.staticbox = box;
|
|
|
|
idHash->Put (pstr->id, pstr);
|
|
|
|
paramHash->Put (pstr->param->get_id (), pstr);
|
|
|
|
}
|
|
|
|
break;
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
default:
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogError(wxT("ParamDialog::AddParam called with unsupported param type id=%d"), (int)type);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
2006-02-18 19:53:18 +03:00
|
|
|
if (pstr->label) pstr->label->Enable(pstr->param->get_enabled());
|
|
|
|
if (pstr->u.window) pstr->u.window->Enable(pstr->param->get_enabled());
|
|
|
|
if (pstr->browseButton) pstr->browseButton->Enable(pstr->param->get_enabled());
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
|
2006-03-18 19:30:52 +03:00
|
|
|
bool ParamDialog::CopyGuiToParam()
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
{
|
|
|
|
// loop through all the parameters
|
2006-03-18 19:30:52 +03:00
|
|
|
idHash->BeginFind();
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
wxNode *node;
|
2006-03-18 19:30:52 +03:00
|
|
|
while ((node = idHash->Next()) != NULL) {
|
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
|
|
|
wxLogDebug(wxT("commit changes for param %s"), pstr->param->get_name());
|
|
|
|
int type = pstr->param->get_type();
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
switch (type) {
|
|
|
|
case BXT_PARAM_BOOL: {
|
|
|
|
bx_param_bool_c *boolp = (bx_param_bool_c*) pstr->param;
|
2002-12-12 21:31:20 +03:00
|
|
|
bool val = pstr->u.checkbox->GetValue ();
|
|
|
|
if (val != boolp->get ()) boolp->set (val);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_NUM: {
|
|
|
|
bx_param_num_c *nump = (bx_param_num_c*) pstr->param;
|
|
|
|
bool valid;
|
2003-09-06 02:07:54 +04:00
|
|
|
int n;
|
2006-03-19 12:24:10 +03:00
|
|
|
wxString complaint(wxT("Invalid integer for '"));
|
|
|
|
complaint += wxString(pstr->param->get_name(), wxConvUTF8);
|
|
|
|
complaint += wxT("'.");
|
|
|
|
if (nump->get_options() & nump->USE_SPIN_CONTROL) {
|
|
|
|
n = pstr->u.spin->GetValue();
|
2003-09-06 02:07:54 +04:00
|
|
|
} else {
|
2006-03-19 12:24:10 +03:00
|
|
|
n = GetTextCtrlInt(pstr->u.text, &valid, true, complaint);
|
2003-09-06 02:07:54 +04:00
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
if ((n < nump->get_min()) || (n > nump->get_max())) {
|
|
|
|
wxMessageBox(wxT("Numerical parameter out of range"), wxT("Error"), wxOK | wxICON_ERROR, this );
|
2003-08-26 21:25:26 +04:00
|
|
|
return false;
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
if (n != nump->get()) nump->set(n);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_ENUM: {
|
|
|
|
bx_param_enum_c *enump = (bx_param_enum_c*) pstr->param;
|
2002-12-12 21:31:20 +03:00
|
|
|
int value = pstr->u.choice->GetSelection () + enump->get_min ();
|
|
|
|
if (value != enump->get ()) enump->set (value);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_STRING: {
|
|
|
|
bx_param_string_c *stringp = (bx_param_string_c*) pstr->param;
|
|
|
|
char buf[1024];
|
|
|
|
wxString tmp(pstr->u.text->GetValue ());
|
2003-08-25 19:21:19 +04:00
|
|
|
if (stringp->get_options()->get () & stringp->RAW_BYTES) {
|
|
|
|
char src[1024];
|
|
|
|
int i, p = 0;
|
|
|
|
unsigned int n;
|
2006-03-19 12:24:10 +03:00
|
|
|
strcpy(src, tmp.mb_str(wxConvUTF8));
|
|
|
|
for (i=0; i<stringp->get_maxsize(); i++)
|
2003-08-25 19:21:19 +04:00
|
|
|
buf[i] = 0;
|
|
|
|
for (i=0; i<stringp->get_maxsize (); i++) {
|
|
|
|
while (src[p] == stringp->get_separator ())
|
|
|
|
p++;
|
|
|
|
if (src[p] == 0) break;
|
|
|
|
// try to read a byte of hex
|
|
|
|
if (sscanf (src+p, "%02x", &n) == 1) {
|
|
|
|
buf[i] = n;
|
|
|
|
p+=2;
|
|
|
|
} else {
|
2006-03-18 19:30:52 +03:00
|
|
|
wxMessageBox(wxT("Illegal raw byte format"), wxT("Error"), wxOK | wxICON_ERROR, this );
|
2003-08-25 19:21:19 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2006-03-19 12:24:10 +03:00
|
|
|
strncpy(buf, tmp.mb_str(wxConvUTF8), sizeof(buf));
|
2003-08-25 19:21:19 +04:00
|
|
|
}
|
2002-12-12 21:31:20 +03:00
|
|
|
buf[sizeof(buf)-1] = 0;
|
|
|
|
if (!stringp->equals (buf)) stringp->set (buf);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
}
|
2002-10-01 02:15:20 +04:00
|
|
|
case BXT_LIST:
|
|
|
|
break;
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
default:
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogError(wxT("ParamDialog::CopyGuiToParam: unsupported param type id=%d"), (int)type);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-03-03 23:29:50 +03:00
|
|
|
void ParamDialog::EnableChanged()
|
2002-09-03 12:53:41 +04:00
|
|
|
{
|
2006-03-03 23:29:50 +03:00
|
|
|
idHash->BeginFind();
|
2002-09-03 12:53:41 +04:00
|
|
|
wxNode *node;
|
|
|
|
while ((node = idHash->Next ()) != NULL) {
|
2006-03-03 23:29:50 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
|
|
|
if (pstr->param->get_type() == BXT_PARAM_BOOL)
|
|
|
|
EnableChanged(pstr);
|
|
|
|
if (pstr->param->get_type() == BXT_PARAM_ENUM)
|
|
|
|
EnumChanged(pstr);
|
2003-09-02 23:34:48 +04:00
|
|
|
if (runtime) {
|
2006-03-03 23:29:50 +03:00
|
|
|
if ((pstr->param->get_type() != BXT_LIST) && !pstr->param->get_runtime_param())
|
|
|
|
EnableParam(pstr->param->get_id(), false);
|
2003-09-02 23:34:48 +04:00
|
|
|
}
|
2002-09-23 00:56:12 +04:00
|
|
|
// special cases that can't be handled in the usual way
|
2002-09-03 12:53:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-03 23:29:50 +03:00
|
|
|
void ParamDialog::EnableChanged(ParamStruct *pstrOfCheckbox)
|
2002-09-03 12:53:41 +04:00
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("EnableChanged on checkbox %s"), pstrOfCheckbox->param->get_name());
|
2002-09-03 12:53:41 +04:00
|
|
|
bx_param_bool_c *enableParam = (bx_param_bool_c*) pstrOfCheckbox->param;
|
2006-03-03 23:29:50 +03:00
|
|
|
wxASSERT(enableParam->get_type() == BXT_PARAM_BOOL); // or we wouldn't be here
|
|
|
|
bool en = pstrOfCheckbox->u.checkbox->GetValue();
|
|
|
|
EnableChangedRecursive(enableParam->get_dependent_list(), en, pstrOfCheckbox);
|
2002-09-23 00:56:12 +04:00
|
|
|
}
|
|
|
|
|
2006-03-03 23:29:50 +03:00
|
|
|
void ParamDialog::EnableChangedRecursive(
|
2002-09-23 00:56:12 +04:00
|
|
|
bx_list_c *list,
|
|
|
|
bool en,
|
|
|
|
ParamStruct *pstrOfCheckbox)
|
|
|
|
{
|
|
|
|
if (list==NULL) return;
|
2002-11-17 01:44:09 +03:00
|
|
|
int i;
|
2006-03-03 23:29:50 +03:00
|
|
|
for (i=0; i<list->get_size(); i++) {
|
2002-09-03 12:53:41 +04:00
|
|
|
bx_param_c *param = list->get(i);
|
2006-03-03 23:29:50 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param->get_id());
|
2002-09-03 12:53:41 +04:00
|
|
|
if (pstr) {
|
2002-09-23 00:56:12 +04:00
|
|
|
if (param == pstrOfCheckbox->param) {
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("not setting enable on checkbox '%s' that triggered the enable change"), pstrOfCheckbox->param->get_name());
|
2002-09-23 00:56:12 +04:00
|
|
|
continue;
|
|
|
|
}
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("setting enable for param '%s' to %d"), pstr->param->get_name(), en?1:0);
|
2006-03-03 23:29:50 +03:00
|
|
|
if (en != pstr->u.window->IsEnabled()) {
|
|
|
|
EnableParam(pstr->param->get_id(), en);
|
|
|
|
bx_list_c *deps = pstr->param->get_dependent_list();
|
|
|
|
if (deps) {
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("recursing on dependent list of %s"), list->get_name());
|
2006-03-03 23:29:50 +03:00
|
|
|
if (pstr->param->get_type() == BXT_PARAM_BOOL) {
|
|
|
|
bool dep_en = pstr->u.window->IsEnabled() && pstr->u.checkbox->GetValue();
|
|
|
|
EnableChangedRecursive(deps, dep_en, pstr);
|
|
|
|
}
|
2002-09-23 00:56:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if any enums changed, give them a chance to update
|
2002-11-17 01:44:09 +03:00
|
|
|
for (i=0; i<list->get_size (); i++) {
|
2002-09-23 00:56:12 +04:00
|
|
|
bx_param_c *param = list->get(i);
|
2006-03-03 23:29:50 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param->get_id());
|
2002-09-23 00:56:12 +04:00
|
|
|
if (pstr) {
|
|
|
|
if (pstr->param->get_type () == BXT_PARAM_ENUM)
|
|
|
|
EnumChanged (pstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 01:48:57 +03:00
|
|
|
void ParamDialog::EnableParam(int param_id, bool enabled)
|
2002-09-23 00:56:12 +04:00
|
|
|
{
|
2006-02-24 01:48:57 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param_id);
|
2002-09-23 00:56:12 +04:00
|
|
|
if (!pstr) return;
|
2006-02-24 01:48:57 +03:00
|
|
|
if (pstr->label) pstr->label->Enable(enabled);
|
|
|
|
if (pstr->browseButton) pstr->browseButton->Enable(enabled);
|
|
|
|
if (pstr->u.window) pstr->u.window->Enable(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParamDialog::EnableParam(const char *pname, bool enabled)
|
|
|
|
{
|
|
|
|
int param_id = SIM->get_param(pname)->get_id();
|
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param_id);
|
|
|
|
if (!pstr) return;
|
|
|
|
if (pstr->label) pstr->label->Enable(enabled);
|
|
|
|
if (pstr->browseButton) pstr->browseButton->Enable(enabled);
|
|
|
|
if (pstr->u.window) pstr->u.window->Enable(enabled);
|
2002-09-23 00:56:12 +04:00
|
|
|
}
|
|
|
|
|
2006-02-26 22:11:20 +03:00
|
|
|
void ParamDialog::EnableParam(const char *pname, bx_list_c *base, bool enabled)
|
|
|
|
{
|
|
|
|
int param_id = SIM->get_param(pname, base)->get_id();
|
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param_id);
|
|
|
|
if (!pstr) return;
|
|
|
|
if (pstr->label) pstr->label->Enable(enabled);
|
|
|
|
if (pstr->browseButton) pstr->browseButton->Enable(enabled);
|
|
|
|
if (pstr->u.window) pstr->u.window->Enable(enabled);
|
|
|
|
}
|
|
|
|
|
2006-03-02 00:24:20 +03:00
|
|
|
void ParamDialog::EnumChanged(ParamStruct *pstr)
|
2002-09-23 00:56:12 +04:00
|
|
|
{
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("EnumChanged"));
|
2006-02-24 15:05:24 +03:00
|
|
|
char pname[512];
|
2006-02-26 22:11:20 +03:00
|
|
|
Bit8u channel, device;
|
|
|
|
|
|
|
|
bx_list_c *base = (bx_list_c*) pstr->param->get_parent();
|
2006-03-02 00:24:20 +03:00
|
|
|
if (base != NULL) {
|
|
|
|
base->get_param_path(pname, 512);
|
|
|
|
} else {
|
|
|
|
pname[0] = 0;
|
|
|
|
}
|
2006-02-26 22:11:20 +03:00
|
|
|
if (!strncmp(pname, "ata.", 4)) {
|
|
|
|
channel = pname[4] - '0';
|
|
|
|
if (!strcmp(base->get_name(), "master")) {
|
|
|
|
device = 0;
|
|
|
|
} else {
|
|
|
|
device = 1;
|
|
|
|
}
|
|
|
|
if (!strcmp(pstr->param->get_name(), "type")) {
|
2002-09-23 00:56:12 +04:00
|
|
|
// find out if "present" checkbox is checked
|
2006-02-26 22:11:20 +03:00
|
|
|
int present_id = SIM->get_param_bool("present", base)->get_id();
|
|
|
|
ParamStruct *present = (ParamStruct*) paramHash->Get(present_id);
|
|
|
|
wxASSERT(present && present->param->get_type() == BXT_PARAM_BOOL);
|
|
|
|
if (!present->u.checkbox->GetValue())
|
|
|
|
return; // device not enabled, leave it alone
|
|
|
|
if (!present->u.checkbox->IsEnabled())
|
|
|
|
return; // enable button for the device is not enabled
|
|
|
|
wxASSERT(pstr->param->get_type() == BXT_PARAM_ENUM);
|
|
|
|
int type = pstr->u.choice->GetSelection();
|
2002-09-23 00:56:12 +04:00
|
|
|
if (type == BX_ATA_DEVICE_DISK) {
|
2006-02-26 22:11:20 +03:00
|
|
|
// enable cylinders, heads, spt
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("enabling disk parameters"));
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("mode", base, 1);
|
|
|
|
EnableParam("cylinders", base, 1);
|
|
|
|
EnableParam("heads", base, 1);
|
|
|
|
EnableParam("spt", base, 1);
|
|
|
|
EnableParam("status", base, 0);
|
|
|
|
EnableParam("translation", base, 1);
|
|
|
|
|
|
|
|
int mode_id = SIM->get_param_enum("mode", base)->get_id();
|
2004-01-06 01:18:01 +03:00
|
|
|
ParamStruct *mode_param = (ParamStruct*) paramHash->Get(mode_id);
|
|
|
|
int mode = BX_ATA_MODE_FLAT;
|
|
|
|
if(mode_param) mode=mode_param->u.choice->GetSelection();
|
|
|
|
switch(mode) {
|
|
|
|
case BX_ATA_MODE_UNDOABLE:
|
|
|
|
case BX_ATA_MODE_VOLATILE:
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("journal", base, 1);
|
2004-01-06 01:18:01 +03:00
|
|
|
break;
|
|
|
|
default:
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("journal", base, 0);
|
2004-01-06 01:18:01 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-09-23 00:56:12 +04:00
|
|
|
} else {
|
2006-02-26 22:11:20 +03:00
|
|
|
// enable inserted
|
2006-03-18 19:30:52 +03:00
|
|
|
wxLogDebug(wxT("enabling cdrom parameters"));
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("mode", base, 0);
|
|
|
|
EnableParam("cylinders", base, 0);
|
|
|
|
EnableParam("heads", base, 0);
|
|
|
|
EnableParam("spt", base, 0);
|
|
|
|
EnableParam("status", base, 1);
|
|
|
|
EnableParam("translation", base, 0);
|
|
|
|
EnableParam("journal", base, 0);
|
2002-09-23 00:56:12 +04:00
|
|
|
}
|
2006-02-26 22:11:20 +03:00
|
|
|
} else if (!strcmp(pstr->param->get_name(), "mode")) {
|
2004-01-06 01:18:01 +03:00
|
|
|
// find out if "present" checkbox is checked
|
2006-02-26 22:11:20 +03:00
|
|
|
int present_id = SIM->get_param_bool("present", base)->get_id();
|
|
|
|
ParamStruct *present = (ParamStruct*) paramHash->Get(present_id);
|
|
|
|
wxASSERT (present && present->param->get_type() == BXT_PARAM_BOOL);
|
2004-01-06 01:18:01 +03:00
|
|
|
if (!present->u.checkbox->GetValue ())
|
2006-02-26 22:11:20 +03:00
|
|
|
return; // device not enabled, leave it alone
|
2004-01-06 01:18:01 +03:00
|
|
|
if (!present->u.checkbox->IsEnabled ())
|
2006-02-26 22:11:20 +03:00
|
|
|
return; // enable button for the device is not enabled
|
|
|
|
wxASSERT(pstr->param->get_type() == BXT_PARAM_ENUM);
|
|
|
|
int mode = pstr->u.choice->GetSelection();
|
2004-01-06 01:18:01 +03:00
|
|
|
switch(mode) {
|
|
|
|
case BX_ATA_MODE_UNDOABLE:
|
|
|
|
case BX_ATA_MODE_VOLATILE:
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("journal", base, 1);
|
2004-01-06 01:18:01 +03:00
|
|
|
break;
|
|
|
|
default:
|
2006-02-26 22:11:20 +03:00
|
|
|
EnableParam("journal", base, 0);
|
2004-01-06 01:18:01 +03:00
|
|
|
break;
|
|
|
|
}
|
2006-02-26 22:11:20 +03:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
pstr->param->get_param_path(pname, 512);
|
|
|
|
if (!strcmp(pname, BXPN_LOAD32BITOS_WHICH)) {
|
|
|
|
int os = pstr->u.choice->GetSelection();
|
|
|
|
if (os != Load32bitOSNone) {
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_PATH, 1);
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_IOLOG, 1);
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_INITRD, 1);
|
|
|
|
} else {
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_PATH, 0);
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_IOLOG, 0);
|
|
|
|
EnableParam(BXPN_LOAD32BITOS_INITRD, 0);
|
2003-08-24 14:08:49 +04:00
|
|
|
}
|
|
|
|
}
|
2002-09-03 12:53:41 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
// if any parameters changed, update the associated control
|
2002-09-20 16:40:13 +04:00
|
|
|
void ParamDialog::CopyParamToGui ()
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
{
|
|
|
|
// loop through all the parameters
|
|
|
|
idHash->BeginFind ();
|
|
|
|
wxNode *node;
|
|
|
|
while ((node = idHash->Next ()) != NULL) {
|
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData ();
|
2006-03-19 12:24:10 +03:00
|
|
|
IFDBG_DLG(wxLogDebug(wxT("refresh param %s"), pstr->param->get_name()));
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
int type = pstr->param->get_type ();
|
|
|
|
switch (type) {
|
|
|
|
case BXT_PARAM_BOOL: {
|
|
|
|
bx_param_bool_c *boolp = (bx_param_bool_c*) pstr->param;
|
|
|
|
pstr->u.checkbox->SetValue (boolp->get ());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_NUM: {
|
|
|
|
bx_param_num_c *nump = (bx_param_num_c*) pstr->param;
|
|
|
|
const char *format = nump->get_format ();
|
|
|
|
if (!format)
|
|
|
|
format = strdup(nump->get_base () == 16 ? "0x%X" : "%d");
|
|
|
|
SetTextCtrl (pstr->u.text, format, nump->get ());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_ENUM: {
|
|
|
|
bx_param_enum_c *enump = (bx_param_enum_c*) pstr->param;
|
|
|
|
pstr->u.choice->SetSelection (enump->get () - enump->get_min ());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_STRING: {
|
|
|
|
bx_param_string_c *stringp = (bx_param_string_c*) pstr->param;
|
2006-03-19 12:24:10 +03:00
|
|
|
pstr->u.text->SetValue (wxString(stringp->getptr (), wxConvUTF8));
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
break;
|
|
|
|
}
|
2002-10-01 02:15:20 +04:00
|
|
|
case BXT_LIST:
|
|
|
|
break;
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
default:
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogError(wxT("ParamDialog::CopyParamToGui(): unsupported param type id=%d"), (int)type);
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
void ParamDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId ();
|
2002-10-01 02:15:20 +04:00
|
|
|
//wxLogMessage ("event was from id=%d", id);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
if (isGeneratedId (id)) {
|
2002-09-03 12:53:41 +04:00
|
|
|
ParamStruct *pstr = (ParamStruct*) idHash->Get (id);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
if (pstr == NULL) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("ParamStruct not found for id=%d"), id);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (id == pstr->id) {
|
2006-03-19 12:24:10 +03:00
|
|
|
IFDBG_DLG(wxLogDebug(wxT("event came from window %p (id=%d) controlled by parameter '%s'"), pstr->u.window, id, pstr->param->get_name()));
|
2002-09-23 00:56:12 +04:00
|
|
|
switch (pstr->param->get_type ()) {
|
|
|
|
case BXT_PARAM_BOOL:
|
2006-03-03 23:29:50 +03:00
|
|
|
EnableChanged(pstr);
|
2002-09-23 00:56:12 +04:00
|
|
|
break;
|
|
|
|
case BXT_PARAM_ENUM:
|
|
|
|
EnumChanged (pstr);
|
|
|
|
break;
|
2002-09-03 12:53:41 +04:00
|
|
|
}
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (id == pstr->browseButtonId) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("browse button id=%d attached to wxTextCtrl %p"), id, pstr->u.text);
|
|
|
|
BrowseTextCtrl(pstr->u.text);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
return;
|
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("id was key to ParamStruct but doesn't match either id inside"));
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
switch (id) {
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
case wxID_OK:
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
if (IsModal ()) {
|
2002-09-20 16:40:13 +04:00
|
|
|
if (CopyGuiToParam ())
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
EndModal (wxID_OK);
|
|
|
|
} else {
|
2002-09-20 16:40:13 +04:00
|
|
|
CopyParamToGui ();
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
}
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
|
|
|
case wxID_CANCEL:
|
- apply a patch I've been working on
- modified files: config.h.in cpu/init.cc debug/dbg_main.cc gui/control.cc
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h iodev/keyboard.cc
----------------------------------------------------------------------
Patch name: patch.wx-show-cpu2
Author: Bryce Denney
Date: Fri Sep 6 12:13:28 EDT 2002
Description:
Second try at implementing the "Debug:Show Cpu" and "Debug:Show
Keyboard" dialog with values that change as the simulation proceeds.
(Nobody gets to see the first try.) This is the first step toward
making something resembling a wxWindows debugger.
First, variables which are going to be visible in the CI must be
registered as parameters. For some variables, it might be acceptable
to change them from Bit32u into bx_param_num_c and access them only
with set/get methods, but for most variables it would be a horrible
pain and wreck performance.
To deal with this, I introduced the concept of a shadow parameter. A
normal parameter has its value stored inside the struct, but a shadow
parameter has only a pointer to the value. Shadow params allow you to
treat any variable as if it was a parameter, without having to change
its type and access it using get/set methods. Of course, a shadow
param's value is controlled by someone else, so it can change at any
time.
To demonstrate and test the registration of shadow parameters, I
added code in cpu/init.cc to register a few CPU registers and
code in iodev/keyboard.cc to register a few keyboard state values.
Now these parameters are visible in the Debug:Show CPU and
Debug:Show Keyboard dialog boxes.
The Debug:Show* dialog boxes are created by the ParamDialog class,
which already understands how to display each type of parameter,
including the new shadow parameters (because they are just a subclass
of a normal parameter class). I have added a ParamDialog::Refresh()
method, which rereads the value from every parameter that it is
displaying and changes the displayed value. At the moment, in the
Debug:Show CPU dialog, changing the values has no effect. However
this is trivial to add when it's time (just call CommitChanges!). It
wouldn't really make sense to change the values unless you have paused
the simulation, for example when single stepping with the debugger.
The Refresh() method must be called periodically or else the dialog
will show the initial values forever. At the moment, Refresh() is
called when the simulator sends an async event called
BX_ASYNC_EVT_REFRESH, created by a call to SIM->refresh_ci ().
Details:
- implement shadow parameter class for Bit32s, called bx_shadow_num_c.
implement shadow parameter class for Boolean, called bx_shadow_bool_c.
more to follow (I need one for every type!)
- now the simulator thread can request that the config interface refresh
its display. For now, the refresh event causes the CI to check every
parameter it is watching and change the display value. Later, it may
be worth the trouble to keep track of which parameters have actually
changed. Code in the simulator thread calls SIM->refresh_ci(), which
creates an async event called BX_ASYNC_EVT_REFRESH and sends it to
the config interface. When it arrives in the wxWindows gui thread,
it calls RefreshDialogs(), which calls the Refresh() method on any
dialogs that might need it.
- in the debugger, SIM->refresh_ci() is called before every prompt
is printed. Otherwise, the refresh would wait until the next
SIM->periodic(), which might be thousands of cycles. This way,
when you're single stepping, the dialogs update with every step.
- To improve performance, the CI has a flag (MyFrame::WantRefresh())
which tells whether it has any need for refresh events. If no
dialogs are showing that need refresh events, then no event is sent
between threads.
- add a few defaults to the param classes that affect the settings of
newly created parameters. When declaring a lot of params with
similar settings it's more compact to set the default for new params
rather than to change each one separately. default_text_format is
the printf format string for displaying numbers. default_base is
the default base for displaying numbers (0, 16, 2, etc.)
- I added to ParamDialog to make it able to display modeless dialog
boxes such as "Debug:Show CPU". The new Refresh() method queries
all the parameters for their current value and changes the value in
the wxWindows control. The ParamDialog class still needs a little
work; for example, if it's modal it should have Cancel/Ok buttons,
but if it's going to be modeless it should maybe have Apply (commit
any changes) and Close.
2002-09-06 20:43:26 +04:00
|
|
|
if (IsModal ())
|
|
|
|
EndModal (wxID_CANCEL);
|
|
|
|
else
|
|
|
|
Show (FALSE);
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
break;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
case wxID_HELP:
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
ShowHelp();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
event.Skip ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParamDialog::ShowHelp ()
|
|
|
|
{
|
2003-08-26 21:25:26 +04:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this );
|
- add generic dialog class called ParamDialog. You create it, call
a method to add the parameters (bx_param_c) that you want to edit,
and display it. It knows how to display and edit boolean, int,
enum, and string, so it can do a reasonable job on any parameter.
The end result is not as nice as a box that you lay out by hand, but
it's decent. The most obvious thing that's missing from
ParamDialog-generated dialogs is that I haven't found a way to
make an "Enable" button that enables/disables a bunch of other
parameters. I'll keep thinking about that.
- using ParamDialog, I made dialogs for Sound, Cmos, Serial/Parallel,
32bitOSloader, and an ugly catch-all category called other.
Now I believe you can edit every single option using wxWindows.
2002-09-03 09:32:49 +04:00
|
|
|
}
|
|
|
|
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// CpuRegistersDialog
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// Structure:
|
|
|
|
// - mainSizer
|
|
|
|
// - mainRegsSizer (grid or flexgrid)
|
|
|
|
// - col0: flexgrid
|
|
|
|
// - params from EAX to ESP
|
|
|
|
// - col1: flexgrid
|
|
|
|
// - params from EIP to EFLAGS
|
|
|
|
// - col2: flexgrid
|
|
|
|
// - params from LDTR to IDTR limit
|
|
|
|
// - flagsSizer
|
|
|
|
// - extRegsSizer
|
|
|
|
// - col0: flexgrid
|
|
|
|
// - DR* params
|
|
|
|
// - col1: flexgrid
|
|
|
|
// - TR* params
|
|
|
|
// - col2: flexgrid
|
|
|
|
// - CR* params
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(CpuRegistersDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, CpuRegistersDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, CpuRegistersDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, CpuRegistersDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
CpuRegistersDialog::CpuRegistersDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
2006-03-08 21:10:41 +03:00
|
|
|
: ParamDialog(parent, id)
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
{
|
|
|
|
wxFlexGridSizer *column;
|
|
|
|
nflags = 0;
|
2006-03-08 21:10:41 +03:00
|
|
|
char *mainRegList1[] = CPU_REGS_MAIN_REGS1;
|
|
|
|
char *mainRegList2[] = CPU_REGS_MAIN_REGS2;
|
|
|
|
char *mainRegList3[] = CPU_REGS_MAIN_REGS3;
|
|
|
|
char *flagList[] = CPU_REGS_FLAGS;
|
|
|
|
char *controlList[] = CPU_REGS_CONTROL_REGS;
|
|
|
|
char *debugList[] = CPU_REGS_DEBUG_REGS;
|
|
|
|
char *testList[] = CPU_REGS_TEST_REGS;
|
2006-04-16 14:12:32 +04:00
|
|
|
bx_list_c *base = (bx_list_c*)SIM->get_param(BXPN_WX_CPU0_STATE);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
|
|
|
// top level objects
|
2006-03-19 12:24:10 +03:00
|
|
|
wxStaticBox *mainRegsBox = new wxStaticBox(this, -1, wxT("Basic Registers"));
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
wxStaticBoxSizer *mainRegsBoxSizer =
|
2006-03-08 21:10:41 +03:00
|
|
|
new wxStaticBoxSizer(mainRegsBox, wxVERTICAL);
|
|
|
|
mainSizer->Add(mainRegsBoxSizer, 0, wxALL|wxGROW, 10);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-19 12:24:10 +03:00
|
|
|
wxStaticBox *flagsBox = new wxStaticBox(this, -1, wxT("EFLAGS Bits"));
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
wxStaticBoxSizer *flagsBoxSizer =
|
2006-03-08 21:10:41 +03:00
|
|
|
new wxStaticBoxSizer(flagsBox, wxVERTICAL);
|
|
|
|
mainSizer->Add(flagsBoxSizer, 0, wxALL|wxGROW, 10);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-19 12:24:10 +03:00
|
|
|
wxStaticBox *otherBox = new wxStaticBox(this, -1, wxT("Other Registers"));
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
wxStaticBoxSizer *otherBoxSizer =
|
2006-03-08 21:10:41 +03:00
|
|
|
new wxStaticBoxSizer(otherBox, wxVERTICAL);
|
|
|
|
mainSizer->Add(otherBoxSizer, 0, wxALL|wxGROW, 10);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
|
|
|
// mainRegsSizer contents
|
2006-03-08 21:10:41 +03:00
|
|
|
mainRegsSizer = new wxFlexGridSizer(3);
|
|
|
|
mainRegsBoxSizer->Add(mainRegsSizer, 0, wxALL, 3);
|
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
mainRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(mainRegList1, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
mainRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(mainRegList2, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
mainRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(mainRegList3, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
|
|
|
// add flag parameters
|
2006-03-08 21:10:41 +03:00
|
|
|
flagsSizer = new wxFlexGridSizer(CPU_REGS_MAX_FLAGS);
|
|
|
|
flagsBoxSizer->Add(flagsSizer, 0, wxALL | wxALIGN_CENTER, 3);
|
|
|
|
int i = 0;
|
|
|
|
while (flagList[i] != NULL) {
|
|
|
|
bx_param_c *param = SIM->get_param(flagList[i], base);
|
|
|
|
if (param != NULL) {
|
|
|
|
AddFlag(param);
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
|
|
|
// extRegsSizer contents
|
2006-03-08 21:10:41 +03:00
|
|
|
extRegsSizer = new wxFlexGridSizer(3);
|
|
|
|
otherBoxSizer->Add(extRegsSizer, 0, wxALL, 3);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
extRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(controlList, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
extRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(debugList, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
2006-03-08 21:10:41 +03:00
|
|
|
column = new wxFlexGridSizer(3);
|
|
|
|
extRegsSizer->Add(column, 0, wxALL, 10);
|
|
|
|
AddParamList(testList, base, column);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
|
|
|
|
// add buttons
|
2002-09-13 23:51:06 +04:00
|
|
|
#if BX_DEBUGGER
|
|
|
|
// only show these if debugger is enabled
|
2006-03-08 21:10:41 +03:00
|
|
|
contButton = AddButton(ID_Debug_Continue, BTNLABEL_DEBUG_CONTINUE);
|
|
|
|
stopButton = AddButton(ID_Debug_Stop, BTNLABEL_DEBUG_STOP);
|
|
|
|
stepButton = AddButton(ID_Debug_Step, BTNLABEL_DEBUG_STEP);
|
|
|
|
//commitButton = AddButton(ID_Debug_Commit, BTNLABEL_DEBUG_COMMIT);
|
2002-09-13 23:51:06 +04:00
|
|
|
#endif
|
2006-03-08 21:10:41 +03:00
|
|
|
AddButton(ID_Close, BTNLABEL_CLOSE);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-08 21:10:41 +03:00
|
|
|
CpuRegistersDialog::AddFlag(bx_param_c *param)
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
{
|
2006-03-08 21:10:41 +03:00
|
|
|
if (param == NULL) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("AddFlag on undefined param"));
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
return;
|
|
|
|
}
|
2006-03-08 21:10:41 +03:00
|
|
|
wxASSERT(nflags < CPU_REGS_MAX_FLAGS);
|
|
|
|
flagptr[nflags++] = param;
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-03-08 21:10:41 +03:00
|
|
|
CpuRegistersDialog::Init()
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<CPU_REGS_MAX_FLAGS; i++) {
|
|
|
|
if (i<nflags) {
|
2006-03-08 21:10:41 +03:00
|
|
|
bx_param_c *param = flagptr[i];
|
2006-03-19 12:24:10 +03:00
|
|
|
flagsSizer->Add(new wxStaticText(this, -1, wxString(param->get_label(), wxConvUTF8)), 0, wxALL|wxALIGN_LEFT, 4);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
} else {
|
2006-03-08 21:10:41 +03:00
|
|
|
flagsSizer->Add(0, 0); // spacer
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i=0; i<nflags; i++) {
|
2006-03-08 21:10:41 +03:00
|
|
|
bx_param_c *param = flagptr[i];
|
|
|
|
AddParam(param, flagsSizer, true);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
// special case: make IOPL text field small
|
2006-04-16 14:12:32 +04:00
|
|
|
ParamStruct *pstr = (ParamStruct*)paramHash->Get(SIM->get_param(BXPN_WX_CPU0_EFLAGS_IOPL)->get_id());
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
if (pstr != NULL) {
|
2006-03-08 21:10:41 +03:00
|
|
|
wxSize size = pstr->u.text->GetSize();
|
|
|
|
size.SetWidth (size.GetWidth() / 2);
|
|
|
|
pstr->u.text->SetSize(size);
|
|
|
|
flagsSizer->SetItemMinSize(pstr->u.text, size.GetWidth(), size.GetHeight());
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
2006-03-08 21:10:41 +03:00
|
|
|
ParamDialog::Init();
|
|
|
|
stateChanged(false);
|
2002-09-14 02:03:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CpuRegistersDialog::stateChanged (bool simRunning)
|
|
|
|
{
|
2002-09-16 19:28:19 +04:00
|
|
|
#if BX_DEBUGGER
|
2002-09-14 02:03:05 +04:00
|
|
|
contButton->Enable (!simRunning);
|
|
|
|
stepButton->Enable (!simRunning);
|
|
|
|
stopButton->Enable (simRunning);
|
2002-09-16 19:28:19 +04:00
|
|
|
#endif
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
void
|
2002-09-20 16:40:13 +04:00
|
|
|
CpuRegistersDialog::CopyParamToGui ()
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
{
|
2002-09-20 16:40:13 +04:00
|
|
|
ParamDialog::CopyParamToGui ();
|
2002-09-16 19:28:19 +04:00
|
|
|
#if BX_DEBUGGER
|
2006-03-05 13:24:29 +03:00
|
|
|
stateChanged (SIM->get_param_bool(BXPN_DEBUG_RUNNING)->get());
|
2002-09-16 19:28:19 +04:00
|
|
|
#endif
|
- add Debug Log dialog, which shows all the text output that is normally
printed to stderr in the text debugger. Also allows the user to
type (text) debugger commands directly, which also appear in the log.
- all text output in the debugger now passes through dbg_printf()
(used to be fprintf to stderr) so that in wxWindows I can redirect
it all to the wxWindows debug log screen. Added debug_fputs to
siminterface which actually sends the text to the GUI by creating
a BX_ASYNC_EVT_DBG_MSG event.
- changed prefix and msg fields of BxLogMsgEvent to const char *,
and also in args of logmsg method of siminterface.
- don't trap SIGINT in wxWindows. There are other ways to stop execution.
Also, signal handling with multiple threads is very strange and different
on different platforms.
- minor changes to fix gcc -Wall warnings in dbg_main.cc
- add a new boolean parameter BXP_DEBUG_RUNNING that tells if the debugger is
running freely or not. This is used by the wxWindows GUI to enable or
disable certain choices.
- CpuRegistersDialog has continue,stop,step buttons. When the sim is running
freely, I disable continue and step, and enable stop. When the sim stops
to wait for the user, I disable stop and enable continue and step. The
change of enables used to be triggered by actually pressing the button,
but then if you started/stopped the simulation in some other way (typing
in debug log window) the enables were never changed. Now the enables are
controlled by the value of BXP_DEBUG_RUNNING, which is set by the debug code
itself, and the buttons are enabled at the right time.
- ParamDialog::Refresh() is now virtual so that child classes can redefine
its refresh behavior.
- in safeWxStrcpy, force the last element of the array to be a 0, since
I noticed that strncpy is not guaranteed to terminate the string!
- modified: debug/dbg_main.cc debug/debug.h gui/siminterface.cc
gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h gui/wxmain.cc
gui/wxmain.h
2002-09-15 15:21:35 +04:00
|
|
|
}
|
|
|
|
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
// How am I going to communicate with the debugger?
|
|
|
|
//
|
|
|
|
// The current model is that the debugger asks you for a command, and
|
|
|
|
// blocks forever until you press return. Then it interprets the command,
|
|
|
|
// however long it takes, and returns to the input loop when the command
|
|
|
|
// is done. A control-C can stop a command prematurely.
|
|
|
|
//
|
2004-10-03 13:11:28 +04:00
|
|
|
// To extend this into wxWidgets multithreaded space, I will create a
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
// synchronous event called BX_SYNC_GET_DBG_COMMAND which is sent from
|
2004-10-03 13:11:28 +04:00
|
|
|
// the simulation thread to wxWidgets. When the user chooses a debugger
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
// action (step, continue, breakpoint, etc.) the simulation awakens and
|
2003-11-28 18:07:29 +03:00
|
|
|
// interprets the event by calling a function in bx_debug/dbg_main.cc.
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
//
|
|
|
|
// The equivalent of a control-C is pressing the "Stop" button during
|
|
|
|
// a long step or continue command. This can be implemented by setting
|
|
|
|
// bx_guard.interrupt_requested = 1, just like the SIGINT handler in
|
2003-11-28 18:07:29 +03:00
|
|
|
// bx_debug/dbg_main.cc does.
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
//
|
|
|
|
// input loop model is good. Create a debugger input loop, possibly in
|
|
|
|
// siminterface.
|
|
|
|
// in the simulation thread. This loop waits for a command from the
|
2004-10-03 13:11:28 +04:00
|
|
|
// wxWidgets debugger
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
//
|
|
|
|
// For example, if you press the "Step" button 5
|
|
|
|
// times, with each click it should call bx_dbg_stepN_command(1) in the
|
|
|
|
// simulator thread. When it returns, it goes back to
|
|
|
|
//
|
|
|
|
void
|
|
|
|
CpuRegistersDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId ();
|
|
|
|
switch (id) {
|
2002-09-16 19:28:19 +04:00
|
|
|
case ID_Close:
|
2006-05-22 20:35:03 +04:00
|
|
|
Show(FALSE);
|
2002-09-16 19:28:19 +04:00
|
|
|
break;
|
|
|
|
#if BX_DEBUGGER
|
|
|
|
case ID_Debug_Stop:
|
2006-05-22 20:35:03 +04:00
|
|
|
wxLogDebug(wxT("wxWidgets triggered a break"));
|
|
|
|
theFrame->DebugBreak();
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
break;
|
|
|
|
case ID_Debug_Continue:
|
2006-05-22 20:35:03 +04:00
|
|
|
wxLogDebug(wxT("before calling DebugCommand"));
|
|
|
|
theFrame->DebugCommand("continue");
|
|
|
|
wxLogDebug(wxT("after calling DebugCommand"));
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
break;
|
|
|
|
case ID_Debug_Step:
|
2006-05-22 20:35:03 +04:00
|
|
|
theFrame->DebugCommand("step 1");
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
break;
|
|
|
|
case ID_Debug_Commit:
|
2006-05-22 20:35:03 +04:00
|
|
|
CopyGuiToParam();
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
break;
|
2002-09-16 19:28:19 +04:00
|
|
|
#endif
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
default:
|
2006-05-22 20:35:03 +04:00
|
|
|
ParamDialog::OnEvent(event);
|
- add infrastructure for sending commands from the wxWindows interface to the
Bochs debugger. The Bochs debugger calls SIM->debug_get_next_command() which
does not return until a debugger command is found. The siminterface sends an
synchronous event to the wxWindows thread with a blank to be filled in with a
debugger command. wxWindows fills in the blank and sends the synchronous
event back, and the Bochs debugger interprets it as if it was typed on
the command line. For the long term I haven't decided whether to stick with
sending text strings vs. some other method.
- so far the wxWindows debugger consists of one big dialog box that shows
all the standard registers, and a working Continue, Stop, and Step button.
- modify ParamDialog so that it is more useful as a base class, by moving
some things to protected members&fields, separating out functionality
that is most likely to be replaced into virtual functions, and making it
generally more flexible. The new CpuRegistersDialog is based on
ParamDialog.
- in wxdialog.cc, continue the convention of using wxID_HELP, wxID_OK,
wxID_CANCEL, etc. for the id's of buttons, instead of wxHELP, wxOK, etc.
which are intended to be ORred together in a bit field.
- cpu/init.cc: put ifdefs around DEFPARAMs for flags in configurations
where they don't exist. Add an eflags shadow parameter that represents all
of the bits of eflags at once. There are also boolean shadow params for
each bit.
- modified files: cpu/init.cc debug/dbg_main.cc debug/debug.h
gui/siminterface.cc gui/siminterface.h gui/wxdialog.cc gui/wxdialog.h
gui/wxmain.cc gui/wxmain.h
2002-09-13 23:39:38 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-11 13:00:56 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// LogOptionsDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(LogOptionsDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, LogOptionsDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, LogOptionsDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, LogOptionsDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
LogOptionsDialog::LogOptionsDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
|
|
|
: ParamDialog(parent, id)
|
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
static wxString names[] = LOG_OPTS_TYPE_NAMES;
|
2006-03-11 13:00:56 +03:00
|
|
|
SetTitle(LOG_OPTS_TITLE);
|
|
|
|
AddParam(SIM->get_param("log"));
|
|
|
|
wxStaticText *text = new wxStaticText(this, -1, LOG_OPTS_PROMPT);
|
|
|
|
mainSizer->Add(text, 0, wxALL, 10);
|
|
|
|
gridSizer = new wxFlexGridSizer (2);
|
|
|
|
mainSizer->Add(gridSizer, 1, wxLEFT, 40);
|
|
|
|
text = new wxStaticText (this, -1, LOG_OPTS_ADV);
|
|
|
|
mainSizer->Add(text, 0, wxTOP|wxLEFT, 20);
|
|
|
|
|
|
|
|
// gridSizer contents
|
|
|
|
gridSizer->AddGrowableCol(1);
|
|
|
|
for (int evtype=0; evtype<LOG_OPTS_N_TYPES; evtype++) {
|
|
|
|
gridSizer->Add(new wxStaticText (this, -1, names[evtype]), 0, wxALL, 5);
|
|
|
|
action[evtype] = makeLogOptionChoiceBox(this, -1, evtype, true);
|
|
|
|
gridSizer->Add(action[evtype], 1, wxALL|wxGROW|wxADJUST_MINSIZE, 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogOptionsDialog::SetAction(int evtype, int a) {
|
|
|
|
// find the choice whose client data matches "a".
|
|
|
|
int *ptr;
|
|
|
|
//wxLogDebug ("SetAction type=%d a=%d", evtype, a);
|
|
|
|
for (int i=0; i < action[evtype]->GetCount(); i++) {
|
|
|
|
//wxLogDebug ("reading action[%d]->GetClientData(%d)", evtype, i);
|
|
|
|
ptr = (int*) action[evtype]->GetClientData(i);
|
|
|
|
if (ptr == NULL) continue;
|
|
|
|
if (a == *ptr) { // found it!
|
|
|
|
action[evtype]->SetSelection(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// this can happen if one of the choices that is excluded by
|
|
|
|
// LOG_OPTS_EXCLUDE() is used, for example.
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("SetAction type=%d a=%d not found"), evtype, a);
|
2006-03-11 13:00:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int LogOptionsDialog::GetAction(int evtype) {
|
|
|
|
int sel = action[evtype]->GetSelection();
|
|
|
|
int *ptrToChoice = (int*)action[evtype]->GetClientData(sel);
|
|
|
|
wxASSERT(ptrToChoice != NULL);
|
|
|
|
return *ptrToChoice;
|
|
|
|
}
|
|
|
|
|
2002-09-03 02:53:39 +04:00
|
|
|
|
2002-08-30 03:28:52 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
// utility
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// Unfortunately this step is necessary if you change the text of
|
|
|
|
// a wxStaticText. Otherwise the sizer that contains the text never realizes
|
|
|
|
// that the size has changed, and the layout is never updated. The
|
|
|
|
// SetItemMinSize trick was reported on comp.soft-sys.wxwindows by
|
|
|
|
// Dirk Birnhardt.
|
|
|
|
void ChangeStaticText (wxSizer *sizer, wxStaticText *win, wxString newtext)
|
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
win->SetLabel(newtext);
|
|
|
|
wxSize sz = win->GetSize();
|
|
|
|
sizer->SetItemMinSize(win, sz.GetWidth(), sz.GetHeight());
|
2002-08-30 03:28:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateImage produces a disk image. It's in the utility function
|
|
|
|
// area because it's used by both floppy and hard disk image creation.
|
2002-08-30 03:18:10 +04:00
|
|
|
bool
|
2002-08-30 03:28:52 +04:00
|
|
|
CreateImage (int harddisk, int sectors, const char *filename)
|
2002-08-30 03:18:10 +04:00
|
|
|
{
|
|
|
|
if (sectors<1) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxMessageBox(wxT("The disk size is invalid."), wxT("Invalid Size"), wxOK | wxICON_ERROR);
|
2002-08-30 03:18:10 +04:00
|
|
|
return false;
|
|
|
|
}
|
2006-03-19 12:24:10 +03:00
|
|
|
wxLogDebug(wxT("filename = '%s'\n"), filename);
|
2002-08-30 03:18:10 +04:00
|
|
|
if (strlen (filename) < 1) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxMessageBox(wxT("You must type a file name for the new disk image."), wxT("Bad Filename"), wxOK | wxICON_ERROR);
|
2002-08-30 03:18:10 +04:00
|
|
|
return false;
|
|
|
|
}
|
2002-08-30 03:28:52 +04:00
|
|
|
// create disk image with name and capacity determined by the filename
|
|
|
|
// and sector args. Call SIM->create_image (filename, sectors, overwrite=0)
|
|
|
|
// first which will create the file if it doesn't already exist. If it
|
|
|
|
// exists, it will instead return -1, and we can ask the user "are you sure
|
|
|
|
// you want to overwrite?". If yes, call again with overwrite=1.
|
2002-08-30 03:18:10 +04:00
|
|
|
int ret = SIM->create_disk_image (filename, sectors, 0);
|
|
|
|
if (ret == -1) { // already exists
|
2006-03-19 12:24:10 +03:00
|
|
|
int answer = wxMessageBox(wxT("File exists. Do you want to overwrite it?"),
|
|
|
|
wxT("File exists"), wxYES_NO | wxCENTER);
|
2002-08-30 03:18:10 +04:00
|
|
|
if (answer == wxYES)
|
|
|
|
ret = SIM->create_disk_image (filename, sectors, 1);
|
|
|
|
else
|
|
|
|
return false; // wxNO
|
|
|
|
}
|
|
|
|
if (ret == -2) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxMessageBox(wxT("I could not create the disk image. Check for permission problems or available disk space."), wxT("Failed"), wxOK | wxICON_ERROR);
|
2002-08-30 03:18:10 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
wxASSERT (ret==0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-03-19 12:24:10 +03:00
|
|
|
void SetTextCtrl(wxTextCtrl *ctrl, const char *format, int val) {
|
2002-09-03 00:13:52 +04:00
|
|
|
wxString tmp;
|
2006-03-19 12:24:10 +03:00
|
|
|
tmp.Printf(wxString(format, wxConvUTF8), val);
|
|
|
|
ctrl->SetValue(tmp);
|
2002-09-03 00:13:52 +04:00
|
|
|
}
|
|
|
|
|
2002-09-03 02:12:31 +04:00
|
|
|
int GetTextCtrlInt (wxTextCtrl *ctrl,
|
|
|
|
bool *valid,
|
|
|
|
bool complain,
|
|
|
|
wxString complaint)
|
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
wxString tmp (ctrl->GetValue());
|
2002-09-03 00:13:52 +04:00
|
|
|
char buf[1024];
|
2006-03-19 12:24:10 +03:00
|
|
|
strncpy(buf, tmp.mb_str(wxConvUTF8), sizeof(buf));
|
|
|
|
int n = strtol(buf, NULL, 0);
|
2002-09-03 02:53:39 +04:00
|
|
|
if (n != LONG_MIN && n != LONG_MAX) {
|
2002-09-03 02:12:31 +04:00
|
|
|
if (valid) *valid = true;
|
|
|
|
return n;
|
|
|
|
}
|
2002-09-03 00:13:52 +04:00
|
|
|
if (valid) *valid = false;
|
|
|
|
if (complain) {
|
2006-03-19 12:24:10 +03:00
|
|
|
wxMessageBox(complaint, wxT("Invalid"), wxOK | wxICON_ERROR );
|
|
|
|
ctrl->SetFocus();
|
2002-09-03 00:13:52 +04:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-03-19 12:24:10 +03:00
|
|
|
bool BrowseTextCtrl(wxTextCtrl *text, wxString prompt, long style) {
|
2002-09-03 02:12:31 +04:00
|
|
|
// try to configure the dialog to show hidden files
|
2006-03-19 12:24:10 +03:00
|
|
|
wxConfigBase::Get() ->Write(wxT("/wxWidgets/wxFileDialog/ShowHidden"), true);
|
2006-03-18 19:30:52 +03:00
|
|
|
wxFileDialog *fdialog = new wxFileDialog (text->GetParent(), prompt, wxT(""), text->GetValue(), wxT("*.*"), style);
|
2005-11-26 12:22:58 +03:00
|
|
|
int result = fdialog->ShowModal();
|
|
|
|
if (result == wxID_OK)
|
2006-03-19 12:24:10 +03:00
|
|
|
text->SetValue(fdialog->GetPath());
|
2002-09-21 01:25:09 +04:00
|
|
|
delete fdialog;
|
2005-11-26 12:22:58 +03:00
|
|
|
return (result == wxID_OK);
|
2002-09-03 02:12:31 +04:00
|
|
|
}
|
2002-09-19 08:52:03 +04:00
|
|
|
|
|
|
|
wxChoice *makeLogOptionChoiceBox (wxWindow *parent,
|
|
|
|
wxWindowID id,
|
|
|
|
int evtype,
|
2002-09-20 21:53:14 +04:00
|
|
|
bool includeNoChange)
|
2002-09-19 08:52:03 +04:00
|
|
|
{
|
2006-03-19 12:24:10 +03:00
|
|
|
static wxString choices[] = LOG_OPTS_CHOICES;
|
2002-09-20 21:53:14 +04:00
|
|
|
static int integers[LOG_OPTS_N_CHOICES] = {0, 1, 2, 3, 4};
|
2006-03-19 12:24:10 +03:00
|
|
|
wxChoice *control = new wxChoice(parent, id, wxDefaultPosition, wxDefaultSize);
|
2002-09-19 08:52:03 +04:00
|
|
|
int lastChoice = 0; // remember index of last choice
|
2002-09-20 21:53:14 +04:00
|
|
|
int nchoice = includeNoChange? LOG_OPTS_N_CHOICES : LOG_OPTS_N_CHOICES_NORMAL;
|
|
|
|
for (int choice=0; choice<nchoice; choice++) {
|
2002-09-19 08:52:03 +04:00
|
|
|
// the exclude expression allows some choices to not be available
|
|
|
|
// for some times. For example, it would be stupid to ignore a panic.
|
2006-03-19 12:24:10 +03:00
|
|
|
if (!LOG_OPTS_EXCLUDE(evtype, choice)) {
|
|
|
|
control->Append(choices[choice], &integers[choice]);
|
2002-09-19 08:52:03 +04:00
|
|
|
// the client data is an int* that points to the choice number.
|
|
|
|
// This is what will be returned by GetAction().
|
|
|
|
lastChoice++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
control->SetSelection (lastChoice-1);
|
|
|
|
return control;
|
|
|
|
}
|
2002-11-19 08:47:45 +03:00
|
|
|
|
|
|
|
#endif /* if BX_WITH_WX */
|