Przeglądaj źródła

【OCToSwift】NSColor_SKExtensions

tangchao 1 rok temu
rodzic
commit
abd8d38a1b

+ 0 - 10
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -2577,9 +2577,6 @@
 		BB86C1FD28F54923005AD968 /* NSEvent_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1FB28F54923005AD968 /* NSEvent_SKExtensions.m */; };
 		BB86C1FE28F54923005AD968 /* NSEvent_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1FB28F54923005AD968 /* NSEvent_SKExtensions.m */; };
 		BB86C1FF28F54923005AD968 /* NSEvent_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C1FB28F54923005AD968 /* NSEvent_SKExtensions.m */; };
-		BB86C21428F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21228F560D1005AD968 /* NSGraphics_SKExtensions.m */; };
-		BB86C21528F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21228F560D1005AD968 /* NSGraphics_SKExtensions.m */; };
-		BB86C21628F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21228F560D1005AD968 /* NSGraphics_SKExtensions.m */; };
 		BB86C21928F561C7005AD968 /* NSColor_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21828F561C7005AD968 /* NSColor_SKExtensions.m */; };
 		BB86C21A28F561C7005AD968 /* NSColor_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21828F561C7005AD968 /* NSColor_SKExtensions.m */; };
 		BB86C21B28F561C7005AD968 /* NSColor_SKExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BB86C21828F561C7005AD968 /* NSColor_SKExtensions.m */; };
@@ -4577,8 +4574,6 @@
 		BB86C1F128F54535005AD968 /* CPDFListView+KeyEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CPDFListView+KeyEvent.m"; sourceTree = "<group>"; };
 		BB86C1FB28F54923005AD968 /* NSEvent_SKExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSEvent_SKExtensions.m; sourceTree = "<group>"; };
 		BB86C1FC28F54923005AD968 /* NSEvent_SKExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSEvent_SKExtensions.h; sourceTree = "<group>"; };
-		BB86C21228F560D1005AD968 /* NSGraphics_SKExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSGraphics_SKExtensions.m; sourceTree = "<group>"; };
-		BB86C21328F560D1005AD968 /* NSGraphics_SKExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSGraphics_SKExtensions.h; sourceTree = "<group>"; };
 		BB86C21728F561C7005AD968 /* NSColor_SKExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSColor_SKExtensions.h; sourceTree = "<group>"; };
 		BB86C21828F561C7005AD968 /* NSColor_SKExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSColor_SKExtensions.m; sourceTree = "<group>"; };
 		BB88E43A294023CB002B3655 /* KMDocumentModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMDocumentModel.swift; sourceTree = "<group>"; };
@@ -8423,8 +8418,6 @@
 			children = (
 				89E4E754296427E5002DBA6F /* NSImage_SKExtensions.h */,
 				89E4E753296427E5002DBA6F /* NSImage_SKExtensions.m */,
-				BB86C21328F560D1005AD968 /* NSGraphics_SKExtensions.h */,
-				BB86C21228F560D1005AD968 /* NSGraphics_SKExtensions.m */,
 				BB86C21728F561C7005AD968 /* NSColor_SKExtensions.h */,
 				BB86C21828F561C7005AD968 /* NSColor_SKExtensions.m */,
 				BB246DA228F6B492005E8F52 /* NSBezierPath_SKExtensions.h */,
@@ -10971,7 +10964,6 @@
 				89E4E7282963FB74002DBA6F /* KMPropertiesViewPopController.m in Sources */,
 				BB32BF232A5EA05900D11348 /* KMAnalytics.swift in Sources */,
 				ADE787A22AA5A833002EC85A /* KMAccountExceptionWindowController.swift in Sources */,
-				BB86C21428F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */,
 				9F1FE4AE29406E4700E952CA /* CTPresentationModeController.m in Sources */,
 				BB146FC0299DC0D100784A6A /* GTMSessionFetcherLogging.m in Sources */,
 				AD1CA4212A061D190070541F /* KMAnnotationScreenAuthorViewItem.swift in Sources */,
@@ -11778,7 +11770,6 @@
 				AD68782229A5FADC005B5210 /* KMLightMemberCache.swift in Sources */,
 				AD8F06182999DB5900D93CBC /* KMPrintDrawPage.swift in Sources */,
 				BB147030299DC0D200784A6A /* OIDTokenUtilities.m in Sources */,
-				BB86C21528F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */,
 				BB146FD6299DC0D100784A6A /* GTLRObject.m in Sources */,
 				8942F7F92926089200389627 /* KMSignatureViewController.swift in Sources */,
 				89E4E7292963FB74002DBA6F /* KMPropertiesViewPopController.m in Sources */,
@@ -12649,7 +12640,6 @@
 				BB147013299DC0D100784A6A /* OIDError.m in Sources */,
 				9F0CB4BF2977C06300007028 /* KMPropertiesPanelColorSubVC.swift in Sources */,
 				ADD1B6BD29420B4A00C3FFF7 /* KMPrintPreviewView.swift in Sources */,
-				BB86C21628F560D1005AD968 /* NSGraphics_SKExtensions.m in Sources */,
 				BB146FF2299DC0D100784A6A /* GTLRUploadParameters.m in Sources */,
 				F373230A292DF9410013862C /* CPDFLineAnnotation+PDFListView.m in Sources */,
 				ADE8BC3D29F9458700570F89 /* KMRecommondManager.m in Sources */,

+ 51 - 51
PDF Office/PDF Master/Class/ToolsLibrary/AppKitCategories/NSColor_SKExtensions.h

@@ -38,66 +38,66 @@
 #define SDK_BEFORE(_version) (!defined(MAC_OS_X_VERSION_ ## _version) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_ ## _version)
 #import <Cocoa/Cocoa.h>
 
-enum {
-    SKScriptingColorRed = 'Red ',
-    SKScriptingColorGreen = 'Gren',
-    SKScriptingColorBlue = 'Blue',
-    SKScriptingColorYellow = 'Yelw',
-    SKScriptingColorMagenta = 'Mgnt',
-    SKScriptingColorCyan = 'Cyan',
-    SKScriptingColorDarkRed = 'DRed',
-    SKScriptingColorDarkGreen = 'DGrn',
-    SKScriptingColorDarkBlue = 'DBlu',
-    SKScriptingColorBanana = 'Bana',
-    SKScriptingColorTurquoise = 'Turq',
-    SKScriptingColorViolet = 'Viol',
-    SKScriptingColorOrange = 'Orng',
-    SKScriptingColorDeepPink = 'DpPk',
-    SKScriptingColorSpringGreen = 'SprG',
-    SKScriptingColorAqua = 'Aqua',
-    SKScriptingColorLime = 'Lime',
-    SKScriptingColorDarkViolet = 'DVio',
-    SKScriptingColorPurple = 'Prpl',
-    SKScriptingColorTeal = 'Teal',
-    SKScriptingColorOlive = 'Oliv',
-    SKScriptingColorBrown = 'Brwn',
-    SKScriptingColorBlack = 'Blck',
-    SKScriptingColorWhite = 'Whit',
-    SKScriptingColorGray = 'Gray',
-    SKScriptingColorLightGray = 'LGry',
-    SKScriptingColorDarkGray = 'DGry',
-    SKScriptingColorClear = 'Clea'
-};
+//enum {
+//    SKScriptingColorRed = 'Red ',
+//    SKScriptingColorGreen = 'Gren',
+//    SKScriptingColorBlue = 'Blue',
+//    SKScriptingColorYellow = 'Yelw',
+//    SKScriptingColorMagenta = 'Mgnt',
+//    SKScriptingColorCyan = 'Cyan',
+//    SKScriptingColorDarkRed = 'DRed',
+//    SKScriptingColorDarkGreen = 'DGrn',
+//    SKScriptingColorDarkBlue = 'DBlu',
+//    SKScriptingColorBanana = 'Bana',
+//    SKScriptingColorTurquoise = 'Turq',
+//    SKScriptingColorViolet = 'Viol',
+//    SKScriptingColorOrange = 'Orng',
+//    SKScriptingColorDeepPink = 'DpPk',
+//    SKScriptingColorSpringGreen = 'SprG',
+//    SKScriptingColorAqua = 'Aqua',
+//    SKScriptingColorLime = 'Lime',
+//    SKScriptingColorDarkViolet = 'DVio',
+//    SKScriptingColorPurple = 'Prpl',
+//    SKScriptingColorTeal = 'Teal',
+//    SKScriptingColorOlive = 'Oliv',
+//    SKScriptingColorBrown = 'Brwn',
+//    SKScriptingColorBlack = 'Blck',
+//    SKScriptingColorWhite = 'Whit',
+//    SKScriptingColorGray = 'Gray',
+//    SKScriptingColorLightGray = 'LGry',
+//    SKScriptingColorDarkGray = 'DGry',
+//    SKScriptingColorClear = 'Clea'
+//};
 
 @interface NSColor (SKExtensions)
 
-+ (NSColor *)keySourceListViewHighlightColor;
-+ (NSColor *)mainSourceListViewHighlightColor;
-+ (NSColor *)disabledSourceListViewHighlightColor;
-+ (NSColor *)mainSourceListBackgroundColor;
-+ (NSColor *)sourceListHighlightColorForView:(NSView *)view;
+//+ (NSColor *)keySourceListViewHighlightColor;
+//+ (NSColor *)mainSourceListViewHighlightColor;
+//+ (NSColor *)disabledSourceListViewHighlightColor;
+//+ (NSColor *)mainSourceListBackgroundColor;
+//+ (NSColor *)sourceListHighlightColorForView:(NSView *)view;
 
-- (NSComparisonResult)colorCompare:(NSColor *)aColor;
-
-- (void)drawSwatchInRoundedRect:(NSRect)rect;
-
-+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor;
-- (id)scriptingRgbaColorDescriptor;
-
-- (NSString *)accessibilityValue;
-
-- (NSString *)hexString;
+//- (NSComparisonResult)colorCompare:(NSColor *)aColor;
+//
+//- (void)drawSwatchInRoundedRect:(NSRect)rect;
+//
+//+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor;
+//- (id)scriptingRgbaColorDescriptor;
 
-- (BOOL)isTheSameColor:(NSColor *)color2;
-- (CGFloat)red;
-- (CGFloat)green;
-- (CGFloat)blue;
-- (CGFloat)alpha;
+//- (NSString *)accessibilityValue;
+//
+//- (NSString *)hexString;
+//
+//- (BOOL)isTheSameColor:(NSColor *)color2;
+//- (CGFloat)red;
+//- (CGFloat)green;
+//- (CGFloat)blue;
+//- (CGFloat)alpha;
 
 @end
 
 #if SDK_BEFORE(10_8)
 @interface NSColor (SKMountainLionDeclarations)
-- (CGColorRef)CGColor;
+//- (CGColorRef)CGColor;
 @end
 #endif

+ 274 - 274
PDF Office/PDF Master/Class/ToolsLibrary/AppKitCategories/NSColor_SKExtensions.m

@@ -59,279 +59,279 @@
 //    SKAddInstanceMethodImplementationFromSelector(self, @selector(CGColor), @selector(fallback_CGColor));
 //}
 
-+ (NSColor *)keySourceListViewHighlightColor {
-    static NSColor *color = nil;
-    static NSColor *graphiteColor = nil;
-    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
-        if (graphiteColor == nil)
-            graphiteColor = [NSColor colorWithCalibratedRed:0.390 green:0.453 blue:0.534 alpha:1.0];
-        return graphiteColor;
-    } else {
-        if (color == nil)
-            color = [NSColor colorWithCalibratedRed:0.251 green:0.487 blue:0.780 alpha:1.0];
-        return color;
-    }
-}
-
-+ (NSColor *)mainSourceListViewHighlightColor {
-    static NSColor *color = nil;
-    static NSColor *graphiteColor = nil;
-    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
-        if (graphiteColor == nil)
-            graphiteColor = [NSColor colorWithCalibratedRed:0.572 green:0.627 blue:0.680 alpha:1.0];
-        return graphiteColor;
-    } else {
-        if (color == nil)
-            color = [NSColor colorWithCalibratedRed:0.556 green:0.615 blue:0.748 alpha:1.0];
-        return color;
-    }
-}
-
-+ (NSColor *)disabledSourceListViewHighlightColor {
-    static NSColor *color = nil;
-    static NSColor *graphiteColor = nil;
-    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
-        if (graphiteColor == nil)
-            graphiteColor = [NSColor colorWithCalibratedRed:0.576 green:0.576 blue:0.576 alpha:1.0];
-        return graphiteColor;
-    } else {
-        if (color == nil)
-            color = [NSColor colorWithCalibratedRed:0.576 green:0.576 blue:0.576 alpha:1.0];
-        return color;
-    }
-}
-
-+ (NSColor *)mainSourceListBackgroundColor {
-    static NSColor *color = nil;
-    if (color == nil)
-        color = [NSColor colorWithCalibratedRed:0.839216 green:0.866667 blue:0.898039 alpha:1.0];
-    return color;
-}
-
-+ (NSColor *)sourceListHighlightColorForView:(NSView *)view {
-    NSWindow *window = [view window];
-    if ([window isKeyWindow] && [window firstResponder] == view)
-        return [self keySourceListViewHighlightColor];
-    else if ([window isMainWindow] || [window isKeyWindow])
-        return [self mainSourceListViewHighlightColor];
-    else
-        return [self disabledSourceListViewHighlightColor];
-}
-
-- (uint32_t)km_uint32HSBAValue {
-    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
-    if (rgbColor) {
-        CGFloat h = 0.0, s = 0.0, b = 0.0, a = 0.0;
-        [rgbColor getHue:&h saturation:&s brightness:&b alpha:&a];
-        union _ {
-            struct {
-                uint8_t h;
-                uint8_t s;
-                uint8_t b;
-                uint8_t a;
-            } hsba;
-            uint32_t uintValue;
-        } u;
-        u.hsba.h = (uint8_t)(h * 255);
-        u.hsba.s = (uint8_t)(s * 255);
-        u.hsba.b = (uint8_t)(b * 255);
-        u.hsba.a = (uint8_t)(a * 255);
-        return CFSwapInt32HostToBig(u.uintValue);
-    }
-    return 0;
-}
-
-- (NSComparisonResult)colorCompare:(NSColor *)aColor {
-    uint32_t value1 = [self km_uint32HSBAValue];
-    uint32_t value2 = [aColor km_uint32HSBAValue];
-    if (value1 < value2)
-        return NSOrderedAscending;
-    else if (value1 > value2)
-        return NSOrderedDescending;
-    else
-        return NSOrderedSame;
-}
-
-- (void)drawSwatchInRoundedRect:(NSRect)rect {
-    NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:3.0 yRadius:3.0];
-    [path setLineWidth:2.0];
-    [path addClip];
-    [self drawSwatchInRect:rect];
-    [[NSColor colorWithCalibratedWhite:0.0 alpha:0.3] setStroke];
-    [path stroke];
-}
-
-+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor {
-    if ([descriptor numberOfItems] > 0) {
-        CGFloat red, green, blue, alpha;
-        red = green = blue = (CGFloat)[[descriptor descriptorAtIndex:1] int32Value] / 65535.0f;
-        if ([descriptor numberOfItems] > 2) {
-            green = (CGFloat)[[descriptor descriptorAtIndex:2] int32Value] / 65535.0f;
-            blue = (CGFloat)[[descriptor descriptorAtIndex:3] int32Value] / 65535.0f;
-        }
-        if ([descriptor numberOfItems] == 2)
-            alpha = (CGFloat)[[descriptor descriptorAtIndex:2] int32Value] / 65535.0f;
-        else if ([descriptor numberOfItems] > 3)
-            alpha = (CGFloat)[[descriptor descriptorAtIndex:4] int32Value] / 65535.0f;
-        else
-            alpha= 1.0;
-        return [NSColor colorWithCalibratedRed:red green:green blue:blue alpha:alpha];
-    } else {
-        switch ([descriptor enumCodeValue]) {
-            case SKScriptingColorRed: return [NSColor redColor];
-            case SKScriptingColorGreen: return [NSColor greenColor];
-            case SKScriptingColorBlue: return [NSColor blueColor];
-            case SKScriptingColorYellow: return [NSColor yellowColor];
-            case SKScriptingColorMagenta: return [NSColor magentaColor];
-            case SKScriptingColorCyan: return [NSColor cyanColor];
-            case SKScriptingColorDarkRed: return [NSColor colorWithCalibratedRed:0.5 green:0.0 blue:0.0 alpha:1.0];
-            case SKScriptingColorDarkGreen: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.0 alpha:1.0];
-            case SKScriptingColorDarkBlue: return [NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.5 alpha:1.0];
-            case SKScriptingColorBanana: return [NSColor colorWithCalibratedRed:1.0 green:1.0 blue:0.5 alpha:1.0];
-            case SKScriptingColorTurquoise: return [NSColor colorWithCalibratedRed:1.0 green:0.5 blue:1.0 alpha:1.0];
-            case SKScriptingColorViolet: return [NSColor colorWithCalibratedRed:0.5 green:1.0 blue:1.0 alpha:1.0];
-            case SKScriptingColorOrange: return [NSColor orangeColor];
-            case SKScriptingColorDeepPink: return [NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.5 alpha:1.0];
-            case SKScriptingColorSpringGreen: return [NSColor colorWithCalibratedRed:0.0 green:1.0 blue:0.5 alpha:1.0];
-            case SKScriptingColorAqua: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:1.0 alpha:1.0];
-            case SKScriptingColorLime: return [NSColor colorWithCalibratedRed:0.5 green:1.0 blue:0.0 alpha:1.0];
-            case SKScriptingColorDarkViolet: return [NSColor colorWithCalibratedRed:0.5 green:0.0 blue:1.0 alpha:1.0];
-            case SKScriptingColorPurple: return [NSColor purpleColor];
-            case SKScriptingColorTeal: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.5 alpha:1.0];
-            case SKScriptingColorOlive: return [NSColor colorWithCalibratedRed:0.5 green:0.5 blue:0.0 alpha:1.0];
-            case SKScriptingColorBrown: return [NSColor brownColor];
-            case SKScriptingColorBlack: return [NSColor blackColor];
-            case SKScriptingColorWhite: return [NSColor whiteColor];
-            case SKScriptingColorGray: return [NSColor grayColor];
-            case SKScriptingColorDarkGray: return [NSColor darkGrayColor];
-            case SKScriptingColorLightGray: return [NSColor lightGrayColor];
-            case SKScriptingColorClear: return [NSColor clearColor];
-            default:
-            {
-                // Cocoa Scripting defines coercions from string to color for some standard color names
-                NSString *string = [descriptor stringValue];
-                if (string) {
-                    NSColor *color = [[NSScriptCoercionHandler sharedCoercionHandler] coerceValue:string toClass:[NSColor class]];
-                    // We should check the return value, because NSScriptCoercionHandler returns the input when it fails rather than nil, stupid
-                    return [color isKindOfClass:[NSColor class]] ? color : nil;
-                }
-            }
-        }
-        return nil;
-    }
-}
-
-- (id)scriptingRgbaColorDescriptor;
-{
-    CGFloat red, green, blue, alpha;
-    [[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
-    
-    NSAppleEventDescriptor *descriptor = [NSAppleEventDescriptor listDescriptor];
-    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * red)] atIndex:1];
-    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * green)] atIndex:2];
-    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * blue)] atIndex:3];
-    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * alpha)] atIndex:4];
-    
-    return descriptor;
-}
-
-- (NSString *)accessibilityValue {
-    static NSColorWell *colorWell = nil;
-    if (colorWell == nil)
-        colorWell = [[NSColorWell alloc] init];
-    [colorWell setColor:self];
-    return [colorWell accessibilityAttributeValue:NSAccessibilityValueAttribute];
-}
-
-- (NSString *)hexString {
-    NSColor *rgbColor = [self colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
-    if (rgbColor) {
-        CGFloat r = 0.0, g = 0.0, b = 0.0, a = 0.0;
-        [rgbColor getRed:&r green:&g blue:&b alpha:&a];
-        return [NSString stringWithFormat:@"#%02x%02x%02x", (unsigned int)(r * 255), (unsigned int)(g * 255), (unsigned int)(b * 255)];
-    }
-    return nil;
-}
-
-- (NSString *)rgbString {
-    NSColor *rgbColor = [self colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
-    if (rgbColor) {
-        CGFloat r = 0.0, g = 0.0, b = 0.0, a = 0.0;
-        [rgbColor getRed:&r green:&g blue:&b alpha:&a];
-        return [NSString stringWithFormat:@"(%u, %u, %u)", (unsigned int)(r * 255), (unsigned int)(g * 255), (unsigned int)(b * 255)];
-    }
-    return nil;
-}
-
-- (BOOL)isTheSameColor:(NSColor *)color2 {
-    const CGFloat *component = CGColorGetComponents(self.CGColor);
-    const CGFloat *component1 = CGColorGetComponents(color2.CGColor);
-    if (![self km_compareSize:component[0] :component1[0]]) {
-        return NO;
-    }
-    
-    if (![self km_compareSize:component[1] :component1[1]]) {
-        return NO;
-    }
-    
-    if (![self km_compareSize:component[2] :component1[2]]) {
-        return NO;
-    }
-    
-    if (![self km_compareSize:component[3] :component1[3]]) {
-        return NO;
-    }
-    return YES;
-}
-
--(BOOL)km_compareSize:(CGFloat)floa1 :(CGFloat)floa2
-{
-    CGFloat t1 = [[NSString stringWithFormat:@"%.3f", floa1] floatValue];
-    CGFloat t2 = [[NSString stringWithFormat:@"%.3f", floa2] floatValue];
-    if (fabs(t1-t2)>1e-6) return NO;
-    
-    return YES;
-    
-}
-
-- (CGFloat)red {
-    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
-    if (rgbColor) {
-        CGFloat red,green,blue,alpha;
-        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
-        return red;
-    }
-    return 0;
-}
-
-- (CGFloat)green {
-    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
-    if (rgbColor) {
-        CGFloat red,green,blue,alpha;
-        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
-        return green;
-    }
-    return 0;
-}
-
-- (CGFloat)blue {
-    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
-    if (rgbColor) {
-        CGFloat red,green,blue,alpha;
-        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
-        return blue;
-    }
-    return 0;
-}
-
-- (CGFloat)alpha {
-    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
-    if (rgbColor) {
-        CGFloat red,green,blue,alpha;
-        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
-        return alpha;
-    }
-    return 0;
-}
+//+ (NSColor *)keySourceListViewHighlightColor {
+//    static NSColor *color = nil;
+//    static NSColor *graphiteColor = nil;
+//    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
+//        if (graphiteColor == nil)
+//            graphiteColor = [NSColor colorWithCalibratedRed:0.390 green:0.453 blue:0.534 alpha:1.0];
+//        return graphiteColor;
+//    } else {
+//        if (color == nil)
+//            color = [NSColor colorWithCalibratedRed:0.251 green:0.487 blue:0.780 alpha:1.0];
+//        return color;
+//    }
+//}
+//
+//+ (NSColor *)mainSourceListViewHighlightColor {
+//    static NSColor *color = nil;
+//    static NSColor *graphiteColor = nil;
+//    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
+//        if (graphiteColor == nil)
+//            graphiteColor = [NSColor colorWithCalibratedRed:0.572 green:0.627 blue:0.680 alpha:1.0];
+//        return graphiteColor;
+//    } else {
+//        if (color == nil)
+//            color = [NSColor colorWithCalibratedRed:0.556 green:0.615 blue:0.748 alpha:1.0];
+//        return color;
+//    }
+//}
+//
+//+ (NSColor *)disabledSourceListViewHighlightColor {
+//    static NSColor *color = nil;
+//    static NSColor *graphiteColor = nil;
+//    if ([NSColor currentControlTint] == NSGraphiteControlTint) {
+//        if (graphiteColor == nil)
+//            graphiteColor = [NSColor colorWithCalibratedRed:0.576 green:0.576 blue:0.576 alpha:1.0];
+//        return graphiteColor;
+//    } else {
+//        if (color == nil)
+//            color = [NSColor colorWithCalibratedRed:0.576 green:0.576 blue:0.576 alpha:1.0];
+//        return color;
+//    }
+//}
+//
+//+ (NSColor *)mainSourceListBackgroundColor {
+//    static NSColor *color = nil;
+//    if (color == nil)
+//        color = [NSColor colorWithCalibratedRed:0.839216 green:0.866667 blue:0.898039 alpha:1.0];
+//    return color;
+//}
+//
+//+ (NSColor *)sourceListHighlightColorForView:(NSView *)view {
+//    NSWindow *window = [view window];
+//    if ([window isKeyWindow] && [window firstResponder] == view)
+//        return [self keySourceListViewHighlightColor];
+//    else if ([window isMainWindow] || [window isKeyWindow])
+//        return [self mainSourceListViewHighlightColor];
+//    else
+//        return [self disabledSourceListViewHighlightColor];
+//}
+//
+//- (uint32_t)km_uint32HSBAValue {
+//    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+//    if (rgbColor) {
+//        CGFloat h = 0.0, s = 0.0, b = 0.0, a = 0.0;
+//        [rgbColor getHue:&h saturation:&s brightness:&b alpha:&a];
+//        union _ {
+//            struct {
+//                uint8_t h;
+//                uint8_t s;
+//                uint8_t b;
+//                uint8_t a;
+//            } hsba;
+//            uint32_t uintValue;
+//        } u;
+//        u.hsba.h = (uint8_t)(h * 255);
+//        u.hsba.s = (uint8_t)(s * 255);
+//        u.hsba.b = (uint8_t)(b * 255);
+//        u.hsba.a = (uint8_t)(a * 255);
+//        return CFSwapInt32HostToBig(u.uintValue);
+//    }
+//    return 0;
+//}
+//
+//- (NSComparisonResult)colorCompare:(NSColor *)aColor {
+//    uint32_t value1 = [self km_uint32HSBAValue];
+//    uint32_t value2 = [aColor km_uint32HSBAValue];
+//    if (value1 < value2)
+//        return NSOrderedAscending;
+//    else if (value1 > value2)
+//        return NSOrderedDescending;
+//    else
+//        return NSOrderedSame;
+//}
+//
+//- (void)drawSwatchInRoundedRect:(NSRect)rect {
+//    NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:3.0 yRadius:3.0];
+//    [path setLineWidth:2.0];
+//    [path addClip];
+//    [self drawSwatchInRect:rect];
+//    [[NSColor colorWithCalibratedWhite:0.0 alpha:0.3] setStroke];
+//    [path stroke];
+//}
+//
+//+ (id)scriptingRgbaColorWithDescriptor:(NSAppleEventDescriptor *)descriptor {
+//    if ([descriptor numberOfItems] > 0) {
+//        CGFloat red, green, blue, alpha;
+//        red = green = blue = (CGFloat)[[descriptor descriptorAtIndex:1] int32Value] / 65535.0f;
+//        if ([descriptor numberOfItems] > 2) {
+//            green = (CGFloat)[[descriptor descriptorAtIndex:2] int32Value] / 65535.0f;
+//            blue = (CGFloat)[[descriptor descriptorAtIndex:3] int32Value] / 65535.0f;
+//        }
+//        if ([descriptor numberOfItems] == 2)
+//            alpha = (CGFloat)[[descriptor descriptorAtIndex:2] int32Value] / 65535.0f;
+//        else if ([descriptor numberOfItems] > 3)
+//            alpha = (CGFloat)[[descriptor descriptorAtIndex:4] int32Value] / 65535.0f;
+//        else
+//            alpha= 1.0;
+//        return [NSColor colorWithCalibratedRed:red green:green blue:blue alpha:alpha];
+//    } else {
+//        switch ([descriptor enumCodeValue]) {
+//            case SKScriptingColorRed: return [NSColor redColor];
+//            case SKScriptingColorGreen: return [NSColor greenColor];
+//            case SKScriptingColorBlue: return [NSColor blueColor];
+//            case SKScriptingColorYellow: return [NSColor yellowColor];
+//            case SKScriptingColorMagenta: return [NSColor magentaColor];
+//            case SKScriptingColorCyan: return [NSColor cyanColor];
+//            case SKScriptingColorDarkRed: return [NSColor colorWithCalibratedRed:0.5 green:0.0 blue:0.0 alpha:1.0];
+//            case SKScriptingColorDarkGreen: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.0 alpha:1.0];
+//            case SKScriptingColorDarkBlue: return [NSColor colorWithCalibratedRed:0.0 green:0.0 blue:0.5 alpha:1.0];
+//            case SKScriptingColorBanana: return [NSColor colorWithCalibratedRed:1.0 green:1.0 blue:0.5 alpha:1.0];
+//            case SKScriptingColorTurquoise: return [NSColor colorWithCalibratedRed:1.0 green:0.5 blue:1.0 alpha:1.0];
+//            case SKScriptingColorViolet: return [NSColor colorWithCalibratedRed:0.5 green:1.0 blue:1.0 alpha:1.0];
+//            case SKScriptingColorOrange: return [NSColor orangeColor];
+//            case SKScriptingColorDeepPink: return [NSColor colorWithCalibratedRed:1.0 green:0.0 blue:0.5 alpha:1.0];
+//            case SKScriptingColorSpringGreen: return [NSColor colorWithCalibratedRed:0.0 green:1.0 blue:0.5 alpha:1.0];
+//            case SKScriptingColorAqua: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:1.0 alpha:1.0];
+//            case SKScriptingColorLime: return [NSColor colorWithCalibratedRed:0.5 green:1.0 blue:0.0 alpha:1.0];
+//            case SKScriptingColorDarkViolet: return [NSColor colorWithCalibratedRed:0.5 green:0.0 blue:1.0 alpha:1.0];
+//            case SKScriptingColorPurple: return [NSColor purpleColor];
+//            case SKScriptingColorTeal: return [NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.5 alpha:1.0];
+//            case SKScriptingColorOlive: return [NSColor colorWithCalibratedRed:0.5 green:0.5 blue:0.0 alpha:1.0];
+//            case SKScriptingColorBrown: return [NSColor brownColor];
+//            case SKScriptingColorBlack: return [NSColor blackColor];
+//            case SKScriptingColorWhite: return [NSColor whiteColor];
+//            case SKScriptingColorGray: return [NSColor grayColor];
+//            case SKScriptingColorDarkGray: return [NSColor darkGrayColor];
+//            case SKScriptingColorLightGray: return [NSColor lightGrayColor];
+//            case SKScriptingColorClear: return [NSColor clearColor];
+//            default:
+//            {
+//                // Cocoa Scripting defines coercions from string to color for some standard color names
+//                NSString *string = [descriptor stringValue];
+//                if (string) {
+//                    NSColor *color = [[NSScriptCoercionHandler sharedCoercionHandler] coerceValue:string toClass:[NSColor class]];
+//                    // We should check the return value, because NSScriptCoercionHandler returns the input when it fails rather than nil, stupid
+//                    return [color isKindOfClass:[NSColor class]] ? color : nil;
+//                }
+//            }
+//        }
+//        return nil;
+//    }
+//}
+//
+//- (id)scriptingRgbaColorDescriptor;
+//{
+//    CGFloat red, green, blue, alpha;
+//    [[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
+//    
+//    NSAppleEventDescriptor *descriptor = [NSAppleEventDescriptor listDescriptor];
+//    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * red)] atIndex:1];
+//    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * green)] atIndex:2];
+//    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * blue)] atIndex:3];
+//    [descriptor insertDescriptor:[NSAppleEventDescriptor descriptorWithInt32:round(65535 * alpha)] atIndex:4];
+//    
+//    return descriptor;
+//}
+//
+//- (NSString *)accessibilityValue {
+//    static NSColorWell *colorWell = nil;
+//    if (colorWell == nil)
+//        colorWell = [[NSColorWell alloc] init];
+//    [colorWell setColor:self];
+//    return [colorWell accessibilityAttributeValue:NSAccessibilityValueAttribute];
+//}
+//
+//- (NSString *)hexString {
+//    NSColor *rgbColor = [self colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
+//    if (rgbColor) {
+//        CGFloat r = 0.0, g = 0.0, b = 0.0, a = 0.0;
+//        [rgbColor getRed:&r green:&g blue:&b alpha:&a];
+//        return [NSString stringWithFormat:@"#%02x%02x%02x", (unsigned int)(r * 255), (unsigned int)(g * 255), (unsigned int)(b * 255)];
+//    }
+//    return nil;
+//}
+//
+//- (NSString *)rgbString {
+//    NSColor *rgbColor = [self colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
+//    if (rgbColor) {
+//        CGFloat r = 0.0, g = 0.0, b = 0.0, a = 0.0;
+//        [rgbColor getRed:&r green:&g blue:&b alpha:&a];
+//        return [NSString stringWithFormat:@"(%u, %u, %u)", (unsigned int)(r * 255), (unsigned int)(g * 255), (unsigned int)(b * 255)];
+//    }
+//    return nil;
+//}
+//
+//- (BOOL)isTheSameColor:(NSColor *)color2 {
+//    const CGFloat *component = CGColorGetComponents(self.CGColor);
+//    const CGFloat *component1 = CGColorGetComponents(color2.CGColor);
+//    if (![self km_compareSize:component[0] :component1[0]]) {
+//        return NO;
+//    }
+//    
+//    if (![self km_compareSize:component[1] :component1[1]]) {
+//        return NO;
+//    }
+//    
+//    if (![self km_compareSize:component[2] :component1[2]]) {
+//        return NO;
+//    }
+//    
+//    if (![self km_compareSize:component[3] :component1[3]]) {
+//        return NO;
+//    }
+//    return YES;
+//}
+//
+//-(BOOL)km_compareSize:(CGFloat)floa1 :(CGFloat)floa2
+//{
+//    CGFloat t1 = [[NSString stringWithFormat:@"%.3f", floa1] floatValue];
+//    CGFloat t2 = [[NSString stringWithFormat:@"%.3f", floa2] floatValue];
+//    if (fabs(t1-t2)>1e-6) return NO;
+//    
+//    return YES;
+//    
+//}
+//
+//- (CGFloat)red {
+//    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+//    if (rgbColor) {
+//        CGFloat red,green,blue,alpha;
+//        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
+//        return red;
+//    }
+//    return 0;
+//}
+//
+//- (CGFloat)green {
+//    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+//    if (rgbColor) {
+//        CGFloat red,green,blue,alpha;
+//        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
+//        return green;
+//    }
+//    return 0;
+//}
+//
+//- (CGFloat)blue {
+//    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+//    if (rgbColor) {
+//        CGFloat red,green,blue,alpha;
+//        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
+//        return blue;
+//    }
+//    return 0;
+//}
+//
+//- (CGFloat)alpha {
+//    NSColor *rgbColor = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+//    if (rgbColor) {
+//        CGFloat red,green,blue,alpha;
+//        [rgbColor getRed:&red green:&green blue:&blue alpha:&alpha];
+//        return alpha;
+//    }
+//    return 0;
+//}
 
 @end

+ 0 - 59
PDF Office/PDF Master/Class/ToolsLibrary/AppKitCategories/NSGraphics_SKExtensions.h

@@ -1,59 +0,0 @@
-//
-//  NSGraphics_SKExtensions.h
-//  Skim
-//
-//  Created by Christiaan Hofman on 10/20/11.
-/*
- This software is Copyright (c) 2011-2018
- 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>
-
-
-//extern void KMDrawResizeHandle(CGContextRef context, NSPoint point, CGFloat radius, BOOL active);
-//extern void KMDrawResizeHandles(CGContextRef context, NSRect rect, CGFloat radius, BOOL active);
-//extern void KMDrawStampResizeHandle(CGContextRef context, NSRect rect, CGFloat radius, BOOL active);
-
-#pragma mark -
-
-//void SKDrawTextFieldBezel(NSRect rect, NSView *controlView);
-
-#pragma mark -
-
-//extern void SKShiftAndResizeViews(NSArray *views, CGFloat dx, CGFloat dw);
-//extern void SKShiftAndResizeView(NSView *view, CGFloat dx, CGFloat dw);
-//void SKResizeWindow(NSWindow *window, CGFloat dw);
-//extern void SKAutoSizeButtons(NSArray *buttons, BOOL rightAlign);
-//extern CGFloat SKAutoSizeLabelFields(NSArray *labelFields, NSArray *controls, BOOL resizeControls);
-//extern CGFloat SKAutoSizeLabelField(NSControl *labelField, NSControl *control, BOOL resizeControls);
-
-//extern NSFont * KMGetAnnotationFontWithBounds(NSString *string, NSRect bounds);

+ 0 - 188
PDF Office/PDF Master/Class/ToolsLibrary/AppKitCategories/NSGraphics_SKExtensions.m

@@ -1,188 +0,0 @@
-//
-//  NSGraphics_SKExtensions.m
-//  Skim
-//
-//  Created by Christiaan Hofman on 10/20/11.
-/*
- This software is Copyright (c) 2011-2018
- 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 "NSGraphics_SKExtensions.h"
-#import "NSColor_SKExtensions.h"
-
-
-//void KMDrawResizeHandle(CGContextRef context, NSPoint point, CGFloat radius, BOOL active)
-//{
-//    CGRect rect = CGRectMake(point.x - radius, point.y - radius, 2 * radius, 2 * radius);
-//    NSColor *color = [[(active ? [NSColor colorWithRed:82.0/255.0 green:102.0/255.0 blue:204.0/255.0 alpha:1] : [NSColor secondarySelectedControlColor]) colorUsingColorSpaceName:NSCalibratedRGBColorSpace] colorWithAlphaComponent:1];
-//    CGContextSetFillColorWithColor(context, [color CGColor]);
-//    CGContextSetStrokeColorWithColor(context, [[NSColor whiteColor] CGColor]);
-//    CGContextSetLineWidth(context, 0.25 * radius);
-//    CGContextFillEllipseInRect(context, rect);
-//    CGContextStrokeEllipseInRect(context, CGRectInset(rect, -0.25 *radius, -0.25 * radius));
-//}
-//
-//void KMDrawResizeHandles(CGContextRef context, NSRect rect, CGFloat radius, BOOL active)
-//{
-//    KMDrawResizeHandle(context, NSMakePoint(NSMinX(rect), NSMidY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMidX(rect), NSMaxY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMidX(rect), NSMinY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMaxX(rect), NSMidY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMinX(rect), NSMaxY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMinX(rect), NSMinY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMaxX(rect), NSMaxY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMaxX(rect), NSMinY(rect)), radius, active);
-//}
-//
-//void KMDrawStampResizeHandle(CGContextRef context, NSRect rect, CGFloat radius, BOOL active)
-//{
-//    KMDrawResizeHandle(context, NSMakePoint(NSMinX(rect), NSMaxY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMinX(rect), NSMinY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMaxX(rect), NSMaxY(rect)), radius, active);
-//    KMDrawResizeHandle(context, NSMakePoint(NSMaxX(rect), NSMinY(rect)), radius, active);
-//}
-//
-//#pragma mark -
-//
-//void SKDrawTextFieldBezel(NSRect rect, NSView *controlView) {
-//    static NSTextFieldCell *cell = nil;
-//    if (cell == nil) {
-//        cell = [[NSTextFieldCell alloc] initTextCell:@""];
-//        [cell setBezeled:YES];
-//    }
-//    [[NSColor controlColor] setFill];
-//    NSRectFill(rect);
-//    [cell drawWithFrame:rect inView:controlView];
-//    [cell setControlView:nil];
-//}
-//
-//#pragma mark -
-//
-//#define MIN_BUTTON_WIDTH 82.0
-//#define MAX_BUTTON_WIDTH 100.0
-//#define EXTRA_BUTTON_WIDTH 12.0
-//
-////void SKShiftAndResizeViews(NSArray *views, CGFloat dx, CGFloat dw) {
-////    for (NSView *view in views)
-////       SKShiftAndResizeView(view, dx, dw);
-////}
-//
-//void SKShiftAndResizeView(NSView *view, CGFloat dx, CGFloat dw) {
-//    NSRect frame = [view frame];
-//    frame.origin.x += dx;
-//    frame.size.width += dw;
-//    [view setFrame:frame];
-//}
-//
-//void SKResizeWindow(NSWindow *window, CGFloat dw) {
-//    NSRect frame = [window frame];
-//    frame.size.width += dw;
-//    [window setFrame:frame display:NO];
-//}
-//
-//void SKAutoSizeButtons(NSArray *buttons, BOOL rightAlign) {
-//    if ([buttons count] == 0)
-//        return;
-//    NSButton *button = [buttons objectAtIndex:0];
-//    CGFloat x = rightAlign ? NSMaxX([button frame]) : NSMinX([button frame]);
-//    CGFloat width = 0.0;
-//    for (button in buttons) {
-//        [button sizeToFit];
-//        width = fmax(width, NSWidth([button frame]) + EXTRA_BUTTON_WIDTH);
-//    }
-//    width = fmin(MAX_BUTTON_WIDTH, fmax(MIN_BUTTON_WIDTH, width));
-//    for (button in buttons) {
-//        NSRect frame = [button frame];
-//        frame.size.width = fmax(width, NSWidth(frame) + EXTRA_BUTTON_WIDTH);
-//        if (rightAlign) {
-//            x -= NSWidth(frame);
-//            frame.origin.x = x;
-//        } else {
-//            frame.origin.x = x;
-//            x += NSWidth(frame);
-//        }
-//        [button setFrame:frame];
-//    }
-//}
-//
-//CGFloat SKAutoSizeLabelFields(NSArray *labelFields, NSArray *controls, BOOL resizeControls) {
-//    if ([labelFields count] == 0)
-//        return 0.0;
-//    NSControl *control;
-//    NSRect frame;
-//    CGFloat left = CGFLOAT_MAX, width = 0.0, right, dw = -NSMaxX([[labelFields lastObject] frame]);
-//    for (control in labelFields) {
-//        [control sizeToFit];
-//        frame = [control frame];
-//        left = fmin(left, NSMinX(frame));
-//        width = fmax(width, NSWidth(frame));
-//    }
-//    right = left + width;
-//    for (control in labelFields) {
-//        frame = [control frame];
-//        frame.origin.x = right - NSWidth(frame);
-//        [control setFrame:frame];
-//    }
-//    dw += right;
-//    SKShiftAndResizeViews(controls, dw, resizeControls ? -dw : 0.0);
-//    return dw;
-//}
-//
-//extern CGFloat SKAutoSizeLabelField(NSControl *labelField, NSControl *control, BOOL resizeControls) {
-//    return SKAutoSizeLabelFields([NSArray arrayWithObjects:labelField, nil], [NSArray arrayWithObjects:control, nil], resizeControls);
-//}
-//
-//NSFont * KMGetAnnotationFontWithBounds(NSString *string, NSRect bounds)
-//{
-//    NSFont * maxFont = [NSFont boldSystemFontOfSize:6.0];
-//    
-//    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
-//    [dictionary setObject:maxFont forKey:NSFontAttributeName];
-//    
-//    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
-//    [style setAlignment:NSTextAlignmentCenter];
-//    [style setLineBreakMode:NSLineBreakByCharWrapping];
-//    
-//    [dictionary setObject:style forKey:NSParagraphStyleAttributeName];
-//    
-//    CGSize size = [string boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT)
-//                                       options:NSStringDrawingUsesLineFragmentOrigin
-//                                    attributes:dictionary].size;
-//    CGFloat width = size.width;
-//    CGFloat scanel = 1.0;
-//    
-//    scanel = MIN(bounds.size.width * 0.75/width, bounds.size.height/size.height);
-//    if (scanel > 1) {
-//        scanel= 1;
-//    }
-//    return [NSFont boldSystemFontOfSize:6.0 * scanel];
-//}