Index: Foundation/NSUserDefaults/NSUserDefaults.m =================================================================== --- Foundation/NSUserDefaults/NSUserDefaults.m (revision 633) +++ Foundation/NSUserDefaults/NSUserDefaults.m (working copy) @@ -341,11 +341,11 @@ } -(void)setInteger:(NSInteger)value forKey:(NSString *)defaultName { - [self setObject:[NSNumber numberWithInteger:value] forKey:defaultName]; + [self setObject:[NSString stringWithFormat: @"%d",value] forKey:defaultName]; } -(void)setFloat:(float)value forKey:(NSString *)defaultName { - [self setObject:[NSNumber numberWithFloat:value] forKey:defaultName]; + [self setObject:[NSString stringWithFormat: @"%f",value] forKey:defaultName]; } -(void)removeObjectForKey:(NSString *)key { Index: AppKit/NSApplication.h =================================================================== --- AppKit/NSApplication.h (revision 633) +++ AppKit/NSApplication.h (working copy) @@ -9,8 +9,9 @@ #import #import #import +#import -@class NSWindow,NSImage,NSMenu, NSPasteboard, NSDisplay; +@class NSWindow,NSImage,NSMenu, NSPasteboard, NSDisplay, NSWindowController, NSDocument; APPKIT_EXPORT NSString *NSModalPanelRunLoopMode; APPKIT_EXPORT NSString *NSEventTrackingRunLoopMode; @@ -209,6 +210,7 @@ @end @interface NSObject(NSApplication_serviceRequest) + -(BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types; @end Index: AppKit/NSApplication.m =================================================================== --- AppKit/NSApplication.m (revision 633) +++ AppKit/NSApplication.m (working copy) @@ -29,6 +29,7 @@ #import #import #import +#import NSString *NSModalPanelRunLoopMode=@"NSModalPanelRunLoopMode"; NSString *NSEventTrackingRunLoopMode=@"NSEventTrackingRunLoopMode"; @@ -413,6 +414,11 @@ needsUntitled = [_delegate applicationShouldOpenUntitledFile: self]; } + if(needsUntitled && _delegate && [_delegate respondsToSelector: @selector(applicationOpenUntitledFile:)]) { + needsUntitled = ![_delegate applicationOpenUntitledFile: self]; + } + + if(needsUntitled && controller && ![controller documentClassForType:[controller defaultType]]) { needsUntitled = NO; } @@ -466,12 +472,18 @@ } -(void)run { - - NSAutoreleasePool *pool=[NSAutoreleasePool new]; - [self finishLaunching]; - [pool release]; + static BOOL didlaunch = NO; + NSAutoreleasePool *pool; + + _isRunning=YES; + + if (!didlaunch) { + didlaunch = YES; + pool=[NSAutoreleasePool new]; + [self finishLaunching]; + [pool release]; + } - _isRunning=YES; do { pool = [NSAutoreleasePool new]; Index: AppKit/NSDocument.m =================================================================== --- AppKit/NSDocument.m (revision 633) +++ AppKit/NSDocument.m (working copy) @@ -21,6 +21,8 @@ @implementation NSDocument +static int untitled_document_number = 0; + +(NSArray *)readableTypes { int i; NSArray *knownDocTypes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDocumentTypes"]; @@ -98,7 +100,7 @@ _fileURL=nil; _fileType=nil; _changeCount=0; - _untitledNumber=0; + _untitledNumber=untitled_document_number++; _hasUndoManager=YES; _activeEditors=[NSMutableArray new]; } @@ -344,7 +346,7 @@ { if(_fileURL==nil) { - if(_untitledNumber > 1) + if(_untitledNumber != 0) return [NSString stringWithFormat:@"Untitled %d", _untitledNumber]; else return @"Untitled";