mirror of https://github.com/bochs-emu/Bochs
- bx_param_num_c: new flag USE_SPIN_CONTROL controls whether a spin control should
be used instead of a simple text control (implemented in wx) - the new flag USE_SPIN_CONTROL is used by the memory size and the irq parameters - special bx_list_c for the "Other options" menu in the wx configuration added
This commit is contained in:
parent
3d341c9776
commit
84c1e3ed15
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: siminterface.h,v 1.111 2003-09-02 19:34:48 vruppert Exp $
|
||||
// $Id: siminterface.h,v 1.112 2003-09-05 22:07:54 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Before I can describe what this file is for, I have to make the
|
||||
|
@ -356,6 +356,7 @@ typedef enum {
|
|||
BXP_MENU_SOUND,
|
||||
BXP_MENU_KEYBOARD,
|
||||
BXP_MENU_MISC,
|
||||
BXP_MENU_MISC_2,
|
||||
BXP_MENU_RUNTIME,
|
||||
BXP_MAX_IPS,
|
||||
BXP_NE2K_PRESENT,
|
||||
|
@ -892,7 +893,13 @@ protected:
|
|||
param_event_handler handler;
|
||||
param_enable_handler enable_handler;
|
||||
int base;
|
||||
Bit32u options;
|
||||
public:
|
||||
enum {
|
||||
// When a bx_param_num_c is displayed in dialog, USE_SPIN_CONTROL controls
|
||||
// whether a spin control should be used instead of a simple text control.
|
||||
USE_SPIN_CONTROL = (1<<0),
|
||||
} bx_numopt_bits;
|
||||
bx_param_num_c (bx_id id,
|
||||
char *name,
|
||||
char *description,
|
||||
|
@ -914,6 +921,8 @@ public:
|
|||
Bit64s get_max () { return max; }
|
||||
static Bit32u set_default_base (Bit32u val);
|
||||
static Bit32u get_default_base () { return default_base; }
|
||||
void set_options (Bit32u options) { this->options = options; }
|
||||
Bit32u get_options () { return options; }
|
||||
#if BX_UI_TEXT
|
||||
virtual void text_print (FILE *fp);
|
||||
virtual int text_ask (FILE *fpin, FILE *fpout);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
// $Id: wxdialog.cc,v 1.65 2003-09-04 16:58:27 vruppert Exp $
|
||||
// $Id: wxdialog.cc,v 1.66 2003-09-05 22:07:54 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
||||
|
@ -1105,15 +1105,26 @@ void ParamDialog::AddParam (
|
|||
case BXT_PARAM_NUM: {
|
||||
bx_param_num_c *param = (bx_param_num_c*) param_generic;
|
||||
if (!plain) ADD_LABEL (prompt);
|
||||
wxTextCtrl *textctrl = new wxTextCtrl (context->parent, pstr->id, "", wxDefaultPosition, normalTextSize);
|
||||
const char *format = param->get_format ();
|
||||
if (!format)
|
||||
format = strdup(param->get_base () == 16 ? "0x%X" : "%d");
|
||||
SetTextCtrl (textctrl, format, param->get ());
|
||||
if (description) textctrl->SetToolTip(description);
|
||||
sizer->Add (textctrl, 0, wxALL, 2);
|
||||
if (!plain) sizer->Add (1, 1); // spacer
|
||||
pstr->u.text = textctrl;
|
||||
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));
|
||||
if (description) spinctrl->SetToolTip(description);
|
||||
sizer->Add (spinctrl, 0, wxALL, 2);
|
||||
if (!plain) sizer->Add (1, 1); // spacer
|
||||
pstr->u.spin = spinctrl;
|
||||
} else {
|
||||
wxTextCtrl *textctrl = new wxTextCtrl (context->parent, pstr->id, "", wxDefaultPosition, normalTextSize);
|
||||
const char *format = param->get_format ();
|
||||
if (!format)
|
||||
format = strdup(param->get_base () == 16 ? "0x%X" : "%d");
|
||||
SetTextCtrl (textctrl, format, param->get ());
|
||||
if (description) textctrl->SetToolTip(description);
|
||||
sizer->Add (textctrl, 0, wxALL, 2);
|
||||
if (!plain) sizer->Add (1, 1); // spacer
|
||||
pstr->u.text = textctrl;
|
||||
}
|
||||
idHash->Put (pstr->id, pstr);
|
||||
paramHash->Put (pstr->param->get_id (), pstr);
|
||||
break;
|
||||
|
@ -1269,9 +1280,14 @@ bool ParamDialog::CopyGuiToParam ()
|
|||
case BXT_PARAM_NUM: {
|
||||
bx_param_num_c *nump = (bx_param_num_c*) pstr->param;
|
||||
bool valid;
|
||||
int n;
|
||||
wxString complaint;
|
||||
complaint.Printf ("Invalid integer for %s.", pstr->param->get_name ());
|
||||
int n = GetTextCtrlInt (pstr->u.text, &valid, true, complaint);
|
||||
if (nump->get_options () & nump->USE_SPIN_CONTROL) {
|
||||
n = pstr->u.spin->GetValue ();
|
||||
} else {
|
||||
n = GetTextCtrlInt (pstr->u.text, &valid, true, complaint);
|
||||
}
|
||||
if ((n < nump->get_min ()) || (n > nump->get_max ())) {
|
||||
wxMessageBox("Numerical parameter out of range", "Error", wxOK | wxICON_ERROR, this );
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
// $Id: wxdialog.h,v 1.51 2003-09-04 16:58:27 vruppert Exp $
|
||||
// $Id: wxdialog.h,v 1.52 2003-09-05 22:07:54 vruppert Exp $
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// wxWindows dialogs for Bochs
|
||||
|
@ -430,6 +430,7 @@ struct ParamStruct : public wxObject {
|
|||
wxWindow *window;
|
||||
wxChoice *choice;
|
||||
wxTextCtrl *text;
|
||||
wxSpinCtrl *spin;
|
||||
wxCheckBox *checkbox;
|
||||
wxStaticBox *staticbox;
|
||||
wxNotebook *notebook;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
// $Id: wxmain.cc,v 1.98 2003-09-04 16:58:27 vruppert Exp $
|
||||
// $Id: wxmain.cc,v 1.99 2003-09-05 22:07:54 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs.
|
||||
|
@ -655,23 +655,9 @@ void MyFrame::OnEditLoadHack(wxCommandEvent& WXUNUSED(event))
|
|||
void MyFrame::OnEditOther(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
ParamDialog dlg(this, -1);
|
||||
dlg.SetTitle ("Other Options");
|
||||
//dlg.AddParam (SIM->get_param (BXP_SEL_DISPLAY_LIBRARY));
|
||||
//dlg.AddParam (SIM->get_param (BXP_SEL_CONFIG_INTERFACE));
|
||||
dlg.AddParam (SIM->get_param (BXP_VGA_UPDATE_INTERVAL));
|
||||
dlg.AddParam (SIM->get_param (BXP_LOG_PREFIX));
|
||||
dlg.AddParam (SIM->get_param (BXP_MOUSE_ENABLED));
|
||||
dlg.AddParam (SIM->get_param (BXP_FLOPPYSIGCHECK));
|
||||
dlg.AddParam (SIM->get_param (BXP_FLOPPY_CMD_DELAY));
|
||||
dlg.AddParam (SIM->get_param (BXP_NEWHARDDRIVESUPPORT));
|
||||
dlg.AddParam (SIM->get_param (BXP_PRIVATE_COLORMAP));
|
||||
#if BX_WITH_AMIGAOS
|
||||
dlg.AddParam (SIM->get_param (BXP_FULLSCREEN));
|
||||
dlg.AddParam (SIM->get_param (BXP_SCREENMODE));
|
||||
#endif
|
||||
dlg.AddParam (SIM->get_param (BXP_I440FX_SUPPORT));
|
||||
dlg.AddParam (SIM->get_param (BXP_CMOS_IMAGE));
|
||||
dlg.AddParam (SIM->get_param (BXP_CMOS_PATH));
|
||||
bx_list_c *list = (bx_list_c*) SIM->get_param (BXP_MENU_MISC_2);
|
||||
dlg.SetTitle (list->get_name ());
|
||||
dlg.AddParam (list);
|
||||
dlg.SetRuntimeFlag (sim_thread != NULL);
|
||||
dlg.ShowModal ();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.248 2003-09-04 16:58:27 vruppert Exp $
|
||||
// $Id: main.cc,v 1.249 2003-09-05 22:07:53 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
|
@ -719,6 +719,7 @@ void bx_init_options ()
|
|||
bx_options.ata[channel].Oioaddr1->set_label ("I/O Address 1:");
|
||||
bx_options.ata[channel].Oioaddr2->set_label ("I/O Address 2:");
|
||||
bx_options.ata[channel].Oirq->set_label ("IRQ:");
|
||||
bx_options.ata[channel].Oirq->set_options (bx_param_num_c::USE_SPIN_CONTROL);
|
||||
#else
|
||||
bx_options.ata[channel].Opresent->set_format ("enabled: %s");
|
||||
bx_options.ata[channel].Oioaddr1->set_format ("ioaddr1: 0x%x");
|
||||
|
@ -865,6 +866,7 @@ void bx_init_options ()
|
|||
bx_options.memory.Osize->set_ask_format ("Enter memory size (MB): [%d] ");
|
||||
#if BX_WITH_WX
|
||||
bx_options.memory.Osize->set_label ("Memory size (megabytes)");
|
||||
bx_options.memory.Osize->set_options (bx_param_num_c::USE_SPIN_CONTROL);
|
||||
#else
|
||||
bx_options.memory.Osize->set_format ("Memory size in megabytes: %d");
|
||||
#endif
|
||||
|
@ -963,6 +965,7 @@ void bx_init_options ()
|
|||
bx_options.usb[i].Oioaddr->set_base (16);
|
||||
bx_options.usb[i].Oenabled->set_label (strdup(label));
|
||||
bx_options.usb[i].Oirq->set_label ("USB IRQ");
|
||||
bx_options.usb[i].Oirq->set_options (bx_param_num_c::USE_SPIN_CONTROL);
|
||||
}
|
||||
// add final NULL at the end, and build the menu
|
||||
*par_ser_ptr = NULL;
|
||||
|
@ -1226,6 +1229,7 @@ void bx_init_options ()
|
|||
"IRQ used by the NE2K device",
|
||||
0, 15,
|
||||
0);
|
||||
bx_options.ne2k.Oirq->set_options (bx_param_num_c::USE_SPIN_CONTROL);
|
||||
bx_options.ne2k.Omacaddr = new bx_param_string_c (BXP_NE2K_MACADDR,
|
||||
"MAC Address",
|
||||
"MAC address of the NE2K device. Don't use an address of a machine on your net.",
|
||||
|
@ -1523,6 +1527,29 @@ void bx_init_options ()
|
|||
};
|
||||
menu = new bx_list_c (BXP_MENU_MISC, "Configure Everything Else", "", other_init_list);
|
||||
menu->get_options ()->set (menu->SHOW_PARENT);
|
||||
|
||||
bx_param_c *other_init_list2[] = {
|
||||
// bx_options.Osel_config,
|
||||
// bx_options.Osel_displaylib,
|
||||
bx_options.Ovga_update_interval,
|
||||
bx_options.log.Oprefix,
|
||||
bx_options.Omouse_enabled,
|
||||
bx_options.OfloppySigCheck,
|
||||
bx_options.Ofloppy_command_delay,
|
||||
bx_options.OnewHardDriveSupport,
|
||||
bx_options.Oprivate_colormap,
|
||||
#if BX_WITH_AMIGAOS
|
||||
bx_options.Ofullscreen,
|
||||
bx_options.Oscreenmode,
|
||||
#endif
|
||||
bx_options.Oi440FXSupport,
|
||||
bx_options.cmos.OcmosImage,
|
||||
bx_options.cmos.Opath,
|
||||
NULL
|
||||
};
|
||||
#if BX_WITH_WX
|
||||
menu = new bx_list_c (BXP_MENU_MISC_2, "Other options", "", other_init_list2);
|
||||
#endif
|
||||
}
|
||||
|
||||
void bx_reset_options ()
|
||||
|
|
Loading…
Reference in New Issue