Ignore:
Timestamp:
Nov 9, 1999, 6:09:27 PM (26 years ago)
Author:
cbratschi
Message:

MoveTo fixes

File:
1 edited

Legend:

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

    r1614 r1668  
    1 /* $Id: treeview.c,v 1.14 1999-11-05 12:53:06 phaller Exp $ */
     1/* $Id: treeview.c,v 1.15 1999-11-09 17:09:27 cbratschi Exp $ */
    22/* Treeview control
    33 *
     
    496496{
    497497  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    498        
    499   TRACE("\n");
     498
     499  //TRACE("\n");
    500500  return (LRESULT) infoPtr->clrBk;
    501501}
     
    507507  COLORREF prevColor=infoPtr->clrBk;
    508508
    509   TRACE("\n");
     509  //TRACE("\n");
    510510  infoPtr->clrBk=(COLORREF) lParam;
    511511  return (LRESULT) prevColor;
     
    516516{
    517517  TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    518        
    519   TRACE("\n");
     518
     519  //TRACE("\n");
    520520  return (LRESULT) infoPtr->clrText;
    521521}
     
    948948{
    949949    TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(hwnd);
    950         TEXTMETRICA tm;
    951         HBRUSH hbrBk;
     950        TEXTMETRICA tm;
     951        HBRUSH hbrBk;
    952952    RECT rect;
    953         HDC hdc;
     953        HDC hdc;
    954954    INT iItem, indent, x, y, cx, height, itemHeight;
    955955    INT viewtop,viewbottom,viewleft,viewright;
    956956    TREEVIEW_ITEM *wineItem, *prevItem;
    957957
    958     TRACE("\n");
    959 
    960         hdc=GetDC (hwnd);
     958    //TRACE("\n");
     959
     960        hdc=GetDC (hwnd);
    961961
    962962    if (infoPtr->Timer & TV_REFRESH_TIMER_SET) {
    963                 KillTimer (hwnd, TV_REFRESH_TIMER);
    964                 infoPtr->Timer &= ~TV_REFRESH_TIMER_SET;
     963                KillTimer (hwnd, TV_REFRESH_TIMER);
     964                infoPtr->Timer &= ~TV_REFRESH_TIMER_SET;
    965965    }
    966966
     
    970970
    971971    infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
    972                                                 (hwnd, CDDS_PREPAINT, hdc, rect);
    973 
    974         if (infoPtr->cdmode==CDRF_SKIPDEFAULT) {
    975                   ReleaseDC (hwnd, hdc);
    976                   return;
    977         }
    978 
    979         infoPtr->uVisibleHeight= rect.bottom-rect.top;
    980         infoPtr->uVisibleWidth= rect.right-rect.left;
     972                                                (hwnd, CDDS_PREPAINT, hdc, rect);
     973
     974        if (infoPtr->cdmode==CDRF_SKIPDEFAULT) {
     975                  ReleaseDC (hwnd, hdc);
     976                  return;
     977        }
     978
     979        infoPtr->uVisibleHeight= rect.bottom-rect.top;
     980        infoPtr->uVisibleWidth= rect.right-rect.left;
    981981
    982982    viewtop=infoPtr->cy;
     
    996996    indent=0;
    997997    x=y=0;
    998     TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright);
     998    //TRACE("[%d %d %d %d]\n",viewtop,viewbottom,viewleft,viewright);
    999999
    10001000    while (iItem) {
    1001                 prevItem=wineItem;
     1001                prevItem=wineItem;
    10021002        wineItem= & infoPtr->items[iItem];
    1003                 wineItem->iLevel=indent;
     1003                wineItem->iLevel=indent;
    10041004
    10051005        ImageList_GetIconSize (infoPtr->himlNormal, &cx, &itemHeight);
    10061006        if (infoPtr->uItemHeight>itemHeight)
    1007                     itemHeight=infoPtr->uItemHeight;
    1008 
    1009             GetTextMetricsA (hdc, &tm);
    1010             if ((tm.tmHeight + tm.tmExternalLeading) > itemHeight)
    1011                      itemHeight=tm.tmHeight + tm.tmExternalLeading;
    1012 
    1013         infoPtr->uRealItemHeight=itemHeight;   
     1007                    itemHeight=infoPtr->uItemHeight;
     1008
     1009            GetTextMetricsA (hdc, &tm);
     1010            if ((tm.tmHeight + tm.tmExternalLeading) > itemHeight)
     1011                     itemHeight=tm.tmHeight + tm.tmExternalLeading;
     1012
     1013        infoPtr->uRealItemHeight=itemHeight;
    10141014
    10151015
    10161016/* FIXME: remove this in later stage  */
    10171017/*
    1018                 if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A)
    1019                 TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x,
    1020                         wineItem->rect.top, wineItem->rect.bottom,
    1021                         wineItem->rect.left, wineItem->rect.right,
    1022                         wineItem->pszText);
    1023                 else
    1024                 TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n",
    1025                                 wineItem->hItem,
    1026                                 wineItem->rect.top, wineItem->rect.bottom,
    1027                                 wineItem->rect.left, wineItem->rect.right);
     1018                if (wineItem->pszText!=LPSTR_TEXTCALLBACK32A)
     1019                TRACE (treeview, "%d %d [%d %d %d %d] (%s)\n",y,x,
     1020                        wineItem->rect.top, wineItem->rect.bottom,
     1021                        wineItem->rect.left, wineItem->rect.right,
     1022                        wineItem->pszText);
     1023                else
     1024                TRACE (treeview, "%d [%d %d %d %d] (CALLBACK)\n",
     1025                                wineItem->hItem,
     1026                                wineItem->rect.top, wineItem->rect.bottom,
     1027                                wineItem->rect.left, wineItem->rect.right);
    10281028*/
    10291029
    1030                 height=itemHeight * wineItem->iIntegral +1;
    1031                 if ((y >= viewtop) && (y <= viewbottom) &&
    1032                 (x >= viewleft  ) && (x <= viewright)) {
    1033                                 wineItem->visible = TRUE;
    1034                         wineItem->rect.top = y - infoPtr->cy + rect.top;
    1035                         wineItem->rect.bottom = wineItem->rect.top + height ;
    1036                         wineItem->rect.left = x - infoPtr->cx + rect.left;
    1037                         wineItem->rect.right = rect.right;
    1038                         if (!infoPtr->firstVisible)
    1039                                 infoPtr->firstVisible=wineItem->hItem;
    1040                 TREEVIEW_DrawItem (hwnd, hdc, wineItem);
    1041                 }
    1042                 else {
    1043                         wineItem->visible   = FALSE;
    1044                         wineItem->rect.left = wineItem->rect.top    = 0;
    1045                         wineItem->rect.right= wineItem->rect.bottom = 0;
    1046                         wineItem->text.left = wineItem->text.top    = 0;
    1047                         wineItem->text.right= wineItem->text.bottom = 0;
    1048                 }
    1049 
    1050                 /* look up next item */
    1051        
    1052                 if ((wineItem->firstChild) && (wineItem->state & TVIS_EXPANDED)) {
    1053                         iItem=(INT)wineItem->firstChild;
    1054                         indent++;
    1055                         x+=infoPtr->uIndent;
    1056                         if (x>infoPtr->uTotalWidth)     
    1057                                 infoPtr->uTotalWidth=x;
    1058                 }
    1059                 else {
    1060                         iItem=(INT)wineItem->sibling;
    1061                         while ((!iItem) && (indent>0)) {
    1062                                 indent--;
    1063                                 x-=infoPtr->uIndent;
    1064                                 prevItem=wineItem;
    1065                                 wineItem=&infoPtr->items[(INT)wineItem->parent];
    1066                                 iItem=(INT)wineItem->sibling;
    1067                         }
    1068                 }
     1030                height=itemHeight * wineItem->iIntegral +1;
     1031                if ((y >= viewtop) && (y <= viewbottom) &&
     1032                (x >= viewleft  ) && (x <= viewright)) {
     1033                                wineItem->visible = TRUE;
     1034                        wineItem->rect.top = y - infoPtr->cy + rect.top;
     1035                        wineItem->rect.bottom = wineItem->rect.top + height ;
     1036                        wineItem->rect.left = x - infoPtr->cx + rect.left;
     1037                        wineItem->rect.right = rect.right;
     1038                        if (!infoPtr->firstVisible)
     1039                                infoPtr->firstVisible=wineItem->hItem;
     1040                TREEVIEW_DrawItem (hwnd, hdc, wineItem);
     1041                }
     1042                else {
     1043                        wineItem->visible   = FALSE;
     1044                        wineItem->rect.left = wineItem->rect.top    = 0;
     1045                        wineItem->rect.right= wineItem->rect.bottom = 0;
     1046                        wineItem->text.left = wineItem->text.top    = 0;
     1047                        wineItem->text.right= wineItem->text.bottom = 0;
     1048                }
     1049
     1050                /* look up next item */
     1051
     1052                if ((wineItem->firstChild) && (wineItem->state & TVIS_EXPANDED)) {
     1053                        iItem=(INT)wineItem->firstChild;
     1054                        indent++;
     1055                        x+=infoPtr->uIndent;
     1056                        if (x>infoPtr->uTotalWidth)
     1057                                infoPtr->uTotalWidth=x;
     1058                }
     1059                else {
     1060                        iItem=(INT)wineItem->sibling;
     1061                        while ((!iItem) && (indent>0)) {
     1062                                indent--;
     1063                                x-=infoPtr->uIndent;
     1064                                prevItem=wineItem;
     1065                                wineItem=&infoPtr->items[(INT)wineItem->parent];
     1066                                iItem=(INT)wineItem->sibling;
     1067                        }
     1068                }
    10691069        y +=height;
    1070     }                           /* while */
     1070    }                           /* while */
    10711071
    10721072/* FIXME: infoPtr->uTotalWidth should also take item label into account */
     
    10751075    infoPtr->uTotalHeight=y;
    10761076    if (y >= (viewbottom-viewtop)) {
    1077                 if (!(infoPtr->uInternalStatus & TV_VSCROLL))
    1078                         ShowScrollBar (hwnd, SB_VERT, TRUE);
    1079                 infoPtr->uInternalStatus |=TV_VSCROLL;
    1080                 SetScrollRange (hwnd, SB_VERT, 0,
    1081                                         y - infoPtr->uVisibleHeight, FALSE);
    1082                 SetScrollPos (hwnd, SB_VERT, infoPtr->cy, TRUE);
    1083         }
     1077                if (!(infoPtr->uInternalStatus & TV_VSCROLL))
     1078                        ShowScrollBar (hwnd, SB_VERT, TRUE);
     1079                infoPtr->uInternalStatus |=TV_VSCROLL;
     1080                SetScrollRange (hwnd, SB_VERT, 0,
     1081                                        y - infoPtr->uVisibleHeight, FALSE);
     1082                SetScrollPos (hwnd, SB_VERT, infoPtr->cy, TRUE);
     1083        }
    10841084    else {
    1085                 if (infoPtr->uInternalStatus & TV_VSCROLL)
    1086                         ShowScrollBar (hwnd, SB_VERT, FALSE);
    1087                 infoPtr->uInternalStatus &= ~TV_VSCROLL;
    1088         }
    1089 
    1090 
    1091         if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
    1092         infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
    1093                                                                 (hwnd, CDDS_POSTPAINT, hdc, rect);
     1085                if (infoPtr->uInternalStatus & TV_VSCROLL)
     1086                        ShowScrollBar (hwnd, SB_VERT, FALSE);
     1087                infoPtr->uInternalStatus &= ~TV_VSCROLL;
     1088        }
     1089
     1090
     1091        if (infoPtr->cdmode & CDRF_NOTIFYPOSTPAINT)
     1092        infoPtr->cdmode=TREEVIEW_SendCustomDrawNotify
     1093                                                                (hwnd, CDDS_POSTPAINT, hdc, rect);
    10941094
    10951095    ReleaseDC (hwnd, hdc);
    1096     TRACE("done\n");
     1096    //TRACE("done\n");
    10971097}
    10981098
     
    14681468  if (!TREEVIEW_ValidItem(infoPtr, parent))
    14691469  {
    1470     ERR ("invalid item hParent=%x\n", (INT)parent);
     1470    //ERR ("invalid item hParent=%x\n", (INT)parent);
    14711471    return FALSE;
    14721472  }
     
    17321732     switch ((DWORD) ptdi->hInsertAfter) {
    17331733                case (DWORD) TVI_FIRST:
    1734                         if (sibItem==wineItem) break;
     1734                        if (sibItem==wineItem) break;
    17351735                        if (wineItem->parent) {
    17361736                                wineItem->sibling=parentItem->firstChild;
Note: See TracChangeset for help on using the changeset viewer.