Skip to content
Browse files

Gah, fix indentation style in NSTextView+TUIExtensions and TUIAnimati…

…onManager
  • Loading branch information...
1 parent d866028 commit 5d38a0fc74c33fa460f5627b3d17208269fe5e7b @jspahrsummers jspahrsummers committed Jul 22, 2012
Showing with 58 additions and 58 deletions.
  1. +20 −20 lib/Support/NSTextView+TUIExtensions.m
  2. +38 −38 lib/Support/TUIAnimationManager.m
View
40 lib/Support/NSTextView+TUIExtensions.m
@@ -1,8 +1,8 @@
//
-// NSTextView+TUIExtensions.m
+// NSTextView+TUIExtensions.m
//
-// Created by Justin Spahr-Summers on 10.03.12.
-// Copyright (c) 2012 Bitswift. All rights reserved.
+// Created by Justin Spahr-Summers on 10.03.12.
+// Copyright (c) 2012 Bitswift. All rights reserved.
//
#import "NSTextView+TUIExtensions.h"
@@ -11,36 +11,36 @@
static void (*originalDrawRectIMP)(id, SEL, NSRect);
static void fixedDrawRect (NSTextView *self, SEL _cmd, NSRect rect) {
- CGContextRef context = [NSGraphicsContext currentContext].graphicsPort;
+ CGContextRef context = [NSGraphicsContext currentContext].graphicsPort;
- CGContextSetAllowsAntialiasing(context, YES);
- CGContextSetAllowsFontSmoothing(context, YES);
- CGContextSetAllowsFontSubpixelPositioning(context, YES);
- CGContextSetAllowsFontSubpixelQuantization(context, YES);
+ CGContextSetAllowsAntialiasing(context, YES);
+ CGContextSetAllowsFontSmoothing(context, YES);
+ CGContextSetAllowsFontSubpixelPositioning(context, YES);
+ CGContextSetAllowsFontSubpixelQuantization(context, YES);
- CGContextSetShouldAntialias(context, YES);
+ CGContextSetShouldAntialias(context, YES);
// TODO: SPAA seems to stop working when text fields and text views lose
// focus, so it's disabled for now.
- CGContextSetShouldSmoothFonts(context, NO);
- CGContextSetShouldSubpixelPositionFonts(context, NO);
- CGContextSetShouldSubpixelQuantizeFonts(context, NO);
+ CGContextSetShouldSmoothFonts(context, NO);
+ CGContextSetShouldSubpixelPositionFonts(context, NO);
+ CGContextSetShouldSubpixelQuantizeFonts(context, NO);
- if (self.superview) {
- // NSTextView likes to fall on non-integral points sometimes -- fix that
- self.frame = [self.superview backingAlignedRect:self.frame options:NSAlignAllEdgesNearest];
- }
+ if (self.superview) {
+ // NSTextView likes to fall on non-integral points sometimes -- fix that
+ self.frame = [self.superview backingAlignedRect:self.frame options:NSAlignAllEdgesNearest];
+ }
- originalDrawRectIMP(self, _cmd, rect);
+ originalDrawRectIMP(self, _cmd, rect);
}
@implementation NSTextView (TUIExtensions)
+ (void)load {
- Method drawRect = class_getInstanceMethod(self, @selector(drawRect:));
- originalDrawRectIMP = (void (*)(id, SEL, NSRect))method_getImplementation(drawRect);
+ Method drawRect = class_getInstanceMethod(self, @selector(drawRect:));
+ originalDrawRectIMP = (void (*)(id, SEL, NSRect))method_getImplementation(drawRect);
- class_replaceMethod(self, method_getName(drawRect), (IMP)&fixedDrawRect, method_getTypeEncoding(drawRect));
+ class_replaceMethod(self, method_getName(drawRect), (IMP)&fixedDrawRect, method_getTypeEncoding(drawRect));
}
@end
View
76 lib/Support/TUIAnimationManager.m
@@ -1,8 +1,8 @@
//
-// TUIAnimationManager.m
+// TUIAnimationManager.m
//
-// Created by Justin Spahr-Summers on 10.03.12.
-// Copyright (c) 2012 Bitswift. All rights reserved.
+// Created by Justin Spahr-Summers on 10.03.12.
+// Copyright (c) 2012 Bitswift. All rights reserved.
//
#import "TUIAnimationManager.h"
@@ -11,7 +11,7 @@
* Disables implicit AppKit animations on every run loop iteration.
*/
static void mainRunLoopObserverCallback (CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {
- [[NSAnimationContext currentContext] setDuration:0];
+ [[NSAnimationContext currentContext] setDuration:0];
}
@interface TUIAnimationManager ()
@@ -40,18 +40,18 @@ @implementation TUIAnimationManager
@synthesize mainRunLoopObserver = m_mainRunLoopObserver;
- (void)setMainRunLoopObserver:(CFRunLoopObserverRef)observer {
- if (observer == m_mainRunLoopObserver)
- return;
+ if (observer == m_mainRunLoopObserver)
+ return;
- if (m_mainRunLoopObserver) {
- CFRunLoopRemoveObserver(CFRunLoopGetMain(), m_mainRunLoopObserver, kCFRunLoopCommonModes);
- CFRelease(m_mainRunLoopObserver);
- }
+ if (m_mainRunLoopObserver) {
+ CFRunLoopRemoveObserver(CFRunLoopGetMain(), m_mainRunLoopObserver, kCFRunLoopCommonModes);
+ CFRelease(m_mainRunLoopObserver);
+ }
- if (observer)
- CFRetain(observer);
+ if (observer)
+ CFRetain(observer);
- m_mainRunLoopObserver = observer;
+ m_mainRunLoopObserver = observer;
}
#pragma mark Lifecycle
@@ -68,47 +68,47 @@ + (void)load {
}
+ (TUIAnimationManager *)defaultManager; {
- static id singleton = nil;
- static dispatch_once_t pred;
+ static id singleton = nil;
+ static dispatch_once_t pred;
- dispatch_once(&pred, ^{
- singleton = [[self alloc] init];
- });
+ dispatch_once(&pred, ^{
+ singleton = [[self alloc] init];
+ });
- return singleton;
+ return singleton;
}
- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
- self.mainRunLoopObserver = NULL;
+ self.mainRunLoopObserver = NULL;
}
#pragma mark Run Loop Observer
- (void)registerRunLoopObserver; {
- // set up an observer on the main run loop that can disable implicit
- // animations
- CFRunLoopObserverRef observer = CFRunLoopObserverCreate(
- NULL,
- kCFRunLoopBeforeTimers,
- YES,
- 10000,
- &mainRunLoopObserverCallback,
- NULL
- );
-
- CFRunLoopAddObserver(CFRunLoopGetMain(), observer, kCFRunLoopCommonModes);
-
- self.mainRunLoopObserver = observer;
- CFRelease(observer);
+ // set up an observer on the main run loop that can disable implicit
+ // animations
+ CFRunLoopObserverRef observer = CFRunLoopObserverCreate(
+ NULL,
+ kCFRunLoopBeforeTimers,
+ YES,
+ 10000,
+ &mainRunLoopObserverCallback,
+ NULL
+ );
+
+ CFRunLoopAddObserver(CFRunLoopGetMain(), observer, kCFRunLoopCommonModes);
+
+ self.mainRunLoopObserver = observer;
+ CFRelease(observer);
}
#pragma mark Notifications
- (void)applicationDidFinishLaunchingNotification:(NSNotification *)notification; {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:notification.name object:nil];
- [self registerRunLoopObserver];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:notification.name object:nil];
+ [self registerRunLoopObserver];
}
@end

0 comments on commit 5d38a0f

Please sign in to comment.
Something went wrong with that request. Please try again.