Ignore:
Timestamp:
Sep 26, 1999, 1:01:11 PM (26 years ago)
Author:
achimha
Message:

merged latest WINE 990923 changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/tooltips.c

    r496 r1058  
    1 /* $Id: tooltips.c,v 1.13 1999-08-14 16:13:15 cbratschi Exp $ */
     1/* $Id: tooltips.c,v 1.14 1999-09-26 11:01:11 achimha Exp $ */
    22/*
    33 * Tool tip control
     
    2121 - CS_SAVEBITS: window movements are slow, bug in Open32?
    2222*/
     23
     24/* WINE 990923 level */
    2325
    2426#include <string.h>
     
    834836    toolPtr = &infoPtr->tools[nTool];
    835837    if ((toolPtr->hinst) && (toolPtr->lpszText)) {
    836         if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
     838        if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
     839             (HIWORD((INT)toolPtr->lpszText) != 0) )
    837840            COMCTL32_Free (toolPtr->lpszText);
    838841    }
     
    891894    toolPtr = &infoPtr->tools[nTool];
    892895    if ((toolPtr->hinst) && (toolPtr->lpszText)) {
    893         if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
     896        if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
     897             (HIWORD((INT)toolPtr->lpszText) != 0) )
    894898            COMCTL32_Free (toolPtr->lpszText);
    895899    }
     
    15731577            toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
    15741578        else {
    1575             if (toolPtr->lpszText) {
     1579            if ( (toolPtr->lpszText) &&
     1580                 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
    15761581                COMCTL32_Free (toolPtr->lpszText);
    15771582                toolPtr->lpszText = NULL;
     
    16271632            toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
    16281633        else {
    1629             if (toolPtr->lpszText) {
     1634            if ( (toolPtr->lpszText) &&
     1635                 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
    16301636                COMCTL32_Free (toolPtr->lpszText);
    16311637                toolPtr->lpszText = NULL;
     
    17111717
    17121718
    1713 static LRESULT
    17141719TOOLTIPS_UpdateTipTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
    17151720{
     
    17191724    INT nTool;
    17201725
    1721     if (lpToolInfo == NULL) return 0;
    1722     if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA) return FALSE;
    1723 
    1724     nTool = TOOLTIPS_GetToolFromInfoA(infoPtr,lpToolInfo);
     1726    if (lpToolInfo == NULL)
     1727        return 0;
     1728    if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEA)
     1729        return FALSE;
     1730
     1731    nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo);
    17251732    if (nTool == -1) return 0;
    17261733
    1727 //    TRACE (tooltips, "tool %d\n", nTool);
     1734//    TRACE("tool %d\n", nTool);
    17281735
    17291736    toolPtr = &infoPtr->tools[nTool];
     
    17321739    toolPtr->hinst  = lpToolInfo->hinst;
    17331740
    1734     if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0))
    1735     {
    1736       toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
    1737     } else if (lpToolInfo->lpszText)
    1738     {
    1739       if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA) toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
    1740       else
    1741       {
    1742         if (toolPtr->lpszText)
    1743         {
    1744           COMCTL32_Free(toolPtr->lpszText);
    1745           toolPtr->lpszText = NULL;
    1746         }
    1747         if (lpToolInfo->lpszText)
    1748         {
    1749           INT len = lstrlenA(lpToolInfo->lpszText);
    1750           toolPtr->lpszText = COMCTL32_Alloc((len+1)*sizeof(WCHAR));
    1751           lstrcpyAtoW(toolPtr->lpszText,lpToolInfo->lpszText);
    1752         }
    1753       }
     1741    if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){
     1742        toolPtr->lpszText = (LPWSTR)lpToolInfo->lpszText;
     1743    }
     1744    else if (lpToolInfo->lpszText) {
     1745        if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKA)
     1746            toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
     1747        else {
     1748            if ( (toolPtr->lpszText) &&
     1749                 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
     1750                COMCTL32_Free (toolPtr->lpszText);
     1751                toolPtr->lpszText = NULL;
     1752            }
     1753            if (lpToolInfo->lpszText) {
     1754                INT len = lstrlenA (lpToolInfo->lpszText);
     1755                toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
     1756                lstrcpyAtoW (toolPtr->lpszText, lpToolInfo->lpszText);
     1757            }
     1758        }
    17541759    }
    17551760
    17561761    /* force repaint */
    1757     if (infoPtr->bActive) TOOLTIPS_Show(hwnd,infoPtr);
    1758     else if (infoPtr->bTrackActive) TOOLTIPS_TrackShow(hwnd,infoPtr);
     1762    if (infoPtr->bActive)
     1763        TOOLTIPS_Show (hwnd, infoPtr);
     1764    else if (infoPtr->bTrackActive)
     1765        TOOLTIPS_TrackShow (hwnd, infoPtr);
    17591766
    17601767    return 0;
     
    17711778
    17721779    if (lpToolInfo == NULL)
    1773         return 0;
     1780        return 0;
    17741781    if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZEW)
    1775         return FALSE;
     1782        return FALSE;
    17761783
    17771784    nTool = TOOLTIPS_GetToolFromInfoW (infoPtr, lpToolInfo);
    17781785    if (nTool == -1)
    1779         return 0;
    1780 
    1781 //    TRACE (tooltips, "tool %d\n", nTool);
     1786        return 0;
     1787
     1788//    TRACE("tool %d\n", nTool);
    17821789
    17831790    toolPtr = &infoPtr->tools[nTool];
     
    17871794
    17881795    if ((lpToolInfo->hinst) && (HIWORD((INT)lpToolInfo->lpszText) == 0)){
    1789         toolPtr->lpszText = lpToolInfo->lpszText;
     1796        toolPtr->lpszText = lpToolInfo->lpszText;
    17901797    }
    17911798    else if (lpToolInfo->lpszText) {
    1792         if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
    1793             toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
    1794         else {
    1795             if (toolPtr->lpszText) {
    1796                 COMCTL32_Free (toolPtr->lpszText);
    1797                 toolPtr->lpszText = NULL;
    1798             }
    1799             if (lpToolInfo->lpszText) {
    1800                 INT len = lstrlenW (lpToolInfo->lpszText);
    1801                 toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
    1802                 lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
    1803             }
    1804         }
     1799        if (lpToolInfo->lpszText == LPSTR_TEXTCALLBACKW)
     1800            toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
     1801        else {
     1802            if ( (toolPtr->lpszText)  &&
     1803                 (HIWORD((INT)toolPtr->lpszText) != 0) ) {
     1804                COMCTL32_Free (toolPtr->lpszText);
     1805                toolPtr->lpszText = NULL;
     1806            }
     1807            if (lpToolInfo->lpszText) {
     1808                INT len = lstrlenW (lpToolInfo->lpszText);
     1809                toolPtr->lpszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
     1810                lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
     1811            }
     1812        }
    18051813    }
    18061814
    18071815    /* force repaint */
    18081816    if (infoPtr->bActive)
    1809         TOOLTIPS_Show (hwnd, infoPtr);
     1817        TOOLTIPS_Show (hwnd, infoPtr);
    18101818    else if (infoPtr->bTrackActive)
    1811         TOOLTIPS_TrackShow (hwnd, infoPtr);
     1819        TOOLTIPS_TrackShow (hwnd, infoPtr);
    18121820
    18131821    return 0;
     
    18821890
    18831891    /* free tools */
    1884     if (infoPtr->tools)
    1885     {
    1886       for (i = 0;i < infoPtr->uNumTools;i++)
    1887       {
    1888         toolPtr = &infoPtr->tools[i];
    1889         if ((toolPtr->hinst) && (toolPtr->lpszText))
    1890         {
    1891           if (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) COMCTL32_Free(toolPtr->lpszText);
    1892         }
    1893 
    1894         /* remove subclassing */
    1895         TOOLTIPS_Desubclass(toolPtr);
    1896 
     1892    if (infoPtr->tools) {
     1893        for (i = 0; i < infoPtr->uNumTools; i++) {
     1894            toolPtr = &infoPtr->tools[i];
     1895            if ((toolPtr->hinst) && (toolPtr->lpszText)) {
     1896                if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
     1897                     (HIWORD((INT)toolPtr->lpszText) != 0) )
     1898                {
     1899                    COMCTL32_Free (toolPtr->lpszText);
     1900                    toolPtr->lpszText = NULL;
     1901                }
     1902            }
     1903
     1904            /* remove subclassing */
     1905            if (toolPtr->uFlags & TTF_SUBCLASS) {
     1906                LPTT_SUBCLASS_INFO lpttsi;
     1907
     1908                if (toolPtr->uFlags & TTF_IDISHWND)
     1909                    lpttsi = (LPTT_SUBCLASS_INFO)GetPropA ((HWND)toolPtr->uId, COMCTL32_aSubclass);
     1910                else
     1911                    lpttsi = (LPTT_SUBCLASS_INFO)GetPropA (toolPtr->hwnd, COMCTL32_aSubclass);
     1912
     1913                if (lpttsi) {
     1914                    SetWindowLongA ((HWND)toolPtr->uId, GWL_WNDPROC,
     1915                                      (LONG)lpttsi->wpOrigProc);
     1916                    RemovePropA ((HWND)toolPtr->uId, COMCTL32_aSubclass);
     1917                    COMCTL32_Free (&lpttsi);
     1918                }
     1919            }
    18971920      }
    18981921      COMCTL32_Free (infoPtr->tools);
Note: See TracChangeset for help on using the changeset viewer.