From ebec7c2e3fe8cfcf4b4e171925db5fa39a541bbe Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Sat, 17 Jan 2009 16:43:06 +0000 Subject: [PATCH] update comctl32 to Wine 1.1.13. not including ros specific stuff for now while I work out what we still need svn path=/trunk/; revision=38822 --- reactos/dll/win32/comctl32/animate.c | 4 +- reactos/dll/win32/comctl32/comboex.c | 82 ++++---- reactos/dll/win32/comctl32/comctl32.h | 6 +- reactos/dll/win32/comctl32/comctl32.rbuild | 1 + reactos/dll/win32/comctl32/comctl_Ja.rc | 41 ++-- reactos/dll/win32/comctl32/comctl_Ko.rc | 2 +- reactos/dll/win32/comctl32/commctrl.c | 79 ++++++-- reactos/dll/win32/comctl32/datetime.c | 198 ++++++++++--------- reactos/dll/win32/comctl32/dpa.c | 2 +- reactos/dll/win32/comctl32/flatsb.c | 2 +- reactos/dll/win32/comctl32/header.c | 72 +++---- reactos/dll/win32/comctl32/hotkey.c | 16 +- reactos/dll/win32/comctl32/imagelist.c | 30 +-- reactos/dll/win32/comctl32/ipaddress.c | 8 +- reactos/dll/win32/comctl32/listview.c | 178 ++++++++++------- reactos/dll/win32/comctl32/monthcal.c | 49 +++-- reactos/dll/win32/comctl32/nativefont.c | 8 +- reactos/dll/win32/comctl32/pager.c | 4 +- reactos/dll/win32/comctl32/progress.c | 4 +- reactos/dll/win32/comctl32/propsheet.c | 189 ++++++------------- reactos/dll/win32/comctl32/rebar.c | 187 +++++++++--------- reactos/dll/win32/comctl32/rsrc.rc | 6 +- reactos/dll/win32/comctl32/status.c | 210 +++++++-------------- reactos/dll/win32/comctl32/syslink.c | 6 +- reactos/dll/win32/comctl32/tab.c | 16 +- reactos/dll/win32/comctl32/theming.c | 11 +- reactos/dll/win32/comctl32/toolbar.c | 203 ++++++++++---------- reactos/dll/win32/comctl32/tooltips.c | 38 +--- reactos/dll/win32/comctl32/trackbar.c | 51 ++--- reactos/dll/win32/comctl32/treeview.c | 103 +++++----- reactos/dll/win32/comctl32/updown.c | 39 ++-- 31 files changed, 933 insertions(+), 912 deletions(-) diff --git a/reactos/dll/win32/comctl32/animate.c b/reactos/dll/win32/comctl32/animate.c index a567cb34858..2b9a80f06d4 100644 --- a/reactos/dll/win32/comctl32/animate.c +++ b/reactos/dll/win32/comctl32/animate.c @@ -817,7 +817,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs) } /* allocate memory for info structure */ - infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO)); + infoPtr = Alloc(sizeof(ANIMATE_INFO)); if (!infoPtr) return FALSE; /* store crossref hWnd <-> info structure */ @@ -962,7 +962,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP return DefWindowProcW(hWnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW(hWnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/comboex.c b/reactos/dll/win32/comctl32/comboex.c index afd4f824d6a..2f95b1ad555 100644 --- a/reactos/dll/win32/comctl32/comboex.c +++ b/reactos/dll/win32/comctl32/comboex.c @@ -164,7 +164,7 @@ static void COMBOEX_DumpItem (CBE_ITEMDATA const *item) static void COMBOEX_DumpInput (COMBOBOXEXITEMW const *input) { - TRACE("input - mask=%08x, iItem=%d, pszText=%p, cchTM=%d, iImage=%d\n", + TRACE("input - mask=%08x, iItem=%ld, pszText=%p, cchTM=%d, iImage=%d\n", input->mask, input->iItem, input->pszText, input->cchTextMax, input->iImage); if (input->mask & CBEIF_TEXT) @@ -198,7 +198,7 @@ static INT COMBOEX_Notify (COMBOEX_INFO *infoPtr, INT code, NMHDR *hdr) static INT -COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, INT code, NMCOMBOBOXEXW *hdr) +COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, UINT code, NMCOMBOBOXEXW *hdr) { /* Change the Text item from Unicode to ANSI if necessary for NOTIFY */ if (infoPtr->NtfUnicode) @@ -211,7 +211,7 @@ COMBOEX_NotifyItem (COMBOEX_INFO *infoPtr, INT code, NMCOMBOBOXEXW *hdr) if ((hdr->ceItem.mask & CBEIF_TEXT) && is_textW(wstr)) { len = WideCharToMultiByte (CP_ACP, 0, wstr, -1, 0, 0, NULL, NULL); if (len > 0) { - astr = (LPSTR)Alloc ((len + 1)*sizeof(CHAR)); + astr = Alloc ((len + 1)*sizeof(CHAR)); if (!astr) return 0; WideCharToMultiByte (CP_ACP, 0, wstr, -1, astr, len, 0, 0); hdr->ceItem.pszText = (LPWSTR)astr; @@ -320,7 +320,7 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item) if (is_textW(nmce.ceItem.pszText)) { len = MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, NULL, 0); - buf = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + buf = Alloc ((len + 1)*sizeof(WCHAR)); if (buf) MultiByteToWideChar (CP_ACP, 0, (LPSTR)nmce.ceItem.pszText, -1, buf, len); if (nmce.ceItem.mask & CBEIF_DI_SETITEM) { @@ -348,7 +348,7 @@ static void COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size) mydc = GetDC (0); /* why the entire screen???? */ nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); - ofont = (HFONT) SelectObject (mydc, nfont); + ofont = SelectObject (mydc, nfont); GetTextExtentPointW (mydc, strA, 1, size); SelectObject (mydc, ofont); ReleaseDC (0, mydc); @@ -431,10 +431,9 @@ static void COMBOEX_ReSize (COMBOEX_INFO *infoPtr) cy = max (iinfo.rcImage.bottom - iinfo.rcImage.top, cy); TRACE("upgraded height due to image: height=%d\n", cy); } - SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, (WPARAM)-1, (LPARAM)cy); + SendMessageW (infoPtr->hwndSelf, CB_SETITEMHEIGHT, -1, cy); if (infoPtr->hwndCombo) { - SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, - (WPARAM) 0, (LPARAM) cy); + SendMessageW (infoPtr->hwndCombo, CB_SETITEMHEIGHT, 0, cy); if ( !(infoPtr->flags & CBES_EX_NOSIZELIMIT)) { RECT comboRect; if (GetWindowRect(infoPtr->hwndCombo, &comboRect)) { @@ -468,7 +467,7 @@ static void COMBOEX_SetEditText (COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item) } -static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT index) +static CBE_ITEMDATA * COMBOEX_FindItem(COMBOEX_INFO *infoPtr, INT_PTR index) { CBE_ITEMDATA *item; INT i; @@ -501,7 +500,7 @@ static inline BOOL COMBOEX_HasEdit(COMBOEX_INFO const *infoPtr) /* *** CBEM_xxx message support *** */ -static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, int n, LPWSTR buf) +static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, INT_PTR n, LPWSTR buf) { CBE_ITEMDATA *item; LPCWSTR str; @@ -528,9 +527,9 @@ static UINT COMBOEX_GetListboxText(COMBOEX_INFO *infoPtr, int n, LPWSTR buf) } -static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT index) +static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT_PTR index) { - TRACE("(index=%d)\n", index); + TRACE("(index=%ld)\n", index); /* if item number requested does not exist then return failure */ if ((index >= infoPtr->nb_items) || (index < 0)) return CB_ERR; @@ -545,7 +544,7 @@ static INT COMBOEX_DeleteItem (COMBOEX_INFO *infoPtr, INT index) static BOOL COMBOEX_GetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit) { - INT index = cit->iItem; + INT_PTR index = cit->iItem; CBE_ITEMDATA *item; TRACE("(...)\n"); @@ -608,7 +607,7 @@ static inline BOOL COMBOEX_HasEditChanged (COMBOEX_INFO const *infoPtr) static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *cit) { - INT index; + INT_PTR index; CBE_ITEMDATA *item; NMCOMBOBOXEXW nmcit; @@ -622,7 +621,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *ci if (index > infoPtr->nb_items) return -1; /* get zero-filled space and chain it in */ - if(!(item = (CBE_ITEMDATA *)Alloc (sizeof(*item)))) return -1; + if(!(item = Alloc (sizeof(*item)))) return -1; /* locate position to insert new item in */ if (index == infoPtr->nb_items) { @@ -654,7 +653,7 @@ static INT COMBOEX_InsertItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW const *ci if (is_textW(cit->pszText)) len = strlenW (cit->pszText); if (len > 0) { - item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + item->pszText = Alloc ((len + 1)*sizeof(WCHAR)); if (!item->pszText) { Free(item); return -1; @@ -700,7 +699,7 @@ static INT COMBOEX_InsertItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *ci memcpy(&citW,cit,sizeof(COMBOBOXEXITEMA)); if (cit->mask & CBEIF_TEXT && is_textA(cit->pszText)) { INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0); - wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + wstr = Alloc ((len + 1)*sizeof(WCHAR)); if (!wstr) return -1; MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len); citW.pszText = wstr; @@ -766,7 +765,7 @@ static HIMAGELIST COMBOEX_SetImageList (COMBOEX_INFO *infoPtr, HIMAGELIST himl) static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit) { - INT index = cit->iItem; + INT_PTR index = cit->iItem; CBE_ITEMDATA *item; if (TRACE_ON(comboex)) COMBOEX_DumpInput (cit); @@ -787,7 +786,7 @@ static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit) COMBOEX_FreeText(item); if (is_textW(cit->pszText)) len = strlenW(cit->pszText); if (len > 0) { - item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + item->pszText = Alloc ((len + 1)*sizeof(WCHAR)); if (!item->pszText) return FALSE; strcpyW(item->pszText, cit->pszText); } else if (cit->pszText == LPSTR_TEXTCALLBACKW) @@ -808,7 +807,7 @@ static BOOL COMBOEX_SetItemW (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMW *cit) if (TRACE_ON(comboex)) COMBOEX_DumpItem (item); /* if original request was to update edit control, do some fast foot work */ - if (cit->iItem == -1) { + if (cit->iItem == -1 && cit->mask & CBEIF_TEXT) { COMBOEX_SetEditText (infoPtr, item); RedrawWindow (infoPtr->hwndCombo, 0, 0, RDW_ERASE | RDW_INVALIDATE); } @@ -824,7 +823,7 @@ static BOOL COMBOEX_SetItemA (COMBOEX_INFO *infoPtr, COMBOBOXEXITEMA const *cit) memcpy(&citW, cit, sizeof(COMBOBOXEXITEMA)); if ((cit->mask & CBEIF_TEXT) && is_textA(cit->pszText)) { INT len = MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, NULL, 0); - wstr = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + wstr = Alloc ((len + 1)*sizeof(WCHAR)); if (!wstr) return FALSE; MultiByteToWideChar (CP_ACP, 0, cit->pszText, -1, wstr, len); citW.pszText = wstr; @@ -871,7 +870,7 @@ COMBOEX_FindStringExact (COMBOEX_INFO *infoPtr, INT start, LPCWSTR str) } -static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT index) +static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT_PTR index) { CBE_ITEMDATA const *item1; CBE_ITEMDATA const *item2; @@ -894,7 +893,7 @@ static DWORD_PTR COMBOEX_GetItemData (COMBOEX_INFO *infoPtr, INT index) } -static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT index) +static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT_PTR index) { CBE_ITEMDATA *item; INT sel; @@ -902,7 +901,7 @@ static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT index) if (!(item = COMBOEX_FindItem(infoPtr, index))) return SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0); - TRACE("selecting item %d text=%s\n", index, debugstr_txt(item->pszText)); + TRACE("selecting item %ld text=%s\n", index, debugstr_txt(item->pszText)); infoPtr->selected = index; sel = (INT)SendMessageW (infoPtr->hwndCombo, CB_SETCURSEL, index, 0); @@ -911,7 +910,7 @@ static INT COMBOEX_SetCursel (COMBOEX_INFO *infoPtr, INT index) } -static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT index, DWORD_PTR data) +static DWORD_PTR COMBOEX_SetItemData (COMBOEX_INFO *infoPtr, INT_PTR index, DWORD_PTR data) { CBE_ITEMDATA *item1; CBE_ITEMDATA const *item2; @@ -976,7 +975,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs) INT i; /* allocate memory for info structure */ - infoPtr = (COMBOEX_INFO *)Alloc (sizeof(COMBOEX_INFO)); + infoPtr = Alloc (sizeof(COMBOEX_INFO)); if (!infoPtr) return -1; /* initialize info structure */ @@ -1109,7 +1108,7 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs) * Create an item structure to represent the data in the * EDIT control. It is allocated zero-filled. */ - infoPtr->edit = (CBE_ITEMDATA *)Alloc (sizeof (CBE_ITEMDATA)); + infoPtr->edit = Alloc (sizeof (CBE_ITEMDATA)); if (!infoPtr->edit) { COMBOEX_Destroy(infoPtr); return -1; @@ -1119,13 +1118,14 @@ static LRESULT COMBOEX_Create (HWND hwnd, CREATESTRUCTA const *cs) } -static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam) { LRESULT lret; INT command = HIWORD(wParam); CBE_ITEMDATA *item = 0; WCHAR wintext[520]; - INT cursel, n, oldItem; + INT cursel, n; + INT_PTR oldItem; NMCBEENDEDITW cbeend; DWORD oldflags; HWND parent = infoPtr->hwndNotify; @@ -1225,7 +1225,7 @@ static LRESULT COMBOEX_Command (COMBOEX_INFO *infoPtr, WPARAM wParam, LPARAM lPa */ oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { - ERR("item %d not found. Problem!\n", oldItem); + ERR("item %ld not found. Problem!\n", oldItem); break; } infoPtr->selected = oldItem; @@ -1408,7 +1408,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT const *di item->mask &= ~CBEIF_TEXT; if( (len = GetWindowTextLengthW(infoPtr->hwndEdit)) ) { item->mask |= CBEIF_TEXT; - item->pszText = (LPWSTR)Alloc ((len + 1)*sizeof(WCHAR)); + item->pszText = Alloc ((len + 1)*sizeof(WCHAR)); if (item->pszText) GetWindowTextW(infoPtr->hwndEdit, item->pszText, len+1); @@ -1713,7 +1713,7 @@ static LRESULT COMBOEX_WindowPosChanging (COMBOEX_INFO *infoPtr, WINDOWPOS *wp) static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; WCHAR edit_text[260]; @@ -1751,7 +1751,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) hwnd, uMsg, wParam, lParam); case WM_KEYDOWN: { - INT oldItem, selected, step = 1; + INT_PTR oldItem, selected, step = 1; CBE_ITEMDATA *item; switch ((INT)wParam) @@ -1788,7 +1788,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) oldItem = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); InvalidateRect (infoPtr->hwndCombo, 0, 0); if (!(item = COMBOEX_FindItem(infoPtr, oldItem))) { - ERR("item %d not found. Problem!\n", oldItem); + ERR("item %ld not found. Problem!\n", oldItem); break; } infoPtr->selected = oldItem; @@ -1830,7 +1830,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (selected != -1) { cmp_func_t cmptext = get_cmp_func(infoPtr); item = COMBOEX_FindItem (infoPtr, selected); - TRACE("handling VK_RETURN, selected = %d, selected_text=%s\n", + TRACE("handling VK_RETURN, selected = %ld, selected_text=%s\n", selected, debugstr_txt(item->pszText)); TRACE("handling VK_RETURN, edittext=%s\n", debugstr_w(edit_text)); @@ -1911,7 +1911,7 @@ COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; NMMOUSE nmmse; @@ -2080,8 +2080,8 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LPCWSTR lastwrk; cmp_func_t cmptext = get_cmp_func(infoPtr); - INT selected = SendMessageW (infoPtr->hwndCombo, - CB_GETCURSEL, 0, 0); + INT_PTR selected = SendMessageW (infoPtr->hwndCombo, + CB_GETCURSEL, 0, 0); /* lstrlenW( lastworkingURL ) */ @@ -2094,7 +2094,7 @@ COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) lastwrk = COMBOEX_GetText(infoPtr, item); } - TRACE("handling EN_CHANGE, selected = %d, selected_text=%s\n", + TRACE("handling EN_CHANGE, selected = %ld, selected_text=%s\n", selected, debugstr_w(lastwrk)); TRACE("handling EN_CHANGE, edittext=%s\n", debugstr_w(edit_text)); @@ -2274,7 +2274,7 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* Window messages passed to parent */ case WM_COMMAND: - return COMBOEX_Command (infoPtr, wParam, lParam); + return COMBOEX_Command (infoPtr, wParam); case WM_NOTIFY: if (infoPtr->NtfUnicode) @@ -2310,7 +2310,7 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n",uMsg,wParam,lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/reactos/dll/win32/comctl32/comctl32.h b/reactos/dll/win32/comctl32/comctl32.h index 51320e658cc..872638dc873 100644 --- a/reactos/dll/win32/comctl32/comctl32.h +++ b/reactos/dll/win32/comctl32/comctl32.h @@ -148,6 +148,8 @@ HWND COMCTL32_CreateToolTip (HWND); VOID COMCTL32_RefreshSysColors(void); void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal); void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground); +void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm); +BOOL COMCTL32_IsReflectedMessage(UINT uMsg); INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen); INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen); BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc); @@ -173,8 +175,8 @@ typedef struct /* undocumented functions */ -LPVOID WINAPI Alloc (DWORD); -LPVOID WINAPI ReAlloc (LPVOID, DWORD); +LPVOID WINAPI Alloc (DWORD) __WINE_ALLOC_SIZE(1); +LPVOID WINAPI ReAlloc (LPVOID, DWORD) __WINE_ALLOC_SIZE(2); BOOL WINAPI Free (LPVOID); DWORD WINAPI GetSize (LPVOID); diff --git a/reactos/dll/win32/comctl32/comctl32.rbuild b/reactos/dll/win32/comctl32/comctl32.rbuild index 3f133425df9..3718cbf6c8b 100644 --- a/reactos/dll/win32/comctl32/comctl32.rbuild +++ b/reactos/dll/win32/comctl32/comctl32.rbuild @@ -32,6 +32,7 @@ string.c syslink.c tab.c + theme_button.c theme_combo.c theme_dialog.c theme_edit.c diff --git a/reactos/dll/win32/comctl32/comctl_Ja.rc b/reactos/dll/win32/comctl32/comctl_Ja.rc index b00969a3e08..e3c1272f29a 100644 --- a/reactos/dll/win32/comctl32/comctl_Ja.rc +++ b/reactos/dll/win32/comctl32/comctl_Ja.rc @@ -16,17 +16,20 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Properties for %s" -FONT 9, "MS UI Gothic" +FONT 9, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP - PUSHBUTTON "ƒLƒƒƒ“ƒZƒ‹", IDCANCEL,58,122,50,14 - PUSHBUTTON "“K—p(&A)", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED - PUSHBUTTON "ƒwƒ‹ƒv", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + PUSHBUTTON "ă‚­ăƒŁăƒłă‚»ăƒ«", IDCANCEL,58,122,50,14 + PUSHBUTTON "適甚(&A)", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "ăƒ˜ăƒ«ăƒ—", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 END @@ -34,13 +37,13 @@ END IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE CAPTION "Wizard" -FONT 9, "MS UI Gothic" +FONT 9, "MS Shell Dlg" BEGIN - PUSHBUTTON "< –ß‚é(&B)", IDC_BACK_BUTTON,71,138,50,14 - DEFPUSHBUTTON "i‚Ț(&N) >", IDC_NEXT_BUTTON,121,138,50,14 - DEFPUSHBUTTON "Šź—č", IDC_FINISH_BUTTON,121,138,50,14 - PUSHBUTTON "ƒLƒƒƒ“ƒZƒ‹", IDCANCEL,178,138,50,14 - PUSHBUTTON "ƒwƒ‹ƒv", IDHELP,235,138,50,14,WS_GROUP + PUSHBUTTON "< æˆ»ă‚‹(&B)", IDC_BACK_BUTTON,71,138,50,14 + DEFPUSHBUTTON "é€Čむ(&N) >", IDC_NEXT_BUTTON,121,138,50,14 + DEFPUSHBUTTON "漌äș†", IDC_FINISH_BUTTON,121,138,50,14 + PUSHBUTTON "ă‚­ăƒŁăƒłă‚»ăƒ«", IDCANCEL,178,138,50,14 + PUSHBUTTON "ăƒ˜ăƒ«ăƒ—", IDHELP,235,138,50,14,WS_GROUP LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE @@ -50,17 +53,17 @@ END IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Customize Toolbar" -FONT 9, "MS UI Gothic" +FONT 9, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "•‚¶‚é(&C)", IDCANCEL,308,6,44,14 - PUSHBUTTON "ƒŠƒZƒbƒg(R&)", IDC_RESET_BTN,308,23,44,14 - PUSHBUTTON "ƒwƒ‹ƒv(&H)", IDC_HELP_BTN,308,40,44,14 - PUSHBUTTON "ă‚Ö (&U)", IDC_MOVEUP_BTN,308,74,44,14 - PUSHBUTTON "‰ș‚Ö (&D)", IDC_MOVEDN_BTN,308,91,44,14 + DEFPUSHBUTTON "閉じる(&C)", IDCANCEL,308,6,44,14 + PUSHBUTTON "ăƒȘă‚»ăƒƒăƒˆ(R&)", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "ăƒ˜ăƒ«ăƒ—(&H)", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "侊ま (&U)", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "例ま (&D)", IDC_MOVEDN_BTN,308,91,44,14 LTEXT "A&vailable buttons:", -1,4,5,84,10 LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "’ljÁ(&A) ->", IDOK, 131, 42, 44, 14 - PUSHBUTTON "<- íœ(&R)", IDC_REMOVE_BTN,131,62,44,14 + PUSHBUTTON "èżœćŠ (&A) ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- 扊陀(&R)", IDC_REMOVE_BTN,131,62,44,14 LTEXT "&Toolbar buttons:", -1,182,5,78,10 LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP END @@ -85,3 +88,5 @@ STRINGTABLE DISCARDABLE { HKY_NONE "None" } + +#pragma code_page(default) diff --git a/reactos/dll/win32/comctl32/comctl_Ko.rc b/reactos/dll/win32/comctl32/comctl_Ko.rc index 52dff6e8232..6574b66a74e 100644 --- a/reactos/dll/win32/comctl32/comctl_Ko.rc +++ b/reactos/dll/win32/comctl32/comctl_Ko.rc @@ -17,7 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -LANGUAGE LANG_KOREAN, SUBLANG_NEUTRAL +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE diff --git a/reactos/dll/win32/comctl32/commctrl.c b/reactos/dll/win32/comctl32/commctrl.c index 4ff20753020..949b62af75b 100644 --- a/reactos/dll/win32/comctl32/commctrl.c +++ b/reactos/dll/win32/comctl32/commctrl.c @@ -123,11 +123,11 @@ static const char manifest[] = static const char manifest_filename[] = ARCH "_" NAME "_" PUBLIC_KEY "_" VERSION "_none_deadbeef.manifest"; -LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -LPWSTR COMCTL32_wSubclass = NULL; +static LPWSTR COMCTL32_wSubclass = NULL; HMODULE COMCTL32_hModule = 0; -LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); +static LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); HBRUSH COMCTL32_hPattern55AABrush = NULL; COMCTL32_SysColor comctl32_color; @@ -878,7 +878,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, hglb = LoadResource (hInstance, hRsrc); if (hglb == 0) return 0; - lpBitmap = (LPBITMAPINFOHEADER)LockResource (hglb); + lpBitmap = LockResource (hglb); if (lpBitmap == NULL) return 0; @@ -889,7 +889,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, else nColorTableSize = 0; nSize = lpBitmap->biSize + nColorTableSize * sizeof(RGBQUAD); - lpBitmapInfo = (LPBITMAPINFOHEADER)GlobalAlloc (GMEM_FIXED, nSize); + lpBitmapInfo = GlobalAlloc (GMEM_FIXED, nSize); if (lpBitmapInfo == NULL) return 0; RtlMoveMemory (lpBitmapInfo, lpBitmap, nSize); @@ -932,7 +932,7 @@ CreateMappedBitmap (HINSTANCE hInstance, INT_PTR idBitmap, UINT wFlags, DeleteDC (hdcDst); } ReleaseDC (NULL, hdcScreen); - GlobalFree ((HGLOBAL)lpBitmapInfo); + GlobalFree (lpBitmapInfo); FreeResource (hglb); return hbm; @@ -1117,7 +1117,7 @@ BOOL WINAPI SetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, * from there. */ /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); + stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { /* allocate stack */ stack = Alloc (sizeof(SUBCLASS_INFO)); @@ -1196,7 +1196,7 @@ BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, TRACE ("(%p, %p, %lx, %p)\n", hWnd, pfnSubclass, uID, pdwRef); /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); + stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1239,7 +1239,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u TRACE ("(%p, %p, %lx)\n", hWnd, pfnSubclass, uID); /* Find the Subclass to remove */ - stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); + stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1284,7 +1284,7 @@ BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR u * Window procedure for all subclassed windows. * Saves the current subclassing stack position to support nested messages */ -LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LPSUBCLASS_INFO stack; LPSUBCLASSPROCS proc; @@ -1292,7 +1292,7 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARA TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); - stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); + stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1343,7 +1343,7 @@ LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); /* retrieve our little stack from the Properties */ - stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); + stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1561,6 +1561,61 @@ void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight return; } +void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm) +{ + HDC hdc = GetDC(NULL); + HFONT hOldFont; + + hOldFont = SelectObject(hdc, hFont); + GetTextMetricsW(hdc, ptm); + SelectObject(hdc, hOldFont); + ReleaseDC(NULL, hdc); +} + +#ifndef OCM__BASE /* avoid including olectl.h */ +#define OCM__BASE (WM_USER+0x1c00) +#endif + +/*********************************************************************** + * COMCTL32_IsReflectedMessage [internal] + * + * Some parents reflect notify messages - for some messages sent by the child, + * they send it back with the message code increased by OCM__BASE (0x2000). + * This allows better subclassing of controls. We don't need to handle such + * messages but we don't want to print ERRs for them, so this helper function + * identifies them. + * + * Some of the codes are in the CCM_FIRST..CCM_LAST range, but there is no + * colision with defined CCM_ codes. + */ +BOOL COMCTL32_IsReflectedMessage(UINT uMsg) +{ + switch (uMsg) + { + case OCM__BASE + WM_COMMAND: + case OCM__BASE + WM_CTLCOLORBTN: + case OCM__BASE + WM_CTLCOLOREDIT: + case OCM__BASE + WM_CTLCOLORDLG: + case OCM__BASE + WM_CTLCOLORLISTBOX: + case OCM__BASE + WM_CTLCOLORMSGBOX: + case OCM__BASE + WM_CTLCOLORSCROLLBAR: + case OCM__BASE + WM_CTLCOLORSTATIC: + case OCM__BASE + WM_DRAWITEM: + case OCM__BASE + WM_MEASUREITEM: + case OCM__BASE + WM_DELETEITEM: + case OCM__BASE + WM_VKEYTOITEM: + case OCM__BASE + WM_CHARTOITEM: + case OCM__BASE + WM_COMPAREITEM: + case OCM__BASE + WM_HSCROLL: + case OCM__BASE + WM_VSCROLL: + case OCM__BASE + WM_PARENTNOTIFY: + case OCM__BASE + WM_NOTIFY: + return TRUE; + default: + return FALSE; + } +} + /*********************************************************************** * MirrorIcon [COMCTL32.414] * diff --git a/reactos/dll/win32/comctl32/datetime.c b/reactos/dll/win32/comctl32/datetime.c index b46c4956cb8..ae538a535e9 100644 --- a/reactos/dll/win32/comctl32/datetime.c +++ b/reactos/dll/win32/comctl32/datetime.c @@ -707,7 +707,7 @@ DATETIME_HitTest (const DATETIME_INFO *infoPtr, POINT pt) static LRESULT -DATETIME_LButtonDown (DATETIME_INFO *infoPtr, WORD wKey, INT x, INT y) +DATETIME_LButtonDown (DATETIME_INFO *infoPtr, INT x, INT y) { POINT pt; int old, new; @@ -769,7 +769,7 @@ DATETIME_LButtonDown (DATETIME_INFO *infoPtr, WORD wKey, INT x, INT y) static LRESULT -DATETIME_LButtonUp (DATETIME_INFO *infoPtr, WORD wKey) +DATETIME_LButtonUp (DATETIME_INFO *infoPtr) { if(infoPtr->bCalDepressed) { infoPtr->bCalDepressed = FALSE; @@ -865,7 +865,7 @@ DATETIME_EraseBackground (const DATETIME_INFO *infoPtr, HDC hdc) static LRESULT -DATETIME_Notify (DATETIME_INFO *infoPtr, int idCtrl, LPNMHDR lpnmh) +DATETIME_Notify (DATETIME_INFO *infoPtr, LPNMHDR lpnmh) { TRACE ("Got notification %x from %p\n", lpnmh->code, lpnmh->hwndFrom); TRACE ("info: %p %p %p\n", infoPtr->hwndSelf, infoPtr->hMonthCal, infoPtr->hUpdown); @@ -890,7 +890,7 @@ DATETIME_Notify (DATETIME_INFO *infoPtr, int idCtrl, LPNMHDR lpnmh) static LRESULT -DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags) +DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode) { int fieldNum = infoPtr->select & DTHT_DATEFIELD; int wrap = 0; @@ -902,83 +902,6 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags) FIXME ("Callbacks not implemented yet\n"); } - if (vkCode >= '0' && vkCode <= '9') { - /* this is a somewhat simplified version of what Windows does */ - SYSTEMTIME *date = &infoPtr->date; - switch (infoPtr->fieldspec[fieldNum]) { - case ONEDIGITYEAR: - case TWODIGITYEAR: - date->wYear = date->wYear - (date->wYear%100) + - (date->wYear%10)*10 + (vkCode-'0'); - date->wDayOfWeek = DATETIME_CalculateDayOfWeek( - date->wDay,date->wMonth,date->wYear); - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case INVALIDFULLYEAR: - case FULLYEAR: - date->wYear = (date->wYear%1000)*10 + (vkCode-'0'); - date->wDayOfWeek = DATETIME_CalculateDayOfWeek( - date->wDay,date->wMonth,date->wYear); - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGITMONTH: - case TWODIGITMONTH: - if ((date->wMonth%10) > 1 || (vkCode-'0') > 2) - date->wMonth = vkCode-'0'; - else - date->wMonth = (date->wMonth%10)*10+vkCode-'0'; - date->wDayOfWeek = DATETIME_CalculateDayOfWeek( - date->wDay,date->wMonth,date->wYear); - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGITDAY: - case TWODIGITDAY: - /* probably better checking here would help */ - if ((date->wDay%10) >= 3 && (vkCode-'0') > 1) - date->wDay = vkCode-'0'; - else - date->wDay = (date->wDay%10)*10+vkCode-'0'; - date->wDayOfWeek = DATETIME_CalculateDayOfWeek( - date->wDay,date->wMonth,date->wYear); - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGIT12HOUR: - case TWODIGIT12HOUR: - if ((date->wHour%10) > 1 || (vkCode-'0') > 2) - date->wHour = vkCode-'0'; - else - date->wHour = (date->wHour%10)*10+vkCode-'0'; - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGIT24HOUR: - case TWODIGIT24HOUR: - if ((date->wHour%10) > 2) - date->wHour = vkCode-'0'; - else if ((date->wHour%10) == 2 && (vkCode-'0') > 3) - date->wHour = vkCode-'0'; - else - date->wHour = (date->wHour%10)*10+vkCode-'0'; - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGITMINUTE: - case TWODIGITMINUTE: - if ((date->wMinute%10) > 5) - date->wMinute = vkCode-'0'; - else - date->wMinute = (date->wMinute%10)*10+vkCode-'0'; - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - case ONEDIGITSECOND: - case TWODIGITSECOND: - if ((date->wSecond%10) > 5) - date->wSecond = vkCode-'0'; - else - date->wSecond = (date->wSecond%10)*10+vkCode-'0'; - DATETIME_SendDateTimeChangeNotify (infoPtr); - break; - } - } - switch (vkCode) { case VK_ADD: case VK_UP: @@ -1025,6 +948,94 @@ DATETIME_KeyDown (DATETIME_INFO *infoPtr, DWORD vkCode, LPARAM flags) } +static LRESULT +DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode) +{ + int fieldNum = infoPtr->select & DTHT_DATEFIELD; + + if (vkCode >= '0' && vkCode <= '9') { + int num = vkCode-'0'; + int newDays; + + /* this is a somewhat simplified version of what Windows does */ + SYSTEMTIME *date = &infoPtr->date; + switch (infoPtr->fieldspec[fieldNum]) { + case ONEDIGITYEAR: + case TWODIGITYEAR: + date->wYear = date->wYear - (date->wYear%100) + + (date->wYear%10)*10 + num; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case INVALIDFULLYEAR: + case FULLYEAR: + date->wYear = (date->wYear%1000)*10 + num; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMONTH: + case TWODIGITMONTH: + if ((date->wMonth%10) > 1 || num > 2) + date->wMonth = num; + else + date->wMonth = (date->wMonth%10)*10+num; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITDAY: + case TWODIGITDAY: + newDays = (date->wDay%10)*10+num; + if (newDays > MONTHCAL_MonthLength(date->wMonth, date->wYear)) + date->wDay = num; + else + date->wDay = newDays; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT12HOUR: + case TWODIGIT12HOUR: + if ((date->wHour%10) > 1 || num > 2) + date->wHour = num; + else + date->wHour = (date->wHour%10)*10+num; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT24HOUR: + case TWODIGIT24HOUR: + if ((date->wHour%10) > 2) + date->wHour = num; + else if ((date->wHour%10) == 2 && num > 3) + date->wHour = num; + else + date->wHour = (date->wHour%10)*10+num; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMINUTE: + case TWODIGITMINUTE: + if ((date->wMinute%10) > 5) + date->wMinute = num; + else + date->wMinute = (date->wMinute%10)*10+num; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITSECOND: + case TWODIGITSECOND: + if ((date->wSecond%10) > 5) + date->wSecond = num; + else + date->wSecond = (date->wSecond%10)*10+num; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + } + } + return 0; +} + + static LRESULT DATETIME_VScroll (DATETIME_INFO *infoPtr, WORD wScroll) { @@ -1138,7 +1149,7 @@ DATETIME_SendSimpleNotify (const DATETIME_INFO *infoPtr, UINT code) } static LRESULT -DATETIME_Size (DATETIME_INFO *infoPtr, WORD flags, INT width, INT height) +DATETIME_Size (DATETIME_INFO *infoPtr, INT width, INT height) { /* set size */ infoPtr->rcClient.bottom = height; @@ -1225,7 +1236,7 @@ static LRESULT DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) { static const WCHAR SysMonthCal32W[] = { 'S', 'y', 's', 'M', 'o', 'n', 't', 'h', 'C', 'a', 'l', '3', '2', 0 }; - DATETIME_INFO *infoPtr = (DATETIME_INFO *)Alloc (sizeof(DATETIME_INFO)); + DATETIME_INFO *infoPtr = Alloc (sizeof(DATETIME_INFO)); STYLESTRUCT ss = { 0, lpcs->style }; if (!infoPtr) return -1; @@ -1234,9 +1245,9 @@ DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) infoPtr->dwStyle = lpcs->style; infoPtr->nrFieldsAllocated = 32; - infoPtr->fieldspec = (int *) Alloc (infoPtr->nrFieldsAllocated * sizeof(int)); - infoPtr->fieldRect = (RECT *) Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT)); - infoPtr->buflen = (int *) Alloc (infoPtr->nrFieldsAllocated * sizeof(int)); + infoPtr->fieldspec = Alloc (infoPtr->nrFieldsAllocated * sizeof(int)); + infoPtr->fieldRect = Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT)); + infoPtr->buflen = Alloc (infoPtr->nrFieldsAllocated * sizeof(int)); infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->select = -1; /* initially, nothing is selected */ infoPtr->bDropdownEnabled = TRUE; @@ -1323,7 +1334,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return SendMessageW (infoPtr->hMonthCal, WM_GETFONT, wParam, lParam); case WM_NOTIFY: - return DATETIME_Notify (infoPtr, (int)wParam, (LPNMHDR)lParam); + return DATETIME_Notify (infoPtr, (LPNMHDR)lParam); case WM_ENABLE: return DATETIME_Enable (infoPtr, (BOOL)wParam); @@ -1339,7 +1350,10 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DATETIME_Paint (infoPtr, (HDC)wParam); case WM_KEYDOWN: - return DATETIME_KeyDown (infoPtr, wParam, lParam); + return DATETIME_KeyDown (infoPtr, wParam); + + case WM_CHAR: + return DATETIME_Char (infoPtr, wParam); case WM_KILLFOCUS: return DATETIME_KillFocus (infoPtr, (HWND)wParam); @@ -1351,13 +1365,13 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DATETIME_SetFocus (infoPtr, (HWND)wParam); case WM_SIZE: - return DATETIME_Size (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return DATETIME_Size (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_LBUTTONDOWN: - return DATETIME_LButtonDown (infoPtr, (WORD)wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return DATETIME_LButtonDown (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_LBUTTONUP: - return DATETIME_LButtonUp (infoPtr, (WORD)wParam); + return DATETIME_LButtonUp (infoPtr); case WM_VSCROLL: return DATETIME_VScroll (infoPtr, (WORD)wParam); @@ -1381,7 +1395,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return (LRESULT) infoPtr->hFont; default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/dpa.c b/reactos/dll/win32/comctl32/dpa.c index e5f98b9e956..a14c53079e8 100644 --- a/reactos/dll/win32/comctl32/dpa.c +++ b/reactos/dll/win32/comctl32/dpa.c @@ -106,7 +106,7 @@ HRESULT WINAPI DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, if (!phDpa || !loadProc || !pStream) return E_INVALIDARG; - *phDpa = (HDPA)NULL; + *phDpa = NULL; position.QuadPart = 0; diff --git a/reactos/dll/win32/comctl32/flatsb.c b/reactos/dll/win32/comctl32/flatsb.c index 080aff98e29..cabcdfcb8f4 100644 --- a/reactos/dll/win32/comctl32/flatsb.c +++ b/reactos/dll/win32/comctl32/flatsb.c @@ -257,7 +257,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return FlatSB_Destroy (hwnd, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/header.c b/reactos/dll/win32/comctl32/header.c index af1923ce6e7..801d339d735 100644 --- a/reactos/dll/win32/comctl32/header.c +++ b/reactos/dll/win32/comctl32/header.c @@ -249,7 +249,7 @@ HEADER_SetItemBounds (HWND hwnd) } static LRESULT -HEADER_Size (HWND hwnd, WPARAM wParam) +HEADER_Size (HWND hwnd) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); @@ -577,7 +577,7 @@ HEADER_Refresh (HWND hwnd, HDC hdc) static void -HEADER_RefreshItem (HWND hwnd, HDC hdc, INT iItem) +HEADER_RefreshItem (HWND hwnd, INT iItem) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); @@ -1073,7 +1073,7 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam) HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd); INT iItem = (INT)wParam; INT iOrder; - INT i; + UINT i; TRACE("[iItem=%d]\n", iItem); @@ -1250,7 +1250,7 @@ HEADER_GetUnicodeFormat (HWND hwnd) static LRESULT -HEADER_HitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_HitTest (HWND hwnd, LPARAM lParam) { LPHDHITTESTINFO phti = (LPHDHITTESTINFO)lParam; @@ -1332,7 +1332,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, const HDITEMW *phdi, BOOL bUnicode) static LRESULT -HEADER_Layout (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_Layout (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); LPHDLAYOUT lpLayout = (LPHDLAYOUT)lParam; @@ -1447,14 +1447,14 @@ HEADER_SetUnicodeFormat (HWND hwnd, WPARAM wParam) static LRESULT -HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_Create (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr; TEXTMETRICW tm; HFONT hOldFont; HDC hdc; - infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO)); + infoPtr = Alloc (sizeof(HEADER_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; @@ -1490,7 +1490,7 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_Destroy (HWND hwnd) { HTHEME theme = GetWindowTheme(hwnd); CloseThemeData(theme); @@ -1498,7 +1498,7 @@ HEADER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) } static LRESULT -HEADER_NCDestroy (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_NCDestroy (HWND hwnd) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); HEADER_ITEM *lpItem; @@ -1544,7 +1544,7 @@ HEADER_IsDragDistance(const HEADER_INFO *infoPtr, const POINT *pt) } static LRESULT -HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_LButtonDblClk (HWND hwnd, LPARAM lParam) { POINT pt; UINT flags; @@ -1564,7 +1564,7 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_LButtonDown (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); @@ -1589,7 +1589,7 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) /* Send WM_CUSTOMDRAW */ hdc = GetDC (hwnd); - HEADER_RefreshItem (hwnd, hdc, nItem); + HEADER_RefreshItem (hwnd, nItem); ReleaseDC (hwnd, hdc); TRACE("Pressed item %d!\n", nItem); @@ -1620,7 +1620,7 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_LButtonUp (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); @@ -1670,7 +1670,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) { infoPtr->items[infoPtr->iMoveItem].bDown = FALSE; hdc = GetDC (hwnd); - HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); + HEADER_RefreshItem (hwnd, infoPtr->iMoveItem); ReleaseDC (hwnd, hdc); HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCLICKW, infoPtr->iMoveItem, NULL); @@ -1735,7 +1735,7 @@ HEADER_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) } static LRESULT -HEADER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_MouseLeave (HWND hwnd) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); /* Reset hot-tracked item when mouse leaves control. */ @@ -1743,7 +1743,7 @@ HEADER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) HDC hdc = GetDC (hwnd); infoPtr->iHotItem = -1; - if (oldHotItem != -1) HEADER_RefreshItem (hwnd, hdc, oldHotItem); + if (oldHotItem != -1) HEADER_RefreshItem (hwnd, oldHotItem); ReleaseDC (hwnd, hdc); return 0; @@ -1751,7 +1751,7 @@ HEADER_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_MouseMove (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); @@ -1814,7 +1814,7 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->items[infoPtr->iMoveItem].bDown = FALSE; if (oldState != infoPtr->items[infoPtr->iMoveItem].bDown) { hdc = GetDC (hwnd); - HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem); + HEADER_RefreshItem (hwnd, infoPtr->iMoveItem); ReleaseDC (hwnd, hdc); } @@ -1866,8 +1866,8 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) TRACKMOUSEEVENT tme; if (oldHotItem != infoPtr->iHotItem && !infoPtr->bDragging) { hdc = GetDC (hwnd); - if (oldHotItem != -1) HEADER_RefreshItem (hwnd, hdc, oldHotItem); - if (infoPtr->iHotItem != -1) HEADER_RefreshItem (hwnd, hdc, infoPtr->iHotItem); + if (oldHotItem != -1) HEADER_RefreshItem (hwnd, oldHotItem); + if (infoPtr->iHotItem != -1) HEADER_RefreshItem (hwnd, infoPtr->iHotItem); ReleaseDC (hwnd, hdc); } tme.cbSize = sizeof( tme ); @@ -1895,7 +1895,7 @@ HEADER_Paint (HWND hwnd, WPARAM wParam) static LRESULT -HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_RButtonUp (HWND hwnd, LPARAM lParam) { BOOL bRet; POINT pt; @@ -1917,7 +1917,7 @@ HEADER_RButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -HEADER_SetCursor (HWND hwnd, WPARAM wParam, LPARAM lParam) +HEADER_SetCursor (HWND hwnd, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); POINT pt; @@ -2033,14 +2033,14 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_GetUnicodeFormat (hwnd); case HDM_HITTEST: - return HEADER_HitTest (hwnd, wParam, lParam); + return HEADER_HitTest (hwnd, lParam); case HDM_INSERTITEMA: case HDM_INSERTITEMW: return HEADER_InsertItemT (hwnd, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_INSERTITEMW); case HDM_LAYOUT: - return HEADER_Layout (hwnd, wParam, lParam); + return HEADER_Layout (hwnd, lParam); case HDM_ORDERTOINDEX: return HEADER_OrderToIndex(hwnd, wParam); @@ -2067,13 +2067,13 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_SetUnicodeFormat (hwnd, wParam); case WM_CREATE: - return HEADER_Create (hwnd, wParam, lParam); + return HEADER_Create (hwnd, lParam); case WM_DESTROY: - return HEADER_Destroy (hwnd, wParam, lParam); + return HEADER_Destroy (hwnd); case WM_NCDESTROY: - return HEADER_NCDestroy (hwnd, wParam, lParam); + return HEADER_NCDestroy (hwnd); case WM_ERASEBKGND: return 1; @@ -2085,25 +2085,25 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_GetFont (hwnd); case WM_LBUTTONDBLCLK: - return HEADER_LButtonDblClk (hwnd, wParam, lParam); + return HEADER_LButtonDblClk (hwnd, lParam); case WM_LBUTTONDOWN: - return HEADER_LButtonDown (hwnd, wParam, lParam); + return HEADER_LButtonDown (hwnd, lParam); case WM_LBUTTONUP: - return HEADER_LButtonUp (hwnd, wParam, lParam); + return HEADER_LButtonUp (hwnd, lParam); case WM_MOUSELEAVE: - return HEADER_MouseLeave (hwnd, wParam, lParam); + return HEADER_MouseLeave (hwnd); case WM_MOUSEMOVE: - return HEADER_MouseMove (hwnd, wParam, lParam); + return HEADER_MouseMove (hwnd, lParam); case WM_NOTIFYFORMAT: return HEADER_NotifyFormat (hwnd, wParam, lParam); case WM_SIZE: - return HEADER_Size (hwnd, wParam); + return HEADER_Size (hwnd); case WM_THEMECHANGED: return HEADER_ThemeChanged (hwnd); @@ -2113,10 +2113,10 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_Paint (hwnd, wParam); case WM_RBUTTONUP: - return HEADER_RButtonUp (hwnd, wParam, lParam); + return HEADER_RButtonUp (hwnd, lParam); case WM_SETCURSOR: - return HEADER_SetCursor (hwnd, wParam, lParam); + return HEADER_SetCursor (hwnd, lParam); case WM_SETFONT: return HEADER_SetFont (hwnd, wParam, lParam); @@ -2125,7 +2125,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return HEADER_SetRedraw(hwnd, wParam, lParam); default: - if ((msg >= WM_USER) && (msg < WM_APP)) + if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", msg, wParam, lParam ); return DefWindowProcW(hwnd, msg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/hotkey.c b/reactos/dll/win32/comctl32/hotkey.c index 8a56fd38993..165d95dad7b 100644 --- a/reactos/dll/win32/comctl32/hotkey.c +++ b/reactos/dll/win32/comctl32/hotkey.c @@ -342,7 +342,7 @@ HOTKEY_KeyDown (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags) static LRESULT -HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags) +HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key) { BYTE bOldMod; @@ -383,7 +383,7 @@ HOTKEY_KeyUp (HOTKEY_INFO *infoPtr, DWORD key, DWORD flags) static LRESULT -HOTKEY_KillFocus (HOTKEY_INFO *infoPtr, HWND receiveFocus) +HOTKEY_KillFocus (HOTKEY_INFO *infoPtr) { infoPtr->bFocus = FALSE; DestroyCaret (); @@ -411,7 +411,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs) dwExStyle | WS_EX_CLIENTEDGE); /* allocate memory for info structure */ - infoPtr = (HOTKEY_INFO *)Alloc (sizeof(HOTKEY_INFO)); + infoPtr = Alloc (sizeof(HOTKEY_INFO)); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ @@ -424,7 +424,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs) } static LRESULT -HOTKEY_SetFocus (HOTKEY_INFO *infoPtr, HWND lostFocus) +HOTKEY_SetFocus (HOTKEY_INFO *infoPtr) { infoPtr->bFocus = TRUE; @@ -505,10 +505,10 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_KEYUP: case WM_SYSKEYUP: - return HOTKEY_KeyUp (infoPtr, wParam, lParam); + return HOTKEY_KeyUp (infoPtr, wParam); case WM_KILLFOCUS: - return HOTKEY_KillFocus (infoPtr, (HWND)wParam); + return HOTKEY_KillFocus (infoPtr); case WM_LBUTTONDOWN: return HOTKEY_LButtonDown (infoPtr); @@ -522,13 +522,13 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case WM_SETFOCUS: - return HOTKEY_SetFocus (infoPtr, (HWND)wParam); + return HOTKEY_SetFocus (infoPtr); case WM_SETFONT: return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam)); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/imagelist.c b/reactos/dll/win32/comctl32/imagelist.c index 660edde8621..c2f4f7b07e9 100644 --- a/reactos/dll/win32/comctl32/imagelist.c +++ b/reactos/dll/win32/comctl32/imagelist.c @@ -598,7 +598,7 @@ ImageList_Create (INT cx, INT cy, UINT flags, TRACE("(%d %d 0x%x %d %d)\n", cx, cy, flags, cInitial, cGrow); - himl = (HIMAGELIST)Alloc (sizeof(struct _IMAGELIST)); + himl = Alloc (sizeof(struct _IMAGELIST)); if (!himl) return NULL; @@ -658,11 +658,11 @@ ImageList_Create (INT cx, INT cy, UINT flags, himl->hbmMask = 0; /* create blending brushes */ - hbmTemp = CreateBitmap (8, 8, 1, 1, &aBitBlend25); + hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25); himl->hbrBlend25 = CreatePatternBrush (hbmTemp); DeleteObject (hbmTemp); - hbmTemp = CreateBitmap (8, 8, 1, 1, &aBitBlend50); + hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend50); himl->hbrBlend50 = CreatePatternBrush (hbmTemp); DeleteObject (hbmTemp); @@ -1212,7 +1212,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp) /* Create the blend Mask */ hOldBitmap = SelectObject(hBlendMaskDC, hBlendMaskBmp); hBlendBrush = fStyle & ILD_BLEND50 ? himl->hbrBlend50 : himl->hbrBlend25; - hOldBrush = (HBRUSH) SelectObject(hBlendMaskDC, hBlendBrush); + hOldBrush = SelectObject(hBlendMaskDC, hBlendBrush); PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY); SelectObject(hBlendMaskDC, hOldBrush); @@ -1225,7 +1225,7 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp) /* now apply blend to the current image given the BlendMask */ if (clrBlend == CLR_DEFAULT) clrBlend = GetSysColor (COLOR_HIGHLIGHT); else if (clrBlend == CLR_NONE) clrBlend = GetTextColor (pimldp->hdcDst); - hOldBrush = (HBRUSH) SelectObject (hImageDC, CreateSolidBrush(clrBlend)); + hOldBrush = SelectObject (hImageDC, CreateSolidBrush(clrBlend)); BitBlt (hImageDC, 0, 0, cx, cy, hBlendMaskDC, 0, 0, 0xB8074A); /* PSDPxax */ DeleteObject(SelectObject(hImageDC, hOldBrush)); SelectObject(hBlendMaskDC, hOldBitmap); @@ -1899,7 +1899,7 @@ static int DIB_GetDIBImageBytes( int width, int height, int depth ) /* helper for ImageList_Read, see comments below */ -static BOOL _read_bitmap(HIMAGELIST himl, HDC hdcIml, LPSTREAM pstm) +static BOOL _read_bitmap(HDC hdcIml, LPSTREAM pstm) { BITMAPFILEHEADER bmfh; int bitsperpixel, palspace; @@ -1908,13 +1908,13 @@ static BOOL _read_bitmap(HIMAGELIST himl, HDC hdcIml, LPSTREAM pstm) int result = FALSE; LPBYTE bits = NULL; - if (!SUCCEEDED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL))) + if (FAILED(IStream_Read ( pstm, &bmfh, sizeof(bmfh), NULL))) return FALSE; if (bmfh.bfType != (('M'<<8)|'B')) return FALSE; - if (!SUCCEEDED(IStream_Read ( pstm, &bmi->bmiHeader, sizeof(bmi->bmiHeader), NULL))) + if (FAILED(IStream_Read ( pstm, &bmi->bmiHeader, sizeof(bmi->bmiHeader), NULL))) return FALSE; if ((bmi->bmiHeader.biSize != sizeof(bmi->bmiHeader))) @@ -1933,13 +1933,13 @@ static BOOL _read_bitmap(HIMAGELIST himl, HDC hdcIml, LPSTREAM pstm) bmi->bmiHeader.biSizeImage = DIB_GetDIBImageBytes(bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, bitsperpixel); /* read the palette right after the end of the bitmapinfoheader */ - if (palspace && !SUCCEEDED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL))) + if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL))) goto error; bits = Alloc(bmi->bmiHeader.biSizeImage); if (!bits) goto error; - if (!SUCCEEDED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL))) + if (FAILED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL))) goto error; if (!StretchDIBits(hdcIml, 0, 0, bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, @@ -1992,7 +1992,7 @@ HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm) TRACE("%p\n", pstm); - if (!SUCCEEDED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL))) + if (FAILED(IStream_Read (pstm, &ilHead, sizeof(ILHEAD), NULL))) return NULL; if (ilHead.usMagic != (('L' << 8) | 'I')) return NULL; @@ -2006,14 +2006,14 @@ HIMAGELIST WINAPI ImageList_Read (LPSTREAM pstm) if (!himl) return NULL; - if (!_read_bitmap(himl, himl->hdcImage, pstm)) + if (!_read_bitmap(himl->hdcImage, pstm)) { WARN("failed to read bitmap from stream\n"); return NULL; } if (ilHead.flags & ILC_MASK) { - if (!_read_bitmap(himl, himl->hdcMask, pstm)) + if (!_read_bitmap(himl->hdcMask, pstm)) { WARN("failed to read mask bitmap from stream\n"); return NULL; @@ -2740,7 +2740,7 @@ _write_bitmap(HBITMAP hBitmap, LPSTREAM pstm) inf->bmiColors[1].rgbRed = inf->bmiColors[1].rgbGreen = inf->bmiColors[1].rgbBlue = 0xff; } - if(!SUCCEEDED(IStream_Write(pstm, data, totalSize, NULL))) + if(FAILED(IStream_Write(pstm, data, totalSize, NULL))) goto failed; result = TRUE; @@ -2796,7 +2796,7 @@ ImageList_Write (HIMAGELIST himl, LPSTREAM pstm) TRACE("cx %u, cy %u, flags 0x04%x, cCurImage %u, cMaxImage %u\n", ilHead.cx, ilHead.cy, ilHead.flags, ilHead.cCurImage, ilHead.cMaxImage); - if(!SUCCEEDED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL))) + if(FAILED(IStream_Write(pstm, &ilHead, sizeof(ILHEAD), NULL))) return FALSE; /* write the bitmap */ diff --git a/reactos/dll/win32/comctl32/ipaddress.c b/reactos/dll/win32/comctl32/ipaddress.c index c29406fd186..15d39f57fd5 100644 --- a/reactos/dll/win32/comctl32/ipaddress.c +++ b/reactos/dll/win32/comctl32/ipaddress.c @@ -178,7 +178,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) SetWindowLongW (hwnd, GWL_STYLE, GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); - infoPtr = (IPADDRESS_INFO *)Alloc (sizeof(IPADDRESS_INFO)); + infoPtr = Alloc (sizeof(IPADDRESS_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); @@ -193,7 +193,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) infoPtr->Enabled = TRUE; infoPtr->Notify = lpCreate->hwndParent; - hSysFont = (HFONT) GetStockObject(ANSI_VAR_FONT); + hSysFont = GetStockObject(ANSI_VAR_FONT); GetObjectW(hSysFont, sizeof(LOGFONTW), &logSysFont); SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0); strcpyW(logFont.lfFaceName, logSysFont.lfFaceName); @@ -454,7 +454,7 @@ static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int LRESULT CALLBACK IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND Self = (HWND)GetPropW (hwnd, IP_SUBCLASS_PROP); + HWND Self = GetPropW (hwnd, IP_SUBCLASS_PROP); IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (Self, 0); CHAR c = (CHAR)wParam; INT index, len = 0, startsel, endsel; @@ -590,7 +590,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return IPADDRESS_IsBlank (infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/reactos/dll/win32/comctl32/listview.c b/reactos/dll/win32/comctl32/listview.c index 6b16a7bbab7..172925f642a 100644 --- a/reactos/dll/win32/comctl32/listview.c +++ b/reactos/dll/win32/comctl32/listview.c @@ -95,10 +95,8 @@ * -- LVS_EX_INFOTIP * -- LVS_EX_LABELTIP * -- LVS_EX_MULTIWORKAREAS - * -- LVS_EX_ONECLICKACTIVATE * -- LVS_EX_REGIONAL * -- LVS_EX_SIMPLESELECT - * -- LVS_EX_TRACKSELECT * -- LVS_EX_TWOCLICKACTIVATE * -- LVS_EX_UNDERLINECOLD * -- LVS_EX_UNDERLINEHOT @@ -257,6 +255,7 @@ typedef struct tagLISTVIEW_INFO HIMAGELIST himlState; BOOL bLButtonDown; BOOL bRButtonDown; + BOOL bDragging; POINT ptClickPos; /* point where the user clicked */ BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ INT nItemHeight; @@ -541,7 +540,7 @@ static inline int lstrncmpiW(LPCWSTR s1, LPCWSTR s2, int n) { int res; - n = min(min(n, strlenW(s1)), strlenW(s2)); + n = min(min(n, lstrlenW(s1)), lstrlenW(s2)); res = CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, s1, n, s2, n); return res ? res - sizeof(WCHAR) : res; } @@ -822,7 +821,7 @@ static BOOL notify_deleteitem(const LISTVIEW_INFO *infoPtr, INT nItem) return IsWindow(hwnd); } -static int get_ansi_notification(INT unicodeNotificationCode) +static int get_ansi_notification(UINT unicodeNotificationCode) { switch (unicodeNotificationCode) { @@ -846,11 +845,12 @@ static int get_ansi_notification(INT unicodeNotificationCode) pdi : dispinfo structure (can be unicode or ansi) isW : TRUE if dispinfo is Unicode */ -static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, INT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW) +static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT notificationCode, LPNMLVDISPINFOW pdi, BOOL isW) { BOOL bResult = FALSE; BOOL convertToAnsi = FALSE, convertToUnicode = FALSE; - INT cchTempBufMax = 0, savCchTextMax = 0, realNotifCode; + INT cchTempBufMax = 0, savCchTextMax = 0; + UINT realNotifCode; LPWSTR pszTempBuf = NULL, savPszText = NULL; if ((pdi->item.mask & LVIF_TEXT) && is_textT(pdi->item.pszText, isW)) @@ -1711,7 +1711,8 @@ static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) if(vertInfo.nPage < infoPtr->nItemHeight) vertInfo.nPage = infoPtr->nItemHeight; - vertInfo.nPage /= infoPtr->nItemHeight; + if (infoPtr->nItemHeight > 0) + vertInfo.nPage /= infoPtr->nItemHeight; } else if (uView != LVS_LIST) /* LVS_ICON, or LVS_SMALLICON */ { @@ -2419,7 +2420,7 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem) /* we should binary search here if need be */ for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { - lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); + lpSubItem = DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem == nSubItem) return lpSubItem; } @@ -2604,12 +2605,12 @@ static void ranges_assert(RANGES ranges, LPCSTR desc, const char *func, int line assert (ranges); assert (DPA_GetPtrCount(ranges->hdpa) >= 0); ranges_dump(ranges); - prev = (RANGE *)DPA_GetPtr(ranges->hdpa, 0); + prev = DPA_GetPtr(ranges->hdpa, 0); if (DPA_GetPtrCount(ranges->hdpa) > 0) assert (prev->lower >= 0 && prev->lower < prev->upper); for (i = 1; i < DPA_GetPtrCount(ranges->hdpa); i++) { - curr = (RANGE *)DPA_GetPtr(ranges->hdpa, i); + curr = DPA_GetPtr(ranges->hdpa, i); assert (prev->upper <= curr->lower); assert (curr->lower < curr->upper); prev = curr; @@ -3267,6 +3268,13 @@ static BOOL LISTVIEW_GetItemAtPt(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE); } +static inline BOOL LISTVIEW_isHotTracking(const LISTVIEW_INFO *infoPtr) +{ + return ((infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) || + (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE) || + (infoPtr->dwLvExStyle & LVS_EX_TWOCLICKACTIVATE)); +} + /*** * DESCRIPTION: * Called when the mouse is being actively tracked and has hovered for a specified @@ -3287,7 +3295,7 @@ static BOOL LISTVIEW_GetItemAtPt(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVIte */ static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y) { - if (infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) + if (LISTVIEW_isHotTracking(infoPtr)) { LVITEMW item; POINT pt; @@ -3321,27 +3329,47 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN if (!(fwKeys & MK_LBUTTON)) infoPtr->bLButtonDown = FALSE; - if (infoPtr->bLButtonDown && DragDetect(infoPtr->hwndSelf, infoPtr->ptClickPos)) + if (infoPtr->bLButtonDown) { - LVHITTESTINFO lvHitTestInfo; - NMLISTVIEW nmlv; + POINT tmp; + RECT rect; + WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); + WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); - lvHitTestInfo.pt = infoPtr->ptClickPos; - LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); + rect.left = infoPtr->ptClickPos.x - wDragWidth; + rect.right = infoPtr->ptClickPos.x + wDragWidth; + rect.top = infoPtr->ptClickPos.y - wDragHeight; + rect.bottom = infoPtr->ptClickPos.y + wDragHeight; - ZeroMemory(&nmlv, sizeof(nmlv)); - nmlv.iItem = lvHitTestInfo.iItem; - nmlv.ptAction = infoPtr->ptClickPos; + tmp.x = x; + tmp.y = y; - notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); + if (!PtInRect(&rect, tmp)) + { + LVHITTESTINFO lvHitTestInfo; + NMLISTVIEW nmlv; - return 0; + lvHitTestInfo.pt = infoPtr->ptClickPos; + LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); + + ZeroMemory(&nmlv, sizeof(nmlv)); + nmlv.iItem = lvHitTestInfo.iItem; + nmlv.ptAction = infoPtr->ptClickPos; + + if (!infoPtr->bDragging) + { + notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); + infoPtr->bDragging = TRUE; + } + + return 0; + } } else infoPtr->bLButtonDown = FALSE; /* see if we are supposed to be tracking mouse hovering */ - if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) { + if (LISTVIEW_isHotTracking(infoPtr)) { /* fill in the trackinfo struct */ trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); trackinfo.dwFlags = TME_QUERY; @@ -3414,8 +3442,8 @@ static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL } else { - HDPA hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); - lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); + HDPA hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); + lpItem = DPA_GetPtr(hdpaSubItems, 0); assert (lpItem); } @@ -3555,7 +3583,7 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, if (!(lpLVItem->mask & (LVIF_TEXT | LVIF_IMAGE | LVIF_STATE))) return TRUE; /* get the subitem structure, and create it if not there */ - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); assert (hdpaSubItems); lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem); @@ -3569,7 +3597,7 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, /* we could binary search here, if need be...*/ for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { - tmpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); + tmpSubItem = DPA_GetPtr(hdpaSubItems, i); if (tmpSubItem->iSubItem > lpLVItem->iSubItem) break; } if (DPA_InsertPtr(hdpaSubItems, i, lpSubItem) == -1) @@ -4487,10 +4515,10 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) if (!bSuppress) notify_deleteitem(infoPtr, i); if (!(infoPtr->dwStyle & LVS_OWNERDATA)) { - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, i); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i); for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++) { - hdrItem = (ITEMHDR *)DPA_GetPtr(hdpaSubItems, j); + hdrItem = DPA_GetPtr(hdpaSubItems, j); if (is_textW(hdrItem->pszText)) Free(hdrItem->pszText); Free(hdrItem); } @@ -4608,12 +4636,12 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem); nSubItem = 0; lpDelItem = 0; for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { - lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); + lpSubItem = DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem == nColumn) { nSubItem = i; @@ -4767,10 +4795,10 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem) ITEMHDR *hdrItem; INT i; - hdpaSubItems = (HDPA)DPA_DeletePtr(infoPtr->hdpaItems, nItem); + hdpaSubItems = DPA_DeletePtr(infoPtr->hdpaItems, nItem); for (i = 0; i < DPA_GetPtrCount(hdpaSubItems); i++) { - hdrItem = (ITEMHDR *)DPA_GetPtr(hdpaSubItems, i); + hdrItem = DPA_GetPtr(hdpaSubItems, i); if (is_textW(hdrItem->pszText)) Free(hdrItem->pszText); Free(hdrItem); } @@ -4810,15 +4838,30 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, LPWSTR pszText, BOOL { HWND hwndSelf = infoPtr->hwndSelf; NMLVDISPINFOW dispInfo; + INT editedItem = infoPtr->nEditLabelItem; + BOOL bSame; TRACE("(pszText=%s, isW=%d)\n", debugtext_t(pszText, isW), isW); + infoPtr->nEditLabelItem = -1; + ZeroMemory(&dispInfo, sizeof(dispInfo)); - dispInfo.item.mask = LVIF_PARAM | LVIF_STATE; - dispInfo.item.iItem = infoPtr->nEditLabelItem; + dispInfo.item.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT; + dispInfo.item.iItem = editedItem; dispInfo.item.iSubItem = 0; dispInfo.item.stateMask = ~0; if (!LISTVIEW_GetItemW(infoPtr, &dispInfo.item)) return FALSE; + + if (isW) + bSame = (lstrcmpW(dispInfo.item.pszText, pszText) == 0); + else + { + LPWSTR tmp = textdupTtoW(pszText, FALSE); + bSame = (lstrcmpW(dispInfo.item.pszText, tmp) == 0); + textfreeT(tmp, FALSE); + } + if (bSame) return TRUE; + /* add the text from the edit in */ dispInfo.item.mask |= LVIF_TEXT; dispInfo.item.pszText = pszText; @@ -4832,18 +4875,18 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, LPWSTR pszText, BOOL if (!(infoPtr->dwStyle & LVS_OWNERDATA)) { - HDPA hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nEditLabelItem); - ITEM_INFO* lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); + HDPA hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, editedItem); + ITEM_INFO* lpItem = DPA_GetPtr(hdpaSubItems, 0); if (lpItem && lpItem->hdr.pszText == LPSTR_TEXTCALLBACKW) { - LISTVIEW_InvalidateItem(infoPtr, infoPtr->nEditLabelItem); + LISTVIEW_InvalidateItem(infoPtr, editedItem); return TRUE; } } ZeroMemory(&dispInfo, sizeof(dispInfo)); dispInfo.item.mask = LVIF_TEXT; - dispInfo.item.iItem = infoPtr->nEditLabelItem; + dispInfo.item.iItem = editedItem; dispInfo.item.iSubItem = 0; dispInfo.item.pszText = pszText; dispInfo.item.cchTextMax = textlenT(pszText, isW); @@ -5487,8 +5530,8 @@ static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, } /* find the item and subitem structures before we proceed */ - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); - lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem); + lpItem = DPA_GetPtr(hdpaSubItems, 0); assert (lpItem); if (isubitem) @@ -6430,8 +6473,8 @@ static INT LISTVIEW_HitTest(const LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, */ static INT WINAPI LISTVIEW_InsertCompare( LPVOID first, LPVOID second, LPARAM lParam) { - ITEM_INFO* lv_first = (ITEM_INFO*) DPA_GetPtr( (HDPA)first, 0 ); - ITEM_INFO* lv_second = (ITEM_INFO*) DPA_GetPtr( (HDPA)second, 0 ); + ITEM_INFO* lv_first = DPA_GetPtr( (HDPA)first, 0 ); + ITEM_INFO* lv_second = DPA_GetPtr( (HDPA)second, 0 ); INT cmpv = textcmpWT(lv_first->hdr.pszText, lv_second->hdr.pszText, TRUE); /* if we're sorting descending, negate the return value */ @@ -6830,10 +6873,10 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem); for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { - lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); + lpSubItem = DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem >= nNewColumn) lpSubItem->iSubItem++; } @@ -7712,8 +7755,8 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL fUnicode) static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM lParam) { LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam; - ITEM_INFO* lv_first = (ITEM_INFO*) DPA_GetPtr( (HDPA)first, 0 ); - ITEM_INFO* lv_second = (ITEM_INFO*) DPA_GetPtr( (HDPA)second, 0 ); + ITEM_INFO* lv_first = DPA_GetPtr( (HDPA)first, 0 ); + ITEM_INFO* lv_second = DPA_GetPtr( (HDPA)second, 0 ); /* Forward the call to the client defined callback */ return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort ); @@ -7753,8 +7796,8 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, if (infoPtr->nFocusedItem >= 0) { - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nFocusedItem); - lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nFocusedItem); + lpItem = DPA_GetPtr(hdpaSubItems, 0); if (lpItem) lpItem->state |= LVIS_FOCUSED; } /* FIXME: go thorugh selected items and mark them so in lpItem->state */ @@ -7773,8 +7816,8 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, selectionMarkItem=(infoPtr->nSelectionMark>=0)?DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nSelectionMark):NULL; for (i=0; i < infoPtr->nItemCount; i++) { - hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, i); - lpItem = (ITEM_INFO *)DPA_GetPtr(hdpaSubItems, 0); + hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i); + lpItem = DPA_GetPtr(hdpaSubItems, 0); if (lpItem->state & LVIS_SELECTED) { @@ -8018,7 +8061,7 @@ static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) if (!infoPtr->hwndHeader) return -1; /* set header unicode format */ - SendMessageW(infoPtr->hwndHeader, HDM_SETUNICODEFORMAT, (WPARAM)TRUE, (LPARAM)NULL); + SendMessageW(infoPtr->hwndHeader, HDM_SETUNICODEFORMAT, TRUE, 0); /* set header font */ SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, (LPARAM)TRUE); @@ -8578,7 +8621,6 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN { LVHITTESTINFO lvHitTestInfo; static BOOL bGroupSelect = TRUE; - BOOL bReceivedFocus = FALSE; POINT pt = { x, y }; INT nItem; @@ -8587,22 +8629,16 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN /* send NM_RELEASEDCAPTURE notification */ if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0; - if (!infoPtr->bFocus) - { - bReceivedFocus = TRUE; - SetFocus(infoPtr->hwndSelf); - } - /* set left button down flag and record the click position */ infoPtr->bLButtonDown = TRUE; infoPtr->ptClickPos = pt; + infoPtr->bDragging = FALSE; lvHitTestInfo.pt.x = x; lvHitTestInfo.pt.y = y; nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); TRACE("at %s, nItem=%d\n", wine_dbgstr_point(&pt), nItem); - infoPtr->nEditLabelItem = -1; if ((nItem >= 0) && (nItem < infoPtr->nItemCount)) { if ((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && (lvHitTestInfo.flags & LVHT_ONITEMSTATEICON)) @@ -8663,6 +8699,9 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN LISTVIEW_SetSelection(infoPtr, nItem); } } + + if (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE) + if(lvHitTestInfo.iItem != -1) notify_itemactivate(infoPtr,&lvHitTestInfo); } else { @@ -8671,9 +8710,6 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN ReleaseCapture(); } - if (bReceivedFocus) - infoPtr->nEditLabelItem = -1; - return 0; } @@ -8707,6 +8743,12 @@ static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT /* set left button flag */ infoPtr->bLButtonDown = FALSE; + if (infoPtr->bDragging) + { + infoPtr->bDragging = FALSE; + return 0; + } + /* if we clicked on a selected item, edit the label */ if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem && (lvHitTestInfo.flags & LVHT_ONITEMLABEL)) { @@ -8721,6 +8763,9 @@ static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT LISTVIEW_DelayedEditItem); } + if (!infoPtr->bFocus) + SetFocus(infoPtr->hwndSelf); + return 0; } @@ -9198,7 +9243,7 @@ static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, HWND hwnd, UINT nHi { LVHITTESTINFO lvHitTestInfo; - if(!(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)) return FALSE; + if(!(LISTVIEW_isHotTracking(infoPtr))) return FALSE; if(!infoPtr->hHotCursor) return FALSE; @@ -9709,9 +9754,8 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case LVM_GETTOPINDEX: return LISTVIEW_GetTopIndex(infoPtr); - /*case LVM_GETUNICODEFORMAT: - FIXME("LVM_GETUNICODEFORMAT: unimplemented\n"); - return FALSE;*/ + case LVM_GETUNICODEFORMAT: + return (infoPtr->notifyFormat == NFR_UNICODE); /* case LVM_GETVIEW: */ @@ -10033,7 +10077,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case WM_WININICHANGE: */ default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); fwd_msg: diff --git a/reactos/dll/win32/comctl32/monthcal.c b/reactos/dll/win32/comctl32/monthcal.c index a9647cd74a6..15acf1f70bc 100644 --- a/reactos/dll/win32/comctl32/monthcal.c +++ b/reactos/dll/win32/comctl32/monthcal.c @@ -913,7 +913,7 @@ MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam) } else if(lParam >= 7) { - infoPtr->firstDay = localFirstDay; + infoPtr->firstDay = 6; /* max first day allowed */ infoPtr->firstDayHighWord = TRUE; } else @@ -994,7 +994,7 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -MONTHCAL_GetRange(HWND hwnd, WPARAM wParam, LPARAM lParam) +MONTHCAL_GetRange(HWND hwnd, LPARAM lParam) { MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); SYSTEMTIME *lprgSysTimeArray = (SYSTEMTIME *)lParam; @@ -1172,7 +1172,6 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, LPARAM lParam) x = lpht->pt.x; y = lpht->pt.y; - retval = MCHT_NOWHERE; ZeroMemory(&lpht->st, sizeof(lpht->st)); @@ -1303,6 +1302,11 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) nmds.cDayState = infoPtr->monthRange; nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + nmds.stStart = infoPtr->todaysDate; + nmds.stStart.wYear = infoPtr->currentYear; + nmds.stStart.wMonth = infoPtr->currentMonth; + nmds.stStart.wDay = 1; + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1333,6 +1337,11 @@ static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) nmds.prgDayState = Alloc (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + nmds.stStart = infoPtr->todaysDate; + nmds.stStart.wYear = infoPtr->currentYear; + nmds.stStart.wMonth = infoPtr->currentMonth; + nmds.stStart.wDay = 1; + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1383,7 +1392,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) if (infoPtr->hWndYearUpDown) { - infoPtr->currentYear=SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); + infoPtr->currentYear=SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, 0); if(!DestroyWindow(infoPtr->hWndYearUpDown)) { FIXME("Can't destroy Updown Control\n"); @@ -1464,9 +1473,9 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) NULL, NULL, NULL); - SendMessageW( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); - SendMessageW( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); - SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETRANGE, 0, MAKELONG (9999, 1753)); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, 0); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, infoPtr->currentYear); return 0; } @@ -1498,8 +1507,8 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) MONTHCAL_CopyTime(&ht.st, &selArray[0]); MONTHCAL_CopyTime(&ht.st, &selArray[1]); - MONTHCAL_SetSelRange(infoPtr, (LPARAM)&selArray); - MONTHCAL_SetCurSel(infoPtr, (LPARAM)&selArray); + MONTHCAL_SetSelRange(infoPtr, (LPARAM)selArray); + MONTHCAL_SetCurSel(infoPtr, (LPARAM)selArray); TRACE("MCHT_CALENDARDATE\n"); nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); @@ -1621,7 +1630,7 @@ MONTHCAL_Timer(MONTHCAL_INFO *infoPtr, WPARAM wParam) static LRESULT -MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) { MCHITTESTINFO ht; int oldselday, selday, hit; @@ -1647,7 +1656,7 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam) SYSTEMTIME selArray[2]; int i; - MONTHCAL_GetSelRange(infoPtr, (LPARAM)&selArray); + MONTHCAL_GetSelRange(infoPtr, (LPARAM)selArray); i = 0; if(infoPtr->firstSelDay==selArray[0].wDay) i=1; TRACE("oldRange:%d %d %d %d\n", infoPtr->firstSelDay, selArray[0].wDay, selArray[1].wDay, i); @@ -1677,7 +1686,7 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, WPARAM wParam, LPARAM lParam) selArray[0].wDay = tempday; } - MONTHCAL_SetSelRange(infoPtr, (LPARAM)&selArray); + MONTHCAL_SetSelRange(infoPtr, (LPARAM)selArray); } } @@ -1864,6 +1873,8 @@ static LRESULT MONTHCAL_SetFont(MONTHCAL_INFO *infoPtr, HFONT hFont, BOOL redraw lf.lfWeight = FW_BOLD; infoPtr->hBoldFont = CreateFontIndirectW(&lf); + MONTHCAL_UpdateSize(infoPtr); + if (redraw) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); @@ -1875,18 +1886,18 @@ static LRESULT theme_changed (const MONTHCAL_INFO* infoPtr) { HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); CloseThemeData (theme); - theme = OpenThemeData (infoPtr->hwndSelf, themeClass); + OpenThemeData (infoPtr->hwndSelf, themeClass); return 0; } /* FIXME: check whether dateMin/dateMax need to be adjusted. */ static LRESULT -MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam) +MONTHCAL_Create(HWND hwnd, LPARAM lParam) { MONTHCAL_INFO *infoPtr; /* allocate memory for info structure */ - infoPtr =(MONTHCAL_INFO*)Alloc(sizeof(MONTHCAL_INFO)); + infoPtr = Alloc(sizeof(MONTHCAL_INFO)); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); if(infoPtr == NULL) { @@ -2011,7 +2022,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_SetFirstDayOfWeek(infoPtr, lParam); case MCM_GETRANGE: - return MONTHCAL_GetRange(hwnd, wParam, lParam); + return MONTHCAL_GetRange(hwnd, lParam); case MCM_SETRANGE: return MONTHCAL_SetRange(infoPtr, wParam, lParam); @@ -2038,7 +2049,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_LButtonDown(infoPtr, lParam); case WM_MOUSEMOVE: - return MONTHCAL_MouseMove(infoPtr, wParam, lParam); + return MONTHCAL_MouseMove(infoPtr, lParam); case WM_LBUTTONUP: return MONTHCAL_LButtonUp(infoPtr, lParam); @@ -2054,7 +2065,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_Size(infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_CREATE: - return MONTHCAL_Create(hwnd, wParam, lParam); + return MONTHCAL_Create(hwnd, lParam); case WM_SETFONT: return MONTHCAL_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam); @@ -2072,7 +2083,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return MONTHCAL_Destroy(infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR( "unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW(hwnd, uMsg, wParam, lParam); } diff --git a/reactos/dll/win32/comctl32/nativefont.c b/reactos/dll/win32/comctl32/nativefont.c index a599a2aa984..2e11a9e665a 100644 --- a/reactos/dll/win32/comctl32/nativefont.c +++ b/reactos/dll/win32/comctl32/nativefont.c @@ -47,12 +47,12 @@ typedef struct #define NATIVEFONT_GetInfoPtr(hwnd) ((NATIVEFONT_INFO *)GetWindowLongPtrW (hwnd, 0)) static LRESULT -NATIVEFONT_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) +NATIVEFONT_Create (HWND hwnd) { NATIVEFONT_INFO *infoPtr; /* allocate memory for info structure */ - infoPtr = (NATIVEFONT_INFO *)Alloc (sizeof(NATIVEFONT_INFO)); + infoPtr = Alloc (sizeof(NATIVEFONT_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ @@ -85,7 +85,7 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case WM_CREATE: - return NATIVEFONT_Create (hwnd, wParam, lParam); + return NATIVEFONT_Create (hwnd); case WM_DESTROY: return NATIVEFONT_Destroy (infoPtr); @@ -101,7 +101,7 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcW (hwnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/pager.c b/reactos/dll/win32/comctl32/pager.c index 11a78a93d55..fdf470cc4c3 100644 --- a/reactos/dll/win32/comctl32/pager.c +++ b/reactos/dll/win32/comctl32/pager.c @@ -237,7 +237,7 @@ PAGER_DrawButton(HDC hdc, COLORREF clrBk, RECT arrowRect, return; hBrush = CreateSolidBrush(clrBk); - hOldBrush = (HBRUSH)SelectObject(hdc, hBrush); + hOldBrush = SelectObject(hdc, hBrush); FillRect(hdc, &rc, hBrush); @@ -801,7 +801,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) PAGER_INFO *infoPtr; /* allocate memory for info structure */ - infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO)); + infoPtr = Alloc (sizeof(PAGER_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); diff --git a/reactos/dll/win32/comctl32/progress.c b/reactos/dll/win32/comctl32/progress.c index d3b7ded976c..776345ffda1 100644 --- a/reactos/dll/win32/comctl32/progress.c +++ b/reactos/dll/win32/comctl32/progress.c @@ -567,7 +567,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); /* allocate memory for info struct */ - infoPtr = (PROGRESS_INFO *)Alloc (sizeof(PROGRESS_INFO)); + infoPtr = Alloc (sizeof(PROGRESS_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); @@ -722,7 +722,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, return infoPtr->Marquee; default: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam ); return DefWindowProcW( hwnd, message, wParam, lParam ); } diff --git a/reactos/dll/win32/comctl32/propsheet.c b/reactos/dll/win32/comctl32/propsheet.c index 09c32777565..7c2f26a8ec5 100644 --- a/reactos/dll/win32/comctl32/propsheet.c +++ b/reactos/dll/win32/comctl32/propsheet.c @@ -441,7 +441,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, (LPWSTR)RT_DIALOG); HGLOBAL hTemplate = LoadResource(lppsp->hInstance, hResource); - pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate); + pTemplate = LockResource(hTemplate); } else { @@ -450,7 +450,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, (LPSTR)RT_DIALOG); HGLOBAL hTemplate = LoadResource(lppsp->hInstance, hResource); - pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate); + pTemplate = LockResource(hTemplate); } /* @@ -1412,7 +1412,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, if(!hTemplate) return FALSE; - pTemplate = (LPDLGTEMPLATEW)LockResource(hTemplate); + pTemplate = LockResource(hTemplate); /* * Make a copy of the dialog template to make it writable */ @@ -1434,7 +1434,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, if(!hTemplate) return FALSE; - pTemplate = (LPDLGTEMPLATEA)LockResource(hTemplate); + pTemplate = LockResource(hTemplate); /* * Make a copy of the dialog template to make it writable */ @@ -1604,8 +1604,7 @@ static BOOL PROPSHEET_Back(HWND hwndDlg) { PSHNOTIFY psn; HWND hwndPage; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); LRESULT result; int idx; @@ -1644,8 +1643,7 @@ static BOOL PROPSHEET_Next(HWND hwndDlg) PSHNOTIFY psn; HWND hwndPage; LRESULT msgResult = 0; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); int idx; TRACE("active_page %d\n", psInfo->active_page); @@ -1684,8 +1682,7 @@ static BOOL PROPSHEET_Finish(HWND hwndDlg) PSHNOTIFY psn; HWND hwndPage; LRESULT msgResult = 0; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("active_page %d\n", psInfo->active_page); if (psInfo->active_page < 0) @@ -1723,8 +1720,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) int i; HWND hwndPage; PSHNOTIFY psn; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("active_page %d\n", psInfo->active_page); if (psInfo->active_page < 0) @@ -1787,8 +1783,7 @@ static BOOL PROPSHEET_Apply(HWND hwndDlg, LPARAM lParam) */ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndPage; PSHNOTIFY psn; int i; @@ -1831,8 +1826,7 @@ static void PROPSHEET_Cancel(HWND hwndDlg, LPARAM lParam) */ static void PROPSHEET_Help(HWND hwndDlg) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndPage; PSHNOTIFY psn; @@ -1855,8 +1849,7 @@ static void PROPSHEET_Help(HWND hwndDlg) static void PROPSHEET_Changed(HWND hwndDlg, HWND hwndDirtyPage) { int i; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("\n"); if (!psInfo) return; @@ -1888,8 +1881,7 @@ static void PROPSHEET_UnChanged(HWND hwndDlg, HWND hwndCleanPage) int i; BOOL noPageDirty = TRUE; HWND hwndApplyBtn = GetDlgItem(hwndDlg, IDC_APPLY_BUTTON); - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("\n"); if ( !psInfo ) return; @@ -1961,8 +1953,7 @@ static void PROPSHEET_PressButton(HWND hwndDlg, int buttonID) */ static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndPage; PSHNOTIFY psn; BOOL res = FALSE; @@ -2005,7 +1996,7 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, HPROPSHEETPAGE hpage ) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP); HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); @@ -2120,8 +2111,7 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg, static void PROPSHEET_SetCurSelId(HWND hwndDlg, int id) { int idx; - PropSheetInfo* psInfo = - (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); idx = PROPSHEET_FindPageByResId(psInfo, id); if (idx < psInfo->nPages ) @@ -2154,8 +2144,8 @@ static void PROPSHEET_SetTitleA(HWND hwndDlg, DWORD dwStyle, LPCSTR lpszText) */ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); - WCHAR szTitle[256]; + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); + WCHAR szTitle[256]; TRACE("%s (style %08x)\n", debugstr_w(lpszText), dwStyle); if (HIWORD(lpszText) == 0) { @@ -2185,7 +2175,7 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText) */ static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); TRACE("'%s'\n", lpszText); @@ -2214,7 +2204,7 @@ static void PROPSHEET_SetFinishTextA(HWND hwndDlg, LPCSTR lpszText) */ static void PROPSHEET_SetFinishTextW(HWND hwndDlg, LPCWSTR lpszText) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndButton = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); TRACE("%s\n", debugstr_w(lpszText)); @@ -2247,7 +2237,7 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg, int i = 0; HWND hwndPage; LRESULT msgResult = 0; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); while ((i < psInfo->nPages) && (msgResult == 0)) { @@ -2267,8 +2257,7 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg, HPROPSHEETPAGE hpage) { PropPageInfo * ppi; - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); TCITEMW item; LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage; @@ -2277,9 +2266,7 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg, /* * Allocate and fill in a new PropPageInfo entry. */ - ppi = (PropPageInfo*) ReAlloc(psInfo->proppage, - sizeof(PropPageInfo) * - (psInfo->nPages + 1)); + ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1)); if (!ppi) return FALSE; @@ -2331,8 +2318,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage) { - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); PropPageInfo* oldPages; @@ -2431,28 +2417,6 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, return FALSE; } -BOOL CALLBACK -EnumChildProc(HWND hwnd, LPARAM lParam) -{ - WCHAR szType[20]; - RealGetWindowClassW(hwnd, szType, 20); - - if (strcmpW(szType, WC_EDITW) == 0) - { - if (IsWindowEnabled(hwnd) && IsWindowVisible(hwnd)) - { - SetFocus(hwnd); - return FALSE; - } - } - else - { - EnumChildWindows(hwnd, EnumChildProc, 0); - } - - return TRUE; -} - /****************************************************************************** * PROPSHEET_SetWizButtons * @@ -2463,8 +2427,7 @@ EnumChildProc(HWND hwnd, LPARAM lParam) */ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndBack = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); HWND hwndNext = GetDlgItem(hwndDlg, IDC_NEXT_BUTTON); HWND hwndFinish = GetDlgItem(hwndDlg, IDC_FINISH_BUTTON); @@ -2475,6 +2438,17 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) EnableWindow(hwndNext, FALSE); EnableWindow(hwndFinish, FALSE); + /* set the default pushbutton to an enabled button */ + if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + else if (dwFlags & PSWIZB_NEXT) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); + else if (dwFlags & PSWIZB_BACK) + SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); + else + SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); + + if (dwFlags & PSWIZB_BACK) EnableWindow(hwndBack, TRUE); @@ -2504,32 +2478,6 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags) } else if (!(dwFlags & PSWIZB_DISABLEDFINISH)) EnableWindow(hwndFinish, TRUE); - - /* set the default pushbutton to an enabled button and give it focus */ - if (((dwFlags & PSWIZB_FINISH) || psInfo->hasFinish) && !(dwFlags & PSWIZB_DISABLEDFINISH)) - { - SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); - SetFocus(hwndFinish); - } - else if (dwFlags & PSWIZB_NEXT) - { - SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); - SetFocus(hwndNext); - } - else if (dwFlags & PSWIZB_BACK) - { - SendMessageW(hwndDlg, DM_SETDEFID, IDC_BACK_BUTTON, 0); - SetFocus(hwndBack); - } - else - { - SendMessageW(hwndDlg, DM_SETDEFID, IDCANCEL, 0); - SetFocus(GetDlgItem(hwndDlg, IDCANCEL)); - } - - /* Now try to find an edit control that deserves focus */ - EnumChildWindows(PropSheet_GetCurrentPageHwnd(hwndDlg), EnumChildProc, 0); - } /****************************************************************************** @@ -2582,8 +2530,7 @@ static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR ps static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg) { int index; - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %p)\n", hwndDlg, hPageDlg); @@ -2599,8 +2546,7 @@ static LRESULT PROPSHEET_HwndToIndex(HWND hwndDlg, HWND hPageDlg) */ static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex) { - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %d)\n", hwndDlg, iPageIndex); if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { WARN("%d out of range.\n", iPageIndex); @@ -2615,8 +2561,7 @@ static LRESULT PROPSHEET_IndexToHwnd(HWND hwndDlg, int iPageIndex) static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage) { int index; - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %p)\n", hwndDlg, hPage); @@ -2632,8 +2577,7 @@ static LRESULT PROPSHEET_PageToIndex(HWND hwndDlg, HPROPSHEETPAGE hPage) */ static LRESULT PROPSHEET_IndexToPage(HWND hwndDlg, int iPageIndex) { - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %d)\n", hwndDlg, iPageIndex); if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { WARN("%d out of range.\n", iPageIndex); @@ -2649,8 +2593,7 @@ static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) { int index; LPCPROPSHEETPAGEW psp; - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); TRACE("(%p, %d)\n", hwndDlg, iPageId); for (index = 0; index < psInfo->nPages; index++) { psp = (LPCPROPSHEETPAGEW)psInfo->proppage[index].hpage; @@ -2666,8 +2609,7 @@ static LRESULT PROPSHEET_IdToIndex(HWND hwndDlg, int iPageId) */ static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex) { - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); LPCPROPSHEETPAGEW psp; TRACE("(%p, %d)\n", hwndDlg, iPageIndex); if (iPageIndex<0 || iPageIndex>=psInfo->nPages) { @@ -2686,8 +2628,7 @@ static LRESULT PROPSHEET_IndexToId(HWND hwndDlg, int iPageIndex) */ static LRESULT PROPSHEET_GetResult(HWND hwndDlg) { - PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); return psInfo->result; } @@ -2732,8 +2673,7 @@ static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psI static void PROPSHEET_CleanUp(HWND hwndDlg) { int i; - PropSheetInfo* psInfo = (PropSheetInfo*) RemovePropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = RemovePropW(hwndDlg, PropSheetInfoStr); TRACE("\n"); if (!psInfo) return; @@ -2821,17 +2761,21 @@ static INT do_loop(const PropSheetInfo *psInfo) static INT_PTR PROPSHEET_PropertySheet(PropSheetInfo* psInfo, BOOL unicode) { INT_PTR bRet = 0; + HWND parent = NULL; if (psInfo->active_page >= psInfo->nPages) psInfo->active_page = 0; TRACE("startpage: %d of %d pages\n", psInfo->active_page, psInfo->nPages); psInfo->unicode = unicode; psInfo->ended = FALSE; + if(!psInfo->isModeless) + { + parent = psInfo->ppshheader.hwndParent; + if (parent) EnableWindow(parent, FALSE); + } bRet = PROPSHEET_CreateDialog(psInfo); if(!psInfo->isModeless) { - HWND parent = GetParent(psInfo->hwnd); - if (parent) EnableWindow(parent, FALSE); bRet = do_loop(psInfo); if (parent) EnableWindow(parent, TRUE); } @@ -2853,8 +2797,7 @@ static INT_PTR PROPSHEET_PropertySheet(PropSheetInfo* psInfo, BOOL unicode) */ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) { - PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR, - sizeof(PropSheetInfo)); + PropSheetInfo* psInfo = GlobalAlloc(GPTR, sizeof(PropSheetInfo)); UINT i, n; const BYTE* pByte; @@ -2862,8 +2805,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) PROPSHEET_CollectSheetInfoA(lppsh, psInfo); - psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) * - lppsh->nPages); + psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp; for (n = i = 0; i < lppsh->nPages; i++, n++) @@ -2896,8 +2838,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh) */ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh) { - PropSheetInfo* psInfo = (PropSheetInfo*) GlobalAlloc(GPTR, - sizeof(PropSheetInfo)); + PropSheetInfo* psInfo = GlobalAlloc(GPTR, sizeof(PropSheetInfo)); UINT i, n; const BYTE* pByte; @@ -2905,8 +2846,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh) PROPSHEET_CollectSheetInfoW(lppsh, psInfo); - psInfo->proppage = (PropPageInfo*) Alloc(sizeof(PropPageInfo) * - lppsh->nPages); + psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp; for (n = i = 0; i < lppsh->nPages; i++, n++) @@ -3137,7 +3077,7 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage) */ static BOOL PROPSHEET_IsDialogMessage(HWND hwnd, LPMSG lpMsg) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); TRACE("\n"); if (!psInfo || (hwnd != lpMsg->hwnd && !IsChild(hwnd, lpMsg->hwnd))) @@ -3203,8 +3143,7 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID) if (wID == IDOK) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); /* don't overwrite ID_PSRESTARTWINDOWS or ID_PSREBOOTSYSTEM */ if (psInfo->result == 0) @@ -3253,7 +3192,7 @@ static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID) */ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); PAINTSTRUCT ps; HDC hdc, hdcSrc; BITMAP bm; @@ -3447,7 +3386,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: { PropSheetInfo* psInfo = (PropSheetInfo*) lParam; - WCHAR* strCaption = (WCHAR*)Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR)); + WCHAR* strCaption = Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR)); HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); int idx; LOGFONTW logFont; @@ -3540,8 +3479,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (psInfo->useCallback) - (*(psInfo->ppshheader.pfnCallback))(hwnd, - PSCB_INITIALIZED, (LPARAM)0); + (*(psInfo->ppshheader.pfnCallback))(hwnd, PSCB_INITIALIZED, 0); idx = psInfo->active_page; psInfo->active_page = -1; @@ -3574,7 +3512,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: if (!PROPSHEET_DoCommand(hwnd, LOWORD(wParam))) { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); if (!psInfo) return FALSE; @@ -3614,8 +3552,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_GETCURRENTPAGEHWND: { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); HWND hwndPage = 0; if (!psInfo) @@ -3679,8 +3616,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_RESTARTWINDOWS: { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); if (!psInfo) return FALSE; @@ -3694,8 +3630,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case PSM_REBOOTSYSTEM: { - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, - PropSheetInfoStr); + PropSheetInfo* psInfo = GetPropW(hwnd, PropSheetInfoStr); if (!psInfo) return FALSE; diff --git a/reactos/dll/win32/comctl32/rebar.c b/reactos/dll/win32/comctl32/rebar.c index 638acea20f1..89ac420a1e6 100644 --- a/reactos/dll/win32/comctl32/rebar.c +++ b/reactos/dll/win32/comctl32/rebar.c @@ -253,7 +253,7 @@ typedef struct #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)GetWindowLongPtrW (hwnd, 0)) -static LRESULT REBAR_NotifyFormat(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam); +static LRESULT REBAR_NotifyFormat(REBAR_INFO *infoPtr, LPARAM lParam); static void REBAR_AutoSize(REBAR_INFO *infoPtr, BOOL needsLayout); /* "constant values" retrieved when DLL was initialized */ @@ -484,7 +484,7 @@ REBAR_DrawChevron (HDC hdc, INT left, INT top, INT colorRef) MoveToEx (hdc, x, y, NULL); LineTo (hdc, x+3, y++); x++; MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+1, y++); + LineTo (hdc, x+1, y); SelectObject( hdc, hOldPen ); DeleteObject( hPen ); } @@ -1643,13 +1643,13 @@ REBAR_ValidateBand (const REBAR_INFO *infoPtr, REBAR_BAND *lpBand) lpBand->cxMinBand += CHEVRON_WIDTH; } -static BOOL +static UINT REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBand) /* Function: This routine copies the supplied values from */ /* user input (lprbbi) to the internal band structure. */ - /* It returns true if something changed and false if not. */ + /* It returns the mask of what changed. */ { - BOOL bChanged = FALSE; + UINT uChanged = 0x0; lpBand->fMask |= lprbbi->fMask; @@ -1657,7 +1657,7 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan (lpBand->fStyle != lprbbi->fStyle ) ) { lpBand->fStyle = lprbbi->fStyle; - bChanged = TRUE; + uChanged |= RBBIM_STYLE; } if( (lprbbi->fMask & RBBIM_COLORS) && @@ -1666,14 +1666,14 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan { lpBand->clrFore = lprbbi->clrFore; lpBand->clrBack = lprbbi->clrBack; - bChanged = TRUE; + uChanged |= RBBIM_COLORS; } if( (lprbbi->fMask & RBBIM_IMAGE) && ( lpBand->iImage != lprbbi->iImage ) ) { lpBand->iImage = lprbbi->iImage; - bChanged = TRUE; + uChanged |= RBBIM_IMAGE; } if( (lprbbi->fMask & RBBIM_CHILD) && @@ -1693,13 +1693,13 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan lpBand->hwndChild = 0; lpBand->hwndPrevParent = 0; } - bChanged = TRUE; + uChanged |= RBBIM_CHILD; } if( (lprbbi->fMask & RBBIM_CHILDSIZE) && ( (lpBand->cxMinChild != lprbbi->cxMinChild) || (lpBand->cyMinChild != lprbbi->cyMinChild ) || - ( (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) && + ( (lprbbi->cbSize >= sizeof (REBARBANDINFOA) && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) && ( (lpBand->cyChild != lprbbi->cyChild ) || (lpBand->cyMaxChild != lprbbi->cyMaxChild ) || (lpBand->cyIntegral != lprbbi->cyIntegral ) ) ) || @@ -1722,28 +1722,28 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan lpBand->cyMaxChild = 0x7fffffff; lpBand->cyIntegral = 0; } - bChanged = TRUE; + uChanged |= RBBIM_CHILDSIZE; } if( (lprbbi->fMask & RBBIM_SIZE) && (lpBand->cx != lprbbi->cx ) ) { lpBand->cx = lprbbi->cx; - bChanged = TRUE; + uChanged |= RBBIM_SIZE; } if( (lprbbi->fMask & RBBIM_BACKGROUND) && ( lpBand->hbmBack != lprbbi->hbmBack ) ) { lpBand->hbmBack = lprbbi->hbmBack; - bChanged = TRUE; + uChanged |= RBBIM_BACKGROUND; } if( (lprbbi->fMask & RBBIM_ID) && (lpBand->wID != lprbbi->wID ) ) { lpBand->wID = lprbbi->wID; - bChanged = TRUE; + uChanged |= RBBIM_ID; } /* check for additional data */ @@ -1752,14 +1752,14 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan ( lpBand->cxIdeal != lprbbi->cxIdeal ) ) { lpBand->cxIdeal = lprbbi->cxIdeal; - bChanged = TRUE; + uChanged |= RBBIM_IDEALSIZE; } if( (lprbbi->fMask & RBBIM_LPARAM) && (lpBand->lParam != lprbbi->lParam ) ) { lpBand->lParam = lprbbi->lParam; - bChanged = TRUE; + uChanged |= RBBIM_LPARAM; } if( (lprbbi->fMask & RBBIM_HEADERSIZE) && @@ -1767,15 +1767,15 @@ REBAR_CommonSetupBand(HWND hwnd, const REBARBANDINFOW *lprbbi, REBAR_BAND *lpBan { lpBand->cxHeader = lprbbi->cxHeader; lpBand->fStyle |= RBBS_UNDOC_FIXEDHEADER; - bChanged = TRUE; + uChanged |= RBBIM_HEADERSIZE; } } - return bChanged; + return uChanged; } static LRESULT -REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, const RECT *clip) +REBAR_InternalEraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, const RECT *clip) /* Function: This erases the background rectangle by drawing */ /* each band with its background color (or the default) and */ /* draws each bands right separator if necessary. The row */ @@ -2035,7 +2035,7 @@ REBAR_HandleLRDrag (REBAR_INFO *infoPtr, const POINT *ptsmove) static LRESULT -REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_DeleteBand (REBAR_INFO *infoPtr, WPARAM wParam) { UINT uBand = (UINT)wParam; REBAR_BAND *lpBand; @@ -2202,7 +2202,7 @@ REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL static LRESULT -REBAR_GetBarHeight (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_GetBarHeight (const REBAR_INFO *infoPtr) { INT nHeight; @@ -2215,7 +2215,7 @@ REBAR_GetBarHeight (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_GetBarInfo (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_GetBarInfo (const REBAR_INFO *infoPtr, LPARAM lParam) { LPREBARINFO lpInfo = (LPREBARINFO)lParam; @@ -2295,7 +2295,7 @@ REBAR_GetRowCount (const REBAR_INFO *infoPtr) static LRESULT -REBAR_GetRowHeight (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_GetRowHeight (const REBAR_INFO *infoPtr, WPARAM wParam) { INT iRow = (INT)wParam; int j = 0, ret = 0; @@ -2351,7 +2351,7 @@ REBAR_GetVersion (const REBAR_INFO *infoPtr) static LRESULT -REBAR_HitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_HitTest (const REBAR_INFO *infoPtr, LPARAM lParam) { LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; @@ -2365,7 +2365,7 @@ REBAR_HitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_IdToIndex (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_IdToIndex (const REBAR_INFO *infoPtr, WPARAM wParam) { UINT i; @@ -2422,6 +2422,14 @@ REBAR_InsertBandT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnico lpBand->iImage = -1; REBAR_CommonSetupBand(infoPtr->hwndSelf, lprbbi, lpBand); + + /* Make sure the defaults for these are correct */ + if (lprbbi->cbSize < sizeof (REBARBANDINFOA) || !(lpBand->fStyle & RBBS_VARIABLEHEIGHT)) { + lpBand->cyChild = lpBand->cyMinChild; + lpBand->cyMaxChild = 0x7fffffff; + lpBand->cyIntegral = 0; + } + if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) { if (bUnicode) Str_SetPtrW(&lpBand->lpText, lprbbi->lpText); @@ -2499,7 +2507,7 @@ REBAR_MaximizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_MinimizeBand (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_MinimizeBand (const REBAR_INFO *infoPtr, WPARAM wParam) { REBAR_BAND *lpBand; UINT uBand = (UINT) wParam; @@ -2587,8 +2595,7 @@ REBAR_MoveBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } /* allocate new space and copy rest of bands into it */ - infoPtr->bands = - (REBAR_BAND *)Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND)); + infoPtr->bands = Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND)); /* pre insert copy */ if (uTo > 0) { @@ -2635,7 +2642,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic { LPREBARBANDINFOW lprbbi = (LPREBARBANDINFOW)lParam; REBAR_BAND *lpBand; - BOOL bChanged; + UINT uChanged; if (lprbbi == NULL) return FALSE; @@ -2650,7 +2657,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic /* set band information */ lpBand = &infoPtr->bands[(UINT)wParam]; - bChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); + uChanged = REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand); if (lprbbi->fMask & RBBIM_TEXT) { LPWSTR wstr = NULL; if (bUnicode) @@ -2661,7 +2668,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic if (REBAR_strdifW(wstr, lpBand->lpText)) { Free(lpBand->lpText); lpBand->lpText = wstr; - bChanged = TRUE; + uChanged |= RBBIM_TEXT; } else Free(wstr); @@ -2671,7 +2678,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic REBAR_DumpBand (infoPtr); - if (bChanged && (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE | RBBIM_IMAGE))) { + if (uChanged & (RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE | RBBIM_IMAGE)) { REBAR_Layout(infoPtr); InvalidateRect(infoPtr->hwndSelf, 0, 1); } @@ -2681,7 +2688,7 @@ REBAR_SetBandInfoT(REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnic static LRESULT -REBAR_SetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetBarInfo (REBAR_INFO *infoPtr, LPARAM lParam) { LPREBARINFO lpInfo = (LPREBARINFO)lParam; REBAR_BAND *lpBand; @@ -2722,7 +2729,7 @@ REBAR_SetBarInfo (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SetBkColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetBkColor (REBAR_INFO *infoPtr, LPARAM lParam) { COLORREF clrTemp; @@ -2740,7 +2747,7 @@ REBAR_SetBkColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SetParent (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetParent (REBAR_INFO *infoPtr, WPARAM wParam) { HWND hwndTemp = infoPtr->hwndNotify; @@ -2751,7 +2758,7 @@ REBAR_SetParent (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SetTextColor (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetTextColor (REBAR_INFO *infoPtr, LPARAM lParam) { COLORREF clrTemp; @@ -2829,7 +2836,7 @@ REBAR_ShowBand (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SizeToRect (REBAR_INFO *infoPtr, LPARAM lParam) { LPRECT lpRect = (LPRECT)lParam; @@ -2844,7 +2851,7 @@ REBAR_SizeToRect (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_Create (REBAR_INFO *infoPtr, LPARAM lParam) { LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; RECT wnrc1, clrc1; @@ -2870,7 +2877,7 @@ REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_Destroy (REBAR_INFO *infoPtr) { REBAR_BAND *lpBand; UINT i; @@ -2911,18 +2918,18 @@ REBAR_Destroy (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_EraseBkGnd (const REBAR_INFO *infoPtr, WPARAM wParam) { RECT cliprect; if (GetClipBox ( (HDC)wParam, &cliprect)) - return REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &cliprect); + return REBAR_InternalEraseBkGnd (infoPtr, wParam, &cliprect); return 0; } static LRESULT -REBAR_GetFont (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_GetFont (const REBAR_INFO *infoPtr) { return (LRESULT)infoPtr->hFont; } @@ -2960,7 +2967,7 @@ REBAR_PushChevron(const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } static LRESULT -REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_LButtonDown (REBAR_INFO *infoPtr, LPARAM lParam) { REBAR_BAND *lpBand; UINT htFlags; @@ -2996,7 +3003,7 @@ REBAR_LButtonDown (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } static LRESULT -REBAR_LButtonUp (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_LButtonUp (REBAR_INFO *infoPtr) { if (infoPtr->iGrabbedBand >= 0) { @@ -3025,7 +3032,7 @@ REBAR_LButtonUp (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } static LRESULT -REBAR_MouseLeave (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_MouseLeave (REBAR_INFO *infoPtr) { if (infoPtr->ichevronhotBand >= 0) { @@ -3043,7 +3050,7 @@ REBAR_MouseLeave (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) } static LRESULT -REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_MouseMove (REBAR_INFO *infoPtr, LPARAM lParam) { REBAR_BAND *lpChevronBand; POINT ptMove; @@ -3133,7 +3140,7 @@ REBAR_MouseMove (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static inline LRESULT -REBAR_NCCalcSize (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_NCCalcSize (const REBAR_INFO *infoPtr, LPARAM lParam) { HTHEME theme; RECT *rect = (RECT *)lParam; @@ -3155,7 +3162,7 @@ REBAR_NCCalcSize (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) +REBAR_NCCreate (HWND hwnd, LPARAM lParam) { LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); @@ -3177,7 +3184,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) } /* allocate memory for info structure */ - infoPtr = (REBAR_INFO *)Alloc (sizeof(REBAR_INFO)); + infoPtr = Alloc (sizeof(REBAR_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure - initial values are 0 */ @@ -3198,7 +3205,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->hFont = GetStockObject (SYSTEM_FONT); /* issue WM_NOTIFYFORMAT to get unicode status of parent */ - REBAR_NotifyFormat(infoPtr, 0, NF_REQUERY); + REBAR_NotifyFormat(infoPtr, NF_REQUERY); /* Stow away the original style */ infoPtr->orgStyle = cs->style; @@ -3248,7 +3255,7 @@ REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_NCHitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_NCHitTest (const REBAR_INFO *infoPtr, LPARAM lParam) { NMMOUSE nmmouse; POINT clpt; @@ -3283,7 +3290,7 @@ REBAR_NCHitTest (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_NCPaint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_NCPaint (const REBAR_INFO *infoPtr) { RECT rcWindow; HDC hdc; @@ -3320,7 +3327,7 @@ REBAR_NCPaint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_NotifyFormat (REBAR_INFO *infoPtr, LPARAM lParam) { INT i; @@ -3339,7 +3346,7 @@ REBAR_NotifyFormat (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam) { HDC hdc = (HDC)wParam; @@ -3352,7 +3359,7 @@ REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) TRACE("painting (%s)\n", wine_dbgstr_rect(&ps.rcPaint)); if (ps.fErase) { /* Erase area of paint if requested */ - REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint); + REBAR_InternalEraseBkGnd (infoPtr, wParam, &ps.rcPaint); } REBAR_Refresh (infoPtr, hdc); EndPaint (infoPtr->hwndSelf, &ps); @@ -3363,7 +3370,7 @@ REBAR_Paint (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SetCursor (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetCursor (const REBAR_INFO *infoPtr, LPARAM lParam) { POINT pt; UINT flags; @@ -3390,7 +3397,7 @@ REBAR_SetCursor (const REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam) { REBAR_BAND *lpBand; UINT i; @@ -3409,7 +3416,7 @@ REBAR_SetFont (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static inline LRESULT -REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_SetRedraw (REBAR_INFO *infoPtr, WPARAM wParam) /***************************************************** * * Function; @@ -3462,7 +3469,7 @@ REBAR_Size (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) static LRESULT -REBAR_StyleChanged (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +REBAR_StyleChanged (REBAR_INFO *infoPtr, LPARAM lParam) { STYLESTRUCT *ss = (STYLESTRUCT *)lParam; @@ -3519,7 +3526,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case RB_BEGINDRAG: */ case RB_DELETEBAND: - return REBAR_DeleteBand (infoPtr, wParam, lParam); + return REBAR_DeleteBand (infoPtr, wParam); /* case RB_DRAGMOVE: */ /* case RB_ENDDRAG: */ @@ -3538,10 +3545,10 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_GetBandInfoT(infoPtr, wParam, lParam, TRUE); case RB_GETBARHEIGHT: - return REBAR_GetBarHeight (infoPtr, wParam, lParam); + return REBAR_GetBarHeight (infoPtr); case RB_GETBARINFO: - return REBAR_GetBarInfo (infoPtr, wParam, lParam); + return REBAR_GetBarInfo (infoPtr, lParam); case RB_GETBKCOLOR: return REBAR_GetBkColor (infoPtr); @@ -3559,7 +3566,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_GetRowCount (infoPtr); case RB_GETROWHEIGHT: - return REBAR_GetRowHeight (infoPtr, wParam, lParam); + return REBAR_GetRowHeight (infoPtr, wParam); case RB_GETTEXTCOLOR: return REBAR_GetTextColor (infoPtr); @@ -3574,10 +3581,10 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_GetVersion (infoPtr); case RB_HITTEST: - return REBAR_HitTest (infoPtr, wParam, lParam); + return REBAR_HitTest (infoPtr, lParam); case RB_IDTOINDEX: - return REBAR_IdToIndex (infoPtr, wParam, lParam); + return REBAR_IdToIndex (infoPtr, wParam); case RB_INSERTBANDA: return REBAR_InsertBandT(infoPtr, wParam, lParam, FALSE); @@ -3589,7 +3596,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_MaximizeBand (infoPtr, wParam, lParam); case RB_MINIMIZEBAND: - return REBAR_MinimizeBand (infoPtr, wParam, lParam); + return REBAR_MinimizeBand (infoPtr, wParam); case RB_MOVEBAND: return REBAR_MoveBand (infoPtr, wParam, lParam); @@ -3604,20 +3611,20 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_SetBandInfoT(infoPtr, wParam, lParam, TRUE); case RB_SETBARINFO: - return REBAR_SetBarInfo (infoPtr, wParam, lParam); + return REBAR_SetBarInfo (infoPtr, lParam); case RB_SETBKCOLOR: - return REBAR_SetBkColor (infoPtr, wParam, lParam); + return REBAR_SetBkColor (infoPtr, lParam); /* case RB_SETCOLORSCHEME: */ /* case RB_SETPALETTE: */ /* return REBAR_GetPalette (infoPtr, wParam, lParam); */ case RB_SETPARENT: - return REBAR_SetParent (infoPtr, wParam, lParam); + return REBAR_SetParent (infoPtr, wParam); case RB_SETTEXTCOLOR: - return REBAR_SetTextColor (infoPtr, wParam, lParam); + return REBAR_SetTextColor (infoPtr, lParam); /* case RB_SETTOOLTIPS: */ @@ -3631,7 +3638,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_ShowBand (infoPtr, wParam, lParam); case RB_SIZETORECT: - return REBAR_SizeToRect (infoPtr, wParam, lParam); + return REBAR_SizeToRect (infoPtr, lParam); /* Messages passed to parent */ @@ -3644,51 +3651,51 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case WM_CHARTOITEM: supported according to ControlSpy */ case WM_CREATE: - return REBAR_Create (infoPtr, wParam, lParam); + return REBAR_Create (infoPtr, lParam); case WM_DESTROY: - return REBAR_Destroy (infoPtr, wParam, lParam); + return REBAR_Destroy (infoPtr); case WM_ERASEBKGND: - return REBAR_EraseBkGnd (infoPtr, wParam, lParam); + return REBAR_EraseBkGnd (infoPtr, wParam); case WM_GETFONT: - return REBAR_GetFont (infoPtr, wParam, lParam); + return REBAR_GetFont (infoPtr); /* case WM_LBUTTONDBLCLK: supported according to ControlSpy */ case WM_LBUTTONDOWN: - return REBAR_LButtonDown (infoPtr, wParam, lParam); + return REBAR_LButtonDown (infoPtr, lParam); case WM_LBUTTONUP: - return REBAR_LButtonUp (infoPtr, wParam, lParam); + return REBAR_LButtonUp (infoPtr); /* case WM_MEASUREITEM: supported according to ControlSpy */ case WM_MOUSEMOVE: - return REBAR_MouseMove (infoPtr, wParam, lParam); + return REBAR_MouseMove (infoPtr, lParam); case WM_MOUSELEAVE: - return REBAR_MouseLeave (infoPtr, wParam, lParam); + return REBAR_MouseLeave (infoPtr); case WM_NCCALCSIZE: - return REBAR_NCCalcSize (infoPtr, wParam, lParam); + return REBAR_NCCalcSize (infoPtr, lParam); case WM_NCCREATE: - return REBAR_NCCreate (hwnd, wParam, lParam); + return REBAR_NCCreate (hwnd, lParam); case WM_NCHITTEST: - return REBAR_NCHitTest (infoPtr, wParam, lParam); + return REBAR_NCHitTest (infoPtr, lParam); case WM_NCPAINT: - return REBAR_NCPaint (infoPtr, wParam, lParam); + return REBAR_NCPaint (infoPtr); case WM_NOTIFYFORMAT: - return REBAR_NotifyFormat (infoPtr, wParam, lParam); + return REBAR_NotifyFormat (infoPtr, lParam); case WM_PRINTCLIENT: case WM_PAINT: - return REBAR_Paint (infoPtr, wParam, lParam); + return REBAR_Paint (infoPtr, wParam); /* case WM_PALETTECHANGED: supported according to ControlSpy */ /* case WM_QUERYNEWPALETTE:supported according to ControlSpy */ @@ -3696,19 +3703,19 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* case WM_RBUTTONUP: supported according to ControlSpy */ case WM_SETCURSOR: - return REBAR_SetCursor (infoPtr, wParam, lParam); + return REBAR_SetCursor (infoPtr, lParam); case WM_SETFONT: - return REBAR_SetFont (infoPtr, wParam, lParam); + return REBAR_SetFont (infoPtr, wParam); case WM_SETREDRAW: - return REBAR_SetRedraw (infoPtr, wParam, lParam); + return REBAR_SetRedraw (infoPtr, wParam); case WM_SIZE: return REBAR_Size (infoPtr, wParam, lParam); case WM_STYLECHANGED: - return REBAR_StyleChanged (infoPtr, wParam, lParam); + return REBAR_StyleChanged (infoPtr, lParam); case WM_THEMECHANGED: return theme_changed (infoPtr); @@ -3725,7 +3732,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return REBAR_WindowPosChanged (infoPtr, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/rsrc.rc b/reactos/dll/win32/comctl32/rsrc.rc index 9028df9444d..c3bf74a4df3 100644 --- a/reactos/dll/win32/comctl32/rsrc.rc +++ b/reactos/dll/win32/comctl32/rsrc.rc @@ -30,9 +30,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #define WINE_FILEDESCRIPTION_STR "Wine Common Controls" #define WINE_FILENAME_STR "comctl32.dll" #define WINE_FILEVERSION COMCTL32_VERSION, COMCTL32_VERSION_MINOR, 4704, 1100 -#define WINE_FILEVERSIONSTR "5.81" +#define WINE_FILEVERSION_STR "5.81" #define WINE_PRODUCTVERSION WINE_FILEVERSION -#define WINE_PRODUCTVERSION_STR WINE_FILEVERSIONSTR +#define WINE_PRODUCTVERSION_STR WINE_FILEVERSION_STR #include "wine/wine_common_ver.rc" @@ -91,7 +91,6 @@ IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico */ #include "comctl_Bg.rc" -#include "comctl_Cn.rc" #include "comctl_Cs.rc" #include "comctl_De.rc" #include "comctl_El.rc" @@ -114,3 +113,4 @@ IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico #include "comctl_Th.rc" #include "comctl_Tr.rc" #include "comctl_Uk.rc" +#include "comctl_Zh.rc" diff --git a/reactos/dll/win32/comctl32/status.c b/reactos/dll/win32/comctl32/status.c index 464e650855d..d107329922f 100644 --- a/reactos/dll/win32/comctl32/status.c +++ b/reactos/dll/win32/comctl32/status.c @@ -72,13 +72,13 @@ typedef struct HWND Notify; WORD numParts; UINT height; + UINT minHeight; /* at least MIN_PANE_HEIGHT, can be increased by SB_SETMINHEIGHT */ BOOL simple; HWND hwndToolTip; HFONT hFont; HFONT hDefaultFont; COLORREF clrBk; /* background color */ - BOOL bUnicode; /* unicode flag */ - BOOL NtfUnicode; /* notify format */ + BOOL bUnicode; /* notify format. TRUE if notifies in Unicode */ STATUSWINDOWPART part0; /* simple window */ STATUSWINDOWPART* parts; INT horizontalBorder; @@ -95,18 +95,52 @@ typedef struct #define HORZ_BORDER 0 #define VERT_BORDER 2 #define HORZ_GAP 2 +#define MIN_PANE_HEIGHT 18 static const WCHAR themeClass[] = { 'S','t','a','t','u','s',0 }; /* prototype */ static void STATUSBAR_SetPartBounds (STATUS_INFO *infoPtr); +static LRESULT +STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd); static inline LPCSTR debugstr_t(LPCWSTR text, BOOL isW) { return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text); } +static UINT +STATUSBAR_ComputeHeight(STATUS_INFO *infoPtr) +{ + HTHEME theme; + UINT height; + TEXTMETRICW tm; + int margin; + + COMCTL32_GetFontMetrics(infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont, &tm); + margin = (tm.tmInternalLeading ? tm.tmInternalLeading : 2); + height = max(tm.tmHeight + margin + 2*GetSystemMetrics(SM_CYBORDER), infoPtr->minHeight) + infoPtr->verticalBorder; + + if ((theme = GetWindowTheme(infoPtr->Self))) + { + /* Determine bar height from theme such that the content area is + * textHeight pixels large */ + HDC hdc = GetDC(infoPtr->Self); + RECT r; + memset (&r, 0, sizeof (r)); + r.bottom = max(infoPtr->minHeight, tm.tmHeight); + if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r))) + { + height = r.bottom - r.top; + } + ReleaseDC(infoPtr->Self, hdc); + } + + TRACE(" textHeight=%d+%d, final height=%d\n", tm.tmHeight, tm.tmInternalLeading, height); + return height; +} + static void STATUSBAR_DrawSizeGrip (HTHEME theme, HDC hdc, LPRECT lpRect) { @@ -218,15 +252,15 @@ static void STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPART *part, int itemID) { HBRUSH hbrBk; - HFONT hOldFont; HTHEME theme; TRACE("item %d\n", itemID); - if (!IsWindowVisible (infoPtr->Self)) - return; if (part->bound.right < part->bound.left) return; + if (!RectVisible(hdc, &part->bound)) + return; + if ((theme = GetWindowTheme (infoPtr->Self))) { RECT cr; @@ -244,18 +278,7 @@ STATUSBAR_RefreshPart (const STATUS_INFO *infoPtr, HDC hdc, const STATUSWINDOWPA DeleteObject (hbrBk); } - hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); - - STATUSBAR_DrawPart (infoPtr, hdc, part, itemID); - - SelectObject (hdc, hOldFont); - - if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & SBARS_SIZEGRIP) { - RECT rect; - - GetClientRect (infoPtr->Self, &rect); - STATUSBAR_DrawSizeGrip (theme, hdc, &rect); - } + STATUSBAR_DrawPart (infoPtr, hdc, part, itemID); } @@ -626,40 +649,9 @@ STATUSBAR_SetIcon (STATUS_INFO *infoPtr, INT nPart, HICON hIcon) static BOOL STATUSBAR_SetMinHeight (STATUS_INFO *infoPtr, INT height) { - - TRACE("(height=%d)\n", height); - if (IsWindowVisible (infoPtr->Self)) { - INT width, x, y; - RECT parent_rect; - HTHEME theme; - - infoPtr->height = height + infoPtr->verticalBorder; - - if ((theme = GetWindowTheme (infoPtr->Self))) - { - /* Determine bar height from theme such that the content area is - * 'height' pixels large */ - HDC hdc = GetDC (infoPtr->Self); - RECT r; - memset (&r, 0, sizeof (r)); - r.bottom = height; - if (SUCCEEDED(GetThemeBackgroundExtent (theme, hdc, SP_PANE, 0, &r, &r))) - { - infoPtr->height = r.bottom - r.top; - } - ReleaseDC (infoPtr->Self, hdc); - } - - if (GetClientRect (infoPtr->Notify, &parent_rect)) - { - width = parent_rect.right - parent_rect.left; - x = parent_rect.left; - y = parent_rect.bottom - infoPtr->height; - MoveWindow (infoPtr->Self, x, y, width, infoPtr->height, TRUE); - STATUSBAR_SetPartBounds (infoPtr); - } - } - + infoPtr->minHeight = max(height, MIN_PANE_HEIGHT); + infoPtr->height = STATUSBAR_ComputeHeight(infoPtr); + /* like native, don't resize the control */ return TRUE; } @@ -912,11 +904,10 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) NONCLIENTMETRICSW nclm; DWORD dwStyle; RECT rect; - int i, width, len, textHeight = 0; - HDC hdc; + int len; TRACE("\n"); - infoPtr = (STATUS_INFO*)Alloc (sizeof(STATUS_INFO)); + infoPtr = Alloc (sizeof(STATUS_INFO)); if (!infoPtr) goto create_fail; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); @@ -930,19 +921,17 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) infoPtr->horizontalBorder = HORZ_BORDER; infoPtr->verticalBorder = VERT_BORDER; infoPtr->horizontalGap = HORZ_GAP; + infoPtr->minHeight = MIN_PANE_HEIGHT; - i = SendMessageW(infoPtr->Notify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); - infoPtr->NtfUnicode = (i == NFR_UNICODE); - - GetClientRect (hwnd, &rect); - InvalidateRect (hwnd, &rect, 0); - UpdateWindow(hwnd); + STATUSBAR_NotifyFormat(infoPtr, infoPtr->Notify, NF_REQUERY); ZeroMemory (&nclm, sizeof(nclm)); nclm.cbSize = sizeof(nclm); SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, nclm.cbSize, &nclm, 0); infoPtr->hDefaultFont = CreateFontIndirectW (&nclm.lfStatusFont); + GetClientRect (hwnd, &rect); + /* initialize simple case */ infoPtr->part0.bound = rect; infoPtr->part0.text = 0; @@ -961,24 +950,11 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) OpenThemeData (hwnd, themeClass); - if (IsWindowUnicode (hwnd)) { - infoPtr->bUnicode = TRUE; - if (lpCreate->lpszName && - (len = strlenW ((LPCWSTR)lpCreate->lpszName))) { - infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR)); - if (!infoPtr->parts[0].text) goto create_fail; - strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName); - } - } - else { - if (lpCreate->lpszName && - (len = strlen((LPCSTR)lpCreate->lpszName))) { - DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 ); - infoPtr->parts[0].text = Alloc (lenW*sizeof(WCHAR)); - if (!infoPtr->parts[0].text) goto create_fail; - MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, - infoPtr->parts[0].text, lenW ); - } + if (lpCreate->lpszName && (len = strlenW ((LPCWSTR)lpCreate->lpszName))) + { + infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR)); + if (!infoPtr->parts[0].text) goto create_fail; + strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName); } dwStyle = GetWindowLongW (hwnd, GWL_STYLE); @@ -986,17 +962,7 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) dwStyle &= ~WS_BORDER; SetWindowLongW (hwnd, GWL_STYLE, dwStyle); - if ((hdc = GetDC (hwnd))) { - TEXTMETRICW tm; - HFONT hOldFont; - - hOldFont = SelectObject (hdc, infoPtr->hDefaultFont); - GetTextMetricsW (hdc, &tm); - textHeight = tm.tmHeight; - SelectObject (hdc, hOldFont); - ReleaseDC (hwnd, hdc); - } - TRACE(" textHeight=%d\n", textHeight); + infoPtr->height = STATUSBAR_ComputeHeight(infoPtr); if (dwStyle & SBT_TOOLTIPS) { infoPtr->hwndToolTip = @@ -1017,32 +983,6 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) } } - if (!(dwStyle & CCS_NORESIZE)) { /* don't resize wnd if it doesn't want it ! */ - HTHEME theme; - GetClientRect (infoPtr->Notify, &rect); - width = rect.right - rect.left; - infoPtr->height = textHeight + 4 + infoPtr->verticalBorder; - - if ((theme = GetWindowTheme (hwnd))) - { - /* Determine bar height from theme such that the content area is - * textHeight pixels large */ - HDC hdc = GetDC (hwnd); - RECT r; - memset (&r, 0, sizeof (r)); - r.bottom = textHeight; - if (SUCCEEDED(GetThemeBackgroundExtent (theme, hdc, SP_PANE, 0, &r, &r))) - { - infoPtr->height = r.bottom - r.top; - } - ReleaseDC (hwnd, hdc); - } - - SetWindowPos(hwnd, 0, lpCreate->x, lpCreate->y - 1, - width, infoPtr->height, SWP_NOZORDER); - STATUSBAR_SetPartBounds (infoPtr); - } - return 0; create_fail: @@ -1062,17 +1002,11 @@ STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf) TRACE("\n"); if (!(infoPtr->parts[0].text)) return 0; - if (infoPtr->bUnicode) - len = strlenW (infoPtr->parts[0].text); - else - len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1; + + len = strlenW (infoPtr->parts[0].text); if (size > len) { - if (infoPtr->bUnicode) - strcpyW (buf, infoPtr->parts[0].text); - else - WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, - (LPSTR)buf, len+1, NULL, NULL ); + strcpyW (buf, infoPtr->parts[0].text); return len; } @@ -1124,6 +1058,9 @@ STATUSBAR_WMSetFont (STATUS_INFO *infoPtr, HFONT font, BOOL redraw) { infoPtr->hFont = font; TRACE("%p\n", infoPtr->hFont); + + infoPtr->height = STATUSBAR_ComputeHeight(infoPtr); + SendMessageW(infoPtr->Self, WM_SIZE, 0, 0); /* update size */ if (redraw) InvalidateRect(infoPtr->Self, NULL, FALSE); @@ -1145,20 +1082,11 @@ STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text) /* duplicate string */ Free (part->text); part->text = 0; - if (infoPtr->bUnicode) { - if (text && (len = strlenW((LPCWSTR)text))) { - part->text = Alloc ((len+1)*sizeof(WCHAR)); - if (!part->text) return FALSE; - strcpyW (part->text, (LPCWSTR)text); - } - } - else { - if (text && (len = lstrlenA(text))) { - DWORD lenW = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 ); - part->text = Alloc (lenW*sizeof(WCHAR)); - if (!part->text) return FALSE; - MultiByteToWideChar( CP_ACP, 0, text, -1, part->text, lenW ); - } + + if (text && (len = strlenW((LPCWSTR)text))) { + part->text = Alloc ((len+1)*sizeof(WCHAR)); + if (!part->text) return FALSE; + strcpyW (part->text, (LPCWSTR)text); } InvalidateRect(infoPtr->Self, &part->bound, FALSE); @@ -1211,9 +1139,9 @@ STATUSBAR_NotifyFormat (STATUS_INFO *infoPtr, HWND from, INT cmd) { if (cmd == NF_REQUERY) { INT i = SendMessageW(from, WM_NOTIFYFORMAT, (WPARAM)infoPtr->Self, NF_QUERY); - infoPtr->NtfUnicode = (i == NFR_UNICODE); + infoPtr->bUnicode = (i == NFR_UNICODE); } - return infoPtr->NtfUnicode ? NFR_UNICODE : NFR_ANSI; + return infoPtr->bUnicode ? NFR_UNICODE : NFR_ANSI; } @@ -1378,7 +1306,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return theme_changed (infoPtr); default: - if ((msg >= WM_USER) && (msg < WM_APP)) + if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", msg, wParam, lParam); return DefWindowProcW (hwnd, msg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/syslink.c b/reactos/dll/win32/comctl32/syslink.c index a1b8aff1e3f..64cea1171f2 100644 --- a/reactos/dll/win32/comctl32/syslink.c +++ b/reactos/dll/win32/comctl32/syslink.c @@ -136,7 +136,7 @@ static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPCWSTR Text, UIN { PDOC_ITEM Item; - textlen = min(textlen, lstrlenW(Text)); + textlen = min(textlen, strlenW(Text)); Item = Alloc(FIELD_OFFSET(DOC_ITEM, Text[textlen + 1])); if(Item == NULL) { @@ -286,8 +286,6 @@ CheckParameter: ValidLink = TRUE; taglen++; } - else - tmp++; } } @@ -1750,7 +1748,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message, default: HandleDefaultMessage: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) { ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam ); } diff --git a/reactos/dll/win32/comctl32/tab.c b/reactos/dll/win32/comctl32/tab.c index 62047e5a08f..0cc8cf92c55 100644 --- a/reactos/dll/win32/comctl32/tab.c +++ b/reactos/dll/win32/comctl32/tab.c @@ -142,7 +142,6 @@ typedef struct #define BUTTON_SPACINGY 3 #define FLAT_BTN_SPACINGX 8 #define DEFAULT_MIN_TAB_WIDTH 54 -#define DEFAULT_TAB_WIDTH_FIXED 96 #define DEFAULT_PADDING_X 6 #define EXTRA_ICON_PADDING 3 @@ -460,7 +459,7 @@ static BOOL TAB_InternalGetItemRect( static inline BOOL TAB_GetItemRect(const TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { - return TAB_InternalGetItemRect(infoPtr, (INT)wParam, (LPRECT)lParam, (LPRECT)NULL); + return TAB_InternalGetItemRect(infoPtr, wParam, (LPRECT)lParam, NULL); } /****************************************************************************** @@ -864,6 +863,8 @@ static LRESULT TAB_AdjustRect(const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT pr TRACE ("hwnd=%p fLarger=%ld (%s)\n", infoPtr->hwnd, fLarger, wine_dbgstr_rect(prc)); + if (!prc) return -1; + if(lStyle & TCS_VERTICAL) { iRightBottom = &(prc->right); @@ -2661,7 +2662,10 @@ static inline LRESULT TAB_SetMinTabWidth (TAB_INFO *infoPtr, INT cx) TRACE("(%p,%d)\n", infoPtr, cx); - oldcx = infoPtr->tabMinWidth; + if (infoPtr->tabMinWidth < 0) + oldcx = DEFAULT_MIN_TAB_WIDTH; + else + oldcx = infoPtr->tabMinWidth; infoPtr->tabMinWidth = cx; TAB_SetItemBounds(infoPtr); return oldcx; @@ -2940,7 +2944,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) HFONT hOldFont; DWORD dwStyle; - infoPtr = (TAB_INFO *)Alloc (sizeof(TAB_INFO)); + infoPtr = Alloc (sizeof(TAB_INFO)); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); @@ -3019,7 +3023,7 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) /* Initialize the width of a tab. */ if (dwStyle & TCS_FIXEDWIDTH) - infoPtr->tabWidth = DEFAULT_TAB_WIDTH_FIXED; + infoPtr->tabWidth = GetDeviceCaps(hdc, LOGPIXELSX); infoPtr->tabMinWidth = -1; @@ -3269,7 +3273,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TAB_NCCalcSize(hwnd, wParam, lParam); default: - if (uMsg >= WM_USER && uMsg < WM_APP) + if (uMsg >= WM_USER && uMsg < WM_APP && !COMCTL32_IsReflectedMessage(uMsg)) WARN("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); break; diff --git a/reactos/dll/win32/comctl32/theming.c b/reactos/dll/win32/comctl32/theming.c index 5b5f6b304ee..bab87ccabf7 100644 --- a/reactos/dll/win32/comctl32/theming.c +++ b/reactos/dll/win32/comctl32/theming.c @@ -34,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(theming); typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM, ULONG_PTR); +extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM, + ULONG_PTR); extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM, ULONG_PTR); extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM, @@ -53,6 +55,7 @@ static const struct ThemingSubclass } subclasses[] = { /* Note: list must be sorted by class name */ {dialogClass, THEMING_DialogSubclassProc}, + {WC_BUTTONW, THEMING_ButtonSubclassProc}, {WC_COMBOBOXW, THEMING_ComboSubclassProc}, {comboLboxClass, THEMING_ListBoxSubclassProc}, {WC_EDITW, THEMING_EditSubclassProc}, @@ -91,13 +94,15 @@ MAKE_SUBCLASS_PROC(1) MAKE_SUBCLASS_PROC(2) MAKE_SUBCLASS_PROC(3) MAKE_SUBCLASS_PROC(4) +MAKE_SUBCLASS_PROC(5) static const WNDPROC subclassProcs[NUM_SUBCLASSES] = { subclass_proc0, subclass_proc1, subclass_proc2, subclass_proc3, - subclass_proc4 + subclass_proc4, + subclass_proc5 }; /*********************************************************************** @@ -108,7 +113,7 @@ static const WNDPROC subclassProcs[NUM_SUBCLASSES] = { */ void THEMING_Initialize (void) { - int i; + unsigned int i; static const WCHAR subclassPropName[] = { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 }; static const WCHAR refDataPropName[] = @@ -156,7 +161,7 @@ void THEMING_Initialize (void) */ void THEMING_Uninitialize (void) { - int i; + unsigned int i; if (!atSubclassProp) return; /* not initialized */ diff --git a/reactos/dll/win32/comctl32/toolbar.c b/reactos/dll/win32/comctl32/toolbar.c index bd37e193aab..a233b391926 100644 --- a/reactos/dll/win32/comctl32/toolbar.c +++ b/reactos/dll/win32/comctl32/toolbar.c @@ -495,7 +495,7 @@ TOOLBAR_DrawFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *info * FIXME: It is possible that the height of each line is really SM_CYBORDER. */ static void -TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, const TBUTTON_INFO *btnPtr, +TOOLBAR_DrawDDFlatSeparator (const RECT *lpRect, HDC hdc, const TOOLBAR_INFO *infoPtr) { RECT myrect; @@ -542,7 +542,7 @@ TOOLBAR_DrawArrow (HDC hdc, INT left, INT top, COLORREF clr) MoveToEx (hdc, x, y, NULL); LineTo (hdc, x+3, y++); x++; MoveToEx (hdc, x, y, NULL); - LineTo (hdc, x+1, y++); + LineTo (hdc, x+1, y); SelectObject( hdc, hOldPen ); DeleteObject( hPen ); } @@ -848,7 +848,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr /* when drawing the vertical bar... */ if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) { if (btnPtr->fsStyle & BTNS_DROPDOWN) - TOOLBAR_DrawDDFlatSeparator (&rc, hdc, btnPtr, infoPtr); + TOOLBAR_DrawDDFlatSeparator (&rc, hdc, infoPtr); else TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr); } @@ -912,8 +912,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc, DWORD dwBaseCustDr rcText.right -= GetSystemMetrics(SM_CXEDGE); if (dwStyle & TBSTYLE_LIST) { - if (TOOLBAR_IsValidBitmapIndex(infoPtr,btnPtr->iBitmap)) - rcText.left += infoPtr->nBitmapWidth + infoPtr->iListGap + 2; + rcText.left += infoPtr->nBitmapWidth + infoPtr->iListGap + 2; } else { @@ -1152,7 +1151,7 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, const PAINTSTRUCT *ps) tbcd.nmcd.dwDrawStage = CDDS_POSTPAINT; tbcd.nmcd.hdc = hdc; tbcd.nmcd.rc = ps->rcPaint; - ntfret = TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW); + TOOLBAR_SendNotify(&tbcd.nmcd.hdr, infoPtr, NM_CUSTOMDRAW); } } @@ -1330,7 +1329,7 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle ) cx = (btnPtr[i].iBitmap > 0) ? btnPtr[i].iBitmap : SEPARATOR_WIDTH; else - cx = infoPtr->nButtonWidth; + cx = (btnPtr[i].cx) ? btnPtr[i].cx : infoPtr->nButtonWidth; /* Two or more adjacent separators form a separator group. */ /* The first separator in a group should be wrapped to the */ @@ -1427,7 +1426,6 @@ TOOLBAR_WrapToolbar( HWND hwnd, DWORD dwStyle ) TRACE("wrap point 5 btn %d style %02x, x=%d, cx=%d\n", i, btnPtr[i].fsStyle, x, cx); btnPtr[i].fsState |= TBSTATE_WRAP; - bFound = TRUE; x = infoPtr->nIndent; if (btnPtr[i].fsStyle & BTNS_SEP ) bButtonWrap = FALSE; @@ -1574,15 +1572,11 @@ static inline SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeS sizeButton.cy += infoPtr->szPadding.cy; /* calculate button width */ - if (bHasBitmap) - { - sizeButton.cx = 2*GetSystemMetrics(SM_CXEDGE) + - infoPtr->nBitmapWidth + infoPtr->iListGap; - if (sizeString.cx > 0) - sizeButton.cx += sizeString.cx + infoPtr->szPadding.cx; - } - else - sizeButton.cx = sizeString.cx + infoPtr->szPadding.cx; + sizeButton.cx = 2*GetSystemMetrics(SM_CXEDGE) + + infoPtr->nBitmapWidth + infoPtr->iListGap; + if (sizeString.cx > 0) + sizeButton.cx += sizeString.cx + infoPtr->szPadding.cx; + } else { @@ -1598,8 +1592,8 @@ static inline SIZE TOOLBAR_MeasureButton(const TOOLBAR_INFO *infoPtr, SIZE sizeS { sizeButton.cy = sizeString.cy + infoPtr->szPadding.cy + NONLIST_NOTEXT_OFFSET; - sizeButton.cx = 2*GetSystemMetrics(SM_CXEDGE) + - infoPtr->szPadding.cx + sizeString.cx; + sizeButton.cx = infoPtr->szPadding.cx + + max(2*GetSystemMetrics(SM_CXEDGE) + sizeString.cx, infoPtr->nBitmapWidth); } } return sizeButton; @@ -2085,7 +2079,7 @@ static void TOOLBAR_Cust_AddButton(const CUSTDLG_INFO *custInfo, HWND hwnd, INT PCUSTOMBUTTON btnNew; /* duplicate 'separator' button */ - btnNew = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + btnNew = Alloc(sizeof(CUSTOMBUTTON)); *btnNew = *btnInfo; btnInfo = btnNew; } @@ -2308,7 +2302,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /* add items to 'toolbar buttons' list and check if removable */ for (i = 0; i < custInfo->tbInfo->nNumButtons; i++) { - btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + btnInfo = Alloc(sizeof(CUSTOMBUTTON)); memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); btnInfo->btn.fsStyle = BTNS_SEP; btnInfo->bVirtual = FALSE; @@ -2324,7 +2318,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessageW (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8); /* insert separator button into 'available buttons' list */ - btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + btnInfo = Alloc(sizeof(CUSTOMBUTTON)); memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); btnInfo->btn.fsStyle = BTNS_SEP; btnInfo->bVirtual = FALSE; @@ -2359,7 +2353,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) index = TOOLBAR_GetButtonIndex (custInfo->tbInfo, nmtb.tbButton.idCommand, FALSE); if (index == -1) { - btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + btnInfo = Alloc(sizeof(CUSTOMBUTTON)); btnInfo->bVirtual = FALSE; btnInfo->bRemovable = TRUE; } @@ -2392,7 +2386,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessageW (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, 0, 0); /* append 'virtual' separator button to the 'toolbar buttons' list */ - btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); + btnInfo = Alloc(sizeof(CUSTOMBUTTON)); memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); btnInfo->btn.fsStyle = BTNS_SEP; btnInfo->bVirtual = TRUE; @@ -2665,7 +2659,7 @@ TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TB TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons); /* Add bitmaps to the default image list */ if (bitmap->hInst == NULL) /* a handle was passed */ - hbmLoad = (HBITMAP)CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0); + hbmLoad = CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0); else hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0); @@ -3066,7 +3060,7 @@ TOOLBAR_AutoSize (HWND hwnd) static LRESULT -TOOLBAR_ButtonCount (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_ButtonCount (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3075,7 +3069,7 @@ TOOLBAR_ButtonCount (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_ButtonStructSize (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_ButtonStructSize (HWND hwnd, WPARAM wParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3157,7 +3151,7 @@ TOOLBAR_CheckButton (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_CommandToIndex (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_CommandToIndex (HWND hwnd, WPARAM wParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3203,7 +3197,7 @@ TOOLBAR_Customize (HWND hwnd) static LRESULT -TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_DeleteButton (HWND hwnd, WPARAM wParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); INT nIndex = (INT)wParam; @@ -3302,7 +3296,7 @@ TOOLBAR_GetAnchorHighlight (HWND hwnd) static LRESULT -TOOLBAR_GetBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetBitmap (HWND hwnd, WPARAM wParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); INT nIndex; @@ -3316,7 +3310,7 @@ TOOLBAR_GetBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam) static inline LRESULT -TOOLBAR_GetBitmapFlags (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetBitmapFlags (HWND hwnd) { return (GetDeviceCaps (0, LOGPIXELSX) >= 120) ? TBBF_LARGE : 0; } @@ -3518,7 +3512,7 @@ TOOLBAR_GetDefImageList (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetInsertMark (HWND hwnd, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); TBINSERTMARK *lptbim = (TBINSERTMARK*)lParam; @@ -3532,7 +3526,7 @@ TOOLBAR_GetInsertMark (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetInsertMarkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetInsertMarkColor (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3570,7 +3564,7 @@ TOOLBAR_GetItemRect (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetMaxSize (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetMaxSize (HWND hwnd, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); LPSIZE lpSize = (LPSIZE)lParam; @@ -3629,7 +3623,7 @@ TOOLBAR_GetRect (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetRows (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3638,7 +3632,7 @@ TOOLBAR_GetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetState (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetState (HWND hwnd, WPARAM wParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); INT nIndex; @@ -3652,14 +3646,14 @@ TOOLBAR_GetState (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetStyle (HWND hwnd) { return GetWindowLongW(hwnd, GWL_STYLE); } static LRESULT -TOOLBAR_GetTextRows (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetTextRows (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3668,7 +3662,7 @@ TOOLBAR_GetTextRows (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetToolTips (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -3679,7 +3673,7 @@ TOOLBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT -TOOLBAR_GetUnicodeFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetUnicodeFormat (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); @@ -4293,7 +4287,7 @@ TOOLBAR_Restore(TOOLBAR_INFO *infoPtr, const TBSAVEPARAMSW *lpSave) * delete */ for (i = infoPtr->nNumButtons - 1; i >= 0; i--) if (infoPtr->buttons[i].iBitmap == -1) - TOOLBAR_DeleteButton(infoPtr->hwndSelf, i, 0); + TOOLBAR_DeleteButton(infoPtr->hwndSelf, i); /* only indicate success if at least one button survived */ if (infoPtr->nNumButtons > 0) ret = TRUE; @@ -4374,26 +4368,38 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); HIMAGELIST himlDef = GETDEFIMAGELIST(infoPtr, 0); + short width = (short)LOWORD(lParam); + short height = (short)HIWORD(lParam); TRACE("hwnd=%p, wParam=%ld, lParam=%ld\n", hwnd, wParam, lParam); if (wParam != 0) FIXME("wParam is %ld. Perhaps image list index?\n", wParam); - if (LOWORD(lParam) == 0) - lParam = MAKELPARAM(1, HIWORD(lParam)); - - if (HIWORD(lParam)==0) - lParam = MAKELPARAM(LOWORD(lParam), 1); + /* 0 width or height is changed to 1 */ + if (width == 0) + width = 1; + if (height == 0) + height = 1; if (infoPtr->nNumButtons > 0) - WARN("%d buttons, undoc increase to bitmap size : %d-%d -> %d-%d\n", - infoPtr->nNumButtons, - infoPtr->nBitmapWidth, infoPtr->nBitmapHeight, - LOWORD(lParam), HIWORD(lParam)); + TRACE("%d buttons, undoc change to bitmap size : %d-%d -> %d-%d\n", + infoPtr->nNumButtons, + infoPtr->nBitmapWidth, infoPtr->nBitmapHeight, width, height); - infoPtr->nBitmapWidth = (INT)LOWORD(lParam); - infoPtr->nBitmapHeight = (INT)HIWORD(lParam); + if (width < -1 || height < -1) + { + /* Windows destroys the imagelist and seems to actually use negative + * values to compute button sizes */ + FIXME("Negative bitmap sizes not supported (%d, %d)\n", width, height); + return FALSE; + } + + /* width or height of -1 means no change */ + if (width != -1) + infoPtr->nBitmapWidth = width; + if (height != -1) + infoPtr->nBitmapHeight = height; if ((himlDef == infoPtr->himlInt) && (ImageList_GetImageCount(infoPtr->himlInt) == 0)) @@ -5165,7 +5171,7 @@ TOOLBAR_SetVersion (HWND hwnd, INT iVersion) infoPtr->iVersion = iVersion; if (infoPtr->iVersion >= 5) - TOOLBAR_SetUnicodeFormat(hwnd, (WPARAM)TRUE, (LPARAM)0); + TOOLBAR_SetUnicodeFormat(hwnd, TRUE, 0); return iOldVersion; } @@ -5236,12 +5242,11 @@ static LRESULT TOOLBAR_Unkwn45D(HWND hwnd, WPARAM wParam, LPARAM lParam) } -/* UNDOCUMENTED MESSAGE: This is an extended version of the - * TB_SETHOTITEM message. It allows the caller to specify a reason why the - * hot item changed (rather than just the HICF_OTHER that TB_SETHOTITEM - * sends). */ +/* This is an extended version of the TB_SETHOTITEM message. It allows the + * caller to specify a reason why the hot item changed (rather than just the + * HICF_OTHER that TB_SETHOTITEM sends). */ static LRESULT -TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_SetHotItem2 (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); INT nOldHotItem = infoPtr->nHotItem; @@ -5262,18 +5267,15 @@ TOOLBAR_Unkwn45E (HWND hwnd, WPARAM wParam, LPARAM lParam) return (nOldHotItem < 0) ? -1 : (LRESULT)nOldHotItem; } -/* UNDOCUMENTED MESSAGE: This sets the toolbar global iListGap parameter - * which controls the amount of spacing between the image and the text - * of buttons for TBSTYLE_LIST toolbars. */ -static LRESULT TOOLBAR_Unkwn460(HWND hwnd, WPARAM wParam, LPARAM lParam) +/* Sets the toolbar global iListGap parameter which controls the amount of + * spacing between the image and the text of buttons for TBSTYLE_LIST + * toolbars. */ +static LRESULT TOOLBAR_SetListGap(HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); TRACE("hwnd=%p iListGap=%ld\n", hwnd, wParam); - if (lParam != 0) - FIXME("lParam = 0x%08lx. Please report\n", lParam); - infoPtr->iListGap = (INT)wParam; InvalidateRect(hwnd, NULL, TRUE); @@ -5281,9 +5283,9 @@ static LRESULT TOOLBAR_Unkwn460(HWND hwnd, WPARAM wParam, LPARAM lParam) return 0; } -/* UNDOCUMENTED MESSAGE: This returns the number of maximum number - * of image lists associated with the various states. */ -static LRESULT TOOLBAR_Unkwn462(HWND hwnd, WPARAM wParam, LPARAM lParam) +/* Returns the number of maximum number of image lists associated with the + * various states. */ +static LRESULT TOOLBAR_GetImageListCount(HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); @@ -5293,7 +5295,7 @@ static LRESULT TOOLBAR_Unkwn462(HWND hwnd, WPARAM wParam, LPARAM lParam) } static LRESULT -TOOLBAR_Unkwn463 (HWND hwnd, WPARAM wParam, LPARAM lParam) +TOOLBAR_GetIdealSize (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); LPSIZE lpsize = (LPSIZE)lParam; @@ -5308,7 +5310,7 @@ TOOLBAR_Unkwn463 (HWND hwnd, WPARAM wParam, LPARAM lParam) * lParam pointer to SIZE structure * */ - TRACE("[0463] wParam %ld, lParam 0x%08lx -> 0x%08x 0x%08x\n", + TRACE("wParam %ld, lParam 0x%08lx -> 0x%08x 0x%08x\n", wParam, lParam, lpsize->cx, lpsize->cy); switch(wParam) { @@ -5335,11 +5337,10 @@ TOOLBAR_Unkwn463 (HWND hwnd, WPARAM wParam, LPARAM lParam) lpsize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top; break; default: - ERR("Unknown wParam %ld for Toolbar message [0463]. Please report\n", - wParam); + FIXME("Unknown wParam %ld\n", wParam); return 0; } - TRACE("[0463] set to -> 0x%08x 0x%08x\n", + TRACE("set to -> 0x%08x 0x%08x\n", lpsize->cx, lpsize->cy); return 1; } @@ -5820,7 +5821,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) if (pt.x < (btnPtr->rect.left + (btnPtr->rect.right - btnPtr->rect.left)/2)) { if ((nButton > 0) && (infoPtr->buttons[nButton-1].fsStyle & BTNS_SEP)) - TOOLBAR_DeleteButton(hwnd, nButton - 1, 0); + TOOLBAR_DeleteButton(hwnd, nButton - 1); } else /* else insert a separator before the dragged button */ { @@ -5847,7 +5848,7 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) else { TRACE("button %d dragged out of toolbar\n", infoPtr->nButtonDrag); - TOOLBAR_DeleteButton(hwnd, (WPARAM)infoPtr->nButtonDrag, 0); + TOOLBAR_DeleteButton(hwnd, (WPARAM)infoPtr->nButtonDrag); } /* button under cursor changed so need to re-set hot item */ @@ -6145,7 +6146,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) DWORD styleadd = 0; /* allocate memory for info structure */ - infoPtr = (TOOLBAR_INFO *)Alloc (sizeof(TOOLBAR_INFO)); + infoPtr = Alloc (sizeof(TOOLBAR_INFO)); SetWindowLongPtrW (hwnd, 0, (LONG_PTR)infoPtr); /* paranoid!! */ @@ -6670,10 +6671,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_AutoSize (hwnd); case TB_BUTTONCOUNT: - return TOOLBAR_ButtonCount (hwnd, wParam, lParam); + return TOOLBAR_ButtonCount (hwnd); case TB_BUTTONSTRUCTSIZE: - return TOOLBAR_ButtonStructSize (hwnd, wParam, lParam); + return TOOLBAR_ButtonStructSize (hwnd, wParam); case TB_CHANGEBITMAP: return TOOLBAR_ChangeBitmap (hwnd, wParam, lParam); @@ -6682,13 +6683,13 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_CheckButton (hwnd, wParam, lParam); case TB_COMMANDTOINDEX: - return TOOLBAR_CommandToIndex (hwnd, wParam, lParam); + return TOOLBAR_CommandToIndex (hwnd, wParam); case TB_CUSTOMIZE: return TOOLBAR_Customize (hwnd); case TB_DELETEBUTTON: - return TOOLBAR_DeleteButton (hwnd, wParam, lParam); + return TOOLBAR_DeleteButton (hwnd, wParam); case TB_ENABLEBUTTON: return TOOLBAR_EnableButton (hwnd, wParam, lParam); @@ -6697,10 +6698,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_GetAnchorHighlight (hwnd); case TB_GETBITMAP: - return TOOLBAR_GetBitmap (hwnd, wParam, lParam); + return TOOLBAR_GetBitmap (hwnd, wParam); case TB_GETBITMAPFLAGS: - return TOOLBAR_GetBitmapFlags (hwnd, wParam, lParam); + return TOOLBAR_GetBitmapFlags (hwnd); case TB_GETBUTTON: return TOOLBAR_GetButton (hwnd, wParam, lParam); @@ -6736,16 +6737,16 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_GetDefImageList (hwnd, wParam, lParam); case TB_GETINSERTMARK: - return TOOLBAR_GetInsertMark (hwnd, wParam, lParam); + return TOOLBAR_GetInsertMark (hwnd, lParam); case TB_GETINSERTMARKCOLOR: - return TOOLBAR_GetInsertMarkColor (hwnd, wParam, lParam); + return TOOLBAR_GetInsertMarkColor (hwnd); case TB_GETITEMRECT: return TOOLBAR_GetItemRect (hwnd, wParam, lParam); case TB_GETMAXSIZE: - return TOOLBAR_GetMaxSize (hwnd, wParam, lParam); + return TOOLBAR_GetMaxSize (hwnd, lParam); /* case TB_GETOBJECT: */ /* 4.71 */ @@ -6756,10 +6757,10 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_GetRect (hwnd, wParam, lParam); case TB_GETROWS: - return TOOLBAR_GetRows (hwnd, wParam, lParam); + return TOOLBAR_GetRows (hwnd); case TB_GETSTATE: - return TOOLBAR_GetState (hwnd, wParam, lParam); + return TOOLBAR_GetState (hwnd, wParam); case TB_GETSTRINGA: return TOOLBAR_GetStringA (hwnd, wParam, lParam); @@ -6768,16 +6769,16 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLBAR_GetStringW (hwnd, wParam, lParam); case TB_GETSTYLE: - return TOOLBAR_GetStyle (hwnd, wParam, lParam); + return TOOLBAR_GetStyle (hwnd); case TB_GETTEXTROWS: - return TOOLBAR_GetTextRows (hwnd, wParam, lParam); + return TOOLBAR_GetTextRows (hwnd); case TB_GETTOOLTIPS: - return TOOLBAR_GetToolTips (hwnd, wParam, lParam); + return TOOLBAR_GetToolTips (hwnd); case TB_GETUNICODEFORMAT: - return TOOLBAR_GetUnicodeFormat (hwnd, wParam, lParam); + return TOOLBAR_GetUnicodeFormat (hwnd); case TB_HIDEBUTTON: return TOOLBAR_HideButton (hwnd, wParam, lParam); @@ -6914,17 +6915,17 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case TB_UNKWN45D: return TOOLBAR_Unkwn45D(hwnd, wParam, lParam); - case TB_UNKWN45E: - return TOOLBAR_Unkwn45E (hwnd, wParam, lParam); + case TB_SETHOTITEM2: + return TOOLBAR_SetHotItem2 (hwnd, wParam, lParam); - case TB_UNKWN460: - return TOOLBAR_Unkwn460(hwnd, wParam, lParam); + case TB_SETLISTGAP: + return TOOLBAR_SetListGap(hwnd, wParam, lParam); - case TB_UNKWN462: - return TOOLBAR_Unkwn462(hwnd, wParam, lParam); + case TB_GETIMAGELISTCOUNT: + return TOOLBAR_GetImageListCount(hwnd, wParam, lParam); - case TB_UNKWN463: - return TOOLBAR_Unkwn463 (hwnd, wParam, lParam); + case TB_GETIDEALSIZE: + return TOOLBAR_GetIdealSize (hwnd, wParam, lParam); case TB_UNKWN464: return TOOLBAR_Unkwn464(hwnd, wParam, lParam); @@ -7046,7 +7047,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DefWindowProcW (hwnd, uMsg, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); @@ -7091,7 +7092,7 @@ static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIS { PIMLENTRY *pnies; - c = (PIMLENTRY) Alloc(sizeof(IMLENTRY)); + c = Alloc(sizeof(IMLENTRY)); c->id = id; pnies = Alloc((*cies + 1) * sizeof(PIMLENTRY)); diff --git a/reactos/dll/win32/comctl32/tooltips.c b/reactos/dll/win32/comctl32/tooltips.c index de9376faebf..5dd48a286c4 100644 --- a/reactos/dll/win32/comctl32/tooltips.c +++ b/reactos/dll/win32/comctl32/tooltips.c @@ -368,7 +368,7 @@ static void TOOLTIPS_GetDispInfoA(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ttnmdi.hdr.hwndFrom = hwnd; ttnmdi.hdr.idFrom = toolPtr->uId; ttnmdi.hdr.code = TTN_GETDISPINFOA; /* == TTN_NEEDTEXTA */ - ttnmdi.lpszText = (LPSTR)&ttnmdi.szText; + ttnmdi.lpszText = (LPSTR)ttnmdi.szText; ttnmdi.uFlags = toolPtr->uFlags; ttnmdi.lParam = toolPtr->lParam; @@ -424,7 +424,7 @@ static void TOOLTIPS_GetDispInfoW(HWND hwnd, TOOLTIPS_INFO *infoPtr, TTTOOL_INFO ttnmdi.hdr.hwndFrom = hwnd; ttnmdi.hdr.idFrom = toolPtr->uId; ttnmdi.hdr.code = TTN_GETDISPINFOW; /* == TTN_NEEDTEXTW */ - ttnmdi.lpszText = (LPWSTR)&ttnmdi.szText; + ttnmdi.lpszText = (LPWSTR)ttnmdi.szText; ttnmdi.uFlags = toolPtr->uFlags; ttnmdi.lParam = toolPtr->lParam; @@ -1574,6 +1574,9 @@ TOOLTIPS_GetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam) nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo); if (nTool == -1) return 0; + if (infoPtr->tools[nTool].lpszText == NULL) + return 0; + strcpyW (lpToolInfo->lpszText, infoPtr->tools[nTool].lpszText); return 0; @@ -2348,7 +2351,7 @@ TOOLTIPS_Create (HWND hwnd, const CREATESTRUCTW *lpcs) TOOLTIPS_INFO *infoPtr; /* allocate memory for info structure */ - infoPtr = (TOOLTIPS_INFO *)Alloc (sizeof(TOOLTIPS_INFO)); + infoPtr = Alloc (sizeof(TOOLTIPS_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize info structure */ @@ -2486,34 +2489,7 @@ static LRESULT TOOLTIPS_NotifyFormat (HWND hwnd, WPARAM wParam, LPARAM lParam) { FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", hwnd, wParam, lParam); - TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr (hwnd); - TTTOOL_INFO *toolPtr = infoPtr->tools; - INT nResult; - if (lParam == NF_QUERY) - { - if (toolPtr->bNotifyUnicode) - { - return NFR_UNICODE; - } else { - return NFR_ANSI; - } - } - else if (lParam == NF_REQUERY) - { - nResult = (INT) SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT, - (WPARAM)hwnd, (LPARAM)NF_QUERY); - if (nResult == NFR_ANSI) { - toolPtr->bNotifyUnicode = FALSE; - TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n"); - } else if (nResult == NFR_UNICODE) { - toolPtr->bNotifyUnicode = TRUE; - TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n"); - } else { - TRACE (" -- WM_NOTIFYFORMAT returns: error!\n"); - } - return nResult; - } return 0; } @@ -2870,7 +2846,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TOOLTIPS_WinIniChange (hwnd, wParam, lParam); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/trackbar.c b/reactos/dll/win32/comctl32/trackbar.c index a25f81ebdc9..3424333e2e2 100644 --- a/reactos/dll/win32/comctl32/trackbar.c +++ b/reactos/dll/win32/comctl32/trackbar.c @@ -146,12 +146,12 @@ notify_with_scroll (const TRACKBAR_INFO *infoPtr, UINT code) static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr) { - int i, tic, nrTics; + int tic; + unsigned nrTics, i; if (infoPtr->uTicFreq && infoPtr->lRangeMax >= infoPtr->lRangeMin) nrTics=(infoPtr->lRangeMax - infoPtr->lRangeMin)/infoPtr->uTicFreq; else { - nrTics = 0; Free (infoPtr->tics); infoPtr->tics = NULL; infoPtr->uNumTics = 0; @@ -1147,7 +1147,7 @@ TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition) infoPtr->lPos = infoPtr->lRangeMax; infoPtr->flags |= TB_THUMBPOSCHANGED; - if (fPosition) TRACKBAR_InvalidateThumbMove(infoPtr, oldPos, lPosition); + if (fPosition && oldPos != lPosition) TRACKBAR_InvalidateThumbMove(infoPtr, oldPos, lPosition); return 0; } @@ -1396,7 +1396,7 @@ TRACKBAR_Create (HWND hwnd, const CREATESTRUCTW *lpcs) TRACKBAR_INFO *infoPtr; DWORD dwStyle; - infoPtr = (TRACKBAR_INFO *)Alloc (sizeof(TRACKBAR_INFO)); + infoPtr = Alloc (sizeof(TRACKBAR_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); @@ -1452,6 +1452,9 @@ TRACKBAR_Destroy (TRACKBAR_INFO *infoPtr) if (infoPtr->hwndToolTip) DestroyWindow (infoPtr->hwndToolTip); + Free (infoPtr->tics); + infoPtr->tics = NULL; + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); CloseThemeData (GetWindowTheme (infoPtr->hwndSelf)); Free (infoPtr); @@ -1461,7 +1464,7 @@ TRACKBAR_Destroy (TRACKBAR_INFO *infoPtr) static LRESULT -TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr, HWND hwndGetFocus) +TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr) { TRACE("\n"); infoPtr->bFocussed = FALSE; @@ -1471,7 +1474,7 @@ TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr, HWND hwndGetFocus) } static LRESULT -TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y) +TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, INT x, INT y) { POINT clickPoint; @@ -1500,7 +1503,7 @@ TRACKBAR_LButtonDown (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y) static LRESULT -TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y) +TRACKBAR_LButtonUp (TRACKBAR_INFO *infoPtr) { if (infoPtr->flags & TB_DRAG_MODE) { notify_with_scroll (infoPtr, TB_THUMBPOSITION | (infoPtr->lPos<<16)); @@ -1548,7 +1551,7 @@ TRACKBAR_Paint (TRACKBAR_INFO *infoPtr, HDC hdc) static LRESULT -TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr, HWND hwndLoseFocus) +TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr) { TRACE("\n"); infoPtr->bFocussed = TRUE; @@ -1559,7 +1562,7 @@ TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr, HWND hwndLoseFocus) static LRESULT -TRACKBAR_Size (TRACKBAR_INFO *infoPtr, DWORD fwSizeType, INT nWidth, INT nHeight) +TRACKBAR_Size (TRACKBAR_INFO *infoPtr) { TRACKBAR_InitializeThumb (infoPtr); TRACKBAR_AlignBuddies (infoPtr); @@ -1569,7 +1572,7 @@ TRACKBAR_Size (TRACKBAR_INFO *infoPtr, DWORD fwSizeType, INT nWidth, INT nHeight static LRESULT -TRACKBAR_Timer (TRACKBAR_INFO *infoPtr, INT wTimerID, const TIMERPROC *tmrpc) +TRACKBAR_Timer (TRACKBAR_INFO *infoPtr) { if (infoPtr->flags & TB_AUTO_PAGE) { POINT pt; @@ -1586,13 +1589,13 @@ static LRESULT theme_changed (const TRACKBAR_INFO* infoPtr) { HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); CloseThemeData (theme); - theme = OpenThemeData (infoPtr->hwndSelf, themeClass); + OpenThemeData (infoPtr->hwndSelf, themeClass); return 0; } static LRESULT -TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y) +TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, INT x, INT y) { DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE); INT clickPlace = (dwStyle & TBS_VERT) ? y : x; @@ -1656,7 +1659,7 @@ TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, DWORD fwKeys, INT x, INT y) } static BOOL -TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData) +TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey) { DWORD style = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE); BOOL downIsLeft = style & TBS_DOWNISLEFT; @@ -1712,7 +1715,7 @@ TRACKBAR_KeyDown (TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData) static inline BOOL -TRACKBAR_KeyUp (const TRACKBAR_INFO *infoPtr, INT nVirtKey, DWORD lKeyData) +TRACKBAR_KeyUp (const TRACKBAR_INFO *infoPtr, INT nVirtKey) { switch (nVirtKey) { case VK_LEFT: @@ -1865,19 +1868,19 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return DLGC_WANTARROWS; case WM_KEYDOWN: - return TRACKBAR_KeyDown (infoPtr, (INT)wParam, (DWORD)lParam); + return TRACKBAR_KeyDown (infoPtr, (INT)wParam); case WM_KEYUP: - return TRACKBAR_KeyUp (infoPtr, (INT)wParam, (DWORD)lParam); + return TRACKBAR_KeyUp (infoPtr, (INT)wParam); case WM_KILLFOCUS: - return TRACKBAR_KillFocus (infoPtr, (HWND)wParam); + return TRACKBAR_KillFocus (infoPtr); case WM_LBUTTONDOWN: - return TRACKBAR_LButtonDown (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return TRACKBAR_LButtonDown (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_LBUTTONUP: - return TRACKBAR_LButtonUp (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return TRACKBAR_LButtonUp (infoPtr); case WM_MOUSELEAVE: infoPtr->flags &= ~TB_THUMB_HOT; @@ -1885,29 +1888,29 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case WM_MOUSEMOVE: - return TRACKBAR_MouseMove (infoPtr, wParam, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); + return TRACKBAR_MouseMove (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam)); case WM_PRINTCLIENT: case WM_PAINT: return TRACKBAR_Paint (infoPtr, (HDC)wParam); case WM_SETFOCUS: - return TRACKBAR_SetFocus (infoPtr, (HWND)wParam); + return TRACKBAR_SetFocus (infoPtr); case WM_SIZE: - return TRACKBAR_Size (infoPtr, wParam, LOWORD(lParam), HIWORD(lParam)); + return TRACKBAR_Size (infoPtr); case WM_THEMECHANGED: return theme_changed (infoPtr); case WM_TIMER: - return TRACKBAR_Timer (infoPtr, (INT)wParam, (TIMERPROC *)lParam); + return TRACKBAR_Timer (infoPtr); case WM_WININICHANGE: return TRACKBAR_InitializeThumb (infoPtr); default: - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } diff --git a/reactos/dll/win32/comctl32/treeview.c b/reactos/dll/win32/comctl32/treeview.c index dd3e0ee842e..dd0563ad834 100644 --- a/reactos/dll/win32/comctl32/treeview.c +++ b/reactos/dll/win32/comctl32/treeview.c @@ -23,8 +23,7 @@ * * Note that TREEVIEW_INFO * and HTREEITEM are the same thing. * - * Note2: All items always! have valid (allocated) pszText field. - * If item's text == LPSTR_TEXTCALLBACKA we allocate buffer + * Note2: If item's text == LPSTR_TEXTCALLBACKA we allocate buffer * of size TEXT_CALLBACK_SIZE in DoSetItem. * We use callbackMask to keep track of fields to be updated. * @@ -752,7 +751,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, (LPSTR)callback.item.pszText, -1, NULL, 0); buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); - newText = (LPWSTR)ReAlloc(wineItem->pszText, buflen); + newText = ReAlloc(wineItem->pszText, buflen); TRACE("returned str %s, len=%d, buflen=%d\n", debugstr_a((LPSTR)callback.item.pszText), len, buflen); @@ -794,7 +793,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, (LPSTR)callback.item.pszText, -1, NULL, 0); buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); - newText = (LPWSTR)Alloc(buflen); + newText = Alloc(buflen); TRACE("same buffer str %s, len=%d, buflen=%d\n", debugstr_a((LPSTR)callback.item.pszText), len, buflen); @@ -859,7 +858,7 @@ TREEVIEW_ComputeItemInternalMetrics(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM > TVS_LINESATROOT); #endif - item->linesOffset = infoPtr->uIndent * (item->iLevel + lar - 1) + item->linesOffset = infoPtr->uIndent * (lar ? item->iLevel : item->iLevel - 1) - infoPtr->scrollX; item->stateOffset = item->linesOffset + infoPtr->uIndent; item->imageOffset = item->stateOffset @@ -1221,7 +1220,7 @@ TREEVIEW_InsertItemT(TREEVIEW_INFO *infoPtr, const TVINSERTSTRUCTW *ptdi, BOOL i if (!TREEVIEW_ValidItem(infoPtr, parentItem)) { WARN("invalid parent %p\n", parentItem); - return (LRESULT)(HTREEITEM)NULL; + return 0; } } @@ -1252,13 +1251,13 @@ TREEVIEW_InsertItemT(TREEVIEW_INFO *infoPtr, const TVINSERTSTRUCTW *ptdi, BOOL i newItem = TREEVIEW_AllocateItem(infoPtr); if (newItem == NULL) - return (LRESULT)(HTREEITEM)NULL; + return 0; newItem->parent = parentItem; newItem->iIntegral = 1; if (!TREEVIEW_DoSetItemT(infoPtr, newItem, tvItem, isW)) - return (LRESULT)(HTREEITEM)NULL; + return 0; /* After this point, nothing can fail. (Except for TVI_SORT.) */ @@ -1585,7 +1584,7 @@ TREEVIEW_DeleteItem(TREEVIEW_INFO *infoPtr, HTREEITEM wineItem) /* Get/Set Messages *********************************************************/ static LRESULT -TREEVIEW_SetRedraw(TREEVIEW_INFO* infoPtr, WPARAM wParam, LPARAM lParam) +TREEVIEW_SetRedraw(TREEVIEW_INFO* infoPtr, WPARAM wParam) { if(wParam) infoPtr->bRedraw = TRUE; @@ -2083,7 +2082,12 @@ TREEVIEW_GetItemT(const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW) if (tvItem->mask & TVIF_TEXT) { - if (isW) + if (wineItem->pszText == NULL) + { + if (tvItem->cchTextMax > 0) + tvItem->pszText[0] = '\0'; + } + else if (isW) { if (wineItem->pszText == LPSTR_TEXTCALLBACKW) { @@ -2826,6 +2830,8 @@ TREEVIEW_Refresh(TREEVIEW_INFO *infoPtr, HDC hdc, const RECT *rc) } } + TREEVIEW_UpdateScrollBars(infoPtr); + if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT) infoPtr->cdmode = TREEVIEW_SendCustomDrawNotify(infoPtr, CDDS_POSTPAINT, hdc, rect); @@ -2908,7 +2914,7 @@ TREEVIEW_SortOnName(TREEVIEW_ITEM *first, TREEVIEW_ITEM *second, /* Returns the number of physical children belonging to item. */ static INT -TREEVIEW_CountChildren(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item) +TREEVIEW_CountChildren(const TREEVIEW_ITEM *item) { INT cChildren = 0; HTREEITEM hti; @@ -2922,7 +2928,7 @@ TREEVIEW_CountChildren(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item) /* Returns a DPA containing a pointer to each physical child of item in * sibling order. If item has no children, an empty DPA is returned. */ static HDPA -TREEVIEW_BuildChildDPA(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item) +TREEVIEW_BuildChildDPA(const TREEVIEW_ITEM *item) { HTREEITEM child = item->firstChild; @@ -2953,7 +2959,7 @@ TREEVIEW_BuildChildDPA(const TREEVIEW_INFO *infoPtr, const TREEVIEW_ITEM *item) */ static LRESULT -TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent, +TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, HTREEITEM parent, LPTVSORTCB pSort) { INT cChildren; @@ -2982,7 +2988,7 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent, lpCompare = (LPARAM)infoPtr; } - cChildren = TREEVIEW_CountChildren(infoPtr, parent); + cChildren = TREEVIEW_CountChildren(parent); /* Make sure there is something to sort */ if (cChildren > 1) @@ -2993,7 +2999,7 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent, HTREEITEM nextItem = 0; HTREEITEM prevItem = 0; - HDPA sortList = TREEVIEW_BuildChildDPA(infoPtr, parent); + HDPA sortList = TREEVIEW_BuildChildDPA(parent); if (sortList == NULL) return FALSE; @@ -3004,8 +3010,8 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent, /* The order of DPA entries has been changed, so fixup the * nextSibling and prevSibling pointers. */ - item = (HTREEITEM)DPA_GetPtr(sortList, count++); - while ((nextItem = (HTREEITEM)DPA_GetPtr(sortList, count++)) != NULL) + item = DPA_GetPtr(sortList, count++); + while ((nextItem = DPA_GetPtr(sortList, count++)) != NULL) { /* link the two current item together */ item->nextSibling = nextItem; @@ -3074,9 +3080,9 @@ TREEVIEW_Sort(TREEVIEW_INFO *infoPtr, BOOL fRecurse, HTREEITEM parent, * and sort the children of the TV item specified in lParam */ static LRESULT -TREEVIEW_SortChildrenCB(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPTVSORTCB pSort) +TREEVIEW_SortChildrenCB(TREEVIEW_INFO *infoPtr, LPTVSORTCB pSort) { - return TREEVIEW_Sort(infoPtr, wParam, pSort->hParent, pSort); + return TREEVIEW_Sort(infoPtr, pSort->hParent, pSort); } @@ -3084,9 +3090,9 @@ TREEVIEW_SortChildrenCB(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPTVSORTCB pSort) * Sort the children of the TV item specified in lParam. */ static LRESULT -TREEVIEW_SortChildren(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +TREEVIEW_SortChildren(TREEVIEW_INFO *infoPtr, LPARAM lParam) { - return TREEVIEW_Sort(infoPtr, (BOOL)wParam, (HTREEITEM)lParam, NULL); + return TREEVIEW_Sort(infoPtr, (HTREEITEM)lParam, NULL); } @@ -3292,7 +3298,7 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, scrollDist = nextItem->rect.top - orgNextTop; scrollRect.top = orgNextTop; - ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, &scrollRect, + ScrollWindowEx (infoPtr->hwnd, 0, scrollDist, &scrollRect, NULL, NULL, NULL, SW_ERASE | SW_INVALIDATE); TREEVIEW_Invalidate (infoPtr, wineItem); } else { @@ -3455,14 +3461,14 @@ TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht) if (status) { lpht->flags = status; - return (LRESULT)(HTREEITEM)NULL; + return 0; } wineItem = TREEVIEW_HitTestPoint(infoPtr, lpht->pt); if (!wineItem) { lpht->flags = TVHT_NOWHERE; - return (LRESULT)(HTREEITEM)NULL; + return 0; } if (x >= wineItem->textOffset + wineItem->textWidth) @@ -3660,8 +3666,11 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) } /* Get string length in pixels */ - GetTextExtentPoint32W(hdc, editItem->pszText, strlenW(editItem->pszText), - &sz); + if (editItem->pszText) + GetTextExtentPoint32W(hdc, editItem->pszText, strlenW(editItem->pszText), + &sz); + else + GetTextExtentPoint32A(hdc, "", 0, &sz); /* Add Extra spacing for the next character */ GetTextMetricsW(hdc, &textMetric); @@ -3710,7 +3719,10 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) } infoPtr->selectedItem = hItem; - SetWindowTextW(hwndEdit, editItem->pszText); + + if (editItem->pszText) + SetWindowTextW(hwndEdit, editItem->pszText); + SetFocus(hwndEdit); SendMessageW(hwndEdit, EM_SETSEL, 0, -1); ShowWindow(hwndEdit, SW_SHOW); @@ -4158,7 +4170,7 @@ TREEVIEW_RButtonUp(const TREEVIEW_INFO *infoPtr, const POINT *pPt) static LRESULT -TREEVIEW_CreateDragImage(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +TREEVIEW_CreateDragImage(TREEVIEW_INFO *infoPtr, LPARAM lParam) { TREEVIEW_ITEM *dragItem = (HTREEITEM)lParam; INT cx, cy; @@ -4184,10 +4196,14 @@ TREEVIEW_CreateDragImage(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) hdc = CreateCompatibleDC(htopdc); hOldFont = SelectObject(hdc, infoPtr->hFont); - GetTextExtentPoint32W(hdc, dragItem->pszText, strlenW(dragItem->pszText), + + if (dragItem->pszText) + GetTextExtentPoint32W(hdc, dragItem->pszText, strlenW(dragItem->pszText), &size); - TRACE("%d %d %s %d\n", size.cx, size.cy, debugstr_w(dragItem->pszText), - strlenW(dragItem->pszText)); + else + GetTextExtentPoint32A(hdc, "", 0, &size); + + TRACE("%d %d %s\n", size.cx, size.cy, debugstr_w(dragItem->pszText)); hbmp = CreateCompatibleBitmap(htopdc, size.cx, size.cy); hOldbmp = SelectObject(hdc, hbmp); @@ -4208,8 +4224,11 @@ TREEVIEW_CreateDragImage(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) /* draw item text */ SetRect(&rc, cx, 0, size.cx, size.cy); - DrawTextW(hdc, dragItem->pszText, strlenW(dragItem->pszText), &rc, - DT_LEFT); + + if (dragItem->pszText) + DrawTextW(hdc, dragItem->pszText, strlenW(dragItem->pszText), &rc, + DT_LEFT); + SelectObject(hdc, hOldFont); SelectObject(hdc, hOldbmp); @@ -4877,7 +4896,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) TRACE("wnd %p, style %x\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE)); - infoPtr = (TREEVIEW_INFO *)Alloc(sizeof(TREEVIEW_INFO)); + infoPtr = Alloc(sizeof(TREEVIEW_INFO)); if (infoPtr == NULL) { @@ -5000,7 +5019,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr) CloseThemeData (GetWindowTheme (infoPtr->hwnd)); /* Deassociate treeview from the window before doing anything drastic. */ - SetWindowLongPtrW(infoPtr->hwnd, 0, (DWORD_PTR)NULL); + SetWindowLongPtrW(infoPtr->hwnd, 0, 0); DeleteObject(infoPtr->hDefaultFont); @@ -5186,7 +5205,7 @@ TREEVIEW_MouseLeave (TREEVIEW_INFO * infoPtr) } static LRESULT -TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, WPARAM wParam, LPARAM lParam) +TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, LPARAM lParam) { POINT pt; TRACKMOUSEEVENT trackinfo; @@ -5451,7 +5470,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case TVM_CREATEDRAGIMAGE: - return TREEVIEW_CreateDragImage(infoPtr, wParam, lParam); + return TREEVIEW_CreateDragImage(infoPtr, lParam); case TVM_DELETEITEM: return TREEVIEW_DeleteItem(infoPtr, (HTREEITEM)lParam); @@ -5585,10 +5604,10 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TREEVIEW_SetUnicodeFormat(infoPtr, (BOOL)wParam); case TVM_SORTCHILDREN: - return TREEVIEW_SortChildren(infoPtr, wParam, lParam); + return TREEVIEW_SortChildren(infoPtr, lParam); case TVM_SORTCHILDRENCB: - return TREEVIEW_SortChildrenCB(infoPtr, wParam, (LPTVSORTCB)lParam); + return TREEVIEW_SortChildrenCB(infoPtr, (LPTVSORTCB)lParam); case WM_CHAR: return TREEVIEW_ProcessLetterKeys( hwnd, wParam, lParam ); @@ -5632,7 +5651,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: if (infoPtr->dwStyle & TVS_TRACKSELECT) - return TREEVIEW_MouseMove(infoPtr, wParam, lParam); + return TREEVIEW_MouseMove(infoPtr, lParam); else return 0; @@ -5669,7 +5688,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return TREEVIEW_SetFont(infoPtr, (HFONT)wParam, (BOOL)lParam); case WM_SETREDRAW: - return TREEVIEW_SetRedraw(infoPtr, wParam, lParam); + return TREEVIEW_SetRedraw(infoPtr, wParam); case WM_SIZE: return TREEVIEW_Size(infoPtr, wParam, lParam); @@ -5703,7 +5722,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) default: /* This mostly catches MFC and Delphi messages. :( */ - if ((uMsg >= WM_USER) && (uMsg < WM_APP)) + if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) TRACE("Unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); def: return DefWindowProcW(hwnd, uMsg, wParam, lParam); diff --git a/reactos/dll/win32/comctl32/updown.c b/reactos/dll/win32/comctl32/updown.c index a62e22134bd..fcbc15a716e 100644 --- a/reactos/dll/win32/comctl32/updown.c +++ b/reactos/dll/win32/comctl32/updown.c @@ -817,7 +817,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); - int temp; static const WCHAR themeClass[] = {'S','p','i','n',0}; HTHEME theme; @@ -829,7 +828,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L switch(message) { case WM_CREATE: - infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO)); + infoPtr = Alloc (sizeof(UPDOWN_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ @@ -903,6 +902,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L /* if initial timer, kill it and start the repeat timer */ if(wParam == TIMER_AUTOREPEAT) { + int temp; + KillTimer(hwnd, TIMER_AUTOREPEAT); /* if no accel info given, used default timer */ if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0) { @@ -917,6 +918,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L /* now, if the mouse is above us, do the thing...*/ if(infoPtr->Flags & FLAG_MOUSEIN) { + int temp; + temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc; UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW); @@ -972,13 +975,16 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L case UDM_GETACCEL: if (wParam==0 && lParam==0) return infoPtr->AccelCount; if (wParam && lParam) { - temp = min(infoPtr->AccelCount, wParam); + int temp = min(infoPtr->AccelCount, wParam); memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL)); return temp; } return 0; case UDM_SETACCEL: + { + unsigned temp; + TRACE("UDM_SETACCEL\n"); if(infoPtr->AccelVect) { @@ -996,14 +1002,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc); return TRUE; - + } case UDM_GETBASE: return infoPtr->Base; case UDM_SETBASE: TRACE("UpDown Ctrl new base(%ld), hwnd=%p\n", wParam, hwnd); if (wParam==10 || wParam==16) { - temp = infoPtr->Base; + WPARAM temp = infoPtr->Base; infoPtr->Base = wParam; return temp; } @@ -1016,11 +1022,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L return (LRESULT)UPDOWN_SetBuddy (infoPtr, (HWND)wParam); case UDM_GETPOS: - temp = UPDOWN_GetBuddyInt (infoPtr); + { + int temp = UPDOWN_GetBuddyInt (infoPtr); return MAKELONG(infoPtr->CurVal, temp ? 0 : 1); - + } case UDM_SETPOS: - temp = (short)LOWORD(lParam); + { + int temp = (short)LOWORD(lParam); + TRACE("UpDown Ctrl new value(%d), hwnd=%p\n", temp, hwnd); if(!UPDOWN_InBounds(infoPtr, temp)) { if(temp < infoPtr->MinVal) temp = infoPtr->MinVal; @@ -1030,7 +1039,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L infoPtr->CurVal = temp; UPDOWN_SetBuddyInt (infoPtr); return wParam; /* return prev value */ - + } case UDM_GETRANGE: return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); @@ -1062,6 +1071,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L return infoPtr->CurVal; case UDM_SETPOS32: + { + int temp; + if(!UPDOWN_InBounds(infoPtr, (int)lParam)) { if((int)lParam < infoPtr->MinVal) lParam = infoPtr->MinVal; if((int)lParam > infoPtr->MaxVal) lParam = infoPtr->MaxVal; @@ -1070,19 +1082,20 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L infoPtr->CurVal = (int)lParam; /* set the new value */ UPDOWN_SetBuddyInt (infoPtr); return temp; /* return prev value */ - + } case UDM_GETUNICODEFORMAT: /* we lie a bit here, we're always using Unicode internally */ return infoPtr->UnicodeFormat; case UDM_SETUNICODEFORMAT: + { /* do we really need to honour this flag? */ - temp = infoPtr->UnicodeFormat; + int temp = infoPtr->UnicodeFormat; infoPtr->UnicodeFormat = (BOOL)wParam; return temp; - + } default: - if ((message >= WM_USER) && (message < WM_APP)) + if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam); return DefWindowProcW (hwnd, message, wParam, lParam); }