From 6d52441d10b4f128f444fa76989dfc973bc3b3a7 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Wed, 30 Aug 2006 19:18:49 +0000 Subject: [PATCH] [WINESYNC] update comctl32 to Wine_0.9.20 svn path=/trunk/; revision=23807 --- reactos/dll/win32/comctl32/imagelist.c | 24 ++++++++----- reactos/dll/win32/comctl32/propsheet.c | 50 +++++++++++++------------- reactos/dll/win32/comctl32/toolbar.c | 31 ++++++++-------- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/reactos/dll/win32/comctl32/imagelist.c b/reactos/dll/win32/comctl32/imagelist.c index cbd8f3430a3..cc3078ea463 100644 --- a/reactos/dll/win32/comctl32/imagelist.c +++ b/reactos/dll/win32/comctl32/imagelist.c @@ -2158,6 +2158,7 @@ ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage, { HDC hdcImage; BITMAP bmp; + HBITMAP hOldBitmap; TRACE("%p %d %p %p\n", himl, i, hbmImage, hbmMask); @@ -2175,29 +2176,34 @@ ImageList_Replace (HIMAGELIST himl, INT i, HBITMAP hbmImage, GetObjectA (hbmImage, sizeof(BITMAP), (LPVOID)&bmp); /* Replace Image */ - SelectObject (hdcImage, hbmImage); + hOldBitmap = SelectObject (hdcImage, hbmImage); StretchBlt (himl->hdcImage, i * himl->cx, 0, himl->cx, himl->cy, hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); if (himl->hbmMask) { - /* Replace Mask */ - SelectObject (hdcImage, hbmMask); + HDC hdcTemp; + HBITMAP hOldBitmapTemp; + + hdcTemp = CreateCompatibleDC(0); + hOldBitmapTemp = SelectObject(hdcTemp, hbmMask); StretchBlt (himl->hdcMask, i * himl->cx, 0, himl->cx, himl->cy, - hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - + hdcTemp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + SelectObject(hdcTemp, hOldBitmapTemp); + DeleteDC(hdcTemp); /* Remove the background from the image */ - StretchBlt (himl->hdcImage, - i*himl->cx, 0, himl->cx, himl->cy, - hdcImage, - 0, 0, bmp.bmWidth, bmp.bmHeight, + BitBlt (himl->hdcImage, + i*himl->cx, 0, bmp.bmWidth, bmp.bmHeight, + himl->hdcMask, + i*himl->cx, 0, 0x220326); /* NOTSRCAND */ } + SelectObject (hdcImage, hOldBitmap); DeleteDC (hdcImage); return TRUE; diff --git a/reactos/dll/win32/comctl32/propsheet.c b/reactos/dll/win32/comctl32/propsheet.c index 907e638a840..972f862129b 100644 --- a/reactos/dll/win32/comctl32/propsheet.c +++ b/reactos/dll/win32/comctl32/propsheet.c @@ -2079,6 +2079,21 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, continue; } } + + /* Invalidate the header area */ + if ( (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && + (psInfo->ppshheader.dwFlags & PSH_HEADER) ) + { + HWND hwndLineHeader = GetDlgItem(hwndDlg, IDC_SUNKEN_LINEHEADER); + RECT r; + + GetClientRect(hwndLineHeader, &r); + MapWindowPoints(hwndLineHeader, hwndDlg, (LPPOINT) &r, 2); + SetRect(&r, 0, 0, r.right + 1, r.top - 1); + + InvalidateRect(hwndDlg, &r, TRUE); + } + /* * Display the new page. */ @@ -3254,15 +3269,16 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) } else { + int margin; hbr = GetSysColorBrush(COLOR_WINDOW); FillRect(hdc, &rzone, hbr); /* Draw the header bitmap. It's always centered like a * common 49 x 49 bitmap. */ - BitBlt(hdc, rzone.right - 49 - ((rzone.bottom - 49) / 2), - (rzone.bottom - 49) / 2, - bm.bmWidth, bm.bmHeight, - hdcSrc, 0, 0, SRCCOPY); + margin = (rzone.bottom - 49) / 2; + BitBlt(hdc, rzone.right - 49 - margin, margin, + min(bm.bmWidth, 49), min(bm.bmHeight, 49), + hdcSrc, 0, 0, SRCCOPY); /* NOTE: Native COMCTL32 draws a white stripe over the bitmap * if its height is smaller than 49 pixels. Because the reason @@ -3276,22 +3292,14 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) if (ppshpage->dwFlags & PSP_USEHEADERTITLE) { SetRect(&r, 20, 10, 0, 0); if (HIWORD(ppshpage->pszHeaderTitle)) - { - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderTitle, - -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); - } + DrawTextW(hdc, ppshpage->pszHeaderTitle, -1, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); else { nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderTitle, szBuffer, 256); if (nLength != 0) { - DrawTextW(hdc, szBuffer, nLength, - &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); + DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_SINGLELINE | DT_NOCLIP); } } } @@ -3300,22 +3308,14 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) SelectObject(hdc, psInfo->hFont); SetRect(&r, 40, 25, rzone.right - 69, rzone.bottom); if (HIWORD(ppshpage->pszHeaderTitle)) - { - if (psInfo->unicode) - DrawTextW(hdc, (LPWSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - else - DrawTextA(hdc, (LPCSTR)ppshpage->pszHeaderSubTitle, - -1, &r, DT_LEFT | DT_SINGLELINE); - } + DrawTextW(hdc, ppshpage->pszHeaderSubTitle, -1, &r, DT_LEFT | DT_WORDBREAK); else { nLength = LoadStringW(ppshpage->hInstance, (UINT_PTR)ppshpage->pszHeaderSubTitle, szBuffer, 256); if (nLength != 0) { - DrawTextW(hdc, szBuffer, nLength, - &r, DT_LEFT | DT_SINGLELINE); + DrawTextW(hdc, szBuffer, nLength, &r, DT_LEFT | DT_WORDBREAK); } } } @@ -3348,6 +3348,8 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); + /* The watermark is truncated to a width of 164 pixels */ + r.right = min(r.right, 164); BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right), min(bm.bmHeight, r.bottom), hdcSrc, 0, 0, SRCCOPY); diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c index e84150ebe1c..108bf048f12 100644 --- a/reactos/dll/win32/comctl32/toolbar.c +++ b/reactos/dll/win32/comctl32/toolbar.c @@ -696,8 +696,9 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top draw_masked = TRUE; } } - else if ((tbcd->nmcd.uItemState & CDIS_HOT) - && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf))) + else if (tbcd->nmcd.uItemState & CDIS_CHECKED || + ((tbcd->nmcd.uItemState & CDIS_HOT) + && ((infoPtr->dwStyle & TBSTYLE_FLAT) || GetWindowTheme (infoPtr->hwndSelf)))) { /* if hot, attempt to draw with hot image list, if fails, use default image list */ @@ -2688,48 +2689,48 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) switch (lpAddBmp->nID) { case IDB_STD_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_STD_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_STD_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_STD_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_STD_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_STD_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_VIEW_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_VIEW_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_VIEW_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_VIEW_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_SMALL_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_HIST_SMALL)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_HIST_SMALL, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_LARGE_COLOR: - hbmLoad = LoadBitmapW (COMCTL32_hModule, - MAKEINTRESOURCEW(IDB_HIST_LARGE)); + hbmLoad = CreateMappedBitmap (COMCTL32_hModule, + IDB_HIST_LARGE, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); @@ -2743,7 +2744,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) } else { - hbmLoad = LoadBitmapW (lpAddBmp->hInst, (LPWSTR)lpAddBmp->nID); + hbmLoad = CreateMappedBitmap(lpAddBmp->hInst, lpAddBmp->nID, 0, NULL, 0); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); }