[Scummvm-cvs-logs] CVS: scummex Makefile,1.1.1.1,1.2 scummex.cpp,1.4,1.5 scummex.h,1.2,1.3 wxwindows.cpp,1.3,1.4

Max Horn fingolfin at users.sourceforge.net
Fri Sep 19 13:45:57 CEST 2003


Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv14412

Modified Files:
	Makefile scummex.cpp scummex.h wxwindows.cpp 
Log Message:
some cleanup (boy this code is indeed dirty, Yosh told us the truth :-). Now at least starts up on OS X, also it complains about a missing MBAR resource

Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummex/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile	18 Sep 2003 16:26:53 -0000	1.1.1.1
+++ Makefile	19 Sep 2003 01:36:40 -0000	1.2
@@ -1,7 +1,7 @@
 CC=g++
 RESSW=--define __WIN32__ --define __WIN95__ --define __GNUWIN32__
 OBJECTS=file.o scummex.o resource.o mixer.o image.o sound.o wxwindows.o descumm.o
-CFLAGS=-DOSUNIX -O -Wall -Wstrict-prototypes -Wuninitialized -Wno-unused-variable -Wno-long-long -Wno-multichar -Wno-unknown-pragmas `wx-config --cxxflags` `sdl-config --cflags`
+CFLAGS=-DOSUNIX -g -Wall -Wstrict-prototypes -Wuninitialized -Wno-unused-variable -Wno-long-long -Wno-multichar -Wno-unknown-pragmas `wx-config --cxxflags` `sdl-config --cflags`
 LIBS=`wx-config --libs` `sdl-config --libs` -lSDL_mixer
 
 .SUFFIXES: .o .cpp

Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- scummex.cpp	18 Sep 2003 22:13:12 -0000	1.4
+++ scummex.cpp	19 Sep 2003 01:36:40 -0000	1.5
@@ -25,11 +25,6 @@
 #include "scummex.h"
 #include "descumm.h"
 
-File _input;
-File _output;
-uint32 tag;
-uint32 block_id;
-
 struct RoomTable _roomTable[200];
 
 struct BlockTable _blockTable[60000];

Index: scummex.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scummex.h	18 Sep 2003 19:37:14 -0000	1.2
+++ scummex.h	19 Sep 2003 01:36:40 -0000	1.3
@@ -38,6 +38,11 @@
 	GUI_wxWindows *_gui;
 
 public:
+	File _input;
+	File _output;
+	uint32 tag;
+	uint32 block_id;
+	
 
 	ScummEX();
 	void fileView();

Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- wxwindows.cpp	18 Sep 2003 20:50:56 -0000	1.3
+++ wxwindows.cpp	19 Sep 2003 01:36:40 -0000	1.4
@@ -25,9 +25,10 @@
 #include "scummex.h"
 #include "icons.h"
 
-wxTreeItemId iter0, iter1, iter2, iter3, iter4, iter5, iter6, iter7, iter8, itemid;
+wxTreeItemId iter[9], itemid;
 wxTreeCtrl *tree;
-wxStaticText *TypeLabel, *OffsetLabel, *SizeLabel, *DescriptionLabel, *SpecLabel1, *SpecLabel2, *SpecLabel3, *SpecLabel4, *SpecLabel5, *SpecLabel6;
+wxStaticText *TypeLabel, *OffsetLabel, *SizeLabel, *DescriptionLabel;
+wxStaticText *SpecLabel[6];
 wxButton *SpecButton1, *SpecButton2;
 MainWindow *frame;
 ImageWindow *imageFrame;
@@ -319,31 +320,8 @@
 
 void GUI_wxWindows::add_tree_elements(char *itemName, int blockid, int level, int type) {
 
-	if (level == 1) {
-		itemid = iter1 = tree->AppendItem(iter0, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-
-	if (level == 2) {
-		itemid = iter2 = tree->AppendItem(iter1, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 3) {
-		itemid = iter3 = tree->AppendItem(iter2, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 4) {
-		itemid = iter4 = tree->AppendItem(iter3, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 5) {
-		itemid = iter5 = tree->AppendItem(iter4, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 6) {
-		itemid = iter6 = tree->AppendItem(iter5, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 7) {
-		itemid = iter7 = tree->AppendItem(iter6, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
-	if (level == 8) {
-		itemid = iter8 = tree->AppendItem(iter7, itemName, -1, -1, new TreeItemData(blockid, type));
-	}
+	assert(level <= 8);
+	itemid = iter[level] = tree->AppendItem(iter[level-1], itemName, -1, -1, new TreeItemData(blockid, type));
 
 	if (blocksInfo[type].iconid != 0) {
 		tree->SetItemImage(itemid, blocksInfo[type].iconid);
@@ -378,27 +356,27 @@
 	}
 	if (strstr(label, "SpecLabel1")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel1->SetLabel(buf);
+		SpecLabel[0]->SetLabel(buf);
 	}
 	if (strstr(label, "SpecLabel2")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel2->SetLabel(buf);
+		SpecLabel[1]->SetLabel(buf);
 	}
 	if (strstr(label, "SpecLabel3")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel3->SetLabel(buf);
+		SpecLabel[2]->SetLabel(buf);
 	}
 	if (strstr(label, "SpecLabel4")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel4->SetLabel(buf);
+		SpecLabel[3]->SetLabel(buf);
 	}
 	if (strstr(label, "SpecLabel5")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel5->SetLabel(buf);
+		SpecLabel[4]->SetLabel(buf);
 	}
 	if (strstr(label, "SpecLabel6")) {
 		sprintf(buf, "%s:    \t\t %d", title, text);
-		SpecLabel6->SetLabel(buf);
+		SpecLabel[5]->SetLabel(buf);
 	}
 
 }
@@ -556,7 +534,7 @@
 			4
 			);
 
-	iter0 = tree->AddRoot("", -1, -1, NULL);
+	iter[0] = tree->AddRoot("", -1, -1, NULL);
 	
 	wxBoxSizer *InfosSizer = new wxBoxSizer( wxVERTICAL );
 
@@ -656,43 +634,20 @@
 			0
 			);
 	
-	SpecLabel1 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel1");
-	SpecLabel2 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel2");
-	SpecLabel3 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel3");
-	SpecLabel4 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel4");
-	SpecLabel5 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel5");
-	SpecLabel6 = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel6");
+	SpecLabel[0] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel1");
+	SpecLabel[1] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel2");
+	SpecLabel[2] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel3");
+	SpecLabel[3] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel4");
+	SpecLabel[4] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel5");
+	SpecLabel[5] = new wxStaticText(infospanel, -1, "", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE, "SpecLabel6");
 	
-	SpecInfosSizer->Add(SpecLabel1,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
-	SpecInfosSizer->Add(SpecLabel2,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
-	SpecInfosSizer->Add(SpecLabel3,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
-	SpecInfosSizer->Add(SpecLabel4,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
-	SpecInfosSizer->Add(SpecLabel5,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
-	SpecInfosSizer->Add(SpecLabel6,
-			0,
-			wxALL|wxEXPAND,
-			1
-			);
+	for (int i = 0; i < 6; i++) {
+		SpecInfosSizer->Add(SpecLabel[i],
+				0,
+				wxALL|wxEXPAND,
+				1
+				);
+	}
 
 	HtmlHelp = new wxHtmlHelpController(wxHF_DEFAULT_STYLE & wxHF_CONTENTS);
 
@@ -820,7 +775,7 @@
         wxOPEN);
 	if (dialog->ShowModal() == wxID_OK) {
 		file = (const char*)dialog->GetPath();
-		tree->DeleteChildren(iter0);
+		tree->DeleteChildren(iter[0]);
 		_scummex->getFileType(file);
 	}
 }
@@ -831,12 +786,8 @@
 	itemid = event.GetItem();
 	TreeItemData *item = (TreeItemData *)tree->GetItemData(itemid);
 
-	SpecLabel1->SetLabel("");
-	SpecLabel2->SetLabel("");
-	SpecLabel3->SetLabel("");
-	SpecLabel4->SetLabel("");
-	SpecLabel5->SetLabel("");
-	SpecLabel6->SetLabel("");
+	for (int i = 0; i < 6; i++)
+		SpecLabel[i]->SetLabel("");
 	SpecButton1->Show(FALSE);
 	SpecButton2->Show(FALSE);
 	ToolBar->EnableTool(ID_Dump, TRUE);





More information about the Scummvm-git-logs mailing list