[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src skin.cpp,1.3,1.4

Chris Apers chrilith at users.sourceforge.net
Tue Jan 20 06:23:02 CET 2004


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

Modified Files:
	skin.cpp 
Log Message:
Fixed list positioning, tapwave related stuffs

Index: skin.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/skin.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- skin.cpp	6 Jan 2004 12:45:25 -0000	1.3
+++ skin.cpp	20 Jan 2004 14:22:42 -0000	1.4
@@ -120,6 +120,7 @@
 	RectangleType r;
 	FormPtr frmP = FrmGetActiveForm();
 
+	WinSetDrawWindow(WinGetDisplayWindow());
 	WinScreenLock(winLockDontCare);
 	//SknSetPalette();
 	RctSetRectangle(&r,0,0,160,160);
@@ -382,15 +383,18 @@
 
 void SknUpdateList() {
 	MemHandle record;
-	UInt16 index, maxIndex, maxView;
+	Int32 index, maxIndex, maxView;
 	GameInfoType *game;
 	RectangleType rArea, rField, rCopy, rArea2x;
 	DmOpenRef skinDBP;
 
 	UInt8 txtColor, norColor, selColor, bkgColor;
 	UInt16 x,y;
+	
+	// prevent flashing screen on Zodiac ?
+	if (!OPTIONS_TST(kOptDeviceZodiac))
+		WinScreenLock(winLockCopy);
 
-	WinScreenLock(winLockCopy);
 	SknGetListBounds(&rArea, &rArea2x);
 	skinDBP = SknOpenSkin();
 	// set default bg
@@ -419,10 +423,14 @@
 	maxIndex = DmNumRecords(gameDB);
 	maxView = rArea.extent.y / sknInfoListItemSize;
 
-	if (index > 0 && (index+maxView) > maxIndex) {
-		index -= (index+maxView) - maxIndex;
-		 gPrefs->listPosition = index;
-	}	
+	if (index > 0 && (index + maxView) > maxIndex)
+		index -= (index + maxView) - maxIndex;
+
+	if (index < 0)
+		index = 0;
+
+	gPrefs->listPosition = index;
+
 	SknRedrawSlider(skinDBP, index, maxIndex, maxView);
 	SknRedrawTools(skinDBP);
 	SknGetListColors(skinDBP, skinColors, &norColor, &selColor, &bkgColor);
@@ -467,7 +475,9 @@
 
 	RctSetRectangle(&rArea,0,0,160,160);
 	WinSetClip(&rArea);
-	WinScreenUnlock();
+	
+	if (!OPTIONS_TST(kOptDeviceZodiac))
+		WinScreenUnlock();
 }
 
 UInt16 SknCheckClick(DmOpenRef skinDBP, Coord mx, Coord my) {
@@ -508,30 +518,21 @@
 			return;
 
 		if (index < DmNumRecords(gameDB)) {
-			GameInfoType modGame;
-
+			Boolean newValue;
+			
 			oldIndex = GamGetSelected();
+
+			if (oldIndex != index && oldIndex != dmMaxRecordIndex)
+				GamUnselect();
+
 			record = DmGetRecord(gameDB, index);
 			game = (GameInfoType *)MemHandleLock(record);
 
-			MemMove(&modGame, game, sizeof(GameInfoType));	
-			modGame.selected = !modGame.selected;
-			DmWrite(game, 0, &modGame, sizeof(GameInfoType));
+			newValue = !game->selected;
+			DmWrite(game, OffsetOf(GameInfoType,selected), &newValue, sizeof(Boolean));
 
 			MemHandleUnlock(record);
 			DmReleaseRecord (gameDB, index, 0);
-
-			if (oldIndex != index && oldIndex != dmMaxRecordIndex)	{
-				record = DmGetRecord(gameDB, oldIndex);
-				game = (GameInfoType *)MemHandleLock(record);
-
-				MemMove(&modGame, game, sizeof(GameInfoType));	
-				modGame.selected = false;
-				DmWrite(game, 0, &modGame, sizeof(GameInfoType));
-
-				MemHandleUnlock(record);
-				DmReleaseRecord (gameDB, oldIndex, 0);
-			}
 			
 			lastIndex = index;
 			SknUpdateList();





More information about the Scummvm-git-logs mailing list