fixed some scrolling issues
Modified: trunk/reactos/lib/aclui/checklist.c

Modified: trunk/reactos/lib/aclui/checklist.c
--- trunk/reactos/lib/aclui/checklist.c	2005-07-04 11:05:04 UTC (rev 16406)
+++ trunk/reactos/lib/aclui/checklist.c	2005-07-04 11:52:16 UTC (rev 16407)
@@ -310,17 +310,16 @@
         if (DirectlyInCheckBox != NULL)
         {
             INT y = ppt->y % infoPtr->ItemHeight;
+            INT cxBox = infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT);
             
             if ((y >= CI_TEXT_MARGIN_HEIGHT &&
                  y < infoPtr->ItemHeight - CI_TEXT_MARGIN_HEIGHT) &&
 
-                (((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2))) &&
-                  (ppt->x < (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2) +
-                             infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT))))
+                (((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2))) &&
+                  (ppt->x < (infoPtr->CheckBoxLeft[CLB_ALLOW] - (cxBox / 2) + cxBox)))
                  ||
-                 ((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2))) &&
-                  (ppt->x < (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2) +
-                             infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT))))))
+                 ((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2))) &&
+                  (ppt->x < (infoPtr->CheckBoxLeft[CLB_DENY] - (cxBox / 2) + cxBox)))))
             {
                 *DirectlyInCheckBox = TRUE;
             }
@@ -446,6 +445,7 @@
     RECT rcClient;
     SCROLLINFO ScrollInfo;
     LONG Style;
+    INT VisibleItems;
     
     GetClientRect(infoPtr->hSelf,
                   &rcClient);
@@ -457,33 +457,40 @@
     ScrollInfo.nPage = ((rcClient.bottom - rcClient.top) + infoPtr->ItemHeight - 1) / infoPtr->ItemHeight;
     ScrollInfo.nPos = 0;
     ScrollInfo.nTrackPos = 0;
+    
+    VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight;
+    
+    if (ScrollInfo.nPage == VisibleItems && ScrollInfo.nMax > 0)
+    {
+        ScrollInfo.nMax--;
+    }
 
+    SetScrollInfo(infoPtr->hSelf,
+                  SB_VERT,
+                  &ScrollInfo,
+                  TRUE);
+
     if (AllowChangeStyle)
     {
         Style = GetWindowLong(infoPtr->hSelf,
                               GWL_STYLE);
 
         /* determine whether the vertical scrollbar has to be visible or not */
-        if (ScrollInfo.nMax > ScrollInfo.nPage &&
+        if (ScrollInfo.nMax > VisibleItems &&
             !(Style & WS_VSCROLL))
         {
             SetWindowLong(infoPtr->hSelf,
                           GWL_STYLE,
                           Style | WS_VSCROLL);
         }
-        else if (ScrollInfo.nMax < ScrollInfo.nPage &&
-                 Style & WS_VSCROLL)
+        else if (ScrollInfo.nMax <= VisibleItems &&
+                 (Style & WS_VSCROLL))
         {
             SetWindowLong(infoPtr->hSelf,
                           GWL_STYLE,
                           Style & ~WS_VSCROLL);
         }
     }
-    
-    SetScrollInfo(infoPtr->hSelf,
-                  SB_VERT,
-                  &ScrollInfo,
-                  TRUE);
 
     RedrawWindow(infoPtr->hSelf,
                  NULL,