Skip to content

Commit

Permalink
Fix indentation(Tab -> Space).
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Mar 7, 2014
1 parent 5e7b3ad commit c27708f
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 206 deletions.
@@ -1,30 +1,30 @@
{\rtf1\ansi\ansicpg932\cocoartf1138\cocoasubrtf510
{\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf190
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720

\f0\b\fs24 \cf0 Engineering:
\b0 \
kishikawa katsumi\
kishikawa katsumi\
\

\b Human Interface Design:
\b0 \
kishikawa katsumi\
kishikawa katsumi\
\

\b Testing:
\b0 \
kishikawa katsumi\
kishikawa katsumi\
\

\b Documentation:
\b0 \
kishikawa katsumi\
kishikawa katsumi\
\

\b With special thanks to:
\b0 \
kishikawa asami\
kishikawa asami\
}
2 changes: 1 addition & 1 deletion Examples/Shared/SETwitterHelper.m
Expand Up @@ -52,7 +52,7 @@ - (NSAttributedString *)attributedStringWithTweet:(NSDictionary *)tweet
UIColor *cashtagColor = [UIColor grayColor];
NSColor *linkColor = [NSColor blueColor];

NSDictionary *attributes = @{(id)kCTForegroundColorAttributeName: (id)tweetColor.CGColor, (id)kCTFontAttributeName: (__bridge id)tweetfont};
NSDictionary *attributes = @{(id)kCTForegroundColorAttributeName: (id)tweetColor.CGColor, (id)kCTFontAttributeName: (__bridge id)tweetfont};
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text attributes:attributes];
CFRelease(tweetfont);

Expand Down
18 changes: 9 additions & 9 deletions Examples/iOS/RichTextEditor/RichTextEditor/SEViewController.m
Expand Up @@ -143,15 +143,15 @@ - (void)keyboardWillShow:(NSNotification *)notification
{
self.scrollView.scrollEnabled = NO;

CGRect keyboardBounds;
CGRect keyboardBounds;
[notification.userInfo[UIKeyboardFrameEndUserInfoKey] getValue:&keyboardBounds];
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];

CGRect containerFrame = self.scrollView.frame;
CGRect containerFrame = self.scrollView.frame;
containerFrame.size.height = CGRectGetHeight(self.view.bounds) - CGRectGetHeight(keyboardBounds);

self.scrollView.frame = containerFrame;
self.scrollView.frame = containerFrame;

self.scrollView.scrollEnabled = YES;
}
Expand All @@ -160,15 +160,15 @@ - (void)keyboardWillHide:(NSNotification *)notification
{
self.scrollView.scrollEnabled = NO;

CGRect keyboardBounds;
CGRect keyboardBounds;
[notification.userInfo[UIKeyboardFrameEndUserInfoKey] getValue:&keyboardBounds];
keyboardBounds = [self.view convertRect:keyboardBounds toView:nil];

CGRect containerFrame = self.scrollView.frame;
CGRect containerFrame = self.scrollView.frame;
containerFrame.size.height = CGRectGetHeight(self.view.bounds) - CGRectGetHeight(keyboardBounds);
self.scrollView.frame = containerFrame;
self.scrollView.frame = containerFrame;

self.scrollView.scrollEnabled = YES;
}
Expand Down
4 changes: 2 additions & 2 deletions Lib/SECompatibility.m
Expand Up @@ -18,9 +18,9 @@ - (CGColorRef)createCGColor
const NSInteger numberOfComponents = [self numberOfComponents];
CGFloat components[numberOfComponents];
CGColorSpaceRef colorSpace = [[self colorSpace] CGColorSpace];
[self getComponents:(CGFloat *)&components];
return CGColorCreate(colorSpace, components);
}

Expand Down
14 changes: 7 additions & 7 deletions Lib/SETextAttachment.h
Expand Up @@ -12,8 +12,8 @@
#if !TARGET_OS_IPHONE
#if !defined(MAC_OS_X_VERSION_10_9) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
enum {
kCTRunDelegateVersion1 = 1,
kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1
kCTRunDelegateVersion1 = 1,
kCTRunDelegateCurrentVersion = kCTRunDelegateVersion1
};

typedef void (*CTRunDelegateDeallocateCallback) (void *refCon);
Expand All @@ -22,11 +22,11 @@ typedef CGFloat (*CTRunDelegateGetDescentCallback) (void *refCon);
typedef CGFloat (*CTRunDelegateGetWidthCallback) (void *refCon);

typedef struct {
CFIndex version;
CTRunDelegateDeallocateCallback dealloc;
CTRunDelegateGetAscentCallback getAscent;
CTRunDelegateGetDescentCallback getDescent;
CTRunDelegateGetWidthCallback getWidth;
CFIndex version;
CTRunDelegateDeallocateCallback dealloc;
CTRunDelegateGetAscentCallback getAscent;
CTRunDelegateGetDescentCallback getDescent;
CTRunDelegateGetWidthCallback getWidth;
} CTRunDelegateCallbacks;

typedef const struct __CTRunDelegate * CTRunDelegateRef;
Expand Down
2 changes: 1 addition & 1 deletion Lib/SETextInput.m
Expand Up @@ -29,7 +29,7 @@ - (UITextPosition *)start

- (UITextPosition *)end
{
return [SETextPosition positionWithIndex:self.range.location + self.range.length];
return [SETextPosition positionWithIndex:self.range.location + self.range.length];
}

- (BOOL)isEmpty
Expand Down
50 changes: 25 additions & 25 deletions Lib/SETextLayout.m
Expand Up @@ -107,21 +107,21 @@ - (void)createFrame
}

CGRect frameRect = _bounds;
CGSize frameSize = CTFramesetterSuggestFrameSizeWithConstraints(_framesetter,
CGSize frameSize = CTFramesetterSuggestFrameSizeWithConstraints(_framesetter,
CFRangeMake(0, _attributedString.length),
NULL,
CGSizeMake(frameRect.size.width, CGFLOAT_MAX),
NULL);
if (self.isEditing) {
frameSize.height += [[UIFont systemFontOfSize:[UIFont labelFontSize]] leading]; // Workaround
}
frameRect.origin.y = CGRectGetMaxY(frameRect) - frameSize.height;
frameRect.origin.y = CGRectGetMaxY(frameRect) - frameSize.height;
frameRect.size.height = frameSize.height;
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, frameRect);
_frame = CTFramesetterCreateFrame(_framesetter, CFRangeMake(0, 0), path, NULL);
CGPathRelease(path);
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddRect(path, NULL, frameRect);
_frame = CTFramesetterCreateFrame(_framesetter, CFRangeMake(0, 0), path, NULL);
CGPathRelease(path);

_frameRect = frameRect;
#if TARGET_OS_IPHONE
Expand Down Expand Up @@ -231,7 +231,7 @@ - (void)calculateLines
#endif

CGRect drawingRect = lineRect;
if (index > 0) {
if (index > 0) {
#if TARGET_OS_IPHONE
drawingRect.origin.y = CGRectGetHeight(_bounds) - CGRectGetMaxY(lineRect);
if (self.lineBreakMode == kCTLineBreakByTruncatingTail && drawingRect.origin.y < 0.0f) {
Expand All @@ -244,7 +244,7 @@ - (void)calculateLines
break;
}
#endif
}
}

SELineLayout *lineLayout = [[SELineLayout alloc] initWithLine:line index:index rect:lineRect metrics:metrics];
lineLayout.drawingRect = drawingRect;
Expand Down Expand Up @@ -294,9 +294,9 @@ - (void)calculateLines
drawingRect.origin.x = rect.origin.x;
drawingRect.size.width = rect.size.width;
truncationLineLayout.drawingRect = drawingRect;
CGFloat truncationTokenWidth = CTLineGetTypographicBounds(truncationToken, NULL, NULL, NULL);
truncationLineLayout.truncationTokenWidth = truncationTokenWidth;
truncationLineLayout.truncationTokenWidth = truncationTokenWidth;

truncationLineLayout.truncated = YES;
[lineLayouts replaceObjectAtIndex:truncatedLineIndex withObject:truncationLineLayout];
Expand All @@ -323,7 +323,7 @@ - (void)drawFrameInContext:(CGContextRef)context
CGContextScaleCTM(context, 1.0, -1.0);
#endif

CGContextSetTextMatrix(context, CGAffineTransformIdentity);
CGContextSetTextMatrix(context, CGAffineTransformIdentity);

if (self.lineBreakMode == kCTLineBreakByTruncatingTail) {
NSArray *lineLayouts = self.lineLayouts;
Expand Down Expand Up @@ -363,23 +363,23 @@ - (CFIndex)stringIndexForPosition:(CGPoint)point

- (CFIndex)stringIndexForClosestPosition:(CGPoint)point
{
NSString *text = self.attributedString.string;
NSString *text = self.attributedString.string;
CFIndex lineNumber = 0;
for (SELineLayout *lineLayout in self.lineLayouts) {
if ([lineLayout containsPoint:point]) {
CFIndex index = [lineLayout stringIndexForPosition:point];
if (index < text.length) {
unichar c = [text characterAtIndex:index];
if (CFStringIsSurrogateLowCharacter(c)) {
index++;
if ((0xDDE6 <= c && c <= 0xDDFF) || c == 0x20E3) {
index += 2;
}
}
}
if (index < text.length) {
unichar c = [text characterAtIndex:index];
if (CFStringIsSurrogateLowCharacter(c)) {
index++;
if ((0xDDE6 <= c && c <= 0xDDFF) || c == 0x20E3) {
index += 2;
}
}
}
if (index != kCFNotFound) {
return index;
}
Expand Down
72 changes: 36 additions & 36 deletions Lib/SETextMagnifierCaret.m
Expand Up @@ -28,14 +28,14 @@ @implementation SETextMagnifierCaret
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
if (self) {
self.backgroundColor = [UIColor clearColor];

UIImage *mask = [UIImage imageNamed:@"SECoreTextView.bundle/kb-loupe-mask"];
self.mask = mask;
self.mask = mask;

self.loupe = [UIImage imageNamed:@"SECoreTextView.bundle/kb-loupe-hi"];
self.loupeFrame = [UIImage imageNamed:@"SECoreTextView.bundle/kb-loupe-lo"];
self.loupe = [UIImage imageNamed:@"SECoreTextView.bundle/kb-loupe-hi"];
self.loupeFrame = [UIImage imageNamed:@"SECoreTextView.bundle/kb-loupe-lo"];

CGImageRef maskImageRef = self.mask.CGImage;
_maskRef = CGImageMaskCreate(CGImageGetWidth(maskImageRef),
Expand All @@ -46,9 +46,9 @@ - (id)initWithFrame:(CGRect)frame
CGImageGetDataProvider(maskImageRef),
NULL,
true);
}
}

return self;
return self;
}

- (void)dealloc
Expand All @@ -58,7 +58,7 @@ - (void)dealloc

- (void)setTouchPoint:(CGPoint)point
{
_touchPoint = point;
_touchPoint = point;
self.center = CGPointMake(point.x, point.y - 65);
}

Expand Down Expand Up @@ -96,7 +96,7 @@ - (void)showInView:(UIView *)view atPoint:(CGPoint)point

- (void)moveToPoint:(CGPoint)point
{
self.touchPoint = point;
self.touchPoint = point;
[self setNeedsDisplay];
}

Expand Down Expand Up @@ -124,34 +124,34 @@ - (void)hide

- (void)drawRect:(CGRect)rect
{
UIGraphicsBeginImageContext(self.magnifyToView.bounds.size);
[self.magnifyToView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *captureImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

CGImageRef captureImageRef = captureImage.CGImage;

CGFloat scale = 1.2f;
CGRect box = CGRectMake(ceilf(self.touchPoint.x - self.mask.size.width / scale / 2),
ceilf(self.touchPoint.y - self.mask.size.height / scale / 2),
ceilf(self.mask.size.width / scale),
ceilf(self.mask.size.height / scale));
UIGraphicsBeginImageContext(self.magnifyToView.bounds.size);
[self.magnifyToView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *captureImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

CGImageRef captureImageRef = captureImage.CGImage;

CGFloat scale = 1.2f;
CGRect box = CGRectMake(ceilf(self.touchPoint.x - self.mask.size.width / scale / 2),
ceilf(self.touchPoint.y - self.mask.size.height / scale / 2),
ceilf(self.mask.size.width / scale),
ceilf(self.mask.size.height / scale));

CGImageRef subImage = CGImageCreateWithImageInRect(captureImageRef, box);
CGImageRef maskedImage = CGImageCreateWithMask(subImage, _maskRef);

CGContextRef context = UIGraphicsGetCurrentContext();

CGAffineTransform xform = CGAffineTransformMake(1.0, 0.0,
0.0, -1.0,
0.0, 0.0);
CGContextConcatCTM(context, xform);

CGRect area = CGRectMake(0, 0, self.mask.size.width, -self.mask.size.height);

CGImageRef subImage = CGImageCreateWithImageInRect(captureImageRef, box);
CGImageRef maskedImage = CGImageCreateWithMask(subImage, _maskRef);

CGContextRef context = UIGraphicsGetCurrentContext();

CGAffineTransform xform = CGAffineTransformMake(1.0, 0.0,
0.0, -1.0,
0.0, 0.0);
CGContextConcatCTM(context, xform);

CGRect area = CGRectMake(0, 0, self.mask.size.width, -self.mask.size.height);

CGContextDrawImage(context, area, self.loupeFrame.CGImage);
CGContextDrawImage(context, area, maskedImage);
CGContextDrawImage(context, area, self.loupe.CGImage);
CGContextDrawImage(context, area, self.loupeFrame.CGImage);
CGContextDrawImage(context, area, maskedImage);
CGContextDrawImage(context, area, self.loupe.CGImage);

CGImageRelease(subImage);
CGImageRelease(maskedImage);
Expand Down

0 comments on commit c27708f

Please sign in to comment.