- statusbar items for floppy and keyboard added (win32 gui only). TODO: implement

statusbar in other display libraries and add items for harddisk/cdrom and network.
This commit is contained in:
Volker Ruppert 2004-02-07 14:34:35 +00:00
parent 126971af49
commit f5c165e32a
7 changed files with 77 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.75 2004-02-01 23:48:57 cbothamy Exp $
// $Id: gui.cc,v 1.76 2004-02-07 14:34:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -51,6 +51,7 @@ bx_gui_c::bx_gui_c(void)
{
put("GUI"); // Init in specific_init
settype(GUILOG);
statusitem_count = 0;
}
bx_gui_c::~bx_gui_c()
@ -598,3 +599,15 @@ bx_gui_c::beep_off()
{
BX_INFO(( "GUI Beep OFF"));
}
int
bx_gui_c::register_statusitem(const char *text)
{
if (statusitem_count < BX_MAX_STATUSITEMS) {
strncpy(statusitem_text[statusitem_count], text, 8);
statusitem_text[statusitem_count][7] = 0;
return statusitem_count++;
} else {
return -1;
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.41 2004-02-01 23:48:57 cbothamy Exp $
// $Id: gui.h,v 1.42 2004-02-07 14:34:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -24,6 +24,8 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define BX_MAX_STATUSITEMS 10
typedef struct {
Bit8u cs_start;
Bit8u cs_end;
@ -64,6 +66,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 exit(void) = 0;
// set_display_mode() changes the mode between the configuration interface
// and the simulation. This is primarily intended for display libraries
@ -96,6 +99,7 @@ public:
unsigned x_tilesize, unsigned y_tilesize);
void update_drive_status_buttons (void);
static void mouse_enabled_changed (bx_bool val);
int register_statusitem(const char *text);
static void init_signal_handlers ();
@ -133,6 +137,8 @@ protected:
unsigned char vga_charmap[0x2000];
bx_bool charmap_updated;
bx_bool char_changed[256];
unsigned statusitem_count;
char statusitem_text[BX_MAX_STATUSITEMS][8];
disp_mode_t disp_mode;
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.71 2003-12-14 09:51:58 vruppert Exp $
// $Id: win32.cc,v 1.72 2004-02-07 14:34:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -46,6 +46,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);
};
// declare one instance of the gui object and call macro to insert the
@ -125,6 +126,11 @@ static unsigned bx_statusbar_y = 0;
static int bx_headerbar_entries;
static unsigned bx_hb_separator;
// Status Bar stuff
#define SIZE_OF_SB_ELEMENT 30
#define SIZE_OF_SB_FIRST_ELEMENT 192
long SB_Edges[BX_MAX_STATUSITEMS+2];
// Misc stuff
static unsigned dimension_x, dimension_y, current_bpp;
static unsigned stretched_x, stretched_y;
@ -648,7 +654,6 @@ VOID UIThread(PVOID pvoid) {
HDC hdc;
WNDCLASS wndclass;
RECT wndRect, wndRect2;
long Edges[1];
workerThreadID = GetCurrentThreadId();
@ -703,8 +708,12 @@ VOID UIThread(PVOID pvoid) {
hwndSB = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "F12 enables mouse",
stInfo.mainWnd, 0x7712);
if (hwndSB) {
Edges[0] = -1;
SendMessage(hwndSB, SB_SETPARTS, 1, (long)&Edges);
int elements;
SB_Edges[0] = SIZE_OF_SB_FIRST_ELEMENT + SIZE_OF_SB_ELEMENT; // F12 Mouse
for (elements = 1; elements < (BX_MAX_STATUSITEMS+1); elements++)
SB_Edges[elements] = SB_Edges[elements-1] + SIZE_OF_SB_ELEMENT;
SB_Edges[elements] = -1;
SendMessage(hwndSB, SB_SETPARTS, BX_MAX_STATUSITEMS+2, (long)&SB_Edges);
}
GetClientRect(hwndTB, &wndRect2);
bx_headerbar_y = wndRect2.bottom;
@ -775,7 +784,6 @@ VOID UIThread(PVOID pvoid) {
_endthread();
}
void SetStatusText(int Num, const char *Text)
{
char StatText[MAX_PATH];
@ -787,6 +795,18 @@ void SetStatusText(int Num, const char *Text)
}
lstrcpy(StatText+1, Text);
SendMessage(hwndSB, SB_SETTEXT, Num, (long)StatText);
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, "");
}
}
LRESULT CALLBACK mainWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.69 2003-12-18 20:04:49 vruppert Exp $
// $Id: floppy.cc,v 1.70 2004-02-07 14:34:34 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.69 2003-12-18 20:04:49 vruppert Exp $"));
BX_DEBUG(("Init $Id: floppy.cc,v 1.70 2004-02-07 14:34:34 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++) {
@ -198,8 +198,12 @@ bx_floppy_ctrl_c::init(void)
default:
BX_PANIC(("unknown floppya type"));
}
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.statusbar_id[0] = bx_gui->register_statusitem("A:");
} else {
BX_FD_THIS s.statusbar_id[0] = -1;
}
if (bx_options.floppya.Otype->get () != BX_FLOPPY_NONE) {
if ( bx_options.floppya.Ostatus->get () == BX_INSERTED) {
@ -264,8 +268,12 @@ bx_floppy_ctrl_c::init(void)
default:
BX_PANIC(("unknown floppyb type"));
}
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.statusbar_id[1] = bx_gui->register_statusitem("B:");
} else {
BX_FD_THIS s.statusbar_id[1] = -1;
}
if (bx_options.floppyb.Otype->get () != BX_FLOPPY_NONE) {
if ( bx_options.floppyb.Ostatus->get () == BX_INSERTED) {
@ -282,7 +290,6 @@ bx_floppy_ctrl_c::init(void)
}
/* CMOS Equipment Byte register */
if (BX_FD_THIS s.num_supported_floppies > 0) {
DEV_cmos_set_reg(0x14, (DEV_cmos_get_reg(0x14) & 0x3e) |
@ -471,6 +478,11 @@ bx_floppy_ctrl_c::write(Bit32u address, Bit32u value, unsigned io_len)
case 0x3F2: /* diskette controller digital output register */
motor_on_drive1 = value & 0x20;
motor_on_drive0 = value & 0x10;
/* 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);
dma_and_interrupt_enable = value & 0x08;
if (!dma_and_interrupt_enable)
BX_DEBUG(("DMA and interrupt capabilities disabled"));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.h,v 1.16 2002-11-30 09:39:29 vruppert Exp $
// $Id: floppy.h,v 1.17 2004-02-07 14:34:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -114,6 +114,7 @@ private:
Bit8u DIR[4]; // Digital Input Register:
// b7: 0=diskette is present and has not been changed
// 1=diskette missing or changed
int statusbar_id[2]; // IDs of the status LEDs
} s; // state information
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.cc,v 1.82 2003-11-11 18:18:36 vruppert Exp $
// $Id: keyboard.cc,v 1.83 2004-02-07 14:34:34 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -125,7 +125,7 @@ bx_keyb_c::resetinternals(bx_bool powerup)
void
bx_keyb_c::init(void)
{
BX_DEBUG(("Init $Id: keyboard.cc,v 1.82 2003-11-11 18:18:36 vruppert Exp $"));
BX_DEBUG(("Init $Id: keyboard.cc,v 1.83 2004-02-07 14:34:34 vruppert Exp $"));
Bit32u i;
DEV_register_irq(1, "8042 Keyboard controller");
@ -203,6 +203,11 @@ bx_keyb_c::init(void)
// mouse port installed on system board
DEV_cmos_set_reg(0x14, DEV_cmos_get_reg(0x14) | 0x04);
// add keyboard LEDs to the statusbar
BX_KEY_THIS statusbar_id[0] = bx_gui->register_statusitem("NUM");
BX_KEY_THIS statusbar_id[1] = bx_gui->register_statusitem("CAPS");
BX_KEY_THIS statusbar_id[2] = bx_gui->register_statusitem("SCRL");
#if BX_WITH_WX
static bx_bool first_time = 1;
if (first_time) {
@ -996,6 +1001,9 @@ bx_keyb_c::kbd_ctrl_to_kbd(Bit8u value)
BX_KEY_THIS s.kbd_internal_buffer.led_status = value;
BX_DEBUG(("LED status set to %02x",
(unsigned) BX_KEY_THIS s.kbd_internal_buffer.led_status));
bx_gui->statusbar_setitem(BX_KEY_THIS statusbar_id[0], value & 0x02);
bx_gui->statusbar_setitem(BX_KEY_THIS statusbar_id[1], value & 0x04);
bx_gui->statusbar_setitem(BX_KEY_THIS statusbar_id[2], value & 0x01);
kbd_enQ(0xFA); // send ACK %%%
return;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: keyboard.h,v 1.22 2003-07-13 19:51:21 vruppert Exp $
// $Id: keyboard.h,v 1.23 2004-02-07 14:34:35 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -228,6 +228,7 @@ private:
static void timer_handler(void *);
void timer(void);
int timer_handle;
int statusbar_id[3];
};