Release 980712

Sun Jul 12 16:23:36 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [server/*] [scheduler/client.c] (new files)
	  [scheduler/sysdeps.c] [scheduler/thread.c] [scheduler/process.c]
	Beginnings of client/server communication for inter-process
	synchronisation.

Sat Jul 11 19:45:45 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [include/bitmap.h] [objects/bitmap.c] [objects/dib.c] 
	  [objects/oembitmap.c]
	Speed up DIB section handling by using pre-allocated colormap and 
	XImage. Moved DIB section data out of general BITMAPOBJ structure.
	Bugfix: GetDIBits32 would overwrite one byte beyond bitmap data.

	* [if1632/shell.spec] [if1632/kernel.spec] [win32/kernel32.c]
	More verbose error message if ThunkConnect fails.
	Implemented KERNEL_475.

	* [files/profile.c] [ole/ole2nls.c]
	Minor bugfixes.

	* [if1632/builtin.c] [if1632/kernel.spec] [include/task.h]
	  [loader/ne/module.c] [loader/task.c]
	Implemented KERNEL.THHOOK.

	* [if1632/wprocs.spec] [include/process.h] [msdos/dpmi.c] [msdos/vxd.c]
	Implemented Win32s VxD services (W32S.386).

Sat Jul 11 17:52:23 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [graphics/x11drv/xfont.c] [graphics/x11drv/text.c] 
	  [include/x11font.h]
	Improve handling of rotated X11 fonts. Metrics/extents should now be
	correct. ExtTextOut should behave better (still doesn't handle lpDx).

	* [graphics/painting.c]
	DrawFocusRect32: Don't do anything if width or height are zero.

Sat Jul 11 15:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [files/profile.c] [include/windows.h]
	The length arguments of *Profile*() need to be treated
	as UINTxx instead of INTxx.

	* [graphics/env.c] [graphics/win16drv/init.c] [include/print.h]
	  [misc/printdrv.c]
	Many printer driver fixes/changes (many thanks go to Huw !).
	Most printers should work again ;)

	* [memory/atom.c]
	Fixed ATOM_AddAtom to store atoms exactly like Windows.

	* [*/*]
	Fixed misc compiler warnings.

Fri Jul 10 15:58:36 1998  Marcus Meissner <marcus@jet.franken.de>

	* [files/drive.c]
	Fixed GetDriveType16 to return DRIVE_REMOTE again.

	* [loader/pe_image.c][loader/module.c]
	Look for modules that have the same modulename or the same
	filename (they sometimes differ).
	Fixed up fixup_imports, removed one of the loops.

	* [windows/winpos.c]
	Added some NULL ptr checks. Needs more.

	* [graphics/ddraw.c]
	Some stubs added.

	* [if1632/snoop.c]
	Updated, made WINELIB compatible.

Fri Jul 10 04:39:56 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [objects/enhmetafile.c] [relay32/gdi32.spec]
	Small tweaks for documentation system.

Thu Jul  9 22:00:18 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
	Fixed GetEffectiveClientRect, CreateToolbarEx and CreateMappedBitmap.
	Added stub for ShowHideMenuCtl. Added some documentation.

	* [documentation/common_controls]
	Added and updated some information.

	* [controls/toolbar.c][include/toolbar.h]
	Added string support.

	* [misc/shell.c][misc/shellord.c][relay32/shell.spec]
	Changed names of undocumented functions to their real names and
	fixed the export table.

	* [controls/imagelist.c][relay32/comctl32.spec]
	Added stub for ImageList_SetFilter.
	Fixed some minor bugs and typos.

	* [objects/font.c][include/windows.h][relay32/gdi32.spec]
	Added stubs for GetCharacterPlacement32[A/W].

	* [objects/region.c][relay32/gdi32.spec]
	Added stub for UNDOCUMENTED GetRandomRgn.

	* [controls/commctrl.c][controls/*.c][include/*.h]
	Added dummy listview, pager, rebar, tooltips, trackbar and
	treeview control. This keeps some programs from complaining.

Thu Jul  9 11:23:58 1998  Rein Klazes <rklazes@casema.net>

	* [graphics/painting.c] [graphics/*/init.c]
	  [graphics/x11drv/graphics.c] [relay32/gdi32.spec]
	  [if1632/gdi.spec] [include/gdi.h] [include/x11drv.h]
	Implemented drawing bezier curves: PolyBezier16/32 and
	PolyBezierTo16/32.

	* [graphics/x11drv/graphics.c]
	Improved accuracy of several graphic routines, especially the
	drawing of pie's.

	* [include/windows.h] [misc/spy.c]
	Added 25 window messages related to programs based on MFC and/or OLE.

Wed Jul  8 22:00:00 1998  James Juran  <jrj120@psu.edu>

	* [documentation/wine.man]
	Updated manpage.

	* [wine.ini]
	Added section for Win95Look=true (commented out by default).

Wed Jul  8 06:23:19 1998  Matthew Becker <mbecker@glasscity.net>

	* [misc/registry.c]
	Fixed a crash in RegEnumValue32A when the dwType parameter is
	NULL.

	* [programs/regtest/regtest.c]
	Improved the printing of errors.

	* [misc/ntdll.c]
	Added stub for RtlFormatCurrentUserKeyPath.

	* [win32/console.c]
	Added stub for ScrollConsoleScreenBuffer.

Mon Jul  6 16:41:47 1998  Per Lindström <pelinstr@algonet.se>

	* [include/windows.h] [relay32/kernel.spec] [win32/newfns.c]
	Added stubs for SleepEx and TerminateProcess.

	* [rc/README]
	Corrected a grammatical error.

Mon Jul  3 12:00:00 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [misc/shellord.c]
	Put some TRACE in.

	* [memory/string.c]
	Deleted unused variable in lstrcmpi32A.

	* [include/windows.h][memory/string.c]
	Added functions WideCharToLocal32 LocalToWideChar32 for
	OLE-strings

	* [include/shlobj.h][include/winerror.h][misc/shell.c]
	  [ole/folders.c]
	Added definition of internal class pidlmgr.
	Changed definitions of EnumIDList, IShellFolder.
	Added some OLE error constants.
	Implemented EnumIDList, IShellFolder, IClassFactory,
	PidlMgr, SHELL32_DllGetClassObject, SHGetDesktopFolder,
	SHGetSpecialFolderLocation (half), SHGetPathFromIDList
	(!!This stuff is not finished yet!!)

	* [include/windows.h][misc/network][reley32/mpr.spec]
	Added stubs for WNetConnectionDialog32[A|W|API].
	Added struct LPCONNECTDLGSTRUCT32[A|W] and some constants.
	Added some SetLastError(WN_NO_NETWORK) to the stubs.
	Fixed bufferhandling in WNetCancelConnection
	Added stub for MultinetGetErrorText[A|W]

	* [ole/ole2nls.c]
	Rewrote GetTimeFormat32A.

Fri Jul  3 10:27:30 1998  Michael Poole <poole+@andrew.cmu.edu>

	* [graphics/ddraw.c] [tsx11/X11_calls]
	Implement IDirectDrawPalette_GetEntries.
	Use CopyColormapAndFree to avoid erasing previously-set
	palette entries.

	* [graphics/ddraw.c] [include/ddraw.h]
	  [tools/make_X11wrappers] [tsx11/X11_calls]
	Provide a preliminary, not-yet-working framework for doing
	DirectDraw via Xlib or XShm as well as DGA.

Tue Jun 30 00:16:09 1998  Marcel Baur <mbaur@g26.ethz.ch>

	* [ole/nls/*.nls]
	Added remaining 22 locales (including arabic locales).
diff --git a/controls/commctrl.c b/controls/commctrl.c
index 8dddf5b..2838976 100644
--- a/controls/commctrl.c
+++ b/controls/commctrl.c
@@ -2,6 +2,7 @@
  * Common controls functions
  *
  * Copyright 1997 Dimitrie O. Paun
+ * Copyright 1998 Eric Kohl
  *
  */
 
@@ -9,43 +10,58 @@
 #include "heap.h"
 #include "commctrl.h"
 #include "header.h"
+#include "listview.h"
+#include "pager.h"
 #include "progress.h"
+#include "rebar.h"
 #include "status.h"
 #include "toolbar.h"
+#include "tooltips.h"
+#include "trackbar.h"
+#include "treeview.h"
 #include "updown.h"
 #include "debug.h"
 
 
 /***********************************************************************
  * DrawStatusText32A [COMCTL32.5][COMCTL32.27]
+ *
+ * Draws text with borders, like in a status bar.
+ *
+ * PARAMS
+ *     hdc   [I] handle to the window's display context
+ *     lprc  [I] pointer to a rectangle
+ *     text  [I] pointer to the text
+ *     style [I] 
  */
-void WINAPI DrawStatusText32A( HDC32 hdc, LPRECT32 lprc, LPCSTR text,
-                               UINT32 style )
+
+VOID WINAPI
+DrawStatusText32A (HDC32 hdc, LPRECT32 lprc, LPCSTR text, UINT32 style)
 {
     RECT32 r = *lprc;
     UINT32 border = BDR_SUNKENOUTER;
 
-    if(style==SBT_POPOUT)
+    if (style == SBT_POPOUT)
       border = BDR_RAISEDOUTER;
-    else if(style==SBT_NOBORDERS)
+    else if (style == SBT_NOBORDERS)
       border = 0;
 
-    DrawEdge32(hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
+    DrawEdge32 (hdc, &r, border, BF_RECT|BF_ADJUST|BF_MIDDLE);
 
     /* now draw text */
     if (text) {
-      int oldbkmode = SetBkMode32(hdc, TRANSPARENT);
+      int oldbkmode = SetBkMode32 (hdc, TRANSPARENT);
       r.left += 3;
-      DrawText32A(hdc, text, lstrlen32A(text),
-		  &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);  
+      DrawText32A (hdc, text, lstrlen32A(text),
+		   &r, DT_LEFT|DT_VCENTER|DT_SINGLELINE);  
       if (oldbkmode != TRANSPARENT)
 	SetBkMode32(hdc, oldbkmode);
     }
-    
 }
 
+
 /***********************************************************************
- *           DrawStatusText32W   (COMCTL32.28)
+ * DrawStatusText32W [COMCTL32.28]
  */
 void WINAPI DrawStatusText32W( HDC32 hdc, LPRECT32 lprc, LPCWSTR text,
                                UINT32 style )
@@ -55,6 +71,7 @@
   HeapFree( GetProcessHeap(), 0, p );         
 }
 
+
 /***********************************************************************
  * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21]
  */
@@ -67,6 +84,7 @@
 			   parent, wid, 0, 0);
 }
 
+
 /***********************************************************************
  *           CreateStatusWindow32W   (COMCTL32.22)
  */
@@ -102,8 +120,14 @@
 /***********************************************************************
  * InitCommonControls [COMCTL32.17]
  *
+ * Registers the common controls.
  *
+ * PARAMS
+ *     None.
  *
+ * NOTES
+ *     Calls InitCommonControlsEx.
+ *     InitCommonControlsEx should be used instead.
  */
 
 VOID WINAPI
@@ -121,8 +145,10 @@
 /***********************************************************************
  * InitCommonControlsEx [COMCTL32.81]
  *
+ * Registers the common controls.
  *
- *
+ * PARAMS
+ *     lpInitCtrls [I] pointer to a INITCOMMONCONTROLS structure.
  */
 
 BOOL32 WINAPI
@@ -141,25 +167,25 @@
 
     switch (lpInitCtrls->dwICC & dwMask) {
       case ICC_LISTVIEW_CLASSES:
-        TRACE (commctrl, "No listview class implemented!\n");
-        HEADER_Register();
+        LISTVIEW_Register ();
+        HEADER_Register ();
         break;
 
       case ICC_TREEVIEW_CLASSES:
-        TRACE (commctrl, "No treeview class implemented!\n");
-        TRACE (commctrl, "No tooltip class implemented!\n");
+        TREEVIEW_Register ();
+	TOOLTIPS_Register ();
         break;
 
       case ICC_BAR_CLASSES:
 	TOOLBAR_Register ();
 	STATUS_Register ();
-        TRACE (commctrl, "No trackbar class implemented!\n");
-        TRACE (commctrl, "No tooltip class implemented!\n");
+	TRACKBAR_Register ();
+	TOOLTIPS_Register ();
         break;
 
       case ICC_TAB_CLASSES:
         TRACE (commctrl, "No tab class implemented!\n");
-        TRACE (commctrl, "No tooltip class implemented!\n");
+	TOOLTIPS_Register ();
         UPDOWN_Register ();
         break;
 
@@ -192,7 +218,7 @@
         break;
 
       case ICC_COOL_CLASSES:
-        TRACE (commctrl, "No rebar class implemented!\n");
+	REBAR_Register ();
         break;
 
       case ICC_INTERNET_CLASSES:
@@ -200,7 +226,7 @@
         break;
 
       case ICC_PAGESCROLLER_CLASS:
-        TRACE (commctrl, "No page scroller class implemented!\n");
+	PAGER_Register ();
         break;
 
       case ICC_NATIVEFNTCTL_CLASS:
@@ -220,9 +246,14 @@
 /***********************************************************************
  * MenuHelp [COMCTL32.2]
  *
- *
- *
- *
+ * PARAMS
+ *     uMsg
+ *     wParam
+ *     lParam
+ *     hMainMenu
+ *     hInst
+ *     hwndStatus
+ *     lpwIDs
  */
 
 VOID WINAPI
@@ -244,7 +275,7 @@
             }
             else {
                 if (HIWORD(wParam) & MF_POPUP) {
-                    TRACE (commctrl, "popup menu selected!\n");
+		    FIXME (commctrl, "popup 0x%08x 0x%08lx\n", wParam, lParam);
 
                     szStatusText[0] = 0;
                 }
@@ -289,16 +320,25 @@
 			(WPARAM32)uStructSize, 0);
 
 	/* set bitmap and button size */
+	SendMessage32A (hwndTB, TB_SETBITMAPSIZE, 0,
+			MAKELPARAM((WORD)dyBitmap, (WORD)dxBitmap));
+#if 0
+	SendMessage32A (hwndTB, TB_SETBUTTONSIZE, 0,
+			MAKELONG((WORD)dyButton, (WORD)dxButton));
+#endif
 
 	/* add bitmaps */
-	tbab.hInst = hBMInst;
-	tbab.nID   = wBMID;
-	SendMessage32A (hwndTB, TB_ADDBITMAP,
-			(WPARAM32)nBitmaps, (LPARAM)&tbab);
+	if (nBitmaps > 0) {
+	    tbab.hInst = hBMInst;
+	    tbab.nID   = wBMID;
+	    SendMessage32A (hwndTB, TB_ADDBITMAP,
+			    (WPARAM32)nBitmaps, (LPARAM)&tbab);
+	}
 
 	/* add buttons */
-	SendMessage32A (hwndTB, TB_ADDBUTTONS32A,
-			(WPARAM32)iNumButtons, (LPARAM)lpButtons);
+	if (iNumButtons > 0)
+	    SendMessage32A (hwndTB, TB_ADDBUTTONS32A,
+			    (WPARAM32)iNumButtons, (LPARAM)lpButtons);
     }
 
     return hwndTB;
@@ -308,22 +348,100 @@
 /***********************************************************************
  * CreateMappedBitmap [COMCTL32.8]
  *
- *
- *
+ * PARAMS
+ *     hInstance
+ *     idBitmap
+ *     wFlags
+ *     lpColorMap
+ *     iNumMaps
  */
 
 HBITMAP32 WINAPI
 CreateMappedBitmap (HINSTANCE32 hInstance, INT32 idBitmap, UINT32 wFlags,
 		    LPCOLORMAP lpColorMap, INT32 iNumMaps)
 {
+    HGLOBAL32 hglb;
+    HRSRC32 hRsrc;
+    LPBITMAPINFOHEADER lpBitmap, lpBitmapInfo;
+    UINT32 nSize, nColorTableSize;
+    DWORD *pColorTable;
+    INT32 iColor, i, iMaps, nWidth, nHeight;
+    HDC32 hdcScreen;
     HBITMAP32 hbm;
+    LPCOLORMAP sysColorMap;
+    COLORMAP internalColorMap[4] =
+	{{0x000000, 0}, {0x808080, 0}, {0xC0C0C0, 0}, {0xFFFFFF, 0}};
 
-    FIXME (commctrl, "semi-stub!\n");
+    /* initialize pointer to colortable and default color table */
+    if (lpColorMap) {
+	iMaps = iNumMaps;
+	sysColorMap = lpColorMap;
+    }
+    else {
+	internalColorMap[0].to = GetSysColor32 (COLOR_BTNTEXT);
+	internalColorMap[1].to = GetSysColor32 (COLOR_BTNSHADOW);
+	internalColorMap[2].to = GetSysColor32 (COLOR_BTNFACE);
+	internalColorMap[3].to = GetSysColor32 (COLOR_BTNHIGHLIGHT);
+	iMaps = 4;
+	sysColorMap = (LPCOLORMAP)internalColorMap;
+    }
 
-    hbm = LoadBitmap32A (hInstance, MAKEINTRESOURCE32A(idBitmap));
+    hRsrc = FindResource32A (hInstance, (LPSTR)idBitmap, RT_BITMAP32A);
+    if (hRsrc == NULL)
+	return NULL;
+    hglb = LoadResource32 (hInstance, hRsrc);
+    if (hglb == NULL)
+	return NULL;
+    lpBitmap = (LPBITMAPINFOHEADER)LockResource32 (hglb);
+    if (lpBitmap == NULL)
+	return NULL;
+
+    nColorTableSize = (1 << lpBitmap->biBitCount);
+    nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD);
+    lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc32 (GMEM_FIXED, nSize);
+    if (lpBitmapInfo == NULL)
+	return NULL;
+    RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize);
+
+    pColorTable = (DWORD*)(((LPBYTE)lpBitmapInfo)+(UINT32)lpBitmapInfo->biSize);
+
+    for (iColor = 0; iColor < nColorTableSize; iColor++) {
+	for (i = 0; i < iMaps; i++) {
+	    if (pColorTable[iColor] == sysColorMap[i].from) {
+#if 0
+		if (wFlags & CBS_MASKED) {
+		    if (sysColorMap[i].to != COLOR_BTNTEXT)
+			pColorTable[iColor] = RGB(255, 255, 255);
+		}
+		else
+#endif
+		    pColorTable[iColor] = sysColorMap[i].to;
+		break;
+	    }
+	}
+    }
+
+    nWidth  = (INT32)lpBitmapInfo->biWidth;
+    nHeight = (INT32)lpBitmapInfo->biHeight;
+    hdcScreen = GetDC32 (NULL);
+    hbm = CreateCompatibleBitmap32 (hdcScreen, nWidth, nHeight);
+    if (hbm) {
+	HDC32 hdcDst = CreateCompatibleDC32 (hdcScreen);
+	HBITMAP32 hbmOld = SelectObject32 (hdcDst, hbm);
+	LPBYTE lpBits = (LPBYTE)(lpBitmap + 1);
+	lpBits += (1 << (lpBitmapInfo->biBitCount)) * sizeof(RGBQUAD);
+	StretchDIBits32 (hdcDst, 0, 0, nWidth, nHeight, 0, 0, nWidth, nHeight,
+		         lpBits, (LPBITMAPINFO)lpBitmapInfo, DIB_RGB_COLORS,
+		         SRCCOPY);
+	SelectObject32 (hdcDst, hbmOld);
+	DeleteDC32 (hdcDst);
+    }
+    ReleaseDC32 (NULL, hdcScreen);
+    GlobalFree32 ((HGLOBAL32)lpBitmapInfo);
+    FreeResource32 (hglb);
 
     return hbm;
- }
+}
 
 
 /***********************************************************************
@@ -358,28 +476,61 @@
 VOID WINAPI
 GetEffectiveClientRect (HWND32 hwnd, LPRECT32 lpRect, LPINT32 lpInfo)
 {
-    RECT32 rcClient, rcCtrl;
-    INT32  idCtrl, *lpRun;
+    RECT32 rcCtrl;
+    INT32  *lpRun;
+    HWND32 hwndCtrl;
 
-    TRACE (commctrl, "hwnd=0x%08lx lpRect=0x%08lx lpInfo=0x%08lx\n",
+    TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n",
 	   (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo);
 
-    GetClientRect32 (hwnd, &rcClient);
-#if 0
+    GetClientRect32 (hwnd, lpRect);
     lpRun = lpInfo;
 
     do {
-	lpRun += 3;
-	idCtrl = *lpRun;
-	if (idCtrl) {
-	    TRACE (commctrl, "control id 0x%x\n", idCtrl);
-	    GetWindowRect32 (GetDlgItem32 (hwnd, idCtrl), &rcCtrl);
+	lpRun += 2;
+	if (*lpRun == 0)
+	    return;
+	lpRun++;
+	hwndCtrl = GetDlgItem32 (hwnd, *lpRun);
+	if (GetWindowLong32A (hwndCtrl, GWL_STYLE) & WS_VISIBLE) {
+	    TRACE (commctrl, "control id 0x%x\n", *lpRun);
+	    GetWindowRect32 (hwndCtrl, &rcCtrl);
 	    MapWindowPoints32 (NULL, hwnd, (LPPOINT32)&rcCtrl, 2);
-	    SubtractRect32 (&rcClient, &rcClient, &rcCtrl);
-	    lpRun++;
+	    SubtractRect32 (lpRect, lpRect, &rcCtrl);
 	}
-    } while (idCtrl);
+	lpRun++;
+    } while (*lpRun);
+}
+
+
+/***********************************************************************
+ * ShowHideMenuCtl [COMCTL32.3]
+ *
+ * PARAMS
+ *     hwnd   [I] handle to the client window.
+ *     uFlags [I] menu command id
+ *     lpInfo [I] pointer to an array of integers
+ *
+ * NOTES
+ */
+
+BOOL32 WINAPI
+ShowHideMenuCtl (HWND32 hwnd, UINT32 uFlags, LPINT32 lpInfo)
+{
+    FIXME (commctrl, "(0x%08x 0x%08x %p): empty stub!\n",
+	   hwnd, uFlags, lpInfo);
+#if 0
+    if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
+	/* checked -> hide control */
+
+    }
+    else {
+	/* not checked -> show control */
+
+    }
+
 #endif
-    CopyRect32 (lpRect, &rcClient);
+
+    return FALSE;
 }