Ignore:
Timestamp:
Mar 21, 2000, 6:30:46 PM (25 years ago)
Author:
cbratschi
Message:

bug fixes and improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/header.cpp

    r3154 r3182  
    1 /* $Id: header.cpp,v 1.3 2000-03-18 16:17:23 cbratschi Exp $ */
     1/* $Id: header.cpp,v 1.4 2000-03-21 17:30:41 cbratschi Exp $ */
    22/*
    33 *  Header control
     
    252252    {
    253253      UINT uTextJustify;
    254       WCHAR* pszText = phdi->pszText;
     254      WCHAR *pszText = phdi->pszText,*orgPtr;
    255255
    256256      if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)
     
    269269        if (isUnicodeNotify(&infoPtr->header))
    270270        {
    271           nmhdr.pszText    = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(WCHAR));
     271          orgPtr = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(WCHAR));
     272          nmhdr.pszText    = orgPtr;
    272273          if (nmhdr.pszText) nmhdr.pszText[0] = 0;
    273274        } else
    274275        {
    275           nmhdr.pszText    = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(CHAR));
     276          orgPtr = (WCHAR*)COMCTL32_Alloc(phdi->cchTextMax*sizeof(CHAR));
     277          nmhdr.pszText    = orgPtr;
    276278          if (nmhdr.pszText) ((LPSTR)nmhdr.pszText)[0] = 0;
    277279        }
     
    291293              lstrcpyW(phdi->pszText,pszText);
    292294            } else phdi->pszText = NULL;
    293             COMCTL32_Free(pszText);
     295            if (pszText == orgPtr) COMCTL32_Free(pszText);
    294296            pszText = phdi->pszText;
    295297          } else
     
    302304              lstrcpyAtoW(pszText,(LPSTR)nmhdr.pszText);
    303305            } else pszText = NULL;
    304             COMCTL32_Free(nmhdr.pszText);
    305 
    306             if (nmhdr.mask & HDI_DI_SETITEM)
    307               phdi->pszText = pszText;
     306            if (nmhdr.pszText == orgPtr) COMCTL32_Free(nmhdr.pszText);
     307
     308            phdi->pszText = pszText;
    308309          }
    309310        }
     
    329330        }
    330331      }
    331       if (phdi->pszText == LPSTR_TEXTCALLBACKW) COMCTL32_Free(pszText);
     332      if ((phdi->pszText == LPSTR_TEXTCALLBACKW) && (pszText == orgPtr)) COMCTL32_Free(pszText);
    332333    }
    333334
     
    16421643        HEADER_SendItemClick(hwnd,infoPtr->iMoveItem,0);
    16431644      }
    1644 //      TRACE (header, "Released item %d!\n", infoPtr->iMoveItem);
    16451645      infoPtr->bPressed = FALSE;
    16461646    } else if (infoPtr->bTracking)
    16471647    {
    1648 //      TRACE (header, "End tracking item %d!\n", infoPtr->iMoveItem);
    16491648      infoPtr->bTracking = FALSE;
    16501649
     
    16661665          {
    16671666            infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
     1667
     1668            HEADER_SetItemBounds (hwnd,infoPtr->iMoveItem);
     1669            HEADER_Refresh(hwnd);
    16681670            HEADER_SendItemChanged(hwnd,infoPtr->iMoveItem);
    1669 
    1670             HEADER_SetItemBounds (hwnd,infoPtr->iMoveItem);
    1671 
    1672             HEADER_Refresh(hwnd);
    16731671          }
    16741672        }
     
    18161814
    18171815        HEADER_SendTrack(hwnd,infoPtr->iMoveItem);
    1818 //          TRACE (header, "Tracking item %d!\n", infoPtr->iMoveItem);
    18191816      }
    18201817    }
Note: See TracChangeset for help on using the changeset viewer.