Release 960516
Thu May 16 13:35:31 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [*/*.c]
Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and
SIZE16. Implemented Win32 version of most functions that take
these types as parameters.
* [configure]
Patched autoconf to attempt to correctly detect -lnsl and
-lsocket. Please check this out.
* [controls/button.c]
Added support for Win32 BM_* messages.
* [controls/menu.c]
Avoid sending extra WM_MENUSELECT messages. This avoids crashes
with Excel.
* [memory.heap.c] [include/heap.h]
Added support for SEGPTRs in Win32 heaps. Added a few macros to
make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR,
but they work with Win32.
* [memory/atom.c]
Implemented Win32 atom functions.
* [memory/local.c]
Fixed LocalReAlloc() changes to avoid copying the whole block twice.
* [win32/memory.c]
Use /dev/zero instead of MAP_ANON for VirtualAlloc().
* [windows/class.c]
Properly implemented the Win32 class functions.
* [windows/winproc.c] (New file)
New file handling the message translation between Win16 and Win32.
Mon May 13 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/mdi.c] [windows/menu.c]
Improved WM_MDICREATE and WM_MDICASCADE handling.
* [windows/event.c] [objects/bitblt.c]
Handle GraphicsExpose event for BitBlt from screen to screen.
* [windows/event.c] [windows/win.c] [windows/nonclient.c]
Bunch of fixes for problems with -managed.
* [windows/win.c] [windows/winpos.c]
Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO
in CreateWindow.
* [windows/win.c] [windows/queue.c] [misc/user.c]
Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL
on window creation/destruction.
* [objects/palette.c]
Crude RealizePalette(). At least something is visible in LviewPro.
Sun May 12 02:05:00 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/gdi32.spec]
Added Rectangle (use win16 version).
* [if1632/kernel32.spec]
Added GetWindowsDirectoryA (use win16 GetWindowsDirectory).
* [if1632/user32.spec]
Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16
versions).
Added SetWindowsHookExA (empty stub for now).
* [include/handle32.h]
Changed #include <malloc.h> to #include <stdlib.h> to prevent
hate message from FreeBSD compiler.
* [win32/newfns.c]
Added new function SetWindowsHookEx32A (empty stub for now).
* [win32/user32.c]
Removed redundant debugging printf statement.
Sun May 12 01:24:57 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [memory/local.c]
Avoid creating adjacent free blocks.
Free the block in LocalReAlloc() before allocating a new one.
Fixed LocalReAlloc() for discarded blocks.
Fri May 10 23:05:12 1996 Jukka Iivonen <iivonen@cc.helsinki.fi>
* [resources/sysres_Fi.rc]
ChooseFont and ChooseColor dialogs updated.
Fri May 10 17:19:33 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/drive.c,if1632/kernel.spec]
GetCurrentDirectory(),SetCurrentDirectory() implemented.
* [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec]
[include/windows.h] [include/winreg.h] [loader/main.c]
[misc/main.c] [misc/shell.c] [misc/registry.c]
Registry fixes:
- loads win95 registry databases,
- save only updated keys on default,
- now adhers to the new function naming standard,
- minor cleanups.
Tue May 7 22:36:13 1996 Albrecht Kleine <kleine@ak.sax.de>
* [combo.c]
Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX
and synchronized mine with Greg Kreider's works.
* [commdlg.c]
Bugfix in ChooseFont: font size handling.
diff --git a/objects/bitblt.c b/objects/bitblt.c
index b9b2b78..2805a10 100644
--- a/objects/bitblt.c
+++ b/objects/bitblt.c
@@ -629,7 +629,7 @@
static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
short widthSrc, short heightSrc,
short widthDst, short heightDst,
- RECT *visRectSrc, RECT *visRectDst,
+ RECT16 *visRectSrc, RECT16 *visRectDst,
int foreground, int background, WORD mode )
{
int *rowSrc, *rowDst, *pixel;
@@ -775,14 +775,14 @@
short widthSrc, short heightSrc,
short xDst, short yDst,
short widthDst, short heightDst,
- RECT *visRectSrc, RECT *visRectDst )
+ RECT16 *visRectSrc, RECT16 *visRectDst )
{
XImage *imageSrc, *imageDst;
- RECT rectSrc = *visRectSrc;
- RECT rectDst = *visRectDst;
- OffsetRect( &rectSrc, -xSrc, -ySrc );
- OffsetRect( &rectDst, -xDst, -yDst );
+ RECT16 rectSrc = *visRectSrc;
+ RECT16 rectDst = *visRectDst;
+ OffsetRect16( &rectSrc, -xSrc, -ySrc );
+ OffsetRect16( &rectDst, -xDst, -yDst );
imageSrc = XGetImage( display, dcSrc->u.x.drawable,
visRectSrc->left, visRectSrc->top,
visRectSrc->right - visRectSrc->left,
@@ -810,7 +810,7 @@
*/
static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
short xSrc, short ySrc,
- RECT *visRectSrc )
+ RECT16 *visRectSrc )
{
XImage *imageSrc, *imageDst;
register short x, y;
@@ -884,7 +884,7 @@
* Retrieve an area from the destination DC, mapping all the
* pixels to Windows colors.
*/
-static void BITBLT_GetDstArea( DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst )
+static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst)
{
short width = visRectDst->right - visRectDst->left;
short height = visRectDst->bottom - visRectDst->top;
@@ -915,7 +915,7 @@
* Put an area back into the destination DC, mapping the pixel
* colors to X pixels.
*/
-static void BITBLT_PutDstArea( DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst )
+static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst)
{
short width = visRectDst->right - visRectDst->left;
short height = visRectDst->bottom - visRectDst->top;
@@ -953,9 +953,9 @@
short widthDst, short heightDst,
DC *dcSrc, short xSrc, short ySrc,
short widthSrc, short heightSrc,
- RECT *visRectSrc, RECT *visRectDst )
+ RECT16 *visRectSrc, RECT16 *visRectDst )
{
- RECT tmpRect, clipRect;
+ RECT16 tmpRect, clipRect;
if (widthSrc < 0) { widthSrc = -widthSrc; xSrc -= widthSrc; }
if (widthDst < 0) { widthDst = -widthDst; xDst -= widthDst; }
@@ -964,28 +964,28 @@
/* Get the destination visible rectangle */
- SetRect( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst );
- GetRgnBox( dcDst->w.hGCClipRgn, &clipRect );
- OffsetRect( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY );
- if (!IntersectRect( visRectDst, &tmpRect, &clipRect )) return FALSE;
+ SetRect16( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst );
+ GetRgnBox16( dcDst->w.hGCClipRgn, &clipRect );
+ OffsetRect16( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY );
+ if (!IntersectRect16( visRectDst, &tmpRect, &clipRect )) return FALSE;
/* Get the source visible rectangle */
if (!dcSrc) return TRUE;
- SetRect( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc );
+ SetRect16( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc );
/* Apparently the clip region is only for output, so use hVisRgn here */
- GetRgnBox( dcSrc->w.hVisRgn, &clipRect );
- OffsetRect( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY );
- if (!IntersectRect( visRectSrc, &tmpRect, &clipRect )) return FALSE;
+ GetRgnBox16( dcSrc->w.hVisRgn, &clipRect );
+ OffsetRect16( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY );
+ if (!IntersectRect16( visRectSrc, &tmpRect, &clipRect )) return FALSE;
/* Intersect the rectangles */
if ((widthSrc == widthDst) && (heightSrc == heightDst)) /* no stretching */
{
- OffsetRect( visRectSrc, xDst - xSrc, yDst - ySrc );
- if (!IntersectRect( &tmpRect, visRectSrc, visRectDst )) return FALSE;
+ OffsetRect16( visRectSrc, xDst - xSrc, yDst - ySrc );
+ if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE;
*visRectSrc = *visRectDst = tmpRect;
- OffsetRect( visRectSrc, xSrc - xDst, ySrc - yDst );
+ OffsetRect16( visRectSrc, xSrc - xDst, ySrc - yDst );
}
else /* stretching */
{
@@ -995,7 +995,7 @@
((visRectSrc->right-xSrc) * widthDst) / widthSrc;
visRectSrc->bottom = yDst +
((visRectSrc->bottom-ySrc) * heightDst) / heightSrc;
- if (!IntersectRect( &tmpRect, visRectSrc, visRectDst )) return FALSE;
+ if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE;
*visRectSrc = *visRectDst = tmpRect;
visRectSrc->left = xSrc + (visRectSrc->left-xDst)*widthSrc/widthDst;
visRectSrc->top = ySrc + (visRectSrc->top-yDst)*heightSrc/heightDst;
@@ -1003,7 +1003,7 @@
((visRectSrc->right-xDst) * widthSrc) / widthDst;
visRectSrc->bottom = ySrc +
((visRectSrc->bottom-yDst) * heightSrc) / heightDst;
- if (IsRectEmpty( visRectSrc )) return FALSE;
+ if (IsRectEmpty16( visRectSrc )) return FALSE;
}
return TRUE;
}
@@ -1020,7 +1020,7 @@
short widthSrc, short heightSrc, DWORD rop )
{
BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush;
- RECT visRectDst, visRectSrc;
+ RECT16 visRectDst, visRectSrc;
short width, height;
const BYTE *opcode;
Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */
@@ -1113,11 +1113,13 @@
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
+ XSetGraphicsExposures( display, dcDst->u.x.gc, True );
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XCopyArea( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, False );
return TRUE;
}
if (dcSrc->w.bitsPerPixel == 1)
@@ -1125,10 +1127,12 @@
XSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel );
XSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel );
XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, True );
XCopyPlane( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top, 1 );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, False );
return TRUE;
}
break;
diff --git a/objects/bitmap.c b/objects/bitmap.c
index b992124..9efed12 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -317,10 +317,11 @@
return CreateCompatibleBitmap(hdc, width, height);
}
+
/***********************************************************************
- * GetBitmapDimensionEx (GDI.468)
+ * GetBitmapDimensionEx16 (GDI.468)
*/
-BOOL GetBitmapDimensionEx( HBITMAP hbitmap, LPSIZE size )
+BOOL16 GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size )
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
@@ -330,19 +331,34 @@
/***********************************************************************
- * GetBitmapDimension (GDI.162)
+ * GetBitmapDimensionEx32 (GDI.468)
*/
-DWORD GetBitmapDimension( HBITMAP hbitmap )
+BOOL32 GetBitmapDimensionEx32( HBITMAP32 hbitmap, LPSIZE32 size )
{
- SIZE size;
- if (!GetBitmapDimensionEx( hbitmap, &size )) return 0;
- return size.cx | (size.cy << 16);
+ BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
+ if (!bmp) return FALSE;
+ size->cx = (INT32)bmp->size.cx;
+ size->cy = (INT32)bmp->size.cy;
+ return TRUE;
}
+
/***********************************************************************
- * SetBitmapDimensionEx (GDI.478)
+ * GetBitmapDimension (GDI.162)
*/
-BOOL SetBitmapDimensionEx( HBITMAP hbitmap, short x, short y, LPSIZE prevSize )
+DWORD GetBitmapDimension( HBITMAP16 hbitmap )
+{
+ SIZE16 size;
+ if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0;
+ return MAKELONG( size.cx, size.cy );
+}
+
+
+/***********************************************************************
+ * SetBitmapDimensionEx16 (GDI.478)
+ */
+BOOL16 SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y,
+ LPSIZE16 prevSize )
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
@@ -354,11 +370,26 @@
/***********************************************************************
+ * SetBitmapDimensionEx32 (GDI.478)
+ */
+BOOL32 SetBitmapDimensionEx32( HBITMAP32 hbitmap, INT32 x, INT32 y,
+ LPSIZE32 prevSize )
+{
+ BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
+ if (!bmp) return FALSE;
+ if (prevSize) CONV_SIZE16TO32( &bmp->size, prevSize );
+ bmp->size.cx = (INT16)x;
+ bmp->size.cy = (INT16)y;
+ return TRUE;
+}
+
+
+/***********************************************************************
* SetBitmapDimension (GDI.163)
*/
-DWORD SetBitmapDimension( HBITMAP hbitmap, short x, short y )
+DWORD SetBitmapDimension( HBITMAP16 hbitmap, INT16 x, INT16 y )
{
- SIZE size;
- if (!SetBitmapDimensionEx( hbitmap, x, y, &size )) return 0;
- return size.cx | (size.cy << 16);
+ SIZE16 size;
+ if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0;
+ return MAKELONG( size.cx, size.cy );
}
diff --git a/objects/clipping.c b/objects/clipping.c
index fc96017..7064d03 100644
--- a/objects/clipping.c
+++ b/objects/clipping.c
@@ -304,11 +304,11 @@
/***********************************************************************
- * RectVisible (GDI.104)
+ * RectVisible16 (GDI.104)
*/
-BOOL RectVisible( HDC hdc, LPRECT rect )
+BOOL16 RectVisible16( HDC16 hdc, LPRECT16 rect )
{
- RECT tmpRect;
+ RECT16 tmpRect;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return FALSE;
dprintf_clipping(stddeb,"RectVisible: %04x %d,%dx%d,%d\n",
@@ -316,22 +316,46 @@
if (!dc->w.hGCClipRgn) return FALSE;
/* copy rectangle to avoid overwriting by LPtoDP */
tmpRect = *rect;
- LPtoDP( hdc, (LPPOINT)&tmpRect, 2 );
- return RectInRegion( dc->w.hGCClipRgn, &tmpRect );
+ LPtoDP16( hdc, (LPPOINT16)&tmpRect, 2 );
+ return RectInRegion16( dc->w.hGCClipRgn, &tmpRect );
}
/***********************************************************************
- * GetClipBox (GDI.77)
+ * RectVisible32 (GDI32.282)
*/
-int GetClipBox( HDC hdc, LPRECT rect )
+BOOL32 RectVisible32( HDC32 hdc, LPRECT32 rect )
+{
+ RECT16 rect16;
+ CONV_RECT32TO16( rect, &rect16 );
+ return RectVisible16( (HDC16)hdc, &rect16 );
+}
+
+
+/***********************************************************************
+ * GetClipBox16 (GDI.77)
+ */
+INT16 GetClipBox16( HDC16 hdc, LPRECT16 rect )
{
int ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR;
- dprintf_clipping(stddeb, "GetClipBox: %04x %p\n", hdc, rect );
- ret = GetRgnBox( dc->w.hGCClipRgn, rect );
- DPtoLP( hdc, (LPPOINT)rect, 2 );
+ ret = GetRgnBox16( dc->w.hGCClipRgn, rect );
+ DPtoLP16( hdc, (LPPOINT16)rect, 2 );
+ return ret;
+}
+
+
+/***********************************************************************
+ * GetClipBox32 (GDI32.162)
+ */
+INT32 GetClipBox32( HDC32 hdc, LPRECT32 rect )
+{
+ INT32 ret;
+ DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
+ if (!dc) return ERROR;
+ ret = GetRgnBox32( dc->w.hGCClipRgn, rect );
+ DPtoLP32( hdc, (LPPOINT32)rect, 2 );
return ret;
}
diff --git a/objects/color.c b/objects/color.c
index 9d78e54..41e612a 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -106,11 +106,11 @@
*
* Create the system palette.
*/
-static HPALETTE COLOR_InitPalette(void)
+static HPALETTE16 COLOR_InitPalette(void)
{
int i, size, pixel;
XColor color;
- HPALETTE hpalette;
+ HPALETTE16 hpalette;
LOGPALETTE * palPtr;
WORD *colorTranslation, *revTranslation;
@@ -215,7 +215,7 @@
*
* Initialize color map and system palette.
*/
-HPALETTE COLOR_Init(void)
+HPALETTE16 COLOR_Init(void)
{
Visual * visual = DefaultVisual( display, DefaultScreen(display) );
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index 7668967..700b53b 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -39,7 +39,7 @@
Cursor CURSORICON_XCursor = None; /* Current X cursor */
static HCURSOR hActiveCursor = 0; /* Active cursor */
static int CURSOR_ShowCount = 0; /* Cursor display count */
-static RECT CURSOR_ClipRect; /* Cursor clipping rect */
+static RECT32 CURSOR_ClipRect; /* Cursor clipping rect */
/**********************************************************************
* CURSORICON_FindBestIcon
@@ -237,7 +237,7 @@
HANDLE hAndBits, hXorBits;
HDC hdc;
int size, sizeAnd, sizeXor;
- POINT hotspot = { 0 ,0 };
+ POINT16 hotspot = { 0 ,0 };
BITMAPOBJ *bmpXor, *bmpAnd;
BITMAPINFO *bmi, *pInfo;
CURSORICONINFO *info;
@@ -245,7 +245,7 @@
if (fCursor) /* If cursor, get the hotspot */
{
- POINT *pt = (POINT *)LockResource( handle );
+ POINT16 *pt = (POINT16 *)LockResource( handle );
hotspot = *pt;
bmi = (BITMAPINFO *)(pt + 1);
}
@@ -864,20 +864,31 @@
/***********************************************************************
- * ClipCursor (USER.16)
+ * ClipCursor16 (USER.16)
*/
-BOOL ClipCursor( RECT *rect )
+BOOL16 ClipCursor16( const RECT16 *rect )
{
- if (!rect) SetRectEmpty( &CURSOR_ClipRect );
- else CopyRect( &CURSOR_ClipRect, rect );
+ if (!rect) SetRectEmpty32( &CURSOR_ClipRect );
+ else CONV_RECT16TO32( rect, &CURSOR_ClipRect );
return TRUE;
}
/***********************************************************************
- * GetCursorPos (USER.17)
+ * ClipCursor32 (USER32.52)
*/
-void GetCursorPos( POINT *pt )
+BOOL32 ClipCursor32( const RECT32 *rect )
+{
+ if (!rect) SetRectEmpty32( &CURSOR_ClipRect );
+ else CopyRect32( &CURSOR_ClipRect, rect );
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * GetCursorPos16 (USER.17)
+ */
+void GetCursorPos16( POINT16 *pt )
{
Window root, child;
int rootX, rootY, childX, childY;
@@ -897,11 +908,31 @@
/***********************************************************************
- * GetClipCursor (USER.309)
+ * GetCursorPos32 (USER32.228)
*/
-void GetClipCursor( RECT *rect )
+void GetCursorPos32( POINT32 *pt )
{
- if (rect) CopyRect( rect, &CURSOR_ClipRect );
+ POINT16 pt16;
+ GetCursorPos16( &pt16 );
+ if (pt) CONV_POINT16TO32( &pt16, pt );
+}
+
+
+/***********************************************************************
+ * GetClipCursor16 (USER.309)
+ */
+void GetClipCursor16( RECT16 *rect )
+{
+ if (rect) CONV_RECT32TO16( &CURSOR_ClipRect, rect );
+}
+
+
+/***********************************************************************
+ * GetClipCursor32 (USER32.220)
+ */
+void GetClipCursor32( RECT32 *rect )
+{
+ if (rect) CopyRect32( rect, &CURSOR_ClipRect );
}
diff --git a/objects/dcvalues.c b/objects/dcvalues.c
index cf67de7..b1b959b 100644
--- a/objects/dcvalues.c
+++ b/objects/dcvalues.c
@@ -26,13 +26,22 @@
}
#define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \
-BOOL func_name( HDC hdc, LPPOINT pt ) \
+BOOL16 func_name##16( HDC16 hdc, LPPOINT16 pt ) \
{ \
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \
if (!dc) return FALSE; \
pt->x = dc->w.ret_x; \
pt->y = dc->w.ret_y; \
return TRUE; \
+} \
+ \
+BOOL32 func_name##32( HDC32 hdc, LPPOINT32 pt ) \
+{ \
+ DC * dc = (DC *) GDI_GetObjPtr( (HDC16)hdc, DC_MAGIC ); \
+ if (!dc) return FALSE; \
+ pt->x = dc->w.ret_x; \
+ pt->y = dc->w.ret_y; \
+ return TRUE; \
}
#define DC_SET_MODE( func_name, dc_field, min_val, max_val, meta_func ) \
diff --git a/objects/font.c b/objects/font.c
index 7917a53..ab57ab2 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -17,6 +17,7 @@
#include "metafile.h"
#include "callback.h"
#include "options.h"
+#include "string32.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
@@ -616,16 +617,29 @@
*/
DWORD GetTextExtent( HDC hdc, LPCSTR str, short count )
{
- SIZE size;
- if (!GetTextExtentPoint( hdc, str, count, &size )) return 0;
+ SIZE16 size;
+ if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0;
return MAKELONG( size.cx, size.cy );
}
/***********************************************************************
- * GetTextExtentPoint (GDI.471)
+ * GetTextExtentPoint16 (GDI.471)
*/
-BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size )
+BOOL16 GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size)
+{
+ SIZE32 size32;
+ BOOL32 ret = GetTextExtentPoint32A( hdc, str, count, &size32 );
+ CONV_SIZE32TO16( &size32, size );
+ return (BOOL16)ret;
+}
+
+
+/***********************************************************************
+ * GetTextExtentPoint32A (GDI32.232)
+ */
+BOOL32 GetTextExtentPoint32A( HDC32 hdc, LPCSTR str, INT32 count,
+ LPSIZE32 size )
{
int dir, ascent, descent;
XCharStruct info;
@@ -639,13 +653,26 @@
size->cy = abs((dc->u.x.font.fstruct->ascent+dc->u.x.font.fstruct->descent)
* dc->w.WndExtY / dc->w.VportExtY);
- dprintf_font(stddeb,"GetTextExtentPoint(%04x '%*.*s' %d %p): returning %d,%d\n",
+ dprintf_font(stddeb,"GetTextExtentPoint(%08x '%*.*s' %d %p): returning %d,%d\n",
hdc, count, count, str, count, size, size->cx, size->cy );
return TRUE;
}
/***********************************************************************
+ * GetTextExtentPoint32W (GDI32.233)
+ */
+BOOL32 GetTextExtentPoint32W( HDC32 hdc, LPCWSTR str, INT32 count,
+ LPSIZE32 size )
+{
+ char *p = STRING32_DupUniToAnsi( str );
+ BOOL32 ret = GetTextExtentPoint32A( hdc, p, count, size );
+ free( p );
+ return ret;
+}
+
+
+/***********************************************************************
* GetTextMetrics (GDI.93)
*/
BOOL GetTextMetrics( HDC hdc, LPTEXTMETRIC metrics )
@@ -667,6 +694,49 @@
* dc->w.WndExtX / dc->w.VportExtX );
metrics->tmAveCharWidth = abs( metrics->tmAveCharWidth
* dc->w.WndExtX / dc->w.VportExtX );
+
+ dprintf_font(stdnimp,"text metrics:\n
+ InternalLeading = %i
+ ExternalLeading = %i
+ MaxCharWidth = %i
+ Weight = %i
+ Italic = %i
+ Underlined = %i
+ StruckOut = %i
+ FirstChar = %i
+ LastChar = %i
+ DefaultChar = %i
+ BreakChar = %i
+ CharSet = %i
+ Overhang = %i
+ DigitizedAspectX = %i
+ DigitizedAspectY = %i
+ AveCharWidth = %i
+ MaxCharWidth = %i
+ Ascent = %i
+ Descent = %i
+ Height = %i\n",
+ metrics->tmInternalLeading,
+ metrics->tmExternalLeading,
+ metrics->tmMaxCharWidth,
+ metrics->tmWeight,
+ metrics->tmItalic,
+ metrics->tmUnderlined,
+ metrics->tmStruckOut,
+ metrics->tmFirstChar,
+ metrics->tmLastChar,
+ metrics->tmDefaultChar,
+ metrics->tmBreakChar,
+ metrics->tmCharSet,
+ metrics->tmOverhang,
+ metrics->tmDigitizedAspectX,
+ metrics->tmDigitizedAspectY,
+ metrics->tmAveCharWidth,
+ metrics->tmMaxCharWidth,
+ metrics->tmAscent,
+ metrics->tmDescent,
+ metrics->tmHeight);
+
return TRUE;
}
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index e957f7e..6af4d94 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -11,12 +11,12 @@
#include "bitmap.h"
#include "brush.h"
#include "font.h"
+#include "heap.h"
#include "palette.h"
#include "pen.h"
#include "region.h"
#include "callback.h"
#include "stddebug.h"
-/* #define DEBUG_GDI */
#include "debug.h"
#include "xmalloc.h"
@@ -160,7 +160,7 @@
*/
BOOL GDI_Init(void)
{
- HPALETTE hpalette;
+ HPALETTE16 hpalette;
/* Create default palette */
@@ -244,7 +244,7 @@
/***********************************************************************
* DeleteObject (GDI.69)
*/
-BOOL DeleteObject( HGDIOBJ obj )
+BOOL DeleteObject( HGDIOBJ16 obj )
{
/* Check if object is valid */
@@ -380,6 +380,8 @@
};
int i, retval = 0;
+ LOGPEN *pen;
+ LOGBRUSH *brush = NULL;
dprintf_gdi( stddeb, "EnumObjects: %04x %d %08lx %08lx\n",
hdc, nObjType, (DWORD)lpEnumFunc, lParam );
@@ -387,40 +389,50 @@
{
case OBJ_PEN:
/* Enumerate solid pens */
+ if (!(pen = SEGPTR_NEW(LOGPEN))) break;
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{
- LOGPEN pen = { PS_SOLID, { 1, 0 }, solid_colors[i] };
- retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&pen),
+ pen->lopnStyle = PS_SOLID;
+ pen->lopnWidth.x = 1;
+ pen->lopnWidth.y = 0;
+ pen->lopnColor = solid_colors[i];
+ retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(pen),
lParam );
dprintf_gdi( stddeb, "EnumObject: solid pen %08lx, ret=%d\n",
solid_colors[i], retval);
if (!retval) break;
}
+ SEGPTR_FREE(pen);
break;
case OBJ_BRUSH:
/* Enumerate solid brushes */
+ if (!(brush = SEGPTR_NEW(LOGBRUSH))) break;
for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++)
{
- LOGBRUSH brush = { BS_SOLID, solid_colors[i], 0 };
- retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&brush),
+ brush->lbStyle = BS_SOLID;
+ brush->lbColor = solid_colors[i];
+ brush->lbHatch = 0;
+ retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(brush),
lParam );
dprintf_gdi( stddeb, "EnumObject: solid brush %08lx, ret=%d\n",
solid_colors[i], retval);
if (!retval) break;
}
- if (!retval) break;
/* Now enumerate hatched brushes */
- for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
+ if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++)
{
- LOGBRUSH brush = { BS_HATCHED, RGB(0,0,0), i };
- retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&brush),
+ brush->lbStyle = BS_HATCHED;
+ brush->lbColor = RGB(0,0,0);
+ brush->lbHatch = i;
+ retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(brush),
lParam );
dprintf_gdi( stddeb, "EnumObject: hatched brush %d, ret=%d\n",
i, retval);
if (!retval) break;
}
+ SEGPTR_FREE(brush);
break;
default:
diff --git a/objects/metafile.c b/objects/metafile.c
index 6ca814a..983b419 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -307,7 +307,7 @@
{
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
METARECORD *mr;
- HANDLETABLE *ht;
+ SEGPTR ht;
int offset = 0;
dprintf_metafile(stddeb,"EnumMetaFile(%04x, %04x, %08lx, %08lx)\n",
@@ -317,7 +317,7 @@
hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT,
sizeof(HANDLETABLE) * mh->mtNoObjects);
- ht = (HANDLETABLE *)GlobalLock16(hHT);
+ ht = WIN16_GlobalLock16(hHT);
offset = mh->mtHeaderSize * 2;
@@ -326,9 +326,8 @@
while (offset < (mh->mtSize * 2))
{
mr = (METARECORD *)((char *)mh + offset);
- if (!CallEnumMetafileProc(lpEnumFunc, hdc, MAKE_SEGPTR(ht),
- MAKE_SEGPTR(mr), mh->mtNoObjects,
- (LONG)lpData))
+ if (!CallEnumMetafileProc(lpEnumFunc, hdc, ht, MAKE_SEGPTR(mr), /* FIXME!! */
+ mh->mtNoObjects, (LONG)lpData))
break;
offset += (mr->rdSize * 2);
@@ -504,22 +503,22 @@
case META_TEXTOUT:
s1 = *(mr->rdParam);
- TextOut(hdc, *(mr->rdParam + ((s1 + 1) >> 1) + 2),
- *(mr->rdParam + ((s1 + 1) >> 1) + 1),
- (char *)(mr->rdParam + 1), s1);
+ TextOut16(hdc, *(mr->rdParam + ((s1 + 1) >> 1) + 2),
+ *(mr->rdParam + ((s1 + 1) >> 1) + 1),
+ (char *)(mr->rdParam + 1), s1);
break;
case META_POLYGON:
- Polygon(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam));
+ Polygon16(hdc, (LPPOINT16)(mr->rdParam + 1), *(mr->rdParam));
break;
case META_POLYPOLYGON:
- PolyPolygon(hdc, (LPPOINT)(mr->rdParam + *(mr->rdParam) + 1),
- (LPINT16)(mr->rdParam + 1), *(mr->rdParam));
+ PolyPolygon16(hdc, (LPPOINT16)(mr->rdParam + *(mr->rdParam) + 1),
+ (LPINT16)(mr->rdParam + 1), *(mr->rdParam));
break;
case META_POLYLINE:
- Polyline(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam));
+ Polyline16(hdc, (LPPOINT16)(mr->rdParam + 1), *(mr->rdParam));
break;
case META_RESTOREDC:
@@ -614,7 +613,8 @@
x6=mr->rdParam[(s1+1)/2+5]; /* unknown meaning */
x7=mr->rdParam[(s1+1)/2+6]; /* unknown meaning */
x8=mr->rdParam[(s1+1)/2+7]; /* unknown meaning */
- ExtTextOut(hdc, x, y, options, (LPRECT) &mr->rdParam[(s1+1)/2+4], (char *)(mr->rdParam + 4), s1, NULL);
+ ExtTextOut16( hdc, x, y, options, (LPRECT16) &mr->rdParam[(s1+1)/2+4],
+ (char *)(mr->rdParam + 4), s1, NULL );
/* fprintf(stderr,"EXTTEXTOUT (len: %d) %hd : %hd %hd %hd %hd [%s].\n",
(mr->rdSize-s1),options,x5,x6,x7,x8,(char*) &(mr->rdParam[4]) );*/
}
@@ -1058,7 +1058,7 @@
* MF_CreatePenIndirect
*/
-BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen)
+BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN *logpen)
{
int index;
HMETAFILE handle;
@@ -1131,7 +1131,7 @@
/******************************************************************
* MF_TextOut
*/
-BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count)
+BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count)
{
HMETAFILE handle;
DWORD len;
@@ -1160,7 +1160,7 @@
/******************************************************************
* MF_MetaPoly - implements Polygon and Polyline
*/
-BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count)
+BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
{
HMETAFILE handle;
DWORD len;
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
index ca330ce..bdb6de9 100644
--- a/objects/oembitmap.c
+++ b/objects/oembitmap.c
@@ -331,7 +331,7 @@
* Create the 2 bitmaps from XPM data.
*/
static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap,
- HBITMAP *hBitmapMask, POINT *hotspot )
+ HBITMAP *hBitmapMask, POINT16 *hotspot )
{
Pixmap pixmap, pixmask;
XpmAttributes *attrs;
@@ -407,7 +407,7 @@
CURSORICONINFO *pInfo;
BITMAPOBJ *bmpXor, *bmpAnd;
HBITMAP hXorBits, hAndBits;
- POINT hotspot;
+ POINT16 hotspot;
int sizeXor, sizeAnd;
if (fCursor)
diff --git a/objects/palette.c b/objects/palette.c
index 25001e1..1e76dce 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -20,7 +20,7 @@
/***********************************************************************
* PALETTE_GetNearestIndexAndColor
*/
-static WORD PALETTE_GetNearestIndexAndColor(HPALETTE hpalette, COLORREF *color)
+static WORD PALETTE_GetNearestIndexAndColor(HPALETTE16 hpalette, COLORREF *color)
{
int i, minDist, dist;
WORD index = 0;
@@ -69,10 +69,10 @@
/***********************************************************************
* CreatePalette (GDI.360)
*/
-HPALETTE CreatePalette( const LOGPALETTE* palette )
+HPALETTE16 CreatePalette( const LOGPALETTE* palette )
{
PALETTEOBJ * palettePtr;
- HPALETTE hpalette;
+ HPALETTE16 hpalette;
int size;
size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY);
@@ -87,7 +87,7 @@
/***********************************************************************
* GetPaletteEntries (GDI.363)
*/
-WORD GetPaletteEntries( HPALETTE hpalette, WORD start, WORD count,
+WORD GetPaletteEntries( HPALETTE16 hpalette, WORD start, WORD count,
LPPALETTEENTRY entries )
{
PALETTEOBJ * palPtr;
@@ -107,7 +107,7 @@
/***********************************************************************
* SetPaletteEntries (GDI.364)
*/
-WORD SetPaletteEntries( HPALETTE hpalette, WORD start, WORD count,
+WORD SetPaletteEntries( HPALETTE16 hpalette, WORD start, WORD count,
LPPALETTEENTRY entries )
{
PALETTEOBJ * palPtr;
@@ -126,7 +126,7 @@
/***********************************************************************
* ResizePalette (GDI.368)
*/
-BOOL ResizePalette(HPALETTE hPal, UINT cEntries)
+BOOL ResizePalette(HPALETTE16 hPal, UINT cEntries)
{
fprintf(stdnimp,"ResizePalette: empty stub! \n");
return FALSE;
@@ -135,7 +135,7 @@
/***********************************************************************
* AnimatePalette (GDI.367)
*/
-BOOL AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries,
+BOOL AnimatePalette(HPALETTE16 hPal, UINT StartIndex, UINT NumEntries,
LPPALETTEENTRY PaletteColors)
{
fprintf(stdnimp,"AnimatePalette: empty stub! \n");
@@ -196,7 +196,7 @@
/***********************************************************************
* GetNearestPaletteIndex (GDI.370)
*/
-WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color )
+WORD GetNearestPaletteIndex( HPALETTE16 hpalette, COLORREF color )
{
WORD index = PALETTE_GetNearestIndexAndColor( hpalette, &color );
dprintf_palette(stddeb,"GetNearestPaletteIndex(%04x,%06lx): returning %d\n",
@@ -235,9 +235,9 @@
/***********************************************************************
* GDISelectPalette (GDI.361)
*/
-HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal )
+HPALETTE16 GDISelectPalette( HDC hdc, HPALETTE16 hpal )
{
- HPALETTE prev;
+ HPALETTE16 prev;
DC *dc;
dprintf_palette(stddeb, "GDISelectPalette: %04x %04x\n", hdc, hpal );
@@ -255,15 +255,49 @@
*/
UINT GDIRealizePalette( HDC hdc )
{
- dprintf_palette(stdnimp, "GDIRealizePalette: %04x\n", hdc );
- return 0;
+ UINT realized = 0;
+ COLORREF color;
+ DC* dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ) ;
+ PALETTEOBJ* palPtr;
+
+ dprintf_palette(stdnimp, "GDIRealizePalette: %04x...", hdc );
+
+ if( dc )
+ {
+ palPtr = (PALETTEOBJ *) GDI_GetObjPtr( dc->w.hPalette, PALETTE_MAGIC );
+
+ if( palPtr )
+ {
+ WORD index, i;
+ HANDLE hMap;
+ WORD* pMap;
+
+ hMap = GDI_HEAP_ALLOC(sizeof(WORD)*palPtr->logpalette.palNumEntries);
+ pMap = (WORD*)GDI_HEAP_LIN_ADDR( hMap );
+
+ if( pMap )
+ {
+ for (i = 0; i < palPtr->logpalette.palNumEntries ; i++)
+ {
+ color = *(COLORREF*)(palPtr->logpalette.palPalEntry + i);
+ index = PALETTE_GetNearestIndexAndColor( STOCK_DEFAULT_PALETTE, &color);
+ if( index != i ) realized++;
+ pMap[i] = index;
+ }
+ COLOR_SetMapping(dc, hMap, 0, i);
+ GDI_HEAP_FREE(hMap);
+ }
+ }
+ }
+ dprintf_palette(stdnimp, " realized %i colors\n", realized );
+ return realized;
}
/***********************************************************************
* SelectPalette (USER.282)
*/
-HPALETTE SelectPalette(HDC hDC, HPALETTE hPal, BOOL bForceBackground)
+HPALETTE16 SelectPalette(HDC hDC, HPALETTE16 hPal, BOOL bForceBackground)
{
return GDISelectPalette( hDC, hPal );
}
diff --git a/objects/pen.c b/objects/pen.c
index bc5a986..f28ce04 100644
--- a/objects/pen.c
+++ b/objects/pen.c
@@ -13,7 +13,7 @@
/***********************************************************************
* CreatePen (GDI.61)
*/
-HPEN CreatePen( INT style, INT width, COLORREF color )
+HPEN16 CreatePen( INT style, INT width, COLORREF color )
{
LOGPEN logpen = { style, { width, 0 }, color };
dprintf_gdi(stddeb, "CreatePen: %d %d %06lx\n", style, width, color );
@@ -24,10 +24,10 @@
/***********************************************************************
* CreatePenIndirect (GDI.62)
*/
-HPEN CreatePenIndirect( const LOGPEN * pen )
+HPEN16 CreatePenIndirect( const LOGPEN * pen )
{
PENOBJ * penPtr;
- HPEN hpen;
+ HPEN16 hpen;
if (pen->lopnStyle > PS_INSIDEFRAME) return 0;
hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC );
@@ -52,13 +52,13 @@
/***********************************************************************
* PEN_SelectObject
*/
-HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
+HPEN16 PEN_SelectObject( DC * dc, HPEN16 hpen, PENOBJ * pen )
{
static char dash_dash[] = { 5, 3 }; /* ----- ----- ----- */
static char dash_dot[] = { 2, 2 }; /* -- -- -- -- -- -- */
static char dash_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static char dash_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
- HPEN prevHandle = dc->w.hPen;
+ HPEN16 prevHandle = dc->w.hPen;
if (dc->header.wMagic == METAFILE_DC_MAGIC)
if (MF_CreatePenIndirect(dc, hpen, &(pen->logpen)))
diff --git a/objects/region.c b/objects/region.c
index 935b996..29bcbc1 100644
--- a/objects/region.c
+++ b/objects/region.c
@@ -7,10 +7,8 @@
#include <stdlib.h>
#include <stdio.h>
-
#include "region.h"
#include "stddebug.h"
-/* #define DEBUG_REGION */
#include "debug.h"
@@ -26,9 +24,9 @@
/***********************************************************************
- * OffsetRgn (GDI.101)
+ * OffsetRgn (GDI.101) (GDI32.256)
*/
-int OffsetRgn( HRGN hrgn, short x, short y )
+INT16 OffsetRgn( HRGN32 hrgn, INT32 x, INT32 y )
{
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (!obj) return ERROR;
@@ -40,33 +38,45 @@
/***********************************************************************
- * GetRgnBox (GDI.134)
+ * GetRgnBox16 (GDI.134)
*/
-int GetRgnBox( HRGN hrgn, LPRECT rect )
+INT16 GetRgnBox16( HRGN16 hrgn, LPRECT16 rect )
{
RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC );
if (!obj) return ERROR;
dprintf_region(stddeb, "GetRgnBox: %04x\n", hrgn );
if (!obj->xrgn)
{
- SetRectEmpty( rect );
+ SetRectEmpty16( rect );
return NULLREGION;
}
else
{
XRectangle xrect;
XClipBox( obj->xrgn, &xrect );
- SetRect( rect, xrect.x, xrect.y,
- xrect.x + xrect.width, xrect.y + xrect.height);
+ SetRect16( rect, xrect.x, xrect.y,
+ xrect.x + xrect.width, xrect.y + xrect.height);
return COMPLEXREGION;
}
}
/***********************************************************************
- * CreateRectRgn (GDI.64)
+ * GetRgnBox32 (GDI32.219)
*/
-HRGN CreateRectRgn( INT left, INT top, INT right, INT bottom )
+INT32 GetRgnBox32( HRGN32 hrgn, LPRECT32 rect )
+{
+ RECT16 r;
+ INT16 ret = GetRgnBox16( hrgn, &r );
+ CONV_RECT16TO32( &r, rect );
+ return ret;
+}
+
+
+/***********************************************************************
+ * CreateRectRgn (GDI.64) (GDI32.59)
+ */
+HRGN CreateRectRgn( INT32 left, INT32 top, INT32 right, INT32 bottom )
{
HRGN hrgn;
RGNOBJ *obj;
@@ -91,18 +101,27 @@
/***********************************************************************
- * CreateRectRgnIndirect (GDI.65)
+ * CreateRectRgnIndirect16 (GDI.65)
*/
-HRGN CreateRectRgnIndirect( const RECT* rect )
+HRGN16 CreateRectRgnIndirect16( const RECT16* rect )
{
return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom );
}
/***********************************************************************
- * SetRectRgn (GDI.172)
+ * CreateRectRgnIndirect32 (GDI32.60)
*/
-void SetRectRgn( HRGN hrgn, short left, short top, short right, short bottom )
+HRGN32 CreateRectRgnIndirect32( const RECT32* rect )
+{
+ return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom );
+}
+
+
+/***********************************************************************
+ * SetRectRgn (GDI.172) (GDI32.332)
+ */
+void SetRectRgn( HRGN32 hrgn, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
RGNOBJ * obj;
@@ -122,10 +141,10 @@
/***********************************************************************
- * CreateRoundRectRgn (GDI.444)
+ * CreateRoundRectRgn (GDI.444) (GDI32.61)
*/
-HRGN CreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
- INT ellipse_width, INT ellipse_height )
+HRGN CreateRoundRectRgn( INT32 left, INT32 top, INT32 right, INT32 bottom,
+ INT32 ellipse_width, INT32 ellipse_height )
{
RGNOBJ * obj;
HRGN hrgn;
@@ -218,9 +237,9 @@
/***********************************************************************
- * CreateEllipticRgn (GDI.54)
+ * CreateEllipticRgn (GDI.54) (GDI32.39)
*/
-HRGN CreateEllipticRgn( INT left, INT top, INT right, INT bottom )
+HRGN CreateEllipticRgn( INT32 left, INT32 top, INT32 right, INT32 bottom )
{
return CreateRoundRectRgn( left, top, right, bottom,
right-left, bottom-top );
@@ -228,9 +247,9 @@
/***********************************************************************
- * CreateEllipticRgnIndirect (GDI.55)
+ * CreateEllipticRgnIndirect16 (GDI.55)
*/
-HRGN CreateEllipticRgnIndirect( LPRECT rect )
+HRGN16 CreateEllipticRgnIndirect16( const RECT16 *rect )
{
return CreateRoundRectRgn(rect->left, rect->top, rect->right, rect->bottom,
rect->right-rect->left, rect->bottom-rect->top );
@@ -238,19 +257,29 @@
/***********************************************************************
- * CreatePolygonRgn (GDI.63)
+ * CreateEllipticRgnIndirect32 (GDI32.40)
*/
-HRGN CreatePolygonRgn( const POINT * points, INT count, INT mode )
+HRGN32 CreateEllipticRgnIndirect32( const RECT32 *rect )
{
- return CreatePolyPolygonRgn( points, &count, 1, mode );
+ return CreateRoundRectRgn(rect->left, rect->top, rect->right, rect->bottom,
+ rect->right-rect->left, rect->bottom-rect->top );
}
/***********************************************************************
- * CreatePolyPolygonRgn (GDI.451)
+ * CreatePolygonRgn16 (GDI.63)
*/
-HRGN CreatePolyPolygonRgn( const POINT * points, const INT16 * count,
- INT nbpolygons, INT mode )
+HRGN16 CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode )
+{
+ return CreatePolyPolygonRgn16( points, &count, 1, mode );
+}
+
+
+/***********************************************************************
+ * CreatePolyPolygonRgn16 (GDI.451)
+ */
+HRGN16 CreatePolyPolygonRgn16( const POINT16 * points, const INT16 * count,
+ INT16 nbpolygons, INT16 mode )
{
RGNOBJ * obj;
HRGN hrgn;
@@ -314,9 +343,9 @@
/***********************************************************************
- * PtInRegion (GDI.161)
+ * PtInRegion (GDI.161) (GDI32.278)
*/
-BOOL PtInRegion( HRGN hrgn, short x, short y )
+BOOL PtInRegion( HRGN32 hrgn, INT32 x, INT32 y )
{
RGNOBJ * obj;
@@ -327,9 +356,9 @@
/***********************************************************************
- * RectInRegion (GDI.181)
+ * RectInRegion16 (GDI.181)
*/
-BOOL RectInRegion( HRGN hrgn, LPRECT rect )
+BOOL16 RectInRegion16( HRGN16 hrgn, const RECT16 *rect )
{
RGNOBJ * obj;
@@ -342,9 +371,24 @@
/***********************************************************************
- * EqualRgn (GDI.72)
+ * RectInRegion32 (GDI32.281)
*/
-BOOL EqualRgn( HRGN rgn1, HRGN rgn2 )
+BOOL32 RectInRegion32( HRGN32 hrgn, const RECT32 *rect )
+{
+ RGNOBJ * obj;
+
+ if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE;
+ if (!obj->xrgn) return FALSE;
+ return (XRectInRegion( obj->xrgn, rect->left, rect->top,
+ rect->right-rect->left,
+ rect->bottom-rect->top ) != RectangleOut);
+}
+
+
+/***********************************************************************
+ * EqualRgn (GDI.72) (GDI32.90)
+ */
+BOOL EqualRgn( HRGN32 rgn1, HRGN32 rgn2 )
{
RGNOBJ *obj1, *obj2;
if (!(obj1 = (RGNOBJ *) GDI_GetObjPtr( rgn1, REGION_MAGIC ))) return FALSE;
@@ -384,7 +428,7 @@
*
* Create a region that is a frame around another region
*/
-BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, int x, int y )
+BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT32 x, INT32 y )
{
RGNOBJ *destObj,*srcObj;
Region result;
@@ -402,11 +446,11 @@
}
/***********************************************************************
- * CombineRgn (GDI.451)
+ * CombineRgn (GDI.451) (GDI32.19)
*
* The behavior is correct even if src and dest regions are the same.
*/
-INT CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode )
+INT16 CombineRgn( HRGN32 hDest, HRGN32 hSrc1, HRGN32 hSrc2, INT32 mode )
{
RGNOBJ *destObj, *src1Obj, *src2Obj;
Region destrgn;
diff --git a/objects/text.c b/objects/text.c
index 3e62c84..cd3676e 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -12,6 +12,7 @@
#include "gdi.h"
#include "callback.h"
#include "metafile.h"
+#include "string32.h"
#include "stddebug.h"
/* #define DEBUG_TEXT */
#include "debug.h"
@@ -51,7 +52,7 @@
int i = 0, j = 0, k;
int plen = 0;
int numspaces;
- SIZE size;
+ SIZE16 size;
int lasttab = 0;
int wb_i = 0, wb_j = 0, wb_count = 0;
@@ -74,7 +75,7 @@
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
- if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
+ if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
@@ -91,7 +92,7 @@
dest[j++] = str[i++];
if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK))
{
- if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
+ if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
@@ -105,7 +106,7 @@
wb_j = j;
wb_count = *count;
- if (!GetTextExtentPoint(hdc, &dest[lasttab], j - lasttab,
+ if (!GetTextExtentPoint16(hdc, &dest[lasttab], j - lasttab,
&size))
return NULL;
@@ -121,7 +122,7 @@
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
- if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
+ if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
@@ -136,7 +137,7 @@
wb_i = i;
wb_j = j - 1;
wb_count = *count;
- if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
+ if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
@@ -147,7 +148,7 @@
if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) ||
(format & DT_WORDBREAK))
{
- if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size))
+ if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size))
return NULL;
plen += size.cx;
}
@@ -182,11 +183,12 @@
/***********************************************************************
- * DrawText (USER.85)
+ * DrawText16 (USER.85)
*/
-INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags )
+INT16 DrawText16( HDC16 hdc, LPCSTR str, INT16 i_count,
+ LPRECT16 rect, UINT16 flags )
{
- SIZE size;
+ SIZE16 size;
const char *strPtr;
static char line[1024];
int len, lh, count=i_count;
@@ -214,9 +216,9 @@
if (flags & DT_EXPANDTABS)
{
- GetTextExtentPoint(hdc, " ", 1, &size);
+ GetTextExtentPoint16(hdc, " ", 1, &size);
spacewidth = size.cx;
- GetTextExtentPoint(hdc, "o", 1, &size);
+ GetTextExtentPoint16(hdc, "o", 1, &size);
tabwidth = size.cx * tabstop;
}
@@ -227,13 +229,13 @@
if (prefix_offset != -1)
{
- GetTextExtentPoint(hdc, line, prefix_offset, &size);
+ GetTextExtentPoint16(hdc, line, prefix_offset, &size);
prefix_x = size.cx;
- GetTextExtentPoint(hdc, line, prefix_offset + 1, &size);
+ GetTextExtentPoint16(hdc, line, prefix_offset + 1, &size);
prefix_end = size.cx - 1;
}
- if (!GetTextExtentPoint(hdc, line, len, &size)) return 0;
+ if (!GetTextExtentPoint16(hdc, line, len, &size)) return 0;
if (flags & DT_CENTER) x = (rect->left + rect->right -
size.cx) / 2;
else if (flags & DT_RIGHT) x = rect->right - size.cx;
@@ -246,16 +248,16 @@
}
if (!(flags & DT_CALCRECT))
{
- if (!ExtTextOut( hdc, x, y, (flags & DT_NOCLIP) ? 0 : ETO_CLIPPED,
- rect, line, len, NULL )) return 0;
+ if (!ExtTextOut16(hdc, x, y, (flags & DT_NOCLIP) ? 0 : ETO_CLIPPED,
+ rect, line, len, NULL )) return 0;
}
else if (size.cx > max_width)
max_width = size.cx;
if (prefix_offset != -1)
{
- HPEN hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) );
- HPEN oldPen = SelectObject( hdc, hpen );
+ HPEN16 hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) );
+ HPEN16 oldPen = SelectObject( hdc, hpen );
MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 );
LineTo(hdc, x + prefix_end, y + tm.tmAscent + 1 );
SelectObject( hdc, oldPen );
@@ -283,15 +285,47 @@
/***********************************************************************
- * ExtTextOut (GDI.351)
+ * DrawText32A (USER32.163)
*/
-BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect,
- LPSTR str, WORD count, LPINT16 lpDx )
+INT32 DrawText32A( HDC32 hdc, LPCSTR str, INT32 count,
+ LPRECT32 rect, UINT32 flags )
+{
+ RECT16 rect16;
+ INT16 ret;
+
+ if (!rect)
+ return DrawText16( (HDC16)hdc, str, (INT16)count, NULL, (UINT16)flags);
+ CONV_RECT32TO16( rect, &rect16 );
+ ret = DrawText16( (HDC16)hdc, str, (INT16)count, &rect16, (UINT16)flags );
+ CONV_RECT16TO32( &rect16, rect );
+ return ret;
+}
+
+
+/***********************************************************************
+ * DrawText32W (USER32.166)
+ */
+INT32 DrawText32W( HDC32 hdc, LPCWSTR str, INT32 count,
+ LPRECT32 rect, UINT32 flags )
+{
+ char *p = STRING32_DupUniToAnsi( str );
+ INT32 ret = DrawText32A( hdc, p, count, rect, flags );
+ free(p);
+ return ret;
+}
+
+
+/***********************************************************************
+ * ExtTextOut16 (GDI.351)
+ */
+BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
+ const RECT16 *lprect, LPCSTR str, UINT16 count,
+ const INT16 *lpDx )
{
int dir, ascent, descent, i;
XCharStruct info;
XFontStruct *font;
- RECT rect;
+ RECT16 rect;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
@@ -421,7 +455,7 @@
items = xmalloc( count * sizeof(XTextItem) );
for (i = 0, pitem = items; i < count; i++, pitem++)
{
- pitem->chars = str + i;
+ pitem->chars = (char *)str + i;
pitem->nchars = 1;
pitem->font = None;
if (i == 0)
@@ -434,7 +468,7 @@
pitem->delta += dc->w.breakExtra;
if (lpDx)
{
- INT width;
+ INT16 width;
GetCharWidth( hdc, str[i], str[i], &width );
pitem->delta += lpDx[i-1] - width;
}
@@ -479,11 +513,62 @@
/***********************************************************************
- * TextOut (GDI.33)
+ * ExtTextOut32A (GDI32.98)
*/
-BOOL TextOut( HDC hdc, short x, short y, LPSTR str, short count )
+BOOL32 ExtTextOut32A( HDC32 hdc, INT32 x, INT32 y, UINT32 flags,
+ const RECT32 *lprect, LPCSTR str, UINT32 count,
+ const INT32 *lpDx )
{
- return ExtTextOut( hdc, x, y, 0, NULL, str, count, NULL );
+ RECT16 rect16;
+
+ if (lpDx) fprintf( stderr, "ExtTextOut32A: lpDx not implemented\n" );
+ if (!lprect)
+ return ExtTextOut16( (HDC16)hdc, (INT16)x, (INT16)y, (UINT16)flags,
+ NULL, str, (UINT16)count, NULL );
+ CONV_RECT32TO16( lprect, &rect16 );
+ return ExtTextOut16( (HDC16)hdc, (INT16)x, (INT16)y, (UINT16)flags,
+ &rect16, str, (UINT16)count, NULL );
+}
+
+
+/***********************************************************************
+ * ExtTextOut32W (GDI32.99)
+ */
+BOOL32 ExtTextOut32W( HDC32 hdc, INT32 x, INT32 y, UINT32 flags,
+ const RECT32 *lprect, LPCWSTR str, UINT32 count,
+ const INT32 *lpDx )
+{
+ char *p = STRING32_DupUniToAnsi( str );
+ INT32 ret = ExtTextOut32A( hdc, x, y, flags, lprect, p, count, lpDx );
+ free(p);
+ return ret;
+}
+
+
+/***********************************************************************
+ * TextOut16 (GDI.33)
+ */
+BOOL16 TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count )
+{
+ return ExtTextOut16( hdc, x, y, 0, NULL, str, count, NULL );
+}
+
+
+/***********************************************************************
+ * TextOut32A (GDI32.355)
+ */
+BOOL32 TextOut32A( HDC32 hdc, INT32 x, INT32 y, LPCSTR str, INT32 count )
+{
+ return ExtTextOut32A( hdc, x, y, 0, NULL, str, count, NULL );
+}
+
+
+/***********************************************************************
+ * TextOut32W (GDI32.356)
+ */
+BOOL32 TextOut32W( HDC32 hdc, INT32 x, INT32 y, LPCWSTR str, INT32 count )
+{
+ return ExtTextOut32W( hdc, x, y, 0, NULL, str, count, NULL );
}
@@ -501,8 +586,8 @@
} else {
current_color = GetTextColor(hdc);
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT) );
- s = TextOut(hdc, x, y, (LPSTR) lParam,
- cch ? cch : lstrlen((LPCSTR) lParam) );
+ s = TextOut16(hdc, x, y, (LPSTR) lParam,
+ cch ? cch : lstrlen((LPCSTR) lParam) );
SetTextColor(hdc, current_color);
return s;
@@ -556,11 +641,11 @@
tabPos = nTabOrg + ((x + LOWORD(extent) - nTabOrg) / defWidth + 1) * defWidth;
if (fDisplayText)
{
- RECT r;
- SetRect( &r, x, y, tabPos, y+HIWORD(extent) );
- ExtTextOut( hdc, x, y,
- GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
- &r, lpstr, i, NULL );
+ RECT16 r;
+ SetRect16( &r, x, y, tabPos, y+HIWORD(extent) );
+ ExtTextOut16( hdc, x, y,
+ GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0,
+ &r, lpstr, i, NULL );
}
x = tabPos;
count -= i+1;