- "ask" dialogbox as an extension of the "textconfig" interface on the win32 platform added

This commit is contained in:
Volker Ruppert 2003-05-21 20:33:24 +00:00
parent 6822fa35a3
commit 7edc0948b7
8 changed files with 118 additions and 3 deletions

4
bochs/configure vendored
View File

@ -22194,6 +22194,7 @@ _ACEOF
;;
esac
DIALOG_OBJS=""
case $target in
*-pc-windows* | *-pc-winnt* | *-cygwin* | *-mingw*)
if test "$bx_plugins" = 1; then
@ -22261,9 +22262,11 @@ fi
PLUGIN_LIBNAME_TRANSFORMATION='%.o=bx_%.dll'
INSTALL_PLUGINS_VAR=install_dll_plugins
fi
DIALOG_OBJS="win32dialog.o"
;;
esac
if test "$use_curses" = yes -a "$cross_configure" = 0; then
echo "$as_me:$LINENO: checking for mvaddch in -lcurses" >&5
echo $ECHO_N "checking for mvaddch in -lcurses... $ECHO_C" >&6
@ -24054,6 +24057,7 @@ s,@GUI_CFLAGS@,$GUI_CFLAGS,;t t
s,@GUI_CXXFLAGS@,$GUI_CXXFLAGS,;t t
s,@WX_CFLAGS@,$WX_CFLAGS,;t t
s,@WX_CXXFLAGS@,$WX_CXXFLAGS,;t t
s,@DIALOG_OBJS@,$DIALOG_OBJS,;t t
s,@PTHREAD_CC@,$PTHREAD_CC,;t t
s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t
s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.208 2003-05-21 16:16:04 sshwarts Exp $]])
AC_REVISION([[$Id: configure.in,v 1.209 2003-05-21 20:33:23 vruppert Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -2052,6 +2052,7 @@ case "$target" in
;;
esac
DIALOG_OBJS=""
case $target in
*-pc-windows* | *-pc-winnt* | *-cygwin* | *-mingw*)
if test "$bx_plugins" = 1; then
@ -2061,8 +2062,10 @@ case $target in
PLUGIN_LIBNAME_TRANSFORMATION='%.o=bx_%.dll'
INSTALL_PLUGINS_VAR=install_dll_plugins
fi
DIALOG_OBJS="win32dialog.o"
;;
esac
AC_SUBST(DIALOG_OBJS)
if test "$use_curses" = yes -a "$cross_configure" = 0; then
AC_CHECK_LIB(curses, mvaddch, GUI_LINK_OPTS_TERM='-lcurses')

View File

@ -69,7 +69,7 @@ GUI_OBJS_RFB = rfb.o
GUI_OBJS_AMIGAOS = amigaos.o
GUI_OBJS_WX = wx.o
GUI_OBJS_WX_SUPPORT = wxmain.o wxdialog.o
OBJS_THAT_CANNOT_BE_PLUGINS = keymap.o gui.o siminterface.o textconfig.o
OBJS_THAT_CANNOT_BE_PLUGINS = keymap.o gui.o siminterface.o textconfig.o @DIALOG_OBJS@
OBJS_THAT_CAN_BE_PLUGINS = @GUI_OBJS@
NONPLUGIN_OBJS = @GUI_NON_PLUGIN_OBJS@

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: textconfig.cc,v 1.8 2002-12-17 05:58:45 bdenney Exp $
// $Id: textconfig.cc,v 1.9 2003-05-21 20:33:24 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// This is code for a text-mode configuration interfac. Note that this file
@ -24,6 +24,9 @@ extern "C" {
#include "textconfig.h"
#include "siminterface.h"
#include "extplugin.h"
#ifdef WIN32
#include "win32dialog.h"
#endif
#define CI_PATH_LENGTH 512
@ -673,6 +676,9 @@ config_interface_notify_callback (void *unused, BxEvent *event)
return event;
case BX_SYNC_EVT_LOG_ASK:
{
#ifdef WIN32
LogAskDialog(event);
#else
int level = event->u.logmsg.level;
fprintf (stderr, "========================================================================\n");
fprintf (stderr, "Event type: %s\n", SIM->get_log_level_name (level));
@ -698,6 +704,7 @@ ask:
fflush(stdout);
fflush(stderr);
event->retcode = choice;
#endif
}
return event;
case BX_ASYNC_EVT_REFRESH:

71
bochs/gui/win32dialog.cc Normal file
View File

@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.1 2003-05-21 20:33:24 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#ifdef WIN32
#include "config.h"
extern "C" {
#include <stdio.h>
#include <windows.h>
}
#include "win32res.h"
#include "siminterface.h"
HWND GetBochsWindow()
{
HWND hwnd;
hwnd = FindWindow("Bochs for Windows", NULL);
if (hwnd == NULL) {
hwnd = GetForegroundWindow();
}
return hwnd;
}
static BOOL CALLBACK LogAskProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BxEvent *event;
int level;
switch (msg) {
case WM_INITDIALOG:
event = (BxEvent*)lParam;
level = event->u.logmsg.level;
SetWindowText(hDlg, SIM->get_log_level_name(level));
SetWindowText(GetDlgItem(hDlg, IDASKDEV), event->u.logmsg.prefix);
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 BX_DEBUGGER
SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_ADDSTRING, 0, (LPARAM)"Continue and return to debugger");
#endif
SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_SETCURSEL, 2, 0);
SetFocus(GetDlgItem(hDlg, IDASKLIST));
return FALSE;
case WM_CLOSE:
EndDialog(hDlg, 2);
break;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hDlg, SendMessage(GetDlgItem(hDlg, IDASKLIST), LB_GETCURSEL, 0, 0));
break;
case IDCANCEL:
EndDialog(hDlg, 2);
break;
}
}
return FALSE;
}
void LogAskDialog(BxEvent *event)
{
event->retcode = DialogBoxParam(NULL, MAKEINTRESOURCE(ASK_DLG), GetBochsWindow(),
(DLGPROC)LogAskProc, (LPARAM)event);
}
#endif // WIN32

9
bochs/gui/win32dialog.h Normal file
View File

@ -0,0 +1,9 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.h,v 1.1 2003-05-21 20:33:24 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#ifdef WIN32
void LogAskDialog(BxEvent *event);
#endif

View File

@ -1 +1,8 @@
#define ICON_BOCHS 1000
#define ASK_DLG 2000
#define IDASKTX1 2010
#define IDASKDEV 2020
#define IDASKTX2 2030
#define IDASKMSG 2040
#define IDASKLIST 2050

View File

@ -2,3 +2,17 @@
#include "gui\win32res.h"
ICON_BOCHS ICON build\win32\nsis\bochs.ico
ASK_DLG DIALOG 30, 30, 200, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Event"
FONT 8, "Helv"
BEGIN
LTEXT "Device", IDASKTX1, 10, 12, 40, 14
EDITTEXT IDASKDEV, 45, 10, 145, 14, ES_READONLY
LTEXT "Message", IDASKTX2, 10, 27, 40, 14
EDITTEXT IDASKMSG, 45, 25, 145, 14, ES_READONLY | ES_AUTOHSCROLL
LISTBOX IDASKLIST, 10, 50, 120, 45, WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 140, 50, 50, 14
PUSHBUTTON "Cancel", IDCANCEL, 140, 70, 50, 14
END