[Scummvm-cvs-logs] SF.net SVN: scummvm: [20558] scummvm/trunk/backends/PalmOS/Src/forms

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Sat Feb 11 10:20:02 CET 2006


Revision: 20558
Author:   chrilith
Date:     2006-02-11 10:18:50 -0800 (Sat, 11 Feb 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm?rev=20558&view=rev

Log Message:
-----------
- Added FileBrowser API support to get the game path
- Added scummvm header
- Typo

Modified Paths:
--------------
    scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.cpp
    scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.h
Modified: scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.cpp
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.cpp	2006-02-11 18:16:19 UTC (rev 20557)
+++ scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.cpp	2006-02-11 18:18:50 UTC (rev 20558)
@@ -1,4 +1,31 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
 #include <PalmOS.h>
+#include <VFSMgr.h>
+#include <FileBrowserLibCommon.h>
+#include <FileBrowserLib68K.h>
 
 #include "formTabs.h"
 #include "forms.h"
@@ -81,19 +108,19 @@
 	// test case
 	if (!gameInfoP) {
 		if (FldGetTextLength(fld1P) == 0) {
-			FrmCustomAlert(FrmWarnAlert,"You must specified an entry name.",0,0);
+			FrmCustomAlert(FrmWarnAlert,"You must specify an entry name.",0,0);
 			TabSetActive(frmP, myTabP, 0);
 			FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoEntryNameField));
 			return errBadParam;
 
 		} else if (FldGetTextLength(fld2P) == 0) {
-			FrmCustomAlert(FrmWarnAlert,"You must specified a path.",0,0);
+			FrmCustomAlert(FrmWarnAlert,"You must specify a path.",0,0);
 			TabSetActive(frmP, myTabP, 0);
 			FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoPathField));
 			return errBadParam;
 
 		} else if (FldGetTextLength(fld3P) == 0) {
-			FrmCustomAlert(FrmWarnAlert,"You must specified a game.",0,0);
+			FrmCustomAlert(FrmWarnAlert,"You must specify a game.",0,0);
 			TabSetActive(frmP, myTabP, 0);
 			FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameInfoGameField));
 			return errBadParam;
@@ -150,7 +177,7 @@
 	cck6P = (ControlType *)GetObjectPtr(TabGameDisplayFilterCheckbox);
 	cck7P = (ControlType *)GetObjectPtr(TabGameDisplayFullscreenCheckbox);
 	cck8P = (ControlType *)GetObjectPtr(TabGameDisplayAspectRatioCheckbox);
-	
+
 	if (!gameInfoP) {
 	} else {
 		gameInfoP->gfxMode = LstGetSelection(list1P);
@@ -249,13 +276,13 @@
 
 	if (!gameInfoP) {
 		if (FldGetTextLength(fld5P) == 0 && CtlGetValue(cck2P) == 1) {
-			FrmCustomAlert(FrmWarnAlert,"You must specified a room number.",0,0);
+			FrmCustomAlert(FrmWarnAlert,"You must specify a room number.",0,0);
 			TabSetActive(frmP, myTabP, 2);
 			FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsStartRoomField));
 			return errBadParam;
 
 		} else if (FldGetTextLength(fld6P) == 0 && CtlGetValue(cck5P) == 1) {
-			FrmCustomAlert(FrmWarnAlert,"You must specified a talk speed.",0,0);
+			FrmCustomAlert(FrmWarnAlert,"You must specify a talk speed.",0,0);
 			TabSetActive(frmP, myTabP, 2);
 			FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabGameOptionsTalkSpeedField));
 			return errBadParam;
@@ -288,6 +315,10 @@
 	TabAddContent(&frmP, tabP, "Display", TabGameDisplayForm);
 	TabAddContent(&frmP, tabP, "Options", TabGameOptionsForm);
 
+	UInt16 refNum;
+	if (SysLibFind(kFileBrowserLibName, &refNum))
+		FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabGameInfoBrowsePushButton));
+
 	if (index != dmMaxRecordIndex) {
 		MemHandle recordH = NULL;
 		GameInfoType *gameInfoP;
@@ -413,7 +444,7 @@
 	}
 }
 
-void EditGameCancel() {
+static void EditGameCancel() {
 	if (itemsText) {
 		MemPtrFree(itemsText);
 		itemsText = NULL;
@@ -422,6 +453,61 @@
 	FrmReturnToMain();
 }
 
+static void EditGameBowser() {
+	UInt16 refNum;
+	Err e;
+
+	ControlPtr butP = (ControlType *)GetObjectPtr(TabGameInfoBrowsePushButton);
+	CtlSetValue(butP, 0);
+
+	e = SysLibFind (kFileBrowserLibName, &refNum);
+	if (!e) {
+		e = FileBrowserLibOpen (refNum);
+		if (!e) {
+			UInt16 volRefNum = gPrefs->card.volRefNum;
+			Char *textP, *pathP = (Char *)MemPtrNew(kFileBrowserLibPathBufferSize);
+			pathP[0] = chrNull;
+			
+			if (FileBrowserLibShowOpenDialog(refNum, &volRefNum, pathP, 0, 0, 0, "Game Data Path", kFileBrowserLibFlagNoFiles)) {
+				FieldPtr fldP;
+				MemHandle textH;
+				Int16 offset, copySize, maxSize;
+				
+				fldP = (FieldType *)GetObjectPtr(TabGameInfoPathField);
+				maxSize = FldGetMaxChars(fldP);				
+				textH = FldGetTextHandle(fldP);
+
+				FldSetTextHandle(fldP, NULL);
+				textP = (Char *)MemHandleLock(textH);
+				offset = 0;
+				copySize = StrLen(pathP);
+
+				if (StrNCaselessCompare(pathP, "/Palm/Programs/ScummVM/Games/", 29) == 0) {
+					if (StrLen(pathP) == 29) {
+						copySize = 1;
+						pathP[0] = '.';
+					} else {
+						copySize -= 29;
+						offset = 29;
+					}
+				}
+
+				if (copySize > maxSize)
+					copySize = maxSize;
+				StrNCopy(textP, pathP + offset, copySize);
+
+				MemHandleUnlock(textH);
+				FldSetTextHandle(fldP, textH);
+				FldDrawField(fldP);
+				FldGrabFocus(fldP);
+			}
+
+			MemPtrFree(pathP);
+			FileBrowserLibClose(refNum);
+		}
+	}
+}
+
 Boolean EditGameFormHandleEvent(EventPtr eventP) {
 	FormPtr frmP = FrmGetActiveForm();
 	Boolean handled = false;
@@ -484,6 +570,10 @@
 				case GameEditDeleteButton:
 					EditGameFormDelete(false);
 					break;
+					
+				case TabGameInfoBrowsePushButton:
+					EditGameBowser();
+					break;
 
 				case TabGameInfoEnginePopTrigger:
 					FrmList(eventP, TabGameInfoEngineList);

Modified: scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.h
===================================================================
--- scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.h	2006-02-11 18:16:19 UTC (rev 20557)
+++ scummvm/trunk/backends/PalmOS/Src/forms/formEditGame.h	2006-02-11 18:18:50 UTC (rev 20558)
@@ -1,3 +1,27 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001  Ludvig Strigeus
+ * Copyright (C) 2001-2006 The ScummVM project
+ * Copyright (C) 2002-2006 Chris Apers - PalmOS Backend
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
 #ifndef __FORMEDITGAME_H__
 #define __FORMEDITGAME_H__
 







More information about the Scummvm-git-logs mailing list