Changeset 5780 for trunk/src


Ignore:
Timestamp:
May 22, 2001, 3:35:04 PM (24 years ago)
Author:
sandervl
Message:

Listview: Send WM_MEASUREITEM for controls with LVS_OWNERDRAWFIXED style.

File:
1 edited

Legend:

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

    r5778 r5780  
    77 *
    88 * NOTES
    9  * Listview control implementation. 
     9 * Listview control implementation.
    1010 *
    1111 * TODO:
     
    1919 * Data structure:
    2020 *   LISTVIEW_SetItemCount : not completed for non OWNERDATA
    21  * 
     21 *
    2222 * Unicode:
    2323 *   LISTVIEW_SetItemW : no unicode support
     
    3030 *   LISTVIEW_GetNumberOfWorkAreas : not implemented
    3131 *   LISTVIEW_GetHotCursor : not implemented
    32  *   LISTVIEW_GetISearchString : not implemented 
     32 *   LISTVIEW_GetISearchString : not implemented
    3333 *   LISTVIEW_GetBkImage : not implemented
    3434 *   LISTVIEW_SetBkImage : not implemented
     
    3737 *   LISTVIEW_Arrange : empty stub
    3838 *   LISTVIEW_ApproximateViewRect : incomplete
    39  *   LISTVIEW_Scroll : not implemented 
     39 *   LISTVIEW_Scroll : not implemented
    4040 *   LISTVIEW_Update : not completed
    4141 */
     
    7171DEFAULT_DEBUG_CHANNEL(listview);
    7272
    73 /* Some definitions for inline edit control */   
     73/* Some definitions for inline edit control */
    7474typedef BOOL (*EditlblCallback)(HWND, LPSTR, DWORD);
    7575
     
    164164
    165165/*
    166  * constants 
     166 * constants
    167167 */
    168168
     
    190190
    191191/* default column width for items in list display mode */
    192 #define DEFAULT_COLUMN_WIDTH 96 
     192#define DEFAULT_COLUMN_WIDTH 96
    193193
    194194/* Increment size of the horizontal scroll bar */
     
    203203/* Border for the icon caption */
    204204#define CAPTION_BORDER  2
    205 /* 
     205/*
    206206 * macros
    207207 */
     
    213213#define GETITEMCOUNT(infoPtr) ((infoPtr)->hdpaItems->nItemCount)
    214214
    215 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 
    216         INT width, INT height, HWND parent, HINSTANCE hinst,
    217         EditlblCallback EditLblCb, DWORD param);
    218  
    219 /* 
    220  * forward declarations 
     215HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     216    INT width, INT height, HWND parent, HINSTANCE hinst,
     217    EditlblCallback EditLblCb, DWORD param);
     218
     219/*
     220 * forward declarations
    221221 */
    222222static LRESULT LISTVIEW_GetItemA(HWND hwnd, LPLVITEMA lpLVItem, BOOL internal);
     
    311311static BOOL
    312312LISTVIEW_SendCustomDrawItemNotify (HWND hwnd, HDC hdc,
    313                                    UINT iItem, UINT iSubItem, 
     313                                   UINT iItem, UINT iSubItem,
    314314                                   UINT uItemDrawState)
    315315{
     
    372372
    373373/*************************************************************************
    374  *              LISTVIEW_ProcessLetterKeys
    375  *
    376  *  Processes keyboard messages generated by pressing the letter keys 
     374 *      LISTVIEW_ProcessLetterKeys
     375 *
     376 *  Processes keyboard messages generated by pressing the letter keys
    377377 *  on the keyboard.
    378  *  What this does is perform a case insensitive search from the 
     378 *  What this does is perform a case insensitive search from the
    379379 *  current position with the following quirks:
    380  *  - If two chars or more are pressed in quick succession we search 
     380 *  - If two chars or more are pressed in quick succession we search
    381381 *    for the corresponding string (e.g. 'abc').
    382  *  - If there is a delay we wipe away the current search string and 
     382 *  - If there is a delay we wipe away the current search string and
    383383 *    restart with just that char.
    384  *  - If the user keeps pressing the same character, whether slowly or 
    385  *    fast, so that the search string is entirely composed of this 
    386  *    character ('aaaaa' for instance), then we search for first item 
     384 *  - If the user keeps pressing the same character, whether slowly or
     385 *    fast, so that the search string is entirely composed of this
     386 *    character ('aaaaa' for instance), then we search for first item
    387387 *    that starting with that character.
    388  *  - If the user types the above character in quick succession, then 
    389  *    we must also search for the corresponding string ('aaaaa'), and 
     388 *  - If the user types the above character in quick succession, then
     389 *    we must also search for the corresponding string ('aaaaa'), and
    390390 *    go to that string if there is a match.
    391391 *
     
    396396 * BUGS
    397397 *
    398  *  - The current implementation has a list of characters it will 
    399  *    accept and it ignores averything else. In particular it will 
    400  *    ignore accentuated characters which seems to match what 
    401  *    Windows does. But I'm not sure it makes sense to follow 
     398 *  - The current implementation has a list of characters it will
     399 *    accept and it ignores averything else. In particular it will
     400 *    ignore accentuated characters which seems to match what
     401 *    Windows does. But I'm not sure it makes sense to follow
    402402 *    Windows there.
    403403 *  - We don't sound a beep when the search fails.
     
    526526
    527527/*************************************************************************
    528  * LISTVIEW_UpdateHeaderSize [Internal] 
     528 * LISTVIEW_UpdateHeaderSize [Internal]
    529529 *
    530530 * Function to resize the header control
     
    567567/***
    568568 * DESCRIPTION:
    569  * Update the scrollbars. This functions should be called whenever 
     569 * Update the scrollbars. This functions should be called whenever
    570570 * the content, size or view changes.
    571  * 
     571 *
    572572 * PARAMETER(S):
    573573 * [I] HWND : window handle
     
    578578static VOID LISTVIEW_UpdateScroll(HWND hwnd)
    579579{
    580   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     580  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    581581  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    582582  UINT uView =  lStyle & LVS_TYPEMASK;
     
    619619    /* update horizontal scrollbar */
    620620    nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
    621     if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE 
     621    if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) == FALSE
    622622       || GETITEMCOUNT(infoPtr) == 0)
    623623    {
    624624      scrollInfo.nPos = 0;
    625     } 
     625    }
    626626    scrollInfo.nMin = 0;
    627     scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE  ; 
     627    scrollInfo.fMask = SIF_RANGE | SIF_POS | SIF_PAGE  ;
    628628    scrollInfo.nPage = nListWidth / LISTVIEW_SCROLL_DIV_SIZE;
    629629    scrollInfo.nMax = max(infoPtr->nItemWidth / LISTVIEW_SCROLL_DIV_SIZE, 0)-1;
    630     SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE); 
     630    SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    631631
    632632    /* Update the Header Control */
     
    679679 * Prints a message for unsupported window styles.
    680680 * A kind of TODO list for window styles.
    681  * 
     681 *
    682682 * PARAMETER(S):
    683683 * [I] LONG : window style
     
    732732 * DESCRIPTION:
    733733 * Aligns the items with the top edge of the window.
    734  * 
     734 *
    735735 * PARAMETER(S):
    736736 * [I] HWND : window handle
     
    747747  RECT rcView;
    748748  INT i;
    749  
     749
    750750  if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    751751  {
    752752    ZeroMemory(&ptItem, sizeof(POINT));
    753753    ZeroMemory(&rcView, sizeof(RECT));
    754    
     754
    755755    if (nListWidth > infoPtr->nItemWidth)
    756756    {
     
    762762          ptItem.y += infoPtr->nItemHeight;
    763763        }
    764        
     764
    765765        ListView_SetItemPosition(hwnd, i, ptItem.x, ptItem.y);
    766766        ptItem.x += infoPtr->nItemWidth;
     
    789789 * DESCRIPTION:
    790790 * Aligns the items with the left edge of the window.
    791  * 
     791 *
    792792 * PARAMETER(S):
    793793 * [I] HWND : window handle
     
    804804  RECT rcView;
    805805  INT i;
    806  
     806
    807807  if ((uView == LVS_SMALLICON) || (uView == LVS_ICON))
    808808  {
     
    846846 * DESCRIPTION:
    847847 * Set the bounding rectangle of all the items.
    848  * 
     848 *
    849849 * PARAMETER(S):
    850850 * [I] HWND : window handle
     
    860860  BOOL bResult = FALSE;
    861861
    862   TRACE("(hwnd=%x, left=%d, top=%d, right=%d, bottom=%d)\n", hwnd, 
     862  TRACE("(hwnd=%x, left=%d, top=%d, right=%d, bottom=%d)\n", hwnd,
    863863        lprcView->left, lprcView->top, lprcView->right, lprcView->bottom);
    864  
     864
    865865  if (lprcView != NULL)
    866866  {
     
    878878 * DESCRIPTION:
    879879 * Retrieves the bounding rectangle of all the items.
    880  * 
     880 *
    881881 * PARAMETER(S):
    882882 * [I] HWND : window handle
     
    906906    }
    907907
    908     TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n", 
     908    TRACE("(left=%d, top=%d, right=%d, bottom=%d)\n",
    909909          lprcView->left, lprcView->top, lprcView->right, lprcView->bottom);
    910910  }
     
    916916 * DESCRIPTION:
    917917 * Retrieves the subitem pointer associated with the subitem index.
    918  * 
     918 *
    919919 * PARAMETER(S):
    920920 * [I] HDPA : DPA handle for a specific item
     
    925925 *   FAILURE : NULL
    926926 */
    927 static LISTVIEW_SUBITEM* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, 
     927static LISTVIEW_SUBITEM* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems,
    928928                                                INT nSubItem)
    929929{
     
    949949 * DESCRIPTION:
    950950 * Calculates the width of an item.
    951  * 
     951 *
    952952 * PARAMETER(S):
    953953 * [I] HWND : window handle
     
    960960{
    961961  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    962   LONG style = GetWindowLongA(hwnd, GWL_STYLE); 
    963   UINT uView = style & LVS_TYPEMASK; 
     962  LONG style = GetWindowLongA(hwnd, GWL_STYLE);
     963  UINT uView = style & LVS_TYPEMASK;
    964964  INT nHeaderItemCount;
    965965  RECT rcHeaderItem;
     
    989989  {
    990990    for (i = 0; i < GETITEMCOUNT(infoPtr); i++)
    991     { 
     991    {
    992992      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, i);
    993993      nItemWidth = max(nItemWidth, nLabelWidth);
    994994    }
    995    
     995
    996996    /* default label size */
    997997    if (GETITEMCOUNT(infoPtr) == 0)
     
    10091009        /* add padding */
    10101010        nItemWidth += WIDTH_PADDING;
    1011      
     1011
    10121012        if (infoPtr->himlSmall != NULL)
    10131013        {
     
    10331033 * DESCRIPTION:
    10341034 * Calculates the width of a specific item.
    1035  * 
    1036  * PARAMETER(S):
    1037  * [I] HWND : window handle
    1038  * [I] LPSTR : string 
     1035 *
     1036 * PARAMETER(S):
     1037 * [I] HWND : window handle
     1038 * [I] LPSTR : string
    10391039 *
    10401040 * RETURN:
     
    10881088        /* add padding */
    10891089        nItemWidth += WIDTH_PADDING;
    1090      
     1090
    10911091        if (infoPtr->himlSmall != NULL)
    10921092        {
     
    11011101    }
    11021102  }
    1103  
     1103
    11041104  return nItemWidth;
    11051105}
     
    11081108 * DESCRIPTION:
    11091109 * Calculates the height of an item.
    1110  * 
     1110 *
    11111111 * PARAMETER(S):
    11121112 * [I] HWND : window handle
     
    11191119{
    11201120  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     1121#ifdef __WIN32OS2__
     1122  DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     1123  UINT uView = dwStyle & LVS_TYPEMASK;
     1124#else
    11211125  UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;
     1126#endif
    11221127  INT nItemHeight = 0;
    11231128
     
    11281133  else
    11291134  {
    1130     TEXTMETRICA tm; 
     1135    TEXTMETRICA tm;
    11311136    HDC hdc = GetDC(hwnd);
    11321137    HFONT hOldFont = SelectObject(hdc, infoPtr->hFont);
     
    11401145    SelectObject(hdc, hOldFont);
    11411146    ReleaseDC(hwnd, hdc);
     1147#ifdef __WIN32OS2__
     1148    if(dwStyle & LVS_OWNERDRAWFIXED) {
     1149        /* Get item height */
     1150
     1151        MEASUREITEMSTRUCT mis;
     1152        UINT              id = GetWindowLongA(hwnd,GWL_ID);
     1153
     1154        mis.CtlType    = ODT_LISTVIEW;
     1155        mis.CtlID      = id;
     1156        mis.itemID     = 0;
     1157        mis.itemData   = 0;     //TODO:!!!!
     1158        mis.itemHeight = nItemHeight;
     1159        SendMessageA(GetParent(hwnd), WM_MEASUREITEM, id, (LPARAM)&mis );
     1160        nItemHeight = mis.itemHeight;
     1161    }
     1162#endif
    11421163  }
    11431164
     
    11751196 * 0 : if Item 1 == Item 2
    11761197 */
    1177 static INT CALLBACK LISTVIEW_CompareSelectionRanges(LPVOID range1, LPVOID range2, 
     1198static INT CALLBACK LISTVIEW_CompareSelectionRanges(LPVOID range1, LPVOID range2,
    11781199                                                    LPARAM flags)
    11791200{
     
    11811202  int l2 = ((LISTVIEW_SELECTION*)(range2))->lower;
    11821203  int u1 = ((LISTVIEW_SELECTION*)(range1))->upper;
    1183   int u2 = ((LISTVIEW_SELECTION*)(range2))->upper; 
     1204  int u2 = ((LISTVIEW_SELECTION*)(range2))->upper;
    11841205  int rc=0;
    11851206
    11861207  if (u1 < l2)
    11871208    rc= -1;
    1188  
     1209
    11891210  if (u2 < l1)
    11901211     rc= 1;
     
    11961217* DESCRIPTION:
    11971218* Adds a selection range.
    1198 * 
     1219*
    11991220* PARAMETER(S):
    12001221* [I] HWND : window handle
    12011222* [I] INT : lower item index
    1202 * [I] INT : upper item index 
     1223* [I] INT : upper item index
    12031224*
    12041225* RETURN:
     
    12341255                      LISTVIEW_CompareSelectionRanges,
    12351256                      0,0);
    1236    selection->upper --; 
     1257   selection->upper --;
    12371258   if (lowerzero)
    12381259     lowerzero=FALSE;
     
    12451266     TRACE("Merge with index %i (%lu - %lu)\n",index,checkselection->lower,
    12461267           checkselection->upper);
    1247      
     1268
    12481269     checkselection->lower = min(selection->lower,checkselection->lower);
    12491270     checkselection->upper = max(selection->upper,checkselection->upper);
    1250    
    1251      TRACE("New range (%lu - %lu)\n", checkselection->lower, 
     1271
     1272     TRACE("New range (%lu - %lu)\n", checkselection->lower,
    12521273           checkselection->upper);
    12531274
    1254      COMCTL32_Free(selection);   
    1255  
     1275     COMCTL32_Free(selection);
     1276
    12561277     /* merge now common selection ranges in the lower group*/
    12571278     do
    12581279     {
    1259         checkselection->upper ++; 
     1280        checkselection->upper ++;
    12601281        if (checkselection->lower == 0)
    12611282          lowerzero = TRUE;
     
    12631284          checkselection->lower --;
    12641285
    1265         TRACE("search lower range (%lu - %lu)\n", checkselection->lower, 
     1286        TRACE("search lower range (%lu - %lu)\n", checkselection->lower,
    12661287              checkselection->upper);
    12671288
     
    12711292                                0);
    12721293
    1273         checkselection->upper --; 
     1294        checkselection->upper --;
    12741295        if (lowerzero)
    12751296          lowerzero = FALSE;
    12761297        else
    1277           checkselection->lower ++;
    1278 
    1279         if (mergeindex >=0  && mergeindex != index)
    1280         {
    1281           TRACE("Merge with index %i\n",mergeindex);
     1298      checkselection->lower ++;
     1299
     1300    if (mergeindex >=0  && mergeindex != index)
     1301        {
     1302      TRACE("Merge with index %i\n",mergeindex);
    12821303          checkselection2 = DPA_GetPtr(infoPtr->hdpaSelectionRanges,
    12831304                                       mergeindex);
    1284           checkselection->lower = min(checkselection->lower, 
     1305          checkselection->lower = min(checkselection->lower,
    12851306                                      checkselection2->lower);
    12861307          checkselection->upper = max(checkselection->upper,
     
    12991320       if (checkselection->lower == 0)
    13001321         lowerzero = TRUE;
    1301        else 
     1322       else
    13021323         checkselection->lower --;
    13031324
    1304        TRACE("search upper range %i (%lu - %lu)\n",index, 
     1325       TRACE("search upper range %i (%lu - %lu)\n",index,
    13051326             checkselection->lower, checkselection->upper);
    13061327
     
    13081329       mergeindex = DPA_Search(infoPtr->hdpaSelectionRanges, checkselection,
    13091330                               index+1,
    1310                                LISTVIEW_CompareSelectionRanges, 0,
    1311                                0);
    1312 
    1313        checkselection->upper --; 
     1331                   LISTVIEW_CompareSelectionRanges, 0,
     1332                   0);
     1333
     1334       checkselection->upper --;
    13141335       if (lowerzero)
    13151336         lowerzero = FALSE;
     
    13191340       if (mergeindex >=0 && mergeindex !=index)
    13201341       {
    1321         TRACE("Merge with index %i\n",mergeindex);
    1322         checkselection2 = DPA_GetPtr(infoPtr->hdpaSelectionRanges,
    1323                                       mergeindex);
    1324          checkselection->lower = min(checkselection->lower,
    1325                                      checkselection2->lower);
    1326         checkselection->upper = max(checkselection->upper,
    1327                                      checkselection2->upper);
    1328         COMCTL32_Free(checkselection2);
    1329         DPA_DeletePtr(infoPtr->hdpaSelectionRanges,mergeindex);
     1342    TRACE("Merge with index %i\n",mergeindex);
     1343    checkselection2 = DPA_GetPtr(infoPtr->hdpaSelectionRanges,
     1344                      mergeindex);
     1345     checkselection->lower = min(checkselection->lower,
     1346                     checkselection2->lower);
     1347    checkselection->upper = max(checkselection->upper,
     1348                     checkselection2->upper);
     1349    COMCTL32_Free(checkselection2);
     1350    DPA_DeletePtr(infoPtr->hdpaSelectionRanges,mergeindex);
    13301351       }
    13311352    }
     
    13361357
    13371358     index = DPA_Search(infoPtr->hdpaSelectionRanges, selection, 0,
    1338                        LISTVIEW_CompareSelectionRanges, 0, 
     1359                       LISTVIEW_CompareSelectionRanges, 0,
    13391360                       DPAS_INSERTAFTER);
    13401361
     
    13421363     if (index == -1)
    13431364       index = 0;
    1344      DPA_InsertPtr(infoPtr->hdpaSelectionRanges,index,selection); 
     1365     DPA_InsertPtr(infoPtr->hdpaSelectionRanges,index,selection);
    13451366   }
    1346  } 
     1367 }
    13471368 else
    13481369 {
     
    13501371 }
    13511372 /*
    1352   * Incase of error 
     1373  * Incase of error
    13531374  */
    13541375 DPA_Sort(infoPtr->hdpaSelectionRanges,LISTVIEW_CompareSelectionRanges,0);
     
    13591380* DESCRIPTION:
    13601381* check if a specified index is selected.
    1361 * 
     1382*
    13621383* PARAMETER(S):
    13631384* [I] HWND : window handle
    1364 * [I] INT : item index 
     1385* [I] INT : item index
    13651386*
    13661387* RETURN:
     
    14021423  INT i;
    14031424  LVITEMA item;
    1404  
     1425
    14051426  TRACE("(0x%x)\n",hwnd);
    14061427
     
    14181439      LISTVIEW_RemoveSelectionRange(hwnd,selection->lower,selection->upper);
    14191440    }
    1420   } 
     1441  }
    14211442  while (infoPtr->hdpaSelectionRanges->nItemCount>0);
    14221443
    14231444  TRACE("done\n");
    1424   return TRUE; 
     1445  return TRUE;
    14251446}
    14261447
     
    14281449* DESCRIPTION:
    14291450* Removes a range selections.
    1430 * 
     1451*
    14311452* PARAMETER(S):
    14321453* [I] HWND : window handle
    14331454* [I] INT : lower item index
    1434 * [I] INT : upper item index 
     1455* [I] INT : upper item index
    14351456*
    14361457* RETURN:
     
    14521473                     LISTVIEW_CompareSelectionRanges,
    14531474                     0,0);
    1454  
     1475
    14551476  if (index == -1)
    14561477    return;
    14571478
    1458  
     1479
    14591480  checkselection = DPA_GetPtr(infoPtr->hdpaSelectionRanges,
    14601481                              index);
     
    14641485
    14651486  /* case 1: Same */
    1466   if ((checkselection->upper == removeselection.upper) && 
     1487  if ((checkselection->upper == removeselection.upper) &&
    14671488     (checkselection->lower == removeselection.lower))
    14681489  {
     
    14711492  }
    14721493  /* case 2: engulf */
    1473   else if (((checkselection->upper < removeselection.upper) && 
     1494  else if (((checkselection->upper < removeselection.upper) &&
    14741495      (checkselection->lower > removeselection.lower))||
    14751496     ((checkselection->upper <= removeselection.upper) &&
     
    15091530    /* bisect the range */
    15101531    LISTVIEW_SELECTION *newselection;
    1511    
     1532
    15121533    newselection = (LISTVIEW_SELECTION *)
    15131534                          COMCTL32_Alloc(sizeof(LISTVIEW_SELECTION));
     
    15251546* DESCRIPTION:
    15261547* Updates the various indices after an item has been inserted or deleted.
    1527 * 
     1548*
    15281549* PARAMETER(S):
    15291550* [I] HWND : window handle
    1530 * [I] INT : item index 
     1551* [I] INT : item index
    15311552* [I] INT : Direction of shift, +1 or -1.
    15321553*
     
    15491570                     0,DPAS_SORTED|DPAS_INSERTAFTER);
    15501571
    1551   while ((index < infoPtr->hdpaSelectionRanges->nItemCount)&&(index != -1)) 
     1572  while ((index < infoPtr->hdpaSelectionRanges->nItemCount)&&(index != -1))
    15521573  {
    15531574    checkselection = DPA_GetPtr(infoPtr->hdpaSelectionRanges,index);
     
    15931614 * DESCRIPTION:
    15941615 * Adds a block of selections.
    1595  * 
    1596  * PARAMETER(S):
    1597  * [I] HWND : window handle
    1598  * [I] INT : item index 
     1616 *
     1617 * PARAMETER(S):
     1618 * [I] HWND : window handle
     1619 * [I] INT : item index
    15991620 *
    16001621 * RETURN:
     
    16291650 * DESCRIPTION:
    16301651 * Adds a single selection.
    1631  * 
    1632  * PARAMETER(S):
    1633  * [I] HWND : window handle
    1634  * [I] INT : item index 
     1652 *
     1653 * PARAMETER(S):
     1654 * [I] HWND : window handle
     1655 * [I] INT : item index
    16351656 *
    16361657 * RETURN:
     
    16551676 * DESCRIPTION:
    16561677 * Selects or unselects an item.
    1657  * 
    1658  * PARAMETER(S):
    1659  * [I] HWND : window handle
    1660  * [I] INT : item index 
    1661  *
    1662  * RETURN:
    1663  *   SELECT: TRUE 
     1678 *
     1679 * PARAMETER(S):
     1680 * [I] HWND : window handle
     1681 * [I] INT : item index
     1682 *
     1683 * RETURN:
     1684 *   SELECT: TRUE
    16641685 *   UNSELECT : FALSE
    16651686 */
     
    16751696  if (LISTVIEW_IsSelected(hwnd,nItem))
    16761697  {
    1677  
     1698
    16781699    LISTVIEW_SetItemState(hwnd,nItem,&item);
    16791700    bResult = FALSE;
     
    16941715/***
    16951716 * DESCRIPTION:
    1696  * Selects items based on view coordinates. 
    1697  * 
    1698  * PARAMETER(S):
    1699  * [I] HWND : window handle
    1700  * [I] RECT : selection rectangle 
     1717 * Selects items based on view coordinates.
     1718 *
     1719 * PARAMETER(S):
     1720 * [I] HWND : window handle
     1721 * [I] RECT : selection rectangle
    17011722 *
    17021723 * RETURN:
     
    17331754 * DESCRIPTION:
    17341755 * Sets a single group selection.
    1735  * 
    1736  * PARAMETER(S):
    1737  * [I] HWND : window handle
    1738  * [I] INT : item index 
    1739  *
    1740  * RETURN:
    1741  * None 
     1756 *
     1757 * PARAMETER(S):
     1758 * [I] HWND : window handle
     1759 * [I] INT : item index
     1760 *
     1761 * RETURN:
     1762 * None
    17421763 */
    17431764static VOID LISTVIEW_SetGroupSelection(HWND hwnd, INT nItem)
     
    17991820 * DESCRIPTION:
    18001821 * Manages the item focus.
    1801  * 
    1802  * PARAMETER(S):
    1803  * [I] HWND : window handle
    1804  * [I] INT : item index 
     1822 *
     1823 * PARAMETER(S):
     1824 * [I] HWND : window handle
     1825 * [I] INT : item index
    18051826 *
    18061827 * RETURN:
     
    18231844      ZeroMemory(&lvItem, sizeof(LVITEMA));
    18241845      lvItem.stateMask = LVIS_FOCUSED;
    1825       ListView_SetItemState(hwnd, oldFocus, &lvItem); 
     1846      ListView_SetItemState(hwnd, oldFocus, &lvItem);
    18261847
    18271848    }
     
    18341855    ListView_EnsureVisible(hwnd, nItem, FALSE);
    18351856  }
    1836  
    1837   return bResult; 
     1857
     1858  return bResult;
    18381859}
    18391860
     
    18411862 * DESCRIPTION:
    18421863 * Sets a single selection.
    1843  * 
    1844  * PARAMETER(S):
    1845  * [I] HWND : window handle
    1846  * [I] INT : item index 
     1864 *
     1865 * PARAMETER(S):
     1866 * [I] HWND : window handle
     1867 * [I] INT : item index
    18471868 *
    18481869 * RETURN:
     
    18561877  ZeroMemory(&lvItem, sizeof(LVITEMA));
    18571878  lvItem.stateMask = LVIS_FOCUSED;
    1858   ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem); 
     1879  ListView_SetItemState(hwnd, infoPtr->nFocusedItem, &lvItem);
    18591880
    18601881  LISTVIEW_RemoveAllSelections(hwnd);
     
    18711892 * DESCRIPTION:
    18721893 * Set selection(s) with keyboard.
    1873  * 
    1874  * PARAMETER(S):
    1875  * [I] HWND : window handle
    1876  * [I] INT : item index 
     1894 *
     1895 * PARAMETER(S):
     1896 * [I] HWND : window handle
     1897 * [I] INT : item index
    18771898 *
    18781899 * RETURN:
     
    18931914    {
    18941915      bResult = TRUE;
    1895       LISTVIEW_SetSelection(hwnd, nItem); 
     1916      LISTVIEW_SetSelection(hwnd, nItem);
    18961917      ListView_EnsureVisible(hwnd, nItem, FALSE);
    18971918    }
     
    19011922      {
    19021923        bResult = TRUE;
    1903         LISTVIEW_SetGroupSelection(hwnd, nItem); 
     1924        LISTVIEW_SetGroupSelection(hwnd, nItem);
    19041925      }
    19051926      else if (wCtrl)
     
    19101931      {
    19111932        bResult = TRUE;
    1912         LISTVIEW_SetSelection(hwnd, nItem); 
     1933        LISTVIEW_SetSelection(hwnd, nItem);
    19131934        ListView_EnsureVisible(hwnd, nItem, FALSE);
    19141935      }
     
    19351956 * LVS_EX_TRACKSELECT: An item is automatically selected when the cursor remains
    19361957 * over the item for a certain period of time.
    1937  * 
     1958 *
    19381959 */
    19391960static LRESULT LISTVIEW_MouseHover(HWND hwnd, WPARAM wParam, LPARAM lParam)
     
    19691990  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    19701991  TRACKMOUSEEVENT trackinfo;
    1971  
     1992
    19721993  /* see if we are supposed to be tracking mouse hovering */
    19731994  if(infoPtr->dwExStyle & LVS_EX_TRACKSELECT) {
     
    19882009    }
    19892010  }
    1990  
     2011
    19912012  return 0;
    19922013}
     
    19952016 * DESCRIPTION:
    19962017 * Selects an item based on coordinates.
    1997  * 
     2018 *
    19982019 * PARAMETER(S):
    19992020 * [I] HWND : window handle
     
    20152036  if (uView == LVS_REPORT)
    20162037  {
    2017     bottomindex = topindex + LISTVIEW_GetCountPerColumn(hwnd) + 1; 
     2038    bottomindex = topindex + LISTVIEW_GetCountPerColumn(hwnd) + 1;
    20182039    bottomindex = min(bottomindex,GETITEMCOUNT(infoPtr));
    20192040  }
     
    20232044  }
    20242045
    2025   for (i = topindex; i < bottomindex; i++) 
     2046  for (i = topindex; i < bottomindex; i++)
    20262047  {
    20272048    rcItem.left = LVIR_SELECTBOUNDS;
     
    20412062 * DESCRIPTION:
    20422063 * Removes a column.
    2043  * 
     2064 *
    20442065 * PARAMETER(S):
    20452066 * [IO] HDPA : dynamic pointer array handle
     
    20672088    }
    20682089  }
    2069    
     2090
    20702091  return bResult;
    20712092}
     
    20742095 * DESCRIPTION:
    20752096 * Removes a subitem at a given position.
    2076  * 
     2097 *
    20772098 * PARAMETER(S):
    20782099 * [IO] HDPA : dynamic pointer array handle
     
    20962117      {
    20972118        /* free string */
    2098         if ((lpSubItem->pszText != NULL) && 
     2119        if ((lpSubItem->pszText != NULL) &&
    20992120            (lpSubItem->pszText != LPSTR_TEXTCALLBACKA))
    21002121        {
    21012122          COMCTL32_Free(lpSubItem->pszText);
    21022123        }
    2103        
     2124
    21042125        /* free item */
    21052126        COMCTL32_Free(lpSubItem);
     
    21162137      }
    21172138    }
    2118   }   
    2119  
     2139  }
     2140
    21202141  return TRUE;
    21212142}
     
    21242145 * DESCRIPTION:
    21252146 * Compares the item information.
    2126  * 
    2127  * PARAMETER(S):
    2128  * [I] LISTVIEW_ITEM *: destination item 
    2129  * [I] LPLVITEM : source item 
     2147 *
     2148 * PARAMETER(S):
     2149 * [I] LISTVIEW_ITEM *: destination item
     2150 * [I] LPLVITEM : source item
    21302151 *
    21312152 * RETURN:
     
    21412162    if (lpLVItem->mask & LVIF_STATE)
    21422163    {
    2143       if ((lpItem->state & lpLVItem->stateMask) != 
     2164      if ((lpItem->state & lpLVItem->stateMask) !=
    21442165          (lpLVItem->state & lpLVItem->stateMask))
    21452166      {
    2146         uChanged |= LVIF_STATE; 
     2167        uChanged |= LVIF_STATE;
    21472168      }
    21482169    }
     
    21522173      if (lpItem->iImage != lpLVItem->iImage)
    21532174      {
    2154         uChanged |= LVIF_IMAGE; 
    2155       }
    2156     }
    2157  
     2175        uChanged |= LVIF_IMAGE;
     2176      }
     2177    }
     2178
    21582179    if (lpLVItem->mask & LVIF_PARAM)
    21592180    {
    21602181      if (lpItem->lParam != lpLVItem->lParam)
    21612182      {
    2162         uChanged |= LVIF_PARAM; 
    2163       }
    2164     }
    2165    
     2183        uChanged |= LVIF_PARAM;
     2184      }
     2185    }
     2186
    21662187    if (lpLVItem->mask & LVIF_INDENT)
    21672188    {
    21682189      if (lpItem->iIndent != lpLVItem->iIndent)
    21692190      {
    2170         uChanged |= LVIF_INDENT; 
    2171       }
    2172     }
    2173 
    2174     if (lpLVItem->mask & LVIF_TEXT) 
    2175     {
    2176       if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 
     2191        uChanged |= LVIF_INDENT;
     2192      }
     2193    }
     2194
     2195    if (lpLVItem->mask & LVIF_TEXT)
     2196    {
     2197      if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA)
    21772198      {
    21782199        if (lpItem->pszText != LPSTR_TEXTCALLBACKA)
    21792200        {
    2180           uChanged |= LVIF_TEXT; 
     2201          uChanged |= LVIF_TEXT;
    21812202        }
    21822203      }
     
    21852206        if (lpItem->pszText == LPSTR_TEXTCALLBACKA)
    21862207        {
    2187           uChanged |= LVIF_TEXT; 
    2188         }
    2189         else
    2190         {
    2191           if (lpLVItem->pszText)
    2192           {
    2193             if (lpItem->pszText)
    2194             {
    2195               if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0)
    2196               {
    2197                 uChanged |= LVIF_TEXT;
    2198               }
    2199             }
    2200             else
    2201             {
    2202               uChanged |= LVIF_TEXT;
    2203             }
    2204           }
    2205           else
    2206           {
    2207             if (lpItem->pszText)
    2208             {
    2209               uChanged |= LVIF_TEXT;
    2210             }
    2211           }
    2212         }
     2208          uChanged |= LVIF_TEXT;
     2209        }
     2210    else
     2211    {
     2212      if (lpLVItem->pszText)
     2213      {
     2214        if (lpItem->pszText)
     2215        {
     2216          if (strcmp(lpLVItem->pszText, lpItem->pszText) != 0)
     2217          {
     2218        uChanged |= LVIF_TEXT;
     2219          }
     2220        }
     2221        else
     2222        {
     2223          uChanged |= LVIF_TEXT;
     2224        }
     2225      }
     2226      else
     2227      {
     2228        if (lpItem->pszText)
     2229        {
     2230          uChanged |= LVIF_TEXT;
     2231        }
     2232      }
     2233    }
    22132234      }
    22142235    }
     
    22202241 * DESCRIPTION:
    22212242 * Initializes item attributes.
    2222  * 
    2223  * PARAMETER(S):
    2224  * [I] HWND : window handle
    2225  * [O] LISTVIEW_ITEM *: destination item 
    2226  * [I] LPLVITEM : source item 
     2243 *
     2244 * PARAMETER(S):
     2245 * [I] HWND : window handle
     2246 * [O] LISTVIEW_ITEM *: destination item
     2247 * [I] LPLVITEM : source item
    22272248 *
    22282249 * RETURN:
     
    22302251 *   FAILURE : FALSE
    22312252 */
    2232 static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem, 
     2253static BOOL LISTVIEW_InitItem(HWND hwnd, LISTVIEW_ITEM *lpItem,
    22332254                              LPLVITEMA lpLVItem)
    22342255{
     
    22392260  {
    22402261    bResult = TRUE;
    2241    
     2262
    22422263    if (lpLVItem->mask & LVIF_STATE)
    22432264    {
     
    22452266      lpItem->state |= (lpLVItem->state & lpLVItem->stateMask);
    22462267    }
    2247    
     2268
    22482269    if (lpLVItem->mask & LVIF_IMAGE)
    22492270    {
    22502271      lpItem->iImage = lpLVItem->iImage;
    22512272    }
    2252  
     2273
    22532274    if (lpLVItem->mask & LVIF_PARAM)
    22542275    {
    22552276      lpItem->lParam = lpLVItem->lParam;
    22562277    }
    2257    
     2278
    22582279    if (lpLVItem->mask & LVIF_INDENT)
    22592280    {
     
    22612282    }
    22622283
    2263     if (lpLVItem->mask & LVIF_TEXT) 
    2264     {
    2265       if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 
     2284    if (lpLVItem->mask & LVIF_TEXT)
     2285    {
     2286      if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA)
    22662287      {
    22672288        if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING))
     
    22702291        }
    22712292
    2272         if ((lpItem->pszText != NULL) && 
     2293        if ((lpItem->pszText != NULL) &&
    22732294            (lpItem->pszText != LPSTR_TEXTCALLBACKA))
    22742295        {
    22752296          COMCTL32_Free(lpItem->pszText);
    22762297        }
    2277    
     2298
    22782299        lpItem->pszText = LPSTR_TEXTCALLBACKA;
    22792300      }
    2280       else 
     2301      else
    22812302      {
    22822303        if (lpItem->pszText == LPSTR_TEXTCALLBACKA)
     
    22842305          lpItem->pszText = NULL;
    22852306        }
    2286        
     2307
    22872308        bResult = Str_SetPtrA(&lpItem->pszText, lpLVItem->pszText);
    22882309      }
     
    23092330 *   FAILURE : FALSE
    23102331 */
    2311 static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem, 
     2332static BOOL LISTVIEW_InitSubItem(HWND hwnd, LISTVIEW_SUBITEM *lpSubItem,
    23122333                                   LPLVITEMA lpLVItem)
    23132334{
    23142335  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    23152336  BOOL bResult = FALSE;
    2316  
     2337
    23172338  if ((lpSubItem != NULL) && (lpLVItem != NULL))
    23182339  {
     
    23272348        lpSubItem->iImage = lpLVItem->iImage;
    23282349      }
    2329      
    2330       if (lpLVItem->mask & LVIF_TEXT) 
    2331       {
    2332         if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA) 
     2350
     2351      if (lpLVItem->mask & LVIF_TEXT)
     2352      {
     2353        if (lpLVItem->pszText == LPSTR_TEXTCALLBACKA)
    23332354        {
    23342355          if ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING))
    23352356          {
    23362357            return FALSE;
    2337           } 
    2338 
    2339           if ((lpSubItem->pszText != NULL) && 
     2358          }
     2359
     2360          if ((lpSubItem->pszText != NULL) &&
    23402361              (lpSubItem->pszText != LPSTR_TEXTCALLBACKA))
    23412362          {
    23422363            COMCTL32_Free(lpSubItem->pszText);
    23432364          }
    2344    
     2365
    23452366          lpSubItem->pszText = LPSTR_TEXTCALLBACKA;
    23462367        }
    2347         else 
     2368        else
    23482369        {
    23492370          if (lpSubItem->pszText == LPSTR_TEXTCALLBACKA)
     
    23512372            lpSubItem->pszText = NULL;
    23522373          }
    2353        
     2374
    23542375          bResult = Str_SetPtrA(&lpSubItem->pszText, lpLVItem->pszText);
    23552376        }
     
    23642385 * DESCRIPTION:
    23652386 * Adds a subitem at a given position (column index).
    2366  * 
    2367  * PARAMETER(S):
    2368  * [I] HWND : window handle
    2369  * [I] LPLVITEM : new subitem atttributes 
     2387 *
     2388 * PARAMETER(S):
     2389 * [I] HWND : window handle
     2390 * [I] LPLVITEM : new subitem atttributes
    23702391 *
    23712392 * RETURN:
     
    23932414      if (lpSubItem != NULL)
    23942415      {
    2395         ZeroMemory(lpSubItem, sizeof(LISTVIEW_SUBITEM));
     2416    ZeroMemory(lpSubItem, sizeof(LISTVIEW_SUBITEM));
    23962417        if (LISTVIEW_InitSubItem(hwnd, lpSubItem, lpLVItem) != FALSE)
    23972418        {
    2398           nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems, 
     2419          nPosition = LISTVIEW_FindInsertPosition(hdpaSubItems,
    23992420                                                  lpSubItem->iSubItem);
    24002421          nItem = DPA_InsertPtr(hdpaSubItems, nPosition, lpSubItem);
     
    24022423          {
    24032424            bResult = TRUE;
    2404           }           
    2405         }
    2406       }
    2407     }
    2408   }
    2409  
    2410   /* cleanup if unsuccessful */   
     2425          }
     2426        }
     2427      }
     2428    }
     2429  }
     2430
     2431  /* cleanup if unsuccessful */
    24112432  if ((bResult == FALSE) && (lpSubItem != NULL))
    24122433  {
    24132434    COMCTL32_Free(lpSubItem);
    24142435  }
    2415  
     2436
    24162437  return bResult;
    24172438}
     
    24202441 * DESCRIPTION:
    24212442 * Finds the dpa insert position (array index).
    2422  * 
     2443 *
    24232444 * PARAMETER(S):
    24242445 * [I] HWND : window handle
     
    24432464        return i;
    24442465      }
    2445     } 
     2466    }
    24462467  }
    24472468
     
    24522473 * DESCRIPTION:
    24532474 * Retrieves a listview subitem at a given position (column index).
    2454  * 
     2475 *
    24552476 * PARAMETER(S):
    24562477 * [I] HWND : window handle
     
    24782499      {
    24792500        return NULL;
    2480       } 
    2481     }
    2482   }
    2483  
     2501      }
     2502    }
     2503  }
     2504
    24842505  return NULL;
    24852506}
     
    24882509 * DESCRIPTION:
    24892510 * Sets item attributes.
    2490  * 
    2491  * PARAMETER(S):
    2492  * [I] HWND : window handle
    2493  * [I] LPLVITEM : new item atttributes 
     2511 *
     2512 * PARAMETER(S):
     2513 * [I] HWND : window handle
     2514 * [I] LPLVITEM : new item atttributes
    24942515 *
    24952516 * RETURN:
     
    25232544      itm.iSubItem = 0;
    25242545      ListView_GetItemA(hwnd,&itm);
    2525      
     2546
    25262547
    25272548      ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
     
    25352556      nmlv.iItem = lpLVItem->iItem;
    25362557
    2537       if ((itm.state & lpLVItem->stateMask) != 
     2558      if ((itm.state & lpLVItem->stateMask) !=
    25382559          (lpLVItem->state & lpLVItem->stateMask))
    25392560      {
     
    25672588          ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);
    25682589
    2569           rcItem.left = LVIR_BOUNDS;
    2570           LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
    2571           InvalidateRect(hwnd, &rcItem, TRUE);
     2590      rcItem.left = LVIR_BOUNDS;
     2591      LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
     2592      InvalidateRect(hwnd, &rcItem, TRUE);
    25722593        }
    25732594      }
     
    26132634                }
    26142635
    2615                 LISTVIEW_AddSelectionRange(hwnd,lpLVItem->iItem,
     2636            LISTVIEW_AddSelectionRange(hwnd,lpLVItem->iItem,
    26162637                                             lpLVItem->iItem);
    26172638              }
     
    26212642                                              lpLVItem->iItem);
    26222643              }
    2623               if (nmlv.uNewState & LVIS_FOCUSED)
     2644          if (nmlv.uNewState & LVIS_FOCUSED)
    26242645              {
    26252646                /*
    26262647                 * This is a fun hoop to jump to try to catch if
    26272648                 * the user is calling us directly to call focus or if
    2628                  * this function is being called as a result of a 
    2629                  * SetItemFocus call. 
     2649                 * this function is being called as a result of a
     2650                 * SetItemFocus call.
    26302651                 */
    26312652                if (infoPtr->nFocusedItem >= 0)
    26322653                  LISTVIEW_SetItemFocus(hwnd, lpLVItem->iItem);
    2633               }           
     2654              }
    26342655            }
    2635            
     2656
    26362657            nmlv.uChanged = uChanged;
    26372658            nmlv.iItem = lpLVItem->iItem;
     
    26612682            bResult = TRUE;
    26622683          }
    2663          
     2684
    26642685          if (uChanged)
    26652686          {
    26662687            rcItem.left = LVIR_BOUNDS;
    2667             LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
     2688        LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
    26682689            InvalidateRect(hwnd, &rcItem, TRUE);
    26692690          }
     
    26792700 * DESCRIPTION:
    26802701 * Sets subitem attributes.
    2681  * 
    2682  * PARAMETER(S):
    2683  * [I] HWND : window handle
    2684  * [I] LPLVITEM : new subitem atttributes 
     2702 *
     2703 * PARAMETER(S):
     2704 * [I] HWND : window handle
     2705 * [I] LPLVITEM : new subitem atttributes
    26852706 *
    26862707 * RETURN:
     
    27192740            bResult = LISTVIEW_AddSubItem(hwnd, lpLVItem);
    27202741          }
    2721          
     2742
    27222743          rcItem.left = LVIR_BOUNDS;
    2723           LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
    2724           InvalidateRect(hwnd, &rcItem, FALSE);
    2725         } 
     2744      LISTVIEW_GetItemRect(hwnd, lpLVItem->iItem, &rcItem);
     2745      InvalidateRect(hwnd, &rcItem, FALSE);
     2746        }
    27262747      }
    27272748    }
     
    27342755 * DESCRIPTION:
    27352756 * Retrieves the index of the item at coordinate (0, 0) of the client area.
    2736  * 
     2757 *
    27372758 * PARAMETER(S):
    27382759 * [I] HWND : window handle
     
    27512772  scrollInfo.cbSize = sizeof(SCROLLINFO);
    27522773  scrollInfo.fMask = SIF_POS;
    2753  
     2774
    27542775  if (uView == LVS_LIST)
    27552776  {
     
    27722793    }
    27732794  }
    2774  
     2795
    27752796  return nItem;
    27762797}
     
    27792800 * DESCRIPTION:
    27802801 * Draws a subitem.
    2781  * 
     2802 *
    27822803 * PARAMETER(S):
    27832804 * [I] HWND : window handle
     
    27902811 * None
    27912812 */
    2792 static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem, 
     2813static VOID LISTVIEW_DrawSubItem(HWND hwnd, HDC hdc, INT nItem, INT nSubItem,
    27932814                                 RECT rcItem, BOOL Selected)
    27942815{
    2795   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     2816  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    27962817  CHAR szDispText[DISP_TEXT_SIZE];
    27972818  LVITEMA lvItem;
     
    28502871  }
    28512872
    2852   ExtTextOutA(hdc, rcItem.left, rcItem.top, textoutOptions, 
     2873  ExtTextOutA(hdc, rcItem.left, rcItem.top, textoutOptions,
    28532874              &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL);
    28542875
     
    28772898 * DESCRIPTION:
    28782899 * Draws an item.
    2879  * 
     2900 *
    28802901 * PARAMETER(S):
    28812902 * [I] HWND : window handle
     
    28892910static VOID LISTVIEW_DrawItem(HWND hwnd, HDC hdc, INT nItem, RECT rcItem, BOOL FullSelect, RECT* SuggestedFocus)
    28902911{
    2891   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     2912  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    28922913  CHAR szDispText[DISP_TEXT_SIZE];
    28932914  INT nLabelWidth;
     
    29262947  if (lvItem.iIndent>0 && infoPtr->iconSize.cx > 0)
    29272948  {
    2928     rcItem.left += infoPtr->iconSize.cx * lvItem.iIndent; 
     2949    rcItem.left += infoPtr->iconSize.cx * lvItem.iIndent;
    29292950
    29302951    if (SuggestedFocus)
    29312952      SuggestedFocus->left += infoPtr->iconSize.cx * lvItem.iIndent;
    2932   } 
     2953  }
    29332954
    29342955  /* state icons */
    29352956  if (infoPtr->himlState != NULL)
    29362957  {
    2937      UINT uStateImage = (lvItem.state & LVIS_STATEIMAGEMASK) >> 12; 
     2958     UINT uStateImage = (lvItem.state & LVIS_STATEIMAGEMASK) >> 12;
    29382959     if (uStateImage > 0)
    29392960     {
    2940        ImageList_Draw(infoPtr->himlState, uStateImage - 1, hdc, rcItem.left, 
     2961       ImageList_Draw(infoPtr->himlState, uStateImage - 1, hdc, rcItem.left,
    29412962                      rcItem.top, ILD_NORMAL);
    29422963     }
    2943  
    2944      rcItem.left += infoPtr->iconSize.cx; 
     2964
     2965     rcItem.left += infoPtr->iconSize.cx;
    29452966     if (SuggestedFocus)
    29462967       SuggestedFocus->left += infoPtr->iconSize.cx;
    29472968     bImage = TRUE;
    29482969  }
    2949  
     2970
    29502971  /* small icons */
    29512972  if (infoPtr->himlSmall != NULL)
     
    29552976    {
    29562977      ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE);
    2957       ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 
     2978      ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left,
    29582979                     rcItem.top, ILD_SELECTED);
    29592980    }
     
    29612982    {
    29622983      ImageList_SetBkColor(infoPtr->himlSmall, CLR_NONE);
    2963       ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left, 
     2984      ImageList_Draw(infoPtr->himlSmall, lvItem.iImage, hdc, rcItem.left,
    29642985                     rcItem.top, ILD_NORMAL);
    29652986    }
    2966    
    2967     rcItem.left += infoPtr->iconSize.cx; 
     2987
     2988    rcItem.left += infoPtr->iconSize.cx;
    29682989
    29692990    if (SuggestedFocus)
     
    29782999  if ((lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus != FALSE))
    29793000  {
    2980     /* set item colors */ 
     3001    /* set item colors */
    29813002    dwBkColor = SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
    29823003    dwTextColor = SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
     
    29843005    nMixMode = SetROP2(hdc, R2_XORPEN);
    29853006  }
    2986   else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) && 
     3007  else if ((GetWindowLongA(hwnd, GWL_STYLE) & LVS_SHOWSELALWAYS) &&
    29873008           (lvItem.state & LVIS_SELECTED) && (infoPtr->bFocus == FALSE))
    29883009  {
     
    30113032    nMixMode = SetROP2(hdc, R2_COPYPEN);
    30123033  }
    3013  
     3034
    30143035  nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText);
    30153036  if (rcItem.left + nLabelWidth < rcItem.right)
     
    30203041      rcItem.right += IMAGE_PADDING;
    30213042  }
    3022  
    3023   /* draw label */ 
     3043
     3044  /* draw label */
    30243045  dwTextX = rcItem.left + 1;
    30253046  if (bImage)
     
    30373058    rec.left = rec.right;
    30383059    rec.right = rec.left+REPORT_MARGINX;
    3039     ExtTextOutA(hdc, rec.left , rec.top, textoutOptions, 
     3060    ExtTextOutA(hdc, rec.left , rec.top, textoutOptions,
    30403061    &rec, NULL, 0, NULL);
    30413062  }
    3042  
     3063
    30433064  if (!FullSelect)
    30443065      CopyRect(SuggestedFocus,&rcItem);
     
    30573078 * DESCRIPTION:
    30583079 * Draws an item when in large icon display mode.
    3059  * 
     3080 *
    30603081 * PARAMETER(S):
    30613082 * [I] HWND : window handle
     
    30713092                                   RECT *SuggestedFocus)
    30723093{
    3073   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     3094  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    30743095  CHAR szDispText[DISP_TEXT_SIZE];
    30753096  INT nDrawPosX = rcItem.left;
     
    31053126  if (lvItem.state & LVIS_SELECTED)
    31063127  {
    3107     /* set item colors */ 
     3128    /* set item colors */
    31083129    SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
    31093130    SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
     
    31363157    if ((lvItem.state & LVIS_SELECTED) && (lvItem.iImage>=0))
    31373158    {
    3138       ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 
     3159      ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX,
    31393160                     rcItem.top, ILD_SELECTED);
    31403161    }
    31413162    else if (lvItem.iImage>=0)
    31423163    {
    3143       ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX, 
     3164      ImageList_Draw(infoPtr->himlNormal, lvItem.iImage, hdc, nDrawPosX,
    31443165                     rcItem.top, ILD_NORMAL);
    31453166    }
     
    31513172
    31523173  InflateRect(&rcItem, -(2*CAPTION_BORDER), 0);
    3153   rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING; 
     3174  rcItem.top += infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
    31543175  nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText);
    31553176  GetTextMetricsA(hdc, &tm);
     
    31613182      INT i, len, eos, nCharsFit;
    31623183      /* give or take a couple, how many average sized chars would fit? */
    3163       nCharsFit = tm.tmAveCharWidth > 0 ? (rcWidth/tm.tmAveCharWidth)+2 : 0; 
     3184      nCharsFit = tm.tmAveCharWidth > 0 ? (rcWidth/tm.tmAveCharWidth)+2 : 0;
    31643185      /* place the ellipse accordingly, without overrunning the buffer */
    31653186      len = strlen(szDispText);
    31663187      eos = min((nCharsFit > 1 && nCharsFit < len) ? nCharsFit+3 : len+2,
    31673188                sizeof(szDispText)-1);
    3168      
     3189
    31693190      nLabelWidth = ListView_GetStringWidthA(hwnd, szDispText);
    31703191      while ((nLabelWidth > rcWidth) && (eos > 3))
    31713192      {
    3172         for (i = 1; i < 4; i++)
    3173             szDispText[eos-i] = '.';
     3193    for (i = 1; i < 4; i++)
     3194        szDispText[eos-i] = '.';
    31743195         /* shift the ellipse one char to the left for each iteration */
    3175          szDispText[eos--] = '\0'; 
     3196         szDispText[eos--] = '\0';
    31763197         nLabelWidth = ListView_GetStringWidthA(hwnd, szDispText);
    31773198      }
     
    31913212  }
    31923213
    3193   /* draw label */ 
    3194   rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING; 
    3195 
    3196   ExtTextOutA(hdc, rcItem.left + CAPTION_BORDER, rcItem.top, textoutOptions, 
     3214  /* draw label */
     3215  rcItem.bottom = rcItem.top + tm.tmHeight + HEIGHT_PADDING;
     3216
     3217  ExtTextOutA(hdc, rcItem.left + CAPTION_BORDER, rcItem.top, textoutOptions,
    31973218              &rcItem, lvItem.pszText, lstrlenA(lvItem.pszText), NULL);
    3198        
     3219
    31993220
    32003221  CopyRect(SuggestedFocus,&rcItem);
     
    32043225 * DESCRIPTION:
    32053226 * Draws listview items when in report display mode.
    3206  * 
    3207  * PARAMETER(S):
    3208  * [I] HWND : window handle
    3209  * [I] HDC : device context handle 
     3227 *
     3228 * PARAMETER(S):
     3229 * [I] HWND : window handle
     3230 * [I] HDC : device context handle
    32103231 *
    32113232 * RETURN:
     
    32803301        RECT br;
    32813302
    3282         TRACE("Owner Drawn\n");   
     3303        TRACE("Owner Drawn\n");
    32833304        dis.CtlType = ODT_LISTVIEW;
    32843305        dis.CtlID = uID;
     
    32863307        dis.itemAction = ODA_DRAWENTIRE;
    32873308        dis.itemState = 0;
    3288        
     3309
    32893310        if (LISTVIEW_IsSelected(hwnd,nItem)) dis.itemState|=ODS_SELECTED;
    32903311        if (nItem==infoPtr->nFocusedItem)   dis.itemState|=ODS_FOCUS;
     
    32953316        Header_GetItemRect(infoPtr->hwndHeader, nColumnCount-1, &br);
    32963317
    3297         dis.rcItem.left = -scrollOffset; 
     3318        dis.rcItem.left = -scrollOffset;
    32983319        dis.rcItem.right = max(dis.rcItem.left, br.right - scrollOffset);
    32993320        dis.rcItem.top = nDrawPosY;
    33003321        dis.rcItem.bottom = dis.rcItem.top + infoPtr->nItemHeight;
    3301        
     3322
    33023323        ZeroMemory(&item,sizeof(LVITEMA));
    33033324        item.iItem = nItem;
     
    33253346      ir.top = nDrawPosY;
    33263347      ir.bottom = ir.top + infoPtr->nItemHeight;
    3327      
     3348
    33283349      CopyRect(&SuggestedFocusRect,&ir);
    33293350    }
     
    33513372      {
    33523373        LISTVIEW_DrawItem(hwnd, hdc, nItem, rcItem, FullSelected,
    3353                           &SuggestedFocusRect); 
    3354       }
    3355       else 
    3356       {
    3357         LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem, 
     3374                          &SuggestedFocusRect);
     3375      }
     3376      else
     3377      {
     3378        LISTVIEW_DrawSubItem(hwnd, hdc, nItem, j, rcItem,
    33583379                              FullSelected);
    33593380      }
    33603381
    33613382      if (cditemmode & CDRF_NOTIFYPOSTPAINT)
    3362         LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, nItem, 0, 
    3363                                       CDDS_ITEMPOSTPAINT);
     3383        LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, nItem, 0,
     3384                      CDDS_ITEMPOSTPAINT);
    33643385    }
    33653386    /*
     
    33723393        rop = SetROP2(hdc, R2_XORPEN);
    33733394
    3374       Rectangle(hdc, SuggestedFocusRect.left, SuggestedFocusRect.top, 
    3375                 SuggestedFocusRect.right,SuggestedFocusRect.bottom); 
     3395      Rectangle(hdc, SuggestedFocusRect.left, SuggestedFocusRect.top,
     3396                SuggestedFocusRect.right,SuggestedFocusRect.bottom);
    33763397
    33773398      if (rop)
     
    33853406 * DESCRIPTION:
    33863407 * Retrieves the number of items that can fit vertically in the client area.
    3387  * 
     3408 *
    33883409 * PARAMETER(S):
    33893410 * [I] HWND : window handle
     
    34203441/***
    34213442 * DESCRIPTION:
    3422  * Retrieves the number of items that can fit horizontally in the client 
     3443 * Retrieves the number of items that can fit horizontally in the client
    34233444 * area.
    3424  * 
     3445 *
    34253446 * PARAMETER(S):
    34263447 * [I] HWND : window handle
     
    34493470/***
    34503471 * DESCRIPTION:
    3451  * Retrieves the number of columns needed to display all the items when in 
     3472 * Retrieves the number of columns needed to display all the items when in
    34523473 * list display mode.
    3453  * 
     3474 *
    34543475 * PARAMETER(S):
    34553476 * [I] HWND : window handle
     
    34773498
    34783499  return nColumnCount;
    3479 } 
    3480  
     3500}
     3501
    34813502
    34823503/***
    34833504 * DESCRIPTION:
    34843505 * Draws listview items when in list display mode.
    3485  * 
    3486  * PARAMETER(S):
    3487  * [I] HWND : window handle
    3488  * [I] HDC : device context handle 
     3506 *
     3507 * PARAMETER(S):
     3508 * [I] HWND : window handle
     3509 * [I] HDC : device context handle
    34893510 *
    34903511 * RETURN:
     
    35393560       */
    35403561      if (LISTVIEW_GetItemState(hwnd,nItem,LVIS_FOCUSED) && infoPtr->bFocus)
    3541       Rectangle(hdc, FocusRect.left, FocusRect.top, 
     3562      Rectangle(hdc, FocusRect.left, FocusRect.top,
    35423563                FocusRect.right,FocusRect.bottom);
    35433564
    35443565      if (cditemmode & CDRF_NOTIFYPOSTPAINT)
    3545         LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, nItem, 0, 
     3566        LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, nItem, 0,
    35463567                                          CDDS_ITEMPOSTPAINT);
    3547  
     3568
    35483569    }
    35493570  }
     
    35533574 * DESCRIPTION:
    35543575 * Draws listview items when in icon or small icon display mode.
    3555  * 
    3556  * PARAMETER(S):
    3557  * [I] HWND : window handle
    3558  * [I] HDC : device context handle 
     3576 *
     3577 * PARAMETER(S):
     3578 * [I] HWND : window handle
     3579 * [I] HDC : device context handle
    35593580 *
    35603581 * RETURN:
     
    35933614    ptPosition.x += ptOrigin.x;
    35943615    ptPosition.y += ptOrigin.y;
    3595      
     3616
    35963617    if (ptPosition.y + infoPtr->nItemHeight > infoPtr->rcList.top)
    35973618    {
     
    36173638             * Draw Focus Rect
    36183639             */
    3619             if (LISTVIEW_GetItemState(hwnd,i,LVIS_FOCUSED) && 
     3640            if (LISTVIEW_GetItemState(hwnd,i,LVIS_FOCUSED) &&
    36203641                infoPtr->bFocus)
    3621               Rectangle(hdc, SuggestedFocus.left, SuggestedFocus.top, 
    3622                         SuggestedFocus.right,SuggestedFocus.bottom);
     3642              Rectangle(hdc, SuggestedFocus.left, SuggestedFocus.top,
     3643                    SuggestedFocus.right,SuggestedFocus.bottom);
    36233644          }
    36243645        }
     
    36263647    }
    36273648    if (cditemmode & CDRF_NOTIFYPOSTPAINT)
    3628         LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, i, 0, 
     3649        LISTVIEW_SendCustomDrawItemNotify(hwnd, hdc, i, 0,
    36293650                                          CDDS_ITEMPOSTPAINT);
    36303651  }
     
    36343655 * DESCRIPTION:
    36353656 * Draws listview items.
    3636  * 
    3637  * PARAMETER(S):
    3638  * [I] HWND : window handle
    3639  * [I] HDC : device context handle 
     3657 *
     3658 * PARAMETER(S):
     3659 * [I] HWND : window handle
     3660 * [I] HDC : device context handle
    36403661 *
    36413662 * RETURN:
     
    36683689
    36693690  /* select transparent brush (for drawing the focus box) */
    3670   SelectObject(hdc, GetStockObject(NULL_BRUSH)); 
     3691  SelectObject(hdc, GetStockObject(NULL_BRUSH));
    36713692
    36723693  if (uView == LVS_LIST)
    36733694  {
    3674     LISTVIEW_RefreshList(hwnd, hdc, cdmode); 
     3695    LISTVIEW_RefreshList(hwnd, hdc, cdmode);
    36753696  }
    36763697  else if (uView == LVS_REPORT)
     
    36903711  SelectObject(hdc, hOldFont);
    36913712  SelectObject(hdc, hOldPen);
    3692  
     3713
    36933714  /* delete pen */
    36943715  DeleteObject(hPen);
    3695  
     3716
    36963717  if (cdmode & CDRF_NOTIFYPOSTPAINT)
    36973718      LISTVIEW_SendCustomDrawNotify(hwnd, CDDS_POSTPAINT, hdc, rect);
     
    37023723 * DESCRIPTION:
    37033724 * Calculates the approximate width and height of a given number of items.
    3704  * 
     3725 *
    37053726 * PARAMETER(S):
    37063727 * [I] HWND : window handle
     
    37123733 * Returns a DWORD. The width in the low word and the height in high word.
    37133734 */
    3714 static LRESULT LISTVIEW_ApproximateViewRect(HWND hwnd, INT nItemCount, 
     3735static LRESULT LISTVIEW_ApproximateViewRect(HWND hwnd, INT nItemCount,
    37153736                                            WORD wWidth, WORD wHeight)
    37163737{
     
    37483769          nItemCountPerColumn = 1;
    37493770        }
    3750        
     3771
    37513772        if (nItemCount % nItemCountPerColumn != 0)
    37523773        {
     
    37783799    /* TO DO */
    37793800  }
    3780  
     3801
    37813802  return dwViewRect;
    37823803}
     
    37853806 * DESCRIPTION:
    37863807 * Arranges listview items in icon display mode.
    3787  * 
     3808 *
    37883809 * PARAMETER(S):
    37893810 * [I] HWND : window handle
     
    37963817static LRESULT LISTVIEW_Arrange(HWND hwnd, INT nAlignCode)
    37973818{
    3798   UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK; 
     3819  UINT uView = GetWindowLongA(hwnd, GWL_STYLE) & LVS_TYPEMASK;
    37993820  BOOL bResult = FALSE;
    38003821
     
    38273848 * DESCRIPTION:
    38283849 * Removes all listview items and subitems.
    3829  * 
     3850 *
    38303851 * PARAMETER(S):
    38313852 * [I] HWND : window handle
     
    38683889    /* initialize memory */
    38693890    ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
    3870    
     3891
    38713892    /* send LVN_DELETEALLITEMS notification */
    38723893    nmlv.hdr.hwndFrom = hwnd;
     
    38753896    nmlv.iItem = -1;
    38763897
    3877     /* verify if subsequent LVN_DELETEITEM notifications should be 
     3898    /* verify if subsequent LVN_DELETEITEM notifications should be
    38783899       suppressed */
    38793900    bSuppress = ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);
     
    38903911          {
    38913912            /* free subitem string */
    3892             if ((lpSubItem->pszText != NULL) && 
     3913            if ((lpSubItem->pszText != NULL) &&
    38933914                (lpSubItem->pszText != LPSTR_TEXTCALLBACKA))
    38943915            {
    38953916              COMCTL32_Free(lpSubItem->pszText);
    38963917            }
    3897        
     3918
    38983919            /* free subitem */
    38993920            COMCTL32_Free(lpSubItem);
    3900           }   
     3921          }
    39013922        }
    39023923
     
    39143935
    39153936          /* free item string */
    3916           if ((lpItem->pszText != NULL) && 
     3937          if ((lpItem->pszText != NULL) &&
    39173938              (lpItem->pszText != LPSTR_TEXTCALLBACKA))
    39183939          {
    39193940            COMCTL32_Free(lpItem->pszText);
    39203941          }
    3921      
     3942
    39223943          /* free item */
    39233944          COMCTL32_Free(lpItem);
    39243945        }
    3925        
     3946
    39263947        DPA_Destroy(hdpaSubItems);
    39273948      }
     
    39303951    /* reinitialize listview memory */
    39313952    bResult = DPA_DeleteAllPtrs(infoPtr->hdpaItems);
    3932    
     3953
    39333954    /* align items (set position of each item) */
    39343955    if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
     
    39433964      }
    39443965    }
    3945    
     3966
    39463967    LISTVIEW_UpdateScroll(hwnd);
    39473968
     
    39493970    InvalidateRect(hwnd, NULL, TRUE);
    39503971  }
    3951  
     3972
    39523973  return bResult;
    39533974}
     
    39563977 * DESCRIPTION:
    39573978 * Removes a column from the listview control.
    3958  * 
     3979 *
    39593980 * PARAMETER(S):
    39603981 * [I] HWND : window handle
     
    39974018 * DESCRIPTION:
    39984019 * Removes an item from the listview control.
    3999  * 
    4000  * PARAMETER(S):
    4001  * [I] HWND : window handle
    4002  * [I] INT : item index 
     4020 *
     4021 * PARAMETER(S):
     4022 * [I] HWND : window handle
     4023 * [I] INT : item index
    40034024 *
    40044025 * RETURN:
     
    40214042
    40224043  TRACE("(hwnd=%x,nItem=%d)\n", hwnd, nItem);
    4023  
    4024  
     4044
     4045
    40254046  /* First, send LVN_DELETEITEM notification. */
    40264047  memset(&nmlv, 0, sizeof (NMLISTVIEW));
     
    40294050  nmlv.hdr.code = LVN_DELETEITEM;
    40304051  nmlv.iItem = nItem;
    4031   SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId, 
     4052  SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)lCtrlId,
    40324053               (LPARAM)&nmlv);
    40334054
     
    40594080        {
    40604081          /* free item string */
    4061           if ((lpSubItem->pszText != NULL) && 
     4082          if ((lpSubItem->pszText != NULL) &&
    40624083              (lpSubItem->pszText != LPSTR_TEXTCALLBACKA))
    40634084          {
    40644085            COMCTL32_Free(lpSubItem->pszText);
    40654086          }
    4066        
     4087
    40674088          /* free item */
    40684089          COMCTL32_Free(lpSubItem);
    4069         }   
    4070       }
    4071  
     4090        }
     4091      }
     4092
    40724093      lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0);
    40734094      if (lpItem != NULL)
    40744095      {
    40754096        /* free item string */
    4076         if ((lpItem->pszText != NULL) && 
     4097        if ((lpItem->pszText != NULL) &&
    40774098            (lpItem->pszText != LPSTR_TEXTCALLBACKA))
    40784099        {
    40794100          COMCTL32_Free(lpItem->pszText);
    40804101        }
    4081      
     4102
    40824103        /* free item */
    40834104        COMCTL32_Free(lpItem);
    40844105      }
    4085    
     4106
    40864107      bResult = DPA_Destroy(hdpaSubItems);
    40874108    }
     
    41074128    InvalidateRect(hwnd, NULL, TRUE);
    41084129  }
    4109  
     4130
    41104131  return bResult;
    41114132}
     
    41574178
    41584179  ZeroMemory(&dispInfo, sizeof(NMLVDISPINFOA));
    4159  
     4180
    41604181  if (!(lStyle & LVS_OWNERDATA))
    41614182  {
    41624183    if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem)))
    4163           return FALSE;
     4184      return FALSE;
    41644185
    41654186    if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0)))
    4166           return FALSE;
     4187      return FALSE;
    41674188  }
    41684189  else
     
    42254246  RECT rect;
    42264247  LISTVIEW_ITEM *lpItem;
    4227   HWND hedit; 
     4248  HWND hedit;
    42284249  HINSTANCE hinst = GetWindowLongA(hwnd, GWL_HINSTANCE);
    42294250  INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
     
    42344255  LISTVIEW_ITEM lvItemRef;
    42354256  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    4236  
     4257
    42374258  if (~GetWindowLongA(hwnd, GWL_STYLE) & LVS_EDITLABELS)
    42384259      return FALSE;
     
    42514272  {
    42524273    if (NULL == (hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem)))
    4253           return 0;
     4274      return 0;
    42544275
    42554276    if (NULL == (lpItem = (LISTVIEW_ITEM *)DPA_GetPtr(hdpaSubItems, 0)))
    4256           return 0;
    4257   } 
     4277      return 0;
     4278  }
    42584279  else
    42594280  {
     
    42924313
    42934314  if (ListView_LVNotify(GetParent(hwnd), nCtrlId, &dispInfo))
    4294           return 0;
     4315      return 0;
    42954316
    42964317  rect.left = LVIR_LABEL;
    42974318  if (!LISTVIEW_GetItemRect(hwnd, nItem, &rect))
    4298           return 0;
    4299  
    4300   if (!(hedit = CreateEditLabel(szDispText , WS_VISIBLE, 
    4301                  rect.left-2, rect.top-1, 0,
    4302                  rect.bottom - rect.top+2,
    4303                 hwnd, hinst, LISTVIEW_EndEditLabel, nItem)))
    4304         return 0;
     4319      return 0;
     4320
     4321  if (!(hedit = CreateEditLabel(szDispText , WS_VISIBLE,
     4322         rect.left-2, rect.top-1, 0,
     4323         rect.bottom - rect.top+2,
     4324        hwnd, hinst, LISTVIEW_EndEditLabel, nItem)))
     4325    return 0;
    43054326
    43064327  infoPtr->hwndEdit = hedit;
    4307   SetFocus(hedit); 
     4328  SetFocus(hedit);
    43084329  SendMessageA(hedit, EM_SETSEL, 0, -1);
    43094330
     
    43154336 * DESCRIPTION:
    43164337 * Ensures the specified item is visible, scrolling into view if necessary.
    4317  * 
     4338 *
    43184339 * PARAMETER(S):
    43194340 * [I] HWND : window handle
     
    43604381          rcItem.left += infoPtr->rcList.left;
    43614382        }
    4362        
    4363         /* When in LVS_REPORT view, the scroll position should
    4364            not be updated. */
    4365         if (nScrollPosWidth != 0)
    4366         {
    4367           if (rcItem.left % nScrollPosWidth == 0)
    4368           {
    4369             scrollInfo.nPos += rcItem.left / nScrollPosWidth;
    4370           }
    4371           else
    4372           {
    4373             scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1;
    4374           }
    4375          
    4376           SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    4377         }
     4383
     4384    /* When in LVS_REPORT view, the scroll position should
     4385       not be updated. */
     4386    if (nScrollPosWidth != 0)
     4387    {
     4388      if (rcItem.left % nScrollPosWidth == 0)
     4389      {
     4390        scrollInfo.nPos += rcItem.left / nScrollPosWidth;
     4391      }
     4392      else
     4393      {
     4394        scrollInfo.nPos += rcItem.left / nScrollPosWidth - 1;
     4395      }
     4396
     4397      SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
     4398    }
    43784399      }
    43794400    }
     
    43834404      {
    43844405        /* scroll right */
    4385         bRedraw = TRUE;
     4406    bRedraw = TRUE;
    43864407        if (uView == LVS_LIST)
    43874408        {
     
    43954416        }
    43964417
    4397         /* When in LVS_REPORT view, the scroll position should
    4398            not be updated. */
    4399         if (nScrollPosWidth != 0)
    4400         {
    4401           if (rcItem.right % nScrollPosWidth == 0)
    4402           {
    4403             scrollInfo.nPos += rcItem.right / nScrollPosWidth;
    4404           }
    4405           else
    4406           {
    4407             scrollInfo.nPos += rcItem.right / nScrollPosWidth + 1;
    4408           }
    4409 
    4410           SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
    4411         }
    4412       }
    4413     }
    4414    
     4418    /* When in LVS_REPORT view, the scroll position should
     4419       not be updated. */
     4420    if (nScrollPosWidth != 0)
     4421    {
     4422      if (rcItem.right % nScrollPosWidth == 0)
     4423      {
     4424        scrollInfo.nPos += rcItem.right / nScrollPosWidth;
     4425      }
     4426      else
     4427      {
     4428        scrollInfo.nPos += rcItem.right / nScrollPosWidth + 1;
     4429      }
     4430
     4431      SetScrollInfo(hwnd, SB_HORZ, &scrollInfo, TRUE);
     4432    }
     4433      }
     4434    }
     4435
    44154436    if (rcItem.top < infoPtr->rcList.top)
    44164437    {
     
    44214442        if (uView == LVS_REPORT)
    44224443        {
    4423           rcItem.top -= infoPtr->rcList.top; 
     4444          rcItem.top -= infoPtr->rcList.top;
    44244445          nScrollPosHeight = infoPtr->nItemHeight;
    44254446        }
     
    44384459          scrollInfo.nPos += rcItem.top / nScrollPosHeight - 1;
    44394460        }
    4440        
     4461
    44414462        SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE);
    44424463      }
     
    44674488          scrollInfo.nPos += rcItem.bottom / nScrollPosHeight + 1;
    44684489        }
    4469        
     4490
    44704491        SetScrollInfo(hwnd, SB_VERT, &scrollInfo, TRUE);
    44714492      }
    44724493    }
    44734494  }
    4474  
     4495
    44754496  if(bRedraw)
    4476     InvalidateRect(hwnd,NULL,TRUE); 
     4497    InvalidateRect(hwnd,NULL,TRUE);
    44774498  return TRUE;
    44784499}
     
    44814502 * DESCRIPTION:
    44824503 * Retrieves the nearest item, given a position and a direction.
    4483  * 
     4504 *
    44844505 * PARAMETER(S):
    44854506 * [I] HWND : window handle
     
    45034524    lvHitTestInfo.pt.x += pt.x;
    45044525    lvHitTestInfo.pt.y += pt.y;
    4505    
     4526
    45064527    do
    4507     { 
     4528    {
    45084529      if (vkDirection == VK_DOWN)
    45094530      {
    45104531        lvHitTestInfo.pt.y += infoPtr->nItemHeight;
    4511       }     
     4532      }
    45124533      else if (vkDirection == VK_UP)
    45134534      {
     
    45374558
    45384559  return nItem;
    4539 } 
     4560}
    45404561
    45414562/***
    45424563 * DESCRIPTION:
    45434564 * Searches for an item with specific characteristics.
    4544  * 
     4565 *
    45454566 * PARAMETER(S):
    45464567 * [I] HWND : window handle
    45474568 * [I] INT : base item index
    45484569 * [I] LPLVFINDINFO : item information to look for
    4549  * 
     4570 *
    45504571 * RETURN:
    45514572 *   SUCCESS : index of item
    45524573 *   FAILURE : -1
    45534574 */
    4554 static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart, 
     4575static LRESULT LISTVIEW_FindItem(HWND hwnd, INT nStart,
    45554576                                 LPLVFINDINFO lpFindInfo)
    45564577{
     
    45714592      lvItem.mask |= LVIF_PARAM;
    45724593    }
    4573    
     4594
    45744595    if (lpFindInfo->flags & LVFI_STRING)
    45754596    {
     
    46034624        if (lpFindInfo->flags & LVFI_NEARESTXY)
    46044625        {
    4605           nItem = LISTVIEW_GetNearestItem(hwnd, ptItem, 
     4626          nItem = LISTVIEW_GetNearestItem(hwnd, ptItem,
    46064627                                          lpFindInfo->vkDirection);
    46074628          if (nItem != -1)
     
    46184639          nItem++;
    46194640        }
    4620        
     4641
    46214642        lvItem.iItem = nItem;
    46224643        lvItem.iSubItem = 0;
     
    46364657            }
    46374658          }
    4638          
     4659
    46394660          if (lvItem.mask & LVIF_PARAM)
    46404661          {
     
    46424663              continue;
    46434664          }
    4644          
     4665
    46454666          return nItem;
    46464667        }
     
    46564677      {
    46574678        return -1;
    4658       }       
    4659     }
    4660   }
    4661 
    4662  return -1; 
     4679      }
     4680    }
     4681  }
     4682
     4683 return -1;
    46634684}
    46644685
     
    46664687 * DESCRIPTION:
    46674688 * Retrieves the background color of the listview control.
    4668  * 
     4689 *
    46694690 * PARAMETER(S):
    46704691 * [I] HWND : window handle
     
    46834704 * DESCRIPTION:
    46844705 * Retrieves the background image of the listview control.
    4685  * 
     4706 *
    46864707 * PARAMETER(S):
    46874708 * [I] HWND : window handle
     
    47014722 * DESCRIPTION:
    47024723 * Retrieves the callback mask.
    4703  * 
     4724 *
    47044725 * PARAMETER(S):
    47054726 * [I] HWND : window handle
     
    47184739 * DESCRIPTION:
    47194740 * Retrieves column attributes.
    4720  * 
     4741 *
    47214742 * PARAMETER(S):
    47224743 * [I] HWND : window handle
     
    47334754  HDITEMA hdi;
    47344755  BOOL bResult = FALSE;
    4735  
     4756
    47364757  if (lpColumn != NULL)
    47374758  {
    47384759    /* initialize memory */
    47394760    ZeroMemory(&hdi, sizeof(HDITEMA));
    4740    
     4761
    47414762    if (lpColumn->mask & LVCF_FMT)
    47424763    {
     
    47694790    if (bResult != FALSE)
    47704791    {
    4771       if (lpColumn->mask & LVCF_FMT) 
     4792      if (lpColumn->mask & LVCF_FMT)
    47724793      {
    47734794        lpColumn->fmt = 0;
     
    47914812        }
    47924813
    4793         if (hdi.fmt & HDF_BITMAP_ON_RIGHT)
    4794         {
    4795           lpColumn->fmt |= LVCFMT_BITMAP_ON_RIGHT;
    4796         }
     4814    if (hdi.fmt & HDF_BITMAP_ON_RIGHT)
     4815    {
     4816      lpColumn->fmt |= LVCFMT_BITMAP_ON_RIGHT;
     4817    }
    47974818      }
    47984819
     
    48014822        lpColumn->cx = hdi.cxy;
    48024823      }
    4803      
     4824
    48044825      if (lpColumn->mask & LVCF_IMAGE)
    48054826      {
     
    48264847
    48274848    if (!lpiArray)
    4828         return FALSE;
     4849    return FALSE;
    48294850
    48304851    /* little hack */
    48314852    for (i = 0; i < iCount; i++)
    4832         lpiArray[i] = i;
     4853    lpiArray[i] = i;
    48334854
    48344855    return TRUE;
     
    48384859 * DESCRIPTION:
    48394860 * Retrieves the column width.
    4840  * 
     4861 *
    48414862 * PARAMETER(S):
    48424863 * [I] HWND : window handle
     
    48454866 * RETURN:
    48464867 *   SUCCESS : column width
    4847  *   FAILURE : zero 
     4868 *   FAILURE : zero
    48484869 */
    48494870static LRESULT LISTVIEW_GetColumnWidth(HWND hwnd, INT nColumn)
     
    48744895/***
    48754896 * DESCRIPTION:
    4876  * In list or report display mode, retrieves the number of items that can fit 
    4877  * vertically in the visible area. In icon or small icon display mode, 
     4897 * In list or report display mode, retrieves the number of items that can fit
     4898 * vertically in the visible area. In icon or small icon display mode,
    48784899 * retrieves the total number of visible items.
    4879  * 
     4900 *
    48804901 * PARAMETER(S):
    48814902 * [I] HWND : window handle
     
    48944915    if (infoPtr->rcList.right > infoPtr->nItemWidth)
    48954916    {
    4896       nItemCount = LISTVIEW_GetCountPerRow(hwnd) * 
     4917      nItemCount = LISTVIEW_GetCountPerRow(hwnd) *
    48974918                   LISTVIEW_GetCountPerColumn(hwnd);
    48984919    }
     
    49294950    /* make sure we can get the listview info */
    49304951    if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0)))
    4931         return (0);
     4952    return (0);
    49324953
    49334954    return (infoPtr->dwExStyle);
     
    49374958 * DESCRIPTION:
    49384959 * Retrieves the handle to the header control.
    4939  * 
     4960 *
    49404961 * PARAMETER(S):
    49414962 * [I] HWND : window handle
     
    49754996 * DESCRIPTION:
    49764997 * Retrieves an image list handle.
    4977  * 
    4978  * PARAMETER(S):
    4979  * [I] HWND : window handle
    4980  * [I] INT : image list identifier 
    4981  * 
     4998 *
     4999 * PARAMETER(S):
     5000 * [I] HWND : window handle
     5001 * [I] INT : image list identifier
     5002 *
    49825003 * RETURN:
    49835004 *   SUCCESS : image list handle
     
    49895010  HIMAGELIST himl = NULL;
    49905011
    4991   switch (nImageList) 
     5012  switch (nImageList)
    49925013  {
    49935014  case LVSIL_NORMAL:
     
    50105031 * DESCRIPTION:
    50115032 * Retrieves item attributes.
    5012  * 
     5033 *
    50135034 * PARAMETER(S):
    50145035 * [I] HWND : window handle
     
    50165037 * [I] internal : if true then we will use tricks that avoid copies
    50175038 *               but are not compatible with the regular interface
    5018  * 
    5019  * RETURN:
    5020  *   SUCCESS : TRUE 
     5039 *
     5040 * RETURN:
     5041 *   SUCCESS : TRUE
    50215042 *   FAILURE : FALSE
    50225043 */
     
    50355056   * lpLVItem describes the information requested by the user
    50365057   * lpItem/lpSubItem is what we have
    5037    * dispInfo is a structure we use to request the missing 
     5058   * dispInfo is a structure we use to request the missing
    50385059   *     information from the application
    50395060   */
     
    50625083    if ((lpLVItem->mask & LVIF_STATE)&&(lpLVItem->iSubItem == 0))
    50635084    {
    5064       lpLVItem->state = 0; 
     5085      lpLVItem->state = 0;
    50655086      if (infoPtr->nFocusedItem == lpLVItem->iItem)
    50665087        lpLVItem->state |= LVIS_FOCUSED;
     
    50875108    ppszText=&lpItem->pszText;
    50885109    if ((infoPtr->uCallbackMask != 0) && (lpLVItem->mask & LVIF_STATE))
    5089     {       
     5110    {
    50905111      dispInfo.item.mask |= LVIF_STATE;
    5091       dispInfo.item.stateMask = infoPtr->uCallbackMask; 
     5112      dispInfo.item.stateMask = infoPtr->uCallbackMask;
    50925113    }
    50935114  }
     
    51625183      lstrcpynA(lpLVItem->pszText, dispInfo.item.pszText, lpLVItem->cchTextMax);
    51635184    }
    5164    
     5185
    51655186    if (ppszText == NULL)
    51665187    {
     
    51875208
    51885209      lpLVItem->state &= ~LVIS_SELECTED;
    5189       if ((dispInfo.item.stateMask & LVIS_SELECTED) && 
     5210      if ((dispInfo.item.stateMask & LVIS_SELECTED) &&
    51905211         (LISTVIEW_IsSelected(hwnd,dispInfo.item.iItem)))
    51915212        lpLVItem->state |= LVIS_SELECTED;
     
    51965217
    51975218      lpLVItem->state &= ~LVIS_SELECTED;
    5198       if ((lpLVItem->stateMask & LVIS_SELECTED) && 
     5219      if ((lpLVItem->stateMask & LVIS_SELECTED) &&
    51995220          (LISTVIEW_IsSelected(hwnd,lpLVItem->iItem)))
    52005221         lpLVItem->state |= LVIS_SELECTED;
     
    52355256    /* make sure we can get the listview info */
    52365257    if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0)))
    5237         return (-1);
     5258    return (-1);
    52385259
    52395260    return (infoPtr->nHotItem);
     
    52455266 * DESCRIPTION:
    52465267 * Retrieves the number of items in the listview control.
    5247  * 
    5248  * PARAMETER(S):
    5249  * [I] HWND : window handle
    5250  * 
     5268 *
     5269 * PARAMETER(S):
     5270 * [I] HWND : window handle
     5271 *
    52515272 * RETURN:
    52525273 * Number of items.
     
    52625283 * DESCRIPTION:
    52635284 * Retrieves the position (upper-left) of the listview control item.
    5264  * 
     5285 *
    52655286 * PARAMETER(S):
    52665287 * [I] HWND : window handle
     
    52725293 *   FAILURE : FALSE
    52735294 */
    5274 static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem, 
     5295static BOOL LISTVIEW_GetItemPosition(HWND hwnd, INT nItem,
    52755296                                     LPPOINT lpptPosition)
    52765297{
     
    52835304  INT nRow;
    52845305
    5285   TRACE("(hwnd=%x,nItem=%d,lpptPosition=%p)\n", hwnd, nItem, 
     5306  TRACE("(hwnd=%x,nItem=%d,lpptPosition=%p)\n", hwnd, nItem,
    52865307        lpptPosition);
    5287  
    5288   if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && 
     5308
     5309  if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) &&
    52895310      (lpptPosition != NULL))
    52905311  {
     
    53055326        {
    53065327          lpptPosition->x = (nItem / nCountPerColumn -1) * infoPtr->nItemWidth;
    5307           lpptPosition->y = (nRow + nCountPerColumn) * infoPtr->nItemHeight; 
     5328          lpptPosition->y = (nRow + nCountPerColumn) * infoPtr->nItemHeight;
    53085329        }
    53095330      }
     
    53195340      bResult = TRUE;
    53205341      lpptPosition->x = REPORT_MARGINX;
    5321       lpptPosition->y = ((nItem - ListView_GetTopIndex(hwnd)) * 
     5342      lpptPosition->y = ((nItem - ListView_GetTopIndex(hwnd)) *
    53225343                         infoPtr->nItemHeight) + infoPtr->rcList.top;
    53235344
    5324           /* Adjust position by scrollbar offset */
    5325           ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));
    5326           scrollInfo.cbSize = sizeof(SCROLLINFO);
    5327           scrollInfo.fMask = SIF_POS;
    5328           GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
    5329           lpptPosition->x -= scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
     5345      /* Adjust position by scrollbar offset */
     5346      ZeroMemory(&scrollInfo, sizeof(SCROLLINFO));
     5347      scrollInfo.cbSize = sizeof(SCROLLINFO);
     5348      scrollInfo.fMask = SIF_POS;
     5349      GetScrollInfo(hwnd, SB_HORZ, &scrollInfo);
     5350      lpptPosition->x -= scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
    53305351    }
    53315352    else
     
    53505371 * DESCRIPTION:
    53515372 * Retrieves the bounding rectangle for a listview control item.
    5352  * 
     5373 *
    53535374 * PARAMETER(S):
    53545375 * [I] HWND : window handle
     
    53635384 *     LVIR_LABEL Returns the bounding rectangle of the item text.
    53645385 *     LVIR_SELECTBOUNDS Returns the union of the LVIR_ICON and LVIR_LABEL
    5365  *      rectangles, but excludes columns in report view.
    5366  * 
     5386 *  rectangles, but excludes columns in report view.
     5387 *
    53675388 * RETURN:
    53685389 *   SUCCESS : TRUE
     
    53975418    if (lvItem.iIndent>0 && infoPtr->iconSize.cx > 0)
    53985419    {
    5399       nIndent = infoPtr->iconSize.cx * lvItem.iIndent; 
    5400     } 
     5420      nIndent = infoPtr->iconSize.cx * lvItem.iIndent;
     5421    }
    54015422    else
    54025423     nIndent = 0;
     
    54045425  else
    54055426    nIndent = 0;
    5406  
     5427
    54075428  if ((nItem >= 0) && (nItem < GETITEMCOUNT(infoPtr)) && (lprc != NULL))
    54085429  {
    54095430    if (ListView_GetItemPosition(hwnd, nItem, &ptItem) != FALSE)
    54105431    {
    5411       switch(lprc->left) 
    5412       { 
    5413       case LVIR_ICON: 
     5432      switch(lprc->left)
     5433      {
     5434      case LVIR_ICON:
    54145435        if (uView == LVS_ICON)
    54155436        {
     
    54225443              lprc->top = ptItem.y + ptOrigin.y;
    54235444              lprc->right = lprc->left + infoPtr->iconSize.cx;
    5424               lprc->bottom = (lprc->top + infoPtr->iconSize.cy + 
     5445              lprc->bottom = (lprc->top + infoPtr->iconSize.cy +
    54255446                              ICON_BOTTOM_PADDING + ICON_TOP_PADDING);
    54265447            }
     
    54385459            if (infoPtr->himlState != NULL)
    54395460              lprc->left += infoPtr->iconSize.cx;
    5440              
     5461
    54415462            if (infoPtr->himlSmall != NULL)
    54425463              lprc->right = lprc->left + infoPtr->iconSize.cx;
     
    54455466          }
    54465467        }
    5447         else 
     5468        else
    54485469        {
    54495470          bResult = TRUE;
     
    54585479            lprc->left += infoPtr->iconSize.cx;
    54595480          }
    5460            
     5481
    54615482          if (infoPtr->himlSmall != NULL)
    54625483          {
     
    54705491        break;
    54715492
    5472       case LVIR_LABEL: 
     5493      case LVIR_LABEL:
    54735494        if (uView == LVS_ICON)
    54745495        {
     
    54925513                lprc->right = lprc->left + infoPtr->iconSpacing.cx - 1;
    54935514              }
    5494            
     5515
    54955516              hdc = GetDC(hwnd);
    54965517              hOldFont = SelectObject(hdc, infoPtr->hFont);
     
    54995520              SelectObject(hdc, hOldFont);
    55005521              ReleaseDC(hwnd, hdc);
    5501             }             
     5522            }
    55025523          }
    55035524        }
     
    55075528          {
    55085529            bResult = TRUE;
    5509             nLeftPos = lprc->left = ptItem.x + ptOrigin.x; 
     5530            nLeftPos = lprc->left = ptItem.x + ptOrigin.x;
    55105531            lprc->top = ptItem.y + ptOrigin.y;
    55115532            lprc->bottom = lprc->top + infoPtr->nItemHeight;
    5512            
     5533
    55135534            if (infoPtr->himlState != NULL)
    55145535            {
    55155536              lprc->left += infoPtr->iconSize.cx;
    55165537            }
    5517            
     5538
    55185539            if (infoPtr->himlSmall != NULL)
    55195540            {
    55205541              lprc->left += infoPtr->iconSize.cx;
    55215542            }
    5522            
     5543
    55235544            nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    55245545            nLabelWidth += TRAILING_PADDING;
     
    55385559          if (uView & LVS_REPORT)
    55395560            nLeftPos = lprc->left = ptItem.x + nIndent;
    5540           else 
    5541             nLeftPos = lprc->left = ptItem.x; 
     5561          else
     5562            nLeftPos = lprc->left = ptItem.x;
    55425563          lprc->top = ptItem.y;
    55435564          lprc->bottom = lprc->top + infoPtr->nItemHeight;
     
    55535574          }
    55545575
    5555           nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     5576      nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    55565577          nLabelWidth += TRAILING_PADDING;
    55575578          if (infoPtr->himlSmall)
    55585579            nLabelWidth += IMAGE_PADDING;
    5559           if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
    5560           {
    5561             lprc->right = lprc->left + nLabelWidth;
    5562           }
    5563           else
    5564           {
    5565             lprc->right = nLeftPos + infoPtr->nItemWidth;
    5566           }
     5580      if (lprc->left + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
     5581      {
     5582        lprc->right = lprc->left + nLabelWidth;
     5583      }
     5584      else
     5585      {
     5586        lprc->right = nLeftPos + infoPtr->nItemWidth;
     5587      }
    55675588        }
    55685589        break;
    55695590
    55705591      case LVIR_BOUNDS:
    5571         if (uView == LVS_ICON)
    5572         {
    5573           if (infoPtr->himlNormal != NULL)
    5574           {
    5575             if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)
    5576             {
    5577               bResult = TRUE;
    5578               lprc->left = ptItem.x + ptOrigin.x;
    5579               lprc->top = ptItem.y + ptOrigin.y;
    5580               lprc->right = lprc->left + infoPtr->iconSpacing.cx;
    5581               lprc->bottom = lprc->top + infoPtr->iconSpacing.cy;
    5582             }
    5583           }
    5584         }
    5585         else if (uView == LVS_SMALLICON)
    5586         {
    5587           if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)
    5588           {
    5589             bResult = TRUE;
    5590             lprc->left = ptItem.x + ptOrigin.x;
    5591             lprc->right = lprc->left;
    5592             lprc->top = ptItem.y + ptOrigin.y;
    5593             lprc->bottom = lprc->top + infoPtr->nItemHeight;
    5594             if (infoPtr->himlState != NULL)
    5595               lprc->right += infoPtr->iconSize.cx;
    5596             if (infoPtr->himlSmall != NULL)
    5597               lprc->right += infoPtr->iconSize.cx;
    5598 
    5599             nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    5600             nLabelWidth += TRAILING_PADDING;
    5601             if (infoPtr->himlSmall)
    5602               nLabelWidth += IMAGE_PADDING;
    5603             if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth)
    5604             {
    5605               lprc->right += nLabelWidth;
    5606             }
    5607             else
    5608             {
    5609               lprc->right = lprc->left + infoPtr->nItemWidth;
    5610             }
    5611           }
    5612         }
    5613         else
    5614         {
    5615           bResult = TRUE;
    5616           lprc->left = ptItem.x;
    5617           if (!(infoPtr->dwExStyle&LVS_EX_FULLROWSELECT) && uView&LVS_REPORT)
    5618             lprc->left += nIndent;
    5619           lprc->right = lprc->left;
    5620           lprc->top = ptItem.y;
    5621           lprc->bottom = lprc->top + infoPtr->nItemHeight;
    5622 
    5623           if (infoPtr->dwExStyle & LVS_EX_FULLROWSELECT)
    5624           {
    5625             RECT br;
    5626             int nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
    5627             Header_GetItemRect(infoPtr->hwndHeader, nColumnCount-1, &br);
    5628 
    5629             lprc->right = max(lprc->left, br.right - REPORT_MARGINX);
    5630           }
    5631           else
    5632           {
    5633              if (infoPtr->himlState != NULL)
    5634             {
    5635               lprc->right += infoPtr->iconSize.cx;
    5636             }
    5637 
    5638             if (infoPtr->himlSmall != NULL)
    5639             {
    5640               lprc->right += infoPtr->iconSize.cx;
    5641             }
    5642 
    5643             nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    5644             nLabelWidth += TRAILING_PADDING;
    5645             if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth)
    5646             {
    5647               lprc->right += nLabelWidth;
    5648             }
    5649             else
    5650             {
    5651               lprc->right = lprc->left + infoPtr->nItemWidth;
    5652             }
    5653           }
    5654         }
    5655         break;
    5656        
    5657       case LVIR_SELECTBOUNDS:
    56585592        if (uView == LVS_ICON)
    56595593        {
     
    56685602              lprc->bottom = lprc->top + infoPtr->iconSpacing.cy;
    56695603            }
    5670           } 
     5604          }
    56715605        }
    56725606        else if (uView == LVS_SMALLICON)
     
    56755609          {
    56765610            bResult = TRUE;
    5677             nLeftPos= lprc->left = ptItem.x + ptOrigin.x; 
     5611            lprc->left = ptItem.x + ptOrigin.x;
     5612            lprc->right = lprc->left;
    56785613            lprc->top = ptItem.y + ptOrigin.y;
    56795614            lprc->bottom = lprc->top + infoPtr->nItemHeight;
    5680            
     5615            if (infoPtr->himlState != NULL)
     5616              lprc->right += infoPtr->iconSize.cx;
     5617            if (infoPtr->himlSmall != NULL)
     5618              lprc->right += infoPtr->iconSize.cx;
     5619
     5620        nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     5621            nLabelWidth += TRAILING_PADDING;
     5622            if (infoPtr->himlSmall)
     5623              nLabelWidth += IMAGE_PADDING;
     5624        if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth)
     5625        {
     5626          lprc->right += nLabelWidth;
     5627        }
     5628        else
     5629        {
     5630          lprc->right = lprc->left + infoPtr->nItemWidth;
     5631        }
     5632          }
     5633        }
     5634        else
     5635        {
     5636          bResult = TRUE;
     5637          lprc->left = ptItem.x;
     5638          if (!(infoPtr->dwExStyle&LVS_EX_FULLROWSELECT) && uView&LVS_REPORT)
     5639            lprc->left += nIndent;
     5640          lprc->right = lprc->left;
     5641          lprc->top = ptItem.y;
     5642          lprc->bottom = lprc->top + infoPtr->nItemHeight;
     5643
     5644          if (infoPtr->dwExStyle & LVS_EX_FULLROWSELECT)
     5645      {
     5646        RECT br;
     5647        int nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
     5648        Header_GetItemRect(infoPtr->hwndHeader, nColumnCount-1, &br);
     5649
     5650        lprc->right = max(lprc->left, br.right - REPORT_MARGINX);
     5651      }
     5652          else
     5653          {
     5654         if (infoPtr->himlState != NULL)
     5655            {
     5656              lprc->right += infoPtr->iconSize.cx;
     5657            }
     5658
     5659            if (infoPtr->himlSmall != NULL)
     5660            {
     5661              lprc->right += infoPtr->iconSize.cx;
     5662            }
     5663
     5664        nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     5665            nLabelWidth += TRAILING_PADDING;
     5666        if (lprc->right + nLabelWidth < lprc->left + infoPtr->nItemWidth)
     5667        {
     5668          lprc->right += nLabelWidth;
     5669        }
     5670        else
     5671        {
     5672          lprc->right = lprc->left + infoPtr->nItemWidth;
     5673        }
     5674          }
     5675        }
     5676        break;
     5677
     5678      case LVIR_SELECTBOUNDS:
     5679        if (uView == LVS_ICON)
     5680        {
     5681          if (infoPtr->himlNormal != NULL)
     5682          {
     5683            if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)
     5684            {
     5685              bResult = TRUE;
     5686              lprc->left = ptItem.x + ptOrigin.x;
     5687              lprc->top = ptItem.y + ptOrigin.y;
     5688              lprc->right = lprc->left + infoPtr->iconSpacing.cx;
     5689              lprc->bottom = lprc->top + infoPtr->iconSpacing.cy;
     5690            }
     5691          }
     5692        }
     5693        else if (uView == LVS_SMALLICON)
     5694        {
     5695          if (LISTVIEW_GetOrigin(hwnd, &ptOrigin) != FALSE)
     5696          {
     5697            bResult = TRUE;
     5698            nLeftPos= lprc->left = ptItem.x + ptOrigin.x;
     5699            lprc->top = ptItem.y + ptOrigin.y;
     5700            lprc->bottom = lprc->top + infoPtr->nItemHeight;
     5701
    56815702            if (infoPtr->himlState != NULL)
    56825703            {
    56835704              lprc->left += infoPtr->iconSize.cx;
    56845705            }
    5685            
     5706
    56865707            lprc->right = lprc->left;
    5687            
     5708
    56885709            if (infoPtr->himlSmall != NULL)
    56895710            {
    56905711              lprc->right += infoPtr->iconSize.cx;
    56915712            }
    5692            
    5693             nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     5713
     5714        nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    56945715            nLabelWidth += TRAILING_PADDING;
    5695             if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
    5696             {
    5697               lprc->right += nLabelWidth;
    5698             }
    5699             else
    5700             {
    5701               lprc->right = nLeftPos + infoPtr->nItemWidth;
    5702             }
     5716        if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
     5717        {
     5718          lprc->right += nLabelWidth;
     5719        }
     5720        else
     5721        {
     5722          lprc->right = nLeftPos + infoPtr->nItemWidth;
     5723        }
    57035724          }
    57045725        }
     
    57075728          bResult = TRUE;
    57085729          if (!(infoPtr->dwExStyle&LVS_EX_FULLROWSELECT) && (uView&LVS_REPORT))
    5709             nLeftPos = lprc->left = ptItem.x + nIndent;
     5730        nLeftPos = lprc->left = ptItem.x + nIndent;
    57105731          else
    5711             nLeftPos = lprc->left = ptItem.x;
     5732        nLeftPos = lprc->left = ptItem.x;
    57125733          lprc->top = ptItem.y;
    57135734          lprc->bottom = lprc->top + infoPtr->nItemHeight;
     
    57175738            lprc->left += infoPtr->iconSize.cx;
    57185739          }
    5719          
     5740
    57205741          lprc->right = lprc->left;
    5721        
     5742
    57225743          if (infoPtr->dwExStyle & LVS_EX_FULLROWSELECT)
    57235744          {
    5724             RECT br;
    5725             int nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
    5726             Header_GetItemRect(infoPtr->hwndHeader, nColumnCount-1, &br);
     5745        RECT br;
     5746        int nColumnCount = Header_GetItemCount(infoPtr->hwndHeader);
     5747        Header_GetItemRect(infoPtr->hwndHeader, nColumnCount-1, &br);
    57275748
    57285749            lprc->right = max(lprc->left, br.right - REPORT_MARGINX);
     
    57355756            }
    57365757
    5737             nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
     5758        nLabelWidth = LISTVIEW_GetLabelWidth(hwnd, nItem);
    57385759            nLabelWidth += TRAILING_PADDING;
    57395760            if (infoPtr->himlSmall)
    57405761              nLabelWidth += IMAGE_PADDING;
    5741             if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
    5742             {
    5743               lprc->right += nLabelWidth;
    5744             }
    5745             else
    5746             {
    5747               lprc->right = nLeftPos + infoPtr->nItemWidth;
    5748             }
     5762        if (lprc->right + nLabelWidth < nLeftPos + infoPtr->nItemWidth)
     5763        {
     5764          lprc->right += nLabelWidth;
     5765        }
     5766        else
     5767        {
     5768          lprc->right = nLeftPos + infoPtr->nItemWidth;
     5769        }
    57495770          }
    57505771        }
     
    57595780 * DESCRIPTION:
    57605781 * Retrieves the width of a label.
    5761  * 
    5762  * PARAMETER(S):
    5763  * [I] HWND : window handle
    5764  * 
     5782 *
     5783 * PARAMETER(S):
     5784 * [I] HWND : window handle
     5785 *
    57655786 * RETURN:
    57665787 *   SUCCESS : string width (in pixels)
     
    57825803  if (LISTVIEW_GetItemA(hwnd, &lvItem, TRUE) != FALSE)
    57835804  {
    5784     nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText); 
    5785   }
    5786    
     5805    nLabelWidth = ListView_GetStringWidthA(hwnd, lvItem.pszText);
     5806  }
     5807
    57875808  return nLabelWidth;
    57885809}
     
    57915812 * DESCRIPTION:
    57925813 * Retrieves the spacing between listview control items.
    5793  * 
    5794  * PARAMETER(S):
    5795  * [I] HWND : window handle
    5796  * [I] BOOL : flag for small or large icon 
     5814 *
     5815 * PARAMETER(S):
     5816 * [I] HWND : window handle
     5817 * [I] BOOL : flag for small or large icon
    57975818 *
    57985819 * RETURN:
     
    58265847 * DESCRIPTION:
    58275848 * Retrieves the state of a listview control item.
    5828  * 
     5849 *
    58295850 * PARAMETER(S):
    58305851 * [I] HWND : window handle
    58315852 * [I] INT : item index
    58325853 * [I] UINT : state mask
    5833  * 
     5854 *
    58345855 * RETURN:
    58355856 * State specified by the mask.
     
    58585879/***
    58595880 * DESCRIPTION:
    5860  * Retrieves the text of a listview control item or subitem. 
    5861  * 
     5881 * Retrieves the text of a listview control item or subitem.
     5882 *
    58625883 * PARAMETER(S):
    58635884 * [I] HWND : window handle
    58645885 * [I] INT : item index
    58655886 * [IO] LPLVITEMA : item information
    5866  * 
     5887 *
    58675888 * RETURN:
    58685889 *   SUCCESS : string length
     
    58735894  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    58745895  INT nLength = 0;
    5875  
     5896
    58765897  if (lpLVItem != NULL)
    58775898  {
     
    58935914 * DESCRIPTION:
    58945915 * Searches for an item based on properties + relationships.
    5895  * 
     5916 *
    58965917 * PARAMETER(S):
    58975918 * [I] HWND : window handle
    58985919 * [I] INT : item index
    58995920 * [I] INT : relationship flag
    5900  * 
     5921 *
    59015922 * RETURN:
    59025923 *   SUCCESS : item index
     
    59115932  INT nCountPerColumn;
    59125933  INT i;
    5913  
     5934
    59145935  if ((nItem >= -1) && (nItem < GETITEMCOUNT(infoPtr)))
    5915   { 
     5936  {
    59165937    ZeroMemory(&lvFindInfo, sizeof(LVFINDINFO));
    59175938
    59185939    if (uFlags & LVNI_CUT)
    59195940      uMask |= LVIS_CUT;
    5920    
     5941
    59215942    if (uFlags & LVNI_DROPHILITED)
    59225943      uMask |= LVIS_DROPHILITED;
    5923          
     5944
    59245945    if (uFlags & LVNI_FOCUSED)
    59255946      uMask |= LVIS_FOCUSED;
     
    60436064 * DESCRIPTION:
    60446065 * Retrieves the origin coordinates when in icon or small icon display mode.
    6045  * 
     6066 *
    60466067 * PARAMETER(S):
    60476068 * [I] HWND : window handle
    60486069 * [O] LPPOINT : coordinate information
    6049  * 
     6070 *
    60506071 * RETURN:
    60516072 *   SUCCESS : TRUE
     
    60576078  UINT uView = lStyle & LVS_TYPEMASK;
    60586079  BOOL bResult = FALSE;
    6059  
     6080
    60606081  TRACE("(hwnd=%x, lpptOrigin=%p)\n", hwnd, lpptOrigin);
    60616082
     
    60706091    {
    60716092      scrollInfo.fMask = SIF_POS;
    6072       if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE) 
    6073       {
    6074         lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE; 
     6093      if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
     6094      {
     6095        lpptOrigin->x = -scrollInfo.nPos * LISTVIEW_SCROLL_DIV_SIZE;
    60756096      }
    60766097    }
     
    60846105      }
    60856106    }
    6086      
     6107
    60876108    bResult = TRUE;
    60886109  }
    6089  
     6110
    60906111  return bResult;
    60916112}
     
    60946115 * DESCRIPTION:
    60956116 * Retrieves the number of items that are marked as selected.
    6096  * 
    6097  * PARAMETER(S):
    6098  * [I] HWND : window handle
    6099  * 
     6117 *
     6118 * PARAMETER(S):
     6119 * [I] HWND : window handle
     6120 *
    61006121 * RETURN:
    61016122 * Number of items selected.
     
    61156136    }
    61166137  }
    6117  
     6138
    61186139  return nSelectedCount;
    61196140}
     
    61226143 * DESCRIPTION:
    61236144 * Retrieves item index that marks the start of a multiple selection.
    6124  * 
    6125  * PARAMETER(S):
    6126  * [I] HWND : window handle
    6127  * 
     6145 *
     6146 * PARAMETER(S):
     6147 * [I] HWND : window handle
     6148 *
    61286149 * RETURN:
    61296150 * Index number or -1 if there is no selection mark.
     
    61396160 * DESCRIPTION:
    61406161 * Retrieves the width of a string.
    6141  * 
    6142  * PARAMETER(S):
    6143  * [I] HWND : window handle
    6144  * 
     6162 *
     6163 * PARAMETER(S):
     6164 * [I] HWND : window handle
     6165 *
    61456166 * RETURN:
    61466167 *   SUCCESS : string width (in pixels)
     
    61516172{
    61526173  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     6174  DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
    61536175  HFONT hFont, hOldFont;
    61546176  SIZE stringSize;
     
    61736195      SelectObject(hdc, hOldFont);
    61746196      ReleaseDC(hwnd, hdc);
     6197    }
     6198    if(dwStyle & LVS_OWNERDRAWFIXED) {
     6199        /* Get item width */
     6200
     6201        MEASUREITEMSTRUCT mis;
     6202        UINT              id = GetWindowLongA(hwnd,GWL_ID);
     6203
     6204        mis.CtlType    = ODT_LISTVIEW;
     6205        mis.CtlID      = id;
     6206        mis.itemID     = 0;
     6207        mis.itemData   = 0;     //TODO:!!!!
     6208        mis.itemHeight = 0;
     6209        mis.itemWidth  = 0;
     6210        SendMessageA(GetParent(hwnd), WM_MEASUREITEM, id, (LPARAM)&mis );
     6211        stringSize.cx  = (mis.itemWidth) ? mis.itemWidth : infoPtr->nItemWidth;
    61756212    }
    61766213  }
     
    62046241 * DESCRIPTION:
    62056242 * Retrieves the text backgound color.
    6206  * 
    6207  * PARAMETER(S):
    6208  * [I] HWND : window handle
    6209  * 
     6243 *
     6244 * PARAMETER(S):
     6245 * [I] HWND : window handle
     6246 *
    62106247 * RETURN:
    62116248 * COLORREF associated with the the background.
     
    62216258 * DESCRIPTION:
    62226259 * Retrieves the text color.
    6223  * 
    6224  * PARAMETER(S):
    6225  * [I] HWND : window handle
    6226  * 
     6260 *
     6261 * PARAMETER(S):
     6262 * [I] HWND : window handle
     6263 *
    62276264 * RETURN:
    62286265 * COLORREF associated with the text.
     
    62386275 * DESCRIPTION:
    62396276 * Determines which section of the item was selected (if any).
    6240  * 
     6277 *
    62416278 * PARAMETER(S):
    62426279 * [I] HWND : window handle
     
    62646301  if (uView == LVS_REPORT)
    62656302  {
    6266     bottomindex = topindex + LISTVIEW_GetCountPerColumn(hwnd) + 1; 
     6303    bottomindex = topindex + LISTVIEW_GetCountPerColumn(hwnd) + 1;
    62676304    bottomindex = min(bottomindex,GETITEMCOUNT(infoPtr));
    62686305  }
     
    62906327          }
    62916328        }
    6292      
     6329
    62936330        rcItem.left = LVIR_LABEL;
    62946331        if (LISTVIEW_GetItemRect(hwnd, i, &rcItem) != FALSE)
     
    63026339          }
    63036340        }
    6304        
     6341
    63056342        lpHitTestInfo->flags = LVHT_ONITEMSTATEICON;
    63066343        lpHitTestInfo->iItem = i;
     
    63106347    }
    63116348  }
    6312      
     6349
    63136350  lpHitTestInfo->flags = LVHT_NOWHERE;
    63146351
     
    63196356 * DESCRIPTION:
    63206357 * Determines which listview item is located at the specified position.
    6321  * 
     6358 *
    63226359 * PARAMETER(S):
    63236360 * [I] HWND : window handle
     
    63396376    lpHitTestInfo->flags = LVHT_TOLEFT;
    63406377  }
    6341   else if (infoPtr->rcList.right < lpHitTestInfo->pt.x) 
     6378  else if (infoPtr->rcList.right < lpHitTestInfo->pt.x)
    63426379  {
    63436380    lpHitTestInfo->flags = LVHT_TORIGHT;
     
    63476384    lpHitTestInfo->flags |= LVHT_ABOVE;
    63486385  }
    6349   else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y) 
     6386  else if (infoPtr->rcList.bottom < lpHitTestInfo->pt.y)
    63506387  {
    63516388    lpHitTestInfo->flags |= LVHT_BELOW;
     
    63546391  if (lpHitTestInfo->flags == 0)
    63556392  {
    6356     /* NOTE (mm 20001022): We must not allow iSubItem to be touched, for 
     6393    /* NOTE (mm 20001022): We must not allow iSubItem to be touched, for
    63576394     * an app might pass only a structure with space up to iItem!
    63586395     * (MS Office 97 does that for instance in the file open dialog)
     
    63606397    nItem = LISTVIEW_HitTestItem(hwnd, lpHitTestInfo, FALSE);
    63616398  }
    6362  
     6399
    63636400  return nItem;
    63646401}
     
    63676404 * DESCRIPTION:
    63686405 * Inserts a new column.
    6369  * 
     6406 *
    63706407 * PARAMETER(S):
    63716408 * [I] HWND : window handle
     
    63776414 *   FAILURE : -1
    63786415 */
    6379 static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn, 
     6416static LRESULT LISTVIEW_InsertColumnA(HWND hwnd, INT nColumn,
    63806417                                      LPLVCOLUMNA lpColumn)
    63816418{
     
    63846421  INT nNewColumn = -1;
    63856422
    6386   TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn, 
     6423  TRACE("(hwnd=%x, nColumn=%d, lpColumn=%p)\n",hwnd, nColumn,
    63876424        lpColumn);
    63886425
    6389   if (lpColumn != NULL) 
     6426  if (lpColumn != NULL)
    63906427  {
    63916428    /* initialize memory */
    63926429    ZeroMemory(&hdi, sizeof(HDITEMA));
    63936430
    6394     if (lpColumn->mask & LVCF_FMT) 
     6431    if (lpColumn->mask & LVCF_FMT)
    63956432    {
    63966433      /* format member is valid */
     
    64176454        }
    64186455      }
    6419  
     6456
    64206457      if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT)
    64216458      {
     
    64286465        /* ??? */
    64296466      }
    6430      
     6467
    64316468      if (lpColumn->fmt & LVCFMT_IMAGE)
    64326469      {
     
    64366473    }
    64376474
    6438     if (lpColumn->mask & LVCF_WIDTH) 
     6475    if (lpColumn->mask & LVCF_WIDTH)
    64396476    {
    64406477      hdi.mask |= HDI_WIDTH;
    64416478      hdi.cxy = lpColumn->cx;
    64426479    }
    6443  
    6444     if (lpColumn->mask & LVCF_TEXT) 
     6480
     6481    if (lpColumn->mask & LVCF_TEXT)
    64456482    {
    64466483      hdi.mask |= HDI_TEXT | HDI_FORMAT;
     
    64496486      hdi.fmt |= HDF_STRING;
    64506487    }
    6451  
    6452     if (lpColumn->mask & LVCF_IMAGE) 
     6488
     6489    if (lpColumn->mask & LVCF_IMAGE)
    64536490    {
    64546491      hdi.mask |= HDI_IMAGE;
     
    64566493    }
    64576494
    6458     if (lpColumn->mask & LVCF_ORDER) 
     6495    if (lpColumn->mask & LVCF_ORDER)
    64596496    {
    64606497      hdi.mask |= HDI_ORDER;
     
    64656502    nNewColumn = SendMessageA(infoPtr->hwndHeader, HDM_INSERTITEMA,
    64666503                             (WPARAM)nColumn, (LPARAM)&hdi);
    6467    
     6504
    64686505    /* Need to reset the item width when inserting a new column */
    64696506    infoPtr->nItemWidth = LISTVIEW_GetItemWidth(hwnd);
     
    64766513}
    64776514
    6478 static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn, 
     6515static LRESULT LISTVIEW_InsertColumnW(HWND hwnd, INT nColumn,
    64796516                                      LPLVCOLUMNW lpColumn)
    64806517{
    6481   LVCOLUMNA     lvca;
    6482   LRESULT               lres;
    6483      
     6518  LVCOLUMNA lvca;
     6519  LRESULT       lres;
     6520
    64846521  memcpy(&lvca,lpColumn,sizeof(lvca));
    64856522  if (lpColumn->mask & LVCF_TEXT) {
     
    65066543    (remarks on LVITEM: LVM_INSERTITEM will insert the new item in the proper sort postion...
    65076544        if:
    6508           LVS_SORTXXX must be specified, 
    6509           LVS_OWNERDRAW is not set, 
     6545          LVS_SORTXXX must be specified,
     6546          LVS_OWNERDRAW is not set,
    65106547          <item>.pszText is not LPSTR_TEXTCALLBACK.
    65116548
    6512     (LVS_SORT* flags): "For the LVS_SORTASCENDING... styles, item indices 
    6513     are sorted based on item text..." 
     6549    (LVS_SORT* flags): "For the LVS_SORTASCENDING... styles, item indices
     6550    are sorted based on item text..."
    65146551*/
    65156552static INT WINAPI LISTVIEW_InsertCompare(  LPVOID first, LPVOID second,  LPARAM lParam)
     
    65286565 * nESCRIPTION:
    65296566 * Inserts a new item in the listview control.
    6530  * 
     6567 *
    65316568 * PARAMETER(S):
    65326569 * [I] HWND : window handle
     
    65776614            {
    65786615              if ( ((lStyle & LVS_SORTASCENDING) || (lStyle & LVS_SORTDESCENDING))
    6579                       && !(lStyle & LVS_OWNERDRAWFIXED)
    6580                       && (LPSTR_TEXTCALLBACKA != lpLVItem->pszText) )
    6581               {
    6582                 /* Insert the item in the proper sort order based on the pszText
    6583                   member. See comments for LISTVIEW_InsertCompare() for greater detail */
    6584                   nItem = DPA_InsertPtr( infoPtr->hdpaItems,
    6585                           GETITEMCOUNT( infoPtr ) + 1, hdpaSubItems );
    6586                   DPA_Sort( infoPtr->hdpaItems, LISTVIEW_InsertCompare, hwnd );
    6587                   nItem = DPA_GetPtrIndex( infoPtr->hdpaItems, hdpaSubItems );
    6588               }
    6589               else
    6590               {
    6591                 nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem, 
     6616              && !(lStyle & LVS_OWNERDRAWFIXED)
     6617              && (LPSTR_TEXTCALLBACKA != lpLVItem->pszText) )
     6618          {
     6619        /* Insert the item in the proper sort order based on the pszText
     6620          member. See comments for LISTVIEW_InsertCompare() for greater detail */
     6621          nItem = DPA_InsertPtr( infoPtr->hdpaItems,
     6622              GETITEMCOUNT( infoPtr ) + 1, hdpaSubItems );
     6623          DPA_Sort( infoPtr->hdpaItems, LISTVIEW_InsertCompare, hwnd );
     6624          nItem = DPA_GetPtrIndex( infoPtr->hdpaItems, hdpaSubItems );
     6625          }
     6626          else
     6627          {
     6628                nItem = DPA_InsertPtr(infoPtr->hdpaItems, lpLVItem->iItem,
    65926629                                    hdpaSubItems);
    6593               }
     6630          }
    65946631              if (nItem != -1)
    65956632              {
     
    65996636                if (lpLVItem->mask & LVIF_STATE)
    66006637                {
    6601                   lpItem->state &= ~(LVIS_FOCUSED|LVIS_SELECTED);
     6638              lpItem->state &= ~(LVIS_FOCUSED|LVIS_SELECTED);
    66026639                  if (lpLVItem->stateMask & LVIS_SELECTED)
    66036640                  {
    66046641                    LISTVIEW_SetSelection(hwnd, nItem);
    6605                   }
    6606                   else if (lpLVItem->stateMask & LVIS_FOCUSED)
     6642          }
     6643          else if (lpLVItem->stateMask & LVIS_FOCUSED)
    66076644                  {
    66086645                    LISTVIEW_SetItemFocus(hwnd, nItem);
    6609                   }           
     6646                  }
    66106647                }
    6611                
     6648
    66126649                /* send LVN_INSERTITEM notification */
    66136650                ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
     
    66186655                nmlv.lParam = lpItem->lParam;;
    66196656                ListView_LVNotify(GetParent(hwnd), lCtrlId, &nmlv);
    6620                
     6657
    66216658                if ((uView == LVS_SMALLICON) || (uView == LVS_LIST))
    6622                 {
    6623                   nItemWidth = LISTVIEW_CalculateWidth(hwnd, lpLVItem->iItem);
    6624                   if (nItemWidth > infoPtr->nItemWidth)
    6625                   {
    6626                     infoPtr->nItemWidth = nItemWidth;
    6627                   }
    6628                 }
     6659        {
     6660          nItemWidth = LISTVIEW_CalculateWidth(hwnd, lpLVItem->iItem);
     6661          if (nItemWidth > infoPtr->nItemWidth)
     6662          {
     6663            infoPtr->nItemWidth = nItemWidth;
     6664          }
     6665        }
    66296666
    66306667                /* align items (set position of each item) */
     
    66406677                  }
    66416678                }
    6642                
     6679
    66436680                LISTVIEW_UpdateScroll(hwnd);
    66446681                /* refresh client area */
     
    66576694    COMCTL32_Free(lpItem);
    66586695  }
    6659  
     6696
    66606697  return nItem;
    66616698}
     
    66856722 * DESCRIPTION:
    66866723 * Redraws a range of items.
    6687  * 
     6724 *
    66886725 * PARAMETER(S):
    66896726 * [I] HWND : window handle
     
    66976734static LRESULT LISTVIEW_RedrawItems(HWND hwnd, INT nFirst, INT nLast)
    66986735{
    6699   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); 
     6736  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    67006737  BOOL bResult = FALSE;
    67016738  RECT rcItem;
     
    67106747          for (i = nFirst; i <= nLast; i++)
    67116748          {
    6712                   rcItem.left = LVIR_BOUNDS;
    6713                   LISTVIEW_GetItemRect(hwnd, i, &rcItem);
    6714                   InvalidateRect(hwnd, &rcItem, TRUE);
     6749              rcItem.left = LVIR_BOUNDS;
     6750              LISTVIEW_GetItemRect(hwnd, i, &rcItem);
     6751              InvalidateRect(hwnd, &rcItem, TRUE);
    67156752          }
    67166753      }
     
    67266763 * DESCRIPTION:
    67276764 * Sets the background color.
    6728  * 
     6765 *
    67296766 * PARAMETER(S):
    67306767 * [I] HWND : window handle
     
    67416778  infoPtr->clrBk = clrBk;
    67426779  InvalidateRect(hwnd, NULL, TRUE);
    6743  
     6780
    67446781  return TRUE;
    67456782}
     
    67516788 * Sets the callback mask. This mask will be used when the parent
    67526789 * window stores state information (some or all).
    6753  * 
     6790 *
    67546791 * PARAMETER(S):
    67556792 * [I] HWND : window handle
     
    67726809 * DESCRIPTION:
    67736810 * Sets the attributes of a header item.
    6774  * 
     6811 *
    67756812 * PARAMETER(S):
    67766813 * [I] HWND : window handle
     
    67826819 *   FAILURE : FALSE
    67836820 */
    6784 static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, 
     6821static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn,
    67856822                                   LPLVCOLUMNA lpColumn)
    67866823{
     
    67896826  HDITEMA hdi, hdiget;
    67906827
    6791   if ((lpColumn != NULL) && (nColumn >= 0) && 
     6828  if ((lpColumn != NULL) && (nColumn >= 0) &&
    67926829      (nColumn < Header_GetItemCount(infoPtr->hwndHeader)))
    67936830  {
     
    67956832    ZeroMemory(&hdi, sizeof(HDITEMA));
    67966833
    6797     if (lpColumn->mask & LVCF_FMT) 
     6834    if (lpColumn->mask & LVCF_FMT)
    67986835    {
    67996836      /* format member is valid */
     
    68036840      hdiget.mask = HDI_FORMAT;
    68046841      if (Header_GetItemA(infoPtr->hwndHeader, nColumn, &hdiget))
    6805               /* preserve HDF_STRING if present */
    6806               hdi.fmt = hdiget.fmt & HDF_STRING;
     6842          /* preserve HDF_STRING if present */
     6843          hdi.fmt = hdiget.fmt & HDF_STRING;
    68076844
    68086845      /* set text alignment (leftmost column must be left-aligned) */
     
    68266863        }
    68276864      }
    6828      
     6865
    68296866      if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT)
    68306867      {
     
    68366873        hdi.fmt |= HDF_IMAGE;
    68376874      }
    6838      
     6875
    68396876      if (lpColumn->fmt & LVCFMT_IMAGE)
    68406877      {
     
    68446881    }
    68456882
    6846     if (lpColumn->mask & LVCF_WIDTH) 
     6883    if (lpColumn->mask & LVCF_WIDTH)
    68476884    {
    68486885      hdi.mask |= HDI_WIDTH;
    68496886      hdi.cxy = lpColumn->cx;
    68506887    }
    6851    
    6852     if (lpColumn->mask & LVCF_TEXT) 
     6888
     6889    if (lpColumn->mask & LVCF_TEXT)
    68536890    {
    68546891      hdi.mask |= HDI_TEXT | HDI_FORMAT;
     
    68576894      hdi.fmt |= HDF_STRING;
    68586895    }
    6859  
    6860     if (lpColumn->mask & LVCF_IMAGE) 
     6896
     6897    if (lpColumn->mask & LVCF_IMAGE)
    68616898    {
    68626899      hdi.mask |= HDI_IMAGE;
     
    68646901    }
    68656902
    6866     if (lpColumn->mask & LVCF_ORDER) 
     6903    if (lpColumn->mask & LVCF_ORDER)
    68676904    {
    68686905      hdi.mask |= HDI_ORDER;
     
    68736910    bResult = Header_SetItemA(infoPtr->hwndHeader, nColumn, &hdi);
    68746911  }
    6875  
     6912
    68766913  return bResult;
    68776914}
     
    68996936
    69006937    if (!lpiArray)
    6901         return FALSE;
     6938    return FALSE;
    69026939
    69036940    return TRUE;
     
    69246961    LRESULT lret;
    69256962    LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    6926     UINT uView = lStyle & LVS_TYPEMASK; 
     6963    UINT uView = lStyle & LVS_TYPEMASK;
    69276964    HDC hdc;
    69286965    HFONT header_font;
     
    69446981    /* set column width only if in report or list mode */
    69456982    if ((uView != LVS_REPORT) && (uView != LVS_LIST))
    6946       return (FALSE);           
     6983      return (FALSE);
    69476984
    69486985    /* take care of invalid cx values */
     
    69516988    else if (uView == LVS_LIST && (cx < 1))
    69526989      return FALSE;
    6953  
     6990
    69546991    /* resize all columns if in LVS_LIST mode */
    69556992    if(uView == LVS_LIST) {
     
    69677004        if(cx < LISTVIEW_GetLabelWidth(hwnd, item_index))
    69687005          cx = LISTVIEW_GetLabelWidth(hwnd, item_index);
    6969       } 
     7006      }
    69707007    } /* autosize based on listview header width */
    69717008    else if(cx == LVSCW_AUTOSIZE_USEHEADER)
    69727009    {
    69737010      header_item_count = Header_GetItemCount(infoPtr->hwndHeader);
    6974  
     7011
    69757012      /* if iCol is the last column make it fill the remainder of the controls width */
    69767013      if(iCol == (header_item_count - 1)) {
     
    69787015        hdi.mask = HDI_WIDTH;
    69797016        cx = 0;
    6980        
     7017
    69817018        for(item_index = 0; item_index < (header_item_count - 1); item_index++) {
    69827019          Header_GetItemA(infoPtr->hwndHeader, item_index, (LPARAM)(&hdi));
    69837020          cx+=hdi.cxy;
    69847021        }
    6985  
     7022
    69867023        /* retrieve the layout of the header */
    69877024        GetWindowRect(infoPtr->hwndHeader, &rcHeader);
    69887025
    69897026        cx = (rcHeader.right - rcHeader.left) - cx;
    6990       }                                 
     7027      }
    69917028      else
    69927029      {
    69937030        /* retrieve header font */
    69947031        header_font = SendMessageA(infoPtr->hwndHeader, WM_GETFONT, 0L, 0L);
    6995  
     7032
    69967033        /* retrieve header text */
    69977034        hdi.mask = HDI_TEXT;
    69987035        hdi.cchTextMax = sizeof(text_buffer);
    6999         hdi.pszText = text_buffer;             
    7000    
     7036        hdi.pszText = text_buffer;
     7037
    70017038        Header_GetItemA(infoPtr->hwndHeader, iCol, (LPARAM)(&hdi));
    7002  
     7039
    70037040        /* determine the width of the text in the header */
    70047041        hdc = GetDC(hwnd);
     
    70067043
    70077044        GetTextExtentPoint32A(hdc, text_buffer, strlen(text_buffer), &size);
    7008  
    7009         SelectObject(hdc, old_font); /* restore the old font */   
     7045
     7046        SelectObject(hdc, old_font); /* restore the old font */
    70107047        ReleaseDC(hwnd, hdc);
    7011  
     7048
    70127049        /* set the width of this column to the width of the text */
    70137050        cx = size.cx;
     
    70167053
    70177054  /* call header to update the column change */
    7018   hdi.mask = HDI_WIDTH;                         
     7055  hdi.mask = HDI_WIDTH;
    70197056
    70207057  hdi.cxy = cx;
    70217058  lret = Header_SetItemA(infoPtr->hwndHeader, (WPARAM)iCol, (LPARAM)&hdi);
    7022  
     7059
    70237060  InvalidateRect(hwnd, NULL, TRUE); /* force redraw of the listview */
    7024  
     7061
    70257062  return lret;
    70267063}
     
    70467083    /* make sure we can get the listview info */
    70477084    if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0)))
    7048         return (0);
     7085    return (0);
    70497086
    70507087    /* store previous style */
     
    70817118    /* make sure we can get the listview info */
    70827119    if (!(infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0)))
    7083         return (-1);
     7120    return (-1);
    70847121
    70857122    /* store previous index */
     
    71187155 * DESCRIPTION:
    71197156 * Sets image lists.
    7120  * 
    7121  * PARAMETER(S):
    7122  * [I] HWND : window handle
    7123  * [I] INT : image list type 
     7157 *
     7158 * PARAMETER(S):
     7159 * [I] HWND : window handle
     7160 * [I] INT : image list type
    71247161 * [I] HIMAGELIST : image list handle
    71257162 *
     
    71347171  INT oldHeight;
    71357172
    7136   switch (nType) 
     7173  switch (nType)
    71377174  {
    71387175  case LVSIL_NORMAL:
     
    71657202 * DESCRIPTION:
    71667203 * Sets the attributes of an item.
    7167  * 
    7168  * PARAMETER(S):
    7169  * [I] HWND : window handle
    7170  * [I] LPLVITEM : item information 
     7204 *
     7205 * PARAMETER(S):
     7206 * [I] HWND : window handle
     7207 * [I] LPLVITEM : item information
    71717208 *
    71727209 * RETURN:
     
    72037240 * DESCRIPTION:
    72047241 * Preallocates memory (does *not* set the actual count of items !)
    7205  * 
     7242 *
    72067243 * PARAMETER(S):
    72077244 * [I] HWND : window handle
     
    72237260
    72247261      /*
    7225        * Internally remove all the selections. 
     7262       * Internally remove all the selections.
    72267263       */
    72277264      do
     
    72347271      }
    72357272      while (infoPtr->hdpaSelectionRanges->nItemCount>0);
    7236  
     7273
    72377274      precount = infoPtr->hdpaItems->nItemCount;
    72387275      topvisible = ListView_GetTopIndex(hwnd) +
     
    72437280      LISTVIEW_UpdateSize(hwnd);
    72447281      LISTVIEW_UpdateScroll(hwnd);
    7245       if (min(precount,infoPtr->hdpaItems->nItemCount)<topvisible) 
     7282      if (min(precount,infoPtr->hdpaItems->nItemCount)<topvisible)
    72467283        InvalidateRect(hwnd, NULL, TRUE);
    72477284  }
     
    72577294 * DESCRIPTION:
    72587295 * Sets the position of an item.
    7259  * 
     7296 *
    72607297 * PARAMETER(S):
    72617298 * [I] HWND : window handle
     
    72797316
    72807317  TRACE("(hwnd=%x,nItem=%d,X=%ld,Y=%ld)\n", hwnd, nItem, nPosX, nPosY);
    7281  
     7318
    72827319  if (lStyle & LVS_OWNERDATA)
    72837320    return FALSE;
     
    73077344 * DESCRIPTION:
    73087345 * Sets the state of one or many items.
    7309  * 
     7346 *
    73107347 * PARAMETER(S):
    73117348 * [I] HWND : window handle
     
    73317368    lvItem.state = lpLVItem->state;
    73327369    lvItem.stateMask = lpLVItem->stateMask ;
    7333    
     7370
    73347371    /* apply to all items */
    73357372    for (i = 0; i< GETITEMCOUNT(infoPtr); i++)
     
    73587395 * DESCRIPTION:
    73597396 * Sets the text of an item or subitem.
    7360  * 
     7397 *
    73617398 * PARAMETER(S):
    73627399 * [I] HWND : window handle
     
    73837420    bResult = ListView_SetItemA(hwnd, &lvItem);
    73847421  }
    7385  
     7422
    73867423  return bResult;
    73877424}
     
    74137450 * DESCRIPTION:
    74147451 * Sets the text background color.
    7415  * 
     7452 *
    74167453 * PARAMETER(S):
    74177454 * [I] HWND : window handle
     
    74357472 * DESCRIPTION:
    74367473 * Sets the text foreground color.
    7437  * 
    7438  * PARAMETER(S):
    7439  * [I] HWND : window handle
    7440  * [I] COLORREF : text color 
     7474 *
     7475 * PARAMETER(S):
     7476 * [I] HWND : window handle
     7477 * [I] COLORREF : text color
    74417478 *
    74427479 * RETURN:
     
    74617498 * DESCRIPTION:
    74627499 * Callback internally used by LISTVIEW_SortItems()
    7463  * 
     7500 *
    74647501 * PARAMETER(S):
    74657502 * [I] LPVOID : first LISTVIEW_ITEM to compare
     
    74727509 *   if first and second are equivalent : zero
    74737510 */
    7474 static INT WINAPI LISTVIEW_CallBackCompare( 
    7475   LPVOID first, 
    7476   LPVOID second, 
     7511static INT WINAPI LISTVIEW_CallBackCompare(
     7512  LPVOID first,
     7513  LPVOID second,
    74777514  LPARAM lParam)
    74787515{
     
    74947531 * DESCRIPTION:
    74957532 * Sorts the listview items.
    7496  * 
     7533 *
    74977534 * PARAMETER(S):
    74987535 * [I] HWND : window handle
     
    75177554
    75187555    if (!infoPtr || !infoPtr->hdpaItems)
    7519         return FALSE;
    7520    
     7556    return FALSE;
     7557
    75217558    nCount = GETITEMCOUNT(infoPtr);
    75227559    /* if there are 0 or 1 items, there is no need to sort */
     
    75287565    DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, hwnd);
    75297566
    7530     /* Adjust selections and indices so that they are the way they should 
    7531      * be after the sort (otherwise, the list items move around, but 
    7532      * whatever is at the item's previous original position will be 
     7567    /* Adjust selections and indices so that they are the way they should
     7568     * be after the sort (otherwise, the list items move around, but
     7569     * whatever is at the item's previous original position will be
    75337570     * selected instead)
    75347571     */
     
    75647601 * DESCRIPTION:
    75657602 * Updates an items or rearranges the listview control.
    7566  * 
     7603 *
    75677604 * PARAMETER(S):
    75687605 * [I] HWND : window handle
     
    76047641 * DESCRIPTION:
    76057642 * Creates the listview control.
    7606  * 
     7643 *
    76077644 * PARAMETER(S):
    76087645 * [I] HWND : window handle
     
    76227659
    76237660  /* determine the type of structures to use */
    7624   infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT, 
     7661  infoPtr->notifyFormat = SendMessageA(GetParent(hwnd), WM_NOTIFYFORMAT,
    76257662                                       (WPARAM)hwnd, (LPARAM)NF_QUERY);
    76267663  if (infoPtr->notifyFormat != NFR_ANSI)
     
    76287665    FIXME("ANSI notify format is NOT used\n");
    76297666  }
    7630  
     7667
    76317668  /* initialize color information  */
    76327669  infoPtr->clrBk = GetSysColor(COLOR_WINDOW);
     
    76507687  infoPtr->hDefaultFont = CreateFontIndirectA(&logFont);
    76517688  infoPtr->hFont = infoPtr->hDefaultFont;
    7652  
     7689
    76537690  /* create header */
    7654   infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL,
    7655                                       WS_CHILD | HDS_HORZ | HDS_BUTTONS, 
    7656                                       0, 0, 0, 0, hwnd, (HMENU)0, 
     7691  infoPtr->hwndHeader = CreateWindowA(WC_HEADERA, (LPCSTR)NULL,
     7692                                      WS_CHILD | HDS_HORZ | HDS_BUTTONS,
     7693                                      0, 0, 0, 0, hwnd, (HMENU)0,
    76577694                                      lpcs->hInstance, NULL);
    76587695
    76597696  /* set header font */
    7660   SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, 
     7697  SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont,
    76617698               (LPARAM)TRUE);
    7662  
     7699
    76637700  if (uView == LVS_ICON)
    76647701  {
     
    76757712    {
    76767713      /* set HDS_HIDDEN flag to hide the header bar */
    7677       SetWindowLongA(infoPtr->hwndHeader, GWL_STYLE, 
     7714      SetWindowLongA(infoPtr->hwndHeader, GWL_STYLE,
    76787715                    GetWindowLongA(infoPtr->hwndHeader, GWL_STYLE) | HDS_HIDDEN);
    76797716    }
    7680      
     7717
    76817718
    76827719    infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
     
    77037740
    77047741  /* initialize the hover time to -1(indicating the default system hover time) */
    7705   infoPtr->dwHoverTime = -1; 
     7742  infoPtr->dwHoverTime = -1;
    77067743
    77077744#ifdef __WIN32OS2__
     
    77197756 * DESCRIPTION:
    77207757 * Erases the background of the listview control.
    7721  * 
     7758 *
    77227759 * PARAMETER(S):
    77237760 * [I] HWND : window handle
    77247761 * [I] WPARAM : device context handle
    77257762 * [I] LPARAM : not used
    7726  * 
     7763 *
    77277764 * RETURN:
    77287765 *   SUCCESS : TRUE
    77297766 *   FAILURE : FALSE
    77307767 */
    7731 static LRESULT LISTVIEW_EraseBackground(HWND hwnd, WPARAM wParam, 
     7768static LRESULT LISTVIEW_EraseBackground(HWND hwnd, WPARAM wParam,
    77327769                                        LPARAM lParam)
    77337770{
     
    77357772  BOOL bResult;
    77367773
    7737   if (infoPtr->clrBk == CLR_NONE) 
     7774  if (infoPtr->clrBk == CLR_NONE)
    77387775  {
    77397776    bResult = SendMessageA(GetParent(hwnd), WM_ERASEBKGND, wParam, lParam);
    77407777  }
    7741   else 
     7778  else
    77427779  {
    77437780    RECT rc;
     
    77577794  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    77587795
    7759   if (infoPtr->clrBk != CLR_NONE) 
     7796  if (infoPtr->clrBk != CLR_NONE)
    77607797  {
    77617798    HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
     
    77687805 * DESCRIPTION:
    77697806 * Retrieves the listview control font.
    7770  * 
     7807 *
    77717808 * PARAMETER(S):
    77727809 * [I] HWND : window handle
     
    77857822 * DESCRIPTION:
    77867823 * Performs vertical scrolling.
    7787  * 
     7824 *
    77887825 * PARAMETER(S):
    77897826 * [I] HWND : window handle
    77907827 * [I] INT : scroll code
    7791  * [I] SHORT : current scroll position if scroll code is SB_THUMBPOSITION 
     7828 * [I] SHORT : current scroll position if scroll code is SB_THUMBPOSITION
    77927829 *             or SB_THUMBTRACK.
    77937830 * [I] HWND : scrollbar control window handle
     
    78197856      }
    78207857    break;
    7821    
     7858
    78227859    case SB_LINEDOWN:
    78237860      if (scrollInfo.nPos < scrollInfo.nMax)
     
    78267863      }
    78277864      break;
    7828      
     7865
    78297866    case SB_PAGEUP:
    78307867      if (scrollInfo.nPos > scrollInfo.nMin)
     
    78407877      }
    78417878      break;
    7842      
     7879
    78437880    case SB_PAGEDOWN:
    78447881      if (scrollInfo.nPos < scrollInfo.nMax)
     
    78747911    }
    78757912  }
    7876    
     7913
    78777914  return 0;
    78787915}
     
    78817918 * DESCRIPTION:
    78827919 * Performs horizontal scrolling.
    7883  * 
     7920 *
    78847921 * PARAMETER(S):
    78857922 * [I] HWND : window handle
    78867923 * [I] INT : scroll code
    7887  * [I] SHORT : current scroll position if scroll code is SB_THUMBPOSITION 
     7924 * [I] SHORT : current scroll position if scroll code is SB_THUMBPOSITION
    78887925 *             or SB_THUMBTRACK.
    78897926 * [I] HWND : scrollbar control window handle
     
    79047941  scrollInfo.cbSize = sizeof(SCROLLINFO);
    79057942  scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
    7906  
     7943
    79077944  if (GetScrollInfo(hwnd, SB_HORZ, &scrollInfo) != FALSE)
    79087945  {
     
    79177954      }
    79187955      break;
    7919    
     7956
    79207957    case SB_LINERIGHT:
    79217958      if (scrollInfo.nPos < scrollInfo.nMax)
     
    79247961      }
    79257962      break;
    7926      
     7963
    79277964    case SB_PAGELEFT:
    79287965      if (scrollInfo.nPos > scrollInfo.nMin)
     
    79387975      }
    79397976      break;
    7940      
     7977
    79417978    case SB_PAGERIGHT:
    79427979      if (scrollInfo.nPos < scrollInfo.nMax)
     
    79798016    }
    79808017  }
    7981    
     8018
    79828019  return 0;
    79838020}
     
    80318068/***
    80328069 * DESCRIPTION:
    8033  * ??? 
    8034  * 
    8035  * PARAMETER(S):
    8036  * [I] HWND : window handle
    8037  * [I] INT : virtual key 
     8070 * ???
     8071 *
     8072 * PARAMETER(S):
     8073 * [I] HWND : window handle
     8074 * [I] INT : virtual key
    80388075 * [I] LONG : key data
    80398076 *
     
    80468083  INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
    80478084  HWND hwndParent = GetParent(hwnd);
    8048   NMLVKEYDOWN nmKeyDown; 
     8085  NMLVKEYDOWN nmKeyDown;
    80498086  NMHDR nmh;
    80508087  INT nItem = -1;
     
    80558092  /* send LVN_KEYDOWN notification */
    80568093  ZeroMemory(&nmKeyDown, sizeof(NMLVKEYDOWN));
    8057   nmKeyDown.hdr.hwndFrom = hwnd; 
    8058   nmKeyDown.hdr.idFrom = nCtrlId; 
    8059   nmKeyDown.hdr.code = LVN_KEYDOWN; 
    8060   nmKeyDown.wVKey = nVirtualKey; 
    8061   nmKeyDown.flags = 0; 
    8062   SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown); 
    8063  
     8094  nmKeyDown.hdr.hwndFrom = hwnd;
     8095  nmKeyDown.hdr.idFrom = nCtrlId;
     8096  nmKeyDown.hdr.code = LVN_KEYDOWN;
     8097  nmKeyDown.wVKey = nVirtualKey;
     8098  nmKeyDown.flags = 0;
     8099  SendMessageA(hwndParent, WM_NOTIFY, (WPARAM)nCtrlId, (LPARAM)&nmKeyDown);
     8100
    80648101  /* initialize */
    80658102  nmh.hwndFrom = hwnd;
     
    80748111      nmh.code = NM_RETURN;
    80758112      ListView_Notify(hwndParent, nCtrlId, &nmh);
    8076      
     8113
    80778114      /* send LVN_ITEMACTIVATE notification */
    80788115      nmh.code = LVN_ITEMACTIVATE;
     
    81028139    nItem = ListView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_ABOVE);
    81038140    break;
    8104    
     8141
    81058142  case VK_RIGHT:
    81068143    nItem = ListView_GetNextItem(hwnd, infoPtr->nFocusedItem, LVNI_TORIGHT);
     
    81188155    else
    81198156    {
    8120       nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(hwnd) 
     8157      nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(hwnd)
    81218158                                    * LISTVIEW_GetCountPerRow(hwnd);
    81228159    }
     
    81548191 * DESCRIPTION:
    81558192 * Kills the focus.
    8156  * 
     8193 *
    81578194 * PARAMETER(S):
    81588195 * [I] HWND : window handle
     
    81708207  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    81718208  UINT uView =  lStyle & LVS_TYPEMASK;
    8172  
     8209
    81738210  TRACE("(hwnd=%x)\n", hwnd);
    81748211
     
    81848221  /* NEED drawing optimization ; redraw the selected items */
    81858222  if (uView & LVS_REPORT)
    8186   { 
     8223  {
    81878224    nTop = LISTVIEW_GetTopIndex(hwnd);
    8188     nBottom = nTop + 
     8225    nBottom = nTop +
    81898226              LISTVIEW_GetCountPerColumn(hwnd) + 1;
    81908227  }
     
    82108247 * DESCRIPTION:
    82118248 * Processes double click messages (left mouse button).
    8212  * 
     8249 *
    82138250 * PARAMETER(S):
    82148251 * [I] HWND : window handle
     
    82208257 * Zero
    82218258 */
    8222 static LRESULT LISTVIEW_LButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 
     8259static LRESULT LISTVIEW_LButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX,
    82238260                                      WORD wPosY)
    82248261{
     
    82498286    nmlv.iItem = -1;
    82508287    nmlv.iSubItem = 0;
    8251   } 
     8288  }
    82528289  nmlv.ptAction.x = wPosX;
    82538290  nmlv.ptAction.y = wPosY;
     
    82718308 * DESCRIPTION:
    82728309 * Processes mouse down messages (left mouse button).
    8273  * 
     8310 *
    82748311 * PARAMETER(S):
    82758312 * [I] HWND : window handle
     
    82818318 * Zero
    82828319 */
    8283 static LRESULT LISTVIEW_LButtonDown(HWND hwnd, WORD wKey, WORD wPosX, 
     8320static LRESULT LISTVIEW_LButtonDown(HWND hwnd, WORD wKey, WORD wPosX,
    82848321                                    WORD wPosY)
    82858322{
     
    82928329  INT nItem;
    82938330
    8294   TRACE("(hwnd=%x, key=%hu, X=%hu, Y=%hu)\n", hwnd, wKey, wPosX, 
     8331  TRACE("(hwnd=%x, key=%hu, X=%hu, Y=%hu)\n", hwnd, wKey, wPosX,
    82958332        wPosY);
    82968333
    8297   /* send NM_RELEASEDCAPTURE notification */ 
     8334  /* send NM_RELEASEDCAPTURE notification */
    82988335  nmh.hwndFrom = hwnd;
    82998336  nmh.idFrom = nCtrlId;
    83008337  nmh.code = NM_RELEASEDCAPTURE;
    83018338  ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
    8302  
     8339
    83038340  if (infoPtr->bFocus == FALSE)
    83048341  {
     
    83088345  /* set left button down flag */
    83098346  infoPtr->bLButtonDown = TRUE;
    8310  
     8347
    83118348  ptPosition.x = wPosX;
    83128349  ptPosition.y = wPosY;
     
    83178354    {
    83188355      if ((ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED)
    8319           && infoPtr->nEditLabelItem == -1) 
     8356          && infoPtr->nEditLabelItem == -1)
    83208357      {
    83218358          infoPtr->nEditLabelItem = nItem;
     
    83498386      else
    83508387      {
    8351         BOOL was_selected =
    8352             (ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED);
    8353 
    8354         /* set selection (clears other pre-existing selections) */
     8388    BOOL was_selected =
     8389        (ListView_GetItemState(hwnd, nItem, LVIS_SELECTED) & LVIS_SELECTED);
     8390
     8391    /* set selection (clears other pre-existing selections) */
    83558392        LISTVIEW_SetSelection(hwnd, nItem);
    83568393
     
    83778414 * DESCRIPTION:
    83788415 * Processes mouse up messages (left mouse button).
    8379  * 
     8416 *
    83808417 * PARAMETER(S):
    83818418 * [I] HWND : window handle
     
    83878424 * Zero
    83888425 */
    8389 static LRESULT LISTVIEW_LButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 
     8426static LRESULT LISTVIEW_LButtonUp(HWND hwnd, WORD wKey, WORD wPosX,
    83908427                                  WORD wPosY)
    83918428{
     
    83948431  TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);
    83958432
    8396   if (infoPtr->bLButtonDown != FALSE) 
     8433  if (infoPtr->bLButtonDown != FALSE)
    83978434  {
    83988435    INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
     
    84448481 * DESCRIPTION:
    84458482 * Creates the listview control (called before WM_CREATE).
    8446  * 
    8447  * PARAMETER(S):
    8448  * [I] HWND : window handle
    8449  * [I] WPARAM : unhandled 
     8483 *
     8484 * PARAMETER(S):
     8485 * [I] HWND : window handle
     8486 * [I] WPARAM : unhandled
    84508487 * [I] LPARAM : widow creation info
    8451  * 
     8488 *
    84528489 * RETURN:
    84538490 * Zero
     
    84668503#endif
    84678504  SetWindowLongA(hwnd, 0, (LONG)infoPtr);
    8468   if (infoPtr == NULL) 
     8505  if (infoPtr == NULL)
    84698506  {
    84708507    ERR("could not allocate info memory!\n");
     
    84728509  }
    84738510
    8474   if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr) 
     8511  if ((LISTVIEW_INFO *)GetWindowLongA(hwnd, 0) != infoPtr)
    84758512  {
    84768513    ERR("pointer assignment error!\n");
     
    84848521 * DESCRIPTION:
    84858522 * Destroys the listview control (called after WM_DESTROY).
    8486  * 
    8487  * PARAMETER(S):
    8488  * [I] HWND : window handle
    8489  * 
     8523 *
     8524 * PARAMETER(S):
     8525 * [I] HWND : window handle
     8526 *
    84908527 * RETURN:
    84918528 * Zero
     
    85268563 * DESCRIPTION:
    85278564 * Handles notifications from children.
    8528  * 
     8565 *
    85298566 * PARAMETER(S):
    85308567 * [I] HWND : window handle
    85318568 * [I] INT : control identifier
    85328569 * [I] LPNMHDR : notification information
    8533  * 
     8570 *
    85348571 * RETURN:
    85358572 * Zero
     
    85388575{
    85398576  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    8540  
    8541   if (lpnmh->hwndFrom == infoPtr->hwndHeader) 
     8577
     8578  if (lpnmh->hwndFrom == infoPtr->hwndHeader)
    85428579  {
    85438580    /* handle notification from header control */
     
    85608597        nmlv.iItem = -1;
    85618598        nmlv.iSubItem = pnmHeader->iItem;
    8562        
     8599
    85638600        ListView_LVNotify(GetParent(hwnd),lCtrlId, &nmlv);
    85648601
     
    85858622 * DESCRIPTION:
    85868623 * Determines the type of structure to use.
    8587  * 
     8624 *
    85888625 * PARAMETER(S):
    85898626 * [I] HWND : window handle of the sender
    8590  * [I] HWND : listview window handle 
     8627 * [I] HWND : listview window handle
    85918628 * [I] INT : command specifying the nature of the WM_NOTIFYFORMAT
    85928629 *
     
    86018638  {
    86028639    /* determine the type of structure to use */
    8603     infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT, 
     8640    infoPtr->notifyFormat = SendMessageA(hwndFrom, WM_NOTIFYFORMAT,
    86048641                                         (WPARAM)hwnd, (LPARAM)NF_QUERY);
    86058642    if (infoPtr->notifyFormat == NFR_UNICODE)
     
    86158652 * DESCRIPTION:
    86168653 * Paints/Repaints the listview control.
    8617  * 
     8654 *
    86188655 * PARAMETER(S):
    86198656 * [I] HWND : window handle
     
    86468683 * DESCRIPTION:
    86478684 * Processes double click messages (right mouse button).
    8648  * 
     8685 *
    86498686 * PARAMETER(S):
    86508687 * [I] HWND : window handle
     
    86568693 * Zero
    86578694 */
    8658 static LRESULT LISTVIEW_RButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX, 
     8695static LRESULT LISTVIEW_RButtonDblClk(HWND hwnd, WORD wKey, WORD wPosX,
    86598696                                      WORD wPosY)
    86608697{
    86618698  INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
    86628699  NMHDR nmh;
    8663 
    8664   TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);
    8665 
    8666   /* send NM_RELEASEDCAPTURE notification */
    8667   nmh.hwndFrom = hwnd;
    8668   nmh.idFrom = nCtrlId;
    8669   nmh.code = NM_RELEASEDCAPTURE;
    8670   ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
    8671 
    8672   /* send NM_RDBLCLK notification */
    8673   nmh.code = NM_RDBLCLK;
    8674   ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
    8675 
    8676   return 0;
    8677 }
    8678 
    8679 /***
    8680  * DESCRIPTION:
    8681  * Processes mouse down messages (right mouse button).
    8682  *
    8683  * PARAMETER(S):
    8684  * [I] HWND : window handle
    8685  * [I] WORD : key flag
    8686  * [I] WORD : x coordinate
    8687  * [I] WORD : y coordinate
    8688  *
    8689  * RETURN:
    8690  * Zero
    8691  */
    8692 static LRESULT LISTVIEW_RButtonDown(HWND hwnd, WORD wKey, WORD wPosX,
    8693                                     WORD wPosY)
    8694 {
    8695   LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    8696   INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
    8697   POINT ptPosition;
    8698   NMHDR nmh;
    8699   INT nItem;
    87008700
    87018701  TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);
     
    87068706  nmh.code = NM_RELEASEDCAPTURE;
    87078707  ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
    8708  
     8708
     8709  /* send NM_RDBLCLK notification */
     8710  nmh.code = NM_RDBLCLK;
     8711  ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
     8712
     8713  return 0;
     8714}
     8715
     8716/***
     8717 * DESCRIPTION:
     8718 * Processes mouse down messages (right mouse button).
     8719 *
     8720 * PARAMETER(S):
     8721 * [I] HWND : window handle
     8722 * [I] WORD : key flag
     8723 * [I] WORD : x coordinate
     8724 * [I] WORD : y coordinate
     8725 *
     8726 * RETURN:
     8727 * Zero
     8728 */
     8729static LRESULT LISTVIEW_RButtonDown(HWND hwnd, WORD wKey, WORD wPosX,
     8730                                    WORD wPosY)
     8731{
     8732  LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     8733  INT nCtrlId = GetWindowLongA(hwnd, GWL_ID);
     8734  POINT ptPosition;
     8735  NMHDR nmh;
     8736  INT nItem;
     8737
     8738  TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);
     8739
     8740  /* send NM_RELEASEDCAPTURE notification */
     8741  nmh.hwndFrom = hwnd;
     8742  nmh.idFrom = nCtrlId;
     8743  nmh.code = NM_RELEASEDCAPTURE;
     8744  ListView_Notify(GetParent(hwnd), nCtrlId, &nmh);
     8745
    87098746  /* make sure the listview control window has the focus */
    87108747  if (infoPtr->bFocus == FALSE)
     
    87338770    LISTVIEW_RemoveAllSelections(hwnd);
    87348771  }
    8735  
     8772
    87368773  return 0;
    87378774}
     
    87408777 * DESCRIPTION:
    87418778 * Processes mouse up messages (right mouse button).
    8742  * 
     8779 *
    87438780 * PARAMETER(S):
    87448781 * [I] HWND : window handle
     
    87508787 * Zero
    87518788 */
    8752 static LRESULT LISTVIEW_RButtonUp(HWND hwnd, WORD wKey, WORD wPosX, 
     8789static LRESULT LISTVIEW_RButtonUp(HWND hwnd, WORD wKey, WORD wPosX,
    87538790                                  WORD wPosY)
    87548791{
     
    87588795  TRACE("(hwnd=%x,key=%hu,X=%hu,Y=%hu)\n", hwnd, wKey, wPosX, wPosY);
    87598796
    8760   if (infoPtr->bRButtonDown != FALSE) 
     8797  if (infoPtr->bRButtonDown != FALSE)
    87618798  {
    87628799    NMLISTVIEW nmlv;
     
    87938830    /* set button flag */
    87948831    infoPtr->bRButtonDown = FALSE;
    8795    
     8832
    87968833    /* Change to screen coordinate for WM_CONTEXTMENU */
    87978834    ClientToScreen(hwnd, &pt);
    8798    
     8835
    87998836    /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
    88008837    SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y));
    88018838  }
    8802  
     8839
    88038840  return 0;
    88048841}
     
    88068843/***
    88078844 * DESCRIPTION:
    8808  * Sets the focus. 
    8809  * 
     8845 * Sets the focus.
     8846 *
    88108847 * PARAMETER(S):
    88118848 * [I] HWND : window handle
     
    88398876/***
    88408877 * DESCRIPTION:
    8841  * Sets the font. 
    8842  * 
     8878 * Sets the font.
     8879 *
    88438880 * PARAMETER(S):
    88448881 * [I] HWND : window handle
     
    88688905  {
    88698906    /* set header font */
    8870     SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, 
     8907    SendMessageA(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont,
    88718908                   MAKELPARAM(fRedraw, 0));
    88728909  }
     
    88798916  /* invalidate listview control client area */
    88808917  InvalidateRect(hwnd, NULL, TRUE);
    8881  
     8918
    88828919  if (fRedraw != FALSE)
    88838920  {
     
    88908927/***
    88918928 * DESCRIPTION:
    8892  * Message handling for WM_SETREDRAW. 
     8929 * Message handling for WM_SETREDRAW.
    88938930 * For the Listview, it invalidates the entire window (the doc specifies otherwise)
    8894  * 
     8931 *
    88958932 * PARAMETER(S):
    88968933 * [I] HWND   : window handle
     
    89238960    if(bRedraw)
    89248961    {
    8925         RedrawWindow(hwnd, NULL, 0, 
     8962        RedrawWindow(hwnd, NULL, 0,
    89268963            RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ALLCHILDREN | RDW_ERASENOW);
    89278964    }
     
    89348971 * Resizes the listview control. This function processes WM_SIZE
    89358972 * messages.  At this time, the width and height are not used.
    8936  * 
     8973 *
    89378974 * PARAMETER(S):
    89388975 * [I] HWND : window handle
     
    89458982static LRESULT LISTVIEW_Size(HWND hwnd, int Width, int Height)
    89468983{
    8947   LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE); 
     8984  LONG lStyle = GetWindowLongA(hwnd, GWL_STYLE);
    89488985  UINT uView = lStyle & LVS_TYPEMASK;
    89498986
     
    89659002
    89669003  LISTVIEW_UpdateScroll(hwnd);
    8967  
     9004
    89689005  /* invalidate client area + erase background */
    89699006  InvalidateRect(hwnd, NULL, TRUE);
     
    89759012 * DESCRIPTION:
    89769013 * Sets the size information.
    8977  * 
     9014 *
    89789015 * PARAMETER(S):
    89799016 * [I] HWND : window handle
     
    89889025  UINT uView = lStyle & LVS_TYPEMASK;
    89899026  RECT rcList;
    8990  
     9027
    89919028  GetClientRect(hwnd, &rcList);
    89929029  infoPtr->rcList.left = 0;
     
    89949031  infoPtr->rcList.top = 0;
    89959032  infoPtr->rcList.bottom = max(rcList.bottom - rcList.top, 1);
    8996      
     9033
    89979034  if (uView == LVS_LIST)
    89989035  {
     
    90019038      INT nHScrollHeight = GetSystemMetrics(SM_CYHSCROLL);
    90029039      if (infoPtr->rcList.bottom > nHScrollHeight)
    9003       { 
     9040      {
    90049041        infoPtr->rcList.bottom -= nHScrollHeight;
    90059042      }
     
    90269063/***
    90279064 * DESCRIPTION:
    9028  * Processes WM_STYLECHANGED messages. 
    9029  * 
     9065 * Processes WM_STYLECHANGED messages.
     9066 *
    90309067 * PARAMETER(S):
    90319068 * [I] HWND : window handle
     
    90369073 * Zero
    90379074 */
    9038 static INT LISTVIEW_StyleChanged(HWND hwnd, WPARAM wStyleType, 
     9075static INT LISTVIEW_StyleChanged(HWND hwnd, WPARAM wStyleType,
    90399076                                 LPSTYLESTRUCT lpss)
    90409077{
     
    90449081  RECT rcList = infoPtr->rcList;
    90459082
    9046   TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n", 
     9083  TRACE("(hwnd=%x, styletype=%x, stylestruct=%p)\n",
    90479084        hwnd, wStyleType, lpss);
    90489085
     
    90539090      ShowWindow(infoPtr->hwndHeader, SW_HIDE);
    90549091    }
    9055  
     9092
    90569093    if ((lpss->styleOld & WS_HSCROLL) != 0)
    90579094    {
    90589095       ShowScrollBar(hwnd, SB_HORZ, FALSE);
    90599096    }
    9060  
     9097
    90619098    if ((lpss->styleOld & WS_VSCROLL) != 0)
    90629099    {
    90639100       ShowScrollBar(hwnd, SB_VERT, FALSE);
    90649101    }
    9065  
     9102
    90669103    if (uNewView == LVS_ICON)
    90679104    {
     
    90879124      hl.pwpos = &wp;
    90889125      Header_Layout(infoPtr->hwndHeader, &hl);
    9089       SetWindowPos(infoPtr->hwndHeader, hwnd, wp.x, wp.y, wp.cx, wp.cy, 
     9126      SetWindowPos(infoPtr->hwndHeader, hwnd, wp.x, wp.y, wp.cx, wp.cy,
    90909127                   wp.flags);
    90919128      if (!(LVS_NOCOLUMNHEADER & lpss->styleNew))
    90929129        ShowWindow(infoPtr->hwndHeader, SW_SHOWNORMAL);
    9093      
     9130
    90949131      infoPtr->iconSize.cx = GetSystemMetrics(SM_CXSMICON);
    90959132      infoPtr->iconSize.cy = GetSystemMetrics(SM_CYSMICON);
     
    91259162    /* add scrollbars if needed */
    91269163    LISTVIEW_UpdateScroll(hwnd);
    9127    
     9164
    91289165    /* invalidate client area + erase background */
    91299166    InvalidateRect(hwnd, NULL, TRUE);
     
    91339170  }
    91349171
    9135   /* If they change the view and we have an active edit control 
     9172  /* If they change the view and we have an active edit control
    91369173     we will need to kill the control since the redraw will
    91379174     misplace the edit control.
     
    96999736}
    97009737
     9738#ifdef DEBUG
     9739void dprintfMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     9740{
     9741 char *msg = NULL;
     9742
     9743  switch (uMsg)
     9744  {
     9745  case LVM_APPROXIMATEVIEWRECT:
     9746      msg = "LVM_APPROXIMATEVIEWRECT";
     9747      break;
     9748  case LVM_ARRANGE:
     9749      msg = "LVM_ARRANGE";
     9750      break;
     9751  case LVM_CREATEDRAGIMAGE:
     9752      msg = "LVM_CREATEDRAGIMAGE";
     9753      break;
     9754  case LVM_DELETEALLITEMS:
     9755      msg = "LVM_DELETEALLITEMS";
     9756      break;
     9757  case LVM_DELETECOLUMN:
     9758      msg = "LVM_DELETECOLUMN";
     9759      break;
     9760  case LVM_DELETEITEM:
     9761      msg = "LVM_DELETEITEM";
     9762      break;
     9763  case LVM_EDITLABELW:
     9764      msg = "LVM_EDITLABELW";
     9765      break;
     9766  case LVM_EDITLABELA:
     9767      msg = "LVM_EDITLABELA";
     9768      break;
     9769  case LVM_ENSUREVISIBLE:
     9770      msg = "LVM_ENSUREVISIBLE";
     9771      break;
     9772  case LVM_FINDITEMA:
     9773      msg = "LVM_FINDITEMA";
     9774      break;
     9775  case LVM_GETBKCOLOR:
     9776      msg = "LVM_GETBKCOLOR";
     9777      break;
     9778  case LVM_GETBKIMAGEA:
     9779      msg = "LVM_GETBKIMAGEA";
     9780      break;
     9781  case LVM_GETBKIMAGEW:
     9782      msg = "LVM_GETBKIMAGEW";
     9783      break;
     9784  case LVM_GETCALLBACKMASK:
     9785      msg = "LVM_GETCALLBACKMASK";
     9786      break;
     9787  case LVM_GETCOLUMNA:
     9788      msg = "LVM_GETCOLUMNA";
     9789      break;
     9790  case LVM_GETCOLUMNW:
     9791      msg = "LVM_GETCOLUMNW";
     9792      break;
     9793  case LVM_GETCOLUMNORDERARRAY:
     9794      msg = "LVM_GETCOLUMNORDERARRAY";
     9795      break;
     9796  case LVM_GETCOLUMNWIDTH:
     9797      msg = "LVM_GETCOLUMNWIDTH";
     9798      break;
     9799  case LVM_GETCOUNTPERPAGE:
     9800      msg = "LVM_GETCOUNTPERPAGE";
     9801      break;
     9802  case LVM_GETEDITCONTROL:
     9803      msg = "LVM_GETEDITCONTROL";
     9804      break;
     9805  case LVM_GETEXTENDEDLISTVIEWSTYLE:
     9806      msg = "LVM_GETEXTENDEDLISTVIEWSTYLE";
     9807      break;
     9808  case LVM_GETHEADER:
     9809      msg = "LVM_GETHEADER";
     9810      break;
     9811  case LVM_GETHOTCURSOR:
     9812      msg = "LVM_GETHOTCURSOR";
     9813      break;
     9814  case LVM_GETHOTITEM:
     9815      msg = "LVM_GETHOTITEM";
     9816      break;
     9817  case LVM_GETHOVERTIME:
     9818      msg = "LVM_GETHOVERTIME";
     9819      break;
     9820  case LVM_GETIMAGELIST:
     9821      msg = "LVM_GETIMAGELIST";
     9822      break;
     9823  case LVM_GETISEARCHSTRINGA:
     9824      msg = "LVM_GETISEARCHSTRINGA";
     9825      break;
     9826  case LVM_GETISEARCHSTRINGW:
     9827      msg = "LVM_GETISEARCHSTRINGW";
     9828      break;
     9829  case LVM_GETITEMA:
     9830      msg = "LVM_GETITEMA";
     9831      break;
     9832  case LVM_GETITEMW:
     9833      msg = "LVM_GETITEMW";
     9834      break;
     9835  case LVM_GETITEMCOUNT:
     9836      msg = "LVM_GETITEMCOUNT";
     9837      break;
     9838  case LVM_GETITEMPOSITION:
     9839      msg = "LVM_GETITEMPOSITION";
     9840      break;
     9841  case LVM_GETITEMRECT:
     9842      msg = "LVM_GETITEMRECT";
     9843      break;
     9844  case LVM_GETITEMSPACING:
     9845      msg = "LVM_GETITEMSPACING";
     9846      break;
     9847  case LVM_GETITEMSTATE:
     9848      msg = "LVM_GETITEMSTATE";
     9849      break;
     9850  case LVM_GETITEMTEXTA:
     9851      msg = "LVM_GETITEMTEXTA";
     9852      break;
     9853  case LVM_GETITEMTEXTW:
     9854      msg = "LVM_GETITEMTEXTW";
     9855      break;
     9856  case LVM_GETNEXTITEM:
     9857      msg = "LVM_GETNEXTITEM";
     9858      break;
     9859  case LVM_GETNUMBEROFWORKAREAS:
     9860      msg = "LVM_GETNUMBEROFWORKAREAS";
     9861      break;
     9862  case LVM_GETORIGIN:
     9863      msg = "LVM_GETORIGIN";
     9864      break;
     9865  case LVM_GETSELECTEDCOUNT:
     9866      msg = "LVM_GETSELECTEDCOUNT";
     9867      break;
     9868  case LVM_GETSELECTIONMARK:
     9869      msg = "LVM_GETSELECTIONMARK";
     9870      break;
     9871  case LVM_GETSTRINGWIDTHA:
     9872      msg = "LVM_GETSTRINGWIDTHA";
     9873      break;
     9874  case LVM_GETSTRINGWIDTHW:
     9875      msg = "LVM_GETSTRINGWIDTHW";
     9876      break;
     9877  case LVM_GETSUBITEMRECT:
     9878      msg = "LVM_GETSUBITEMRECT";
     9879      break;
     9880  case LVM_GETTEXTBKCOLOR:
     9881      msg = "LVM_GETTEXTBKCOLOR";
     9882      break;
     9883  case LVM_GETTEXTCOLOR:
     9884      msg = "LVM_GETTEXTCOLOR";
     9885      break;
     9886  case LVM_GETTOOLTIPS:
     9887      msg = "LVM_GETTOOLTIPS";
     9888      break;
     9889  case LVM_GETTOPINDEX:
     9890      msg = "LVM_GETTOPINDEX";
     9891      break;
     9892  case LVM_GETVIEWRECT:
     9893      msg = "LVM_GETVIEWRECT";
     9894      break;
     9895  case LVM_GETWORKAREAS:
     9896      msg = "LVM_GETWORKAREAS";
     9897      break;
     9898  case LVM_HITTEST:
     9899      msg = "LVM_HITTEST";
     9900      break;
     9901  case LVM_INSERTCOLUMNA:
     9902      msg = "LVM_INSERTCOLUMNA";
     9903      break;
     9904  case LVM_INSERTCOLUMNW:
     9905      msg = "LVM_INSERTCOLUMNW";
     9906      break;
     9907  case LVM_INSERTITEMA:
     9908      msg = "LVM_INSERTITEMA";
     9909      break;
     9910  case LVM_INSERTITEMW:
     9911      msg = "LVM_INSERTITEMW";
     9912      break;
     9913  case LVM_REDRAWITEMS:
     9914      msg = "LVM_REDRAWITEMS";
     9915      break;
     9916  case LVM_SCROLL:
     9917      msg = "LVM_SCROLL";
     9918      break;
     9919  case LVM_SETBKCOLOR:
     9920      msg = "LVM_SETBKCOLOR";
     9921      break;
     9922  case LVM_SETBKIMAGEA:
     9923      msg = "LVM_SETBKIMAGEA";
     9924      break;
     9925  case LVM_SETBKIMAGEW:
     9926      msg = "LVM_SETBKIMAGEW";
     9927      break;
     9928  case LVM_SETCALLBACKMASK:
     9929      msg = "LVM_SETCALLBACKMASK";
     9930      break;
     9931  case LVM_SETCOLUMNA:
     9932      msg = "LVM_SETCOLUMNA";
     9933      break;
     9934  case LVM_SETCOLUMNW:
     9935      msg = "LVM_SETCOLUMNW";
     9936      break;
     9937  case LVM_SETCOLUMNORDERARRAY:
     9938      msg = "LVM_SETCOLUMNORDERARRAY";
     9939      break;
     9940  case LVM_SETCOLUMNWIDTH:
     9941      msg = "LVM_SETCOLUMNWIDTH";
     9942      break;
     9943  case LVM_SETEXTENDEDLISTVIEWSTYLE:
     9944      msg = "LVM_SETEXTENDEDLISTVIEWSTYLE";
     9945      break;
     9946  case LVM_SETHOTCURSOR:
     9947      msg = "LVM_SETHOTCURSOR";
     9948      break;
     9949  case LVM_SETHOTITEM:
     9950      msg = "LVM_SETHOTITEM";
     9951      break;
     9952  case LVM_SETHOVERTIME:
     9953      msg = "LVM_SETHOVERTIME";
     9954      break;
     9955  case LVM_SETICONSPACING:
     9956      msg = "LVM_SETICONSPACING";
     9957      break;
     9958  case LVM_SETIMAGELIST:
     9959      msg = "LVM_SETIMAGELIST";
     9960      break;
     9961  case LVM_SETITEMA:
     9962      msg = "LVM_SETITEMA";
     9963      break;
     9964  case LVM_SETITEMW:
     9965      msg = "LVM_SETITEMW";
     9966      break;
     9967  case LVM_SETITEMCOUNT:
     9968      msg = "LVM_SETITEMCOUNT";
     9969      break;
     9970  case LVM_SETITEMPOSITION:
     9971      msg = "LVM_SETITEMPOSITION";
     9972      break;
     9973  case LVM_SETITEMPOSITION32:
     9974      msg = "LVM_SETITEMPOSITION32";
     9975      break;
     9976  case LVM_SETITEMSTATE:
     9977      msg = "LVM_SETITEMSTATE";
     9978      break;
     9979  case LVM_SETITEMTEXTA:
     9980      msg = "LVM_SETITEMTEXTA";
     9981      break;
     9982  case LVM_SETITEMTEXTW:
     9983      msg = "LVM_SETITEMTEXTW";
     9984      break;
     9985  case LVM_SETSELECTIONMARK:
     9986      msg = "LVM_SETSELECTIONMARK";
     9987      break;
     9988  case LVM_SETTEXTBKCOLOR:
     9989      msg = "LVM_SETTEXTBKCOLOR";
     9990      break;
     9991  case LVM_SETTEXTCOLOR:
     9992      msg = "LVM_SETTEXTCOLOR";
     9993      break;
     9994  case LVM_SETTOOLTIPS:
     9995      msg = "LVM_SETTOOLTIPS";
     9996      break;
     9997  case LVM_SETWORKAREAS:
     9998      msg = "LVM_SETWORKAREAS";
     9999      break;
     10000  case LVM_SORTITEMS:
     10001      msg = "LVM_SORTITEMS";
     10002      break;
     10003  case LVM_SUBITEMHITTEST:
     10004      msg = "LVM_SUBITEMHITTEST";
     10005      break;
     10006  case LVM_UPDATE:
     10007      msg = "LVM_UPDATE";
     10008      break;
     10009  default:
     10010      return;
     10011  }
     10012  dprintf(("SysListView %x %s %x %x", hwnd, msg, wParam, lParam));
     10013}
     10014#endif
    970110015#endif //__WIN32OS2__
    970210016
     
    970910023                                   LPARAM lParam)
    971010024{
     10025#if defined(DEBUG) && defined(__WIN32OS2__)
     10026  dprintfMsg(hwnd, uMsg, wParam, lParam);
     10027#else
    971110028  TRACE("hwnd=%x uMsg=%x wParam=%x lParam=%lx\n", hwnd, uMsg, wParam, lParam);
     10029#endif
     10030
    971210031  if (!GetWindowLongA(hwnd, 0) && (uMsg != WM_NCCREATE))
    971310032    return DefWindowProcA( hwnd, uMsg, wParam, lParam );
    971410033  switch (uMsg)
    971510034  {
    9716   case LVM_APPROXIMATEVIEWRECT: 
    9717     return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam, 
     10035  case LVM_APPROXIMATEVIEWRECT:
     10036    return LISTVIEW_ApproximateViewRect(hwnd, (INT)wParam,
    971810037                                        LOWORD(lParam), HIWORD(lParam));
    9719   case LVM_ARRANGE: 
     10038  case LVM_ARRANGE:
    972010039    return LISTVIEW_Arrange(hwnd, (INT)wParam);
    972110040
     
    975610075    return LISTVIEW_GetBkImage(hwnd,wParam,lParam,TRUE);
    975710076#endif
    9758 /*      case LVM_GETBKIMAGE: */
     10077/*  case LVM_GETBKIMAGE: */
    975910078
    976010079  case LVM_GETCALLBACKMASK:
     
    976410083    return LISTVIEW_GetColumnA(hwnd, (INT)wParam, (LPLVCOLUMNA)lParam);
    976510084
    9766 /*      case LVM_GETCOLUMNW: */
     10085/*  case LVM_GETCOLUMNW: */
    976710086
    976810087  case LVM_GETCOLUMNORDERARRAY:
     
    978410103    return LISTVIEW_GetHeader(hwnd);
    978510104
    9786 /*      case LVM_GETHOTCURSOR: */
     10105/*  case LVM_GETHOTCURSOR: */
    978710106#ifdef __WIN32OS2__
    978810107  case LVM_GETHOTCURSOR:
     
    979910118    return LISTVIEW_GetImageList(hwnd, (INT)wParam);
    980010119
    9801 /*      case LVM_GETISEARCHSTRING: */
     10120/*  case LVM_GETISEARCHSTRING: */
    980210121
    980310122#ifdef __WIN32OS2__
     
    981210131    return LISTVIEW_GetItemA(hwnd, (LPLVITEMA)lParam, FALSE);
    981310132
    9814 /*      case LVM_GETITEMW: */
     10133/*  case LVM_GETITEMW: */
    981510134
    981610135  case LVM_GETITEMCOUNT:
     
    982010139    return LISTVIEW_GetItemPosition(hwnd, (INT)wParam, (LPPOINT)lParam);
    982110140
    9822   case LVM_GETITEMRECT: 
     10141  case LVM_GETITEMRECT:
    982310142    return LISTVIEW_GetItemRect(hwnd, (INT)wParam, (LPRECT)lParam);
    982410143
    9825   case LVM_GETITEMSPACING: 
     10144  case LVM_GETITEMSPACING:
    982610145    return LISTVIEW_GetItemSpacing(hwnd, (BOOL)wParam);
    982710146
    9828   case LVM_GETITEMSTATE: 
     10147  case LVM_GETITEMSTATE:
    982910148    return LISTVIEW_GetItemState(hwnd, (INT)wParam, (UINT)lParam);
    9830    
     10149
    983110150  case LVM_GETITEMTEXTA:
    983210151    LISTVIEW_GetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam);
    983310152    break;
    983410153
    9835 /*      case LVM_GETITEMTEXTW: */
     10154/*  case LVM_GETITEMTEXTW: */
    983610155
    983710156  case LVM_GETNEXTITEM:
    983810157    return LISTVIEW_GetNextItem(hwnd, (INT)wParam, LOWORD(lParam));
    983910158
    9840 /*      case LVM_GETNUMBEROFWORKAREAS: */
     10159/*  case LVM_GETNUMBEROFWORKAREAS: */
    984110160
    984210161#ifdef __WIN32OS2__
     
    985110170    return LISTVIEW_GetSelectedCount(hwnd);
    985210171
    9853   case LVM_GETSELECTIONMARK: 
     10172  case LVM_GETSELECTIONMARK:
    985410173    return LISTVIEW_GetSelectionMark(hwnd);
    985510174
     
    985710176    return LISTVIEW_GetStringWidthA (hwnd, (LPCSTR)lParam);
    985810177
    9859 /*      case LVM_GETSTRINGWIDTHW: */
    9860 /*      case LVM_GETSUBITEMRECT: */
     10178/*  case LVM_GETSTRINGWIDTHW: */
     10179/*  case LVM_GETSUBITEMRECT: */
    986110180
    986210181#ifdef __WIN32OS2__
     
    987110190    return LISTVIEW_GetTextColor(hwnd);
    987210191
    9873 /*      case LVM_GETTOOLTIPS: */
     10192/*  case LVM_GETTOOLTIPS: */
    987410193#ifdef __WIN32OS2__
    987510194  case LVM_GETTOOLTIPS:
     
    988010199    return LISTVIEW_GetTopIndex(hwnd);
    988110200
    9882 /*      case LVM_GETUNICODEFORMAT: */
     10201/*  case LVM_GETUNICODEFORMAT: */
    988310202
    988410203  case LVM_GETVIEWRECT:
    988510204    return LISTVIEW_GetViewRect(hwnd, (LPRECT)lParam);
    988610205
    9887 /*      case LVM_GETWORKAREAS: */
     10206/*  case LVM_GETWORKAREAS: */
    988810207#ifdef __WIN32OS2__
    988910208  case LVM_GETWORKAREAS:
     
    991010229
    991110230#ifdef __WIN32OS2__
    9912   case LVM_SCROLL: 
     10231  case LVM_SCROLL:
    991310232    return LISTVIEW_Scroll(hwnd, (INT)wParam, (INT)lParam);
    991410233#endif
     
    991910238    return LISTVIEW_SetBkColor(hwnd, (COLORREF)lParam);
    992010239
    9921 /*      case LVM_SETBKIMAGE: */
     10240/*  case LVM_SETBKIMAGE: */
    992210241#ifdef __WIN32OS2__
    992310242  case LVM_SETBKIMAGEA:
     
    994710266    return LISTVIEW_SetExtendedListViewStyle(hwnd, (DWORD)wParam, (DWORD)lParam);
    994810267
    9949 /*      case LVM_SETHOTCURSOR: */
     10268/*  case LVM_SETHOTCURSOR: */
    995010269#ifdef __WIN32OS2__
    995110270  case LVM_SETHOTCURSOR:
     
    995910278    return LISTVIEW_SetHoverTime(hwnd, (DWORD)wParam);
    996010279
    9961 /*      case LVM_SETICONSPACING: */
     10280/*  case LVM_SETICONSPACING: */
    996210281#ifdef __WIN32OS2__
    996310282  case LVM_SETICONSPACING:
    996410283    return LISTVIEW_SetIconSpacing(hwnd,wParam,lParam);
    996510284#endif
    9966        
     10285
    996710286  case LVM_SETIMAGELIST:
    996810287    return LISTVIEW_SetImageList(hwnd, (INT)wParam, (HIMAGELIST)lParam);
     
    997110290    return LISTVIEW_SetItemA(hwnd, (LPLVITEMA)lParam);
    997210291
    9973 /*      case LVM_SETITEMW: */
    9974 
    9975   case LVM_SETITEMCOUNT: 
     10292/*  case LVM_SETITEMW: */
     10293
     10294  case LVM_SETITEMCOUNT:
    997610295    return LISTVIEW_SetItemCount(hwnd, (INT)wParam, (DWORD)lParam);
    9977    
     10296
    997810297  case LVM_SETITEMPOSITION:
    997910298    return LISTVIEW_SetItemPosition(hwnd, (INT)wParam, (INT)LOWORD(lParam),
     
    998210301  case LVM_SETITEMPOSITION32:
    998310302    return LISTVIEW_SetItemPosition(hwnd, (INT)wParam, ((POINT*)lParam)->x,
    9984                                     ((POINT*)lParam)->y);
     10303                    ((POINT*)lParam)->y);
    998510304
    998610305  case LVM_SETITEMSTATE:
     
    999010309    return LISTVIEW_SetItemTextA(hwnd, (INT)wParam, (LPLVITEMA)lParam);
    999110310
    9992 /*      case LVM_SETITEMTEXTW: */
     10311/*  case LVM_SETITEMTEXTW: */
    999310312
    999410313  case LVM_SETSELECTIONMARK:
     
    1000810327    return LISTVIEW_SetWorkAreas(hwnd,wParam,lParam);
    1000910328#endif
    10010 /*      case LVM_SETTOOLTIPS: */
    10011 /*      case LVM_SETUNICODEFORMAT: */
    10012 /*      case LVM_SETWORKAREAS: */
     10329/*  case LVM_SETTOOLTIPS: */
     10330/*  case LVM_SETUNICODEFORMAT: */
     10331/*  case LVM_SETWORKAREAS: */
    1001310332
    1001410333  case LVM_SORTITEMS:
    1001510334    return LISTVIEW_SortItems(hwnd, wParam, lParam);
    1001610335
    10017 /*      case LVM_SUBITEMHITTEST: */
     10336/*  case LVM_SUBITEMHITTEST: */
    1001810337#ifdef __WIN32OS2__
    1001910338  case LVM_SUBITEMHITTEST:
     
    1002110340#endif
    1002210341
    10023   case LVM_UPDATE: 
     10342  case LVM_UPDATE:
    1002410343    return LISTVIEW_Update(hwnd, (INT)wParam);
    1002510344
     
    1003210351  case WM_CREATE:
    1003310352    return LISTVIEW_Create(hwnd, wParam, lParam);
    10034    
     10353
    1003510354  case WM_ERASEBKGND:
    1003610355    return LISTVIEW_EraseBackground(hwnd, wParam, lParam);
     
    1004310362
    1004410363  case WM_HSCROLL:
    10045     return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam), 
     10364    return LISTVIEW_HScroll(hwnd, (INT)LOWORD(wParam),
    1004610365                            (INT)HIWORD(wParam), (HWND)lParam);
    1004710366
     
    1005310372
    1005410373  case WM_LBUTTONDBLCLK:
    10055     return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 
     10374    return LISTVIEW_LButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam),
    1005610375                                HIWORD(lParam));
    10057    
     10376
    1005810377  case WM_LBUTTONDOWN:
    10059     return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 
     10378    return LISTVIEW_LButtonDown(hwnd, (WORD)wParam, LOWORD(lParam),
    1006010379                                HIWORD(lParam));
    1006110380  case WM_LBUTTONUP:
    10062     return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 
     10381    return LISTVIEW_LButtonUp(hwnd, (WORD)wParam, LOWORD(lParam),
    1006310382                              HIWORD(lParam));
    1006410383  case WM_MOUSEMOVE:
     
    1008010399    return LISTVIEW_NotifyFormat(hwnd, (HWND)wParam, (INT)lParam);
    1008110400
    10082   case WM_PAINT: 
    10083     return LISTVIEW_Paint(hwnd, (HDC)wParam); 
     10401  case WM_PAINT:
     10402    return LISTVIEW_Paint(hwnd, (HDC)wParam);
    1008410403
    1008510404  case WM_RBUTTONDBLCLK:
    10086     return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam), 
     10405    return LISTVIEW_RButtonDblClk(hwnd, (WORD)wParam, LOWORD(lParam),
    1008710406                                  HIWORD(lParam));
    1008810407
    1008910408  case WM_RBUTTONDOWN:
    10090     return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam), 
     10409    return LISTVIEW_RButtonDown(hwnd, (WORD)wParam, LOWORD(lParam),
    1009110410                                HIWORD(lParam));
    1009210411
    1009310412  case WM_RBUTTONUP:
    10094     return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam), 
     10413    return LISTVIEW_RButtonUp(hwnd, (WORD)wParam, LOWORD(lParam),
    1009510414                              HIWORD(lParam));
    1009610415
     
    1010110420    return LISTVIEW_SetFont(hwnd, (HFONT)wParam, (WORD)lParam);
    1010210421
    10103   case WM_SETREDRAW: 
     10422  case WM_SETREDRAW:
    1010410423    return LISTVIEW_SetRedraw(hwnd, (BOOL)wParam);
    1010510424
     
    1011010429    return LISTVIEW_StyleChanged(hwnd, wParam, (LPSTYLESTRUCT)lParam);
    1011110430
    10112 /*      case WM_TIMER: */
     10431/*  case WM_TIMER: */
    1011310432#ifdef __WIN32OS2__
    1011410433  case WM_TIMER:
     
    1011710436
    1011810437  case WM_VSCROLL:
    10119     return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam), 
     10438    return LISTVIEW_VScroll(hwnd, (INT)LOWORD(wParam),
    1012010439                            (INT)HIWORD(wParam), (HWND)lParam);
    1012110440
     
    1012310442      if (wParam & (MK_SHIFT | MK_CONTROL))
    1012410443          return DefWindowProcA( hwnd, uMsg, wParam, lParam );
    10125       return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam));/*    case WM_WINDOWPOSCHANGED: */
    10126 
    10127 /*      case WM_WININICHANGE: */
     10444      return LISTVIEW_MouseWheel(hwnd, (short int)HIWORD(wParam));/*    case WM_WINDOWPOSCHANGED: */
     10445
     10446/*  case WM_WININICHANGE: */
    1012810447
    1012910448  default:
    1013010449    if (uMsg >= WM_USER)
    1013110450    {
    10132       ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, 
     10451      ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam,
    1013310452          lParam);
    1013410453    }
     
    1014810467 * DESCRIPTION:
    1014910468 * Registers the window class.
    10150  * 
     10469 *
    1015110470 * PARAMETER(S):
    1015210471 * None
     
    1017310492 * DESCRIPTION:
    1017410493 * Unregisters the window class.
    10175  * 
     10494 *
    1017610495 * PARAMETER(S):
    1017710496 * None
     
    1018810507 * DESCRIPTION:
    1018910508 * Handle any WM_COMMAND messages
    10190  * 
     10509 *
    1019110510 * PARAMETER(S):
    1019210511 *
     
    1019710516    switch (HIWORD(wParam))
    1019810517    {
    10199         case EN_UPDATE:
    10200         {
    10201             /*
    10202              * Adjust the edit window size
    10203              */
    10204             char buffer[1024];
    10205             LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
    10206             HDC           hdc      = GetDC(infoPtr->hwndEdit);
     10518    case EN_UPDATE:
     10519    {
     10520        /*
     10521         * Adjust the edit window size
     10522         */
     10523        char buffer[1024];
     10524        LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0);
     10525        HDC           hdc      = GetDC(infoPtr->hwndEdit);
    1020710526            HFONT         hFont, hOldFont = 0;
    10208             RECT          rect;
    10209             SIZE          sz;
    10210             int           len;
    10211 
    10212             len = GetWindowTextA(infoPtr->hwndEdit, buffer, 1023);
    10213             GetWindowRect(infoPtr->hwndEdit, &rect);
     10527        RECT      rect;
     10528        SIZE      sz;
     10529        int       len;
     10530
     10531        len = GetWindowTextA(infoPtr->hwndEdit, buffer, 1023);
     10532        GetWindowRect(infoPtr->hwndEdit, &rect);
    1021410533
    1021510534            /* Select font to get the right dimension of the string */
     
    1022010539            }
    1022110540
    10222             if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz))
    10223             {
     10541        if (GetTextExtentPoint32A(hdc, buffer, strlen(buffer), &sz))
     10542        {
    1022410543                TEXTMETRICA textMetric;
    1022510544
     
    1022810547                sz.cx += (textMetric.tmMaxCharWidth * 2);
    1022910548
    10230                 SetWindowPos (
    10231                     infoPtr->hwndEdit,
    10232                     HWND_TOP,
    10233                     0,
    10234                     0,
    10235                     sz.cx,
    10236                     rect.bottom - rect.top,
    10237                     SWP_DRAWFRAME|SWP_NOMOVE);
    10238             }
     10549        SetWindowPos (
     10550            infoPtr->hwndEdit,
     10551            HWND_TOP,
     10552            0,
     10553            0,
     10554            sz.cx,
     10555            rect.bottom - rect.top,
     10556            SWP_DRAWFRAME|SWP_NOMOVE);
     10557        }
    1023910558            if(hFont != 0)
    1024010559            {
     
    1024210561            }
    1024310562
    10244             ReleaseDC(hwnd, hdc);
    10245 
    10246             break;
    10247         }
    10248 
    10249         default:
    10250           return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam);
     10563        ReleaseDC(hwnd, hdc);
     10564
     10565        break;
     10566    }
     10567
     10568    default:
     10569      return SendMessageA (GetParent (hwnd), WM_COMMAND, wParam, lParam);
    1025110570    }
    1025210571
     
    1026310582 * RETURN:
    1026410583 */
    10265 LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg, 
    10266         WPARAM wParam, LPARAM lParam)
     10584LRESULT CALLBACK EditLblWndProc(HWND hwnd, UINT uMsg,
     10585    WPARAM wParam, LPARAM lParam)
    1026710586{
    1026810587    BOOL cancel = FALSE;
     
    1027210591    switch (uMsg)
    1027310592    {
    10274         case WM_GETDLGCODE:
    10275           return DLGC_WANTARROWS | DLGC_WANTALLKEYS;
    10276                        
    10277         case WM_KILLFOCUS:
     10593    case WM_GETDLGCODE:
     10594      return DLGC_WANTARROWS | DLGC_WANTALLKEYS;
     10595
     10596    case WM_KILLFOCUS:
    1027810597            if(bIgnoreKillFocus)
    1027910598            {
    1028010599                return TRUE;
    1028110600            }
    10282             break;
    10283 
    10284         case WM_DESTROY:
    10285         {
    10286             WNDPROC editProc = einfo->EditWndProc;
    10287             SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc);
    10288             COMCTL32_Free(einfo);
    10289             infoPtr->pedititem = NULL;
    10290             return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam);
    10291         }
    10292 
    10293         case WM_KEYDOWN:
    10294             if (VK_ESCAPE == (INT)wParam)
    10295             {
    10296                 cancel = TRUE;
     10601        break;
     10602
     10603    case WM_DESTROY:
     10604    {
     10605        WNDPROC editProc = einfo->EditWndProc;
     10606        SetWindowLongA(hwnd, GWL_WNDPROC, (LONG)editProc);
     10607        COMCTL32_Free(einfo);
     10608        infoPtr->pedititem = NULL;
     10609        return CallWindowProcA(editProc, hwnd, uMsg, wParam, lParam);
     10610    }
     10611
     10612    case WM_KEYDOWN:
     10613        if (VK_ESCAPE == (INT)wParam)
     10614        {
     10615        cancel = TRUE;
    1029710616                break;
    1029810617
    10299             }
    10300             else if (VK_RETURN == (INT)wParam)
    10301                 break;
    10302 
    10303         default:
    10304             return CallWindowProcA(einfo->EditWndProc, hwnd,
    10305                         uMsg, wParam, lParam);
     10618        }
     10619        else if (VK_RETURN == (INT)wParam)
     10620        break;
     10621
     10622    default:
     10623        return CallWindowProcA(einfo->EditWndProc, hwnd,
     10624            uMsg, wParam, lParam);
    1030610625    }
    1030710626
    1030810627    if (einfo->EditLblCb)
    1030910628    {
    10310         char *buffer  = NULL;
    10311        
    10312 
    10313         if (!cancel)
    10314         {
    10315             int len = 1 + GetWindowTextLengthA(hwnd);
    10316 
    10317             if (len > 1)
    10318             {
    10319                 if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char))))
    10320                 {
    10321                     GetWindowTextA(hwnd, buffer, len);
    10322                 }
    10323             }
    10324         }
     10629    char *buffer  = NULL;
     10630
     10631
     10632    if (!cancel)
     10633    {
     10634        int len = 1 + GetWindowTextLengthA(hwnd);
     10635
     10636        if (len > 1)
     10637        {
     10638        if (NULL != (buffer = (char *)COMCTL32_Alloc(len*sizeof(char))))
     10639        {
     10640            GetWindowTextA(hwnd, buffer, len);
     10641        }
     10642        }
     10643    }
    1032510644        /* Processing LVN_ENDLABELEDIT message could kill the focus       */
    1032610645        /* eg. Using a messagebox                                         */
    1032710646        bIgnoreKillFocus = TRUE;
    10328         einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param);
    10329 
    10330         if (buffer)
    10331             COMCTL32_Free(buffer);
    10332 
    10333         einfo->EditLblCb = NULL;
     10647    einfo->EditLblCb(GetParent(hwnd), buffer, einfo->param);
     10648
     10649    if (buffer)
     10650        COMCTL32_Free(buffer);
     10651
     10652    einfo->EditLblCb = NULL;
    1033410653        bIgnoreKillFocus = FALSE;
    1033510654    }
     
    1034810667 * RETURN:
    1034910668 */
    10350 HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y, 
    10351         INT width, INT height, HWND parent, HINSTANCE hinst,
    10352         EditlblCallback EditLblCb, DWORD param)
     10669HWND CreateEditLabel(LPCSTR text, DWORD style, INT x, INT y,
     10670    INT width, INT height, HWND parent, HINSTANCE hinst,
     10671    EditlblCallback EditLblCb, DWORD param)
    1035310672{
    1035410673    HWND hedit;
     
    1036010679
    1036110680    if (NULL == (infoPtr->pedititem = COMCTL32_Alloc(sizeof(EDITLABEL_ITEM))))
    10362         return 0;
     10681    return 0;
    1036310682
    1036410683    style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER;
     
    1038410703
    1038510704    ReleaseDC(parent, hdc);
    10386     if (!(hedit = CreateWindowA("Edit", text, style, x, y, sz.cx, height, 
    10387                     parent, 0, hinst, 0)))
    10388     {
    10389         COMCTL32_Free(infoPtr->pedititem);
    10390         return 0;
     10705    if (!(hedit = CreateWindowA("Edit", text, style, x, y, sz.cx, height,
     10706            parent, 0, hinst, 0)))
     10707    {
     10708    COMCTL32_Free(infoPtr->pedititem);
     10709    return 0;
    1039110710    }
    1039210711
    1039310712    infoPtr->pedititem->param = param;
    1039410713    infoPtr->pedititem->EditLblCb = EditLblCb;
    10395     infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit, 
    10396           GWL_WNDPROC, (LONG) EditLblWndProc);
     10714    infoPtr->pedititem->EditWndProc = (WNDPROC)SetWindowLongA(hedit,
     10715      GWL_WNDPROC, (LONG) EditLblWndProc);
    1039710716
    1039810717    SendMessageA(hedit, WM_SETFONT, infoPtr->hFont, FALSE);
Note: See TracChangeset for help on using the changeset viewer.