Revision: 12989
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12989&view=rev
Author:   hofman
Date:     2008-03-06 14:05:44 -0800 (Thu, 06 Mar 2008)

Log Message:
-----------
Restrict slider width, second try.

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m        2008-03-06 
21:53:10 UTC (rev 12988)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m        2008-03-06 
22:05:44 UTC (rev 12989)
@@ -471,20 +471,20 @@
 #define MIN_SLIDER_WIDTH 50.0
 #define MAX_SLIDER_WIDTH 200.0
 #define SLIDER_HEIGHT 15.0
+#define TOP_SLIDER_OFFSET 1.0
+#define BOTTOM_SLIDER_OFFSET 19.0
 
 - (NSRect)_topSliderRect
 {
     NSRect r = [self visibleRect];
 #if __LP64__
-    CGFloat w = fmax( MAX_SLIDER_WIDTH, fmin( MIN_SLIDER_WIDTH, NSWidth(r) / 
3.0 ) );
-    CGFloat l = fmax( 0.0, floor( ( NSWidth(r) - w ) / 2.0 ) );
+    CGFloat l = floor( NSMidX(r) - fmax( MIN_SLIDER_WIDTH / 2, fmin( 
MAX_SLIDER_WIDTH / 2, NSWidth(r) / 5 ) ) );
 #else
-    CGFloat w = fmaxf( MAX_SLIDER_WIDTH, fminf( MIN_SLIDER_WIDTH, NSWidth(r) / 
3.0 ) );
-    CGFloat l = fmaxf( 0.0, floorf( ( NSWidth(r) - w ) / 2.0 ) );
+    CGFloat l = floorf( NSMidX(r) - fmaxf( MIN_SLIDER_WIDTH / 2, fminf( 
MAX_SLIDER_WIDTH / 2, NSWidth(r) / 5 ) ) );
 #endif
     r.origin.x += l;
-    r.origin.y += 1.0;
-    r.size.width -= 2.0 * l;
+    r.origin.y += TOP_SLIDER_OFFSET;
+    r.size.width -= 2 * l;
     r.size.height = SLIDER_HEIGHT;
     return r;
 }
@@ -492,11 +492,15 @@
 - (NSRect)_bottomSliderRect
 {
     NSRect r = [self visibleRect];
-    CGFloat l = floor(NSWidth(r) / 3);
+#if __LP64__
+    CGFloat l = floor( NSMidX(r) - fmax( MIN_SLIDER_WIDTH / 2, fmin( 
MAX_SLIDER_WIDTH / 2, NSWidth(r) / 5 ) ) );
+#else
+    CGFloat l = floorf( NSMidX(r) - fmaxf( MIN_SLIDER_WIDTH / 2, fminf( 
MAX_SLIDER_WIDTH / 2, NSWidth(r) / 5 ) ) );
+#endif
     r.origin.x += l;
-    r.origin.y += NSHeight(r) - 19;
+    r.origin.y += NSHeight(r) - BOTTOM_SLIDER_OFFSET;
     r.size.width -= 2 * l;
-    r.size.height = 15;
+    r.size.height = SLIDER_HEIGHT;
     return r;
 }
 
@@ -581,9 +585,9 @@
             [self _hideArrows];
         
         if (_autoScales == NO) {
-            NSRect sliderRect = [self _topSliderRect];
+            NSRect sliderRect = NSIntersectionRect([self _topSliderRect], 
visibleRect);
             _topSliderTag = [self addTrackingRect:sliderRect owner:self 
userData:[self _sliderWindow] assumeInside:NSPointInRect(mouseLoc, 
sliderRect)];  
-            sliderRect = [self _bottomSliderRect];
+            sliderRect = NSIntersectionRect([self _bottomSliderRect], 
visibleRect);
             _bottomSliderTag = [self addTrackingRect:sliderRect owner:self 
userData:[self _sliderWindow] assumeInside:NSPointInRect(mouseLoc, 
sliderRect)];  
         }
     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to