Revision: 5924
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5924&view=rev
Author:   hofman
Date:     2009-10-21 17:02:23 +0000 (Wed, 21 Oct 2009)

Log Message:
-----------
for completeness highlight history using color appropriate to highlight style

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

Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m        2009-10-21 15:20:15 UTC (rev 5923)
+++ trunk/SKThumbnailTableView.m        2009-10-21 17:02:23 UTC (rev 5924)
@@ -80,36 +80,51 @@
 
 - (void)highlightSelectionInClipRect:(NSRect)clipRect {
     if ([[self delegate] 
respondsToSelector:@selector(tableViewHighlightedRows:)]) {
-        NSColor *color;
+        NSColor *color = nil;
         NSInteger row;
         NSRect rect;
         CGFloat *rgb;
         BOOL isGraphite = [NSColor currentControlTint] == 
NSGraphiteControlTint;
-        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
-            rgb = isGraphite ? keyColorGraphite : keyColorBlue;
-        else if ([[self window] isMainWindow] || [[self window] isKeyWindow])
-            rgb = isGraphite ? mainColorGraphite : mainColorBlue;
-        else
-            rgb = isGraphite ? disabledColorGraphite : disabledColorBlue;
-        color = [NSColor colorWithDeviceRed:rgb[0] green:rgb[1] blue:rgb[2] 
alpha:1.0];
         
-        [NSGraphicsContext saveGraphicsState];
+        switch ([self selectionHighlightStyle]) {
+            case NSTableViewSelectionHighlightStyleSourceList:
+                if ([[self window] isKeyWindow] && [[self window] 
firstResponder] == self)
+                    rgb = isGraphite ? keyColorGraphite : keyColorBlue;
+                else if ([[self window] isMainWindow] || [[self window] 
isKeyWindow])
+                    rgb = isGraphite ? mainColorGraphite : mainColorBlue;
+                else
+                    rgb = isGraphite ? disabledColorGraphite : 
disabledColorBlue;
+                color = [NSColor colorWithDeviceRed:rgb[0] green:rgb[1] 
blue:rgb[2] alpha:1.0];
+                break;
+            case NSTableViewSelectionHighlightStyleRegular:
+                if ([[self window] isKeyWindow] && [[self window] 
firstResponder] == self)
+                    color = [NSColor selectedControlColor];
+                else
+                    color = [NSColor secondarySelectedControlColor];
+                break;
+            default:
+                break;
+        }
         
-        NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes] 
mutableCopy] autorelease];
-        NSArray *rows = [[self delegate] tableViewHighlightedRows:self];
-        NSInteger i, count = MIN((NSInteger)[rows count], 5);
-        
-        for (i = 0; i < count; i++) {
-            row = [[rows objectAtIndex:i] integerValue];
-            rect = [self rectOfRow:row];
-            if (NSIntersectsRect(rect, clipRect) && [rowIndexes 
containsIndex:row] == NO) {
-                [[color colorWithAlphaComponent:0.5 - 0.1 * i] setFill];
-                [NSBezierPath fillRect:rect];
+        if (color) {
+            [NSGraphicsContext saveGraphicsState];
+            
+            NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes] 
mutableCopy] autorelease];
+            NSArray *rows = [[self delegate] tableViewHighlightedRows:self];
+            NSInteger i, count = MIN((NSInteger)[rows count], 5);
+            
+            for (i = 0; i < count; i++) {
+                row = [[rows objectAtIndex:i] integerValue];
+                rect = [self rectOfRow:row];
+                if (NSIntersectsRect(rect, clipRect) && [rowIndexes 
containsIndex:row] == NO) {
+                    [[color colorWithAlphaComponent:0.5 - 0.1 * i] setFill];
+                    [NSBezierPath fillRect:rect];
+                }
+                [rowIndexes addIndex:row];
             }
-            [rowIndexes addIndex:row];
+            
+            [NSGraphicsContext restoreGraphicsState];
         }
-        
-        [NSGraphicsContext restoreGraphicsState];
     }
     
     [super highlightSelectionInClipRect:clipRect];

Modified: trunk/SKTocOutlineView.m
===================================================================
--- trunk/SKTocOutlineView.m    2009-10-21 15:20:15 UTC (rev 5923)
+++ trunk/SKTocOutlineView.m    2009-10-21 17:02:23 UTC (rev 5924)
@@ -59,36 +59,51 @@
 
 - (void)highlightSelectionInClipRect:(NSRect)clipRect {
     if ([[self delegate] 
respondsToSelector:@selector(outlineViewHighlightedRows:)]) {
-        NSColor *color;
+        NSColor *color = nil;
         NSInteger row;
         NSRect rect;
         CGFloat *rgb;
         BOOL isGraphite = [NSColor currentControlTint] == 
NSGraphiteControlTint;
-        if ([[self window] isKeyWindow] && [[self window] firstResponder] == 
self)
-            rgb = isGraphite ? keyColorGraphite : keyColorBlue;
-        else if ([[self window] isMainWindow] || [[self window] isKeyWindow])
-            rgb = isGraphite ? mainColorGraphite : mainColorBlue;
-        else
-            rgb = isGraphite ? disabledColorGraphite : disabledColorBlue;
-        color = [NSColor colorWithDeviceRed:rgb[0] green:rgb[1] blue:rgb[2] 
alpha:1.0];
         
-        [NSGraphicsContext saveGraphicsState];
+        switch ([self selectionHighlightStyle]) {
+            case NSTableViewSelectionHighlightStyleSourceList:
+                if ([[self window] isKeyWindow] && [[self window] 
firstResponder] == self)
+                    rgb = isGraphite ? keyColorGraphite : keyColorBlue;
+                else if ([[self window] isMainWindow] || [[self window] 
isKeyWindow])
+                    rgb = isGraphite ? mainColorGraphite : mainColorBlue;
+                else
+                    rgb = isGraphite ? disabledColorGraphite : 
disabledColorBlue;
+                color = [NSColor colorWithDeviceRed:rgb[0] green:rgb[1] 
blue:rgb[2] alpha:1.0];
+                break;
+            case NSTableViewSelectionHighlightStyleRegular:
+                if ([[self window] isKeyWindow] && [[self window] 
firstResponder] == self)
+                    color = [NSColor selectedControlColor];
+                else
+                    color = [NSColor secondarySelectedControlColor];
+                break;
+            default:
+                break;
+        }
         
-        NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes] 
mutableCopy] autorelease];
-        NSArray *rows = [[self delegate] outlineViewHighlightedRows:self];
-        NSInteger i, count = MIN((NSInteger)[rows count], 5);
-        
-        for (i = 0; i < count; i++) {
-            row = [[rows objectAtIndex:i] integerValue];
-            rect = [self rectOfRow:row];
-            if (NSIntersectsRect(rect, clipRect) && [rowIndexes 
containsIndex:row] == NO) {
-                [[color colorWithAlphaComponent:0.5 - 0.1 * i] setFill];
-                [NSBezierPath fillRect:rect];
+        if (color) {
+            [NSGraphicsContext saveGraphicsState];
+            
+            NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes] 
mutableCopy] autorelease];
+            NSArray *rows = [[self delegate] outlineViewHighlightedRows:self];
+            NSInteger i, count = MIN((NSInteger)[rows count], 5);
+            
+            for (i = 0; i < count; i++) {
+                row = [[rows objectAtIndex:i] integerValue];
+                rect = [self rectOfRow:row];
+                if (NSIntersectsRect(rect, clipRect) && [rowIndexes 
containsIndex:row] == NO) {
+                    [[color colorWithAlphaComponent:0.5 - 0.1 * i] setFill];
+                    [NSBezierPath fillRect:rect];
+                }
+                [rowIndexes addIndex:row];
             }
-            [rowIndexes addIndex:row];
+            
+            [NSGraphicsContext restoreGraphicsState];
         }
-        
-        [NSGraphicsContext restoreGraphicsState];
     }
     
     [super highlightSelectionInClipRect:clipRect];


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to