mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-13 06:01:28 +00:00
Merge branch 'master' into jake
Conflicts: Objective-J/CommonJS/objective-j/lib-js/objective-j/compiler.js
This commit is contained in:
+29
-1
@@ -39,6 +39,11 @@ CPApp = nil;
|
||||
|
||||
CPApplicationWillFinishLaunchingNotification = @"CPApplicationWillFinishLaunchingNotification";
|
||||
CPApplicationDidFinishLaunchingNotification = @"CPApplicationDidFinishLaunchingNotification";
|
||||
CPApplicationWillTerminateNotification = @"CPApplicationWillTerminateNotification";
|
||||
|
||||
CPTerminateNow = YES;
|
||||
CPTerminateCancel = NO;
|
||||
CPTerminateLater = -1; // not currently supported
|
||||
|
||||
CPRunStoppedResponse = -1000;
|
||||
CPRunAbortedResponse = -1001;
|
||||
@@ -295,7 +300,30 @@ CPRunContinuesResponse = -1002;
|
||||
|
||||
- (void)terminate:(id)aSender
|
||||
{
|
||||
[CPPlatform terminateApplication];
|
||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||
didCloseAllSelector:@selector(_documentController:didCloseAll:context:)
|
||||
contextInfo:nil];
|
||||
}
|
||||
|
||||
- (void)_documentController:(NSDocumentController *)docController didCloseAll:(BOOL)didCloseAll context:(Object)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
|
||||
{
|
||||
if (terminate == CPTerminateNow)
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPApplicationWillTerminateNotification object:self];
|
||||
[CPPlatform terminateApplication];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)activateIgnoringOtherApps:(BOOL)shouldIgnoreOtherApps
|
||||
|
||||
+2
-1
@@ -94,7 +94,8 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
id _target;
|
||||
SEL _action;
|
||||
int _sendActionOn;
|
||||
|
||||
BOOL _sendsActionOnEndEditing @accessors(property=sendsActionOnEndEditing);
|
||||
|
||||
// Mouse Tracking Support
|
||||
BOOL _continuousTracking;
|
||||
BOOL _trackingWasWithinFrame;
|
||||
|
||||
@@ -323,3 +323,38 @@ var CPSharedDocumentController = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPDocumentController (Closing)
|
||||
|
||||
- (void)closeAllDocumentsWithDelegate:(id)aDelegate didCloseAllSelector:(SEL)didCloseSelector contextInfo:(Object)info
|
||||
{
|
||||
var context = {
|
||||
delegate: aDelegate,
|
||||
selector: didCloseSelector,
|
||||
context: info
|
||||
};
|
||||
|
||||
[self _closeDocumentsStartingWith:nil shouldClose:YES context:context];
|
||||
}
|
||||
|
||||
// Recursive callback method. Start it by passing in a document of nil.
|
||||
- (void)_closeDocumentsStartingWith:(CPDocument)aDocument shouldClose:(BOOL)shouldClose context:(Object)context
|
||||
{
|
||||
if (shouldClose)
|
||||
{
|
||||
[aDocument close];
|
||||
|
||||
if ([[self documents] count] > 0)
|
||||
{
|
||||
[[[self documents] lastObject] canCloseDocumentWithDelegate:self
|
||||
shouldCloseSelector:@selector(_closeDocumentsStartingWith:shouldClose:context:)
|
||||
contextInfo:context];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ([context.delegate respondsToSelector:context.selector])
|
||||
objj_msgSend(context.delegate, context.selector, self, [[self documents] count] === 0, context.context);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -269,8 +269,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
if (aDOMEvent && aDOMEvent.keyCode == CPReturnKeyCode)
|
||||
{
|
||||
[owner sendAction:[owner action] to:[owner target]];
|
||||
[[owner window] makeFirstResponder:nil];
|
||||
[owner sendAction:[owner action] to:[owner target]];
|
||||
[owner selectText:nil];
|
||||
}
|
||||
else if (aDOMEvent && aDOMEvent.keyCode == CPTabKeyCode)
|
||||
{
|
||||
@@ -666,6 +666,9 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
//post CPControlTextDidEndEditingNotification
|
||||
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
|
||||
|
||||
if ([self sendsActionOnEndEditing])
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,14 +166,16 @@
|
||||
|
||||
|
||||
var CPViewControllerViewKey = @"CPViewControllerViewKey",
|
||||
CPViewControllerTitleKey = @"CPViewControllerTitleKey";
|
||||
CPViewControllerTitleKey = @"CPViewControllerTitleKey",
|
||||
CPViewControllerCibNameKey = @"CPViewControllerCibNameKey",
|
||||
CPViewControllerBundleKey = @"CPViewControllerBundleKey";
|
||||
|
||||
@implementation CPViewController (CPCoding)
|
||||
|
||||
/*!
|
||||
Initializes the view item by unarchiving data from a coder.
|
||||
Initializes the view controller by unarchiving data from a coder.
|
||||
@param aCoder the coder from which the data will be unarchived
|
||||
@return the initialized collection view item
|
||||
@return the initialized view controller
|
||||
*/
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
@@ -183,14 +185,20 @@ var CPViewControllerViewKey = @"CPViewControllerViewKey",
|
||||
{
|
||||
_view = [aCoder decodeObjectForKey:CPViewControllerViewKey];
|
||||
_title = [aCoder decodeObjectForKey:CPViewControllerTitleKey];
|
||||
_cibName = [aCoder decodeObjectForKey:CPViewControllerCibNameKey];
|
||||
|
||||
var bundlePath = [aCoder decodeObjectForKey:CPViewControllerBundleKey];
|
||||
_cibBundle = bundlePath ? [CPBundle bundleWithPath:bundlePath] : [CPBundle mainBundle];
|
||||
|
||||
_cibExternalNameTable = [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Archives the colletion view item to the provided coder.
|
||||
@param aCoder the coder to which the view item should be archived
|
||||
Archives the view controller to the provided coder.
|
||||
@param aCoder the coder to which the view controller should be archived
|
||||
*/
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
@@ -198,6 +206,8 @@ var CPViewControllerViewKey = @"CPViewControllerViewKey",
|
||||
|
||||
[aCoder encodeObject:_view forKey:CPViewControllerViewKey];
|
||||
[aCoder encodeObject:_title forKey:CPViewControllerTitleKey];
|
||||
[aCoder encodeObject:_cibName forKey:CPViewControllerCibNameKey];
|
||||
[aCoder encodeObject:[_cibBundle bundlePath] forKey:CPViewControllerBundleKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -3,9 +3,9 @@ var FILE = require("file"),
|
||||
objj = require("objective-j"),
|
||||
objj_preprocess = objj.objj_preprocess,
|
||||
IS_FILE = objj.IS_FILE,
|
||||
GET_FILE = objj.GET_FILE,
|
||||
GET_CODE = objj.GET_CODE,
|
||||
IS_LOCAL = objj.IS_LOCAL,
|
||||
GET_CODE = objj.GET_CODE,
|
||||
GET_FILE = objj.GET_FILE,
|
||||
MARKER_IMPORT_STD = objj.MARKER_IMPORT_STD,
|
||||
MARKER_IMPORT_LOCAL = objj.MARKER_IMPORT_LOCAL,
|
||||
MARKER_CODE = objj.MARKER_CODE,
|
||||
|
||||
@@ -27,14 +27,21 @@
|
||||
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [super NS_initWithCoder:aCoder];
|
||||
self = [super NS_initWithCoder:aCoder];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_title = [aCoder decodeObjectForKey:@"NSTitle"];
|
||||
_cibName = [aCoder decodeObjectForKey:@"NSNibName"];
|
||||
_cibBundle = [CPBundle bundleWithPath:[aCoder decodeObjectForKey:@"NSNibBundleIdentifier"]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSViewController : CPViewController
|
||||
{
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
@@ -43,7 +50,7 @@
|
||||
|
||||
- (Class)classForKeyedArchiver
|
||||
{
|
||||
return [CPCollectionView class];
|
||||
return [CPViewController class];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user