Index: unk/aux/cocotron/win32/cocotron/cocotron-r621.patch
===================================================================
--- /trunk/aux/cocotron/win32/cocotron/cocotron-r621.patch	(revision 12726)
+++ 	(revision )
@@ -1,158 +1,0 @@
-
-Property changes on: Cocoa/Cocoa.xcodeproj
-___________________________________________________________________
-Modified: svn:ignore
-   - *.mode1
-*.pbxuser
-*.mode1v3
-
-   + *.mode1
-*.pbxuser
-*.mode1v3
-*.perspectivev3
-
-
-Index: Foundation/NSUserDefaults/NSUserDefaults.m
-===================================================================
---- Foundation/NSUserDefaults/NSUserDefaults.m	(revision 621)
-+++ Foundation/NSUserDefaults/NSUserDefaults.m	(working copy)
-@@ -313,16 +313,19 @@
- }
- 
- -(NSInteger)integerForKey:(NSString *)defaultName {
--   NSNumber *number=[self objectForKey:defaultName];
-+   id number=[self objectForKey:defaultName];
- 
--   return [number isKindOfClass:objc_lookUpClass("NSNumber")]?[number intValue]:0;
-+   return [number isKindOfClass:objc_lookUpClass("NSString")]?[(NSString *)number intValue]:
-+     ([number isKindOfClass:objc_lookUpClass("NSNumber")]?[(NSNumber *)number intValue]:0);
- }
- 
- 
- -(float)floatForKey:(NSString *)defaultName {
--   NSNumber *number=[self objectForKey:defaultName];
-+   id number=[self objectForKey:defaultName];
- 
--   return [number isKindOfClass:objc_lookUpClass("NSNumber")]?[number floatValue]:0.0f;
-+   return [number isKindOfClass:objc_lookUpClass("NSString")]?[(NSString *)number floatValue]:
-+     ([number isKindOfClass:objc_lookUpClass("NSNumber")]?[(NSNumber *)number floatValue]:0.0);
-+
- }
- 
- -(void)setObject:value forKey:(NSString *)key {
-@@ -338,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 621)
-+++ AppKit/NSApplication.h	(working copy)
-@@ -9,8 +9,9 @@
- #import <AppKit/NSResponder.h>
- #import <AppKit/AppKitExport.h>
- #import <AppKit/NSGraphics.h>
-+#import <AppKit/NSWindow.h>
- 
--@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 621)
-+++ AppKit/NSApplication.m	(working copy)
-@@ -29,6 +29,7 @@
- #import <AppKit/CGWindow.h>
- #import <AppKit/NSRaise.h>
- #import <objc/message.h>
-+#import <AppKit/NSWindow.h>
- 
- 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 621)
-+++ 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";
Index: /trunk/aux/cocotron/win32/cocotron/cocotron-r622.patch
===================================================================
--- /trunk/aux/cocotron/win32/cocotron/cocotron-r622.patch	(revision 12727)
+++ /trunk/aux/cocotron/win32/cocotron/cocotron-r622.patch	(revision 12727)
@@ -0,0 +1,226 @@
+Index: Foundation/NSUserDefaults/NSUserDefaults.m
+===================================================================
+--- Foundation/NSUserDefaults/NSUserDefaults.m	(revision 622)
++++ Foundation/NSUserDefaults/NSUserDefaults.m	(working copy)
+@@ -313,16 +313,19 @@
+ }
+ 
+ -(NSInteger)integerForKey:(NSString *)defaultName {
+-   NSNumber *number=[self objectForKey:defaultName];
++   id number=[self objectForKey:defaultName];
+ 
+-   return [number isKindOfClass:objc_lookUpClass("NSNumber")]?[number intValue]:0;
++   return [number isKindOfClass:objc_lookUpClass("NSString")]?[(NSString *)number intValue]:
++     ([number isKindOfClass:objc_lookUpClass("NSNumber")]?[(NSNumber *)number intValue]:0);
+ }
+ 
+ 
+ -(float)floatForKey:(NSString *)defaultName {
+-   NSNumber *number=[self objectForKey:defaultName];
++   id number=[self objectForKey:defaultName];
+ 
+-   return [number isKindOfClass:objc_lookUpClass("NSNumber")]?[number floatValue]:0.0f;
++   return [number isKindOfClass:objc_lookUpClass("NSString")]?[(NSString *)number floatValue]:
++     ([number isKindOfClass:objc_lookUpClass("NSNumber")]?[(NSNumber *)number floatValue]:0.0);
++
+ }
+ 
+ -(void)setObject:value forKey:(NSString *)key {
+@@ -338,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 622)
++++ AppKit/NSApplication.h	(working copy)
+@@ -9,8 +9,9 @@
+ #import <AppKit/NSResponder.h>
+ #import <AppKit/AppKitExport.h>
+ #import <AppKit/NSGraphics.h>
++#import <AppKit/NSWindow.h>
+ 
+-@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 622)
++++ AppKit/NSApplication.m	(working copy)
+@@ -29,6 +29,7 @@
+ #import <AppKit/CGWindow.h>
+ #import <AppKit/NSRaise.h>
+ #import <objc/message.h>
++#import <AppKit/NSWindow.h>
+ 
+ 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/OpenGL.subproj/NSOpenGLContext.h
+===================================================================
+--- AppKit/OpenGL.subproj/NSOpenGLContext.h	(revision 622)
++++ AppKit/OpenGL.subproj/NSOpenGLContext.h	(working copy)
+@@ -35,8 +35,9 @@
+ -(void)setView:(NSView *)view;
+ 
+ -(void)makeCurrentContext;
++-(void)_clearCurrentContext;
++
+ -(int)currentVirtualScreen;
+-
+ -(void)setCurrentVirtualScreen:(int)screen;
+ -(void)setFullScreen;
+ -(void)setOffscreen:(void *)bytes width:(long)width height:(long)height rowbytes:(long)rowbytes;
+Index: AppKit/OpenGL.subproj/NSOpenGLDrawable.m
+===================================================================
+--- AppKit/OpenGL.subproj/NSOpenGLDrawable.m	(revision 622)
++++ AppKit/OpenGL.subproj/NSOpenGLDrawable.m	(working copy)
+@@ -19,6 +19,9 @@
+ -(void)makeCurrentWithGLContext:(void *)glContext {
+ }
+ 
++-(void)clearCurrentWithGLContext:(void *)glContext {
++}
++
+ -(void)swapBuffers {
+ }
+ 
+Index: AppKit/OpenGL.subproj/NSOpenGLContext.m
+===================================================================
+--- AppKit/OpenGL.subproj/NSOpenGLContext.m	(revision 622)
++++ AppKit/OpenGL.subproj/NSOpenGLContext.m	(working copy)
+@@ -22,6 +22,9 @@
+ }
+ 
+ +(void)clearCurrentContext {
++   if(currentContext!=nil) {
++      [currentContext _clearCurrentContext];
++   }
+    currentContext=nil;
+ }
+ 
+@@ -89,6 +92,11 @@
+    currentContext=self;
+ }
+ 
++-(void)_clearCurrentContext {
++  if (_drawable!=nil)
++    [_drawable clearCurrentWithGLContext:_glContext];
++}
++
+ -(int)currentVirtualScreen {
+    NSUnimplementedMethod();
+    return 0;
+Index: AppKit/OpenGL.subproj/NSOpenGLDrawable.h
+===================================================================
+--- AppKit/OpenGL.subproj/NSOpenGLDrawable.h	(revision 622)
++++ AppKit/OpenGL.subproj/NSOpenGLDrawable.h	(working copy)
+@@ -11,6 +11,7 @@
+ -(void)invalidate;
+ -(void)updateWithView:(NSView *)view;
+ -(void)makeCurrentWithGLContext:(void *)glContext;
++-(void)clearCurrentWithGLContext:(void *)glContext;
+ -(void)swapBuffers;
+ 
+ @end
+Index: AppKit/Win32.subproj/NSOpenGLDrawable_gdiView.m
+===================================================================
+--- AppKit/Win32.subproj/NSOpenGLDrawable_gdiView.m	(revision 622)
++++ AppKit/Win32.subproj/NSOpenGLDrawable_gdiView.m	(working copy)
+@@ -226,6 +226,10 @@
+     NSLog(@"wglMakeCurrent failed");
+ }
+ 
++-(void)clearCurrentWithGLContext:(HGLRC)glContext {   
++   opengl_wglMakeCurrent(NULL,NULL);
++}
++
+ -(void)swapBuffers {
+    SwapBuffers(_dc);
+ }
+Index: AppKit/NSDocument.m
+===================================================================
+--- AppKit/NSDocument.m	(revision 622)
++++ 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";
