Ticket #1134: Colloquy-1134.patch
| File Colloquy-1134.patch, 5.2 kB (added by eschaton, 9 months ago) |
|---|
-
Views/JVSideOutlineView.m
old new 10 10 outData[i] = ( 1. - a ) * dark[i] + a * light[i]; 11 11 } 12 12 13 @interface NSOutlineView (InternalMethodsColloquyOverridesPreLeopard) 14 - (NSColor *)_highlightColorForCell:(NSCell *)cell; 15 - (void)_highlightRow:(int)row clipRect:(NSRect)clip; 16 @end 17 13 18 @implementation JVSideOutlineView 19 14 20 - (NSColor *) _highlightColorForCell:(NSCell *) cell { 15 // return nil to prevent normal selection drawing 16 return nil; 21 NSColor *highlightColor = nil; 22 23 if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) && [NSOutlineView instancesRespondToSelector:@selector(_highlightColorForCell:)]) { 24 highlightColor = [super _highlightColorForCell:cell]; 25 } else { 26 // return nil to prevent normal selection drawing 27 highlightColor = nil; 28 } 29 30 return highlightColor; 17 31 } 18 32 19 33 - (void) _highlightRow:(int) row clipRect:(NSRect) clip { 20 NSRect highlight = [self rectOfRow:row]; 21 22 struct CGFunctionCallbacks callbacks = { 0, gradientInterpolate, NULL }; 23 CGFunctionRef function = CGFunctionCreate( NULL, 1, NULL, 4, NULL, &callbacks ); 24 CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB(); 25 26 CGShadingRef shading = CGShadingCreateAxial( cspace, CGPointMake( NSMinX( highlight ), NSMaxY( highlight ) ), CGPointMake( NSMinX( highlight ), NSMinY( highlight ) ), function, false, false ); 27 CGContextDrawShading( [[NSGraphicsContext currentContext] graphicsPort], shading ); 28 29 CGShadingRelease( shading ); 30 CGColorSpaceRelease( cspace ); 31 CGFunctionRelease( function ); 32 33 static NSColor *rowBottomLine = nil; 34 if( ! rowBottomLine ) 35 rowBottomLine = [[NSColor colorWithCalibratedRed:( 140. / 255. ) green:( 152. / 255. ) blue:( 176. / 255. ) alpha:1.] retain]; 36 37 [rowBottomLine set]; 38 39 NSRect bottomLine = NSMakeRect( NSMinX( highlight ), NSMaxY( highlight ) - 1., NSWidth( highlight ), 1. ); 40 NSRectFill( bottomLine ); 34 if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) && [NSOutlineView instancesRespondToSelector:@selector(_highlightRow:clipRect:)]) { 35 [super _highlightRow:row clipRect:clip]; 36 } else { 37 NSRect highlight = [self rectOfRow:row]; 38 39 struct CGFunctionCallbacks callbacks = { 0, gradientInterpolate, NULL }; 40 CGFunctionRef function = CGFunctionCreate( NULL, 1, NULL, 4, NULL, &callbacks ); 41 CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB(); 42 43 CGShadingRef shading = CGShadingCreateAxial( cspace, CGPointMake( NSMinX( highlight ), NSMaxY( highlight ) ), CGPointMake( NSMinX( highlight ), NSMinY( highlight ) ), function, false, false ); 44 CGContextDrawShading( [[NSGraphicsContext currentContext] graphicsPort], shading ); 45 46 CGShadingRelease( shading ); 47 CGColorSpaceRelease( cspace ); 48 CGFunctionRelease( function ); 49 50 static NSColor *rowBottomLine = nil; 51 if( ! rowBottomLine ) 52 rowBottomLine = [[NSColor colorWithCalibratedRed:( 140. / 255. ) green:( 152. / 255. ) blue:( 176. / 255. ) alpha:1.] retain]; 53 54 [rowBottomLine set]; 55 56 NSRect bottomLine = NSMakeRect( NSMinX( highlight ), NSMaxY( highlight ) - 1., NSWidth( highlight ), 1. ); 57 NSRectFill( bottomLine ); 58 } 41 59 } 42 60 43 61 - (void) drawBackgroundInClipRect:(NSRect) clipRect { 44 static NSColor *backgroundColor = nil; 45 if( ! backgroundColor ) 46 backgroundColor = [[NSColor colorWithCalibratedRed:( 229. / 255. ) green:( 237. / 255. ) blue:( 247. / 255. ) alpha:1.] retain]; 47 [backgroundColor set]; 48 NSRectFill( clipRect ); 62 if ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) && [NSOutlineView instancesRespondToSelector:@selector(_highlightRow:clipRect:)]) { 63 [super drawBackgroundInClipRect:clipRect]; 64 } else { 65 static NSColor *backgroundColor = nil; 66 if( ! backgroundColor ) 67 backgroundColor = [[NSColor colorWithCalibratedRed:( 229. / 255. ) green:( 237. / 255. ) blue:( 247. / 255. ) alpha:1.] retain]; 68 [backgroundColor set]; 69 NSRectFill( clipRect ); 70 } 49 71 } 72 50 73 @end -
Controllers/JVChatWindowController.m
old new 12 12 NSString *JVToolbarToggleChatDrawerItemIdentifier = @"JVToolbarToggleChatDrawerItem"; 13 13 NSString *JVChatViewPboardType = @"Colloquy Chat View v1.0 pasteboard type"; 14 14 15 #pragma mark - 16 17 #if !defined(MAC_OS_X_VERSION_10_5) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5) 18 @interface NSTableView (LeopardMethodsForBuildingWithPreLeopardSDK) 19 - (void)setSelectionHighlightStyle:(int)value; 20 @end 21 #endif 22 15 23 @interface NSToolbar (NSToolbarPrivate) 16 24 - (NSView *) _toolbarView; 17 25 @end … … 72 80 [chatViewsOutlineView registerForDraggedTypes:[NSArray arrayWithObjects:JVChatViewPboardType, NSFilenamesPboardType, nil]]; 73 81 [chatViewsOutlineView setMenu:[[[NSMenu allocWithZone:nil] initWithTitle:@""] autorelease]]; 74 82 83 #if 1 84 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4) { 85 [chatViewsOutlineView setSelectionHighlightStyle:1]; 86 } 87 #endif 88 75 89 [favoritesButton setMenu:[MVConnectionsController favoritesMenu]]; 76 90 77 91 [self setShouldCascadeWindows:NO];
