[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/forms formEditGame.cpp,1.1,1.2

Chris Apers chrilith at users.sourceforge.net
Fri Nov 28 02:00:06 CET 2003


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/forms
In directory sc8-pr-cvs1:/tmp/cvs-serv7681

Modified Files:
	formEditGame.cpp 
Log Message:
Fixed list position + set focus on new entry

Index: formEditGame.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/forms/formEditGame.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- formEditGame.cpp	3 Nov 2003 16:01:13 -0000	1.1
+++ formEditGame.cpp	28 Nov 2003 09:59:52 -0000	1.2
@@ -134,7 +134,7 @@
 	// update list position
 	{
 		RectangleType rArea;
-		UInt16 posIndex, maxIndex, maxView;
+		UInt16 posIndex, maxView;
 		
 		// get the sorted index
 		index = GamGetSelected();
@@ -142,14 +142,10 @@
 		SknGetListBounds(&rArea, NULL);
 		maxView = rArea.extent.y / sknInfoListItemSize;
 		posIndex = gPrefs->listPosition;
-		maxIndex = DmNumRecords(gameDB);
 		
-		if (index == 0 && posIndex > 0) {
-			gPrefs->listPosition = 0;
-		} else if ((maxView + posIndex) <= index) {
-			posIndex = index - (maxView - posIndex) + 1;
-			gPrefs->listPosition = posIndex;
-		}
+		// if out of the current list position
+		if (!(index >= posIndex && index < (posIndex + maxView)))
+			gPrefs->listPosition = index;	// this value is corrected in SknUpdateList if needed
 	}
 
 	FrmReturnToMain();
@@ -193,7 +189,7 @@
 	roomP = (Char *)MemHandleLock(roomH);
 	talkP = (Char *)MemHandleLock(talkH);
 
-//	index = GamGetSelected();
+	frmP = FrmGetActiveForm();
 
 	if (index != dmMaxRecordIndex) {
 		recordH = DmQueryRecord(gameDB, index);
@@ -238,6 +234,8 @@
 		LstSetSelection(list2P, 0);
 		LstSetSelection(list3P, 0);
 		CtlSetUsable((ControlType *)GetObjectPtr(EditGameDeleteButton),false);
+		
+		FrmSetFocus(frmP, FrmGetObjectIndex(frmP, EditGameEntryNameField));
 	}
 
 	MemHandleUnlock(nameH);
@@ -258,7 +256,6 @@
 	CtlSetLabel((ControlType *)GetObjectPtr(EditGameLanguagePopTrigger), LstGetSelectionText(list2P, LstGetSelection(list2P)));
 	CtlSetLabel((ControlType *)GetObjectPtr(EditGamePlatformPopTrigger), LstGetSelectionText(list3P, LstGetSelection(list3P)));
 
-	frmP = FrmGetActiveForm();
 	FrmDrawForm(frmP);
 }
 





More information about the Scummvm-git-logs mailing list