Listview N6

Dimitrie O. Paun dpaun at rogers.com
Thu Oct 10 13:44:42 CDT 2002


Noop. Get this out of the way, they bug me.

ChangeLog
  Remove superfluous abstractions which make the code harder to understand.

--- dlls/comctl32/listview.c.N5	Thu Oct 10 14:27:51 2002
+++ dlls/comctl32/listview.c	Thu Oct 10 14:40:31 2002
@@ -659,15 +659,6 @@
     return bResult;
 }
 
-static inline void notify_odcachehint(LISTVIEW_INFO *infoPtr, RANGE range)
-{
-    NMLVCACHEHINT nmlv;
-
-    nmlv.iFrom = range.lower;
-    nmlv.iTo   = range.upper;
-    notify_hdr(infoPtr, LVN_ODCACHEHINT, &nmlv.hdr);
-}
-
 static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, LISTVIEW_INFO *infoPtr, HDC hdc, LPRECT rcBounds, LVITEMW *lpLVItem)
 {
     ZeroMemory(lpnmlvcd, sizeof(NMLVCUSTOMDRAW));
@@ -865,11 +856,6 @@
     return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);
 }
 
-static inline int LISTVIEW_GetType(LISTVIEW_INFO *infoPtr)
-{
-    return infoPtr->dwStyle & LVS_TYPEMASK;
-}
-
 /***
  * DESCRIPTION:
  * Retrieves the number of items that can fit vertically in the client area.
@@ -1578,7 +1564,7 @@
  */
 static void LISTVIEW_AlignTop(LISTVIEW_INFO *infoPtr)
 {
-  UINT uView = LISTVIEW_GetType(infoPtr);
+  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
   POINT ptItem;
   RECT rcView;
@@ -1646,7 +1632,7 @@
  */
 static void LISTVIEW_AlignLeft(LISTVIEW_INFO *infoPtr)
 {
-  UINT uView = LISTVIEW_GetType(infoPtr);
+  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
   POINT ptItem;
   RECT rcView;
@@ -1773,7 +1759,7 @@
  */
 static INT LISTVIEW_CalculateItemWidth(LISTVIEW_INFO *infoPtr, INT nItem)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nItemWidth = 0, i;
 
     if (uView == LVS_ICON) 
@@ -1876,7 +1862,7 @@
 {
     INT nItemHeight;
 
-    if (LISTVIEW_GetType(infoPtr) == LVS_ICON)
+    if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_ICON)
 	nItemHeight = infoPtr->iconSpacing.cy;
     else
     {
@@ -2367,7 +2353,7 @@
  */
 static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT i;
     LVITEMW item;
     POINT ptItem;
@@ -3318,8 +3304,15 @@
     iterator_clippeditems(&i, infoPtr, hdc);
     
     /* send cache hint notification */
-    if (infoPtr->dwStyle & LVS_OWNERDATA) 
-	notify_odcachehint(infoPtr, iterator_range(&i));
+    if (infoPtr->dwStyle & LVS_OWNERDATA)
+    {
+	RANGE range = iterator_range(&i);
+        NMLVCACHEHINT nmlv;
+
+        nmlv.iFrom = range.lower;
+        nmlv.iTo   = range.upper;
+        notify_hdr(infoPtr, LVN_ODCACHEHINT, &nmlv.hdr);
+    }
 
     /* iterate through the invalidated rows */
     while(iterator_next(&i))
@@ -3428,10 +3421,6 @@
     bFullSelected = infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT;
     TRACE("Colums=(%di - %d)\n", nFirstCol, nLastCol);
 
-    /* send cache hint notification */
-    if (infoPtr->dwStyle & LVS_OWNERDATA) 
-	notify_odcachehint(infoPtr, iterator_range(&i));
-
     /* iterate through the invalidated rows */
     while(iterator_next(&i))
     {
@@ -3583,7 +3572,7 @@
  */
 static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     NMLVCUSTOMDRAW nmlvcd;
     HFONT hOldFont;
     DWORD cdmode;
@@ -3645,7 +3634,7 @@
 static LRESULT LISTVIEW_ApproximateViewRect(LISTVIEW_INFO *infoPtr, INT nItemCount,
                                             WORD wWidth, WORD wHeight)
 {
-  UINT uView = LISTVIEW_GetType(infoPtr);
+  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   INT nItemCountPerColumn = 1;
   INT nColumnCount = 0;
   DWORD dwViewRect = 0;
@@ -3709,7 +3698,7 @@
  */
 static LRESULT LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
 {
-  UINT uView = LISTVIEW_GetType(infoPtr);
+  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   BOOL bResult = FALSE;
 
   if ((uView == LVS_ICON) || (uView == LVS_SMALLICON))
@@ -4189,7 +4178,7 @@
  */
 static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *infoPtr, INT nItem, BOOL bPartial)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nScrollPosHeight = 0;
     INT nScrollPosWidth = 0;
     INT nHorzAdjust = 0;
@@ -4550,7 +4539,7 @@
 
     TRACE("nColumn=%d\n", nColumn);
 
-    switch(LISTVIEW_GetType(infoPtr))
+    switch(infoPtr->dwStyle & LVS_TYPEMASK)
     {
     case LVS_LIST:
 	nColumnWidth = infoPtr->nItemWidth;
@@ -4582,7 +4571,7 @@
  */
 static LRESULT LISTVIEW_GetCountPerPage(LISTVIEW_INFO *infoPtr)
 {
-  UINT uView = LISTVIEW_GetType(infoPtr);
+  UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
   INT nItemCount = 0;
 
   if (uView == LVS_LIST)
@@ -5062,7 +5051,7 @@
     POINT ptPosition;
     INT nSubItem, flags;
     
-    if (!lprc || LISTVIEW_GetType(infoPtr) != LVS_REPORT) return FALSE;
+    if (!lprc || (infoPtr->dwStyle & LVS_TYPEMASK) != LVS_REPORT) return FALSE;
     
     nSubItem = lprc->top;
     flags = lprc->left;
@@ -5140,7 +5129,7 @@
   }
   else
   {
-    if (LISTVIEW_GetType(infoPtr) == LVS_ICON)
+    if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_ICON)
       lResult = MAKELONG(DEFAULT_COLUMN_WIDTH, GetSystemMetrics(SM_CXSMICON)+HEIGHT_PADDING);
     else
       lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight);
@@ -5218,7 +5207,7 @@
  */
 static LRESULT LISTVIEW_GetNextItem(LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     UINT uMask = 0;
     LVFINDINFOW lvFindInfo;
     INT nCountPerColumn;
@@ -5986,7 +5975,7 @@
  */
 static LRESULT LISTVIEW_Scroll(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
 {
-    switch(LISTVIEW_GetType(infoPtr)) {
+    switch(infoPtr->dwStyle & LVS_TYPEMASK) {
     case LVS_REPORT:
 	dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2;
         dy /= infoPtr->nItemHeight;
@@ -6492,7 +6481,7 @@
  */
 static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *infoPtr, INT nType, HIMAGELIST himl)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT oldHeight = infoPtr->nItemHeight;
     HIMAGELIST himlOld = 0;
 
@@ -7102,7 +7091,7 @@
 static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, 
 				INT nScrollDiff, HWND hScrollWnd)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nOldScrollPos, nNewScrollPos;
     SCROLLINFO scrollInfo;
     BOOL is_an_icon;
@@ -7206,7 +7195,7 @@
 static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode,
                                 INT nScrollDiff, HWND hScrollWnd)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT nOldScrollPos, nNewScrollPos;
     SCROLLINFO scrollInfo;
 
@@ -7289,7 +7278,7 @@
 
 static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
 {
-    UINT uView = LISTVIEW_GetType(infoPtr);
+    UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
     INT gcWheelDelta = 0;
     UINT pulScrollLines = 3;
     SCROLLINFO scrollInfo;
@@ -7350,7 +7339,7 @@
  */
 static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
 {
-  UINT uView =  LISTVIEW_GetType(infoPtr);
+  UINT uView =  infoPtr->dwStyle & LVS_TYPEMASK;
   INT nItem = -1;
   NMLVKEYDOWN nmKeyDown;
 
@@ -7992,7 +7981,7 @@
     
     LISTVIEW_SaveTextMetrics(infoPtr);
 
-    if (LISTVIEW_GetType(infoPtr) == LVS_REPORT)
+    if ((infoPtr->dwStyle & LVS_TYPEMASK) == LVS_REPORT)
 	SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0));
 
     if (fRedraw) LISTVIEW_InvalidateList(infoPtr);




More information about the wine-patches mailing list