[Scummvm-cvs-logs] CVS: scummex TODO,NONE,1.1 akos.cpp,1.1,1.2 descumm.cpp,1.3,1.4 image.cpp,1.27,1.28 image.h,1.14,1.15 resource.cpp,1.31,1.32 resource.h,1.30,1.31 scummsys.h,1.2,1.3 wxwindows.cpp,1.38,1.39 wxwindows.h,1.19,1.20

Max Horn fingolfin at users.sourceforge.net
Sun Sep 19 06:51:23 CEST 2004


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10701

Modified Files:
	akos.cpp descumm.cpp image.cpp image.h resource.cpp resource.h 
	scummsys.h wxwindows.cpp wxwindows.h 
Added Files:
	TODO 
Log Message:
Some cleanup; fixed various crashes; made compiling with wxWidgets 2.5 possible; fixed endian issues in descumm code; and introduced a regression regarding the 'Close' menu item

--- NEW FILE: TODO ---
ScummEX should probably simply be rewriten from scratch. There are so
many fundamental flaws with its (non-existant) design, as well as lots
of strange bugs and crashes which are hard to find and debug etc.

Some things to keep in mind for such a rewrite:

* allow multiple files to be opened
* menus shouldn't change around whenever the active window changes --
  options like "Open", "Close", "Quit", "View as hex" etc. should almost
  always be available
* object orientation / encapsulation is good, but it needs to be
  employed properly. If you end up with a lot of methods which do nothing
  but call to another method in another object, which then in turn does
  the same for yet another object, then usually something is wrong :-)
* Don't use SDL here if it can be avoided. Currently we only need it for
  sound playback. Surely there is another way to do that (wxSound/wxWave
  sadly seems to be crippled on MacOS and too limited anyway)
* The ImageWindow class should do all the scaling stuff in a different
  (properly encapsulated) way: client code shouldn't have to worry about
  whether the image is displayed scaled or not; and it shouldn't be
  necessary for ImageWindow to keep track of the drawing source. To do this,
  render the image to be displayed into a buffer once; then do window redraws
  from that buffer, optionally with scaling inbetween.


Some other things:
* better hex viewer
* things like the palette/images could be displayed "inline": i.e. when
  you click on a CLUT palette, it could display the palette immediately in
  the lower right part of the main window
* file loading should be faster; until that's done, at least show a
  progress bar during loading
* descumm.cpp duplicates the code of descumm -- bad, as it gets out of sync etc.
  Would be far better to create a "libdescumm" which then is used here
* Rename the icon files to reflect their function... e.g. instead of
  "xpm_37.xpm" maybe use "block_RMIM.xpm" or "block_RoomImage.xpm"
  (but note that some icons are currently used more than once)
* Mapping of block IDs to Descriptions/help files/icons could be stored in 
  a text file for flexibility... not sure whether that's a good idea, though
* Maybe adapt the ScummVM MD5 detector system to determine which game we are
  looking at (combined with filename matching etc.) -> useful for descumming,
  besides other things...



Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/akos.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- akos.cpp	3 Jul 2004 14:47:43 -0000	1.1
+++ akos.cpp	19 Sep 2004 13:50:42 -0000	1.2
@@ -76,14 +76,14 @@
 	int len;
 	byte tmp;
 	char buffer[1024];
-	
+
 	len = size;
 	mem = (byte *)malloc(size);
 	_input.read(mem, size);
 
 	curpos = mem + 8;
 
-	_gui->DisplayViewer("AKOS Decompilation", 600, 400, "");
+	ViewerWindow *vw = _gui->DisplayViewer("AKOS Decompilation", 600, 400, "");
 
 	while (curpos < mem + len) {
 		int code = *curpos;
@@ -298,27 +298,27 @@
 			break;
 
 		case AKC_SkipE:
-			sprintf(buffer, "if (animVar[%d] == %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] == %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		case AKC_SkipNE:
-			sprintf(buffer, "if (animVar[%d] != %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] != %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		case AKC_SkipL:
-			sprintf(buffer, "if (animVar[%d] < %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] < %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		case AKC_SkipLE:
-			sprintf(buffer, "if (animVar[%d] <= %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] <= %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		case AKC_SkipG:
-			sprintf(buffer, "if (animVar[%d] > %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] > %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		case AKC_SkipGE:
-			sprintf(buffer, "if (animVar[%d] >= %d) SetFlag();\n");
+			sprintf(buffer, "if (animVar[%d] >= %d) SetFlag();\n", GB(4), GW(2));
 			break;
 
 		default:
@@ -326,7 +326,7 @@
 			break;
 		}
 
-		_gui->AppendText(buffer);
+		vw->AppendText(buffer);
 	}
 }
 

Index: descumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/descumm.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- descumm.cpp	23 Sep 2003 12:56:12 -0000	1.3
+++ descumm.cpp	19 Sep 2004 13:50:42 -0000	1.4
@@ -24,6 +24,8 @@
 #include "wxwindows.h"
 #include "descumm.h"
 
+static ViewerWindow *g_descumm_viewer;
+
 #define A1B (1<<0)
 #define A1W (2<<0)
 #define A1V (3<<0)
@@ -2985,20 +2987,20 @@
 		if (size_of_code < 6) {
 			return;
 		}
-		switch (TO_LE_16(*((uint16 *)mem + 2))) {
-		case MKID('LS'):
+		switch (TO_BE_16(*((uint16 *)mem + 2))) {
+		case 'LS':
 			mem += 7;
 			break;			/* Local script */
-		case MKID('SC'):
+		case 'SC':
 			mem += 6;
 			break;			/* Script */
-		case MKID('EN'):
+		case 'EN':
 			mem += 6;
 			break;			/* Entry code */
-		case MKID('EX'):
+		case 'EX':
 			mem += 6;
 			break;			/* Exit code */
-		case MKID('OC'):
+		case 'OC':
 			offs_of_line = skipVerbHeader_V34(mem);
 			break;			/* Verb */
 		default:
@@ -3010,7 +3012,7 @@
 	cur_pos = org_pos + offs_of_line;
 	len -= mem - memorg;
 
-	_gui->DisplayViewer("Scumm Decompilation", 600, 400, "");
+	g_descumm_viewer = _gui->DisplayViewer("Scumm Decompilation", 600, 400, "");
 	
 	while (cur_pos < mem + len) {
 		byte opcode = *cur_pos;
@@ -3141,7 +3143,7 @@
 				sprintf(buffer, "[%.4X] (%s) %s%s\n", curoffs, buf2, s, buf);
 			}
 		}
-		_gui->AppendText(buffer);
+		g_descumm_viewer->AppendText(buffer);
 	}
 	free(buffer);
 }

Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- image.cpp	23 Jun 2004 01:48:12 -0000	1.27
+++ image.cpp	19 Sep 2004 13:50:42 -0000	1.28
@@ -31,11 +31,9 @@
 	_transp = 0;
 	_width = 0;
 	_height = 0;
-	_resource = new Resource();
 }
 
 Image::~Image() {
-	delete _resource;
 }
 
 void Image::setupEGAPalette() {
@@ -153,17 +151,17 @@
 
 	if (_blockTable[id].blockTypeID == BM || _blockTable[id].blockTypeID == BX) {
 		version = 3;
-		headerID = _resource->findBlock(0, _blockTable, id, "HD", NULL);
+		headerID = _resource.findBlock(0, _blockTable, id, "HD", NULL);
 	} else {
-		headerID = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
+		headerID = _resource.findBlock(0, _blockTable, id, "RMHD", NULL);
 	}
 
 	_width = _blockTable[headerID].width;
 	_height = _blockTable[headerID].height;
 
-	if ( _resource->findBlock(0, _blockTable, id, "IMAG", NULL) != -1) {
+	if ( _resource.findBlock(0, _blockTable, id, "IMAG", NULL) != -1) {
 		version = 8;
-	} else if ( version > 3 && _resource->findBlock(0, _blockTable, id, "PALS", NULL) != -1) {
+	} else if ( version > 3 && _resource.findBlock(0, _blockTable, id, "PALS", NULL) != -1) {
 		version = 7;
 	}
 
@@ -174,9 +172,9 @@
 
 	if (_blockTable[id].blockTypeID != BOXD && _blockTable[id].blockTypeID != BX) {
 		if (version > 5) {
-			id = _resource->findBlock(1, _blockTable, id, "BOXD", NULL);
+			id = _resource.findBlock(1, _blockTable, id, "BOXD", NULL);
 		} else {
-			id = _resource->findBlock(0, _blockTable, id, "BOXD", "BX", NULL);
+			id = _resource.findBlock(0, _blockTable, id, "BOXD", "BX", NULL);
 		}
 	}
 	
@@ -203,7 +201,7 @@
 			_input.seek(20, SEEK_CUR);
 		}
 
-	} else if (version == 3 && _resource->findBlock(0, _blockTable, id, "LF", NULL) == -1 && _resource->findBlock(1, _blockTable, id, "PA", NULL) != -1) {
+	} else if (version == 3 && _resource.findBlock(0, _blockTable, id, "LF", NULL) == -1 && _resource.findBlock(1, _blockTable, id, "PA", NULL) != -1) {
 		for (int i=0; i<nBox; i++) {
 			_points[i][0].x = _input.readUint16LE() * _image->_scaleFactor;
 			_points[i][0].y = _input.readUint16LE() * _image->_scaleFactor;
@@ -245,7 +243,7 @@
 	int x = 0, y = 0;
 	byte *dst, *dstorg, *chunk_buffer, *dstFinal;
 
-	index = _resource->findBlock(0, _blockTable, id, "NPAL", "AHDR", NULL);
+	index = _resource.findBlock(0, _blockTable, id, "NPAL", "AHDR", NULL);
 	if (_blockTable[index].blockTypeID == AHDR) {
 		_input.seek(_blockTable[index].offset + 14, SEEK_SET);
 	} else {
@@ -320,13 +318,13 @@
 
 	if (_blockTable[id].blockTypeID == BM) {
 		version = 3;
-		headerID = _resource->findBlock(0, _blockTable, id, "HD", NULL);
+		headerID = _resource.findBlock(0, _blockTable, id, "HD", NULL);
 	} else if (_blockTable[id-1].blockTypeID == IMHD) {
 		version = 8;
 		headerID = id-1;
 	} else {
 		version = 5;
-		headerID = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
+		headerID = _resource.findBlock(0, _blockTable, id, "RMHD", NULL);
 	}
 	
 	_width = _blockTable[headerID].width;
@@ -338,11 +336,11 @@
 		_image = _blockTable[id].image;
 
 	if (version > 4) {
-		paletteID = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
+		paletteID = _resource.findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
 		_input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
 	} else {
 		_transp = 260;
-		paletteID = _resource->findBlock(0, _blockTable, id, "PA", NULL);
+		paletteID = _resource.findBlock(0, _blockTable, id, "PA", NULL);
 		if (paletteID != -1) {
 			version = 4;
 			_input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
@@ -362,7 +360,7 @@
 	}
 
 	if (version > 4) {
-		dataID = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
+		dataID = _resource.findBlock(1, _blockTable, id, "SMAP", NULL);
 	} else {
 		dataID = id;
 	}
@@ -371,7 +369,7 @@
 
 	if (_blockTable[id].blockTypeID == IMAG) {
 		version = 8;
-		dataID = _resource->findBlock(1, _blockTable, dataID, "OFFS", NULL);
+		dataID = _resource.findBlock(1, _blockTable, dataID, "OFFS", NULL);
 		blockSize = _blockTable[dataID-1].blockSize - 8;
 		
 	}
@@ -431,22 +429,22 @@
 	byte *dst, *dstorg, *src, *dstFinal;
 
 	if (_blockTable[id].blockTypeID == OBIM) {
-		headerID = _resource->findBlock(1, _blockTable, id, "IMHD", NULL);
+		headerID = _resource.findBlock(1, _blockTable, id, "IMHD", NULL);
 	} else if (_blockTable[id].blockTypeID == OI) {
 		version = 3;
 		headerID = id;
 		while (1) {
-			headerID = _resource->findBlock(1, _blockTable, headerID, "OC", NULL);
+			headerID = _resource.findBlock(1, _blockTable, headerID, "OC", NULL);
 				if (_blockTable[headerID].numFiles == _blockTable[id].numFiles)
 					break;
 		}
-		paletteID = _resource->findBlock(0, _blockTable, id, "PA", NULL);
+		paletteID = _resource.findBlock(0, _blockTable, id, "PA", NULL);
 		if (paletteID != -1) {
 			version = 4;
 			_input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
 		}
 	} else {
-		headerID = _resource->findBlock(0, _blockTable, id, "IMHD", NULL);
+		headerID = _resource.findBlock(0, _blockTable, id, "IMHD", NULL);
 	}
 	
 	_width = _blockTable[headerID].width;
@@ -458,7 +456,7 @@
 		_image = _blockTable[id].image;
 
 	if (version > 4) {
-		paletteID = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
+		paletteID = _resource.findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
 		_input.seek(_blockTable[paletteID].offset + 8, SEEK_SET);
 	}
 	
@@ -473,7 +471,7 @@
 	}
 	
 	if (version > 4) {
-		dataID = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
+		dataID = _resource.findBlock(1, _blockTable, id, "SMAP", NULL);
 		_input.seek(_blockTable[dataID].offset + 8, SEEK_SET);
 	} else {
 		dataID = id;

Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- image.h	23 Jun 2004 01:48:12 -0000	1.14
+++ image.h	19 Sep 2004 13:50:42 -0000	1.15
@@ -48,11 +48,10 @@
 	uint32 *_offsets;
 	int _width;
 	int _height;
-	int _imageWindowId;
 	byte _decomp_shr;
 	byte _decomp_mask;
 	int _vertStripNextInc;
-	Resource *_resource;
+	Resource _resource;
 	Codec37Decoder _codec37;
 	Codec47Decoder _codec47;
 	ImageWindow *_image;

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/resource.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- resource.cpp	26 Jun 2004 05:31:55 -0000	1.31
+++ resource.cpp	19 Sep 2004 13:50:42 -0000	1.32
@@ -26,7 +26,206 @@
 #include "scummex.h"
 #include "sound/voc.h"
 
-int v8 = 0;
+static int v8 = 0;
+
+const struct blockInfo blocksInfo[] = {
+	{"RNAM", "Room Names", 1, "help/specRNAM.html", 47},
+	{"MAXS", "Maximum Values", 0, "", 2},
+	{"LB83", "Lucasarts Bundle 8.3", 1, "help/specLB83.html", 6},
+	{"LABN", "Lucasarts Bundle New", 1, "help/specLABN.html", 6},
+	{"LECF", "LucasArts Entertainment Company Files", 1, "help/specLECF.html", 6},
+	{"LOFF", "Room Offset Table", 1, "help/specLOFF.html", 44},
+	{"LFLF", "LucasArts File Format", 1, "help/specLFLF.html", 58},
+	{"ROOM", "Room Container", 1, "help/specROOM.html", 38},
+	{"RMHD", "Room Header", 0, "", 35},
+	{"CYCL", "Color Cycle", 0, "", 12},
+	{"TRNS", "Transparency", 1, "help/specTRNS.html", 46},
+	{"EPAL", "EGA Palette", 0, "", 34},
+	{"BOXD", "Box Description", 0, "", 4},
+	{"BOXM", "Box Matrix", 0, "", 5},
+	{"OBCD", "Object Code", 1, "help/specOBCD.html", 57},
+	{"OBNA", "Object Name", 1, "help/specOBNA.html", 45},
+	{"CDHD", "Code Header", 0, "", 7},
+	{"VERB", "Verbs", 0, "", 50},
+	{"DROO", "Directory of Rooms", 0, "", 18},
+	{"DSCR", "Directory of Scripts", 0, "", 19},
+	{"DSOU", "Directory of Sounds", 0, "", 20},
+	{"DCOS", "Directory of Costumes", 0, "", 14},
+	{"DCHR", "Directory of Charsets", 0, "", 13},
+	{"DOBJ", "Directory of Objects", 0, "", 17},
+	{"cus1", "bundled file"},
+	{"cus2", "iMUSE Cue", 0, "", 59},
+	{"COMP", "Compression Table", 0, "", 9},
+	{"CLUT", "Color Lookup Table", 1, "help/specCLUT.html", 34},
+	{"PALS", "Wrapper for Palettes", 1, "help/specPALS.html", 56},
+	{"WRAP", "Wrapper for Palettes/Images", 1, "help/specWRAP.html", 60},
+	{"OFFS", "Offsets", 1, "help/specOFFS.html", 44},
+	{"APAL", "Palette", 1, "help/specAPAL.html", 34},
+	{"RMIM", "Room Image", 0, "", 37},
+	{"RMIH", "Room Image Header", 0, "", 36},
+	{"IM00", "Image", 0, "", 25},
+	{"IM01", "Image", 0, "", 25},
+	{"IM02", "Image", 0, "", 25},
+	{"IM03", "Image", 0, "", 25},
+	{"IM04", "Image", 0, "", 25},
+	{"IM05", "Image", 0, "", 25},
+	{"IM06", "Image", 0, "", 25},
+	{"IM07", "Image", 0, "", 25},
+	{"IM08", "Image", 0, "", 25},
+	{"IM09", "Image", 0, "", 25},
+	{"IM0A", "Image", 0, "", 25},
+	{"IM0B", "Image", 0, "", 25},
+	{"IM0C", "Image", 0, "", 25},
+	{"IM0D", "Image", 0, "", 25},
+	{"IM0E", "Image", 0, "", 25},
+	{"IM0F", "Image", 0, "", 25},
+	{"IM10", "Image", 0, "", 25},
+	{"ZP01", "", 0, "", 52},
+	{"ZP02", "", 0, "", 52},
+	{"ZP03", "", 0, "", 52},
+	{"ZP04", "", 0, "", 52},
+	{"ZPLN", "", 0, "", 52},
+	{"SMAP", "Pixelmap", 0, "", 42},
+	{"SCAL", "Scaling", 0, "", 40},
+	{"AARY", "Array?", 0, "", 47},
+	{"ANAM", "", 0, "", 47},
+	{"SOUN", "Sound", 0, "", 59},
+	{"SCRP", "Script", 0, "", 41},
+	{"EXCD", "Exit Code", 0, "", 22},
+	{"ENCD", "Entry Code", 0, "", 21},
+	{"NLSC", "Non Local Script", 0, "", 41},
+	{"OBIM", "Object Image", 0, "", 33},
+	{"IMHD", "Image Header", 0, "", 26},
+	{"SOU ", "Sound", 0, "", 59},
+	{"VCTL", "", 0, "", 15},
+	{"Crea", "Voc Sample", 0, "", 16},
+	{"VTLK", "", 0, "", 15},
+	{"MCMP", "", 1, "help/specMCMP.html", 9},
+	{"iMUS", "iMUSE Digital Sound", 1, "help/speciMUS.html", 59},
+	{"MAP ", "iMUSE Digital MAP of Sound Data", 1, "help/specMAP.html", 29},
+	{"FRMT", "iMUSE Digital Sound Data Format", 1, "help/specFRMT.html", 51},
+	{"TEXT", "iMUSE Digital Trigger Marker", 1, "help/specTEXT.html", 45},
+	{"REGN", "iMUSE Digital Data Region", 1, "help/specREGN.html", 27},
+	{"JUMP", "iMUSE Digital Jump To Region", 1, "help/specJUMP.html", 27},
+	{"DATA", "iMUSE Digital Sound Data", 1, "help/specDATA.html", 16},
+	{"STOP", "iMUSE Digital End of Sound Data", 1, "help/specSTOP.html", 27},
+	{"SYNC", "iMUSE Digital Lip Sync Data", 1, "help/specSYNC.html", 43},
+	{"IMC", "", 1, "help/specIMC.html", 59},
+	{"LSCR", "", 0, "", 41},
+	{"COST", "", 0, "", 11},
+	{"CHAR", "", 0, "", 8},
+	{"BOMP", "", 0, "", 47},
+	{"IMAG", "", 0, "", 25},
+	{"AKOS", "Animated Costume", 0, "", 47},
+	{"RMSC", "", 1, "help/specRMSC.html", 57},
+	{"BSTR", "", 0, "", 42},
+	{"AKHD", "AKOS Header", 0, "", 47},
+	{"AKPL", "AKOS Palette", 0, "", 47},
+	{"RGBS", "", 0, "", 47},
+	{"AKOF", "AKOS Offset", 0, "", 47},
+	{"AKCI", "AKOS Costume Info", 0, "", 47},
+	{"AKCD", "", 0, "", 47},
+	{"AKSQ", "AKOS Script", 0, "", 50},
+	{"AKCH", "", 0, "", 47},
+	{"ANIM", "SMUSH Animation", 0, "", 55},
+	{"AHDR", "SMUSH Animation Header", 0, "", 1},
+	{"FRME", "SMUSH Frame", 0, "", 55},
+	{"FOBJ", "SMUSH Frame Object", 0, "", 32},
+	{"IACT", "iMUSE Digital Smush Audio Track", 0, "", 24},
+	{"NPAL", "SMUSH New Palette", 0, "", 34},
+	{"TRES", "SMUSH Text Resource", 0, "", 47},
+	{"PSAD", "SMUSH Primary Audio", 0, "", 24},
+	{"SAUD", "SMUSH Audio", 0, "", 24},
+	{"STRK", "SMUSH Audio Track", 0, "", 24},
+	{"SDAT", "SMUSH Audio Data", 0, "", 24},
+	{"XPAL", "SMUSH Difference Palette", 0, "", 34},
+	{"ADL ", "Adlib MIDI Data", 1, "help/specADL.html", 31},
+	{"SPK ", "Speaker Sound Data", 1, "help/specSPK.html", 31},
+	{"ROL ", "Roland MIDI Data", 1, "help/specROL.html", 31},
+	{"FTCH", "SMUSH Fetch Frame", 0, "", 47},
+	{"STOR", "SMUSH Store Frame", 0, "", 47},
+	{"MIDI", "MIDI Data", 0, "", 31},
+	{"GMD ", "General MIDI Data", 0, "", 31},
+	{"SBL ", "", 0, "", 31},
+	{"ZSTR", "", 0, "", 47},
+	{"AUhd", "", 0, "", 31},
+	{"WVhd", "", 0, "", 31},
+	{"AUdt", "", 0, "", 31},
+	{"WVdt", "", 0, "", 31},
+	{"TLKB", "Talkie ?", 0, "", 47},
+	{"TALK", "Talkie Sounds", 0, "", 47},
+	{"HSHD", "Humongous Sound HeaDer", 0, "", 47},
+	{"DIRI", "", 0, "", 47},
+	{"DIRR", "Directory of Rooms", 0, "", 47},
+	{"DIRN", "Directory of Sounds", 0, "", 47},
+	{"DIRC", "Directory of Costumes", 0, "", 47},
+	{"DIRF", "Directory of Charsets", 0, "", 47},
+	{"DIRM", "", 0, "", 47},
+	{"DLFL", "Directory of LFLs", 0, "", 47},
+	{"DIRS", "", 0, "", 47},
+	{"SONG", "", 0, "", 47},
+	{"SGHD", "Song Header", 0, "", 47},
+	{"SGEN", "Song ?", 0, "", 47},
+	{"DIGI", "Digital Sound", 0, "", 47},
+	{"RMDA", "Room Data", 0, "", 38},
+	{"BMAP", "Bitmap Image", 0, "", 47},
+	{"WIZH", "", 0, "", 47},
+	{"AWIZ", "", 0, "", 47},
+	{"WIZD", "", 0, "", 47},
+	{"SPOT", "", 0, "", 47},
+	{"CNVS", "", 0, "", 47},
+	{"POLD", "", 0, "", 47},
+	{"LSC2", "", 0, "", 47},
+	{"FMUS", "Music header?", 0, "", 47},
+	{"SKIP", "SMUSH Skip Frame", 0, "", 47},
+	{"IaCt", "INSANE Action", 0, "", 24}, // small letters are intentional
+	{"REMP", "Actor Palette?", 0, "", 34},
+	{"SANM", "SMUSH v2 file", 0, "", 55},
+	{"Wave", "SMUSH v2 VIMA audio codec", 0, "", 55},
+	{"Bl16", "SMUSH v2 Blocky16 video codec", 0, "", 55},
+	{"FLHD", "SMUSH v2 Frame Header", 0, "", 55},
+	{"ANNO", "SMUSH v2 Annotations", 0, "", 55},
+	{"ZFOB", "SMUSH Zlib Compressed Frame Object", 0, "", 32},
+	{"SMRK", "SMUSH Audio Marker", 0, "", 24},
+	{"SHDR", "SMUSH Audio Header/SMUSH v2 Header", 0, "", 24},
+	{"ETRS", "SMUSH External Text Resource", 0, "", 24},
+	{0, 0, 0, 0, 0}
+};
+
+const struct blockInfo oldBlocksInfo[] = {
+	{"0R", "Directory of Rooms", 0, "", 18},
+	{"0S", "", 0, "", 19},
+	{"0N", "", 0, "", 47},
+	{"0C", "", 0, "", 14},
+	{"0O", "Directory of Objects", 0, "", 17},
+	{"RO", "", 0, "", 38},
+	{"HD", "", 0, "", 35},
+	{"BX", "", 0, "", 4},
+	{"PA", "", 0, "", 34},
+	{"BM", "", 0, "", 37},
+	{"OI", "", 0, "", 33},
+	{"OC", "", 0, "", 41},
+	{"NL", "", 0, "", 41},
+	{"SL", "", 0, "", 47},
+	{"EX", "", 0, "", 22},
+	{"EN", "", 0, "", 21},
+	{"LC", "", 0, "", 47},
+	{"LS", "", 0, "", 41},
+	{"SC", "", 0, "", 41},
+	{"CO", "", 0, "", 11},
+	{"LE", "LucasArts Entertainment Company Files", 0, "", 6},
+	{"FO", "", 0, "", 44},
+	{"LF", "", 0, "", 58},
+	{"CC", "", 0, "", 12},
+	{"SP", "", 0, "", 47},
+	{"SA", "", 0, "", 40},
+	{"SO", "", 0, "", 59},
+	{"RN", "", 0, "", 47},
+	{"WA", "", 0, "", 31},
+	{"AD", "", 0, "", 31},
+	{0, 0, 0, 0, 0}
+};
+
 
 Resource::Resource() {
 	stopflag = 0;
@@ -122,7 +321,7 @@
 	return index;
 }
 
-int Resource::parseBlocks(char *blockName, BlockTable *_blockTable, File& _input, int index, int level) {
+int Resource::parseBlocks(const char *blockName, BlockTable *_blockTable, File& _input, int index, int level) {
 	
 	int z = 0;
 	byte c;
@@ -808,7 +1007,7 @@
 
 }
 
-int Resource::parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _input, int index, int level) {
+int Resource::parseOldBlocks(const char *blockName, BlockTable *_blockTable, File& _input, int index, int level) {
 	
 	int numFiles, offset, number, bufindex;
 
@@ -918,11 +1117,11 @@
 }
 
 
-int Resource::getBlockType(char *tag) {
+int Resource::getBlockType(const char *tag) {
 	
-	for (int i = 0; i < numBlocks; i++) {
+	for (int i = 0; blocksInfo[i].name[0] != 0; i++) {
 		if(strncmp(tag, blocksInfo[i].name, 4) == 0) {
-			return blocksInfo[i].id;
+			return i;
 		}
 
 	}
@@ -931,11 +1130,11 @@
 	return -1;
 }
 
-int Resource::getOldBlockType(char *tag) {
+int Resource::getOldBlockType(const char *tag) {
 	
-	for (int i = 0; i < numOldBlocks; i++) {
+	for (int i = 0; oldBlocksInfo[i].name[0] != 0; i++) {
 		if(strncmp(tag, oldBlocksInfo[i].name, 2) == 0) {
-			return oldBlocksInfo[i].id;
+			return 200 + i;
 		}
 	}
 	//printf("Unknown block: %s\n", tag);

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/resource.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- resource.h	3 Jul 2004 14:47:43 -0000	1.30
+++ resource.h	19 Sep 2004 13:50:42 -0000	1.31
@@ -55,7 +55,6 @@
 };
 
 struct blockInfo {
-	int id;
 	char name[5];
 	char description[256];
 	int html;
@@ -63,217 +62,20 @@
 	int iconid;
 };
 
-const struct blockInfo blocksInfo[] = {
-	{0, "RNAM", "Room Names", 1, "help/specRNAM.html", 47},
-	{1, "MAXS", "Maximum Values", 0, "", 2},
-	{2, "LB83", "Lucasarts Bundle 8.3", 1, "help/specLB83.html", 6},
-	{3, "LABN", "Lucasarts Bundle New", 1, "help/specLABN.html", 6},
-	{4, "LECF", "LucasArts Entertainment Company Files", 1, "help/specLECF.html", 6},
-	{5, "LOFF", "Room Offset Table", 1, "help/specLOFF.html", 44},
-	{6, "LFLF", "LucasArts File Format", 1, "help/specLFLF.html", 58},
-	{7, "ROOM", "Room Container", 1, "help/specROOM.html", 38},
-	{8, "RMHD", "Room Header", 0, "", 35},
-	{9, "CYCL", "Color Cycle", 0, "", 12},
-	{10, "TRNS", "Transparency", 1, "help/specTRNS.html", 46},
-	{11, "EPAL", "EGA Palette", 0, "", 34},
-	{12, "BOXD", "Box Description", 0, "", 4},
-	{13, "BOXM", "Box Matrix", 0, "", 5},
-	{14, "OBCD", "Object Code", 1, "help/specOBCD.html", 57},
-	{15, "OBNA", "Object Name", 1, "help/specOBNA.html", 45},
-	{16, "CDHD", "Code Header", 0, "", 7},
-	{17, "VERB", "Verbs", 0, "", 50},
-	{18, "DROO", "Directory of Rooms", 0, "", 18},
-	{19, "DSCR", "Directory of Scripts", 0, "", 19},
-	{20, "DSOU", "Directory of Sounds", 0, "", 20},
-	{21, "DCOS", "Directory of Costumes", 0, "", 14},
-	{22, "DCHR", "Directory of Charsets", 0, "", 13},
-	{23, "DOBJ", "Directory of Objects", 0, "", 17},
-	{24, "cus1", "bundled file"},
-	{25, "cus2", "iMUSE Cue", 0, "", 59},
-	{26, "COMP", "Compression Table", 0, "", 9},
-	{27, "CLUT", "Color Lookup Table", 1, "help/specCLUT.html", 34},
-	{28, "PALS", "Wrapper for Palettes", 1, "help/specPALS.html", 56},
-	{29, "WRAP", "Wrapper for Palettes/Images", 1, "help/specWRAP.html", 60},
-	{30, "OFFS", "Offsets", 1, "help/specOFFS.html", 44},
-	{31, "APAL", "Palette", 1, "help/specAPAL.html", 34},
-	{32, "RMIM", "Room Image", 0, "", 37},
-	{33, "RMIH", "Room Image Header", 0, "", 36},
-	{34, "IM00", "Image", 0, "", 25},
-	{35, "SMAP", "Pixelmap", 0, "", 42},
-	{36, "SCAL", "Scaling", 0, "", 40},
-	{37, "AARY", "Array?", 0, "", 47},
-	{38, "ANAM", "", 0, "", 47},
-	{39, "SOUN", "Sound", 0, "", 59},
-	{40, "SCRP", "Script", 0, "", 41},
-	{41, "EXCD", "Exit Code", 0, "", 22},
-	{42, "ENCD", "Entry Code", 0, "", 21},
-	{43, "NLSC", "Non Local Script", 0, "", 41},
-	{44, "OBIM", "Object Image", 0, "", 33},
-	{45, "IMHD", "Image Header", 0, "", 26},
-	{46, "SOU ", "Sound", 0, "", 59},
-	{47, "VCTL", "", 0, "", 15},
-	{48, "Crea", "Voc Sample", 0, "", 16},
-	{49, "VTLK", "", 0, "", 15},
-	{50, "MCMP", "", 1, "help/specMCMP.html", 9},
-	{51, "iMUS", "iMUSE Digital Sound", 1, "help/speciMUS.html", 59},
-	{52, "MAP ", "iMUSE Digital MAP of Sound Data", 1, "help/specMAP.html", 29},
-	{53, "FRMT", "iMUSE Digital Sound Data Format", 1, "help/specFRMT.html", 51},
-	{54, "TEXT", "iMUSE Digital Trigger Marker", 1, "help/specTEXT.html", 45},
-	{55, "REGN", "iMUSE Digital Data Region", 1, "help/specREGN.html", 27},
-	{56, "JUMP", "iMUSE Digital Jump To Region", 1, "help/specJUMP.html", 27},
-	{57, "DATA", "iMUSE Digital Sound Data", 1, "help/specDATA.html", 16},
-	{58, "STOP", "iMUSE Digital End of Sound Data", 1, "help/specSTOP.html", 27},
-	{59, "SYNC", "iMUSE Digital Lip Sync Data", 1, "help/specSYNC.html", 43},
-	{60, "IM01", "Image", 0, "", 25},
-	{61, "IM02", "Image", 0, "", 25},
-	{62, "IM03", "Image", 0, "", 25},
-	{63, "IM04", "Image", 0, "", 25},
-	{64, "IM05", "Image", 0, "", 25},
-	{65, "IM06", "Image", 0, "", 25},
-	{66, "IM07", "Image", 0, "", 25},
-	{67, "IM08", "Image", 0, "", 25},
-	{68, "IM09", "Image", 0, "", 25},
-	{69, "IMC", "", 1, "help/specIMC.html", 59},
-	{70, "ZP01", "", 0, "", 52},
-	{71, "LSCR", "", 0, "", 41},
-	{72, "COST", "", 0, "", 11},
-	{73, "ZP02", "", 0, "", 52},
-	{74, "CHAR", "", 0, "", 8},
-	{75, "ZP03", "", 0, "", 52},
-	{76, "IM0A", "Image", 0, "", 25},
-	{77, "IM0B", "Image", 0, "", 25},
-	{78, "IM0C", "Image", 0, "", 25},
-	{79, "IM0D", "Image", 0, "", 25},
-	{80, "IM0E", "Image", 0, "", 25},
-	{81, "IM0F", "Image", 0, "", 25},
-	{82, "IM10", "Image", 0, "", 25},
-	{83, "BOMP", "", 0, "", 47},
-	{84, "IMAG", "", 0, "", 25},
-	{85, "AKOS", "Animated Costume", 0, "", 47},
-	{86, "ZP04", "", 0, "", 52},
-	{87, "RMSC", "", 1, "help/specRMSC.html", 57},
-	{88, "BSTR", "", 0, "", 42},
-	{89, "ZPLN", "", 0, "", 52},
-	{90, "AKHD", "AKOS Header", 0, "", 47},
-	{91, "AKPL", "AKOS Palette", 0, "", 47},
-	{92, "RGBS", "", 0, "", 47},
-	{93, "AKOF", "AKOS Offset", 0, "", 47},
-	{94, "AKCI", "AKOS Costume Info", 0, "", 47},
-	{95, "AKCD", "", 0, "", 47},
-	{96, "AKSQ", "AKOS Script", 0, "", 50},
-	{97, "AKCH", "", 0, "", 47},
-	{98, "ANIM", "SMUSH Animation", 0, "", 55},
-	{99, "AHDR", "SMUSH Animation Header", 0, "", 1},
-	{100, "FRME", "SMUSH Frame", 0, "", 55},
-	{101, "FOBJ", "SMUSH Frame Object", 0, "", 32},
-	{102, "IACT", "iMUSE Digital Smush Audio Track", 0, "", 24},
-	{103, "NPAL", "SMUSH New Palette", 0, "", 34},
-	{104, "TRES", "SMUSH Text Resource", 0, "", 47},
-	{105, "PSAD", "SMUSH Primary Audio", 0, "", 24},
-	{106, "SAUD", "SMUSH Audio", 0, "", 24},
-	{107, "STRK", "SMUSH Audio Track", 0, "", 24},
-	{108, "SDAT", "SMUSH Audio Data", 0, "", 24},
-	{109, "XPAL", "SMUSH Difference Palette", 0, "", 34},
-	{110, "ADL ", "Adlib MIDI Data", 1, "help/specADL.html", 31},
-	{111, "SPK ", "Speaker Sound Data", 1, "help/specSPK.html", 31},
-	{112, "ROL ", "Roland MIDI Data", 1, "help/specROL.html", 31},
-	{113, "FTCH", "SMUSH Fetch Frame", 0, "", 47},
-	{114, "STOR", "SMUSH Store Frame", 0, "", 47},
-	{115, "MIDI", "MIDI Data", 0, "", 31},
-	{116, "GMD ", "General MIDI Data", 0, "", 31},
-	{117, "SBL ", "", 0, "", 31},
-	{118, "ZSTR", "", 0, "", 47},
-	{119, "AUhd", "", 0, "", 31},
-	{120, "WVhd", "", 0, "", 31},
-	{121, "AUdt", "", 0, "", 31},
-	{122, "WVdt", "", 0, "", 31},
-	{123, "TLKB", "Talkie ?", 0, "", 47},
-	{124, "TALK", "Talkie Sounds", 0, "", 47},
-	{125, "HSHD", "Humongous Sound HeaDer", 0, "", 47},
-	{126, "DIRI", "", 0, "", 47},
-	{127, "DIRR", "Directory of Rooms", 0, "", 47},
-	{128, "DIRN", "Directory of Sounds", 0, "", 47},
-	{129, "DIRC", "Directory of Costumes", 0, "", 47},
-	{130, "DIRF", "Directory of Charsets", 0, "", 47},
-	{131, "DIRM", "", 0, "", 47},
-	{132, "DLFL", "Directory of LFLs", 0, "", 47},
-	{133, "DIRS", "", 0, "", 47},
-	{134, "SONG", "", 0, "", 47},
-	{135, "SGHD", "Song Header", 0, "", 47},
-	{136, "SGEN", "Song ?", 0, "", 47},
-	{137, "DIGI", "Digital Sound", 0, "", 47},
-	{138, "RMDA", "Room Data", 0, "", 38},
-	{139, "BMAP", "Bitmap Image", 0, "", 47},
-	{140, "WIZH", "", 0, "", 47},
-	{141, "AWIZ", "", 0, "", 47},
-	{142, "WIZD", "", 0, "", 47},
-	{143, "SPOT", "", 0, "", 47},
-	{144, "CNVS", "", 0, "", 47},
-	{145, "POLD", "", 0, "", 47},
-	{146, "LSC2", "", 0, "", 47},
-	{147, "FMUS", "Music header?", 0, "", 47},
-	{148, "SKIP", "SMUSH Skip Frame", 0, "", 47},
-	{149, "IaCt", "INSANE Action", 0, "", 24}, // small letters are intentional
-	{150, "REMP", "Actor Palette?", 0, "", 34},
-	{151, "SANM", "SMUSH v2 file", 0, "", 55},
-	{152, "Wave", "SMUSH v2 VIMA audio codec", 0, "", 55},
-	{153, "Bl16", "SMUSH v2 Blocky16 video codec", 0, "", 55},
-	{154, "FLHD", "SMUSH v2 Frame Header", 0, "", 55},
-	{155, "ANNO", "SMUSH v2 Annotations", 0, "", 55},
-	{156, "ZFOB", "SMUSH Zlib Compressed Frame Object", 0, "", 32},
-	{157, "SMRK", "SMUSH Audio Marker", 0, "", 24},
-	{158, "SHDR", "SMUSH Audio Header/SMUSH v2 Header", 0, "", 24},
-	{159, "ETRS", "SMUSH External Text Resource", 0, "", 24}
-};
-
-const int numBlocks = 160;
-
-const struct blockInfo oldBlocksInfo[] = {
-	{200, "0R", "Directory of Rooms", 0, "", 18},
-	{201, "0S", "", 0, "", 19},
-	{202, "0N", "", 0, "", 47},
-	{203, "0C", "", 0, "", 14},
-	{204, "0O", "Directory of Objects", 0, "", 17},
-	{205, "RO", "", 0, "", 38},
-	{206, "HD", "", 0, "", 35},
-	{207, "BX", "", 0, "", 4},
-	{208, "PA", "", 0, "", 34},
-	{209, "BM", "", 0, "", 37},
-	{210, "OI", "", 0, "", 33},
-	{211, "OC", "", 0, "", 41},
-	{212, "NL", "", 0, "", 41},
-	{213, "SL", "", 0, "", 47},
-	{214, "EX", "", 0, "", 22},
-	{215, "EN", "", 0, "", 21},
-	{216, "LC", "", 0, "", 47},
-	{217, "LS", "", 0, "", 41},
-	{218, "SC", "", 0, "", 41},
-	{219, "CO", "", 0, "", 11},
-	{220, "LE", "LucasArts Entertainment Company Files", 0, "", 6},
-	{221, "FO", "", 0, "", 44},
-	{222, "LF", "", 0, "", 58},
-	{223, "CC", "", 0, "", 12},
-	{224, "SP", "", 0, "", 47},
-	{225, "SA", "", 0, "", 40},
-	{226, "SO", "", 0, "", 59},
-	{227, "RN", "", 0, "", 47},
-	{228, "WA", "", 0, "", 31},
-	{229, "AD", "", 0, "", 31}
-};
-
-const int numOldBlocks = 30;
+extern const struct blockInfo blocksInfo[];
+extern const struct blockInfo oldBlocksInfo[];
 
 class Resource {
 private:
 	int stopflag;	
 public:
 	Resource();
-	int getBlockType(char *tag);
-	int getOldBlockType(char *tag);
+	int getBlockType(const char *tag);
+	int getOldBlockType(const char *tag);
 	int searchBlocks(BlockTable *_blockTable, File& _input, int index = 0, int level = 1, int size = 0);
 	int searchOldBlocks(BlockTable *_blockTable, File& _input, int index = 0, int level = 1, int size = 0);
-	int parseBlocks(char *blockName, BlockTable *_blockTable, File& _input, int index, int level);
-	int parseOldBlocks(char *blockName, BlockTable *_blockTable, File& _input, int index, int level);
+	int parseBlocks(const char *blockName, BlockTable *_blockTable, File& _input, int index, int level);
+	int parseOldBlocks(const char *blockName, BlockTable *_blockTable, File& _input, int index, int level);
 	int findBlock(int direction, BlockTable * _blockTable, int id, ...);
 };
 

Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummsys.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scummsys.h	23 Sep 2003 00:47:23 -0000	1.2
+++ scummsys.h	19 Sep 2004 13:50:42 -0000	1.3
@@ -215,19 +215,19 @@
 
 	#define READ_UINT32(a) READ_LE_UINT32(a)
 
-	#define FROM_LE_32(a) (a)
-	#define FROM_LE_16(a) (a)
+	#define FROM_LE_32(a) ((uint32)(a))
+	#define FROM_LE_16(a) ((uint16)(a))
 
-	#define TO_LE_32(a) (a)
-	#define TO_LE_16(a) (a)
+	#define TO_LE_32(a) ((uint32)(a))
+	#define TO_LE_16(a) ((uint16)(a))
 
 	#define TO_BE_32(a) SWAP_BYTES_32(a)
 	#define TO_BE_16(a) SWAP_BYTES_16(a)
 
 #elif defined(SCUMM_BIG_ENDIAN)
 
-	#define MKID(a) (a)
-	#define MKID_BE(a) (a)
+	#define MKID(a) ((uint32)(a))
+	#define MKID_BE(a) ((uint32)(a))
 	//#define MKID_BE(a) SWAP_BYTES_32(a)
 
 	#define READ_UINT32(a) READ_BE_UINT32(a)
@@ -238,8 +238,8 @@
 	#define TO_LE_32(a) SWAP_BYTES_32(a)
 	#define TO_LE_16(a) SWAP_BYTES_16(a)
 
-	#define TO_BE_32(a) (a)
-	#define TO_BE_16(a) (a)
+	#define TO_BE_32(a) ((uint32)(a))
+	#define TO_BE_16(a) ((uint16)(a))
 
 #else
 

Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- wxwindows.cpp	3 Jul 2004 14:47:43 -0000	1.38
+++ wxwindows.cpp	19 Sep 2004 13:50:42 -0000	1.39
@@ -26,7 +26,6 @@
 #include "icons.h"
 
 ScummEX *g_scummex = 0;
-wxTextCtrl *hexdata = 0;
 wxToolBar *ToolBar = 0;
 GUI_wxWindows *_gui = 0;
 
@@ -164,8 +163,7 @@
 }
 
 BEGIN_EVENT_TABLE(ImageWindow, wxFrame)
-	EVT_CLOSE(ImageWindow::OnQuit)
-	EVT_MENU(Viewer_Quit, ImageWindow::OnQuit)
+	EVT_CLOSE(ImageWindow::OnClose)
 	EVT_MENU(ID_BMP, ImageWindow::SaveImage)
 	EVT_MENU(ID_Boxes, ImageWindow::boxesDrawOverlay)
 	EVT_MENU(ID_Scale1x, ImageWindow::Scale1x)
@@ -187,7 +185,7 @@
 	BMPItem->SetBitmap(SaveIcon);
 	menuFile->Append(BMPItem);
 
-	menuFile->Append(Viewer_Quit,"Close");
+	menuFile->Append(wxID_CLOSE,"Close");
 	
 	menuBar->Append(menuFile,"&File");
 
@@ -245,21 +243,21 @@
 	Refresh();
 }
 
-void ImageWindow::Scale1x(wxEvent& event) {
+void ImageWindow::Scale1x(wxCommandEvent& event) {
 	_scaleFactor = 1;
 	menuZoom->Check(ID_Scale2x, FALSE);
 	menuZoom->Check(ID_Scale3x, FALSE);
 	Scale();
 }
 
-void ImageWindow::Scale2x(wxEvent& event) {
+void ImageWindow::Scale2x(wxCommandEvent& event) {
 	_scaleFactor = 2;
 	menuZoom->Check(ID_Scale1x, FALSE);
 	menuZoom->Check(ID_Scale3x, FALSE);
 	Scale();
 }
 
-void ImageWindow::Scale3x(wxEvent& event) {
+void ImageWindow::Scale3x(wxCommandEvent& event) {
 	_scaleFactor = 3;
 	menuZoom->Check(ID_Scale1x, FALSE);
 	menuZoom->Check(ID_Scale2x, FALSE);
@@ -322,14 +320,14 @@
 	}
 }
 
-void ImageWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
+void ImageWindow::OnClose(wxCloseEvent& WXUNUSED(event))
 {
 	delete _image;
 	g_scummex->getBlockTable(_blockId).image = NULL;
 	Destroy();
 }
 
-void ImageWindow::SaveImage(wxEvent& event) {
+void ImageWindow::SaveImage(wxCommandEvent& event) {
 	wxFileDialog *dialog = new wxFileDialog(this, "Please select an output file.", "", "",
 		"*",
 		wxSAVE);
@@ -339,7 +337,7 @@
 	}
 }
 
-void ImageWindow::boxesDrawOverlay(wxEvent& event) {
+void ImageWindow::boxesDrawOverlay(wxCommandEvent& event) {
 	if (!_boxesDisplayed) {
 		_boxesDisplayed = 1;
 		g_scummex->boxesDraw(_blockId);
@@ -353,41 +351,34 @@
 	_image->SetRGB(x, y, (unsigned char) red, (unsigned char) green, (unsigned char) blue);
 }
 
-void GUI_wxWindows::DisplayViewer(char *title, int width, int height, char *text) {
-	ViewerWindow *viewerFrame = new ViewerWindow(_mainWindow, title, text, wxPoint(50,50), wxSize(width, height));
-}
-
-void GUI_wxWindows::AppendText(char *text) {
-	hexdata->AppendText(text);
+ViewerWindow *GUI_wxWindows::DisplayViewer(char *title, int width, int height, char *text) {
+	return new ViewerWindow(_mainWindow, title, text, wxPoint(50,50), wxSize(width, height));
 }
 
 BEGIN_EVENT_TABLE(ViewerWindow, wxFrame)
-	EVT_CLOSE(ViewerWindow::OnQuit)
-	EVT_MENU(Viewer_Quit, ViewerWindow::OnQuit)
 END_EVENT_TABLE()
 
 ViewerWindow::ViewerWindow(MainWindow *parent, const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size)
 	: wxFrame(parent, ID_ViewerWindow, title, pos, size)
 {
 	wxMenu *menuFile = new wxMenu;
-	menuFile->Append(Viewer_Quit,"Close");
+	menuFile->Append(wxID_CLOSE,"Close");
 	
 	wxMenuBar *menuBar = new wxMenuBar;
 	menuBar->Append(menuFile,"&File");
 	
 	SetMenuBar(menuBar);
 
-	hexdata = new wxTextCtrl(this, -1, text, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE|wxTE_RICH, wxDefaultValidator, wxTextCtrlNameStr);
+	_textCtrl = new wxTextCtrl(this, -1, text, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE|wxTE_DONTWRAP, wxDefaultValidator, wxTextCtrlNameStr);
 
-	hexdata->SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL));
+	_textCtrl->SetFont(wxFont(10, wxMODERN, wxNORMAL, wxNORMAL));
 
 	Show(TRUE);
 
 }
 
-void ViewerWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-	Destroy();
+void ViewerWindow::AppendText(const char *text) {
+	_textCtrl->AppendText(text);
 }
 
 void GUI_wxWindows::DisplayDialog(char *message, char *title) {
@@ -669,19 +660,19 @@
 }
 
 BEGIN_EVENT_TABLE(MainWindow, wxFrame)
-	EVT_MENU(wxID_EXIT, MainWindow::OnQuit)
+	EVT_CLOSE(MainWindow::OnClose)
 	EVT_MENU(wxID_ABOUT, MainWindow::OnAbout)
 	EVT_MENU(wxID_OPEN, MainWindow::OnOpen)
 	EVT_MENU(ID_View, MainWindow::FileView)
 	EVT_MENU(ID_Dump, MainWindow::BlockDump)
 	EVT_MENU(wxID_HELP, MainWindow::OnHelp)
 	EVT_MENU(ID_FileInfo, MainWindow::FileInfo)
-	EVT_CUSTOM(wxEVT_COMMAND_TREE_SEL_CHANGING, ID_Tree, MainWindow::OnSelChanged)
+	EVT_TREE_SEL_CHANGING(ID_Tree, MainWindow::OnSelChanged)
 END_EVENT_TABLE()
 
 
 MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize& size)
-	: wxFrame((wxFrame*)NULL,-1,title,pos,size),
+	: wxFrame((wxFrame*)NULL, wxID_ANY, title,pos,size),
 	_filename(0), _blockId(0)
 {
 	htmlflag = 0;
@@ -702,11 +693,11 @@
 	wxMenu *fileMenu = new wxMenu();
 	
 	fileMenu->Append(wxID_OPEN, "&Open...\tCtrl-O", "Open resource file");
-	fileMenu->Append(wxID_CLOSE, "Close\tCtrl-W", "Close resource file");
+	fileMenu->Append(wxID_CLOSE, "&Close\tCtrl-W", "Close resource file");
 	fileMenu->AppendSeparator();
-	fileMenu->Append(ID_FileInfo, "File Info", "Show File Info");
+	fileMenu->Append(ID_FileInfo, "File &Info", "Show File Info");
 	fileMenu->AppendSeparator();
-	fileMenu->Append(wxID_EXIT, "Exit\tCtrl-X");
+	fileMenu->Append(wxID_EXIT, "E&xit\tCtrl-X");
 	// FIXME: On Mac you *always* say "Quit", but on Windows/Linux, "Exit" is more common, I think?
 	// So maybe we'll have to make this compile conditionally...
 	
@@ -818,7 +809,7 @@
 	for (int i = 0; i < 5; i++) {
 		GenInfosSizer->Add(_GenLabel[i][0], 0, wxALL|wxEXPAND, 1);
 	}
-		
+
 	for (int i = 0; i < 5; i++) {
 		_GenLabel[i][1] = new wxStaticText(infospanel, -1, "n/a", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE);
 		GenInfosSizer2->Add(_GenLabel[i][1], 0, wxALL|wxEXPAND, 1);
@@ -886,6 +877,7 @@
 	htmlpanel->SetAutoLayout( true );
 	htmlpanel->SetSizer( htmlpanelsizer );	
 	
+/*
 	//
 	// Search panel
 	//	
@@ -915,7 +907,8 @@
 			
 	searchpanel->SetAutoLayout( true );
 	searchpanel->SetSizer( SearchPanelSizer );	
-	
+*/
+
 	panel->SetAutoLayout( TRUE );
 	panel->SetSizer( RootSizer );
 
@@ -928,11 +921,6 @@
 	_gui->readConfigValue("DataPath", &_filepath);
 }
 
-void MainWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-	Close(TRUE);
-}
-
 void MainWindow::OnAbout(wxCommandEvent& WXUNUSED(event))
 {
 	wxMessageDialog *dialog = new wxMessageDialog(this, "\nScummEX 0.1.0cvs (C) 2003 The ScummVM project\n","About", wxOK|wxCENTRE);
@@ -961,6 +949,11 @@
 	}
 }
 
+void MainWindow::OnClose(wxCloseEvent& event)
+{
+	Destroy();
+}
+
 void MainWindow::OnSelChanged(wxTreeEvent& event) {
 	wxTreeItemId itemid;
 	int itemtype;
@@ -1002,11 +995,11 @@
 	event.Skip();
 }
 
-void MainWindow::FileView(wxEvent& event) {
+void MainWindow::FileView(wxCommandEvent& event) {
 	g_scummex->fileView(_blockId);
 }
 
-void MainWindow::FileInfo(wxEvent& event) {
+void MainWindow::FileInfo(wxCommandEvent& event) {
 	FileInfoDialog(g_scummex->getInputFileSize(), g_scummex->getEncByte());
 }
 
@@ -1029,7 +1022,7 @@
 }
 
 
-void MainWindow::BlockDump(wxEvent& event) {
+void MainWindow::BlockDump(wxCommandEvent& event) {
 	wxFileDialog *dialog = new wxFileDialog(this, "Please select an output file.", "", "",
 		"*",
 		wxSAVE);

Index: wxwindows.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- wxwindows.h	3 Jul 2004 14:47:43 -0000	1.19
+++ wxwindows.h	19 Sep 2004 13:50:42 -0000	1.20
@@ -54,7 +54,7 @@
 	wxNotebook *notebook;
 	wxBitmap bigIconBitmap;
 	wxStaticBitmap *BigIcon;
-	wxPanel *panel, *infospanel, *htmlpanel, *searchpanel;
+	wxPanel *panel, *infospanel, *htmlpanel;
 	int htmlflag;
 	wxStaticText *_GenLabel[5][2];
 	wxStaticText *_SpecLabel[6][2];
@@ -76,15 +76,15 @@
 	void add_tree_elements(char *itemName, int blockid, int level, int type);
 
 protected:
-	void OnQuit(wxCommandEvent& event);
 	void OnAbout(wxCommandEvent& event);
 	void OnOpen(wxCommandEvent& event);
+	void OnClose(wxCloseEvent& event);
 	void OnHelp(wxCommandEvent& event);
 	void OnSelChanged(wxTreeEvent& event);
 
-	void FileView(wxEvent& event);
-	void FileInfo(wxEvent& event);
-	void BlockDump(wxEvent& event);
+	void FileView(wxCommandEvent& event);
+	void FileInfo(wxCommandEvent& event);
+	void BlockDump(wxCommandEvent& event);
 	void SaveSOU(wxEvent& event);
 	void SaveiMUSE(wxEvent& event);
 
@@ -123,12 +123,12 @@
 	int _blockId;
 	int _boxesDisplayed;
 
-	void OnQuit(wxCommandEvent& event);
-	void SaveImage(wxEvent& event);
-	void boxesDrawOverlay(wxEvent& event);
-	void Scale1x(wxEvent& event);
-	void Scale2x(wxEvent& event);
-	void Scale3x(wxEvent& event);
+	void OnClose(wxCloseEvent& event);
+	void SaveImage(wxCommandEvent& event);
+	void boxesDrawOverlay(wxCommandEvent& event);
+	void Scale1x(wxCommandEvent& event);
+	void Scale2x(wxCommandEvent& event);
+	void Scale3x(wxCommandEvent& event);
 	void Scale();
 
 	DECLARE_EVENT_TABLE()
@@ -146,11 +146,15 @@
 };
 
 class ViewerWindow : public wxFrame {
+private:
+	wxTextCtrl *_textCtrl;
+
 public:
 	ViewerWindow(MainWindow *parent, const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size);
 
+	void AppendText(const char *text);
+
 protected:
-	void OnQuit(wxCommandEvent& event);
 
 	DECLARE_EVENT_TABLE()
 };
@@ -166,10 +170,9 @@
 	MainWindow *_mainWindow;
 	void EnableToolbarTool(int tool);
 	void DisableToolbarTool(int tool);
-	void AppendText(char *text);
 	void DisplayHelp();
 	void SetTitle(char *title);
-	void DisplayViewer(char *title, int width, int height, char *text);
+	ViewerWindow* DisplayViewer(char *title, int width, int height, char *text);
 	void DisplayDialog(char *message, char *title);
 	virtual bool OnInit();
 	void add_tree_elements(char *itemName, int blockid, int level, int type);
@@ -194,7 +197,6 @@
 	ID_View,
 	ID_SpecButton1,
 	ID_SpecButton2,
-	Viewer_Quit,
 	Button_Open,
 	Button_Close,
 	Button_Save,





More information about the Scummvm-git-logs mailing list