From 95f799abe61d97ee0b2e746ada026b5031b0aa4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Fri, 6 Jan 2006 19:59:46 +0000 Subject: [PATCH] Sync to Wine-0_9_5: Vitaliy Margolen - comctl32: Listview - allow selection toggle with ctrl+space. Robert Reif - comctl32: Create ipaddress in enabled state. Thomas Weidenmueller - comctrl32: ReAlloc should be able to move memory blocks if necessary. - comctl32: Fix error handling in PSM_ADDPAGE in case of memory allocation failure. svn path=/trunk/; revision=20619 --- reactos/lib/comctl32/ipaddress.c | 3 ++- reactos/lib/comctl32/listview.c | 15 ++++++++++++++- reactos/lib/comctl32/propsheet.c | 11 ++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/reactos/lib/comctl32/ipaddress.c b/reactos/lib/comctl32/ipaddress.c index f4da2ff7fe8..aa59cb288cc 100644 --- a/reactos/lib/comctl32/ipaddress.c +++ b/reactos/lib/comctl32/ipaddress.c @@ -189,7 +189,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) edit.bottom = rcClient.bottom - 2; infoPtr->Self = hwnd; - infoPtr->Enabled = FALSE; + infoPtr->Enabled = TRUE; infoPtr->Notify = lpCreate->hwndParent; for (i = 0; i < 4; i++) { @@ -208,6 +208,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate) part->OrigProc = (WNDPROC) SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)IPADDRESS_SubclassProc); + EnableWindow(part->EditHwnd, infoPtr->Enabled); } return 0; diff --git a/reactos/lib/comctl32/listview.c b/reactos/lib/comctl32/listview.c index 13e6b2c3c23..f1f01234e02 100644 --- a/reactos/lib/comctl32/listview.c +++ b/reactos/lib/comctl32/listview.c @@ -3175,6 +3175,7 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem) WORD wCtrl = HIWORD(GetKeyState(VK_CONTROL)); BOOL bResult = FALSE; + TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl); if ((nItem >= 0) && (nItem < infoPtr->nItemCount)) { if (infoPtr->dwStyle & LVS_SINGLESEL) @@ -3191,6 +3192,14 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem) } else if (wCtrl) { + LVITEMW lvItem; + lvItem.state = ~LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED); + lvItem.stateMask = LVIS_SELECTED; + LISTVIEW_SetItemState(infoPtr, nItem, &lvItem); + + if (lvItem.state & LVIS_SELECTED) + infoPtr->nSelectionMark = nItem; + bResult = LISTVIEW_SetItemFocus(infoPtr, nItem); } else @@ -8020,6 +8029,10 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK switch (nVirtualKey) { + case VK_SPACE: + nItem = infoPtr->nFocusedItem; + break; + case VK_RETURN: if ((infoPtr->nItemCount > 0) && (infoPtr->nFocusedItem != -1)) { @@ -8086,7 +8099,7 @@ static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lK break; } - if ((nItem != -1) && (nItem != infoPtr->nFocusedItem)) + if ((nItem != -1) && (nItem != infoPtr->nFocusedItem || nVirtualKey == VK_SPACE)) LISTVIEW_KeySelection(infoPtr, nItem); return 0; diff --git a/reactos/lib/comctl32/propsheet.c b/reactos/lib/comctl32/propsheet.c index 08c55b8bfee..78fdc430a1d 100644 --- a/reactos/lib/comctl32/propsheet.c +++ b/reactos/lib/comctl32/propsheet.c @@ -2288,6 +2288,7 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg, static BOOL PROPSHEET_AddPage(HWND hwndDlg, HPROPSHEETPAGE hpage) { + PropPageInfo * ppi; PropSheetInfo * psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); @@ -2298,9 +2299,13 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg, /* * Allocate and fill in a new PropPageInfo entry. */ - psInfo->proppage = (PropPageInfo*) ReAlloc(psInfo->proppage, - sizeof(PropPageInfo) * - (psInfo->nPages + 1)); + ppi = (PropPageInfo*) ReAlloc(psInfo->proppage, + sizeof(PropPageInfo) * + (psInfo->nPages + 1)); + if (!ppi) + return FALSE; + + psInfo->proppage = ppi; if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages)) return FALSE;