Revision: 2819 http://skim-app.svn.sourceforge.net/skim-app/?rev=2819&view=rev Author: hofman Date: 2007-09-04 02:02:54 -0700 (Tue, 04 Sep 2007)
Log Message: ----------- Use different color to highlight disabled tables with a blue background. Modified Paths: -------------- trunk/NSColor_SKExtensions.h trunk/NSColor_SKExtensions.m trunk/SKThumbnailTableView.m trunk/SKTocOutlineView.m trunk/Skim.xcodeproj/project.pbxproj Added Paths: ----------- trunk/NSCell_SKExtensions.h trunk/NSCell_SKExtensions.m Added: trunk/NSCell_SKExtensions.h =================================================================== --- trunk/NSCell_SKExtensions.h (rev 0) +++ trunk/NSCell_SKExtensions.h 2007-09-04 09:02:54 UTC (rev 2819) @@ -0,0 +1,45 @@ +// +// NSCell_SKExtensions.h +// Skim +// +// Created by Christiaan Hofman on 9/4/07. +// Copyright 2007 Christiaan Hofman. All rights reserved. +// +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Cocoa/Cocoa.h> + + [EMAIL PROTECTED] NSCell (SKExtensions) [EMAIL PROTECTED] Added: trunk/NSCell_SKExtensions.m =================================================================== --- trunk/NSCell_SKExtensions.m (rev 0) +++ trunk/NSCell_SKExtensions.m 2007-09-04 09:02:54 UTC (rev 2819) @@ -0,0 +1,60 @@ +// +// NSCell_SKExtensions.h +// Skim +// +// Created by Christiaan Hofman on 9/4/07. +// Copyright 2007 Christiaan Hofman. All rights reserved. +// +/* + This software is Copyright (c) 2007 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "NSCell_SKExtensions.h" +#import "OBUtilities.h" + + [EMAIL PROTECTED] NSCell (SKExtensions) + +static IMP originalHighlightColorWithFrameInView = NULL; + ++ (void)load { + originalHighlightColorWithFrameInView = OBReplaceMethodImplementationWithSelector(self, @selector(highlightColorWithFrame:inView:), @selector(replacementHighlightColorWithFrame:inView:)); +} + +- (NSColor *)replacementHighlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { + if ([controlView respondsToSelector:@selector(highlightColor)]) + return [(id)controlView highlightColor]; + else + return originalHighlightColorWithFrameInView(self, _cmd, cellFrame, controlView); +} + [EMAIL PROTECTED] Modified: trunk/NSColor_SKExtensions.h =================================================================== --- trunk/NSColor_SKExtensions.h 2007-09-03 22:17:20 UTC (rev 2818) +++ trunk/NSColor_SKExtensions.h 2007-09-04 09:02:54 UTC (rev 2819) @@ -72,6 +72,7 @@ @interface NSColor (SKExtensions) + (NSColor *)tableBackgroundColor; ++ (NSColor *)secondarySelectedTableColor; + (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor; - (id)scriptingRgbaColorDescriptor; Modified: trunk/NSColor_SKExtensions.m =================================================================== --- trunk/NSColor_SKExtensions.m 2007-09-03 22:17:20 UTC (rev 2818) +++ trunk/NSColor_SKExtensions.m 2007-09-04 09:02:54 UTC (rev 2819) @@ -44,12 +44,20 @@ + (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]; + 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 = [self tableBackgroundColor]; + secondarySelectedTableColor = [[NSColor colorWithCalibratedRed:0.724706 green:0.743529 blue:0.771765 alpha:1.0] retain]; + } + return secondarySelectedTableColor; +} + + (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor { float red, green, blue, alpha = 1.0; switch ([descriptor numberOfItems]) { Modified: trunk/SKThumbnailTableView.m =================================================================== --- trunk/SKThumbnailTableView.m 2007-09-03 22:17:20 UTC (rev 2818) +++ trunk/SKThumbnailTableView.m 2007-09-04 09:02:54 UTC (rev 2819) @@ -75,42 +75,21 @@ return [NSColor tableBackgroundColor]; } -- (BOOL)isScrolling { return isScrolling; } - -- (void)handleScrollerWillScroll:(NSNotification *)note { - isScrolling = YES; +- (NSColor *)highlightColor { + if ([[self window] isKeyWindow] && [[self window] firstResponder] == self) + return [NSColor alternateSelectedControlColor]; + else + return [NSColor secondarySelectedTableColor]; } -- (void)handleScrollerDidScroll:(NSNotification *)note { - isScrolling = NO; - [self setNeedsDisplayInRect:[self visibleRect]]; -} - -- (void)awakeFromNib { - NSScroller *scroller = [[self enclosingScrollView] verticalScroller]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerWillScroll:) - name:SKScrollerWillScrollNotification object:scroller]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerDidScroll:) - name:SKScrollerDidScrollNotification object:scroller]; -} - -- (void)setFrame:(NSRect)frameRect { - [super setFrame:frameRect]; - [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; -} - -- (void)setFrameSize:(NSSize)frameSize { - [super setFrameSize:frameSize]; - [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; -} - - (void)highlightSelectionInClipRect:(NSRect)clipRect { - NSColor *color = ([[self window] isKeyWindow] && [[self window] firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor secondarySelectedControlColor]; + NSColor *color = [self highlightColor]; int row; [NSGraphicsContext saveGraphicsState]; if ([[self delegate] respondsToSelector:@selector(tableViewHighlightedRows:)]) { + NSMutableIndexSet *rowIndexes = [[[self selectedRowIndexes] mutableCopy] autorelease]; NSArray *rows = [[self delegate] tableViewHighlightedRows:self]; float factor = 0.5; @@ -136,6 +115,35 @@ [NSGraphicsContext restoreGraphicsState]; } +- (BOOL)isScrolling { return isScrolling; } + +- (void)handleScrollerWillScroll:(NSNotification *)note { + isScrolling = YES; +} + +- (void)handleScrollerDidScroll:(NSNotification *)note { + isScrolling = NO; + [self setNeedsDisplayInRect:[self visibleRect]]; +} + +- (void)awakeFromNib { + NSScroller *scroller = [[self enclosingScrollView] verticalScroller]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerWillScroll:) + name:SKScrollerWillScrollNotification object:scroller]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleScrollerDidScroll:) + name:SKScrollerDidScrollNotification object:scroller]; +} + +- (void)setFrame:(NSRect)frameRect { + [super setFrame:frameRect]; + [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; +} + +- (void)setFrameSize:(NSSize)frameSize { + [super setFrameSize:frameSize]; + [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]]; +} + - (void)mouseDown:(NSEvent *)theEvent { if (([theEvent modifierFlags] & NSCommandKeyMask) && [[self delegate] respondsToSelector:@selector(tableView:commandSelectRow:)]) { int row = [self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]]; Modified: trunk/SKTocOutlineView.m =================================================================== --- trunk/SKTocOutlineView.m 2007-09-03 22:17:20 UTC (rev 2818) +++ trunk/SKTocOutlineView.m 2007-09-04 09:02:54 UTC (rev 2819) @@ -53,8 +53,15 @@ return [NSColor tableBackgroundColor]; } +- (NSColor *)highlightColor { + if ([[self window] isKeyWindow] && [[self window] firstResponder] == self) + return [NSColor alternateSelectedControlColor]; + else + return [NSColor secondarySelectedTableColor]; +} + - (void)highlightSelectionInClipRect:(NSRect)clipRect { - NSColor *color = ([[self window] isKeyWindow] && [[self window] firstResponder] == self) ? [NSColor alternateSelectedControlColor] : [NSColor secondarySelectedControlColor]; + NSColor *color = [self highlightColor]; int row; [NSGraphicsContext saveGraphicsState]; Modified: trunk/Skim.xcodeproj/project.pbxproj =================================================================== --- trunk/Skim.xcodeproj/project.pbxproj 2007-09-03 22:17:20 UTC (rev 2818) +++ trunk/Skim.xcodeproj/project.pbxproj 2007-09-04 09:02:54 UTC (rev 2819) @@ -132,6 +132,7 @@ CE5BF8430C7CC24A00EBDCF7 /* SKOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5BF8410C7CC24A00EBDCF7 /* SKOutlineView.m */; }; CE5F42AF0BF89FE00069D89C /* AppleRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5F42AD0BF89FE00069D89C /* AppleRemote.m */; }; CE5F43730BF8A3410069D89C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE5F42D30BF8A3400069D89C /* IOKit.framework */; }; + CE5F71560C8CDF9A008BE480 /* NSCell_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5F71540C8CDF9A008BE480 /* NSCell_SKExtensions.m */; }; CE67BB260BC44AC9007B6929 /* ZoomValues.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE67BB240BC44AC9007B6929 /* ZoomValues.strings */; }; CE6C03F10BEDF759007BF0B5 /* NSParagraphStyle_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CE6C03EF0BEDF759007BF0B5 /* NSParagraphStyle_SKExtensions.m */; }; CE74686F0B7F3B1C00CBF969 /* ToolbarInfo.tiff in Resources */ = {isa = PBXBuildFile; fileRef = CE7467330B7F2ED700CBF969 /* ToolbarInfo.tiff */; }; @@ -497,6 +498,8 @@ CE5F42AC0BF89FE00069D89C /* AppleRemote.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppleRemote.h; path = vendorsrc/martinkahr/AppleRemoteSource_R80/AppleRemote.h; sourceTree = "<group>"; }; CE5F42AD0BF89FE00069D89C /* AppleRemote.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AppleRemote.m; path = vendorsrc/martinkahr/AppleRemoteSource_R80/AppleRemote.m; sourceTree = "<group>"; }; CE5F42D30BF8A3400069D89C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; }; + CE5F71530C8CDF9A008BE480 /* NSCell_SKExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCell_SKExtensions.h; sourceTree = "<group>"; }; + CE5F71540C8CDF9A008BE480 /* NSCell_SKExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSCell_SKExtensions.m; sourceTree = "<group>"; }; CE67BB250BC44AC9007B6929 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/ZoomValues.strings; sourceTree = "<group>"; }; CE67BB290BC44AD5007B6929 /* Dutch */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = Dutch; path = Dutch.lproj/ZoomValues.strings; sourceTree = "<group>"; }; CE6C03EE0BEDF759007BF0B5 /* NSParagraphStyle_SKExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSParagraphStyle_SKExtensions.h; sourceTree = "<group>"; }; @@ -792,6 +795,8 @@ CE4EC87E0B7E6E110091F228 /* NSBezierPath_CoreImageExtensions.m */, F968C5A00C036E9D000BD1B2 /* NSBitmapImageRep_SKExtensions.h */, F968C5A10C036E9D000BD1B2 /* NSBitmapImageRep_SKExtensions.m */, + CE5F71530C8CDF9A008BE480 /* NSCell_SKExtensions.h */, + CE5F71540C8CDF9A008BE480 /* NSCell_SKExtensions.m */, CE1E30260BDB9D8E0011D9DD /* NSCharacterSet_SKExtensions.h */, CE1E30270BDB9D8E0011D9DD /* NSCharacterSet_SKExtensions.m */, CE7C204D0C259A5D0059E08C /* NSColor_SKExtensions.h */, @@ -1494,6 +1499,7 @@ CE5BF8010C7CBF6300EBDCF7 /* SKTableView.m in Sources */, CE5BF8430C7CC24A00EBDCF7 /* SKOutlineView.m in Sources */, CE820A220C8A0E310020E6B0 /* NSTask_SKExtensions.m in Sources */, + CE5F71560C8CDF9A008BE480 /* NSCell_SKExtensions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 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 Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit