Retire IconMaker

This commit is contained in:
Lukhnos Liu 2020-10-16 16:48:27 -07:00
parent 4c8270c42f
commit 3ac018f6c0
15 changed files with 0 additions and 4935 deletions

View File

@ -1,43 +0,0 @@
//
// AppIconRendererView.h
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
@interface AppIconRendererView : NSView {
// CGImageRef image;
NSImage *image;
}
@end

View File

@ -1,229 +0,0 @@
//
// AppIconRendererView.m
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import "AppIconRendererView.h"
@implementation AppIconRendererView
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
// CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
// CGContextRef context = CGBitmapContextCreate(NULL, frame.size.width, frame.size.height, 8, frame.size.width, colorSpace, 0);
// CGColorSpaceRelease(colorSpace);
// imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:frame.size.width pixelsHigh:frame.size.height bitsPerSample:8 samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSDeviceWhiteColorSpace bytesPerRow:0 bitsPerPixel:0];
NSRect bounds = [self bounds];
image = [[NSImage alloc] initWithSize:frame.size];
[image lockFocus];
[[NSColor blackColor] setFill];
[NSBezierPath fillRect:bounds];
CIContext *imageContext = [[NSGraphicsContext currentContext] CIContext];
CIFilter *filter = [CIFilter filterWithName:@"CIRandomGenerator"];
[filter setDefaults];
// CIContext *imageContext = [CIContext contextWithCGContext:context options:nil];
CIImage *output = [filter valueForKey:@"outputImage"];
CIFilter *mono = [CIFilter filterWithName:@"CIColorMonochrome"];
[mono setDefaults];
[mono setValue:output forKey:@"inputImage"];
CIColor *color = [[[CIColor alloc] initWithColor:[NSColor blackColor]] autorelease];
[mono setValue:color forKey:@"inputColor"];
[mono setValue:[NSNumber numberWithDouble:1.0] forKey:@"inputIntensity"];
output = [mono valueForKey:@"outputImage"];
CIFilter *blur = [CIFilter filterWithName:@"CIMotionBlur"];
[blur setDefaults];
[blur setValue:output forKey:@"inputImage"];
[blur setValue:[NSNumber numberWithDouble:25.0] forKey:@"inputRadius"];
[blur setValue:[NSNumber numberWithDouble:0.0] forKey:@"inputAngle"];
output = [blur valueForKey:@"outputImage"];
[imageContext drawImage:output inRect:[self bounds] fromRect:[self bounds]];
NSColor *transWhite = [NSColor colorWithDeviceWhite:0.9 alpha:0.2];
NSColor *transBlack = [NSColor colorWithDeviceWhite:0.5 alpha:0.3];
NSGradient *gradient = // [[[NSGradient alloc] initWithStartingColor:transBlack endingColor:transWhite] autorelease];
[[[NSGradient alloc] initWithColorsAndLocations:
transBlack, 0.0,
// [NSColor darkGrayColor], 0.1,
transWhite, 0.5,
// [NSColor darkGrayColor], 0.9,
transBlack, 1.0,
nil] autorelease];
// bounds.size.width /= 2;
[gradient drawInRect:bounds angle:0.0];
// bounds.origin.x += bounds.size.width;
// [gradient drawInRect:bounds angle:180.0];
// CGBitmapContextCreateImage(context);
// CGColorSpaceRef colorColorSpace = CGColorSpaceCreateDeviceRGB();
// CGImageRef tmpImage = CGBitmapContextCreateImage(context);
// image = CGImageCreateCopyWithColorSpace(tmpImage, colorColorSpace);
// CGImageRelease(tmpImage);
// CGColorSpaceRelease(colorColorSpace);
// CGContextRelease(context);
[image unlockFocus];
// NSLog(@"%@", [image representations]);
// [image addRepresentation:imageRep];
// NSLog(@"%@", [image representations]);
// for (NSBitmapImageRep *rep in [image representations]) {
// [rep setColorSpaceName:NSDeviceWhiteColorSpace];
// }
}
return self;
}
- (void)dealloc
{
// CGImageRelease(image);
[image release];
[super dealloc];
}
- (void)drawRect:(NSRect)dirtyRect
{
NSRect boundRect = [self bounds];
CGFloat radius = 1.0;
if (boundRect.size.width > 16.0 && boundRect.size.width <= 32.0) {
boundRect.origin.x += 1.0;
boundRect.origin.y += 1.0;
boundRect.size.width -= 2.0;
boundRect.size.height -= 2.0;
radius = 2.0;
}
else if (boundRect.size.width > 32.0) {
boundRect.origin.x += 5.0;
boundRect.origin.y += 5.0;
boundRect.size.width -= 10.0;
boundRect.size.height -= 10.0;
radius = 7.0;
}
NSShadow *imageShadow = [[[NSShadow alloc] init] autorelease];
[imageShadow setShadowOffset:NSMakeSize(1.0, -1.0)];
[imageShadow setShadowColor:[NSColor darkGrayColor]];
[imageShadow setShadowBlurRadius:radius / 2];
NSBezierPath *clipPath = [NSBezierPath bezierPathWithRoundedRect:boundRect xRadius:radius yRadius:radius];
[[NSGraphicsContext currentContext] saveGraphicsState];
[imageShadow set];
[[NSColor whiteColor] setFill];
[clipPath fill];
[[NSGraphicsContext currentContext] restoreGraphicsState];
[clipPath setClip];
[image drawInRect:boundRect fromRect:boundRect operation:NSCompositeCopy fraction:1.0];
NSString *text = @"ㄅ";
if ([self bounds].size.width >= 32.0) {
text = @"ㄅㄆ\nㄇㄈ";
}
NSFont *font = [NSFont fontWithName:@"LiSong Pro" size:boundRect.size.width * 0.40];
NSShadow *shadow = [[[NSShadow alloc] init] autorelease];
[shadow setShadowColor:[NSColor blackColor]];
[shadow setShadowOffset:NSMakeSize(1.0, 1.0)];
// [shadow setShadowBlurRadius:2.0];
// [NSFont boldSystemFontOfSize:48.0];
NSColor *textColor = [NSColor whiteColor];
NSMutableDictionary *attr = [NSMutableDictionary dictionaryWithObjectsAndKeys:
font, NSFontAttributeName,
textColor, NSForegroundColorAttributeName,
shadow, NSShadowAttributeName,
nil];
NSAttributedString *attrStr = [[[NSAttributedString alloc] initWithString:text attributes:attr] autorelease];
NSRect textRect = [attrStr boundingRectWithSize:boundRect.size options:NSStringDrawingUsesLineFragmentOrigin];
textRect.origin.x = boundRect.origin.x + (boundRect.size.width - textRect.size.width) / 2.0;
textRect.origin.y = boundRect.origin.y + (boundRect.size.height - textRect.size.height) / 2.0;
textRect.origin.y += boundRect.size.height * 0.025;
[attrStr drawInRect:textRect];
// NSBitmapImageRep *imageRep = [[[NSBitmapImageRep alloc] initWithCGImage:image] autorelease];
//
// [imageRep colorizeByMappingGray:0.2 toColor:[NSColor greenColor] blackMapping:[NSColor darkGrayColor] whiteMapping:[NSColor redColor]];
// NSImage *img = [[NSImage alloc] initWithCGImage:image size:NSZeroSize];
// NSLog(@"%@", [img representations]);
//
// [img drawInRect:[self bounds] fromRect:[self bounds] operation:NSCompositeCopy fraction:1.0];
// [img release];
// [image drawRepresentation:imageRep inRect:[self bounds]];
// [imageRep draw];
// [imageRep drawInRect:[self bounds] fromRect:[self bounds] operation:NSCompositeCopy fraction:1.0 respectFlipped:YES hints:nil];
}
@end

View File

@ -1,14 +0,0 @@
//
// BopomofoIconRenderView.h
// Lettuce
//
// Created by Lukhnos D. Liu on 9/3/12.
//
//
#import <Cocoa/Cocoa.h>
@interface BopomofoIconRenderView : NSView
@property (assign, nonatomic) BOOL textMenuIcon;
@property (assign, nonatomic) BOOL plainBopomofoIcon;
@end

View File

@ -1,115 +0,0 @@
//
// BopomofoIconRenderView.m
// Lettuce
//
// Created by Lukhnos D. Liu on 9/3/12.
//
//
#import "BopomofoIconRenderView.h"
@implementation BopomofoIconRenderView
- (void)drawRect:(NSRect)dirtyRect
{
NSAffineTransform *transform = [NSAffineTransform transform];
[transform scaleBy:[self bounds].size.width / 16.0];
[transform concat];
NSRect boundsRect = NSMakeRect(0.0, 0.0, 16.0, 16.0);
if ([self bounds].size.width > 16.0) {
boundsRect.origin.x += 0.5;
}
boundsRect.size.width -= 1.0;
NSBezierPath *backgroundPath = [NSBezierPath bezierPathWithRoundedRect:boundsRect xRadius:2.0 yRadius:2.0];
if (self.textMenuIcon) {
[[NSColor colorWithDeviceWhite:0.95 alpha:1.0] setFill];
[[NSColor colorWithDeviceWhite:0.6 alpha:1.0] setStroke];
[backgroundPath fill];
NSRect innerBoundRect = boundsRect;
innerBoundRect.size.width -= 1.0;
innerBoundRect.size.height -= 1.0;
innerBoundRect.origin.x += 0.5;
innerBoundRect.origin.y += 0.5;
backgroundPath = [NSBezierPath bezierPathWithRoundedRect:innerBoundRect xRadius:2.0 yRadius:2.0];
[backgroundPath stroke];
[NSGraphicsContext saveGraphicsState];
NSBezierPath *coveringPath = [NSBezierPath bezierPath];
[coveringPath appendBezierPathWithArcWithCenter:NSMakePoint(16.0, 1.0) radius:14.0 startAngle:0.0 endAngle:360.0];
[coveringPath setClip];
[[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setStroke];
backgroundPath = [NSBezierPath bezierPathWithRoundedRect:innerBoundRect xRadius:2.0 yRadius:2.0];
[backgroundPath stroke];
[NSGraphicsContext restoreGraphicsState];
}
else {
if (self.plainBopomofoIcon) {
if ([self bounds].size.width > 16.0) {
[[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setFill];
}
else {
[[NSColor colorWithDeviceWhite:0.1 alpha:1.0] setFill];
}
}
else {
[[NSColor colorWithDeviceWhite:0.3 alpha:1.0] setFill];
}
[backgroundPath fill];
}
CGFloat fontSize = ([self bounds].size.width > 16.0) ? 14.0 : 13.0;
NSString *text = @"ㄅ";
NSString *fontName = @"BiauKai";
NSColor *textColor = nil;
if (self.textMenuIcon) {
textColor = [NSColor blackColor];
}
else if (self.plainBopomofoIcon) {
textColor = [NSColor colorWithDeviceWhite:0.95 alpha:1.0];
}
else {
textColor = [NSColor colorWithDeviceWhite:1.0 alpha:1.0];
}
NSMutableDictionary *attrDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
textColor, NSForegroundColorAttributeName,
[NSFont fontWithName:fontName size:fontSize], NSFontAttributeName,
nil];
NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:text attributes:attrDict] autorelease];
NSRect textBounds = [attrString boundingRectWithSize:boundsRect.size options:NSStringDrawingUsesLineFragmentOrigin];
NSPoint textOrigin;
textOrigin.x = boundsRect.origin.x + (boundsRect.size.width - textBounds.size.width) / 2.0;
textOrigin.y = boundsRect.origin.y;
[attrString drawAtPoint:textOrigin];
if (self.plainBopomofoIcon) {
NSBezierPath *coveringPath = [NSBezierPath bezierPath];
[coveringPath appendBezierPathWithArcWithCenter:NSMakePoint(16.0, -3.0) radius:13.0 startAngle:0.0 endAngle:360.0];
[coveringPath setClip];
if (!([self bounds].size.width > 16.0)) {
[[NSColor colorWithDeviceWhite:0.6 alpha:1.0] setFill];
}
else {
[[NSColor colorWithDeviceWhite:0.65 alpha:1.0] setFill];
}
[backgroundPath fill];
[attrDict setObject:[NSColor colorWithDeviceWhite:1.0 alpha:1.0] forKey:NSForegroundColorAttributeName];
[attrString setAttributes:attrDict range:NSMakeRange(0, [text length])];
[attrString drawAtPoint:textOrigin];
}
}
@end

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2011-2012 Mengjuei Hsieh et al.</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.openvanilla.McBopomofo.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>MICM</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View File

@ -1,7 +0,0 @@
//
// Prefix header for all source files of the 'IconMaker' target in the 'IconMaker' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif

View File

@ -1,282 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
6AA67F9E15FC429D00B5A308 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AA67F9D15FC429D00B5A308 /* Cocoa.framework */; };
6AA67FD315FC430F00B5A308 /* AppIconRendererView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */; };
6AA67FD415FC430F00B5A308 /* BopomofoIconRenderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */; };
6AA67FD715FC430F00B5A308 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6AA67FC815FC430F00B5A308 /* MainMenu.xib */; };
6AA67FD915FC430F00B5A308 /* IconMakerAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */; };
6AA67FDA15FC430F00B5A308 /* ImageZoomInView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */; };
6AA67FDB15FC430F00B5A308 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FD015FC430F00B5A308 /* main.m */; };
6AA67FDC15FC430F00B5A308 /* TISIconRendererView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */; };
6AA67FE215FC43BC00B5A308 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6AA67FE115FC43BC00B5A308 /* Quartz.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
6AA67F9915FC429D00B5A308 /* IconMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IconMaker.app; sourceTree = BUILT_PRODUCTS_DIR; };
6AA67F9D15FC429D00B5A308 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
6AA67FBF15FC430F00B5A308 /* AppIconRendererView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppIconRendererView.h; sourceTree = "<group>"; };
6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppIconRendererView.m; sourceTree = "<group>"; };
6AA67FC115FC430F00B5A308 /* BopomofoIconRenderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BopomofoIconRenderView.h; sourceTree = "<group>"; };
6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BopomofoIconRenderView.m; sourceTree = "<group>"; };
6AA67FC915FC430F00B5A308 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = MainMenu.xib; sourceTree = "<group>"; };
6AA67FCA15FC430F00B5A308 /* IconMaker-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "IconMaker-Info.plist"; sourceTree = "<group>"; };
6AA67FCB15FC430F00B5A308 /* IconMaker-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "IconMaker-Prefix.pch"; sourceTree = "<group>"; };
6AA67FCC15FC430F00B5A308 /* IconMakerAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconMakerAppDelegate.h; sourceTree = "<group>"; };
6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IconMakerAppDelegate.m; sourceTree = "<group>"; };
6AA67FCE15FC430F00B5A308 /* ImageZoomInView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageZoomInView.h; sourceTree = "<group>"; };
6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageZoomInView.m; sourceTree = "<group>"; };
6AA67FD015FC430F00B5A308 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
6AA67FD115FC430F00B5A308 /* TISIconRendererView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TISIconRendererView.h; sourceTree = "<group>"; };
6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TISIconRendererView.m; sourceTree = "<group>"; };
6AA67FE115FC43BC00B5A308 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6AA67F9615FC429D00B5A308 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
6AA67FE215FC43BC00B5A308 /* Quartz.framework in Frameworks */,
6AA67F9E15FC429D00B5A308 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
6AA67F8E15FC429D00B5A308 = {
isa = PBXGroup;
children = (
6AA67FBF15FC430F00B5A308 /* AppIconRendererView.h */,
6AA67FC015FC430F00B5A308 /* AppIconRendererView.m */,
6AA67FC115FC430F00B5A308 /* BopomofoIconRenderView.h */,
6AA67FC215FC430F00B5A308 /* BopomofoIconRenderView.m */,
6AA67FCC15FC430F00B5A308 /* IconMakerAppDelegate.h */,
6AA67FCD15FC430F00B5A308 /* IconMakerAppDelegate.m */,
6AA67FCE15FC430F00B5A308 /* ImageZoomInView.h */,
6AA67FCF15FC430F00B5A308 /* ImageZoomInView.m */,
6AA67FD015FC430F00B5A308 /* main.m */,
6AA67FD115FC430F00B5A308 /* TISIconRendererView.h */,
6AA67FD215FC430F00B5A308 /* TISIconRendererView.m */,
6AE210AF15FC6388003659FE /* Resources */,
6AA67F9C15FC429D00B5A308 /* Frameworks */,
6AA67F9A15FC429D00B5A308 /* Products */,
);
sourceTree = "<group>";
};
6AA67F9A15FC429D00B5A308 /* Products */ = {
isa = PBXGroup;
children = (
6AA67F9915FC429D00B5A308 /* IconMaker.app */,
);
name = Products;
sourceTree = "<group>";
};
6AA67F9C15FC429D00B5A308 /* Frameworks */ = {
isa = PBXGroup;
children = (
6AA67F9D15FC429D00B5A308 /* Cocoa.framework */,
6AA67FE115FC43BC00B5A308 /* Quartz.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
6AE210AF15FC6388003659FE /* Resources */ = {
isa = PBXGroup;
children = (
6AA67FCA15FC430F00B5A308 /* IconMaker-Info.plist */,
6AA67FCB15FC430F00B5A308 /* IconMaker-Prefix.pch */,
6AA67FC815FC430F00B5A308 /* MainMenu.xib */,
);
name = Resources;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
6AA67F9815FC429D00B5A308 /* IconMaker */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6AA67FB715FC429D00B5A308 /* Build configuration list for PBXNativeTarget "IconMaker" */;
buildPhases = (
6AA67F9515FC429D00B5A308 /* Sources */,
6AA67F9615FC429D00B5A308 /* Frameworks */,
6AA67F9715FC429D00B5A308 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = IconMaker;
productName = IconMaker;
productReference = 6AA67F9915FC429D00B5A308 /* IconMaker.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
6AA67F9015FC429D00B5A308 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
ORGANIZATIONNAME = OpenVanilla;
};
buildConfigurationList = 6AA67F9315FC429D00B5A308 /* Build configuration list for PBXProject "IconMaker" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 6AA67F8E15FC429D00B5A308;
productRefGroup = 6AA67F9A15FC429D00B5A308 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
6AA67F9815FC429D00B5A308 /* IconMaker */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
6AA67F9715FC429D00B5A308 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6AA67FD715FC430F00B5A308 /* MainMenu.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
6AA67F9515FC429D00B5A308 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6AA67FD315FC430F00B5A308 /* AppIconRendererView.m in Sources */,
6AA67FD415FC430F00B5A308 /* BopomofoIconRenderView.m in Sources */,
6AA67FD915FC430F00B5A308 /* IconMakerAppDelegate.m in Sources */,
6AA67FDA15FC430F00B5A308 /* ImageZoomInView.m in Sources */,
6AA67FDB15FC430F00B5A308 /* main.m in Sources */,
6AA67FDC15FC430F00B5A308 /* TISIconRendererView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
6AA67FC815FC430F00B5A308 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
6AA67FC915FC430F00B5A308 /* en */,
);
name = MainMenu.xib;
path = en.lproj;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
6AA67FB515FC429D00B5A308 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
6AA67FB615FC429D00B5A308 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
6AA67FB815FC429D00B5A308 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "IconMaker-Prefix.pch";
INFOPLIST_FILE = "IconMaker-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
6AA67FB915FC429D00B5A308 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "IconMaker-Prefix.pch";
INFOPLIST_FILE = "IconMaker-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
6AA67F9315FC429D00B5A308 /* Build configuration list for PBXProject "IconMaker" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6AA67FB515FC429D00B5A308 /* Debug */,
6AA67FB615FC429D00B5A308 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6AA67FB715FC429D00B5A308 /* Build configuration list for PBXNativeTarget "IconMaker" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6AA67FB815FC429D00B5A308 /* Debug */,
6AA67FB915FC429D00B5A308 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 6AA67F9015FC429D00B5A308 /* Project object */;
}

View File

@ -1,45 +0,0 @@
//
// IconMakerAppDelegate.h
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
#import "TISIconRendererView.h"
#import "BopomofoIconRenderView.h"
@interface IconMakerAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet TISIconRendererView *selectedTISIconRendererView;
@property (assign) IBOutlet TISIconRendererView *faviconRenderView;
@property (assign) IBOutlet BopomofoIconRenderView *bopomofoIconRenderView;
@property (assign) IBOutlet BopomofoIconRenderView *bopomofoIconRenderView2x;
@end

View File

@ -1,112 +0,0 @@
//
// IconMakerAppDelegate.m
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import "IconMakerAppDelegate.h"
@implementation IconMakerAppDelegate
- (void)makeIconForObject:(id)object size:(NSSize)size filename:(NSString *)name
{
NSRect rect;
rect.origin = NSZeroPoint;
rect.size = size;
NSView *view = nil;
if ([object isKindOfClass:[NSView class]]) {
view = object;
[view setFrame:NSMakeRect(0.0, 0.0, size.width, size.height)];
}
else if ([object isKindOfClass:[NSString class]]) {
view = [[[NSClassFromString(object) alloc] initWithFrame:rect] autorelease];
}
NSImage *image = [[[NSImage alloc] initWithSize:size] autorelease];
[image lockFocus];
[view drawRect:rect];
[image unlockFocus];
NSData *data = [image TIFFRepresentation];
[data writeToFile:name atomically:YES];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
// Insert code here to initialize your application
self.selectedTISIconRendererView.selected = YES;
[self.selectedTISIconRendererView setNeedsDisplay:YES];
self.faviconRenderView.favicon = YES;
self.faviconRenderView.selected = YES;
NSRect oldFrame = [self.faviconRenderView frame];
[self makeIconForObject:self.faviconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/BopomofoFavicon.tiff"];
[self.faviconRenderView setFrame:oldFrame];
[self.faviconRenderView setNeedsDisplay:YES];
self.bopomofoIconRenderView.textMenuIcon = NO;
self.bopomofoIconRenderView.plainBopomofoIcon = NO;
self.bopomofoIconRenderView2x.textMenuIcon = NO;
self.bopomofoIconRenderView2x.plainBopomofoIcon = NO;
[self.bopomofoIconRenderView setNeedsDisplay:YES];
[self.bopomofoIconRenderView2x setNeedsDisplay:YES];
BopomofoIconRenderView *iconRenderView = [[[BopomofoIconRenderView alloc] init] autorelease];
iconRenderView.textMenuIcon = NO;
iconRenderView.plainBopomofoIcon = NO;
[self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/Bopomofo.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/Bopomofo@2x.tiff"];
iconRenderView.textMenuIcon = NO;
iconRenderView.plainBopomofoIcon = YES;
[self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/PlainBopomofo.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/PlainBopomofo@2x.tiff"];
iconRenderView.plainBopomofoIcon = NO;
iconRenderView.textMenuIcon = YES;
[self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/BopomofoTextMenu.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/BopomofoTextMenu@2x.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(16, 16) filename:@"/tmp/icon_16x16.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/icon_16x16@2x.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(32, 32) filename:@"/tmp/icon_32x32.tiff"];
[self makeIconForObject:iconRenderView size:NSMakeSize(64, 64) filename:@"/tmp/icon_32x32@2x.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(128, 128) filename:@"/tmp/icon_128x128.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(256, 256) filename:@"/tmp/icon_128x128@2x.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(256, 256) filename:@"/tmp/icon_256x256.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(512, 512) filename:@"/tmp/icon_256x256@2x.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(512, 512) filename:@"/tmp/icon_512x512.tiff"];
[self makeIconForObject:@"AppIconRendererView" size:NSMakeSize(1024, 1024) filename:@"/tmp/icon_512x512@2x.tiff"];
NSRunAlertPanel(@"Icons Generated", @"TIFF files are placed in /tmp", @"Dismiss", nil, nil);
}
@end

View File

@ -1,42 +0,0 @@
//
// ImageZoomInView.h
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
@interface ImageZoomInView : NSView
{
NSRect imageBoundRect;
}
@property (nonatomic, retain) NSImage *image;
@end

View File

@ -1,77 +0,0 @@
//
// ImageZoomInView.m
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import "ImageZoomInView.h"
#import "TISIconRendererView.h"
@implementation ImageZoomInView
@synthesize image;
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
image = [[NSImage alloc] initWithSize:NSMakeSize(16.0, 16.0)];
[image lockFocus];
imageBoundRect = NSMakeRect(0.0, 0.0, 16.0, 16.0);
// [[NSColor clearColor] setFill];
// [NSBezierPath fillRect:imageBoundRect];
TISIconRendererView *rendererView = [[TISIconRendererView alloc] initWithFrame:imageBoundRect];
[rendererView drawRect:imageBoundRect];
[image unlockFocus];
}
return self;
}
- (void)dealloc
{
[image release];
[super dealloc];
}
- (void)drawRect:(NSRect)dirtyRect
{
[[NSColor blackColor] setStroke];
[NSBezierPath strokeRect:[self bounds]];
[image drawInRect:[self bounds] fromRect:imageBoundRect operation:NSCompositeSourceOver fraction:1.0];
}
@end

View File

@ -1,40 +0,0 @@
//
// TISIconRendererView.h
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
@interface TISIconRendererView : NSView
@property (nonatomic, assign) BOOL favicon;
@property (nonatomic, assign) BOOL selected;
@end

View File

@ -1,116 +0,0 @@
//
// TISIconRendererView.m
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import "TISIconRendererView.h"
@implementation TISIconRendererView
@synthesize selected;
@synthesize favicon;
- (void)drawRect:(NSRect)dirtyRect
{
NSRect boundsRect = [self bounds];
if (favicon) {
boundsRect.origin.x += 0.0;
boundsRect.origin.y += 1.0;
boundsRect.size.width -= 1.0;
boundsRect.size.height -= 2.0;
NSBezierPath *roundRectPath = [NSBezierPath bezierPathWithRoundedRect:boundsRect xRadius:1 yRadius:2];
[[NSColor grayColor] setFill];
[roundRectPath fill];
boundsRect.origin.x += 0.0;
boundsRect.origin.y += 1.0;
boundsRect.size.width -= 1.0;
boundsRect.size.height -= 1.0;
}
else {
boundsRect.origin.x += 0.0;
boundsRect.origin.y += 1.0;
boundsRect.size.width -= 1.0;
boundsRect.size.height -= 1.0;
}
NSInteger fontSize = 16;
if (favicon) {
fontSize = 11;
}
NSString *text = @"ㄅ";
NSString *fontName = @"LiSong Pro";
NSColor *textColor = nil;
NSColor *shadowColor = nil;
if (!selected) {
textColor = [NSColor blackColor];
shadowColor = [NSColor colorWithDeviceWhite:0.9 alpha:0.9];
}
else {
shadowColor = [NSColor darkGrayColor];
textColor = [NSColor colorWithDeviceWhite:1.0 alpha:1.0];
}
NSShadow *textShadow = [[NSShadow alloc] init];
[textShadow setShadowColor:shadowColor];
[textShadow setShadowOffset:NSMakeSize(-1, -1)];
NSMutableDictionary *attrDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
textColor, NSForegroundColorAttributeName,
textShadow, NSShadowAttributeName,
[NSFont fontWithName:fontName size:fontSize], NSFontAttributeName,
nil];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:text attributes:attrDict];
NSRect textBounds = [attrString boundingRectWithSize:boundsRect.size options:NSStringDrawingUsesLineFragmentOrigin];
NSPoint textOrigin;
textOrigin.x = boundsRect.origin.x + (boundsRect.size.width - textBounds.size.width) / 2.0;
if (favicon) {
textOrigin.x += 1;
textOrigin.y = boundsRect.origin.y;
}
else {
textOrigin.y = boundsRect.origin.y - 2;
}
attrString = [[NSAttributedString alloc] initWithString:text attributes:attrDict];
[attrString drawAtPoint:textOrigin];
}
@end

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
//
// main.m
//
// Copyright (c) 2011 The McBopomofo Project.
//
// Contributors:
// Mengjuei Hsieh (@mjhsieh)
// Weizhong Yang (@zonble)
//
// Based on the Syrup Project and the Formosana Library
// by Lukhnos Liu (@lukhnos).
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **)argv);
}