[Scummvm-cvs-logs] CVS: scummex image.cpp,1.14,1.15 image.h,1.8,1.9 scummex.cpp,1.22,1.23 scummex.h,1.13,1.14 wxwindows.cpp,1.21,1.22 wxwindows.h,1.10,1.11
Adrien Mercier
yoshizf at users.sourceforge.net
Wed Sep 24 04:51:01 CEST 2003
Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv29358
Modified Files:
image.cpp image.h scummex.cpp scummex.h wxwindows.cpp
wxwindows.h
Log Message:
Rewrote ImageWindow so we can display multiple ones and specify where we want to draw. Now you can display/hide boxes on the image.
Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- image.cpp 23 Sep 2003 12:56:12 -0000 1.14
+++ image.cpp 24 Sep 2003 11:49:30 -0000 1.15
@@ -43,7 +43,7 @@
int index = 0;
unsigned int h;
- _gui->DisplayImage("Block Palette", 384, 384);
+ _imageWindowId = _gui->DisplayImage("Block Palette", 384, 384, id);
_input.seek(_blockTable[id].offset + 8, SEEK_SET);
@@ -75,7 +75,7 @@
for (int l = 0; l < 16; l++) {
for (int j = 0; j < 384 / 16; j++) {
index = l + addindex;
- _gui->PutPixel(x++, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
y++;
@@ -84,7 +84,7 @@
addindex += 16;
}
- _gui->DrawImage();
+ _gui->DrawImage(_imageWindowId);
return 0;
}
@@ -94,7 +94,7 @@
double x, xinc, y, yinc;
if (xStart == xEnd && yStart == yEnd) {
- _gui->PutPixel(xEnd, yEnd, red, green, blue);
+ _gui->PutPixel(_imageWindowId, xEnd, yEnd, red, green, blue);
return;
}
@@ -113,14 +113,14 @@
y = yStart + 0.5;
for (i=0; i<=len; ++i) {
- _gui->PutPixel((int)x, (int)y, red, green, blue);
+ _gui->PutPixel(_imageWindowId, (int)x, (int)y, red, green, blue);
x += xinc;
y += yinc;
}
}
-int Image::drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow) {
+int Image::drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow, int imageWindowId) {
int nBox, RMHDindex, width, height, version = 5;
RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
@@ -134,6 +134,7 @@
}
if (newWindow == 0) {
+ _imageWindowId = imageWindowId;
if (version > 5) {
id = _resource->findBlock(1, _blockTable, id, "BOXD", NULL);
} else {
@@ -177,9 +178,8 @@
}
- if (newWindow == 1) {
- _gui->DisplayImage("Boxes", width, height);
- }
+ if (newWindow == 1)
+ _imageWindowId = _gui->DisplayImage("Boxes", width, height, id);
for (int i=0; i<nBox; i++) {
for (int j=0; j<3; j++) {
@@ -189,9 +189,9 @@
}
if (newWindow == 1) {
- _gui->DrawImage();
+ _gui->DrawImage(_imageWindowId);
} else {
- _gui->UpdateImage();
+ _gui->UpdateImage(_imageWindowId);
}
return 0;
}
@@ -235,22 +235,22 @@
break;
}
- _gui->DisplayImage("SMUSH Frame", _blockTable[id].width, _blockTable[id].height);
+ _imageWindowId = _gui->DisplayImage("SMUSH Frame", _blockTable[id].width, _blockTable[id].height, id);
for (y=0; y<_blockTable[id].height; y++) {
for (x=0; x<_blockTable[id].width; x++) {
int color = *dst++;
- _gui->PutPixel(x, y, _rgbTable[color].red, _rgbTable[color].green, _rgbTable[color].blue);
+ _gui->PutPixel(_imageWindowId, x, y, _rgbTable[color].red, _rgbTable[color].green, _rgbTable[color].blue);
}
}
free(chunk_buffer);
free(dstorg);
- _gui->DrawImage();
+ _gui->DrawImage(_imageWindowId);
return 0;
}
-int Image::drawBG(File& _input, BlockTable *_blockTable, int id)
+int Image::drawBG(File& _input, BlockTable *_blockTable, int id, int newWindow, int imageWindowId)
{
int RMHDindex, CLUTindex, SMAPindex, TRNSindex;
@@ -264,7 +264,11 @@
_width = _blockTable[RMHDindex].width;
_height = _blockTable[RMHDindex].height;
- _gui->DisplayImage("Room Image", _width, _height, IMAGE_BOXES);
+ if (newWindow) {
+ _imageWindowId = _gui->DisplayImage("Room Image", _width, _height, id, IMAGE_BOXES);
+ } else {
+ _imageWindowId = imageWindowId;
+ }
if (_blockTable[id].blockTypeID != BM) {
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
@@ -311,7 +315,11 @@
GetStrip(x, _input);
}
- _gui->DrawImage();
+ if (newWindow) {
+ _gui->DrawImage(_imageWindowId);
+ } else {
+ _gui->UpdateImage(_imageWindowId);
+ }
return 0;
}
@@ -325,7 +333,7 @@
_width = _blockTable[RMHDindex].width;
_height = _blockTable[RMHDindex].height;
- _gui->DisplayImage("Object", _width, _height);
+ _imageWindowId = _gui->DisplayImage("Object", _width, _height, id);
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
@@ -356,7 +364,7 @@
GetStrip(x, _input);
}
- _gui->DrawImage();
+ _gui->DrawImage(_imageWindowId);
return 0;
}
@@ -416,7 +424,7 @@
for (uint8 x = 0; x < 8; x++)
{
index = _input.readByte();
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
@@ -431,13 +439,13 @@
if (y == 0)
{
index = _input.readByte();
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
while ( x < 8 )
{
if (_input.getbit(1) == 0)
- _gui->PutPixel(x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
{
if (_input.getbit(1) == 0)
@@ -445,7 +453,7 @@
index = 0;
for (uint8 cx = 0; cx < parameter; cx++)
index += (_input.getbit(1) << cx);
- _gui->PutPixel(x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
@@ -465,13 +473,13 @@
x = 0;
y++;
}
- _gui->PutPixel(x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
else
{
index += command - 4;
- _gui->PutPixel(x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
@@ -490,13 +498,13 @@
{
index = _input.readByte();
if (index != _transp)
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
while ( x < 8 )
{
if (_input.getbit(1) == 0)
- _gui->PutPixel(x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x++ + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
if (_input.getbit(1) == 0)
{
@@ -504,7 +512,7 @@
for (uint8 cx = 0; cx < parameter; cx++)
index += (_input.getbit(1) << cx);
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
else
@@ -516,7 +524,7 @@
{
index -= 4-command;
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
else if (command == 4)
@@ -532,7 +540,7 @@
y++;
}
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
@@ -541,7 +549,7 @@
{
index += command-4;
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
}
@@ -561,11 +569,11 @@
if ((y == 0) && (x == 0))
{
index = _input.readByte();
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
if (_input.getbit(1) == 0)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
{
if (_input.getbit(1) == 0)
@@ -574,20 +582,20 @@
for (uint8 cx = 0; cx < parameter; cx++)
index += (_input.getbit(1) << cx );
subt = 1;
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
if (_input.getbit(1) == 0)
{
index -= subt;
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
subt =- subt;
index -= subt;
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
@@ -607,11 +615,11 @@
if ((y == 0) && (x == 0))
{
index = _input.readByte();
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
if (_input.getbit(1) == 0)
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
{
if (_input.getbit(1) == 0)
@@ -620,20 +628,20 @@
for (uint8 cx = 0; cx < parameter; cx++)
index += (_input.getbit(1) << cx );
subt = 1;
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
if (_input.getbit(1) == 0)
{
index -= subt;
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
subt =- subt;
index -= subt;
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
@@ -654,12 +662,12 @@
{
index = _input.readByte();
if (index != _transp)
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
if (_input.getbit(1) == 0)
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
{
if (_input.getbit(1) == 0)
@@ -669,7 +677,7 @@
index += (_input.getbit(1) << cx );
subt = 1;
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
@@ -677,14 +685,14 @@
{
index -= subt;
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
subt =- subt;
index -= subt;
if (index != _transp)
- _gui->PutPixel(x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, x + offset, y, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
@@ -705,12 +713,12 @@
{
index = _input.readByte();
if (index != _transp)
- _gui->PutPixel(0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, 0 + offset, 0, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
x++;
}
if (_input.getbit(1) == 0)
if (index != _transp)
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
else
{
if (_input.getbit(1) == 0)
@@ -720,7 +728,7 @@
index += (_input.getbit(1) << cx );
subt = 1;
if (index != _transp)
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
@@ -728,14 +736,14 @@
{
index -= subt;
if (index != _transp)
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
else
{
subt =- subt;
index -= subt;
if (index != _transp)
- _gui->PutPixel(y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
+ _gui->PutPixel(_imageWindowId, y + offset, x, _rgbTable[index].red, _rgbTable[index].green, _rgbTable[index].blue);
}
}
}
Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- image.h 23 Sep 2003 00:47:23 -0000 1.8
+++ image.h 24 Sep 2003 11:49:30 -0000 1.9
@@ -48,6 +48,7 @@
uint32 *_offsets;
int _width;
int _height;
+ int _imageWindowId;
Resource *_resource;
Codec37Decoder _codec37;
Codec47Decoder _codec47;
@@ -58,10 +59,10 @@
Image();
~Image();
int drawPalette(BlockTable *_blockTable, int id, File& _input);
- int drawBG(File& _input, BlockTable *_blockTable, int id);
+ int drawBG(File& _input, BlockTable *_blockTable, int id, int newWindow = 1, int imageWindowId = 0);
int drawObject(File& _input, BlockTable *_blockTable, int id);
int drawSmushFrame(BlockTable *_blockTable, int id, File& _input);
- int drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow = 1);
+ int drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow = 1, int imageWindowId = 0);
void decode_uncompressed(uint16 height, File& _input);
void decode_horiz(uint16 height, uint8 compr, File& _input);
void decode_vert(uint16 height, uint8 compr, File& _input);
Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- scummex.cpp 23 Sep 2003 13:40:54 -0000 1.22
+++ scummex.cpp 24 Sep 2003 11:49:30 -0000 1.23
@@ -273,6 +273,11 @@
_image->drawBG(_input, _blockTable, blockid);
}
+void ScummEX::bgReDraw(int imageWindowId, int blockid)
+{
+ _image->drawBG(_input, _blockTable, blockid, 0, imageWindowId);
+}
+
void ScummEX::SmushFrameDraw(int blockid)
{
_image->drawSmushFrame(_blockTable, blockid, _input);
@@ -288,7 +293,7 @@
_image->drawBoxes(_blockTable, blockid, _input);
}
-void ScummEX::boxesDrawOverlay(int blockid)
+void ScummEX::boxesDrawOverlay(int imageWindowId, int blockid)
{
- _image->drawBoxes(_blockTable, blockid, _input, 0);
+ _image->drawBoxes(_blockTable, blockid, _input, 0, imageWindowId);
}
Index: scummex.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- scummex.h 23 Sep 2003 12:26:09 -0000 1.13
+++ scummex.h 24 Sep 2003 11:49:30 -0000 1.14
@@ -65,7 +65,8 @@
void SmushFrameDraw(int blockid);
void objectDraw(int blockid);
void boxesDraw(int blockid);
- void boxesDrawOverlay(int blockid);
+ void boxesDrawOverlay(int imageWindowId, int blockid);
+ void bgReDraw(int imageWindowId, int blockid);
const BlockTable &getBlockTable(int blockid) const { return _blockTable[blockid]; }
Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- wxwindows.cpp 23 Sep 2003 13:40:54 -0000 1.21
+++ wxwindows.cpp 24 Sep 2003 11:49:30 -0000 1.22
@@ -26,17 +26,16 @@
#include "icons.h"
ScummEX *g_scummex = 0;
-wxImage *image = 0;
wxTextCtrl *hexdata = 0;
wxToolBar *ToolBar = 0;
GUI_wxWindows *_gui = 0;
-
+int imageWindowId;
IMPLEMENT_APP(GUI_wxWindows)
GUI_wxWindows::GUI_wxWindows()
- : _mainWindow(0), _imageWindow(0) {
+ : _mainWindow(0) {
g_scummex = new ScummEX();
_gui = this; // FIXME - ugly quick workaround for previously broken code
}
@@ -124,22 +123,22 @@
return 0;
}
-void GUI_wxWindows::PutPixel(int x, int y, int red, int green, int blue) {
- image->SetRGB(x, y, (unsigned char) red, (unsigned char) green, (unsigned char) blue);
+void GUI_wxWindows::PutPixel(int imgWindowId, int x, int y, int red, int green, int blue) {
+ _imageWindow[imgWindowId]->PutPixel(x, y, red, green, blue);
}
-void GUI_wxWindows::DisplayImage(char* title, int width, int height, byte flags) {
- _imageWindow = new ImageWindow(_mainWindow, title, wxPoint(-1,-1), wxSize(width, height), flags);
+int GUI_wxWindows::DisplayImage(char* title, int width, int height, int blockId, byte flags) {
+ _imageWindow[imageWindowId] = new ImageWindow(_mainWindow, imageWindowId + 150, title, wxPoint(-1,-1), wxSize(width, height), blockId, flags);
+ imageWindowId++;
+ return imageWindowId - 1;
}
-void GUI_wxWindows::DrawImage() {
- _imageWindow->DrawImage();
+void GUI_wxWindows::DrawImage(int imgWindowId) {
+ _imageWindow[imgWindowId]->DrawImage();
}
-void GUI_wxWindows::UpdateImage() {
- wxBitmap bitmap = wxBitmap(image);
- _imageWindow->_sbmp->SetBitmap(bitmap);
- _imageWindow->Refresh();
+void GUI_wxWindows::UpdateImage(int imgWindowId) {
+ _imageWindow[imgWindowId]->UpdateImage();
}
BEGIN_EVENT_TABLE(ImageWindow, wxFrame)
@@ -149,11 +148,13 @@
EVT_MENU(ID_Boxes, ImageWindow::boxesDrawOverlay)
END_EVENT_TABLE()
-ImageWindow::ImageWindow(MainWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, byte flags)
- : wxFrame(parent,ID_ImageWindow,title,pos,size, wxDEFAULT_FRAME_STYLE & (wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION))
+ImageWindow::ImageWindow(MainWindow *parent, int imgWindowId, const wxString& title, const wxPoint& pos, const wxSize& size, int blockId, byte flags)
+ : wxFrame(parent, imgWindowId, title, pos, size, wxDEFAULT_FRAME_STYLE & (wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION))
{
wxMenuBar *menuBar = new wxMenuBar;
wxMenu *menuFile = new wxMenu;
+ _blockId = blockId;
+ _boxesDisplayed = 0;
wxMenuItem *BMPItem = new wxMenuItem(menuFile, ID_BMP, "Save to BMP...", "Save image to .BMP", wxITEM_NORMAL, NULL );
wxBitmap SaveIcon = wxBitmap(save_icon);
@@ -166,18 +167,18 @@
if (flags & IMAGE_BOXES) {
wxMenu *menuView = new wxMenu;
- wxMenuItem *BoxesItem = new wxMenuItem(menuView, ID_Boxes, "Display Boxes", "Display Boxes", wxITEM_NORMAL, NULL );
+ wxMenuItem *BoxesItem = new wxMenuItem(menuView, ID_Boxes, "Display Boxes", "Display Boxes", wxITEM_CHECK, NULL );
menuView->Append(BoxesItem);
menuBar->Append(menuView,"View");
}
SetMenuBar(menuBar);
SetClientSize(size.GetWidth(), size.GetHeight());
- image = new wxImage(size.GetWidth(), size.GetHeight());
+ _image = new wxImage(size.GetWidth(), size.GetHeight());
}
void ImageWindow::DrawImage() {
- wxBitmap bitmap = wxBitmap(image);
+ wxBitmap bitmap = wxBitmap(_image);
wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
@@ -190,7 +191,8 @@
void ImageWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
{
- delete image;
+ delete _image;
+ imageWindowId--;
Destroy();
}
@@ -200,18 +202,29 @@
wxSAVE);
if (dialog->ShowModal() == wxID_OK) {
const char *filename = (const char*)dialog->GetPath();
- image->SaveFile(filename, wxBITMAP_TYPE_BMP);
+ _image->SaveFile(filename, wxBITMAP_TYPE_BMP);
}
}
void ImageWindow::boxesDrawOverlay(wxEvent& event) {
-// FIXME: need to pass the current block ID here. I could add a hack to do
-// that, however, the truth is that ImageWindow and Image are not quite nice
-// anyway... We probably should just rewrite them in a cleaner fashion.
-// Also it feels odd to reuse a single ImageWindow for everything, after all
-// one may want to compare multiple palettes/rooms etc. side-by-side.
-//
-// g_scummex->boxesDrawOverlay();
+ int windowId = this->GetId() - 150;
+ if (!_boxesDisplayed) {
+ _boxesDisplayed = 1;
+ g_scummex->boxesDrawOverlay(windowId, _blockId);
+ } else {
+ _boxesDisplayed = 0;
+ g_scummex->bgReDraw(windowId, _blockId);
+ }
+}
+
+void ImageWindow::PutPixel(int x, int y, int red, int green, int blue) {
+ _image->SetRGB(x, y, (unsigned char) red, (unsigned char) green, (unsigned char) blue);
+}
+
+void ImageWindow::UpdateImage() {
+ wxBitmap bitmap = wxBitmap(_image);
+ _sbmp->SetBitmap(bitmap);
+ Refresh();
}
void GUI_wxWindows::DisplayViewer(char *title, int width, int height, char *text) {
@@ -276,9 +289,9 @@
switch(blocktype) {
case cus2: // iMUSE
SpecButton1->SetLabel("Play");
- SpecButton2->SetLabel("Decompress to WAV...");
+ SpecButton2->SetLabel("Dump to WAV...");
SpecButton1->Show(TRUE);
- SpecButton1->Enable(FALSE); // FIXME Mixer not working anymore?
+ //SpecButton1->Enable(FALSE); // FIXME Mixer not working anymore?
SpecButton2->Show(TRUE);
Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction) &MainWindow::iMUSEPlay );
@@ -295,11 +308,11 @@
case Crea:
SpecButton1->SetLabel("Play");
- SpecButton2->SetLabel("Decompress to WAV...");
+ SpecButton2->SetLabel("Dump to WAV...");
SpecButton1->Show(TRUE);
- SpecButton1->Enable(FALSE); // FIXME Mixer not working anymore?
+ //SpecButton1->Enable(FALSE); // FIXME Mixer not working anymore?
SpecButton2->Show(TRUE);
- SpecButton2->Enable(FALSE);
+ //SpecButton2->Enable(FALSE);
Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction) &MainWindow::SOUPlay );
Connect( ID_SpecButton2, wxEVT_COMMAND_BUTTON_CLICKED,
Index: wxwindows.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- wxwindows.h 23 Sep 2003 13:40:54 -0000 1.10
+++ wxwindows.h 24 Sep 2003 11:49:30 -0000 1.11
@@ -104,12 +104,17 @@
class ImageWindow : public wxFrame {
public:
- wxStaticBitmap *_sbmp;
-
- ImageWindow(MainWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, byte flags);
+ ImageWindow(MainWindow *parent, int imgWindowId, const wxString& title, const wxPoint& pos, const wxSize& size, int blockId, byte flags);
void DrawImage();
+ void PutPixel(int x, int y, int red, int green, int blue);
+ void UpdateImage();
protected:
+ wxStaticBitmap *_sbmp;
+ wxImage *_image;
+ int _blockId;
+ int _boxesDisplayed;
+
void OnQuit(wxCommandEvent& event);
void SaveImage(wxEvent& event);
@@ -131,7 +136,7 @@
class GUI_wxWindows : public wxApp {
private:
MainWindow *_mainWindow;
- ImageWindow *_imageWindow;
+ ImageWindow *_imageWindow[10];
public:
GUI_wxWindows();
@@ -140,13 +145,13 @@
void EnableToolbarTool(int tool);
void DisableToolbarTool(int tool);
void AppendText(char *text);
- void DrawImage();
- void UpdateImage();
+ void DrawImage(int imgWindowId);
+ void UpdateImage(int imgWindowId);
void DisplayHelp();
void SetTitle(char *title);
void DisplayViewer(char *title, int width, int height, char *text);
- void PutPixel(int x, int y, int red, int green, int blue);
- void DisplayImage(char* title, int width, int height, byte flags = FLAG_NONE);
+ void PutPixel(int imgWindowId, int x, int y, int red, int green, int blue);
+ int DisplayImage(char* title, int width, int height, int blockID, byte flags = FLAG_NONE);
void DisplayDialog(char *message, char *title);
virtual bool OnInit();
void add_tree_elements(char *itemName, int blockid, int level, int type);
More information about the Scummvm-git-logs
mailing list