2002-08-28 07:20:23 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2011-02-25 01:05:47 +03:00
|
|
|
// $Id$
|
2002-08-28 07:20:23 +04:00
|
|
|
/////////////////////////////////////////////////////////////////
|
2013-02-11 01:26:51 +04:00
|
|
|
//
|
2019-11-02 22:30:39 +03:00
|
|
|
// Copyright (C) 2002-2019 The Bochs Project
|
2013-01-23 21:56:57 +04:00
|
|
|
//
|
2014-01-04 00:46:59 +04:00
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-11-14 08:13:40 +03:00
|
|
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
2008-02-06 01:57:43 +03:00
|
|
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
2002-11-14 08:13:40 +03:00
|
|
|
// 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
|
2010-02-26 17:18:19 +03:00
|
|
|
#include "param_names.h"
|
|
|
|
|
2002-11-19 08:47:45 +03:00
|
|
|
#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
|
|
|
|
2019-11-02 22:30:39 +03:00
|
|
|
#if !defined(wxADJUST_MINSIZE)
|
|
|
|
#define wxADJUST_MINSIZE 0
|
|
|
|
#endif
|
|
|
|
|
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:
|
2008-02-06 01:57:43 +03:00
|
|
|
// vertSizer:
|
|
|
|
// context text field,
|
2002-08-28 11:54:53 +04:00
|
|
|
// message text field
|
|
|
|
// don't-ask checkbox
|
|
|
|
// buttonSizer:
|
2014-01-04 00:46:59 +04:00
|
|
|
// continue button
|
|
|
|
// die button
|
|
|
|
// dumpcore button
|
|
|
|
// debugger button
|
|
|
|
// help button
|
2002-08-28 11:54:53 +04:00
|
|
|
//
|
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)
|
2008-02-06 01:57:43 +03:00
|
|
|
: wxDialog (parent, id, title, wxDefaultPosition, wxDefaultSize,
|
2002-08-28 07:20:23 +04:00
|
|
|
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
|
|
|
}
|
|
|
|
SetAutoLayout(TRUE);
|
|
|
|
SetSizer(vertSizer);
|
2006-03-19 12:24:10 +03:00
|
|
|
vertSizer->Fit(this);
|
|
|
|
wxSize size = vertSizer->GetMinSize();
|
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)
|
|
|
|
{
|
2006-12-17 11:17:28 +03:00
|
|
|
int id = event.GetId();
|
2002-08-28 07:20:23 +04:00
|
|
|
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;
|
2006-12-17 11:17:28 +03:00
|
|
|
case wxID_HELP: ShowHelp(); return;
|
2002-08-28 07:20:23 +04:00
|
|
|
default:
|
|
|
|
return; // without EndModal
|
|
|
|
}
|
2006-12-17 11:17:28 +03:00
|
|
|
EndModal(ret);
|
2002-08-28 07:20:23 +04:00
|
|
|
}
|
|
|
|
|
2006-12-17 11:17:28 +03:00
|
|
|
void LogMsgAskDialog::ShowHelp()
|
2002-08-28 11:54:53 +04:00
|
|
|
{
|
2008-02-16 01:05:43 +03:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this);
|
2002-08-28 11:54:53 +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)
|
2008-02-06 01:57:43 +03:00
|
|
|
: wxDialog(parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
2002-09-19 08:52:03 +04:00
|
|
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
|
|
|
{
|
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);
|
2014-01-04 00:46:59 +04:00
|
|
|
logfileSizer->Add(text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
2006-03-26 19:52:31 +04:00
|
|
|
logfile = new wxTextCtrl(this, -1, wxT(""), wxDefaultPosition, longTextSize);
|
2014-01-04 00:46:59 +04:00
|
|
|
logfileSizer->Add(logfile, 0, wxALL | wxALIGN_CENTER_VERTICAL);
|
2006-03-26 19:52:31 +04:00
|
|
|
wxButton *btn = new wxButton(this, ID_Browse, BTNLABEL_BROWSE);
|
|
|
|
logfileSizer->Add(btn, 0, wxALL, 5);
|
2014-01-04 00:46:59 +04:00
|
|
|
if (runtime) {
|
|
|
|
text->Enable(false);
|
|
|
|
logfile->Enable(false);
|
|
|
|
btn->Enable(false);
|
|
|
|
}
|
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
|
2008-02-06 01:57:43 +03: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++) {
|
2012-02-23 21:16:35 +04:00
|
|
|
if (strcmp(SIM->get_logfn_name(dev), "?")) {
|
2006-10-21 19:36:07 +04:00
|
|
|
action[dev] = new wxChoice* [ADVLOG_OPTS_N_TYPES];
|
|
|
|
// name of device in first column
|
2014-01-04 00:46:59 +04:00
|
|
|
gridSizer->Add(new wxStaticText(scrollPanel, -1, wxString(SIM->get_logfn_name(dev), wxConvUTF8)),
|
|
|
|
0, wxALL | wxALIGN_CENTER_VERTICAL);
|
2006-10-21 19:36:07 +04:00
|
|
|
// 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
|
2008-02-06 01:57:43 +03:00
|
|
|
// width of the scrollWin. I tried several things before arriving at
|
2002-09-20 21:53:14 +04:00
|
|
|
// 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);
|
2014-01-04 00:46:59 +04:00
|
|
|
|
|
|
|
runtime = 0;
|
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();
|
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
|
|
|
}
|
|
|
|
|
2012-04-06 17:15:27 +04:00
|
|
|
void AdvancedLogOptionsDialog::CopyParamToGui()
|
|
|
|
{
|
2006-03-05 13:24:29 +03:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 00:46:59 +04: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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-04 00:46:59 +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];
|
2008-12-18 12:55:09 +03:00
|
|
|
for (int i=0; i < (int)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
|
2012-10-06 01:36:49 +04:00
|
|
|
// BX_LOG_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
|
|
|
}
|
|
|
|
|
2014-01-04 00:46:59 +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;
|
2008-02-06 01:57:43 +03:00
|
|
|
int sel = action[dev][evtype]->GetSelection();
|
2006-03-26 19:52:31 +04:00
|
|
|
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();
|
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++) {
|
2014-01-04 00:46:59 +04:00
|
|
|
int action = SIM->get_default_log_action(lev);
|
|
|
|
int dev, ndev = SIM->get_n_log_modules();
|
|
|
|
for (dev=0; dev<ndev; dev++)
|
|
|
|
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:
|
2008-02-06 01:57:43 +03:00
|
|
|
ShowHelp();
|
2002-09-19 08:52:03 +04:00
|
|
|
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
|
|
|
{
|
2008-02-16 01:05:43 +03:00
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this);
|
2002-09-19 08:52:03 +04:00
|
|
|
}
|
|
|
|
|
2012-02-21 16:00:54 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// PluginControlDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(PluginControlDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, PluginControlDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, PluginControlDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, PluginControlDialog::OnEvent)
|
|
|
|
EVT_LISTBOX(-1, PluginControlDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
PluginControlDialog::PluginControlDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
|
|
|
: wxDialog(parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxDEFAULT_DIALOG_STYLE)
|
|
|
|
{
|
|
|
|
SetTitle(wxT("Optional Plugin Control"));
|
|
|
|
vertSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
horzSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
listSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
editSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
horzSizer->Add(listSizer, 0, wxALIGN_LEFT);
|
|
|
|
horzSizer->Add(editSizer, 0, wxALIGN_RIGHT);
|
|
|
|
vertSizer->Add(horzSizer, 0, wxALIGN_LEFT);
|
|
|
|
vertSizer->Add(buttonSizer, 0, wxALIGN_CENTER);
|
|
|
|
// listSizer contents
|
|
|
|
pluglist = new wxListBox(this, ID_PluginList);
|
|
|
|
listSizer->Add(pluglist, 0, wxALL, 10);
|
|
|
|
// editSizer contents
|
|
|
|
plugname = new wxTextCtrl(this, ID_PluginName, wxT(""), wxDefaultPosition, wxSize(120, -1));
|
|
|
|
editSizer->Add(plugname, 0, wxALL, 10);
|
|
|
|
btn_load = new wxButton(this, ID_Load, wxT("Load"));
|
|
|
|
editSizer->Add(btn_load, 0, wxALL | wxALIGN_RIGHT, 5);
|
|
|
|
btn_unload = new wxButton(this, ID_Unload, wxT("Unload"));
|
|
|
|
editSizer->Add(btn_unload, 0, wxALL | wxALIGN_RIGHT, 5);
|
|
|
|
// buttonSizer contents
|
|
|
|
wxButton *btn = new wxButton(this, wxID_HELP, BTNLABEL_HELP);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
|
|
|
btn = new wxButton(this, wxID_OK, BTNLABEL_OK);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
2012-02-24 01:26:13 +04:00
|
|
|
// make sure all plugins are loaded and add them to the listbox
|
2012-07-06 21:19:32 +04:00
|
|
|
SIM->opt_plugin_ctrl("*", 1);
|
2012-02-21 16:00:54 +04:00
|
|
|
bx_list_c *plugin_ctrl = (bx_list_c*) SIM->get_param(BXPN_PLUGIN_CTRL);
|
2012-07-06 21:19:32 +04:00
|
|
|
for (int i = 0; i < plugin_ctrl->get_size(); i++) {
|
2012-02-24 01:26:13 +04:00
|
|
|
bx_param_bool_c *plugin = (bx_param_bool_c*)plugin_ctrl->get(i);
|
|
|
|
pluglist->Insert(wxString(plugin->get_name(), wxConvUTF8), i);
|
2012-02-21 16:00:54 +04:00
|
|
|
}
|
|
|
|
btn_load->Enable(0);
|
|
|
|
btn_unload->Enable(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginControlDialog::Init()
|
|
|
|
{
|
|
|
|
SetSizer(vertSizer);
|
|
|
|
vertSizer->Fit(this);
|
|
|
|
wxSize size = vertSizer->GetMinSize();
|
|
|
|
int margin = 5;
|
|
|
|
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
|
|
|
|
Center();
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginControlDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
int id = event.GetId();
|
|
|
|
switch (id) {
|
|
|
|
case ID_PluginList:
|
|
|
|
if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED) {
|
|
|
|
btn_unload->Enable(1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_PluginName:
|
|
|
|
if (event.GetEventType() == wxEVT_COMMAND_TEXT_UPDATED) {
|
|
|
|
btn_load->Enable(!plugname->IsEmpty());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_Load:
|
|
|
|
{
|
|
|
|
wxString tmpname(plugname->GetValue());
|
|
|
|
strncpy(buf, tmpname.mb_str(wxConvUTF8), sizeof(buf));
|
2015-01-07 19:17:40 +03:00
|
|
|
buf[sizeof(buf) - 1] = '\0';
|
2012-02-21 16:00:54 +04:00
|
|
|
if (SIM->opt_plugin_ctrl(buf, 1)) {
|
|
|
|
tmpname.Printf(wxT("Plugin '%s' loaded"), buf);
|
|
|
|
wxMessageBox(tmpname, wxT("Plugin Control"), wxOK | wxICON_INFORMATION, this);
|
2012-02-24 01:26:13 +04:00
|
|
|
pluglist->Insert(wxString(buf, wxConvUTF8), pluglist->GetCount());
|
2012-02-21 16:00:54 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ID_Unload:
|
|
|
|
{
|
|
|
|
int i = pluglist->GetSelection();
|
|
|
|
wxString tmpname = pluglist->GetString(i);
|
|
|
|
strncpy(buf, tmpname.mb_str(wxConvUTF8), sizeof(buf));
|
2015-01-07 19:17:40 +03:00
|
|
|
buf[sizeof(buf) - 1] = '\0';
|
2012-02-21 16:00:54 +04:00
|
|
|
if (SIM->opt_plugin_ctrl(buf, 0)) {
|
|
|
|
tmpname.Printf(wxT("Plugin '%s' unloaded"), buf);
|
|
|
|
wxMessageBox(tmpname, wxT("Plugin Control"), wxOK | wxICON_INFORMATION, this);
|
|
|
|
pluglist->Delete(i);
|
|
|
|
btn_unload->Enable(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case wxID_OK:
|
|
|
|
EndModal(wxID_OK);
|
|
|
|
break;
|
|
|
|
case wxID_HELP:
|
|
|
|
ShowHelp();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void PluginControlDialog::ShowHelp()
|
|
|
|
{
|
|
|
|
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this);
|
|
|
|
}
|
|
|
|
|
2014-01-12 23:27:01 +04:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// LogViewDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(LogViewDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, LogViewDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
LogViewDialog::LogViewDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
|
|
|
: wxDialog(parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxDEFAULT_DIALOG_STYLE)
|
|
|
|
{
|
|
|
|
lengthMax = LOG_VIEW_DEFAULT_LENGTH_MAX;
|
|
|
|
lengthTolerance = LOG_VIEW_DEFAULT_TOLERANCE;
|
|
|
|
SetTitle(wxT("Bochs Log Viewer"));
|
|
|
|
mainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
logSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
buttonSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
mainSizer->Add(logSizer, 0, wxALIGN_CENTER);
|
|
|
|
mainSizer->Add(buttonSizer, 0, wxALIGN_CENTER);
|
2014-12-07 02:10:11 +03:00
|
|
|
log = new wxTextCtrl(this, -1, wxT(""),
|
2014-01-12 23:27:01 +04:00
|
|
|
wxDefaultPosition, wxSize(575, 300),
|
|
|
|
wxTE_MULTILINE | wxTE_RICH | wxTE_READONLY);
|
|
|
|
wxFont font(8, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
|
|
|
wxTextAttr attr;
|
|
|
|
attr.SetFont(font);
|
|
|
|
log->SetDefaultStyle(attr);
|
|
|
|
logSizer->Add(log, 1, wxALL|wxGROW, 10);
|
|
|
|
// buttonSizer contents
|
|
|
|
wxButton *btn = new wxButton(this, wxID_OK, BTNLABEL_CLOSE);
|
|
|
|
buttonSizer->Add(btn, 0, wxALL, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogViewDialog::Init()
|
|
|
|
{
|
|
|
|
SetSizer(mainSizer);
|
|
|
|
mainSizer->Fit(this);
|
|
|
|
wxSize size = mainSizer->GetMinSize();
|
|
|
|
int margin = 5;
|
|
|
|
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
|
|
|
|
Center();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LogViewDialog::Show(bool val)
|
|
|
|
{
|
|
|
|
SIM->set_log_viewer(val);
|
|
|
|
if (val) wxDialog::Raise();
|
|
|
|
return wxDialog::Show(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogViewDialog::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.
|
|
|
|
for (Bit32u i = len - lengthMax; i<len-1; i++) {
|
|
|
|
if (str.GetChar(i) == '\n') {
|
|
|
|
// remove the \n and everything before it.
|
|
|
|
log->Remove(0, i+1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// no newline found?!
|
|
|
|
log->Remove(0, len - lengthMax);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-13 22:03:40 +04:00
|
|
|
void LogViewDialog::AppendText(int level, wxString msg)
|
2014-01-12 23:27:01 +04:00
|
|
|
{
|
|
|
|
if ((level == LOGLEV_ERROR) || (level == LOGLEV_PANIC)) {
|
|
|
|
log->SetDefaultStyle(wxTextAttr(*wxRED));
|
|
|
|
} else {
|
|
|
|
log->SetDefaultStyle(wxTextAttr(*wxBLACK));
|
|
|
|
}
|
|
|
|
log->AppendText(msg);
|
|
|
|
int n = log->GetLastPosition();
|
|
|
|
if (n>0) n--;
|
|
|
|
log->ShowPosition(n);
|
|
|
|
CheckLogLength();
|
|
|
|
}
|
|
|
|
|
|
|
|
void LogViewDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
switch (id) {
|
|
|
|
case wxID_OK:
|
|
|
|
Show(false);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- 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)
|
2013-12-08 15:32:13 +04: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)
|
|
|
|
{
|
2013-12-08 15:32:13 +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
|
2013-12-08 15:32:13 +04:00
|
|
|
mainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
|
|
|
|
// info sizer only used in floppy and log options dialog
|
|
|
|
infoSizer = 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
|
|
|
|
- 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.
|
2013-12-08 15:32:13 +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();
|
2017-06-04 12:32:58 +03:00
|
|
|
wxHashTable::Node *node;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-12-08 15:32:13 +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
|
|
|
{
|
2013-12-08 15:32:13 +04:00
|
|
|
wxButton *btn = new wxButton(this, id, label);
|
|
|
|
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.
|
2013-12-08 15:32:13 +04:00
|
|
|
void ParamDialog::AddDefaultButtons()
|
- 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
|
|
|
{
|
2013-12-08 15:32:13 +04:00
|
|
|
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()
|
|
|
|
{
|
2013-12-08 15:32:13 +04:00
|
|
|
// add info sizer if present
|
|
|
|
if (infoSizer != NULL) {
|
|
|
|
mainSizer->Add(infoSizer, 0, wxALIGN_CENTER);
|
|
|
|
}
|
- 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();
|
- 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;
|
|
|
|
|
2013-11-29 20:37:50 +04:00
|
|
|
int ParamDialog::genId()
|
|
|
|
{
|
- 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 ++_next_id;
|
|
|
|
}
|
|
|
|
|
2013-11-29 20:37:50 +04:00
|
|
|
bool ParamDialog::isGeneratedId(int id)
|
|
|
|
{
|
|
|
|
return (id >= ID_LAST_USER_DEFINED && id <= _next_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
|
|
|
}
|
|
|
|
|
2008-12-18 12:55:09 +03:00
|
|
|
void ParamDialog::AddParamList(const 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.
|
2013-12-08 15:32:13 +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;
|
2013-12-08 15:32:13 +04:00
|
|
|
AddParam(param, plain, &context);
|
- 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
|
|
|
}
|
|
|
|
|
2013-12-08 15:32:13 +04:00
|
|
|
void ParamDialog::AddParam(
|
- 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_param_c *param_generic,
|
|
|
|
bool plain,
|
2008-02-06 01:57:43 +03:00
|
|
|
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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
wxASSERT(context->parent != NULL);
|
|
|
|
wxASSERT(context->vertSizer != NULL);
|
2008-02-06 01:57:43 +03:00
|
|
|
if (param_generic == 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
|
|
|
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) {
|
2008-02-06 01:57:43 +03:00
|
|
|
// create a gridSizer if none exists yet. add it to default vertSizer.
|
2013-12-08 15:32:13 +04:00
|
|
|
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
|
|
|
|
2013-12-08 15:32:13 +04:00
|
|
|
ParamStruct *pstr = new ParamStruct();
|
- 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->param = param_generic;
|
2013-12-08 15:32:13 +04:00
|
|
|
pstr->id = 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->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;
|
2011-03-20 00:40:07 +03:00
|
|
|
prompt = list->get_title();
|
2006-02-19 18:43:03 +03:00
|
|
|
} 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();
|
2013-12-08 15:32:13 +04:00
|
|
|
wxASSERT(prompt != NULL);
|
2014-01-04 00:46:59 +04:00
|
|
|
#define ADD_LABEL(x) sizer->Add(pstr->label = new wxStaticText(context->parent, -1, wxString(x, wxConvUTF8)), 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|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) {
|
2013-12-08 15:32:13 +04:00
|
|
|
case BXT_PARAM_BOOL:
|
|
|
|
{
|
|
|
|
bx_param_bool_c *param = (bx_param_bool_c*) param_generic;
|
|
|
|
if (!plain) ADD_LABEL(prompt);
|
|
|
|
wxCheckBox *ckbx = new wxCheckBox(context->parent, pstr->id, wxT(""));
|
|
|
|
ckbx->SetValue(param->get());
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) ckbx->SetToolTip(wxString(description, wxConvUTF8));
|
2013-12-08 15:32:13 +04:00
|
|
|
sizer->Add(ckbx, 0, wxALL, 2);
|
|
|
|
if (!plain) sizer->Add(1, 1); // spacer
|
|
|
|
pstr->u.checkbox = ckbx;
|
|
|
|
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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
case BXT_PARAM_NUM:
|
|
|
|
{
|
|
|
|
bx_param_num_c *param = (bx_param_num_c*) param_generic;
|
|
|
|
if (!plain) ADD_LABEL(prompt);
|
|
|
|
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));
|
2013-12-08 15:32:13 +04:00
|
|
|
sizer->Add(spinctrl, 0, wxALL, 2);
|
|
|
|
if (!plain) sizer->Add(1, 1); // spacer
|
2003-09-06 02:07:54 +04:00
|
|
|
pstr->u.spin = spinctrl;
|
|
|
|
} else {
|
2013-12-08 15:32:13 +04:00
|
|
|
wxTextCtrl *textctrl = new wxTextCtrl(context->parent, pstr->id, wxT(""), wxDefaultPosition, normalTextSize);
|
|
|
|
const char *format = param->get_format();
|
2003-09-06 02:07:54 +04:00
|
|
|
if (!format)
|
2013-12-08 15:32:13 +04:00
|
|
|
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));
|
2013-12-08 15:32:13 +04:00
|
|
|
sizer->Add(textctrl, 0, wxALL, 2);
|
|
|
|
if (!plain) sizer->Add(1, 1); // spacer
|
2003-09-06 02:07:54 +04:00
|
|
|
pstr->u.text = textctrl;
|
|
|
|
}
|
2013-12-08 15:32:13 +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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
case BXT_PARAM_ENUM:
|
|
|
|
{
|
|
|
|
bx_param_enum_c *param = (bx_param_enum_c*) param_generic;
|
|
|
|
if (!plain) ADD_LABEL(prompt);
|
|
|
|
wxChoice *choice = new wxChoice(context->parent, pstr->id);
|
2006-03-19 12:24:10 +03:00
|
|
|
if (description) choice->SetToolTip(wxString(description, wxConvUTF8));
|
2013-12-08 15:32:13 +04:00
|
|
|
sizer->Add(choice, 0, wxADJUST_MINSIZE, 2);
|
|
|
|
if (!plain) sizer->Add(1, 1); // spacer
|
|
|
|
// fill in the choices
|
|
|
|
int i=0;
|
|
|
|
const char *ptr;
|
|
|
|
while (NULL != (ptr = param->get_choice(i++)))
|
|
|
|
choice->Append(wxString(ptr, wxConvUTF8));
|
|
|
|
choice->SetSelection(param->get() - param->get_min());
|
|
|
|
pstr->u.choice = choice;
|
|
|
|
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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
case BXT_PARAM_STRING:
|
2018-01-19 23:27:04 +03:00
|
|
|
case BXT_PARAM_BYTESTRING:
|
2013-12-08 15:32:13 +04:00
|
|
|
{
|
2013-02-01 23:13:58 +04:00
|
|
|
bx_param_string_c *param = (bx_param_string_c*) param_generic;
|
|
|
|
char value[1024];
|
|
|
|
if (!plain) ADD_LABEL(prompt);
|
2009-03-16 00:16:17 +03:00
|
|
|
bool isFilename = param->get_options() & param->IS_FILENAME;
|
2013-11-29 20:37:50 +04: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));
|
2018-01-10 23:05:59 +03:00
|
|
|
param->dump_param(value, 1024);
|
2013-02-01 23:13:58 +04:00
|
|
|
txtctrl->SetValue(wxString(value, wxConvUTF8));
|
2018-01-19 23:27:04 +03:00
|
|
|
if (type != BXT_PARAM_BYTESTRING) {
|
2006-03-19 12:24:10 +03:00
|
|
|
txtctrl->SetMaxLength(param->get_maxsize());
|
2003-08-25 19:21:19 +04:00
|
|
|
}
|
2013-11-29 20:37:50 +04:00
|
|
|
sizer->Add(txtctrl, 0, wxALL, 2);
|
2013-02-01 23:13:58 +04:00
|
|
|
if (!plain) {
|
|
|
|
if (isFilename) {
|
|
|
|
// create Browse button
|
2013-11-29 20:37:50 +04:00
|
|
|
pstr->browseButtonId = genId();
|
|
|
|
pstr->browseButton = new wxButton(context->parent,
|
2013-02-01 23:13:58 +04:00
|
|
|
pstr->browseButtonId, BTNLABEL_BROWSE);
|
2013-11-29 20:37:50 +04:00
|
|
|
sizer->Add(pstr->browseButton, 0, wxALL, 2);
|
|
|
|
idHash->Put(pstr->browseButtonId, pstr); // register under button id
|
2013-02-01 23:13:58 +04:00
|
|
|
} else {
|
2013-11-29 20:37:50 +04:00
|
|
|
sizer->Add(1, 1); // spacer
|
2013-02-01 23:13:58 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pstr->u.text = txtctrl;
|
2013-11-29 20:37:50 +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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
case BXT_LIST:
|
|
|
|
{
|
2013-11-29 20:37:50 +04:00
|
|
|
bx_list_c *list = (bx_list_c*) param_generic;
|
2009-03-16 00:16:17 +03:00
|
|
|
if (list->get_options() & bx_list_c::USE_TAB_WINDOW) {
|
2013-11-29 20:37:50 +04:00
|
|
|
// put each item in a separate tab of a tabbed window
|
|
|
|
wxNotebook *notebook = new wxNotebook(context->parent, -1);
|
2005-05-17 22:07:04 +04:00
|
|
|
#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION < 6
|
2013-11-29 20:37:50 +04:00
|
|
|
wxNotebookSizer *nbsizer = new wxNotebookSizer(notebook);
|
2005-05-17 22:07:04 +04:00
|
|
|
#endif
|
2013-11-29 20:37:50 +04:00
|
|
|
// put all items in the list into a separate page of the notebook.
|
|
|
|
for (int i=0; i<list->get_size(); i++) {
|
|
|
|
bx_list_c *child = (bx_list_c*)list->get(i);
|
|
|
|
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.
|
|
|
|
wxPanel *panel = new wxPanel(notebook);
|
|
|
|
wxBoxSizer *boxsz = new wxBoxSizer(wxVERTICAL);
|
|
|
|
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);
|
|
|
|
const char *pagename = child->get_title();
|
|
|
|
if (!pagename) pagename = child->get_name();
|
|
|
|
panel->SetAutoLayout(TRUE);
|
|
|
|
panel->SetSizer(boxsz);
|
|
|
|
notebook->AddPage(panel, wxString(pagename, wxConvUTF8));
|
|
|
|
}
|
2005-05-17 22:07:04 +04:00
|
|
|
#if wxMAJOR_VERSION == 2 && wxMINOR_VERSION < 6
|
2013-11-29 20:37:50 +04:00
|
|
|
context->vertSizer->Add(nbsizer, 0, wxALL|wxGROW, 10);
|
2005-05-17 22:07:04 +04:00
|
|
|
#else
|
2013-11-29 20:37:50 +04:00
|
|
|
context->vertSizer->Add(notebook, 0, wxALL|wxGROW, 10);
|
2005-05-17 22:07:04 +04:00
|
|
|
#endif
|
2013-11-29 20:37:50 +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;
|
|
|
|
idHash->Put(pstr->id, pstr);
|
|
|
|
paramHash->Put(pstr->param->get_id(), pstr);
|
|
|
|
} else {
|
2003-08-23 19:28:06 +04:00
|
|
|
wxString boxTitle;
|
2013-12-10 23:34:56 +04:00
|
|
|
wxScrolledWindow *scrollWin = NULL;
|
|
|
|
wxPanel *scrollPanel = NULL;
|
|
|
|
wxBoxSizer *scrollsz = NULL;
|
|
|
|
wxStaticBox *box = NULL;
|
|
|
|
wxStaticBoxSizer *boxsz = NULL;
|
2009-03-16 00:16:17 +03:00
|
|
|
if (list->get_options() & bx_list_c::USE_BOX_TITLE) {
|
2006-03-19 12:24:10 +03:00
|
|
|
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
|
|
|
}
|
2013-11-29 20:37:50 +04:00
|
|
|
AddParamContext newcontext;
|
|
|
|
newcontext.depth = 1 + context->depth;
|
|
|
|
newcontext.gridSizer = NULL; // it will be created if necessary
|
2013-12-10 23:34:56 +04:00
|
|
|
if (list->get_options() & bx_list_c::USE_SCROLL_WINDOW) {
|
|
|
|
scrollWin = new wxScrolledWindow(context->parent, -1);
|
|
|
|
scrollPanel = new wxPanel(scrollWin, -1);
|
|
|
|
scrollsz = new wxBoxSizer(wxVERTICAL);
|
|
|
|
newcontext.parent = scrollPanel;
|
|
|
|
newcontext.vertSizer = scrollsz;
|
|
|
|
} else {
|
|
|
|
box = new wxStaticBox(context->parent, -1, boxTitle);
|
|
|
|
boxsz = new wxStaticBoxSizer(box, wxVERTICAL);
|
|
|
|
newcontext.parent = context->parent;
|
|
|
|
newcontext.vertSizer = boxsz;
|
|
|
|
}
|
2013-11-29 20:37:50 +04:00
|
|
|
// 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);
|
|
|
|
}
|
2013-12-10 23:34:56 +04:00
|
|
|
if (list->get_options() & bx_list_c::USE_SCROLL_WINDOW) {
|
|
|
|
scrollPanel->SetAutoLayout(TRUE);
|
|
|
|
scrollPanel->SetSizer(scrollsz);
|
|
|
|
scrollsz->Fit(scrollPanel);
|
|
|
|
scrollsz->SetSizeHints(scrollPanel);
|
|
|
|
wxSize size = scrollPanel->GetBestSize();
|
|
|
|
scrollWin->SetScrollbars(1, 1, size.GetWidth(), size.GetHeight());
|
|
|
|
context->vertSizer->Add(scrollWin, 0, wxALL|wxGROW, 10);
|
|
|
|
context->vertSizer->SetItemMinSize(scrollWin, size.GetWidth() + 30, 400);
|
|
|
|
} else {
|
|
|
|
// add the boxsz to vertSizer
|
|
|
|
context->vertSizer->Add(boxsz, 0, wxALL|wxGROW, 10);
|
|
|
|
}
|
2013-11-29 20:37:50 +04:00
|
|
|
// 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
|
|
|
{
|
2013-12-01 20:02:31 +04:00
|
|
|
bx_bool sim_running = 0;
|
|
|
|
|
|
|
|
if (runtime) {
|
|
|
|
sim_running = theFrame->SimThreadControl(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
|
|
|
// loop through all the parameters
|
2006-03-18 19:30:52 +03:00
|
|
|
idHash->BeginFind();
|
2017-06-04 12:32:58 +03:00
|
|
|
wxHashTable::Node *node;
|
|
|
|
while ((node = idHash->Next()) != NULL) {
|
2006-03-18 19:30:52 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
|
|
|
wxLogDebug(wxT("commit changes for param %s"), pstr->param->get_name());
|
2009-04-05 12:33:27 +04:00
|
|
|
CopyGuiToParam(pstr->param);
|
|
|
|
if (pstr->param->get_type() == BXT_LIST) break;
|
2013-12-01 20:02:31 +04:00
|
|
|
}
|
|
|
|
if (runtime && sim_running) {
|
|
|
|
SIM->update_runtime_options();
|
|
|
|
theFrame->SimThreadControl(1);
|
2009-04-05 12:33:27 +04:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ParamDialog::CopyGuiToParam(bx_param_c *param)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (param == NULL) return false;
|
|
|
|
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param->get_id());
|
|
|
|
wxLogDebug(wxT("commit changes for param %s"), param->get_name());
|
|
|
|
int type = param->get_type();
|
|
|
|
switch (type) {
|
|
|
|
case BXT_PARAM_BOOL: {
|
|
|
|
bx_param_bool_c *boolp = (bx_param_bool_c*) pstr->param;
|
|
|
|
bool val = pstr->u.checkbox->GetValue();
|
|
|
|
if (val != boolp->get()) boolp->set(val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_NUM: {
|
|
|
|
bx_param_num_c *nump = (bx_param_num_c*) pstr->param;
|
|
|
|
bool valid;
|
|
|
|
int n;
|
|
|
|
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();
|
|
|
|
} else {
|
|
|
|
n = GetTextCtrlInt(pstr->u.text, &valid, true, complaint);
|
2008-02-16 01:05:43 +03:00
|
|
|
}
|
2009-04-05 12:33:27 +04:00
|
|
|
if ((n < nump->get_min()) || (n > nump->get_max())) {
|
|
|
|
wxMessageBox(wxT("Numerical parameter out of range"), wxT("Error"), wxOK | wxICON_ERROR, this);
|
|
|
|
return false;
|
2008-02-16 01:05:43 +03:00
|
|
|
}
|
2009-04-05 12:33:27 +04:00
|
|
|
if (n != nump->get()) nump->set(n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_ENUM: {
|
|
|
|
bx_param_enum_c *enump = (bx_param_enum_c*) pstr->param;
|
|
|
|
int value = pstr->u.choice->GetSelection() + enump->get_min();
|
|
|
|
if (value != enump->get()) enump->set(value);
|
|
|
|
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());
|
2018-01-19 23:27:04 +03:00
|
|
|
strncpy(buf, tmp.mb_str(wxConvUTF8), sizeof(buf));
|
|
|
|
buf[sizeof(buf)-1] = 0;
|
|
|
|
if (!stringp->equals(buf)) stringp->set(buf);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case BXT_PARAM_BYTESTRING: {
|
|
|
|
bx_param_bytestring_c *stringp = (bx_param_bytestring_c*) pstr->param;
|
|
|
|
wxString tmp(pstr->u.text->GetValue());
|
|
|
|
char src[1024];
|
|
|
|
strcpy(src, tmp.mb_str(wxConvUTF8));
|
2018-02-05 01:20:46 +03:00
|
|
|
if (!stringp->parse_param(src)) {
|
|
|
|
wxMessageBox(wxT("Illegal raw byte format"), wxT("Error"), wxOK | wxICON_ERROR, this);
|
|
|
|
return false;
|
2008-02-16 01:05:43 +03:00
|
|
|
}
|
2009-04-05 12:33:27 +04:00
|
|
|
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
|
|
|
}
|
2009-04-05 12:33:27 +04:00
|
|
|
case BXT_LIST: {
|
|
|
|
bx_list_c *list = (bx_list_c*) param;
|
|
|
|
for (i = 0; i < list->get_size(); i++) {
|
|
|
|
bx_param_c *item = list->get(i);
|
|
|
|
if (!CopyGuiToParam(item)) break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
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();
|
2017-06-04 12:32:58 +03:00
|
|
|
wxHashTable::Node *node;
|
|
|
|
while ((node = idHash->Next()) != NULL) {
|
2006-03-03 23:29:50 +03:00
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-18 09:07:53 +03:00
|
|
|
void ParamDialog::EnableChanged(ParamStruct *pstr)
|
2002-09-03 12:53:41 +04:00
|
|
|
{
|
2009-03-20 19:23:46 +03:00
|
|
|
wxLogDebug(wxT("EnableChanged on param %s"), pstr->param->get_name());
|
|
|
|
ProcessDependentList(pstr, true);
|
2002-09-23 00:56:12 +04:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2009-03-20 19:23:46 +03:00
|
|
|
void ParamDialog::ProcessDependentList(ParamStruct *pstrChanged, bool enabled)
|
2006-02-26 22:11:20 +03:00
|
|
|
{
|
2009-03-29 17:26:07 +04:00
|
|
|
bx_param_c *dparam;
|
2009-03-20 19:23:46 +03:00
|
|
|
ParamStruct *pstr;
|
|
|
|
Bit64s value;
|
|
|
|
bool en;
|
|
|
|
int i;
|
2006-02-26 22:11:20 +03:00
|
|
|
|
2009-03-20 19:23:46 +03:00
|
|
|
bx_list_c *list = pstrChanged->param->get_dependent_list();
|
2009-03-18 21:57:37 +03:00
|
|
|
if (list) {
|
2009-03-20 19:23:46 +03:00
|
|
|
if (pstrChanged->param->get_type() == BXT_PARAM_ENUM) {
|
|
|
|
bx_param_enum_c *enump = (bx_param_enum_c*)pstrChanged->param;
|
|
|
|
value = pstrChanged->u.choice->GetSelection() + enump->get_min();
|
|
|
|
Bit64u enable_bitmap = enump->get_dependent_bitmap(value);
|
|
|
|
Bit64u mask = 0x1;
|
|
|
|
for (i = 0; i < list->get_size(); i++) {
|
2009-03-29 17:26:07 +04:00
|
|
|
dparam = list->get(i);
|
|
|
|
if (dparam != enump) {
|
2009-03-20 19:23:46 +03:00
|
|
|
en = (enable_bitmap & mask) && enabled;
|
2009-03-29 17:26:07 +04:00
|
|
|
pstr = (ParamStruct*) paramHash->Get(dparam->get_id());
|
2009-03-20 19:23:46 +03:00
|
|
|
if (pstr) {
|
|
|
|
if (en != pstr->u.window->IsEnabled()) {
|
2009-03-29 17:26:07 +04:00
|
|
|
EnableParam(dparam->get_id(), en);
|
2009-03-20 19:23:46 +03:00
|
|
|
ProcessDependentList(pstr, en);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mask <<= 1;
|
|
|
|
}
|
|
|
|
} else if ((pstrChanged->param->get_type() == BXT_PARAM_BOOL) ||
|
2009-03-29 17:26:07 +04:00
|
|
|
(pstrChanged->param->get_type() == BXT_PARAM_NUM) ||
|
2018-01-19 23:27:04 +03:00
|
|
|
(pstrChanged->param->get_type() == BXT_PARAM_STRING) ||
|
|
|
|
(pstrChanged->param->get_type() == BXT_PARAM_BYTESTRING)) {
|
2009-03-29 17:26:07 +04:00
|
|
|
bx_param_c *param = pstrChanged->param;
|
|
|
|
if (param->get_type() == BXT_PARAM_BOOL) {
|
2009-03-20 19:23:46 +03:00
|
|
|
value = pstrChanged->u.checkbox->GetValue();
|
2009-03-29 17:26:07 +04:00
|
|
|
} else if (param->get_type() == BXT_PARAM_NUM) {
|
|
|
|
bx_param_num_c *nump = (bx_param_num_c*)param;
|
2009-03-20 19:23:46 +03:00
|
|
|
if (nump->get_options() & nump->USE_SPIN_CONTROL) {
|
|
|
|
value = (pstrChanged->u.spin->GetValue() > 0);
|
|
|
|
} else {
|
|
|
|
bool valid;
|
|
|
|
value = (GetTextCtrlInt(pstrChanged->u.text, &valid, true, wxT("")) > 0);
|
|
|
|
}
|
2009-03-29 17:26:07 +04:00
|
|
|
} else {
|
|
|
|
wxString tmp(pstrChanged->u.text->GetValue());
|
|
|
|
value = !tmp.IsEmpty() && tmp.compare(wxT("none"));
|
2009-03-20 19:23:46 +03:00
|
|
|
}
|
|
|
|
for (i = 0; i < list->get_size(); i++) {
|
2009-03-29 17:26:07 +04:00
|
|
|
dparam = list->get(i);
|
|
|
|
if (dparam != param) {
|
2009-03-20 19:23:46 +03:00
|
|
|
en = (value && enabled);
|
2009-03-29 17:26:07 +04:00
|
|
|
pstr = (ParamStruct*) paramHash->Get(dparam->get_id());
|
2009-03-20 19:23:46 +03:00
|
|
|
if (pstr) {
|
|
|
|
if (en != pstr->u.window->IsEnabled()) {
|
2009-03-29 17:26:07 +04:00
|
|
|
EnableParam(dparam->get_id(), en);
|
2009-03-20 19:23:46 +03:00
|
|
|
ProcessDependentList(pstr, en);
|
|
|
|
}
|
2009-03-18 21:57:37 +03:00
|
|
|
}
|
2004-01-06 01:18:01 +03:00
|
|
|
}
|
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
|
2009-03-18 21:57:37 +03: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
|
2013-12-08 15:32:13 +04:00
|
|
|
idHash->BeginFind();
|
2017-06-04 12:32:58 +03:00
|
|
|
wxHashTable::Node *node;
|
|
|
|
while ((node = idHash->Next()) != NULL) {
|
2013-12-08 15:32:13 +04:00
|
|
|
ParamStruct *pstr = (ParamStruct*) node->GetData();
|
2006-03-19 12:24:10 +03:00
|
|
|
IFDBG_DLG(wxLogDebug(wxT("refresh param %s"), pstr->param->get_name()));
|
2013-12-08 15:32:13 +04:00
|
|
|
int type = pstr->param->get_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
|
|
|
switch (type) {
|
|
|
|
case BXT_PARAM_BOOL: {
|
|
|
|
bx_param_bool_c *boolp = (bx_param_bool_c*) pstr->param;
|
2009-03-18 21:57:37 +03:00
|
|
|
pstr->u.checkbox->SetValue(boolp->get());
|
|
|
|
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
|
|
|
}
|
|
|
|
case BXT_PARAM_NUM: {
|
|
|
|
bx_param_num_c *nump = (bx_param_num_c*) pstr->param;
|
2009-03-18 21:57:37 +03:00
|
|
|
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;
|
- 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
|
|
|
}
|
|
|
|
case BXT_PARAM_ENUM: {
|
|
|
|
bx_param_enum_c *enump = (bx_param_enum_c*) pstr->param;
|
2009-03-18 21:57:37 +03:00
|
|
|
pstr->u.choice->SetSelection(enump->get() - enump->get_min());
|
|
|
|
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
|
|
|
}
|
2018-01-19 23:27:04 +03:00
|
|
|
case BXT_PARAM_STRING:
|
|
|
|
case BXT_PARAM_BYTESTRING: {
|
- 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
|
|
|
bx_param_string_c *stringp = (bx_param_string_c*) pstr->param;
|
2009-03-18 21:57:37 +03:00
|
|
|
pstr->u.text->SetValue(wxString(stringp->getptr(), wxConvUTF8));
|
|
|
|
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
|
|
|
}
|
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)
|
|
|
|
{
|
2006-12-17 11:17:28 +03:00
|
|
|
int id = event.GetId();
|
|
|
|
if (isGeneratedId(id)) {
|
|
|
|
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()));
|
2013-12-08 15:32:13 +04:00
|
|
|
switch (pstr->param->get_type()) {
|
2009-03-18 09:07:53 +03:00
|
|
|
case BXT_PARAM_BOOL:
|
|
|
|
case BXT_PARAM_NUM:
|
|
|
|
case BXT_PARAM_ENUM:
|
2009-03-29 17:26:07 +04:00
|
|
|
case BXT_PARAM_STRING:
|
2018-01-19 23:27:04 +03:00
|
|
|
case BXT_PARAM_BYTESTRING:
|
2009-03-20 19:23:46 +03:00
|
|
|
EnableChanged(pstr);
|
2009-03-18 09:07:53 +03:00
|
|
|
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:
|
2009-04-05 12:33:27 +04:00
|
|
|
if (IsModal()) {
|
|
|
|
if (CopyGuiToParam())
|
2013-12-08 15:32:13 +04:00
|
|
|
EndModal(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
|
|
|
} else {
|
2009-04-05 12:33:27 +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:
|
2013-12-08 15:32:13 +04:00
|
|
|
if (IsModal())
|
|
|
|
EndModal(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
|
|
|
else
|
2013-12-08 15:32:13 +04:00
|
|
|
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:
|
2008-02-06 01:57:43 +03:00
|
|
|
ShowHelp();
|
- 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;
|
|
|
|
default:
|
2013-12-08 15:32:13 +04:00
|
|
|
event.Skip();
|
- 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void ParamDialog::ShowHelp()
|
- 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
|
|
|
{
|
2008-02-16 01:05:43 +03: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
|
|
|
}
|
|
|
|
|
2009-03-28 01:22:07 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// FloppyConfigDialog implementation
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// all events go to OnEvent method
|
|
|
|
BEGIN_EVENT_TABLE(FloppyConfigDialog, wxDialog)
|
|
|
|
EVT_BUTTON(-1, FloppyConfigDialog::OnEvent)
|
|
|
|
EVT_CHECKBOX(-1, FloppyConfigDialog::OnEvent)
|
|
|
|
EVT_CHOICE(-1, FloppyConfigDialog::OnEvent)
|
|
|
|
EVT_TEXT(-1, FloppyConfigDialog::OnEvent)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
FloppyConfigDialog::FloppyConfigDialog(
|
|
|
|
wxWindow* parent,
|
|
|
|
wxWindowID id)
|
|
|
|
: ParamDialog(parent, id)
|
|
|
|
{
|
2013-12-08 15:32:13 +04:00
|
|
|
infoSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
infoSizer->Add(new wxStaticText(this, -1, wxString("Clicking OK signals a media change for this drive.", wxConvUTF8)), 0, wxALIGN_CENTER|wxALL, 3);
|
2013-12-27 00:51:46 +04:00
|
|
|
createButton = AddButton(ID_Create, BTNLABEL_CREATE_IMG);
|
2009-03-28 01:22:07 +03:00
|
|
|
AddDefaultButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
void FloppyConfigDialog::Setup(bx_list_c *list)
|
|
|
|
{
|
2010-07-03 09:34:27 +04:00
|
|
|
int devtype_id, path_id, media_id, status_id, readonly_id;
|
2009-03-28 01:22:07 +03:00
|
|
|
|
|
|
|
devtype_id = list->get_by_name("devtype")->get_id();
|
|
|
|
path_id = list->get_by_name("path")->get_id();
|
|
|
|
media_id = list->get_by_name("type")->get_id();
|
|
|
|
status_id = list->get_by_name("status")->get_id();
|
2010-07-03 09:34:27 +04:00
|
|
|
readonly_id = list->get_by_name("readonly")->get_id();
|
2009-03-28 01:22:07 +03:00
|
|
|
AddParam(list);
|
|
|
|
pstrDevice = (ParamStruct*) paramHash->Get(devtype_id);
|
|
|
|
pstrPath = (ParamStruct*) paramHash->Get(path_id);
|
|
|
|
pstrMedia = (ParamStruct*) paramHash->Get(media_id);
|
|
|
|
pstrStatus = (ParamStruct*) paramHash->Get(status_id);
|
2010-07-03 09:34:27 +04:00
|
|
|
pstrReadonly = (ParamStruct*) paramHash->Get(readonly_id);
|
2009-03-28 01:22:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
|
|
|
|
{
|
|
|
|
int id = event.GetId();
|
|
|
|
if (isGeneratedId(id)) {
|
|
|
|
ParamStruct *pstr = (ParamStruct*) idHash->Get(id);
|
|
|
|
if (pstr == NULL) {
|
|
|
|
wxLogDebug(wxT("ParamStruct not found for id=%d"), id);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (id == pstr->id) {
|
|
|
|
if ((pstr == pstrDevice) || (pstr == pstrMedia)) {
|
|
|
|
int val1 = pstrDevice->u.choice->GetSelection() + ((bx_param_num_c*)pstrDevice->param)->get_min();
|
|
|
|
int val2 = pstrMedia->u.choice->GetSelection() + ((bx_param_num_c*)pstrMedia->param)->get_min();
|
|
|
|
createButton->Enable((val1 != BX_FDD_NONE) && (val2 != BX_FLOPPY_NONE));
|
|
|
|
} else if ((pstr == pstrPath) && (!pstrPath->u.text->IsModified())) {
|
|
|
|
pstrMedia->u.choice->SetSelection(pstrMedia->u.choice->FindString(wxT("auto")));
|
2013-01-23 21:56:57 +04:00
|
|
|
pstrStatus->u.choice->SetSelection(BX_INSERTED);
|
2009-03-28 01:22:07 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ParamDialog::OnEvent(event);
|
|
|
|
} else {
|
|
|
|
switch (id) {
|
|
|
|
case ID_Create:
|
|
|
|
{
|
|
|
|
int cap = pstrMedia->u.choice->GetSelection();
|
|
|
|
char name[1024];
|
|
|
|
strncpy(name, pstrPath->u.text->GetValue().mb_str(wxConvUTF8), sizeof(name));
|
2015-01-07 19:17:40 +03:00
|
|
|
name[sizeof(name) - 1] = '\0';
|
2009-03-28 01:22:07 +03:00
|
|
|
if ((floppy_type_n_sectors[cap] > 0) && (strlen(name) > 0) && (strcmp(name, "none"))) {
|
2013-12-08 15:32:13 +04:00
|
|
|
if (CreateImage(0, floppy_type_n_sectors[cap], name)) {
|
2009-03-28 01:22:07 +03:00
|
|
|
wxString msg(wxT("Created a "));
|
|
|
|
msg += pstrMedia->u.choice->GetString(cap);
|
|
|
|
msg += wxT(" disk image called '");
|
|
|
|
msg += pstrPath->u.text->GetValue();
|
|
|
|
msg += wxT("'.");
|
|
|
|
wxMessageBox(msg, wxT("Image Created"), wxOK | wxICON_INFORMATION, this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2013-12-08 15:32:13 +04:00
|
|
|
case wxID_OK:
|
|
|
|
// force a media change
|
|
|
|
((bx_param_enum_c*)pstrStatus->param)->set(BX_EJECTED);
|
2009-03-28 01:22:07 +03:00
|
|
|
default:
|
|
|
|
ParamDialog::OnEvent(event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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);
|
2013-12-08 15:32:13 +04:00
|
|
|
gridSizer = new wxFlexGridSizer(2);
|
2006-03-11 13:00:56 +03:00
|
|
|
mainSizer->Add(gridSizer, 1, wxLEFT, 40);
|
2013-12-08 15:32:13 +04:00
|
|
|
infoSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
text = new wxStaticText(this, -1, LOG_OPTS_ADV);
|
|
|
|
infoSizer->Add(text, 0, wxALIGN_CENTER|wxALL, 3);
|
2006-03-11 13:00:56 +03:00
|
|
|
|
|
|
|
// gridSizer contents
|
|
|
|
gridSizer->AddGrowableCol(1);
|
|
|
|
for (int evtype=0; evtype<LOG_OPTS_N_TYPES; evtype++) {
|
2014-01-04 00:46:59 +04:00
|
|
|
gridSizer->Add(new wxStaticText(this, -1, names[evtype]), 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
|
2006-03-11 13:00:56 +03:00
|
|
|
action[evtype] = makeLogOptionChoiceBox(this, -1, evtype, true);
|
|
|
|
gridSizer->Add(action[evtype], 1, wxALL|wxGROW|wxADJUST_MINSIZE, 5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
void LogOptionsDialog::SetAction(int evtype, int a)
|
|
|
|
{
|
2006-03-11 13:00:56 +03:00
|
|
|
// find the choice whose client data matches "a".
|
|
|
|
int *ptr;
|
|
|
|
//wxLogDebug ("SetAction type=%d a=%d", evtype, a);
|
2008-12-18 12:55:09 +03:00
|
|
|
for (int i=0; i < (int)action[evtype]->GetCount(); i++) {
|
2006-03-11 13:00:56 +03:00
|
|
|
//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
|
2012-10-06 01:36:49 +04:00
|
|
|
// BX_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
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +03:00
|
|
|
int LogOptionsDialog::GetAction(int evtype)
|
|
|
|
{
|
2006-03-11 13:00:56 +03:00
|
|
|
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
|
2008-02-06 01:57:43 +03:00
|
|
|
// SetItemMinSize trick was reported on comp.soft-sys.wxwindows by
|
2002-08-30 03:28:52 +04:00
|
|
|
// Dirk Birnhardt.
|
2013-12-08 15:32:13 +04:00
|
|
|
void ChangeStaticText(wxSizer *sizer, wxStaticText *win, wxString newtext)
|
2002-08-30 03:28:52 +04:00
|
|
|
{
|
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.
|
2013-12-08 15:32:13 +04:00
|
|
|
bool 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);
|
2013-12-08 15:32:13 +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
|
2013-12-08 15:32:13 +04:00
|
|
|
// and sector args. Call SIM->create_image(filename, sectors, overwrite=0)
|
2002-08-30 03:28:52 +04:00
|
|
|
// 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.
|
2013-12-08 15:32:13 +04:00
|
|
|
int ret = SIM->create_disk_image(filename, sectors, 0);
|
2002-08-30 03:18:10 +04:00
|
|
|
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)
|
2013-12-08 15:32:13 +04:00
|
|
|
ret = SIM->create_disk_image(filename, sectors, 1);
|
2008-02-06 01:57:43 +03:00
|
|
|
else
|
2002-08-30 03:18:10 +04:00
|
|
|
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;
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
wxASSERT(ret==0);
|
2002-08-30 03:18:10 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +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
|
|
|
}
|
|
|
|
|
2013-12-08 15:32:13 +04:00
|
|
|
int GetTextCtrlInt(wxTextCtrl *ctrl,
|
2002-09-03 02:12:31 +04:00
|
|
|
bool *valid,
|
|
|
|
bool complain,
|
2008-02-06 01:57:43 +03:00
|
|
|
wxString complaint)
|
2002-09-03 02:12:31 +04:00
|
|
|
{
|
2013-12-08 15:32:13 +04: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));
|
2015-01-07 19:17:40 +03:00
|
|
|
buf[sizeof(buf)-1] = '\0';
|
2006-03-19 12:24:10 +03:00
|
|
|
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) {
|
2008-02-16 01:05:43 +03:00
|
|
|
wxMessageBox(complaint, wxT("Invalid"), wxOK | wxICON_ERROR);
|
2006-03-19 12:24:10 +03:00
|
|
|
ctrl->SetFocus();
|
2002-09-03 00:13:52 +04:00
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2008-02-16 01:05:43 +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);
|
2013-12-08 15:32:13 +04: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
|
|
|
|
2013-12-08 15:32:13 +04:00
|
|
|
wxChoice *makeLogOptionChoiceBox(wxWindow *parent,
|
2002-09-19 08:52:03 +04:00
|
|
|
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;
|
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/bochs.h ./bochs.h
--- /home/volker/bochs/bochs/bochs.h 2016-08-12 19:06:18.803209189 +0200
+++ ./bochs.h 2016-12-28 00:41:20.000627252 +0100
@@ -2,7 +2,7 @@
// $Id: bochs.h 12935 2016-08-12 17:06:14Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2001-2015 The Bochs Project
+// Copyright (C) 2001-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -276,8 +276,9 @@
void error(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
void panic(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
void ldebug(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
- void fatal (const char *prefix, const char *fmt, va_list ap, int exit_status);
- void ask (int level, const char *prefix, const char *fmt, va_list ap);
+ void fatal(const char *prefix, const char *fmt, va_list ap, int exit_status);
+ void warn(int level, const char *prefix, const char *fmt, va_list ap);
+ void ask(int level, const char *prefix, const char *fmt, va_list ap);
void put(const char *p);
void put(const char *n, const char *p);
void setio(class iofunctions *);
@@ -334,7 +335,8 @@
void set_log_action(int loglevel, int action);
const char *getlevel(int i) const;
const char *getaction(int i) const;
-
+ int isaction(const char *val) const;
+
protected:
int n_logfn;
#define MAX_LOGFNS 512
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/CHANGES ./CHANGES
--- /home/volker/bochs/bochs/CHANGES 2016-12-26 10:45:44.000000000 +0100
+++ ./CHANGES 2016-12-28 15:54:25.127088081 +0100
@@ -1,5 +1,8 @@
Changes after 2.6.8 release:
+- General
+ - Added new log action "warn", designed to show a message box on error events.
+
- Configure and compile
- Added Android host platform support.
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/config.cc ./config.cc
--- /home/volker/bochs/bochs/config.cc 2016-05-03 21:15:09.158016000 +0200
+++ ./config.cc 2016-12-27 19:53:10.461420368 +0100
@@ -2062,15 +2062,8 @@
actstr = strtok(NULL, "");
if (actstr != NULL) {
def_action = !strcmp(module, "action");
- if (!strcmp(actstr, "fatal"))
- action = ACT_FATAL;
- else if (!strcmp (actstr, "report"))
- action = ACT_REPORT;
- else if (!strcmp (actstr, "ignore"))
- action = ACT_IGNORE;
- else if (!strcmp (actstr, "ask"))
- action = ACT_ASK;
- else {
+ action = SIM->is_action_name(actstr);
+ if (action < ACT_IGNORE) {
PARSE_ERR(("%s: %s directive malformed.", context, params[0]));
free(param);
return -1;
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/sdl2.cc ./gui/sdl2.cc
--- /home/volker/bochs/bochs/gui/sdl2.cc 2016-08-12 19:06:18.811209142 +0200
+++ ./gui/sdl2.cc 2016-12-28 12:33:39.534288819 +0100
@@ -2,7 +2,7 @@
// $Id: sdl2.cc 12935 2016-08-12 17:06:14Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2014-2015 The Bochs Project
+// Copyright (C) 2014-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -1478,20 +1478,16 @@
SDL_MessageBoxData msgboxdata;
SDL_MessageBoxButtonData buttondata[4];
int level, retcode;
-#if BX_DEBUGGER || BX_GDBSTUB
- int defbtn = 3;
-#else
- int defbtn = 2;
-#endif
char message[512];
level = event->u.logmsg.level;
- sprintf(message, "%s %s", event->u.logmsg.prefix, event->u.logmsg.msg);
+ sprintf(message, "Device: %s\nMessage: %s", event->u.logmsg.prefix,
+ event->u.logmsg.msg);
msgboxdata.flags = SDL_MESSAGEBOX_ERROR;
msgboxdata.window = window;
msgboxdata.title = SIM->get_log_level_name(level);
msgboxdata.message = message;
- msgboxdata.numbuttons = defbtn + 1;
+ msgboxdata.numbuttons = 2;
msgboxdata.buttons = buttondata;
msgboxdata.colorScheme = NULL;
buttondata[0].flags = 0;
@@ -1500,14 +1496,18 @@
buttondata[1].flags = 0;
buttondata[1].buttonid = BX_LOG_ASK_CHOICE_CONTINUE_ALWAYS;
buttondata[1].text = "Alwayscont";
+ if (event->u.logmsg.flag == BX_LOG_ASK_ASKDLG) {
+ msgboxdata.numbuttons = 3;
+ buttondata[2].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
+ buttondata[2].buttonid = BX_LOG_ASK_CHOICE_DIE;
+ buttondata[2].text = "Quit";
#if BX_DEBUGGER || BX_GDBSTUB
- buttondata[2].flags = 0;
- buttondata[2].buttonid = BX_LOG_ASK_CHOICE_ENTER_DEBUG;
- buttondata[2].text = "Debugger";
-#endif
- buttondata[defbtn].flags = SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT;
- buttondata[defbtn].buttonid = BX_LOG_ASK_CHOICE_DIE;
- buttondata[defbtn].text = "Quit";
+ msgboxdata.numbuttons = 4;
+ buttondata[3].flags = 0;
+ buttondata[3].buttonid = BX_LOG_ASK_CHOICE_ENTER_DEBUG;
+ buttondata[3].text = "Debugger";
+#endif
+ }
if (SDL_ShowMessageBox(&msgboxdata, &retcode) < 0) {
return -1;
} else {
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/siminterface.cc ./gui/siminterface.cc
--- /home/volker/bochs/bochs/gui/siminterface.cc 2016-12-05 19:56:56.729685000 +0100
+++ ./gui/siminterface.cc 2016-12-28 11:14:02.004075717 +0100
@@ -2,7 +2,7 @@
// $Id: siminterface.cc 12981 2016-12-05 18:56:56Z sshwarts $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2002-2015 The Bochs Project
+// Copyright (C) 2002-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -100,6 +100,7 @@
virtual int get_log_action(int mod, int level);
virtual void set_log_action(int mod, int level, int action);
virtual const char *get_action_name(int action);
+ virtual int is_action_name(const char *val);
virtual int get_default_log_action(int level) {
return logfunctions::get_default_action(level);
}
@@ -123,6 +124,7 @@
virtual void set_notify_callback(bxevent_handler func, void *arg);
virtual void get_notify_callback(bxevent_handler *func, void **arg);
virtual BxEvent* sim_to_ci_event(BxEvent *event);
+ virtual int log_warn(const char *prefix, int level, const char *msg);
virtual int log_ask(const char *prefix, int level, const char *msg);
virtual void log_msg(const char *prefix, int level, const char *msg);
virtual void set_log_viewer(bx_bool val) { bx_log_viewer = val; }
@@ -420,6 +422,11 @@
return io->getaction(action);
}
+int bx_real_sim_c::is_action_name(const char *val)
+{
+ return io->isaction(val);
+}
+
const char *bx_real_sim_c::get_log_level_name(int level)
{
return io->getlevel(level);
@@ -575,6 +582,21 @@
}
}
+int bx_real_sim_c::log_warn(const char *prefix, int level, const char *msg)
+{
+ BxEvent be;
+ be.type = BX_SYNC_EVT_LOG_ASK;
+ be.u.logmsg.prefix = prefix;
+ be.u.logmsg.level = level;
+ be.u.logmsg.msg = msg;
+ be.u.logmsg.flag = BX_LOG_ASK_MSGBOX_WARN;
+ // default return value in case something goes wrong.
+ be.retcode = BX_LOG_NOTIFY_FAILED;
+ // calling notify
+ sim_to_ci_event(&be);
+ return be.retcode;
+}
+
// returns 0 for continue, 1 for alwayscontinue, 2 for die.
int bx_real_sim_c::log_ask(const char *prefix, int level, const char *msg)
{
@@ -583,6 +605,7 @@
be.u.logmsg.prefix = prefix;
be.u.logmsg.level = level;
be.u.logmsg.msg = msg;
+ be.u.logmsg.flag = BX_LOG_ASK_ASKDLG;
// default return value in case something goes wrong.
be.retcode = BX_LOG_NOTIFY_FAILED;
// calling notify
@@ -1157,16 +1180,10 @@
} else if (!strncmp(string, "PANIC=", 6)) {
type = LOGLEV_PANIC;
}
- if (!strcmp(string+j, "ignore")) {
- action = ACT_IGNORE;
- } else if (!strcmp(string+j, "report")) {
- action = ACT_REPORT;
- } else if (!strcmp(string+j, "ask")) {
- action = ACT_ASK;
- } else if (!strcmp(string+j, "fatal")) {
- action = ACT_FATAL;
+ action = is_action_name(string+j);
+ if (action >= ACT_IGNORE) {
+ set_log_action(dev, type, action);
}
- set_log_action(dev, type, action);
} else {
if (i == 1) {
BX_ERROR(("restore_logopts(): log module '%s' not found", devname));
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/siminterface.h ./gui/siminterface.h
--- /home/volker/bochs/bochs/gui/siminterface.h 2016-03-31 19:24:37.451025427 +0200
+++ ./gui/siminterface.h 2016-12-28 11:11:21.036683362 +0100
@@ -168,6 +168,7 @@
typedef enum {
ACT_IGNORE = 0,
ACT_REPORT,
+ ACT_WARN,
ACT_ASK,
ACT_FATAL,
N_ACT
@@ -178,11 +179,11 @@
// normally all action choices are available for all event types. The exclude
// expression allows some choices to be eliminated if they don't make any
// sense. For example, it would be stupid to ignore a panic.
-#define BX_LOG_OPTS_EXCLUDE(type, choice) ( \
- /* can't die or ask, on debug or info events */ \
- (type <= LOGLEV_INFO && (choice == ACT_ASK || choice == ACT_FATAL)) \
- /* can't ignore panics */ \
- || (type == LOGLEV_PANIC && choice == ACT_IGNORE) \
+#define BX_LOG_OPTS_EXCLUDE(type, choice) ( \
+ /* can't die, ask or warn, on debug or info events */ \
+ (type <= LOGLEV_INFO && (choice >= ACT_WARN)) \
+ /* can't ignore panics */ \
+ || (type == LOGLEV_PANIC && choice == ACT_IGNORE) \
)
// floppy / cdrom media status
@@ -392,6 +393,7 @@
// synchronizing threads, etc. for each.
typedef struct {
Bit8u level;
+ Bit8u flag;
const char *prefix;
const char *msg;
} BxLogMsgEvent;
@@ -419,6 +421,12 @@
BX_LOG_NOTIFY_FAILED
};
+enum {
+ BX_LOG_ASK_ASKDLG,
+ BX_LOG_ASK_MSGBOX_WARN,
+ BX_LOG_ASK_MSGBOX_QUIT
+};
+
// Event type: BX_SYNC_EVT_GET_DBG_COMMAND
//
// This is a synchronous event sent from the simulator to the debugger
@@ -675,6 +683,7 @@
virtual int get_default_log_action(int level) {return -1;}
virtual void set_default_log_action(int level, int action) {}
virtual const char *get_action_name(int action) {return NULL;}
+ virtual int is_action_name(const char *val) {return -1;}
virtual const char *get_log_level_name(int level) {return NULL;}
virtual int get_max_log_level() {return -1;}
@@ -715,6 +724,9 @@
// send an event from the simulator to the CI.
virtual BxEvent* sim_to_ci_event(BxEvent *event) {return NULL;}
+ // called from simulator when it hits errors, to warn the user
+ // before continuing simulation
+ virtual int log_warn(const char *prefix, int level, const char *msg) {return -1;}
// called from simulator when it hits serious errors, to ask if the user
// wants to continue or not
virtual int log_ask(const char *prefix, int level, const char *msg) {return -1;}
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/textconfig.cc ./gui/textconfig.cc
--- /home/volker/bochs/bochs/gui/textconfig.cc 2016-12-05 20:15:59.112637000 +0100
+++ ./gui/textconfig.cc 2016-12-28 12:44:43.079411258 +0100
@@ -2,7 +2,7 @@
// $Id: textconfig.cc 12983 2016-12-05 19:15:59Z sshwarts $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2002-2013 The Bochs Project
+// Copyright (C) 2002-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -552,8 +552,8 @@
}
static const char *log_options_prompt1 = "Enter the ID of the device to edit, or -1 to return: [-1] ";
-static const char *log_level_choices[] = { "ignore", "report", "ask", "fatal", "no change" };
-static int log_level_n_choices_normal = 4;
+static const char *log_level_choices[N_ACT+1] = { "ignore", "report", "warn", "ask", "fatal", "no change" };
+static int log_level_n_choices_normal = N_ACT;
void bx_log_options(int individual)
{
@@ -589,7 +589,7 @@
bx_print_log_action_table();
for (int level=0; level<SIM->get_max_log_level(); level++) {
char prompt[1024];
- int action, default_action = 4; // default to no change
+ int action, default_action = N_ACT; // default to no change
sprintf(prompt, "Enter action for %s event on all devices: [no change] ", SIM->get_log_level_name(level));
// do show the no change choice (choices=4)
if (ask_menu(prompt, "", log_level_n_choices_normal+1, log_level_choices, default_action, &action)<0)
@@ -718,47 +718,50 @@
event->retcode = event->u.param.param->text_ask(stdin, stderr);
return event;
case BX_SYNC_EVT_LOG_ASK:
- {
- int level = event->u.logmsg.level;
- fprintf(stderr, "========================================================================\n");
- fprintf(stderr, "Event type: %s\n", SIM->get_log_level_name (level));
- fprintf(stderr, "Device: %s\n", event->u.logmsg.prefix);
- fprintf(stderr, "Message: %s\n\n", event->u.logmsg.msg);
- fprintf(stderr, "A %s has occurred. Do you want to:\n", SIM->get_log_level_name (level));
- fprintf(stderr, " cont - continue execution\n");
- fprintf(stderr, " alwayscont - continue execution, and don't ask again.\n");
- fprintf(stderr, " This affects only %s events from device %s\n", SIM->get_log_level_name (level), event->u.logmsg.prefix);
- fprintf(stderr, " die - stop execution now\n");
- fprintf(stderr, " abort - dump core %s\n",
- BX_HAVE_ABORT ? "" : "(Disabled)");
+ if (event->u.logmsg.flag == BX_LOG_ASK_ASKDLG) {
+ int level = event->u.logmsg.level;
+ fprintf(stderr, "========================================================================\n");
+ fprintf(stderr, "Event type: %s\n", SIM->get_log_level_name (level));
+ fprintf(stderr, "Device: %s\n", event->u.logmsg.prefix);
+ fprintf(stderr, "Message: %s\n\n", event->u.logmsg.msg);
+ fprintf(stderr, "A %s has occurred. Do you want to:\n", SIM->get_log_level_name (level));
+ fprintf(stderr, " cont - continue execution\n");
+ fprintf(stderr, " alwayscont - continue execution, and don't ask again.\n");
+ fprintf(stderr, " This affects only %s events from device %s\n", SIM->get_log_level_name (level), event->u.logmsg.prefix);
+ fprintf(stderr, " die - stop execution now\n");
+ fprintf(stderr, " abort - dump core %s\n",
+ BX_HAVE_ABORT ? "" : "(Disabled)");
#if BX_DEBUGGER
- fprintf(stderr, " debug - continue and return to bochs debugger\n");
+ fprintf(stderr, " debug - continue and return to bochs debugger\n");
#endif
#if BX_GDBSTUB
- fprintf(stderr, " debug - hand control to gdb\n");
+ fprintf(stderr, " debug - hand control to gdb\n");
#endif
- int choice;
+ int choice;
ask:
- if (ask_menu("Choose one of the actions above: [%s] ", "",
- log_action_n_choices, log_action_ask_choices, 2, &choice) < 0)
- event->retcode = -1;
- // return 0 for continue, 1 for alwayscontinue, 2 for die, 3 for debug.
- if (!BX_HAVE_ABORT && choice==BX_LOG_ASK_CHOICE_DUMP_CORE) goto ask;
- fflush(stdout);
- fflush(stderr);
- event->retcode = choice;
- }
- return event;
- case BX_ASYNC_EVT_REFRESH:
- case BX_ASYNC_EVT_DBG_MSG:
- case BX_ASYNC_EVT_LOG_MSG:
- // The text mode interface does not use these events, so just ignore
- // them.
- return event;
- default:
- fprintf(stderr, "textconfig: notify callback called with event type %04x\n", event->type);
- return event;
+ if (ask_menu("Choose one of the actions above: [%s] ", "",
+ log_action_n_choices, log_action_ask_choices, 2, &choice) < 0)
+ event->retcode = -1;
+ // return 0 for continue, 1 for alwayscontinue, 2 for die, 3 for debug.
+ if (!BX_HAVE_ABORT && choice==BX_LOG_ASK_CHOICE_DUMP_CORE) goto ask;
+ fflush(stdout);
+ fflush(stderr);
+ event->retcode = choice;
+ } else {
+ // warning prompt not implemented
+ event->retcode = 0;
+ }
+ return event;
+ case BX_ASYNC_EVT_REFRESH:
+ case BX_ASYNC_EVT_DBG_MSG:
+ case BX_ASYNC_EVT_LOG_MSG:
+ // The text mode interface does not use these events, so just ignore
+ // them.
+ return event;
+ default:
+ fprintf(stderr, "textconfig: notify callback called with event type %04x\n", event->type);
+ return event;
}
assert(0); // switch statement should return
}
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/win32dialog.cc ./gui/win32dialog.cc
--- /home/volker/bochs/bochs/gui/win32dialog.cc 2014-06-20 11:32:02.034026376 +0200
+++ ./gui/win32dialog.cc 2016-12-28 12:50:14.148888740 +0100
@@ -2,7 +2,7 @@
// $Id: win32dialog.cc 12381 2014-06-20 09:31:56Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2003-2014 The Bochs Project
+// Copyright (C) 2003-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,7 @@
#include "win32res.h"
#include "win32paramdlg.h"
-const char log_choices[5][16] = {"ignore", "log", "ask user", "end simulation", "no change"};
+const char log_choices[N_ACT+1][16] = {"ignore", "log", "warn user", "ask user", "end simulation", "no change"};
HWND GetBochsWindow()
{
@@ -97,12 +97,16 @@
SetWindowText(GetDlgItem(hDlg, IDASKMSG), event->u.logmsg.msg);
SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Continue");
SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Continue and don't ask again");
- SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Kill simulation");
- SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Abort (dump core)");
+ if (event->u.logmsg.flag == BX_LOG_ASK_ASKDLG) {
+ SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Kill simulation");
+ SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Abort (dump core)");
#if BX_DEBUGGER
- SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Continue and return to debugger");
+ SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Continue and return to debugger");
#endif
- SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_SETCURSEL, 2, 0);
+ SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_SETCURSEL, 2, 0);
+ } else {
+ SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_SETCURSEL, 0, 0);
+ }
SetFocus(GetDlgItem(hDlg, IDASKLIST));
return FALSE;
case WM_CLOSE:
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/wxdialog.cc ./gui/wxdialog.cc
--- /home/volker/bochs/bochs/gui/wxdialog.cc 2015-01-07 17:17:40.447882000 +0100
+++ ./gui/wxdialog.cc 2016-12-27 20:30:44.997609007 +0100
@@ -2,7 +2,7 @@
// $Id: wxdialog.cc 12594 2015-01-07 16:17:40Z sshwarts $
/////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2002-2014 The Bochs Project
+// Copyright (C) 2002-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -208,7 +208,6 @@
: wxDialog(parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
- //static int integers[LOG_OPTS_N_CHOICES_NORMAL] = {0, 1, 2, 3};
static wxString names[] = ADVLOG_OPTS_TYPE_NAMES;
SetTitle(ADVLOG_OPTS_TITLE);
vertSizer = new wxBoxSizer(wxVERTICAL);
@@ -1563,7 +1562,7 @@
bool includeNoChange)
{
static wxString choices[] = LOG_OPTS_CHOICES;
- static int integers[LOG_OPTS_N_CHOICES] = {0, 1, 2, 3, 4};
+ static int integers[LOG_OPTS_N_CHOICES] = {0, 1, 2, 3, 4, 5};
wxChoice *control = new wxChoice(parent, id, wxDefaultPosition, wxDefaultSize);
int lastChoice = 0; // remember index of last choice
int nchoice = includeNoChange? LOG_OPTS_N_CHOICES : LOG_OPTS_N_CHOICES_NORMAL;
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/wxdialog.h ./gui/wxdialog.h
--- /home/volker/bochs/bochs/gui/wxdialog.h 2014-12-23 20:30:12.896090221 +0100
+++ ./gui/wxdialog.h 2016-12-27 20:34:28.518389938 +0100
@@ -2,7 +2,7 @@
// $Id: wxdialog.h 12576 2014-12-23 19:30:03Z vruppert $
////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2002-2014 The Bochs Project
+// Copyright (C) 2002-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -354,10 +354,10 @@
#define LOG_OPTS_PROMPT wxT("How should Bochs respond to each type of event?")
#define LOG_OPTS_TYPE_NAMES { wxT("Debug events"), wxT("Info events"), wxT("Error events"), wxT("Panic events") }
#define LOG_OPTS_N_TYPES 4
-#define LOG_OPTS_CHOICES { wxT("ignore"), wxT("log"), wxT("ask user"), wxT("end simulation"), wxT("no change") }
-#define LOG_OPTS_N_CHOICES_NORMAL 4
-#define LOG_OPTS_N_CHOICES 5 // number of choices, including "no change"
-#define LOG_OPTS_NO_CHANGE 4 // index of "no change"
+#define LOG_OPTS_CHOICES { wxT("ignore"), wxT("log"), wxT("warn user"), wxT("ask user"), wxT("end simulation"), wxT("no change") }
+#define LOG_OPTS_N_CHOICES_NORMAL 5
+#define LOG_OPTS_N_CHOICES 6 // number of choices, including "no change"
+#define LOG_OPTS_NO_CHANGE 5 // index of "no change"
#define LOG_OPTS_ADV wxT("For additional control over how each device responds to events, use the menu option \"Log ... By Device\".")
wxFlexGridSizer *gridSizer;
wxChoice *action[LOG_OPTS_N_TYPES];
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/wxmain.cc ./gui/wxmain.cc
--- /home/volker/bochs/bochs/gui/wxmain.cc 2016-12-26 17:12:57.470174541 +0100
+++ ./gui/wxmain.cc 2016-12-28 12:15:26.035961463 +0100
@@ -2,7 +2,7 @@
// $Id: wxmain.cc 13006 2016-12-26 16:12:54Z vruppert $
/////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2002-2014 The Bochs Project
+// Copyright (C) 2002-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -1158,6 +1158,10 @@
#if !BX_DEBUGGER && !BX_GDBSTUB
dlg.EnableButton(dlg.DEBUG, FALSE);
#endif
+ if (be->u.logmsg.flag != BX_LOG_ASK_ASKDLG) {
+ dlg.EnableButton(dlg.DIE, FALSE);
+ dlg.EnableButton(dlg.DUMP, FALSE);
+ }
dlg.SetContext(wxString(be->u.logmsg.prefix, wxConvUTF8));
dlg.SetMessage(wxString(be->u.logmsg.msg, wxConvUTF8));
int n = dlg.ShowModal();
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/gui/x.cc ./gui/x.cc
--- /home/volker/bochs/bochs/gui/x.cc 2016-12-27 17:26:59.622665119 +0100
+++ ./gui/x.cc 2016-12-28 12:03:10.963351647 +0100
@@ -2687,11 +2687,7 @@
} else {
size_x = 30 + maxlen * 6;
}
- if (lines < 3) {
- size_y = 90;
- } else {
- size_y = 60 + lines * 15;
- }
+ size_y = 70 + lines * 15;
x11_dialog_c *xdlg = new x11_dialog_c(name, size_x, size_y,
(mode == XDLG_SIMPLE) ? 1 : 2);
ypos = 34;
@@ -2729,11 +2725,21 @@
bx_param_string_c *sparam;
bx_param_enum_c *eparam;
bx_list_c *list;
+ char message[256];
switch (event->type)
{
case BX_SYNC_EVT_LOG_ASK:
- event->retcode = x11_ask_dialog(event);
+ if (event->u.logmsg.flag == BX_LOG_ASK_ASKDLG) {
+ event->retcode = x11_ask_dialog(event);
+ } else if (event->u.logmsg.flag == BX_LOG_ASK_MSGBOX_WARN) {
+ const char *title = SIM->get_log_level_name(event->u.logmsg.level);
+ sprintf(message, "Device: %s\n\nMessage: %s", event->u.logmsg.prefix,
+ event->u.logmsg.msg);
+ bx_param_bool_c bparam(NULL, "warn", title, message, 1);
+ x11_message_box(&bparam, XDLG_SIMPLE);
+ event->retcode = 0;
+ }
return event;
case BX_SYNC_EVT_ASK_PARAM:
param = event->u.param.param;
diff -urNX /home/volker/exclude-bochs /home/volker/bochs/bochs/logio.cc ./logio.cc
--- /home/volker/bochs/bochs/logio.cc 2015-05-10 08:55:18.678940963 +0200
+++ ./logio.cc 2016-12-28 00:40:40.395736643 +0100
@@ -2,7 +2,7 @@
// $Id: logio.cc 12759 2015-05-10 06:55:16Z vruppert $
/////////////////////////////////////////////////////////////////////////
//
-// Copyright (C) 2001-2014 The Bochs Project
+// Copyright (C) 2001-2016 The Bochs Project
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@ -50,11 +50,25 @@
else return "?";
}
+static const char *act_name[N_ACT] = { "ignore", "report", "warn", "ask", "fatal" };
+
const char* iofunctions::getaction(int i) const
{
- static const char *name[] = { "ignore", "report", "ask", "fatal" };
assert (i>=ACT_IGNORE && i<N_ACT);
- return name[i];
+ return act_name[i];
+}
+
+int iofunctions::isaction(const char *val) const
+{
+ int action = -1;
+
+ for (int i = 0; i < N_ACT; i++) {
+ if (!strcmp(val, act_name[i])) {
+ action = ACT_IGNORE + i;
+ break;
+ }
+ }
+ return action;
}
void iofunctions::flush(void)
@@ -414,6 +428,11 @@
logio->out(LOGLEV_ERROR, prefix, fmt, ap);
va_end(ap);
+ if (onoff[LOGLEV_ERROR] == ACT_WARN) {
+ va_start(ap, fmt);
+ warn(LOGLEV_ERROR, prefix, fmt, ap);
+ va_end(ap);
+ }
if (onoff[LOGLEV_ERROR] == ACT_ASK) {
va_start(ap, fmt);
ask(LOGLEV_ERROR, prefix, fmt, ap);
@@ -438,6 +457,11 @@
logio->out(LOGLEV_PANIC, prefix, fmt, ap);
va_end(ap);
+ if (onoff[LOGLEV_PANIC] == ACT_WARN) {
+ va_start(ap, fmt);
+ warn(LOGLEV_PANIC, prefix, fmt, ap);
+ va_end(ap);
+ }
if (onoff[LOGLEV_PANIC] == ACT_ASK) {
va_start(ap, fmt);
ask(LOGLEV_PANIC, prefix, fmt, ap);
@@ -465,6 +489,36 @@
// the actions ask() and fatal() are not supported here
}
+void logfunctions::warn(int level, const char *prefix, const char *fmt, va_list ap)
+{
+ // Guard against reentry on warn() function. The danger is that some
+ // function that's called within warn() could trigger another
+ // BX_ERROR that could call warn() again, leading to infinite
+ // recursion and infinite asks.
+ static char in_warn_already = 0;
+ char buf1[1024];
+ if (in_warn_already) {
+ fprintf(stderr, "logfunctions::warn() should not reenter!!\n");
+ return;
+ }
+ in_warn_already = 1;
+ vsnprintf(buf1, sizeof(buf1), fmt, ap);
+ // FIXME: facility set to 0 because it's unknown.
+
+ // update vga screen. This is useful because sometimes useful messages
+ // are printed on the screen just before a panic. It's also potentially
+ // dangerous if this function calls ask again... That's why I added
+ // the reentry check above.
+ SIM->refresh_vga();
+
+ // ensure the text screen is showing
+ SIM->set_display_mode(DISP_MODE_CONFIG);
+ SIM->log_warn(prefix, level, buf1);
+ // return to simulation mode
+ SIM->set_display_mode(DISP_MODE_SIM);
+ in_warn_already = 0;
+}
+
void logfunctions::ask(int level, const char *prefix, const char *fmt, va_list ap)
{
// Guard against reentry on ask() function. The danger is that some
2016-12-28 18:06:34 +03:00
|
|
|
static int integers[LOG_OPTS_N_CHOICES] = {0, 1, 2, 3, 4, 5};
|
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++) {
|
2012-10-06 01:36:49 +04:00
|
|
|
// the exclude expression allows some choices not being available if they
|
|
|
|
// don't make any sense. For example, it would be stupid to ignore a panic.
|
|
|
|
if (!BX_LOG_OPTS_EXCLUDE(evtype, choice)) {
|
2006-03-19 12:24:10 +03:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
2013-12-08 15:32:13 +04:00
|
|
|
control->SetSelection(lastChoice-1);
|
2002-09-19 08:52:03 +04:00
|
|
|
return control;
|
|
|
|
}
|
2002-11-19 08:47:45 +03:00
|
|
|
|
|
|
|
#endif /* if BX_WITH_WX */
|