aboutsummaryrefslogtreecommitdiff
path: root/AppKit
diff options
context:
space:
mode:
Diffstat (limited to 'AppKit')
-rw-r--r--AppKit/GTMDelegatingTableColumn.h19
-rw-r--r--AppKit/GTMDelegatingTableColumn.m27
-rw-r--r--AppKit/GTMLinearRGBShading.h6
-rw-r--r--AppKit/GTMLinearRGBShading.m76
-rw-r--r--AppKit/GTMLinearRGBShadingTest.m16
-rw-r--r--AppKit/GTMLoginItems.m31
-rw-r--r--AppKit/GTMNSBezierPath+CGPath.m6
-rw-r--r--AppKit/GTMNSBezierPath+CGPathTest.m14
-rw-r--r--AppKit/GTMNSBezierPath+RoundRect.h7
-rw-r--r--AppKit/GTMNSBezierPath+RoundRect.m22
-rw-r--r--AppKit/GTMNSBezierPath+RoundRectTest.m40
-rw-r--r--AppKit/GTMNSBezierPath+Shading.h9
-rw-r--r--AppKit/GTMNSBezierPath+Shading.m54
-rw-r--r--AppKit/GTMNSBezierPath+ShadingTest.m4
-rw-r--r--AppKit/GTMNSColor+Theme.h35
-rw-r--r--AppKit/GTMNSColor+Theme.m62
-rw-r--r--AppKit/GTMNSColor+ThemeTest.m199
-rw-r--r--AppKit/GTMNSWorkspace+ScreenSaver.m4
-rw-r--r--AppKit/GTMNSWorkspace+Theme.h39
-rw-r--r--AppKit/GTMNSWorkspace+Theme.m42
-rw-r--r--AppKit/GTMNSWorkspace+ThemeTest.m38
-rw-r--r--AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiffbin0 -> 2556 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+CGPathTest.tiff (renamed from AppKit/GTMNSBezierPath+CGPathTest.tiff)bin2558 -> 2558 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiffbin0 -> 2556 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiffbin0 -> 8042 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+RoundRectTest.tiff (renamed from AppKit/GTMNSBezierPath+RoundRectTest.tiff)bin8036 -> 8036 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiffbin0 -> 8042 bytes
-rw-r--r--AppKit/TestData/GTMNSBezierPath+ShadingTest.10.5.tiff (renamed from AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff)bin19450 -> 19450 bytes
28 files changed, 187 insertions, 563 deletions
diff --git a/AppKit/GTMDelegatingTableColumn.h b/AppKit/GTMDelegatingTableColumn.h
index a90b298..63abf20 100644
--- a/AppKit/GTMDelegatingTableColumn.h
+++ b/AppKit/GTMDelegatingTableColumn.h
@@ -17,16 +17,19 @@
//
#import <Cocoa/Cocoa.h>
+#import "GTMDefines.h"
-@interface GTMDelegatingTableColumn : NSTableColumn {
- @private
- IBOutlet id delegate_;
-}
-- (void)setDelegate:(id)delegate;
-- (id)delegate;
-- (id)dataCellForRow:(int)row;
+// NOTE: If you're using the 10.5 SDK, just use the new delegate method:
+// tableView:dataCellForTableColumn:row:
+
+@interface GTMDelegatingTableColumn : NSTableColumn
+// no instance state or new method, it will just invoke the tableview's delegate
+// w/ the method below.
@end
+// the method delegated to
@interface NSObject (GTMDelegatingTableColumnDelegate)
-- (id)tableColumn:(NSTableColumn*)column dataCellForRow:(int)row;
+- (id)gtm_tableView:(NSTableView *)tableView
+ dataCellForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row;
@end
diff --git a/AppKit/GTMDelegatingTableColumn.m b/AppKit/GTMDelegatingTableColumn.m
index d84e2e7..0bd2371 100644
--- a/AppKit/GTMDelegatingTableColumn.m
+++ b/AppKit/GTMDelegatingTableColumn.m
@@ -19,19 +19,22 @@
#import "GTMDelegatingTableColumn.h"
@implementation GTMDelegatingTableColumn
-- (void)setDelegate:(id)delegate {
- delegate_ = delegate;
-}
-
-- (id)delegate {
- return delegate_;
-}
-
-- (id)dataCellForRow:(int)row {
+- (id)dataCellForRow:(NSInteger)row {
id dataCell = nil;
- if (delegate_ && [delegate_ respondsToSelector:@selector(tableColumn:dataCellForRow:)]) {
- dataCell = [delegate_ tableColumn:self dataCellForRow:row];
- } else {
+ id delegate = [[self tableView] delegate];
+ BOOL sendSuper = YES;
+ if (delegate) {
+ if ([delegate respondsToSelector:@selector(gtm_tableView:dataCellForTableColumn:row:)]) {
+
+ dataCell = [delegate gtm_tableView:[self tableView]
+ dataCellForTableColumn:self
+ row:row];
+ sendSuper = NO;
+ } else {
+ _GTMDevLog(@"tableView delegate didn't implement gtm_tableView:dataCellForTableColumn:row:");
+ }
+ }
+ if (sendSuper) {
dataCell = [super dataCellForRow:row];
}
return dataCell;
diff --git a/AppKit/GTMLinearRGBShading.h b/AppKit/GTMLinearRGBShading.h
index f6b6405..d85a4eb 100644
--- a/AppKit/GTMLinearRGBShading.h
+++ b/AppKit/GTMLinearRGBShading.h
@@ -34,7 +34,7 @@
CGFunctionRef function_; // function used to calculated shading (STRONG)
CGColorSpaceRef colorSpace_; // colorspace used for shading (STRONG)
BOOL isCalibrated_; // are we using calibrated or device RGB.
- float colorValue[4]; // the RGBA color values
+ CGFloat colorValue_[4]; // the RGBA color values
}
/// Generate a shading with color |begin| at position 0.0 and color |end| at 1.0.
@@ -64,8 +64,8 @@
// a GTMLinearRGBShading
+ (id)shadingWithColors:(NSColor **)colors
fromSpaceNamed:(NSString*)colorSpaceName
- atPositions:(float *)positions
- count:(unsigned int)numberOfColors;
+ atPositions:(CGFloat *)positions
+ count:(NSUInteger)numberOfColors;
/// Designated initializer
// Args:
diff --git a/AppKit/GTMLinearRGBShading.m b/AppKit/GTMLinearRGBShading.m
index 31f22ca..18af0e0 100644
--- a/AppKit/GTMLinearRGBShading.m
+++ b/AppKit/GTMLinearRGBShading.m
@@ -19,24 +19,24 @@
#import "GTMLinearRGBShading.h"
// Carbon callback function required for CoreGraphics
-static void cShadeFunction(void *info, const float *inPos, float *outVals);
+static void cShadeFunction(void *info, const CGFloat *inPos, CGFloat *outVals);
@implementation GTMLinearRGBShading
+ (id)shadingFromColor:(NSColor *)begin toColor:(NSColor *)end
fromSpaceNamed:(NSString*)colorSpaceName {
NSColor *theColors[] = { begin, end };
- float thePositions[] = { 0.0f, 1.0f };
+ CGFloat thePositions[] = { 0.0, 1.0 };
return [[self class] shadingWithColors:theColors
fromSpaceNamed:colorSpaceName
atPositions:thePositions
- count:(sizeof(thePositions)/sizeof(float))];
+ count:(sizeof(thePositions)/sizeof(CGFloat))];
}
+ (id)shadingWithColors:(NSColor **)colors fromSpaceNamed:(NSString*)colorSpaceName
- atPositions:(float *)positions count:(unsigned)count {
+ atPositions:(CGFloat *)positions count:(NSUInteger)count {
GTMLinearRGBShading *theShading = [[[[self class] alloc] initWithColorSpaceName:colorSpaceName] autorelease];
- for (unsigned int i = 0; i < count; ++i) {
+ for (NSUInteger i = 0; i < count; ++i) {
[theShading insertStop:colors[i] atPosition:positions[i]];
}
return theShading;
@@ -50,14 +50,24 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals);
isCalibrated_ = YES;
}
else {
- [self dealloc];
+ [self release];
self = nil;
}
}
return self;
}
-- (void) dealloc {
+- (void)finalize {
+ if (nil != function_) {
+ CGFunctionRelease(function_);
+ }
+ if (nil != colorSpace_) {
+ CGColorSpaceRelease(colorSpace_);
+ }
+ [super finalize];
+}
+
+- (void)dealloc {
if (nil != function_) {
CGFunctionRelease(function_);
}
@@ -68,7 +78,7 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals);
}
-- (void)insertStop:(id)item atPosition:(float)position {
+- (void)insertStop:(id)item atPosition:(CGFloat)position {
NSString *colorSpaceName = isCalibrated_ ? NSCalibratedRGBColorSpace : NSDeviceRGBColorSpace;
NSColor *tempColor = [item colorUsingColorSpaceName: colorSpaceName];
if (nil != tempColor) {
@@ -77,13 +87,13 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals);
}
// Calculate a linear value based on our stops
-- (id)valueAtPosition:(float)position {
- unsigned int index = 0;
- unsigned int colorCount = [self stopCount];
- float stop1Position = 0.0f;
+- (id)valueAtPosition:(CGFloat)position {
+ NSUInteger index = 0;
+ NSUInteger colorCount = [self stopCount];
+ CGFloat stop1Position = 0.0;
NSColor *stop1Color = [self stopAtIndex:index position:&stop1Position];
index += 1;
- float stop2Position = 0.0f;
+ CGFloat stop2Position = 0.0;
NSColor *stop2Color = nil;
NSColor *theColor = nil;
if (colorCount > 1) {
@@ -105,30 +115,30 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals);
if (position <= stop1Position) {
// if we are less than our lowest position, return our first color
theColor = stop1Color;
- [stop1Color getRed:&colorValue[0] green:&colorValue[1]
- blue:&colorValue[2] alpha:&colorValue[3]];
+ [stop1Color getRed:&colorValue_[0] green:&colorValue_[1]
+ blue:&colorValue_[2] alpha:&colorValue_[3]];
} else if (position >= stop2Position) {
// likewise if we are greater than our highest position, return the last color
- [stop2Color getRed:&colorValue[0] green:&colorValue[1]
- blue:&colorValue[2] alpha:&colorValue[3]];
+ [stop2Color getRed:&colorValue_[0] green:&colorValue_[1]
+ blue:&colorValue_[2] alpha:&colorValue_[3]];
} else {
// otherwise interpolate between the two
position = (position - stop1Position) / (stop2Position - stop1Position);
- float red1, red2, green1, green2, blue1, blue2, alpha1, alpha2;
+ CGFloat red1, red2, green1, green2, blue1, blue2, alpha1, alpha2;
[stop1Color getRed:&red1 green:&green1 blue:&blue1 alpha:&alpha1];
[stop2Color getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2];
- colorValue[0] = (red2 - red1) * position + red1;
- colorValue[1] = (green2 - green1) * position + green1;
- colorValue[2] = (blue2 - blue1) * position + blue1;
- colorValue[3] = (alpha2 - alpha1) * position + alpha1;
+ colorValue_[0] = (red2 - red1) * position + red1;
+ colorValue_[1] = (green2 - green1) * position + green1;
+ colorValue_[2] = (blue2 - blue1) * position + blue1;
+ colorValue_[3] = (alpha2 - alpha1) * position + alpha1;
}
- // Yes, I am casting a float[] to an id to pass it by the compiler. This
+ // Yes, I am casting a CGFloat[] to an id to pass it by the compiler. This
// significantly improves performance though as I avoid creating an NSColor
// for every scanline which later has to be cleaned up in an autorelease pool
// somewhere. Causes guardmalloc to run significantly faster.
- return (id)colorValue;
+ return (id)colorValue_;
}
//
@@ -146,12 +156,12 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals);
// a single float value
// outVals: where we store our return values. Since we are calculating
// an RGBA color, this is a pointer to an array of four float values
-// ranging from 0.0f to 1.0f
+// ranging from 0.0 to 1.0
//
//
-static void cShadeFunction(void *info, const float *inPos, float *outVals) {
+static void cShadeFunction(void *info, const CGFloat *inPos, CGFloat *outVals) {
id object = (id)info;
- float *colorValue = (float*)[object valueAtPosition:*inPos];
+ CGFloat *colorValue = (CGFloat*)[object valueAtPosition:*inPos];
outVals[0] = colorValue[0];
outVals[1] = colorValue[1];
outVals[2] = colorValue[2];
@@ -165,15 +175,15 @@ static void cShadeFunction(void *info, const float *inPos, float *outVals) {
// diposed if necessary in the dealloc call.
const CGFunctionCallbacks shadeFunctionCallbacks = { 0, &cShadeFunction, NULL };
- // TODO: this code assumes that we have a range from 0.0f to 1.0f
+ // TODO: this code assumes that we have a range from 0.0 to 1.0
// which may not be true according to the stops that the user has given us.
// In general you have stops at 0.0 and 1.0, so this will do for right now
// but may be an issue in the future.
- const float inRange[2] = { 0.0f, 1.0f };
- const float outRange[8] = { 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f };
- function_ = CGFunctionCreate(self,
- sizeof(inRange) / (sizeof(float) * 2), inRange,
- sizeof(outRange) / (sizeof(float) * 2), outRange,
+ const CGFloat inRange[2] = { 0.0, 1.0 };
+ const CGFloat outRange[8] = { 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 };
+ function_ = CGFunctionCreate(self,
+ sizeof(inRange) / (sizeof(CGFloat) * 2), inRange,
+ sizeof(outRange) / (sizeof(CGFloat) * 2), outRange,
&shadeFunctionCallbacks);
}
return function_;
diff --git a/AppKit/GTMLinearRGBShadingTest.m b/AppKit/GTMLinearRGBShadingTest.m
index e90d84c..119fa79 100644
--- a/AppKit/GTMLinearRGBShadingTest.m
+++ b/AppKit/GTMLinearRGBShadingTest.m
@@ -34,8 +34,8 @@
toColor:blue
fromSpaceNamed:NSCalibratedRGBColorSpace];
STAssertNotNil(theShading,nil);
- STAssertEquals([theShading stopCount], 2U, nil);
- float *theColor = (float*)[theShading valueAtPosition: 0.5];
+ STAssertEquals([theShading stopCount], (NSUInteger)2, nil);
+ CGFloat *theColor = (CGFloat*)[theShading valueAtPosition: 0.5];
STAssertTrue(theColor[0] == [purple redComponent] &&
theColor[1] == [purple greenComponent] &&
theColor[2] == [purple blueComponent] &&
@@ -44,11 +44,11 @@
- (void)testShadingWith {
// Create a shading with kColorCount colors and make sure all the values are there.
- const unsigned int kColorCount = 100;
+ const NSUInteger kColorCount = 100;
NSColor *theColors[kColorCount];
- float thePositions[kColorCount];
- const float kColorIncrement = 1.0f / kColorCount;
- for (unsigned int i = 0; i < kColorCount; i++) {
+ CGFloat thePositions[kColorCount];
+ const CGFloat kColorIncrement = 1.0 / kColorCount;
+ for (NSUInteger i = 0; i < kColorCount; i++) {
thePositions[i] = kColorIncrement * i;
theColors[i] = [NSColor colorWithCalibratedRed:kColorIncrement * i
green:kColorIncrement * i
@@ -60,8 +60,8 @@
fromSpaceNamed:NSCalibratedRGBColorSpace
atPositions:thePositions
count:kColorCount];
- for (unsigned int i = 0; i < kColorCount; i++) {
- float *theColor = (float*)[theShading valueAtPosition: kColorIncrement * i];
+ for (NSUInteger i = 0; i < kColorCount; i++) {
+ CGFloat *theColor = (CGFloat*)[theShading valueAtPosition: kColorIncrement * i];
STAssertTrue(theColor[0] == kColorIncrement * i &&
theColor[1] == kColorIncrement * i &&
theColor[2] == kColorIncrement * i &&
diff --git a/AppKit/GTMLoginItems.m b/AppKit/GTMLoginItems.m
index d3197c0..cc34c11 100644
--- a/AppKit/GTMLoginItems.m
+++ b/AppKit/GTMLoginItems.m
@@ -18,6 +18,7 @@
//
#import "GTMLoginItems.h"
+#import "GTMDefines.h"
#include <Carbon/Carbon.h>
@@ -27,22 +28,22 @@ NSString * const kGTMLoginItemsPathKey = @"Path";
NSString * const kGTMLoginItemsHiddenKey = @"Hide";
@interface GTMLoginItems (PrivateMethods)
-+ (int)indexOfLoginItemWithValue:(id)value
- forKey:(NSString *)key
- loginItems:(NSArray *)items;
++ (NSInteger)indexOfLoginItemWithValue:(id)value
+ forKey:(NSString *)key
+ loginItems:(NSArray *)items;
+ (BOOL)compileAndRunScript:(NSString *)script
withError:(NSError **)errorInfo;
@end
@implementation GTMLoginItems (PrivateMethods)
-+ (int)indexOfLoginItemWithValue:(id)value
- forKey:(NSString *)key
- loginItems:(NSArray *)items {
++ (NSInteger)indexOfLoginItemWithValue:(id)value
+ forKey:(NSString *)key
+ loginItems:(NSArray *)items {
if (!value || !key || !items) return NSNotFound;
NSDictionary *item = nil;
NSEnumerator *itemsEnum = [items objectEnumerator];
- int found = -1;
+ NSInteger found = -1;
while ((item = [itemsEnum nextObject])) {
++found;
id itemValue = [item objectForKey:key];
@@ -105,8 +106,8 @@ NSString * const kGTMLoginItemsHiddenKey = @"Hide";
}
// build our results
NSMutableArray *result = [NSMutableArray array];
- int count = [scriptResult numberOfItems];
- for (int i = 0; i < count; ++i) {
+ NSInteger count = [scriptResult numberOfItems];
+ for (NSInteger i = 0; i < count; ++i) {
NSAppleEventDescriptor *aeItem = [scriptResult descriptorAtIndex:i+1];
NSAppleEventDescriptor *hidn = [aeItem descriptorForKeyword:kAEHidden];
NSAppleEventDescriptor *nam = [aeItem descriptorForKeyword:pName];
@@ -135,17 +136,17 @@ NSString * const kGTMLoginItemsHiddenKey = @"Hide";
+ (BOOL)pathInLoginItems:(NSString *)path {
NSArray *loginItems = [self loginItems:nil];
- int index = [self indexOfLoginItemWithValue:path
- forKey:kGTMLoginItemsPathKey
- loginItems:loginItems];
+ NSInteger index = [self indexOfLoginItemWithValue:path
+ forKey:kGTMLoginItemsPathKey
+ loginItems:loginItems];
return (index != NSNotFound) ? YES : NO;
}
+ (BOOL)itemWithNameInLoginItems:(NSString *)name {
NSArray *loginItems = [self loginItems:nil];
- int index = [self indexOfLoginItemWithValue:name
- forKey:kGTMLoginItemsNameKey
- loginItems:loginItems];
+ NSInteger index = [self indexOfLoginItemWithValue:name
+ forKey:kGTMLoginItemsNameKey
+ loginItems:loginItems];
return (index != NSNotFound) ? YES : NO;
}
diff --git a/AppKit/GTMNSBezierPath+CGPath.m b/AppKit/GTMNSBezierPath+CGPath.m
index c805f42..3bc6de9 100644
--- a/AppKit/GTMNSBezierPath+CGPath.m
+++ b/AppKit/GTMNSBezierPath+CGPath.m
@@ -1,5 +1,5 @@
//
-// GTMNSBezierPath+CGPath.h
+// GTMNSBezierPath+CGPath.m
//
// Category for extracting a CGPathRef from a NSBezierPath
//
@@ -33,13 +33,13 @@
CGMutablePathRef thePath = CGPathCreateMutable();
if (!thePath) return nil;
- unsigned int elementCount = [self elementCount];
+ NSInteger elementCount = [self elementCount];
// The maximum number of points is 3 for a NSCurveToBezierPathElement.
// (controlPoint1, controlPoint2, and endPoint)
NSPoint controlPoints[3];
- for (unsigned int i = 0; i < elementCount; i++) {
+ for (NSInteger i = 0; i < elementCount; i++) {
switch ([self elementAtIndex:i associatedPoints:controlPoints]) {
case NSMoveToBezierPathElement:
CGPathMoveToPoint(thePath, &CGAffineTransformIdentity,
diff --git a/AppKit/GTMNSBezierPath+CGPathTest.m b/AppKit/GTMNSBezierPath+CGPathTest.m
index 3ca11c3..e22ee07 100644
--- a/AppKit/GTMNSBezierPath+CGPathTest.m
+++ b/AppKit/GTMNSBezierPath+CGPathTest.m
@@ -36,11 +36,11 @@
// Draws all of our tests so that we can compare this to our stored image file.
- (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
NSBezierPath *thePath = [NSBezierPath bezierPath];
- NSPoint theStart = NSMakePoint(20.0f, 20.0f);
+ NSPoint theStart = NSMakePoint(20.0, 20.0);
// Test moveto/lineto
[thePath moveToPoint: theStart];
- for (unsigned int i = 0; i < 10; ++i) {
+ for (NSUInteger i = 0; i < 10; ++i) {
NSPoint theNewPoint = NSMakePoint(i * 5, i * 10);
[thePath lineToPoint: theNewPoint];
theNewPoint = NSMakePoint(i * 2, i * 6);
@@ -48,11 +48,11 @@
}
// Test moveto/curveto
- for (unsigned int i = 0; i < 10; ++i) {
- NSPoint startPoint = NSMakePoint(5.0f, 50.0f);
- NSPoint endPoint = NSMakePoint(55.0f, 50.0f);
- NSPoint controlPoint1 = NSMakePoint(17.5f, 50.0f + 5.0f * i);
- NSPoint controlPoint2 = NSMakePoint(42.5f, 50.0f - 5.0f * i);
+ for (NSUInteger i = 0; i < 10; ++i) {
+ NSPoint startPoint = NSMakePoint(5.0, 50.0);
+ NSPoint endPoint = NSMakePoint(55.0, 50.0);
+ NSPoint controlPoint1 = NSMakePoint(17.5, 50.0 + 5.0 * i);
+ NSPoint controlPoint2 = NSMakePoint(42.5, 50.0 - 5.0 * i);
[thePath moveToPoint:startPoint];
[thePath curveToPoint:endPoint controlPoint1:controlPoint1 controlPoint2:controlPoint2];
}
diff --git a/AppKit/GTMNSBezierPath+RoundRect.h b/AppKit/GTMNSBezierPath+RoundRect.h
index 8e916fe..b0b48de 100644
--- a/AppKit/GTMNSBezierPath+RoundRect.h
+++ b/AppKit/GTMNSBezierPath+RoundRect.h
@@ -20,6 +20,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "GTMDefines.h"
/// Category for adding utility functions for creating round rectangles.
@interface NSBezierPath (GMBezierPathRoundRectAdditions)
@@ -33,7 +34,8 @@
//
// Returns:
// Auto released NSBezierPath
-+ (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect cornerRadius:(float)radius;
++ (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect
+ cornerRadius:(CGFloat)radius;
/// Adds a path which is a round rectangle inscribed inside of rectangle |rect| with a corner radius of |radius|
//
@@ -41,5 +43,6 @@
// rect: outer rectangle to inscribe into
// radius: radius of the corners. |radius| is clamped internally
// to be no larger than the smaller of half |rect|'s width or height
-- (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect cornerRadius:(float)radius;
+- (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect
+ cornerRadius:(CGFloat)radius;
@end
diff --git a/AppKit/GTMNSBezierPath+RoundRect.m b/AppKit/GTMNSBezierPath+RoundRect.m
index 4b98dc9..d4e5050 100644
--- a/AppKit/GTMNSBezierPath+RoundRect.m
+++ b/AppKit/GTMNSBezierPath+RoundRect.m
@@ -24,14 +24,16 @@
@implementation NSBezierPath (GTMBezierPathRoundRectAdditions)
-+ (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect cornerRadius:(float)radius {
++ (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect
+ cornerRadius:(CGFloat)radius {
NSBezierPath *bezier = [NSBezierPath bezierPath];
[bezier gtm_appendBezierPathWithRoundRect:rect cornerRadius:radius];
return bezier;
}
-- (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect cornerRadius:(float)radius {
+- (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect
+ cornerRadius:(CGFloat)radius {
if (!NSIsEmptyRect(rect)) {
if (radius > 0.0) {
// Clamp radius to be no larger than half the rect's width or height.
@@ -42,10 +44,18 @@
NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect));
[self moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))];
- [self appendBezierPathWithArcFromPoint:topLeft toPoint:rect.origin radius:radius];
- [self appendBezierPathWithArcFromPoint:rect.origin toPoint:bottomRight radius:radius];
- [self appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:radius];
- [self appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:radius];
+ [self appendBezierPathWithArcFromPoint:topLeft
+ toPoint:rect.origin
+ radius:radius];
+ [self appendBezierPathWithArcFromPoint:rect.origin
+ toPoint:bottomRight
+ radius:radius];
+ [self appendBezierPathWithArcFromPoint:bottomRight
+ toPoint:topRight
+ radius:radius];
+ [self appendBezierPathWithArcFromPoint:topRight
+ toPoint:topLeft
+ radius:radius];
[self closePath];
} else {
// When radius <= 0.0, use plain rectangle.
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.m b/AppKit/GTMNSBezierPath+RoundRectTest.m
index 6ff4a18..c67c4b3 100644
--- a/AppKit/GTMNSBezierPath+RoundRectTest.m
+++ b/AppKit/GTMNSBezierPath+RoundRectTest.m
@@ -35,26 +35,26 @@
// Draws all of our tests so that we can compare this to our stored TIFF file.
- (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{
NSRect theRects[] = {
- NSMakeRect(0.0f, 10.0f, 0.0f, 0.0f), //Empty Rect test
- NSMakeRect(50.0f, 10.0f, 30.0f, 30.0f), //Square Test
- NSMakeRect(100.0f, 10.0f, 1.0f, 2.0f), //Small Test
- NSMakeRect(120.0f, 10.0f, 15.0f, 20.0f), //Medium Test
- NSMakeRect(140.0f, 10.0f, 150.0f, 30.0f) //Large Test
+ NSMakeRect(0.0, 10.0, 0.0, 0.0), //Empty Rect test
+ NSMakeRect(50.0, 10.0, 30.0, 30.0), //Square Test
+ NSMakeRect(100.0, 10.0, 1.0, 2.0), //Small Test
+ NSMakeRect(120.0, 10.0, 15.0, 20.0), //Medium Test
+ NSMakeRect(140.0, 10.0, 150.0, 30.0) //Large Test
};
- const unsigned int theRectCount = sizeof(theRects) / sizeof(NSRect);
+ const NSUInteger theRectCount = sizeof(theRects) / sizeof(NSRect);
// Line Width Tests
- float theLineWidths[] = { 0.5f, 50.0f, 2.0f };
- const unsigned int theLineWidthCount = sizeof(theLineWidths) / sizeof(float);
- unsigned int i,j;
+ CGFloat theLineWidths[] = { 0.5, 50.0, 2.0 };
+ const NSUInteger theLineWidthCount = sizeof(theLineWidths) / sizeof(CGFloat);
+ NSUInteger i,j;
for (i = 0; i < theLineWidthCount; ++i) {
for (j = 0; j < theRectCount; ++j) {
NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
- cornerRadius:20.0f];
+ cornerRadius:20.0];
[roundRect setLineWidth: theLineWidths[i]];
[roundRect stroke];
- float newWidth = 35.0f;
+ CGFloat newWidth = 35.0;
if (i < theLineWidthCount - 1) {
newWidth += theLineWidths[i + 1] + theLineWidths[i];
}
@@ -64,32 +64,32 @@
// Fill test
NSColor *theColors[] = {
- [NSColor colorWithCalibratedRed:1.0f green:0.0f blue:0.0f alpha:1.0f],
- [NSColor colorWithCalibratedRed:0.2f green:0.4f blue:0.6f alpha:0.4f]
+ [NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.0 alpha:1.0],
+ [NSColor colorWithCalibratedRed:0.2 green:0.4 blue:0.6 alpha:0.4]
};
- const unsigned int theColorCount = sizeof(theColors)/sizeof(NSColor);
+ const NSUInteger theColorCount = sizeof(theColors)/sizeof(NSColor);
for (i = 0; i < theColorCount; ++i) {
for (j = 0; j < theRectCount; ++j) {
NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
- cornerRadius:10.0f];
+ cornerRadius:10.0];
[theColors[i] setFill];
[roundRect fill];
- theRects[j].origin.y += 35.0f;
+ theRects[j].origin.y += 35.0;
}
}
// Flatness test
- float theFlatness[] = {0.0f, 0.1f, 1.0f, 10.0f};
- const unsigned int theFlatnessCount = sizeof(theFlatness)/sizeof(float);
+ CGFloat theFlatness[] = {0.0, 0.1, 1.0, 10.0};
+ const NSUInteger theFlatnessCount = sizeof(theFlatness)/sizeof(CGFloat);
for (i = 0; i < theFlatnessCount; i++) {
for (j = 0; j < theRectCount; ++j) {
NSBezierPath *roundRect = [NSBezierPath gtm_bezierPathWithRoundRect:theRects[j]
- cornerRadius:6.0f];
+ cornerRadius:6.0];
[roundRect setFlatness:theFlatness[i]];
[roundRect stroke];
- theRects[j].origin.y += 35.0f;
+ theRects[j].origin.y += 35.0;
}
}
}
diff --git a/AppKit/GTMNSBezierPath+Shading.h b/AppKit/GTMNSBezierPath+Shading.h
index b67043c..5d68728 100644
--- a/AppKit/GTMNSBezierPath+Shading.h
+++ b/AppKit/GTMNSBezierPath+Shading.h
@@ -19,6 +19,7 @@
//
#import <Cocoa/Cocoa.h>
+#import "GTMDefines.h"
@protocol GTMShading;
@@ -66,8 +67,8 @@
// last color in our shading?
// shading: the shading to use to take our colors from.
//
-- (void)gtm_strokeRadiallyFrom:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+- (void)gtm_strokeRadiallyFrom:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading;
@@ -113,8 +114,8 @@
// last color in our shading?
// shading: the shading to use to take our colors from.
//
-- (void)gtm_fillRadiallyFrom:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+- (void)gtm_fillRadiallyFrom:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading;
@end
diff --git a/AppKit/GTMNSBezierPath+Shading.m b/AppKit/GTMNSBezierPath+Shading.m
index f5935ab..4ab9ee3 100644
--- a/AppKit/GTMNSBezierPath+Shading.m
+++ b/AppKit/GTMNSBezierPath+Shading.m
@@ -22,6 +22,7 @@
#import "GTMNSBezierPath+CGPath.h"
#import "GTMShading.h"
#import "GTMGeometryUtils.h"
+#import "GTMMethodCheck.h"
@interface NSBezierPath (GTMBezierPathShadingAdditionsPrivate)
// Fills a CGPathRef either axially or radially with the given shading.
@@ -44,8 +45,8 @@
- (void)gtm_fillCGPath:(CGPathRef)path
axially:(BOOL)axially
asStroke:(BOOL)asStroke
- from:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+ from:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading;
@@ -62,7 +63,7 @@
// the projected point
- (NSPoint)gtm_projectLineFrom:(NSPoint)pointA
to:(NSPoint)pointB
- by:(float)length;
+ by:(CGFloat)length;
@end
@@ -70,8 +71,8 @@
- (void)gtm_fillCGPath:(CGPathRef)path
axially:(BOOL)axially asStroke:(BOOL)asStroke
- from:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+ from:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading {
CGFunctionRef shadingFunction = [shading shadeFunction];
@@ -79,15 +80,15 @@
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
if (nil != currentContext) {
CGContextSaveGState(currentContext);
- float lineWidth = [self lineWidth];
- CGContextSetLineWidth(currentContext,lineWidth);
+ CGFloat lineWidth = [self lineWidth];
+ CGContextSetLineWidth(currentContext, lineWidth);
if (asStroke) {
// if we are using the stroke, we offset the from and to points
// by half the stroke width away from the center of the stroke.
// Otherwise we tend to end up with fills that only cover half of the
// because users set the start and end points based on the center
// of the stroke.
- float halfWidth = lineWidth * 0.5f;
+ CGFloat halfWidth = lineWidth * 0.5;
fromPoint = [self gtm_projectLineFrom:toPoint to:fromPoint by:halfWidth];
toPoint = [self gtm_projectLineFrom:fromPoint to:toPoint by:-halfWidth];
}
@@ -127,18 +128,24 @@
- (NSPoint)gtm_projectLineFrom:(NSPoint)pointA
to:(NSPoint)pointB
- by:(float)length {
+ by:(CGFloat)length {
NSPoint newPoint = pointB;
- float x = (pointB.x - pointA.x);
- float y = (pointB.y - pointA.y);
- if (x == 0.0f) {
+ CGFloat x = (pointB.x - pointA.x);
+ CGFloat y = (pointB.y - pointA.y);
+ if (x == 0.0) {
newPoint.y += length;
- } else if (y == 0.0f) {
+ } else if (y == 0.0) {
newPoint.x += length;
} else {
- float angle = atanf(y / x);
+#if CGFLOAT_IS_DOUBLE
+ CGFloat angle = atan(y / x);
+ newPoint.x += sin(angle) * length;
+ newPoint.y += cos(angle) * length;
+#else
+ CGFloat angle = atanf(y / x);
newPoint.x += sinf(angle) * length;
newPoint.y += cosf(angle) * length;
+#endif
}
return newPoint;
}
@@ -147,8 +154,7 @@
@implementation NSBezierPath (GTMBezierPathShadingAdditions)
-
-//METHOD_CHECK(NSBezierPath, gtm_createCGPath);
+GTM_METHOD_CHECK(NSBezierPath, gtm_createCGPath); // COV_NF_LINE
- (void)gtm_strokeAxiallyFrom:(NSPoint)fromPoint to:(NSPoint)toPoint
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
@@ -156,8 +162,8 @@
CGPathRef thePath = [self gtm_createCGPath];
if (nil != thePath) {
[self gtm_fillCGPath:thePath axially:YES asStroke:YES
- from:fromPoint fromRadius:0.0f
- to:toPoint toRadius:0.0f
+ from:fromPoint fromRadius:(CGFloat)0.0
+ to:toPoint toRadius:(CGFloat)0.0
extendingStart:extendingStart extendingEnd:extendingEnd
shading:shading];
CGPathRelease(thePath);
@@ -165,8 +171,8 @@
}
-- (void)gtm_strokeRadiallyFrom:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+- (void)gtm_strokeRadiallyFrom:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading {
CGPathRef thePath = [self gtm_createCGPath];
@@ -187,8 +193,8 @@
CGPathRef thePath = [self gtm_createCGPath];
if (nil != thePath) {
[self gtm_fillCGPath:thePath axially:YES asStroke:NO
- from:fromPoint fromRadius:0.0f
- to:toPoint toRadius:0.0f
+ from:fromPoint fromRadius:(CGFloat)0.0
+ to:toPoint toRadius:(CGFloat)0.0
extendingStart:extendingStart extendingEnd:extendingEnd
shading:shading];
CGPathRelease(thePath);
@@ -196,8 +202,8 @@
}
-- (void)gtm_fillRadiallyFrom:(NSPoint)fromPoint fromRadius:(float)fromRadius
- to:(NSPoint)toPoint toRadius:(float)toRadius
+- (void)gtm_fillRadiallyFrom:(NSPoint)fromPoint fromRadius:(CGFloat)fromRadius
+ to:(NSPoint)toPoint toRadius:(CGFloat)toRadius
extendingStart:(BOOL)extendingStart extendingEnd:(BOOL)extendingEnd
shading:(id<GTMShading>)shading {
CGPathRef thePath = [self gtm_createCGPath];
diff --git a/AppKit/GTMNSBezierPath+ShadingTest.m b/AppKit/GTMNSBezierPath+ShadingTest.m
index 8b56cfb..9fa7a8f 100644
--- a/AppKit/GTMNSBezierPath+ShadingTest.m
+++ b/AppKit/GTMNSBezierPath+ShadingTest.m
@@ -40,13 +40,13 @@
[NSColor redColor], [NSColor yellowColor],
[NSColor blueColor], [NSColor greenColor],
[NSColor redColor] };
- float theFloatArray[] = { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.00f };
+ CGFloat theFloatArray[] = { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 };
GTMLinearRGBShading *shading =
[GTMLinearRGBShading shadingWithColors:theColorArray
fromSpaceNamed:NSCalibratedRGBColorSpace
atPositions:theFloatArray
- count:sizeof(theFloatArray)/sizeof(float)];
+ count:sizeof(theFloatArray)/sizeof(CGFloat)];
NSBezierPath *shadedPath;
// axialStrokeRect test
diff --git a/AppKit/GTMNSColor+Theme.h b/AppKit/GTMNSColor+Theme.h
deleted file mode 100644
index f63a143..0000000
--- a/AppKit/GTMNSColor+Theme.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//
-// GTMNSColor+Theme.m
-//
-// Category for working with Themes and NSColor
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <Cocoa/Cocoa.h>
-#import <Carbon/Carbon.h>
-
-/// Category for working with Themes and NSColor
-@interface NSColor (GTMColorThemeAdditions)
-
-/// Create up an NSColor based on a Theme Text Color.
-/// Colors will be in the CalibratedRGB color space
-+ (id)gtm_colorWithThemeTextColor:(ThemeTextColor)textColor;
-
-/// Create up an NSColor based on a Theme Brush
-/// Colors will be in the CalibratedRGB color space
-+ (id)gtm_colorWithThemeBrush:(ThemeBrush)brush;
-
-@end
diff --git a/AppKit/GTMNSColor+Theme.m b/AppKit/GTMNSColor+Theme.m
deleted file mode 100644
index 67e8459..0000000
--- a/AppKit/GTMNSColor+Theme.m
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// GTMNSColor+Theme.m
-//
-// Category for working with Themes and NSColor
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import "GTMNSColor+Theme.h"
-#import "GTMDefines.h"
-
-@implementation NSColor (GTMColorThemeAdditions)
-
-/// Create up an NSColor based on a Theme Text Color
-/// Colors will be in the CalibratedRGB color space
-+ (id)gtm_colorWithThemeTextColor:(ThemeTextColor)textColor {
- NSColor *nsTextColor = nil;
- RGBColor rgbTextColor;
- OSStatus status = GetThemeTextColor(textColor, 32, true, &rgbTextColor);
- if (status == noErr) {
- float red = rgbTextColor.red / 65535.0f;
- float green = rgbTextColor.green / 65535.0f;
- float blue = rgbTextColor.blue / 65535.0f;
- nsTextColor = [NSColor colorWithCalibratedRed:red
- green:green
- blue:blue
- alpha:1.0f];
- } else {
- _GTMDevLog(@"Unable to create color for textcolor %d", textColor);
- }
- return nsTextColor;
-}
-
-/// Create up an NSColor based on a Theme Brush
-/// Colors will be in the CalibratedRGB color space
-+ (id)gtm_colorWithThemeBrush:(ThemeBrush)brush {
- NSColor *nsBrushColor = nil;
- RGBColor rgbBrushColor;
- OSStatus status = GetThemeBrushAsColor(brush, 32, true, &rgbBrushColor);
- if (status == noErr) {
- nsBrushColor = [NSColor colorWithCalibratedRed:rgbBrushColor.red / 65535.0f
- green:rgbBrushColor.green / 65535.0f
- blue:rgbBrushColor.blue / 65535.0f
- alpha:1.0f];
- } else {
- _GTMDevLog(@"Unable to create color for brushcolor %d", brush);
- }
- return nsBrushColor;
-}
-@end
diff --git a/AppKit/GTMNSColor+ThemeTest.m b/AppKit/GTMNSColor+ThemeTest.m
deleted file mode 100644
index e7d2a77..0000000
--- a/AppKit/GTMNSColor+ThemeTest.m
+++ /dev/null
@@ -1,199 +0,0 @@
-//
-// NSColor+ThemeTest.m
-//
-// Copyright 2006-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <SenTestingKit/SenTestingKit.h>
-#import "GTMNSColor+Theme.h"
-#import "GTMNSWorkspace+Theme.h"
-#import "GTMSystemVersion.h"
-
-
-@interface GTMNSColor_ThemeTest : SenTestCase
-@end
-
-@implementation GTMNSColor_ThemeTest
-
-//METHOD_CHECK(NSWorkspace, themeAppearance);
-
-- (void)testColorWithThemeTextColor {
- float colorValues[][4] = {
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 0.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.449989, 0.449989, 0.449989, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.449989, 0.449989, 0.449989, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.599985, 0.599985, 0.599985, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.599985, 0.599985, 0.599985, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.499992, 0.499992, 0.499992, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 }
- };
-
- if ([GTMSystemVersion isLeopardOrGreater]) {
- // kThemeTextColorRootMenuDisabled changed to white in Leopard.
- colorValues[35][0] = 1.0;
- colorValues[35][1] = 1.0;
- colorValues[35][2] = 1.0;
- }
- for(int i = kThemeTextColorWhite; i < kThemeTextColorSystemDetail; i++) {
- if (i == 0) continue; // There is no brush 0
- NSColor *textColor = [NSColor gtm_colorWithThemeTextColor:i];
- float nsComponents[5];
- [textColor getComponents: nsComponents];
- for(int j = 0; j < 4; j++) {
- STAssertEqualsWithAccuracy(nsComponents[j], colorValues[i + 2][j], 0.000001,
- @"Theme Text Color %d is wrong", i);
- STAssertEqualObjects([textColor colorSpaceName], NSCalibratedRGBColorSpace,
- @"Color space must be CalibratedRGB");
- }
- }
-}
-
-- (void)testColorWithThemeBrushColor {
- float colorValues[][4] = {
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 0.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.980011, 0.990005, 0.990005, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.709789, 0.835294, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.492195, 0.675792, 0.847669, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.000000, 0.000000, 0.000000, 1.000000 },
- { 0.500008, 0.500008, 0.500008, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.600000, 0.600000, 0.600000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.510002, 0.510002, 0.510002, 1.000000 },
- { 0.760006, 0.760006, 0.760006, 1.000000 },
- { 0.940002, 0.940002, 0.940002, 1.000000 },
- { 0.980011, 0.980011, 0.980011, 1.000000 },
- { 0.670008, 0.670008, 0.670008, 1.000000 },
- { 0.860014, 0.860014, 0.860014, 1.000000 },
- { 0.880003, 0.880003, 0.880003, 1.000000 },
- { 0.880003, 0.880003, 0.880003, 1.000000 },
- { 0.990005, 0.990005, 0.990005, 1.000000 },
- { 0.900008, 0.900008, 0.900008, 1.000000 },
- { 0.930007, 0.930007, 0.930007, 1.000000 },
- { 0.930007, 0.930007, 0.930007, 1.000000 },
- { 0.990005, 0.990005, 0.990005, 1.000000 },
- { 0.540002, 0.540002, 0.540002, 1.000000 },
- { 0.590005, 0.590005, 0.590005, 1.000000 },
- { 0.590005, 0.590005, 0.590005, 1.000000 },
- { 0.730007, 0.730007, 0.730007, 1.000000 },
- { 0.640009, 0.640009, 0.640009, 1.000000 },
- { 0.640009, 0.640009, 0.640009, 1.000000 },
- { 0.820005, 0.820005, 0.820005, 1.000000 },
- { 0.820005, 0.820005, 0.820005, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 1.000000, 1.000000, 1.000000, 1.000000 },
- { 0.925490, 0.952895, 0.996094, 1.000000 }
- };
-
- NSString *theme = [[NSWorkspace sharedWorkspace] gtm_themeAppearance];
- if ([theme isEqualToString:(NSString*)kThemeAppearanceAquaGraphite]) {
- // COV_NF_START
- // These are the only two brushes that change with an appearance change
- // In general we will be testing in blue, so this code won't get run
- colorValues[21][0] = 0.605478;
- colorValues[21][1] = 0.667979;
- colorValues[21][2] = 0.738293;
- colorValues[59][0] = 0.941192;
- colorValues[59][1] = 0.941192;
- colorValues[59][2] = 0.941192;
- // COV_NF_END
- }
- for(int i = kThemeBrushWhite; i < kThemeBrushListViewColumnDivider; i++) {
- // Brush "14" is the selection, so it will change depending on the system
- // There is no brush 0.
- if (i == 0 || i == 14) continue;
- NSColor *brushColor = [NSColor gtm_colorWithThemeBrush:i];
- float nsComponents[5];
- [brushColor getComponents: nsComponents];
- for(int j = 0; j < 4; j++) {
- STAssertEqualsWithAccuracy(nsComponents[j], colorValues[i + 2][j], 0.000001,
- @"Theme Text Brush %d is wrong", i + 2);
- STAssertEqualObjects([brushColor colorSpaceName], NSCalibratedRGBColorSpace,
- @"Color space must be CalibratedRB");
- }
- }
-}
-
-@end
diff --git a/AppKit/GTMNSWorkspace+ScreenSaver.m b/AppKit/GTMNSWorkspace+ScreenSaver.m
index c86a73c..9e1eb6a 100644
--- a/AppKit/GTMNSWorkspace+ScreenSaver.m
+++ b/AppKit/GTMNSWorkspace+ScreenSaver.m
@@ -77,8 +77,9 @@
BOOL answer = NO;
ScreenSaverController *controller = nil;
// We're calling into an "undocumented" framework here, so we are going to
- // step rather carefully.
+ // step rather carefully (and in 10.5.2 it's only 32bit).
+#if !__LP64__
Class screenSaverControllerClass = NSClassFromString(@"ScreenSaverController");
_GTMDevAssert(screenSaverControllerClass,
@"Are you linked with ScreenSaver.framework?"
@@ -96,6 +97,7 @@
}
}
}
+#endif // !__LP64__
if (!controller) {
// COV_NF_START
diff --git a/AppKit/GTMNSWorkspace+Theme.h b/AppKit/GTMNSWorkspace+Theme.h
deleted file mode 100644
index 364d623..0000000
--- a/AppKit/GTMNSWorkspace+Theme.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// GTMNSWorkspace+ScreenSaver.h
-//
-// Copyright 2007-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <Cocoa/Cocoa.h>
-#import <Carbon/Carbon.h>
-
-enum {
- // This means that we had a failure getting the style
- kThemeScrollBarArrowsInvalid = -1,
- // This is the "missing" scroll bar arrow style that some people use
- kThemeScrollBarArrowsDouble = 2
-};
-
-/// Category for interacting with the screen saver
-@interface NSWorkspace (GTMWorkspaceThemeAddition)
-
-// returns one of the kThemeAppearance... constants as an autoreleased NSString
-// tells you whether we are running under blue or graphite
-- (NSString*)gtm_themeAppearance;
-
-// Returns how the user has their scroll bars configured.
-- (ThemeScrollBarArrowStyle)gtm_themeScrollBarArrowStyle;
-@end
-
diff --git a/AppKit/GTMNSWorkspace+Theme.m b/AppKit/GTMNSWorkspace+Theme.m
deleted file mode 100644
index 3afb801..0000000
--- a/AppKit/GTMNSWorkspace+Theme.m
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// GTMNSWorkspace+Theme.m
-//
-// Copyright 2007-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import "GTMNSWorkspace+Theme.h"
-#import "GTMGarbageCollection.h"
-
-@implementation NSWorkspace (GTMWorkspaceThemeAddition)
-
-- (NSString*)gtm_themeAppearance {
- CFStringRef cfTheme;
- NSString *nsTheme = nil;
- OSStatus theStatus = CopyThemeIdentifier(&cfTheme);
- if (theStatus == noErr) {
- nsTheme = [GTMNSMakeCollectable(cfTheme) autorelease];
- }
- return nsTheme;
-}
-
-- (ThemeScrollBarArrowStyle)gtm_themeScrollBarArrowStyle {
- ThemeScrollBarArrowStyle style = kThemeScrollBarArrowsInvalid;
- OSStatus theStatus = GetThemeScrollBarArrowStyle(&style);
- if (theStatus != noErr) {
- style = kThemeScrollBarArrowsInvalid; // COV_NF_LINE
- }
- return style;
-}
-@end
diff --git a/AppKit/GTMNSWorkspace+ThemeTest.m b/AppKit/GTMNSWorkspace+ThemeTest.m
deleted file mode 100644
index ae1cb66..0000000
--- a/AppKit/GTMNSWorkspace+ThemeTest.m
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// NSWorkspace+ThemeTest.m
-//
-// Copyright 2007-2008 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
-// of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-//
-
-#import <SenTestingKit/SenTestingKit.h>
-#import "GTMSenTestCase.h"
-#import "GTMNSWorkspace+Theme.h"
-
-@interface GTMNSWorkspace_ThemeTest : SenTestCase
-@end
-
-@implementation GTMNSWorkspace_ThemeTest
-
-- (void)testThemeAppearance {
- NSString *theme = [[NSWorkspace sharedWorkspace] gtm_themeAppearance];
- STAssertNotNil(theme, nil);
- STAssertTrue([theme hasPrefix:(NSString*)kThemeAppearanceAqua], nil);
-}
-
-- (void)testThemeScrollBarArrowStyle {
- ThemeScrollBarArrowStyle style = [[NSWorkspace sharedWorkspace] gtm_themeScrollBarArrowStyle];
- STAssertLessThanOrEqual(style, (ThemeScrollBarArrowStyle)kThemeScrollBarArrowsDouble, nil);
-}
-@end
diff --git a/AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiff b/AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiff
new file mode 100644
index 0000000..33c3e17
--- /dev/null
+++ b/AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+CGPathTest.tiff b/AppKit/TestData/GTMNSBezierPath+CGPathTest.tiff
index 98ec8f8..98ec8f8 100644
--- a/AppKit/GTMNSBezierPath+CGPathTest.tiff
+++ b/AppKit/TestData/GTMNSBezierPath+CGPathTest.tiff
Binary files differ
diff --git a/AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiff b/AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiff
new file mode 100644
index 0000000..33c3e17
--- /dev/null
+++ b/AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiff
Binary files differ
diff --git a/AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiff b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiff
new file mode 100644
index 0000000..a4df8f8
--- /dev/null
+++ b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+RoundRectTest.tiff b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.tiff
index c41ab04..c41ab04 100644
--- a/AppKit/GTMNSBezierPath+RoundRectTest.tiff
+++ b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.tiff
Binary files differ
diff --git a/AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiff b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiff
new file mode 100644
index 0000000..a4df8f8
--- /dev/null
+++ b/AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiff
Binary files differ
diff --git a/AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff b/AppKit/TestData/GTMNSBezierPath+ShadingTest.10.5.tiff
index 040cb0d..040cb0d 100644
--- a/AppKit/GTMNSBezierPath+ShadingTest.10.5.tiff
+++ b/AppKit/TestData/GTMNSBezierPath+ShadingTest.10.5.tiff
Binary files differ