Sync to Wine-0_9_5:
authorGé van Geldorp <ge@gse.nl>
Fri, 6 Jan 2006 19:59:46 +0000 (19:59 +0000)
committerGé van Geldorp <ge@gse.nl>
Fri, 6 Jan 2006 19:59:46 +0000 (19:59 +0000)
Vitaliy Margolen <wine-patch@kievinfo.com>
- comctl32: Listview - allow selection toggle with ctrl+space.
Robert Reif <reif@earthlink.net>
- comctl32: Create ipaddress in enabled state.
Thomas Weidenmueller <wine-patches@reactsoft.com>
- 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
reactos/lib/comctl32/listview.c
reactos/lib/comctl32/propsheet.c

index f4da2ff..aa59cb2 100644 (file)
@@ -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;
index 13e6b2c..f1f0123 100644 (file)
@@ -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;
index 08c55b8..78fdc43 100644 (file)
@@ -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;