Permalink
Browse files

Merge commit 'origin/master' into native-build

  • Loading branch information...
2 parents a2a8fa9 + f67c3f8 commit 031ad9dfbcf0ab490b41d271467376e6d1941b5d farcaller committed Sep 22, 2009
Showing 340 changed files with 13,000 additions and 3,236 deletions.
View
@@ -25,6 +25,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSCachedImageRep.h>
#import <AppKit/NSCell.h>
#import <AppKit/NSClipView.h>
+#import <AppKit/NSCollectionView.h>
#import <AppKit/NSColor.h>
#import <AppKit/NSColorList.h>
#import <AppKit/NSColorPanel.h>
@@ -78,10 +79,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSNibOutletConnector.h>
#import <AppKit/NSObjectController.h>
#import <AppKit/NSOpenPanel.h>
-#import <AppKit/NSOpenGLContext.h>
-#import <AppKit/NSOpenGLView.h>
-#import <AppKit/NSOpenGLPixelBuffer.h>
-#import <AppKit/NSOpenGLPixelFormat.h>
+#import <AppKit/NSOpenGL.h>
#import <AppKit/NSOutlineView.h>
#import <AppKit/NSPageLayout.h>
#import <AppKit/NSPanel.h>

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,12 +1,10 @@
-/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
+/* Copyright (c) 2006-2007 Christopher J. W. Lloyd <cjwl@objc.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-
-// Original - Christopher Lloyd <cjwl@objc.net>
#import <AppKit/NSActionCell.h>
#import <Foundation/NSKeyedArchiver.h>
View
@@ -389,9 +389,11 @@ -(void)layoutIfNeeded {
-(void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo {
typedef void (*alertDidEnd)(id,SEL,NSAlert *,int,void *);
- alertDidEnd endFunction=(alertDidEnd)[_sheetDelegate methodForSelector:_sheetDidEnd];
+ if (_sheetDidEnd) {
+ alertDidEnd endFunction=(alertDidEnd)[_sheetDelegate methodForSelector:_sheetDidEnd];
- endFunction(_sheetDelegate,_sheetDidEnd,self,returnCode,contextInfo);
+ endFunction(_sheetDelegate,_sheetDidEnd,self,returnCode,contextInfo);
+ }
[self release];
}
No changes.
No changes.
View
@@ -8,6 +8,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#import <AppKit/NSResponder.h>
#import <AppKit/AppKitExport.h>
+#import <AppKit/NSGraphics.h>
@class NSWindow,NSImage,NSMenu, NSPasteboard, NSDisplay;
@@ -84,6 +85,8 @@ typedef enum {
NSEvent *_currentEvent;
NSMutableArray *_modalStack;
+ NSMutableArray *_orderedDocuments;
+ NSMutableArray *_orderedWindows;
}
+(NSApplication *)sharedApplication;
@@ -200,6 +203,9 @@ typedef enum {
-(void)_windowDidBecomeActive:(NSWindow *)window;
-(void)_windowWillBecomeDeactive:(NSWindow *)window;
-(void)_windowDidBecomeDeactive:(NSWindow *)window;
+-(void)_windowOrderingChange:(NSWindowOrderingMode)place forWindow:(NSWindow *)window relativeTo:(NSWindow *)relativeWindow;
+-(void)_updateOrderedDocuments;
+
@end
@interface NSObject(NSApplication_serviceRequest)
View
@@ -125,6 +125,8 @@ -(void)_closeSplashImage {
_display=[[NSDisplay currentDisplay] retain];
_windows=[NSMutableArray new];
+ _orderedWindows=[NSMutableArray new];
+ _orderedDocuments=[NSMutableArray new];
_mainMenu=nil;
_modalStack=[NSMutableArray new];
@@ -243,13 +245,11 @@ -(void)miniaturizeAll:sender {
}
-(NSArray *)orderedDocuments {
- NSUnimplementedMethod();
- return nil;
+ return _orderedDocuments;
}
-(NSArray *)orderedWindows {
- NSUnimplementedMethod();
- return nil;
+ return _orderedWindows;
}
-(void)preventWindowOrdering {
@@ -554,74 +554,107 @@ -(void)postEvent:(NSEvent *)event atStart:(BOOL)atStart {
[_display postEvent:event atStart:atStart];
}
--targetForAction:(SEL)action {
- NSWindow *window;
- NSResponder *check;
-
- window=[self keyWindow];
-
- for(check=[window firstResponder];check!=nil;check=[check nextResponder]){
- if([check respondsToSelector:action])
- return check;
- }
-
- if([window respondsToSelector:action])
- return window;
-
- if([[window delegate] respondsToSelector:action])
- return [window delegate];
-
- window=[self mainWindow];
-
- for(check=[window firstResponder];check!=nil;check=[check nextResponder]){
- if([check respondsToSelector:action])
- return check;
- }
-
- if([window respondsToSelector:action])
- return window;
-
- if([[window delegate] respondsToSelector:action])
- return [window delegate];
-
- if([self respondsToSelector:action])
- return self;
-
- if([[self delegate] respondsToSelector:action])
- return [self delegate];
+-_sameWindowTargetForAction:(SEL)action to:target {
+ // Search just one window's responder chain.
+
+ if ([target respondsToSelector:action])
+ return target;
+
+ if ([target respondsToSelector:@selector(nextResponder)])
+ {
+ target = [target nextResponder];
+ while (target != nil)
+ {
+ if ([target respondsToSelector:action])
+ return target;
+
+ if ([target isKindOfClass:[NSWindow class]])
+ {
+ if ([[target delegate] respondsToSelector:action])
+ return [target delegate];
+ if ([[target windowController] respondsToSelector:action])
+ return [target windowController];
+ }
+
+ target = [target nextResponder];
+ }
+ }
+
+ return nil;
+}
- if([[NSDocumentController sharedDocumentController] respondsToSelector:action])
- return [NSDocumentController sharedDocumentController];
-
- return nil;
+-targetForAction:(SEL)action {
+ return [self targetForAction:action to:nil from:nil];
}
-targetForAction:(SEL)action to:target from:sender {
- NSUnimplementedMethod();
- return nil;
+ if (target == nil)
+ {
+ target = [self _sameWindowTargetForAction:action to:[[self keyWindow] firstResponder]];
+ if (target)
+ return target;
+
+ if ([self mainWindow] != [self keyWindow])
+ {
+ target = [self _sameWindowTargetForAction:action to:[[self mainWindow] firstResponder]];
+ if (target)
+ return target;
+ }
+ }
+ else
+ {
+ target = [self _sameWindowTargetForAction:action to:target];
+ if (target)
+ return target;
+ }
+
+ NSDocumentController *documentController = [NSDocumentController sharedDocumentController];
+ if ([[documentController currentDocument] respondsToSelector:action])
+ return [documentController currentDocument];
+
+ if([self respondsToSelector:action])
+ return self;
+
+ if([[self delegate] respondsToSelector:action])
+ return [self delegate];
+
+ if([documentController respondsToSelector:action])
+ return documentController;
+
+ return nil;
}
-(BOOL)sendAction:(SEL)action to:target from:sender {
-
-//NSLog(@"%s %s %@ %@",sel_getName(_cmd),action,target,sender);
-
- if(target!=nil){
- if([target respondsToSelector:action]){
- [target performSelector:action withObject:sender];
- return YES;
+ if([target respondsToSelector:action])
+ {
+ [target performSelector:action withObject:sender];
+ return YES;
}
- }
- else if((target=[self targetForAction:action])!=nil){
- [target performSelector:action withObject:sender];
- return YES;
- }
-
- return NO;
+
+ target=[self targetForAction:action to:target from:sender];
+ if (target != nil)
+ {
+ [target performSelector:action withObject:sender];
+ return YES;
+ }
+
+ return NO;
}
-(BOOL)tryToPerform:(SEL)selector with:object {
- NSUnimplementedMethod();
- return NO;
+ if ([self respondsToSelector:selector])
+ {
+ [self performSelector:selector withObject:object];
+ return YES;
+ }
+
+ if ([[self delegate] respondsToSelector:selector])
+ {
+ [[self delegate] performSelector:selector withObject:object];
+ return YES;
+ }
+
+ return NO;
}
-(void)setWindowsNeedUpdate:(BOOL)value {
@@ -836,22 +869,35 @@ -(void)stop:sender {
_isRunning=NO;
}
--(void)terminate:sender {
- if([_delegate respondsToSelector:@selector(applicationShouldTerminate:)]){
- if(![_delegate applicationShouldTerminate:self]){
- return;
- }
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:self];
-
- [NSClassFromString(@"Win32RunningCopyPipe") performSelector:@selector(invalidateRunningCopyPipe)];
+-(void)terminate:sender
+{
+ [[NSDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
+ didCloseAllSelector:@selector(_documentController:didCloseAll:contextInfo:)
+ contextInfo:NULL];
+}
- exit(0);
+-(void)_documentController:(NSDocumentController *)docController didCloseAll:(BOOL)didCloseAll contextInfo:(void *)info
+{
+ // callback method for terminate:
+ if (didCloseAll)
+ {
+ if ([_delegate respondsToSelector:@selector(applicationShouldTerminate:)])
+ [self replyToApplicationShouldTerminate:[_delegate applicationShouldTerminate:self]];
+ else
+ [self replyToApplicationShouldTerminate:YES];
+ }
}
--(void)replyToApplicationShouldTerminate:(BOOL)terminate {
- NSUnimplementedMethod();
+-(void)replyToApplicationShouldTerminate:(BOOL)terminate
+{
+ if (terminate == NSTerminateNow)
+ {
+ [[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillTerminateNotification object:self];
+
+ [NSClassFromString(@"Win32RunningCopyPipe") performSelector:@selector(invalidateRunningCopyPipe)];
+
+ exit(0);
+ }
}
-(void)replyToOpenOrPrint:(NSApplicationDelegateReply)reply {
@@ -979,6 +1025,68 @@ -(void)_addWindow:(NSWindow *)window {
[_windows addObject:window];
}
+-(void)_windowOrderingChange:(NSWindowOrderingMode)place forWindow:(NSWindow *)window relativeTo:(NSWindow *)relativeWindow {
+ NSUInteger index, count;
+
+ NSWindowController *controller = [window windowController];
+ NSDocument *document = [controller document];
+
+ [_orderedWindows removeObject: window];
+
+ switch (place) {
+ case NSWindowAbove:
+ if (relativeWindow == nil) {
+ index = 0;
+ } else {
+ index = [_orderedWindows indexOfObject: relativeWindow];
+ if (index == NSNotFound) {
+ index = 0;
+ }
+ }
+ [_orderedWindows insertObject: window atIndex: index];
+ break;
+
+ case NSWindowBelow:
+ if (relativeWindow == nil) {
+ [_orderedWindows addObject: window];
+ } else {
+ index = [_orderedWindows indexOfObject: relativeWindow];
+ if (index == NSNotFound) {
+ [_orderedWindows addObject: window];
+ } else {
+ [_orderedWindows insertObject: window atIndex: index+1];
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ if (document) {
+ [self _updateOrderedDocuments];
+ }
+}
+
+-(void)_updateOrderedDocuments {
+ NSUInteger i, count = [_orderedWindows count];
+ NSWindowController *controller;
+ NSDocument *document;
+ NSWindow *window;
+
+ [_orderedDocuments removeAllObjects];
+ for (i = 0; i < count; i++) {
+ window = [_orderedWindows objectAtIndex: i];
+ controller = [window windowController];
+ document = [controller document];
+ if (document) {
+ [_orderedDocuments addObject: document];
+ }
+ }
+}
+
+
+
+
-(void)_windowWillBecomeActive:(NSWindow *)window {
if(![self isActive]){
[[NSNotificationCenter defaultCenter] postNotificationName:NSApplicationWillBecomeActiveNotification object:self];
@@ -60,6 +60,7 @@ typedef enum {
+(NSData *)representationOfImageRepsInArray:(NSArray *)array usingType:(NSBitmapImageFileType)type properties:(NSDictionary *)properties;
++(NSArray *)imageRepsWithData:(NSData *)data;
+imageRepWithData:(NSData *)data;
-initWithBitmapDataPlanes:(unsigned char **)planes pixelsWide:(int)width pixelsHigh:(int)height bitsPerSample:(int)bitsPerSample samplesPerPixel:(int)samplesPerPixel hasAlpha:(BOOL)hasAlpha isPlanar:(BOOL)isPlanar colorSpaceName:(NSString *)colorSpaceName bitmapFormat:(NSBitmapFormat)bitmapFormat bytesPerRow:(int)bytesPerRow bitsPerPixel:(int)bitsPerPixel;
Oops, something went wrong.

0 comments on commit 031ad9d

Please sign in to comment.