[COMCTL32] Sync with Wine Staging 2.2. CORE-12823
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 5 Mar 2017 20:52:24 +0000 (20:52 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 5 Mar 2017 20:52:24 +0000 (20:52 +0000)
cc055c4 comctl32: Add support for PSPCB_ADDREF/PSPCB_RELEASE callback notifications. (v2)
83cde06 comctl32/propsheet: Implement PSM_SETHEADERSUBTITLE.
ce9c06b comctl32/propsheet: Implement PSM_SETHEADERTITLE.
1a750f7 comctl32/propsheet: Add helpers to do string duplication.
14a6c98 comctl32/pager: Don't block window size changes.
a6661ba comctl32/propsheet: Added PSM_INSERTPAGE implementation.
34dd326 comctl32/propsheet: Only use header bitmap when asked for it.
6eafebe comctl32/propsheet: Force wizard header if any of pages has title/subtitle.
70c9a96 comctl32: Fix some more spec file entries.
2dd0fb8 comctl32: Correctly set the colour table for ILC_COLOR4 and ILC_COLOR8 imagelists.
a0e73a1 comctl32/syslink: Don't use exported StrCmpNIW().
970029b comctl32/toolbar: Fix TB_SETDRAWTEXTFLAGS handler.
99913e8 comctl32: Fix some spec file entries.
9d404dd comctl32/propsheet: Double size of a template buffer passed to PSCB_PRECREATE.
bb1d68e comctl32/trackbar: Fix TBM_SETRANGEMAX handling when new limit is less than current min boundary.
26067cc comctl32/toolbar: Protect from NULL pointer access in TB_GETBUTTONINFOW handler.
a6aabe0 comctl32/trackbar: Update thumb unconditionally on TBM_SETTICFREQ.
c7c8994 comctl32: Recompute the text width if necessary.
3ed6ba5 comctl32: Set the text and bkgnd colours to the default before the item pre-paint notification.
8915404 comctl32: Use wine_dbgstr_point in TRACES.

svn path=/trunk/; revision=74090

13 files changed:
reactos/dll/win32/comctl32/comctl32.spec
reactos/dll/win32/comctl32/datetime.c
reactos/dll/win32/comctl32/imagelist.c
reactos/dll/win32/comctl32/monthcal.c
reactos/dll/win32/comctl32/pager.c
reactos/dll/win32/comctl32/propsheet.c
reactos/dll/win32/comctl32/rebar.c
reactos/dll/win32/comctl32/syslink.c
reactos/dll/win32/comctl32/toolbar.c
reactos/dll/win32/comctl32/tooltips.c
reactos/dll/win32/comctl32/trackbar.c
reactos/dll/win32/comctl32/treeview.c
reactos/media/doc/README.WINE

index 4e16a62..f49c127 100644 (file)
@@ -1,12 +1,12 @@
 2 stdcall MenuHelp(long long long long long long ptr)
 3 stdcall ShowHideMenuCtl(long long ptr)
-4 stdcall GetEffectiveClientRect(long long long)
+4 stdcall GetEffectiveClientRect(long ptr ptr)
 5 stdcall DrawStatusTextA(long ptr str long)
 6 stdcall CreateStatusWindowA(long str long long)
 7 stdcall CreateToolbar(long long long long long long ptr long)
 8 stdcall CreateMappedBitmap(long long long ptr long)
-9 stdcall -noname DPA_LoadStream(ptr ptr ptr long)
-10 stdcall -noname DPA_SaveStream(ptr ptr ptr long)
+9 stdcall -noname DPA_LoadStream(ptr ptr ptr ptr)
+10 stdcall -noname DPA_SaveStream(ptr ptr ptr ptr)
 11 stdcall -noname DPA_Merge(ptr ptr long ptr ptr long)
 12 stdcall CreatePropertySheetPage(ptr) CreatePropertySheetPageA
 13 stdcall MakeDragList(long)
 236 stdcall -ordinal Str_SetPtrW(wstr wstr)
 320 stdcall -ordinal DSA_Create(long long)
 321 stdcall -ordinal DSA_Destroy(ptr)
-322 stdcall -noname DSA_GetItem(ptr long long)
+322 stdcall -noname DSA_GetItem(ptr long ptr)
 323 stdcall -ordinal DSA_GetItemPtr(ptr long)
-324 stdcall -ordinal DSA_InsertItem(ptr long long)
-325 stdcall -noname DSA_SetItem (ptr long long)
+324 stdcall -ordinal DSA_InsertItem(ptr long ptr)
+325 stdcall -noname DSA_SetItem (ptr long ptr)
 326 stdcall -noname DSA_DeleteItem(ptr long)
 327 stdcall -ordinal DSA_DeleteAllItems(ptr)
 328 stdcall -ordinal DPA_Create(long)
 340 stdcall -noname DPA_CreateEx(long long)
 341 stdcall -noname SendNotify(long long long ptr)
 342 stdcall -noname SendNotifyEx(long long long ptr long)
-350 stdcall -noname -private StrChrA(str str)
+350 stdcall -noname -private StrChrA(str long)
 351 stdcall -noname -private StrRChrA(str str long)
 352 stdcall -noname -private StrCmpNA(str str long)
 353 stdcall -noname -private StrCmpNIA(str str long)
 382 stdcall -noname SmoothScrollWindow(ptr)
 383 stdcall -noname DoReaderMode(ptr)
 384 stdcall -noname SetPathWordBreakProc(ptr long)
-385 stdcall -ordinal DPA_EnumCallback(long long long)
-386 stdcall -ordinal DPA_DestroyCallback(ptr ptr long)
-387 stdcall -noname DSA_EnumCallback(ptr ptr long)
-388 stdcall -ordinal DSA_DestroyCallback(ptr ptr long)
+385 stdcall -ordinal DPA_EnumCallback(ptr ptr ptr)
+386 stdcall -ordinal DPA_DestroyCallback(ptr ptr ptr)
+387 stdcall -noname DSA_EnumCallback(ptr ptr ptr)
+388 stdcall -ordinal DSA_DestroyCallback(ptr ptr ptr)
 #389 CControl::v_OnNotify
 390 stdcall -noname ImageList_SetColorTable(ptr long long ptr)
 400 stdcall -ordinal CreateMRUListW(ptr)
index 3afcfe1..eb26ad1 100644 (file)
@@ -804,7 +804,7 @@ DATETIME_HitTest (const DATETIME_INFO *infoPtr, POINT pt)
 {
     int i;
 
-    TRACE ("%d, %d\n", pt.x, pt.y);
+    TRACE ("%s\n", wine_dbgstr_point(&pt));
 
     if (PtInRect (&infoPtr->calbutton, pt)) return DTHT_MCPOPUP;
     if (PtInRect (&infoPtr->checkbox, pt)) return DTHT_CHECKBOX;
index 5ed8765..31ce0c9 100644 (file)
@@ -72,6 +72,7 @@ struct _IMAGELIST
     INT     cInitial;
     UINT    uBitsPixel;
     char   *has_alpha;
+    BOOL    color_table_set;
 
     LONG        ref;                       /* reference count */
 };
@@ -298,6 +299,9 @@ done:
     return ret;
 }
 
+UINT WINAPI
+ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb);
+
 /*************************************************************************
  * IMAGELIST_InternalExpandBitmaps [Internal]
  *
@@ -420,7 +424,8 @@ ImageList_Add (HIMAGELIST himl,     HBITMAP hbmImage, HBITMAP hbmMask)
 
     nImageCount = bmp.bmWidth / himl->cx;
 
-    TRACE("%p has %d images (%d x %d)\n", hbmImage, nImageCount, bmp.bmWidth, bmp.bmHeight);
+    TRACE("%p has %d images (%d x %d) bpp %d\n", hbmImage, nImageCount, bmp.bmWidth, bmp.bmHeight,
+          bmp.bmBitsPixel);
 
     IMAGELIST_InternalExpandBitmaps(himl, nImageCount);
 
@@ -438,6 +443,14 @@ ImageList_Add (HIMAGELIST himl,    HBITMAP hbmImage, HBITMAP hbmMask)
         SelectObject(hdcTemp, hbmMask);
     }
 
+    if (himl->uBitsPixel <= 8 && bmp.bmBitsPixel <= 8 &&
+        !himl->color_table_set && himl->cCurImage == 0)
+    {
+        RGBQUAD colors[256];
+        UINT num = GetDIBColorTable( hdcBitmap, 0, 1 << bmp.bmBitsPixel, colors );
+        if (num) ImageList_SetColorTable( himl, 0, num, colors );
+    }
+
     for (i=0; i<nImageCount; i++)
     {
         imagelist_point_from_index( himl, himl->cCurImage + i, &pt );
@@ -787,6 +800,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
     himl->cGrow     = cGrow;
     himl->clrFg     = CLR_DEFAULT;
     himl->clrBk     = CLR_NONE;
+    himl->color_table_set = FALSE;
 
     /* initialize overlay mask indices */
     for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
@@ -3219,11 +3233,25 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count)
 
        if (himl->uBitsPixel <= ILC_COLOR8)
        {
-            /* retrieve the default color map */
-            HBITMAP tmp = CreateBitmap( 1, 1, 1, 1, NULL );
-            GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
-            DeleteObject( tmp );
-       }
+            if (!himl->color_table_set)
+            {
+                /* retrieve the default color map */
+                HBITMAP tmp = CreateBitmap( 1, 1, 1, 1, NULL );
+                GetDIBits( hdc, tmp, 0, 0, NULL, bmi, DIB_RGB_COLORS );
+                DeleteObject( tmp );
+                if (ilc == ILC_COLOR4)
+                {
+                    RGBQUAD tmp;
+                    tmp = bmi->bmiColors[7];
+                    bmi->bmiColors[7] = bmi->bmiColors[8];
+                    bmi->bmiColors[8] = tmp;
+                }
+            }
+            else
+            {
+                GetDIBColorTable(himl->hdcImage, 0, 1 << himl->uBitsPixel, bmi->bmiColors);
+            }
+        }
        hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, NULL, 0, 0);
     }
     else /*if (ilc == ILC_COLORDDB)*/
@@ -3258,6 +3286,8 @@ static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count)
 UINT WINAPI
 ImageList_SetColorTable(HIMAGELIST himl, UINT uStartIndex, UINT cEntries, const RGBQUAD *prgb)
 {
+    TRACE("(%p, %d, %d, %p)\n", himl, uStartIndex, cEntries, prgb);
+    himl->color_table_set = TRUE;
     return SetDIBColorTable(himl->hdcImage, uStartIndex, cEntries, prgb);
 }
 
index 5857ca3..52ff00a 100644 (file)
@@ -2157,7 +2157,7 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
 
   hit = MONTHCAL_HitTest(infoPtr, &ht);
 
-  TRACE("%x at (%d, %d)\n", hit, ht.pt.x, ht.pt.y);
+  TRACE("%x at %s\n", hit, wine_dbgstr_point(&ht.pt));
 
   switch(hit)
   {
index fddc29d..d4fbd39 100644 (file)
@@ -379,34 +379,6 @@ PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress)
     return 0;
 }
 
-static LRESULT
-PAGER_WindowPosChanging(PAGER_INFO* infoPtr, WINDOWPOS *winpos)
-{
-    if ((infoPtr->dwStyle & CCS_NORESIZE) && !(winpos->flags & SWP_NOSIZE))
-    {
-        /* don't let the app resize the nonscrollable dimension of a control
-         * that was created with CCS_NORESIZE style
-         * (i.e. height for a horizontal pager, or width for a vertical one) */
-
-       /* except if the current dimension is 0 and app is setting for
-        * first time, then save amount as dimension. - GA 8/01 */
-
-        if (infoPtr->dwStyle & PGS_HORZ)
-           if (!infoPtr->nHeight && winpos->cy)
-               infoPtr->nHeight = winpos->cy;
-           else
-               winpos->cy = infoPtr->nHeight;
-        else
-           if (!infoPtr->nWidth && winpos->cx)
-               infoPtr->nWidth = winpos->cx;
-           else
-               winpos->cx = infoPtr->nWidth;
-       return 0;
-    }
-
-    return DefWindowProcW (infoPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos);
-}
-
 /******************************************************************
  * For the PGM_RECALCSIZE message (but not the other uses in      *
  * this module), the native control does only the following:      *
@@ -1027,6 +999,8 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     PAGER_INFO *infoPtr = (PAGER_INFO *)GetWindowLongPtrW(hwnd, 0);
 
+    TRACE("(%p, %#x, %#lx, %#lx)\n", hwnd, uMsg, wParam, lParam);
+
     if (!infoPtr && (uMsg != WM_CREATE))
        return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
@@ -1085,9 +1059,6 @@ PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         case WM_NCPAINT:
             return PAGER_NCPaint (infoPtr, (HRGN)wParam);
 
-        case WM_WINDOWPOSCHANGING:
-            return PAGER_WindowPosChanging (infoPtr, (WINDOWPOS*)lParam);
-
         case WM_STYLECHANGED:
             return PAGER_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
 
index d6073b1..bfdfa50 100644 (file)
  *   - Wizard 97 header resizing
  *   - Enforcing of minimal wizard size
  *   - Messages:
- *     o PSM_INSERTPAGE
  *     o PSM_RECALCPAGESIZES
- *     o PSM_SETHEADERSUBTITLE
- *     o PSM_SETHEADERTITLE
  *     o WM_HELP
  *     o WM_CONTEXTMENU
  *   - Notifications:
@@ -156,13 +153,32 @@ 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 BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage);
 
 static INT_PTR CALLBACK
 PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
 WINE_DEFAULT_DEBUG_CHANNEL(propsheet);
 
+static WCHAR *heap_strdupW(const WCHAR *str)
+{
+    int len = strlenW(str) + 1;
+    WCHAR *ret = Alloc(len * sizeof(WCHAR));
+    strcpyW(ret, str);
+    return ret;
+}
+
+static WCHAR *heap_strdupAtoW(const char *str)
+{
+    WCHAR *ret;
+    INT len;
+
+    len = MultiByteToWideChar(CP_ACP, 0, str, -1, 0, 0);
+    ret = Alloc(len * sizeof(WCHAR));
+    MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
+
+    return ret;
+}
+
 #define add_flag(a) if (dwFlags & a) {strcat(string, #a );strcat(string," ");}
 /******************************************************************************
  *            PROPSHEET_UnImplementedFlags
@@ -255,23 +271,6 @@ static INT PROPSHEET_FindPageByResId(const PropSheetInfo * psInfo, LRESULT resId
    return i;
 }
 
-/******************************************************************************
- *            PROPSHEET_AtoW
- *
- * Convert ASCII to Unicode since all data is saved as Unicode.
- */
-static void PROPSHEET_AtoW(LPCWSTR *tostr, LPCSTR frstr)
-{
-    INT len;
-    WCHAR *to;
-
-    TRACE("<%s>\n", frstr);
-    len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0);
-    to = Alloc(len * sizeof(WCHAR));
-    MultiByteToWideChar(CP_ACP, 0, frstr, -1, to, len);
-    *tostr = to;
-}
-
 /******************************************************************************
  *            PROPSHEET_CollectSheetInfoCommon
  *
@@ -360,12 +359,7 @@ static void PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh,
   else
   {
      if (!IS_INTRESOURCE(lppsh->pszCaption))
-     {
-        int len = strlenW(lppsh->pszCaption);
-        WCHAR *caption = Alloc( (len+1)*sizeof(WCHAR) );
-
-        psInfo->ppshheader.pszCaption = strcpyW( caption, lppsh->pszCaption );
-     }
+       psInfo->ppshheader.pszCaption = heap_strdupW( lppsh->pszCaption );
   }
   psInfo->nPages = lppsh->nPages;
 
@@ -471,6 +465,9 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
   width  = (WORD)*p; p++;
   height = (WORD)*p; p++;
 
+  if (lppsp->dwFlags & (PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE))
+    psInfo->ppshheader.dwFlags |= PSH_HEADER;
+
   /* Special calculation for interior wizard pages so the largest page is
    * calculated correctly. We need to add all the padding and space occupied
    * by the header so the width and height sums up to the whole wizard client
@@ -535,8 +532,6 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
     WCHAR szTitle[256];
     const WCHAR *pTitle;
     static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 };
-    WCHAR *text;
-    int len;
 
     if (IS_INTRESOURCE( lppsp->pszTitle ))
     {
@@ -550,9 +545,7 @@ static BOOL PROPSHEET_CollectPageInfo(LPCPROPSHEETPAGEW lppsp,
     else
       pTitle = lppsp->pszTitle;
 
-    len = strlenW(pTitle);
-    text = Alloc( (len+1)*sizeof (WCHAR) );
-    psInfo->proppage[index].pszText = strcpyW( text, pTitle);
+    psInfo->proppage[index].pszText = heap_strdupW( pTitle );
   }
 
   /*
@@ -624,7 +617,7 @@ static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo)
    */
   resSize = SizeofResource(COMCTL32_hModule, hRes);
 
-  temp = Alloc(resSize);
+  temp = Alloc(2 * resSize);
 
   if (!temp)
     return -1;
@@ -2226,16 +2219,108 @@ static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
   return msgResult;
 }
 
+/******************************************************************************
+ *            PROPSHEET_InsertPage
+ */
+static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
+{
+  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;
+
+  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;
+}
 
 /******************************************************************************
  *            PROPSHEET_AddPage
  */
-static BOOL PROPSHEET_AddPage(HWND hwndDlg,
-                              HPROPSHEETPAGE hpage)
+static BOOL PROPSHEET_AddPage(HWND hwndDlg, HPROPSHEETPAGE hpage)
 {
   PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
-  TRACE("hpage %p\n", hpage);
-  return PROPSHEET_InsertPage(hwndDlg, (HPROPSHEETPAGE)(ULONG_PTR)psInfo->nPages, hpage);
+  TRACE("hwndDlg %p, hpage %p\n", hwndDlg, hpage);
+  return PROPSHEET_InsertPage(hwndDlg, UlongToPtr(psInfo->nPages), hpage);
 }
 
 /******************************************************************************
@@ -2419,135 +2504,75 @@ static void PROPSHEET_SetWizButtons(HWND hwndDlg, DWORD dwFlags)
 }
 
 /******************************************************************************
- *            PROPSHEET_InsertPage
+ *            PROPSHEET_SetHeaderTitleW
  */
-static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage)
+static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, UINT page_index, const WCHAR *title)
 {
-  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++;
+    PropSheetInfo *psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
+    PROPSHEETPAGEW *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;
+    TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_w(title));
 
-  if (psInfo->hImageList)
-  {
-    SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
-  }
+    if (page_index >= psInfo->nPages)
+        return;
 
-  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);
+    page = (PROPSHEETPAGEW *)psInfo->proppage[page_index].hpage;
 
-  return TRUE;
-}
+    if (!IS_INTRESOURCE(page->pszHeaderTitle))
+        Free((void *)page->pszHeaderTitle);
 
-/******************************************************************************
- *            PROPSHEET_SetHeaderTitleW
- */
-static void PROPSHEET_SetHeaderTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderTitle)
-{
-    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderTitle));
+    page->pszHeaderTitle = heap_strdupW(title);
+    page->dwFlags |= PSP_USEHEADERTITLE;
 }
 
 /******************************************************************************
  *            PROPSHEET_SetHeaderTitleA
  */
-static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderTitle)
+static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, UINT page_index, const char *title)
 {
-    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderTitle));
+    WCHAR *titleW;
+
+    TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_a(title));
+
+    titleW = heap_strdupAtoW(title);
+    PROPSHEET_SetHeaderTitleW(hwndDlg, page_index, titleW);
+    Free(titleW);
 }
 
 /******************************************************************************
  *            PROPSHEET_SetHeaderSubTitleW
  */
-static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, int iPageIndex, LPCWSTR pszHeaderSubTitle)
+static void PROPSHEET_SetHeaderSubTitleW(HWND hwndDlg, UINT page_index, const WCHAR *subtitle)
 {
-    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_w(pszHeaderSubTitle));
+    PropSheetInfo *psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
+    PROPSHEETPAGEW *page;
+
+    TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_w(subtitle));
+
+    if (page_index >= psInfo->nPages)
+        return;
+
+    page = (PROPSHEETPAGEW *)psInfo->proppage[page_index].hpage;
+
+    if (!IS_INTRESOURCE(page->pszHeaderSubTitle))
+        Free((void *)page->pszHeaderSubTitle);
+
+    page->pszHeaderSubTitle = heap_strdupW(subtitle);
+    page->dwFlags |= PSP_USEHEADERSUBTITLE;
 }
 
 /******************************************************************************
  *            PROPSHEET_SetHeaderSubTitleA
  */
-static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, int iPageIndex, LPCSTR pszHeaderSubTitle)
+static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, UINT page_index, const char *subtitle)
 {
-    FIXME("(%p, %d, %s): stub\n", hwndDlg, iPageIndex, debugstr_a(pszHeaderSubTitle));
+    WCHAR *subtitleW;
+
+    TRACE("(%p, %u, %s)\n", hwndDlg, page_index, debugstr_a(subtitle));
+
+    subtitleW = heap_strdupAtoW(subtitle);
+    PROPSHEET_SetHeaderSubTitleW(hwndDlg, page_index, subtitleW);
+    Free(subtitleW);
 }
 
 /******************************************************************************
@@ -2963,15 +2988,15 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
     if (ppsp->dwFlags & PSP_USEICONID)
     {
         if (!IS_INTRESOURCE( ppsp->u2.pszIcon ))
-            PROPSHEET_AtoW(&ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon);
+            ppsp->u2.pszIcon = heap_strdupAtoW( lpPropSheetPage->u2.pszIcon );
     }
 
     if (ppsp->dwFlags & PSP_USETITLE)
     {
-        if (!IS_INTRESOURCE( ppsp->pszTitle ))
-            PROPSHEET_AtoW( &ppsp->pszTitle, lpPropSheetPage->pszTitle );
-        else
+        if (IS_INTRESOURCE( ppsp->pszTitle ))
             ppsp->pszTitle = load_string( ppsp->hInstance, ppsp->pszTitle );
+        else
+            ppsp->pszTitle = heap_strdupAtoW( lpPropSheetPage->pszTitle );
     }
     else
         ppsp->pszTitle = NULL;
@@ -2981,24 +3006,27 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
 
     if (ppsp->dwFlags & PSP_USEHEADERTITLE)
     {
-        if (!IS_INTRESOURCE( ppsp->pszHeaderTitle ))
-            PROPSHEET_AtoW(&ppsp->pszHeaderTitle, lpPropSheetPage->pszHeaderTitle);
-        else
+        if (IS_INTRESOURCE( ppsp->pszHeaderTitle ))
             ppsp->pszHeaderTitle = load_string( ppsp->hInstance, ppsp->pszHeaderTitle );
+        else
+            ppsp->pszHeaderTitle = heap_strdupAtoW( lpPropSheetPage->pszHeaderTitle );
     }
     else
         ppsp->pszHeaderTitle = NULL;
 
     if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE)
     {
-        if (!IS_INTRESOURCE( ppsp->pszHeaderSubTitle ))
-            PROPSHEET_AtoW(&ppsp->pszHeaderSubTitle, lpPropSheetPage->pszHeaderSubTitle);
-        else
+        if (IS_INTRESOURCE( ppsp->pszHeaderSubTitle ))
             ppsp->pszHeaderSubTitle = load_string( ppsp->hInstance, ppsp->pszHeaderSubTitle );
+        else
+            ppsp->pszHeaderSubTitle = heap_strdupAtoW( lpPropSheetPage->pszHeaderSubTitle );
     }
     else
         ppsp->pszHeaderSubTitle = NULL;
 
+    if ((ppsp->dwFlags & PSH_USECALLBACK) && ppsp->pfnCallback)
+        ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp);
+
     return (HPROPSHEETPAGE)ppsp;
 }
 
@@ -3018,23 +3046,13 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
     if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) )
     {
         if (!IS_INTRESOURCE( ppsp->u.pszTemplate ))
-        {
-            int len = strlenW(lpPropSheetPage->u.pszTemplate) + 1;
-            WCHAR *template = Alloc( len * sizeof (WCHAR) );
-
-            ppsp->u.pszTemplate = strcpyW( template, lpPropSheetPage->u.pszTemplate );
-        }
+            ppsp->u.pszTemplate = heap_strdupW( lpPropSheetPage->u.pszTemplate );
     }
 
     if ( ppsp->dwFlags & PSP_USEICONID )
     {
         if (!IS_INTRESOURCE( ppsp->u2.pszIcon ))
-        {
-            int len = strlenW(lpPropSheetPage->u2.pszIcon) + 1;
-            WCHAR *icon = Alloc( len * sizeof (WCHAR) );
-
-            ppsp->u2.pszIcon = strcpyW( icon, lpPropSheetPage->u2.pszIcon );
-        }
+            ppsp->u2.pszIcon = heap_strdupW( lpPropSheetPage->u2.pszIcon );
     }
 
     if (ppsp->dwFlags & PSP_USETITLE)
@@ -3055,6 +3073,9 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage
     else
         ppsp->pszHeaderSubTitle = NULL;
 
+    if ((ppsp->dwFlags & PSH_USECALLBACK) && ppsp->pfnCallback)
+        ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp);
+
     return (HPROPSHEETPAGE)ppsp;
 }
 
@@ -3076,6 +3097,9 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
   if (!psp)
      return FALSE;
 
+  if ((psp->dwFlags & PSH_USECALLBACK) && psp->pfnCallback)
+     psp->pfnCallback(0, PSPCB_RELEASE, psp);
+
   if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate ))
      Free ((LPVOID)psp->u.pszTemplate);
 
@@ -3251,61 +3275,65 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
        COLORREF clrOld = 0;
        int oldBkMode = 0;
 
-       hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
-       hOldFont = SelectObject(hdc, psInfo->hFontBold);
-
-       GetClientRect(hwndLineHeader, &r);
-       MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2);
-       SetRect(&rzone, 0, 0, r.right + 1, r.top - 1);
-
-       GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), &bm);
-
-       if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD)
-       {
-           /* Fill the unoccupied part of the header with color of the
-            * left-top pixel, but do it only when needed.
-            */
-           if (bm.bmWidth < r.right || bm.bmHeight < r.bottom)
-           {
-               hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0));
-                r = rzone;
-               if (bm.bmWidth < r.right)
-               {
-                   r.left = bm.bmWidth;
-                   FillRect(hdc, &r, hbr);
-               }
-               if (bm.bmHeight < r.bottom)
-               {
-                   r.left = 0;
-                   r.top = bm.bmHeight;
-                   FillRect(hdc, &r, hbr);
-               }
-               DeleteObject(hbr);
-           }
-
-           /* Draw the header itself. */
-           BitBlt(hdc, 0, 0,
-                  bm.bmWidth, min(bm.bmHeight, rzone.bottom),
-                  hdcSrc, 0, 0, SRCCOPY);
-       }
-       else
-       {
-            int margin;
-           hbr = GetSysColorBrush(COLOR_WINDOW);
-           FillRect(hdc, &rzone, hbr);
-
-           /* Draw the header bitmap. It's always centered like a
-            * common 49 x 49 bitmap. */
-            margin = (rzone.bottom - 49) / 2;
-           BitBlt(hdc, rzone.right - 49 - margin, margin,
-                   min(bm.bmWidth, 49), min(bm.bmHeight, 49),
-                   hdcSrc, 0, 0, SRCCOPY);
-
-           /* NOTE: Native COMCTL32 draws a white stripe over the bitmap
-            * if its height is smaller than 49 pixels. Because the reason
-            * for this bug is unknown the current code doesn't try to
-            * replicate it. */
-       }
+        GetClientRect(hwndLineHeader, &r);
+        MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2);
+        SetRect(&rzone, 0, 0, r.right + 1, r.top - 1);
+
+        hOldFont = SelectObject(hdc, psInfo->hFontBold);
+
+        if (psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)
+        {
+            hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u5.hbmHeader);
+
+            GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), &bm);
+            if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD)
+            {
+                /* Fill the unoccupied part of the header with color of the
+                 * left-top pixel, but do it only when needed.
+                 */
+                if (bm.bmWidth < r.right || bm.bmHeight < r.bottom)
+                {
+                    hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0));
+                    r = rzone;
+                    if (bm.bmWidth < r.right)
+                    {
+                        r.left = bm.bmWidth;
+                        FillRect(hdc, &r, hbr);
+                    }
+                    if (bm.bmHeight < r.bottom)
+                    {
+                        r.left = 0;
+                        r.top = bm.bmHeight;
+                        FillRect(hdc, &r, hbr);
+                    }
+                    DeleteObject(hbr);
+                }
+
+                /* Draw the header itself. */
+                BitBlt(hdc, 0, 0, bm.bmWidth, min(bm.bmHeight, rzone.bottom),
+                        hdcSrc, 0, 0, SRCCOPY);
+            }
+            else
+            {
+                int margin;
+                hbr = GetSysColorBrush(COLOR_WINDOW);
+                FillRect(hdc, &rzone, hbr);
+
+                /* Draw the header bitmap. It's always centered like a
+                 * common 49 x 49 bitmap. */
+                margin = (rzone.bottom - 49) / 2;
+                BitBlt(hdc, rzone.right - 49 - margin, margin,
+                        min(bm.bmWidth, 49), min(bm.bmHeight, 49),
+                        hdcSrc, 0, 0, SRCCOPY);
+
+                /* NOTE: Native COMCTL32 draws a white stripe over the bitmap
+                 * if its height is smaller than 49 pixels. Because the reason
+                 * for this bug is unknown the current code doesn't try to
+                 * replicate it. */
+            }
+
+            SelectObject(hdcSrc, hbmp);
+        }
 
        clrOld = SetTextColor (hdc, 0x00000000);
        oldBkMode = SetBkMode (hdc, TRANSPARENT); 
@@ -3346,7 +3374,6 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam)
        SetTextColor(hdc, clrOld);
        SetBkMode(hdc, oldBkMode);
        SelectObject(hdc, hOldFont);
-       SelectObject(hdcSrc, hbmp);
     }
 
     if ( (ppshpage && (ppshpage->dwFlags & PSP_HIDEHEADER)) &&
@@ -3754,19 +3781,19 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     }
 
     case PSM_SETHEADERTITLEW:
-        PROPSHEET_SetHeaderTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
+        PROPSHEET_SetHeaderTitleW(hwnd, wParam, (LPCWSTR)lParam);
         return TRUE;
 
     case PSM_SETHEADERTITLEA:
-        PROPSHEET_SetHeaderTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
+        PROPSHEET_SetHeaderTitleA(hwnd, wParam, (LPCSTR)lParam);
         return TRUE;
 
     case PSM_SETHEADERSUBTITLEW:
-        PROPSHEET_SetHeaderSubTitleW(hwnd, (int)wParam, (LPCWSTR)lParam);
+        PROPSHEET_SetHeaderSubTitleW(hwnd, wParam, (LPCWSTR)lParam);
         return TRUE;
 
     case PSM_SETHEADERSUBTITLEA:
-        PROPSHEET_SetHeaderSubTitleA(hwnd, (int)wParam, (LPCSTR)lParam);
+        PROPSHEET_SetHeaderSubTitleA(hwnd, wParam, (LPCSTR)lParam);
         return TRUE;
 
     case PSM_HWNDTOINDEX:
index 0266553..1706957 100644 (file)
@@ -3386,7 +3386,7 @@ REBAR_NCHitTest (const REBAR_INFO *infoPtr, LPARAM lParam)
              ret, i);
        ret = (LRESULT) i;
     }
-    TRACE("returning %ld, client point (%d,%d)\n", ret, clpt.x, clpt.y);
+    TRACE("returning %ld, client point %s\n", ret, wine_dbgstr_point(&clpt));
     return ret;
 }
 
index 3536f5d..4c0904d 100644 (file)
@@ -33,8 +33,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(syslink);
 
-INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT);
-
 typedef struct
 {
     int nChars;
@@ -90,11 +88,6 @@ typedef struct
     BOOL      IgnoreReturn; /* (infoPtr->Style & LWS_IGNORERETURN) on creation */
 } SYSLINK_INFO;
 
-static const WCHAR SL_LINKOPEN[] =  { '<','a', 0 };
-static const WCHAR SL_HREF[] =      { 'h','r','e','f','=','\"',0 };
-static const WCHAR SL_ID[] =        { 'i','d','=','\"',0 };
-static const WCHAR SL_LINKCLOSE[] = { '<','/','a','>',0 };
-
 /* Control configuration constants */
 
 #define SL_LEFTMARGIN   (0)
@@ -166,26 +159,6 @@ static VOID SYSLINK_ClearDoc (SYSLINK_INFO *infoPtr)
     }
 }
 
-/***********************************************************************
- * SYSLINK_StrCmpNIW
- * Wrapper for StrCmpNIW to ensure 'len' is not too big.
- */
-static INT SYSLINK_StrCmpNIW (LPCWSTR str, LPCWSTR comp, INT len)
-{
-    INT i;
-
-    for(i = 0; i < len; i++)
-    {
-        if(!str[i])
-        {
-            len = i + 1;
-            break;
-        }
-    }
-
-    return StrCmpNIW(str, comp, len);
-}
-
 /***********************************************************************
  * SYSLINK_ParseText
  * Parses the window text string and creates a document. Returns the
@@ -193,6 +166,10 @@ static INT SYSLINK_StrCmpNIW (LPCWSTR str, LPCWSTR comp, INT len)
  */
 static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
 {
+    static const WCHAR SL_LINKOPEN[] =  { '<','a' };
+    static const WCHAR SL_HREF[] =      { 'h','r','e','f','=','\"' };
+    static const WCHAR SL_ID[] =        { 'i','d','=','\"' };
+    static const WCHAR SL_LINKCLOSE[] = { '<','/','a','>' };
     LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL;
     int taglen = 0, textlen = 0, linklen = 0, docitems = 0;
     PDOC_ITEM Last = NULL;
@@ -206,7 +183,7 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
     {
         if(*current == '<')
         {
-            if(!SYSLINK_StrCmpNIW(current, SL_LINKOPEN, 2) && (CurrentType == slText))
+            if(!strncmpiW(current, SL_LINKOPEN, sizeof(SL_LINKOPEN)/sizeof(SL_LINKOPEN[0])) && (CurrentType == slText))
             {
                 BOOL ValidParam = FALSE, ValidLink = FALSE;
 
@@ -234,14 +211,14 @@ static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text)
                     
 CheckParameter:
                     /* compare the current position with all known parameters */
-                    if(!SYSLINK_StrCmpNIW(tmp, SL_HREF, 6))
+                    if(!strncmpiW(tmp, SL_HREF, sizeof(SL_HREF)/sizeof(SL_HREF[0])))
                     {
                         taglen += 6;
                         ValidParam = TRUE;
                         CurrentParameter = &lpUrl;
                         CurrentParameterLen = &lenUrl;
                     }
-                    else if(!SYSLINK_StrCmpNIW(tmp, SL_ID, 4))
+                    else if(!strncmpiW(tmp, SL_ID, sizeof(SL_ID)/sizeof(SL_ID[0])))
                     {
                         taglen += 4;
                         ValidParam = TRUE;
@@ -315,7 +292,7 @@ CheckParameter:
                     }
                 }
             }
-            else if(!SYSLINK_StrCmpNIW(current, SL_LINKCLOSE, 4) && (CurrentType == slLink) && firsttag)
+            else if(!strncmpiW(current, SL_LINKCLOSE, sizeof(SL_LINKCLOSE)/sizeof(SL_LINKCLOSE[0])) && (CurrentType == slLink) && firsttag)
             {
                 /* there's a <a...> tag opened, first add the previous text, if present */
                 if(textstart != NULL && textlen > 0 && firsttag > textstart)
index e87e2a5..3b1ed5f 100644 (file)
@@ -3484,7 +3484,7 @@ TOOLBAR_GetButtonInfoT(const TOOLBAR_INFO *infoPtr, INT Id, LPTBBUTTONINFOW lpTb
                 Str_GetPtrW(lpText, lpTbInfo->pszText, lpTbInfo->cchText);
             else
                 Str_GetPtrWtoA(lpText, (LPSTR)lpTbInfo->pszText, lpTbInfo->cchText);
-        } else
+        } else if (!bUnicode || lpTbInfo->pszText)
             lpTbInfo->pszText[0] = '\0';
     }
     return nIndex;
@@ -4663,17 +4663,16 @@ TOOLBAR_SetDisabledImageList (TOOLBAR_INFO *infoPtr, WPARAM wParam, HIMAGELIST h
 
 
 static LRESULT
-TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
+TOOLBAR_SetDrawTextFlags (TOOLBAR_INFO *infoPtr, DWORD mask, DWORD flags)
 {
-    DWORD dwTemp;
+    DWORD old_flags;
 
-    TRACE("hwnd = %p, dwMask = 0x%08x, dwDTFlags = 0x%08x\n", infoPtr->hwndSelf, (DWORD)wParam, (DWORD)lParam);
+    TRACE("hwnd = %p, mask = 0x%08x, flags = 0x%08x\n", infoPtr->hwndSelf, mask, flags);
 
-    dwTemp = infoPtr->dwDTFlags;
-    infoPtr->dwDTFlags =
-       (infoPtr->dwDTFlags & (DWORD)wParam) | (DWORD)lParam;
+    old_flags = infoPtr->dwDTFlags;
+    infoPtr->dwDTFlags = (old_flags & ~mask) | (flags & mask);
 
-    return (LRESULT)dwTemp;
+    return (LRESULT)old_flags;
 }
 
 /* This function differs a bit from what MSDN says it does:
index 52ec3b5..f92dd1b 100644 (file)
@@ -1521,7 +1521,7 @@ TOOLTIPS_RelayEvent (TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
                                                       &pt);
            TRACE("tool (%p) %d %d %d\n", infoPtr->hwndSelf, nOldTool,
                  infoPtr->nTool, infoPtr->nCurrentTool);
-            TRACE("WM_MOUSEMOVE (%p %d %d)\n", infoPtr->hwndSelf, pt.x, pt.y);
+            TRACE("WM_MOUSEMOVE (%p %s)\n", infoPtr->hwndSelf, wine_dbgstr_point(&pt));
 
            if (infoPtr->nTool != nOldTool) {
                if(infoPtr->nTool == -1) { /* Moved out of all tools */
index 97a1cd6..7b6f6c4 100644 (file)
@@ -436,7 +436,7 @@ TRACKBAR_AutoPage (TRACKBAR_INFO *infoPtr, POINT clickPoint)
     LONG dir = TRACKBAR_GetAutoPageDirection(infoPtr, clickPoint);
     LONG prevPos = infoPtr->lPos;
 
-    TRACE("x=%d, y=%d, dir=%d\n", clickPoint.x, clickPoint.y, dir);
+    TRACE("clickPoint=%s, dir=%d\n", wine_dbgstr_point(&clickPoint), dir);
 
     if (dir > 0 && (infoPtr->flags & TB_AUTO_PAGE_RIGHT))
        TRACKBAR_PageDown(infoPtr);
@@ -1261,10 +1261,11 @@ static inline LRESULT
 TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG lMax)
 {
     BOOL changed = infoPtr->lRangeMax != lMax;
+    LONG rightmost = max(lMax, infoPtr->lRangeMin);
 
     infoPtr->lRangeMax = lMax;
-    if (infoPtr->lPos > infoPtr->lRangeMax) {
-        infoPtr->lPos = infoPtr->lRangeMax;
+    if (infoPtr->lPos > rightmost) {
+        infoPtr->lPos = rightmost;
         infoPtr->flags |= TB_THUMBPOSCHANGED;
     }
 
@@ -1415,6 +1416,7 @@ TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
        TRACKBAR_InvalidateAll(infoPtr);
     }
 
+    TRACKBAR_UpdateThumb (infoPtr);
     return 0;
 }
 
index 27f99ee..26bc1b9 100644 (file)
@@ -2531,6 +2531,8 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
     }
 
     hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, item));
+    oldTextColor = SetTextColor(hdc, nmcdhdr.clrText);
+    oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk);
 
     /* The custom draw handler can query the text rectangle,
      * so get ready. */
@@ -2565,9 +2567,9 @@ TREEVIEW_DrawItem(const TREEVIEW_INFO *infoPtr, HDC hdc, TREEVIEW_ITEM *item)
 
     TREEVIEW_DrawItemLines(infoPtr, hdc, item);
 
-    /* Set colors. Custom draw handler can change these so we do this after it. */
-    oldTextColor = SetTextColor(hdc, nmcdhdr.clrText);
-    oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk);
+    /* reset colors. Custom draw handler can change them */
+    SetTextColor(hdc, nmcdhdr.clrText);
+    SetBkColor(hdc, nmcdhdr.clrTextBk);
 
     centery = (item->rect.top + item->rect.bottom) / 2;
 
@@ -3687,6 +3689,9 @@ TREEVIEW_HitTest(const TREEVIEW_INFO *infoPtr, LPTVHITTESTINFO lpht)
         return NULL;
     }
 
+    if (!item->textWidth)
+        TREEVIEW_ComputeTextWidth(infoPtr, item, 0);
+
     if (x >= item->textOffset + item->textWidth)
     {
        lpht->flags = TVHT_ONITEMRIGHT;
index 9386ff6..22f6122 100644 (file)
@@ -54,7 +54,7 @@ reactos/dll/win32/browseui            # Out of sync
 reactos/dll/win32/cabinet             # Synced to WineStaging-2.2
 reactos/dll/win32/clusapi             # Synced to WineStaging-1.9.11
 reactos/dll/win32/comcat              # Synced to WineStaging-1.9.11
-reactos/dll/win32/comctl32            # Synced to WineStaging-1.9.23
+reactos/dll/win32/comctl32            # Synced to WineStaging-2.2
 reactos/dll/win32/comdlg32            # Synced to WineStaging-1.9.23
 reactos/dll/win32/compstui            # Synced to WineStaging-2.2
 reactos/dll/win32/credui              # Synced to WineStaging-2.2