Revision: 2816
http://skim-app.svn.sourceforge.net/skim-app/?rev=2816&view=rev
Author: hofman
Date: 2007-09-03 10:52:53 -0700 (Mon, 03 Sep 2007)
Log Message:
-----------
Use a blue background for some tables. Don't add a white line at the bottom of
the selected row for those tables.
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 2007-09-03 15:23:18 UTC (rev 2815)
+++ trunk/NSColor_SKExtensions.h 2007-09-03 17:52:53 UTC (rev 2816)
@@ -71,6 +71,8 @@
@interface NSColor (SKExtensions)
++ (NSColor *)tableBackgroundColor;
+
+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor;
- (id)scriptingRgbaColorDescriptor;
Modified: trunk/NSColor_SKExtensions.m
===================================================================
--- trunk/NSColor_SKExtensions.m 2007-09-03 15:23:18 UTC (rev 2815)
+++ trunk/NSColor_SKExtensions.m 2007-09-03 17:52:53 UTC (rev 2816)
@@ -41,6 +41,15 @@
@implementation NSColor (SKExtensions)
++ (NSColor *)tableBackgroundColor {
+ static NSColor *tableBackgroundColor = nil;
+ if (nil == tableBackgroundColor) {
+ // from Mail.app on 10.4; should be based on control tint?
+ tableBackgroundColor = [[NSColor colorWithCalibratedRed:231.0f/255.0f
green:237.0f/255.0f blue:246.0f/255.0f alpha:1.0] retain];
+ }
+ return tableBackgroundColor;
+}
+
+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor {
float red, green, blue, alpha = 1.0;
switch ([descriptor numberOfItems]) {
Modified: trunk/SKThumbnailTableView.m
===================================================================
--- trunk/SKThumbnailTableView.m 2007-09-03 15:23:18 UTC (rev 2815)
+++ trunk/SKThumbnailTableView.m 2007-09-03 17:52:53 UTC (rev 2816)
@@ -39,6 +39,7 @@
#import "SKThumbnailTableView.h"
#import "OBUtilities.h"
#import "SKTypeSelectHelper.h"
+#import "NSColor_SKExtensions.h"
static NSString *SKScrollerWillScrollNotification =
@"SKScrollerWillScrollNotification";
static NSString *SKScrollerDidScrollNotification =
@"SKScrollerDidScrollNotification";
@@ -70,6 +71,10 @@
[super dealloc];
}
+- (NSColor *)backgroundColor {
+ return [NSColor tableBackgroundColor];
+}
+
- (BOOL)isScrolling { return isScrolling; }
- (void)handleScrollerWillScroll:(NSNotification *)note {
@@ -100,27 +105,35 @@
}
- (void)highlightSelectionInClipRect:(NSRect)clipRect {
+ NSColor *color = ([[self window] isKeyWindow] && [[self window]
firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor
secondarySelectedControlColor];
+ int row;
+
+ [NSGraphicsContext saveGraphicsState];
+
if ([[self delegate]
respondsToSelector:@selector(tableViewHighlightedRows:)]) {
NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes]
mutableCopy] autorelease];
NSArray *rows = [[self delegate] tableViewHighlightedRows:self];
- NSColor *color = ([[self window] isKeyWindow] && [[self window]
firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor
secondarySelectedControlColor];
float factor = 0.5;
int i, count = [rows count];
- [NSGraphicsContext saveGraphicsState];
- NSColor *bgColor = [NSColor controlBackgroundColor];
for (i = 0; i < count && factor > 0.0; i++) {
- int row = [[rows objectAtIndex:i] intValue];
- [[bgColor blendedColorWithFraction:factor ofColor:color] setFill];
+ row = [[rows objectAtIndex:i] intValue];
+ [[[self backgroundColor] blendedColorWithFraction:factor
ofColor:color] setFill];
factor -= 0.1;
if ([rowIndexes containsIndex:row] == NO) {
NSRectFill([self rectOfRow:row]);
[rowIndexes addIndex:row];
}
}
- [NSGraphicsContext restoreGraphicsState];
}
- [super highlightSelectionInClipRect:clipRect];
+
+ row = [self selectedRow];
+ if (row != -1) {
+ [color setFill];
+ NSRectFill([self rectOfRow:row]);
+ }
+
+ [NSGraphicsContext restoreGraphicsState];
}
- (void)mouseDown:(NSEvent *)theEvent {
Modified: trunk/SKTocOutlineView.m
===================================================================
--- trunk/SKTocOutlineView.m 2007-09-03 15:23:18 UTC (rev 2815)
+++ trunk/SKTocOutlineView.m 2007-09-03 17:52:53 UTC (rev 2816)
@@ -38,6 +38,7 @@
#import "SKTocOutlineView.h"
#import "SKTypeSelectHelper.h"
+#import "NSColor_SKExtensions.h"
@implementation SKTocOutlineView
@@ -48,18 +49,25 @@
[super dealloc];
}
+- (NSColor *)backgroundColor {
+ return [NSColor tableBackgroundColor];
+}
+
- (void)highlightSelectionInClipRect:(NSRect)clipRect {
+ NSColor *color = ([[self window] isKeyWindow] && [[self window]
firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor
secondarySelectedControlColor];
+ int row;
+
+ [NSGraphicsContext saveGraphicsState];
+
if ([[self delegate]
respondsToSelector:@selector(outlineViewHighlightedRows:)]) {
NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes]
mutableCopy] autorelease];
NSArray *rows = [[self delegate] outlineViewHighlightedRows:self];
- NSColor *color = ([[self window] isKeyWindow] && [[self window]
firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor
secondarySelectedControlColor];
float factor = 0.5;
int i, count = [rows count];
- [NSGraphicsContext saveGraphicsState];
for (i = 0; i < count; i++) {
- int row = [[rows objectAtIndex:i] intValue];
- [[[NSColor controlBackgroundColor] blendedColorWithFraction:factor
ofColor:color] set];
+ row = [[rows objectAtIndex:i] intValue];
+ [[[self backgroundColor] blendedColorWithFraction:factor
ofColor:color] set];
factor -= 0.1;
if ([rowIndexes containsIndex:row] == NO) {
NSRectFill([self rectOfRow:row]);
@@ -67,9 +75,15 @@
}
if (factor <= 0.0) break;
}
- [NSGraphicsContext restoreGraphicsState];
}
- [super highlightSelectionInClipRect:clipRect];
+
+ row = [self selectedRow];
+ if (row != -1) {
+ [color setFill];
+ NSRectFill([self rectOfRow:row]);
+ }
+
+ [NSGraphicsContext restoreGraphicsState];
}
- (void)removeTrackingRects {
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit