Permalink
Browse files

Format and style fix

  • Loading branch information...
1 parent 3ea054c commit e799f6617544b72c2f4d4642e860f7e9cd0e75f2 @jjgod committed Jul 17, 2012
Showing with 19 additions and 19 deletions.
  1. +0 −1 AppController.h
  2. +0 −1 AppController.mm
  3. +0 −1 ExtendedAttributes.h
  4. +2 −1 ExtendedAttributes.m
  5. +2 −3 README.markdown
  6. +1 −2 TTDocument.h
  7. +1 −1 TTDocument.mm
  8. +0 −1 TTTextView.h
  9. +13 −7 TTTextView.mm
  10. +0 −1 main.m
View
1 AppController.h
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jjgod Jiang on 3/16/09.
-// Copyright 2009 Jjgod Jiang. All rights reserved.
//
#import <Cocoa/Cocoa.h>
View
1 AppController.mm
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jjgod Jiang on 3/16/09.
-// Copyright 2009 Jjgod Jiang. All rights reserved.
//
#import "AppController.h"
View
1 ExtendedAttributes.h
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jiang Jiang on 9/18/09.
-// Copyright 2009 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
View
3 ExtendedAttributes.m
@@ -86,7 +86,8 @@ - (void) setString: (NSString *) str forXattrKey: (NSString *) key
NSData *data = [str dataUsingEncoding: NSUTF8StringEncoding];
if (!data)
- [NSException raise: NSCharacterConversionException format: @"Couldn't convert string to UTF8 for xattr storage."];
+ [NSException raise: NSCharacterConversionException
+ format: @"Couldn't convert string to UTF8 for xattr storage."];
[self setData: data forXattrKey: key];
}
View
5 README.markdown
@@ -8,8 +8,7 @@ TODO
* Vertical layout
* On-demand layout (according to pages)
-* Invalid layout on window resizing (partially finished)
* Use hash value to do on-demand layout
-* Use Universal Charset Detector to detect file encodings
* Foreground/background colors
-
+* Bookmarks
+* Markdown
View
3 TTDocument.h
@@ -3,12 +3,11 @@
// Textus
//
// Created by Jjgod Jiang on 2/16/09.
-// Copyright Jjgod Jiang 2009 . All rights reserved.
//
#import <Cocoa/Cocoa.h>
-#import "TTTextView.h"
+@class TTTextView;
@interface TTDocument : NSDocument
{
IBOutlet TTTextView *textView;
View
2 TTDocument.mm
@@ -3,13 +3,13 @@
// Textus
//
// Created by Jjgod Jiang on 2/16/09.
-// Copyright Jjgod Jiang 2009-2010. All rights reserved.
//
#import "AppController.h"
#import "TTDocument.h"
#import "ExtendedAttributes.h"
#import "chardetect.h"
+#import "TTTextView.h"
#define kLastReadLocationKey @"org.jjgod.textus.lastReadLocation"
View
1 TTTextView.h
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jjgod Jiang on 3/16/09.
-// Copyright 2009 Jjgod Jiang. All rights reserved.
//
#import <Cocoa/Cocoa.h>
View
20 TTTextView.mm
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jjgod Jiang on 3/16/09.
-// Copyright 2009 Jjgod Jiang. All rights reserved.
//
#import "TTTextView.h"
@@ -13,6 +12,7 @@
#define kMaxLinesPerFrame 256
#define MAX_LINES(total) (total > kMaxLinesPerFrame ? kMaxLinesPerFrame : total)
#define JJ_CUSTOM_FRAMESETTER 1
+// #define TT_LAYOUT_TIMING 1
@implementation TTTextView
@@ -71,8 +71,11 @@ - (void) invalidateLayout
[self removeAllLines];
+#ifdef TT_LAYOUT_TIMING
struct timeval tv1, tv2;
gettimeofday(&tv1, 0);
+#endif
+
#ifdef JJ_CUSTOM_FRAMESETTER
CGFloat fontSize = CTFontGetSize(font);
CFStringRef str = (CFStringRef) document.fileContentsInPlainText;
@@ -94,11 +97,11 @@ - (void) invalidateLayout
if (secondCharInNextLineIndex < text.length) {
UniChar ch = CFStringGetCharacterAtIndex(str, secondCharInNextLineIndex);
// TODO: handle ⋯⋯” at the beginning of next line
- if ((ch == 0xFF0C /* , */ || ch == 0x3002 /* 。 */ ||
- ch == 0x3001 /* 、 */ || ch == 0xFF01 /* ! */ ||
- ch == 0xFF1A /* : */ || ch == 0xFF1B /* ; */ ||
- ch == 0x201D /* ” */) || ch == 0x201C /* “ */ ||
- ch == 0x300C /* 「 */ || ch == 0xFF1F /* ? */) {
+ if (ch == 0xFF0C /* , */ || ch == 0x3002 /* 。 */ ||
+ ch == 0x3001 /* 、 */ || ch == 0xFF01 /* ! */ ||
+ ch == 0xFF1A /* : */ || ch == 0xFF1B /* ; */ ||
+ ch == 0x201D /* ” */ || ch == 0x201C /* “ */ ||
+ ch == 0x300C /* 「 */ || ch == 0xFF1F /* ? */) {
CFRelease(lineData.line);
length += (ch == 0x201C || ch == 0x300C) ? 1 : 2;
@@ -168,9 +171,12 @@ - (void) invalidateLayout
CFRelease(framesetter);
#endif
+
+#ifdef TT_LAYOUT_TIMING
gettimeofday(&tv2, 0);
int msec = (tv2.tv_sec - tv1.tv_sec) * 1000 + (tv2.tv_usec - tv1.tv_usec) / 1000;
- // NSLog(@"time used = %d msecs", msec);
+ NSLog(@"time used = %d msecs", msec);
+#endif
NSRect newFrame = [self frame];
newFrame.size.height = lineData.origin.y + textInset.height;
View
1 main.m
@@ -3,7 +3,6 @@
// Textus
//
// Created by Jjgod Jiang on 2/16/09.
-// Copyright Jjgod Jiang 2009 . All rights reserved.
//
#import <Cocoa/Cocoa.h>

0 comments on commit e799f66

Please sign in to comment.