[Scummvm-cvs-logs] CVS: scummvm/backends/PalmOS/Src/forms formtabs.cpp,1.4,1.5 formtabs.h,1.3,1.4

Chris Apers chrilith at users.sourceforge.net
Sat Nov 5 03:06:38 CET 2005


Update of /cvsroot/scummvm/scummvm/backends/PalmOS/Src/forms
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19512

Modified Files:
	formtabs.cpp formtabs.h 
Log Message:
Added tabMoveUpObject function
Changed tabs look

Index: formtabs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/forms/formtabs.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- formtabs.cpp	30 Jul 2005 21:10:49 -0000	1.4
+++ formtabs.cpp	5 Nov 2005 11:05:53 -0000	1.5
@@ -3,6 +3,7 @@
 #include <FrmGlue.h>
 #include <LstGlue.h>
 
+#include "globals.h"
 #include "formTabs.h"
 
 TabType *TabNewTabs(UInt16 cnt) {
@@ -15,11 +16,17 @@
 	return newP;
 }
 
+void TabMoveUpObject(FormType *frmP, UInt16 objID, Coord amount) {
+	Coord x, y;
+	FrmGetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), &x, &y);
+	FrmSetObjectPosition(frmP, FrmGetObjectIndex(frmP, objID), x, y - amount);
+}
+
 void TabDeleteTabs(TabType *tabP) {
 	UInt16 cnt, num;
 	num = MemPtrSize(tabP->tabs) / sizeof(TabDataType);
 
-	for (cnt = 0; cnt < num; cnt++)
+	for (cnt = 0; cnt < num; cnt++)	
 		FrmDeleteForm(tabP->tabs[cnt].srcP);
 
 	delete tabP->tabs;
@@ -60,7 +67,7 @@
 	h = 12;
 	ControlType *addP = CtlNewControl(dstP, (FrmGetFormId(*frmP) + tabP->count), buttonCtl, nameP, x, y, w, h, stdFont, 0, true);
 	CtlGlueSetFrameStyle(addP, noButtonFrame);
-	tabP->width += w + 1;
+	tabP->width += w + 3;
 
 	// create tab content
 	for (cnt = 0; cnt < objNum; cnt++) {
@@ -86,7 +93,7 @@
 				UInt16 items = LstGetNumberOfItems((ListType *)objP);
 				UInt16 trigger = id - 1;
 				trigger = (FrmGetObjectIndex((FormType *)*dstP, trigger) != frmInvalidObjectId) ? trigger : 0;
-
+				
 				LstNewList(dstP, id, x, y, w, h, font, visible, trigger);
 				newP = (ListType *)FrmGetObjectPtr((FormType *)*dstP, FrmGetObjectIndex((FormType *)*dstP, id));
 				LstSetListChoices(newP, itemsP, items);
@@ -166,7 +173,8 @@
 	WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill));
 	WinDrawLine(1, 14, 154,14);
 	WinDrawLine(1, 15, 154,15);
-	RctSetRectangle(&r, 1, 30, 154, 100);
	WinDrawRectangle(&r, 0);
+	RctSetRectangle(&r, 1, 30, 154, 100);
+	WinDrawRectangle(&r, 0);
 	WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
 	WinDrawLine(1, 28, 154,28);
 
@@ -183,25 +191,52 @@
 			if (num == cnt) {
 				RGBColorType yellow = {0,255,192,0};
 
+				UInt8 line = /*(UIColorGetTableEntryIndex(UIFormFill) == UIColorGetTableEntryIndex(UIFieldTextHighlightBackground)) ?
+							WinRGBToIndex(&yellow) :*/
+							UIColorGetTableEntryIndex(UIFieldTextHighlightBackground);
+
 				r.topLeft.y	-= 1;
 				WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
-				WinDrawRectangleFrame(simpleFrame, &r);
-				WinSetForeColor(WinRGBToIndex(&yellow));
+				WinDrawRectangleFrame(simpleFrame, &r); 
+				WinSetForeColor(line);
 				WinDrawLine(r.topLeft.x, r.topLeft.y, r.topLeft.x + r.extent.x - 1, r.topLeft.y);
-				FrmShowObject(frmP, idx);
+				FrmShowObject(frmP, idx);				
+
 			} else {
-				WinSetForeColor(UIColorGetTableEntryIndex(UIObjectFrame));
-				WinDrawRectangleFrame(simpleFrame, &r);
+				UInt8 frame = UIColorGetTableEntryIndex(UIObjectFrame);
+				RGBColorType light;
+				WinIndexToRGB(frame, &light);
+				light.r = (255 - light.r) > 72 ? light.r + 72 : 255;
+				light.g = (255 - light.g) > 72 ? light.g + 72 : 255;
+				light.b = (255 - light.b) > 72 ? light.b + 72 : 255;
+
+				WinSetForeColor(WinRGBToIndex(&light));
+				WinDrawRectangleFrame(simpleFrame, &r); 
+				WinSetForeColor(frame);
+				WinDrawLine(r.topLeft.x - 1, r.topLeft.y + r.extent.y, r.topLeft.x + r.extent.x, r.topLeft.y + r.extent.y);
+			}
+
+			// round corner
+			WinSetForeColor(UIColorGetTableEntryIndex(UIFormFill));
+			if (OPTIONS_TST(kOptModeHiDensity)) {
+				WinSetCoordinateSystem(kCoordinatesNative);
+				WinDrawPixel((r.topLeft.x - 1) * 2, (r.topLeft.y - 1) * 2);
+				WinDrawPixel((r.topLeft.x + r.extent.x) * 2 + 1, (r.topLeft.y - 1) * 2);
+				WinSetCoordinateSystem(kCoordinatesStandard);
+
+			} else {
+				// TODO
 			}
 		}
 	}
 
 	// show objects
-	if (dataP->drawFunc)
-		(dataP->drawFunc)();
-
 	for (cnt = dataP->first; cnt <= dataP->last; cnt++) {
 		if ((idx = FrmGetObjectIndex(frmP, cnt)) != frmInvalidObjectId)
 			FrmShowObject(frmP, idx);
 	}
+
+	// post draw function
+	if (dataP->drawFunc)
+		(dataP->drawFunc)();
 }

Index: formtabs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/PalmOS/Src/forms/formtabs.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- formtabs.h	20 Dec 2004 16:59:43 -0000	1.3
+++ formtabs.h	5 Nov 2005 11:05:53 -0000	1.4
@@ -1,24 +1,24 @@
-#ifndef __FORMTABS_H__
-#define __FORMTABS_H__
-
-typedef void (TabProc)();
-
-typedef struct {
-	FormPtr srcP;
-	UInt16 first;
-	UInt16 last;
-	TabProc *drawFunc;
-} TabDataType, *TabDataPtr;
-
-typedef struct {
-	UInt16 count, active;
-	Coord width;
-	TabDataPtr tabs;
-} TabType, *TabPtr;
-
-TabType	*TabNewTabs		(UInt16 cnt);
-void 	 TabDeleteTabs	(TabType *tabP);
-Err 	 TabAddContent	(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc = 0);
-void 	 TabSetActive	(FormType *frmP, TabType *tabP, UInt16 num);
-
-#endif
+#ifndef __FORMTABS_H__
+#define __FORMTABS_H__
+
+typedef void (TabProc)();
+
+typedef struct {
+	FormPtr srcP;
+	UInt16 first;
+	UInt16 last;
+	TabProc *drawFunc;
+} TabDataType, *TabDataPtr;
+
+typedef struct {
+	UInt16 count, active;
+	Coord width;
+	TabDataPtr tabs;
+} TabType, *TabPtr;
+
+TabType	*TabNewTabs		(UInt16 cnt);
+void 	 TabDeleteTabs	(TabType *tabP);
+Err 	 TabAddContent	(FormType **frmP, TabType *tabP, const Char *nameP, UInt16 rscID, TabProc *drawFunc = 0);
+void 	 TabSetActive	(FormType *frmP, TabType *tabP, UInt16 num);
+void	TabMoveUpObject	(FormType *frmP, UInt16 objID, Coord amount);
+#endif





More information about the Scummvm-git-logs mailing list