mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-10 12:47:13 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6678bba94f |
@@ -96,12 +96,12 @@
|
||||
return _items;
|
||||
}
|
||||
|
||||
- (void)addItem:(CPAccordionViewItem)anItem
|
||||
- (void)addItem:(CPAccordionItem)anItem
|
||||
{
|
||||
[self insertItem:anItem atIndex:_items.length];
|
||||
}
|
||||
|
||||
- (void)insertItem:(CPAccordionViewItem)anItem atIndex:(CPInteger)anIndex
|
||||
- (void)insertItem:(CPAccordionItem)anItem atIndex:(CPInteger)anIndex
|
||||
{
|
||||
// FIXME: SHIFT ITEMS RIGHT
|
||||
[_expandedItemIndexes addIndex:anIndex];
|
||||
@@ -122,7 +122,7 @@
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)removeItem:(CPAccordionViewItem)anItem
|
||||
- (void)removeItem:(CPAccordionItem)anItem
|
||||
{
|
||||
[self removeItemAtIndex:[_items indexOfObjectIdenticalTo:anItem]];
|
||||
}
|
||||
|
||||
+70
-43
@@ -31,7 +31,6 @@
|
||||
@import "CPCibLoading.j"
|
||||
@import "CPPlatform.j"
|
||||
|
||||
#include "Platform/Platform.h"
|
||||
|
||||
var CPMainCibFile = @"CPMainCibFile",
|
||||
CPMainCibFileHumanFriendly = @"Main cib file base name";
|
||||
@@ -213,46 +212,85 @@ CPRunContinuesResponse = -1002;
|
||||
{
|
||||
if (_delegate == aDelegate)
|
||||
return;
|
||||
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter],
|
||||
delegateNotifications =
|
||||
[
|
||||
CPApplicationWillFinishLaunchingNotification, @selector(applicationWillFinishLaunching:),
|
||||
CPApplicationDidFinishLaunchingNotification, @selector(applicationDidFinishLaunching:),
|
||||
CPApplicationWillBecomeActiveNotification, @selector(applicationWillBecomeActive:),
|
||||
CPApplicationDidBecomeActiveNotification, @selector(applicationDidBecomeActive:),
|
||||
CPApplicationWillResignActiveNotification, @selector(applicationWillResignActive:),
|
||||
CPApplicationDidResignActiveNotification, @selector(applicationDidResignActive:),
|
||||
CPApplicationWillTerminateNotification, @selector(applicationWillTerminate:)
|
||||
],
|
||||
count = [delegateNotifications count];
|
||||
|
||||
|
||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
||||
|
||||
if (_delegate)
|
||||
{
|
||||
var index = 0;
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationWillFinishLaunchingNotification
|
||||
object:self];
|
||||
|
||||
for (; index < count; index += 2)
|
||||
{
|
||||
var notificationName = delegateNotifications[index],
|
||||
selector = delegateNotifications[index + 1];
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationDidFinishLaunchingNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:selector])
|
||||
[defaultCenter removeObserver:_delegate name:notificationName object:self];
|
||||
}
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationWillBecomeActiveNotification
|
||||
object:self];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationDidBecomeActiveNotification
|
||||
object:self];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationWillResignActiveNotification
|
||||
object:self];
|
||||
|
||||
[defaultCenter
|
||||
removeObserver:_delegate
|
||||
name:CPApplicationDidResignActiveNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
|
||||
_delegate = aDelegate;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(applicationWillFinishLaunching:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationWillFinishLaunching:)
|
||||
name:CPApplicationWillFinishLaunchingNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(applicationDidFinishLaunching:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationDidFinishLaunching:)
|
||||
name:CPApplicationDidFinishLaunchingNotification
|
||||
object:self];
|
||||
|
||||
var index = 0;
|
||||
if ([_delegate respondsToSelector:@selector(applicationWillBecomeActive:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationWillBecomeActive:)
|
||||
name:CPApplicationWillBecomeActiveNotification
|
||||
object:self];
|
||||
|
||||
for (; index < count; index += 2)
|
||||
{
|
||||
var notificationName = delegateNotifications[index],
|
||||
selector = delegateNotifications[index + 1];
|
||||
if ([_delegate respondsToSelector:@selector(applicationDidBecomeActive:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationDidBecomeActive:)
|
||||
name:CPApplicationDidBecomeActiveNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:selector])
|
||||
[defaultCenter addObserver:_delegate selector:selector name:notificationName object:self];
|
||||
}
|
||||
if ([_delegate respondsToSelector:@selector(applicationWillResignActive:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationWillResignActive:)
|
||||
name:CPApplicationWillResignActiveNotification
|
||||
object:self];
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(applicationDidResignActive:)])
|
||||
[defaultCenter
|
||||
addObserver:_delegate
|
||||
selector:@selector(applicationDidResignActive:)
|
||||
name:CPApplicationDidResignActiveNotification
|
||||
object:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -331,10 +369,6 @@ CPRunContinuesResponse = -1002;
|
||||
|
||||
- (void)terminate:(id)aSender
|
||||
{
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPApplicationWillTerminateNotification
|
||||
object:self];
|
||||
|
||||
if (![CPPlatform isBrowser])
|
||||
{
|
||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||
@@ -1103,13 +1137,6 @@ var _CPRunModalLoop = function(anEvent)
|
||||
|
||||
function CPApplicationMain(args, namedArgs)
|
||||
{
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
// hook to allow recorder, etc to manipulate things before starting AppKit
|
||||
if (window.parent !== window && typeof window.parent._childAppIsStarting === "function")
|
||||
window.parent._childAppIsStarting(window);
|
||||
#endif
|
||||
|
||||
var mainBundle = [CPBundle mainBundle],
|
||||
principalClass = [mainBundle principalClass];
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ CPGrooveBorder = 3;
|
||||
|
||||
[aView setFrame:CGRectInset([self bounds], _contentMargin.width + _borderWidth, _contentMargin.height + _borderWidth)];
|
||||
[self replaceSubview:_contentView with:aView];
|
||||
[aView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
|
||||
_contentView = aView;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ CPInputTypeCanBeChangedFeature = 1 << 25;
|
||||
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
|
||||
|
||||
|
||||
|
||||
|
||||
var USER_AGENT = "",
|
||||
PLATFORM_ENGINE = CPUnknownBrowserEngine,
|
||||
PLATFORM_FEATURES = 0;
|
||||
@@ -73,7 +75,7 @@ var USER_AGENT = "",
|
||||
|
||||
PLATFORM_FEATURES |= CPInputTypeCanBeChangedFeature;
|
||||
|
||||
if (typeof window !== "undefined" && typeof window.navigator !== "undefined")
|
||||
if (typeof window != "undfined" && typeof window.navigator != "undefined")
|
||||
USER_AGENT = window.navigator.userAgent;
|
||||
|
||||
// Opera
|
||||
|
||||
+6
-19
@@ -210,10 +210,10 @@ var CPDocumentUntitledCount = 0;
|
||||
@throws CPUnsupportedMethodException if this method hasn't been overriden by the subclass
|
||||
@return the document data
|
||||
*/
|
||||
- (CPData)dataOfType:(CPString)aType
|
||||
- (CPData)dataOfType:(CPString)aType error:({CPError})anError
|
||||
{
|
||||
[CPException raise:CPUnsupportedMethodException
|
||||
reason:"dataOfType: must be overridden by the document subclass."];
|
||||
reason:"dataOfType:error: must be overridden by the document subclass."];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -473,21 +473,8 @@ var CPDocumentUntitledCount = 0;
|
||||
*/
|
||||
- (void)saveToURL:(CPURL)anAbsoluteURL ofType:(CPString)aTypeName forSaveOperation:(CPSaveOperationType)aSaveOperation delegate:(id)aDelegate didSaveSelector:(SEL)aDidSaveSelector contextInfo:(id)aContextInfo
|
||||
{
|
||||
if (anAbsoluteURL.isLocalStorageURL())
|
||||
[[CPDocumentController sharedDocumentController] _addLocalDocumentURL:anAbsoluteURL];
|
||||
|
||||
var data = nil;
|
||||
|
||||
if ([self respondsToSelector:@selector(dataOfType:error:)])
|
||||
{
|
||||
CPLog.warn("[" + CPStringFromClass([self class]) + " " + CPStringFromSelector(@selector(dataOfType:error:)) + "] is deprecated, please implement " + CPStringFromSelector(@selector(dataOfType:)) + " instead and simply throw exceptions when necessary.");
|
||||
|
||||
data = [self dataOfType:[self fileType] error:nil];
|
||||
}
|
||||
else
|
||||
data = [self dataOfType:[self fileType]];
|
||||
|
||||
var oldChangeCount = _changeCount;
|
||||
var data = [self dataOfType:[self fileType] error:nil],
|
||||
oldChangeCount = _changeCount;
|
||||
|
||||
_writeRequest = [CPURLRequest requestWithURL:anAbsoluteURL];
|
||||
|
||||
@@ -501,10 +488,10 @@ var CPDocumentUntitledCount = 0;
|
||||
|
||||
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
||||
|
||||
if (aSaveOperation === CPSaveOperation)
|
||||
if (aSaveOperation == CPSaveOperation)
|
||||
[_writeRequest setValue:@"true" forHTTPHeaderField:@"x-cappuccino-overwrite"];
|
||||
|
||||
if (aSaveOperation !== CPSaveToOperation)
|
||||
if (aSaveOperation != CPSaveToOperation)
|
||||
[self updateChangeCount:CPChangeCleared];
|
||||
|
||||
// FIXME: Oh man is this every looking for trouble, we need to handle login at the Cappuccino level, with HTTP Errors.
|
||||
|
||||
@@ -38,7 +38,6 @@ var CPSharedDocumentController = nil;
|
||||
{
|
||||
CPArray _documents;
|
||||
CPArray _documentTypes;
|
||||
CPArray _localDocumentURLs;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -60,30 +59,14 @@ var CPSharedDocumentController = nil;
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_documents = [[CPArray alloc] init];
|
||||
|
||||
if (!CPSharedDocumentController)
|
||||
CPSharedDocumentController = self;
|
||||
|
||||
_localDocumentURLs = [CPSet set];
|
||||
|
||||
if (window.localStorage)
|
||||
{
|
||||
var localDocumentURLs = localStorage.getItem(CPDocumentControllerLocalDocumentURLsKey);
|
||||
|
||||
if (localDocumentURLs)
|
||||
{
|
||||
localDocumentURLs = JSON.parse(localDocumentURLs);
|
||||
|
||||
var count = [localDocumentURLs count];
|
||||
|
||||
while (count--)
|
||||
[_localDocumentURLs addObject:new CFURL(localDocumentURLs[count])];
|
||||
}
|
||||
}
|
||||
|
||||
_documents = [];
|
||||
_documentTypes = [[[CPBundle mainBundle] infoDictionary] objectForKey:@"CPBundleDocumentTypes"];
|
||||
}
|
||||
return self;
|
||||
@@ -236,7 +219,7 @@ var CPSharedDocumentController = nil;
|
||||
Opens a new document in the application.
|
||||
@param aSender the requesting object
|
||||
*/
|
||||
- (@action)newDocument:(id)aSender
|
||||
- (CFAction)newDocument:(id)aSender
|
||||
{
|
||||
[self openUntitledDocumentOfType:[[_documentTypes objectAtIndex:0] objectForKey:@"CPBundleTypeName"] display:YES];
|
||||
}
|
||||
@@ -472,41 +455,3 @@ var CPSharedDocumentController = nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPDocumentControllerLocalDocumentURLsKey = @"Cappuccino.CPDocumentController.documentURLs";
|
||||
|
||||
@implementation CPDocumentController (LocalStorage)
|
||||
|
||||
- (void)_addLocalDocumentURL:(CPURL)aURL
|
||||
{
|
||||
if (!window.localStorage)
|
||||
return;
|
||||
|
||||
[_localDocumentURLs addObject:aURL];
|
||||
|
||||
var stringURLs = [],
|
||||
URL = nil,
|
||||
URLEnumerator = [_localDocumentURLs objectEnumerator];
|
||||
|
||||
while (URL = [URLEnumerator nextObject])
|
||||
stringURLs.push(URL + "");
|
||||
|
||||
localStorage.setItem(CPDocumentControllerLocalDocumentURLsKey, JSON.stringify(stringURLs));
|
||||
}
|
||||
|
||||
- (void)_removeLocalDocumentURL:(CPURL)aURL
|
||||
{
|
||||
if (!window.localStorage)
|
||||
return;
|
||||
|
||||
[_localDocumentURLs removeObject:aURL];
|
||||
|
||||
localStorage.setItem(CPDocumentControllerLocalDocumentURLsKey, JSON.stringify([self allObjects]));
|
||||
}
|
||||
|
||||
- (CPSet)localDocumentURLs
|
||||
{
|
||||
return [_localDocumentURLs copy];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -127,7 +127,7 @@ var CPDragServerDraggingInfo = nil;
|
||||
@end
|
||||
|
||||
var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
CPDraggingSource_draggedImage_endedAt_operation_ = 1 << 1,
|
||||
CPDraggingSource_draggedImage_endAt_operation_ = 1 << 1,
|
||||
CPDraggingSource_draggedView_movedTo_ = 1 << 2,
|
||||
CPDraggingSource_draggedView_endedAt_operation_ = 1 << 3;
|
||||
|
||||
@@ -267,7 +267,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
if (![CPPlatform supportsDragAndDrop])
|
||||
[_draggedWindow orderOut:self];
|
||||
|
||||
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endedAt_operation_)
|
||||
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_)
|
||||
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
||||
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
|
||||
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
|
||||
@@ -342,8 +342,8 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:movedTo:)])
|
||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_movedTo_;
|
||||
|
||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:endedAt:operation:)])
|
||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endedAt_operation_;
|
||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:endAt:operation:)])
|
||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endAt_operation_;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+2
-5
@@ -128,7 +128,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
BOOL _isARepeat;
|
||||
unsigned _keyCode;
|
||||
DOMEvent _DOMEvent;
|
||||
|
||||
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
float _deltaZ;
|
||||
@@ -345,10 +345,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
*/
|
||||
- (int)buttonNumber
|
||||
{
|
||||
if (_type === CPRightMouseDown || _type === CPRightMouseUp || _type === CPRightMouseDragged)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return _buttonNumber;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
+1
-5
@@ -1,8 +1,8 @@
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
#import "CoreGraphics/CGGeometry.h"
|
||||
#import "Platform/Platform.h"
|
||||
|
||||
@implementation CPScreen : CPObject
|
||||
{
|
||||
@@ -10,11 +10,7 @@
|
||||
|
||||
- (CGRect)visibleFrame
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
|
||||
#else
|
||||
return _CGRectMakeZero();
|
||||
#endif
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -282,9 +282,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||
[self addSubview:_tableDrawView];
|
||||
|
||||
[self setBackgroundColor:[CPColor whiteColor]];
|
||||
[self _init];
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -297,6 +296,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
[_dropOperationFeedbackView setTableView:self];
|
||||
|
||||
_lastColumnShouldSnap = NO;
|
||||
_backgroundColor = [CPColor whiteColor];
|
||||
|
||||
// Gradients for the source list
|
||||
_sourceListActiveGradient = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [89.0/255.0, 153.0/255.0, 209.0/255.0,1.0, 33.0/255.0, 94.0/255.0, 208.0/255.0,1.0], [0,1], 2);
|
||||
@@ -2200,7 +2200,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
||||
{
|
||||
if (!_usesAlternatingRowBackgroundColors)
|
||||
{
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
CGContextSetFillColor(context, _backgroundColor);
|
||||
CGContextFillRect(context, aRect);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var rowColors = [self alternatingRowBackgroundColors],
|
||||
|
||||
@@ -50,7 +50,7 @@ var CPViewControllerCachedCibs;
|
||||
CPView _view;
|
||||
|
||||
id _representedObject @accessors(property=representedObject);
|
||||
CPString _title;
|
||||
CPString _title @accessors(property=title);
|
||||
|
||||
CPString _cibName @accessors(property=cibName, readonly);
|
||||
CPBundle _cibBundle @accessors(property=cibBundle, readonly);
|
||||
@@ -78,9 +78,7 @@ var CPViewControllerCachedCibs;
|
||||
|
||||
- (id)initWithCibName:(CPString)aCibNameOrNil bundle:(CPBundle)aCibBundleOrNil owner:(id)anOwner
|
||||
{
|
||||
return [self initWithCibName:aCibNameOrNil
|
||||
bundle:aCibBundleOrNil
|
||||
externalNameTable:[CPDictionary dictionaryWithObject:anOwner forKey:CPCibOwner]];
|
||||
return [self initWithCibName:aCibNameOrNil bundle:aCibBundleOrNil externalNameTable:[CPDictionary dictionaryWithObject:anOwner forKey:CPCibOwner]];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -99,34 +97,13 @@ var CPViewControllerCachedCibs;
|
||||
{
|
||||
// Don't load the cib until someone actually requests the view. The user may just be intending to use setView:.
|
||||
_cibName = aCibNameOrNil;
|
||||
_cibBundle = aCibBundleOrNil;
|
||||
|
||||
if (!_cibBundle)
|
||||
{
|
||||
var owner = [anExternalNameTable objectForKey:CPCibOwner];
|
||||
|
||||
_cibBundle = owner ? [CPBundle bundleForClass:[owner class]] : [CPBundle mainBundle];
|
||||
}
|
||||
|
||||
_cibBundle = aCibBundleOrNil || [CPBundle mainBundle];
|
||||
_cibExternalNameTable = anExternalNameTable || [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setTitle:(CPString)aTitle
|
||||
{
|
||||
_title = aTitle;
|
||||
|
||||
if (self._navigationItem)
|
||||
[_navigationItem setTitle:aTitle];
|
||||
}
|
||||
|
||||
- (CPString)title
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
||||
/*!
|
||||
Programmatically creates the view that the controller manages.
|
||||
You should never call this method directly. The view controller calls this method when the view property is requested but is nil.
|
||||
@@ -147,9 +124,9 @@ var CPViewControllerCachedCibs;
|
||||
// check if a cib is already cached for the current _cibName
|
||||
var cib = [CPViewControllerCachedCibs objectForKey:_cibName];
|
||||
|
||||
// If the cib isn't cached yet : fetch it and cache it
|
||||
if (!cib)
|
||||
{
|
||||
// if the cib isn't cached yet : fetch it and cache it
|
||||
cib = [[CPCib alloc] initWithContentsOfURL:[_cibBundle pathForResource:_cibName + @".cib"]];
|
||||
[CPViewControllerCachedCibs setObject:cib forKey:_cibName];
|
||||
}
|
||||
@@ -215,34 +192,6 @@ var CPViewControllerCachedCibs;
|
||||
_view = aView;
|
||||
}
|
||||
|
||||
- (CPNavigationItem)navigationItem
|
||||
{
|
||||
var navigationItem = self._navigationItem;
|
||||
|
||||
if (!navigationItem)
|
||||
navigationItem = [[CPNavigationItem alloc] initWithTitle:[self title]];
|
||||
|
||||
self._navigationItem = navigationItem;
|
||||
|
||||
return navigationItem;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)isAnimated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)isAnimated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)isAnimated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)isAnimated
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -71,12 +71,11 @@ var _CPToolbarViewBackgroundColor = nil;
|
||||
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
||||
}
|
||||
|
||||
var frame = CGRectMakeZero(),
|
||||
toolbarOffset = [self toolbarOffset];
|
||||
|
||||
frame.origin = CGPointMake(toolbarOffset.width, toolbarOffset.height);
|
||||
var frame = CGRectMakeZero();
|
||||
|
||||
frame.origin = CGPointMakeCopy([self toolbarOffset]);
|
||||
frame.size = [_toolbarView frame].size;
|
||||
|
||||
|
||||
[_toolbarBackgroundView setFrame:frame];
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
CGSize _resizeIndicatorOffset;
|
||||
|
||||
CPView _toolbarView;
|
||||
CGSize _toolbarOffset;
|
||||
// BOOL _isAnimatingToolbar;
|
||||
|
||||
|
||||
@@ -81,8 +80,8 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
if (self)
|
||||
{
|
||||
_styleMask = aStyleMask;
|
||||
_resizeIndicatorOffset = CGSizeMakeZero();
|
||||
_toolbarOffset = CGSizeMakeZero();
|
||||
_resizeIndicatorOffset = CGSizeMake(0.0, 0.0);
|
||||
_toolbarOffset = CGSizeMake(0.0, 0.0);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -270,7 +269,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
|
||||
- (CGSize)toolbarOffset
|
||||
{
|
||||
return _toolbarOffset;
|
||||
return CGSizeMakeZero();
|
||||
}
|
||||
|
||||
- (CPColor)toolbarLabelColor
|
||||
|
||||
@@ -40,16 +40,6 @@ var screenNeedsInitialization = NO,
|
||||
return;
|
||||
|
||||
screenNeedsInitialization = [CPPlatform isBrowser];
|
||||
|
||||
// We do this here because doing it later breaks IE.
|
||||
if (document.documentElement)
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
if ([CPPlatform isBrowser])
|
||||
window.onunload = function()
|
||||
{
|
||||
[CPApp terminate:nil];
|
||||
}
|
||||
}
|
||||
|
||||
+ (BOOL)isBrowser
|
||||
@@ -131,6 +121,9 @@ var screenNeedsInitialization = NO,
|
||||
|
||||
bodyElement.style.overflow = "hidden";
|
||||
|
||||
if (document.documentElement)
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPPlatformDidClearBodyElementNotification
|
||||
object:self];
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div>Test custom cursors with .cur images.</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(disappearingItemCursor.cur), default">disappearingItemCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(closedHandCursor.cur), default">closedHandCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(contextMenuCursor.cur), default">contextMenuCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(dragCopyCursor.cur), default">dragCopyCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(dragLinkCursor.cur), default">dragLinkCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(openHandCursor.cur), default">openHandCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeDownCursor.cur), default">resizeDownCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeLeftCursor.cur), default">resizeLeftCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeRightCursor.cur), default">resizeRightCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(resizeUpCursor.cur), default">resizeUpCursor</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+9
-34
@@ -44,11 +44,6 @@ parser.option("-s", "--split", "number", "split")
|
||||
.def(0)
|
||||
.help("Split into multiple files");
|
||||
|
||||
parser.option("-c", "--compressor", "compressor")
|
||||
.def("shrinksafe")
|
||||
.set()
|
||||
.help("Select a compressor to use (closure-compiler, yuicompressor, shrinksafe), or \"none\" (default: shrinksafe)");
|
||||
|
||||
parser.option("-v", "--verbose", "verbose")
|
||||
.def(false)
|
||||
.set(true)
|
||||
@@ -115,14 +110,7 @@ function main(args)
|
||||
FILE.copyTree(rootPath, outputPath);
|
||||
|
||||
applicationJSs.forEach(function(applicationJS, n) {
|
||||
var name = "Application"+(n||"")+".js";
|
||||
if (options.compressor === "none") {
|
||||
print("skipping compression: " + name);
|
||||
} else {
|
||||
print("compressing: " + name);
|
||||
applicationJS = require("minify/"+options.compressor).compress(applicationJS, { charset : "UTF-8", useServer : true });
|
||||
}
|
||||
outputPath.join(name).write(applicationJS, { charset : "UTF-8" });
|
||||
outputPath.join("Application"+(n||"")+".js").write(applicationJS);
|
||||
});
|
||||
|
||||
rewriteMainHTML(outputPath.join(options.index));
|
||||
@@ -145,14 +133,11 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
||||
this.serializeFunctions();
|
||||
this.serializeFileCache();
|
||||
|
||||
var additions = FILE.read(FILE.join(FILE.dirname(module.path), "..", "..", "cappuccino", "lib", "cappuccino", "objj-flatten-additions.js"), { charset:"UTF-8" });
|
||||
|
||||
var applicationJSs = [];
|
||||
|
||||
if (this.options.split === 0) {
|
||||
var buffer = [];
|
||||
buffer.push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||
buffer.push(additions);
|
||||
buffer.push(this.fileCacheBuffer.join("\n"));
|
||||
buffer.push(this.functionsBuffer.join("\n"));
|
||||
buffer.push("ObjectiveJ.bootstrap();");
|
||||
@@ -175,13 +160,11 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
||||
}
|
||||
|
||||
buffers[0].push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||
buffers[0].push(additions);
|
||||
|
||||
buffers[0].push("var appFilesCount = " + appFilesCount +";");
|
||||
buffers[0].push("for (var i = 1; i <= appFilesCount; i++) {");
|
||||
buffers[0].push(" var script = document.createElement(\"script\");");
|
||||
buffers[0].push(" script.src = \"Application\"+i+\".js\";");
|
||||
buffers[0].push(" script.charset = \"UTF-8\";");
|
||||
buffers[0].push(" script.onload = function() { if (--appFilesCount === 0) ObjectiveJ.bootstrap(); };");
|
||||
buffers[0].push(" document.getElementsByTagName(\"head\")[0].appendChild(script);");
|
||||
buffers[0].push("}");
|
||||
@@ -254,6 +237,7 @@ ObjectiveJFlattener.prototype.serializeFunctions = function() {
|
||||
}
|
||||
|
||||
ObjectiveJFlattener.prototype.serializeFileCache = function() {
|
||||
this.fileCacheBuffer.push(FILE.read(FILE.join(FILE.dirname(module.path), "..", "..", "cappuccino", "lib", "cappuccino", "objj-flatten-additions.js"), { charset:"UTF-8" }));
|
||||
for (var relative in this.filesToCache) {
|
||||
var contents = this.filesToCache[relative];
|
||||
print("caching: " + relative + " => " + (contents == null ? 404 : 200));
|
||||
@@ -298,30 +282,21 @@ ObjectiveJFlattener.prototype.setupFileCache = function() {
|
||||
}
|
||||
|
||||
// "$1" is the matching indentation
|
||||
var scriptTagsBefore =
|
||||
'$1<script type = "text/javascript">\n'+
|
||||
'$1 OBJJ_AUTO_BOOTSTRAP = false;\n'+
|
||||
'$1</script>';
|
||||
|
||||
var scriptTagsAfter =
|
||||
'$1<script type="text/javascript" src="Application.js" charset="UTF-8"></script>';
|
||||
var scriptTagsBefore = '$1<script type = "text/javascript">\n$1 OBJJ_AUTO_BOOTSTRAP = false;\n$1</script>';
|
||||
var scriptTagsAfter = '$1<script type = "text/javascript" src = "Application.js"></script>';
|
||||
|
||||
// enable CPLog:
|
||||
// scriptTagsAfter = '$1<script type="text/javascript">\n$1 CPLogRegister(CPLogConsole);\n$1</script>\n' + scriptTagsAfter;
|
||||
// scriptTagsAfter = '$1<script type = "text/javascript">\n$1 CPLogRegister(CPLogConsole);\n$1</script>\n' + scriptTagsAfter;
|
||||
|
||||
function rewriteMainHTML(indexHTMLPath) {
|
||||
if (indexHTMLPath.isFile()) {
|
||||
var indexHTML = indexHTMLPath.read({ charset : "UTF-8" });
|
||||
var indexHTML = indexHTMLPath.read();
|
||||
|
||||
// inline the Application.js if it's smallish
|
||||
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
||||
if (applicationJSPath.size() < 10*1024) {
|
||||
// escape any dollar signs by replacing them with two
|
||||
// then indent by splitting/joining on newlines
|
||||
scriptTagsAfter =
|
||||
'$1<script type="text/javascript">\n'+
|
||||
'$1 ' + applicationJSPath.read({ charset : "UTF-8" }).replace(/\$/g, "$$$$").split("\n").join("\n$1 ")+'\n'+
|
||||
'$1</script>';
|
||||
var applicationJS = applicationJSPath.read().split("\n").join("\n$1 ");
|
||||
scriptTagsAfter = '$1<script type = "text/javascript">\n$1 '+applicationJS+'\n$1</script>'
|
||||
}
|
||||
|
||||
// attempt to find Objective-J script tag and add ours
|
||||
@@ -330,7 +305,7 @@ function rewriteMainHTML(indexHTMLPath) {
|
||||
|
||||
if (newIndexHTML !== indexHTML) {
|
||||
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
||||
indexHTMLPath.write(newIndexHTML, { charset : "UTF-8" });
|
||||
indexHTMLPath.write(newIndexHTML);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -31,11 +31,6 @@ ObjectiveJRuntimeAnalyzer = function(rootPath)
|
||||
return url ? url.absoluteURL().path() : null;
|
||||
}
|
||||
|
||||
this.require("cappuccino/objj-flatten-additions");
|
||||
|
||||
if (!this.context.global.CFHTTPRequest._lookupCachedRequest)
|
||||
print("Warning: CFHTTPRequest._lookupCachedRequest. Need to import objj-flatten-additions module.");
|
||||
|
||||
var requestedURLs = this.requestedURLs = {};
|
||||
var _lookupCachedRequest = this.context.global.CFHTTPRequest._lookupCachedRequest;
|
||||
this.context.global.CFHTTPRequest._lookupCachedRequest = function(aURL) {
|
||||
|
||||
+13
-40
@@ -105,7 +105,11 @@
|
||||
*/
|
||||
+ (id)alloc
|
||||
{
|
||||
return [];
|
||||
var a = [];
|
||||
a._retainCount = 1;
|
||||
a._UID = objj_generateObjectUID();
|
||||
OBJJ_MEMORY_TABLE[a._UID] = a;
|
||||
return a;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -113,7 +117,7 @@
|
||||
*/
|
||||
+ (id)array
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -123,7 +127,7 @@
|
||||
*/
|
||||
+ (id)arrayWithArray:(CPArray)anArray
|
||||
{
|
||||
return [[self alloc] initWithArray:anArray];
|
||||
return [[[self alloc] initWithArray:anArray] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -133,7 +137,7 @@
|
||||
*/
|
||||
+ (id)arrayWithObject:(id)anObject
|
||||
{
|
||||
return [[self alloc] initWithObjects:anObject];
|
||||
return [[[self alloc] initWithObjects:anObject] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -150,7 +154,7 @@
|
||||
for(; i < arguments.length && (argument = arguments[i]) != nil; ++i)
|
||||
array.push(argument);
|
||||
|
||||
return array;
|
||||
return [array autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -161,7 +165,7 @@
|
||||
*/
|
||||
+ (id)arrayWithObjects:(id)objects count:(unsigned)aCount
|
||||
{
|
||||
return [[self alloc] initWithObjects:objects count:aCount];
|
||||
return [[[self alloc] initWithObjects:objects count:aCount] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -453,19 +457,10 @@
|
||||
@return the index of the object, or \c CPNotFound if it was not found.
|
||||
*/
|
||||
- (unsigned)indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
||||
{
|
||||
var result = [self _indexOfObject:anObject sortedByFunction:aFunction context:aContext];
|
||||
return result >= 0 ? result : CPNotFound;
|
||||
}
|
||||
|
||||
- (unsigned)_indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
||||
{
|
||||
if (!aFunction || anObject === undefined)
|
||||
return CPNotFound;
|
||||
|
||||
if (length === 0)
|
||||
return -1;
|
||||
|
||||
var mid, c, first = 0, last = length - 1;
|
||||
while (first <= last)
|
||||
{
|
||||
@@ -485,7 +480,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
return -first-1;
|
||||
return CPNotFound;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -653,8 +648,8 @@
|
||||
{
|
||||
if (self === anArray)
|
||||
return YES;
|
||||
|
||||
if (anArray === nil || length !== anArray.length)
|
||||
|
||||
if(length != anArray.length)
|
||||
return NO;
|
||||
|
||||
var index = 0,
|
||||
@@ -981,28 +976,6 @@
|
||||
[self insertObject:objects[index] atIndex:currentIndex];
|
||||
}
|
||||
|
||||
- (unsigned)insertObject:(id)anObject inArraySortedByDescriptors:(CPArray)descriptors
|
||||
{
|
||||
var index = [self _indexOfObject:anObject sortedByFunction:function(lhs, rhs)
|
||||
{
|
||||
var i = 0,
|
||||
count = [descriptors count],
|
||||
result = CPOrderedSame;
|
||||
|
||||
while (i < count)
|
||||
if((result = [descriptors[i++] compareObject:lhs withObject:rhs]) != CPOrderedSame)
|
||||
return result;
|
||||
|
||||
return result;
|
||||
} context:nil];
|
||||
|
||||
if (index < 0)
|
||||
index = -index-1;
|
||||
|
||||
[self insertObject:anObject atIndex:index];
|
||||
return index;
|
||||
}
|
||||
|
||||
/*!
|
||||
Replaces the element at \c anIndex with \c anObject.
|
||||
The current element at position \c anIndex will be removed from the array.
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
|
||||
@import "CPObject.j"
|
||||
|
||||
var MAIN_POOL = nil;
|
||||
|
||||
@implementation CPAutoreleasePool : CPObject
|
||||
{
|
||||
CPArray _objects;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
MAIN_POOL = [CPAutoreleasePool new];
|
||||
}
|
||||
|
||||
+ (id)_mainAutoreleasePool
|
||||
{
|
||||
return MAIN_POOL;
|
||||
}
|
||||
|
||||
+ (void)addObject:(id)anObject
|
||||
{
|
||||
[[self _mainAutoreleasePool] addObject:anObject];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_objects = [];
|
||||
[[CPRunLoop currentRunLoop] performSelector:@selector(drain) target:self argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addObject:(id)anObject
|
||||
{
|
||||
_objects.push(anObject);
|
||||
}
|
||||
|
||||
- (void)drain
|
||||
{
|
||||
for (var i = 0, count = [_objects count]; i < count; i++)
|
||||
[_objects.pop() release];
|
||||
|
||||
[[CPRunLoop currentRunLoop] performSelector:@selector(drain) target:self argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self drain];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -72,7 +72,7 @@ var CPBundlesForURLStrings = { };
|
||||
if (self)
|
||||
{
|
||||
_bundle = new CFBundle(aURL);
|
||||
CPBundlesForURLStrings[URLString] = self;
|
||||
CPBundlesForURLStrings[URLString] = [self retain];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
+5
-5
@@ -40,27 +40,27 @@
|
||||
|
||||
+ (CPData)data
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithRawString:(CPString)aString
|
||||
{
|
||||
return [[self alloc] initWithRawString:aString];
|
||||
return [[[self alloc] initWithRawString:aString] autorelease];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithPlistObject:(id)aPlistObject
|
||||
{
|
||||
return [[self alloc] initWithPlistObject:aPlistObject];
|
||||
return [[[self alloc] initWithPlistObject:aPlistObject] autorelease];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithPlistObject:(id)aPlistObject format:(CPPropertyListFormat)aFormat
|
||||
{
|
||||
return [[self alloc] initWithPlistObject:aPlistObject format:aFormat];
|
||||
return [[[self alloc] initWithPlistObject:aPlistObject format:aFormat] autorelease];
|
||||
}
|
||||
|
||||
+ (CPData)dataWithJSONObject:(Object)anObject
|
||||
{
|
||||
return [[self alloc] initWithJSONObject:anObject];
|
||||
return [[[self alloc] initWithJSONObject:anObject] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithRawString:(CPString)aString
|
||||
|
||||
+19
-13
@@ -24,7 +24,13 @@
|
||||
@import "CPString.j"
|
||||
|
||||
|
||||
var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0)),
|
||||
_CPDateAllocator = function(a) {
|
||||
a._retainCount = 1;
|
||||
a._UID = objj_generateObjectUID();
|
||||
OBJJ_MEMORY_TABLE[a._UID] = a;
|
||||
return a;
|
||||
};
|
||||
|
||||
/*!
|
||||
@class CPDate
|
||||
@@ -39,48 +45,48 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
+ (id)alloc
|
||||
{
|
||||
return new Date;
|
||||
return _CPDateAllocator(new Date);
|
||||
}
|
||||
|
||||
+ (id)date
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
+ (id)dateWithTimeIntervalSinceNow:(CPTimeInterval)seconds
|
||||
{
|
||||
return [[CPDate alloc] initWithTimeIntervalSinceNow:seconds];
|
||||
return [[[CPDate alloc] initWithTimeIntervalSinceNow:seconds] autorelease];
|
||||
}
|
||||
|
||||
+ (id)dateWithTimeIntervalSince1970:(CPTimeInterval)seconds
|
||||
{
|
||||
return [[CPDate alloc] initWithTimeIntervalSince1970:seconds];
|
||||
return [[[CPDate alloc] initWithTimeIntervalSince1970:seconds] autorelease];
|
||||
}
|
||||
|
||||
+ (id)dateWithTimeIntervalSinceReferenceDate:(CPTimeInterval)seconds
|
||||
{
|
||||
return [[CPDate alloc] initWithTimeIntervalSinceReferenceDate:seconds];
|
||||
return [[[CPDate alloc] initWithTimeIntervalSinceReferenceDate:seconds] autorelease];
|
||||
}
|
||||
|
||||
+ (id)distantPast
|
||||
{
|
||||
return new Date(-10000,1,1,0,0,0,0);
|
||||
return [_CPDateAllocator(new Date(-10000,1,1,0,0,0,0)) autorelease];
|
||||
}
|
||||
|
||||
+ (id)distantFuture
|
||||
{
|
||||
return new Date(10000,1,1,0,0,0,0);
|
||||
return [_CPDateAllocator(new Date(10000,1,1,0,0,0,0)) autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithTimeIntervalSinceNow:(CPTimeInterval)seconds
|
||||
{
|
||||
self = new Date((new Date()).getTime() + seconds * 1000);
|
||||
self = _CPDateAllocator(new Date((new Date()).getTime() + seconds * 1000));
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithTimeIntervalSince1970:(CPTimeInterval)seconds
|
||||
{
|
||||
self = new Date(seconds * 1000);
|
||||
self = _CPDateAllocator(new Date(seconds * 1000));
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -92,7 +98,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
- (id)initWithTimeInterval:(CPTimeInterval)seconds sinceDate:(CPDate)refDate
|
||||
{
|
||||
self = new Date(refDate.getTime() + seconds * 1000);
|
||||
self = _CPDateAllocator(new Date(refDate.getTime() + seconds * 1000));
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -117,7 +123,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
date.setMinutes(d[5]);
|
||||
date.setSeconds(d[6]);
|
||||
|
||||
self = new Date(date.getTime() + (timeZoneOffset - date.getTimezoneOffset()) * 60 * 1000);
|
||||
self = _CPDateAllocator(new Date(date.getTime() + (timeZoneOffset - date.getTimezoneOffset()) * 60 * 1000));
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -185,7 +191,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return new Date(self.getTime());
|
||||
return _CPDateAllocator(new Date(self.getTime()));
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
*/
|
||||
+ (id)dictionary
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -102,7 +102,7 @@
|
||||
*/
|
||||
+ (id)dictionaryWithDictionary:(CPDictionary)aDictionary
|
||||
{
|
||||
return [[self alloc] initWithDictionary:aDictionary];
|
||||
return [[[self alloc] initWithDictionary:aDictionary] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -113,7 +113,7 @@
|
||||
*/
|
||||
+ (id)dictionaryWithObject:(id)anObject forKey:(id)aKey
|
||||
{
|
||||
return [[self alloc] initWithObjects:[anObject] forKeys:[aKey]];
|
||||
return [[[self alloc] initWithObjects:[anObject] forKeys:[aKey]] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -125,7 +125,7 @@
|
||||
*/
|
||||
+ (id)dictionaryWithObjects:(CPArray)objects forKeys:(CPArray)keys
|
||||
{
|
||||
return [[self alloc] initWithObjects:objects forKeys:keys];
|
||||
return [[[self alloc] initWithObjects:objects forKeys:keys] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -135,7 +135,7 @@
|
||||
*/
|
||||
+ (id)dictionaryWithJSObject:(JSObject)object
|
||||
{
|
||||
return [self dictionaryWithJSObject:object recursively:NO];
|
||||
return [[self dictionaryWithJSObject:object recursively:NO] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -145,7 +145,7 @@
|
||||
*/
|
||||
+ (id)dictionaryWithJSObject:(JSObject)object recursively:(BOOL)recursively
|
||||
{
|
||||
var dictionary = [[self alloc] init];
|
||||
var dictionary = [[[self alloc] init] autorelease];
|
||||
|
||||
for (var key in object)
|
||||
{
|
||||
@@ -209,7 +209,7 @@
|
||||
arguments[0] = [self alloc];
|
||||
arguments[1] = @selector(initWithObjectsAndKeys:);
|
||||
|
||||
return objj_msgSend.apply(this, arguments);
|
||||
return [objj_msgSend.apply(this, arguments) autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
*/
|
||||
+ (id)indexSet
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
+ (id)indexSetWithIndex:(int)anIndex
|
||||
{
|
||||
return [[self alloc] initWithIndex:anIndex];
|
||||
return [[[self alloc] initWithIndex:anIndex] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -64,7 +64,7 @@
|
||||
*/
|
||||
+ (id)indexSetWithIndexesInRange:(CPRange)aRange
|
||||
{
|
||||
return [[self alloc] initWithIndexesInRange:aRange];
|
||||
return [[[self alloc] initWithIndexesInRange:aRange] autorelease];
|
||||
}
|
||||
|
||||
// Initializing and Index Set
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
*/
|
||||
+ (id)invocationWithMethodSignature:(CPMethodSignature)aMethodSignature
|
||||
{
|
||||
return [[self alloc] initWithMethodSignature:aMethodSignature];
|
||||
return [[[self alloc] initWithMethodSignature:aMethodSignature] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -56,7 +56,7 @@ CPJSONPCallbackReplacementString = @"${JSONP_CALLBACK}";
|
||||
|
||||
+ (CPJSONPConnection)connectionWithRequest:(CPURLRequest)aRequest callback:(CPString)callbackParameter delegate:(id)aDelegate
|
||||
{
|
||||
return [[[self class] alloc] initWithRequest:aRequest callback:callbackParameter delegate:aDelegate startImmediately:YES];;
|
||||
return [[[[self class] alloc] initWithRequest:aRequest callback:callbackParameter delegate:aDelegate startImmediately:YES] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithRequest:(CPURLRequest)aRequest callback:(CPString)aString delegate:(id)aDelegate
|
||||
|
||||
@@ -148,7 +148,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
+ (CPData)archivedDataWithRootObject:(id)anObject
|
||||
{
|
||||
var data = [CPData dataWithPlistObject:nil],
|
||||
archiver = [[self alloc] initForWritingWithMutableData:data];
|
||||
archiver = [[[self alloc] initForWritingWithMutableData:data] autorelease];
|
||||
|
||||
[archiver encodeObject:anObject forKey:@"root"];
|
||||
[archiver finishEncoding];
|
||||
|
||||
@@ -171,7 +171,7 @@ var CPArrayClass = Ni
|
||||
return nil;
|
||||
}
|
||||
|
||||
var unarchiver = [[self alloc] initForReadingWithData:aData],
|
||||
var unarchiver = [[[self alloc] initForReadingWithData:aData] autorelease],
|
||||
object = [unarchiver decodeObjectForKey:@"root"];
|
||||
|
||||
[unarchiver finishDecoding];
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
*/
|
||||
+ (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject userInfo:(CPDictionary)aUserInfo
|
||||
{
|
||||
return [[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo];
|
||||
return [[[self alloc] initWithName:aNotificationName object:anObject userInfo:aUserInfo] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -64,7 +64,7 @@
|
||||
*/
|
||||
+ (CPNotification)notificationWithName:(CPString)aNotificationName object:(id)anObject
|
||||
{
|
||||
return [[self alloc] initWithName:aNotificationName object:anObject userInfo:nil];
|
||||
return [[[self alloc] initWithName:aNotificationName object:anObject userInfo:nil] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -333,4 +333,7 @@ FIXME: Do we need this?
|
||||
|
||||
Number.prototype.isa = CPNumber;
|
||||
Boolean.prototype.isa = CPNumber;
|
||||
Number.prototype._retainCount = Infinity;
|
||||
Boolean.prototype._retainCount = Infinity;
|
||||
|
||||
[CPNumber initialize];
|
||||
|
||||
+10
-1
@@ -89,7 +89,6 @@ CPLog(@"Got some class: %@", inst);
|
||||
*/
|
||||
+ (id)alloc
|
||||
{
|
||||
// CPLog("calling alloc on " + self.name + ".");
|
||||
return class_createInstance(self);
|
||||
}
|
||||
|
||||
@@ -130,6 +129,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
*/
|
||||
- (void)dealloc
|
||||
{
|
||||
delete OBJJ_MEMORY_TABLE[[self UID]];
|
||||
}
|
||||
|
||||
// Identifying classes
|
||||
@@ -464,6 +464,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
*/
|
||||
- (id)autorelease
|
||||
{
|
||||
[CPAutoreleasePool addObject:self];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -498,6 +499,7 @@ CPLog(@"Got some class: %@", inst);
|
||||
*/
|
||||
- (id)retain
|
||||
{
|
||||
_retainCount++;
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -506,6 +508,11 @@ CPLog(@"Got some class: %@", inst);
|
||||
*/
|
||||
- (void)release
|
||||
{
|
||||
_retainCount--;
|
||||
if (_retainCount === 0)
|
||||
[self dealloc];
|
||||
else if (OBJJ_ZOMBIE_DETECTION && _retainCount < 0)
|
||||
throw ("Released a zombie object: "+self);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -535,3 +542,5 @@ objj_class.prototype.toString = objj_object.prototype.toString = function()
|
||||
else
|
||||
return String(this) + " (-description not implemented)";
|
||||
}
|
||||
|
||||
@import "CPAutoreleasePool.j"
|
||||
|
||||
@@ -73,7 +73,7 @@ var _CPRunLoopPerformPool = [],
|
||||
return perform;
|
||||
}
|
||||
|
||||
return [[self alloc] initWithSelector:aSelector target:aTarget argument:anArgument order:anOrder modes:modes];
|
||||
return [[[self alloc] initWithSelector:aSelector target:aTarget argument:anArgument order:anOrder modes:modes] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithSelector:(SEL)aSelector target:(SEL)aTarget argument:(id)anArgument order:(unsigned)anOrder modes:(CPArray)modes
|
||||
|
||||
+6
-6
@@ -45,7 +45,7 @@
|
||||
*/
|
||||
+ (id)set
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[[self alloc] init] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -54,7 +54,7 @@
|
||||
*/
|
||||
+ (id)setWithArray:(CPArray)array
|
||||
{
|
||||
return [[self alloc] initWithArray:array];
|
||||
return [[[self alloc] initWithArray:array] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -63,7 +63,7 @@
|
||||
*/
|
||||
+ (id)setWithObject:(id)anObject
|
||||
{
|
||||
return [[self alloc] initWithArray:[anObject]];
|
||||
return [[[self alloc] initWithArray:[anObject]] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -73,7 +73,7 @@
|
||||
*/
|
||||
+ (id)setWithObjects:(id)objects count:(unsigned)count
|
||||
{
|
||||
return [[self alloc] initWithObjects:objects count:count];
|
||||
return [[[self alloc] initWithObjects:objects count:count] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -90,7 +90,7 @@
|
||||
for(; i < argLength && ((argument = arguments[i]) !== nil); ++i)
|
||||
[set addObject:argument];
|
||||
|
||||
return set;
|
||||
return [set autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -99,7 +99,7 @@
|
||||
*/
|
||||
+ (id)setWithSet:(CPSet)set
|
||||
{
|
||||
return [[self alloc] initWithSet:set];
|
||||
return [[[self alloc] initWithSet:set] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -78,7 +78,7 @@ CPOrderedDescending = 1;
|
||||
|
||||
+ (id)sortDescriptorWithKey:(CPString)aKey ascending:(BOOL)isAscending selector:(SEL)aSelector
|
||||
{
|
||||
return [[self alloc] initWithKey:aKey ascending:isAscending selector:aSelector];
|
||||
return [[[self alloc] initWithKey:aKey ascending:isAscending selector:aSelector] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -769,3 +769,4 @@ var CPStringRegexSpecialCharacters = [
|
||||
@end
|
||||
|
||||
String.prototype.isa = CPString;
|
||||
String.prototype._retainCount = Infinity;
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds invocation:(CPInvocation)anInvocation repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
var timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
var timer = [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat] autorelease];
|
||||
|
||||
//add to the runloop
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
@@ -61,7 +61,7 @@
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
var timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat]
|
||||
var timer = [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat] autorelease];
|
||||
|
||||
//add to the runloop
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
@@ -74,7 +74,7 @@
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds callback:(Function)aFunction repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
var timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
var timer = [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat] autorelease];
|
||||
|
||||
//add to the runloop
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
@@ -87,7 +87,7 @@
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds invocation:(CPInvocation)anInvocation repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
return [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -95,7 +95,7 @@
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat];
|
||||
return [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -103,7 +103,7 @@
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds callback:(Function)aFunction repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
return [[[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
|
||||
|
||||
+ (id)URLWithString:(CPString)URLString
|
||||
{
|
||||
return [[self alloc] initWithString:URLString];
|
||||
return [[[self alloc] initWithString:URLString] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithString:(CPString)URLString relativeToURL:(CPURL)aBaseURL
|
||||
|
||||
@@ -128,7 +128,7 @@ var CPURLConnectionDelegate = nil;
|
||||
*/
|
||||
+ (CPURLConnection)connectionWithRequest:(CPURLRequest)aRequest delegate:(id)aDelegate
|
||||
{
|
||||
return [[self alloc] initWithRequest:aRequest delegate:aDelegate];
|
||||
return [[[self alloc] initWithRequest:aRequest delegate:aDelegate] autorelease];
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
*/
|
||||
+ (id)requestWithURL:(CPURL)aURL
|
||||
{
|
||||
return [[CPURLRequest alloc] initWithURL:aURL];
|
||||
return [[[CPURLRequest alloc] initWithURL:aURL] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -71,7 +71,7 @@ var _CPUndoGroupingPool = [],
|
||||
return grouping;
|
||||
}
|
||||
|
||||
return [[self alloc] initWithParent:anUndoGrouping];
|
||||
return [[[self alloc] initWithParent:anUndoGrouping] autorelease];
|
||||
}
|
||||
|
||||
- (id)initWithParent:(_CPUndoGrouping)anUndoGrouping
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
*/
|
||||
+ (id)valueWithJSObject:(JSObject)aJSObject
|
||||
{
|
||||
return [[self alloc] initWithJSObject:aJSObject];
|
||||
return [[[self alloc] initWithJSObject:aJSObject] autorelease];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
@import "CPAutoreleasePool.j"
|
||||
@import "CPArray.j"
|
||||
@import "CPBundle.j"
|
||||
@import "CPCoder.j"
|
||||
|
||||
@@ -107,16 +107,14 @@ task ("documentation", function()
|
||||
|
||||
// Downloads
|
||||
|
||||
task ("downloads", ["starter_download"]);
|
||||
task ("downloads", ["starter_download", "tools_download"]);
|
||||
|
||||
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
||||
$STARTER_BOOTSTRAP = 'bootstrap.sh';
|
||||
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
||||
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
||||
$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
|
||||
$STARTER_DOWNLOAD_BOOTSTRAP = FILE.join($STARTER_DOWNLOAD, 'bootstrap.sh');
|
||||
|
||||
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, $STARTER_DOWNLOAD_BOOTSTRAP, "documentation"], function()
|
||||
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, "documentation"], function()
|
||||
{
|
||||
if (FILE.exists($DOCUMENTATION_BUILD))
|
||||
{
|
||||
@@ -132,8 +130,8 @@ filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
|
||||
|
||||
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
||||
// FIXME: uncomment this: we get conversion errors
|
||||
OS.exit(1); // rake abort if ($? != 0)
|
||||
//{}
|
||||
//OS.exit(1); // rake abort if ($? != 0)
|
||||
{}
|
||||
// No tools means no objective-j gem
|
||||
// FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
|
||||
});
|
||||
@@ -143,11 +141,36 @@ filedir ($STARTER_DOWNLOAD_README, [$STARTER_README], function()
|
||||
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
||||
});
|
||||
|
||||
filedir ($STARTER_DOWNLOAD_BOOTSTRAP, [$STARTER_BOOTSTRAP], function()
|
||||
$TOOLS_README = FILE.join('Tools', 'READMEs', 'TOOLS-README');
|
||||
$TOOLS_EDITORS = FILE.join('Tools', 'Editors');
|
||||
$TOOLS_INSTALLER = FILE.join('Tools', 'Install', 'install-tools');
|
||||
$TOOLS_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools');
|
||||
$TOOLS_DOWNLOAD_EDITORS = FILE.join($TOOLS_DOWNLOAD, 'Editors');
|
||||
$TOOLS_DOWNLOAD_README = FILE.join($TOOLS_DOWNLOAD, 'README');
|
||||
$TOOLS_DOWNLOAD_INSTALLER = FILE.join($TOOLS_DOWNLOAD, 'install-tools');
|
||||
$TOOLS_DOWNLOAD_COMMONJS = FILE.join($BUILD_DIR, "Cappuccino", "Tools", "CommonJS", "objective-j");
|
||||
|
||||
task ("tools_download", [$TOOLS_DOWNLOAD_EDITORS, $TOOLS_DOWNLOAD_README, $TOOLS_DOWNLOAD_INSTALLER, $TOOLS_DOWNLOAD_COMMONJS]);
|
||||
|
||||
filedir ($TOOLS_DOWNLOAD_EDITORS, [$TOOLS_EDITORS], function()
|
||||
{
|
||||
var bootstrap = FILE.read($STARTER_BOOTSTRAP, { charset : "UTF-8" }).replace('install_capp=""', 'install_capp="yes"');
|
||||
FILE.write($STARTER_DOWNLOAD_BOOTSTRAP, bootstrap, { charset : "UTF-8" });
|
||||
OS.system(["chmod", "+x", $STARTER_DOWNLOAD_BOOTSTRAP]);
|
||||
cp_r(FILE.join($TOOLS_EDITORS, '.'), $TOOLS_DOWNLOAD_EDITORS);
|
||||
});
|
||||
|
||||
filedir ($TOOLS_DOWNLOAD_README, [$TOOLS_README], function()
|
||||
{
|
||||
cp($TOOLS_README, $TOOLS_DOWNLOAD_README);
|
||||
});
|
||||
|
||||
filedir ($TOOLS_DOWNLOAD_INSTALLER, [$TOOLS_INSTALLER], function()
|
||||
{
|
||||
cp($TOOLS_INSTALLER, $TOOLS_DOWNLOAD_INSTALLER);
|
||||
});
|
||||
|
||||
filedir ($TOOLS_DOWNLOAD_COMMONJS, ["CommonJS"], function()
|
||||
{
|
||||
rm_rf($TOOLS_DOWNLOAD_COMMONJS);
|
||||
cp_r($COMMONJS_PRODUCT, $TOOLS_DOWNLOAD_COMMONJS);
|
||||
});
|
||||
|
||||
// Deployment
|
||||
@@ -210,22 +233,15 @@ task ("demos", function()
|
||||
{
|
||||
return this.name();
|
||||
}
|
||||
|
||||
|
||||
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||
return new Demo(FILE.dirname(demoPath))
|
||||
}).filter(function(demo){
|
||||
return !demo.excluded();
|
||||
}).forEach(function(demo)
|
||||
{
|
||||
// copy frameworks into the demos
|
||||
cp_r(FILE.join($STARTER_DOWNLOAD_APPLICATION, "Frameworks"), FILE.join(demo.path(), "Frameworks"));
|
||||
rm_rf(FILE.join(demo.path(), "Frameworks", "Debug"));
|
||||
|
||||
var outputPath = demo.name().replace(/\s/g, "-")+".zip";
|
||||
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+" && zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(FILE.basename(demo.path())));
|
||||
|
||||
// remove the frameworks
|
||||
rm_rf(FILE.join(demo.path(), "Frameworks"));
|
||||
var outputPath = FILE.join(demosDir, demo.name().replace(/\s/g, "-")+".zip");
|
||||
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+"; zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(demo.path()));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ GLOBAL(CFBundle) = function(/*CFURL|String*/ aURL)
|
||||
this._infoDictionary = new CFDictionary();
|
||||
|
||||
this._eventDispatcher = new EventDispatcher(this);
|
||||
|
||||
this._UID = objj_generateObjectUID();
|
||||
this._retainCount = 1;
|
||||
OBJJ_MEMORY_TABLE[this._UID] = this;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFBundle);
|
||||
|
||||
@@ -31,6 +31,10 @@ GLOBAL(CFData) = function()
|
||||
|
||||
this._bytes = NULL;
|
||||
this._base64 = NULL;
|
||||
|
||||
this._UID = objj_generateObjectUID();
|
||||
this._retainCount = 1;
|
||||
OBJJ_MEMORY_TABLE[this._UID] = this;
|
||||
}
|
||||
|
||||
CFData.prototype.propertyList = function()
|
||||
|
||||
@@ -26,6 +26,8 @@ GLOBAL(CFDictionary) = function(/*CFDictionary*/ aDictionary)
|
||||
this._count = 0;
|
||||
this._buckets = { };
|
||||
this._UID = objj_generateObjectUID();
|
||||
this._retainCount = 1;
|
||||
OBJJ_MEMORY_TABLE[this._UID] = this;
|
||||
}
|
||||
|
||||
var indexOf = Array.prototype.indexOf,
|
||||
|
||||
@@ -177,8 +177,7 @@ CFHTTPRequest.prototype.responseText = function()
|
||||
|
||||
CFHTTPRequest.prototype.setRequestHeader = function(/*String*/ aHeader, /*Object*/ aValue)
|
||||
{
|
||||
if (!this._URL)
|
||||
return this._nativeRequest.setRequestHeader(aHeader, aValue);
|
||||
return this._nativeRequest.setRequestHeader(aHeader, aValue);
|
||||
}
|
||||
|
||||
CFHTTPRequest.prototype.getResponseHeader = function(/*String*/ aHeader)
|
||||
@@ -199,65 +198,11 @@ CFHTTPRequest.prototype.overrideMimeType = function(/*String*/ aMimeType)
|
||||
|
||||
CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*Boolean*/ isAsynchronous, /*String*/ aUser, /*String*/ aPassword)
|
||||
{
|
||||
aURL = makeAbsoluteURL(aURL);
|
||||
|
||||
if (aURL.isStorageURL())
|
||||
{
|
||||
this._URL = aURL;
|
||||
this._method = aMethod;
|
||||
this._isAsynchronous = isAsynchronous;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
else if (this._URL)
|
||||
{
|
||||
delete this._URL;
|
||||
delete this._method;
|
||||
delete this._isAsynchronous;
|
||||
}
|
||||
|
||||
return this._nativeRequest.open(aMethod, aURL + "", isAsynchronous, aUser, aPassword);
|
||||
}
|
||||
|
||||
function sendStorage(/*CFHTTPRequest*/ aRequest, /*String*/ aBody)
|
||||
{
|
||||
var method = aRequest._method.toUpperCase(),
|
||||
eventDispatcher = aRequest._eventDispatcher;
|
||||
|
||||
if (method === "GET")
|
||||
{
|
||||
var item = localStorage.getItem(aRequest._URL);
|
||||
|
||||
if (item === undefined)
|
||||
eventDispatcher.dispatchEvent({ type:"failure", request:aRequest });
|
||||
|
||||
else
|
||||
eventDispatcher.dispatchEvent({ type:"success", request:aRequest });
|
||||
}
|
||||
|
||||
else if (method === "POST" || method === "PUT")
|
||||
{
|
||||
try
|
||||
{
|
||||
localStorage.setItem(aRequest._URL, aBody);
|
||||
eventDispatcher.dispatchEvent({ type:"success", request:aRequest });
|
||||
}
|
||||
catch (anException)
|
||||
{
|
||||
eventDispatcher.dispatchEvent({ type:"failure", request:aRequest });
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
eventDispatcher.dispatchEvent({ type:"failure", request:aRequest });
|
||||
return this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword);
|
||||
}
|
||||
|
||||
CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
|
||||
{
|
||||
if (this._URL)
|
||||
return sendStorage(this, aBody);
|
||||
|
||||
try
|
||||
{
|
||||
return this._nativeRequest.send(aBody);
|
||||
|
||||
+2
-21
@@ -199,6 +199,8 @@ GLOBAL(CFURL) = function(/*CFURL|String*/ aURL, /*CFURL*/ aBaseURL)
|
||||
}
|
||||
|
||||
this._UID = objj_generateObjectUID();
|
||||
this._retainCount = 1;
|
||||
OBJJ_MEMORY_TABLE[this._UID] = this;
|
||||
|
||||
this._string = aURL;
|
||||
this._baseURL = aBaseURL;
|
||||
@@ -498,27 +500,6 @@ CFURL.prototype.authority = function()
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.authority);
|
||||
|
||||
CFURL.prototype.isStorageURL = function()
|
||||
{
|
||||
return this.isLocalStorageURL() || this.isSessionStorageURL();
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.isStorageURL);
|
||||
|
||||
CFURL.prototype.isLocalStorageURL = function()
|
||||
{
|
||||
return this.scheme() === "storage.local";
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.isLocalStorageURL);
|
||||
|
||||
CFURL.prototype.isSessionStorageURL = function()
|
||||
{
|
||||
return this.scheme() === "storage.session";
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.isSessionStorageURL);
|
||||
|
||||
CFURL.prototype.hasDirectoryPath = function()
|
||||
{
|
||||
var hasDirectoryPath = this._hasDirectoryPath;
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
|
||||
var FILE = require("file");
|
||||
var MD5 = require("md5");
|
||||
|
||||
var FileList = require("jake").FileList,
|
||||
var BundleTask = require("objective-j/jake/bundletask").BundleTask;
|
||||
|
||||
exports.generateManifest = function(productPath, indexFilePath)
|
||||
{
|
||||
indexFilePath = indexFilePath || FILE.join(productPath, "index.html");
|
||||
|
||||
if (!FILE.isFile(indexFilePath)) {
|
||||
print("Warning: Skipping cache manifest generation, no index file at "+indexFilePath);
|
||||
return;
|
||||
}
|
||||
|
||||
var index = FILE.read(indexFilePath, { charset : "UTF-8" });
|
||||
|
||||
var manifestName = "app.manifest";
|
||||
var manifestPath = FILE.join(productPath, manifestName);
|
||||
var manifestAttribute = 'manifest="'+manifestName+'"';
|
||||
|
||||
print("Generating cache manifest: " + manifestPath);
|
||||
|
||||
var manifestOut = FILE.open(manifestPath, "w", { charset : "UTF-8" });
|
||||
manifestOut.print("CACHE MANIFEST");
|
||||
manifestOut.print("");
|
||||
manifestOut.print("CACHE:");
|
||||
|
||||
var list = new FileList(FILE.join(productPath, "**", "*"));
|
||||
list.exclude(manifestPath);
|
||||
list.exclude("**/.DS_Store", "**/.htaccess");
|
||||
list.exclude("**/LICENSE");
|
||||
list.exclude("**/MHTML*");
|
||||
list.exclude("**/CommonJS.environment/*");
|
||||
|
||||
// FIXME: bleh. heuristic for whether index file includes debug frameworks
|
||||
if (index.indexOf('"Frameworks/Debug"') < 0)
|
||||
list.exclude("**/Frameworks/Debug/*");
|
||||
|
||||
list.forEach(function(path) {
|
||||
if (FILE.isFile(path)) {
|
||||
// FIXME: check the actual sprited images file
|
||||
if (BundleTask.isSpritable(path))
|
||||
return;
|
||||
|
||||
// include hash of each file in comments to expire when any file changes
|
||||
var hash = MD5.hash(FILE.read(path, "b")).decodeToString("base16");
|
||||
manifestOut.print("# " + hash);
|
||||
manifestOut.print(FILE.relative(productPath, path));
|
||||
}
|
||||
});
|
||||
|
||||
manifestOut.print("");
|
||||
manifestOut.print("NETWORK:");
|
||||
manifestOut.print("*");
|
||||
manifestOut.close();
|
||||
|
||||
// Insert "manifest" attribute in <html> tag of index file
|
||||
var matchTag = index.match(/<html[^>]*>/i);
|
||||
if (matchTag) {
|
||||
var htmlTag = matchTag[0];
|
||||
var newHTMLTag = null;
|
||||
|
||||
var matchAttr = htmlTag.match(/manifest\s*=\s*"([^"]*)"/i);
|
||||
if (matchAttr) {
|
||||
if (matchAttr[1] !== manifestName) {
|
||||
newHTMLTag = htmlTag.replace(matchAttr[0], manifestAttribute);
|
||||
}
|
||||
} else {
|
||||
newHTMLTag = htmlTag.replace(/>$/, " "+manifestAttribute+">");
|
||||
}
|
||||
|
||||
if (newHTMLTag) {
|
||||
print("Replacing html tag: \n " + htmlTag + "\nwith:\n " + newHTMLTag);
|
||||
var newIndex = index.replace(htmlTag, newHTMLTag);
|
||||
if (newIndex === index) {
|
||||
print("Warning: No change!");
|
||||
} else {
|
||||
FILE.write(indexFilePath, newIndex, { charset : "UTF-8" });
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print("Warning: Couldn't find <html> tag in "+indexFilePath);
|
||||
}
|
||||
|
||||
// Add Content-Type "text/cache-manifest" for manifest file to .htaccess
|
||||
// This allows manifests to work out of the box on Apache (if htaccess overrides are allowed)
|
||||
var htaccessPath = FILE.join(productPath, ".htaccess");
|
||||
var htaccess = FILE.isFile(htaccessPath) ? FILE.read(htaccessPath, { charset : "UTF-8" }) : "";
|
||||
|
||||
var htaccessOut = FILE.open(htaccessPath, "w", { charset : "UTF-8" });
|
||||
htaccessOut.print(htaccess);
|
||||
|
||||
var openTag = "<Files "+manifestName+">";
|
||||
if (htaccess.indexOf(openTag) < 0) {
|
||||
htaccessOut.print("");
|
||||
htaccessOut.print(openTag);
|
||||
htaccessOut.print("\tHeader set Content-Type text/cache-manifest");
|
||||
htaccessOut.print("</Files>");
|
||||
}
|
||||
htaccessOut.close();
|
||||
}
|
||||
@@ -17,8 +17,6 @@ function ApplicationTask(aName)
|
||||
this._frameworksPath = "Frameworks";
|
||||
else
|
||||
this._frameworksPath = null;
|
||||
|
||||
this._shouldGenerateCacheManifest = false;
|
||||
}
|
||||
|
||||
ApplicationTask.__proto__ = BundleTask;
|
||||
@@ -35,7 +33,6 @@ ApplicationTask.prototype.defineTasks = function()
|
||||
|
||||
this.defineFrameworksTask();
|
||||
this.defineIndexFileTask();
|
||||
this.defineCacheManifestTask();
|
||||
}
|
||||
|
||||
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
||||
@@ -62,16 +59,6 @@ ApplicationTask.prototype.frameworksPath = function()
|
||||
return this._frameworksPath;
|
||||
}
|
||||
|
||||
ApplicationTask.prototype.setShouldGenerateCacheManifest = function(shouldGenerateCacheManifest)
|
||||
{
|
||||
this._shouldGenerateCacheManifest = shouldGenerateCacheManifest;
|
||||
}
|
||||
|
||||
ApplicationTask.prototype.shouldGenerateCacheManifest = function()
|
||||
{
|
||||
return this._shouldGenerateCacheManifest;
|
||||
}
|
||||
|
||||
ApplicationTask.prototype.defineFrameworksTask = function()
|
||||
{
|
||||
// FIXME: platform requires...
|
||||
@@ -85,7 +72,7 @@ ApplicationTask.prototype.defineFrameworksTask = function()
|
||||
Jake.fileCreate(newFrameworks, function()
|
||||
{
|
||||
if (thisTask._frameworksPath === "capp")
|
||||
OS.system(["capp", "gen", "-f", "--force", buildPath]);
|
||||
OS.system("capp gen -f --force " + buildPath);
|
||||
else if (thisTask._frameworksPath)
|
||||
{
|
||||
if (FILE.exists(newFrameworks))
|
||||
@@ -119,23 +106,6 @@ ApplicationTask.prototype.defineIndexFileTask = function()
|
||||
this.enhance([buildIndexFilePath]);
|
||||
}
|
||||
|
||||
ApplicationTask.prototype.defineCacheManifestTask = function()
|
||||
{
|
||||
if (!this.shouldGenerateCacheManifest())
|
||||
return;
|
||||
|
||||
var productPath = FILE.join(this.buildProductPath(), "");
|
||||
var indexFilePath = this.buildIndexFilePath();
|
||||
|
||||
// TODO: can we conditionally generate based on outdated files?
|
||||
var manifestPath = FILE.join(productPath, "app.manifest");
|
||||
Jake.task(manifestPath, function() {
|
||||
require("../cache-manifest").generateManifest(productPath, indexFilePath);
|
||||
});
|
||||
|
||||
this.enhance([manifestPath]);
|
||||
}
|
||||
|
||||
exports.ApplicationTask = ApplicationTask;
|
||||
|
||||
exports.app = function(aName, aFunction)
|
||||
|
||||
@@ -451,14 +451,10 @@ BundleTask.prototype.resourcesPath = function()
|
||||
return FILE.join(this.buildProductPath(), "Resources", "");
|
||||
}
|
||||
|
||||
// Don't sprite images larger than 32KB, IE 8 doesn't like it.
|
||||
BundleTask.isSpritable = function(aResourcePath) {
|
||||
return isImage(aResourcePath) && FILE.size(aResourcePath) < 32768;
|
||||
}
|
||||
|
||||
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
|
||||
{
|
||||
if (this.spritesResources() && BundleTask.isSpritable(aResourcePath))
|
||||
// Don't sprite images larger than 32KB, IE 8 doesn't like it.
|
||||
if (this.spritesResources() && isImage(aResourcePath) && FILE.size(aResourcePath) < 32768)
|
||||
{
|
||||
this.environments().forEach(function(/*Environment*/ anEnvironment)
|
||||
{
|
||||
|
||||
@@ -73,3 +73,8 @@ GLOBAL(PI_2) = Math.PI / 2.0;
|
||||
|
||||
GLOBAL(SQRT1_2) = Math.SQRT1_2;
|
||||
GLOBAL(SQRT2) = Math.SQRT2;
|
||||
|
||||
GLOBAL(OBJJ_MEMORY_TABLE) = [];
|
||||
|
||||
GLOBAL($) = function(pointer) { return OBJJ_MEMORY_TABLE[pointer]; }
|
||||
GLOBAL($$) = function(object) { return object._UID; }
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef BROWSER
|
||||
CPLogRegister(CPLogDefault);
|
||||
#endif
|
||||
|
||||
// formatting helpers
|
||||
|
||||
@@ -219,3 +217,6 @@ GLOBAL(objj_debug_typecheck) = function(expectedType, object)
|
||||
|
||||
throw ("expected=" + expectedType + ", actual=" + actualType);
|
||||
}
|
||||
|
||||
if (typeof window.OBJJ_ZOMBIE_DETECTION === "undefined")
|
||||
OBJJ_ZOMBIE_DETECTION = false;
|
||||
|
||||
@@ -34,8 +34,6 @@ var TOKEN_ACCESSORS = "accessors",
|
||||
TOKEN_SUPER = "super",
|
||||
TOKEN_VAR = "var",
|
||||
TOKEN_IN = "in",
|
||||
TOKEN_PRAGMA = "pragma",
|
||||
TOKEN_MARK = "mark",
|
||||
|
||||
TOKEN_EQUAL = '=',
|
||||
TOKEN_PLUS = '+',
|
||||
@@ -52,7 +50,6 @@ var TOKEN_ACCESSORS = "accessors",
|
||||
TOKEN_OPEN_BRACKET = '[',
|
||||
TOKEN_DOUBLE_QUOTE = '"',
|
||||
TOKEN_PREPROCESSOR = '@',
|
||||
TOKEN_HASH = '#',
|
||||
TOKEN_CLOSE_BRACKET = ']',
|
||||
TOKEN_QUESTION_MARK = '?',
|
||||
TOKEN_OPEN_PARENTHESIS = '(',
|
||||
@@ -366,29 +363,6 @@ Preprocessor.prototype.directive = function(tokens, aStringBuffer, allowedDirect
|
||||
return buffer;
|
||||
}
|
||||
|
||||
Preprocessor.prototype.hash = function(tokens, aStringBuffer)
|
||||
{
|
||||
// Grab the next token, C preprocessor directives follow '#' immediately.
|
||||
var buffer = aStringBuffer ? aStringBuffer : new StringBuffer(),
|
||||
token = tokens.next();
|
||||
|
||||
// #pragma (C Preprocessor directive)
|
||||
if (token === TOKEN_PRAGMA)
|
||||
{
|
||||
token = tokens.skip_whitespace();
|
||||
|
||||
// '#pragma mark' directive is used in Xcode editor for creating labels,
|
||||
// which is irrelevant to Cappuccino - just swallow this line
|
||||
if (token === TOKEN_MARK)
|
||||
{
|
||||
while ((token = tokens.next()).indexOf("\n") < 0);
|
||||
}
|
||||
}
|
||||
// if not a #pragma directive, it should not be processed here
|
||||
else
|
||||
throw new SyntaxError(this.error_message("*** Expected \"pragma\" to follow # but instead saw \"" + token + "\"."));
|
||||
}
|
||||
|
||||
Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStringBuffer)
|
||||
{
|
||||
var buffer = aStringBuffer,
|
||||
@@ -568,11 +542,6 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
||||
|
||||
CONCAT(instance_methods, this.method(tokens, ivar_names));
|
||||
}
|
||||
// If we reach a # symbol, we may be at a C preprocessor directive.
|
||||
else if (token == TOKEN_HASH)
|
||||
{
|
||||
this.hash(tokens, buffer);
|
||||
}
|
||||
// Check if we've reached @end...
|
||||
else if (token == TOKEN_PREPROCESSOR)
|
||||
{
|
||||
@@ -927,10 +896,6 @@ Preprocessor.prototype.preprocess = function(tokens, /*StringBuffer*/ aStringBuf
|
||||
// If we reach an @ symbol, we are at a preprocessor directive.
|
||||
else if (token == TOKEN_PREPROCESSOR)
|
||||
this.directive(tokens, buffer);
|
||||
|
||||
// If we reach a # symbol, we may be at a C preprocessor directive.
|
||||
else if (token == TOKEN_HASH)
|
||||
this.hash(tokens, buffer);
|
||||
|
||||
// If we reach a bracket, we will either be preprocessing a message send, a literal
|
||||
// array, or an array index.
|
||||
|
||||
@@ -392,6 +392,8 @@ GLOBAL(class_createInstance) = function(/*Class*/ aClass)
|
||||
|
||||
object.isa = aClass;
|
||||
object._UID = objj_generateObjectUID();
|
||||
object._retainCount = 1;
|
||||
OBJJ_MEMORY_TABLE[object._UID] = object;
|
||||
|
||||
return object;
|
||||
}
|
||||
@@ -514,6 +516,9 @@ GLOBAL(objj_msgSend) = function(/*id*/ aReceiver, /*SEL*/ aSelector)
|
||||
if (aReceiver == nil)
|
||||
return nil;
|
||||
|
||||
if (OBJJ_ZOMBIE_DETECTION && typeof aReceiver._retainCount !== "undefined" && aReceiver._retainCount < 1 && $($$(aReceiver)) !== aReceiver)
|
||||
throw ("Sending a message to a zombie object: "+$$(aReceiver));
|
||||
|
||||
var isa = aReceiver.isa;
|
||||
|
||||
CLASS_GET_METHOD_IMPLEMENTATION(var implementation, isa, aSelector);
|
||||
|
||||
@@ -155,61 +155,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testInsertObjectInArraySortedByDescriptors
|
||||
{
|
||||
var descriptors = [[[CPSortDescriptor alloc] initWithKey:@"intValue" ascending:YES]];
|
||||
var array = [1, 3, 5];
|
||||
|
||||
[array insertObject: 0 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[0, 1, 3, 5] equals:array];
|
||||
|
||||
array = [1, 3, 5];
|
||||
[array insertObject: 2 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[1, 2, 3, 5] equals:array];
|
||||
|
||||
array = [1, 3, 5];
|
||||
[array insertObject: 1 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[1, 1, 3, 5] equals:array];
|
||||
|
||||
array = [1, 3, 5];
|
||||
[array insertObject: 6 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[1, 3, 5, 6] equals:array];
|
||||
|
||||
array = [1, 3, 5];
|
||||
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[1, 3, 3, 5] equals:array];
|
||||
|
||||
array = [];
|
||||
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[3] equals:array];
|
||||
|
||||
descriptors = [[[CPSortDescriptor alloc] initWithKey:@"intValue" ascending:NO]];
|
||||
|
||||
array = [5, 3, 1];
|
||||
[array insertObject: 0 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[5, 3, 1, 0] equals:array];
|
||||
|
||||
array = [5, 3, 1];
|
||||
[array insertObject: 2 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[5, 3, 2, 1] equals:array];
|
||||
|
||||
array = [5, 3, 1];
|
||||
[array insertObject: 1 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[5, 3, 1, 1] equals:array];
|
||||
|
||||
array = [5, 3, 1];
|
||||
[array insertObject: 6 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[6, 5, 3, 1] equals:array];
|
||||
|
||||
array = [5, 3, 1];
|
||||
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[5, 3, 3, 1] equals:array];
|
||||
|
||||
array = [];
|
||||
[array insertObject: 3 inArraySortedByDescriptors:descriptors];
|
||||
[self assert:[3] equals:array];
|
||||
}
|
||||
|
||||
- (void)testInitWithArrayCopyItems
|
||||
{
|
||||
var a = [[CopyableObject new], 2, 3];
|
||||
@@ -218,16 +163,6 @@
|
||||
[self assert:a notEqual:b];
|
||||
}
|
||||
|
||||
- (void)testIsEqualToArray
|
||||
{
|
||||
var a = [1, 2, 3],
|
||||
b = [5];
|
||||
|
||||
[self assertTrue:[a isEqualToArray:a]];
|
||||
[self assertFalse:[a isEqualToArray:b]];
|
||||
[self assertFalse:[a isEqualToArray:nil]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPArray (reverse)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div>Test custom cursors with .cur images.</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/disappearingItemCursor.cur), default">disappearingItemCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/closedHandCursor.cur), default">closedHandCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/contextMenuCursor.cur), default">contextMenuCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/dragCopyCursor.cur), default">dragCopyCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/dragLinkCursor.cur), default">dragLinkCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/openHandCursor.cur), default">openHandCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeDownCursor.cur), default">resizeDownCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeLeftCursor.cur), default">resizeLeftCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeRightCursor.cur), default">resizeRightCursor</div>
|
||||
<div style="width: 20px; height: 20px; margin: 10px; background: #ddd; cursor: url(../../../AppKit/Resources/CPCursor/resizeUpCursor.cur), default">resizeUpCursor</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -49,7 +49,7 @@ parser.option("--force", "force")
|
||||
.help("Overwrite update existing frameworks.");
|
||||
|
||||
parser.option("--noconfig", "noconfig")
|
||||
.set(true)
|
||||
.set()
|
||||
.help("Selects a project template to use.");
|
||||
|
||||
parser.option("--list-templates", "listTemplates")
|
||||
|
||||
@@ -13,14 +13,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -28,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
@@ -72,7 +64,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
@@ -13,21 +13,13 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -49,7 +41,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
@@ -13,14 +13,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -28,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
@@ -72,7 +64,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
@@ -13,21 +13,13 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -49,7 +41,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
@@ -13,14 +13,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -28,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -50,7 +42,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
@@ -13,21 +13,13 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>__project.name__</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -49,7 +41,7 @@
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
<script type = "text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading __project.name__...</p></div>");
|
||||
|
||||
+5
-12
@@ -28,23 +28,16 @@
|
||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
var isBold = NO,
|
||||
fontName = [aCoder decodeObjectForKey:@"NSName"],
|
||||
size = [aCoder decodeDoubleForKey:@"NSSize"];
|
||||
|
||||
if ((fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold") && size === 13)
|
||||
{
|
||||
CPLog.debug("Converting default IB font: <"+fontName+", "+size+"> to default Aristo font: <Arial, 12>");
|
||||
return [CPFont boldSystemFontOfSize:12.0];
|
||||
}
|
||||
|
||||
fontName = [aCoder decodeObjectForKey:@"NSName"];
|
||||
|
||||
// FIXME: Is this alwasy true?
|
||||
if (fontName.indexOf("-Bold") === fontName.length - "-Bold".length)
|
||||
isBold = YES;
|
||||
|
||||
|
||||
if (fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold")
|
||||
fontName = "Arial";
|
||||
|
||||
return [self _initWithName:fontName size:size bold:isBold];
|
||||
|
||||
return [self _initWithName:fontName size:[aCoder decodeDoubleForKey:@"NSSize"] bold:isBold];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
@import "NSControl.j"
|
||||
@import "NSCell.j"
|
||||
@import <AppKit/CPFont.j>
|
||||
|
||||
|
||||
@implementation CPTextField (NSCoding)
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
{
|
||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||
|
||||
if ([[cell font] isEqual:[CPFont boldSystemFontOfSize:12.0]])
|
||||
[self setFont:[CPFont systemFontOfSize:12.0]];
|
||||
|
||||
[self sendActionOn:CPKeyUpMask|CPKeyDownMask];
|
||||
|
||||
[self setEditable:[cell isEditable]];
|
||||
|
||||
+3
-9
@@ -118,7 +118,6 @@ github_ref="master"
|
||||
tusk_install_command="install"
|
||||
|
||||
noprompt=""
|
||||
install_capp=""
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
@@ -127,7 +126,6 @@ while [ $# -gt 0 ]; do
|
||||
--clone) tusk_install_command="clone";;
|
||||
--github-user) github_user="$2"; shift;;
|
||||
--github-ref) github_ref="$2"; shift;;
|
||||
--install-capp) install_capp="yes";;
|
||||
*) cat >&2 <<-EOT
|
||||
usage: ./bootstrap.sh [OPTIONS]
|
||||
|
||||
@@ -136,7 +134,6 @@ usage: ./bootstrap.sh [OPTIONS]
|
||||
--clone: Do "git clone" instead of downloading zips.
|
||||
--github-user [USER]: Use another github user (default: 280north).
|
||||
--github-ref [REF]: Use another git ref (default: master).
|
||||
--install-capp: Install "objective-j" and "cappuccino" packages.
|
||||
EOT
|
||||
exit 1;;
|
||||
esac
|
||||
@@ -266,13 +263,10 @@ fi
|
||||
# echo "================================================================================"
|
||||
# echo "Would you like to install the pre-built Objective-J and Cappuccino packages?"
|
||||
# echo "If you intend to build Cappuccino yourself this is not neccessary."
|
||||
# if [ ! "$install_capp" ] && prompt; then
|
||||
# install_capp="yes"
|
||||
# extra_packages=""
|
||||
# if prompt; then
|
||||
# extra_packages="objective-j cappuccino"
|
||||
# fi
|
||||
extra_packages=""
|
||||
if [ "$install_capp" ]; then
|
||||
extra_packages="objective-j cappuccino"
|
||||
fi
|
||||
|
||||
echo "Installing necessary packages..."
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "0.8.1"
|
||||
"version": "0.8.0"
|
||||
}
|
||||
Reference in New Issue
Block a user