Revision: 5294
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5294&view=rev
Author:   hofman
Date:     2009-03-31 21:30:27 +0000 (Tue, 31 Mar 2009)

Log Message:
-----------
Use the background style to draw the window indicator in the snapshot page 
cell, draw it raised in a lowered background style, which is now whenever the 
row is selected on Leopard

Modified Paths:
--------------
    trunk/SKSnapshotPageCell.m

Modified: trunk/SKSnapshotPageCell.m
===================================================================
--- trunk/SKSnapshotPageCell.m  2009-03-31 21:29:00 UTC (rev 5293)
+++ trunk/SKSnapshotPageCell.m  2009-03-31 21:30:27 UTC (rev 5294)
@@ -44,26 +44,6 @@
 
 @implementation SKSnapshotPageCell
 
-static NSShadow *selectedShadow = nil;
-static NSShadow *deselectedShadow = nil;
-static NSColor *selectedColor = nil;
-static NSColor *deselectedColor = nil;
-
-+ (void)initialize
-{
-    SKINITIALIZE;
-    
-    selectedShadow = [[NSShadow alloc] init];
-    [selectedShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 
alpha:0.2]];
-    [selectedShadow setShadowOffset:NSMakeSize(0.0, -1.0)];
-    deselectedShadow = [[NSShadow alloc] init];
-    [deselectedShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 
alpha:0.2]];
-    [deselectedShadow setShadowOffset:NSMakeSize(0.0, -1.0)];
-    
-    selectedColor = [[NSColor colorWithCalibratedWhite:1.0 alpha:1.0] copy];
-    deselectedColor = [[NSColor colorWithCalibratedWhite:0.0 alpha:0.8] copy];
-}
-
 - (id)copyWithZone:(NSZone *)aZone {
     SKSnapshotPageCell *copy = [super copyWithZone:aZone];
     copy->hasWindow = hasWindow;
@@ -94,19 +74,37 @@
     NSDivideRect(cellFrame, &textRect, &imageRect, 17.0, NSMinYEdge);
     [super drawInteriorWithFrame:textRect inView:controlView];
     if (hasWindow) {
-        BOOL isSelected = [self isHighlighted] && [[controlView window] 
isKeyWindow] && [[[controlView window] firstResponder] isEqual:controlView];
         float radius = 2.0;
         NSBezierPath *path = [NSBezierPath bezierPath];
-        NSShadow *aShadow;
+        NSShadow *aShadow = [[[NSShadow alloc] init] autorelease];
         NSColor *fillColor;
+        NSBackgroundStyle backgroundStyle = NSBackgroundStyleLight;
         
-        if (isSelected) {
-            aShadow = selectedShadow;
-            fillColor = selectedColor;
-        } else {
-            aShadow = deselectedShadow;
-            fillColor = deselectedColor;
+        if ([self respondsToSelector:@selector(interiorBackgroundStyle)])
+            backgroundStyle = [self interiorBackgroundStyle];
+        else if ([self isHighlighted] && [[controlView window] isKeyWindow] && 
[[[controlView window] firstResponder] isEqual:controlView])
+            backgroundStyle = NSBackgroundStyleDark;
+        
+        switch (backgroundStyle) {
+            case NSBackgroundStyleDark:
+                [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 
alpha:0.2]];
+                fillColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0];
+                break;
+            case NSBackgroundStyleLowered:
+                [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 
alpha:0.3333]];
+                fillColor = [NSColor colorWithCalibratedWhite:1.0 alpha:1.0];
+                break;
+            case NSBackgroundStyleRaised:
+                [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 
alpha:0.3]];
+                fillColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.8];
+                break;
+            case NSBackgroundStyleLight:
+            default:
+                [aShadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 
alpha:0.2]];
+                fillColor = [NSColor colorWithCalibratedWhite:0.0 alpha:0.8];
+                break;
         }
+        [aShadow setShadowOffset:NSMakeSize(0.0, -1.0)];
         
         NSDivideRect(imageRect, &imageRect, &ignored, 10.0, NSMinYEdge);
         imageRect.origin.x += 4.0;


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

------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to