diff --git a/TextEd.xcodeproj/project.pbxproj b/TextEd.xcodeproj/project.pbxproj index 0088485..6087c3a 100644 --- a/TextEd.xcodeproj/project.pbxproj +++ b/TextEd.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 1F857063188F11FC00C56A96 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F85703F188F11FC00C56A96 /* Cocoa.framework */; }; 1F85706B188F11FC00C56A96 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F857069188F11FC00C56A96 /* InfoPlist.strings */; }; 1F85706D188F11FC00C56A96 /* TextEdTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F85706C188F11FC00C56A96 /* TextEdTests.m */; }; + 1F85707A188F27DA00C56A96 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 1F857079188F27DA00C56A96 /* Icon.icns */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -52,6 +53,7 @@ 1F857068188F11FC00C56A96 /* TextEdTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TextEdTests-Info.plist"; sourceTree = ""; }; 1F85706A188F11FC00C56A96 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 1F85706C188F11FC00C56A96 /* TextEdTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TextEdTests.m; sourceTree = ""; }; + 1F857079188F27DA00C56A96 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Icon.icns; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -134,6 +136,7 @@ 1F857048188F11FC00C56A96 /* InfoPlist.strings */, 1F85704B188F11FC00C56A96 /* main.m */, 1F85704D188F11FC00C56A96 /* TextEd-Prefix.pch */, + 1F857079188F27DA00C56A96 /* Icon.icns */, 1F85704E188F11FC00C56A96 /* Credits.rtf */, ); name = "Supporting Files"; @@ -238,6 +241,7 @@ 1F85704A188F11FC00C56A96 /* InfoPlist.strings in Resources */, 1F857050188F11FC00C56A96 /* Credits.rtf in Resources */, 1F857059188F11FC00C56A96 /* MainMenu.xib in Resources */, + 1F85707A188F27DA00C56A96 /* Icon.icns in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TextEd/Base.lproj/Document.xib b/TextEd/Base.lproj/Document.xib index b30d47d..b89c849 100644 --- a/TextEd/Base.lproj/Document.xib +++ b/TextEd/Base.lproj/Document.xib @@ -1,11 +1,12 @@ - + - + + @@ -13,26 +14,51 @@ - + - + - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - + + + + @@ -40,5 +66,6 @@ + \ No newline at end of file diff --git a/TextEd/Document.h b/TextEd/Document.h index 923259a..5936be5 100644 --- a/TextEd/Document.h +++ b/TextEd/Document.h @@ -8,6 +8,11 @@ #import -@interface Document : NSDocument +@interface Document : NSDocument { + NSAttributedString *stringModel; +} + +@property (unsafe_unretained) IBOutlet NSTextView *textView; +@property (nonatomic, readwrite) NSAttributedString *stringModel; @end diff --git a/TextEd/Document.m b/TextEd/Document.m index d672846..9f88652 100644 --- a/TextEd/Document.m +++ b/TextEd/Document.m @@ -9,6 +9,8 @@ #import "Document.h" @implementation Document +@synthesize textView; +@synthesize stringModel; - (id)init { @@ -29,6 +31,7 @@ - (void)windowControllerDidLoadNib:(NSWindowController *)aController { [super windowControllerDidLoadNib:aController]; + [self.textView setFont:[NSFont userFixedPitchFontOfSize:16]]; // Add any code here that needs to be executed once the windowController has loaded the document's window. } @@ -39,21 +42,20 @@ - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { - // Insert code here to write your document to data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning nil. - // You can also choose to override -fileWrapperOfType:error:, -writeToURL:ofType:error:, or -writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead. - NSException *exception = [NSException exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil]; - @throw exception; - return nil; + NSData *data = [[self.textView.textStorage string] dataUsingEncoding:NSUTF8StringEncoding]; + [self.textView breakUndoCoalescing]; + + if (!data && outError) { + *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:nil]; + } + + return data; } - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { - // Insert code here to read your document from the given data of the specified type. If outError != NULL, ensure that you create and set an appropriate error when returning NO. - // You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead. - // If you override either of these, you should also override -isEntireFileLoaded to return NO if the contents are lazily loaded. - NSException *exception = [NSException exceptionWithName:@"UnimplementedMethod" reason:[NSString stringWithFormat:@"%@ is unimplemented", NSStringFromSelector(_cmd)] userInfo:nil]; - @throw exception; - return YES; + self.stringModel = [[NSAttributedString alloc] initWithString:[NSString stringWithUTF8String:[data bytes]]]; + return !!self.stringModel; } @end diff --git a/TextEd/Icon.icns b/TextEd/Icon.icns new file mode 100644 index 0000000..29cbac4 Binary files /dev/null and b/TextEd/Icon.icns differ diff --git a/TextEd/TextEd-Info.plist b/TextEd/TextEd-Info.plist index e95eb49..7347bc8 100644 --- a/TextEd/TextEd-Info.plist +++ b/TextEd/TextEd-Info.plist @@ -28,9 +28,9 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIconFile - + Icon.icns CFBundleIdentifier - net.jeena.${PRODUCT_NAME:rfc1034identifier} + nu.jabs.${PRODUCT_NAME:rfc1034identifier} CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -43,6 +43,8 @@ ???? CFBundleVersion 1 + LSApplicationCategoryType + public.app-category.productivity LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/TextEd/en.lproj/Credits.rtf b/TextEd/en.lproj/Credits.rtf index 46576ef..e272d9d 100644 --- a/TextEd/en.lproj/Credits.rtf +++ b/TextEd/en.lproj/Credits.rtf @@ -1,29 +1,16 @@ -{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} +{\rtf1\ansi\ansicpg1252\cocoartf1265 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} -\paperw9840\paperh8400 -\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural +\paperw11900\paperh16840\vieww9600\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural -\f0\b\fs24 \cf0 Engineering: -\b0 \ - Some people\ +\f0\b\fs24 \cf0 TextEd.app +\b0 is here to replace Apples TextEdit.app since it doesn't start right away anymore and can not be used as a notepad anymore, the startup time is just too slow.\ \ - -\b Human Interface Design: -\b0 \ - Some other people\ +It doesn't work with RDF, only with plain text. Therefor a monospace font is used.\ \ - -\b Testing: -\b0 \ - Hopefully not nobody\ +Jabs Nu \ \ - -\b Documentation: -\b0 \ - Whoever\ -\ - -\b With special thanks to: -\b0 \ - Mom\ -} +Thanks to +\i Yellow Icon Design +\i0 for the icon } \ No newline at end of file