Index: trunk/src/gdi32/CALLBACK.CPP
===================================================================
--- trunk/src/gdi32/CALLBACK.CPP	(revision 4551)
+++ trunk/src/gdi32/CALLBACK.CPP	(revision 4552)
@@ -1,3 +1,3 @@
-/* $Id: CALLBACK.CPP,v 1.5 2000-10-16 22:26:53 sandervl Exp $ */
+/* $Id: CALLBACK.CPP,v 1.6 2000-11-04 16:29:23 sandervl Exp $ */
 
 /*
@@ -17,4 +17,6 @@
 #define DBG_LOCALLOG	DBG_callback
 #include "dbglocal.h"
+
+#ifndef STDCALL_ENUMPROCS
 
 static VOID OPEN32API Callback(int X, int Y, LPARAM lpData);
@@ -52,2 +54,4 @@
 //******************************************************************************
 //******************************************************************************
+
+#endif //#ifndef STDCALL_ENUMPROCS
Index: trunk/src/gdi32/gdi32.cpp
===================================================================
--- trunk/src/gdi32/gdi32.cpp	(revision 4551)
+++ trunk/src/gdi32/gdi32.cpp	(revision 4552)
@@ -1,3 +1,3 @@
-/* $Id: gdi32.cpp,v 1.57 2000-10-26 17:20:29 sandervl Exp $ */
+/* $Id: gdi32.cpp,v 1.58 2000-11-04 16:29:23 sandervl Exp $ */
 
 /*
@@ -43,5 +43,5 @@
 COLORREF WIN32API SetBkColor(HDC hdc, COLORREF crColor)
 {
-  dprintf(("GDI32: SetBkColor to %X\n", crColor));
+  dprintf(("GDI32: SetBkColor %x to %x", hdc, crColor));
   return(O32_SetBkColor(hdc, crColor));
 }
@@ -52,6 +52,6 @@
  COLORREF clr;
 
+  dprintf(("GDI32: SetTextColor %x to %x", hdc, crColor));
   clr = O32_SetTextColor(hdc, crColor);
-  dprintf(("GDI32: SetTextColor from %X to %X\n", clr, crColor));
   return(clr);
 }
@@ -578,10 +578,16 @@
 //******************************************************************************
 //******************************************************************************
-int WIN32API EnumObjects( HDC arg1, int arg2, GOBJENUMPROC arg3, LPARAM  arg4)
-{
+int WIN32API EnumObjects( HDC hdc, int objType, GOBJENUMPROC objFunc, LPARAM lParam)
+{
+#ifdef STDCALL_ENUMPROCS
+    dprintf(("GDI32: EnumObjects %x %d %x %x", hdc, objType, objFunc, lParam));
+    //should change os2win.h
+    return O32_EnumObjects(hdc, objType, (GOBJENUMPROC_O32)objFunc, lParam);
+#else
+    //calling convention differences
     dprintf(("GDI32: EnumObjects STUB"));
-    //calling convention differences
 //    return O32_EnumObjects(arg1, arg2, arg3, arg4);
     return 0;
+#endif
 }
 //******************************************************************************
@@ -1292,5 +1298,5 @@
 {
   dprintf(("GDI32: UpdateColors\n"));
-  return O32_InvalidateRect(O32_WindowFromDC(hdc), NULL, FALSE);
+  return InvalidateRect(WindowFromDC(hdc), NULL, FALSE);
 }
 //******************************************************************************
Index: trunk/src/gdi32/line.cpp
===================================================================
--- trunk/src/gdi32/line.cpp	(revision 4551)
+++ trunk/src/gdi32/line.cpp	(revision 4552)
@@ -1,3 +1,3 @@
-/* $Id: line.cpp,v 1.6 2000-02-16 14:18:10 sandervl Exp $ */
+/* $Id: line.cpp,v 1.7 2000-11-04 16:29:24 sandervl Exp $ */
 /*
  * Line API's
@@ -14,4 +14,5 @@
 #include "callback.h"
 #include "oslibgpi.h"
+#include <dcdata.h>
 
 #define DBG_LOCALLOG	DBG_line
@@ -48,5 +49,5 @@
 }
 
-BOOL drawSingleLinePoint(HDC hdc,PVOID pHps,PPOINTLOS2 pt)
+BOOL drawSingleLinePoint(HDC hdc,pDCData pHps,PPOINTLOS2 pt)
 {
   LOGPEN penInfo;
@@ -72,5 +73,5 @@
 BOOL WIN32API MoveToEx( HDC hdc, int X, int Y, LPPOINT lpPoint)
 {
-  PVOID pHps = OSLibGpiQueryDCData(hdc);
+  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
 
   dprintf(("GDI32: MoveToEx %x (%d,%d)", hdc, X, Y));
@@ -79,4 +80,13 @@
   {
     POINTLOS2 newPoint = {X,Y};
+
+#ifndef INVERT
+    if(pHps->yInvert > 0) {
+         newPoint.y =  pHps->yInvert - newPoint.y;
+         if (lpPoint) {
+            lpPoint->y = pHps->yInvert - lpPoint->y;
+         }
+    }
+#endif
 
     if (lpPoint)
@@ -105,5 +115,5 @@
 BOOL WIN32API LineTo( HDC hdc, int nXEnd, int  nYEnd)
 {
-  PVOID pHps = OSLibGpiQueryDCData(hdc);
+  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
   BOOL rc = TRUE;
 
@@ -114,4 +124,10 @@
     POINTLOS2 oldPoint,newPoint;
     BOOL bWideLine;
+
+#ifndef INVERT
+    if (pHps->yInvert > 0) {
+       nYEnd = pHps->yInvert - nYEnd;
+    }
+#endif
 
     //CB: add metafile info
@@ -151,5 +167,7 @@
 {
   BOOL                 rc;
+#ifndef STDCALL_ENUMPROCS
   LineDDAProcCallback *callback = new LineDDAProcCallback(lpLineFunc, lpData);
+#endif
   POINTLOS2 startPt,endPt;
 
@@ -160,10 +178,16 @@
   toWin32LineEnd(&startPt,nXEnd,nYEnd,&endPt);
 
-  rc = O32_LineDDA(startPt.x,startPt.y,endPt.x,endPt.y,callback->GetOS2Callback(),(LPARAM)callback);
+  rc = O32_LineDDA(startPt.x,startPt.y,endPt.x,endPt.y, lpLineFunc, lpData);
+#else
+#ifdef STDCALL_ENUMPROCS
+  //should change os2win.h
+  rc = O32_LineDDA(nXStart,nYStart,nXEnd,nYEnd, (LINEDDAPROC_O32)lpLineFunc, lpData);
 #else
   rc = O32_LineDDA(nXStart,nYStart,nXEnd,nYEnd,callback->GetOS2Callback(),(LPARAM)callback);
-#endif
   if(callback)
         delete callback;
+#endif
+
+#endif
   return(rc);
 }
@@ -172,5 +196,5 @@
 BOOL WIN32API Polyline( HDC hdc, const POINT *lppt, int cPoints)
 {
-  PVOID pHps = OSLibGpiQueryDCData(hdc);
+  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
 
   dprintf(("GDI32: Polyline"));
@@ -186,5 +210,4 @@
   {
     SetLastError(ERROR_INVALID_PARAMETER);
-
     return FALSE;
   }
@@ -193,5 +216,4 @@
   {
     drawSingleLinePoint(hdc,pHps,(PPOINTLOS2)lppt); //CB: check metafile recording
-
     return TRUE;
   }
@@ -211,5 +233,5 @@
 BOOL WIN32API PolylineTo( HDC hdc, const POINT * lppt, DWORD cCount)
 {
-  PVOID pHps = OSLibGpiQueryDCData(hdc);
+  pDCData pHps = (pDCData)OSLibGpiQueryDCData(hdc);
 
   dprintf(("GDI32: PolylineTo"));
@@ -228,5 +250,4 @@
   {
     drawSingleLinePoint(hdc,pHps,(PPOINTLOS2)lppt);
-
     return TRUE;
   }
Index: trunk/src/gdi32/makefile
===================================================================
--- trunk/src/gdi32/makefile	(revision 4551)
+++ trunk/src/gdi32/makefile	(revision 4552)
@@ -1,3 +1,3 @@
-# $Id: makefile,v 1.27 2000-07-19 19:05:06 sandervl Exp $
+# $Id: makefile,v 1.28 2000-11-04 16:29:24 sandervl Exp $
 
 #
@@ -20,4 +20,10 @@
 # Flag overloads and local macros.
 CLEANEXTRAS = gdi32rsrc.asm
+
+#CFLAGS   = $(CFLAGS) -DSTDCALL_ENUMPROCS -DINVERT
+#CXXFLAGS = $(CXXFLAGS) -DSTDCALL_ENUMPROCS -DINVERT
+
+CFLAGS   = $(CFLAGS) -DINVERT
+CXXFLAGS = $(CXXFLAGS) -DINVERT
 
 # Object files. All objects should be prefixed with $(OBJDIR)!
Index: trunk/src/gdi32/metafile.cpp
===================================================================
--- trunk/src/gdi32/metafile.cpp	(revision 4551)
+++ trunk/src/gdi32/metafile.cpp	(revision 4552)
@@ -1,3 +1,3 @@
-/* $Id: metafile.cpp,v 1.2 2000-02-16 14:18:11 sandervl Exp $ */
+/* $Id: metafile.cpp,v 1.3 2000-11-04 16:29:24 sandervl Exp $ */
 
 /*
@@ -23,6 +23,7 @@
 HENHMETAFILE WIN32API CloseEnhMetaFile( HDC arg1)
 {
-    dprintf(("GDI32: CloseEnhMetaFile"));
-    return O32_CloseEnhMetaFile(arg1);
+    dprintf(("GDI32: CloseEnhMetaFile NOT IMPLEMENTED"));
+////    return O32_CloseEnhMetaFile(arg1);
+    return 0;
 }
 //******************************************************************************
@@ -37,6 +38,7 @@
 HENHMETAFILE WIN32API CopyEnhMetaFileA( HENHMETAFILE arg1, LPCSTR  arg2)
 {
-    dprintf(("GDI32: CopyEnhMetaFileA"));
-    return O32_CopyEnhMetaFile(arg1, arg2);
+    dprintf(("GDI32: CopyEnhMetaFileA NOT IMPLEMENTED"));
+////    return O32_CopyEnhMetaFile(arg1, arg2);
+    return 0;
 }
 //******************************************************************************
@@ -48,5 +50,5 @@
 
     dprintf(("GDI32: CopyEnhMetaFileW"));
-    rc = O32_CopyEnhMetaFile(arg1, astring);
+    rc = CopyEnhMetaFileA(arg1, astring);
     FreeAsciiString(astring);
     return rc;
@@ -56,6 +58,7 @@
 HENHMETAFILE WIN32API CreateEnhMetaFileA( HDC arg1, LPCSTR arg2, const RECT * arg3, LPCSTR  arg4)
 {
-    dprintf(("GDI32: CreateEnhMetaFileA"));
-    return O32_CreateEnhMetaFile(arg1, arg2, arg3, arg4);
+    dprintf(("GDI32: CreateEnhMetaFileA NOT IMPLEMENTED"));
+////    return O32_CreateEnhMetaFile(arg1, arg2, arg3, arg4);
+    return 0;
 }
 //******************************************************************************
@@ -68,5 +71,5 @@
 
     dprintf(("GDI32: CreateMetaFileW"));
-    rc = O32_CreateEnhMetaFile(arg1,astring1,arg3,astring2);
+    rc = CreateEnhMetaFileA(arg1,astring1,arg3,astring2);
     FreeAsciiString(astring1);
     FreeAsciiString(astring2);
@@ -96,6 +99,7 @@
 BOOL WIN32API DeleteEnhMetaFile( HENHMETAFILE arg1)
 {
-    dprintf(("GDI32: DeleteEnhMetaFile\n"));
-    return O32_DeleteEnhMetaFile(arg1);
+    dprintf(("GDI32: DeleteEnhMetaFile NOT IMPLEMENTED"));
+////    return O32_DeleteEnhMetaFile(arg1);
+    return 0;
 }
 //******************************************************************************
@@ -128,10 +132,16 @@
 //TODO: Callback
 //******************************************************************************
-BOOL WIN32API EnumMetaFile( HDC arg1, HMETAFILE arg2, MFENUMPROC arg3, LPARAM  arg4)
-{
-    dprintf(("GDI32: EnumMetaFile STUB"));
+BOOL WIN32API EnumMetaFile( HDC hdc, HMETAFILE hMetafile, MFENUMPROC metaProc, LPARAM lParam)
+{
+#ifdef STDCALL_ENUMPROCS
+    dprintf(("GDI32: EnumMetaFile %x %x %x %x", hdc, hMetafile, metaProc, lParam));
+    //should change os2win.h
+    return O32_EnumMetaFile(hdc, hMetafile, (MFENUMPROC_O32)metaProc, lParam);
+#else
+    dprintf(("GDI32: EnumMetaFile NOT IMPLEMENTED"));
     //calling convention differences
 //    return O32_EnumMetaFile(arg1, arg2, arg3, arg4);
     return 0;
+#endif
 }
 //******************************************************************************
@@ -139,5 +149,5 @@
 BOOL WIN32API EnumEnhMetaFile( HDC arg1, HENHMETAFILE arg2, ENHMFENUMPROC arg3, PVOID arg4, const RECT *  arg5)
 {
-    dprintf(("GDI32: EnumEnhMetaFile DOESN'T WORK!"));
+    dprintf(("GDI32: EnumEnhMetaFile NOT IMPLEMENTED!"));
 //    return O32_EnumEnhMetaFile(arg1, arg2, arg3, arg4, arg5);
     return 0;
@@ -167,6 +177,7 @@
 HENHMETAFILE WIN32API GetEnhMetaFileA( LPCSTR arg1)
 {
-    dprintf(("GDI32: GetEnhMetaFileA"));
-    return O32_GetEnhMetaFile(arg1);
+    dprintf(("GDI32: GetEnhMetaFileA NOT IMPLEMENTED"));
+////    return O32_GetEnhMetaFile(arg1);
+    return 0;
 }
 //******************************************************************************
@@ -179,5 +190,5 @@
     dprintf(("GDI32: GetEnhMetaFileW"));
     // NOTE: This will not work as is (needs UNICODE support)
-    rc = O32_GetEnhMetaFile(astring);
+    rc = GetEnhMetaFileA(astring);
     FreeAsciiString(astring);
     return rc;
@@ -187,6 +198,7 @@
 UINT WIN32API GetEnhMetaFileBits( HENHMETAFILE arg1, UINT arg2, PBYTE  arg3)
 {
-    dprintf(("GDI32: GetEnhMetaFileBits"));
-    return O32_GetEnhMetaFileBits(arg1, arg2, arg3);
+    dprintf(("GDI32: GetEnhMetaFileBits NOT IMPLEMENTED"));
+////    return O32_GetEnhMetaFileBits(arg1, arg2, arg3);
+    return 0;
 }
 //******************************************************************************
@@ -201,6 +213,7 @@
 HENHMETAFILE WIN32API SetEnhMetaFileBits( UINT arg1, const BYTE *  arg2)
 {
-    dprintf(("GDI32: SetEnhMetaFileBits"));
-    return O32_SetEnhMetaFileBits(arg1, arg2);
+    dprintf(("GDI32: SetEnhMetaFileBits NOT IMPLEMENTED"));
+////    return O32_SetEnhMetaFileBits(arg1, arg2);
+    return 0;
 }
 //******************************************************************************
@@ -215,6 +228,7 @@
 HENHMETAFILE WIN32API SetWinMetaFileBits( UINT arg1, const BYTE * arg2, HDC arg3, const METAFILEPICT *  arg4)
 {
-    dprintf(("GDI32: SetWinMetaFileBits"));
-    return O32_SetWinMetaFileBits(arg1, arg2, arg3, arg4);
+    dprintf(("GDI32: SetWinMetaFileBits NOT IMPLEMENTED"));
+////    return O32_SetWinMetaFileBits(arg1, arg2, arg3, arg4);
+    return 0;
 }
 //******************************************************************************
@@ -222,6 +236,7 @@
 UINT WIN32API GetWinMetaFileBits( HENHMETAFILE arg1, UINT arg2, PBYTE arg3, int arg4, HDC arg5)
 {
-    dprintf(("GDI32: GetWinMetaFileBits"));
-    return O32_GetWinMetaFileBits(arg1, arg2, arg3, arg4, arg5);
+    dprintf(("GDI32: GetWinMetaFileBits NOT IMPLEMENTED"));
+////    return O32_GetWinMetaFileBits(arg1, arg2, arg3, arg4, arg5);
+    return 0;
 }
 //******************************************************************************
@@ -229,6 +244,7 @@
 UINT WIN32API GetEnhMetaFileHeader( HENHMETAFILE arg1, UINT arg2, LPENHMETAHEADER  arg3)
 {
-    dprintf(("GDI32: GetEnhMetaFileHeader"));
-    return O32_GetEnhMetaFileHeader(arg1, arg2, arg3);
+    dprintf(("GDI32: GetEnhMetaFileHeader NOT IMPLEMENTED"));
+////    return O32_GetEnhMetaFileHeader(arg1, arg2, arg3);
+    return 0;
 }
 //******************************************************************************
@@ -236,6 +252,7 @@
 UINT WIN32API GetEnhMetaFilePaletteEntries( HENHMETAFILE arg1, UINT arg2, PPALETTEENTRY  arg3)
 {
-    dprintf(("GDI32: GetEnhMetaFilePaletteEntries"));
-    return O32_GetEnhMetaFilePaletteEntries(arg1, arg2, arg3);
+    dprintf(("GDI32: GetEnhMetaFilePaletteEntries NOT IMPLEMENTED"));
+////    return O32_GetEnhMetaFilePaletteEntries(arg1, arg2, arg3);
+    return 0;
 }
 //******************************************************************************
@@ -243,6 +260,7 @@
 BOOL WIN32API PlayEnhMetaFile( HDC arg1, HENHMETAFILE arg2, const RECT *  arg3)
 {
-    dprintf(("GDI32: PlayEnhMetaFile"));
-    return O32_PlayEnhMetaFile(arg1, arg2, arg3);
+    dprintf(("GDI32: PlayEnhMetaFile NOT IMPLEMENTED"));
+////    return O32_PlayEnhMetaFile(arg1, arg2, arg3);
+    return 0;
 }
 //******************************************************************************
@@ -269,24 +287,20 @@
         )
 {
-        dprintf(("GDI32: PlayEnhMetaFileRecord - stub\n"));
+        dprintf(("GDI32: PlayEnhMetaFileRecord - NOT IMPLEMENTED"));
         return FALSE;
 }
 //******************************************************************************
-UINT WIN32API GetEnhMetaFileDescriptionA(                    /*KSO Thu 21.05.1998*/
-        HENHMETAFILE    arg1,
-        UINT                    arg2,
-        LPSTR                   arg3
-        )
-{
-        dprintf(("GDI32: GetEnhMetaFileDescriptionA - stub\n"));
+UINT WIN32API GetEnhMetaFileDescriptionA(HENHMETAFILE    arg1,
+                                         UINT            arg2,
+                                         LPSTR           arg3)
+{
+        dprintf(("GDI32: GetEnhMetaFileDescriptionA - NOT IMPLEMENTED"));
         return FALSE;
 }
 //******************************************************************************
 //******************************************************************************
-UINT WIN32API GetEnhMetaFileDescriptionW(                    /*KSO Thu 21.05.1998*/
-        HENHMETAFILE    arg1,
-        UINT                    arg2,
-        LPWSTR                  arg3
-        )
+UINT WIN32API GetEnhMetaFileDescriptionW(HENHMETAFILE    arg1,
+                                         UINT            arg2,
+                                         LPWSTR          arg3)
 {
         dprintf(("GDI32: GetEnhMetaFileDescriptionW - stub\n"));
Index: trunk/src/gdi32/region.cpp
===================================================================
--- trunk/src/gdi32/region.cpp	(revision 4551)
+++ trunk/src/gdi32/region.cpp	(revision 4552)
@@ -1,3 +1,3 @@
-/* $Id: region.cpp,v 1.14 2000-10-02 17:43:32 sandervl Exp $ */
+/* $Id: region.cpp,v 1.15 2000-11-04 16:29:24 sandervl Exp $ */
 
 /*
@@ -562,4 +562,12 @@
         }
         else {
+#ifndef INVERT
+            //Convert coordinates from PM to win32
+            if (pHps->yInvert > 0) {
+   	         LONG temp     = pHps->yInvert - rectl.yBottom;
+                 rectl.yBottom = pHps->yInvert - rectl.yTop;
+	         rectl.yTop    = temp;
+            }
+#endif
             //Convert including/including to including/excluding
             includeBottomRightPoint(pHps, (PPOINTLOS2)&rectl);
@@ -567,7 +575,5 @@
             lpRect->left   = rectl.xLeft;
             lpRect->right  = rectl.xRight;
-            //No conversion required as GpiQueryClipBox is affected by
-            //the y-inversion of the window
-            //NOTE: YINVERSION dependancy
+
             if(rectl.yBottom > rectl.yTop) {
                 lpRect->top    = rectl.yTop;
@@ -582,4 +588,6 @@
         }
     }
+//    if(lpRect->left == 0 && lpRect->top == 0 && lpRect->right == 0 && lpRect->bottom == 0)
+// 	DebugInt3();
     dprintf(("GDI32: GetClipBox of %X returned %d; (%d,%d)(%d,%d)", hdc, rc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom));
     return rc;
@@ -650,4 +658,12 @@
     }
 
+#ifndef INVERT
+    if (pHps->yInvert > 0) {
+        LONG temp     = pHps->yInvert - rectl.yBottom;
+        rectl.yBottom = pHps->yInvert - rectl.yTop;
+        rectl.yTop    = temp;
+    }
+#endif
+
     dprintf(("ExcludeClipRgn %x (%d,%d)(%d,%d)", hdc, left, top, right, bottom));
     lComplexity = GpiExcludeClipRectangle(pHps->hps, &rectl);
@@ -684,4 +700,13 @@
     }
 
+#ifndef INVERT
+    //Convert coordinates from PM to win32
+    if (pHps->yInvert > 0) {
+         LONG temp     = pHps->yInvert - rectl.yBottom;
+         rectl.yBottom = pHps->yInvert - rectl.yTop;
+         rectl.yTop    = temp;
+    }
+#endif
+
     dprintf(("IntersectClipRgn %x (%d,%d)(%d,%d)", hdc, left, top, right, bottom));
     lComplexity = GpiIntersectClipRectangle(pHps->hps, &rectl);
@@ -708,4 +733,10 @@
    dprintf(("OffsetClipRgn %x (%d,%d)", hdc, nXOffset, nYOffset));
    POINTL  pointl = { nXOffset, nYOffset };
+#ifndef INVERT
+   if (pHps->yInvert > 0) {
+        pointl.y = pHps->yInvert - pointl.y;
+   }
+#endif
+
    lComplexity = GpiOffsetClipRegion(pHps->hps, &pointl);
 
@@ -1262,9 +1293,10 @@
     GpiOffsetRegion(hpsRegion, hrgn, &ptlOffset);
 
+    RECTL    rectl[8];
     RGNRECT  rgnRect;
     rgnRect.ircStart    = 1;
-    rgnRect.crc         = 0;
+    rgnRect.crc         = 8;
     rgnRect.ulDirection = RECTDIR_LFRT_TOPBOT;     // doesn't make a difference
-    if(GpiQueryRegionRects(hpsRegion, hrgn, NULL, &rgnRect, NULL))
+    if(GpiQueryRegionRects(hpsRegion, hrgn, NULL, &rgnRect, &rectl[0]))
     {
         switch (rgnRect.crcReturned) {
@@ -1306,5 +1338,5 @@
     height = abs(height);
 
-    if(pHps->lastBrushHandle != (UINT)hBrush)
+    if(pHps->lastBrushKey != (UINT)hBrush)
     {
         hbrushRestore = SelectObject(hdc, hBrush);
@@ -1347,5 +1379,5 @@
     }
 
-    if(pHps->lastBrushHandle != (UINT)hBrush)
+    if(pHps->lastBrushKey != (UINT)hBrush)
     {
         hbrushRestore = SelectObject(hdc, hBrush);
@@ -1382,5 +1414,5 @@
    }
 
-   return FillRgn(hdc, hrgn, (HBRUSH) pHps->lastBrushHandle);
+   return FillRgn(hdc, hrgn, (HBRUSH) pHps->lastBrushKey);
 }
 //******************************************************************************
