Dimitrie's fix for the listview large icon text

Medland, Bill Bill.Medland at accpac.com
Fri Jan 25 13:47:35 CST 2002


Dimitrie gets the glory; all I did was make it compile.

-------------- next part --------------
Bill Medland (medbi01 at accpac.com)
Dimitrie's patch for the text under large icons.

Index: wine/dlls/comctl32/listview.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
retrieving revision 1.108
diff -u -r1.108 listview.c
--- wine/dlls/comctl32/listview.c	2002/01/18 19:05:35	1.108
+++ wine/dlls/comctl32/listview.c	2002/01/25 17:38:04
@@ -3187,22 +3187,16 @@
   rcWidth = max(0, rcItem.right - rcItem.left);
   if (nLabelWidth > rcWidth)
   {
-      INT i, len, eos, nCharsFit;
       /* give or take a couple, how many average sized chars would fit? */
-      nCharsFit = tm.tmAveCharWidth > 0 ? (rcWidth/tm.tmAveCharWidth)+2 : 0; 
-      /* place the ellipse accordingly, without overrunning the buffer */
-      len = strlenW(szDispText);
-      eos = min((nCharsFit > 1 && nCharsFit < len) ? nCharsFit+3 : len+2,
-                sizeof(szDispText)/sizeof(WCHAR)-1);
-      
-      nLabelWidth = ListView_GetStringWidthW(hwnd, szDispText);
-      while ((nLabelWidth > rcWidth) && (eos > 3))
+      INT nCharsFit = tm.tmAveCharWidth > 0 ? rcWidth/tm.tmAveCharWidth+2 : 0; 
+      INT eos = min(strlenW(lvItem.pszText), nCharsFit);
+      if (eos > 0)  lvItem.pszText[eos-1] = '.';
+      if (eos > 1)  lvItem.pszText[eos-2] = '.';
+      for ( ; eos > 2; eos--) 
       {
-	 for (i = 1; i < 4; i++)
-	    szDispText[eos-i] = '.'; 
-         /* shift the ellipse one char to the left for each iteration */
-         szDispText[eos--] = '\0'; 
-         nLabelWidth = ListView_GetStringWidthW(hwnd, szDispText);
+	lvItem.pszText[eos - 3] = '.';
+	lvItem.pszText[eos] = '\0';
+	if (ListView_GetStringWidthW(hwnd, lvItem.pszText) <= rcWidth) break;
       }
   }
 


More information about the wine-patches mailing list