mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-09 12:17:13 +00:00
Compare commits
37
Commits
refcount
...
localStorage
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4091acd0ec | ||
|
|
6a72e1b6ff | ||
|
|
b3141f1a62 | ||
|
|
aea8f1f0dc | ||
|
|
f8114b0760 | ||
|
|
8aecf880e5 | ||
|
|
7d5ce51910 | ||
|
|
cfc8ccafce | ||
|
|
e11dfc2875 | ||
|
|
b3ef31ad05 | ||
|
|
70410d6311 | ||
|
|
4cc7dec35b | ||
|
|
47ecd40c4f | ||
|
|
489f2bcfa0 | ||
|
|
16590e0603 | ||
|
|
f50cda9abc | ||
|
|
7543968203 | ||
|
|
54685b1f36 | ||
|
|
abdc601d92 | ||
|
|
9f50f08065 | ||
|
|
aabb1fa6f2 | ||
|
|
4b770714bd | ||
|
|
8175dbca53 | ||
|
|
c91332afb4 | ||
|
|
08fb1b33b4 | ||
|
|
cd6b6afc65 | ||
|
|
cd4a70ea78 | ||
|
|
eb24ba9835 | ||
|
|
468869821f | ||
|
|
0c85dbf9b0 | ||
|
|
2db47e413e | ||
|
|
b8fddc98bf | ||
|
|
467f798147 | ||
|
|
374f3d13f1 | ||
|
|
b0a35a183f | ||
|
|
74e349ed33 | ||
|
|
c57aa2ac5e |
@@ -96,12 +96,12 @@
|
|||||||
return _items;
|
return _items;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)addItem:(CPAccordionItem)anItem
|
- (void)addItem:(CPAccordionViewItem)anItem
|
||||||
{
|
{
|
||||||
[self insertItem:anItem atIndex:_items.length];
|
[self insertItem:anItem atIndex:_items.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertItem:(CPAccordionItem)anItem atIndex:(CPInteger)anIndex
|
- (void)insertItem:(CPAccordionViewItem)anItem atIndex:(CPInteger)anIndex
|
||||||
{
|
{
|
||||||
// FIXME: SHIFT ITEMS RIGHT
|
// FIXME: SHIFT ITEMS RIGHT
|
||||||
[_expandedItemIndexes addIndex:anIndex];
|
[_expandedItemIndexes addIndex:anIndex];
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
[self setNeedsLayout];
|
[self setNeedsLayout];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)removeItem:(CPAccordionItem)anItem
|
- (void)removeItem:(CPAccordionViewItem)anItem
|
||||||
{
|
{
|
||||||
[self removeItemAtIndex:[_items indexOfObjectIdenticalTo:anItem]];
|
[self removeItemAtIndex:[_items indexOfObjectIdenticalTo:anItem]];
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-70
@@ -31,6 +31,7 @@
|
|||||||
@import "CPCibLoading.j"
|
@import "CPCibLoading.j"
|
||||||
@import "CPPlatform.j"
|
@import "CPPlatform.j"
|
||||||
|
|
||||||
|
#include "Platform/Platform.h"
|
||||||
|
|
||||||
var CPMainCibFile = @"CPMainCibFile",
|
var CPMainCibFile = @"CPMainCibFile",
|
||||||
CPMainCibFileHumanFriendly = @"Main cib file base name";
|
CPMainCibFileHumanFriendly = @"Main cib file base name";
|
||||||
@@ -212,85 +213,46 @@ CPRunContinuesResponse = -1002;
|
|||||||
{
|
{
|
||||||
if (_delegate == aDelegate)
|
if (_delegate == aDelegate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var defaultCenter = [CPNotificationCenter defaultCenter];
|
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];
|
||||||
|
|
||||||
if (_delegate)
|
if (_delegate)
|
||||||
{
|
{
|
||||||
[defaultCenter
|
var index = 0;
|
||||||
removeObserver:_delegate
|
|
||||||
name:CPApplicationWillFinishLaunchingNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
[defaultCenter
|
for (; index < count; index += 2)
|
||||||
removeObserver:_delegate
|
{
|
||||||
name:CPApplicationDidFinishLaunchingNotification
|
var notificationName = delegateNotifications[index],
|
||||||
object:self];
|
selector = delegateNotifications[index + 1];
|
||||||
|
|
||||||
[defaultCenter
|
if ([_delegate respondsToSelector:selector])
|
||||||
removeObserver:_delegate
|
[defaultCenter removeObserver:_delegate name:notificationName object:self];
|
||||||
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;
|
_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];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationWillBecomeActive:)])
|
var index = 0;
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationWillBecomeActive:)
|
|
||||||
name:CPApplicationWillBecomeActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationDidBecomeActive:)])
|
for (; index < count; index += 2)
|
||||||
[defaultCenter
|
{
|
||||||
addObserver:_delegate
|
var notificationName = delegateNotifications[index],
|
||||||
selector:@selector(applicationDidBecomeActive:)
|
selector = delegateNotifications[index + 1];
|
||||||
name:CPApplicationDidBecomeActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationWillResignActive:)])
|
if ([_delegate respondsToSelector:selector])
|
||||||
[defaultCenter
|
[defaultCenter addObserver:_delegate selector:selector name:notificationName object:self];
|
||||||
addObserver:_delegate
|
}
|
||||||
selector:@selector(applicationWillResignActive:)
|
|
||||||
name:CPApplicationWillResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(applicationDidResignActive:)])
|
|
||||||
[defaultCenter
|
|
||||||
addObserver:_delegate
|
|
||||||
selector:@selector(applicationDidResignActive:)
|
|
||||||
name:CPApplicationDidResignActiveNotification
|
|
||||||
object:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -369,6 +331,10 @@ CPRunContinuesResponse = -1002;
|
|||||||
|
|
||||||
- (void)terminate:(id)aSender
|
- (void)terminate:(id)aSender
|
||||||
{
|
{
|
||||||
|
[[CPNotificationCenter defaultCenter]
|
||||||
|
postNotificationName:CPApplicationWillTerminateNotification
|
||||||
|
object:self];
|
||||||
|
|
||||||
if (![CPPlatform isBrowser])
|
if (![CPPlatform isBrowser])
|
||||||
{
|
{
|
||||||
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
[[CPDocumentController sharedDocumentController] closeAllDocumentsWithDelegate:self
|
||||||
@@ -1137,6 +1103,13 @@ var _CPRunModalLoop = function(anEvent)
|
|||||||
|
|
||||||
function CPApplicationMain(args, namedArgs)
|
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],
|
var mainBundle = [CPBundle mainBundle],
|
||||||
principalClass = [mainBundle principalClass];
|
principalClass = [mainBundle principalClass];
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,6 @@ CPGrooveBorder = 3;
|
|||||||
|
|
||||||
[aView setFrame:CGRectInset([self bounds], _contentMargin.width + _borderWidth, _contentMargin.height + _borderWidth)];
|
[aView setFrame:CGRectInset([self bounds], _contentMargin.width + _borderWidth, _contentMargin.height + _borderWidth)];
|
||||||
[self replaceSubview:_contentView with:aView];
|
[self replaceSubview:_contentView with:aView];
|
||||||
[aView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
|
||||||
|
|
||||||
_contentView = aView;
|
_contentView = aView;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ CPInputTypeCanBeChangedFeature = 1 << 25;
|
|||||||
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
|
CPHTML5DragAndDropSourceYOffBy1 = 1 << 26;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var USER_AGENT = "",
|
var USER_AGENT = "",
|
||||||
PLATFORM_ENGINE = CPUnknownBrowserEngine,
|
PLATFORM_ENGINE = CPUnknownBrowserEngine,
|
||||||
PLATFORM_FEATURES = 0;
|
PLATFORM_FEATURES = 0;
|
||||||
@@ -75,7 +73,7 @@ var USER_AGENT = "",
|
|||||||
|
|
||||||
PLATFORM_FEATURES |= CPInputTypeCanBeChangedFeature;
|
PLATFORM_FEATURES |= CPInputTypeCanBeChangedFeature;
|
||||||
|
|
||||||
if (typeof window != "undfined" && typeof window.navigator != "undefined")
|
if (typeof window !== "undefined" && typeof window.navigator !== "undefined")
|
||||||
USER_AGENT = window.navigator.userAgent;
|
USER_AGENT = window.navigator.userAgent;
|
||||||
|
|
||||||
// Opera
|
// Opera
|
||||||
|
|||||||
+19
-6
@@ -210,10 +210,10 @@ var CPDocumentUntitledCount = 0;
|
|||||||
@throws CPUnsupportedMethodException if this method hasn't been overriden by the subclass
|
@throws CPUnsupportedMethodException if this method hasn't been overriden by the subclass
|
||||||
@return the document data
|
@return the document data
|
||||||
*/
|
*/
|
||||||
- (CPData)dataOfType:(CPString)aType error:({CPError})anError
|
- (CPData)dataOfType:(CPString)aType
|
||||||
{
|
{
|
||||||
[CPException raise:CPUnsupportedMethodException
|
[CPException raise:CPUnsupportedMethodException
|
||||||
reason:"dataOfType:error: must be overridden by the document subclass."];
|
reason:"dataOfType: must be overridden by the document subclass."];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -473,8 +473,21 @@ var CPDocumentUntitledCount = 0;
|
|||||||
*/
|
*/
|
||||||
- (void)saveToURL:(CPURL)anAbsoluteURL ofType:(CPString)aTypeName forSaveOperation:(CPSaveOperationType)aSaveOperation delegate:(id)aDelegate didSaveSelector:(SEL)aDidSaveSelector contextInfo:(id)aContextInfo
|
- (void)saveToURL:(CPURL)anAbsoluteURL ofType:(CPString)aTypeName forSaveOperation:(CPSaveOperationType)aSaveOperation delegate:(id)aDelegate didSaveSelector:(SEL)aDidSaveSelector contextInfo:(id)aContextInfo
|
||||||
{
|
{
|
||||||
var data = [self dataOfType:[self fileType] error:nil],
|
if (anAbsoluteURL.isLocalStorageURL())
|
||||||
oldChangeCount = _changeCount;
|
[[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;
|
||||||
|
|
||||||
_writeRequest = [CPURLRequest requestWithURL:anAbsoluteURL];
|
_writeRequest = [CPURLRequest requestWithURL:anAbsoluteURL];
|
||||||
|
|
||||||
@@ -488,10 +501,10 @@ var CPDocumentUntitledCount = 0;
|
|||||||
|
|
||||||
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
[_writeRequest setValue:@"close" forHTTPHeaderField:@"Connection"];
|
||||||
|
|
||||||
if (aSaveOperation == CPSaveOperation)
|
if (aSaveOperation === CPSaveOperation)
|
||||||
[_writeRequest setValue:@"true" forHTTPHeaderField:@"x-cappuccino-overwrite"];
|
[_writeRequest setValue:@"true" forHTTPHeaderField:@"x-cappuccino-overwrite"];
|
||||||
|
|
||||||
if (aSaveOperation != CPSaveToOperation)
|
if (aSaveOperation !== CPSaveToOperation)
|
||||||
[self updateChangeCount:CPChangeCleared];
|
[self updateChangeCount:CPChangeCleared];
|
||||||
|
|
||||||
// FIXME: Oh man is this every looking for trouble, we need to handle login at the Cappuccino level, with HTTP Errors.
|
// FIXME: Oh man is this every looking for trouble, we need to handle login at the Cappuccino level, with HTTP Errors.
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ var CPSharedDocumentController = nil;
|
|||||||
{
|
{
|
||||||
CPArray _documents;
|
CPArray _documents;
|
||||||
CPArray _documentTypes;
|
CPArray _documentTypes;
|
||||||
|
CPArray _localDocumentURLs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -59,14 +60,30 @@ var CPSharedDocumentController = nil;
|
|||||||
- (id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|
||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
_documents = [[CPArray alloc] init];
|
|
||||||
|
|
||||||
if (!CPSharedDocumentController)
|
if (!CPSharedDocumentController)
|
||||||
CPSharedDocumentController = self;
|
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"];
|
_documentTypes = [[[CPBundle mainBundle] infoDictionary] objectForKey:@"CPBundleDocumentTypes"];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -219,7 +236,7 @@ var CPSharedDocumentController = nil;
|
|||||||
Opens a new document in the application.
|
Opens a new document in the application.
|
||||||
@param aSender the requesting object
|
@param aSender the requesting object
|
||||||
*/
|
*/
|
||||||
- (CFAction)newDocument:(id)aSender
|
- (@action)newDocument:(id)aSender
|
||||||
{
|
{
|
||||||
[self openUntitledDocumentOfType:[[_documentTypes objectAtIndex:0] objectForKey:@"CPBundleTypeName"] display:YES];
|
[self openUntitledDocumentOfType:[[_documentTypes objectAtIndex:0] objectForKey:@"CPBundleTypeName"] display:YES];
|
||||||
}
|
}
|
||||||
@@ -455,3 +472,41 @@ var CPSharedDocumentController = nil;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@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
|
@end
|
||||||
|
|
||||||
var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
||||||
CPDraggingSource_draggedImage_endAt_operation_ = 1 << 1,
|
CPDraggingSource_draggedImage_endedAt_operation_ = 1 << 1,
|
||||||
CPDraggingSource_draggedView_movedTo_ = 1 << 2,
|
CPDraggingSource_draggedView_movedTo_ = 1 << 2,
|
||||||
CPDraggingSource_draggedView_endedAt_operation_ = 1 << 3;
|
CPDraggingSource_draggedView_endedAt_operation_ = 1 << 3;
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
if (![CPPlatform supportsDragAndDrop])
|
if (![CPPlatform supportsDragAndDrop])
|
||||||
[_draggedWindow orderOut:self];
|
[_draggedWindow orderOut:self];
|
||||||
|
|
||||||
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_)
|
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endedAt_operation_)
|
||||||
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
|
||||||
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
|
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
|
||||||
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
|
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
|
||||||
@@ -342,8 +342,8 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
|
|||||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:movedTo:)])
|
if ([_draggingSource respondsToSelector:@selector(draggedImage:movedTo:)])
|
||||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_movedTo_;
|
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_movedTo_;
|
||||||
|
|
||||||
if ([_draggingSource respondsToSelector:@selector(draggedImage:endAt:operation:)])
|
if ([_draggingSource respondsToSelector:@selector(draggedImage:endedAt:operation:)])
|
||||||
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endAt_operation_;
|
_implementedDraggingSourceMethods |= CPDraggingSource_draggedImage_endedAt_operation_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-2
@@ -128,7 +128,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
|||||||
BOOL _isARepeat;
|
BOOL _isARepeat;
|
||||||
unsigned _keyCode;
|
unsigned _keyCode;
|
||||||
DOMEvent _DOMEvent;
|
DOMEvent _DOMEvent;
|
||||||
|
|
||||||
float _deltaX;
|
float _deltaX;
|
||||||
float _deltaY;
|
float _deltaY;
|
||||||
float _deltaZ;
|
float _deltaZ;
|
||||||
@@ -345,7 +345,10 @@ var _CPEventPeriodicEventPeriod = 0,
|
|||||||
*/
|
*/
|
||||||
- (int)buttonNumber
|
- (int)buttonNumber
|
||||||
{
|
{
|
||||||
return _buttonNumber;
|
if (_type === CPRightMouseDown || _type === CPRightMouseUp || _type === CPRightMouseDragged)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
+5
-1
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
@import <Foundation/CPObject.j>
|
@import <Foundation/CPObject.j>
|
||||||
|
|
||||||
|
|
||||||
#import "CoreGraphics/CGGeometry.h"
|
#import "CoreGraphics/CGGeometry.h"
|
||||||
|
#import "Platform/Platform.h"
|
||||||
|
|
||||||
@implementation CPScreen : CPObject
|
@implementation CPScreen : CPObject
|
||||||
{
|
{
|
||||||
@@ -10,7 +10,11 @@
|
|||||||
|
|
||||||
- (CGRect)visibleFrame
|
- (CGRect)visibleFrame
|
||||||
{
|
{
|
||||||
|
#if PLATFORM(DOM)
|
||||||
return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
|
return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight);
|
||||||
|
#else
|
||||||
|
return _CGRectMakeZero();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -282,8 +282,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||||
[self addSubview:_tableDrawView];
|
[self addSubview:_tableDrawView];
|
||||||
[self _init];
|
|
||||||
|
|
||||||
|
[self setBackgroundColor:[CPColor whiteColor]];
|
||||||
|
[self _init];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -296,7 +297,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
[_dropOperationFeedbackView setTableView:self];
|
[_dropOperationFeedbackView setTableView:self];
|
||||||
|
|
||||||
_lastColumnShouldSnap = NO;
|
_lastColumnShouldSnap = NO;
|
||||||
_backgroundColor = [CPColor whiteColor];
|
|
||||||
|
|
||||||
// Gradients for the source list
|
// 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);
|
_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,14 +2200,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
|||||||
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
- (void)drawBackgroundInClipRect:(CGRect)aRect
|
||||||
{
|
{
|
||||||
if (!_usesAlternatingRowBackgroundColors)
|
if (!_usesAlternatingRowBackgroundColors)
|
||||||
{
|
|
||||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
|
||||||
|
|
||||||
CGContextSetFillColor(context, _backgroundColor);
|
|
||||||
CGContextFillRect(context, aRect);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var rowColors = [self alternatingRowBackgroundColors],
|
var rowColors = [self alternatingRowBackgroundColors],
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ var CPViewControllerCachedCibs;
|
|||||||
CPView _view;
|
CPView _view;
|
||||||
|
|
||||||
id _representedObject @accessors(property=representedObject);
|
id _representedObject @accessors(property=representedObject);
|
||||||
CPString _title @accessors(property=title);
|
CPString _title;
|
||||||
|
|
||||||
CPString _cibName @accessors(property=cibName, readonly);
|
CPString _cibName @accessors(property=cibName, readonly);
|
||||||
CPBundle _cibBundle @accessors(property=cibBundle, readonly);
|
CPBundle _cibBundle @accessors(property=cibBundle, readonly);
|
||||||
@@ -78,7 +78,9 @@ var CPViewControllerCachedCibs;
|
|||||||
|
|
||||||
- (id)initWithCibName:(CPString)aCibNameOrNil bundle:(CPBundle)aCibBundleOrNil owner:(id)anOwner
|
- (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]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -97,13 +99,34 @@ var CPViewControllerCachedCibs;
|
|||||||
{
|
{
|
||||||
// Don't load the cib until someone actually requests the view. The user may just be intending to use setView:.
|
// Don't load the cib until someone actually requests the view. The user may just be intending to use setView:.
|
||||||
_cibName = aCibNameOrNil;
|
_cibName = aCibNameOrNil;
|
||||||
_cibBundle = aCibBundleOrNil || [CPBundle mainBundle];
|
_cibBundle = aCibBundleOrNil;
|
||||||
|
|
||||||
|
if (!_cibBundle)
|
||||||
|
{
|
||||||
|
var owner = [anExternalNameTable objectForKey:CPCibOwner];
|
||||||
|
|
||||||
|
_cibBundle = owner ? [CPBundle bundleForClass:[owner class]] : [CPBundle mainBundle];
|
||||||
|
}
|
||||||
|
|
||||||
_cibExternalNameTable = anExternalNameTable || [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
|
_cibExternalNameTable = anExternalNameTable || [CPDictionary dictionaryWithObject:self forKey:CPCibOwner];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
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.
|
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.
|
You should never call this method directly. The view controller calls this method when the view property is requested but is nil.
|
||||||
@@ -124,9 +147,9 @@ var CPViewControllerCachedCibs;
|
|||||||
// check if a cib is already cached for the current _cibName
|
// check if a cib is already cached for the current _cibName
|
||||||
var cib = [CPViewControllerCachedCibs objectForKey:_cibName];
|
var cib = [CPViewControllerCachedCibs objectForKey:_cibName];
|
||||||
|
|
||||||
|
// If the cib isn't cached yet : fetch it and cache it
|
||||||
if (!cib)
|
if (!cib)
|
||||||
{
|
{
|
||||||
// if the cib isn't cached yet : fetch it and cache it
|
|
||||||
cib = [[CPCib alloc] initWithContentsOfURL:[_cibBundle pathForResource:_cibName + @".cib"]];
|
cib = [[CPCib alloc] initWithContentsOfURL:[_cibBundle pathForResource:_cibName + @".cib"]];
|
||||||
[CPViewControllerCachedCibs setObject:cib forKey:_cibName];
|
[CPViewControllerCachedCibs setObject:cib forKey:_cibName];
|
||||||
}
|
}
|
||||||
@@ -192,6 +215,34 @@ var CPViewControllerCachedCibs;
|
|||||||
_view = aView;
|
_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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,11 +71,12 @@ var _CPToolbarViewBackgroundColor = nil;
|
|||||||
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
var frame = CGRectMakeZero();
|
var frame = CGRectMakeZero(),
|
||||||
|
toolbarOffset = [self toolbarOffset];
|
||||||
frame.origin = CGPointMakeCopy([self toolbarOffset]);
|
|
||||||
|
frame.origin = CGPointMake(toolbarOffset.width, toolbarOffset.height);
|
||||||
frame.size = [_toolbarView frame].size;
|
frame.size = [_toolbarView frame].size;
|
||||||
|
|
||||||
[_toolbarBackgroundView setFrame:frame];
|
[_toolbarBackgroundView setFrame:frame];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
CGSize _resizeIndicatorOffset;
|
CGSize _resizeIndicatorOffset;
|
||||||
|
|
||||||
CPView _toolbarView;
|
CPView _toolbarView;
|
||||||
|
CGSize _toolbarOffset;
|
||||||
// BOOL _isAnimatingToolbar;
|
// BOOL _isAnimatingToolbar;
|
||||||
|
|
||||||
|
|
||||||
@@ -80,8 +81,8 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
if (self)
|
if (self)
|
||||||
{
|
{
|
||||||
_styleMask = aStyleMask;
|
_styleMask = aStyleMask;
|
||||||
_resizeIndicatorOffset = CGSizeMake(0.0, 0.0);
|
_resizeIndicatorOffset = CGSizeMakeZero();
|
||||||
_toolbarOffset = CGSizeMake(0.0, 0.0);
|
_toolbarOffset = CGSizeMakeZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
@@ -269,7 +270,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
|||||||
|
|
||||||
- (CGSize)toolbarOffset
|
- (CGSize)toolbarOffset
|
||||||
{
|
{
|
||||||
return CGSizeMakeZero();
|
return _toolbarOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CPColor)toolbarLabelColor
|
- (CPColor)toolbarLabelColor
|
||||||
|
|||||||
@@ -40,6 +40,16 @@ var screenNeedsInitialization = NO,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
screenNeedsInitialization = [CPPlatform isBrowser];
|
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
|
+ (BOOL)isBrowser
|
||||||
@@ -121,9 +131,6 @@ var screenNeedsInitialization = NO,
|
|||||||
|
|
||||||
bodyElement.style.overflow = "hidden";
|
bodyElement.style.overflow = "hidden";
|
||||||
|
|
||||||
if (document.documentElement)
|
|
||||||
document.documentElement.style.overflow = "hidden";
|
|
||||||
|
|
||||||
[[CPNotificationCenter defaultCenter]
|
[[CPNotificationCenter defaultCenter]
|
||||||
postNotificationName:CPPlatformDidClearBodyElementNotification
|
postNotificationName:CPPlatformDidClearBodyElementNotification
|
||||||
object:self];
|
object:self];
|
||||||
|
|||||||
@@ -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(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>
|
|
||||||
|
|
||||||
+34
-9
@@ -44,6 +44,11 @@ parser.option("-s", "--split", "number", "split")
|
|||||||
.def(0)
|
.def(0)
|
||||||
.help("Split into multiple files");
|
.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")
|
parser.option("-v", "--verbose", "verbose")
|
||||||
.def(false)
|
.def(false)
|
||||||
.set(true)
|
.set(true)
|
||||||
@@ -110,7 +115,14 @@ function main(args)
|
|||||||
FILE.copyTree(rootPath, outputPath);
|
FILE.copyTree(rootPath, outputPath);
|
||||||
|
|
||||||
applicationJSs.forEach(function(applicationJS, n) {
|
applicationJSs.forEach(function(applicationJS, n) {
|
||||||
outputPath.join("Application"+(n||"")+".js").write(applicationJS);
|
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" });
|
||||||
});
|
});
|
||||||
|
|
||||||
rewriteMainHTML(outputPath.join(options.index));
|
rewriteMainHTML(outputPath.join(options.index));
|
||||||
@@ -133,11 +145,14 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
|||||||
this.serializeFunctions();
|
this.serializeFunctions();
|
||||||
this.serializeFileCache();
|
this.serializeFileCache();
|
||||||
|
|
||||||
|
var additions = FILE.read(FILE.join(FILE.dirname(module.path), "..", "..", "cappuccino", "lib", "cappuccino", "objj-flatten-additions.js"), { charset:"UTF-8" });
|
||||||
|
|
||||||
var applicationJSs = [];
|
var applicationJSs = [];
|
||||||
|
|
||||||
if (this.options.split === 0) {
|
if (this.options.split === 0) {
|
||||||
var buffer = [];
|
var buffer = [];
|
||||||
buffer.push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
buffer.push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||||
|
buffer.push(additions);
|
||||||
buffer.push(this.fileCacheBuffer.join("\n"));
|
buffer.push(this.fileCacheBuffer.join("\n"));
|
||||||
buffer.push(this.functionsBuffer.join("\n"));
|
buffer.push(this.functionsBuffer.join("\n"));
|
||||||
buffer.push("ObjectiveJ.bootstrap();");
|
buffer.push("ObjectiveJ.bootstrap();");
|
||||||
@@ -160,11 +175,13 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffers[0].push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
buffers[0].push("var baseURL = new CFURL(\".\", ObjectiveJ.pageURL);");
|
||||||
|
buffers[0].push(additions);
|
||||||
|
|
||||||
buffers[0].push("var appFilesCount = " + appFilesCount +";");
|
buffers[0].push("var appFilesCount = " + appFilesCount +";");
|
||||||
buffers[0].push("for (var i = 1; i <= appFilesCount; i++) {");
|
buffers[0].push("for (var i = 1; i <= appFilesCount; i++) {");
|
||||||
buffers[0].push(" var script = document.createElement(\"script\");");
|
buffers[0].push(" var script = document.createElement(\"script\");");
|
||||||
buffers[0].push(" script.src = \"Application\"+i+\".js\";");
|
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(" script.onload = function() { if (--appFilesCount === 0) ObjectiveJ.bootstrap(); };");
|
||||||
buffers[0].push(" document.getElementsByTagName(\"head\")[0].appendChild(script);");
|
buffers[0].push(" document.getElementsByTagName(\"head\")[0].appendChild(script);");
|
||||||
buffers[0].push("}");
|
buffers[0].push("}");
|
||||||
@@ -237,7 +254,6 @@ ObjectiveJFlattener.prototype.serializeFunctions = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ObjectiveJFlattener.prototype.serializeFileCache = 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) {
|
for (var relative in this.filesToCache) {
|
||||||
var contents = this.filesToCache[relative];
|
var contents = this.filesToCache[relative];
|
||||||
print("caching: " + relative + " => " + (contents == null ? 404 : 200));
|
print("caching: " + relative + " => " + (contents == null ? 404 : 200));
|
||||||
@@ -282,21 +298,30 @@ ObjectiveJFlattener.prototype.setupFileCache = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// "$1" is the matching indentation
|
// "$1" is the matching indentation
|
||||||
var scriptTagsBefore = '$1<script type = "text/javascript">\n$1 OBJJ_AUTO_BOOTSTRAP = false;\n$1</script>';
|
var scriptTagsBefore =
|
||||||
var scriptTagsAfter = '$1<script type = "text/javascript" src = "Application.js"></script>';
|
'$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>';
|
||||||
|
|
||||||
// enable CPLog:
|
// 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) {
|
function rewriteMainHTML(indexHTMLPath) {
|
||||||
if (indexHTMLPath.isFile()) {
|
if (indexHTMLPath.isFile()) {
|
||||||
var indexHTML = indexHTMLPath.read();
|
var indexHTML = indexHTMLPath.read({ charset : "UTF-8" });
|
||||||
|
|
||||||
// inline the Application.js if it's smallish
|
// inline the Application.js if it's smallish
|
||||||
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
||||||
if (applicationJSPath.size() < 10*1024) {
|
if (applicationJSPath.size() < 10*1024) {
|
||||||
var applicationJS = applicationJSPath.read().split("\n").join("\n$1 ");
|
// escape any dollar signs by replacing them with two
|
||||||
scriptTagsAfter = '$1<script type = "text/javascript">\n$1 '+applicationJS+'\n$1</script>'
|
// 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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// attempt to find Objective-J script tag and add ours
|
// attempt to find Objective-J script tag and add ours
|
||||||
@@ -305,7 +330,7 @@ function rewriteMainHTML(indexHTMLPath) {
|
|||||||
|
|
||||||
if (newIndexHTML !== indexHTML) {
|
if (newIndexHTML !== indexHTML) {
|
||||||
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
||||||
indexHTMLPath.write(newIndexHTML);
|
indexHTMLPath.write(newIndexHTML, { charset : "UTF-8" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ ObjectiveJRuntimeAnalyzer = function(rootPath)
|
|||||||
return url ? url.absoluteURL().path() : null;
|
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 requestedURLs = this.requestedURLs = {};
|
||||||
var _lookupCachedRequest = this.context.global.CFHTTPRequest._lookupCachedRequest;
|
var _lookupCachedRequest = this.context.global.CFHTTPRequest._lookupCachedRequest;
|
||||||
this.context.global.CFHTTPRequest._lookupCachedRequest = function(aURL) {
|
this.context.global.CFHTTPRequest._lookupCachedRequest = function(aURL) {
|
||||||
|
|||||||
+34
-3
@@ -453,10 +453,19 @@
|
|||||||
@return the index of the object, or \c CPNotFound if it was not found.
|
@return the index of the object, or \c CPNotFound if it was not found.
|
||||||
*/
|
*/
|
||||||
- (unsigned)indexOfObject:(id)anObject sortedByFunction:(Function)aFunction context:(id)aContext
|
- (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)
|
if (!aFunction || anObject === undefined)
|
||||||
return CPNotFound;
|
return CPNotFound;
|
||||||
|
|
||||||
|
if (length === 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
var mid, c, first = 0, last = length - 1;
|
var mid, c, first = 0, last = length - 1;
|
||||||
while (first <= last)
|
while (first <= last)
|
||||||
{
|
{
|
||||||
@@ -476,7 +485,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return CPNotFound;
|
return -first-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -644,8 +653,8 @@
|
|||||||
{
|
{
|
||||||
if (self === anArray)
|
if (self === anArray)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if(length != anArray.length)
|
if (anArray === nil || length !== anArray.length)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
var index = 0,
|
var index = 0,
|
||||||
@@ -972,6 +981,28 @@
|
|||||||
[self insertObject:objects[index] atIndex:currentIndex];
|
[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.
|
Replaces the element at \c anIndex with \c anObject.
|
||||||
The current element at position \c anIndex will be removed from the array.
|
The current element at position \c anIndex will be removed from the array.
|
||||||
|
|||||||
@@ -107,14 +107,16 @@ task ("documentation", function()
|
|||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
|
|
||||||
task ("downloads", ["starter_download", "tools_download"]);
|
task ("downloads", ["starter_download"]);
|
||||||
|
|
||||||
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
|
||||||
|
$STARTER_BOOTSTRAP = 'bootstrap.sh';
|
||||||
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
|
||||||
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
|
||||||
$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
|
$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, "documentation"], function()
|
task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README, $STARTER_DOWNLOAD_BOOTSTRAP, "documentation"], function()
|
||||||
{
|
{
|
||||||
if (FILE.exists($DOCUMENTATION_BUILD))
|
if (FILE.exists($DOCUMENTATION_BUILD))
|
||||||
{
|
{
|
||||||
@@ -130,8 +132,8 @@ filedir ($STARTER_DOWNLOAD_APPLICATION, ["CommonJS"], function()
|
|||||||
|
|
||||||
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
if (OS.system(["capp", "gen", $STARTER_DOWNLOAD_APPLICATION, "-t", "Application", "--noconfig"]))
|
||||||
// FIXME: uncomment this: we get conversion errors
|
// 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
|
// No tools means no objective-j gem
|
||||||
// FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
|
// FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
|
||||||
});
|
});
|
||||||
@@ -141,36 +143,11 @@ filedir ($STARTER_DOWNLOAD_README, [$STARTER_README], function()
|
|||||||
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
cp($STARTER_README, $STARTER_DOWNLOAD_README);
|
||||||
});
|
});
|
||||||
|
|
||||||
$TOOLS_README = FILE.join('Tools', 'READMEs', 'TOOLS-README');
|
filedir ($STARTER_DOWNLOAD_BOOTSTRAP, [$STARTER_BOOTSTRAP], function()
|
||||||
$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()
|
|
||||||
{
|
{
|
||||||
cp_r(FILE.join($TOOLS_EDITORS, '.'), $TOOLS_DOWNLOAD_EDITORS);
|
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]);
|
||||||
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
|
// Deployment
|
||||||
@@ -233,15 +210,22 @@ task ("demos", function()
|
|||||||
{
|
{
|
||||||
return this.name();
|
return this.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||||
return new Demo(FILE.dirname(demoPath))
|
return new Demo(FILE.dirname(demoPath))
|
||||||
}).filter(function(demo){
|
}).filter(function(demo){
|
||||||
return !demo.excluded();
|
return !demo.excluded();
|
||||||
}).forEach(function(demo)
|
}).forEach(function(demo)
|
||||||
{
|
{
|
||||||
var outputPath = FILE.join(demosDir, demo.name().replace(/\s/g, "-")+".zip");
|
// copy frameworks into the demos
|
||||||
OS.system("cd "+OS.enquote(FILE.dirname(demo.path()))+"; zip -ry -8 "+OS.enquote(outputPath)+" "+OS.enquote(demo.path()));
|
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"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ CFHTTPRequest.prototype.responseText = function()
|
|||||||
|
|
||||||
CFHTTPRequest.prototype.setRequestHeader = function(/*String*/ aHeader, /*Object*/ aValue)
|
CFHTTPRequest.prototype.setRequestHeader = function(/*String*/ aHeader, /*Object*/ aValue)
|
||||||
{
|
{
|
||||||
return this._nativeRequest.setRequestHeader(aHeader, aValue);
|
if (!this._URL)
|
||||||
|
return this._nativeRequest.setRequestHeader(aHeader, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFHTTPRequest.prototype.getResponseHeader = function(/*String*/ aHeader)
|
CFHTTPRequest.prototype.getResponseHeader = function(/*String*/ aHeader)
|
||||||
@@ -198,11 +199,65 @@ CFHTTPRequest.prototype.overrideMimeType = function(/*String*/ aMimeType)
|
|||||||
|
|
||||||
CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*Boolean*/ isAsynchronous, /*String*/ aUser, /*String*/ aPassword)
|
CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*Boolean*/ isAsynchronous, /*String*/ aUser, /*String*/ aPassword)
|
||||||
{
|
{
|
||||||
return this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, 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 });
|
||||||
}
|
}
|
||||||
|
|
||||||
CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
|
CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
|
||||||
{
|
{
|
||||||
|
if (this._URL)
|
||||||
|
return sendStorage(this, aBody);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return this._nativeRequest.send(aBody);
|
return this._nativeRequest.send(aBody);
|
||||||
|
|||||||
@@ -498,6 +498,27 @@ CFURL.prototype.authority = function()
|
|||||||
|
|
||||||
DISPLAY_NAME(CFURL.prototype.authority);
|
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()
|
CFURL.prototype.hasDirectoryPath = function()
|
||||||
{
|
{
|
||||||
var hasDirectoryPath = this._hasDirectoryPath;
|
var hasDirectoryPath = this._hasDirectoryPath;
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
|
||||||
|
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,6 +17,8 @@ function ApplicationTask(aName)
|
|||||||
this._frameworksPath = "Frameworks";
|
this._frameworksPath = "Frameworks";
|
||||||
else
|
else
|
||||||
this._frameworksPath = null;
|
this._frameworksPath = null;
|
||||||
|
|
||||||
|
this._shouldGenerateCacheManifest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationTask.__proto__ = BundleTask;
|
ApplicationTask.__proto__ = BundleTask;
|
||||||
@@ -33,6 +35,7 @@ ApplicationTask.prototype.defineTasks = function()
|
|||||||
|
|
||||||
this.defineFrameworksTask();
|
this.defineFrameworksTask();
|
||||||
this.defineIndexFileTask();
|
this.defineIndexFileTask();
|
||||||
|
this.defineCacheManifestTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
ApplicationTask.prototype.setIndexFilePath = function(aFilePath)
|
||||||
@@ -59,6 +62,16 @@ ApplicationTask.prototype.frameworksPath = function()
|
|||||||
return this._frameworksPath;
|
return this._frameworksPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplicationTask.prototype.setShouldGenerateCacheManifest = function(shouldGenerateCacheManifest)
|
||||||
|
{
|
||||||
|
this._shouldGenerateCacheManifest = shouldGenerateCacheManifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationTask.prototype.shouldGenerateCacheManifest = function()
|
||||||
|
{
|
||||||
|
return this._shouldGenerateCacheManifest;
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationTask.prototype.defineFrameworksTask = function()
|
ApplicationTask.prototype.defineFrameworksTask = function()
|
||||||
{
|
{
|
||||||
// FIXME: platform requires...
|
// FIXME: platform requires...
|
||||||
@@ -72,7 +85,7 @@ ApplicationTask.prototype.defineFrameworksTask = function()
|
|||||||
Jake.fileCreate(newFrameworks, function()
|
Jake.fileCreate(newFrameworks, function()
|
||||||
{
|
{
|
||||||
if (thisTask._frameworksPath === "capp")
|
if (thisTask._frameworksPath === "capp")
|
||||||
OS.system("capp gen -f --force " + buildPath);
|
OS.system(["capp", "gen", "-f", "--force", buildPath]);
|
||||||
else if (thisTask._frameworksPath)
|
else if (thisTask._frameworksPath)
|
||||||
{
|
{
|
||||||
if (FILE.exists(newFrameworks))
|
if (FILE.exists(newFrameworks))
|
||||||
@@ -106,6 +119,23 @@ ApplicationTask.prototype.defineIndexFileTask = function()
|
|||||||
this.enhance([buildIndexFilePath]);
|
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.ApplicationTask = ApplicationTask;
|
||||||
|
|
||||||
exports.app = function(aName, aFunction)
|
exports.app = function(aName, aFunction)
|
||||||
|
|||||||
@@ -451,10 +451,14 @@ BundleTask.prototype.resourcesPath = function()
|
|||||||
return FILE.join(this.buildProductPath(), "Resources", "");
|
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)
|
BundleTask.prototype.defineResourceTask = function(aResourcePath, aDestinationPath)
|
||||||
{
|
{
|
||||||
// Don't sprite images larger than 32KB, IE 8 doesn't like it.
|
if (this.spritesResources() && BundleTask.isSpritable(aResourcePath))
|
||||||
if (this.spritesResources() && isImage(aResourcePath) && FILE.size(aResourcePath) < 32768)
|
|
||||||
{
|
{
|
||||||
this.environments().forEach(function(/*Environment*/ anEnvironment)
|
this.environments().forEach(function(/*Environment*/ anEnvironment)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,9 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef BROWSER
|
||||||
CPLogRegister(CPLogDefault);
|
CPLogRegister(CPLogDefault);
|
||||||
|
#endif
|
||||||
|
|
||||||
// formatting helpers
|
// formatting helpers
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ var TOKEN_ACCESSORS = "accessors",
|
|||||||
TOKEN_SUPER = "super",
|
TOKEN_SUPER = "super",
|
||||||
TOKEN_VAR = "var",
|
TOKEN_VAR = "var",
|
||||||
TOKEN_IN = "in",
|
TOKEN_IN = "in",
|
||||||
|
TOKEN_PRAGMA = "pragma",
|
||||||
|
TOKEN_MARK = "mark",
|
||||||
|
|
||||||
TOKEN_EQUAL = '=',
|
TOKEN_EQUAL = '=',
|
||||||
TOKEN_PLUS = '+',
|
TOKEN_PLUS = '+',
|
||||||
@@ -50,6 +52,7 @@ var TOKEN_ACCESSORS = "accessors",
|
|||||||
TOKEN_OPEN_BRACKET = '[',
|
TOKEN_OPEN_BRACKET = '[',
|
||||||
TOKEN_DOUBLE_QUOTE = '"',
|
TOKEN_DOUBLE_QUOTE = '"',
|
||||||
TOKEN_PREPROCESSOR = '@',
|
TOKEN_PREPROCESSOR = '@',
|
||||||
|
TOKEN_HASH = '#',
|
||||||
TOKEN_CLOSE_BRACKET = ']',
|
TOKEN_CLOSE_BRACKET = ']',
|
||||||
TOKEN_QUESTION_MARK = '?',
|
TOKEN_QUESTION_MARK = '?',
|
||||||
TOKEN_OPEN_PARENTHESIS = '(',
|
TOKEN_OPEN_PARENTHESIS = '(',
|
||||||
@@ -363,6 +366,29 @@ Preprocessor.prototype.directive = function(tokens, aStringBuffer, allowedDirect
|
|||||||
return buffer;
|
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)
|
Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStringBuffer)
|
||||||
{
|
{
|
||||||
var buffer = aStringBuffer,
|
var buffer = aStringBuffer,
|
||||||
@@ -542,6 +568,11 @@ Preprocessor.prototype.implementation = function(tokens, /*StringBuffer*/ aStrin
|
|||||||
|
|
||||||
CONCAT(instance_methods, this.method(tokens, ivar_names));
|
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...
|
// Check if we've reached @end...
|
||||||
else if (token == TOKEN_PREPROCESSOR)
|
else if (token == TOKEN_PREPROCESSOR)
|
||||||
{
|
{
|
||||||
@@ -896,6 +927,10 @@ Preprocessor.prototype.preprocess = function(tokens, /*StringBuffer*/ aStringBuf
|
|||||||
// If we reach an @ symbol, we are at a preprocessor directive.
|
// If we reach an @ symbol, we are at a preprocessor directive.
|
||||||
else if (token == TOKEN_PREPROCESSOR)
|
else if (token == TOKEN_PREPROCESSOR)
|
||||||
this.directive(tokens, buffer);
|
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
|
// If we reach a bracket, we will either be preprocessing a message send, a literal
|
||||||
// array, or an array index.
|
// array, or an array index.
|
||||||
|
|||||||
@@ -155,6 +155,61 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (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
|
- (void)testInitWithArrayCopyItems
|
||||||
{
|
{
|
||||||
var a = [[CopyableObject new], 2, 3];
|
var a = [[CopyableObject new], 2, 3];
|
||||||
@@ -163,6 +218,16 @@
|
|||||||
[self assert:a notEqual:b];
|
[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
|
@end
|
||||||
|
|
||||||
@implementation CPArray (reverse)
|
@implementation CPArray (reverse)
|
||||||
|
|||||||
@@ -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(../../../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.");
|
.help("Overwrite update existing frameworks.");
|
||||||
|
|
||||||
parser.option("--noconfig", "noconfig")
|
parser.option("--noconfig", "noconfig")
|
||||||
.set()
|
.set(true)
|
||||||
.help("Selects a project template to use.");
|
.help("Selects a project template to use.");
|
||||||
|
|
||||||
parser.option("--list-templates", "listTemplates")
|
parser.option("--list-templates", "listTemplates")
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
objj_msgSend_reset();
|
objj_msgSend_reset();
|
||||||
@@ -64,7 +72,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,13 +13,21 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
OBJJ_MAIN_FILE = "main.j";
|
OBJJ_MAIN_FILE = "main.j";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
objj_msgSend_reset();
|
objj_msgSend_reset();
|
||||||
@@ -64,7 +72,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,13 +13,21 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
OBJJ_MAIN_FILE = "main.j";
|
OBJJ_MAIN_FILE = "main.j";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,6 +13,14 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -20,7 +28,7 @@
|
|||||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -42,7 +50,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
@@ -13,13 +13,21 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
<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>
|
<title>__project.name__</title>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
OBJJ_MAIN_FILE = "main.j";
|
OBJJ_MAIN_FILE = "main.j";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="Frameworks/Objective-J/Objective-J.js" type="text/javascript"></script>
|
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body{margin:0; padding:0;}
|
body{margin:0; padding:0;}
|
||||||
@@ -41,7 +49,7 @@
|
|||||||
<body style="">
|
<body style="">
|
||||||
<div id="cappuccino-body">
|
<div id="cappuccino-body">
|
||||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
<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'>" +
|
document.write("<div id='container'><p id='content'>" +
|
||||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||||
"Loading __project.name__...</p></div>");
|
"Loading __project.name__...</p></div>");
|
||||||
|
|||||||
+12
-5
@@ -28,16 +28,23 @@
|
|||||||
- (id)NS_initWithCoder:(CPCoder)aCoder
|
- (id)NS_initWithCoder:(CPCoder)aCoder
|
||||||
{
|
{
|
||||||
var isBold = NO,
|
var isBold = NO,
|
||||||
fontName = [aCoder decodeObjectForKey:@"NSName"];
|
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];
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Is this alwasy true?
|
// FIXME: Is this alwasy true?
|
||||||
if (fontName.indexOf("-Bold") === fontName.length - "-Bold".length)
|
if (fontName.indexOf("-Bold") === fontName.length - "-Bold".length)
|
||||||
isBold = YES;
|
isBold = YES;
|
||||||
|
|
||||||
if (fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold")
|
if (fontName === "LucidaGrande" || fontName === "LucidaGrande-Bold")
|
||||||
fontName = "Arial";
|
fontName = "Arial";
|
||||||
|
|
||||||
return [self _initWithName:fontName size:[aCoder decodeDoubleForKey:@"NSSize"] bold:isBold];
|
return [self _initWithName:fontName size:size bold:isBold];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
@import "NSControl.j"
|
@import "NSControl.j"
|
||||||
@import "NSCell.j"
|
@import "NSCell.j"
|
||||||
|
@import <AppKit/CPFont.j>
|
||||||
|
|
||||||
@implementation CPTextField (NSCoding)
|
@implementation CPTextField (NSCoding)
|
||||||
|
|
||||||
@@ -36,6 +36,9 @@
|
|||||||
{
|
{
|
||||||
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
var cell = [aCoder decodeObjectForKey:@"NSCell"];
|
||||||
|
|
||||||
|
if ([[cell font] isEqual:[CPFont boldSystemFontOfSize:12.0]])
|
||||||
|
[self setFont:[CPFont systemFontOfSize:12.0]];
|
||||||
|
|
||||||
[self sendActionOn:CPKeyUpMask|CPKeyDownMask];
|
[self sendActionOn:CPKeyUpMask|CPKeyDownMask];
|
||||||
|
|
||||||
[self setEditable:[cell isEditable]];
|
[self setEditable:[cell isEditable]];
|
||||||
|
|||||||
+9
-3
@@ -118,6 +118,7 @@ github_ref="master"
|
|||||||
tusk_install_command="install"
|
tusk_install_command="install"
|
||||||
|
|
||||||
noprompt=""
|
noprompt=""
|
||||||
|
install_capp=""
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -126,6 +127,7 @@ while [ $# -gt 0 ]; do
|
|||||||
--clone) tusk_install_command="clone";;
|
--clone) tusk_install_command="clone";;
|
||||||
--github-user) github_user="$2"; shift;;
|
--github-user) github_user="$2"; shift;;
|
||||||
--github-ref) github_ref="$2"; shift;;
|
--github-ref) github_ref="$2"; shift;;
|
||||||
|
--install-capp) install_capp="yes";;
|
||||||
*) cat >&2 <<-EOT
|
*) cat >&2 <<-EOT
|
||||||
usage: ./bootstrap.sh [OPTIONS]
|
usage: ./bootstrap.sh [OPTIONS]
|
||||||
|
|
||||||
@@ -134,6 +136,7 @@ usage: ./bootstrap.sh [OPTIONS]
|
|||||||
--clone: Do "git clone" instead of downloading zips.
|
--clone: Do "git clone" instead of downloading zips.
|
||||||
--github-user [USER]: Use another github user (default: 280north).
|
--github-user [USER]: Use another github user (default: 280north).
|
||||||
--github-ref [REF]: Use another git ref (default: master).
|
--github-ref [REF]: Use another git ref (default: master).
|
||||||
|
--install-capp: Install "objective-j" and "cappuccino" packages.
|
||||||
EOT
|
EOT
|
||||||
exit 1;;
|
exit 1;;
|
||||||
esac
|
esac
|
||||||
@@ -263,10 +266,13 @@ fi
|
|||||||
# echo "================================================================================"
|
# echo "================================================================================"
|
||||||
# echo "Would you like to install the pre-built Objective-J and Cappuccino packages?"
|
# 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."
|
# echo "If you intend to build Cappuccino yourself this is not neccessary."
|
||||||
# extra_packages=""
|
# if [ ! "$install_capp" ] && prompt; then
|
||||||
# if prompt; then
|
# install_capp="yes"
|
||||||
# extra_packages="objective-j cappuccino"
|
|
||||||
# fi
|
# fi
|
||||||
|
extra_packages=""
|
||||||
|
if [ "$install_capp" ]; then
|
||||||
|
extra_packages="objective-j cappuccino"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing necessary packages..."
|
echo "Installing necessary packages..."
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "0.8.0"
|
"version": "0.8.1"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user