- wx: building memory config dialog simplified

- textconfig now supports lists in a list
- network configuration divided in two menus / groupboxes
- ips setting now belongs to the clock menu / dialog
- wx.cc: center status bar items (wxMSW port only)
- wxmain.cc: obsolete stuff removed
This commit is contained in:
Volker Ruppert 2004-10-24 20:04:52 +00:00
parent b47448c6e5
commit ec05b63532
6 changed files with 76 additions and 92 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.15 2004-10-17 16:25:10 vruppert Exp $
// $Id: config.cc,v 1.16 2004-10-24 20:04:50 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1116,6 +1116,10 @@ void bx_init_options ()
};
menu = new bx_list_c (BXP_MENU_MEMORY, "Bochs Memory Options", "memmenu", memory_init_list);
menu->get_options ()->set (menu->SHOW_PARENT);
#if BX_WITH_WX
menu = new bx_list_c (BXP_OPTROM_LIST, "Optional ROM Images", "optromlist", &memory_init_list[4]);
menu->get_options ()->set (menu->USE_BOX_TITLE);
#endif
// interface
bx_options.Ovga_update_interval = new bx_param_num_c (BXP_VGA_UPDATE_INTERVAL,
@ -1236,7 +1240,6 @@ void bx_init_options ()
bx_options.Odisplaylib_options,
bx_options.Ovga_update_interval,
bx_options.Omouse_enabled,
bx_options.Oips,
bx_options.Oprivate_colormap,
#if BX_WITH_AMIGAOS
bx_options.Ofullscreen,
@ -1377,14 +1380,16 @@ void bx_init_options ()
#if !BX_WITH_WX
bx_options.pnic.Oscript->set_ask_format ("Enter new script name, or 'none': [%s] ");
#endif
bx_param_c *netdev_init_list[] = {
bx_options.ne2k.Opresent,
bx_param_c *ne2k_init_list[] = {
bx_options.ne2k.Oioaddr,
bx_options.ne2k.Oirq,
bx_options.ne2k.Omacaddr,
bx_options.ne2k.Oethmod,
bx_options.ne2k.Oethdev,
bx_options.ne2k.Oscript,
NULL
};
bx_param_c *pnic_init_list[] = {
bx_options.pnic.Oenabled,
bx_options.pnic.Oioaddr,
bx_options.pnic.Oirq,
@ -1394,22 +1399,22 @@ void bx_init_options ()
bx_options.pnic.Oscript,
NULL
};
bx_param_c *ne2k_deps_list[] = {
bx_options.ne2k.Oioaddr,
bx_options.ne2k.Oirq,
bx_options.ne2k.Omacaddr,
bx_options.ne2k.Oethmod,
bx_options.ne2k.Oethdev,
bx_options.ne2k.Oscript,
menu = new bx_list_c (BXP_NE2K, "NE2000", "", ne2k_init_list);
menu->get_options ()->set (menu->USE_BOX_TITLE | menu->SHOW_PARENT);
bx_options.ne2k.Opresent->set_dependent_list (
new bx_list_c (BXP_NULL, "", "", ne2k_init_list));
menu = new bx_list_c (BXP_PNIC, "PCI Pseudo NIC", "", pnic_init_list);
menu->get_options ()->set (menu->USE_BOX_TITLE | menu->SHOW_PARENT);
bx_options.pnic.Oenabled->set_dependent_list (
new bx_list_c (BXP_NULL, "", "", pnic_init_list));
bx_param_c *netdev_init_list2[] = {
SIM->get_param (BXP_NE2K),
SIM->get_param (BXP_PNIC),
NULL
};
menu = new bx_list_c (BXP_NE2K, "Network Configuration", "", netdev_init_list);
menu = new bx_list_c (BXP_NETWORK, "Network Configuration", "", netdev_init_list2);
menu->get_options ()->set (menu->SHOW_PARENT);
bx_options.ne2k.Opresent->set_dependent_list (
new bx_list_c (BXP_NULL, "", "", ne2k_deps_list));
bx_param_c **pnic_dependent_list = &netdev_init_list[8];
bx_options.pnic.Oenabled->set_dependent_list (
new bx_list_c (BXP_NULL, "", "", pnic_dependent_list));
// SB16 options
bx_options.sb16.Opresent = new bx_param_bool_c (BXP_SB16_PRESENT,
@ -1537,17 +1542,18 @@ void bx_init_options ()
// clock
bx_options.clock.Otime0 = new bx_param_num_c (BXP_CLOCK_TIME0,
"clock:time0",
"Initial CMOS time",
"Initial time for Bochs CMOS clock, used if you really want two runs to be identical",
0, BX_MAX_BIT32U,
BX_CLOCK_TIME0_LOCAL);
bx_options.clock.Osync = new bx_param_enum_c (BXP_CLOCK_SYNC,
"clock:sync",
"Synchronisation method",
"Host to guest time synchronization method",
clock_sync_names,
BX_CLOCK_SYNC_NONE,
BX_CLOCK_SYNC_NONE);
bx_param_c *clock_init_list[] = {
bx_options.Oips,
bx_options.clock.Osync,
bx_options.clock.Otime0,
NULL
@ -1561,7 +1567,7 @@ void bx_init_options ()
bx_options.clock.Otime0->set_label ("Initial CMOS time for Bochs\n(1:localtime, 2:utc, other:time in seconds)");
bx_options.clock.Osync->set_label ("Synchronisation method");
menu = new bx_list_c (BXP_CLOCK, "Clock parameters", "", clock_init_list);
menu->get_options ()->set (menu->SERIES_ASK);
menu->get_options ()->set (menu->SHOW_PARENT);
// other
bx_options.Okeyboard_serial_delay = new bx_param_num_c (BXP_KBD_SERIAL_DELAY,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.126 2004-10-17 16:25:10 vruppert Exp $
// $Id: siminterface.h,v 1.127 2004-10-24 20:04:51 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Before I can describe what this file is for, I have to make the
@ -136,6 +136,7 @@ typedef enum {
BXP_OPTROM2_ADDRESS,
BXP_OPTROM3_ADDRESS,
BXP_OPTROM4_ADDRESS,
BXP_OPTROM_LIST,
BXP_KBD_SERIAL_DELAY,
BXP_KBD_PASTE_DELAY,
BXP_KBD_TYPE,
@ -331,13 +332,6 @@ typedef enum {
BXP_USB1_ENABLED,
BXP_USB1_IOADDR,
BXP_USB1_IRQ,
BXP_PNIC_ENABLED,
BXP_PNIC_IOADDR,
BXP_PNIC_IRQ,
BXP_PNIC_MACADDR,
BXP_PNIC_ETHMOD,
BXP_PNIC_ETHDEV,
BXP_PNIC_SCRIPT,
BXP_PRIVATE_COLORMAP,
BXP_FULLSCREEN,
BXP_SCREENMODE,
@ -381,6 +375,15 @@ typedef enum {
BXP_NE2K_ETHDEV,
BXP_NE2K_SCRIPT,
BXP_NE2K,
BXP_PNIC_ENABLED,
BXP_PNIC_IOADDR,
BXP_PNIC_IRQ,
BXP_PNIC_MACADDR,
BXP_PNIC_ETHMOD,
BXP_PNIC_ETHDEV,
BXP_PNIC_SCRIPT,
BXP_PNIC,
BXP_NETWORK,
BXP_PCIDEV_VENDOR,
BXP_PCIDEV_DEVICE,
BXP_PCIDEV,

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.27 2004-10-07 17:38:02 vruppert Exp $
// $Id: textconfig.cc,v 1.28 2004-10-24 20:04:51 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// This is code for a text-mode configuration interface. Note that this file
@ -352,7 +352,11 @@ int do_menu (bx_id id) {
bx_param_c *chosen = menu->get (index);
assert (chosen != NULL);
if (chosen->get_enabled ()) {
chosen->text_ask (stdin, stderr);
if (chosen->get_type () == BXT_LIST) {
do_menu(chosen->get_id ());
} else {
chosen->text_ask (stdin, stderr);
}
}
}
}
@ -448,7 +452,7 @@ int bx_config_interface (int menu)
case 8: do_menu (BXP_MENU_DISK); break;
case 9: do_menu (BXP_MENU_SERIAL_PARALLEL); break;
case 10: do_menu (BXP_SB16); break;
case 11: do_menu (BXP_NE2K); break;
case 11: do_menu (BXP_NETWORK); break;
case 12: do_menu (BXP_MENU_KEYBOARD); break;
case 13: do_menu (BXP_PCI); break;
case 14: do_menu (BXP_MENU_MISC); break;
@ -956,10 +960,14 @@ bx_list_c::text_ask (FILE *fpin, FILE *fpout)
assert (list[i] != NULL);
fprintf (fpout, "%d. ", i+1);
if (list[i]->get_enabled ()) {
if ((options->get () & SHOW_GROUP_NAME) && (list[i]->get_group () != NULL))
fprintf (fpout, "%s ", list[i]->get_group ());
list[i]->text_print (fpout);
fprintf (fpout, "\n");
if (list[i]->get_type () == BXT_LIST) {
fprintf (fpout, "%s\n", list[i]->get_name ());
} else {
if ((options->get () & SHOW_GROUP_NAME) && (list[i]->get_group () != NULL))
fprintf (fpout, "%s ", list[i]->get_group ());
list[i]->text_print (fpout);
fprintf (fpout, "\n");
}
} else
fprintf (fpout, "(disabled)\n");
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wx.cc,v 1.72 2004-10-03 09:11:28 vruppert Exp $
// $Id: wx.cc,v 1.73 2004-10-24 20:04:51 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxWidgets VGA display for Bochs. wx.cc implements a custom
@ -1032,17 +1032,33 @@ void bx_wx_gui_c::handle_events(void)
void
bx_wx_gui_c::statusbar_setitem(int element, bx_bool active)
{
#if defined( __WXMSW__)
char status_text[10];
#endif
if (element < 0) {
for (unsigned i = 0; i < statusitem_count; i++) {
if (active) {
#if defined( __WXMSW__)
status_text[0] = 9;
strcpy(status_text+1, statusitem_text[i]);
theFrame->SetStatusText(status_text, i+1);
#else
theFrame->SetStatusText(statusitem_text[i], i+1);
#endif
} else {
theFrame->SetStatusText("", i+1);
}
}
} else if ((unsigned)element < statusitem_count) {
if (active) {
#if defined( __WXMSW__)
status_text[0] = 9;
strcpy(status_text+1, statusitem_text[element]);
theFrame->SetStatusText(status_text, element+1);
#else
theFrame->SetStatusText(statusitem_text[element], element+1);
#endif
} else {
theFrame->SetStatusText("", element+1);
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxdialog.cc,v 1.73 2004-10-16 15:44:00 vruppert Exp $
// $Id: wxdialog.cc,v 1.74 2004-10-24 20:04:51 vruppert Exp $
/////////////////////////////////////////////////////////////////
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
@ -1676,10 +1676,6 @@ ConfigMemoryDialog::ConfigMemoryDialog(
{
bx_id standardList[] = {BXP_MEM_SIZE, BXP_ROM_PATH, BXP_ROM_ADDRESS,
BXP_VGA_ROM_PATH, BXP_NULL};
bx_id optionalList[] = {BXP_OPTROM1_PATH, BXP_OPTROM1_ADDRESS,
BXP_OPTROM2_PATH, BXP_OPTROM2_ADDRESS,
BXP_OPTROM3_PATH, BXP_OPTROM3_ADDRESS,
BXP_OPTROM4_PATH, BXP_OPTROM4_ADDRESS, BXP_NULL};
int insideStaticBoxMargin = 15;
SetTitle (CONFIG_MEMORY_TITLE);
@ -1688,10 +1684,6 @@ ConfigMemoryDialog::ConfigMemoryDialog(
wxStaticBoxSizer *box1sizer = new wxStaticBoxSizer (box1, wxVERTICAL);
mainSizer->Add (box1sizer, 0, wxALL|wxGROW, 10);
wxStaticBox *box2 = new wxStaticBox (this, -1, CONFIG_MEMORY_BOX2_TITLE);
wxStaticBoxSizer *box2sizer = new wxStaticBoxSizer (box2, wxVERTICAL);
mainSizer->Add (box2sizer, 0, wxALL|wxGROW, 10);
// box1 contents
box1gridSizer = new wxFlexGridSizer (3);
box1sizer->Add (box1gridSizer, 0, wxALL, insideStaticBoxMargin);
@ -1700,10 +1692,10 @@ ConfigMemoryDialog::ConfigMemoryDialog(
box1gridSizer->Add (vgabiosaddr1, 0, wxALIGN_RIGHT|wxALL, 2);
wxStaticText *vgabiosaddr2 = new wxStaticText (this, -1, "0xC0000");
box1gridSizer->Add (vgabiosaddr2, 0, wxALL, 2);
// box2 contents
box2gridSizer = new wxFlexGridSizer (3);
box2sizer->Add (box2gridSizer, 0, wxALL, insideStaticBoxMargin);
AddParamList (optionalList, box2gridSizer);
// box2 contains a list
bx_list_c *list = (bx_list_c *) SIM->get_param (BXP_OPTROM_LIST);
AddParam (list);
}
/////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.108 2004-10-17 16:25:10 vruppert Exp $
// $Id: wxmain.cc,v 1.109 2004-10-24 20:04:52 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs.
@ -620,7 +620,6 @@ void MyFrame::OnEditSound(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnEditTiming(wxCommandEvent& WXUNUSED(event))
{
ParamDialog dlg (this, -1);
dlg.AddParam (SIM->get_param (BXP_IPS));
bx_list_c *list = (bx_list_c*) SIM->get_param (BXP_CLOCK);
dlg.SetTitle (list->get_name ());
dlg.AddParam (list);
@ -630,7 +629,7 @@ void MyFrame::OnEditTiming(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnEditNet(wxCommandEvent& WXUNUSED(event))
{
ParamDialog dlg (this, -1);
bx_list_c *list = (bx_list_c*) SIM->get_param (BXP_NE2K);
bx_list_c *list = (bx_list_c*) SIM->get_param (BXP_NETWORK);
dlg.SetTitle (list->get_name ());
dlg.AddParam (list);
dlg.ShowModal ();
@ -1094,46 +1093,6 @@ MyFrame::HandleAskParam (BxEvent *event)
return -1;
}
}
#if 0
switch (param) {
case BXP_FLOPPYA_PATH:
case BXP_FLOPPYB_PATH:
case BXP_DISKC_PATH:
case BXP_DISKD_PATH:
case BXP_CDROM_PATH:
{
Raise(); // bring window to front so dialog shows
char *msg;
if (param==BXP_FLOPPYA_PATH || param==BXP_FLOPPYB_PATH)
msg = "Choose new floppy disk image file";
else if (param==BXP_DISKC_PATH || param==BXP_DISKD_PATH)
msg = "Choose new hard disk image file";
else if (param==BXP_CDROM_PATH)
msg = "Choose new CDROM image file";
else
msg = "Choose new image file";
wxFileDialog dialog(this, msg, "", "", "*.*", 0);
int ret = dialog.ShowModal();
if (ret == wxID_OK)
{
char *newpath = (char *)dialog.GetPath().c_str ();
if (newpath && strlen(newpath)>0) {
// change floppy path to this value.
bx_param_string_c *Opath = SIM->get_param_string (param);
assert (Opath != NULL);
wxLogDebug ("Setting floppy %c path to '%s'",
param == BXP_FLOPPYA_PATH ? 'A' : 'B',
newpath);
Opath->set (newpath);
return 1;
}
}
return 0;
}
default:
wxLogError ("HandleAskParam: parameter %d, not implemented", event->u.param.id);
}
#endif
return -1; // could not display
}