Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor file names

  • Loading branch information...
commit e742f81458b900699e7b94e746e916d1afcf6b7e 1 parent 1b6fc03
@jjgod authored
View
1  .gitignore
@@ -1,3 +1,4 @@
*.pbxuser
*.perspectivev3
+.DS_Store
build/
View
1  AppController.m
@@ -7,7 +7,6 @@
//
#import "AppController.h"
-#import "TextDocument.h"
int hexNum(char ch)
{
View
112 English.lproj/TextDocument.xib → English.lproj/TTDocument.xib
@@ -2,35 +2,29 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10B504</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
- <string key="IBDocument.AppKitVersion">1038.2</string>
- <string key="IBDocument.HIToolboxVersion">437.00</string>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">804</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">732</string>
+ <string key="NS.object.0">804</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="512844837">
- <string key="NSClassName">TextDocument</string>
+ <string key="NSClassName">TTDocument</string>
</object>
<object class="NSCustomObject" id="613418571">
<string key="NSClassName">FirstResponder</string>
@@ -46,7 +40,7 @@
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<string key="NSWindowContentMinSize">{94, 86}</string>
<object class="NSView" key="NSWindowView" id="568628114">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -65,7 +59,7 @@
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{800, 679}</string>
<reference key="NSSuperview" ref="479699895"/>
- <string key="NSClassName">JJTextView</string>
+ <string key="NSClassName">TTTextView</string>
</object>
</object>
<string key="NSFrame">{{1, 1}, {800, 679}}</string>
@@ -114,7 +108,6 @@
</object>
</object>
<string key="NSFrameSize">{800, 700}</string>
- <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{94, 108}</string>
@@ -160,7 +153,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <reference key="object" ref="0"/>
+ <object class="NSArray" key="object" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="children" ref="580458321"/>
<nil key="parent"/>
</object>
@@ -295,38 +290,27 @@
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">JJTextView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="368465059">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">JJTextView.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">JJTextView</string>
- <string key="superclassName">NSView</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier" id="109171031">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">TextDocument.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TextDocument</string>
- <string key="superclassName">NSDocument</string>
- <reference key="sourceIdentifier" ref="368465059"/>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">TextDocument</string>
+ <string key="className">TTDocument</string>
<string key="superclassName">NSDocument</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">textView</string>
- <string key="NS.object.0">JJTextView</string>
+ <string key="NS.object.0">TTTextView</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">textView</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">textView</string>
+ <string key="candidateClassName">TTTextView</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
</object>
- <reference key="sourceIdentifier" ref="109171031"/>
</object>
<object class="IBPartialClassDescription">
- <string key="className">TextDocument</string>
- <string key="superclassName">NSDocument</string>
+ <string key="className">TTTextView</string>
+ <string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
@@ -418,6 +402,45 @@
<string>id</string>
</object>
</object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>printDocument:</string>
+ <string>revertDocumentToSaved:</string>
+ <string>runPageLayout:</string>
+ <string>saveDocument:</string>
+ <string>saveDocumentAs:</string>
+ <string>saveDocumentTo:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBActionInfo">
+ <string key="name">printDocument:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">revertDocumentToSaved:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">runPageLayout:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocument:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentAs:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
+ <string key="name">saveDocumentTo:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDocument.h</string>
@@ -780,6 +803,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
View
2  Info.plist
@@ -22,7 +22,7 @@
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
- <string>TextDocument</string>
+ <string>TTDocument</string>
<key>NSTypeName</key>
<string>Plain Text Format</string>
</dict>
View
19 TextDocument.h → TTDocument.h
@@ -7,24 +7,11 @@
//
#import <Cocoa/Cocoa.h>
+#import "TTTextView.h"
-@class TextDocument;
-
-@interface JJTextView : NSView
-
-@property (assign) NSSize textInset;
-@property (retain) NSColor *backgroundColor;
-@property (assign) TextDocument *document;
-
-- (void) invalidateLayout;
-- (void) scrollToLine: (NSUInteger) line;
-- (void) doPartialLayoutWithMaximumHeight: (CGFloat) height aroundLine: (NSUInteger) line;
-
-@end
-
-@interface TextDocument : NSDocument
+@interface TTDocument : NSDocument
{
- IBOutlet JJTextView *textView;
+ IBOutlet TTTextView *textView;
NSStringEncoding GB18030Encoding;
NSMutableAttributedString *fileContents;
NSString *fileContentsInPlainText;
View
8 TextDocument.m → TTDocument.mm
@@ -1,5 +1,5 @@
//
-// MyDocument.m
+// TTDocument.m
// Textus
//
// Created by Jjgod Jiang on 2/16/09.
@@ -7,7 +7,7 @@
//
#import "AppController.h"
-#import "TextDocument.h"
+#import "TTDocument.h"
#import "ExtendedAttributes.h"
#import <CommonCrypto/CommonDigest.h>
@@ -42,7 +42,7 @@ - (NSString *) MD5Hash
@end
-@implementation TextDocument
+@implementation TTDocument
@synthesize fileContents, fileContentsInPlainText;
@synthesize lastReadLine, lastLayoutHeight;
@@ -98,7 +98,7 @@ - (void) saveMetaData
- (NSString *) windowNibName
{
- return @"TextDocument";
+ return @"TTDocument";
}
- (void) windowControllerDidLoadNib: (NSWindowController *) aController
View
29 TTPage.h
@@ -0,0 +1,29 @@
+//
+// TTPage.h
+// Textus
+//
+// Created by Jiang Jiang on 4/20/10.
+// Copyright 2010 Jjgod Jiang. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface TTPage : NSObject {
+ CGRect frame;
+ CFRange textRange;
+ CTFramesetterRef framesetter;
+ CFArrayRef lines;
+ CGFloat lineHeight, lineAscent;
+ BOOL drawn;
+}
+
+- (id) initWithContents: (CFAttributedStringRef) contents atRange: (CFRange) initialRange inFrame: (CGRect) theFrame;
+
+- (CGFloat) height;
+
+@property (readonly) CFRange textRange;
+@property (readonly) CFArrayRef lines;
+@property (readonly) CGFloat lineHeight, lineAscent;
+@property (assign) BOOL drawn;
+
+@end
View
67 TTPage.m
@@ -0,0 +1,67 @@
+//
+// TTPage.m
+// Textus
+//
+// Created by Jiang Jiang on 4/20/10.
+// Copyright 2010 Jjgod Jiang. All rights reserved.
+//
+
+#import "TTPage.h"
+
+@implementation TTPage
+
+@synthesize textRange, lines, lineHeight, lineAscent, drawn;
+
+- (id) initWithContents: (CFAttributedStringRef) contents
+ atRange: (CFRange) initialRange
+ inFrame: (CGRect) theFrame
+{
+ if (self = [super init])
+ {
+ NSLog(@"Creating page with range: %d, %d (%gx%g)", initialRange.location, initialRange.length,
+ theFrame.size.width, theFrame.size.height);
+ CFAttributedStringRef substring = CFAttributedStringCreateWithSubstring(0, contents, initialRange);
+ CTFontRef font = CFAttributedStringGetAttribute(contents, 0, kCTFontAttributeName, NULL);
+ lineHeight = CTFontGetAscent(font) + CTFontGetDescent(font) + CTFontGetLeading(font);
+ lineHeight *= [[NSUserDefaults standardUserDefaults] doubleForKey: @"lineHeight"];
+ lineHeight = ceil(lineHeight);
+ NSLog(@"lineHeight = %g", lineHeight);
+
+ lineAscent = CTFontGetAscent(font);
+ drawn = NO;
+
+ framesetter = CTFramesetterCreateWithAttributedString(substring);
+ CFRelease(substring);
+
+ frame = theFrame;
+ if (framesetter)
+ {
+ CGMutablePathRef path = CGPathCreateMutable();
+ CGPathAddRect(path, NULL, frame);
+ CTFrameRef textFrame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
+ lines = CFRetain(CTFrameGetLines(textFrame));
+
+ CFRelease(path);
+ textRange = CTFrameGetVisibleStringRange(textFrame);
+ // NSLog(@"textRange: %d, %d", textRange.location, textRange.length);
+ textRange.location = initialRange.location;
+ CFRelease(textFrame);
+ CFRelease(framesetter);
+ }
+ }
+ return self;
+}
+
+- (CGFloat) height
+{
+ return lineHeight * CFArrayGetCount(lines);
+}
+
+- (void) dealloc
+{
+ if (lines)
+ CFRelease(lines);
+ [super dealloc];
+}
+
+@end
View
17 JJTextView.h → TTTextView.h
@@ -16,25 +16,16 @@ typedef struct LineData {
CGPoint origin;
} JJLineData;
-@interface TextDocument : NSDocument
+@class TTDocument;
-@property (retain) NSMutableAttributedString *fileContents;
-@property (retain) NSString *fileContentsInPlainText;
-@property (assign) NSUInteger lastReadLine;
-
-- (NSDictionary *) attributesForText;
-- (void) saveMetaData;
-
-@end
-
-@interface JJTextView : NSView {
+@interface TTTextView : NSView {
NSSize textInset;
vector<JJLineData> textLines;
- TextDocument *document;
+ TTDocument *document;
}
@property (assign) NSSize textInset;
-@property (assign) TextDocument *document;
+@property (assign) TTDocument *document;
- (void) invalidateLayout;
- (void) scrollToLine: (NSUInteger) line;
View
5 JJTextView.mm → TTTextView.mm
@@ -6,14 +6,15 @@
// Copyright 2009 Jjgod Jiang. All rights reserved.
//
-#import "JJTextView.h"
+#import "TTTextView.h"
+#import "TTDocument.h"
#import <time.h>
#define kMaxLinesPerFrame 256
#define MAX_LINES(total) (total > kMaxLinesPerFrame ? kMaxLinesPerFrame : total)
-@implementation JJTextView
+@implementation TTTextView
@synthesize textInset;
@synthesize document;
View
43 Textus.xcodeproj/project.pbxproj
@@ -10,12 +10,12 @@
0728CDEC102817BC0060E2F2 /* Textus.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0728CDEB102817BC0060E2F2 /* Textus.icns */; };
074880B610636E6900C91C75 /* ExtendedAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 074880B510636E6900C91C75 /* ExtendedAttributes.m */; };
07AF47CE0F6E3EFA00558BF4 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 07AF47CD0F6E3EFA00558BF4 /* AppController.m */; };
- 07AF48FD0F6E5D6900558BF4 /* JJTextView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07AF48FC0F6E5D6900558BF4 /* JJTextView.mm */; };
- 1DDD582C0DA1D0D100B32029 /* TextDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* TextDocument.xib */; };
+ 07AF48FD0F6E5D6900558BF4 /* TTTextView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07AF48FC0F6E5D6900558BF4 /* TTTextView.mm */; };
+ 1DDD582C0DA1D0D100B32029 /* TTDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58280DA1D0D100B32029 /* TTDocument.xib */; };
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
- 8D15AC310486D014006FF6A4 /* TextDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* TextDocument.m */; settings = {ATTRIBUTES = (); }; };
+ 8D15AC310486D014006FF6A4 /* TTDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* TTDocument.mm */; settings = {ATTRIBUTES = (); }; };
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@@ -26,15 +26,15 @@
074880B510636E6900C91C75 /* ExtendedAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtendedAttributes.m; sourceTree = "<group>"; };
07AF47CC0F6E3EFA00558BF4 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
07AF47CD0F6E3EFA00558BF4 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
- 07AF48FB0F6E5D6900558BF4 /* JJTextView.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = JJTextView.h; sourceTree = "<group>"; };
- 07AF48FC0F6E5D6900558BF4 /* JJTextView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JJTextView.mm; sourceTree = "<group>"; };
+ 07AF48FB0F6E5D6900558BF4 /* TTTextView.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TTTextView.h; sourceTree = "<group>"; };
+ 07AF48FC0F6E5D6900558BF4 /* TTTextView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TTTextView.mm; sourceTree = "<group>"; };
089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
- 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TextDocument.xib; sourceTree = "<group>"; };
+ 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TTDocument.xib; sourceTree = "<group>"; };
1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
- 2A37F4ACFDCFA73011CA2CEA /* TextDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextDocument.m; sourceTree = "<group>"; };
- 2A37F4AEFDCFA73011CA2CEA /* TextDocument.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = TextDocument.h; sourceTree = "<group>"; };
+ 2A37F4ACFDCFA73011CA2CEA /* TTDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TTDocument.mm; sourceTree = "<group>"; };
+ 2A37F4AEFDCFA73011CA2CEA /* TTDocument.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = TTDocument.h; sourceTree = "<group>"; };
2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = "<group>"; };
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
@@ -99,10 +99,10 @@
children = (
07AF47CC0F6E3EFA00558BF4 /* AppController.h */,
07AF47CD0F6E3EFA00558BF4 /* AppController.m */,
- 2A37F4AEFDCFA73011CA2CEA /* TextDocument.h */,
- 2A37F4ACFDCFA73011CA2CEA /* TextDocument.m */,
- 07AF48FB0F6E5D6900558BF4 /* JJTextView.h */,
- 07AF48FC0F6E5D6900558BF4 /* JJTextView.mm */,
+ 2A37F4AEFDCFA73011CA2CEA /* TTDocument.h */,
+ 2A37F4ACFDCFA73011CA2CEA /* TTDocument.mm */,
+ 07AF48FB0F6E5D6900558BF4 /* TTTextView.h */,
+ 07AF48FC0F6E5D6900558BF4 /* TTTextView.mm */,
074880B410636E6900C91C75 /* ExtendedAttributes.h */,
074880B510636E6900C91C75 /* ExtendedAttributes.m */,
);
@@ -125,7 +125,7 @@
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
8D15AC360486D014006FF6A4 /* Info.plist */,
089C165FFE840EACC02AAC07 /* InfoPlist.strings */,
- 1DDD58280DA1D0D100B32029 /* TextDocument.xib */,
+ 1DDD58280DA1D0D100B32029 /* TTDocument.xib */,
1DDD582A0DA1D0D100B32029 /* MainMenu.xib */,
);
name = Resources;
@@ -168,7 +168,14 @@
isa = PBXProject;
buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "Textus" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 2A37F4AAFDCFA73011CA2CEA /* Textus */;
projectDirPath = "";
projectRoot = "";
@@ -185,7 +192,7 @@
files = (
8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */,
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
- 1DDD582C0DA1D0D100B32029 /* TextDocument.xib in Resources */,
+ 1DDD582C0DA1D0D100B32029 /* TTDocument.xib in Resources */,
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
0728CDEC102817BC0060E2F2 /* Textus.icns in Resources */,
);
@@ -198,10 +205,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 8D15AC310486D014006FF6A4 /* TextDocument.m in Sources */,
+ 8D15AC310486D014006FF6A4 /* TTDocument.mm in Sources */,
8D15AC320486D014006FF6A4 /* main.m in Sources */,
07AF47CE0F6E3EFA00558BF4 /* AppController.m in Sources */,
- 07AF48FD0F6E5D6900558BF4 /* JJTextView.mm in Sources */,
+ 07AF48FD0F6E5D6900558BF4 /* TTTextView.mm in Sources */,
074880B610636E6900C91C75 /* ExtendedAttributes.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -217,12 +224,12 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
- 1DDD58280DA1D0D100B32029 /* TextDocument.xib */ = {
+ 1DDD58280DA1D0D100B32029 /* TTDocument.xib */ = {
isa = PBXVariantGroup;
children = (
1DDD58290DA1D0D100B32029 /* English */,
);
- name = TextDocument.xib;
+ name = TTDocument.xib;
sourceTree = "<group>";
};
1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = {
View
BIN  chardetect.a
Binary file not shown
View
130 chardetect.h
@@ -0,0 +1,130 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Universal charset detector code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 2001
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Kohei TAKETA <k-tak@void.in>
+ * Jim Huang <jserv.tw@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+#ifndef ___CHARDET_H___
+#define ___CHARDET_H___
+
+#ifdef _WIN32
+# ifdef DLL_EXPORTS
+# define CHARDET_IMEXPORT extern _declspec(dllexport)
+# else
+# define CHARDET_IMEXPORT extern _declspec(dllimport)
+# endif
+#else
+# define CHARDET_IMEXPORT extern __attribute__ ((visibility("default")))
+#endif
+
+#include <stddef.h>
+
+#define CHARDET_RESULT_DONE 1
+#define CHARDET_RESULT_OK 0
+#define CHARDET_RESULT_NOMEMORY (-1)
+#define CHARDET_RESULT_INVALID_DETECTOR (-2)
+#define CHARDET_RESULT_CANT_DETECT (-3)
+
+#define CHARDET_MAX_ENCODING_NAME 64
+
+
+typedef void* chardet_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Create an encoding detector.
+ * @param pdet [out] pointer to a chardet_t variable that receives
+ * the encoding detector handle.
+ * @return CHARDET_RESULT_OK if succeeded. CHARDET_RESULT_NOMEMORY otherwise.
+ */
+CHARDET_IMEXPORT int chardet_create(chardet_t* pdet);
+
+/**
+ * Destroy an encoding detector.
+ * @param det [in] the encoding detector handle to be destroyed.
+ */
+CHARDET_IMEXPORT void chardet_destroy(chardet_t det);
+
+/**
+ * Feed data to an encoding detector.
+ * @param det [in] the encoding detector handle
+ * @param data [in] data
+ * @param len [in] length of data in bytes.
+ * @return CHARDET_RESULT_OK if succeeded.
+ * CHARSET_RESULT_NOMEMORY if running out of memory.
+ * CHARDET_RESULT_INVALID_DETECTOR if det was invalid.
+ */
+CHARDET_IMEXPORT int chardet_handle_data(chardet_t det, const char* data, unsigned int len);
+
+/**
+ * Notify an end of data to an encoding detctor.
+ * @param det [in] the encoding detector handle
+ * @return CHARDET_RESULT_OK if succeeded.
+ * CHARDET_RESULT_INVALID_DETECTOR if det was invalid.
+ */
+CHARDET_IMEXPORT int chardet_data_end(chardet_t det);
+
+/**
+ * Reset an encoding detector.
+ * @param det [in] the encoding detector handle
+ * @return CHARDET_RESULT_OK if succeeded.
+ * CHARDET_RESULT_INVALID_DETECTOR if det was invalid.
+ */
+CHARDET_IMEXPORT int chardet_reset(chardet_t det);
+
+/**
+ * Get the name of encoding that was detected.
+ * @param det [in] the encoding detector handle
+ * @param namebuf [in/out] pointer to a buffer that receives the name of
+ * detected encoding. A valid encoding name or an empty string
+ * will be written to namebuf. If an empty strng was written,
+ * the detector could not detect any encoding.
+ * Written strings will always be NULL-terminated.
+ * @param buflen [in] length of namebuf
+ * @return CHARDET_RESULT_OK if succeeded.
+ * CHARDET_RESULT_NOMEMORY if namebuf was too small to store
+ * the entire encoding name.
+ * CHARDET_RESULT_INVALID_DETECTOR if det was invalid.
+ */
+CHARDET_IMEXPORT int chardet_get_charset(chardet_t det, char* namebuf, unsigned int buflen);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
Please sign in to comment.
Something went wrong with that request. Please try again.