- use the bochsrc path for the initial directory of the win32 file dialogs

- runtime config: update the options of the modified tab items only
- removed brackets from the device prefixes in the log options listbox
This commit is contained in:
Volker Ruppert 2004-02-04 19:54:58 +00:00
parent 95e27bfc27
commit 050de9ef04
3 changed files with 71 additions and 42 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.116 2004-01-29 18:50:32 vruppert Exp $ // $Id: siminterface.h,v 1.117 2004-02-04 19:54:56 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Before I can describe what this file is for, I have to make the // Before I can describe what this file is for, I have to make the
@ -1450,7 +1450,7 @@ BOCHSAPI extern bx_simulator_interface_c *SIM;
BOCHSAPI extern void bx_init_siminterface (); BOCHSAPI extern void bx_init_siminterface ();
BOCHSAPI extern int bx_init_main (int argc, char *argv[]); BOCHSAPI extern int bx_init_main (int argc, char *argv[]);
#ifdef __WXMSW__ #if defined(__WXMSW__) || defined(WIN32)
// Just to provide HINSTANCE, etc. in files that have not included bochs.h. // Just to provide HINSTANCE, etc. in files that have not included bochs.h.
// I don't like this at all, but I don't see a way around it. // I don't like this at all, but I don't see a way around it.
#include <windows.h> #include <windows.h>
@ -1461,6 +1461,9 @@ typedef struct BOCHSAPI {
// standard argc,argv // standard argc,argv
int argc; int argc;
char **argv; char **argv;
#ifdef WIN32
char initial_dir[MAX_PATH];
#endif
#ifdef __WXMSW__ #ifdef __WXMSW__
// these are only used when compiling with wxWindows. This gives us a // these are only used when compiling with wxWindows. This gives us a
// place to store the data that was passed to WinMain. // place to store the data that was passed to WinMain.

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.17 2004-02-03 22:40:33 vruppert Exp $ // $Id: win32dialog.cc,v 1.18 2004-02-04 19:54:58 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
#include "config.h" #include "config.h"
@ -301,6 +301,7 @@ void RuntimeDlgInitLogOpt(HWND hDlg)
char choices[5][16] = {"ignore", "log", "ask user", "end simulation", "no change"}; char choices[5][16] = {"ignore", "log", "ask user", "end simulation", "no change"};
int level, idx, mod, mod_max; int level, idx, mod, mod_max;
int defchoice[5]; int defchoice[5];
char prefix[8];
mod_max = SIM->get_n_log_modules (); mod_max = SIM->get_n_log_modules ();
for (level=0; level<5; level++) { for (level=0; level<5; level++) {
@ -336,7 +337,10 @@ void RuntimeDlgInitLogOpt(HWND hDlg)
idx = 0; idx = 0;
for (mod=0; mod<mod_max; mod++) { for (mod=0; mod<mod_max; mod++) {
if (strcmp(SIM->get_prefix(mod), "[ ]")) { if (strcmp(SIM->get_prefix(mod), "[ ]")) {
SendMessage(GetDlgItem(hDlg, IDDEVLIST), LB_ADDSTRING, 0, (LPARAM)SIM->get_prefix(mod)); lstrcpyn(prefix, SIM->get_prefix(mod), sizeof(prefix));
lstrcpy(prefix, prefix+1);
prefix[5] = 0;
SendMessage(GetDlgItem(hDlg, IDDEVLIST), LB_ADDSTRING, 0, (LPARAM)prefix);
SendMessage(GetDlgItem(hDlg, IDDEVLIST), LB_SETITEMDATA, idx, mod); SendMessage(GetDlgItem(hDlg, IDDEVLIST), LB_SETITEMDATA, idx, mod);
idx++; idx++;
} }
@ -351,8 +355,8 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
int device, tabnum; int device, tabnum;
static int devcount; static int devcount;
long noticode; long noticode;
static BOOL changed; static unsigned changed;
BOOL old_changed; unsigned old_changed;
int idx, level, value; int idx, level, value;
char buffer[32]; char buffer[32];
static bx_atadevice_options cdromop[4]; static bx_atadevice_options cdromop[4];
@ -399,8 +403,7 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
} }
SetDlgItemText(hDlg, IDUSERBTN, SIM->get_param_string(BXP_USER_SHORTCUT)->getptr()); SetDlgItemText(hDlg, IDUSERBTN, SIM->get_param_string(BXP_USER_SHORTCUT)->getptr());
EnableWindow(GetDlgItem(hDlg, IDAPPLY), FALSE); EnableWindow(GetDlgItem(hDlg, IDAPPLY), FALSE);
changed = FALSE; changed = 0;
old_changed = FALSE;
break; break;
case WM_CLOSE: case WM_CLOSE:
for (device=1; device<devcount; device++) { for (device=1; device<devcount; device++) {
@ -417,10 +420,12 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
case IDCDROM2: case IDCDROM2:
case IDCDROM3: case IDCDROM3:
case IDCDROM4: case IDCDROM4:
changed |= 0x01;
break;
case IDVGAUPDATE: case IDVGAUPDATE:
case IDKBDPASTE: case IDKBDPASTE:
case IDUSERBTN: case IDUSERBTN:
changed = TRUE; changed |= 0x04;
break; break;
} }
break; break;
@ -443,7 +448,10 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
case IDLOGEVT4: case IDLOGEVT4:
case IDLOGEVT5: case IDLOGEVT5:
if (HIWORD(wParam) == CBN_SELCHANGE) { if (HIWORD(wParam) == CBN_SELCHANGE) {
changed = TRUE; if ((changed & 0x02) == 0) {
EnableWindow(GetDlgItem(hDlg, IDADVLOGOPT), FALSE);
}
changed |= 0x02;
} }
break; break;
case IDADVLOGOPT: case IDADVLOGOPT:
@ -452,44 +460,54 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
case IDSTATUS2: case IDSTATUS2:
case IDSTATUS3: case IDSTATUS3:
case IDSTATUS4: case IDSTATUS4:
changed |= 0x01;
break;
case IDMOUSE: case IDMOUSE:
changed = TRUE; changed |= 0x04;
break; break;
case IDAPPLY: case IDAPPLY:
for (device=1; device<devcount; device++) { if (changed & 0x01) {
if (SendMessage(GetDlgItem(hDlg, IDSTATUS1+device), BM_GETCHECK, 0, 0) == BST_CHECKED) { for (device=1; device<devcount; device++) {
GetDlgItemText(hDlg, IDCDROM1+device, path, MAX_PATH); if (SendMessage(GetDlgItem(hDlg, IDSTATUS1+device), BM_GETCHECK, 0, 0) == BST_CHECKED) {
if (lstrlen(path)) { GetDlgItemText(hDlg, IDCDROM1+device, path, MAX_PATH);
cdromop[device].Ostatus->set(BX_INSERTED); if (lstrlen(path)) {
cdromop[device].Ostatus->set(BX_INSERTED);
} else {
cdromop[device].Ostatus->set(BX_EJECTED);
lstrcpy(path, "none");
}
} else { } else {
cdromop[device].Ostatus->set(BX_EJECTED); cdromop[device].Ostatus->set(BX_EJECTED);
lstrcpy(path, "none"); lstrcpy(path, "none");
} }
} else { cdromop[device].Opath->set(path);
cdromop[device].Ostatus->set(BX_EJECTED);
lstrcpy(path, "none");
}
cdromop[device].Opath->set(path);
}
for (level=0; level<5; level++) {
idx = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETCURSEL, 0, 0);
value = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETITEMDATA, idx, 0);
if (value < 4) {
// set new default
SIM->set_default_log_action (level, value);
// apply that action to all modules (devices)
SIM->set_log_action (-1, level, value);
} }
} }
value = GetDlgItemInt(hDlg, IDVGAUPDATE, NULL, FALSE); if (changed & 0x02) {
SIM->get_param_num(BXP_VGA_UPDATE_INTERVAL)->set(value); for (level=0; level<5; level++) {
value = GetDlgItemInt(hDlg, IDKBDPASTE, NULL, FALSE); idx = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETCURSEL, 0, 0);
SIM->get_param_num(BXP_KBD_PASTE_DELAY)->set(value); value = SendMessage(GetDlgItem(hDlg, IDLOGEVT1+level), CB_GETITEMDATA, idx, 0);
value = SendMessage(GetDlgItem(hDlg, IDMOUSE), BM_GETCHECK, 0, 0); if (value < 4) {
SIM->get_param_num(BXP_MOUSE_ENABLED)->set(value==BST_CHECKED); // set new default
GetDlgItemText(hDlg, IDUSERBTN, buffer, sizeof(buffer)); SIM->set_default_log_action (level, value);
SIM->get_param_string(BXP_USER_SHORTCUT)->set(buffer); // apply that action to all modules (devices)
changed = FALSE; SIM->set_log_action (-1, level, value);
}
}
EnableWindow(GetDlgItem(hDlg, IDADVLOGOPT), TRUE);
}
if (changed & 0x04) {
value = GetDlgItemInt(hDlg, IDVGAUPDATE, NULL, FALSE);
SIM->get_param_num(BXP_VGA_UPDATE_INTERVAL)->set(value);
value = GetDlgItemInt(hDlg, IDKBDPASTE, NULL, FALSE);
SIM->get_param_num(BXP_KBD_PASTE_DELAY)->set(value);
value = SendMessage(GetDlgItem(hDlg, IDMOUSE), BM_GETCHECK, 0, 0);
SIM->get_param_num(BXP_MOUSE_ENABLED)->set(value==BST_CHECKED);
GetDlgItemText(hDlg, IDUSERBTN, buffer, sizeof(buffer));
SIM->get_param_string(BXP_USER_SHORTCUT)->set(buffer);
}
EnableWindow(GetDlgItem(hDlg, IDAPPLY), FALSE);
changed = 0;
break; break;
case IDOK: case IDOK:
EndDialog(hDlg, 15); EndDialog(hDlg, 15);
@ -502,8 +520,8 @@ static BOOL CALLBACK RuntimeDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
break; break;
} }
} }
if (changed != old_changed) { if ((changed > 0) && (old_changed == 0)) {
EnableWindow(GetDlgItem(hDlg, IDAPPLY), changed); EnableWindow(GetDlgItem(hDlg, IDAPPLY), TRUE);
} }
break; break;
case WM_NOTIFY: case WM_NOTIFY:
@ -544,6 +562,7 @@ int AskFilename(HWND hwnd, bx_param_filename_c *param, const char *ext)
ofn.hwndOwner = hwnd; ofn.hwndOwner = hwnd;
ofn.lpstrFile = filename; ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH; ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = bx_startup_flags.initial_dir;
ofn.lpstrTitle = title; ofn.lpstrTitle = title;
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY; ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY;
ofn.lpstrDefExt = ext; ofn.lpstrDefExt = ext;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.263 2004-01-29 18:50:31 vruppert Exp $ // $Id: main.cc,v 1.264 2004-02-04 19:54:52 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -2243,6 +2243,13 @@ bx_init_main (int argc, char *argv[])
if (load_rcfile) { if (load_rcfile) {
/* parse configuration file and command line arguments */ /* parse configuration file and command line arguments */
#ifdef WIN32
if (bochsrc_filename != NULL) {
lstrcpy(bx_startup_flags.initial_dir, bochsrc_filename);
} else {
bx_startup_flags.initial_dir[0] = 0;
}
#endif
if (bochsrc_filename == NULL) bochsrc_filename = bx_find_bochsrc (); if (bochsrc_filename == NULL) bochsrc_filename = bx_find_bochsrc ();
if (bochsrc_filename) if (bochsrc_filename)
norcfile = bx_read_configuration (bochsrc_filename); norcfile = bx_read_configuration (bochsrc_filename);