Merge branch 'jake' into enstore_jake

This commit is contained in:
Klaas Pieter Annema committed 2010-01-21 15:01:21 +01:00
commit 5abbdfc094
5 files changed
+63 -71

No files matched your search

+10 -8
View File
@@ -241,17 +241,19 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
_selectedColumnIndexes = [CPIndexSet indexSet];
_selectedRowIndexes = [CPIndexSet indexSet];
_draggedRowIndexes = [CPIndexSet indexSet];
_verticalMotionCanDrag = YES;
_isSelectingSession = NO;
_retargetedDropRow = nil;
_retargetedDropOperation = nil;
_dragOperationDefaultMask = nil;
_destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
_dropOperationFeedbackView = [[_dropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
window.setTimeout(function(){
self._draggedRowIndexes = [CPIndexSet indexSet];
self._verticalMotionCanDrag = YES;
self._isSelectingSession = NO;
self._retargetedDropRow = nil;
self._retargetedDropOperation = nil;
self._dragOperationDefaultMask = nil;
self._destinationDragStyle = CPTableViewDraggingDestinationFeedbackStyleRegular;
self._dropOperationFeedbackView = [[_dropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()];
[self addSubview:_dropOperationFeedbackView];
[_dropOperationFeedbackView setHidden:YES];
[_dropOperationFeedbackView setTableView:self];
},0);
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
+6 -7
View File
@@ -23,8 +23,7 @@
#include "../CoreGraphics/CGGeometry.h"
var DOMIFrameElement = nil,
DOMSpanElement = nil,
var DOMSpanElement = nil,
DefaultFont = nil;
@implementation CPPlatformString : CPBasePlatformString
@@ -48,12 +47,12 @@ var DOMIFrameElement = nil,
DOMIFrameElement.name = name = "iframe_" + FLOOR(RAND() * 10000);
DOMIFrameElement.style.position = "absolute";
DOMIFrameElement.style.left = "-100px";
DOMIFrameElement.style.top = "-100px";
DOMIFrameElement.style.width = "1px";
DOMIFrameElement.style.height = "1px";
DOMIFrameElement.style.left = "-1000px";
DOMIFrameElement.style.top = "-1000px";
// TODO: investigate a better way to make this work in IE:
DOMIFrameElement.style.width = "1000px";
DOMIFrameElement.style.height = "1000px";
DOMIFrameElement.style.borderWidth = "0px";
DOMIFrameElement.style.background = "blue";
DOMIFrameElement.style.overflow = "hidden";
DOMIFrameElement.style.zIndex = 100000000000;
+16 -3
View File
@@ -1,9 +1,10 @@
#!/usr/bin/env narwhal
var FILE = require("file"),
ENV = require("system").env,
SYSTEM = require("system"),
OS = require("os"),
jake = require("jake");
jake = require("jake"),
stream = require("term").stream;
require(FILE.absolute("common.jake"));
@@ -44,7 +45,19 @@ task ("install", ["CommonJS"], function()
{
// FIXME: require("narwhal/tusk/install").install({}, $COMMONJS);
// Doesn't work due to some weird this.print business.
OS.system(["sudo", "tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO]);
if (OS.system(["tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO])) {
stream.print("\0red(Installation failed, possibly because you do not have permissions.\0)");
stream.print("\0red(Try re-running using '\0yellow(jake sudo-install\0)'.\0)");
OS.exit(1); //rake abort if ($? != 0)
}
});
task ("sudo-install", ["CommonJS"], function()
{
// FIXME: require("narwhal/tusk/install").install({}, $COMMONJS);
// Doesn't work due to some weird this.print business.
if (OS.system(["sudo", "tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO]))
OS.exit(1); //rake abort if ($? != 0)
});
// Documentation
+6 -7
View File
@@ -13,6 +13,7 @@ var ARGS = require("args");
var FILE = require("file");
var OS = require("os");
var DOM = require("browser/dom");
var INTERPRETER = require("interpreter");
var serializer = new DOM.XMLSerializer();
@@ -148,8 +149,8 @@ function pressEnvironment(rootPath, outputFiles, environment, options) {
CPLog.info("Environment: " + environment);
// get a Rhino context
var ctx = Packages.org.mozilla.javascript.Context.getCurrentContext();
var scope = makeObjjScope(ctx); // "scope" is the same as require("objective-j").window;
var context = new INTERPRETER.Context();
var scope = setupObjectiveJ(context);
scope.OBJJ_INCLUDE_PATHS = frameworks;
scope.OBJJ_ENVIRONMENTS = [environment, "ObjJ"];
@@ -178,11 +179,9 @@ function pressEnvironment(rootPath, outputFiles, environment, options) {
exectuableResponses.push(aResponse);
});
var context = {
ctx : ctx,
scope : scope,
rootPath : rootPath
};
// lets just use the Context object as our con
context.rootPath = rootPath;
context.scope = scope;
// phase 1: get global defines
CPLog.error("PHASE 1: Loading application...");
+25 -46
View File
@@ -2,8 +2,7 @@ var FILE = require("file");
/*
param context includes
scope: a global variable containing objj_files hash
ctx: js context
scope: the objective-j scope
dependencies: hash mapping from paths to an array of global variables defined by that file
[importCallback]: callback function that is called for each imported file (takes importing file path, and imported file path parameters)
[referencedCallback]: callback function that is called for each referenced file (takes referencing file path, referenced file path parameters, and list of tokens)
@@ -267,27 +266,27 @@ function findGlobalDefines(context, mainPath, evaledFragments, bundleCallback)
var bundleDelegate = [[PressBundleDelgate alloc] initWithCallback:bundleCallback];
var bundlePaths = [];
runWithScope(context, function(mainPath, bundleDelegate, bundlePaths) {
// **************************************************
objj_import(mainPath, true, function() {
print("bundleDelegate="+bundleDelegate)
[bundleDelegate bundleDidFinishLoading:"foo"];
(context.eval("("+(function(mainPath, bundleDelegate, bundlePaths) {
with (require("objective-j").window) {
objj_import(mainPath, true, function() {
bundlePaths = bundlePaths || [];
bundlePaths = bundlePaths || [];
// load default theme bundle
var themePath = [[CPBundle bundleForClass:[CPApplication class]] pathForResource:[CPApplication defaultThemeName]];
var themeBundle = [[CPBundle alloc] initWithPath:themePath + "/Info.plist"];
[themeBundle loadWithDelegate:bundleDelegate];
// load default theme bundle
var themePath = [[CPBundle bundleForClass:[CPApplication class]] pathForResource:[CPApplication defaultThemeName]];
var themeBundle = [[CPBundle alloc] initWithPath:themePath + "/Info.plist"];
[themeBundle loadWithDelegate:bundleDelegate];
// load additional bundles
bundlePaths.forEach(function(bundlePath) {
var bundle = [[CPBundle alloc] initWithPath:bundlePath];
[bundle loadWithDelegate:bundleDelegate];
});
});
}
})+")"))(mainPath, bundleDelegate, bundlePaths);
// load additional bundles
bundlePaths.forEach(function(bundlePath) {
var bundle = [[CPBundle alloc] initWithPath:bundlePath];
[bundle loadWithDelegate:bundleDelegate];
})
});
// **************************************************
}, [mainPath, bundleDelegate, bundlePaths]);
// run the "event loop"
context.scope.require('browser/timeout').serviceTimeouts();
return dependencies;
}
@@ -314,26 +313,18 @@ function coalesceGlobalDefines(globals)
}
// create a new scope loaded with Narwhal and Objective-J
function makeObjjScope(ctx, debug)
function setupObjectiveJ(context, debug)
{
// init standard JS scope objects
var scope = ctx.initStandardObjects();
// set these properties required for Narwhal bootstrapping
scope.NARWHAL_HOME = system.prefix;
scope.NARWHAL_ENGINE_HOME = FILE.join(system.prefix, "engines", "rhino");
context.global.NARWHAL_HOME = system.prefix;
context.global.NARWHAL_ENGINE_HOME = FILE.join(system.prefix, "engines", "rhino");
// load the bootstrap.js for narwhal-rhino
var bootstrapPath = FILE.join(scope.NARWHAL_ENGINE_HOME, "bootstrap.js");
ctx.evaluateReader(scope,
new Packages.java.io.FileReader(bootstrapPath),
"bootstrap.js",
1,
null
);
var bootstrapPath = FILE.join(context.global.NARWHAL_ENGINE_HOME, "bootstrap.js");
context.evalFile(bootstrapPath);
// get the Objective-J module from this scope, return the window object.
var OBJJ = scope.require("objective-j");
var OBJJ = context.global.require("objective-j");
addMockBrowserEnvironment(OBJJ.window);
@@ -367,18 +358,6 @@ function addMockBrowserEnvironment(scope)
}
}
// run a function within the given scope (func can be a function object if the source of the function is returned by toString() as it is by default)
function runWithScope(context, func, args)
{
var functionInScope = context.ctx.compileFunction(context.scope, String(func), "<runWithScope>", 1, null);
var result = functionInScope.apply(context.scope, args);
context.scope.require('browser/timeout').serviceTimeouts();
return result;
}
// does a shallow copy of an object. if onlyList is true, it sets each property to "true" instead of the actual value
function cloneProperties(object, onlyList)
{