[COMCTL32] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 24 Nov 2015 10:36:57 +0000 (10:36 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 24 Nov 2015 10:36:57 +0000 (10:36 +0000)
svn path=/trunk/; revision=70080

12 files changed:
reactos/dll/win32/comctl32/CMakeLists.txt
reactos/dll/win32/comctl32/commctrl.c
reactos/dll/win32/comctl32/icon.c [deleted file]
reactos/dll/win32/comctl32/imagelist.c
reactos/dll/win32/comctl32/listview.c
reactos/dll/win32/comctl32/propsheet.c
reactos/dll/win32/comctl32/rebar.c
reactos/dll/win32/comctl32/syslink.c
reactos/dll/win32/comctl32/theme_button.c
reactos/dll/win32/comctl32/toolbar.c
reactos/dll/win32/comctl32/treeview.c
reactos/media/doc/README.WINE

index b72044b..fc0527b 100644 (file)
@@ -22,7 +22,6 @@ list(APPEND SOURCE
     flatsb.c
     header.c
     hotkey.c
     flatsb.c
     header.c
     hotkey.c
-    icon.c
     imagelist.c
     ipaddress.c
     listview.c
     imagelist.c
     ipaddress.c
     listview.c
index 086a92e..7883cd0 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright 1997 Dimitrie O. Paun
  * Copyright 1998,2000 Eric Kohl
  *
  * Copyright 1997 Dimitrie O. Paun
  * Copyright 1998,2000 Eric Kohl
+ * Copyright 2014-2015 Michael Müller
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1811,10 +1812,49 @@ HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnBu
 /***********************************************************************
  * LoadIconWithScaleDown [COMCTL32.@]
  */
 /***********************************************************************
  * LoadIconWithScaleDown [COMCTL32.@]
  */
-HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int cy, HICON *icon)
+HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy, HICON *icon)
 {
 {
-    FIXME("stub: %p %s %d %d %p\n", hinst, wine_dbgstr_w(name), cx, cy, icon);
-    return E_NOTIMPL;
+    TRACE("(%p, %s, %d, %d, %p)\n", hinst, debugstr_w(name), cx, cy, icon);
+
+    *icon = NULL;
+
+    if (!name)
+        return E_INVALIDARG;
+
+    *icon = LoadImageW(hinst, name, IMAGE_ICON, cx, cy,
+                       (hinst || IS_INTRESOURCE(name)) ? 0 : LR_LOADFROMFILE);
+    if (!*icon)
+        return HRESULT_FROM_WIN32(GetLastError());
+
+    return S_OK;
+}
+
+/***********************************************************************
+ * LoadIconMetric [COMCTL32.@]
+ */
+HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *name, int size, HICON *icon)
+{
+    int cx, cy;
+
+    TRACE("(%p, %s, %d, %p)\n", hinst, debugstr_w(name), size, icon);
+
+    if (size == LIM_SMALL)
+    {
+        cx = GetSystemMetrics(SM_CXSMICON);
+        cy = GetSystemMetrics(SM_CYSMICON);
+    }
+    else if (size == LIM_LARGE)
+    {
+        cx = GetSystemMetrics(SM_CXICON);
+        cy = GetSystemMetrics(SM_CYICON);
+    }
+    else
+    {
+        *icon = NULL;
+        return E_INVALIDARG;
+    }
+
+    return LoadIconWithScaleDown(hinst, name, cx, cy, icon);
 }
 
 /***********************************************************************
 }
 
 /***********************************************************************
diff --git a/reactos/dll/win32/comctl32/icon.c b/reactos/dll/win32/comctl32/icon.c
deleted file mode 100644 (file)
index 3b6816a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Comctl32 Icon functions
- *
- * Copyright 2014 Michael Müller
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "comctl32.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
-
-HRESULT WINAPI
-LoadIconMetric (HINSTANCE hinst, PCWSTR name, INT size, HICON *icon)
-{
-    INT width, height;
-
-    TRACE("(%p %s %d %p)\n", hinst, debugstr_w(name), size, icon);
-
-    if (!icon)
-        return E_INVALIDARG;
-
-    /* windows sets it to zero in a case of failure */
-    *icon = NULL;
-
-    if (!name)
-        return E_INVALIDARG;
-
-    if (size == LIM_SMALL)
-    {
-        width  = GetSystemMetrics( SM_CXSMICON );
-        height = GetSystemMetrics( SM_CYSMICON );
-    }
-    else if (size == LIM_LARGE)
-    {
-        width  = GetSystemMetrics( SM_CXICON );
-        height = GetSystemMetrics( SM_CYICON );
-    }
-    else
-        return E_INVALIDARG;
-
-    *icon = LoadImageW( hinst, name, IMAGE_ICON, width, height, LR_SHARED );
-    if (*icon)
-        return S_OK;
-
-    return HRESULT_FROM_WIN32(GetLastError());
-}
index 416c124..ff35fd4 100644 (file)
@@ -3615,7 +3615,7 @@ static HRESULT WINAPI ImageListImpl_SetDragCursorImage(IImageList2 *iface,
     IUnknown *punk, int iDrag, int dxHotspot, int dyHotspot)
 {
     IImageList *iml2 = NULL;
     IUnknown *punk, int iDrag, int dxHotspot, int dyHotspot)
 {
     IImageList *iml2 = NULL;
-    HRESULT ret;
+    BOOL ret;
 
     if (!punk)
         return E_FAIL;
 
     if (!punk)
         return E_FAIL;
index a1de8a6..efc6ea4 100644 (file)
@@ -63,9 +63,9 @@
  *   -- if list is sorted by item text LISTVIEW_InsertItemT could use
  *      binary search to calculate item index (e.g. DPA_Search()).
  *      This requires sorted state to be reliably tracked in item modifiers.
  *   -- if list is sorted by item text LISTVIEW_InsertItemT could use
  *      binary search to calculate item index (e.g. DPA_Search()).
  *      This requires sorted state to be reliably tracked in item modifiers.
- *   -- we should keep an ordered array of coordinates in iconic mode
- *      this would allow to frame items (iterator_frameditems),
- *      and find nearest item (LVFI_NEARESTXY) a lot more efficiently
+ *   -- we should keep an ordered array of coordinates in iconic mode.
+ *      This would allow framing items (iterator_frameditems),
+ *      and finding the nearest item (LVFI_NEARESTXY) a lot more efficiently.
  *
  * Flags
  *   -- LVIF_COLUMNS
  *
  * Flags
  *   -- LVIF_COLUMNS
@@ -571,7 +571,7 @@ static const char* debugscrollinfo(const SCROLLINFO *pScrollInfo)
     int len, size = DEBUG_BUFFER_SIZE;
 
     if (pScrollInfo == NULL) return "(null)";
     int len, size = DEBUG_BUFFER_SIZE;
 
     if (pScrollInfo == NULL) return "(null)";
-    len = snprintf(buf, size, "{cbSize=%d, ", pScrollInfo->cbSize);
+    len = snprintf(buf, size, "{cbSize=%u, ", pScrollInfo->cbSize);
     if (len == -1) goto end; buf += len; size -= len;
     if (pScrollInfo->fMask & SIF_RANGE)
        len = snprintf(buf, size, "nMin=%d, nMax=%d, ", pScrollInfo->nMin, pScrollInfo->nMax);
     if (len == -1) goto end; buf += len; size -= len;
     if (pScrollInfo->fMask & SIF_RANGE)
        len = snprintf(buf, size, "nMin=%d, nMax=%d, ", pScrollInfo->nMin, pScrollInfo->nMax);
@@ -4122,6 +4122,7 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
     /* see if we are supposed to be tracking mouse hovering */
     if (LISTVIEW_IsHotTracking(infoPtr)) {
         TRACKMOUSEEVENT trackinfo;
     /* see if we are supposed to be tracking mouse hovering */
     if (LISTVIEW_IsHotTracking(infoPtr)) {
         TRACKMOUSEEVENT trackinfo;
+        DWORD flags;
 
         trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
         trackinfo.dwFlags = TME_QUERY;
 
         trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
         trackinfo.dwFlags = TME_QUERY;
@@ -4129,8 +4130,12 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
         /* see if we are already tracking this hwnd */
         _TrackMouseEvent(&trackinfo);
 
         /* see if we are already tracking this hwnd */
         _TrackMouseEvent(&trackinfo);
 
-        if(!(trackinfo.dwFlags & TME_HOVER) || trackinfo.hwndTrack != infoPtr->hwndSelf) {
-            trackinfo.dwFlags     = TME_HOVER;
+        flags = TME_LEAVE;
+        if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
+            flags |= TME_HOVER;
+
+        if((trackinfo.dwFlags & flags) != flags || trackinfo.hwndTrack != infoPtr->hwndSelf) {
+            trackinfo.dwFlags     = flags;
             trackinfo.dwHoverTime = infoPtr->dwHoverTime;
             trackinfo.hwndTrack   = infoPtr->hwndSelf;
 
             trackinfo.dwHoverTime = infoPtr->dwHoverTime;
             trackinfo.hwndTrack   = infoPtr->hwndSelf;
 
@@ -5683,11 +5688,11 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
     }
 
     /* update the other column info */
     }
 
     /* update the other column info */
-    LISTVIEW_UpdateItemSize(infoPtr);
     if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
         LISTVIEW_InvalidateList(infoPtr);
     else
         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));
+    LISTVIEW_UpdateItemSize(infoPtr);
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -7855,10 +7860,18 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
     item.iItem = nItem;
     if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
     {
     item.iItem = nItem;
     if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
     {
-        item.mask |= LVIF_STATE;
-        item.stateMask |= LVIS_STATEIMAGEMASK;
-        item.state &= ~LVIS_STATEIMAGEMASK;
-        item.state |= INDEXTOSTATEIMAGEMASK(1);
+        if (item.mask & LVIF_STATE)
+        {
+            item.stateMask |= LVIS_STATEIMAGEMASK;
+            item.state &= ~LVIS_STATEIMAGEMASK;
+            item.state |= INDEXTOSTATEIMAGEMASK(1);
+        }
+        else
+        {
+            item.mask |= LVIF_STATE;
+            item.stateMask = LVIS_STATEIMAGEMASK;
+            item.state = INDEXTOSTATEIMAGEMASK(1);
+        }
     }
 
     if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;
     }
 
     if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;
index d70cf35..8e00b8f 100644 (file)
@@ -156,6 +156,7 @@ static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psI
 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo);
 static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
 static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage);
 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo);
 static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
 static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage);
+static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage);
 
 static INT_PTR CALLBACK
 PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 static INT_PTR CALLBACK
 PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -2243,60 +2244,9 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
 static BOOL PROPSHEET_AddPage(HWND hwndDlg,
                               HPROPSHEETPAGE hpage)
 {
 static BOOL PROPSHEET_AddPage(HWND hwndDlg,
                               HPROPSHEETPAGE hpage)
 {
-  PropPageInfo * ppi;
   PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
   PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
-  HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
-  TCITEMW item;
-  LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
-
   TRACE("hpage %p\n", hpage);
   TRACE("hpage %p\n", hpage);
-  /*
-   * Allocate and fill in a new PropPageInfo entry.
-   */
-  ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1));
-  if (!ppi)
-      return FALSE;
-
-  psInfo->proppage = ppi;
-  if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages, FALSE))
-      return FALSE;
-
-  psInfo->proppage[psInfo->nPages].hpage = hpage;
-
-  if (ppsp->dwFlags & PSP_PREMATURE)
-  {
-     /* Create the page but don't show it */
-     if(!PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp))
-         return FALSE;
-  }
-
-  /*
-   * Add a new tab to the tab control.
-   */
-  item.mask = TCIF_TEXT;
-  item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText;
-  item.cchTextMax = MAX_TABTEXT_LENGTH;
-
-  if (psInfo->hImageList)
-  {
-    SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
-  }
-
-  if ( psInfo->proppage[psInfo->nPages].hasIcon )
-  {
-    item.mask |= TCIF_IMAGE;
-    item.iImage = psInfo->nPages;
-  }
-
-  SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1,
-               (LPARAM)&item);
-
-  psInfo->nPages++;
-
-  /* If it is the only page - show it */
-  if(psInfo->nPages == 1)
-     PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
-  return TRUE;
+  return PROPSHEET_InsertPage(hwndDlg, (HPROPSHEETPAGE)(ULONG_PTR)psInfo->nPages, hpage);
 }
 
 /******************************************************************************
 }
 
 /******************************************************************************
@@ -2484,11 +2434,99 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
  */
 static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
 {
  */
 static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
 {
-    if (IS_INTRESOURCE(hpageInsertAfter))
-        FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage);
-    else
-        FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage);
-    return FALSE;
+  PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
+  PropPageInfo * ppi, * prev_ppi = psInfo->proppage;
+  HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
+  LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
+  TCITEMW item;
+  int index;
+
+  TRACE("hwndDlg %p, hpageInsertAfter %p, hpage %p\n", hwndDlg, hpageInsertAfter, hpage);
+
+  if (IS_INTRESOURCE(hpageInsertAfter))
+    index = LOWORD(hpageInsertAfter);
+  else
+  {
+    index = PROPSHEET_GetPageIndex(hpageInsertAfter, psInfo, -1);
+    if (index < 0)
+    {
+      TRACE("Could not find page to insert after!\n");
+      return FALSE;
+    }
+    index++;
+  }
+
+  if (index > psInfo->nPages)
+    index = psInfo->nPages;
+
+  /*
+   * Allocate a new PropPageInfo entry.
+   */
+  ppi = Alloc(sizeof(PropPageInfo) * (psInfo->nPages + 1));
+  if (!ppi)
+      return FALSE;
+
+  /*
+   * Fill in a new PropPageInfo entry.
+   */
+  if (index > 0)
+    memcpy(ppi, prev_ppi, index * sizeof(PropPageInfo));
+  memset(&ppi[index], 0, sizeof(PropPageInfo));
+  if (index < psInfo->nPages)
+    memcpy(&ppi[index + 1], &prev_ppi[index], (psInfo->nPages - index) * sizeof(PropPageInfo));
+  psInfo->proppage = ppi;
+
+  if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, index, FALSE))
+  {
+     psInfo->proppage = prev_ppi;
+     Free(ppi);
+     return FALSE;
+  }
+
+  psInfo->proppage[index].hpage = hpage;
+
+  if (ppsp->dwFlags & PSP_PREMATURE)
+  {
+     /* Create the page but don't show it */
+     if(!PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppsp))
+     {
+        psInfo->proppage = prev_ppi;
+        Free(ppi);
+        return FALSE;
+     }
+  }
+
+  Free(prev_ppi);
+  psInfo->nPages++;
+  if (index <= psInfo->active_page)
+    psInfo->active_page++;
+
+  /*
+   * Add a new tab to the tab control.
+   */
+  item.mask = TCIF_TEXT;
+  item.pszText = (LPWSTR) psInfo->proppage[index].pszText;
+  item.cchTextMax = MAX_TABTEXT_LENGTH;
+
+  if (psInfo->hImageList)
+  {
+    SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
+  }
+
+  if (psInfo->proppage[index].hasIcon)
+  {
+    item.mask |= TCIF_IMAGE;
+    item.iImage = index;
+  }
+
+  SendMessageW(hwndTabControl, TCM_INSERTITEMW, index,
+               (LPARAM)&item);
+
+  /* If it is the only page - show it */
+  if (psInfo->nPages == 1)
+     PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
+
+  return TRUE;
 }
 
 /******************************************************************************
 }
 
 /******************************************************************************
@@ -2717,6 +2755,7 @@ static INT do_loop(const PropSheetInfo *psInfo)
     MSG msg;
     INT ret = -1;
     HWND hwnd = psInfo->hwnd;
     MSG msg;
     INT ret = -1;
     HWND hwnd = psInfo->hwnd;
+    HWND parent = psInfo->ppshheader.hwndParent;
 
     while(IsWindow(hwnd) && !psInfo->ended && (ret = GetMessageW(&msg, NULL, 0, 0)))
     {
 
     while(IsWindow(hwnd) && !psInfo->ended && (ret = GetMessageW(&msg, NULL, 0, 0)))
     {
@@ -2739,6 +2778,9 @@ static INT do_loop(const PropSheetInfo *psInfo)
     if(ret != -1)
         ret = psInfo->result;
 
     if(ret != -1)
         ret = psInfo->result;
 
+    if(parent)
+        EnableWindow(parent, TRUE);
+
     DestroyWindow(hwnd);
     return ret;
 }
     DestroyWindow(hwnd);
     return ret;
 }
@@ -2765,10 +2807,7 @@ static INT_PTR PROPSHEET_PropertySheet(PropSheetInfo* psInfo, BOOL unicode)
   }
   bRet = PROPSHEET_CreateDialog(psInfo);
   if(!psInfo->isModeless)
   }
   bRet = PROPSHEET_CreateDialog(psInfo);
   if(!psInfo->isModeless)
-  {
       bRet = do_loop(psInfo);
       bRet = do_loop(psInfo);
-      if (parent) EnableWindow(parent, TRUE);
-  }
   return bRet;
 }
 
   return bRet;
 }
 
index 600e198..7ae7601 100644 (file)
@@ -2337,7 +2337,7 @@ REBAR_GetBandInfoT(const REBAR_INFO *infoPtr, UINT uIndex, LPREBARBANDINFOW lprb
     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
        lprbbi->cxMinChild = lpBand->cxMinChild;
        lprbbi->cyMinChild = lpBand->cyMinChild;
     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
        lprbbi->cxMinChild = lpBand->cxMinChild;
        lprbbi->cyMinChild = lpBand->cyMinChild;
-        /* to make tests pass we follow Windows behaviour and allow to read these fields only
+        /* to make tests pass we follow Windows' behaviour and allow reading these fields only
          * for RBBS_VARIABLEHEIGHTS bands */
         if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
            lprbbi->cyChild    = lpBand->cyChild;
          * for RBBS_VARIABLEHEIGHTS bands */
         if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) {
            lprbbi->cyChild    = lpBand->cyChild;
index 483fd11..1c7039c 100644 (file)
@@ -1377,7 +1377,7 @@ static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt,
     for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
     {
         if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) &&
     for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
     {
         if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) &&
-           (!MustBeEnabled || (MustBeEnabled && (Current->u.Link.state & LIS_ENABLED))))
+           (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED)))
         {
             if(LinkId != NULL)
             {
         {
             if(LinkId != NULL)
             {
index 7cc9b48..b8f85bf 100644 (file)
@@ -306,9 +306,6 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
     ButtonState drawState;
     pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
 
     ButtonState drawState;
     pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
 
-    if(!paint)
-        return FALSE;
-
     if(IsWindowEnabled(hwnd))
     {
         if(state & BST_PUSHED) drawState = STATE_PRESSED;
     if(IsWindowEnabled(hwnd))
     {
         if(state & BST_PUSHED) drawState = STATE_PRESSED;
@@ -319,7 +316,7 @@ static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC)
     else drawState = STATE_DISABLED;
 
     hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
     else drawState = STATE_DISABLED;
 
     hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
-    paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
+    if (paint) paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
     if (!hParamDC) EndPaint(hwnd, &ps);
     return TRUE;
 }
     if (!hParamDC) EndPaint(hwnd, &ps);
     return TRUE;
 }
@@ -406,6 +403,14 @@ LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg,
         break;
     }
 
         break;
     }
 
+    case BM_SETCHECK:
+    case BM_SETSTATE:
+        theme = GetWindowTheme(hwnd);
+        if (theme) {
+            InvalidateRect(hwnd, NULL, FALSE);
+        }
+        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
+
     default:
        /* Call old proc */
        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
     default:
        /* Call old proc */
        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
index c92319c..8252361 100644 (file)
@@ -3238,7 +3238,7 @@ TOOLBAR_CheckButton (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
 
     bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
 
 
     bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
 
-    if (LOWORD(lParam) == FALSE)
+    if (!LOWORD(lParam))
        btnPtr->fsState &= ~TBSTATE_CHECKED;
     else {
        if (btnPtr->fsStyle & BTNS_GROUP) {
        btnPtr->fsState &= ~TBSTATE_CHECKED;
     else {
        if (btnPtr->fsStyle & BTNS_GROUP) {
@@ -3370,7 +3370,7 @@ TOOLBAR_EnableButton (TOOLBAR_INFO *infoPtr, INT Id, LPARAM lParam)
     bState = btnPtr->fsState & TBSTATE_ENABLED;
 
     /* update the toolbar button state */
     bState = btnPtr->fsState & TBSTATE_ENABLED;
 
     /* update the toolbar button state */
-    if(LOWORD(lParam) == FALSE) {
+    if(!LOWORD(lParam)) {
        btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
     } else {
        btnPtr->fsState |= TBSTATE_ENABLED;
        btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
     } else {
        btnPtr->fsState |= TBSTATE_ENABLED;
@@ -5309,16 +5309,13 @@ TOOLBAR_GetStringW (const TOOLBAR_INFO *infoPtr, WPARAM wParam, LPWSTR str)
     return ret;
 }
 
     return ret;
 }
 
-/* UNDOCUMENTED MESSAGE: This appears to set some kind of size. Perhaps it
- * is the maximum size of the toolbar? */
-static LRESULT TOOLBAR_Unkwn45D(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     SIZE * pSize = (SIZE*)lParam;
     FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub!\n", hwnd, wParam, pSize->cx, pSize->cy);
     return 0;
 }
 
 {
     SIZE * pSize = (SIZE*)lParam;
     FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub!\n", hwnd, wParam, pSize->cx, pSize->cy);
     return 0;
 }
 
-
 /* 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). */
@@ -5690,95 +5687,92 @@ TOOLBAR_LButtonDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
     nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
 
     if (button)
     nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
 
     if (button)
+    {
         btnPtr = &infoPtr->buttons[nHit];
 
         btnPtr = &infoPtr->buttons[nHit];
 
-    if (button && bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
-    {
-        infoPtr->nButtonDrag = nHit;
-        SetCapture (infoPtr->hwndSelf);
-        
-        /* If drag cursor has not been loaded, load it.
-         * Note: it doesn't need to be freed */
-        if (!hCursorDrag)
-            hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
-        SetCursor(hCursorDrag);
-    }
-    else if (button)
-    {
-       RECT arrowRect;
-       infoPtr->nOldHit = nHit;
-
-       CopyRect(&arrowRect, &btnPtr->rect);
-       arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
-
-       /* for EX_DRAWDDARROWS style,  click must be in the drop-down arrow rect */
-       if ((btnPtr->fsState & TBSTATE_ENABLED) && 
-            ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
-             ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
-              ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
-              (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
-       {
-           LRESULT res;
+        if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
+        {
+            infoPtr->nButtonDrag = nHit;
+            SetCapture (infoPtr->hwndSelf);
+
+            /* If drag cursor has not been loaded, load it.
+             * Note: it doesn't need to be freed */
+            if (!hCursorDrag)
+                hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
+            SetCursor(hCursorDrag);
+        }
+        else
+        {
+            RECT arrowRect;
+            infoPtr->nOldHit = nHit;
 
 
-           /* draw in pressed state */
-           if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
-               btnPtr->fsState |= TBSTATE_PRESSED;
-           else
-               btnPtr->bDropDownPressed = TRUE;
-           RedrawWindow(infoPtr->hwndSelf,&btnPtr->rect,0,
-                       RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
-
-           memset(&nmtb, 0, sizeof(nmtb));
-           nmtb.iItem = btnPtr->idCommand;
-           nmtb.rcButton = btnPtr->rect;
-           res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-                                 TBN_DROPDOWN);
-           TRACE("TBN_DROPDOWN responded with %ld\n", res);
-
-            if (res != TBDDRET_TREATPRESSED)
+            CopyRect(&arrowRect, &btnPtr->rect);
+            arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
+
+            /* for EX_DRAWDDARROWS style,  click must be in the drop-down arrow rect */
+            if ((btnPtr->fsState & TBSTATE_ENABLED) &&
+                 ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
+                  ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
+                   ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) ||
+                   (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
             {
             {
-                MSG msg;
+                LRESULT res;
 
 
-                /* redraw button in unpressed state */
-               if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
-                           btnPtr->fsState &= ~TBSTATE_PRESSED;
-                       else
-                           btnPtr->bDropDownPressed = FALSE;
-                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
+                /* draw in pressed state */
+                if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
+                    btnPtr->fsState |= TBSTATE_PRESSED;
+                else
+                    btnPtr->bDropDownPressed = TRUE;
+                RedrawWindow(infoPtr->hwndSelf, &btnPtr->rect, 0, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
 
 
-                /* find and set hot item */
-                GetCursorPos(&pt);
-                ScreenToClient(infoPtr->hwndSelf, &pt);
-                nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
-                if (!infoPtr->bAnchor || button)
-                    TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE);
-                
-                /* remove any left mouse button down or double-click messages
-                 * so that we can get a toggle effect on the button */
-                while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
-                       PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
-                    ;
+                memset(&nmtb, 0, sizeof(nmtb));
+                nmtb.iItem = btnPtr->idCommand;
+                nmtb.rcButton = btnPtr->rect;
+                res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN);
+                TRACE("TBN_DROPDOWN responded with %ld\n", res);
 
 
-               return 0;
+                if (res != TBDDRET_TREATPRESSED)
+                {
+                    MSG msg;
+
+                    /* redraw button in unpressed state */
+                    if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
+                        btnPtr->fsState &= ~TBSTATE_PRESSED;
+                    else
+                        btnPtr->bDropDownPressed = FALSE;
+                    InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
+
+                    /* find and set hot item */
+                    GetCursorPos(&pt);
+                    ScreenToClient(infoPtr->hwndSelf, &pt);
+                    nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
+                    if (!infoPtr->bAnchor || button)
+                        TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
+
+                    /* remove any left mouse button down or double-click messages
+                     * so that we can get a toggle effect on the button */
+                    while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) ||
+                           PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE))
+                        ;
+
+                    return 0;
+                }
+                /* otherwise drop through and process as pushed */
             }
             }
-           /* otherwise drop through and process as pushed */
-               }
-       infoPtr->bCaptured = TRUE;
-       infoPtr->nButtonDown = nHit;
-       infoPtr->bDragOutSent = FALSE;
+            infoPtr->bCaptured = TRUE;
+            infoPtr->nButtonDown = nHit;
+            infoPtr->bDragOutSent = FALSE;
 
 
-       btnPtr->fsState |= TBSTATE_PRESSED;
+            btnPtr->fsState |= TBSTATE_PRESSED;
 
 
-        TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE);
+            TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
 
 
-        if (btnPtr->fsState & TBSTATE_ENABLED)
-           InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
-       UpdateWindow(infoPtr->hwndSelf);
-       SetCapture (infoPtr->hwndSelf);
-    }
+            if (btnPtr->fsState & TBSTATE_ENABLED)
+                InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
+            UpdateWindow(infoPtr->hwndSelf);
+            SetCapture (infoPtr->hwndSelf);
+        }
 
 
-    if (button)
-    {
         memset(&nmtb, 0, sizeof(nmtb));
         nmtb.iItem = btnPtr->idCommand;
         TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
         memset(&nmtb, 0, sizeof(nmtb));
         nmtb.iItem = btnPtr->idCommand;
         TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
@@ -6902,8 +6896,8 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
        case TB_SETUNICODEFORMAT:
            return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
 
        case TB_SETUNICODEFORMAT:
            return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
 
-       case TB_UNKWN45D:
-           return TOOLBAR_Unkwn45D(hwnd, wParam, lParam);
+       case TB_SETBOUNDINGSIZE:
+           return TOOLBAR_SetBoundingSize(hwnd, wParam, lParam);
 
        case TB_SETHOTITEM2:
            return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
 
        case TB_SETHOTITEM2:
            return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
index cf8c6fc..37110fa 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "comctl32.h"
 
 
 #include "comctl32.h"
 
+#include <wine/exception.h>
+
 WINE_DEFAULT_DEBUG_CHANNEL(treeview);
 
 /* internal structures */
 WINE_DEFAULT_DEBUG_CHANNEL(treeview);
 
 /* internal structures */
@@ -2046,11 +2048,20 @@ TREEVIEW_GetItemT(const TREEVIEW_INFO *infoPtr, LPTVITEMEXW tvItem, BOOL isW)
 
     if (!TREEVIEW_ValidItem(infoPtr, item))
     {
 
     if (!TREEVIEW_ValidItem(infoPtr, item))
     {
+        BOOL valid_item = FALSE;
         if (!item) return FALSE;
 
         if (!item) return FALSE;
 
-        TRACE("got item from different tree %p, called from %p\n", item->infoPtr, infoPtr);
-        infoPtr = item->infoPtr;
-        if (!TREEVIEW_ValidItem(infoPtr, item)) return FALSE;
+        __TRY
+        {
+            infoPtr = item->infoPtr;
+            TRACE("got item from different tree %p, called from %p\n", item->infoPtr, infoPtr);
+            valid_item = TREEVIEW_ValidItem(infoPtr, item);
+        }
+        __EXCEPT_PAGE_FAULT
+        {
+        }
+        __ENDTRY
+        if (!valid_item) return FALSE;
     }
 
     TREEVIEW_UpdateDispInfo(infoPtr, item, tvItem->mask);
     }
 
     TREEVIEW_UpdateDispInfo(infoPtr, item, tvItem->mask);
index 87a8957..fdb5892 100644 (file)
@@ -54,7 +54,7 @@ reactos/dll/win32/browseui            # Out of sync
 reactos/dll/win32/cabinet             # Synced to WineStaging-1.7.47
 reactos/dll/win32/clusapi             # Synced to WineStaging-1.7.47
 reactos/dll/win32/comcat              # Synced to WineStaging-1.7.47
 reactos/dll/win32/cabinet             # Synced to WineStaging-1.7.47
 reactos/dll/win32/clusapi             # Synced to WineStaging-1.7.47
 reactos/dll/win32/comcat              # Synced to WineStaging-1.7.47
-reactos/dll/win32/comctl32            # Synced to WineStaging-1.7.47
+reactos/dll/win32/comctl32            # Synced to WineStaging-1.7.55
 reactos/dll/win32/comdlg32            # Synced to WineStaging-1.7.47
 reactos/dll/win32/compstui            # Synced to WineStaging-1.7.47
 reactos/dll/win32/credui              # Synced to WineStaging-1.7.55
 reactos/dll/win32/comdlg32            # Synced to WineStaging-1.7.47
 reactos/dll/win32/compstui            # Synced to WineStaging-1.7.47
 reactos/dll/win32/credui              # Synced to WineStaging-1.7.55