home *** CD-ROM | disk | FTP | other *** search
Wrap
/*********** ColorConversion: color declarations ***********/ replace "NXColor *<var>" with "NSColor *<var>" replace "(NXColor *)" with "(NSColor *)" replace "(const NXColor *)" with "(NSColor *)" replace "NXColor" with "NSColor *" /*********** ColorConversion: files ***********/ replace "\"color.h\"" with "\"NSColor.h\"" replace "<AppKit/color.h>" with "<AppKit/NSColor.h>" /*********** ColorConversion: #defines ***********/ replace "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("NX_COLORBLACK", "[NSColor blackColor]"), ("NX_COLORWHITE", "[NSColor whiteColor]"), ("NX_COLORGRAY", "[NSColor grayColor]"), ("NX_COLORLTGRAY", "[NSColor lightGrayColor]"), ("NX_COLORDKGRAY", "[NSColor darkGrayColor]"), ("NX_COLORRED", "[NSColor redColor]"), ("NX_COLORGREEN", "[NSColor greenColor]"), ("NX_COLORBLUE", "[NSColor blueColor]"), ("NX_COLORCYAN", "[NSColor cyanColor]"), ("NX_COLORYELLOW", "[NSColor yellowColor]"), ("NX_COLORMAGENTA", "[NSColor magentaColor]"), ("NX_COLORORANGE", "[NSColor orangeColor]"), ("NX_COLORPURPLE", "[NSColor purpleColor]"), ("NX_COLORBROWN", "[NSColor brownColor]"), ("NX_COLORCLEAR", "[NSColor clearColor]"), } replace "NX_NOALPHA" with "1.0" warning "ColorConversion: Was NX_NOALPHA." /*********** ColorConversion: conversion functions ***********/ replace "NXConvertRGBToColor (<a>, <b>, <c>)" with "[NSColor colorWithCalibratedRed:<a> green:<b> blue:<c> alpha:1.0]" replace "NXConvertRGBAToColor (<a>, <b>, <c>, <alpha>)" with "[NSColor colorWithCalibratedRed:<a> green:<b> blue:<c> alpha:1.0]" where ("<alpha>") isOneOf { ("-1"), ("-1."), ("-1.0") } replace "NXConvertRGBAToColor (<a>, <b>, <c>, <d>)" with "[NSColor colorWithCalibratedRed:<a> green:<b> blue:<c> alpha:<d>]" replace "NXConvertHSBToColor (<a>, <b>, <c>)" with "[NSColor colorWithCalibratedHue:<a> saturation:<b> brightness:<c> alpha:1.0]" replace "NXConvertHSBAToColor (<a>, <b>, <c>, <alpha>)" with "[NSColor colorWithCalibratedHue:<a> saturation:<b> brightness:<c> alpha:1.0]" where ("<alpha>") isOneOf { ("-1"), ("-1."), ("-1.0") } replace "NXConvertHSBAToColor (<a>, <b>, <c>, <d>)" with "[NSColor colorWithCalibratedHue:<a> saturation:<b> brightness:<c> alpha:<d>]" replace "NXConvertCMYKToColor (<a>, <b>, <c>, <d>)" with "[NSColor colorWithDeviceCyan:<a> magenta:<b> yellow:<c> black:<d> alpha:1.0]" replace "NXConvertCMYKAToColor (<a>, <b>, <c>, <d>, <e>)" with "[NSColor colorWithDeviceCyan:<a> magenta:<b> yellow:<c> black:<d> alpha:<e>]" replace "NXConvertGrayToColor (<a>)" with "[NSColor colorWithCalibratedWhite:<a> alpha:1.0]" replace "NXConvertGrayAlphaToColor (<a>, <alpha>)" with "[NSColor colorWithCalibratedWhite:<a> alpha:1.0]" where ("<alpha>") isOneOf { ("-1"), ("-1."), ("-1.0") } replace "NXConvertGrayAlphaToColor (<a>, <b>)" with "[NSColor colorWithCalibratedWhite:<a> alpha:<b>]" replace "NXConvertColorToRGB (<color>, <a>, <b>, <c>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:<a> green:<b> blue:<c> alpha:NULL]" replace "NXConvertColorToRGBA (<color>, <a>, <b>, <c>, <d>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:<a> green:<b> blue:<c> alpha:<d>]" replace "NXConvertColorToHSB (<color>, <a>, <b>, <c>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getHue:<a> saturation:<b> brightness:<c> alpha:NULL]" replace "NXConvertColorToHSBA (<color>, <a>, <b>, <c>, <d>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getHue:<a> saturation:<b> brightness:<c> alpha:<d>]" replace "NXConvertColorToCMYK (<color>, <a>, <b>, <c>, <d>)" with "[[<color> colorUsingColorSpaceName:NSDeviceCMYKColorSpace] getCyan:<a> magenta:<b> yellow:<c> black:<d> alpha:NULL]" replace "NXConvertColorToCMYKA (<color>, <a>, <b>, <c>, <d>, <e>)" with "[[<color> colorUsingColorSpaceName:NSDeviceCMYKColorSpace] getCyan:<a> magenta:<b> yellow:<c> black:<d> alpha:<e>]" replace "NXConvertColorToGray (<color>, <a>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedWhiteColorSpace] getWhite:<a> alpha:NULL]" replace "NXConvertColorToGrayAlpha (<color>, <a>, <b>)" with "[[<color> colorUsingColorSpaceName:NSCalibratedWhiteColorSpace] getWhite:<a> alpha:<b>]" /*********** ColorConversion: color component functions ***********/ replace "<func>(<c>)" with "[[<c> colorUsingColorSpaceName:<colorSpace>] <method>]" where ("<func>", "<colorSpace>", "<method>") isOneOf { ("NXGrayComponent", "NSCalibratedWhiteColorSpace", "whiteComponent"), ("NXRedComponent", "NSCalibratedRGBColorSpace", "redComponent"), ("NXBlueComponent", "NSCalibratedRGBColorSpace", "blueComponent"), ("NXGreenComponent", "NSCalibratedRGBColorSpace", "greenComponent"), ("NXHueComponent", "NSCalibratedRGBColorSpace", "hueComponent"), ("NXSaturationComponent", "NSCalibratedRGBColorSpace", "saturationComponent"), ("NXBrightnessComponent", "NSCalibratedRGBColorSpace", "brightnessComponent"), ("NXCyanComponent", "NSDeviceCMYKColorSpace", "cyanComponent"), ("NXYellowComponent", "NSDeviceCMYKColorSpace", "yellowComponent"), ("NXMagentaComponent", "NSDeviceCMYKColorSpace", "magentaComponent"), ("NXBlackComponent", "NSDeviceCMYKColorSpace", "blackComponent") ("NXColorListName", "NSNamedColorSpace", "catalogNameComponent"), ("NXColorName", "NSNamedColorSpace", "colorNameComponent") } replace "NXAlphaComponent (<a>)" with "[<a> alphaComponent]" replace "NXChangeAlphaComponent(<c>,<arg>)" with "[<c> colorWithAlphaComponent:<arg>]" replace "<func>(<c>,<arg>)" with "[<c> <method>:<arg>]" error "ColorConversion: [<c> <method>:<arg>] (used to be <func>(<c>,<arg>)) is not in the API. Rewrite this code, or implement a category on NSColor to support this method." where ("<func>", "<method>") isOneOf { ("NXChangeRedComponent", "colorWithRedComponent"), ("NXChangeBlueComponent", "colorWithBlueComponent"), ("NXChangeGreenComponent", "colorWithGreenComponent"), ("NXChangeGrayComponent", "colorWithWhiteComponent"), ("NXChangeHueComponent", "colorWithHueComponent"), ("NXChangeSaturationComponent", "colorWithSaturationComponent"), ("NXChangeBrightnessComponent", "colorWithBrightnessComponent"), ("NXChangeCyanComponent", "colorWithCyanComponent"), ("NXChangeYellowComponent", "colorWithYellowComponent"), ("NXChangeMagentaComponent", "colorWithMagentaComponent"), ("NXChangeBlackComponent", "colorWithBlackComponent"), } /*********** ColorConversion: color pasteboard functions ***********/ replace "NXReadColorFromPasteboard(<pasteboard>)" with "[NSColor colorFromPasteboard:<pasteboard>]" replace "NXWriteColorToPasteboard(<pasteboard>, <color>)" with "[<color> writeToPasteboard:<pasteboard>]" /*********** ColorConversion: other functions ***********/ replace "NXEqualColor (<a>, <b>)" with "[<a> isEqual:<b>]" replace "NXSetColor (<a>)" with "[<a> set]" replace "NXFindColorNamed (<list>, <name>, <c>)" with "(<c> = [[NSColorList colorListNamed:<list>] colorWithKey:<name>])" /*********** ColorConversion: color background methods ***********/ replace "[<obj> <method>:<minusOne>]" with "[<obj> <replacementMethod>:NO]" warning "ColorConversion: [<obj> <replacementMethod>:NO] was [<obj> <method>:<minusOne>]" where ("<minusOne>") isOneOf { ("-1"), ("-1.0") } where ("<method>", "<replacementMethod>") isOneOf { ("setBackgroundGray", "setDrawsBackground"), ("setCellBackgroundGray", "setDrawsCellBackground") } replace "([<obj> <method>] <comp>)" with "(![<obj> <replacementMethod>])" where ("<comp>") isOneOf { ("< 0"), ("< 0.0"), ("== -1"), ("== -1.0") } where ("<method>", "<replacementMethod>") isOneOf { ("backgroundGray", "drawsBackground"), ("cellBackgroundGray", "drawsCellBackground") } replace "[<obj> <method>:<arg>]" with "[<obj> <replacementMethod>:!(<arg>)]" where ("<method>", "<replacementMethod>") isOneOf { ("setBackgroundTransparent", "setDrawsBackground"), ("setCellBackgroundTransparent", "setDrawsCellBackground") } replace "[<obj> <method>]" with "(![<obj> <replacementMethod>])" where ("<method>", "<replacementMethod>") isOneOf { ("isBackgroundTransparent", "drawsBackground"), ("isCellBackgroundTransparent", "drawsCellBackground") } replace "[<obj> <method>:<arg>]" with "[<obj> <replacementMethod>:[NSColor colorWithCalibratedWhite:<arg> alpha:1.0]]" where ("<method>", "<replacementMethod>") isOneOf { ("setBackgroundGray", "setBackgroundColor"), ("setCellBackgroundGray", "setCellBackgroundColor"), ("setTitleGray", "setTitleColor"), ("setTextGray", "setTextColor") ("setForegroundGray", "setForegroundColor") ("setPeakGray", "setPeakColor") ("setSelGray", "setSelColor") } replace "[<obj> <method>]" with "[[[<obj> <replacementMethod>] colorUsingColorSpaceName:NSCalibratedWhiteColorSpace] whiteComponent]" warning "ColorConversion: Do you really want gray?" where ("<method>", "<replacementMethod>") isOneOf { ("backgroundGray", "backgroundColor"), ("cellBackgroundGray", "cellBackgroundColor"), ("titleGray", "titleColor"), ("textGray", "textColor") ("foregroundGray", "foregroundColor") ("peakGray", "peakColor") ("selGray", "selColor") } /*********** ColorConversion: other methods ***********/ replace "[<obj> runGray:<run>]" with "[[[<obj> runColor:<run>] colorUsingColorSpace:NSCalibratedWhiteColorSpace] whiteComponent]" warning "ColorConversion: Do you really want gray?" /*********** ColorConversion: cleanup ***********/ replace "[NSColor colorWithCalibratedWhite:<gray> alpha:1.0]" with "[NSColor <method>]" where ("<gray>", "<method>") isOneOf { ("NX_LTGRAY", "lightGrayColor"), ("NX_DKGRAY", "darkGrayColor"), ("NX_WHITE", "whiteColor"), ("NX_BLACK", "blackColor"), ("0.666", "lightGrayColor"), ("0.667", "lightGrayColor"), ("0.333", "darkGrayColor"), ("1.0", "whiteColor"), ("0.0", "blackColor"), ("1", "whiteColor"), ("0", "blackColor") } replace "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("NX_LTGRAY", "NSLightGray"), ("NX_DKGRAY", "NSDarkGray"), ("NX_WHITE", "NSWhite"), ("NX_BLACK", "NSBlack"), ("!(YES)", "NO"), ("!(NO)", "YES") } /*********** ColorConversion: NSColorList ***********/ replace "NXColorList" with "NSColorList" replacemethod "<old>" with "<new>" where ("<old>", "<new>") isOneOf { ("setColorNamed:<key> color:<color>", "setColor:<color> forKey:<key>"), ("removeColorNamed:", "removeColorWithKey:"), ("colorNamed:", "colorWithKey:"), ("findColorListNamed:", "colorListNamed:") } replacemethod "saveTo:" with "writeToFile:" warning "ColorConversion: 'writeToFile:' was 'saveTo:' ; conversion should only apply to NSColorList ; 'writeToFile:' returns BOOL rather than raising" /*********** ColorConversion: obsolete NSColorList methods ***********/ replace "[<obj> freeAndRemoveFile]" with "{[<obj> removeFile]; [<obj> release];}" replace "[<obj> colorCount]" with "[[<obj> allKeys] count]" replacemethod "colorCount" with same error "ColorConversion: 'colorCount' is obsolete ; use [[<obj> allKeys] count]" replace "[<obj> nameOfColorAt:<loc>]" with "[[<obj> allKeys] objectAtIndex:<loc>]" replacemethod "nameOfColorAt:" with same error "ColorConversion: 'nameOfColorAt:' is obsolete ; use [[<obj> allKeys] objectAtIndex:<loc>]" replace "[<obj> localizedNameForColorNamed:<name>]" with "(<name>)" warning "ColorConversion: Was localizedNameForColorNamed:" replacemethod "localizedNameForColorNamed:" with same error "ColorConversion: 'localizedNameForColorNamed:' is obsolete" replacemethod "generatesNamedColors" with same error "ColorConversion: 'generatesNamedColors' is obsolete" replacemethod "deactivateAllWells" with same error "ColorConversion: 'deactivateAllWells' is obsolete" /* (The ColorList delegate methods are taken care of in NotificationConversion) */ /*********** ColorConversion: obsolete conversion header hacks ***********/ replace "NXReadColor(<coder>)" with "[[<coder> decodeNXColor] retain]" warning "ColorConversion: [[<coder> decodeNXColor] retain] used to be NXReadColor(<coder>). Use 'decodeNXColor' to read old style colors, but use 'decodeObject' to read OpenStep colors." replace "NXWriteColor(<coder>, <color>)" with "[<coder> encodeObject:<color>]" /*********** ColorConversion: methods now obsolete ***********/ replacemethod "<sel>" with same error "ColorConversion: <sel> is obsolete. Use the NSColor class" where "<sel>" isOneOf { "setSelGray:" "setBackroundGray:" } /*********** ColorConversion: window depth ***********/ replace "NX_TwoBitGrayDepth" with "NSBestDepth(NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)" replace "NX_EightBitGrayDepth" with "NSBestDepth(NSCalibratedWhiteColorSpace, 8, 8, YES, NULL)" replace "NX_EightBitRGBDepth" with "NSBestDepth(NSCalibratedRGBColorSpace, 8, 8, YES, NULL)" replace "NX_TwelveBitRGBDepth" with "NSBestDepth(NSCalibratedRGBColorSpace, 4, 12, NO, NULL)" replace "NX_TwentyFourBitRGBDepth" with "NSBestDepth(NSCalibratedRGBColorSpace, 8, 24, NO, NULL)" replace "NX_DefaultDepth" with "0" replace "f = NXGetBestDepth(<depth>, <n>, <bps>)" with "*<depth> = NSBestDepth(((<n>==1) ? NSCalibratedWhiteColorSpace : ((<n>==4) ? NSDeviceCMYKColorSpace : NSCalibratedRGBColorSpace )), <bps>, 0, YES, &<f>)" replace "*&" with "" replace "&*" with "" /*********** ColorConversion: color spaces ***********/ replace "NX_CustomColorSpace" with "NSCustomColorSpace" replace "NX_OneIsBlackColorSpace" with "NSCalibratedBlackColorSpace" replace "NX_OneIsWhiteColorSpace" with "NSCalibratedWhiteColorSpace" replace "NX_RGBColorSpace" with "NSCalibratedRGBColorSpace" replace "NX_CMYKColorSpace" with "NSDeviceCMYKColorSpace"