Revision: 5292
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5292&view=rev
Author:   hofman
Date:     2009-03-31 17:59:01 +0000 (Tue, 31 Mar 2009)

Log Message:
-----------
Use sourcelist style for thumbnail and toc tables

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

Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m        2009-03-31 14:33:33 UTC (rev 5291)
+++ trunk/SKThumbnailTableView.m        2009-03-31 17:59:01 UTC (rev 5292)
@@ -65,24 +65,49 @@
 
 @implementation SKThumbnailTableView
 
+- (id)initWithFrame:(NSRect)frameRect {
+    if (self = [super initWithFrame:frameRect]) {
+        if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
+            [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
+        else
+            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+    }
+    return self;
+}
+
+- (id)initWithCoder:(NSCoder *)coder {
+    if (self = [super initWithCoder:coder]) {
+        if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
+            [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
+        else
+            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+    }
+    return self;
+}
+
 - (void)dealloc {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     [super dealloc];
 }
 
-- (NSColor *)backgroundColor {
-    return [NSColor tableBackgroundColor];
-}
-
 - (void)highlightSelectionInClipRect:(NSRect)clipRect {
     NSColor *color;
     int row;
     NSRect rect;
     
-    if ([[self window] isKeyWindow] && [[self window] firstResponder] == self)
-        color = [NSColor alternateSelectedControlColor];
-    else
-        color = [NSColor secondarySelectedTableColor];
+    if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)]) {
+        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
+            color = [NSColor colorWithCalibratedRed:0.296719 green:0.489387 
blue:0.823514 alpha:1.0];
+        else if ([[self window] isKeyWindow])
+            color = [NSColor colorWithCalibratedRed:0.659915 green:0.709033 
blue:0.788708 alpha:1.0];
+        else
+            color = [NSColor colorWithCalibratedRed:0.496086 green:0.496086 
blue:0.496086 alpha:1.0];
+    } else {
+        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
+            color = [NSColor alternateSelectedControlColor];
+        else
+            color = [NSColor secondarySelectedTableColor];
+    }
     
     [NSGraphicsContext saveGraphicsState];
     
@@ -103,16 +128,9 @@
         }
     }
     
-    row = [self selectedRow];
-    if (row != -1) {
-        rect = [self rectOfRow:row];
-        if (NSIntersectsRect(rect, clipRect)) {
-            [color setFill];
-            NSRectFill([self rectOfRow:row]);
-        }
-    }
+    [NSGraphicsContext restoreGraphicsState];
     
-    [NSGraphicsContext restoreGraphicsState];
+    [super highlightSelectionInClipRect:clipRect];
 }
 
 - (void)selectRowIndexes:(NSIndexSet *)indexes 
byExtendingSelection:(BOOL)extendSelection {

Modified: trunk/SKTocOutlineView.m
===================================================================
--- trunk/SKTocOutlineView.m    2009-03-31 14:33:33 UTC (rev 5291)
+++ trunk/SKTocOutlineView.m    2009-03-31 17:59:01 UTC (rev 5292)
@@ -45,25 +45,50 @@
 
 + (BOOL)usesDefaultFontSize { return YES; }
 
+- (id)initWithFrame:(NSRect)frameRect {
+    if (self = [super initWithFrame:frameRect]) {
+        if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
+            [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
+        else
+            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+    }
+    return self;
+}
+
+- (id)initWithCoder:(NSCoder *)coder {
+    if (self = [super initWithCoder:coder]) {
+        if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)])
+            [self 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList];
+        else
+            [self setBackgroundColor:[NSColor tableBackgroundColor]];
+    }
+    return self;
+}
+
 - (void)dealloc {
     if (trackingRects != NULL)
         CFRelease(trackingRects);
     [super dealloc];
 }
 
-- (NSColor *)backgroundColor {
-    return [NSColor tableBackgroundColor];
-}
-
 - (void)highlightSelectionInClipRect:(NSRect)clipRect {
     NSColor *color;
     int row;
     NSRect rect;
     
-    if ([[self window] isKeyWindow] && [[self window] firstResponder] == self)
-        color = [NSColor alternateSelectedControlColor];
-    else
-        color = [NSColor secondarySelectedTableColor];
+    if ([self respondsToSelector:@selector(setSelectionHighlightStyle:)]) {
+        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
+            color = [NSColor colorWithCalibratedRed:0.296719 green:0.489387 
blue:0.823514 alpha:1.0];
+        else if ([[self window] isKeyWindow])
+            color = [NSColor colorWithCalibratedRed:0.659915 green:0.709033 
blue:0.788708 alpha:1.0];
+        else
+            color = [NSColor colorWithCalibratedRed:0.496086 green:0.496086 
blue:0.496086 alpha:1.0];
+    } else {
+        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
+            color = [NSColor alternateSelectedControlColor];
+        else
+            color = [NSColor secondarySelectedTableColor];
+    }
     
     [NSGraphicsContext saveGraphicsState];
     
@@ -83,16 +108,9 @@
         }
     }
     
-    row = [self selectedRow];
-    if (row != -1) {
-        rect = [self rectOfRow:row];
-        if (NSIntersectsRect(rect, clipRect)) {
-            [color setFill];
-            [NSBezierPath fillRect:rect];
-        }
-    }
+    [NSGraphicsContext restoreGraphicsState];
     
-    [NSGraphicsContext restoreGraphicsState];
+    [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.

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

Reply via email to