Revision: 5308
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5308&view=rev
Author:   hofman
Date:     2009-04-06 18:37:51 +0000 (Mon, 06 Apr 2009)

Log Message:
-----------
Define tiger colors for blue tables in the table classes directly instead of a 
custom class factory method with a static color. Draw selection in these tables 
on Tiger.

Modified Paths:
--------------
    trunk/NSColor_SKExtensions.h
    trunk/NSColor_SKExtensions.m
    trunk/SKThumbnailTableView.m
    trunk/SKTocOutlineView.m

Modified: trunk/NSColor_SKExtensions.h
===================================================================
--- trunk/NSColor_SKExtensions.h        2009-04-06 17:27:02 UTC (rev 5307)
+++ trunk/NSColor_SKExtensions.h        2009-04-06 18:37:51 UTC (rev 5308)
@@ -71,9 +71,6 @@
 
 @interface NSColor (SKExtensions)
 
-+ (NSColor *)tableBackgroundColor;
-+ (NSColor *)secondarySelectedTableColor;
-
 + (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor;
 - (id)scriptingRgbaColorDescriptor;
 

Modified: trunk/NSColor_SKExtensions.m
===================================================================
--- trunk/NSColor_SKExtensions.m        2009-04-06 17:27:02 UTC (rev 5307)
+++ trunk/NSColor_SKExtensions.m        2009-04-06 18:37:51 UTC (rev 5308)
@@ -39,26 +39,8 @@
 #import "NSColor_SKExtensions.h"
 
 
-...@interface NSColor (SKApplePrivateDeclerations)
-+ (NSColor *)_sourceListBackgroundColor;
-...@end
-
 @implementation NSColor (SKExtensions)
 
-+ (NSColor *)tableBackgroundColor {
-    static NSColor *tableBackgroundColor = nil;
-    if (nil == tableBackgroundColor)
-        tableBackgroundColor = [[NSColor colorWithCalibratedRed:0.905882 
green:0.929412 blue:0.964706 alpha:1.0] retain];
-    return tableBackgroundColor;
-}
-
-+ (NSColor *)secondarySelectedTableColor {
-    static NSColor *secondarySelectedTableColor = nil;
-    if (nil == secondarySelectedTableColor)
-        secondarySelectedTableColor = [[NSColor 
colorWithCalibratedRed:0.724706 green:0.743529 blue:0.771765 alpha:1.0] retain];
-    return secondarySelectedTableColor;
-}
-
 + (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor {
     if ([descriptor numberOfItems] > 0) {
         float red, green, blue, alpha;

Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m        2009-04-06 17:27:02 UTC (rev 5307)
+++ trunk/SKThumbnailTableView.m        2009-04-06 18:37:51 UTC (rev 5308)
@@ -44,6 +44,7 @@
 #define SKScrollerWillScrollNotification @"SKScrollerWillScrollNotification"
 #define SKScrollerDidScrollNotification @"SKScrollerDidScrollNotification"
 
+
 @interface NSScroller (SKExtensions)
 @end
 
@@ -65,12 +66,14 @@
 
 @implementation SKThumbnailTableView
 
+#define TIGER_BACKGROUNDCOLOR [NSColor colorWithCalibratedRed:0.905882 
green:0.929412 blue:0.964706 alpha:1.0]
+
 - (id)initWithFrame:(NSRect)frameRect {
     if (self = [super initWithFrame:frameRect]) {
         if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
             [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
         else
-            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+            [self setBackgroundColor:TIGER_BACKGROUNDCOLOR];
     }
     return self;
 }
@@ -80,7 +83,7 @@
         if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
             [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
         else
-            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+            [self setBackgroundColor:TIGER_BACKGROUNDCOLOR];
     }
     return self;
 }
@@ -94,8 +97,9 @@
     NSColor *color;
     int row;
     NSRect rect;
+    BOOL supportsSourceList = [self 
respondsToSelector:@selector(setSelectionHighlightStyle:)];
     
-    if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)]) {
+    if (supportsSourceList) {
         if ([[self window] isMainWindow] == NO)
             color = [NSColor colorWithDeviceRed:40606.0/65535.0 
green:40606.0/65535.0 blue:40606.0/65535.0 alpha:1.0];
         else if ([[self window] isKeyWindow] && [[self window] firstResponder] 
== self)
@@ -106,7 +110,7 @@
         if ([[self window] isMainWindow] && [[self window] firstResponder] == 
self)
             color = [NSColor alternateSelectedControlColor];
         else
-            color = [NSColor secondarySelectedTableColor];
+            color = [NSColor colorWithCalibratedRed:0.724706 green:0.743529 
blue:0.771765 alpha:1.0];
     }
     
     [NSGraphicsContext saveGraphicsState];
@@ -128,9 +132,19 @@
         }
     }
     
+    row = [self selectedRow];
+    if (row != -1 && supportsSourceList == NO) {
+        rect = [self rectOfRow:row];
+        if (NSIntersectsRect(rect, clipRect)) {
+            [color setFill];
+            NSRectFill([self rectOfRow:row]);
+        }
+    }
+    
     [NSGraphicsContext restoreGraphicsState];
     
-    [super highlightSelectionInClipRect:clipRect];
+    if (supportsSourceList)
+        [super highlightSelectionInClipRect:clipRect];
 }
 
 - (void)selectRowIndexes:(NSIndexSet *)indexes 
byExtendingSelection:(BOOL)extendSelection {

Modified: trunk/SKTocOutlineView.m
===================================================================
--- trunk/SKTocOutlineView.m    2009-04-06 17:27:02 UTC (rev 5307)
+++ trunk/SKTocOutlineView.m    2009-04-06 18:37:51 UTC (rev 5308)
@@ -45,12 +45,14 @@
 
 + (BOOL)usesDefaultFontSize { return YES; }
 
+#define TIGER_BACKGROUNDCOLOR [NSColor colorWithCalibratedRed:0.905882 
green:0.929412 blue:0.964706 alpha:1.0]
+
 - (id)initWithFrame:(NSRect)frameRect {
     if (self = [super initWithFrame:frameRect]) {
         if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
             [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
         else
-            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+            [self setBackgroundColor:TIGER_BACKGROUNDCOLOR];
     }
     return self;
 }
@@ -60,7 +62,7 @@
         if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
             [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
         else
-            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+            [self setBackgroundColor:TIGER_BACKGROUNDCOLOR];
     }
     return self;
 }
@@ -75,8 +77,9 @@
     NSColor *color;
     int row;
     NSRect rect;
+    BOOL supportsSourceList = [self 
respondsToSelector:@selector(setSelectionHighlightStyle:)];
     
-    if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)]) {
+    if (supportsSourceList) {
         if ([[self window] isMainWindow] == NO)
             color = [NSColor colorWithDeviceRed:40606.0/65535.0 
green:40606.0/65535.0 blue:40606.0/65535.0 alpha:1.0];
         else if ([[self window] isKeyWindow] && [[self window] firstResponder] 
== self)
@@ -87,7 +90,7 @@
         if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
             color = [NSColor alternateSelectedControlColor];
         else
-            color = [NSColor secondarySelectedTableColor];
+            color = [NSColor colorWithCalibratedRed:0.724706 green:0.743529 
blue:0.771765 alpha:1.0];
     }
     
     [NSGraphicsContext saveGraphicsState];
@@ -108,9 +111,19 @@
         }
     }
     
+    row = [self selectedRow];
+    if (row != -1 && supportsSourceList == NO) {
+        rect = [self rectOfRow:row];
+        if (NSIntersectsRect(rect, clipRect)) {
+            [color setFill];
+            NSRectFill([self rectOfRow:row]);
+        }
+    }
+
     [NSGraphicsContext restoreGraphicsState];
     
-    [super highlightSelectionInClipRect:clipRect];
+    if (supportsSourceList)
+        [super highlightSelectionInClipRect:clipRect];
 }
 
 - (void)selectRowIndexes:(NSIndexSet *)indexes 
byExtendingSelection:(BOOL)extendSelection {


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:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to