- win32 statusbar now shows active items with light green background

- harddisk/cdrom status light feature prepared
This commit is contained in:
Volker Ruppert 2004-02-08 18:38:26 +00:00
parent f4b51462d7
commit d78f3da836
4 changed files with 33 additions and 18 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.73 2004-02-08 10:25:50 vruppert Exp $ // $Id: win32.cc,v 1.74 2004-02-08 18:38:26 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -127,10 +127,11 @@ static int bx_headerbar_entries;
static unsigned bx_hb_separator; static unsigned bx_hb_separator;
// Status Bar stuff // Status Bar stuff
#define SIZE_OF_SB_ELEMENT 30 #define SIZE_OF_SB_ELEMENT 40
#define SIZE_OF_SB_FIRST_ELEMENT 192 #define SIZE_OF_SB_FIRST_ELEMENT 160
long SB_Edges[BX_MAX_STATUSITEMS+2]; long SB_Edges[BX_MAX_STATUSITEMS+2];
char SB_Text[BX_MAX_STATUSITEMS][10]; char SB_Text[BX_MAX_STATUSITEMS][10];
bx_bool SB_Active[BX_MAX_STATUSITEMS];
// Misc stuff // Misc stuff
static unsigned dimension_x, dimension_y, current_bpp; static unsigned dimension_x, dimension_y, current_bpp;
@ -789,17 +790,18 @@ void SetStatusText(int Num, const char *Text, bx_bool active)
{ {
char StatText[MAX_PATH]; char StatText[MAX_PATH];
if (Num < 1) { if ((Num < 1) || (Num > BX_MAX_STATUSITEMS)) {
StatText[0] = ' '; // Add space to text in first item StatText[0] = ' '; // Add space to text in first and last item
} else { } else {
StatText[0] = 9; // Center the rest StatText[0] = 9; // Center the rest
} }
lstrcpy(StatText+1, Text); lstrcpy(StatText+1, Text);
if (active) if ((Num < 1) || (Num > BX_MAX_STATUSITEMS)) {
SendMessage(hwndSB, SB_SETTEXT, Num, (long)StatText); SendMessage(hwndSB, SB_SETTEXT, Num, (long)StatText);
else { } else {
lstrcpy(SB_Text[Num], StatText); lstrcpy(SB_Text[Num-1], StatText);
SendMessage(hwndSB, SB_SETTEXT, Num | SBT_OWNERDRAW, (long)SB_Text[Num]); SB_Active[Num-1] = active;
SendMessage(hwndSB, SB_SETTEXT, Num | SBT_OWNERDRAW, (long)SB_Text[Num-1]);
} }
UpdateWindow(hwndSB); UpdateWindow(hwndSB);
} }
@ -858,8 +860,12 @@ LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
lpdis = (DRAWITEMSTRUCT *)lParam; lpdis = (DRAWITEMSTRUCT *)lParam;
if (lpdis->hwndItem == hwndSB) { if (lpdis->hwndItem == hwndSB) {
sbtext = (char *)lpdis->itemData; sbtext = (char *)lpdis->itemData;
SetBkMode(lpdis->hDC, TRANSPARENT); if (SB_Active[lpdis->itemID-1]) {
SetTextColor(lpdis->hDC, 0x00808080); SetBkColor(lpdis->hDC, 0x0000FF00);
} else {
SetBkMode(lpdis->hDC, TRANSPARENT);
SetTextColor(lpdis->hDC, 0x00808080);
}
DrawText(lpdis->hDC, sbtext+1, lstrlen(sbtext)-1, &lpdis->rcItem, DT_SINGLELINE | DT_CENTER | DT_VCENTER); DrawText(lpdis->hDC, sbtext+1, lstrlen(sbtext)-1, &lpdis->rcItem, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
return TRUE; return TRUE;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.71 2004-02-08 10:25:50 vruppert Exp $ // $Id: floppy.cc,v 1.72 2004-02-08 18:38:26 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -132,7 +132,7 @@ bx_floppy_ctrl_c::init(void)
{ {
Bit8u i; Bit8u i;
BX_DEBUG(("Init $Id: floppy.cc,v 1.71 2004-02-08 10:25:50 vruppert Exp $")); BX_DEBUG(("Init $Id: floppy.cc,v 1.72 2004-02-08 18:38:26 vruppert Exp $"));
DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive"); DEV_dma_register_8bit_channel(2, dma_read, dma_write, "Floppy Drive");
DEV_register_irq(6, "Floppy Drive"); DEV_register_irq(6, "Floppy Drive");
for (unsigned addr=0x03F2; addr<=0x03F7; addr++) { for (unsigned addr=0x03F2; addr<=0x03F7; addr++) {
@ -200,7 +200,7 @@ bx_floppy_ctrl_c::init(void)
} }
if (BX_FD_THIS s.device_type[0] != BX_FLOPPY_NONE) { if (BX_FD_THIS s.device_type[0] != BX_FLOPPY_NONE) {
BX_FD_THIS s.num_supported_floppies++; BX_FD_THIS s.num_supported_floppies++;
BX_FD_THIS s.statusbar_id[0] = bx_gui->register_statusitem("A:"); BX_FD_THIS s.statusbar_id[0] = bx_gui->register_statusitem(" A: ");
} else { } else {
BX_FD_THIS s.statusbar_id[0] = -1; BX_FD_THIS s.statusbar_id[0] = -1;
} }
@ -270,7 +270,7 @@ bx_floppy_ctrl_c::init(void)
} }
if (BX_FD_THIS s.device_type[1] != BX_FLOPPY_NONE) { if (BX_FD_THIS s.device_type[1] != BX_FLOPPY_NONE) {
BX_FD_THIS s.num_supported_floppies++; BX_FD_THIS s.num_supported_floppies++;
BX_FD_THIS s.statusbar_id[1] = bx_gui->register_statusitem("B:"); BX_FD_THIS s.statusbar_id[1] = bx_gui->register_statusitem(" B: ");
} else { } else {
BX_FD_THIS s.statusbar_id[1] = -1; BX_FD_THIS s.statusbar_id[1] = -1;
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.117 2004-02-06 22:28:00 danielg4 Exp $ // $Id: harddrv.cc,v 1.118 2004-02-08 18:38:26 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -158,8 +158,9 @@ bx_hard_drive_c::init(void)
{ {
Bit8u channel; Bit8u channel;
char string[5]; char string[5];
char sbtext[8];
BX_DEBUG(("Init $Id: harddrv.cc,v 1.117 2004-02-06 22:28:00 danielg4 Exp $")); BX_DEBUG(("Init $Id: harddrv.cc,v 1.118 2004-02-08 18:38:26 vruppert Exp $"));
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) { for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
if (bx_options.ata[channel].Opresent->get() == 1) { if (bx_options.ata[channel].Opresent->get() == 1) {
@ -251,6 +252,7 @@ bx_hard_drive_c::init(void)
// If not present // If not present
BX_HD_THIS channels[channel].drives[device].device_type = IDE_NONE; BX_HD_THIS channels[channel].drives[device].device_type = IDE_NONE;
BX_HD_THIS channels[channel].drives[device].statusbar_id = -1;
if (!bx_options.atadevice[channel][device].Opresent->get()) { if (!bx_options.atadevice[channel][device].Opresent->get()) {
continue; continue;
} }
@ -265,6 +267,9 @@ bx_hard_drive_c::init(void)
if (bx_options.atadevice[channel][device].Otype->get() == BX_ATA_DEVICE_DISK) { if (bx_options.atadevice[channel][device].Otype->get() == BX_ATA_DEVICE_DISK) {
BX_DEBUG(( "Hard-Disk on target %d/%d",channel,device)); BX_DEBUG(( "Hard-Disk on target %d/%d",channel,device));
BX_HD_THIS channels[channel].drives[device].device_type = IDE_DISK; BX_HD_THIS channels[channel].drives[device].device_type = IDE_DISK;
sprintf(sbtext, "HD:%d-%s", channel, device?"S":"M");
BX_HD_THIS channels[channel].drives[device].statusbar_id =
bx_gui->register_statusitem(sbtext);
int cyl = bx_options.atadevice[channel][device].Ocylinders->get (); int cyl = bx_options.atadevice[channel][device].Ocylinders->get ();
int heads = bx_options.atadevice[channel][device].Oheads->get (); int heads = bx_options.atadevice[channel][device].Oheads->get ();
@ -389,6 +394,9 @@ bx_hard_drive_c::init(void)
BX_HD_THIS channels[channel].drives[device].sense.sense_key = SENSE_NONE; BX_HD_THIS channels[channel].drives[device].sense.sense_key = SENSE_NONE;
BX_HD_THIS channels[channel].drives[device].sense.asc = 0; BX_HD_THIS channels[channel].drives[device].sense.asc = 0;
BX_HD_THIS channels[channel].drives[device].sense.ascq = 0; BX_HD_THIS channels[channel].drives[device].sense.ascq = 0;
sprintf(sbtext, "CD:%d-%s", channel, device?"S":"M");
BX_HD_THIS channels[channel].drives[device].statusbar_id =
bx_gui->register_statusitem(sbtext);
// Check bit fields // Check bit fields
BX_CONTROLLER(channel,device).sector_count = 0; BX_CONTROLLER(channel,device).sector_count = 0;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: harddrv.h,v 1.23 2004-02-06 22:28:00 danielg4 Exp $ // $Id: harddrv.h,v 1.24 2004-02-08 18:38:26 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2002 MandrakeSoft S.A. // Copyright (C) 2002 MandrakeSoft S.A.
@ -741,6 +741,7 @@ private:
atapi_t atapi; atapi_t atapi;
Bit8u model_no[41]; Bit8u model_no[41];
int statusbar_id;
} drives[2]; } drives[2];
unsigned drive_select; unsigned drive_select;