- win32 statusbar now shows all inactive items grayed
- update floppy items in statusbar on status change only - initialize statusbar and set all items inactive before the simulation starts
This commit is contained in:
parent
c6d65e3694
commit
107c109d04
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: win32.cc,v 1.72 2004-02-07 14:34:34 vruppert Exp $
|
||||
// $Id: win32.cc,v 1.73 2004-02-08 10:25:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -130,6 +130,7 @@ static unsigned bx_hb_separator;
|
||||
#define SIZE_OF_SB_ELEMENT 30
|
||||
#define SIZE_OF_SB_FIRST_ELEMENT 192
|
||||
long SB_Edges[BX_MAX_STATUSITEMS+2];
|
||||
char SB_Text[BX_MAX_STATUSITEMS][10];
|
||||
|
||||
// Misc stuff
|
||||
static unsigned dimension_x, dimension_y, current_bpp;
|
||||
@ -784,7 +785,7 @@ VOID UIThread(PVOID pvoid) {
|
||||
_endthread();
|
||||
}
|
||||
|
||||
void SetStatusText(int Num, const char *Text)
|
||||
void SetStatusText(int Num, const char *Text, bx_bool active)
|
||||
{
|
||||
char StatText[MAX_PATH];
|
||||
|
||||
@ -794,30 +795,39 @@ void SetStatusText(int Num, const char *Text)
|
||||
StatText[0] = 9; // Center the rest
|
||||
}
|
||||
lstrcpy(StatText+1, Text);
|
||||
SendMessage(hwndSB, SB_SETTEXT, Num, (long)StatText);
|
||||
if (active)
|
||||
SendMessage(hwndSB, SB_SETTEXT, Num, (long)StatText);
|
||||
else {
|
||||
lstrcpy(SB_Text[Num], StatText);
|
||||
SendMessage(hwndSB, SB_SETTEXT, Num | SBT_OWNERDRAW, (long)SB_Text[Num]);
|
||||
}
|
||||
UpdateWindow(hwndSB);
|
||||
}
|
||||
|
||||
void
|
||||
bx_win32_gui_c::statusbar_setitem(int element, bx_bool active)
|
||||
{
|
||||
if (element < BX_MAX_STATUSITEMS) {
|
||||
if (active)
|
||||
SetStatusText(element+1, statusitem_text[element]);
|
||||
else
|
||||
SetStatusText(element+1, "");
|
||||
if (element < 0) {
|
||||
for (int i = 0; i < statusitem_count; i++) {
|
||||
SetStatusText(i+1, statusitem_text[i], active);
|
||||
}
|
||||
} else if (element < statusitem_count) {
|
||||
SetStatusText(element+1, statusitem_text[element], active);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {
|
||||
LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
DRAWITEMSTRUCT *lpdis;
|
||||
char *sbtext;
|
||||
|
||||
switch (iMsg) {
|
||||
case WM_CREATE:
|
||||
bx_options.Omouse_enabled->set (mouseCaptureMode);
|
||||
if (mouseCaptureMode)
|
||||
SetStatusText(0, "Press F12 to release mouse");
|
||||
SetStatusText(0, "Press F12 to release mouse", TRUE);
|
||||
else
|
||||
SetStatusText(0, "F12 enables mouse");
|
||||
SetStatusText(0, "F12 enables mouse", TRUE);
|
||||
return 0;
|
||||
|
||||
case WM_COMMAND:
|
||||
@ -844,6 +854,17 @@ LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
SendMessage(hwndTB, TB_AUTOSIZE, 0, 0);
|
||||
break;
|
||||
|
||||
case WM_DRAWITEM:
|
||||
lpdis = (DRAWITEMSTRUCT *)lParam;
|
||||
if (lpdis->hwndItem == hwndSB) {
|
||||
sbtext = (char *)lpdis->itemData;
|
||||
SetBkMode(lpdis->hDC, TRANSPARENT);
|
||||
SetTextColor(lpdis->hDC, 0x00808080);
|
||||
DrawText(lpdis->hDC, sbtext+1, lstrlen(sbtext)-1, &lpdis->rcItem, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return DefWindowProc (hwnd, iMsg, wParam, lParam);
|
||||
}
|
||||
@ -936,9 +957,9 @@ LRESULT CALLBACK simWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
|
||||
SetCursorPos(wndRect.left + stretched_x/2, wndRect.top + stretched_y/2);
|
||||
cursorWarped();
|
||||
if (mouseCaptureMode)
|
||||
SetStatusText(0, "Press F12 to release mouse");
|
||||
SetStatusText(0, "Press F12 to release mouse", TRUE);
|
||||
else
|
||||
SetStatusText(0, "F12 enables mouse");
|
||||
SetStatusText(0, "F12 enables mouse", TRUE);
|
||||
} else {
|
||||
EnterCriticalSection(&stInfo.keyCS);
|
||||
enq_key_event(HIWORD (lParam) & 0x01FF, BX_KEY_PRESSED);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: floppy.cc,v 1.70 2004-02-07 14:34:34 vruppert Exp $
|
||||
// $Id: floppy.cc,v 1.71 2004-02-08 10:25:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -132,7 +132,7 @@ bx_floppy_ctrl_c::init(void)
|
||||
{
|
||||
Bit8u i;
|
||||
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.70 2004-02-07 14:34:34 vruppert Exp $"));
|
||||
BX_DEBUG(("Init $Id: floppy.cc,v 1.71 2004-02-08 10:25:50 vruppert Exp $"));
|
||||
DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive");
|
||||
DEV_register_irq(6, "Floppy Drive");
|
||||
for (unsigned addr=0x03F2; addr<=0x03F7; addr++) {
|
||||
@ -476,13 +476,17 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
|
||||
switch (address) {
|
||||
#if BX_DMA_FLOPPY_IO
|
||||
case 0x3F2: /* diskette controller digital output register */
|
||||
motor_on_drive1 = value & 0x20;
|
||||
motor_on_drive0 = value & 0x10;
|
||||
motor_on_drive1 = value & 0x20;
|
||||
/* set status bar conditions for Floppy 0 and Floppy 1 */
|
||||
if (BX_FD_THIS s.statusbar_id[0] >= 0)
|
||||
bx_gui->statusbar_setitem(BX_FD_THIS s.statusbar_id[0], motor_on_drive0);
|
||||
if (BX_FD_THIS s.statusbar_id[1] >= 0)
|
||||
bx_gui->statusbar_setitem(BX_FD_THIS s.statusbar_id[1], motor_on_drive1);
|
||||
if (BX_FD_THIS s.statusbar_id[0] >= 0) {
|
||||
if (motor_on_drive0 != (BX_FD_THIS s.DOR & 0x10))
|
||||
bx_gui->statusbar_setitem(BX_FD_THIS s.statusbar_id[0], motor_on_drive0);
|
||||
}
|
||||
if (BX_FD_THIS s.statusbar_id[1] >= 0) {
|
||||
if (motor_on_drive1 != (BX_FD_THIS s.DOR & 0x20))
|
||||
bx_gui->statusbar_setitem(BX_FD_THIS s.statusbar_id[1], motor_on_drive1);
|
||||
}
|
||||
dma_and_interrupt_enable = value & 0x08;
|
||||
if (!dma_and_interrupt_enable)
|
||||
BX_DEBUG(("DMA and interrupt capabilities disabled"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: main.cc,v 1.265 2004-02-06 22:27:59 danielg4 Exp $
|
||||
// $Id: main.cc,v 1.266 2004-02-08 10:25:50 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -2396,6 +2396,8 @@ bx_begin_simulation (int argc, char *argv[])
|
||||
|
||||
// update headerbar buttons since drive status can change during init
|
||||
bx_gui->update_drive_status_buttons ();
|
||||
// iniialize statusbar and set all items inactive
|
||||
bx_gui->statusbar_setitem(-1, 0);
|
||||
|
||||
// The set handler for mouse_enabled does not actually update the gui
|
||||
// until init_done is set. This forces the set handler to be called,
|
||||
|
Loading…
Reference in New Issue
Block a user