mirror of
https://github.com/scummvm/scummex.git
synced 2026-05-21 05:40:51 +00:00
cleanup, cleanup, and lots of bug fixes (like, those _gui variables were never inited... nobody noticed because the class had no member vars... still this was pure evil.. and it would be really nice if there was some design work behind the whole thing (like GUI_wxWindows vs. MainWindow, which have no clear distribution of responsibilities - both act upon the same (global!) data. Evil. Using the MVC model would be nice)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/descumm.h,v 1.2 2003/09/19 19:57:07 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/descumm.h,v 1.3 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -113,8 +113,6 @@ struct StackEnt {
|
||||
|
||||
class DeScumm {
|
||||
private:
|
||||
GUI_wxWindows *_gui;
|
||||
|
||||
char *strecpy(char *buf, const char *src);
|
||||
int get_curoffs();
|
||||
int get_byte();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.cpp,v 1.10 2003/09/22 21:31:18 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.cpp,v 1.11 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -109,16 +109,16 @@ void Image::drawLine(int xStart, int yStart, int xEnd, int yEnd, int red, int gr
|
||||
int Image::drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow) {
|
||||
int nBox, RMHDindex, width, height, v8 = 0;
|
||||
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", "-1");
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
|
||||
width = _blockTable[RMHDindex].width;
|
||||
height = _blockTable[RMHDindex].height;
|
||||
|
||||
if (newWindow == 0) {
|
||||
if ( _resource->findBlock(0, _blockTable, id, "IMAG", "-1") != -1) {
|
||||
if ( _resource->findBlock(0, _blockTable, id, "IMAG", NULL) != -1) {
|
||||
v8 = 1;
|
||||
id = _resource->findBlock(1, _blockTable, id, "BOXD", "-1");
|
||||
id = _resource->findBlock(1, _blockTable, id, "BOXD", NULL);
|
||||
} else {
|
||||
id = _resource->findBlock(0, _blockTable, id, "BOXD", "-1");
|
||||
id = _resource->findBlock(0, _blockTable, id, "BOXD", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ int Image::drawSmushFrame(BlockTable *_blockTable, int id, File& _input) {
|
||||
int x = 0, y = 0;
|
||||
byte *dst, *dstorg, *chunk_buffer;
|
||||
|
||||
index = _resource->findBlock(0, _blockTable, id, "NPAL", "AHDR", "-1");
|
||||
index = _resource->findBlock(0, _blockTable, id, "NPAL", "AHDR", NULL);
|
||||
if (_blockTable[index].blockTypeID == AHDR) {
|
||||
_input.seek(_blockTable[index].offset + 14, SEEK_SET);
|
||||
} else {
|
||||
@@ -236,11 +236,11 @@ int Image::drawBG(File& _input, BlockTable *_blockTable, int id)
|
||||
int RMHDindex, CLUTindex, SMAPindex, TRNSindex;
|
||||
|
||||
if (_blockTable[id].blockTypeID == BM) {
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "HD", "-1");
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "HD", NULL);
|
||||
} else if (_blockTable[id-1].blockTypeID == IMHD) {
|
||||
RMHDindex = id-1;
|
||||
} else {
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", "-1");
|
||||
RMHDindex = _resource->findBlock(0, _blockTable, id, "RMHD", NULL);
|
||||
}
|
||||
_width = _blockTable[RMHDindex].width;
|
||||
_height = _blockTable[RMHDindex].height;
|
||||
@@ -248,13 +248,13 @@ int Image::drawBG(File& _input, BlockTable *_blockTable, int id)
|
||||
_gui->DisplayImage("Room Image", _width, _height, IMAGE_BOXES);
|
||||
|
||||
if (_blockTable[id].blockTypeID != BM) {
|
||||
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", "-1");
|
||||
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
|
||||
_transp = _blockTable[TRNSindex].trans;
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", "-1");
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
|
||||
_input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
|
||||
} else {
|
||||
_transp = 260;
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "PA", "-1");
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "PA", NULL);
|
||||
_input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
|
||||
}
|
||||
|
||||
@@ -265,13 +265,13 @@ int Image::drawBG(File& _input, BlockTable *_blockTable, int id)
|
||||
}
|
||||
|
||||
if (_blockTable[id].blockTypeID != BM) {
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", "-1");
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
|
||||
} else {
|
||||
SMAPindex = id;
|
||||
}
|
||||
|
||||
if (_blockTable[id].blockTypeID == IMAG) {
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, SMAPindex, "OFFS", "-1");
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, SMAPindex, "OFFS", NULL);
|
||||
}
|
||||
|
||||
_offsets = new uint32[_width/8];
|
||||
@@ -301,18 +301,18 @@ int Image::drawObject(File& _input, BlockTable *_blockTable, int id)
|
||||
{
|
||||
int RMHDindex, CLUTindex, SMAPindex, TRNSindex;
|
||||
|
||||
RMHDindex = _resource->findBlock(1, _blockTable, id, "IMHD", "-1");
|
||||
RMHDindex = _resource->findBlock(1, _blockTable, id, "IMHD", NULL);
|
||||
|
||||
_width = _blockTable[RMHDindex].width;
|
||||
_height = _blockTable[RMHDindex].height;
|
||||
|
||||
_gui->DisplayImage("Object", _width, _height);
|
||||
|
||||
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", "-1");
|
||||
TRNSindex = _resource->findBlock(0, _blockTable, id, "TRNS", NULL);
|
||||
|
||||
_transp = _blockTable[TRNSindex].trans;
|
||||
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", "-1");
|
||||
CLUTindex = _resource->findBlock(0, _blockTable, id, "CLUT", "APAL", "NPAL", NULL);
|
||||
|
||||
_input.seek(_blockTable[CLUTindex].offset + 8, SEEK_SET);
|
||||
|
||||
@@ -322,7 +322,7 @@ int Image::drawObject(File& _input, BlockTable *_blockTable, int id)
|
||||
_rgbTable[j].blue = _input.readByte(); // blue
|
||||
}
|
||||
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", "-1");
|
||||
SMAPindex = _resource->findBlock(1, _blockTable, id, "SMAP", NULL);
|
||||
|
||||
_offsets = new uint32[_width/8];
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.h,v 1.7 2003/09/22 18:25:16 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.h,v 1.8 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -49,7 +49,6 @@ private:
|
||||
int _width;
|
||||
int _height;
|
||||
Resource *_resource;
|
||||
GUI_wxWindows *_gui;
|
||||
Codec37Decoder _codec37;
|
||||
Codec47Decoder _codec47;
|
||||
|
||||
|
||||
+7
-5
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.14 2003/09/22 19:47:58 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.15 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -877,13 +877,13 @@ int Resource::findBlock(int direction, BlockTable * _blockTable, int id, ...)
|
||||
|
||||
va_start(arg_ptr, id);
|
||||
|
||||
while (strcmp(test = (va_arg(arg_ptr, char *)) , "-1")) {
|
||||
while ((test = (va_arg(arg_ptr, char *)))) {
|
||||
id = tempid;
|
||||
if (direction == 0) {
|
||||
id -= 1;
|
||||
while (id >= 0) {
|
||||
if(strstr(test, _blockTable[id].blockName)) {
|
||||
return id;
|
||||
goto the_end;
|
||||
}
|
||||
id--;
|
||||
}
|
||||
@@ -891,16 +891,18 @@ int Resource::findBlock(int direction, BlockTable * _blockTable, int id, ...)
|
||||
|
||||
if (direction == 1) {
|
||||
id += 1;
|
||||
// FIXME: Loop till infinity?? that can hardly be correct
|
||||
while (1) {
|
||||
if(strstr(test, _blockTable[id].blockName)) {
|
||||
return id;
|
||||
goto the_end;
|
||||
}
|
||||
id++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
the_end:
|
||||
va_end(arg_ptr);
|
||||
return -1;
|
||||
return test ? id : -1;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.h,v 1.7 2003/09/22 19:47:58 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.h,v 1.8 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -210,7 +210,6 @@ const struct blockInfo oldBlocksInfo[] = {
|
||||
|
||||
class Resource {
|
||||
private:
|
||||
GUI_wxWindows *_gui;
|
||||
int stopflag;
|
||||
public:
|
||||
Resource();
|
||||
|
||||
+13
-13
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.18 2003/09/22 23:43:29 fingolfin Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.19 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#include "descumm.h"
|
||||
|
||||
ScummEX::ScummEX() {
|
||||
_image = new Image();
|
||||
_sound = new Sound();
|
||||
_resource = new Resource();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_sound = new Sound();
|
||||
_resource = new Resource();
|
||||
}
|
||||
|
||||
void ScummEX::getFileType(const char *filename) {
|
||||
@@ -45,7 +45,7 @@ void ScummEX::getFileType(const char *filename) {
|
||||
sprintf(buf, "ScummEX - %s", filename);
|
||||
_gui->SetTitle(buf);
|
||||
|
||||
_gui->EnableToolbarTool(ID_Close);
|
||||
_gui->EnableToolbarTool(wxID_CLOSE);
|
||||
_gui->EnableToolbarTool(ID_FileInfo);
|
||||
|
||||
_input.read(&tag, 4);
|
||||
@@ -104,7 +104,7 @@ void ScummEX::getFileType(const char *filename) {
|
||||
}
|
||||
|
||||
_gui->SetTitle("ScummEX");
|
||||
_gui->DisableToolbarTool(ID_Close);
|
||||
_gui->DisableToolbarTool(wxID_CLOSE);
|
||||
_gui->DisableToolbarTool(ID_FileInfo);
|
||||
_gui->DisplayDialog("Unknown file type!", "Error");
|
||||
}
|
||||
@@ -257,37 +257,37 @@ void ScummEX::SOUPlay()
|
||||
|
||||
void ScummEX::paletteDraw()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawPalette(_blockTable, _blockId, _input);
|
||||
}
|
||||
|
||||
void ScummEX::bgDraw()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawBG(_input, _blockTable, _blockId);
|
||||
}
|
||||
|
||||
void ScummEX::SmushFrameDraw()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawSmushFrame(_blockTable, _blockId, _input);
|
||||
}
|
||||
|
||||
void ScummEX::objectDraw()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawObject(_input, _blockTable, _blockId);
|
||||
}
|
||||
|
||||
void ScummEX::boxesDraw()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawBoxes(_blockTable, _blockId, _input);
|
||||
}
|
||||
|
||||
void ScummEX::boxesDrawOverlay()
|
||||
{
|
||||
_image = new Image();
|
||||
_image = new Image(); // FIXME - where is this deleted?
|
||||
_image->drawBoxes(_blockTable, _blockId, _input, 0);
|
||||
}
|
||||
|
||||
@@ -411,6 +411,6 @@ void ScummEX::UpdateInfosFromTree(int blockid) {
|
||||
ScummEX *_scummex;
|
||||
_scummex = new ScummEX();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
}*/
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.h,v 1.10 2003/09/22 23:43:29 fingolfin Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.h,v 1.11 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,6 @@ private:
|
||||
Image *_image;
|
||||
Sound *_sound;
|
||||
Resource *_resource;
|
||||
GUI_wxWindows *_gui;
|
||||
|
||||
public:
|
||||
int _scummVersion;
|
||||
|
||||
+1
-14
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummsys.h,v 1.1 2003/09/18 16:26:58 fingolfin Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummsys.h,v 1.2 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
#ifndef SCUMMSYS_H
|
||||
@@ -285,17 +285,4 @@ FORCEINLINE uint16 SWAP_BYTES_16(uint16 a) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialized operator new */
|
||||
// FIXME - get rid of these new/delete overrides!!! They conflict with the
|
||||
// Standard C++ library, and they are only there to support lazy programmers anyway.
|
||||
#ifndef __PALM_OS__
|
||||
void * operator new(size_t size);
|
||||
void operator delete(void *ptr);
|
||||
// Temporary hack until we fully remove the new/delete operators:
|
||||
// Since 'new' now returns a memory block inited to 0xE7E7E7E7 we might
|
||||
// get some invocations of free() with that param. We check for those here.
|
||||
// That allows us to set a debugger breakpoint to catch it.
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/Attic/sound.h,v 1.3 2003/09/21 00:45:16 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/Attic/sound.h,v 1.4 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,6 @@ class Sound {
|
||||
private:
|
||||
Mixer *_mixer;
|
||||
Resource *_resource;
|
||||
GUI_wxWindows *_gui;
|
||||
|
||||
static int32 Sound::compDecode(byte * src, byte * dst);
|
||||
|
||||
|
||||
+95
-86
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.14 2003/09/22 19:47:59 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.15 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -25,56 +25,61 @@
|
||||
#include "scummex.h"
|
||||
#include "icons.h"
|
||||
|
||||
wxTreeItemId iter[11], itemid;
|
||||
wxTreeCtrl *tree;
|
||||
wxTreeItemId iter[11];
|
||||
wxTreeCtrl *tree = 0;
|
||||
wxStaticText *TypeLabel, *OffsetLabel, *SizeLabel, *DescriptionLabel;
|
||||
wxStaticText *SpecLabel[6];
|
||||
wxButton *SpecButton1, *SpecButton2;
|
||||
MainWindow *frame;
|
||||
ImageWindow *imageFrame;
|
||||
ScummEX *_scummex;
|
||||
wxImage *image;
|
||||
const char *file, *filename;
|
||||
wxTextCtrl *hexdata;
|
||||
wxToolBar *ToolBar;
|
||||
wxButton *SpecButton1 = 0, *SpecButton2 = 0;
|
||||
ScummEX *_scummex = 0;
|
||||
wxImage *image = 0;
|
||||
const char *g_filename = 0;
|
||||
wxTextCtrl *hexdata = 0;
|
||||
wxToolBar *ToolBar = 0;
|
||||
|
||||
GUI_wxWindows *_gui = 0;
|
||||
|
||||
|
||||
IMPLEMENT_APP(GUI_wxWindows)
|
||||
|
||||
GUI_wxWindows::GUI_wxWindows() {
|
||||
GUI_wxWindows::GUI_wxWindows()
|
||||
: _mainWindow(0), _imageWindow(0) {
|
||||
_scummex = new ScummEX();
|
||||
_gui = this; // FIXME - ugly quick workaround for previously broken code
|
||||
}
|
||||
|
||||
bool GUI_wxWindows::OnInit()
|
||||
{
|
||||
frame = new MainWindow("ScummEX", wxPoint(-1,-1),
|
||||
printf("GUI_wxWindows::OnInit\n");
|
||||
_mainWindow = new MainWindow("ScummEX", wxPoint(-1,-1),
|
||||
wxSize(640,480));
|
||||
|
||||
frame->Connect( ID_Quit, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &MainWindow::OnQuit );
|
||||
frame->Connect( ID_About, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &MainWindow::OnAbout );
|
||||
frame->Connect( ID_Open, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( wxID_OPEN, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &MainWindow::OnOpen );
|
||||
frame->Connect( ID_Browse, wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
_mainWindow->Connect( ID_Browse, wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
(wxObjectEventFunction) &MainWindow::OnOpen );
|
||||
frame->Connect( ID_View, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( ID_View, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &ScummEX::fileView );
|
||||
frame->Connect( ID_Dump, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( ID_Dump, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &GUI_wxWindows::BlockDump );
|
||||
frame->Connect( Tree, wxEVT_COMMAND_TREE_SEL_CHANGING,
|
||||
_mainWindow->Connect( Tree, wxEVT_COMMAND_TREE_SEL_CHANGING,
|
||||
(wxObjectEventFunction) &MainWindow::OnSelChanged );
|
||||
frame->Connect( ID_Help, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( wxID_HELP, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &MainWindow::OnHelp );
|
||||
frame->Connect( ID_FileInfo, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_mainWindow->Connect( ID_FileInfo, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &ScummEX::FileInfo );
|
||||
|
||||
frame->Show(TRUE);
|
||||
SetTopWindow(frame);
|
||||
_mainWindow->Show(TRUE);
|
||||
SetTopWindow(_mainWindow);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void GUI_wxWindows::SetTitle(char *title) {
|
||||
frame->SetTitle(title);
|
||||
printf("GUI_wxWindows::SetTitle(%s)\n", title);
|
||||
_mainWindow->SetTitle(title);
|
||||
}
|
||||
|
||||
void MainWindow::OnHelp(wxCommandEvent& WXUNUSED(event)) {
|
||||
@@ -108,7 +113,7 @@ int GUI_wxWindows::getScummVersionDialog() {
|
||||
"The Curse of Monkey Island"
|
||||
};
|
||||
|
||||
wxSingleChoiceDialog *dialog = new wxSingleChoiceDialog(frame, "Please select the correct game", "Scumm version selection", 22, games, NULL, wxOK|wxCANCEL|wxCENTRE, wxDefaultPosition);
|
||||
wxSingleChoiceDialog *dialog = new wxSingleChoiceDialog(_mainWindow, "Please select the correct game", "Scumm version selection", 22, games, NULL, wxOK|wxCANCEL|wxCENTRE, wxDefaultPosition);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
choice = dialog->GetSelection();
|
||||
switch (choice) {
|
||||
@@ -151,7 +156,7 @@ void GUI_wxWindows::FileInfoDialog(int size, int encbyte) {
|
||||
char msg[512];
|
||||
const char *fname;
|
||||
const char *fpath;
|
||||
wxFileName *filename = new wxFileName(file);
|
||||
wxFileName *filename = new wxFileName(g_filename);
|
||||
|
||||
fname = filename->GetFullName();
|
||||
fpath = filename->GetFullPath();
|
||||
@@ -162,40 +167,40 @@ void GUI_wxWindows::FileInfoDialog(int size, int encbyte) {
|
||||
strcat(msg, buf);
|
||||
sprintf(buf, "XOR byte: \t %d (0x%02X)\n", encbyte, encbyte);
|
||||
strcat(msg, buf);
|
||||
wxMessageBox(msg, "File Info", wxOK, frame);
|
||||
wxMessageBox(msg, "File Info", wxOK, _mainWindow);
|
||||
}
|
||||
|
||||
void GUI_wxWindows::BlockDump() {
|
||||
wxFileDialog *dialog = new wxFileDialog(frame, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
wxFileDialog *dialog = new wxFileDialog(_mainWindow, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
filename = (const char*)dialog->GetPath();
|
||||
const char *filename = (const char*)dialog->GetPath();
|
||||
_scummex->FileDump(filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GUI_wxWindows::SaveSOU() {
|
||||
wxFileDialog *dialog = new wxFileDialog(frame, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
wxFileDialog *dialog = new wxFileDialog(_mainWindow, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
filename = (const char*)dialog->GetPath();
|
||||
const char *filename = (const char*)dialog->GetPath();
|
||||
_scummex->iMUSEDump(filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GUI_wxWindows::SaveiMUSE() {
|
||||
wxFileDialog *dialog = new wxFileDialog(frame, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
wxFileDialog *dialog = new wxFileDialog(_mainWindow, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
filename = (const char*)dialog->GetPath();
|
||||
const char *filename = (const char*)dialog->GetPath();
|
||||
_scummex->iMUSEDump(filename);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GUI_wxWindows::PutPixel(int x, int y, int red, int green, int blue) {
|
||||
@@ -203,40 +208,40 @@ void GUI_wxWindows::PutPixel(int x, int y, int red, int green, int blue) {
|
||||
}
|
||||
|
||||
void GUI_wxWindows::SaveImage() {
|
||||
wxFileDialog *dialog = new wxFileDialog(imageFrame, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
wxFileDialog *dialog = new wxFileDialog(_imageWindow, "Please select an output file.", "", "",
|
||||
"*",
|
||||
wxSAVE);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
filename = (const char*)dialog->GetPath();
|
||||
const char *filename = (const char*)dialog->GetPath();
|
||||
image->SaveFile(filename, wxBITMAP_TYPE_BMP);
|
||||
}
|
||||
}
|
||||
|
||||
void GUI_wxWindows::DisplayImage(char* title, int width, int height, byte flags) {
|
||||
imageFrame = new ImageWindow(title, wxPoint(-1,-1), wxSize(width, height), flags);
|
||||
_imageWindow = new ImageWindow(_mainWindow, title, wxPoint(-1,-1), wxSize(width, height), flags);
|
||||
|
||||
imageFrame->Connect( Viewer_Quit, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_imageWindow->Connect( Viewer_Quit, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &ImageWindow::OnQuit );
|
||||
imageFrame->Connect( ID_BMP, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_imageWindow->Connect( ID_BMP, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &GUI_wxWindows::SaveImage );
|
||||
imageFrame->Connect( ID_Boxes, wxEVT_COMMAND_MENU_SELECTED,
|
||||
_imageWindow->Connect( ID_Boxes, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &ScummEX::boxesDrawOverlay );
|
||||
imageFrame->Connect( ID_ImageWindow, wxEVT_CLOSE_WINDOW,
|
||||
_imageWindow->Connect( ID_ImageWindow, wxEVT_CLOSE_WINDOW,
|
||||
(wxObjectEventFunction) &ImageWindow::OnQuit );
|
||||
}
|
||||
|
||||
void GUI_wxWindows::DrawImage() {
|
||||
imageFrame->DrawImage();
|
||||
_imageWindow->DrawImage();
|
||||
}
|
||||
|
||||
void GUI_wxWindows::UpdateImage() {
|
||||
wxBitmap bitmap = wxBitmap(image);
|
||||
imageFrame->_sbmp->SetBitmap(bitmap);
|
||||
imageFrame->Refresh();
|
||||
_imageWindow->_sbmp->SetBitmap(bitmap);
|
||||
_imageWindow->Refresh();
|
||||
}
|
||||
|
||||
ImageWindow::ImageWindow(const wxString& title, const wxPoint& pos, const wxSize& size, byte flags)
|
||||
: wxFrame(frame,ID_ImageWindow,title,pos,size, wxDEFAULT_FRAME_STYLE & (wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION))
|
||||
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))
|
||||
{
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
@@ -282,7 +287,7 @@ void ImageWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void GUI_wxWindows::DisplayViewer(char *title, int width, int height, char *text) {
|
||||
|
||||
ViewerWindow *viewerFrame = new ViewerWindow(title, text, wxPoint(50,50), wxSize(width, height));
|
||||
ViewerWindow *viewerFrame = new ViewerWindow(_mainWindow, title, text, wxPoint(50,50), wxSize(width, height));
|
||||
|
||||
viewerFrame->Connect( Viewer_Quit, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &ViewerWindow::OnQuit );
|
||||
@@ -294,8 +299,8 @@ void GUI_wxWindows::AppendText(char *text) {
|
||||
hexdata->AppendText(text);
|
||||
}
|
||||
|
||||
ViewerWindow::ViewerWindow(const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame(frame, ID_ViewerWindow, title, pos, size)
|
||||
ViewerWindow::ViewerWindow(MainWindow *parent, const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame(parent, ID_ViewerWindow, title, pos, size)
|
||||
{
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
@@ -320,7 +325,7 @@ void ViewerWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
}
|
||||
|
||||
void GUI_wxWindows::DisplayDialog(char *message, char *title) {
|
||||
wxMessageBox(message, title, wxOK, frame);
|
||||
wxMessageBox(message, title, wxOK, _mainWindow);
|
||||
}
|
||||
|
||||
void GUI_wxWindows::EnableToolbarTool(int tool) {
|
||||
@@ -421,15 +426,16 @@ void GUI_wxWindows::SetButton(int blocktype) {
|
||||
|
||||
void GUI_wxWindows::add_tree_elements(char *itemName, int blockid, int level, int type) {
|
||||
|
||||
wxTreeItemId itemid;
|
||||
assert(level <= 10);
|
||||
itemid = iter[level] = tree->AppendItem(iter[level-1], itemName, -1, -1, new TreeItemData(blockid, type));
|
||||
|
||||
if (type < 200) {
|
||||
tree->SetItemImage(itemid, blocksInfo[type].iconid);
|
||||
tree->SetItemImage(itemid, blocksInfo[type].iconid, wxTreeItemIcon_Selected);
|
||||
tree->SetItemImage(itemid, blocksInfo[type].iconid);
|
||||
tree->SetItemImage(itemid, blocksInfo[type].iconid, wxTreeItemIcon_Selected);
|
||||
} else {
|
||||
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid);
|
||||
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid, wxTreeItemIcon_Selected);
|
||||
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid);
|
||||
tree->SetItemImage(itemid, oldBlocksInfo[type-200].iconid, wxTreeItemIcon_Selected);
|
||||
}
|
||||
|
||||
if (blockid == 1) {
|
||||
@@ -499,13 +505,13 @@ MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize&
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
wxMenu *menuFile = new wxMenu;
|
||||
|
||||
wxMenuItem *OpenItem = new wxMenuItem(menuFile, ID_Open, "Open", "Open resource file", wxITEM_NORMAL, NULL );
|
||||
wxMenuItem *OpenItem = new wxMenuItem(menuFile, wxID_OPEN, "Open...", "Open resource file", wxITEM_NORMAL, NULL );
|
||||
OpenItem->SetBitmap(OpenIcon);
|
||||
menuFile->Append(OpenItem);
|
||||
|
||||
menuFile->AppendSeparator();
|
||||
|
||||
wxMenuItem *QuitItem = new wxMenuItem(menuFile, ID_Quit, "Exit", "Exit ScummEX", wxITEM_NORMAL, NULL );
|
||||
wxMenuItem *QuitItem = new wxMenuItem(menuFile, wxID_EXIT, "Exit", "Exit ScummEX", wxITEM_NORMAL, NULL );
|
||||
QuitItem->SetBitmap(ExitIcon);
|
||||
menuFile->Append(QuitItem);
|
||||
|
||||
@@ -519,8 +525,8 @@ MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize&
|
||||
menuBar->Append(menuTools, "&Tools");
|
||||
|
||||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append(ID_Help, "Contents");
|
||||
menuHelp->Append(ID_About,"About...");
|
||||
menuHelp->Append(wxID_HELP, "Contents");
|
||||
menuHelp->Append(wxID_ABOUT,"About...");
|
||||
menuBar->Append(menuHelp, "&Help");
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
@@ -531,21 +537,21 @@ MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize&
|
||||
|
||||
ToolBar->SetToolBitmapSize(wxSize(16, 16));
|
||||
|
||||
ToolBar->AddTool(ID_Open, "Open", OpenIcon, wxNullBitmap, wxITEM_NORMAL, "Open", "Open resource file", NULL);
|
||||
ToolBar->AddTool(ID_Close, "Close", CloseIcon, wxNullBitmap, wxITEM_NORMAL, "Close", "Close resource file", NULL);
|
||||
ToolBar->EnableTool(ID_Close, FALSE);
|
||||
ToolBar->AddTool(wxID_OPEN, "Open...", OpenIcon, wxNullBitmap, wxITEM_NORMAL, "Open...", "Open resource file", NULL);
|
||||
ToolBar->AddTool(wxID_CLOSE, "Close", CloseIcon, wxNullBitmap, wxITEM_NORMAL, "Close", "Close resource file", NULL);
|
||||
ToolBar->EnableTool(wxID_CLOSE, FALSE);
|
||||
ToolBar->AddTool(ID_FileInfo, "File Info", FileIcon, wxNullBitmap, wxITEM_NORMAL, "File Info", "Show File Info", NULL);
|
||||
ToolBar->EnableTool(ID_FileInfo, FALSE);
|
||||
ToolBar->AddTool(ID_Quit, "Exit", ExitIcon, wxNullBitmap, wxITEM_NORMAL, "Exit", "Exit ScummEX", NULL);
|
||||
ToolBar->AddTool(wxID_EXIT, "Exit", ExitIcon, wxNullBitmap, wxITEM_NORMAL, "Exit", "Exit ScummEX", NULL);
|
||||
ToolBar->AddSeparator();
|
||||
ToolBar->AddTool(ID_Dump, "File Dump", SaveIcon, wxNullBitmap, wxITEM_NORMAL, "File Dump", "Dump block to disk", NULL);
|
||||
ToolBar->EnableTool(ID_Dump, FALSE);
|
||||
ToolBar->AddTool(ID_View, "Hex Viewer", HexIcon, wxNullBitmap, wxITEM_NORMAL, "Hex Viewer", "View block as hex", NULL);
|
||||
ToolBar->AddTool(ID_View, "Hex Viewer...", HexIcon, wxNullBitmap, wxITEM_NORMAL, "Hex Viewer...", "View block as hex", NULL);
|
||||
ToolBar->EnableTool(ID_View, FALSE);
|
||||
ToolBar->AddTool(Button_Options, "Options", OptionsIcon, wxNullBitmap, wxITEM_NORMAL, "Options", "Options", NULL);
|
||||
ToolBar->AddTool(Button_Options, "Options...", OptionsIcon, wxNullBitmap, wxITEM_NORMAL, "Options...", "Options", NULL);
|
||||
ToolBar->EnableTool(Button_Options, FALSE);
|
||||
ToolBar->AddSeparator();
|
||||
ToolBar->AddTool(ID_Help, "Help", HelpIcon, wxNullBitmap, wxITEM_NORMAL, "Help", "View help", NULL);
|
||||
ToolBar->AddTool(wxID_HELP, "Help", HelpIcon, wxNullBitmap, wxITEM_NORMAL, "Help", "View help", NULL);
|
||||
ToolBar->Realize();
|
||||
|
||||
panel = new wxPanel(this, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "panel");
|
||||
@@ -847,8 +853,8 @@ MainWindow::MainWindow(const wxString& title, const wxPoint& pos, const wxSize&
|
||||
searchpanel->SetAutoLayout( true );
|
||||
searchpanel->SetSizer( SearchPanelSizer );
|
||||
|
||||
panel->SetAutoLayout( TRUE );
|
||||
panel->SetSizer( RootSizer );
|
||||
panel->SetAutoLayout( TRUE );
|
||||
panel->SetSizer( RootSizer );
|
||||
|
||||
CreateStatusBar();
|
||||
SetStatusText("Ready.");
|
||||
@@ -871,18 +877,21 @@ void MainWindow::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
void MainWindow::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxFileDialog *dialog = new wxFileDialog(frame, "Please select an input file.", "", "",
|
||||
"All Supported Files|*|Main Resource Files|*.001;*.la1;*.la2;*.lab;*.lfl;*.lec;*.sm1|Directory Files|*.000;*.la0;*.lfl;*.sm0",
|
||||
wxOPEN);
|
||||
wxFileDialog *dialog = new wxFileDialog(this, "Please select an input file.", "", "",
|
||||
"All Supported Files|*|"
|
||||
"Main Resource Files|*.001;*.la1;*.la2;*.lab;*.lfl;*.lec;*.sm1|"
|
||||
"Directory Files|*.000;*.la0;*.lfl;*.sm0",
|
||||
wxOPEN);
|
||||
if (dialog->ShowModal() == wxID_OK) {
|
||||
file = (const char*)dialog->GetPath();
|
||||
g_filename = (const char*)dialog->GetPath();
|
||||
tree->DeleteChildren(iter[0]);
|
||||
_scummex->getFileType(file);
|
||||
_scummex->getFileType(g_filename);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnSelChanged(wxTreeEvent& event) {
|
||||
int itemid, itemtype;
|
||||
wxTreeItemId itemid;
|
||||
int itemtype;
|
||||
bool val1, val2;
|
||||
itemid = event.GetItem();
|
||||
TreeItemData *item = (TreeItemData *)tree->GetItemData(itemid);
|
||||
|
||||
+8
-8
@@ -16,7 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.h,v 1.5 2003/09/22 18:25:16 yoshizf Exp $
|
||||
* $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.h,v 1.6 2003/09/23 00:47:23 fingolfin Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -69,17 +69,19 @@ public:
|
||||
|
||||
void DrawImage();
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
ImageWindow(const wxString& title, const wxPoint& pos, const wxSize& size, byte flags);
|
||||
ImageWindow(MainWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, byte flags);
|
||||
};
|
||||
|
||||
class ViewerWindow : public wxFrame {
|
||||
public:
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
ViewerWindow(const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size);
|
||||
ViewerWindow(MainWindow *parent, const wxString& title, const wxString& text, const wxPoint& pos, const wxSize& size);
|
||||
};
|
||||
|
||||
class GUI_wxWindows : public wxApp {
|
||||
private:
|
||||
MainWindow *_mainWindow;
|
||||
ImageWindow *_imageWindow;
|
||||
|
||||
public:
|
||||
GUI_wxWindows();
|
||||
@@ -115,10 +117,7 @@ class TreeItemData : public wxTreeItemData {
|
||||
|
||||
enum
|
||||
{
|
||||
ID_Quit=1,
|
||||
ID_About,
|
||||
ID_Open,
|
||||
ID_Browse,
|
||||
ID_Browse = 1,
|
||||
ID_SoundStop,
|
||||
ID_Dump,
|
||||
ID_View,
|
||||
@@ -130,7 +129,6 @@ enum
|
||||
Button_Save,
|
||||
Button_Options,
|
||||
ID_Help,
|
||||
ID_Close,
|
||||
ID_FileInfo,
|
||||
ID_Hex,
|
||||
ID_ImageWindow,
|
||||
@@ -140,4 +138,6 @@ enum
|
||||
Tree
|
||||
};
|
||||
|
||||
extern GUI_wxWindows *_gui;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user