Revision: 3082
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3082&view=rev
Author:   hofman
Date:     2007-10-28 04:49:42 -0700 (Sun, 28 Oct 2007)

Log Message:
-----------
Reverse gradients in Leopard. In fact, change the meaning of the NSBezierPath 
and CIImage categories to follow the more sensible Leopard ordering.

Modified Paths:
--------------
    trunk/BDSKGradientView.h
    trunk/BDSKGradientView.m
    trunk/CIImage_BDSKExtensions.m
    trunk/SKSplitView.m
    trunk/SKStatusBar.m

Modified: trunk/BDSKGradientView.h
===================================================================
--- trunk/BDSKGradientView.h    2007-10-28 10:14:41 UTC (rev 3081)
+++ trunk/BDSKGradientView.h    2007-10-28 11:49:42 UTC (rev 3082)
@@ -42,8 +42,8 @@
 @interface BDSKGradientView : NSView
 {
     @private
-    CIColor *startColor;
-    CIColor *endColor;
+    CIColor *lowerColor;
+    CIColor *upperColor;
 }
 
 - (void)setLowerColor:(NSColor *)color;

Modified: trunk/BDSKGradientView.m
===================================================================
--- trunk/BDSKGradientView.m    2007-10-28 10:14:41 UTC (rev 3081)
+++ trunk/BDSKGradientView.m    2007-10-28 11:49:42 UTC (rev 3082)
@@ -57,8 +57,8 @@
 
 - (void)dealloc
 {
-    [endColor release];
-    [startColor release];
+    [lowerColor release];
+    [upperColor release];
     [super dealloc];
 }
 
@@ -66,24 +66,24 @@
 {
     // fill entire view, not just the (possibly clipped) aRect
     if ([[self window] styleMask] & NSClosableWindowMask)
-        [[NSBezierPath bezierPathWithRect:[self bounds]] 
fillPathVerticallyWithStartColor:[self upperColor] endColor:[self lowerColor]];
+        [[NSBezierPath bezierPathWithRect:[self bounds]] 
fillPathVerticallyWithStartColor:[self lowerColor] endColor:[self upperColor]];
 }
 
 // -[CIColor initWithColor:] fails (returns nil) with +[NSColor gridColor] 
rdar://problem/4789043
 - (void)setLowerColor:(NSColor *)color
 {
-    [endColor autorelease];
-    endColor = [[CIColor colorWithNSColor:color] retain];
+    [lowerColor autorelease];
+    lowerColor = [[CIColor colorWithNSColor:color] retain];
 }
 
 - (void)setUpperColor:(NSColor *)color
 {
-    [startColor autorelease];
-    startColor = [[CIColor colorWithNSColor:color] retain];
+    [upperColor autorelease];
+    upperColor = [[CIColor colorWithNSColor:color] retain];
 }    
 
-- (CIColor *)lowerColor { return endColor; }
-- (CIColor *)upperColor { return startColor; }
+- (CIColor *)lowerColor { return lowerColor; }
+- (CIColor *)upperColor { return upperColor; }
 
 // required in order for redisplay to work properly with the controls
 - (BOOL)isOpaque{  return ([[self window] styleMask] & NSClosableWindowMask) 
!= 0; }

Modified: trunk/CIImage_BDSKExtensions.m
===================================================================
--- trunk/CIImage_BDSKExtensions.m      2007-10-28 10:14:41 UTC (rev 3081)
+++ trunk/CIImage_BDSKExtensions.m      2007-10-28 11:49:42 UTC (rev 3082)
@@ -41,6 +41,20 @@
 
 @implementation CIImage (BDSKExtensions)
 
+static NSString *startColorKey = nil;
+static NSString *endColorKey = nil;
+
++ (void)initialize {
+    if (floor(NSAppKitVersionNumber) <= 824) {
+        // in Tiger the input colors are reversed
+        startColorKey = [@"inputColor1" retain];
+        endColorKey = [@"inputColor0" retain];
+    } else {
+        startColorKey = [@"inputColor0" retain];
+        endColorKey = [@"inputColor1" retain];
+    }
+}
+
 + (CIImage *)imageWithConstantColor:(CIColor *)color;
 {
     static CIFilter *colorFilter = nil;
@@ -58,8 +72,8 @@
     if (linearFilter == nil)
         linearFilter = [[CIFilter filterWithName:@"CILinearGradient"] retain]; 
   
     
-    [linearFilter setValue:startColor forKey:@"inputColor0"];
-    [linearFilter setValue:endColor forKey:@"inputColor1"];
+    [linearFilter setValue:startColor forKey:startColorKey];
+    [linearFilter setValue:endColor forKey:endColorKey];
     
     [linearFilter setValue:[CIVector vectorWithX:startPoint.x Y:startPoint.y] 
forKey:@"inputPoint0"];
     [linearFilter setValue:[CIVector vectorWithX:endPoint.x Y:endPoint.y] 
forKey:@"inputPoint1"];

Modified: trunk/SKSplitView.m
===================================================================
--- trunk/SKSplitView.m 2007-10-28 10:14:41 UTC (rev 3081)
+++ trunk/SKSplitView.m 2007-10-28 11:49:42 UTC (rev 3082)
@@ -47,14 +47,14 @@
 + (CIColor *)startColor{
     static CIColor *startColor = nil;
     if (startColor == nil)
-        startColor = [[CIColor colorWithNSColor:[NSColor 
colorWithCalibratedWhite:0.85 alpha:1.0]] retain];
+        startColor = [[CIColor colorWithNSColor:[NSColor 
colorWithCalibratedWhite:0.95 alpha:1.0]] retain];
     return startColor;
 }
 
 + (CIColor *)endColor{
     static CIColor *endColor = nil;
     if (endColor == nil)
-        endColor = [[CIColor colorWithNSColor:[NSColor 
colorWithCalibratedWhite:0.95 alpha:1.0]] retain];
+        endColor = [[CIColor colorWithNSColor:[NSColor 
colorWithCalibratedWhite:0.85 alpha:1.0]] retain];
    return endColor;
 }
 
@@ -98,9 +98,9 @@
     if (blendEnds) {
         NSRect endRect, ignored;
         NSDivideRect(aRect, &endRect, &ignored, END_JOIN_WIDTH, [self 
isVertical] ? NSMinYEdge : NSMinXEdge);
+        [[NSBezierPath bezierPathWithRect:endRect] fillPathVertically:[self 
isVertical] withStartColor:[[self class] endColor] endColor:[CIColor 
clearColor]];
+        NSDivideRect(aRect, &endRect, &ignored, END_JOIN_WIDTH, [self 
isVertical] ? NSMaxYEdge : NSMaxXEdge);
         [[NSBezierPath bezierPathWithRect:endRect] fillPathVertically:[self 
isVertical] withStartColor:[CIColor clearColor] endColor:[[self class] 
startColor]];
-        NSDivideRect(aRect, &endRect, &ignored, END_JOIN_WIDTH, [self 
isVertical] ? NSMaxYEdge : NSMaxXEdge);
-        [[NSBezierPath bezierPathWithRect:endRect] fillPathVertically:[self 
isVertical] withStartColor:[[self class] endColor] endColor:[CIColor 
clearColor]];
     }
     
     [NSGraphicsContext saveGraphicsState];

Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2007-10-28 10:14:41 UTC (rev 3081)
+++ trunk/SKStatusBar.m 2007-10-28 11:49:42 UTC (rev 3082)
@@ -90,7 +90,7 @@
        NSRect textRect, ignored;
     float rightMargin = RIGHT_MARGIN;
     
-    [[NSBezierPath bezierPathWithRect:[self bounds]] 
fillPathVerticallyWithStartColor:[[self class] upperColor] endColor:[[self 
class] lowerColor]];
+    [[NSBezierPath bezierPathWithRect:[self bounds]] 
fillPathVerticallyWithStartColor:[[self class] lowerColor] endColor:[[self 
class] upperColor]];
     
     if (progressIndicator)
         rightMargin += NSWidth([progressIndicator frame]) + SEPARATION;


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to