Trackbar select range tweaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A couple minor tweaks.

Changelog:
	Oops, initial thumb length doesn't appear to depend on
	SM_CYCAPTION after all.
	Fix the channel size/selection range for the TBS_ENABLESELRANGE
	style.

Index: dlls/comctl32/trackbar.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/trackbar.c,v
retrieving revision 1.50
diff -u -r1.50 trackbar.c
--- dlls/comctl32/trackbar.c	2 Aug 2003 00:44:00 -0000	1.50
+++ dlls/comctl32/trackbar.c	2 Aug 2003 17:37:46 -0000
@@ -228,11 +228,14 @@
 
     offsetthumb = infoPtr->uThumbLen / 4;
     offsetedge  = offsetthumb + 3;
-    cyChannel   = (dwStyle & TBS_ENABLESELRANGE) ? (offsetthumb+1)*3 : 4;
+    cyChannel   = (dwStyle & TBS_ENABLESELRANGE) ? offsetthumb*3 : 4;
     if (dwStyle & TBS_VERT) {
         channel->top    = lpRect.top + offsetedge;
         channel->bottom = lpRect.bottom - offsetedge;
-        channel->left = lpRect.left + (infoPtr->uThumbLen / 2) - 1;
+        if (dwStyle & TBS_ENABLESELRANGE)
+            channel->left = lpRect.left + ((infoPtr->uThumbLen - cyChannel + 2) / 2);
+        else
+            channel->left = lpRect.left + (infoPtr->uThumbLen / 2) - 1;
         if (dwStyle & TBS_BOTH) {
             if (dwStyle & TBS_NOTICKS)
                 channel->left += 1;
@@ -249,7 +252,10 @@
     } else {
         channel->left = lpRect.left + offsetedge;
         channel->right = lpRect.right - offsetedge;
-        channel->top = lpRect.top + (infoPtr->uThumbLen / 2) - 1;
+        if (dwStyle & TBS_ENABLESELRANGE)
+            channel->top = lpRect.top + ((infoPtr->uThumbLen - cyChannel + 2) / 2);
+        else
+            channel->top = lpRect.top + (infoPtr->uThumbLen / 2) - 1;
         if (dwStyle & TBS_BOTH) {
             if (dwStyle & TBS_NOTICKS)
                 channel->top += 1;
@@ -348,23 +354,25 @@
 {
     RECT *selection = &infoPtr->rcSelection;
     int range = infoPtr->lRangeMax - infoPtr->lRangeMin;
+    int offsetthumb;
 
     if (range <= 0) {
         SetRectEmpty (selection);
     } else {
+        offsetthumb = (infoPtr->rcThumb.right - infoPtr->rcThumb.left)/2 + 1;
         if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_VERT) {
-            int height = infoPtr->rcChannel.right - infoPtr->rcChannel.left;
-            selection->top    = infoPtr->rcChannel.top +
+            int height = infoPtr->rcChannel.right - infoPtr->rcChannel.left - offsetthumb*2;
+            selection->top    = infoPtr->rcChannel.top + offsetthumb +
                 (height*infoPtr->lSelMin)/range;
-            selection->bottom = infoPtr->rcChannel.top +
+            selection->bottom = infoPtr->rcChannel.top + offsetthumb +
                 (height*infoPtr->lSelMax)/range;
             selection->left   = infoPtr->rcChannel.left + 3;
             selection->right  = infoPtr->rcChannel.right - 3;
         } else {
-            int width = infoPtr->rcChannel.right - infoPtr->rcChannel.left;
-            selection->left   = infoPtr->rcChannel.left +
+            int width = infoPtr->rcChannel.right - infoPtr->rcChannel.left - offsetthumb*2;
+            selection->left   = infoPtr->rcChannel.left + offsetthumb +
                 (width*infoPtr->lSelMin)/range;
-            selection->right  = infoPtr->rcChannel.left +
+            selection->right  = infoPtr->rcChannel.left + offsetthumb +
                 (width*infoPtr->lSelMax)/range;
             selection->top    = infoPtr->rcChannel.top + 3;
             selection->bottom = infoPtr->rcChannel.bottom - 3;
@@ -454,13 +462,9 @@
     if (flags & TBS_VERT) {
 	int height = rcTics.bottom - rcTics.top;
 	y = rcTics.top + (height*(ticPos - infoPtr->lRangeMin))/range;
-/*	x -= (offset + 2) * side;
-	y += indent;*/
     } else {
         int width = rcTics.right - rcTics.left;
         x = rcTics.left + (width*(ticPos - infoPtr->lRangeMin))/range;
-/*	x += indent;
-	y -= (offset + 2) * side;*/
     }
 
     ox = x;
@@ -1246,15 +1250,15 @@
     int clientWidth, clientMetric;
 
     /* initial thumb length */
-    clientMetric = GetSystemMetrics(SM_CYCAPTION);
+    clientMetric = (dwStyle & TBS_ENABLESELRANGE) ? 23 : 21;
     GetClientRect(infoPtr->hwndSelf,&rect);
     if (dwStyle & TBS_VERT) {
 	clientWidth = rect.right - rect.left;
     } else {
 	clientWidth = rect.bottom - rect.top;
     }
-    if (clientWidth > clientMetric)
-        infoPtr->uThumbLen = clientMetric + 1;
+    if (clientWidth >= clientMetric)
+        infoPtr->uThumbLen = clientMetric;
     else
         infoPtr->uThumbLen = clientWidth > 9 ? clientWidth - 6 : 4;
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux