Merged patch with blinking HDD led in RED color when HDD write occurs (GREEN when HDD read)

This commit is contained in:
Stanislav Shwartsman 2008-10-06 22:00:11 +00:00
parent 3b0e84d9e3
commit 0df223d363
6 changed files with 55 additions and 41 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.58 2008-09-26 11:05:07 sshwarts Exp $
// $Id: gui.h,v 1.59 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -96,7 +96,7 @@ public:
virtual int get_clipboard_text(Bit8u **bytes, Bit32s *nbytes) = 0;
virtual int set_clipboard_text(char *snapshot, Bit32u len) = 0;
virtual void mouse_enabled_changed_specific (bx_bool val) = 0;
virtual void statusbar_setitem(int element, bx_bool active) {}
virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0) {}
virtual void set_tooltip(unsigned hbar_id, const char *tip) {}
virtual void exit(void) = 0;
// set_display_mode() changes the mode between the configuration interface

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rfb.cc,v 1.59 2008-09-26 11:05:07 sshwarts Exp $
// $Id: rfb.cc,v 1.60 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 Psyon.Org!
@ -51,12 +51,14 @@ public:
DECLARE_GUI_VIRTUAL_METHODS()
DECLARE_GUI_NEW_VIRTUAL_METHODS()
void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
void statusbar_setitem(int element, bx_bool active);
void statusbar_setitem(int element, bx_bool active, bx_bool w=0);
#if BX_SHOW_IPS
void show_ips(Bit32u ips_count);
#endif
};
void rfbSetStatusText(int element, const char *text, bx_bool active, bx_bool w=0);
// declare one instance of the gui object and call macro to insert the
// plugin code
static bx_rfb_gui_c *theGui = NULL;
@ -288,7 +290,7 @@ void bx_rfb_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsi
dialog_caps = 0;
}
void rfbSetStatusText(int element, const char *text, bx_bool active)
void rfbSetStatusText(int element, const char *text, bx_bool active, bx_bool w)
{
char *newBits;
unsigned xleft, xsize, color, i, len;
@ -302,7 +304,7 @@ void rfbSetStatusText(int element, const char *text, bx_bool active)
newBits[((xsize / 8) + 1) * i] = 0;
}
if (element > 0) {
color = active?0xa0:0xf7;
color = color = active?(w?0xc0:0xa0):0xf7;
} else {
color = 0xf0;
}
@ -320,14 +322,14 @@ void rfbSetStatusText(int element, const char *text, bx_bool active)
rfbUpdateRegion.updated = true;
}
void bx_rfb_gui_c::statusbar_setitem(int element, bx_bool active)
void bx_rfb_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w)
{
if (element < 0) {
for (unsigned i = 0; i < statusitem_count; i++) {
rfbSetStatusText(i+1, statusitem_text[i], active);
rfbSetStatusText(i+1, statusitem_text[i], active, w);
}
} else if ((unsigned)element < statusitem_count) {
rfbSetStatusText(element+1, statusitem_text[element], active);
rfbSetStatusText(element+1, statusitem_text[element], active, w);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: sdl.cc,v 1.75 2008-09-26 11:05:07 sshwarts Exp $
// $Id: sdl.cc,v 1.76 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -53,12 +53,14 @@ public:
DECLARE_GUI_VIRTUAL_METHODS()
DECLARE_GUI_NEW_VIRTUAL_METHODS()
virtual void set_display_mode(disp_mode_t newmode);
virtual void statusbar_setitem(int element, bx_bool active);
virtual void statusbar_setitem(int element, bx_bool active, bx_bool w = 0);
#if BX_SHOW_IPS
virtual void show_ips(Bit32u ips_count);
#endif
};
void sdl_set_status_text(int element, const char *text, bx_bool active, bx_bool w = 0);
// declare one instance of the gui object and call macro to insert the
// plugin code
static bx_sdl_gui_c *theGui = NULL;
@ -69,9 +71,11 @@ IMPLEMENT_GUI_PLUGIN_CODE(sdl)
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const Uint32 status_led_green = 0x00ff0000;
const Uint32 status_gray_text = 0x80808000;
const Uint32 status_led_red = 0x0040ff00;
#else
const Uint32 status_led_green = 0x0000ff00;
const Uint32 status_gray_text = 0x00808080;
const Uint32 status_led_red = 0x00ff4000;
#endif
static unsigned prev_cursor_x=0;
@ -350,7 +354,7 @@ void bx_sdl_gui_c::specific_init(int argc, char **argv,
#endif
}
void sdl_set_status_text(int element, const char *text, bx_bool active)
void sdl_set_status_text(int element, const char *text, bx_bool active, bx_bool w)
{
Uint32 *buf, *buf_row;
Uint32 disp, fgcolor, bgcolor;
@ -368,7 +372,7 @@ void sdl_set_status_text(int element, const char *text, bx_bool active)
rowsleft = statusbar_height - 2;
fgcolor = active?headerbar_fg:status_gray_text;
if (element > 0) {
bgcolor = active?status_led_green:headerbar_bg;
bgcolor = active?(w?status_led_red:status_led_green):headerbar_bg;
} else {
bgcolor = headerbar_bg;
}
@ -413,14 +417,14 @@ void sdl_set_status_text(int element, const char *text, bx_bool active)
SDL_UpdateRect(sdl_screen, xleft,res_y+headerbar_height+1,xsize,statusbar_height-2);
}
void bx_sdl_gui_c::statusbar_setitem(int element, bx_bool active)
void bx_sdl_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w)
{
if (element < 0) {
for (unsigned i = 0; i < statusitem_count; i++) {
sdl_set_status_text(i+1, statusitem_text[i], active);
sdl_set_status_text(i+1, statusitem_text[i], active, w);
}
} else if ((unsigned)element < statusitem_count) {
sdl_set_status_text(element+1, statusitem_text[element], active);
sdl_set_status_text(element+1, statusitem_text[element], active, w);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.120 2008-06-01 10:56:29 vruppert Exp $
// $Id: win32.cc,v 1.121 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -50,7 +50,7 @@ class bx_win32_gui_c : public bx_gui_c {
public:
bx_win32_gui_c (void) {}
DECLARE_GUI_VIRTUAL_METHODS();
virtual void statusbar_setitem(int element, bx_bool active);
virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0);
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
virtual void set_tooltip(unsigned hbar_id, const char *tip);
#if BX_SHOW_IPS
@ -168,6 +168,7 @@ static char ipsText[20];
long SB_Edges[BX_MAX_STATUSITEMS+BX_SB_TEXT_ELEMENTS+1];
char SB_Text[BX_MAX_STATUSITEMS][10];
bx_bool SB_Active[BX_MAX_STATUSITEMS];
bx_bool SB_ActiveW[BX_MAX_STATUSITEMS];
// Misc stuff
static unsigned dimension_x, dimension_y, current_bpp;
@ -207,7 +208,7 @@ sharedThreadInfo stInfo;
LRESULT CALLBACK mainWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK simWndProc (HWND, UINT, WPARAM, LPARAM);
VOID CDECL UIThread(PVOID);
void SetStatusText(int Num, const char *Text, bx_bool active);
void SetStatusText(int Num, const char *Text, bx_bool active, bx_bool w=0);
void terminateEmul(int);
void create_vga_font(void);
static unsigned char reverse_bitorder(unsigned char);
@ -939,7 +940,7 @@ VOID CDECL UIThread(PVOID pvoid)
_endthread();
}
void SetStatusText(int Num, const char *Text, bx_bool active)
void SetStatusText(int Num, const char *Text, bx_bool active, bx_bool w)
{
char StatText[MAX_PATH];
@ -952,20 +953,20 @@ void SetStatusText(int Num, const char *Text, bx_bool active)
lstrcpy(StatText+1, Text);
lstrcpy(SB_Text[Num-BX_SB_TEXT_ELEMENTS], StatText);
SB_Active[Num-BX_SB_TEXT_ELEMENTS] = active;
SB_ActiveW[Num-BX_SB_TEXT_ELEMENTS] = w;
SendMessage(hwndSB, SB_SETTEXT, Num | SBT_OWNERDRAW, (long)SB_Text[Num-BX_SB_TEXT_ELEMENTS]);
}
UpdateWindow(hwndSB);
}
void
bx_win32_gui_c::statusbar_setitem(int element, bx_bool active)
void bx_win32_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w)
{
if (element < 0) {
for (int i = 0; i < (int)statusitem_count; i++) {
SetStatusText(i+BX_SB_TEXT_ELEMENTS, statusitem_text[i], active);
SetStatusText(i+BX_SB_TEXT_ELEMENTS, statusitem_text[i], active, w);
}
} else if (element < (int)statusitem_count) {
SetStatusText(element+BX_SB_TEXT_ELEMENTS, statusitem_text[element], active);
SetStatusText(element+BX_SB_TEXT_ELEMENTS, statusitem_text[element], active, w);
}
}
@ -1009,7 +1010,7 @@ LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
SendMessage(hwndSB, WM_SIZE, 0, 0);
// now fit simWindow to mainWindow
int rect_data[] = { 1, 0, IsWindowVisible(hwndTB),
100, IsWindowVisible(hwndSB), 0x7712, 0, 0 };
100, IsWindowVisible(hwndSB), 0x7712, 0, 0 };
RECT R;
GetEffectiveClientRect(hwnd, &R, rect_data);
x = R.right - R.left;
@ -1031,7 +1032,10 @@ LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
if (lpdis->hwndItem == hwndSB) {
sbtext = (char *)lpdis->itemData;
if (SB_Active[lpdis->itemID-BX_SB_TEXT_ELEMENTS]) {
SetBkColor(lpdis->hDC, 0x0000FF00);
if (SB_ActiveW[lpdis->itemID-BX_SB_TEXT_ELEMENTS])
SetBkColor(lpdis->hDC, 0x000040FF);
else
SetBkColor(lpdis->hDC, 0x0000FF00);
} else {
SetBkMode(lpdis->hDC, TRANSPARENT);
SetTextColor(lpdis->hDC, 0x00808080);
@ -1047,16 +1051,15 @@ LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
lpttt = (LPTOOLTIPTEXT)lParam;
idTT = (int)wParam;
hbar_id = idTT - 101;
if ((SendMessage(hwndTB, TB_GETSTATE, idTT, 0)) &&
(bx_headerbar_entry[hbar_id].tooltip != NULL)) {
lstrcpy(lpttt->szText, bx_headerbar_entry[hbar_id].tooltip);
if (SendMessage(hwndTB, TB_GETSTATE, idTT, 0) && bx_headerbar_entry[hbar_id].tooltip != NULL) {
lstrcpy(lpttt->szText, bx_headerbar_entry[hbar_id].tooltip);
}
}
return FALSE;
break;
}
return DefWindowProc (hwnd, iMsg, wParam, lParam);
return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
void SetMouseCapture()

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.116 2008-05-25 12:28:27 vruppert Exp $
// $Id: x.cc,v 1.117 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -65,7 +65,7 @@ public:
#endif
virtual void beep_on(float frequency);
virtual void beep_off();
virtual void statusbar_setitem(int element, bx_bool active);
virtual void statusbar_setitem(int element, bx_bool active, bx_bool w=0);
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
#if BX_SHOW_IPS
virtual void show_ips(Bit32u ips_count);
@ -167,7 +167,7 @@ static Bit8u x11_mouse_msg_counter = 0;
static void headerbar_click(int x, int y);
static void send_keyboard_mouse_status(void);
static void set_status_text(int element, const char *text, bx_bool active);
static void set_status_text(int element, const char *text, bx_bool active, bx_bool w=0);
Bit32u ascii_to_key_event[0x5f] = {
@ -608,11 +608,13 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsign
switch (imBPP) {
case 16:
bx_status_led_green = 0x07e0;
bx_status_led_red = 0xf900;
bx_status_graytext = 0x8410;
break;
case 24:
case 32:
bx_status_led_green = 0x00ff00;
bx_status_led_red = 0xff4000;
bx_status_graytext = 0x808080;
break;
default:
@ -662,7 +664,7 @@ void bx_x_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsign
dialog_caps |= (BX_GUI_DLG_USER | BX_GUI_DLG_SNAPSHOT | BX_GUI_DLG_CDROM);
}
void set_status_text(int element, const char *text, bx_bool active)
void set_status_text(int element, const char *text, bx_bool active, bx_bool w)
{
int xleft, xsize, sb_ypos;
@ -680,7 +682,10 @@ void set_status_text(int element, const char *text, bx_bool active)
} else if (element <= BX_MAX_STATUSITEMS) {
bx_statusitem_active[element] = active;
if (active) {
XSetForeground(bx_x_display, gc_headerbar, bx_status_led_green);
if (w)
XSetForeground(bx_x_display, gc_headerbar, bx_status_led_red);
else
XSetForeground(bx_x_display, gc_headerbar, bx_status_led_green);
XFillRectangle(bx_x_display, win, gc_headerbar, xleft, sb_ypos+2, xsize-1, bx_statusbar_y-2);
XSetForeground(bx_x_display, gc_headerbar, black_pixel);
} else {
@ -693,14 +698,14 @@ void set_status_text(int element, const char *text, bx_bool active)
}
}
void bx_x_gui_c::statusbar_setitem(int element, bx_bool active)
void bx_x_gui_c::statusbar_setitem(int element, bx_bool active, bx_bool w)
{
if (element < 0) {
for (unsigned i = 0; i < statusitem_count; i++) {
set_status_text(i+1, statusitem_text[i], active);
set_status_text(i+1, statusitem_text[i], active, w);
}
} else if ((unsigned)element < statusitem_count) {
set_status_text(element+1, statusitem_text[element], active);
set_status_text(element+1, statusitem_text[element], active, w);
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: harddrv.cc,v 1.214 2008-07-27 08:06:22 vruppert Exp $
// $Id: harddrv.cc,v 1.215 2008-10-06 22:00:11 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -173,7 +173,7 @@ void bx_hard_drive_c::init(void)
char ata_name[20];
bx_list_c *base;
BX_DEBUG(("Init $Id: harddrv.cc,v 1.214 2008-07-27 08:06:22 vruppert Exp $"));
BX_DEBUG(("Init $Id: harddrv.cc,v 1.215 2008-10-06 22:00:11 sshwarts Exp $"));
for (channel=0; channel<BX_MAX_ATA_CHANNEL; channel++) {
sprintf(ata_name, "ata.%d.resources", channel);
@ -3519,7 +3519,7 @@ bx_bool bx_hard_drive_c::ide_write_sector(Bit8u channel, Bit8u *buffer, Bit32u b
}
/* set status bar conditions for device */
if (!BX_SELECTED_DRIVE(channel).iolight_counter)
bx_gui->statusbar_setitem(BX_SELECTED_DRIVE(channel).statusbar_id, 1);
bx_gui->statusbar_setitem(BX_SELECTED_DRIVE(channel).statusbar_id, 1, 1 /* write */);
BX_SELECTED_DRIVE(channel).iolight_counter = 5;
bx_pc_system.activate_timer(BX_HD_THIS iolight_timer_index, 100000, 0);
ret = BX_SELECTED_DRIVE(channel).hard_drive->write((bx_ptr_t)bufptr, 512);