From 2f07e000b4a7d9093349530fb18989f72aa7ffb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Sat, 8 May 2004 11:41:05 +0000 Subject: [PATCH] Sync to Wine-20040505: Ilya Korniyko - Added Ukrainian translations. Francois Gouget - Make Unicode strings static const. - Make our ascii strings static const. - Remove a couple string variables that were used only once and use the string literal directly. Krzysztof Foltman - make monthcal a child of datetime (it was a sibling before, causing completely incorrect message flow) - update monthcal after date change in datetime - choose different coordinates when DTS_SHOWNONE is not used - embedded monthcal is now 200 pixels wide - selecting a day in embedded monthcal updates the datetime and hides the monthcal - changing months/years by clicking month name/year in title bar works - embedded month calendar is correctly destroyed (it used to stick on the screen long after the datetime's container was closed) - next/prev month don't stick anymore - min/max ranges initialized to some reasonable values - fixed some bugs caused by reversed order of arguments of MONTHCAL_CopyTime - update current month/year after setting current date - changing months etc doesn't send MCN_SELECT (which could be sent only after a particular day was clicked) - changed (hit && MCHT_CALENDARDATE) to (hit == MCHT_CALENDARDATE) Huw Davies - Deleting column zero should only delete the column and not the item data. - Implemented TVS_NOSCROLL. Maxime Bellenge - Add NM_RCLICK notification support for toolbars. - Fix the size of the listview items in the customize dialog. - Fix TB_GETSTYLE message to return the style of the toolbar and not the style of a button. Robert Shearman - Optimise accessing toolbar style by storing it in the TOOLBAR_INFO structure. - Replace {Get,Set}WindowLong by {Get,Set}WindowLongPtr where appropriate. svn path=/trunk/; revision=9321 --- reactos/lib/comctl32/comboex.c | 8 +- reactos/lib/comctl32/comctl32undoc.c | 4 +- reactos/lib/comctl32/comctl_Uk.rc | 88 ++++++++++++++++++ reactos/lib/comctl32/datetime.c | 44 +++++++-- reactos/lib/comctl32/header.c | 3 +- reactos/lib/comctl32/ipaddress.c | 8 +- reactos/lib/comctl32/listview.c | 22 ++--- reactos/lib/comctl32/monthcal.c | 54 ++++++----- reactos/lib/comctl32/propsheet.c | 2 +- reactos/lib/comctl32/rsrc.rc | 1 + reactos/lib/comctl32/toolbar.c | 127 +++++++++++++++----------- reactos/lib/comctl32/trackbar.c | 3 +- reactos/lib/comctl32/treeview.c | 10 +- reactos/lib/comctl32/winehq2ros.patch | 101 +++++++++++++++----- 14 files changed, 336 insertions(+), 139 deletions(-) create mode 100644 reactos/lib/comctl32/comctl_Uk.rc diff --git a/reactos/lib/comctl32/comboex.c b/reactos/lib/comctl32/comboex.c index 3b1a0b548a7..7f55192c646 100644 --- a/reactos/lib/comctl32/comboex.c +++ b/reactos/lib/comctl32/comboex.c @@ -915,9 +915,9 @@ static INT COMBOEX_SetItemHeight (COMBOEX_INFO *infoPtr, INT index, UINT height) static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs) { - WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 }; - WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 }; - WCHAR NIL[] = { 0 }; + static const WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 }; + static const WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 }; + static const WCHAR NIL[] = { 0 }; COMBOEX_INFO *infoPtr; LOGFONTW mylogfont; RECT wnrc1, clrc1, cmbwrc; @@ -1281,7 +1281,7 @@ static BOOL COMBOEX_WM_DeleteItem (COMBOEX_INFO *infoPtr, DELETEITEMSTRUCT *dis) static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis) { - WCHAR nil[] = { 0 }; + static const WCHAR nil[] = { 0 }; CBE_ITEMDATA *item = 0; SIZE txtsize; RECT rect; diff --git a/reactos/lib/comctl32/comctl32undoc.c b/reactos/lib/comctl32/comctl32undoc.c index fabc4d59032..8944c197257 100644 --- a/reactos/lib/comctl32/comctl32undoc.c +++ b/reactos/lib/comctl32/comctl32undoc.c @@ -523,7 +523,7 @@ VOID MRU_SaveChanged( LPWINEMRULIST mp ) HKEY newkey; WCHAR realname[2]; LPWINEMRUITEM witem; - WCHAR emptyW[] = {'\0'}; + static const WCHAR emptyW[] = {'\0'}; /* or should we do the following instead of RegOpenKeyEx: */ @@ -859,7 +859,7 @@ HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) WCHAR realname[2]; LPWINEMRUITEM witem; DWORD type; - WCHAR emptyW[] = {'\0'}; + static const WCHAR emptyW[] = {'\0'}; /* get space to save indices that will turn into names * but in order of most to least recently used diff --git a/reactos/lib/comctl32/comctl_Uk.rc b/reactos/lib/comctl32/comctl_Uk.rc new file mode 100644 index 00000000000..fecaddd80bc --- /dev/null +++ b/reactos/lib/comctl32/comctl_Uk.rc @@ -0,0 +1,88 @@ +/* + * comctl (Ukrainian resources) + * + * Copyright 2004 Ilya Korniyko + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Властивості для " +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "&Відміна", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Застосувати", 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 + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Мастер" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "&Завершити", IDC_FINISH_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Далі >", IDC_NEXT_BUTTON,121,138,50,14 + PUSHBUTTON "< &Назад", IDC_BACK_BUTTON,71,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 +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Настройка панелі інструментів" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "&Закрити", IDCANCEL,308,6,44,14 + PUSHBUTTON "&Скинути", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Довідка", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Пересунути в&гору", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Пересунути до&низу", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "На&явні кнопки:", -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 "&Додати ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Прибрати", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "&Кнопки панелі інструментів:", -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 + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Закрити" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "Сьогодні:" + IDM_GOTODAY "Поточна дата" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Роздільник" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "Нема" +} diff --git a/reactos/lib/comctl32/datetime.c b/reactos/lib/comctl32/datetime.c index 9741560bff0..aab70245caa 100644 --- a/reactos/lib/comctl32/datetime.c +++ b/reactos/lib/comctl32/datetime.c @@ -148,13 +148,14 @@ DATETIME_SetSystemTime (HWND hwnd, WPARAM wParam, LPARAM lParam ) TRACE("%p %04x %08lx\n",hwnd, wParam, lParam); if (!lParam) return 0; - TRACE("%04d/%02d/%02d %02d:%02d:%02d)\n", + TRACE("%04d/%02d/%02d %02d:%02d:%02d\n", lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay, lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond); if (wParam==GDT_VALID) { infoPtr->dateValid = TRUE; MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date); + SendMessageA(infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date)); SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0); } else if (wParam==GDT_NONE) { infoPtr->dateValid = FALSE; @@ -784,8 +785,10 @@ static void DATETIME_Refresh (HWND hwnd, HDC hdc) GetTextExtentPoint32A (hdc, txt, strlen (txt), &size); rcDraw->bottom = size.cy+2; - if (dwStyle & DTS_SHOWNONE) checkbox->right = 18; - + if (dwStyle & DTS_SHOWNONE) + checkbox->right = 18; + else + checkbox->right = 2; prevright = checkbox->right; for (i=0; inrFields; i++) { @@ -882,19 +885,25 @@ DATETIME_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) /* recalculate the position of the monthcal popup */ if(dwStyle & DTS_RIGHTALIGN) infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - - infoPtr->calbutton.left) + 145); + infoPtr->calbutton.left) + 200); else infoPtr->monthcal_pos.x = 8; infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom; ClientToScreen (hwnd, &(infoPtr->monthcal_pos)); + /* FIXME My Windoze has cx=about 200, but it probably depends on font size etc */ SetWindowPos(infoPtr->hMonthCal, 0, infoPtr->monthcal_pos.x, - infoPtr->monthcal_pos.y, 145, 150, 0); + infoPtr->monthcal_pos.y, 200, 150, 0); if(IsWindowVisible(infoPtr->hMonthCal)) ShowWindow(infoPtr->hMonthCal, SW_HIDE); - else - ShowWindow(infoPtr->hMonthCal, SW_SHOW); + else { + SYSTEMTIME *lprgSysTimeArray = &infoPtr->date; + TRACE("update calendar %04d/%02d/%02d\n", + lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay); + SendMessageA(infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date)); + ShowWindow(infoPtr->hMonthCal, SW_SHOW); + } TRACE ("dt:%p mc:%p mc parent:%p, desktop:%p\n", hwnd, infoPtr->hMonthCal, infoPtr->hwndNotify, GetDesktopWindow ()); @@ -995,6 +1004,17 @@ DATETIME_Notify (HWND hwnd, WPARAM wParam, LPARAM lParam) TRACE ("%x,%lx\n",wParam, lParam); TRACE ("Got notification %x from %p\n", lpnmh->code, lpnmh->hwndFrom); TRACE ("info: %p %p %p\n",hwnd,infoPtr->hMonthCal,infoPtr->hUpdown); + + if (lpnmh->code==MCN_SELECT) { + ShowWindow(infoPtr->hMonthCal, SW_HIDE); + infoPtr->dateValid = TRUE; + SendMessageA (infoPtr->hMonthCal, MCM_GETCURSEL, 0, (LPARAM)&infoPtr->date); + TRACE("got from calendar %04d/%02d/%02d\n", + infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay); + SendMessageA (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0); + InvalidateRect(hwnd, NULL, TRUE); + DATETIME_SendDateTimeChangeNotify (hwnd); + } return 0; } @@ -1232,7 +1252,7 @@ DATETIME_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->hMonthCal = CreateWindowExA (0,"SysMonthCal32", 0, WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, 0, 0, 0, 0, - infoPtr->hwndNotify, + hwnd, 0, 0, 0); /* initialize info structure */ @@ -1249,8 +1269,14 @@ DATETIME_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) DATETIME_INFO *infoPtr = DATETIME_GetInfoPtr (hwnd); TRACE("\n"); + if (infoPtr->hMonthCal) { + /* FIXME I don't completely understand why doesn't it + * happen automatically, WS_POPUP maybe? */ + DestroyWindow(infoPtr->hMonthCal); + infoPtr->hMonthCal = NULL; + } Free (infoPtr); - SetWindowLongA( hwnd, 0, 0 ); + SetWindowLongA( hwnd, 0, 0 ); /* clear infoPtr */ return 0; } diff --git a/reactos/lib/comctl32/header.c b/reactos/lib/comctl32/header.c index 7c1e8a69706..0d592791075 100644 --- a/reactos/lib/comctl32/header.c +++ b/reactos/lib/comctl32/header.c @@ -924,9 +924,8 @@ HEADER_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam) lpItem->cxy = phdi->cxy; if (phdi->mask & HDI_TEXT) { - static char empty[] = ""; if (!phdi->pszText) /* null pointer check */ - phdi->pszText = empty; + phdi->pszText = ""; if (phdi->pszText != LPSTR_TEXTCALLBACKA) { len = MultiByteToWideChar(CP_ACP, 0, phdi->pszText, -1, NULL, 0); lpItem->pszText = Alloc( len*sizeof(WCHAR) ); diff --git a/reactos/lib/comctl32/ipaddress.c b/reactos/lib/comctl32/ipaddress.c index 61b463dd8ad..d1d52ce064e 100644 --- a/reactos/lib/comctl32/ipaddress.c +++ b/reactos/lib/comctl32/ipaddress.c @@ -155,7 +155,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) IPADDRESS_INFO *infoPtr; RECT rcClient, edit; int i, fieldsize; - WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 }; + static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 }; TRACE("\n"); @@ -291,7 +291,8 @@ static void IPADDRESS_ClearAddress (IPADDRESS_INFO *infoPtr) static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address) { - WCHAR buf[20], fmt[] = { '%', 'd', 0 }; + WCHAR buf[20]; + static const WCHAR fmt[] = { '%', 'd', 0 }; int i; TRACE("\n"); @@ -328,7 +329,8 @@ static void IPADDRESS_SetFocusToField (IPADDRESS_INFO *infoPtr, INT index) static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield) { IPPART_INFO *part = &infoPtr->Part[currentfield]; - WCHAR field[10], fmt[] = { '%', 'd', 0 }; + WCHAR field[10]; + static const WCHAR fmt[] = { '%', 'd', 0 }; int curValue, newValue; TRACE("(currentfield=%d)\n", currentfield); diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index 249cb98cccd..8a6e8ad0fbe 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -3553,7 +3553,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS { UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK; WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' }; - WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 }; + static const WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 }; DWORD cdsubitemmode = CDRF_DODEFAULT; RECT* lprcFocus, rcSelect, rcBox, rcState, rcIcon, rcLabel; NMLVCUSTOMDRAW nmlvcd; @@ -3576,7 +3576,7 @@ static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, INT nS if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE; if (nSubItem > 0 && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)) lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); - if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = szCallback; + if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = (LPWSTR)szCallback; TRACE(" lvItem=%s\n", debuglvitem_t(&lvItem, TRUE)); /* now check if we need to update the focus rectangle */ @@ -4230,13 +4230,9 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; /* While the MSDN specifically says that column zero should not be deleted, - it does in fact work on WinNT, and at least one app depends on it. On - WinNT, deleting column zero deletes the last column of items but the - first header. Since no app will ever depend on that bizarre behavior, - we just delete the last column including the header. + what actually happens is that the column itself is deleted but no items or subitems + are removed. */ - if (nColumn == 0) - nColumn = DPA_GetPtrCount(infoPtr->hdpaColumns) - 1; LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol); @@ -4246,15 +4242,12 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn)); DPA_DeletePtr(infoPtr->hdpaColumns, nColumn); - if (!(infoPtr->dwStyle & LVS_OWNERDATA)) + if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn) { SUBITEM_INFO *lpSubItem, *lpDelItem; HDPA hdpaSubItems; INT nItem, nSubItem, i; - if (nColumn == 0) - return LISTVIEW_DeleteAllItems(infoPtr); - for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); @@ -4291,7 +4284,10 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) } /* update the other column info */ - LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left)); + if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) + LISTVIEW_InvalidateList(infoPtr); + else + LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left)); return TRUE; } diff --git a/reactos/lib/comctl32/monthcal.c b/reactos/lib/comctl32/monthcal.c index 5514da25378..a7be319a7ba 100644 --- a/reactos/lib/comctl32/monthcal.c +++ b/reactos/lib/comctl32/monthcal.c @@ -948,7 +948,7 @@ static LRESULT MONTHCAL_SetRange(HWND hwnd, WPARAM wParam, LPARAM lParam) { MONTHCAL_INFO *infoPtr = MONTHCAL_GetInfoPtr(hwnd); - SYSTEMTIME lprgSysTimeArray[1]; + SYSTEMTIME *lprgSysTimeArray=(SYSTEMTIME *)lParam; int prev; TRACE("%x %lx\n", wParam, lParam); @@ -1033,6 +1033,7 @@ MONTHCAL_GetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT) return FALSE; MONTHCAL_CopyTime(&infoPtr->minSel, lpSel); + TRACE("%d/%d/%d\n", lpSel->wYear, lpSel->wMonth, lpSel->wDay); return TRUE; } @@ -1048,7 +1049,8 @@ MONTHCAL_SetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE; if(GetWindowLongA(hwnd, GWL_STYLE) & MCS_MULTISELECT) return FALSE; - TRACE("%d %d\n", lpSel->wMonth, lpSel->wDay); + infoPtr->currentMonth=lpSel->wMonth; + infoPtr->currentYear=lpSel->wYear; MONTHCAL_CopyTime(lpSel, &infoPtr->minSel); MONTHCAL_CopyTime(lpSel, &infoPtr->maxSel); @@ -1479,23 +1481,24 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam) InvalidateRect(hwnd, NULL, FALSE); return TRUE; } - if(hit && MCHT_CALENDARDATE) { + if(hit == MCHT_CALENDARDATE) { SYSTEMTIME selArray[2]; NMSELCHANGE nmsc; - TRACE("MCHT_CALENDARDATE\n"); - nmsc.nmhdr.hwndFrom = hwnd; - nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); - nmsc.nmhdr.code = MCN_SELCHANGE; - MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); - MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); - - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); - MONTHCAL_CopyTime(&ht.st, &selArray[0]); MONTHCAL_CopyTime(&ht.st, &selArray[1]); MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray); + MONTHCAL_SetCurSel(hwnd,0,(LPARAM) &selArray); + TRACE("MCHT_CALENDARDATE\n"); + nmsc.nmhdr.hwndFrom = hwnd; + nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmsc.nmhdr.code = MCN_SELCHANGE; + MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart); + MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd); + + SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); + /* redraw both old and new days if the selected day changed */ if(infoPtr->curSelDay != ht.st.wDay) { @@ -1530,10 +1533,12 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam) if(infoPtr->status & MC_NEXTPRESSED) { KillTimer(hwnd, MC_NEXTMONTHTIMER); + infoPtr->status &= ~MC_NEXTPRESSED; redraw = TRUE; } if(infoPtr->status & MC_PREVPRESSED) { KillTimer(hwnd, MC_PREVMONTHTIMER); + infoPtr->status &= ~MC_PREVPRESSED; redraw = TRUE; } @@ -1560,20 +1565,21 @@ MONTHCAL_LButtonUp(HWND hwnd, WPARAM wParam, LPARAM lParam) SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); - - nmsc.nmhdr.hwndFrom = hwnd; - nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); - nmsc.nmhdr.code = MCN_SELECT; - MONTHCAL_CopyTime(&nmsc.stSelStart, &infoPtr->minSel); - MONTHCAL_CopyTime(&nmsc.stSelEnd, &infoPtr->maxSel); - - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); - /* redraw if necessary */ if(redraw) InvalidateRect(hwnd, NULL, FALSE); + /* only send MCN_SELECT if currently displayed month's day was selected */ + if(hit == MCHT_CALENDARDATE) { + nmsc.nmhdr.hwndFrom = hwnd; + nmsc.nmhdr.idFrom = GetWindowLongA(hwnd, GWL_ID); + nmsc.nmhdr.code = MCN_SELECT; + MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); + MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); + SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); + + } return 0; } @@ -1898,6 +1904,8 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->currentYear = infoPtr->todaysDate.wYear; MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minDate); MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate); + infoPtr->maxDate.wYear=2050; + infoPtr->minDate.wYear=1950; infoPtr->maxSelCount = 7; infoPtr->monthRange = 3; infoPtr->monthdayState = Alloc diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 3ee7de384c5..20b4a910ce9 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -524,7 +524,7 @@ BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp, { WCHAR szTitle[256]; const WCHAR *pTitle; - static WCHAR pszNull[] = { '(','n','u','l','l',')',0 }; + static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 }; int len; if ( !HIWORD( lppsp->pszTitle ) ) diff --git a/reactos/lib/comctl32/rsrc.rc b/reactos/lib/comctl32/rsrc.rc index ea280e1be19..5903d7560dc 100644 --- a/reactos/lib/comctl32/rsrc.rc +++ b/reactos/lib/comctl32/rsrc.rc @@ -1128,3 +1128,4 @@ IDI_DRAGARROW ICON LOADONCALL DISCARDABLE idi_dragarrow.ico #include "comctl_Ru.rc" #include "comctl_Si.rc" #include "comctl_Th.rc" +#include "comctl_Uk.rc" diff --git a/reactos/lib/comctl32/toolbar.c b/reactos/lib/comctl32/toolbar.c index 5362291e53b..1b145c8daef 100644 --- a/reactos/lib/comctl32/toolbar.c +++ b/reactos/lib/comctl32/toolbar.c @@ -52,7 +52,6 @@ * - Notifications: * - NM_CHAR * - NM_KEYDOWN - * - NM_RCLICK * - NM_RDBLCLICK * - TBN_DRAGOUT * - TBN_GETOBJECT @@ -170,6 +169,7 @@ typedef struct BOOL bAnchor; /* anchor highlight enabled */ BOOL bNtfUnicode; /* TRUE if NOTIFYs use {W} */ BOOL bDoRedraw; /* Redraw status */ + DWORD dwStyle; /* regular toolbar style */ DWORD dwExStyle; /* extended toolbar style */ DWORD dwDTFlags; /* DrawText flags */ @@ -220,7 +220,7 @@ typedef enum /* how wide to treat the bitmap if it isn't present */ #define LIST_IMAGE_ABSENT_WIDTH 2 -#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0)) +#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongPtrW(hwnd,0)) #define TOOLBAR_HasText(x, y) (TOOLBAR_GetText(x, y) ? TRUE : FALSE) #define TOOLBAR_HasDropDownArrows(exStyle) ((exStyle & TBSTYLE_EX_DRAWDDARROWS) ? TRUE : FALSE) @@ -290,13 +290,11 @@ TOOLBAR_DumpToolbar(TOOLBAR_INFO *iP, INT line) { if (TRACE_ON(toolbar)) { INT i; - DWORD dwStyle; - dwStyle = GetWindowLongA (iP->hwndSelf, GWL_STYLE); TRACE("toolbar %p at line %d, exStyle=%08lx, buttons=%d, bitmaps=%d, strings=%d, style=%08lx\n", iP->hwndSelf, line, iP->dwExStyle, iP->nNumButtons, iP->nNumBitmaps, - iP->nNumStrings, dwStyle); + iP->nNumStrings, iP->dwStyle); TRACE("toolbar %p at line %d, himlInt=%p, himlDef=%p, himlHot=%p, himlDis=%p, redrawable=%s\n", iP->hwndSelf, line, iP->himlInt, iP->himlDef, iP->himlHot, iP->himlDis, @@ -726,7 +724,7 @@ TOOLBAR_DrawImage(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, INT left, INT top if (!himl) draw_masked = TRUE; } - else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & TBSTYLE_FLAT)) + else if ((tbcd->nmcd.uItemState & CDIS_HOT) && (infoPtr->dwStyle & TBSTYLE_FLAT)) { /* if hot, attempt to draw with hot image list, if fails, use default image list */ @@ -830,7 +828,7 @@ static void TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = infoPtr->dwStyle; BOOL hasDropDownArrow = (TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && (btnPtr->fsStyle & BTNS_DROPDOWN)) || (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN); @@ -1396,7 +1394,7 @@ static void TOOLBAR_CalcToolbar (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = infoPtr->dwStyle; TBUTTON_INFO *btnPtr; INT i, nRows, nSepRows; INT x, y, cx, cy; @@ -1760,7 +1758,7 @@ TOOLBAR_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, static INT_PTR CALLBACK TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - PCUSTDLG_INFO custInfo = (PCUSTDLG_INFO)GetWindowLongA (hwnd, DWL_USER); + PCUSTDLG_INFO custInfo = (PCUSTDLG_INFO)GetWindowLongPtrW (hwnd, DWLP_USER); PCUSTOMBUTTON btnInfo; NMTOOLBARA nmtb; TOOLBAR_INFO *infoPtr = custInfo ? custInfo->tbInfo : NULL; @@ -1769,7 +1767,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: custInfo = (PCUSTDLG_INFO)lParam; - SetWindowLongA (hwnd, DWL_USER, (DWORD)custInfo); + SetWindowLongPtrW (hwnd, DWLP_USER, (LONG_PTR)custInfo); if (custInfo) { @@ -1811,6 +1809,8 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMDATA, index, (LPARAM)btnInfo); } + SendDlgItemMessageA (hwnd, IDC_TOOLBARBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8); + /* insert separator button into 'available buttons' list */ btnInfo = (PCUSTOMBUTTON)Alloc(sizeof(CUSTOMBUTTON)); memset (&btnInfo->btn, 0, sizeof(TBBUTTON)); @@ -1875,6 +1875,8 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) } } + SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETITEMHEIGHT, 0, infoPtr->nBitmapHeight + 8); + /* select first item in the 'available' list */ SendDlgItemMessageA (hwnd, IDC_AVAILBTN_LBOX, LB_SETCURSEL, 0, 0); @@ -2167,7 +2169,6 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (wParam == IDC_AVAILBTN_LBOX || wParam == IDC_TOOLBARBTN_LBOX) { LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)lParam; - DWORD dwStyle = GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE); RECT rcButton; RECT rcText; HPEN hPen, hOldPen; @@ -2210,7 +2211,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DrawFocusRect (lpdis->hDC, &lpdis->rcItem); /* draw button */ - if (!(dwStyle & TBSTYLE_FLAT)) + if (!(infoPtr->dwStyle & TBSTYLE_FLAT)) DrawEdge (lpdis->hDC, &rcButton, EDGE_RAISED, BF_RECT|BF_MIDDLE|BF_SOFT); /* draw image and text */ @@ -2238,10 +2239,7 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { MEASUREITEMSTRUCT *lpmis = (MEASUREITEMSTRUCT*)lParam; - if (custInfo && custInfo->tbInfo) - lpmis->itemHeight = custInfo->tbInfo->nBitmapHeight + 8; - else - lpmis->itemHeight = 15 + 8; /* default height */ + lpmis->itemHeight = 15 + 8; /* default height */ return TRUE; } @@ -2794,7 +2792,6 @@ static LRESULT TOOLBAR_AutoSize (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); RECT parent_rect; RECT window_rect; HWND parent; @@ -2802,7 +2799,7 @@ TOOLBAR_AutoSize (HWND hwnd) INT cx, cy; UINT uPosFlags = SWP_NOZORDER; - TRACE("resize forced, style=%lx!\n", dwStyle); + TRACE("resize forced, style=%lx!\n", infoPtr->dwStyle); parent = GetParent (hwnd); GetClientRect(parent, &parent_rect); @@ -2813,7 +2810,7 @@ TOOLBAR_AutoSize (HWND hwnd) /* FIXME: we should be able to early out if nothing */ /* has changed with nWidth != parent_rect width */ - if (dwStyle & CCS_NORESIZE) { + if (infoPtr->dwStyle & CCS_NORESIZE) { uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); cx = 0; cy = 0; @@ -2826,24 +2823,24 @@ TOOLBAR_AutoSize (HWND hwnd) cy = infoPtr->nHeight; cx = infoPtr->nWidth; - if ((dwStyle & CCS_BOTTOM) == CCS_NOMOVEY) { + if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_NOMOVEY) { GetWindowRect(hwnd, &window_rect); ScreenToClient(parent, (LPPOINT)&window_rect.left); y = window_rect.top; } - if ((dwStyle & CCS_BOTTOM) == CCS_BOTTOM) { + if ((infoPtr->dwStyle & CCS_BOTTOM) == CCS_BOTTOM) { GetWindowRect(hwnd, &window_rect); y = parent_rect.bottom - ( window_rect.bottom - window_rect.top); } } - if (dwStyle & CCS_NOPARENTALIGN) + if (infoPtr->dwStyle & CCS_NOPARENTALIGN) uPosFlags |= SWP_NOMOVE; - if (!(dwStyle & CCS_NODIVIDER)) + if (!(infoPtr->dwStyle & CCS_NODIVIDER)) cy += GetSystemMetrics(SM_CYEDGE); - if (dwStyle & WS_BORDER) + if (infoPtr->dwStyle & WS_BORDER) { x = y = 1; cy += GetSystemMetrics(SM_CYEDGE); @@ -2991,7 +2988,7 @@ TOOLBAR_Customize (HWND hwnd) if(!(template = (LPVOID)LoadResource (COMCTL32_hModule, hRes))) return FALSE; - ret = DialogBoxIndirectParamA ((HINSTANCE)GetWindowLongA(hwnd, GWL_HINSTANCE), + ret = DialogBoxIndirectParamA ((HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), (LPDLGTEMPLATEA)template, hwnd, TOOLBAR_CustomizeDialogProc, @@ -3349,7 +3346,7 @@ TOOLBAR_GetHotItem (HWND hwnd) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - if (!(GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_FLAT)) + if (!(infoPtr->dwStyle & TBSTYLE_FLAT)) return -1; if (infoPtr->nHotItem < 0) @@ -3467,7 +3464,7 @@ TOOLBAR_GetRows (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - if (GetWindowLongA (hwnd, GWL_STYLE) & TBSTYLE_WRAPABLE) + if (infoPtr->dwStyle & TBSTYLE_WRAPABLE) return infoPtr->nRows; else return 1; @@ -3491,16 +3488,7 @@ TOOLBAR_GetState (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT TOOLBAR_GetStyle (HWND hwnd, WPARAM wParam, LPARAM lParam) { - TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - INT nIndex; - - if (wParam == 0) return GetWindowLongW(hwnd, GWL_STYLE); - - nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT)wParam, FALSE); - if (nIndex == -1) - return -1; - - return infoPtr->buttons[nIndex].fsStyle; + return GetWindowLongW(hwnd, GWL_STYLE); } @@ -4627,7 +4615,7 @@ TOOLBAR_SetHotItem (HWND hwnd, WPARAM wParam) if ((INT) wParam < 0 || (INT)wParam > infoPtr->nNumButtons) wParam = -2; - if (GetWindowLongW(hwnd, GWL_STYLE) & TBSTYLE_FLAT) + if (infoPtr->dwStyle & TBSTYLE_FLAT) TOOLBAR_SetHotItemEx(infoPtr, wParam, HICF_OTHER); if (nOldHotItem < 0) @@ -5093,7 +5081,7 @@ static LRESULT TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); LOGFONTA logFont; TRACE("hwnd = %p\n", hwnd); @@ -5132,6 +5120,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) infoPtr->szPadding.cx = 2*(GetSystemMetrics(SM_CXEDGE)+OFFSET_X) + 1; infoPtr->szPadding.cy = 2*(GetSystemMetrics(SM_CYEDGE)+OFFSET_Y); infoPtr->iListGap = infoPtr->szPadding.cx / 2; + infoPtr->dwStyle = dwStyle; GetClientRect(hwnd, &infoPtr->client_rect); TOOLBAR_NotifyFormat(infoPtr, (WPARAM)hwnd, (LPARAM)NF_REQUERY); @@ -5206,7 +5195,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) /* free toolbar info data */ Free (infoPtr); - SetWindowLongA (hwnd, 0, 0); + SetWindowLongPtrW (hwnd, 0, 0); return 0; } @@ -5216,12 +5205,11 @@ static LRESULT TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); NMTBCUSTOMDRAW tbcd; INT ret = FALSE; DWORD ntfret; - if (dwStyle & TBSTYLE_CUSTOMERASE) { + if (infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) { ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); tbcd.nmcd.dwDrawStage = CDDS_PREERASE; tbcd.nmcd.hdc = (HDC)wParam; @@ -5260,7 +5248,7 @@ TOOLBAR_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) if (!ret) ret = DefWindowProcA (hwnd, WM_ERASEBKGND, wParam, lParam); - if ((dwStyle & TBSTYLE_CUSTOMERASE) && + if ((infoPtr->dwStyle & TBSTYLE_CUSTOMERASE) && (infoPtr->dwBaseCustDraw & CDRF_NOTIFYPOSTERASE)) { ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW)); tbcd.nmcd.dwDrawStage = CDDS_POSTERASE; @@ -5320,7 +5308,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) NMTOOLBARA nmtb; BOOL bDragKeyPressed; - if (GetWindowLongW(hwnd, GWL_STYLE) & TBSTYLE_ALTDRAG) + if (infoPtr->dwStyle & TBSTYLE_ALTDRAG) bDragKeyPressed = (GetKeyState(VK_MENU) < 0); else bDragKeyPressed = (wParam & MK_SHIFT); @@ -5335,7 +5323,7 @@ TOOLBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) btnPtr = &infoPtr->buttons[nHit]; - if ((nHit >= 0) && bDragKeyPressed && (GetWindowLongW(hwnd, GWL_STYLE) & CCS_ADJUSTABLE)) + if ((nHit >= 0) && bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE)) { infoPtr->nButtonDrag = nHit; SetCapture (hwnd); @@ -5588,6 +5576,34 @@ TOOLBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) return 0; } +static LRESULT +TOOLBAR_RButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); + + NMMOUSE nmmouse; + POINT pt; + + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + + nmmouse.dwHitInfo = TOOLBAR_InternalHitTest(hwnd, &pt); + + if (nmmouse.dwHitInfo < 0) { + nmmouse.dwItemSpec = -1; + } else { + nmmouse.dwItemSpec = infoPtr->buttons[nmmouse.dwHitInfo].idCommand; + nmmouse.dwItemData = infoPtr->buttons[nmmouse.dwHitInfo].dwData; + } + + ClientToScreen(hwnd, &pt); + memcpy(&nmmouse.pt, &pt, sizeof(POINT)); + + TOOLBAR_SendNotify((LPNMHDR)&nmmouse, infoPtr, NM_RCLICK); + + return 0; +} + static LRESULT TOOLBAR_CaptureChanged(HWND hwnd) { @@ -5713,7 +5729,7 @@ TOOLBAR_NCActivate (HWND hwnd, WPARAM wParam, LPARAM lParam) inline static LRESULT TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam) { - if (!(GetWindowLongA (hwnd, GWL_STYLE) & CCS_NODIVIDER)) + if (!(GetWindowLongW(hwnd, GWL_STYLE) & CCS_NODIVIDER)) ((LPRECT)lParam)->top += GetSystemMetrics(SM_CYEDGE); return DefWindowProcA (hwnd, WM_NCCALCSIZE, wParam, lParam); @@ -5729,16 +5745,16 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) /* allocate memory for info structure */ infoPtr = (TOOLBAR_INFO *)Alloc (sizeof(TOOLBAR_INFO)); - SetWindowLongA (hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW (hwnd, 0, (LONG_PTR)infoPtr); /* paranoid!! */ infoPtr->dwStructSize = sizeof(TBBUTTON); infoPtr->nRows = 1; /* fix instance handle, if the toolbar was created by CreateToolbarEx() */ - if (!GetWindowLongA (hwnd, GWL_HINSTANCE)) { - HINSTANCE hInst = (HINSTANCE)GetWindowLongA (GetParent (hwnd), GWL_HINSTANCE); - SetWindowLongA (hwnd, GWL_HINSTANCE, (DWORD)hInst); + if (!GetWindowLongPtrW (hwnd, GWLP_HINSTANCE)) { + HINSTANCE hInst = (HINSTANCE)GetWindowLongPtrW (GetParent (hwnd), GWLP_HINSTANCE); + SetWindowLongPtrW (hwnd, GWLP_HINSTANCE, (LONG_PTR)hInst); } /* native control does: @@ -5790,7 +5806,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) styleadd |= TBSTYLE_TRANSPARENT; if (!(cs->style & (CCS_TOP | CCS_NOMOVEY))) { styleadd |= CCS_TOP; /* default to top */ - SetWindowLongA (hwnd, GWL_STYLE, cs->style | styleadd); + SetWindowLongW (hwnd, GWL_STYLE, cs->style | styleadd); } return DefWindowProcA (hwnd, WM_NCCREATE, wParam, lParam); @@ -5800,7 +5816,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT TOOLBAR_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) { - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); RECT rcWindow; HDC hdc; @@ -6099,7 +6115,7 @@ static LRESULT TOOLBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = infoPtr->dwStyle; RECT parent_rect; RECT window_rect; HWND parent; @@ -6246,6 +6262,8 @@ TOOLBAR_StyleChanged (HWND hwnd, INT nType, LPSTYLESTRUCT lpStyle) TOOLBAR_CheckStyle (hwnd, lpStyle->styleNew); TRACE("new style 0x%08lx\n", lpStyle->styleNew); + + infoPtr->dwStyle = lpStyle->styleNew; } TOOLBAR_CalcToolbar(hwnd); @@ -6598,6 +6616,9 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONUP: return TOOLBAR_LButtonUp (hwnd, wParam, lParam); + case WM_RBUTTONUP: + return TOOLBAR_RButtonUp (hwnd, wParam, lParam); + case WM_MOUSEMOVE: return TOOLBAR_MouseMove (hwnd, wParam, lParam); diff --git a/reactos/lib/comctl32/trackbar.c b/reactos/lib/comctl32/trackbar.c index 79c5c3709e3..01924648d15 100644 --- a/reactos/lib/comctl32/trackbar.c +++ b/reactos/lib/comctl32/trackbar.c @@ -728,7 +728,8 @@ static void TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr) { DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE); - WCHAR buf[80], fmt[] = { '%', 'l', 'd', 0 }; + WCHAR buf[80]; + static const WCHAR fmt[] = { '%', 'l', 'd', 0 }; TTTOOLINFOW ti; POINT pt; RECT rcClient; diff --git a/reactos/lib/comctl32/treeview.c b/reactos/lib/comctl32/treeview.c index f62c26dd983..da9001d1b68 100644 --- a/reactos/lib/comctl32/treeview.c +++ b/reactos/lib/comctl32/treeview.c @@ -30,8 +30,8 @@ * missing notifications: NM_SETCURSOR, TVN_GETINFOTIP, TVN_KEYDOWN, * TVN_SETDISPINFO, TVN_SINGLEEXPAND * - * missing styles: TVS_FULLROWSELECT, TVS_INFOTIP, TVS_NOSCROLL, - * TVS_RTLREADING, TVS_TRACKSELECT + * missing styles: TVS_FULLROWSELECT, TVS_INFOTIP, TVS_RTLREADING, + * TVS_TRACKSELECT * * missing item styles: TVIS_CUT, TVIS_EXPANDPARTIAL * @@ -3093,7 +3093,7 @@ TREEVIEW_Expand(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *wineItem, TRACE("\n"); if (wineItem->state & TVIS_EXPANDED) - return TRUE; + return TRUE; TRACE("TVE_EXPAND %p %s\n", wineItem, TREEVIEW_ItemName(wineItem)); @@ -3467,7 +3467,7 @@ TREEVIEW_EditLabel(TREEVIEW_INFO *infoPtr, HTREEITEM hItem) HDC hdc; HFONT hOldFont=0; TEXTMETRICW textMetric; - WCHAR EditW[] = {'E','d','i','t',0}; + static const WCHAR EditW[] = {'E','d','i','t',0}; TRACE("%x %p\n", (unsigned)hwnd, hItem); if (!TREEVIEW_ValidItem(infoPtr, editItem)) @@ -4333,7 +4333,7 @@ TREEVIEW_EnsureVisible(TREEVIEW_INFO *infoPtr, HTREEITEM item, BOOL bHScroll) else if (visible_pos >= viscount /* Sometimes, before we are displayed, GVC is 0, causing us to * spuriously scroll up. */ - && visible_pos > 0) + && visible_pos > 0 && !(infoPtr->dwStyle & TVS_NOSCROLL) ) { /* item is past the end of the list. */ int scroll = visible_pos - viscount; diff --git a/reactos/lib/comctl32/winehq2ros.patch b/reactos/lib/comctl32/winehq2ros.patch index e3d42825ab3..a617c115e24 100644 --- a/reactos/lib/comctl32/winehq2ros.patch +++ b/reactos/lib/comctl32/winehq2ros.patch @@ -4,7 +4,7 @@ RCS file: /home/wine/wine/dlls/comctl32/comctl32.spec,v retrieving revision 1.43 diff -u -r1.43 comctl32.spec --- comctl32.spec 20 Feb 2004 05:16:37 -0000 1.43 -+++ comctl32.spec 15 Apr 2004 08:36:51 -0000 ++++ comctl32.spec 8 May 2004 11:49:39 -0000 @@ -106,13 +106,13 @@ 412 stdcall RemoveWindowSubclass(long ptr long) 413 stdcall DefSubclassProc(long long long long) @@ -26,13 +26,84 @@ diff -u -r1.43 comctl32.spec # Functions imported by name +Index: commctrl.c +=================================================================== +RCS file: /home/wine/wine/dlls/comctl32/commctrl.c,v +retrieving revision 1.76 +diff -u -r1.76 commctrl.c +--- commctrl.c 11 Mar 2004 22:38:22 -0000 1.76 ++++ commctrl.c 8 May 2004 11:49:41 -0000 +@@ -114,7 +114,6 @@ + extern void UPDOWN_Register(void); + extern void UPDOWN_Unregister(void); + +-static LRESULT WINAPI SubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + + LPSTR COMCTL32_aSubclass = NULL; + HMODULE COMCTL32_hModule = 0; +@@ -1109,10 +1108,10 @@ + /* set window procedure to our own and save the current one */ + if (IsWindowUnicode (hWnd)) + stack->origproc = (WNDPROC)SetWindowLongW (hWnd, GWL_WNDPROC, +- (LONG)SubclassWndProc); ++ (LONG)DefSubclassProc); + else + stack->origproc = (WNDPROC)SetWindowLongA (hWnd, GWL_WNDPROC, +- (LONG)SubclassWndProc); ++ (LONG)DefSubclassProc); + } else { + WNDPROC current; + if (IsWindowUnicode (hWnd)) +@@ -1120,7 +1119,7 @@ + else + current = (WNDPROC)GetWindowLongA (hWnd, GWL_WNDPROC); + +- if (current != SubclassWndProc) { ++ if (current != DefSubclassProc) { + ERR ("Application has subclassed with our procedure, then manually, then with us again. The current implementation can't handle this.\n"); + return FALSE; + } +@@ -1260,33 +1259,6 @@ + } + + return FALSE; +-} +- +- +-/*********************************************************************** +- * SubclassWndProc (internal) +- * +- * Window procedure for all subclassed windows. +- * Saves the current subclassing stack position to support nested messages +- */ +- +-static LRESULT WINAPI SubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +-{ +- LPSUBCLASS_INFO stack; +- int stackpos; +- LRESULT ret; +- +- /* retrieve our little stack from the Properties */ +- stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); +- if (!stack) { +- ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); +- return 0; +- } +- stackpos = stack->stackpos; +- stack->stackpos = stack->stacknum; +- ret = DefSubclassProc(hWnd,uMsg,wParam,lParam); +- stack->stackpos = stackpos; +- return ret; + } + + Index: imagelist.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v retrieving revision 1.85 diff -u -r1.85 imagelist.c --- imagelist.c 27 Feb 2004 04:40:08 -0000 1.85 -+++ imagelist.c 15 Apr 2004 08:36:52 -0000 ++++ imagelist.c 8 May 2004 11:49:43 -0000 @@ -1146,11 +1146,13 @@ PatBlt(hBlendMaskDC, 0, 0, cx, cy, PATCOPY); SelectObject(hBlendMaskDC, hOldBrush); @@ -50,10 +121,10 @@ diff -u -r1.85 imagelist.c Index: listview.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/listview.c,v -retrieving revision 1.385 -diff -u -r1.385 listview.c ---- listview.c 11 Mar 2004 00:39:53 -0000 1.385 -+++ listview.c 15 Apr 2004 08:36:56 -0000 +retrieving revision 1.387 +diff -u -r1.387 listview.c +--- listview.c 21 Apr 2004 22:25:04 -0000 1.387 ++++ listview.c 8 May 2004 11:49:47 -0000 @@ -147,6 +147,7 @@ #include #include @@ -68,7 +139,7 @@ RCS file: /home/wine/wine/dlls/comctl32/string.c,v retrieving revision 1.3 diff -u -r1.3 string.c --- string.c 20 Feb 2004 19:58:39 -0000 1.3 -+++ string.c 15 Apr 2004 08:36:56 -0000 ++++ string.c 8 May 2004 11:49:52 -0000 @@ -254,7 +254,7 @@ { TRACE("(%s,%s)\n", debugstr_w(lpszStr), debugstr_w(lpszSearch)); @@ -87,19 +158,3 @@ diff -u -r1.3 string.c } /************************************************************************* -Index: treeview.c -=================================================================== -RCS file: /home/wine/wine/dlls/comctl32/treeview.c,v -retrieving revision 1.145 -diff -u -r1.145 treeview.c ---- treeview.c 1 Mar 2004 23:10:52 -0000 1.145 -+++ treeview.c 15 Apr 2004 08:36:58 -0000 -@@ -3093,7 +3093,7 @@ - TRACE("\n"); - - if (wineItem->state & TVIS_EXPANDED) -- return FALSE; -+ return TRUE; - - TRACE("TVE_EXPAND %p %s\n", wineItem, TREEVIEW_ItemName(wineItem)); -