mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-10 12:47:13 +00:00
Compare commits
23
Commits
v0.8.0-RC4
..
v0.8.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2fdc89e1d | ||
|
|
70ea654c60 | ||
|
|
1e0c3b73a8 | ||
|
|
e719978079 | ||
|
|
fe3e7795b2 | ||
|
|
8f1972799d | ||
|
|
5858360b4c | ||
|
|
a9d71ca6dd | ||
|
|
f2be5b49d0 | ||
|
|
f90e98baaa | ||
|
|
6d150e6609 | ||
|
|
222900aa2a | ||
|
|
0e18551500 | ||
|
|
3ec5c2fc6c | ||
|
|
2e6061a5f3 | ||
|
|
f67dfd85ef | ||
|
|
3712da3bba | ||
|
|
862e8db063 | ||
|
|
db13748e6c | ||
|
|
77a648db94 | ||
|
|
e3cb8c4264 | ||
|
|
83fade3b29 | ||
|
|
f9a111bfec |
@@ -1224,6 +1224,11 @@ var _CPAppBootstrapperActions = nil;
|
||||
[self performActions];
|
||||
}
|
||||
|
||||
+ (void)cibDidFailToLoad:(CPCib)aCib
|
||||
{
|
||||
throw new Error("Could not load main cib file (Did you forget to nib2cib it?).");
|
||||
}
|
||||
|
||||
+ (void)reset
|
||||
{
|
||||
_CPAppBootstrapperActions = nil;
|
||||
|
||||
@@ -227,8 +227,8 @@ var SelectionColor = nil,
|
||||
|
||||
CGContextClosePath(context);
|
||||
|
||||
CGContextSetShadowWithColor(context, CGSizeMake(0.0, 1.0), 1.1, _shadowColor);
|
||||
CGContextSetFillColor(context, _color);
|
||||
CGContextSetShadowWithColor(context, CGSizeMake(0.0, 1.0), 1.1, _shadowColor || [CPColor whiteColor]);
|
||||
CGContextSetFillColor(context, _color || [CPColor blackColor]);
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
|
||||
|
||||
+9
-10
@@ -261,14 +261,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
[_headerView setTableView:self];
|
||||
|
||||
_cornerView = [[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))];
|
||||
|
||||
|
||||
_lastSelectedRow = -1;
|
||||
_selectedColumnIndexes = [CPIndexSet indexSet];
|
||||
_selectedRowIndexes = [CPIndexSet indexSet];
|
||||
_currentHighlightedTableColumn = nil;
|
||||
|
||||
|
||||
_sortDescriptors = [CPArray array];
|
||||
|
||||
|
||||
_draggedRowIndexes = [CPIndexSet indexSet];
|
||||
_verticalMotionCanDrag = YES;
|
||||
_isSelectingSession = NO;
|
||||
@@ -276,10 +276,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_retargetedDropOperation = nil;
|
||||
_dragOperationDefaultMask = nil;
|
||||
_destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
|
||||
_dropOperationFeedbackView = [[_dropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[self addSubview:_dropOperationFeedbackView];
|
||||
[_dropOperationFeedbackView setHidden:YES];
|
||||
[_dropOperationFeedbackView setTableView:self];
|
||||
|
||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||
@@ -294,6 +290,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
// FIX ME: we have a lot of redundent init stuff in initWithFrame: and initWithCoder: we should move it all into here.
|
||||
- (void)_init
|
||||
{
|
||||
_dropOperationFeedbackView = [[_dropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_dropOperationFeedbackView setTableView:self];
|
||||
|
||||
_lastColumnShouldSnap = NO;
|
||||
_backgroundColor = [CPColor whiteColor];
|
||||
|
||||
@@ -2757,7 +2756,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (void)draggingExited:(id)sender
|
||||
{
|
||||
[_dropOperationFeedbackView setHidden:YES];
|
||||
[_dropOperationFeedbackView removeFromSuperview];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2773,7 +2772,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_retargetedDropOperation = nil;
|
||||
_retargetedDropRow = nil;
|
||||
_draggedRowIndexes = [CPIndexSet indexSet];
|
||||
[_dropOperationFeedbackView setHidden:YES];
|
||||
[_dropOperationFeedbackView removeFromSuperview];
|
||||
}
|
||||
/*
|
||||
@ignore
|
||||
@@ -2906,7 +2905,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
{
|
||||
// FIX ME: is there anything else that needs to happen here?
|
||||
// actual validation is called in dragginUpdated:
|
||||
[_dropOperationFeedbackView setHidden:YES];
|
||||
[_dropOperationFeedbackView removeFromSuperview];
|
||||
|
||||
return (_implementedDataSourceMethods & CPTableViewDataSource_tableView_validateDrop_proposedRow_proposedDropOperation_);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,12 @@ var _CPToolbarViewBackgroundColor = nil;
|
||||
[self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil];
|
||||
}
|
||||
|
||||
var frame = CGRectMakeZero();
|
||||
|
||||
frame.origin = CGPointMakeCopy([self toolbarOffset]);
|
||||
var frame = CGRectMakeZero(),
|
||||
toolbarOffset = [self toolbarOffset];
|
||||
|
||||
frame.origin = CGPointMake(toolbarOffset.width, toolbarOffset.height);
|
||||
frame.size = [_toolbarView frame].size;
|
||||
|
||||
|
||||
[_toolbarBackgroundView setFrame:frame];
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
CGSize _resizeIndicatorOffset;
|
||||
|
||||
CPView _toolbarView;
|
||||
CGSize _toolbarOffset;
|
||||
// BOOL _isAnimatingToolbar;
|
||||
|
||||
|
||||
@@ -80,8 +81,8 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
if (self)
|
||||
{
|
||||
_styleMask = aStyleMask;
|
||||
_resizeIndicatorOffset = CGSizeMake(0.0, 0.0);
|
||||
_toolbarOffset = CGSizeMake(0.0, 0.0);
|
||||
_resizeIndicatorOffset = CGSizeMakeZero();
|
||||
_toolbarOffset = CGSizeMakeZero();
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -269,7 +270,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
|
||||
- (CGSize)toolbarOffset
|
||||
{
|
||||
return CGSizeMakeZero();
|
||||
return _toolbarOffset;
|
||||
}
|
||||
|
||||
- (CPColor)toolbarLabelColor
|
||||
|
||||
+6
-1
@@ -171,12 +171,17 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey";
|
||||
|
||||
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)data
|
||||
{
|
||||
// FIXME: Why aren't we getting connection:didFailWithError:
|
||||
if (!data)
|
||||
return [self connection:aConnection didFailWithError:nil];
|
||||
|
||||
_data = [CPData dataWithRawString:data];
|
||||
}
|
||||
|
||||
- (void)connection:(CPURLConnection)aConnection didFailWithError:(CPError)anError
|
||||
{
|
||||
alert("cib: connection failed.");
|
||||
if ([_loadDelegate respondsToSelector:@selector(cibDidFailToLoad:)])
|
||||
[_loadDelegate cibDidFailToLoad:self];
|
||||
|
||||
_loadDelegate = nil;
|
||||
}
|
||||
|
||||
@@ -118,4 +118,9 @@ var CPCibOwner = @"CPCibOwner";
|
||||
[_loadDelegate cibDidFinishLoading:aCib];
|
||||
}
|
||||
|
||||
- (void)cibDidFailToLoad:(CPCib)aCib
|
||||
{
|
||||
[_loadDelegate cibDidFailToLoad:aCib];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -40,6 +40,10 @@ 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";
|
||||
}
|
||||
|
||||
+ (BOOL)isBrowser
|
||||
@@ -121,9 +125,6 @@ var screenNeedsInitialization = NO,
|
||||
|
||||
bodyElement.style.overflow = "hidden";
|
||||
|
||||
if (document.documentElement)
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPPlatformDidClearBodyElementNotification
|
||||
object:self];
|
||||
|
||||
@@ -129,8 +129,6 @@ var CPDOMEventGetClickCount,
|
||||
CPDOMEventStop,
|
||||
StopDOMEventPropagation;
|
||||
|
||||
var _DOMEventGuard;
|
||||
|
||||
//right now we hard code q, w, r and t as keys to propogate
|
||||
//these aren't normal keycodes, they are with modifier key codes
|
||||
//might be mac only, we should investigate futher later.
|
||||
@@ -257,19 +255,6 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
|
||||
// Make sure the pastboard element is blurred.
|
||||
_DOMPasteboardElement.blur();
|
||||
|
||||
// Create a full screen div to protect against iframes and other elements from consuming events during tracking
|
||||
// FIXME: multiple windows
|
||||
_DOMEventGuard = theDocument.createElement("div");
|
||||
_DOMEventGuard.style.position = "absolute";
|
||||
_DOMEventGuard.style.top = "0px";
|
||||
_DOMEventGuard.style.left = "0px";
|
||||
_DOMEventGuard.style.width = "100%";
|
||||
_DOMEventGuard.style.height = "100%";
|
||||
_DOMEventGuard.style.zIndex = "999";
|
||||
_DOMEventGuard.style.display = "none";
|
||||
_DOMEventGuard.className = "cpdontremove";
|
||||
_DOMBodyElement.appendChild(_DOMEventGuard);
|
||||
}
|
||||
|
||||
- (void)registerDOMWindow
|
||||
@@ -1116,9 +1101,6 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
|
||||
if (StopDOMEventPropagation && (!supportsNativeDragAndDrop || type !== "mousedown" && !isDragging))
|
||||
CPDOMEventStop(aDOMEvent, self);
|
||||
|
||||
// if there are any tracking event listeners then show the event guard so we don't lose events to iframes
|
||||
_DOMEventGuard.style.display = (CPApp._eventListeners.length === 0) ? "none" : "";
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
|
||||
+20
-8
@@ -5,13 +5,18 @@
|
||||
{
|
||||
}
|
||||
|
||||
- (void)_init
|
||||
{
|
||||
[self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 23.0))]];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
[self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 23.0))]];
|
||||
[self _init];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -20,16 +25,23 @@
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
CGContextSetStrokeColor(context, [CPColor colorWithHexString:@"dce0e2"]);
|
||||
|
||||
var points = [
|
||||
CGPointMake(aRect.origin.x, aRect.origin.y),
|
||||
CGPointMake(aRect.origin.x + aRect.size.width, aRect.origin.y),
|
||||
|
||||
|
||||
var points = [
|
||||
CGPointMake(aRect.origin.x, aRect.origin.y + 0.5),
|
||||
CGPointMake(aRect.origin.x, aRect.origin.y + aRect.size.height)
|
||||
];
|
||||
|
||||
|
||||
CGContextStrokeLineSegments(context, points, 2);
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
{
|
||||
[self _init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -574,8 +574,8 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
|
||||
_DOMImageElement.width = imageWidth;
|
||||
_DOMImageElement.height = imageHeight;
|
||||
imageStyle.width = imageWidth + "px";
|
||||
imageStyle.height = imageHeight + "px";
|
||||
imageStyle.width = MAX(imageWidth, 0) + "px";
|
||||
imageStyle.height = MAX(imageHeight, 0) + "px";
|
||||
|
||||
if (_imagePosition === CPImageBelow)
|
||||
{
|
||||
@@ -619,7 +619,7 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
textRectY = _CGRectGetMinY(textRect),
|
||||
textRectWidth = _CGRectGetWidth(textRect),
|
||||
textRectHeight = _CGRectGetHeight(textRect);
|
||||
|
||||
|
||||
if (_verticalAlignment !== CPTopVerticalTextAlignment)
|
||||
{
|
||||
if (!_textSize)
|
||||
@@ -646,8 +646,8 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
|
||||
textStyle.top = ROUND(textRectY) + "px";
|
||||
textStyle.left = ROUND(textRectX) + "px";
|
||||
textStyle.width = ROUND(textRectWidth) + "px";
|
||||
textStyle.height = ROUND(textRectHeight) + "px";
|
||||
textStyle.width = MAX(ROUND(textRectWidth), 0) + "px";
|
||||
textStyle.height = MAX(ROUND(textRectHeight), 0) + "px";
|
||||
|
||||
if (shadowStyle)
|
||||
{
|
||||
@@ -656,8 +656,8 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
|
||||
shadowStyle.top = ROUND(textRectY + _textShadowOffset.height) + "px";
|
||||
shadowStyle.left = ROUND(textRectX + _textShadowOffset.width) + "px";
|
||||
shadowStyle.width = ROUND(textRectWidth) + "px";
|
||||
shadowStyle.height = ROUND(textRectHeight) + "px";
|
||||
shadowStyle.width = MAX(ROUND(textRectWidth), 0) + "px";
|
||||
shadowStyle.height = MAX(ROUND(textRectHeight), 0) + "px";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+34
-9
@@ -44,6 +44,11 @@ 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)
|
||||
@@ -110,7 +115,14 @@ function main(args)
|
||||
FILE.copyTree(rootPath, outputPath);
|
||||
|
||||
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));
|
||||
@@ -133,11 +145,14 @@ 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();");
|
||||
@@ -160,11 +175,13 @@ 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("}");
|
||||
@@ -237,7 +254,6 @@ 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));
|
||||
@@ -282,21 +298,30 @@ 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"></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" charset="UTF-8"></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();
|
||||
var indexHTML = indexHTMLPath.read({ charset : "UTF-8" });
|
||||
|
||||
// inline the Application.js if it's smallish
|
||||
var applicationJSPath = indexHTMLPath.dirname().join("Application.js");
|
||||
if (applicationJSPath.size() < 10*1024) {
|
||||
var applicationJS = applicationJSPath.read().split("\n").join("\n$1 ");
|
||||
scriptTagsAfter = '$1<script type = "text/javascript">\n$1 '+applicationJS+'\n$1</script>'
|
||||
// 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>';
|
||||
}
|
||||
|
||||
// attempt to find Objective-J script tag and add ours
|
||||
@@ -305,7 +330,7 @@ function rewriteMainHTML(indexHTMLPath) {
|
||||
|
||||
if (newIndexHTML !== indexHTML) {
|
||||
stream.print("\0green(Modified: "+indexHTMLPath+".\0)");
|
||||
indexHTMLPath.write(newIndexHTML);
|
||||
indexHTMLPath.write(newIndexHTML, { charset : "UTF-8" });
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -31,6 +31,11 @@ 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) {
|
||||
|
||||
@@ -163,9 +163,15 @@ var CPArrayClass = Ni
|
||||
@param data the data from which to read the graph
|
||||
@return the unarchived object
|
||||
*/
|
||||
+ (id)unarchiveObjectWithData:(CPData)data
|
||||
+ (id)unarchiveObjectWithData:(CPData)aData
|
||||
{
|
||||
var unarchiver = [[self alloc] initForReadingWithData:data],
|
||||
if (!aData)
|
||||
{
|
||||
CPLog.error("Null data passed to -[CPKeyedUnarchiver unarchiveObjectWithData:].");
|
||||
return nil;
|
||||
}
|
||||
|
||||
var unarchiver = [[self alloc] initForReadingWithData:aData],
|
||||
object = [unarchiver decodeObjectForKey:@"root"];
|
||||
|
||||
[unarchiver finishDecoding];
|
||||
|
||||
@@ -247,7 +247,7 @@ task ("demos", function()
|
||||
|
||||
// Testing
|
||||
|
||||
task("test", ["build", "test-only"]);
|
||||
task("test", ["CommonJS", "test-only"]);
|
||||
|
||||
task("test-only", function()
|
||||
{
|
||||
|
||||
+25
-7
@@ -314,7 +314,7 @@ function resolveURL(aURL)
|
||||
resolvedPathComponents.splice(basePathComponents.length - 1, 1);
|
||||
|
||||
// If this doesn't start with a "..", then we're simply appending to already standardized paths.
|
||||
if (pathComponents.length && pathComponents[0] === "..")
|
||||
if (pathComponents.length && (pathComponents[0] === ".." || pathComponents[0] === "."))
|
||||
standardizePathComponents(resolvedPathComponents, YES);
|
||||
|
||||
resolvedParts.pathComponents = resolvedPathComponents;
|
||||
@@ -352,19 +352,26 @@ function standardizePathComponents(/*Array*/ pathComponents, /*BOOL*/ inPlace)
|
||||
var index = 0,
|
||||
resultIndex = 0,
|
||||
count = pathComponents.length,
|
||||
result = inPlace ? pathComponents : [];
|
||||
result = inPlace ? pathComponents : [],
|
||||
startsWithPeriod = NO;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var component = pathComponents[index];
|
||||
|
||||
if (component === "" || component === ".")
|
||||
if (component === "")
|
||||
continue;
|
||||
|
||||
if (component === ".")
|
||||
{
|
||||
startsWithPeriod = resultIndex === 0;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (component !== ".." || resultIndex === 0 || result[resultIndex - 1] === "..")
|
||||
{
|
||||
//if (resultIndex !== index)
|
||||
result[resultIndex] = component;
|
||||
result[resultIndex] = component;
|
||||
|
||||
resultIndex++;
|
||||
|
||||
@@ -375,6 +382,9 @@ function standardizePathComponents(/*Array*/ pathComponents, /*BOOL*/ inPlace)
|
||||
--resultIndex;
|
||||
}
|
||||
|
||||
if (startsWithPeriod && resultIndex === 0)
|
||||
result[resultIndex++] = ".";
|
||||
|
||||
result.length = resultIndex;
|
||||
|
||||
return result;
|
||||
@@ -505,10 +515,11 @@ CFURL.prototype.hasDirectoryPath = function()
|
||||
var lastPathComponent = this.lastPathComponent();
|
||||
|
||||
hasDirectoryPath = lastPathComponent === "." || lastPathComponent === "..";
|
||||
|
||||
this._hasDirectoryPath = hasDirectoryPath;
|
||||
}
|
||||
|
||||
return this._hasDirectoryPath;
|
||||
return hasDirectoryPath;
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.hasDirectoryPath);
|
||||
@@ -646,7 +657,14 @@ CFURL.prototype.asDirectoryPathURL = function()
|
||||
if (this.hasDirectoryPath())
|
||||
return this;
|
||||
|
||||
return new CFURL(this.lastPathComponent() + "/", this);
|
||||
var lastPathComponent = this.lastPathComponent();
|
||||
|
||||
// We do this because on Windows the path may start with C: and be
|
||||
// misinterpreted as a scheme.
|
||||
if (lastPathComponent !== "/")
|
||||
lastPathComponent = "./" + lastPathComponent;
|
||||
|
||||
return new CFURL(lastPathComponent + "/", this);
|
||||
}
|
||||
|
||||
DISPLAY_NAME(CFURL.prototype.asDirectoryPathURL);
|
||||
|
||||
@@ -357,3 +357,10 @@ function _CPLogInitPopup(logWindow)
|
||||
}, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if COMMONJS
|
||||
CPLogDefault = CPLogPrint;
|
||||
#else
|
||||
CPLogDefault = (typeof window === "object" && window.console) ? CPLogConsole : CPLogPopup;
|
||||
#endif
|
||||
|
||||
@@ -16,8 +16,7 @@ var Task = Jake.Task,
|
||||
|
||||
function isImage(/*String*/ aFilename)
|
||||
{
|
||||
return FILE.isFile(aFilename) &&
|
||||
UTIL.has([".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"], FILE.extension(aFilename).toLowerCase());
|
||||
return UTIL.has([".png", ".jpg", ".jpeg", ".gif", ".tif", ".tiff"], FILE.extension(aFilename).toLowerCase());
|
||||
}
|
||||
|
||||
function mimeType(/*String*/ aFilename)
|
||||
@@ -350,11 +349,6 @@ BundleTask.prototype.packageType = function()
|
||||
return 1;
|
||||
}
|
||||
|
||||
function isDataResource(aFilename)
|
||||
{
|
||||
return FILE.isFile(aFilename) && isImage(aFilename);
|
||||
}
|
||||
|
||||
BundleTask.prototype.infoPlist = function()
|
||||
{
|
||||
var infoPlistPath = this.infoPlistPath();
|
||||
@@ -379,7 +373,7 @@ BundleTask.prototype.infoPlist = function()
|
||||
var environmentsWithImageSprites = this.environments().filter(
|
||||
function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.spritesImages() && task(this.buildProductDataURLPathForEnvironment(anEnvironment)).prerequisites().filter(isDataResource).length > 0;
|
||||
return anEnvironment.spritesImages() && task(this.buildProductDataURLPathForEnvironment(anEnvironment)).prerequisites().filter(isImage).length > 0;
|
||||
}, this).map(function(anEnvironment)
|
||||
{
|
||||
return anEnvironment.name();
|
||||
@@ -607,7 +601,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
|
||||
filedir (dataURLPath, function(aTask)
|
||||
{
|
||||
var prerequisites = aTask.prerequisites().filter(isDataResource);
|
||||
var prerequisites = aTask.prerequisites().filter(isImage);
|
||||
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
@@ -645,7 +639,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
|
||||
filedir (MHTMLPath, function(aTask)
|
||||
{
|
||||
var prerequisites = aTask.prerequisites().filter(isDataResource);
|
||||
var prerequisites = aTask.prerequisites().filter(isImage);
|
||||
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
@@ -679,7 +673,7 @@ BundleTask.prototype.defineSpritedImagesTask = function()
|
||||
|
||||
filedir (MHTMLDataPath, function(aTask)
|
||||
{
|
||||
var prerequisites = aTask.prerequisites().filter(isDataResource);
|
||||
var prerequisites = aTask.prerequisites().filter(isImage);
|
||||
|
||||
if (!prerequisites.length)
|
||||
{
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef BROWSER
|
||||
CPLogRegister(CPLogDefault);
|
||||
#endif
|
||||
|
||||
// formatting helpers
|
||||
|
||||
function objj_debug_object_format(aReceiver)
|
||||
|
||||
@@ -143,8 +143,14 @@ StaticResource.resourceAtURL = function(/*CFURL|String*/ aURL, /*BOOL*/ resolveA
|
||||
resource = resource._children[name];
|
||||
|
||||
else if (resolveAsDirectoriesIfNecessary)
|
||||
resource = new StaticResource(new CFURL(name, resource.URL()), resource, YES, YES);
|
||||
{
|
||||
// We do this because on Windows the path may start with C: and be
|
||||
// misinterpreted as a scheme.
|
||||
if (name !== "/")
|
||||
name = "./" + name;
|
||||
|
||||
resource = new StaticResource(new CFURL(name, resource.URL()), resource, YES, YES);
|
||||
}
|
||||
else
|
||||
throw new Error("Static Resource at " + aURL + " is not resolved (\"" + name + "\")");
|
||||
}
|
||||
|
||||
@@ -60,4 +60,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testPeriods
|
||||
{
|
||||
var URLStrings =
|
||||
{
|
||||
"." : "./",
|
||||
"./" : "./",
|
||||
".//" : "./",
|
||||
"/." : "/",
|
||||
"/./" : "/",
|
||||
"/.//" : "/",
|
||||
"./a/" : "a/",
|
||||
"./a" : "a",
|
||||
".." : "../",
|
||||
"../" : "../",
|
||||
"..//" : "../",
|
||||
"/.." : "/",
|
||||
"/../" : "/",
|
||||
"/..//" : "/",
|
||||
"../a/" : "../a/",
|
||||
"../a" : "../a"
|
||||
};
|
||||
|
||||
var URLString;
|
||||
|
||||
for (URLString in URLStrings)
|
||||
if (URLStrings.hasOwnProperty(URLString))
|
||||
[self assert:new CFURL(URLString).absoluteString() equals:URLStrings[URLString]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,7 @@ app ("__project.nameasidentifier__", function(task)
|
||||
task.setEmail("__organization.email__");
|
||||
task.setSummary("__project.name__");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/*"));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</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">
|
||||
objj_msgSend_reset();
|
||||
@@ -35,6 +35,13 @@
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -57,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>");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</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">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -41,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>");
|
||||
|
||||
@@ -27,7 +27,7 @@ app ("__project.nameasidentifier__", function(task)
|
||||
task.setEmail("__organization.email__");
|
||||
task.setSummary("__project.name__");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/*"));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
task.setNib2CibFlags("-R Resources/");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</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">
|
||||
objj_msgSend_reset();
|
||||
@@ -35,6 +35,13 @@
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
@@ -57,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>");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</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">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -41,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>");
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</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">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -42,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>");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</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">
|
||||
body{margin:0; padding:0;}
|
||||
@@ -41,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>");
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
self = [super NS_initWithCoder:aCoder];
|
||||
if (self)
|
||||
{
|
||||
[self setBackgroundColor:[CPColor colorWithPatternImage:CPAppKitImage("tableview-headerview.png", CGSizeMake(1.0, 23.0))]];
|
||||
|
||||
_frame.size.height = 23.0;
|
||||
_bounds.size.height = 23.0;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,32 @@ function check_and_exit () {
|
||||
fi
|
||||
}
|
||||
|
||||
function check_build_environment () {
|
||||
# make sure user is running HotSpot JVM
|
||||
java -version 2>&1 | grep HotSpot &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
java_ver=`java -version 2>&1 | egrep "(Client|Server)"`
|
||||
if [ "$java_ver" = "" ]; then
|
||||
java_ver="your JVM"
|
||||
fi
|
||||
echo "Error: Narwhal is not compatible with $java_ver. Please switch to the Sun (HotSpot) JVM and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure other dependencies are installed and on the $PATH
|
||||
OTHER_DEPS=(gcc unzip curl)
|
||||
|
||||
for dep in ${OTHER_DEPS[@]}; do
|
||||
which "$dep" &> /dev/null
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo "Error: $dep is required to build Cappuccino. Please install $dep and re-run bootstrap.sh."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
check_build_environment
|
||||
|
||||
if [ -w "/usr/local" ]; then
|
||||
default_directory="/usr/local/narwhal"
|
||||
else
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "0.8.0"
|
||||
"version": "0.8.1"
|
||||
}
|
||||
Reference in New Issue
Block a user