[COMCTL32] Sync with Wine Staging 1.9.16. CORE-11866
[reactos.git] / reactos / dll / win32 / comctl32 / comctl32_ros.diff
1 diff -pudN e:\wine\dlls\comctl32/comctl32.h e:\reactos\dll\win32\comctl32/comctl32.h
2 --- e:\wine\dlls\comctl32/comctl32.h 2016-08-14 19:11:25 +0100
3 +++ e:\reactos\dll\win32\comctl32/comctl32.h 2014-03-05 11:47:40 +0100
4 @@ -53,67 +53,6 @@
5 extern HMODULE COMCTL32_hModule DECLSPEC_HIDDEN;
6 extern HBRUSH COMCTL32_hPattern55AABrush DECLSPEC_HIDDEN;
7
8 -/* Property sheet / Wizard */
9 -#define IDD_PROPSHEET 1006
10 -#define IDD_WIZARD 1020
11 -
12 -#define IDC_TABCONTROL 12320
13 -#define IDC_APPLY_BUTTON 12321
14 -#define IDC_BACK_BUTTON 12323
15 -#define IDC_NEXT_BUTTON 12324
16 -#define IDC_FINISH_BUTTON 12325
17 -#define IDC_SUNKEN_LINE 12326
18 -#define IDC_SUNKEN_LINEHEADER 12327
19 -
20 -#define IDS_CLOSE 4160
21 -
22 -/* Toolbar customization dialog */
23 -#define IDD_TBCUSTOMIZE 200
24 -
25 -#define IDC_AVAILBTN_LBOX 201
26 -#define IDC_RESET_BTN 202
27 -#define IDC_TOOLBARBTN_LBOX 203
28 -#define IDC_REMOVE_BTN 204
29 -#define IDC_HELP_BTN 205
30 -#define IDC_MOVEUP_BTN 206
31 -#define IDC_MOVEDN_BTN 207
32 -
33 -#define IDS_SEPARATOR 1024
34 -
35 -/* Toolbar imagelist bitmaps */
36 -#define IDB_STD_SMALL 120
37 -#define IDB_STD_LARGE 121
38 -#define IDB_VIEW_SMALL 124
39 -#define IDB_VIEW_LARGE 125
40 -#define IDB_HIST_SMALL 130
41 -#define IDB_HIST_LARGE 131
42 -
43 -#define IDM_TODAY 4163
44 -#define IDM_GOTODAY 4164
45 -
46 -/* Treeview Checkboxes */
47 -
48 -#define IDT_CHECK 401
49 -
50 -
51 -/* Cursors */
52 -#define IDC_MOVEBUTTON 102
53 -#define IDC_COPY 104
54 -#define IDC_DIVIDER 106
55 -#define IDC_DIVIDEROPEN 107
56 -
57 -
58 -/* DragList resources */
59 -#define IDI_DRAGARROW 501
60 -
61 -/* HOTKEY internal strings */
62 -#define HKY_NONE 2048
63 -
64 -/* Tooltip icons */
65 -#define IDI_TT_INFO_SM 22
66 -#define IDI_TT_WARN_SM 25
67 -#define IDI_TT_ERROR_SM 28
68 -
69 typedef struct
70 {
71 COLORREF clrBtnHighlight; /* COLOR_BTNHIGHLIGHT */
72 @@ -149,8 +88,6 @@ INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWST
73 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN;
74 BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN;
75
76 -#define COMCTL32_VERSION_MINOR 81
77 -
78 /* Our internal stack structure of the window procedures to subclass */
79 typedef struct _SUBCLASSPROCS {
80 SUBCLASSPROC subproc;
81 diff -pudN e:\wine\dlls\comctl32/commctrl.c e:\reactos\dll\win32\comctl32/commctrl.c
82 --- e:\wine\dlls\comctl32/commctrl.c 2016-08-14 19:11:25 +0100
83 +++ e:\reactos\dll\win32\comctl32/commctrl.c 2016-03-01 20:00:53 +0100
84 @@ -60,6 +60,19 @@
85
86 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
87
88 +#define NAME L"microsoft.windows.common-controls"
89 +#define VERSION L"6.0.2600.2982"
90 +#define PUBLIC_KEY L"6595b64144ccf1df"
91 +
92 +#ifdef __i386__
93 +#define ARCH L"x86"
94 +#elif defined __x86_64__
95 +#define ARCH L"amd64"
96 +#else
97 +#define ARCH L"none"
98 +#endif
99 +
100 +static const WCHAR manifest_filename[] = ARCH L"_" NAME L"_" PUBLIC_KEY L"_" VERSION L"_none_deadbeef.manifest";
101
102 static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
103
104 @@ -81,6 +94,67 @@ static const WCHAR strCC32SubclassInfo[]
105 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
106 };
107
108 +static BOOL create_manifest(BOOL install)
109 +{
110 + WCHAR *pwszBuf;
111 + HRSRC hResInfo;
112 + HGLOBAL hResData;
113 + PVOID pManifest;
114 + DWORD cchBuf, cbManifest, cbWritten;
115 + HANDLE hFile;
116 + BOOL bRet = FALSE;
117 +
118 + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST);
119 + if (!hResInfo)
120 + return FALSE;
121 +
122 + cbManifest = SizeofResource(COMCTL32_hModule, hResInfo);
123 + if (!cbManifest)
124 + return FALSE;
125 +
126 + hResData = LoadResource(COMCTL32_hModule, hResInfo);
127 + if (!hResData)
128 + return FALSE;
129 +
130 + pManifest = LockResource(hResData);
131 + if (!pManifest)
132 + return FALSE;
133 +
134 + cchBuf = GetWindowsDirectoryW(NULL, 0) * sizeof(WCHAR) + sizeof(L"\\winsxs\\manifests\\") + sizeof(manifest_filename);
135 + pwszBuf = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchBuf * sizeof(WCHAR));
136 + if (!pwszBuf)
137 + return FALSE;
138 +
139 + GetWindowsDirectoryW(pwszBuf, cchBuf);
140 + lstrcatW(pwszBuf, L"\\winsxs");
141 + CreateDirectoryW(pwszBuf, NULL);
142 + lstrcatW(pwszBuf, L"\\manifests\\");
143 + CreateDirectoryW(pwszBuf, NULL);
144 + lstrcatW(pwszBuf, manifest_filename);
145 + if (install)
146 + {
147 + hFile = CreateFileW(pwszBuf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
148 + if (hFile != INVALID_HANDLE_VALUE)
149 + {
150 + if (WriteFile(hFile, pManifest, cbManifest, &cbWritten, NULL) && cbWritten == cbManifest)
151 + bRet = TRUE;
152 +
153 + CloseHandle(hFile);
154 +
155 + if (!bRet)
156 + DeleteFileW(pwszBuf);
157 + else
158 + TRACE("created %s\n", debugstr_w(pwszBuf));
159 + }
160 + }
161 + else
162 + bRet = DeleteFileW(pwszBuf);
163 +
164 + HeapFree(GetProcessHeap(), 0, pwszBuf);
165 +
166 + return bRet;
167 +}
168 +
169
170 /***********************************************************************
171 * DllMain [Internal]
172 @@ -917,6 +991,12 @@ HRESULT WINAPI DllGetVersion (DLLVERSION
173 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
174 {
175 TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
176 + if (!create_manifest(bInstall))
177 + {
178 + ERR("create_manifest failed!\n");
179 + return HRESULT_FROM_WIN32(GetLastError());
180 + }
181 +
182 return S_OK;
183 }
184
185 @@ -1580,33 +1660,114 @@ LRESULT WINAPI SetPathWordBreakProc(HWND
186 *
187 * Draw text with shadow.
188 */
189 -int WINAPI DrawShadowText(HDC hdc, LPCWSTR text, UINT length, RECT *rect, DWORD flags,
190 - COLORREF crText, COLORREF crShadow, int offset_x, int offset_y)
191 +int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags,
192 + COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
193 {
194 - int bkmode, ret;
195 - COLORREF clr;
196 - RECT r;
197 + COLORREF crOldText;
198 + RECT rcText;
199 + INT iRet, x, y, x2, y2;
200 + BYTE *pBits;
201 + HBITMAP hbm, hbmOld;
202 + BITMAPINFO bi;
203 + HDC hdcMem;
204 + HFONT hOldFont;
205 + BLENDFUNCTION bf;
206
207 - FIXME("(%p, %s, %d, %p, 0x%08x, 0x%08x, 0x%08x, %d, %d): semi-stub\n", hdc, debugstr_w(text),
208 - length, rect, flags, crText, crShadow, offset_x, offset_y);
209 + /* Create 32 bit DIB section for the shadow */
210 + ZeroMemory(&bi, sizeof(bi));
211 + bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
212 + bi.bmiHeader.biWidth = prc->right - prc->left + 4;
213 + bi.bmiHeader.biHeight = prc->bottom - prc->top + 5; // bottom-up DIB
214 + bi.bmiHeader.biPlanes = 1;
215 + bi.bmiHeader.biBitCount = 32;
216 + bi.bmiHeader.biCompression = BI_RGB;
217 + hbm = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (PVOID*)&pBits, NULL, 0);
218 + if(!hbm)
219 + {
220 + ERR("CreateDIBSection failed\n");
221 + return 0;
222 + }
223
224 - bkmode = SetBkMode(hdc, TRANSPARENT);
225 - clr = SetTextColor(hdc, crShadow);
226 + /* Create memory device context for new DIB section and select it */
227 + hdcMem = CreateCompatibleDC(hdc);
228 + if(!hdcMem)
229 + {
230 + ERR("CreateCompatibleDC failed\n");
231 + DeleteObject(hbm);
232 + return 0;
233 + }
234
235 - /* FIXME: for shadow we need to render normally, blur it, and blend with current background. */
236 - r = *rect;
237 - OffsetRect(&r, 1, 1);
238 - DrawTextW(hdc, text, length, &r, flags);
239 + hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
240
241 - SetTextColor(hdc, crText);
242 + /* Draw text on our helper bitmap */
243 + hOldFont = (HFONT)SelectObject(hdcMem, GetCurrentObject(hdc, OBJ_FONT));
244 + SetTextColor(hdcMem, RGB(16, 16, 16));
245 + SetBkColor(hdcMem, RGB(0, 0, 0));
246 + SetBkMode(hdcMem, TRANSPARENT);
247 + SetRect(&rcText, 0, 0, prc->right - prc->left, prc->bottom - prc->top);
248 + DrawTextW(hdcMem, pszText, cch, &rcText, dwFlags);
249 + SelectObject(hdcMem, hOldFont);
250
251 - /* with text color on top of a shadow */
252 - ret = DrawTextW(hdc, text, length, rect, flags);
253 + /* Flush GDI so data pointed by pBits is valid */
254 + GdiFlush();
255
256 - SetTextColor(hdc, clr);
257 - SetBkMode(hdc, bkmode);
258 + /* Set alpha of pixels (forget about colors for now. They will be changed in next loop).
259 + We copy text image 4*5 times and each time alpha is added */
260 + for (x = 0; x < bi.bmiHeader.biWidth; ++x)
261 + for (y = 0; y < bi.bmiHeader.biHeight; ++y)
262 + {
263 + BYTE *pDest = &pBits[(y * bi.bmiHeader.biWidth + x) * 4];
264 + UINT Alpha = 0;
265
266 - return ret;
267 + for (x2 = x - 4 + 1; x2 <= x; ++x2)
268 + for (y2 = y; y2 < y + 5; ++y2)
269 + {
270 + if (x2 >= 0 && x2 < bi.bmiHeader.biWidth && y2 >= 0 && y2 < bi.bmiHeader.biHeight)
271 + {
272 + BYTE *pSrc = &pBits[(y2 * bi.bmiHeader.biWidth + x2) * 4];
273 + Alpha += pSrc[0];
274 + }
275 + }
276 +
277 + if (Alpha > 255)
278 + Alpha = 255;
279 + pDest[3] = Alpha;
280 + }
281 +
282 + /* Now set the color of each pixel to shadow color * alpha (see GdiAlphaBlend) */
283 + for (x = 0; x < bi.bmiHeader.biWidth; ++x)
284 + for (y = 0; y < bi.bmiHeader.biHeight; ++y)
285 + {
286 + BYTE *pDest = &pBits[(y * bi.bmiHeader.biWidth + x) * 4];
287 + pDest[0] = GetBValue(crShadow) * pDest[3] / 255;
288 + pDest[1] = GetGValue(crShadow) * pDest[3] / 255;
289 + pDest[2] = GetRValue(crShadow) * pDest[3] / 255;
290 + }
291 +
292 + /* Fix ixOffset of the shadow (tested on Win) */
293 + ixOffset -= 3;
294 + iyOffset -= 3;
295 +
296 + /* Alpha blend helper image to destination DC */
297 + bf.BlendOp = AC_SRC_OVER;
298 + bf.BlendFlags = 0;
299 + bf.SourceConstantAlpha = 255;
300 + bf.AlphaFormat = AC_SRC_ALPHA;
301 + if (!GdiAlphaBlend(hdc, prc->left + ixOffset, prc->top + iyOffset, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight, hdcMem, 0, 0, bi.bmiHeader.biWidth, bi.bmiHeader.biHeight, bf))
302 + ERR("GdiAlphaBlend failed: %lu\n", GetLastError());
303 +
304 + /* Delete the helper bitmap */
305 + SelectObject(hdcMem, hbmOld);
306 + DeleteObject(hbm);
307 + DeleteDC(hdcMem);
308 +
309 + /* Finally draw the text over shadow */
310 + crOldText = SetTextColor(hdc, crText);
311 + SetBkMode(hdc, TRANSPARENT);
312 + iRet = DrawTextW(hdc, pszText, cch, prc, dwFlags);
313 + SetTextColor(hdc, crOldText);
314 +
315 + return iRet;
316 }
317
318 /***********************************************************************
319 @@ -1695,3 +1856,15 @@ HRESULT WINAPI LoadIconMetric(HINSTANCE
320
321 return LoadIconWithScaleDown(hinst, name, cx, cy, icon);
322 }
323 +
324 +/***********************************************************************
325 + * RegisterClassNameW [COMCTL32.@]
326 + *
327 + * Register window class again while using as SxS module.
328 + */
329 +BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className)
330 +{
331 + /* FIXME: actually register redirected user32 class,
332 + comctl32 classes are registered by this module anyway */
333 + return TRUE;
334 +}
335 diff -pudN e:\wine\dlls\comctl32/imagelist.c e:\reactos\dll\win32\comctl32/imagelist.c
336 --- e:\wine\dlls\comctl32/imagelist.c 2016-08-14 19:11:25 +0100
337 +++ e:\reactos\dll\win32\comctl32/imagelist.c 2016-08-18 12:03:13 +0100
338 @@ -33,7 +33,7 @@
339 *
340 * TODO:
341 * - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
342 - * - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE
343 + * - Add support for ILS_GLOW, ILS_SHADOW
344 * - Thread-safe locking
345 */
346
347 @@ -1229,8 +1229,11 @@ ImageList_DrawEx (HIMAGELIST himl, INT i
348 return ImageList_DrawIndirect (&imldp);
349 }
350
351 -
352 +#ifdef __REACTOS__
353 +static BOOL alpha_blend_image( HIMAGELIST himl, HDC srce_dc, HDC dest_dc, int dest_x, int dest_y,
354 +#else
355 static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
356 +#endif
357 int src_x, int src_y, int cx, int cy, BLENDFUNCTION func,
358 UINT style, COLORREF blend_col )
359 {
360 @@ -1255,9 +1258,17 @@ static BOOL alpha_blend_image( HIMAGELIS
361 info->bmiHeader.biYPelsPerMeter = 0;
362 info->bmiHeader.biClrUsed = 0;
363 info->bmiHeader.biClrImportant = 0;
364 +#ifdef __REACTOS__
365 + if (!(bmp = CreateDIBSection( srce_dc, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
366 +#else
367 if (!(bmp = CreateDIBSection( himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
368 +#endif
369 SelectObject( hdc, bmp );
370 +#ifdef __REACTOS__
371 + BitBlt( hdc, 0, 0, cx, cy, srce_dc, src_x, src_y, SRCCOPY );
372 +#else
373 BitBlt( hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY );
374 +#endif
375
376 if (blend_col != CLR_NONE)
377 {
378 @@ -1330,6 +1341,68 @@ done:
379 return ret;
380 }
381
382 +#ifdef __REACTOS__
383 +HDC saturate_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int dest_y,
384 + int src_x, int src_y, int cx, int cy, COLORREF rgbFg)
385 +{
386 + HDC hdc = NULL;
387 + HBITMAP bmp = 0;
388 + BITMAPINFO *info;
389 +
390 + unsigned int *ptr;
391 + void *bits;
392 + int i;
393 +
394 + /* create a dc and its device independent bitmap for doing the work,
395 + shamelessly copied from the alpha-blending function above */
396 + if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
397 + if (!(info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
398 + info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
399 + info->bmiHeader.biWidth = cx;
400 + info->bmiHeader.biHeight = cy;
401 + info->bmiHeader.biPlanes = 1;
402 + info->bmiHeader.biBitCount = 32;
403 + info->bmiHeader.biCompression = BI_RGB;
404 + info->bmiHeader.biSizeImage = cx * cy * 4;
405 + info->bmiHeader.biXPelsPerMeter = 0;
406 + info->bmiHeader.biYPelsPerMeter = 0;
407 + info->bmiHeader.biClrUsed = 0;
408 + info->bmiHeader.biClrImportant = 0;
409 + if (!(bmp = CreateDIBSection(himl->hdcImage, info, DIB_RGB_COLORS, &bits, 0, 0 ))) goto done;
410 +
411 + /* bind both surfaces */
412 + SelectObject(hdc, bmp);
413 +
414 + /* copy into our dc the section that covers just the icon we we're asked for */
415 + BitBlt(hdc, 0, 0, cx, cy, himl->hdcImage, src_x, src_y, SRCCOPY);
416 +
417 + /* loop every pixel of the bitmap */
418 + for (i = 0, ptr = bits; i < cx * cy; i++, ptr++)
419 + {
420 + COLORREF orig_color = *ptr;
421 +
422 + /* calculate the effective luminance using the constants from here, adapted to the human eye:
423 + <http://bobpowell.net/grayscale.aspx> */
424 + float mixed_color = (GetRValue(orig_color) * .30 +
425 + GetGValue(orig_color) * .59 +
426 + GetBValue(orig_color) * .11);
427 +
428 + *ptr = RGBA(mixed_color, mixed_color, mixed_color, GetAValue(orig_color));
429 + }
430 +
431 +done:
432 +
433 + if (bmp)
434 + DeleteObject(bmp);
435 +
436 + if (info)
437 + HeapFree(GetProcessHeap(), 0, info);
438 +
439 + /* return the handle to our desaturated dc, that will substitute its original counterpart in the next calls */
440 + return hdc;
441 +}
442 +#endif /* __REACTOS__ */
443 +
444 /*************************************************************************
445 * ImageList_DrawIndirect [COMCTL32.@]
446 *
447 @@ -1406,6 +1479,23 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
448 oldImageFg = SetTextColor( hImageDC, RGB( 0, 0, 0 ) );
449 oldImageBk = SetBkColor( hImageDC, RGB( 0xff, 0xff, 0xff ) );
450
451 +#ifdef __REACTOS__
452 + /*
453 + * If the ILS_SATURATE bit is enabled we should multiply the
454 + * RGB colors of the original image by the contents of rgbFg.
455 + */
456 + if (fState & ILS_SATURATE)
457 + {
458 + hImageListDC = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
459 + pt.x, pt.y, cx, cy, pimldp->rgbFg);
460 +
461 + /* shitty way of getting subroutines to blit at the right place (top left corner),
462 + as our modified imagelist only contains a single image for performance reasons */
463 + pt.x = 0;
464 + pt.y = 0;
465 + }
466 +#endif
467 +
468 has_alpha = (himl->has_alpha && himl->has_alpha[pimldp->i]);
469 if (!bMask && (has_alpha || (fState & ILS_ALPHA)))
470 {
471 @@ -1426,7 +1516,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
472
473 if (bIsTransparent)
474 {
475 +#ifdef __REACTOS__
476 + bResult = alpha_blend_image( himl, hImageListDC, pimldp->hdcDst, pimldp->x, pimldp->y,
477 +#else
478 bResult = alpha_blend_image( himl, pimldp->hdcDst, pimldp->x, pimldp->y,
479 +#endif
480 pt.x, pt.y, cx, cy, func, fStyle, blend_col );
481 goto end;
482 }
483 @@ -1436,7 +1530,11 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
484
485 hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour));
486 PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY );
487 +#ifdef __REACTOS__
488 + alpha_blend_image( himl, hImageListDC, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
489 +#else
490 alpha_blend_image( himl, hImageDC, 0, 0, pt.x, pt.y, cx, cy, func, fStyle, blend_col );
491 +#endif
492 DeleteObject (SelectObject (hImageDC, hOldBrush));
493 bResult = BitBlt( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCCOPY );
494 goto end;
495 @@ -1530,7 +1628,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPAR
496 }
497 }
498
499 +#ifndef __REACTOS__
500 if (fState & ILS_SATURATE) FIXME("ILS_SATURATE: unimplemented!\n");
501 +#endif
502 if (fState & ILS_GLOW) FIXME("ILS_GLOW: unimplemented!\n");
503 if (fState & ILS_SHADOW) FIXME("ILS_SHADOW: unimplemented!\n");
504
505 Common subdirectories: e:\wine\dlls\comctl32/lang and e:\reactos\dll\win32\comctl32/lang
506 diff -pudN e:\wine\dlls\comctl32/listview.c e:\reactos\dll\win32\comctl32/listview.c
507 --- e:\wine\dlls\comctl32/listview.c 2016-08-14 19:11:25 +0100
508 +++ e:\reactos\dll\win32\comctl32/listview.c 2016-08-18 12:03:13 +0100
509 @@ -287,6 +287,9 @@ typedef struct tagLISTVIEW_INFO
510 COLORREF clrBk;
511 COLORREF clrText;
512 COLORREF clrTextBk;
513 +#ifdef __REACTOS__
514 + BOOL bDefaultBkColor;
515 +#endif
516
517 /* font */
518 HFONT hDefaultFont;
519 @@ -1696,8 +1699,24 @@ static inline BOOL LISTVIEW_GetItemW(con
520 /* used to handle collapse main item column case */
521 static inline BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
522 {
523 +#ifdef __REACTOS__
524 + BOOL Ret = FALSE;
525 +
526 + if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
527 + {
528 + DWORD dwOldBkColor, dwOldTextColor;
529 +
530 + dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
531 + dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
532 + Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
533 + SetBkColor(hdc, dwOldBkColor);
534 + SetBkColor(hdc, dwOldTextColor);
535 + }
536 + return Ret;
537 +#else
538 return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
539 DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
540 +#endif
541 }
542
543 /* Listview invalidation functions: use _only_ these functions to invalidate */
544 @@ -4688,7 +4707,12 @@ static void LISTVIEW_DrawItemPart(LISTVI
545 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
546 rcLabel.bottom--;
547
548 - DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
549 +#ifdef __REACTOS__
550 + if ((!(item->state & LVIS_SELECTED) || !infoPtr->bFocus) && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT))
551 + DrawShadowText(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2);
552 + else
553 +#endif
554 + DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
555 }
556
557 /***
558 @@ -5232,7 +5256,11 @@ enddraw:
559
560 /* Draw marquee rectangle if appropriate */
561 if (infoPtr->bMarqueeSelect)
562 + {
563 + SetBkColor(hdc, RGB(255, 255, 255));
564 + SetTextColor(hdc, RGB(0, 0, 0));
565 DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
566 + }
567
568 if (cdmode & CDRF_NOTIFYPOSTPAINT)
569 notify_postpaint(infoPtr, &nmlvcd);
570 @@ -8035,6 +8063,9 @@ static BOOL LISTVIEW_SetBkColor(LISTVIEW
571 {
572 TRACE("(color=%x)\n", color);
573
574 +#ifdef __REACTOS__
575 + infoPtr->bDefaultBkColor = FALSE;
576 +#endif
577 if(infoPtr->clrBk != color) {
578 if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
579 infoPtr->clrBk = color;
580 @@ -8710,7 +8741,7 @@ static DWORD LISTVIEW_SetIconSpacing(LIS
581 return oldspacing;
582 }
583
584 -static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL small)
585 +static inline void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small)
586 {
587 INT cx, cy;
588
589 @@ -8721,8 +8752,8 @@ static inline void set_icon_size(SIZE *s
590 }
591 else
592 {
593 - size->cx = GetSystemMetrics(small ? SM_CXSMICON : SM_CXICON);
594 - size->cy = GetSystemMetrics(small ? SM_CYSMICON : SM_CYICON);
595 + size->cx = GetSystemMetrics(is_small ? SM_CXSMICON : SM_CXICON);
596 + size->cy = GetSystemMetrics(is_small ? SM_CYSMICON : SM_CYICON);
597 }
598 }
599
600 @@ -9458,6 +9489,9 @@ static LRESULT LISTVIEW_NCCreate(HWND hw
601 infoPtr->clrText = CLR_DEFAULT;
602 infoPtr->clrTextBk = CLR_DEFAULT;
603 LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow);
604 +#ifdef __REACTOS__
605 + infoPtr->bDefaultBkColor = TRUE;
606 +#endif
607
608 /* set default values */
609 infoPtr->nFocusedItem = -1;
610 @@ -11741,6 +11775,14 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg
611
612 case WM_SYSCOLORCHANGE:
613 COMCTL32_RefreshSysColors();
614 +#ifdef __REACTOS__
615 + if (infoPtr->bDefaultBkColor)
616 + {
617 + LISTVIEW_SetBkColor(infoPtr, comctl32_color.clrWindow);
618 + infoPtr->bDefaultBkColor = TRUE;
619 + LISTVIEW_InvalidateList(infoPtr);
620 + }
621 +#endif
622 return 0;
623
624 /* case WM_TIMER: */
625 diff -pudN e:\wine\dlls\comctl32/monthcal.c e:\reactos\dll\win32\comctl32/monthcal.c
626 --- e:\wine\dlls\comctl32/monthcal.c 2016-08-14 19:11:25 +0100
627 +++ e:\reactos\dll\win32\comctl32/monthcal.c 2016-08-18 12:03:13 +0100
628 @@ -43,6 +43,9 @@
629
630 WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
631
632 +/* FIXME: Inspect */
633 +#define MCS_NOSELCHANGEONNAV 0x0100
634 +
635 #define MC_SEL_LBUTUP 1 /* Left button released */
636 #define MC_SEL_LBUTDOWN 2 /* Left button pressed in calendar */
637 #define MC_PREVPRESSED 4 /* Prev month button pressed */
638 diff -pudN e:\wine\dlls\comctl32/propsheet.c e:\reactos\dll\win32\comctl32/propsheet.c
639 --- e:\wine\dlls\comctl32/propsheet.c 2016-08-14 19:11:25 +0100
640 +++ e:\reactos\dll\win32\comctl32/propsheet.c 2016-08-18 12:03:14 +0100
641 @@ -2355,12 +2355,19 @@ static void PROPSHEET_SetWizButtons(HWND
642 HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON);
643 BOOL enable_finish = ((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH);
644
645 +#ifdef __REACTOS__
646 + HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL);
647 + INT iDefItem = 0;
648 + HWND hwndFocus;
649 +#endif
650 +
651 TRACE("%d\n", dwFlags);
652
653 EnableWindow(hwndBack, dwFlags & PSWIZB_BACK);
654 EnableWindow(hwndNext, dwFlags & PSWIZB_NEXT);
655 EnableWindow(hwndFinish, enable_finish);
656
657 +#ifndef __REACTOS__
658 /* set the default pushbutton to an enabled button */
659 if (enable_finish)
660 SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0);
661 @@ -2370,6 +2377,7 @@ static void PROPSHEET_SetWizButtons(HWND
662 SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0);
663 else
664 SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0);
665 +#endif
666
667 if (!psInfo->hasFinish)
668 {
669 @@ -2389,6 +2397,25 @@ static void PROPSHEET_SetWizButtons(HWND
670 ShowWindow(hwndNext, SW_SHOW);
671 }
672 }
673 +
674 +#ifdef __REACTOS__
675 + /* set the default pushbutton to an enabled button */
676 + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH))
677 + iDefItem = IDC_FINISH_BUTTON;
678 + else if (dwFlags & PSWIZB_NEXT)
679 + iDefItem = IDC_NEXT_BUTTON;
680 + else if (dwFlags & PSWIZB_BACK)
681 + iDefItem = IDC_BACK_BUTTON;
682 + else
683 + iDefItem = IDCANCEL;
684 + SendMessageW(hwndDlg, DM_SETDEFID, iDefItem, 0);
685 +
686 + /* Set focus if no control has it */
687 + hwndFocus = GetFocus();
688 + if (!hwndFocus || hwndFocus == hwndCancel)
689 + SetFocus(GetDlgItem(hwndDlg, iDefItem));
690 +#endif
691 +
692 }
693
694 /******************************************************************************
695 diff -pudN e:\wine\dlls\comctl32/rebar.c e:\reactos\dll\win32\comctl32/rebar.c
696 --- e:\wine\dlls\comctl32/rebar.c 2016-08-14 19:11:25 +0100
697 +++ e:\reactos\dll\win32\comctl32/rebar.c 2016-08-18 12:03:14 +0100
698 @@ -50,7 +50,6 @@
699 * - WM_QUERYNEWPALETTE
700 * - WM_RBUTTONDOWN
701 * - WM_RBUTTONUP
702 - * - WM_SYSCOLORCHANGE
703 * - WM_VKEYTOITEM
704 * - WM_WININICHANGE
705 * Notifications:
706 @@ -1819,16 +1818,43 @@ static LRESULT REBAR_EraseBkGnd (const R
707 RECT cr;
708 COLORREF old = CLR_NONE, new;
709 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
710 +#ifdef __REACTOS__
711 + HRGN hrgn;
712 +#endif
713
714 GetClientRect (infoPtr->hwndSelf, &cr);
715
716 +#ifdef __REACTOS__
717 +
718 + if (theme)
719 + {
720 + if (IsThemeBackgroundPartiallyTransparent(theme, RP_BACKGROUND, 0))
721 + {
722 + DrawThemeParentBackground (infoPtr->hwndSelf, hdc, &cr);
723 + }
724 + DrawThemeBackground (theme, hdc, 0, 0, &cr, NULL);
725 + }
726 +
727 + hrgn = CreateRectRgn(cr.left, cr.top, cr.right, cr.bottom);
728 +
729 +#endif
730 +
731 oldrow = -1;
732 for(i=0; i<infoPtr->uNumBands; i++) {
733 RECT rcBand;
734 +#ifdef __REACTOS__
735 + RECT rcBandReal;
736 + HRGN hrgnBand;
737 +#endif
738 +
739 lpBand = REBAR_GetBand(infoPtr, i);
740 if (HIDDENBAND(lpBand)) continue;
741 translate_rect(infoPtr, &rcBand, &lpBand->rcBand);
742
743 +#ifdef __REACTOS__
744 + rcBandReal = rcBand;
745 +#endif
746 +
747 /* draw band separator between rows */
748 if (lpBand->iRow != oldrow) {
749 oldrow = lpBand->iRow;
750 @@ -1853,6 +1879,9 @@ static LRESULT REBAR_EraseBkGnd (const R
751 }
752 TRACE ("drawing band separator bottom (%s)\n",
753 wine_dbgstr_rect(&rcRowSep));
754 +#ifdef __REACTOS__
755 + rcBandReal = rcRowSep;
756 +#endif
757 }
758 }
759
760 @@ -1863,6 +1892,9 @@ static LRESULT REBAR_EraseBkGnd (const R
761 if (infoPtr->dwStyle & CCS_VERT) {
762 rcSep.bottom = rcSep.top;
763 rcSep.top -= SEP_WIDTH_SIZE;
764 +#ifdef __REACTOS__
765 + rcBandReal.top -= SEP_WIDTH_SIZE;
766 +#endif
767 if (theme)
768 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_BOTTOM, NULL);
769 else
770 @@ -1871,6 +1903,9 @@ static LRESULT REBAR_EraseBkGnd (const R
771 else {
772 rcSep.right = rcSep.left;
773 rcSep.left -= SEP_WIDTH_SIZE;
774 +#ifdef __REACTOS__
775 + rcBandReal.left -= SEP_WIDTH_SIZE;
776 +#endif
777 if (theme)
778 DrawThemeEdge (theme, hdc, RP_BAND, 0, &rcSep, EDGE_ETCHED, BF_RIGHT, NULL);
779 else
780 @@ -1901,6 +1936,9 @@ static LRESULT REBAR_EraseBkGnd (const R
781 #endif
782 }
783
784 +#ifdef __REACTOS__
785 + if (!theme)
786 +#else
787 if (theme)
788 {
789 /* When themed, the background color is ignored (but not a
790 @@ -1908,6 +1946,7 @@ static LRESULT REBAR_EraseBkGnd (const R
791 DrawThemeBackground (theme, hdc, 0, 0, &cr, &rcBand);
792 }
793 else
794 +#endif
795 {
796 old = SetBkColor (hdc, new);
797 TRACE("%s background color=0x%06x, band %s\n",
798 @@ -1918,7 +1957,26 @@ static LRESULT REBAR_EraseBkGnd (const R
799 if (lpBand->clrBack != CLR_NONE)
800 SetBkColor (hdc, old);
801 }
802 +
803 +#ifdef __REACTOS__
804 + hrgnBand = CreateRectRgn(rcBandReal.left, rcBandReal.top, rcBandReal.right, rcBandReal.bottom);
805 + CombineRgn(hrgn, hrgn, hrgnBand, RGN_DIFF);
806 + DeleteObject(hrgnBand);
807 +#endif
808 }
809 +
810 +#if 1
811 +#ifdef __REACTOS__
812 + if (!theme)
813 +#endif
814 + {
815 + //FIXME: Apparently painting the remaining area is a v6 feature
816 + HBRUSH hbrush = CreateSolidBrush(new);
817 + FillRgn(hdc, hrgn, hbrush);
818 + DeleteObject(hbrush);
819 + DeleteObject(hrgn);
820 + }
821 +#endif
822 return TRUE;
823 }
824
825 @@ -2887,12 +2945,26 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, INT
826
827
828 static LRESULT
829 +#ifdef __REACTOS__
830 +REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM flags, RECT *lpRect)
831 +#else
832 REBAR_SizeToRect (REBAR_INFO *infoPtr, const RECT *lpRect)
833 +#endif
834 {
835 if (!lpRect) return FALSE;
836
837 TRACE("[%s]\n", wine_dbgstr_rect(lpRect));
838 REBAR_SizeToHeight(infoPtr, get_rect_cy(infoPtr, lpRect));
839 +
840 +#ifdef __REACTOS__
841 + /* Note that this undocumented flag is available on comctl32 v6 or later */
842 + if ((flags & RBSTR_CHANGERECT) != 0)
843 + {
844 + RECT rcRebar;
845 + GetClientRect(infoPtr->hwndSelf, &rcRebar);
846 + lpRect->bottom = lpRect->top + (rcRebar.bottom - rcRebar.top);
847 + }
848 +#endif
849 return TRUE;
850 }
851
852 @@ -3199,7 +3271,11 @@ REBAR_NCCalcSize (const REBAR_INFO *info
853 else if ((theme = GetWindowTheme (infoPtr->hwndSelf)))
854 {
855 /* FIXME: should use GetThemeInt */
856 +#ifdef __REACTOS__
857 + rect->top = (rect->top + 1 < rect->bottom) ? rect->top : rect->bottom;
858 +#else
859 rect->top = min(rect->top + 1, rect->bottom);
860 +#endif
861 }
862 TRACE("new client=(%s)\n", wine_dbgstr_rect(rect));
863 return 0;
864 @@ -3300,7 +3376,11 @@ REBAR_NCHitTest (const REBAR_INFO *infoP
865 (INT *)&nmmouse.dwItemSpec);
866 nmmouse.dwItemData = 0;
867 nmmouse.pt = clpt;
868 +#ifdef __REACTOS__
869 + nmmouse.dwHitInfo = scrap;
870 +#else
871 nmmouse.dwHitInfo = 0;
872 +#endif
873 if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
874 TRACE("notify changed return value from %ld to %d\n",
875 ret, i);
876 @@ -3372,6 +3452,9 @@ REBAR_Paint (const REBAR_INFO *infoPtr,
877 {
878 if (hdc) {
879 TRACE("painting\n");
880 +#ifdef __REACTOS__
881 + REBAR_EraseBkGnd (infoPtr, hdc);
882 +#endif
883 REBAR_Refresh (infoPtr, hdc);
884 } else {
885 PAINTSTRUCT ps;
886 @@ -3650,7 +3733,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
887 return REBAR_ShowBand (infoPtr, wParam, lParam);
888
889 case RB_SIZETORECT:
890 +#ifdef __REACTOS__
891 + return REBAR_SizeToRect (infoPtr, wParam, (LPRECT)lParam);
892 +#else
893 return REBAR_SizeToRect (infoPtr, (LPCRECT)lParam);
894 +#endif
895
896
897 /* Messages passed to parent */
898 @@ -3733,6 +3820,11 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg,
899
900 case WM_SYSCOLORCHANGE:
901 COMCTL32_RefreshSysColors();
902 +#ifdef __REACTOS__
903 + /* r51522 - Properly support WM_SYSCOLORCHANGE */
904 + infoPtr->clrBtnText = comctl32_color.clrBtnText;
905 + infoPtr->clrBtnFace = comctl32_color.clrBtnFace;
906 +#endif
907 return 0;
908
909 /* case WM_VKEYTOITEM: supported according to ControlSpy */
910 diff -pudN e:\wine\dlls\comctl32/toolbar.c e:\reactos\dll\win32\comctl32/toolbar.c
911 --- e:\wine\dlls\comctl32/toolbar.c 2016-08-14 19:11:25 +0100
912 +++ e:\reactos\dll\win32\comctl32/toolbar.c 2016-08-18 12:03:14 +0100
913 @@ -33,11 +33,9 @@
914 * - TBSTYLE_REGISTERDROP
915 * - TBSTYLE_EX_DOUBLEBUFFER
916 * - Messages:
917 - * - TB_GETMETRICS
918 * - TB_GETOBJECT
919 * - TB_INSERTMARKHITTEST
920 * - TB_SAVERESTORE
921 - * - TB_SETMETRICS
922 * - WM_WININICHANGE
923 * - Notifications:
924 * - NM_CHAR
925 @@ -125,6 +123,10 @@ typedef struct
926 INT nOldHit;
927 INT nHotItem; /* index of the "hot" item */
928 SIZE szPadding; /* padding values around button */
929 +#ifdef __REACTOS__
930 + SIZE szBarPadding; /* padding values around the toolbar (NOT USED BUT STORED) */
931 + SIZE szSpacing; /* spacing values between buttons */
932 +#endif
933 INT iTopMargin; /* the top margin */
934 INT iListGap; /* default gap between text and image for toolbar with list style */
935 HFONT hDefaultFont;
936 @@ -190,12 +192,24 @@ typedef enum
937 #define ARROW_HEIGHT 3
938 #define INSERTMARK_WIDTH 2
939
940 +/* default padding inside a button */
941 #define DEFPAD_CX 7
942 #define DEFPAD_CY 6
943 +
944 +#ifdef __REACTOS__
945 +/* default space between buttons and between rows */
946 +#define DEFSPACE_CX 7
947 +#define DEFSPACE_CY 6
948 +#endif
949 +
950 #define DEFLISTGAP 4
951
952 /* vertical padding used in list mode when image is present */
953 +#ifdef __REACTOS__
954 +#define LISTPAD_CY 2
955 +#else
956 #define LISTPAD_CY 9
957 +#endif
958
959 /* how wide to treat the bitmap if it isn't present */
960 #define NONLIST_NOTEXT_OFFSET 2
961 @@ -239,7 +253,12 @@ static LRESULT TOOLBAR_SetButtonInfo(TOO
962
963 static inline int default_top_margin(const TOOLBAR_INFO *infoPtr)
964 {
965 +#ifndef __REACTOS__
966 return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
967 +#else /* r65766 */
968 + /* This is the behaviour in comctl32 v6 */
969 + return 0;
970 +#endif
971 }
972
973 static inline BOOL TOOLBAR_HasDropDownArrows(DWORD exStyle)
974 @@ -723,10 +742,14 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
975 const NMTBCUSTOMDRAW *tbcd, DWORD dwItemCDFlag)
976 {
977 HIMAGELIST himl = NULL;
978 - BOOL draw_masked = FALSE;
979 + BOOL draw_masked = FALSE, draw_desaturated = FALSE;
980 INT index;
981 INT offset = 0;
982 UINT draw_flags = ILD_TRANSPARENT;
983 +#ifdef __REACTOS__
984 + IMAGEINFO info = {0};
985 + BITMAP bm = {0};
986 +#endif
987
988 if (tbcd->nmcd.uItemState & (CDIS_DISABLED | CDIS_INDETERMINATE))
989 {
990 @@ -734,7 +757,22 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
991 if (!himl)
992 {
993 himl = TOOLBAR_GetImageListForDrawing(infoPtr, btnPtr, IMAGE_LIST_DEFAULT, &index);
994 +
995 +#ifdef __REACTOS__
996 + ImageList_GetImageInfo(himl, index, &info);
997 + GetObjectW(info.hbmImage, sizeof(bm), &bm);
998 +
999 + if (bm.bmBitsPixel == 32)
1000 + {
1001 + draw_desaturated = TRUE;
1002 + }
1003 + else
1004 + {
1005 + draw_masked = TRUE;
1006 + }
1007 +#else
1008 draw_masked = TRUE;
1009 +#endif
1010 }
1011 }
1012 else if (tbcd->nmcd.uItemState & CDIS_CHECKED ||
1013 @@ -765,9 +803,34 @@ TOOLBAR_DrawImage(const TOOLBAR_INFO *in
1014 index, himl, left, top, offset);
1015
1016 if (draw_masked)
1017 + {
1018 + /* code path for drawing flat disabled icons without alpha channel */
1019 TOOLBAR_DrawMasked (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
1020 + }
1021 + else if (draw_desaturated)
1022 + {
1023 + /* code path for drawing disabled, alpha-blended (32bpp) icons */
1024 + IMAGELISTDRAWPARAMS imldp = {0};
1025 +
1026 + imldp.cbSize = sizeof(imldp);
1027 + imldp.himl = himl;
1028 + imldp.i = index;
1029 + imldp.hdcDst = tbcd->nmcd.hdc,
1030 + imldp.x = offset + left;
1031 + imldp.y = offset + top;
1032 + imldp.rgbBk = CLR_NONE;
1033 + imldp.rgbFg = CLR_DEFAULT;
1034 + imldp.fStyle = ILD_TRANSPARENT;
1035 + imldp.fState = ILS_ALPHA | ILS_SATURATE;
1036 + imldp.Frame = 192;
1037 +
1038 + ImageList_DrawIndirect (&imldp);
1039 + }
1040 else
1041 + {
1042 + /* code path for drawing standard icons as-is */
1043 ImageList_Draw (himl, index, tbcd->nmcd.hdc, left + offset, top + offset, draw_flags);
1044 + }
1045 }
1046
1047 /* draws a blank frame for a toolbar button */
1048 @@ -884,14 +947,15 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
1049 InflateRect(&rcsep, -infoPtr->szPadding.cx, -infoPtr->szPadding.cy);
1050 TOOLBAR_DrawFlatHorizontalSeparator (&rcsep, hdc, infoPtr);
1051 }
1052 - else
1053 - TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1054 - }
1055 - else if (btnPtr->fsStyle != BTNS_SEP) {
1056 - FIXME("Draw some kind of separator: fsStyle=%x\n",
1057 - btnPtr->fsStyle);
1058 - }
1059 - return;
1060 + else {
1061 + TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr);
1062 + }
1063 + }
1064 + else if (btnPtr->fsStyle != BTNS_SEP) {
1065 + FIXME("Draw some kind of separator: fsStyle=%x\n",
1066 + btnPtr->fsStyle);
1067 + }
1068 + return;
1069 }
1070
1071 /* get a pointer to the text */
1072 @@ -1027,7 +1091,11 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
1073 }
1074 }
1075
1076 +#ifdef __REACTOS__
1077 + if (theme && !(dwItemCDFlag & TBCDRF_NOBACKGROUND))
1078 +#else
1079 if (theme)
1080 +#endif
1081 {
1082 int partId = drawSepDropDownArrow ? TP_SPLITBUTTON : TP_BUTTON;
1083 int stateId = TS_NORMAL;
1084 @@ -1044,7 +1112,12 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *
1085
1086 DrawThemeBackground (theme, hdc, partId, stateId, &rc, NULL);
1087 }
1088 +
1089 +#ifdef __REACTOS__
1090 + if (!theme)
1091 +#else
1092 else
1093 +#endif
1094 TOOLBAR_DrawFrame(infoPtr, &tbcd, &rc, dwItemCDFlag);
1095
1096 if (drawSepDropDownArrow)
1097 @@ -1570,9 +1643,14 @@ static inline SIZE TOOLBAR_MeasureButton
1098 /* ... add on the necessary padding */
1099 if (bValidImageList)
1100 {
1101 +#ifdef __REACTOS__
1102 + sizeButton.cy += infoPtr->szPadding.cy;
1103 + if (!bHasBitmap)
1104 +#else
1105 if (bHasBitmap)
1106 sizeButton.cy += DEFPAD_CY;
1107 else
1108 +#endif
1109 sizeButton.cy += LISTPAD_CY;
1110 }
1111 else
1112 @@ -1589,7 +1667,11 @@ static inline SIZE TOOLBAR_MeasureButton
1113 {
1114 if (bHasBitmap)
1115 {
1116 +#ifdef __REACTOS__
1117 + sizeButton.cy = infoPtr->nBitmapHeight + infoPtr->szPadding.cy;
1118 +#else
1119 sizeButton.cy = infoPtr->nBitmapHeight + DEFPAD_CY;
1120 +#endif
1121 if (sizeString.cy > 0)
1122 sizeButton.cy += 1 + sizeString.cy;
1123 sizeButton.cx = infoPtr->szPadding.cx +
1124 @@ -1694,7 +1776,14 @@ TOOLBAR_LayoutToolbar(TOOLBAR_INFO *info
1125 {
1126 if (btnPtr->cx)
1127 cx = btnPtr->cx;
1128 +#ifdef __REACTOS__
1129 + /* Revert Wine Commit 5b7b911 as it breaks Explorer Toolbar Buttons
1130 + FIXME: Revisit this when the bug is fixed. CORE-9970 */
1131 + else if ((infoPtr->dwExStyle & TBSTYLE_EX_MIXEDBUTTONS) ||
1132 + (btnPtr->fsStyle & BTNS_AUTOSIZE))
1133 +#else
1134 else if (btnPtr->fsStyle & BTNS_AUTOSIZE)
1135 +#endif
1136 {
1137 SIZE sz;
1138 HDC hdc;
1139 @@ -1953,6 +2042,17 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND h
1140 SendMessageW (hwndTip, TTM_RELAYEVENT, 0, (LPARAM)&msg);
1141 }
1142
1143 +#ifdef __REACTOS__
1144 +static LRESULT
1145 +TOOLBAR_ThemeChanged(HWND hwnd)
1146 +{
1147 + HTHEME theme = GetWindowTheme(hwnd);
1148 + CloseThemeData(theme);
1149 + OpenThemeData(hwnd, themeClass);
1150 + return 0;
1151 +}
1152 +#endif
1153 +
1154 static void
1155 TOOLBAR_TooltipAddTool(const TOOLBAR_INFO *infoPtr, const TBUTTON_INFO *button)
1156 {
1157 @@ -3534,6 +3634,36 @@ TOOLBAR_GetMaxSize (const TOOLBAR_INFO *
1158 return TRUE;
1159 }
1160
1161 +#ifdef __REACTOS__
1162 +static LRESULT
1163 +TOOLBAR_GetMetrics(const TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
1164 +{
1165 + if (pMetrics == NULL)
1166 + return FALSE;
1167 +
1168 + /* TODO: check if cbSize is a valid value */
1169 +
1170 + if (pMetrics->dwMask & TBMF_PAD)
1171 + {
1172 + pMetrics->cxPad = infoPtr->szPadding.cx;
1173 + pMetrics->cyPad = infoPtr->szPadding.cy;
1174 + }
1175 +
1176 + if (pMetrics->dwMask & TBMF_BARPAD)
1177 + {
1178 + pMetrics->cxBarPad = infoPtr->szBarPadding.cx;
1179 + pMetrics->cyBarPad = infoPtr->szBarPadding.cy;
1180 + }
1181 +
1182 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
1183 + {
1184 + pMetrics->cxButtonSpacing = infoPtr->szSpacing.cx;
1185 + pMetrics->cyButtonSpacing = infoPtr->szSpacing.cy;
1186 + }
1187 +
1188 + return TRUE;
1189 +}
1190 +#endif
1191
1192 /* << TOOLBAR_GetObject >> */
1193
1194 @@ -4789,6 +4919,44 @@ TOOLBAR_SetMaxTextRows (TOOLBAR_INFO *in
1195 return TRUE;
1196 }
1197
1198 +#ifdef __REACTOS__
1199 +static LRESULT
1200 +TOOLBAR_SetMetrics(TOOLBAR_INFO *infoPtr, TBMETRICS *pMetrics)
1201 +{
1202 + BOOL changed = FALSE;
1203 +
1204 + if (!pMetrics)
1205 + return FALSE;
1206 +
1207 + /* TODO: check if cbSize is a valid value */
1208 +
1209 + if (pMetrics->dwMask & TBMF_PAD)
1210 + {
1211 + infoPtr->szPadding.cx = pMetrics->cxPad;
1212 + infoPtr->szPadding.cy = pMetrics->cyPad;
1213 + changed = TRUE;
1214 + }
1215 +
1216 + if (pMetrics->dwMask & TBMF_PAD)
1217 + {
1218 + infoPtr->szBarPadding.cx = pMetrics->cxBarPad;
1219 + infoPtr->szBarPadding.cy = pMetrics->cyBarPad;
1220 + changed = TRUE;
1221 + }
1222 +
1223 + if (pMetrics->dwMask & TBMF_BUTTONSPACING)
1224 + {
1225 + infoPtr->szSpacing.cx = pMetrics->cxButtonSpacing;
1226 + infoPtr->szSpacing.cy = pMetrics->cyButtonSpacing;
1227 + changed = TRUE;
1228 + }
1229 +
1230 + if (changed)
1231 + TOOLBAR_CalcToolbar(infoPtr);
1232 +
1233 + return TRUE;
1234 +}
1235 +#endif
1236
1237 /* MSDN gives slightly wrong info on padding.
1238 * 1. It is not only used on buttons with the BTNS_AUTOSIZE style
1239 @@ -6029,6 +6197,10 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wPar
1240 infoPtr->clrBtnShadow = CLR_DEFAULT;
1241 infoPtr->szPadding.cx = DEFPAD_CX;
1242 infoPtr->szPadding.cy = DEFPAD_CY;
1243 +#ifdef __REACTOS__
1244 + infoPtr->szSpacing.cx = DEFSPACE_CX;
1245 + infoPtr->szSpacing.cy = DEFSPACE_CY;
1246 +#endif
1247 infoPtr->iListGap = DEFLISTGAP;
1248 infoPtr->iTopMargin = default_top_margin(infoPtr);
1249 infoPtr->dwStyle = lpcs->style;
1250 @@ -6438,7 +6610,7 @@ TOOLBAR_SysColorChange (void)
1251 return 0;
1252 }
1253
1254 -
1255 +#ifndef __REACTOS__
1256 /* update theme after a WM_THEMECHANGED message */
1257 static LRESULT theme_changed (HWND hwnd)
1258 {
1259 @@ -6447,7 +6619,7 @@ static LRESULT theme_changed (HWND hwnd)
1260 OpenThemeData (hwnd, themeClass);
1261 return 0;
1262 }
1263 -
1264 +#endif
1265
1266 static LRESULT WINAPI
1267 ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1268 @@ -6552,6 +6724,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
1269
1270 case TB_GETMAXSIZE:
1271 return TOOLBAR_GetMaxSize (infoPtr, (LPSIZE)lParam);
1272 +#ifdef __REACTOS__
1273 + case TB_GETMETRICS:
1274 + return TOOLBAR_GetMetrics (infoPtr, (TBMETRICS*)lParam);
1275 +#endif
1276
1277 /* case TB_GETOBJECT: */ /* 4.71 */
1278
1279 @@ -6693,6 +6869,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
1280 case TB_SETMAXTEXTROWS:
1281 return TOOLBAR_SetMaxTextRows (infoPtr, wParam);
1282
1283 +#ifdef __REACTOS__
1284 + case TB_SETMETRICS:
1285 + return TOOLBAR_SetMetrics (infoPtr, (TBMETRICS*)lParam);
1286 +#endif
1287 +
1288 case TB_SETPADDING:
1289 return TOOLBAR_SetPadding (infoPtr, lParam);
1290
1291 @@ -6834,7 +7015,11 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg,
1292 return TOOLBAR_SysColorChange ();
1293
1294 case WM_THEMECHANGED:
1295 +#ifdef __REACTOS__
1296 + return TOOLBAR_ThemeChanged(hwnd);
1297 +#else
1298 return theme_changed (hwnd);
1299 +#endif
1300
1301 /* case WM_WININICHANGE: */
1302
1303 diff -pudN e:\wine\dlls\comctl32/tooltips.c e:\reactos\dll\win32\comctl32/tooltips.c
1304 --- e:\wine\dlls\comctl32/tooltips.c 2016-08-14 19:11:25 +0100
1305 +++ e:\reactos\dll\win32\comctl32/tooltips.c 2016-08-18 12:03:14 +0100
1306 @@ -2009,7 +2009,36 @@ TOOLTIPS_NCHitTest (const TOOLTIPS_INFO
1307 static LRESULT
1308 TOOLTIPS_NotifyFormat (TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
1309 {
1310 +#ifdef __REACTOS__
1311 + TTTOOL_INFO *toolPtr = infoPtr->tools;
1312 + LRESULT nResult;
1313 +
1314 + TRACE("infoPtr=%p wParam=%lx lParam=%p\n", infoPtr, wParam, (PVOID)lParam);
1315 +
1316 + if (lParam == NF_QUERY) {
1317 + if (toolPtr->bNotifyUnicode) {
1318 + return NFR_UNICODE;
1319 + } else {
1320 + return NFR_ANSI;
1321 + }
1322 + }
1323 + else if (lParam == NF_REQUERY) {
1324 + nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
1325 + (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
1326 + if (nResult == NFR_ANSI) {
1327 + toolPtr->bNotifyUnicode = FALSE;
1328 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1329 + } else if (nResult == NFR_UNICODE) {
1330 + toolPtr->bNotifyUnicode = TRUE;
1331 + TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1332 + } else {
1333 + TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
1334 + }
1335 + return nResult;
1336 + }
1337 +#else
1338 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
1339 +#endif
1340
1341 return 0;
1342 }
1343 diff -pudN e:\wine\dlls\comctl32/treeview.c e:\reactos\dll\win32\comctl32/treeview.c
1344 --- e:\wine\dlls\comctl32/treeview.c 2016-08-14 19:11:25 +0100
1345 +++ e:\reactos\dll\win32\comctl32/treeview.c 2016-08-18 12:03:14 +0100
1346 @@ -2888,7 +2888,14 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr,
1347 }
1348 }
1349
1350 + //
1351 + // FIXME: This is correct, but is causes and infinite loop of WM_PAINT
1352 + // messages, resulting in continuous painting of the scroll bar in reactos.
1353 + // Comment out until the real bug is found. CORE-4912
1354 + //
1355 +#ifndef __REACTOS__
1356 TREEVIEW_UpdateScrollBars(infoPtr);
1357 +#endif
1358
1359 if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
1360 infoPtr->cdmode =