[Scummvm-cvs-logs] CVS: scummex wxwindows.cpp,1.23,1.24 wxwindows.h,1.11,1.12

Adrien Mercier yoshizf at users.sourceforge.net
Fri Sep 26 17:31:09 CEST 2003


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

Modified Files:
	wxwindows.cpp wxwindows.h 
Log Message:
Added functions for reading/writing a config file (or the registry under Windows). It will be used to save the data path, the scaler, etc..

Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- wxwindows.cpp	24 Sep 2003 23:04:06 -0000	1.23
+++ wxwindows.cpp	26 Sep 2003 23:47:59 -0000	1.24
@@ -38,10 +38,12 @@
 	: _mainWindow(0) {
 	g_scummex = new ScummEX();
 	_gui = this; // FIXME - ugly quick workaround for previously broken code
+	config = new wxConfig("ScummEX");
 }
 
 GUI_wxWindows::~GUI_wxWindows() {
 	delete g_scummex;
+	delete config;
 }
 
 bool GUI_wxWindows::OnInit()
@@ -141,6 +143,32 @@
 	_imageWindow[imgWindowId]->UpdateImage();
 }
 
+bool GUI_wxWindows::readConfigValue(const char* key, int* string) {
+	bool result;
+	result = config->Read(key, string);
+	return result;
+}
+
+bool GUI_wxWindows::readConfigValue(const char* key, wxString* string) {
+	bool result;
+	result = config->Read(key, string);
+	return result;
+}
+
+bool GUI_wxWindows::writeConfigValue(const char* key, int string) {
+	bool result;
+	result = config->Write(key, string);
+	config->Flush();
+	return result;
+}
+
+bool GUI_wxWindows::writeConfigValue(const char* key, wxString& string) {
+	bool result;
+	result = config->Write(key, string);
+	config->Flush();
+	return result;
+}
+
 BEGIN_EVENT_TABLE(ImageWindow, wxFrame)
 	EVT_CLOSE(ImageWindow::OnQuit)
 	EVT_MENU(Viewer_Quit, ImageWindow::OnQuit)
@@ -300,6 +328,21 @@
 			break;
 
 		case OBIM:
+		case IM01:
+		case IM02:
+		case IM03:
+		case IM04:
+		case IM05:
+		case IM06:
+		case IM07:
+		case IM08:
+		case IM09:
+		case IM0A:
+		case IM0B:
+		case IM0C:
+		case IM0D:
+		case IM0E:
+		case IM0F:
 			SpecButton1->SetLabel("View Object");
 			SpecButton1->Show(TRUE);
 			Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
@@ -484,6 +527,24 @@
 			}
 			break;
 
+		case IM01:
+		case IM02:
+		case IM03:
+		case IM04:
+		case IM05:
+		case IM06:
+		case IM07:
+		case IM08:
+		case IM09:
+		case IM0A:
+		case IM0B:
+		case IM0C:
+		case IM0D:
+		case IM0E:
+		case IM0F:
+			SetButton(block.blockTypeID);
+			break;
+
 		case IMHD:
 			updateLabel(SpecLabel[0], "Room Width", block.width);
 			updateLabel(SpecLabel[1], "Room Height", block.height);
@@ -910,6 +971,7 @@
 	SetIcon(wxICON(scummex_icon));
 	
 	SetSizeHints(640, 480);
+	_gui->readConfigValue("DataPath", &_filepath);
 }
 
 void MainWindow::OnQuit(wxCommandEvent& WXUNUSED(event))
@@ -927,7 +989,7 @@
 	HtmlHelp->DisplayContents();
 }
 
-void MainWindow::OnOpen(wxCommandEvent& WXUNUSED(event))
+void MainWindow::OnOpen(wxCommandEvent& WXUNUSED(event)) 
 {
 	wxFileDialog *dialog = new wxFileDialog(this, "Please select an input file.", _filepath, "",
 		"All Supported Files|*|"
@@ -939,6 +1001,7 @@
 		_file = wxFileName(_filename);
 	
 		_filepath = _file.GetPath();
+		_gui->writeConfigValue("DataPath", _filepath);
 		tree->DeleteChildren(iter[0]);
 		g_scummex->loadFile(_filename);
 	}
@@ -1213,6 +1276,7 @@
 		case ADL:
 		case SPK:
 		case ROL:
+		case MIDI:
 			bigIconBitmap = wxBitmap(xpm_31_big);
 			break;
 

Index: wxwindows.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- wxwindows.h	24 Sep 2003 11:49:30 -0000	1.11
+++ wxwindows.h	26 Sep 2003 23:47:59 -0000	1.12
@@ -137,6 +137,7 @@
 private:
 	MainWindow *_mainWindow;
 	ImageWindow *_imageWindow[10];
+	wxConfig *config;
 
 public:
 	GUI_wxWindows();
@@ -156,6 +157,10 @@
 	virtual bool OnInit();
 	void add_tree_elements(char *itemName, int blockid, int level, int type);
 	int getScummVersionDialog();
+	bool readConfigValue(const char* key, int* string);
+	bool readConfigValue(const char* key, wxString* string);
+	bool writeConfigValue(const char* key, int string);
+	bool writeConfigValue(const char* key, wxString& string);
 };
 
 class TreeItemData : public wxTreeItemData {





More information about the Scummvm-git-logs mailing list