- new variable 'charmap_updated', 'charmap_changed' array renamed to

'char_changed'. These variables are currently only used by the win32 gui for
  the update of the font bitmaps. SDL and wxWindows do not use the variables
  since they are using the charmap data directly
- free text snapshot memory when the user has cancelled the dialog
- write text snapshot file in binary mode (disables the LF -> CRLF conversion
  in cygwin)
This commit is contained in:
Volker Ruppert 2002-09-21 19:38:47 +00:00
parent a08834b7f7
commit 4c4294cc6f
3 changed files with 27 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.47 2002-09-19 18:59:49 vruppert Exp $
// $Id: gui.cc,v 1.48 2002-09-21 19:38:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -347,14 +347,17 @@ bx_gui_c::snapshot_handler(void)
//FIXME
char filename[BX_PATHNAME_LEN];
#if BX_WITH_WX
int ret = SIM->ask_filename (filename, sizeof(filename),
"Save snapshot as...", "snapshot.txt",
int ret = SIM->ask_filename (filename, sizeof(filename),
"Save snapshot as...", "snapshot.txt",
bx_param_string_c::BX_SAVE_FILE_DIALOG);
if (ret < 0) return; // cancelled
if (ret < 0) { // cancelled
free(text_snapshot);
return;
}
#else
strcpy (filename, "snapshot.txt");
#endif
FILE *fp = fopen(filename, "w");
FILE *fp = fopen(filename, "wb");
fwrite(text_snapshot, 1, strlen(text_snapshot), fp);
fclose(fp);
free(text_snapshot);
@ -468,7 +471,7 @@ bx_gui_c::mouse_enabled_changed (Boolean val)
mouse_enabled_changed_specific (val);
}
void
void
bx_gui_c::init_signal_handlers ()
{
#if BX_GUI_SIGHANDLER
@ -485,12 +488,14 @@ bx_gui_c::init_signal_handlers ()
bx_gui_c::set_text_charmap(Bit8u *fbuffer)
{
memcpy(& BX_GUI_THIS vga_charmap, fbuffer, 0x2000);
for (unsigned i=0; i<256; i++) BX_GUI_THIS charmap_changed[i] = 1;
for (unsigned i=0; i<256; i++) BX_GUI_THIS char_changed[i] = 1;
BX_GUI_THIS charmap_updated = 1;
}
void
bx_gui_c::set_text_charbyte(Bit16u address, Bit8u data)
{
BX_GUI_THIS vga_charmap[address] = data;
BX_GUI_THIS charmap_changed[address >> 5] = 1;
BX_GUI_THIS char_changed[address >> 5] = 1;
BX_GUI_THIS charmap_updated = 1;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.30 2002-09-19 18:59:49 vruppert Exp $
// $Id: gui.h,v 1.31 2002-09-21 19:38:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -104,7 +104,8 @@ private:
unsigned user_bmap_id, user_hbar_id;
unsigned char vga_charmap[0x2000];
Boolean charmap_changed[256];
Boolean charmap_updated;
Boolean char_changed[256];
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.41 2002-09-19 18:59:50 vruppert Exp $
// $Id: win32.cc,v 1.42 2002-09-21 19:38:47 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -784,14 +784,17 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned nchars, ncols;
unsigned char data[64];
for (unsigned c = 0; c<256; c++) {
if (bx_gui.charmap_changed[c]) {
memset(data, 0, sizeof(data));
for (unsigned i=0; i<32; i++)
data[i*2] = bx_gui.vga_charmap[c*32+i];
SetBitmapBits(vgafont[c], 64, data);
bx_gui.charmap_changed[c] = 0;
if (bx_gui.charmap_updated) {
for (unsigned c = 0; c<256; c++) {
if (bx_gui.char_changed[c]) {
memset(data, 0, sizeof(data));
for (unsigned i=0; i<32; i++)
data[i*2] = bx_gui.vga_charmap[c*32+i];
SetBitmapBits(vgafont[c], 64, data);
bx_gui.char_changed[c] = 0;
}
}
bx_gui.charmap_updated = 0;
}
cs_start = (cursor_state >> 8) & 0x3f;