├── .gitignore ├── .travis.yml ├── Base.lproj ├── DocumentProperties.nib │ ├── designable.nib │ └── keyedobjects.nib ├── Edit.nib │ ├── designable.nib │ └── keyedobjects.nib ├── Preferences.nib │ ├── designable.nib │ └── keyedobjects.nib ├── PrintPanelAccessory.nib │ ├── designable.nib │ └── keyedobjects.nib ├── SelectEncodingsPanel.nib │ ├── designable.nib │ └── keyedobjects.nib └── SelectLinePanel.nib │ ├── designable.nib │ └── keyedobjects.nib ├── Controller.h ├── Controller.m ├── Document.h ├── Document.m ├── DocumentController.h ├── DocumentController.m ├── DocumentPropertiesPanelController.h ├── DocumentPropertiesPanelController.m ├── DocumentWindow.nib ├── designable.nib └── keyedobjects.nib ├── DocumentWindowController.h ├── DocumentWindowController.m ├── Edit.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png ├── Edit_main.m ├── EncodingManager.h ├── EncodingManager.m ├── English.lproj ├── EncodingAccessory.nib │ ├── designable.nib │ └── keyedobjects.nib ├── InfoPlist.strings ├── LinePanel.strings ├── Localizable.strings ├── PrintAccessory.strings ├── ServicesMenu.strings └── ZoomValues.strings ├── FontNameTransformer.h ├── FontNameTransformer.m ├── Info-TextEdit.plist ├── JJTypesetter.h ├── JJTypesetter.m ├── LinePanelController.h ├── LinePanelController.m ├── MultiplePageView.h ├── MultiplePageView.m ├── OpenCC ├── libopencc.dylib ├── opencc.h ├── opencc_types.h ├── trad_to_simp_characters.ocd ├── trad_to_simp_phrases.ocd └── zht2zhs.ini ├── Preferences.h ├── Preferences.m ├── PrintPanelAccessoryController.h ├── PrintPanelAccessoryController.m ├── PrintingTextView.h ├── PrintingTextView.m ├── README.md ├── README.rtf ├── ScalingScrollView.h ├── ScalingScrollView.m ├── TextEdit Test Document.rtf ├── TextEdit.scatterload ├── TextEdit.scriptSuite ├── TextEdit.scriptTerminology ├── TextEdit.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── TextEdit.xcscheme ├── TextEditDefaultsKeys.h ├── TextEditErrors.h ├── TextEditMisc.h ├── UniversalDetector.framework ├── Headers ├── Resources ├── UniversalDetector └── Versions │ ├── A │ ├── Headers │ │ └── UniversalDetector.h │ ├── Resources │ │ └── Info.plist │ └── UniversalDetector │ └── Current ├── Version.xcconfig ├── html.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png ├── rtf.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png ├── rtfd.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png └── txt.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | *jjgod.* 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | xcode_project: TextEdit.xcodeproj 3 | xcode_scheme: TextEdit 4 | -------------------------------------------------------------------------------- /Base.lproj/DocumentProperties.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/DocumentProperties.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Base.lproj/Edit.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/Edit.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Base.lproj/Preferences.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/Preferences.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Base.lproj/PrintPanelAccessory.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/PrintPanelAccessory.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Base.lproj/SelectEncodingsPanel.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/SelectEncodingsPanel.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Base.lproj/SelectLinePanel.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Base.lproj/SelectLinePanel.nib/keyedobjects.nib -------------------------------------------------------------------------------- /Controller.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Controller.h 4 | Abstract: Central controller object for TextEdit, for implementing app functionality (services) as well 5 | as few tidbits for which there are no dedicated controllers. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | 53 | @class Preferences, DocumentPropertiesPanelController, LinePanelController; 54 | 55 | @interface Controller : NSObject { 56 | IBOutlet Preferences *preferencesController; 57 | IBOutlet DocumentPropertiesPanelController *propertiesController; 58 | IBOutlet LinePanelController *lineController; 59 | } 60 | 61 | @property (assign) Preferences *preferencesController; 62 | @property (assign) DocumentPropertiesPanelController *propertiesController; 63 | @property (assign) LinePanelController *lineController; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Controller.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Controller.m 4 | Abstract: Central controller object for TextEdit, for implementing app functionality (services) as well 5 | as few tidbits for which there are no dedicated controllers. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | #import "Controller.h" 53 | #import "DocumentController.h" 54 | #import "Document.h" 55 | #import "EncodingManager.h" 56 | #import "TextEditDefaultsKeys.h" 57 | #import "TextEditErrors.h" 58 | #import "TextEditMisc.h" 59 | 60 | static NSDictionary *defaultValues() { 61 | static NSDictionary *dict = nil; 62 | if (!dict) { 63 | dict = [[NSDictionary alloc] initWithObjectsAndKeys: 64 | [NSNumber numberWithInteger:30], AutosavingDelay, 65 | [NSNumber numberWithBool:NO], NumberPagesWhenPrinting, 66 | [NSNumber numberWithBool:YES], WrapToFitWhenPrinting, 67 | [NSNumber numberWithBool:YES], RichText, 68 | [NSNumber numberWithBool:NO], ShowPageBreaks, 69 | [NSNumber numberWithBool:NO], OpenPanelFollowsMainWindow, 70 | [NSNumber numberWithBool:YES], AddExtensionToNewPlainTextFiles, 71 | [NSNumber numberWithInteger:90], WindowWidth, 72 | [NSNumber numberWithInteger:30], WindowHeight, 73 | [NSNumber numberWithUnsignedInteger:NoStringEncoding], PlainTextEncodingForRead, 74 | [NSNumber numberWithUnsignedInteger:NoStringEncoding], PlainTextEncodingForWrite, 75 | [NSNumber numberWithInteger:8], TabWidth, 76 | [NSNumber numberWithInteger:50000], ForegroundLayoutToIndex, 77 | [NSNumber numberWithBool:NO], IgnoreRichText, 78 | [NSNumber numberWithBool:NO], IgnoreHTML, 79 | [NSNumber numberWithBool:YES], CheckSpellingAsYouType, 80 | [NSNumber numberWithBool:NO], CheckGrammarWithSpelling, 81 | [NSNumber numberWithBool:[NSSpellChecker isAutomaticSpellingCorrectionEnabled]], CorrectSpellingAutomatically, 82 | [NSNumber numberWithBool:YES], ShowRuler, 83 | [NSNumber numberWithBool:YES], SmartCopyPaste, 84 | [NSNumber numberWithBool:NO], SmartQuotes, 85 | [NSNumber numberWithBool:NO], SmartDashes, 86 | [NSNumber numberWithBool:NO], SmartLinks, 87 | [NSNumber numberWithBool:NO], DataDetectors, 88 | [NSNumber numberWithBool:[NSSpellChecker isAutomaticTextReplacementEnabled]], TextReplacement, 89 | [NSNumber numberWithBool:NO], SubstitutionsEnabledInRichTextOnly, 90 | @"", AuthorProperty, 91 | @"", CompanyProperty, 92 | @"", CopyrightProperty, 93 | [NSNumber numberWithBool:NO], UseXHTMLDocType, 94 | [NSNumber numberWithBool:NO], UseTransitionalDocType, 95 | [NSNumber numberWithBool:YES], UseEmbeddedCSS, 96 | [NSNumber numberWithBool:NO], UseInlineCSS, 97 | [NSNumber numberWithUnsignedInteger:NSUTF8StringEncoding], HTMLEncoding, 98 | [NSNumber numberWithBool:YES], PreserveWhitespace, 99 | [NSNumber numberWithBool:NO], UseScreenFonts, 100 | nil]; 101 | } 102 | return dict; 103 | } 104 | 105 | @implementation Controller 106 | 107 | @synthesize preferencesController, propertiesController, lineController; 108 | 109 | + (void)initialize { 110 | // Set up default values for preferences managed by NSUserDefaultsController 111 | [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues()]; 112 | [[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:defaultValues()]; 113 | #if __LP64__ 114 | // At some point during 32-to-64 bit transition of TextEdit, some versions erroneously wrote out the value of -1 to defaults. These values cause grief throughout the program under 64-bit, so it's best to clean them out from defaults permanently. Note that it's often considered bad form to write defaults while launching; however, here we do this only once, ever. 115 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 116 | if ([[defaults objectForKey:PlainTextEncodingForRead] unsignedIntegerValue] == 0xFFFFFFFFFFFFFFFFULL) [defaults removeObjectForKey:PlainTextEncodingForRead]; 117 | if ([[defaults objectForKey:PlainTextEncodingForWrite] unsignedIntegerValue] == 0xFFFFFFFFFFFFFFFFULL) [defaults removeObjectForKey:PlainTextEncodingForWrite]; 118 | #endif 119 | } 120 | 121 | - (void)applicationDidFinishLaunching:(NSNotification *)notification { 122 | // To get service requests to go to the controller... 123 | [NSApp setServicesProvider:self]; 124 | } 125 | 126 | /*** Services support ***/ 127 | 128 | - (void)openFile:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error { 129 | NSString *filename, *origFilename; 130 | NSURL *url = nil; 131 | NSError *err = nil; 132 | NSString *type = [pboard availableTypeFromArray:[NSArray arrayWithObject:(NSString *)kUTTypePlainText]]; 133 | 134 | if (type && (filename = origFilename = [pboard stringForType:type])) { 135 | BOOL success = NO; 136 | if ([filename isAbsolutePath] && (url = [NSURL fileURLWithPath:filename])) { // If seems to be a valid absolute path, first try using it as-is 137 | success = [(DocumentController *)[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:&err] != nil; 138 | } 139 | if (!success) { // Check to see if the user mistakenly included a carriage return or more at the end of the file name... 140 | filename = [[filename substringWithRange:[filename lineRangeForRange:NSMakeRange(0, 0)]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 141 | if ([filename hasPrefix:@"~"]) filename = [filename stringByExpandingTildeInPath]; // Convert the "~username" case 142 | if (![origFilename isEqual:filename] && [filename isAbsolutePath]) { 143 | url = [NSURL fileURLWithPath:filename]; 144 | success = [(DocumentController *)[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:url display:YES error:&err] != nil; 145 | } 146 | } 147 | // Given that this is a one-way service (no return), we need to put up the error panel ourselves and we do not set *error. 148 | if (!success) { 149 | if (!err) { 150 | err = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:[NSDictionary dictionaryWithObjectsAndKeys:truncatedString(filename, PATH_MAX+10), NSFilePathErrorKey, nil]]; 151 | } 152 | [[NSAlert alertWithError:err] runModal]; 153 | } 154 | } 155 | } 156 | 157 | /* The following, apart from providing the service through the Services menu, allows the user to drop snippets of text on the TextEdit icon and have it open as a new document. */ 158 | - (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error { 159 | NSError *err = nil; 160 | Document *document = [(DocumentController *)[NSDocumentController sharedDocumentController] openDocumentWithContentsOfPasteboard:pboard display:YES error:&err]; 161 | 162 | if (!document) { 163 | [[NSAlert alertWithError:err] runModal]; 164 | // No need to report an error string... 165 | } 166 | } 167 | 168 | @end 169 | 170 | 171 | 172 | -------------------------------------------------------------------------------- /Document.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Document.h 4 | Abstract: Document object for TextEdit. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | @interface Document : NSDocument { 53 | // Book-keeping 54 | BOOL setUpPrintInfoDefaults; /* YES the first time -printInfo is called */ 55 | BOOL inDuplicate; 56 | // Document data 57 | NSTextStorage *textStorage; /* The (styled) text content of the document */ 58 | CGFloat scaleFactor; /* The scale factor retreived from file */ 59 | BOOL isReadOnly; /* The document is locked and should not be modified */ 60 | NSColor *backgroundColor; /* The color of the document's background */ 61 | CGFloat hyphenationFactor; /* Hyphenation factor in range 0.0-1.0 */ 62 | NSSize viewSize; /* The view size, as stored in an RTF document. Can be NSZeroSize */ 63 | BOOL hasMultiplePages; /* Whether the document prefers a paged display */ 64 | BOOL usesScreenFonts; /* The document allows using screen fonts */ 65 | 66 | // The next seven are document properties (applicable only to rich text documents) 67 | NSString *author; /* Corresponds to NSAuthorDocumentAttribute */ 68 | NSString *copyright; /* Corresponds to NSCopyrightDocumentAttribute */ 69 | NSString *company; /* Corresponds to NSCompanyDocumentAttribute */ 70 | NSString *title; /* Corresponds to NSTitleDocumentAttribute */ 71 | NSString *subject; /* Corresponds to NSSubjectDocumentAttribute */ 72 | NSString *comment; /* Corresponds to NSCommentDocumentAttribute */ 73 | NSArray *keywords; /* Corresponds to NSKeywordsDocumentAttribute */ 74 | 75 | // Information about how the document was created 76 | BOOL openedIgnoringRichText; /* Setting at the the time the doc was open (so revert does the same thing) */ 77 | NSStringEncoding documentEncoding; /* NSStringEncoding used to interpret / save the document */ 78 | BOOL convertedDocument; /* Converted (or filtered) from some other format (and hence not writable) */ 79 | BOOL lossyDocument; /* Loaded lossily, so might not be a good idea to overwrite */ 80 | BOOL transient; /* Untitled document automatically opened and never modified */ 81 | NSArray *originalOrientationSections; /* An array of dictionaries. Each describing the text layout orientation for a page */ 82 | 83 | // Temporary information about how to save the document 84 | NSStringEncoding documentEncodingForSaving; /* NSStringEncoding for saving the document */ 85 | NSSaveOperationType currentSaveOperation; /* So we can know whether to use documentEncodingForSaving or documentEncoding 86 | in -fileWrapperOfType:error: */ 87 | 88 | 89 | // Temporary information about document's desired file type 90 | NSString *fileTypeToSet; /* Actual file type determined during a read, and set after the read (which includes revert) is complete. */ 91 | 92 | } 93 | 94 | - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName encoding:(NSStringEncoding)encoding ignoreRTF:(BOOL)ignoreRTF ignoreHTML:(BOOL)ignoreHTML error:(NSError **)outError; 95 | 96 | /* Is the document rich? */ 97 | - (BOOL)isRichText; 98 | 99 | /* Is the document read-only? */ 100 | - (BOOL)isReadOnly; 101 | - (void)setReadOnly:(BOOL)flag; 102 | 103 | /* Document background color */ 104 | - (NSColor *)backgroundColor; 105 | - (void)setBackgroundColor:(NSColor *)color; 106 | 107 | /* The encoding of the document... */ 108 | - (NSUInteger)encoding; 109 | - (void)setEncoding:(NSUInteger)encoding; 110 | 111 | /* Encoding of the document chosen when saving */ 112 | - (NSUInteger)encodingForSaving; 113 | - (void)setEncodingForSaving:(NSUInteger)encoding; 114 | 115 | /* Whether document was converted from some other format (filter services) */ 116 | - (BOOL)isConverted; 117 | - (void)setConverted:(BOOL)flag; 118 | 119 | /* Whether document was opened ignoring rich text */ 120 | - (BOOL)isOpenedIgnoringRichText; 121 | - (void)setOpenedIgnoringRichText:(BOOL)flag; 122 | 123 | /* Whether document was loaded lossily */ 124 | - (BOOL)isLossy; 125 | - (void)setLossy:(BOOL)flag; 126 | 127 | /* Hyphenation factor (0.0-1.0, 0.0 == disabled) */ 128 | - (float)hyphenationFactor; 129 | - (void)setHyphenationFactor:(float)factor; 130 | 131 | /* View size (as it should be saved in a RTF file) */ 132 | - (NSSize)viewSize; 133 | - (void)setViewSize:(NSSize)newSize; 134 | 135 | /* Scale factor; 1.0 is 100% */ 136 | - (CGFloat)scaleFactor; 137 | - (void)setScaleFactor:(CGFloat)scaleFactor; 138 | 139 | /* Attributes */ 140 | - (NSTextStorage *)textStorage; 141 | - (void)setTextStorage:(id)ts; // This will _copy_ the contents of the NS[Attributed]String ts into the document's textStorage. 142 | 143 | /* Page-oriented methods */ 144 | - (void)setHasMultiplePages:(BOOL)flag; 145 | - (BOOL)hasMultiplePages; 146 | - (NSSize)paperSize; 147 | - (void)setPaperSize:(NSSize)size; 148 | 149 | /* Action methods */ 150 | - (IBAction)toggleReadOnly:(id)sender; 151 | - (IBAction)togglePageBreaks:(id)sender; 152 | 153 | /* Whether conversion to rich/plain be done without loss of information */ 154 | - (BOOL)toggleRichWillLoseInformation; 155 | 156 | /* Default text attributes for plain or rich text formats */ 157 | - (NSDictionary *)defaultTextAttributes:(BOOL)forRichText; 158 | - (void)applyDefaultTextAttributes:(BOOL)forRichText; 159 | 160 | /* Document properties */ 161 | - (NSDictionary *)documentPropertyToAttributeNameMappings; 162 | - (NSArray *)knownDocumentProperties; 163 | - (void)clearDocumentProperties; 164 | - (void)setDocumentPropertiesToDefaults; 165 | - (BOOL)hasDocumentProperties; 166 | 167 | /* Transient documents */ 168 | - (BOOL)isTransient; 169 | - (void)setTransient:(BOOL)flag; 170 | - (BOOL)isTransientAndCanBeReplaced; 171 | 172 | /* Layout orientation sections */ 173 | - (NSArray *)originalOrientationSections; 174 | - (void)setOriginalOrientationSections:(NSArray *)array; 175 | 176 | /* Screen fonts property */ 177 | - (BOOL)usesScreenFonts; 178 | - (void)setUsesScreenFonts:(BOOL)aFlag; 179 | @end 180 | -------------------------------------------------------------------------------- /DocumentController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: DocumentController.h 4 | Abstract: NSDocumentController subclass for TextEdit. 5 | Required to support transient documents and customized Open panel. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | #import "Document.h" 53 | 54 | /* An instance of this subclass is created in the main nib file. */ 55 | 56 | // NSDocumentController is subclassed to provide for modification of the open panel. Normally, there is no need to subclass the document controller. 57 | @interface DocumentController : NSDocumentController { 58 | NSMutableDictionary *customOpenSettings; // Mapping of document URLs to encoding, ignore HTML, and ignore rich text settings that override the defaults from Preferences 59 | NSMutableArray *deferredDocuments; 60 | NSLock *transientDocumentLock; 61 | NSLock *displayDocumentLock; 62 | } 63 | 64 | + (NSView *)encodingAccessory:(NSUInteger)encoding includeDefaultEntry:(BOOL)includeDefaultItem encodingPopUp:(NSPopUpButton **)popup checkBox:(NSButton **)button; 65 | 66 | - (Document *)openDocumentWithContentsOfPasteboard:(NSPasteboard *)pb display:(BOOL)display error:(NSError **)error; 67 | 68 | - (NSStringEncoding)lastSelectedEncodingForURL:(NSURL *)url; 69 | - (BOOL)lastSelectedIgnoreHTMLForURL:(NSURL *)url; 70 | - (BOOL)lastSelectedIgnoreRichForURL:(NSURL *)url; 71 | 72 | - (void)beginOpenPanel:(NSOpenPanel *)openPanel forTypes:(NSArray *)types completionHandler:(void (^)(NSInteger result))completionHandler; 73 | 74 | - (Document *)transientDocumentToReplace; 75 | - (void)displayDocument:(NSDocument *)doc; 76 | - (void)replaceTransientDocument:(NSArray *)documents; 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /DocumentPropertiesPanelController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: DocumentPropertiesPanelController.h 4 | Abstract: "Document Properties" panel controller for TextEdit. There is a little more code here than one would like, 5 | however, this code does show steps needed to implement a non-modal inspector panel using bindings, and have 6 | the fields in the panel correctly commit when the panel loses key, or the document it is associated with 7 | is saved or made non-key (inactive). 8 | 9 | This class is mostly reusable, except with the assumption that commitEditing always succeeds. 10 | 11 | Version: 1.9 12 | 13 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 14 | Inc. ("Apple") in consideration of your agreement to the following 15 | terms, and your use, installation, modification or redistribution of 16 | this Apple software constitutes acceptance of these terms. If you do 17 | not agree with these terms, please do not use, install, modify or 18 | redistribute this Apple software. 19 | 20 | In consideration of your agreement to abide by the following terms, and 21 | subject to these terms, Apple grants you a personal, non-exclusive 22 | license, under Apple's copyrights in this original Apple software (the 23 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 24 | Software, with or without modifications, in source and/or binary forms; 25 | provided that if you redistribute the Apple Software in its entirety and 26 | without modifications, you must retain this notice and the following 27 | text and disclaimers in all such redistributions of the Apple Software. 28 | Neither the name, trademarks, service marks or logos of Apple Inc. may 29 | be used to endorse or promote products derived from the Apple Software 30 | without specific prior written permission from Apple. Except as 31 | expressly stated in this notice, no other rights or licenses, express or 32 | implied, are granted by Apple herein, including but not limited to any 33 | patent rights that may be infringed by your derivative works or by other 34 | works in which the Apple Software may be incorporated. 35 | 36 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 37 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 38 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 39 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 40 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 41 | 42 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 43 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 44 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 45 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 46 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 47 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 48 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 49 | POSSIBILITY OF SUCH DAMAGE. 50 | 51 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 52 | 53 | */ 54 | 55 | #import 56 | 57 | 58 | @interface DocumentPropertiesPanelController : NSWindowController { 59 | IBOutlet id documentObjectController; 60 | id inspectedDocument; 61 | } 62 | 63 | - (IBAction)toggleWindow:(id)sender; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /DocumentPropertiesPanelController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: DocumentPropertiesPanelController.m 4 | Abstract: "Document Properties" panel controller for TextEdit. There is a little more code here than one would like, 5 | however, this code does show steps needed to implement a non-modal inspector panel using bindings, and have 6 | the fields in the panel correctly commit when the panel loses key, or the document it is associated with 7 | is saved or made non-key (inactive). 8 | 9 | This class is mostly reusable, except with the assumption that commitEditing always succeeds. 10 | 11 | Version: 1.9 12 | 13 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 14 | Inc. ("Apple") in consideration of your agreement to the following 15 | terms, and your use, installation, modification or redistribution of 16 | this Apple software constitutes acceptance of these terms. If you do 17 | not agree with these terms, please do not use, install, modify or 18 | redistribute this Apple software. 19 | 20 | In consideration of your agreement to abide by the following terms, and 21 | subject to these terms, Apple grants you a personal, non-exclusive 22 | license, under Apple's copyrights in this original Apple software (the 23 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 24 | Software, with or without modifications, in source and/or binary forms; 25 | provided that if you redistribute the Apple Software in its entirety and 26 | without modifications, you must retain this notice and the following 27 | text and disclaimers in all such redistributions of the Apple Software. 28 | Neither the name, trademarks, service marks or logos of Apple Inc. may 29 | be used to endorse or promote products derived from the Apple Software 30 | without specific prior written permission from Apple. Except as 31 | expressly stated in this notice, no other rights or licenses, express or 32 | implied, are granted by Apple herein, including but not limited to any 33 | patent rights that may be infringed by your derivative works or by other 34 | works in which the Apple Software may be incorporated. 35 | 36 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 37 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 38 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 39 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 40 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 41 | 42 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 43 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 44 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 45 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 46 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 47 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 48 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 49 | POSSIBILITY OF SUCH DAMAGE. 50 | 51 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 52 | 53 | */ 54 | 55 | #import "DocumentPropertiesPanelController.h" 56 | #import "Document.h" 57 | #import "DocumentController.h" 58 | #import "TextEditMisc.h" 59 | #import "Controller.h" 60 | 61 | @implementation DocumentPropertiesPanelController 62 | 63 | - (id)init { 64 | return [super initWithWindowNibName:@"DocumentProperties"]; 65 | } 66 | 67 | - (void)dealloc { 68 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 69 | [NSApp removeObserver:self forKeyPath:@"mainWindow.windowController.document"]; 70 | [super dealloc]; 71 | } 72 | 73 | /* inspectedDocument is a KVO-compliant property, which this method manages. Anytime we hear about the mainWindow, or the mainWindow's document change, we check to see what changed. Note that activeDocumentChanged doesn't mean document contents changed, but rather we have a new active document. 74 | */ 75 | - (void)activeDocumentChanged { 76 | id doc = [[[NSApp mainWindow] windowController] document]; 77 | if (doc != inspectedDocument) { 78 | if (inspectedDocument) [documentObjectController commitEditing]; 79 | [self setValue:(doc && [doc isKindOfClass:[Document class]]) ? doc : nil forKey:@"inspectedDocument"]; 80 | } 81 | } 82 | 83 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 84 | if (context == [DocumentPropertiesPanelController class]) { 85 | [self activeDocumentChanged]; 86 | } else { 87 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; 88 | } 89 | } 90 | 91 | /* When controls in the panel start editing, register it with the inspected document. 92 | */ 93 | - (void)objectDidBeginEditing:(id)editor { 94 | [inspectedDocument objectDidBeginEditing:editor]; 95 | } 96 | 97 | - (void)objectDidEndEditing:(id)editor { 98 | [inspectedDocument objectDidEndEditing:editor]; 99 | } 100 | 101 | /* We don't want to do any observing until the properties panel is brought up. 102 | */ 103 | - (void)windowDidLoad { 104 | // Once the UI is loaded, we start observing the panel itself to commit editing when it becomes inactive (loses key state) 105 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(documentPropertiesPanelDidResignKey:) name:NSWindowDidResignKeyNotification object:[self window]]; 106 | 107 | // Make sure we start inspecting the document that is currently active, and start observing changes 108 | [self activeDocumentChanged]; 109 | [NSApp addObserver:self forKeyPath:@"mainWindow.windowController.document" options:0 context:[DocumentPropertiesPanelController class]]; 110 | 111 | NSWindow *window = [self window]; 112 | [window setIdentifier:@"DocumentProperties"]; 113 | [window setRestorationClass:[self class]]; 114 | 115 | [super windowDidLoad]; // It's documented to do nothing, but still a good idea to invoke... 116 | } 117 | 118 | /* Reopen the properties window when the app's persistent state is restored. 119 | */ 120 | + (void)restoreWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler { 121 | completionHandler([[(Controller *)[NSApp delegate] propertiesController] window], NULL); 122 | } 123 | 124 | /* Whenever the properties panel loses key status, we want to commit editing. 125 | */ 126 | - (void)documentPropertiesPanelDidResignKey:(NSNotification *)notification { 127 | [documentObjectController commitEditing]; 128 | } 129 | 130 | /* Since we want the panel to toggle... Note that if the window is visible and key, we order it out; otherwise we make it key. 131 | */ 132 | - (IBAction)toggleWindow:(id)sender { 133 | NSWindow *window = [self window]; 134 | if ([window isVisible] && [window isKeyWindow]) { 135 | [[self window] orderOut:sender]; 136 | } else { 137 | [[self window] makeKeyAndOrderFront:sender]; 138 | } 139 | } 140 | 141 | /* validateMenuItem: is used to dynamically set attributes of menu items. 142 | */ 143 | - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { 144 | if ([menuItem action] == @selector(toggleWindow:)) { // Correctly toggle the menu item for showing/hiding document properties 145 | // We call [self isWindowLoaded] first since it prevents [self window] from loading the nib 146 | validateToggleItem(menuItem, [self isWindowLoaded] && [[self window] isVisible], NSLocalizedString(@"Hide Properties", @"Title for menu item to hide the document properties panel."), NSLocalizedString(@"Show Properties", @"Title for menu item to show the document properties panel (should be the same as the initial menu item in the nib).")); 147 | } 148 | return YES; 149 | } 150 | 151 | @end 152 | -------------------------------------------------------------------------------- /DocumentWindow.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/DocumentWindow.nib/keyedobjects.nib -------------------------------------------------------------------------------- /DocumentWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: DocumentWindowController.h 4 | Abstract: Document's main window controller object for TextEdit. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | #import "ScalingScrollView.h" 52 | #include "opencc_types.h" 53 | 54 | @interface DocumentWindowController : NSWindowController { 55 | IBOutlet ScalingScrollView *scrollView; 56 | NSLayoutManager *layoutMgr; 57 | BOOL hasMultiplePages; 58 | BOOL rulerIsBeingDisplayed; 59 | BOOL isSettingSize; 60 | opencc_t conversionHandle; 61 | } 62 | 63 | // Convenience initializer. Loads the correct nib automatically. 64 | - (id)init; 65 | 66 | - (NSUInteger)numberOfPages; 67 | 68 | - (NSView *)documentView; 69 | 70 | - (void)breakUndoCoalescing; 71 | 72 | /* Layout orientation sections */ 73 | - (NSArray *)layoutOrientationSections; 74 | 75 | - (IBAction)chooseAndAttachFiles:(id)sender; 76 | - (IBAction)convertToSimplifiedChinese:(id)sender; 77 | - (IBAction)unwrapSelectedLines:(id)sender; 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Edit.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_128x128.png -------------------------------------------------------------------------------- /Edit.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /Edit.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_16x16.png -------------------------------------------------------------------------------- /Edit.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /Edit.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_256x256.png -------------------------------------------------------------------------------- /Edit.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /Edit.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_32x32.png -------------------------------------------------------------------------------- /Edit.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /Edit.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_512x512.png -------------------------------------------------------------------------------- /Edit.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/Edit.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /Edit_main.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Edit_main.m 4 | Abstract: Standard main file. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | int main(int argc, const char *argv[]) { 53 | return NSApplicationMain(argc, argv); 54 | } 55 | -------------------------------------------------------------------------------- /EncodingManager.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: EncodingManager.h 4 | Abstract: Helper class providing additional functionality for character encodings. 5 | This file also defines the EncodingPopUpButtonCell class. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | 53 | enum { 54 | NoStringEncoding = 0xFFFFFFFF 55 | }; 56 | 57 | enum { 58 | WantsAutomaticTag = -1 59 | }; 60 | 61 | 62 | @interface EncodingPopUpButtonCell : NSPopUpButtonCell { 63 | } 64 | @end 65 | 66 | 67 | 68 | @interface EncodingManager : NSObject { 69 | @private 70 | IBOutlet NSMatrix *encodingMatrix; 71 | NSArray *encodings; 72 | } 73 | 74 | /* There is just one instance... 75 | */ 76 | + (EncodingManager *)sharedInstance; 77 | 78 | /* List of encodings that should be shown in encoding lists 79 | */ 80 | - (NSArray *)enabledEncodings; 81 | 82 | /* Empties then initializes the supplied popup with the supported encodings. 83 | */ 84 | - (void)setupPopUpCell:(EncodingPopUpButtonCell *)button selectedEncoding:(NSStringEncoding)selectedEncoding withDefaultEntry:(BOOL)includeDefaultItem; 85 | 86 | /* Action methods for bringing up and dealing with changes in the encodings list panel 87 | */ 88 | - (IBAction)showPanel:(id)sender; 89 | - (IBAction)encodingListChanged:(id)sender; 90 | - (IBAction)clearAll:(id)sender; 91 | - (IBAction)selectAll:(id)sender; 92 | - (IBAction)revertToDefault:(id)sender; 93 | 94 | /* Internal method to save and communicate changes to the encoding list 95 | */ 96 | - (void)noteEncodingListChange:(BOOL)writeDefault updateList:(BOOL)updateList postNotification:(BOOL)post; 97 | 98 | /* Use universal charset detector to automatically determine which encoding 99 | * we should use to open the URL */ 100 | - (NSStringEncoding)detectedEncodingForURL:(NSURL *)url; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /EncodingManager.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: EncodingManager.m 4 | Abstract: Helper class providing additional functionality for character encodings. 5 | This file also defines the EncodingPopUpButtonCell class. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | #import 53 | 54 | #import "EncodingManager.h" 55 | 56 | /* 57 | EncodingPopUpButtonCell is a subclass of NSPopUpButtonCell which provides the ability to automatically recompute its contents on changes to the encodings list. This allows sprinkling these around the app any have them automatically update themselves. Because we really only want to know when the cell's selectedItem is changed, we want to prevent the last item ("Customize...") from being selected. 58 | 59 | In a nib file, to indicate that a default entry is wanted, the first menu item is given a tag of -1. 60 | */ 61 | @implementation EncodingPopUpButtonCell 62 | 63 | - (id)initTextCell:(NSString *)stringValue pullsDown:(BOOL)pullDown { 64 | if (self = [super initTextCell:stringValue pullsDown:pullDown]) { 65 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(encodingsListChanged:) name:@"EncodingsListChanged" object:nil]; 66 | [[EncodingManager sharedInstance] setupPopUpCell:self selectedEncoding:NoStringEncoding withDefaultEntry:NO]; 67 | } 68 | return self; 69 | } 70 | 71 | - (id)initWithCoder:(NSCoder *)coder { 72 | if (self = [super initWithCoder:coder]) { 73 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(encodingsListChanged:) name:@"EncodingsListChanged" object:nil]; 74 | [[EncodingManager sharedInstance] setupPopUpCell:self selectedEncoding:NoStringEncoding withDefaultEntry:([self numberOfItems] > 0 && [[self itemAtIndex:0] tag] == WantsAutomaticTag)]; 75 | } 76 | return self; 77 | } 78 | 79 | - (void)dealloc { 80 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 81 | [super dealloc]; 82 | } 83 | 84 | /* Do not allow selecting the "Customize" item and the separator before it. (Note that the customize item can be chosen and an action will be sent, but the selection doesn't change to it.) 85 | */ 86 | - (void)selectItemAtIndex:(NSInteger)index { 87 | if (index + 2 <= [self numberOfItems]) [super selectItemAtIndex:index]; 88 | } 89 | 90 | /* Update contents based on encodings list customization 91 | */ 92 | - (void)encodingsListChanged:(NSNotification *)notification { 93 | [[EncodingManager sharedInstance] setupPopUpCell:self selectedEncoding:[[[self selectedItem] representedObject] unsignedIntegerValue] withDefaultEntry:([self numberOfItems] > 0 && [[self itemAtIndex:0] tag] == WantsAutomaticTag)]; 94 | } 95 | 96 | @end 97 | 98 | 99 | @implementation EncodingManager 100 | 101 | /* Manage single shared instance which both init and sharedInstance methods return. 102 | */ 103 | static EncodingManager *sharedInstance = nil; 104 | 105 | + (EncodingManager *)sharedInstance { 106 | return sharedInstance ? sharedInstance : [[self alloc] init]; 107 | } 108 | 109 | - (id)init { 110 | if (sharedInstance) { // We just have one instance of the EncodingManager class, return that one instead 111 | [self release]; 112 | } else if (self = [super init]) { 113 | sharedInstance = self; 114 | } 115 | return sharedInstance; 116 | } 117 | 118 | - (void)dealloc { 119 | if (self != sharedInstance) [super dealloc]; // Don't free the shared instance 120 | } 121 | 122 | 123 | 124 | /* Sort using the equivalent Mac encoding as the major key. Secondary key is the actual encoding value, which works well enough. We treat Unicode encodings as special case, putting them at top of the list. 125 | */ 126 | static int encodingCompare(const void *firstPtr, const void *secondPtr) { 127 | CFStringEncoding first = *(CFStringEncoding *)firstPtr; 128 | CFStringEncoding second = *(CFStringEncoding *)secondPtr; 129 | CFStringEncoding macEncodingForFirst = CFStringGetMostCompatibleMacStringEncoding(first); 130 | CFStringEncoding macEncodingForSecond = CFStringGetMostCompatibleMacStringEncoding(second); 131 | if (first == second) return 0; // Should really never happen 132 | if (macEncodingForFirst == kCFStringEncodingUnicode || macEncodingForSecond == kCFStringEncodingUnicode) { 133 | if (macEncodingForSecond == macEncodingForFirst) return (first > second) ? 1 : -1; // Both Unicode; compare second order 134 | return (macEncodingForFirst == kCFStringEncodingUnicode) ? -1 : 1; // First is Unicode 135 | } 136 | if ((macEncodingForFirst > macEncodingForSecond) || ((macEncodingForFirst == macEncodingForSecond) && (first > second))) return 1; 137 | return -1; 138 | } 139 | 140 | /* Return a sorted list of all available string encodings. 141 | */ 142 | + (NSArray *)allAvailableStringEncodings { 143 | static NSMutableArray *allEncodings = nil; 144 | if (!allEncodings) { // Build list of encodings, sorted, and including only those with human readable names 145 | const CFStringEncoding *cfEncodings = CFStringGetListOfAvailableEncodings(); 146 | CFStringEncoding *tmp; 147 | NSInteger cnt, num = 0; 148 | while (cfEncodings[num] != kCFStringEncodingInvalidId) num++; // Count 149 | tmp = malloc(sizeof(CFStringEncoding) * num); 150 | memcpy(tmp, cfEncodings, sizeof(CFStringEncoding) * num); // Copy the list 151 | qsort(tmp, num, sizeof(CFStringEncoding), encodingCompare); // Sort it 152 | allEncodings = [[NSMutableArray alloc] init]; // Now put it in an NSArray 153 | for (cnt = 0; cnt < num; cnt++) { 154 | NSStringEncoding nsEncoding = CFStringConvertEncodingToNSStringEncoding(tmp[cnt]); 155 | if (nsEncoding && [NSString localizedNameOfStringEncoding:nsEncoding]) [allEncodings addObject:[NSNumber numberWithUnsignedInteger:nsEncoding]]; 156 | } 157 | free(tmp); 158 | } 159 | return allEncodings; 160 | } 161 | 162 | 163 | /* Called once (when the UI is first brought up) to properly setup the encodings list in the "Customize Encodings List" panel. 164 | */ 165 | - (void)setupEncodingsList { 166 | NSArray *allEncodings = [[self class] allAvailableStringEncodings]; 167 | NSInteger cnt, numEncodings = [allEncodings count]; 168 | 169 | for (cnt = 0; cnt < numEncodings; cnt++) { 170 | NSNumber *encodingNumber = [allEncodings objectAtIndex:cnt]; 171 | NSStringEncoding encoding = [encodingNumber unsignedIntegerValue]; 172 | NSString *encodingName = [NSString localizedNameOfStringEncoding:encoding]; 173 | NSCell *cell; 174 | if (cnt >= [encodingMatrix numberOfRows]) [encodingMatrix addRow]; 175 | cell = [encodingMatrix cellAtRow:cnt column:0]; 176 | [cell setTitle:encodingName]; 177 | [cell setRepresentedObject:encodingNumber]; 178 | } 179 | [encodingMatrix sizeToCells]; 180 | [self noteEncodingListChange:NO updateList:YES postNotification:NO]; 181 | } 182 | 183 | 184 | /* This method initializes the provided popup with list of encodings; it also sets up the selected encoding as indicated and if includeDefaultItem is YES, includes an initial item for selecting "Automatic" choice. All encoding items have an NSNumber with the encoding (or NoStringEncoding) as their representedObject. 185 | */ 186 | - (void)setupPopUpCell:(EncodingPopUpButtonCell *)popup selectedEncoding:(NSStringEncoding)selectedEncoding withDefaultEntry:(BOOL)includeDefaultItem { 187 | NSArray *encs = [self enabledEncodings]; 188 | NSUInteger cnt, numEncodings, itemToSelect = 0; 189 | 190 | // Put the encodings in the popup 191 | [popup removeAllItems]; 192 | 193 | // Put the initial "Automatic" item, if desired 194 | if (includeDefaultItem) { 195 | [popup addItemWithTitle:NSLocalizedString(@"Automatic", @"Encoding popup entry indicating automatic choice of encoding")]; 196 | [[popup itemAtIndex:0] setRepresentedObject:[NSNumber numberWithUnsignedInteger:NoStringEncoding]]; 197 | [[popup itemAtIndex:0] setTag:WantsAutomaticTag]; // so that the default entry is included again next time 198 | } 199 | 200 | // Make sure the initial selected encoding appears in the list 201 | if (!includeDefaultItem && (selectedEncoding != NoStringEncoding) && ![encs containsObject:[NSNumber numberWithUnsignedInteger:selectedEncoding]]) encs = [encs arrayByAddingObject:[NSNumber numberWithUnsignedInteger:selectedEncoding]]; 202 | 203 | numEncodings = [encs count]; 204 | 205 | // Fill with encodings 206 | for (cnt = 0; cnt < numEncodings; cnt++) { 207 | NSNumber *encodingNumber = [encs objectAtIndex:cnt]; 208 | NSStringEncoding encoding = [encodingNumber unsignedIntegerValue]; 209 | [popup addItemWithTitle:[NSString localizedNameOfStringEncoding:encoding]]; 210 | [[popup lastItem] setRepresentedObject:encodingNumber]; 211 | [[popup lastItem] setEnabled:YES]; 212 | if (encoding == selectedEncoding) itemToSelect = [popup numberOfItems] - 1; 213 | } 214 | 215 | // Add an optional separator and "customize" item at end 216 | if ([popup numberOfItems] > 0) { 217 | [[popup menu] addItem:[NSMenuItem separatorItem]]; 218 | } 219 | [popup addItemWithTitle:NSLocalizedString(@"Customize Encodings List\\U2026", @"Encoding popup entry for bringing up the Customize Encodings List panel (this also occurs as the title of the panel itself, they should have the same localization)")]; 220 | [[popup lastItem] setAction:@selector(showPanel:)]; 221 | [[popup lastItem] setTarget:self]; 222 | 223 | [popup selectItemAtIndex:itemToSelect]; 224 | } 225 | 226 | 227 | /* Returns the actual enabled list of encodings. 228 | */ 229 | - (NSArray *)enabledEncodings { 230 | static const NSInteger plainTextFileStringEncodingsSupported[] = { 231 | kCFStringEncodingUnicode, kCFStringEncodingUTF8, kCFStringEncodingMacRoman, kCFStringEncodingWindowsLatin1, kCFStringEncodingMacJapanese, kCFStringEncodingShiftJIS, kCFStringEncodingMacChineseTrad, kCFStringEncodingMacKorean, kCFStringEncodingMacChineseSimp, kCFStringEncodingGB_18030_2000, -1 232 | }; 233 | if (encodings == nil) { 234 | NSMutableArray *encs = [[[NSUserDefaults standardUserDefaults] arrayForKey:@"Encodings"] mutableCopy]; 235 | if (encs == nil) { 236 | NSStringEncoding defaultEncoding = [NSString defaultCStringEncoding]; 237 | NSStringEncoding encoding; 238 | BOOL hasDefault = NO; 239 | NSInteger cnt = 0; 240 | encs = [[NSMutableArray alloc] init]; 241 | while (plainTextFileStringEncodingsSupported[cnt] != -1) { 242 | if ((encoding = CFStringConvertEncodingToNSStringEncoding(plainTextFileStringEncodingsSupported[cnt++])) != kCFStringEncodingInvalidId) { 243 | [encs addObject:[NSNumber numberWithUnsignedInteger:encoding]]; 244 | if (encoding == defaultEncoding) hasDefault = YES; 245 | } 246 | } 247 | if (!hasDefault) [encs addObject:[NSNumber numberWithUnsignedInteger:defaultEncoding]]; 248 | } 249 | encodings = encs; 250 | } 251 | return encodings; 252 | } 253 | 254 | /* Should be called after any customization to the encodings list. Writes the new list out to defaults; updates the UI; also posts notification to get all encoding popups to update. 255 | */ 256 | - (void)noteEncodingListChange:(BOOL)writeDefault updateList:(BOOL)updateList postNotification:(BOOL)post { 257 | if (writeDefault) [[NSUserDefaults standardUserDefaults] setObject:encodings forKey:@"Encodings"]; 258 | 259 | if (updateList) { 260 | NSInteger cnt, numEncodings = [encodingMatrix numberOfRows]; 261 | for (cnt = 0; cnt < numEncodings; cnt++) { 262 | NSCell *cell = [encodingMatrix cellAtRow:cnt column:0]; 263 | [cell setState:[encodings containsObject:[cell representedObject]] ? NSOnState : NSOffState]; 264 | } 265 | } 266 | 267 | if (post) [[NSNotificationCenter defaultCenter] postNotificationName:@"EncodingsListChanged" object:nil]; 268 | } 269 | 270 | /* Because we want the encoding list to be modifiable even when a modal panel (such as the open panel) is up, we indicate that both the encodings list panel and the target work when modal. (See showPanel: below for the former...) 271 | */ 272 | - (BOOL)worksWhenModal { 273 | return YES; 274 | } 275 | 276 | 277 | /* Action methods */ 278 | 279 | - (IBAction)showPanel:(id)sender { 280 | if (!encodingMatrix) { 281 | if (![[NSBundle mainBundle] loadNibNamed:@"SelectEncodingsPanel" owner:self topLevelObjects:NULL]) { 282 | NSLog(@"Failed to load SelectEncodingsPanel.nib"); 283 | return; 284 | } 285 | [[encodingMatrix window] retain]; // loadNibNamed:owner:topLevelObjects: does not retain top level objects 286 | [(NSPanel *)[encodingMatrix window] setWorksWhenModal:YES]; // This should work when open panel is up 287 | [[encodingMatrix window] setLevel:NSModalPanelWindowLevel]; // Again, for the same reason 288 | [self setupEncodingsList]; // Initialize the list (only need to do this once) 289 | } 290 | [[encodingMatrix window] makeKeyAndOrderFront:nil]; 291 | } 292 | 293 | - (IBAction)encodingListChanged:(id)sender { 294 | NSInteger cnt, numRows = [encodingMatrix numberOfRows]; 295 | NSMutableArray *encs = [[NSMutableArray alloc] init]; 296 | 297 | for (cnt = 0; cnt < numRows; cnt++) { 298 | NSCell *cell = [encodingMatrix cellAtRow:cnt column:0]; 299 | NSNumber *encodingNumber = [cell representedObject]; 300 | if (([encodingNumber unsignedIntegerValue] != NoStringEncoding) && ([cell state] == NSOnState)) [encs addObject:encodingNumber]; 301 | } 302 | 303 | [encodings autorelease]; 304 | encodings = encs; 305 | 306 | [self noteEncodingListChange:YES updateList:NO postNotification:YES]; 307 | } 308 | 309 | - (IBAction)clearAll:(id)sender { 310 | [encodings autorelease]; 311 | encodings = [[NSArray array] retain]; // Empty encodings list 312 | [self noteEncodingListChange:YES updateList:YES postNotification:YES]; 313 | } 314 | 315 | - (IBAction)selectAll:(id)sender { 316 | [encodings autorelease]; 317 | encodings = [[[self class] allAvailableStringEncodings] retain]; // All encodings 318 | [self noteEncodingListChange:YES updateList:YES postNotification:YES]; 319 | } 320 | 321 | - (IBAction)revertToDefault:(id)sender { 322 | [encodings autorelease]; 323 | encodings = nil; 324 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"Encodings"]; 325 | (void)[self enabledEncodings]; // Regenerate default list 326 | [self noteEncodingListChange:NO updateList:YES postNotification:YES]; 327 | } 328 | 329 | #define BUFSIZE 4096 330 | 331 | /* Use universal charset detector to automatically determine which encoding 332 | * we should use to open the URL */ 333 | - (NSStringEncoding) detectedEncodingForURL: (NSURL *) url 334 | { 335 | UniversalDetector *detector = [UniversalDetector detector]; 336 | FILE *fp; 337 | char buf[BUFSIZE]; 338 | int len, total = 0; 339 | 340 | fp = fopen([[url path] fileSystemRepresentation], "r"); 341 | if (! fp) 342 | return NoStringEncoding; 343 | do 344 | { 345 | len = fread(buf, 1, sizeof(buf), fp); 346 | total += len; 347 | [detector analyzeBytes: buf length: len]; 348 | } while ([detector confidence] < 0.9 && ![detector done] && (feof(fp) == 0)); 349 | 350 | fclose(fp); 351 | 352 | return [detector encoding]; 353 | } 354 | 355 | @end 356 | 357 | 358 | 359 | 360 | -------------------------------------------------------------------------------- /English.lproj/EncodingAccessory.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/English.lproj/EncodingAccessory.nib/keyedobjects.nib -------------------------------------------------------------------------------- /English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Apple HTML document 6 | Web Page (.html) 7 | Apple SimpleText document 8 | SimpleText Document 9 | Apple Web archive 10 | Web Archive Document 11 | CFBundleDisplayName 12 | TextEdit 13 | CFBundleName 14 | TextEdit 15 | Microsoft Word 2003 XML document 16 | Word 2003 (.xml) Document 17 | Microsoft Word 2007 document 18 | Word 2007 (.docx) Document 19 | Microsoft Word 97 document 20 | Word 97 (.doc) Document 21 | NSHumanReadableCopyright 22 | Copyright © 1995-2013 Apple Inc. 23 | All rights reserved. 24 | NSRTFDPboardType 25 | Rich Text Document with Attachments 26 | NSRTFPboardType 27 | Rich Text Document 28 | NSStringPboardType 29 | Plain Text Document 30 | OpenDocument Text document 31 | OpenDocument Text (.odt) Document 32 | Unknown document 33 | Document 34 | 35 | 36 | -------------------------------------------------------------------------------- /English.lproj/LinePanel.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Enter a line number or a range of line numbers to select. 6 | Enter a line number or a range of line numbers to select. 7 | Invalid line specification \U201c%@\U201d. 8 | Invalid line specification “%@”. 9 | 10 | 11 | -------------------------------------------------------------------------------- /English.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | &Make Plain Text 6 | &Make Plain Text 7 | &Make Rich Text 8 | &Make Rich Text 9 | &Wrap to Page 10 | &Wrap to Page 11 | &Wrap to Window 12 | &Wrap to Window 13 | Allow Editing 14 | Allow Editing 15 | Allow Hyphenation 16 | Allow Hyphenation 17 | Are you sure you want to edit this document? 18 | Are you sure you want to edit this document? 19 | Are you sure you want to modify the document in place? 20 | Are you sure you want to modify the document in place? 21 | Automatic 22 | Automatic 23 | Automatically append \U201c.txt\U201d to the file name if no known file name extension is provided. 24 | Automatically append “.txt” to the file name if no known file name extension is provided. 25 | Cancel 26 | Cancel 27 | Convert 28 | Convert 29 | Convert this document to RTF format? 30 | Convert this document to RTF format? 31 | Convert this document to RTFD format? 32 | Convert this document to RTFD format? 33 | Convert this document to plain text? 34 | Convert this document to plain text? 35 | Customize Encodings List\U2026 36 | Customize Encodings List… 37 | Do not Allow Hyphenation 38 | Do not Allow Hyphenation 39 | Documents with graphics and attachments will be saved using RTFD (RTF with graphics) format. RTFD documents are not compatible with some applications. Convert anyway? 40 | Documents with graphics and attachments will be saved using RTFD (RTF with graphics) format. RTFD documents are not compatible with some applications. Convert anyway? 41 | Duplicate 42 | Duplicate 43 | Edit 44 | Edit 45 | Hide Properties 46 | Hide Properties 47 | If no extension is provided, use \U201c.txt\U201d. 48 | If no extension is provided, use “.txt”. 49 | If selected, HTML and RTF files will be loaded as plain text, allowing you to see and edit the HTML or RTF directives. 50 | If selected, HTML and RTF files will be loaded as plain text, allowing you to see and edit the HTML or RTF directives. 51 | Ignore rich text commands 52 | Ignore rich text commands 53 | Make Layout Horizontal 54 | Make Layout Horizontal 55 | Make Layout Vertical 56 | Make Layout Vertical 57 | Make Plain Text 58 | Make Plain Text 59 | Make Rich Text 60 | Make Rich Text 61 | Making a rich text document plain will lose all text styles (such as fonts and colors), images, attachments, and document properties. 62 | Making a rich text document plain will lose all text styles (such as fonts and colors), images, attachments, and document properties. 63 | Modifying the document in place might cause you to lose some of the original formatting. Would you like to duplicate the document first? 64 | Modifying the document in place might cause you to lose some of the original formatting. Would you like to duplicate the document first? 65 | None of the items could be attached. 66 | None of the items could be attached. 67 | OK 68 | OK 69 | Overwrite 70 | Overwrite 71 | Please choose another encoding (such as UTF-8). 72 | Please choose another encoding (such as UTF-8). 73 | Prevent Editing 74 | Prevent Editing 75 | Service failed. Couldn\U2019t open the selection. 76 | Service failed. Couldn’t open the selection. 77 | Show Properties 78 | Show Properties 79 | Some of the items could not be attached. 80 | Some of the items could not be attached. 81 | The files may be unreadable, or the volume they are on may be inaccessible. Please check in Finder. 82 | The files may be unreadable, or the volume they are on may be inaccessible. Please check in Finder. 83 | The specified text encoding isn\U2019t applicable. 84 | The specified text encoding isn’t applicable. 85 | There might be an internal error or a performance problem, or the source application may be providing text of invalid type in the service request. Please try the operation a second time. If that doesn\U2019t work, copy/paste the selection into TextEdit. 86 | There might be an internal error or a performance problem, or the source application may be providing text of invalid type in the service request. Please try the operation a second time. If that doesn’t work, copy/paste the selection into TextEdit. 87 | This document can no longer be saved using its original %@ encoding. 88 | This document can no longer be saved using its original %@ encoding. 89 | This document must be converted to RTF before it can be modified. 90 | This document must be converted to RTF before it can be modified. 91 | This document was converted from a format that TextEdit cannot save. It will be saved in %@ format. 92 | This document was converted from a format that TextEdit cannot save. It will be saved in %@ format. 93 | author 94 | Change Author 95 | comment 96 | Change Comment 97 | company 98 | Change Company 99 | copyright 100 | Change Copyright 101 | keywords 102 | Change Keywords 103 | rich text 104 | rich text 105 | rich text with graphics (RTFD) 106 | rich text with graphics (RTFD) 107 | subject 108 | Change Subject 109 | title 110 | Change Title 111 | 112 | 113 | -------------------------------------------------------------------------------- /English.lproj/PrintAccessory.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Header and Footer 6 | Header and Footer 7 | Off 8 | Off 9 | On 10 | On 11 | Rewrap to fit page 12 | Rewrap to fit page 13 | 14 | 15 | -------------------------------------------------------------------------------- /English.lproj/ServicesMenu.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | New TextEdit Window Containing Selection 6 | New TextEdit Window Containing Selection 7 | Open Selected File in TextEdit 8 | Open Selected File in TextEdit 9 | 10 | 11 | -------------------------------------------------------------------------------- /English.lproj/ZoomValues.strings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10% 6 | 10% 7 | 100% 8 | 100% 9 | 125% 10 | 125% 11 | 150% 12 | 150% 13 | 1600% 14 | 1600% 15 | 200% 16 | 200% 17 | 25% 18 | 25% 19 | 400% 20 | 400% 21 | 50% 22 | 50% 23 | 75% 24 | 75% 25 | 800% 26 | 800% 27 | 28 | 29 | -------------------------------------------------------------------------------- /FontNameTransformer.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: FontNameTransformer.h 4 | Abstract: Value transformer that turns fonts into a human-readable string with the font's name and size. This is used in the preferences window. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | 53 | @interface FontNameTransformer : NSValueTransformer { 54 | 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /FontNameTransformer.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: FontNameTransformer.m 4 | Abstract: Value transformer that turns fonts into a human-readable string with the font's name and size. This is used in the preferences window. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import "FontNameTransformer.h" 51 | 52 | 53 | @implementation FontNameTransformer 54 | + (Class)tranformedValueClass { 55 | return [NSString class]; 56 | } 57 | 58 | + (BOOL)allowsReverseTransformation { 59 | return NO; 60 | } 61 | 62 | - (id)transformedValue:(id)value { 63 | if (value && [value isKindOfClass:[NSFont class]]) { 64 | return [NSString stringWithFormat:@"%@ %g", [value displayName], [value pointSize]]; 65 | } else { 66 | return @""; 67 | } 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Info-TextEdit.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | TextEdit 9 | CFBundleDocumentTypes 10 | 11 | 12 | CFBundleTypeIconFile 13 | rtf.icns 14 | CFBundleTypeName 15 | NSRTFPboardType 16 | LSItemContentTypes 17 | 18 | public.rtf 19 | 20 | CFBundleTypeRole 21 | Editor 22 | LSIsAppleDefaultForType 23 | 24 | NSIsRelatedItemType 25 | 26 | NSDocumentClass 27 | Document 28 | 29 | 30 | CFBundleTypeIconFile 31 | rtfd.icns 32 | CFBundleTypeName 33 | NSRTFDPboardType 34 | LSItemContentTypes 35 | 36 | com.apple.rtfd 37 | 38 | CFBundleTypeRole 39 | Editor 40 | LSIsAppleDefaultForType 41 | 42 | LSTypeIsPackage 43 | 44 | NSIsRelatedItemType 45 | 46 | NSDocumentClass 47 | Document 48 | 49 | 50 | CFBundleTypeIconFile 51 | html.icns 52 | CFBundleTypeName 53 | Apple HTML document 54 | LSItemContentTypes 55 | 56 | public.html 57 | 58 | CFBundleTypeRole 59 | Editor 60 | NSDocumentClass 61 | Document 62 | 63 | 64 | CFBundleTypeName 65 | Apple Web archive 66 | LSItemContentTypes 67 | 68 | com.apple.webarchive 69 | 70 | CFBundleTypeRole 71 | Editor 72 | NSDocumentClass 73 | Document 74 | 75 | 76 | CFBundleTypeName 77 | OpenDocument Text document 78 | LSItemContentTypes 79 | 80 | org.oasis-open.opendocument.text 81 | 82 | CFBundleTypeRole 83 | Editor 84 | NSDocumentClass 85 | Document 86 | 87 | 88 | LSItemContentTypes 89 | 90 | org.oasis-open.opendocument.text-template 91 | org.openoffice.text 92 | org.openoffice.text-template 93 | 94 | CFBundleTypeRole 95 | Viewer 96 | NSDocumentClass 97 | Document 98 | 99 | 100 | CFBundleTypeName 101 | Microsoft Word 2007 document 102 | LSItemContentTypes 103 | 104 | org.openxmlformats.wordprocessingml.document 105 | 106 | CFBundleTypeRole 107 | Editor 108 | LSHandlerRank 109 | Alternate 110 | NSDocumentClass 111 | Document 112 | 113 | 114 | CFBundleTypeName 115 | Microsoft Word 2003 XML document 116 | LSItemContentTypes 117 | 118 | com.microsoft.word.wordml 119 | 120 | CFBundleTypeRole 121 | Editor 122 | LSHandlerRank 123 | Alternate 124 | NSDocumentClass 125 | Document 126 | 127 | 128 | CFBundleTypeName 129 | Microsoft Word 97 document 130 | LSItemContentTypes 131 | 132 | com.microsoft.word.doc 133 | 134 | CFBundleTypeRole 135 | Editor 136 | LSHandlerRank 137 | Alternate 138 | NSDocumentClass 139 | Document 140 | 141 | 142 | CFBundleTypeIconFile 143 | txt.icns 144 | CFBundleTypeName 145 | NSStringPboardType 146 | LSItemContentTypes 147 | 148 | public.text 149 | 150 | CFBundleTypeRole 151 | Editor 152 | LSIsAppleDefaultForType 153 | 154 | NSDocumentClass 155 | Document 156 | 157 | 158 | CFBundleTypeIconFile 159 | txt.icns 160 | CFBundleTypeName 161 | NSStringPboardType 162 | LSItemContentTypes 163 | 164 | public.plain-text 165 | 166 | CFBundleTypeRole 167 | Editor 168 | LSIsAppleDefaultForType 169 | 170 | NSIsRelatedItemType 171 | 172 | NSDocumentClass 173 | Document 174 | 175 | 176 | CFBundleTypeIconFile 177 | txt.icns 178 | CFBundleTypeName 179 | Apple SimpleText document 180 | LSItemContentTypes 181 | 182 | com.apple.traditional-mac-plain-text 183 | 184 | CFBundleTypeRole 185 | Viewer 186 | LSIsAppleDefaultForType 187 | 188 | NSDocumentClass 189 | Document 190 | 191 | 192 | CFBundleTypeName 193 | Unknown document 194 | CFBundleTypeRole 195 | Viewer 196 | LSIsAppleDefaultForType 197 | 198 | LSItemContentTypes 199 | 200 | public.data 201 | 202 | NSDocumentClass 203 | Document 204 | 205 | 206 | CFBundleExecutable 207 | TextEdit 208 | CFBundleHelpBookFolder 209 | TextEdit.help 210 | CFBundleHelpBookName 211 | com.apple.TextEdit.help 212 | CFBundleIconFile 213 | Edit.icns 214 | CFBundleIdentifier 215 | com.apple.TextEdit 216 | CFBundleInfoDictionaryVersion 217 | 6.0 218 | CFBundleName 219 | TextEdit 220 | CFBundlePackageType 221 | APPL 222 | CFBundleShortVersionString 223 | 1.9 224 | CFBundleSignature 225 | ttxt 226 | CFBundleVersion 227 | $(CURRENT_PROJECT_VERSION) 228 | LSMinimumSystemVersion 229 | 10.9 230 | NSAppleScriptEnabled 231 | 232 | NSHumanReadableCopyright 233 | Copyright © 1995-2013, Apple Inc. 234 | All rights reserved. 235 | NSMainNibFile 236 | Edit 237 | NSPrincipalClass 238 | NSApplication 239 | NSServices 240 | 241 | 242 | NSMenuItem 243 | 244 | default 245 | New TextEdit Window Containing Selection 246 | 247 | NSMessage 248 | openSelection 249 | NSPortName 250 | TextEdit 251 | NSSendTypes 252 | 253 | com.apple.flat-rtfd 254 | public.rtf 255 | public.plain-text 256 | 257 | 258 | 259 | NSMenuItem 260 | 261 | default 262 | Open Selected File in TextEdit 263 | 264 | NSMessage 265 | openFile 266 | NSPortName 267 | TextEdit 268 | NSSendTypes 269 | 270 | public.plain-text 271 | 272 | NSRequiredContext 273 | 274 | NSTextContent 275 | FilePath 276 | 277 | 278 | 279 | NSSupportsSuddenTermination 280 | YES 281 | LSApplicationCategoryType 282 | public.app-category.productivity 283 | 284 | 285 | -------------------------------------------------------------------------------- /JJTypesetter.h: -------------------------------------------------------------------------------- 1 | // 2 | // JJTypesetter.h 3 | // TextEdit 4 | // 5 | // Created by Jjgod Jiang on 8/31/09. 6 | // 7 | 8 | #import 9 | 10 | 11 | @interface JJTypesetter : NSATSTypesetter { 12 | CGFloat _lineHeight; 13 | CGFloat _baselineOffset; 14 | BOOL _isEnabled; 15 | } 16 | 17 | @property BOOL enabled; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /JJTypesetter.m: -------------------------------------------------------------------------------- 1 | // 2 | // JJTypesetter.m 3 | // TextEdit 4 | // 5 | // Created by Jjgod Jiang on 8/31/09. 6 | // 7 | 8 | #import "JJTypesetter.h" 9 | 10 | @implementation JJTypesetter 11 | 12 | @synthesize enabled=_isEnabled; 13 | 14 | - (void) fontDidChange: (NSFont *) font 15 | { 16 | if (! _isEnabled) 17 | return; 18 | 19 | NSLayoutManager *lm = [self layoutManager]; 20 | 21 | _lineHeight = [lm defaultLineHeightForFont: font]; 22 | _baselineOffset = [lm defaultBaselineOffsetForFont: font]; 23 | } 24 | 25 | - (void) willSetLineFragmentRect:(NSRectPointer)lineRect 26 | forGlyphRange:(NSRange)glyphRange 27 | usedRect:(NSRectPointer)usedRect 28 | baselineOffset:(CGFloat *)baselineOffset 29 | { 30 | if (! _isEnabled) 31 | return; 32 | 33 | if (! _lineHeight) 34 | { 35 | NSFont *font = [NSFont userFixedPitchFontOfSize:0.0]; 36 | [self fontDidChange: font]; 37 | } 38 | 39 | lineRect->size.height = _lineHeight; 40 | usedRect->size.height = _lineHeight; 41 | *baselineOffset = _baselineOffset; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /LinePanelController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: LinePanelController.h 4 | Abstract: "Select Line" panel controller for TextEdit. 5 | Enables selecting a single line, range of lines, from start or relative to current selected range. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | 53 | 54 | @interface LinePanelController : NSWindowController { 55 | IBOutlet NSTextField *lineField; 56 | } 57 | 58 | - (IBAction)lineFieldChanged:(id)sender; 59 | - (IBAction)selectClicked:(id)sender; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /LinePanelController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: LinePanelController.m 4 | Abstract: "Select Line" panel controller for TextEdit. 5 | Enables selecting a single line, range of lines, from start or relative to current selected range. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import "LinePanelController.h" 52 | #import "TextEditErrors.h" 53 | #import "TextEditMisc.h" 54 | #import "Controller.h" 55 | 56 | @implementation LinePanelController 57 | 58 | - (id)init { 59 | return [super initWithWindowNibName:@"SelectLinePanel"]; 60 | } 61 | 62 | - (void)windowDidLoad { 63 | NSWindow *window = [self window]; 64 | [window setIdentifier:@"Line"]; 65 | [window setRestorationClass:[self class]]; 66 | [super windowDidLoad]; // It's documented to do nothing, but still a good idea to invoke... 67 | } 68 | 69 | /* Reopen the line panel when the app's persistent state is restored. 70 | */ 71 | + (void)restoreWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler { 72 | completionHandler([[(Controller *)[NSApp delegate] lineController] window], NULL); 73 | } 74 | 75 | /* A short and sweet example of use of NSScanner. Parses user's line specification, in the form of N, or N-M, or +N-M, or -N-M. Returns NO on error. Assumes none of the out parameters are NULL! 76 | */ 77 | - (BOOL)parseLineDescription:(NSString *)desc fromLineSpec:(NSInteger *)fromLine toLineSpec:(NSInteger *)toLine relative:(NSInteger *)relative { 78 | NSScanner *scanner = [NSScanner localizedScannerWithString:desc]; 79 | *relative = [scanner scanString:@"+" intoString:NULL] ? 1 : ([scanner scanString:@"-" intoString:NULL] ? -1 : 0); // Look for "+" or "-"; set relative to 1 or -1, or 0 if neither found 80 | if (![scanner scanInteger:fromLine]) return NO; // Get the "from" spec 81 | if ([scanner scanString:@"-" intoString:NULL]) { // If "-" seen, look for the "to" spec 82 | if (![scanner scanInteger:toLine] || (*toLine < *fromLine)) return NO; // There needs to be a number that is not less than the "from" spec 83 | } else { 84 | *toLine = *fromLine; // If not a range, set the "to" spec to be the same as "from" 85 | } 86 | return [scanner isAtEnd] ? YES : NO; // If more stuff, error. Note that the scanner skips over white space 87 | } 88 | 89 | /* getRange:... gets the range to be selected in the specified textView using the indicated start, end, and relative values 90 | If relative = 0, then select from start of fromLine to end of toLine. The first line of the text is line 1. 91 | If relative != 0 then select from start of fromLine lines from current selected range to toLine lines from current selected range. 92 | toLine == fromLine means a one-line selection 93 | */ 94 | - (BOOL)getRange:(NSRange *)rangePtr inTextView:(NSTextView *)textView fromLineSpec:(NSInteger)fromLine toLineSpec:(NSInteger)toLine relative:(NSInteger)relative { 95 | NSRange newSelection = {0, 0}; // Character locations for the new selection 96 | NSString *textString = [textView string]; 97 | 98 | if (relative != 0) { // Depending on relative direction, set the starting point to beginning of line at the start or end of the existing selected range 99 | NSRange curSel = [textView selectedRange]; 100 | if (relative > 0) curSel.location = NSMaxRange(curSel) - ((curSel.length > 0) ? 1 : 0); 101 | [textString getLineStart:&newSelection.location end:NULL contentsEnd:NULL forRange:NSMakeRange(curSel.location, 0)]; 102 | } else { 103 | if (fromLine == 0) return NO; // "0" is not a valid absolute line spec 104 | } 105 | 106 | // At this point, newSelection.location points at the beginning of the line we want to start from 107 | if (relative < 0) { // Backwards relative from that spot 108 | for (NSInteger cnt = 1; cnt < fromLine; cnt++) { 109 | if (newSelection.location == 0) return NO; // Invalid specification 110 | NSRange lineRange = [textString lineRangeForRange:NSMakeRange(newSelection.location - 1, 0)]; 111 | newSelection.location = lineRange.location; 112 | } 113 | NSInteger end = newSelection.location; // This now marks the end of the range to be selected 114 | for (NSInteger cnt = fromLine; cnt <= toLine; cnt++) { 115 | if (newSelection.location == 0) return NO; // Invalid specification 116 | NSRange lineRange = [textString lineRangeForRange:NSMakeRange(newSelection.location - 1, 0)]; 117 | newSelection.location = lineRange.location; 118 | } 119 | newSelection.length = end - newSelection.location; 120 | } else { // Forwards 121 | NSInteger textLength = [textString length]; 122 | for (NSInteger cnt = (relative == 0) ? 1 : 0; cnt < fromLine; cnt++) { // If not a relative selection, we start counting from 1, since the first line is "line 1" to the user 123 | if (newSelection.location == textLength) return NO; // Invalid specification 124 | NSRange lineRange = [textString lineRangeForRange:NSMakeRange(newSelection.location, 0)]; 125 | newSelection.location = NSMaxRange(lineRange); 126 | } 127 | NSInteger end = newSelection.location; 128 | for (NSInteger cnt = fromLine; cnt <= toLine; cnt++) { // If not relative, the end of the range is an absolute line number; otherwise it's relative 129 | if (end == textLength) return NO; // Invalid specification 130 | NSRange lineRange = [textString lineRangeForRange:NSMakeRange(end, 0)]; 131 | end = NSMaxRange(lineRange); 132 | } 133 | newSelection.length = end - newSelection.location; 134 | } 135 | if (rangePtr) *rangePtr = newSelection; 136 | return YES; 137 | } 138 | 139 | /* selectLinesUsingDescription:error: selects the specified lines. On error it returns NO and sets *error if not NULL. 140 | */ 141 | - (BOOL)selectLinesUsingDescription:(NSString *)desc error:(NSError **)error { 142 | id firstResponder = [[NSApp mainWindow] firstResponder]; 143 | if ([firstResponder isKindOfClass:[NSTextView class]]) { 144 | NSInteger fromLine, toLine, relative; 145 | if (![self parseLineDescription:desc fromLineSpec:&fromLine toLineSpec:&toLine relative:&relative]) { 146 | if (error) *error = [NSError errorWithDomain:TextEditErrorDomain code:TextEditInvalidLineSpecification userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Invalid line specification \\U201c%@\\U201d.", @"LinePanel", @"Error message indicating invalid line specification for 'Select Line'"), truncatedString(desc, 100)], NSLocalizedDescriptionKey, NSLocalizedStringFromTable(@"Enter a line number or a range of line numbers to select.", @"LinePanel", @"Suggestion for correcting invalid line specification"), NSLocalizedRecoverySuggestionErrorKey, nil]]; 147 | return NO; 148 | } 149 | NSRange range; 150 | if (![self getRange:&range inTextView:firstResponder fromLineSpec:fromLine toLineSpec:toLine relative:relative]) { 151 | if (error) *error = [NSError errorWithDomain:TextEditErrorDomain code:TextEditOutOfRangeLineSpecification userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Invalid line specification \\U201c%@\\U201d.", @"LinePanel", @"Error message indicating invalid line specification for 'Select Line'"), truncatedString(desc, 100)], NSLocalizedDescriptionKey, NSLocalizedStringFromTable(@"Enter a line number or a range of line numbers to select.", @"LinePanel", @"Suggestion for correcting invalid line specification"), NSLocalizedRecoverySuggestionErrorKey, nil]]; 152 | return NO; 153 | } 154 | [firstResponder setSelectedRange:range]; 155 | [firstResponder scrollRangeToVisible:range]; 156 | } 157 | return YES; 158 | } 159 | 160 | /* If the user enters a line specification and hits return, we want to order the panel out if successful. Hence this extra action method. 161 | */ 162 | - (IBAction)lineFieldChanged:(id)sender { 163 | NSError *error; 164 | if ([@"" isEqual:[sender stringValue]]) return; // Don't do anything on empty string 165 | if ([self selectLinesUsingDescription:[sender stringValue] error:&error]) { 166 | [[self window] orderOut:nil]; 167 | } else { 168 | [[self window] presentError:error]; 169 | [[self window] makeKeyAndOrderFront:nil]; 170 | } 171 | } 172 | 173 | /* Default action for the "Select" button. 174 | */ 175 | - (IBAction)selectClicked:(id)sender { 176 | NSError *error; 177 | if ([@"" isEqual:[lineField stringValue]]) return; // Don't do anything on empty string 178 | if (![self selectLinesUsingDescription:[lineField stringValue] error:&error]) { 179 | [[self window] presentError:error]; 180 | [[self window] makeKeyAndOrderFront:nil]; 181 | } 182 | } 183 | 184 | @end 185 | -------------------------------------------------------------------------------- /MultiplePageView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: MultiplePageView.h 4 | Abstract: View which holds all the pages together in the multiple-page case. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | @interface MultiplePageView : NSView { 53 | NSPrintInfo *printInfo; 54 | NSColor *lineColor; 55 | NSColor *marginColor; 56 | NSUInteger numPages; 57 | NSTextLayoutOrientation layoutOrientation; 58 | } 59 | 60 | - (void)setPrintInfo:(NSPrintInfo *)anObject; 61 | - (NSPrintInfo *)printInfo; 62 | - (CGFloat)pageSeparatorHeight; 63 | - (NSSize)documentSizeInPage; /* Returns the area where the document can draw */ 64 | - (NSRect)documentRectForPageNumber:(NSUInteger)pageNumber; /* First page is page 0 */ 65 | - (NSRect)pageRectForPageNumber:(NSUInteger)pageNumber; /* First page is page 0 */ 66 | - (void)setNumberOfPages:(NSUInteger)num; 67 | - (NSUInteger)numberOfPages; 68 | - (void)setLineColor:(NSColor *)color; 69 | - (NSColor *)lineColor; 70 | - (void)setMarginColor:(NSColor *)color; 71 | - (NSColor *)marginColor; 72 | - (void)setLayoutOrientation:(NSTextLayoutOrientation)orientation; 73 | - (NSTextLayoutOrientation)layoutOrientation; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /MultiplePageView.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: MultiplePageView.m 4 | Abstract: View which holds all the pages together in the multiple-page case. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | #import "MultiplePageView.h" 52 | #import "TextEditMisc.h" 53 | 54 | @implementation MultiplePageView 55 | 56 | - (id)initWithFrame:(NSRect)rect { 57 | if ((self = [super initWithFrame:rect])) { 58 | numPages = 0; 59 | [self setLineColor:[NSColor lightGrayColor]]; 60 | [self setMarginColor:[NSColor whiteColor]]; 61 | /* This will set the frame to be whatever's appropriate... */ 62 | [self setPrintInfo:[NSPrintInfo sharedPrintInfo]]; 63 | } 64 | return self; 65 | } 66 | 67 | - (BOOL)isFlipped { 68 | return YES; 69 | } 70 | 71 | - (BOOL)isOpaque { 72 | return YES; 73 | } 74 | 75 | - (void)updateFrame { 76 | if ([self superview]) { 77 | NSRect rect = NSZeroRect; 78 | rect.size = [printInfo paperSize]; 79 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 80 | rect.size.height = rect.size.height * numPages; 81 | if (numPages > 1) rect.size.height += [self pageSeparatorHeight] * (numPages - 1); 82 | } else { 83 | rect.size.width = rect.size.width * numPages; 84 | if (numPages > 1) rect.size.width += [self pageSeparatorHeight] * (numPages - 1); 85 | } 86 | rect.size = [self convertSize:rect.size toView:[self superview]]; 87 | [self setFrame:rect]; 88 | } 89 | } 90 | 91 | - (void)setPrintInfo:(NSPrintInfo *)anObject { 92 | if (printInfo != anObject) { 93 | [printInfo autorelease]; 94 | printInfo = [anObject copyWithZone:[self zone]]; 95 | [self updateFrame]; 96 | [self setNeedsDisplay:YES]; /* Because the page size or margins might change (could optimize this) */ 97 | } 98 | } 99 | 100 | - (NSPrintInfo *)printInfo { 101 | return printInfo; 102 | } 103 | 104 | - (void)setNumberOfPages:(NSUInteger)num { 105 | if (numPages != num) { 106 | NSRect oldFrame = [self frame]; 107 | NSRect newFrame; 108 | numPages = num; 109 | [self updateFrame]; 110 | newFrame = [self frame]; 111 | if (newFrame.size.height > oldFrame.size.height) { 112 | [self setNeedsDisplayInRect:NSMakeRect(oldFrame.origin.x, NSMaxY(oldFrame), oldFrame.size.width, NSMaxY(newFrame) - NSMaxY(oldFrame))]; 113 | } 114 | } 115 | } 116 | 117 | - (NSUInteger)numberOfPages { 118 | return numPages; 119 | } 120 | 121 | - (CGFloat)pageSeparatorHeight { 122 | return 5.0; 123 | } 124 | 125 | - (void)dealloc { 126 | [printInfo release]; 127 | [super dealloc]; 128 | } 129 | 130 | - (NSSize)documentSizeInPage { 131 | return documentSizeForPrintInfo(printInfo); 132 | } 133 | 134 | - (NSRect)documentRectForPageNumber:(NSUInteger)pageNumber { /* First page is page 0, of course! */ 135 | NSRect rect = [self pageRectForPageNumber:pageNumber]; 136 | rect.origin.x += [printInfo leftMargin] - defaultTextPadding(); 137 | rect.origin.y += [printInfo topMargin]; 138 | rect.size = [self documentSizeInPage]; 139 | return rect; 140 | } 141 | 142 | - (NSRect)pageRectForPageNumber:(NSUInteger)pageNumber { 143 | NSRect rect; 144 | rect.size = [printInfo paperSize]; 145 | rect.origin = [self frame].origin; 146 | 147 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 148 | rect.origin.y += ((rect.size.height + [self pageSeparatorHeight]) * pageNumber); 149 | } else { 150 | rect.origin.x += (NSWidth([self bounds]) - ((rect.size.width + [self pageSeparatorHeight]) * (pageNumber + 1))); 151 | } 152 | return rect; 153 | } 154 | 155 | /* For locations on the page separator right after a page, returns that page number. Same for any locations on the empty (gray background) area to the side of a page. Will return 0 or numPages-1 for locations beyond the ends. Results are 0-based. 156 | */ 157 | - (NSUInteger)pageNumberForPoint:(NSPoint)loc { 158 | NSUInteger pageNumber; 159 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 160 | if (loc.y < 0) pageNumber = 0; 161 | else if (loc.y >= [self bounds].size.height) pageNumber = numPages - 1; 162 | else pageNumber = loc.y / ([printInfo paperSize].height + [self pageSeparatorHeight]); 163 | } else { 164 | if (loc.x < 0) pageNumber = numPages - 1; 165 | else if (loc.x >= [self bounds].size.width) pageNumber = 0; 166 | else pageNumber = (NSWidth([self bounds]) - loc.x) / ([printInfo paperSize].width + [self pageSeparatorHeight]); 167 | } 168 | return pageNumber; 169 | } 170 | 171 | - (void)setLineColor:(NSColor *)color { 172 | if (color != lineColor) { 173 | [lineColor autorelease]; 174 | lineColor = [color copyWithZone:[self zone]]; 175 | [self setNeedsDisplay:YES]; 176 | } 177 | } 178 | 179 | - (NSColor *)lineColor { 180 | return lineColor; 181 | } 182 | 183 | - (void)setMarginColor:(NSColor *)color { 184 | if (color != marginColor) { 185 | [marginColor autorelease]; 186 | marginColor = [color copyWithZone:[self zone]]; 187 | [self setNeedsDisplay:YES]; 188 | } 189 | } 190 | 191 | - (NSColor *)marginColor { 192 | return marginColor; 193 | } 194 | 195 | - (void)setLayoutOrientation:(NSTextLayoutOrientation)orientation { 196 | if (orientation != layoutOrientation) { 197 | layoutOrientation = orientation; 198 | 199 | [self updateFrame]; 200 | } 201 | } 202 | 203 | - (NSTextLayoutOrientation)layoutOrientation { 204 | return layoutOrientation; 205 | } 206 | 207 | - (void)drawRect:(NSRect)rect { 208 | if ([[NSGraphicsContext currentContext] isDrawingToScreen]) { 209 | NSSize paperSize = [printInfo paperSize]; 210 | NSUInteger firstPage; 211 | NSUInteger lastPage; 212 | NSUInteger cnt; 213 | 214 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 215 | firstPage = NSMinY(rect) / (paperSize.height + [self pageSeparatorHeight]); 216 | lastPage = NSMaxY(rect) / (paperSize.height + [self pageSeparatorHeight]); 217 | } else { 218 | firstPage = numPages - (NSMaxX(rect) / (paperSize.width + [self pageSeparatorHeight])); 219 | lastPage = numPages - (NSMinX(rect) / (paperSize.width + [self pageSeparatorHeight])); 220 | } 221 | 222 | [marginColor set]; 223 | NSRectFill(rect); 224 | 225 | [lineColor set]; 226 | for (cnt = firstPage; cnt <= lastPage; cnt++) { 227 | // Draw boundary around the page, making sure it doesn't overlap the document area in terms of pixels 228 | NSRect docRect = NSInsetRect([self centerScanRect:[self documentRectForPageNumber:cnt]], -1.0, -1.0); 229 | NSFrameRectWithWidth(docRect, 1.0); 230 | } 231 | 232 | if ([[self superview] isKindOfClass:[NSClipView class]]) { 233 | NSColor *backgroundColor = [(NSClipView *)[self superview] backgroundColor]; 234 | [backgroundColor set]; 235 | for (cnt = firstPage; cnt <= lastPage; cnt++) { 236 | NSRect pageRect = [self pageRectForPageNumber:cnt]; 237 | NSRect separatorRect; 238 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 239 | separatorRect = NSMakeRect(NSMinX(pageRect), NSMaxY(pageRect), NSWidth(pageRect), [self pageSeparatorHeight]); 240 | } else { 241 | separatorRect = NSMakeRect(NSMaxX(pageRect), NSMinY(pageRect), [self pageSeparatorHeight], NSHeight(pageRect)); 242 | } 243 | NSRectFill (separatorRect); 244 | } 245 | } 246 | } 247 | } 248 | 249 | /**** Smart magnification ****/ 250 | 251 | - (NSRect)rectForSmartMagnificationAtPoint:(NSPoint)location inRect:(NSRect)visibleRect { 252 | NSRect result; 253 | NSUInteger pageNumber = [self pageNumberForPoint:location]; 254 | NSRect documentRect = NSInsetRect([self documentRectForPageNumber:pageNumber], -3.0, -3.0); // We use -3 to show a bit of the margins 255 | NSRect pageRect = [self pageRectForPageNumber:pageNumber]; 256 | 257 | if (NSPointInRect(location, documentRect)) { // Smart magnify on page contents; return the page contents rect 258 | result = documentRect; 259 | } else if (NSPointInRect(location, pageRect)) { // Smart magnify on page margins; return the page rect (not including separator area) 260 | result = pageRect; 261 | } else { // Smart magnify between pages, or the empty area beyond the side or bottom/top of the page; return the extended area for the page 262 | result = pageRect; 263 | if (NSTextLayoutOrientationHorizontal == layoutOrientation) { 264 | if (NSMaxX(visibleRect) > NSMaxX(pageRect)) result.size.width = NSMaxX(visibleRect); // include area to the right of the paper 265 | if (pageNumber + 1 < numPages) result.size.height += [self pageSeparatorHeight]; 266 | if (location.y > NSMaxY(result)) result.size.height = ceil(location.y - result.origin.y); // extend the rect out to include location 267 | } else { 268 | if (NSMaxY(visibleRect) > NSMaxY(pageRect)) result.size.height = NSMaxY(visibleRect); // include area below the paper 269 | if (pageNumber + 1 < numPages) result.size.width += [self pageSeparatorHeight]; 270 | if (location.x > NSMaxX(result)) result.size.width = ceil(location.x - result.origin.x); // extend the rect out to include location 271 | } 272 | } 273 | return result; 274 | } 275 | 276 | /**** Printing support... ****/ 277 | 278 | - (BOOL)knowsPageRange:(NSRangePointer)aRange { 279 | aRange->length = [self numberOfPages]; 280 | return YES; 281 | } 282 | 283 | - (NSRect)rectForPage:(NSInteger)page { 284 | return [self documentRectForPageNumber:page-1]; /* Our page numbers start from 0; the kit's from 1 */ 285 | } 286 | 287 | /* This method makes sure that we center the view on the page. By default, the text view "bleeds" into the margins by defaultTextPadding() as a way to provide padding around the editing area. If we don't do anything special, the text view appears at the margin, which causes the text to be offset on the page by defaultTextPadding(). This method makes sure the text is centered. 288 | */ 289 | - (NSPoint)locationOfPrintRect:(NSRect)rect { 290 | NSSize paperSize = [printInfo paperSize]; 291 | return NSMakePoint((paperSize.width - rect.size.width) / 2.0, (paperSize.height - rect.size.height) / 2.0); 292 | } 293 | 294 | @end 295 | 296 | 297 | NSSize documentSizeForPrintInfo(NSPrintInfo *printInfo) { 298 | NSSize paperSize = [printInfo paperSize]; 299 | paperSize.width -= ([printInfo leftMargin] + [printInfo rightMargin]) - defaultTextPadding() * 2.0; 300 | paperSize.height -= ([printInfo topMargin] + [printInfo bottomMargin]); 301 | return paperSize; 302 | } 303 | 304 | -------------------------------------------------------------------------------- /OpenCC/libopencc.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/OpenCC/libopencc.dylib -------------------------------------------------------------------------------- /OpenCC/opencc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * OpenCC API. 4 | * 5 | * @license 6 | * Open Chinese Convert 7 | * 8 | * Copyright 2010-2013 BYVoid 9 | * 10 | * Licensed under the Apache License, Version 2.0 (the "License"); 11 | * you may not use this file except in compliance with the License. 12 | * You may obtain a copy of the License at 13 | * 14 | * http://www.apache.org/licenses/LICENSE-2.0 15 | * 16 | * Unless required by applicable law or agreed to in writing, software 17 | * distributed under the License is distributed on an "AS IS" BASIS, 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | * See the License for the specific language governing permissions and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifndef __OPENCC_H_ 24 | #define __OPENCC_H_ 25 | 26 | /** 27 | * @defgroup opencc_api OpenCC API 28 | * 29 | * API in C language 30 | */ 31 | 32 | #include "opencc_types.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** 39 | * Filename of default Simplified to Traditional configuration. 40 | * 41 | * @ingroup opencc_api 42 | */ 43 | #define OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD "zhs2zht.ini" 44 | 45 | /** 46 | * Filename of default Traditional to Simplified configuration. 47 | * 48 | * @ingroup opencc_api 49 | */ 50 | #define OPENCC_DEFAULT_CONFIG_TRAD_TO_SIMP "zht2zhs.ini" 51 | 52 | /** 53 | * Makes an instance of opencc. 54 | * Leave config_file to NULL if you do not want to load any configuration file. 55 | * 56 | * @param config_file Location of configuration file. 57 | * @return A description pointer of the newly allocated instance of 58 | * opencc. On error the return value will be (opencc_t) -1. 59 | * @ingroup opencc_api 60 | */ 61 | opencc_t opencc_open(const char* config_file); 62 | 63 | /** 64 | * Destroys an instance of opencc. 65 | * 66 | * @param od The description pointer. 67 | * @return 0 on success or non-zero number on failure. 68 | */ 69 | int opencc_close(opencc_t od); 70 | 71 | /** 72 | * Converts a UCS-4 string from *inbuf to *outbuf. 73 | * Do not forget to assign **outbuf to L'\0' after called if you want to use it 74 | * as a C-Style string. 75 | * 76 | * @param od The opencc description pointer. 77 | * @param inbuf The pointer to the UCS-4 string. 78 | * @param inbufleft The maximum number of characters in *inbuf to be converted. 79 | * @param outbuf The pointer to the output buffer. 80 | * @param outbufleft The size of output buffer. 81 | * 82 | * @return The number of characters in the input buffer that has been 83 | * converted. 84 | * @ingroup opencc_api 85 | */ 86 | size_t opencc_convert(opencc_t od, 87 | ucs4_t** inbuf, 88 | size_t* inbufleft, 89 | ucs4_t** outbuf, 90 | size_t* outbufleft); 91 | 92 | /** 93 | * Converts UTF-8 string from inbuf. 94 | * This function returns an allocated C-Style string via malloc(), which stores 95 | * the converted string. 96 | * You should call opencc_convert_utf8_free() to release allocated memory. 97 | * 98 | * @param od The opencc description pointer. 99 | * @param inbuf The UTF-8 encoded string. 100 | * @param length The maximum length of inbuf to convert. If length is set to -1, 101 | * the whole c-style string in inbuf will be converted. 102 | * 103 | * @return The newly allocated UTF-8 string that stores text converted 104 | * from inbuf. 105 | * @ingroup opencc_api 106 | */ 107 | char* opencc_convert_utf8(opencc_t od, const char* inbuf, size_t length); 108 | 109 | /** 110 | * Releases allocated buffer by opencc_convert_utf8. 111 | * 112 | * @param buf Pointer to the allocated string buffer by opencc_convert_utf8. 113 | * 114 | * @ingroup opencc_api 115 | */ 116 | void opencc_convert_utf8_free(char* buf); 117 | 118 | /** 119 | * Loads a dictionary to default dictionary chain. 120 | * 121 | * @param od The opencc description pointer. 122 | * @param dict_filename The name (or location) of the dictionary file. 123 | * @param dict_type The type of the dictionary. 124 | * 125 | * @return 0 on success or non-zero number on failure. 126 | * 127 | * @ingroup opencc_api 128 | * @deprecated This function is not recommended to use and will be removed. 129 | */ 130 | int opencc_dict_load(opencc_t od, 131 | const char* dict_filename, 132 | opencc_dictionary_type dict_type); 133 | 134 | /** 135 | * Changes the mode of conversion. 136 | * 137 | * @param od The opencc description pointer. 138 | * @param conversion_mode Conversion mode. Options are 139 | * - OPENCC_CONVERSION_FAST 140 | * - OPENCC_CONVERSION_SEGMENT_ONLY 141 | * - OPENCC_CONVERSION_LIST_CANDIDATES 142 | * @ingroup opencc_api 143 | */ 144 | void opencc_set_conversion_mode(opencc_t od, 145 | opencc_conversion_mode conversion_mode); 146 | 147 | /** 148 | * Returns an opencc_convert_errno_t which describes the last error. 149 | * 150 | * @return The error type. 151 | */ 152 | opencc_error opencc_errno(void); 153 | 154 | /** 155 | * Prints the error message to stderr. 156 | * 157 | * @param spec Prefix message. 158 | * @ingroup opencc_api 159 | */ 160 | void opencc_perror(const char* spec); 161 | 162 | #ifdef __cplusplus 163 | } 164 | #endif 165 | 166 | #endif /* __OPENCC_H_ */ 167 | -------------------------------------------------------------------------------- /OpenCC/opencc_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Open Chinese Convert 3 | * 4 | * Copyright 2010-2013 BYVoid 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | #ifndef __OPENCC_TYPES_H_ 20 | #define __OPENCC_TYPES_H_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif // ifdef __cplusplus 25 | 26 | #include 27 | #include 28 | 29 | typedef void* opencc_t; 30 | 31 | typedef uint32_t ucs4_t; 32 | 33 | enum _opencc_error { 34 | OPENCC_ERROR_VOID, 35 | OPENCC_ERROR_DICTLOAD, 36 | OPENCC_ERROR_CONFIG, 37 | OPENCC_ERROR_ENCODING, 38 | OPENCC_ERROR_ENCODIND = OPENCC_ERROR_ENCODING, 39 | OPENCC_ERROR_CONVERTER 40 | }; 41 | typedef enum _opencc_error opencc_error; 42 | 43 | enum _opencc_dictionary_type { 44 | OPENCC_DICTIONARY_TYPE_TEXT, 45 | OPENCC_DICTIONARY_TYPE_DATRIE 46 | }; 47 | typedef enum _opencc_dictionary_type opencc_dictionary_type; 48 | 49 | enum _opencc_conversion_mode { 50 | OPENCC_CONVERSION_FAST = 0, 51 | OPENCC_CONVERSION_SEGMENT_ONLY = 1, 52 | OPENCC_CONVERSION_LIST_CANDIDATES = 2 53 | }; 54 | typedef enum _opencc_conversion_mode opencc_conversion_mode; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif // ifdef __cplusplus 59 | 60 | #endif /* __OPENCC_TYPES_H_ */ 61 | -------------------------------------------------------------------------------- /OpenCC/trad_to_simp_characters.ocd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/OpenCC/trad_to_simp_characters.ocd -------------------------------------------------------------------------------- /OpenCC/trad_to_simp_phrases.ocd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/OpenCC/trad_to_simp_phrases.ocd -------------------------------------------------------------------------------- /OpenCC/zht2zhs.ini: -------------------------------------------------------------------------------- 1 | ; Open Chinese Convert 2 | ; 3 | ; Copyright 2010-2013 BYVoid 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | 17 | title = trad_to_simp 18 | description = Standard Configuration for Conversion from Traditional Chinese to Simplified Chinese 19 | dict0 = OCD trad_to_simp_phrases.ocd 20 | dict0 = OCD trad_to_simp_characters.ocd 21 | -------------------------------------------------------------------------------- /Preferences.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Preferences.h 4 | Abstract: Preferences controller, subclass of NSWindowController. Since the switch to a bindings-based preferences interface, the class has become a lot simpler; its only duties now are to manage the user fonts for rich and plain text documents, translate HTML saving options from backwards-compatible defaults values into pop-up menu item tags, and revert everything to the initial defaults if the user so chooses. 5 | 6 | The Preferences instance also acts as a delegate for the window, in order to validate edits before it closes, and for the two text fields bound to the window size in characters, so that invalid entries trigger a reset to a field's previous value. 7 | 8 | Version: 1.9 9 | 10 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 11 | Inc. ("Apple") in consideration of your agreement to the following 12 | terms, and your use, installation, modification or redistribution of 13 | this Apple software constitutes acceptance of these terms. If you do 14 | not agree with these terms, please do not use, install, modify or 15 | redistribute this Apple software. 16 | 17 | In consideration of your agreement to abide by the following terms, and 18 | subject to these terms, Apple grants you a personal, non-exclusive 19 | license, under Apple's copyrights in this original Apple software (the 20 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 21 | Software, with or without modifications, in source and/or binary forms; 22 | provided that if you redistribute the Apple Software in its entirety and 23 | without modifications, you must retain this notice and the following 24 | text and disclaimers in all such redistributions of the Apple Software. 25 | Neither the name, trademarks, service marks or logos of Apple Inc. may 26 | be used to endorse or promote products derived from the Apple Software 27 | without specific prior written permission from Apple. Except as 28 | expressly stated in this notice, no other rights or licenses, express or 29 | implied, are granted by Apple herein, including but not limited to any 30 | patent rights that may be infringed by your derivative works or by other 31 | works in which the Apple Software may be incorporated. 32 | 33 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 34 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 35 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 36 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 37 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 38 | 39 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 40 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 42 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 43 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 44 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 45 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 46 | POSSIBILITY OF SUCH DAMAGE. 47 | 48 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 49 | 50 | */ 51 | 52 | #import 53 | 54 | enum { 55 | HTMLDocumentTypeOptionUseTransitional = (1 << 0), 56 | HTMLDocumentTypeOptionUseXHTML = (1 << 1) 57 | }; 58 | typedef NSUInteger HTMLDocumentTypeOptions; 59 | 60 | enum { 61 | HTMLStylingUseEmbeddedCSS = 0, 62 | HTMLStylingUseInlineCSS = 1, 63 | HTMLStylingUseNoCSS = 2 64 | }; 65 | typedef NSInteger HTMLStylingMode; 66 | 67 | @interface Preferences : NSWindowController { 68 | BOOL changingRTFFont; 69 | NSInteger originalDimensionFieldValue; 70 | } 71 | - (IBAction)revertToDefault:(id)sender; 72 | 73 | - (IBAction)changeRichTextFont:(id)sender; /* Request to change the rich text font */ 74 | - (IBAction)changePlainTextFont:(id)sender; /* Request to change the plain text font */ 75 | - (void)changeFont:(id)fontManager; /* Sent by the font manager */ 76 | 77 | - (NSFont *)richTextFont; 78 | - (void)setRichTextFont:(NSFont *)newFont; 79 | - (NSFont *)plainTextFont; 80 | - (void)setPlainTextFont:(NSFont *)newFont; 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Preferences.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: Preferences.m 4 | Abstract: Preferences controller, subclass of NSWindowController. Since the switch to a bindings-based preferences interface, the class has become a lot simpler; its only duties now are to manage the user fonts for rich and plain text documents, translate HTML saving options from backwards-compatible defaults values into pop-up menu item tags, and revert everything to the initial defaults if the user so chooses. 5 | 6 | The Preferences instance also acts as a delegate for the window, in order to validate edits before it closes, and for the two text fields bound to the window size in characters, so that invalid entries trigger a reset to a field's previous value. 7 | 8 | Version: 1.9 9 | 10 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 11 | Inc. ("Apple") in consideration of your agreement to the following 12 | terms, and your use, installation, modification or redistribution of 13 | this Apple software constitutes acceptance of these terms. If you do 14 | not agree with these terms, please do not use, install, modify or 15 | redistribute this Apple software. 16 | 17 | In consideration of your agreement to abide by the following terms, and 18 | subject to these terms, Apple grants you a personal, non-exclusive 19 | license, under Apple's copyrights in this original Apple software (the 20 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 21 | Software, with or without modifications, in source and/or binary forms; 22 | provided that if you redistribute the Apple Software in its entirety and 23 | without modifications, you must retain this notice and the following 24 | text and disclaimers in all such redistributions of the Apple Software. 25 | Neither the name, trademarks, service marks or logos of Apple Inc. may 26 | be used to endorse or promote products derived from the Apple Software 27 | without specific prior written permission from Apple. Except as 28 | expressly stated in this notice, no other rights or licenses, express or 29 | implied, are granted by Apple herein, including but not limited to any 30 | patent rights that may be infringed by your derivative works or by other 31 | works in which the Apple Software may be incorporated. 32 | 33 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 34 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 35 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 36 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 37 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 38 | 39 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 40 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 41 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 42 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 43 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 44 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 45 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 46 | POSSIBILITY OF SUCH DAMAGE. 47 | 48 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 49 | 50 | */ 51 | 52 | #import 53 | #import "Preferences.h" 54 | #import "EncodingManager.h" 55 | #import "FontNameTransformer.h" 56 | #import "TextEditDefaultsKeys.h" 57 | #import "Controller.h" 58 | 59 | @implementation Preferences 60 | 61 | - (id)init { 62 | return [super initWithWindowNibName:@"Preferences"]; 63 | } 64 | 65 | - (void)windowDidLoad { 66 | NSWindow *window = [self window]; 67 | [window setHidesOnDeactivate:NO]; 68 | [window setExcludedFromWindowsMenu:YES]; 69 | [window setIdentifier:@"Preferences"]; 70 | [window setRestorationClass:[self class]]; 71 | } 72 | 73 | /* Reopen the preferences window when the app's persistent state is restored. 74 | */ 75 | + (void)restoreWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler { 76 | completionHandler([[(Controller *)[NSApp delegate] preferencesController] window], NULL); 77 | } 78 | 79 | 80 | #pragma mark *** Font changing code *** 81 | 82 | - (IBAction)changeRichTextFont:(id)sender { 83 | // validate whatever's currently being edited first 84 | if ([[self window] makeFirstResponder:nil]) { 85 | changingRTFFont = YES; 86 | NSFontManager *fontManager = [NSFontManager sharedFontManager]; 87 | [fontManager setSelectedFont:[self richTextFont] isMultiple:NO]; 88 | [fontManager orderFrontFontPanel:self]; 89 | } 90 | } 91 | 92 | - (IBAction)changePlainTextFont:(id)sender { 93 | // validate whatever's currently being edited first 94 | if ([[self window] makeFirstResponder:nil]) { 95 | changingRTFFont = NO; 96 | NSFontManager *fontManager = [NSFontManager sharedFontManager]; 97 | [fontManager setSelectedFont:[self plainTextFont] isMultiple:NO]; 98 | [fontManager orderFrontFontPanel:self]; 99 | } 100 | } 101 | 102 | - (void)changeFont:(id)fontManager { 103 | if (changingRTFFont) { 104 | [self setRichTextFont:[fontManager convertFont:[self richTextFont]]]; 105 | } else { 106 | [self setPlainTextFont:[fontManager convertFont:[self plainTextFont]]]; 107 | } 108 | } 109 | 110 | - (void)setRichTextFont:(NSFont *)newFont { 111 | [NSFont setUserFont:newFont]; 112 | } 113 | 114 | - (void)setPlainTextFont:(NSFont *)newFont { 115 | [NSFont setUserFixedPitchFont:newFont]; 116 | } 117 | 118 | - (NSFont *)richTextFont { 119 | return [NSFont userFontOfSize:0.0]; 120 | } 121 | 122 | - (NSFont *)plainTextFont { 123 | return [NSFont userFixedPitchFontOfSize:0.0]; 124 | } 125 | 126 | #pragma mark *** HTML document type and styling code *** 127 | 128 | /* The user chooses the HTML document type using a popup button, but the actual type is represented as a two-bit bitfield, where one bit represents whether or not to use a transitional DTD and another bit determines whether or not to use XHTML. The popup button uses the bitfield's integer value as its tag. 129 | */ 130 | - (HTMLDocumentTypeOptions)HTMLDocumentType { 131 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 132 | HTMLDocumentTypeOptions type = 0; 133 | 134 | if ([defaults boolForKey:UseXHTMLDocType]) type |= HTMLDocumentTypeOptionUseXHTML; 135 | if ([defaults boolForKey:UseTransitionalDocType]) type |= HTMLDocumentTypeOptionUseTransitional; 136 | 137 | return type; 138 | } 139 | 140 | - (void)setHTMLDocumentType:(HTMLDocumentTypeOptions)newType { 141 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 142 | 143 | [defaults setBool:((newType & HTMLDocumentTypeOptionUseXHTML) == HTMLDocumentTypeOptionUseXHTML) forKey:UseXHTMLDocType]; 144 | [defaults setBool:((newType & HTMLDocumentTypeOptionUseTransitional) == HTMLDocumentTypeOptionUseTransitional) forKey:UseTransitionalDocType]; 145 | } 146 | 147 | /* The style mode is how style information is encoded when saving HTML: using embedded or inline CSS, or using older HTML tags and attributes. For backwards compatibility this information is stored in user defaults as two boolean values, rather than a style mode name or enumerated integer value. 148 | */ 149 | - (HTMLStylingMode)HTMLStylingMode { 150 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 151 | 152 | if ([defaults boolForKey:UseEmbeddedCSS]) { 153 | return HTMLStylingUseEmbeddedCSS; 154 | } else if ([defaults boolForKey:UseInlineCSS]) { 155 | return HTMLStylingUseInlineCSS; 156 | } else { 157 | return HTMLStylingUseNoCSS; 158 | } 159 | } 160 | 161 | - (void)setHTMLStylingMode:(HTMLStylingMode)newMode { 162 | BOOL useEmbedded = NO; 163 | BOOL useInline = NO; 164 | 165 | switch (newMode) { 166 | case HTMLStylingUseEmbeddedCSS: 167 | useEmbedded = YES; 168 | break; 169 | case HTMLStylingUseInlineCSS: 170 | useInline = YES; 171 | break; 172 | // ignore default case 173 | } 174 | 175 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 176 | [defaults setBool:useEmbedded forKey:UseEmbeddedCSS]; 177 | [defaults setBool:useInline forKey:UseInlineCSS]; 178 | } 179 | 180 | #pragma mark *** Reverting to defaults *** 181 | 182 | - (IBAction)revertToDefault:(id)sender { 183 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; 184 | 185 | [self willChangeValueForKey:@"HTMLDocumentType"]; 186 | [defaults removeObjectForKey:UseXHTMLDocType]; 187 | [defaults removeObjectForKey:UseTransitionalDocType]; 188 | [self didChangeValueForKey:@"HTMLDocumentType"]; 189 | 190 | [self willChangeValueForKey:@"HTMLStylingMode"]; 191 | [defaults removeObjectForKey:UseEmbeddedCSS]; 192 | [defaults removeObjectForKey:UseInlineCSS]; 193 | [self didChangeValueForKey:@"HTMLStylingMode"]; 194 | 195 | [self setRichTextFont:nil]; 196 | [self setPlainTextFont:nil]; 197 | 198 | [[NSUserDefaultsController sharedUserDefaultsController] revertToInitialValues:nil]; // For the rest of the defaults 199 | } 200 | 201 | #pragma mark *** Window delegation *** 202 | 203 | /* We do this to catch the case where the user enters a value into one of the text fields but closes the window without hitting enter or tab. 204 | */ 205 | - (BOOL)windowShouldClose:(NSWindow *)window { 206 | return [window makeFirstResponder:nil]; // validate editing 207 | } 208 | 209 | #pragma mark *** Window size field delegation *** 210 | 211 | - (void)controlTextDidBeginEditing:(NSNotification *)note { 212 | originalDimensionFieldValue = [[note object] integerValue]; 213 | } 214 | 215 | /* Handle the case when the user enters a ridiculous value for the window size. We just set it back to what it started as. 216 | */ 217 | - (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)error { 218 | [control setIntegerValue:originalDimensionFieldValue]; 219 | return YES; 220 | } 221 | 222 | 223 | @end 224 | -------------------------------------------------------------------------------- /PrintPanelAccessoryController.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: PrintPanelAccessoryController.h 4 | Abstract: PrintPanelAccessoryController is a subclass of NSViewController demonstrating how to add an accessory view to the print panel. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | 53 | @interface PrintPanelAccessoryController : NSViewController { 54 | BOOL showsWrappingToFit; 55 | BOOL wrappingToFit; 56 | } 57 | 58 | @property BOOL pageNumbering; 59 | @property BOOL wrappingToFit; 60 | @property BOOL showsWrappingToFit; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /PrintPanelAccessoryController.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: PrintPanelAccessoryController.m 4 | Abstract: PrintPanelAccessoryController is a subclass of NSViewController demonstrating how to add an accessory view to the print panel. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import "PrintPanelAccessoryController.h" 51 | #import "TextEditDefaultsKeys.h" 52 | 53 | 54 | @implementation PrintPanelAccessoryController 55 | 56 | @synthesize showsWrappingToFit, wrappingToFit; 57 | 58 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 59 | // We override the designated initializer, ignoring the nib since we need our own 60 | return [super initWithNibName:@"PrintPanelAccessory" bundle:nibBundleOrNil]; 61 | } 62 | 63 | /* The first time the printInfo is supplied, initialize the value of the pageNumbering setting from defaults 64 | */ 65 | - (void)setRepresentedObject:(id)printInfo { 66 | [super setRepresentedObject:printInfo]; 67 | // We don't bind to NSUserDefaults since we don't want changes while one panel is up to affect other panels that may be up 68 | self.pageNumbering = [[NSUserDefaults standardUserDefaults] boolForKey:NumberPagesWhenPrinting]; 69 | self.wrappingToFit = [[NSUserDefaults standardUserDefaults] boolForKey:WrapToFitWhenPrinting]; 70 | [self addObserver:self forKeyPath:@"pageNumbering" options:0 context:NULL]; 71 | [self addObserver:self forKeyPath:@"wrappingToFit" options:0 context:NULL]; 72 | } 73 | 74 | - (void)dealloc { 75 | if (self.representedObject) { // If setRepresentedObject: wasn't called, no observers, so don't attempt to remove 76 | [self removeObserver:self forKeyPath:@"pageNumbering"]; 77 | [self removeObserver:self forKeyPath:@"wrappingToFit"]; 78 | } 79 | [super dealloc]; 80 | } 81 | 82 | /* The values are sticky, so write them out to defaults when they change 83 | */ 84 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 85 | if ([keyPath isEqual:@"pageNumbering"]) { 86 | [[NSUserDefaults standardUserDefaults] setBool:self.pageNumbering forKey:NumberPagesWhenPrinting]; 87 | } else if ([keyPath isEqual:@"wrappingToFit"]) { 88 | [[NSUserDefaults standardUserDefaults] setBool:self.wrappingToFit forKey:WrapToFitWhenPrinting]; 89 | } else { 90 | [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; 91 | } 92 | } 93 | 94 | /* We don't use a instance variable to store pageNumbering, but instead get/set it in the printInfo. Hence we need custom accessors. 95 | */ 96 | - (void)setPageNumbering:(BOOL)flag { 97 | NSPrintInfo *printInfo = [self representedObject]; 98 | [[printInfo dictionary] setObject:[NSNumber numberWithBool:flag] forKey:NSPrintHeaderAndFooter]; 99 | } 100 | 101 | - (BOOL)pageNumbering { 102 | NSPrintInfo *printInfo = [self representedObject]; 103 | return [[[printInfo dictionary] objectForKey:NSPrintHeaderAndFooter] boolValue]; 104 | } 105 | 106 | - (NSSet *)keyPathsForValuesAffectingPreview { 107 | return [NSSet setWithObjects:@"pageNumbering", @"wrappingToFit", nil]; 108 | } 109 | 110 | /* This enables TextEdit-specific settings to be displayed in the Summary pane of the print panel. 111 | */ 112 | - (NSArray *)localizedSummaryItems { 113 | NSMutableArray *items = [NSMutableArray array]; 114 | [items addObject:[NSDictionary dictionaryWithObjectsAndKeys: 115 | NSLocalizedStringFromTable(@"Header and Footer", @"PrintAccessory", @"Print panel summary item title for whether header and footer (page number, date, document title) should be printed"), NSPrintPanelAccessorySummaryItemNameKey, 116 | [self pageNumbering] ? NSLocalizedStringFromTable(@"On", @"PrintAccessory", @"Print panel summary value for feature that is enabled") : NSLocalizedStringFromTable(@"Off", @"PrintAccessory", @"Print panel summary value for feature that is disabled"), NSPrintPanelAccessorySummaryItemDescriptionKey, 117 | nil]]; 118 | // We add the "Rewrap to fit page" item to the summary only if the item is settable (which it isn't, for "wrap-to-page" mode) 119 | if ([self showsWrappingToFit]) [items addObject:[NSDictionary dictionaryWithObjectsAndKeys: 120 | NSLocalizedStringFromTable(@"Rewrap to fit page", @"PrintAccessory", @"Print panel summary item title for whether document contents should be rewrapped to fit the page"), NSPrintPanelAccessorySummaryItemNameKey, 121 | [self wrappingToFit] ? NSLocalizedStringFromTable(@"On", @"PrintAccessory", @"Print panel summary value for feature that is enabled") : NSLocalizedStringFromTable(@"Off", @"PrintAccessory", @"Print panel summary value for feature that is disabled"), NSPrintPanelAccessorySummaryItemDescriptionKey, 122 | nil]]; 123 | return items; 124 | } 125 | 126 | @end 127 | -------------------------------------------------------------------------------- /PrintingTextView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: PrintingTextView.h 4 | Abstract: Very simple subclass of NSTextView that allows dynamic rewrapping/resizing to accomodate user options in the print panel when printing. 5 | This view is used only for printing of "wrap-to-window" views, since "wrap-to-page" views have fixed wrapping and size already. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | @class PrintPanelAccessoryController; 53 | 54 | @interface PrintingTextView : NSTextView { 55 | PrintPanelAccessoryController *printPanelAccessoryController; // Accessory controller which manages user's printing choices 56 | NSSize originalSize; // The original size of the text view in the window (used for non-rewrapped printing) 57 | NSSize previousValueOfDocumentSizeInPage; // As user fiddles with the print panel settings, stores the last document size for which the text was relaid out 58 | BOOL previousValueOfWrappingToFit; // Stores the last setting of whether to rewrap to fit page or not 59 | } 60 | @property (assign) PrintPanelAccessoryController *printPanelAccessoryController; 61 | @property (assign) NSSize originalSize; 62 | @end 63 | -------------------------------------------------------------------------------- /PrintingTextView.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: PrintingTextView.m 4 | Abstract: Very simple subclass of NSTextView that allows dynamic rewrapping/resizing to accomodate user options in the print panel when printing. 5 | This view is used only for printing of "wrap-to-window" views, since "wrap-to-page" views have fixed wrapping and size already. 6 | 7 | Version: 1.9 8 | 9 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 10 | Inc. ("Apple") in consideration of your agreement to the following 11 | terms, and your use, installation, modification or redistribution of 12 | this Apple software constitutes acceptance of these terms. If you do 13 | not agree with these terms, please do not use, install, modify or 14 | redistribute this Apple software. 15 | 16 | In consideration of your agreement to abide by the following terms, and 17 | subject to these terms, Apple grants you a personal, non-exclusive 18 | license, under Apple's copyrights in this original Apple software (the 19 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 20 | Software, with or without modifications, in source and/or binary forms; 21 | provided that if you redistribute the Apple Software in its entirety and 22 | without modifications, you must retain this notice and the following 23 | text and disclaimers in all such redistributions of the Apple Software. 24 | Neither the name, trademarks, service marks or logos of Apple Inc. may 25 | be used to endorse or promote products derived from the Apple Software 26 | without specific prior written permission from Apple. Except as 27 | expressly stated in this notice, no other rights or licenses, express or 28 | implied, are granted by Apple herein, including but not limited to any 29 | patent rights that may be infringed by your derivative works or by other 30 | works in which the Apple Software may be incorporated. 31 | 32 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 33 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 34 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 35 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 36 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 37 | 38 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 39 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 42 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 43 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 44 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 45 | POSSIBILITY OF SUCH DAMAGE. 46 | 47 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 48 | 49 | */ 50 | 51 | #import 52 | #import "PrintingTextView.h" 53 | #import "PrintPanelAccessoryController.h" 54 | #import "TextEditMisc.h" 55 | 56 | 57 | @implementation PrintingTextView 58 | 59 | @synthesize printPanelAccessoryController, originalSize; 60 | 61 | /* Override of knowsPageRange: checks printing parameters against the last invocation, and if not the same, resizes the view and relays out the text. On first invocation, the saved size will be 0,0, which will cause the text to be laid out. 62 | */ 63 | - (BOOL)knowsPageRange:(NSRangePointer)range { 64 | NSSize documentSizeInPage = documentSizeForPrintInfo([self.printPanelAccessoryController representedObject]); 65 | BOOL wrappingToFit = self.printPanelAccessoryController.wrappingToFit; 66 | 67 | if (!NSEqualSizes(previousValueOfDocumentSizeInPage, documentSizeInPage) || (previousValueOfWrappingToFit != wrappingToFit)) { 68 | previousValueOfDocumentSizeInPage = documentSizeInPage; 69 | previousValueOfWrappingToFit = wrappingToFit; 70 | 71 | NSSize size = wrappingToFit ? documentSizeInPage : self.originalSize; 72 | [self setFrame:NSMakeRect(0.0, 0.0, size.width, size.height)]; 73 | [[[self textContainer] layoutManager] setDefaultAttachmentScaling:wrappingToFit ? NSImageScaleProportionallyDown : NSImageScaleNone]; 74 | [self textEditDoForegroundLayoutToCharacterIndex:NSIntegerMax]; // Make sure the whole document is laid out 75 | } 76 | return [super knowsPageRange:range]; 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TextEditPlus 2 | ============ 3 | 4 | An enhanced version of TextEdit in Mac OS X, features encoding detection, etc. 5 | 6 | [![Build Status](https://travis-ci.org/jjgod/TextEditPlus.png)](https://travis-ci.org/jjgod/TextEditPlus) 7 | -------------------------------------------------------------------------------- /ScalingScrollView.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: ScalingScrollView.h 4 | Abstract: NSScrollView subclass to support scaling content. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | @class NSPopUpButton; 53 | 54 | @interface ScalingScrollView : NSScrollView 55 | 56 | - (void)setScaleFactor:(CGFloat)factor adjustPopup:(BOOL)flag; 57 | - (CGFloat)scaleFactor; 58 | 59 | - (IBAction)zoomToActualSize:(id)sender; 60 | - (IBAction)zoomIn:(id)sender; 61 | - (IBAction)zoomOut:(id)sender; 62 | 63 | @end 64 | 65 | -------------------------------------------------------------------------------- /ScalingScrollView.m: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: ScalingScrollView.m 4 | Abstract: NSScrollView subclass to support scaling content. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | #import "ScalingScrollView.h" 52 | 53 | @implementation ScalingScrollView 54 | 55 | - (void)awakeFromNib { 56 | [super awakeFromNib]; 57 | [self setAllowsMagnification:YES]; 58 | [self setMaxMagnification:16.0]; 59 | [self setMinMagnification:0.25]; 60 | } 61 | 62 | - (CGFloat)scaleFactor { 63 | return [self magnification]; 64 | } 65 | 66 | - (void)setScaleFactor:(CGFloat)newScaleFactor { 67 | [self setMagnification:newScaleFactor]; 68 | } 69 | 70 | - (void)setScaleFactor:(CGFloat)newScaleFactor adjustPopup:(BOOL)flag { 71 | [self setScaleFactor:newScaleFactor]; 72 | } 73 | 74 | /* Action methods 75 | */ 76 | - (IBAction)zoomToActualSize:(id)sender { 77 | [[self animator] setMagnification:1.0]; 78 | } 79 | 80 | - (IBAction)zoomIn:(id)sender { 81 | CGFloat scaleFactor = [self scaleFactor]; 82 | scaleFactor = (scaleFactor > 0.4 && scaleFactor < 0.6) ? 1.0 : scaleFactor * 2.0; 83 | [[self animator] setMagnification:scaleFactor]; 84 | } 85 | 86 | - (IBAction)zoomOut:(id)sender { 87 | CGFloat scaleFactor = [self scaleFactor]; 88 | scaleFactor = (scaleFactor > 1.8 && scaleFactor < 2.2) ? 1.0 : scaleFactor / 2.0; 89 | [[self animator] setMagnification:scaleFactor]; 90 | } 91 | 92 | /* Reassure AppKit that ScalingScrollView supports live resize content preservation, even though it's a subclass that could have modified NSScrollView in such a way as to make NSScrollView's live resize content preservation support inoperative. By default this is disabled for NSScrollView subclasses. 93 | */ 94 | - (BOOL)preservesContentDuringLiveResize { 95 | return [self drawsBackground]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /TextEdit Test Document.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf969 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 LucidaGrande;\f2\fnil\fcharset128 HiraKakuPro-W3; 3 | \f3\fnil\fcharset128 MS-Gothic;\f4\fnil\fcharset129 AppleGothic;} 4 | {\colortbl;\red255\green255\blue255;\red255\green0\blue0;\red0\green0\blue255;\red255\green0\blue255; 5 | \red26\green26\blue255;} 6 | \vieww11760\viewh13400\viewkind0 7 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 8 | 9 | \f0\fs24 \cf0 This is a test document for Apple's self-test suite. Saved on 10.3.3. \ 10 | 11 | \b Some bold text. 12 | \i\b0 Some italic text.\ 13 | 14 | \i0 ABCDEFGHIJKLMNOPQRSTUVWXYZ.\ 15 | abcdefghijklmnopqrstuvwxyz.\ 16 | 0123456789.\ 17 | \'f6\'fc\'e4\'e7\'e6\'e9\'ea\'83\'a9\'86\'a2\uc0\u8734 \'a7\'b6\'95\'aa\'ba\'96\'97\'a1\'99\'a3\u351 \u287 \'e5\u350 \u286 \'c5\u268 \u304 \u332 18 | \f1 \uc0\u393 \u415 .\ 19 | \uc0\u1040 \u1041 \u1042 \u1043 \u1044 \u1045 \u1072 \u1073 \u1074 \u1075 \u1076 \u1077 \ 20 | \uc0\u913 \u914 \u915 \u916 \u917 \u918 \u945 \u946 \u947 \u948 \u949 \u950 \ 21 | \uc0\u8531 \u8532 \u8533 \u8451 \u8457 \ 22 | \uc0\u8544 \u8545 \u8546 \u8547 \u8548 \u8549 \u8550 \u8551 \u8552 \u8553 \ 23 | 24 | \f2 \uc0\u8656 25 | \f3 \uc0\u8657 26 | \f4 \'a2\'a1 27 | \f3 \uc0\u8659 28 | \f1 \uc0\u8679 \u8682 29 | \f4 \'a1\'f8\'a1\'f9\'a1\'f6\'a1\'f7 30 | \f1 \ 31 | 32 | \f0 \kerning1\expnd3\expndtw15 33 | Loose kerning.\ 34 | \kerning1\expnd0\expndtw0 Normal \super Superscript\nosupersub \sub Subscript \nosupersub Normal.\ 35 | \pard\tx1440\tx2880\tx4320\tx5760\tx7200\tx8640\ql\qnatural 36 | \cf0 Left Tabs Every Inch.\ 37 | \pard\tqr\tx1420\tqr\tx2880\tqr\tx4320\tqr\tx5760\tqr\tx7200\tqr\tx8640\ql\qnatural 38 | \cf0 Right Tabs Every Inch.\ 39 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 40 | \cf0 Center Tabs Every Inch.\ 41 | \pard\tqdec\tx1440\tqdec\tx2880\tqdec\tx4320\tqdec\tx5760\tqdec\tx7200\tqdec\tx8640\ql\qnatural 42 | \cf0 Decimal 0.2 12345.6\ 43 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 44 | \cf0 \ul \ulc0 Single Underlined. \uldb Double Underlined. \ulnone \strike \strikec0 Single Strikethrough. \striked1 \strikec0 Double Strikethrough.\ 45 | \ul \ulc2 \strike0\striked0 Single Underlined. \uldb Double Underlined. Red underline.\ulnone \strike \strikec0 \ 46 | \strikec2 Single Strikethrough. \striked1 \strikec2 Double Strikethrough. Red strikethrough.\ 47 | \ul \ulc3 \strike \strikec2 Single blue underline and red strikethrough.\ 48 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 49 | \cf4 \ulnone \strike0\striked0 Purple text.\ 50 | \cf0 \outl\strokewidth60 \strokec0 Outlined text.\ 51 | 52 | \b \outl0\strokewidth0 NOTE: Shadowed text test has been removed for now\ 53 | 54 | \b0 A regular paragraph with no special line spacing. A regular paragraph with no special line spacing. A regular paragraph with no special line spacing. A regular paragraph with no special line spacing. A regular paragraph with no special line spacing. \ 55 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl480\slmult1\ql\qnatural 56 | \cf0 A paragraph with double line spacing. A paragraph with double line spacing. A paragraph with double line spacing. A paragraph with double line spacing. A paragraph with double line spacing. A paragraph with double line spacing. \ 57 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl-200\ql\qnatural 58 | \cf0 A paragraph with 10pt line spacing. A paragraph with 10pt line spacing. A paragraph with 10pt line spacing. A paragraph with 10pt line spacing. A paragraph with 10pt line spacing. A paragraph with 10pt line spacing. \outl\strokewidth60 \ 59 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\sl200\slmaximum400\ql\qnatural 60 | \cf0 \outl0\strokewidth0 A paragraph with at least 10pt and at most 20pt line spacing. A paragraph with at least 10pt and at most 20pt line spacing. A paragraph with at least 10pt and at most 20pt line spacing. A paragraph with at least 10pt and at most 20pt line spacing.\outl\strokewidth60 \ 61 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 62 | \cf0 \outl0\strokewidth0 Left Justified.\ 63 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qc 64 | \cf0 Centered.\ 65 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\qr 66 | \cf0 Right Justified.\ 67 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 68 | \cf0 Some Japanese text now:\ 69 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 70 | 71 | \f2 \cf0 \'82\'b1\'82\'cc\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'f0\'8a\'4a\'82\'a2\'82\'bd\'8c\'e3\'82\'dc\'82\'bd\'82\'cd\'95\'db\'91\'b6\'82\'b5\'82\'bd\'8c\'e3\'82\'c5\'81\'41\'95\'ca\'82\'cc\'83\'41\'83\'76\'83\'8a\'83\'50\'81\'5b\'83\'56\'83\'87\'83\'93\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'95\'cf\'8d\'58\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'81\'42 72 | \f0 \ 73 | Same Japanese text, outlined:\ 74 | 75 | \f2 \outl\strokewidth60 \'82\'b1\'82\'cc\'83\'74\'83\'40\'83\'43\'83\'8b\'82\'f0\'8a\'4a\'82\'a2\'82\'bd\'8c\'e3\'82\'dc\'82\'bd\'82\'cd\'95\'db\'91\'b6\'82\'b5\'82\'bd\'8c\'e3\'82\'c5\'81\'41\'95\'ca\'82\'cc\'83\'41\'83\'76\'83\'8a\'83\'50\'81\'5b\'83\'56\'83\'87\'83\'93\'82\'c9\'82\'e6\'82\'c1\'82\'c4\'95\'cf\'8d\'58\'82\'b3\'82\'ea\'82\'c4\'82\'a2\'82\'dc\'82\'b7\'81\'42\ 76 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 77 | 78 | \f0 \cf0 \outl0\strokewidth0 Composed chars (304B 309A):\ 79 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 80 | 81 | \f2 \cf0 \uc0\u12363 \u12442 \ 82 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 83 | 84 | \f0\b \cf0 NOTE: Glyph info test has been removed for now\ 85 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 86 | {\field{\*\fldinst{HYPERLINK "http://www.apple.com"}}{\fldrslt 87 | \b0 \cf5 \ul \ulc5 Link to Apple.}} \ 88 | \pard\tqc\tx1440\tqc\tx2880\tqc\tx4320\tqc\tx5760\tqc\tx7200\tqc\tx8640\ql\qnatural 89 | \cf0 Last line, everything back to normal.\ 90 | \ 91 | } -------------------------------------------------------------------------------- /TextEdit.scatterload: -------------------------------------------------------------------------------- 1 | start 2 | _main 3 | -[LinePanelController init] 4 | -[Preferences init] 5 | -[DocumentPropertiesPanelController init] 6 | +[Controller initialize] 7 | _defaultValues 8 | -[Controller setPreferencesController:] 9 | -[Controller setPropertiesController:] 10 | -[Controller setLineController:] 11 | -[DocumentController awakeFromNib] 12 | +[Document(TextEditNSDocumentOverrides) autosavesInPlace] 13 | -[Controller applicationDidFinishLaunching:] 14 | +[Document(TextEditNSDocumentOverrides) canConcurrentlyReadDocumentsOfType:] 15 | -[Document init] 16 | -[Document setBackgroundColor:] 17 | -[Document setEncoding:] 18 | -[Document setEncodingForSaving:] 19 | -[Document setScaleFactor:] 20 | -[Document setDocumentPropertiesToDefaults] 21 | -[Document knownDocumentProperties] 22 | -[Document documentPropertyToAttributeNameMappings] 23 | -[Document setValue:forKey:] 24 | -[Document setValue:forDocumentProperty:] 25 | -[DocumentController defaultType] 26 | -[Document printInfo] 27 | -[Document readFromURL:ofType:error:] 28 | -[DocumentController lastSelectedIgnoreHTMLForURL:] 29 | -[DocumentController lastSelectedIgnoreRichForURL:] 30 | -[DocumentController lastSelectedEncodingForURL:] 31 | -[Document readFromURL:ofType:encoding:ignoreRTF:ignoreHTML:error:] 32 | -[Document textStorage] 33 | -[Document isOpenedIgnoringRichText] 34 | -[Document textDocumentTypeToTextEditDocumentTypeMappingTable] 35 | ___-[Document textDocumentTypeToTextEditDocumentTypeMappingTable]_block_invoke_1 36 | -[Document applyDefaultTextAttributes:] 37 | -[Document defaultTextAttributes:] 38 | ___-[Document applyDefaultTextAttributes:]_block_invoke_1 39 | ___-[Document applyDefaultTextAttributes:]_block_invoke_2 40 | -[Document setHasMultiplePages:] 41 | -[Document setHyphenationFactor:] 42 | -[Document setReadOnly:] 43 | -[Document setOriginalOrientationSections:] 44 | -[Document(TextEditNSDocumentOverrides) updateChangeCount:] 45 | -[Document setTransient:] 46 | -[DocumentController addDocument:] 47 | -[Document(TextEditNSDocumentOverrides) makeWindowControllers] 48 | -[DocumentWindowController init] 49 | -[DocumentWindowController setDocument:] 50 | -[Document(TextEditNSDocumentOverrides) checkAutosavingSafetyAndReturnError:] 51 | -[Document hyphenationFactor] 52 | -[DocumentWindowController firstTextView] 53 | -[DocumentWindowController layoutManager] 54 | -[DocumentWindowController windowDidLoad] 55 | -[Document hasMultiplePages] 56 | -[DocumentWindowController setHasMultiplePages:force:] 57 | -[Document originalOrientationSections] 58 | -[DocumentWindowController configureTypingAttributesAndDefaultParagraphStyleForTextView:] 59 | -[Document isRichText] 60 | -[ScalingScrollView setHasHorizontalScroller:] 61 | -[ScalingScrollView setScaleFactor:adjustPopup:] 62 | -[ScalingScrollView setScaleFactor:] 63 | -[DocumentWindowController(Delegation) layoutManager:didCompleteLayoutForTextContainer:atEnd:] 64 | -[Document isReadOnly] 65 | -[ScalingScrollView tile] 66 | -[DocumentWindowController setupInitialTextViewSharedState] 67 | -[DocumentWindowController setupWindowForDocument] 68 | -[Document viewSize] 69 | -[DocumentWindowController setupTextViewForDocument] 70 | -[DocumentWindowController updateForRichTextAndRulerState] 71 | -[Document backgroundColor] 72 | -[DocumentWindowController observeValueForKeyPath:ofObject:change:context:] 73 | -[DocumentWindowController resizeWindowForViewSize:] 74 | _defaultTextPadding 75 | -[DocumentWindowController(Delegation) windowDidResize:] 76 | -[Document setViewSize:] 77 | -[Document validateMenuItem:] 78 | -[DocumentWindowController(NSMenuValidation) validateMenuItem:] 79 | -[DocumentPropertiesPanelController validateMenuItem:] 80 | _validateToggleItem 81 | -[DocumentController openUntitledDocumentAndDisplay:error:] 82 | -[Document isTransient] 83 | -[DocumentWindowController(Delegation) windowWillUseStandardFrame:defaultFrame:] 84 | -[DocumentWindowController showRulerDelayed:] 85 | -[DocumentWindowController(Delegation) windowDidMove:] 86 | -[DocumentWindowController showRuler:] 87 | -[Document(TextEditNSDocumentOverrides) checkAutosavingSafetyAfterChangeAndReturnError:] 88 | -[DocumentWindowController toggleRich:] 89 | -[Document toggleRichWillLoseInformation] 90 | -[DocumentWindowController didEndToggleRichSheet:returnCode:contextInfo:] 91 | -[DocumentController runModalOpenPanel:forTypes:] 92 | +[DocumentController encodingAccessory:includeDefaultEntry:encodingPopUp:checkBox:] 93 | -[EncodingPopUpButtonCell initWithCoder:] 94 | -[EncodingPopUpButtonCell selectItemAtIndex:] 95 | +[EncodingManager sharedInstance] 96 | -[EncodingManager init] 97 | -[EncodingManager setupPopUpCell:selectedEncoding:withDefaultEntry:] 98 | -[EncodingManager enabledEncodings] 99 | -[DocumentController openDocumentWithContentsOfURL:display:error:] 100 | -[DocumentController transientDocumentToReplace] 101 | -[Document(TextEditNSDocumentOverrides) writableTypesForSaveOperation:ignoreTemporaryState:] 102 | -[Document isConverted] 103 | -[Document isLossy] 104 | -[Document setPaperSize:] 105 | -[DocumentController displayDocument:] 106 | -[Document(TextEditNSDocumentOverrides) writableTypesForSaveOperation:] 107 | -[Document(TextEditNSDocumentOverrides) saveToURL:ofType:forSaveOperation:completionHandler:] 108 | -[DocumentWindowController breakUndoCoalescing] 109 | ___copy_helper_block_4 110 | -[Document(TextEditNSDocumentOverrides) canAsynchronouslyWriteToURL:ofType:forSaveOperation:] 111 | -[Document(TextEditNSDocumentOverrides) fileWrapperOfType:error:] 112 | -[Document paperSize] 113 | -[DocumentWindowController layoutOrientationSections] 114 | ___-[Document(TextEditNSDocumentOverrides) saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_1 115 | ___destroy_helper_block_4 116 | -[Document(TextEditNSDocumentOverrides) duplicateAndReturnError:] 117 | -[Document(TextEditNSDocumentOverrides) autosavingFileType] 118 | -[Document printOperationWithSettings:error:] 119 | -[PrintPanelAccessoryController initWithNibName:bundle:] 120 | -[PrintPanelAccessoryController setShowsWrappingToFit:] 121 | -[PrintingTextView setOriginalSize:] 122 | -[PrintingTextView setPrintPanelAccessoryController:] 123 | -[PrintPanelAccessoryController showsWrappingToFit] 124 | -[PrintPanelAccessoryController setRepresentedObject:] 125 | -[PrintPanelAccessoryController setPageNumbering:] 126 | -[PrintPanelAccessoryController setWrappingToFit:] 127 | -[PrintPanelAccessoryController keyPathsForValuesAffectingPreview] 128 | -[PrintingTextView knowsPageRange:] 129 | -[PrintingTextView printPanelAccessoryController] 130 | _documentSizeForPrintInfo 131 | -[PrintPanelAccessoryController wrappingToFit] 132 | -[NSTextView(TextEditAdditions) textEditDoForegroundLayoutToCharacterIndex:] 133 | -[PrintPanelAccessoryController localizedSummaryItems] 134 | -[PrintPanelAccessoryController pageNumbering] 135 | -[DocumentWindowController printInfoUpdated] 136 | -[Document togglePageBreaks:] 137 | -[MultiplePageView initWithFrame:] 138 | -[MultiplePageView setLineColor:] 139 | -[MultiplePageView setMarginColor:] 140 | -[MultiplePageView setPrintInfo:] 141 | -[MultiplePageView updateFrame] 142 | -[MultiplePageView isFlipped] 143 | -[MultiplePageView setLayoutOrientation:] 144 | -[DocumentWindowController addPage] 145 | -[DocumentWindowController numberOfPages] 146 | -[MultiplePageView numberOfPages] 147 | -[MultiplePageView documentSizeInPage] 148 | -[MultiplePageView layoutOrientation] 149 | -[MultiplePageView setNumberOfPages:] 150 | -[MultiplePageView documentRectForPageNumber:] 151 | -[MultiplePageView pageRectForPageNumber:] 152 | -[MultiplePageView pageSeparatorHeight] 153 | -[MultiplePageView showsScalePopUpButton] 154 | -[ScalingScrollView makeScalePopUpButton] 155 | -[ScalingScrollView drawRect:] 156 | -[MultiplePageView isOpaque] 157 | -[MultiplePageView drawRect:] 158 | -[DocumentWindowController doToggleRichAfterSaving] 159 | -[DocumentWindowController setRichText:] 160 | -[Document setRichText:] 161 | -[Document clearDocumentProperties] 162 | -[DocumentWindowController convertTextForRichTextStateRemoveAttachments:] 163 | -[DocumentWindowController removeAttachments] 164 | -[Document hasDocumentProperties] 165 | -[Preferences HTMLStylingMode] 166 | -[Preferences HTMLDocumentType] 167 | -[Preferences plainTextFont] 168 | -[FontNameTransformer transformedValue:] 169 | -[Preferences richTextFont] 170 | -[Preferences windowDidLoad] 171 | -[Preferences windowShouldClose:] 172 | -[Document scaleFactor] 173 | -[DocumentWindowController setDocumentEdited:] 174 | -[DocumentWindowController dealloc] 175 | -[MultiplePageView dealloc] 176 | -------------------------------------------------------------------------------- /TextEdit.scriptSuite: -------------------------------------------------------------------------------- 1 | { 2 | "Name" = "TextEdit"; 3 | "AppleEventCode" = "txdt"; 4 | 5 | "Classes" = { 6 | "NSApplication" = { 7 | "Superclass" = "NSCoreSuite.NSApplication"; 8 | "ToManyRelationships" = { 9 | "orderedDocuments" = { 10 | "Type" = "Document"; 11 | "AppleEventCode" = "docu"; 12 | }; 13 | }; 14 | "AppleEventCode" = "capp"; 15 | }; 16 | "Document" = { 17 | "Superclass" = "NSCoreSuite.NSDocument"; 18 | "AppleEventCode" = "docu"; 19 | "DefaultSubcontainerAttribute" = "textStorage"; 20 | "ToOneRelationships" = { 21 | "textStorage" = { 22 | "Type" = "NSTextSuite.NSTextStorage"; 23 | "AppleEventCode" = "ctxt"; 24 | }; 25 | }; 26 | }; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /TextEdit.scriptTerminology: -------------------------------------------------------------------------------- 1 | { 2 | "Name" = "TextEdit suite"; 3 | "Description" = "TextEdit specific classes."; 4 | 5 | "Classes" = { 6 | "NSApplication" = { 7 | "Name" = "application"; 8 | "PluralName" = "applications"; 9 | "Description" = "TextEdit's top level scripting object."; 10 | }; 11 | "Document" = { 12 | "Name" = "document"; 13 | "PluralName" = "documents"; 14 | "Description" = "A TextEdit document."; 15 | "ToOneRelationships" = { 16 | "textStorage" = { 17 | "Name" = "text"; 18 | "Description" = "The text of the document."; 19 | }; 20 | }; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /TextEdit.xcodeproj/xcshareddata/xcschemes/TextEdit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /TextEditDefaultsKeys.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: TextEditDefaultsKeys.h 4 | Abstract: Keys used for preferences. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | // Note that not all keys in this file are exposed in the UI. Some of them are not used at all, but are kept for reference. 51 | #define RichText @"RichText" 52 | #define ShowPageBreaks @"ShowPageBreaks" 53 | #define AddExtensionToNewPlainTextFiles @"AddExtensionToNewPlainTextFiles" 54 | #define WindowWidth @"WidthInChars" 55 | #define WindowHeight @"HeightInChars" 56 | #define PlainTextEncodingForRead @"PlainTextEncoding" 57 | #define PlainTextEncodingForWrite @"PlainTextEncodingForWrite" 58 | #define IgnoreRichText @"IgnoreRichText" 59 | #define IgnoreHTML @"IgnoreHTML" 60 | #define TabWidth @"TabWidth" 61 | #define ForegroundLayoutToIndex @"ForegroundLayoutToIndex" 62 | #define OpenPanelFollowsMainWindow @"OpenPanelFollowsMainWindow" 63 | #define CheckSpellingAsYouType @"CheckSpellingWhileTyping" 64 | #define CheckGrammarWithSpelling @"CheckGrammarWithSpelling" 65 | #define CorrectSpellingAutomatically @"CorrectSpellingAutomatically" 66 | #define ShowRuler @"ShowRuler" 67 | #define SmartCopyPaste @"SmartCopyPaste" 68 | #define SmartQuotes @"SmartQuotes" 69 | #define SmartDashes @"SmartDashes" 70 | #define SmartLinks @"SmartLinks" 71 | #define DataDetectors @"DataDetectors" 72 | #define TextReplacement @"TextReplacement" 73 | #define SubstitutionsEnabledInRichTextOnly @"SubstitutionsEnabledInRichTextOnly" 74 | #define UseXHTMLDocType @"UseXHTMLDocType" 75 | #define UseTransitionalDocType @"UseTransitionalDocType" 76 | #define UseEmbeddedCSS @"UseEmbeddedCSS" 77 | #define UseInlineCSS @"UseInlineCSS" 78 | #define HTMLEncoding @"HTMLEncoding" 79 | #define PreserveWhitespace @"PreserveWhitespace" 80 | #define AutosavingDelay @"AutosavingDelay" 81 | #define NumberPagesWhenPrinting @"NumberPagesWhenPrinting" 82 | #define WrapToFitWhenPrinting @"WrapToFitWhenPrinting" 83 | #define UseScreenFonts @"UseScreenFonts" 84 | 85 | // Use different convention for the key values here, to be consistent with the keys in Document 86 | #define AuthorProperty @"author" 87 | #define CompanyProperty @"company" 88 | #define CopyrightProperty @"copyright" 89 | 90 | -------------------------------------------------------------------------------- /TextEditErrors.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: TextEditErrors.h 4 | Abstract: Definition of TextEdit-specific error domain and codes for NSError. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #define TextEditErrorDomain @"com.apple.TextEdit" 51 | 52 | enum { 53 | TextEditSaveErrorConvertedDocument = 1, 54 | TextEditSaveErrorLossyDocument = 2, 55 | TextEditSaveErrorWritableTypeRequired = 3, 56 | TextEditSaveErrorEncodingInapplicable = 4, 57 | TextEditOpenDocumentWithSelectionServiceFailed = 100, 58 | TextEditInvalidLineSpecification = 200, 59 | TextEditOutOfRangeLineSpecification = 201, 60 | TextEditAttachFilesFailure = 300 61 | }; 62 | 63 | 64 | -------------------------------------------------------------------------------- /TextEditMisc.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | File: TextEditMisc.h 4 | Abstract: Miscellaneous helper functions and methods. 5 | 6 | Version: 1.9 7 | 8 | Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple 9 | Inc. ("Apple") in consideration of your agreement to the following 10 | terms, and your use, installation, modification or redistribution of 11 | this Apple software constitutes acceptance of these terms. If you do 12 | not agree with these terms, please do not use, install, modify or 13 | redistribute this Apple software. 14 | 15 | In consideration of your agreement to abide by the following terms, and 16 | subject to these terms, Apple grants you a personal, non-exclusive 17 | license, under Apple's copyrights in this original Apple software (the 18 | "Apple Software"), to use, reproduce, modify and redistribute the Apple 19 | Software, with or without modifications, in source and/or binary forms; 20 | provided that if you redistribute the Apple Software in its entirety and 21 | without modifications, you must retain this notice and the following 22 | text and disclaimers in all such redistributions of the Apple Software. 23 | Neither the name, trademarks, service marks or logos of Apple Inc. may 24 | be used to endorse or promote products derived from the Apple Software 25 | without specific prior written permission from Apple. Except as 26 | expressly stated in this notice, no other rights or licenses, express or 27 | implied, are granted by Apple herein, including but not limited to any 28 | patent rights that may be infringed by your derivative works or by other 29 | works in which the Apple Software may be incorporated. 30 | 31 | The Apple Software is provided by Apple on an "AS IS" basis. APPLE 32 | MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION 33 | THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS 34 | FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND 35 | OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. 36 | 37 | IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 38 | OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 39 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 40 | INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, 41 | MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED 42 | AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), 43 | STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE 44 | POSSIBILITY OF SUCH DAMAGE. 45 | 46 | Copyright (C) 2013 Apple Inc. All Rights Reserved. 47 | 48 | */ 49 | 50 | #import 51 | 52 | /* Returns the default padding on the left/right edges of text views */ 53 | CGFloat defaultTextPadding(void); 54 | 55 | /* Helper used in toggling menu items in validate methods, based on a condition (useFirst) */ 56 | void validateToggleItem(NSMenuItem *menuItem, BOOL useFirst, NSString *first, NSString *second); 57 | 58 | /* Truncate string to no longer than truncationLength; should be > 10 */ 59 | NSString *truncatedString(NSString *str, NSUInteger truncationLength); 60 | 61 | /* Return the text view size appropriate for the NSPrintInfo */ 62 | NSSize documentSizeForPrintInfo(NSPrintInfo *printInfo); 63 | 64 | /* A method on NSTextView to cause layout up to the specified index */ 65 | @interface NSTextView (TextEditAdditions) 66 | - (void)textEditDoForegroundLayoutToCharacterIndex:(NSUInteger)loc; 67 | @end 68 | 69 | -------------------------------------------------------------------------------- /UniversalDetector.framework/Headers: -------------------------------------------------------------------------------- 1 | Versions/Current/Headers -------------------------------------------------------------------------------- /UniversalDetector.framework/Resources: -------------------------------------------------------------------------------- 1 | Versions/Current/Resources -------------------------------------------------------------------------------- /UniversalDetector.framework/UniversalDetector: -------------------------------------------------------------------------------- 1 | Versions/Current/UniversalDetector -------------------------------------------------------------------------------- /UniversalDetector.framework/Versions/A/Headers/UniversalDetector.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface UniversalDetector:NSObject 4 | { 5 | void *detector; 6 | NSString *charset; 7 | float confidence; 8 | const char *lastcstring; 9 | } 10 | 11 | +(UniversalDetector *)detector; 12 | +(NSArray *)possibleMIMECharsets; 13 | 14 | -(id)init; 15 | -(void)dealloc; 16 | 17 | -(void)analyzeData:(NSData *)data; 18 | -(void)analyzeBytes:(const char *)data length:(int)len; 19 | -(void)reset; 20 | 21 | -(BOOL)done; 22 | -(NSString *)MIMECharset; 23 | -(float)confidence; 24 | 25 | #ifdef __APPLE__ 26 | -(NSStringEncoding)encoding; 27 | #endif 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /UniversalDetector.framework/Versions/A/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 13A598 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | UniversalDetector 11 | CFBundleIdentifier 12 | org.mozilla.universalchardet 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | UniversalDetector 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.1 23 | DTCompiler 24 | com.apple.compilers.llvm.clang.1_0 25 | DTPlatformBuild 26 | 5A2034a 27 | DTPlatformVersion 28 | GM 29 | DTSDKBuild 30 | 13A595 31 | DTSDKName 32 | macosx10.9 33 | DTXcode 34 | 0501 35 | DTXcodeBuild 36 | 5A2034a 37 | 38 | 39 | -------------------------------------------------------------------------------- /UniversalDetector.framework/Versions/A/UniversalDetector: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/UniversalDetector.framework/Versions/A/UniversalDetector -------------------------------------------------------------------------------- /UniversalDetector.framework/Versions/Current: -------------------------------------------------------------------------------- 1 | A -------------------------------------------------------------------------------- /Version.xcconfig: -------------------------------------------------------------------------------- 1 | CURRENT_PROJECT_VERSION = 309 2 | 3 | -------------------------------------------------------------------------------- /html.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_128x128.png -------------------------------------------------------------------------------- /html.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /html.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_16x16.png -------------------------------------------------------------------------------- /html.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /html.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_256x256.png -------------------------------------------------------------------------------- /html.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /html.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_32x32.png -------------------------------------------------------------------------------- /html.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /html.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_512x512.png -------------------------------------------------------------------------------- /html.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/html.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /rtf.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_128x128.png -------------------------------------------------------------------------------- /rtf.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /rtf.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_16x16.png -------------------------------------------------------------------------------- /rtf.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /rtf.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_256x256.png -------------------------------------------------------------------------------- /rtf.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /rtf.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_32x32.png -------------------------------------------------------------------------------- /rtf.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /rtf.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_512x512.png -------------------------------------------------------------------------------- /rtf.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtf.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_128x128.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_16x16.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_256x256.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_32x32.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_512x512.png -------------------------------------------------------------------------------- /rtfd.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/rtfd.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /txt.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_128x128.png -------------------------------------------------------------------------------- /txt.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /txt.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_16x16.png -------------------------------------------------------------------------------- /txt.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /txt.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_256x256.png -------------------------------------------------------------------------------- /txt.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /txt.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_32x32.png -------------------------------------------------------------------------------- /txt.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /txt.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_512x512.png -------------------------------------------------------------------------------- /txt.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjgod/TextEditPlus/3228b7a96f27dde64bc2313e8edd34cafb87a2f3/txt.iconset/icon_512x512@2x.png --------------------------------------------------------------------------------