From 204df993753aaa41c56e29de751fb0afdff10b6a Mon Sep 17 00:00:00 2001 From: Nicholas Small Date: Fri, 15 Jan 2010 17:23:56 -0500 Subject: [PATCH 1/7] Make CPPanel -becomesKeyOnlyIfNeeded and CPView -needsPanelToBecomeKey work. --- AppKit/CPTextField.j | 10 ++++++++++ AppKit/CPView.j | 8 ++++++++ AppKit/CPWindow/CPWindow.j | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index ef77ea021..619c12d08 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -569,6 +569,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); return YES; } +/*! + Text fields require panels to become key window, so this returns \c YES. +*/ +- (BOOL)needsPanelToBecomeKey +{ + return YES; +} + - (void)mouseDown:(CPEvent)anEvent { // Don't track! (ever?) @@ -1028,6 +1036,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); var view = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; //[view setImagePosition:CPNoImage]; + [view setHitTests:NO]; + return view; } diff --git a/AppKit/CPView.j b/AppKit/CPView.j index e865737b2..a112d62ca 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -1284,6 +1284,14 @@ var CPViewFlags = { }, return self; } +/*! + Returns \c YES if this view requires a panel to become key. Normally only text fields, so this returns \c NO. +*/ +- (BOOL)needsPanelToBecomeKey +{ + return NO; +} + /*! Returns \c YES if mouse events aren't needed by the receiver and can be sent to the superview. The default implementation returns \c NO if the view is opaque. diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 07d9f38f4..84fff9816 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -1321,7 +1321,7 @@ CPTexturedBackgroundWindowMask var theWindow = [anEvent window]; - if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded]) + if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]) return [_leftMouseDownView mouseDown:anEvent]; else { From a5a6c07b08a3b227c230daeaa7cca02132bed182 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 19 Jan 2010 13:16:16 -0800 Subject: [PATCH 2/7] Move manual tests to Manual sub dir --- Tests/{ => Manual}/AttachedSheet/AppController.j | 0 Tests/{ => Manual}/AttachedSheet/Info.plist | 0 Tests/{ => Manual}/AttachedSheet/Rakefile | 0 .../AttachedSheet/Resources/spinner.gif | Bin Tests/{ => Manual}/AttachedSheet/index-debug.html | 0 Tests/{ => Manual}/AttachedSheet/index.html | 0 Tests/{ => Manual}/AttachedSheet/main.j | 0 Tests/{ => Manual}/CPCursor/AppController.j | 0 Tests/{ => Manual}/CPCursor/Info.plist | 0 Tests/{ => Manual}/CPCursor/Jakefile | 0 Tests/{ => Manual}/CPCursor/Resources/spinner.gif | Bin Tests/{ => Manual}/CPCursor/index-debug.html | 0 Tests/{ => Manual}/CPCursor/index.html | 0 Tests/{ => Manual}/CPCursor/main.j | 0 Tests/{ => Manual}/CPSearchField/AppController.j | 0 Tests/{ => Manual}/CPSearchField/Info.plist | 0 Tests/{ => Manual}/CPSearchField/index-debug.html | 0 Tests/{ => Manual}/CPSearchField/index.html | 0 Tests/{ => Manual}/CPSearchField/main.j | 0 Tests/{ => Manual}/TableCibTest/AppController.j | 0 Tests/{ => Manual}/TableCibTest/Info.plist | 0 Tests/{ => Manual}/TableCibTest/Rakefile | 0 .../TableCibTest/Resources/MainMenu.cib | 0 .../TableCibTest/Resources/MainMenu.xib | 0 .../{ => Manual}/TableCibTest/Resources/spinner.gif | Bin Tests/{ => Manual}/TableCibTest/index-debug.html | 0 Tests/{ => Manual}/TableCibTest/index.html | 0 Tests/{ => Manual}/TableCibTest/main.j | 0 Tests/{ => Manual}/TableTest/AppController.j | 0 Tests/{ => Manual}/TableTest/Info.plist | 0 Tests/{ => Manual}/TableTest/Rakefile | 0 Tests/{ => Manual}/TableTest/Resources/spinner.gif | Bin Tests/{ => Manual}/TableTest/index-debug.html | 0 Tests/{ => Manual}/TableTest/index.html | 0 Tests/{ => Manual}/TableTest/main.j | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename Tests/{ => Manual}/AttachedSheet/AppController.j (100%) rename Tests/{ => Manual}/AttachedSheet/Info.plist (100%) rename Tests/{ => Manual}/AttachedSheet/Rakefile (100%) rename Tests/{ => Manual}/AttachedSheet/Resources/spinner.gif (100%) rename Tests/{ => Manual}/AttachedSheet/index-debug.html (100%) rename Tests/{ => Manual}/AttachedSheet/index.html (100%) rename Tests/{ => Manual}/AttachedSheet/main.j (100%) rename Tests/{ => Manual}/CPCursor/AppController.j (100%) rename Tests/{ => Manual}/CPCursor/Info.plist (100%) rename Tests/{ => Manual}/CPCursor/Jakefile (100%) rename Tests/{ => Manual}/CPCursor/Resources/spinner.gif (100%) rename Tests/{ => Manual}/CPCursor/index-debug.html (100%) rename Tests/{ => Manual}/CPCursor/index.html (100%) rename Tests/{ => Manual}/CPCursor/main.j (100%) rename Tests/{ => Manual}/CPSearchField/AppController.j (100%) rename Tests/{ => Manual}/CPSearchField/Info.plist (100%) rename Tests/{ => Manual}/CPSearchField/index-debug.html (100%) rename Tests/{ => Manual}/CPSearchField/index.html (100%) rename Tests/{ => Manual}/CPSearchField/main.j (100%) rename Tests/{ => Manual}/TableCibTest/AppController.j (100%) rename Tests/{ => Manual}/TableCibTest/Info.plist (100%) rename Tests/{ => Manual}/TableCibTest/Rakefile (100%) rename Tests/{ => Manual}/TableCibTest/Resources/MainMenu.cib (100%) rename Tests/{ => Manual}/TableCibTest/Resources/MainMenu.xib (100%) rename Tests/{ => Manual}/TableCibTest/Resources/spinner.gif (100%) rename Tests/{ => Manual}/TableCibTest/index-debug.html (100%) rename Tests/{ => Manual}/TableCibTest/index.html (100%) rename Tests/{ => Manual}/TableCibTest/main.j (100%) rename Tests/{ => Manual}/TableTest/AppController.j (100%) rename Tests/{ => Manual}/TableTest/Info.plist (100%) rename Tests/{ => Manual}/TableTest/Rakefile (100%) rename Tests/{ => Manual}/TableTest/Resources/spinner.gif (100%) rename Tests/{ => Manual}/TableTest/index-debug.html (100%) rename Tests/{ => Manual}/TableTest/index.html (100%) rename Tests/{ => Manual}/TableTest/main.j (100%) diff --git a/Tests/AttachedSheet/AppController.j b/Tests/Manual/AttachedSheet/AppController.j similarity index 100% rename from Tests/AttachedSheet/AppController.j rename to Tests/Manual/AttachedSheet/AppController.j diff --git a/Tests/AttachedSheet/Info.plist b/Tests/Manual/AttachedSheet/Info.plist similarity index 100% rename from Tests/AttachedSheet/Info.plist rename to Tests/Manual/AttachedSheet/Info.plist diff --git a/Tests/AttachedSheet/Rakefile b/Tests/Manual/AttachedSheet/Rakefile similarity index 100% rename from Tests/AttachedSheet/Rakefile rename to Tests/Manual/AttachedSheet/Rakefile diff --git a/Tests/AttachedSheet/Resources/spinner.gif b/Tests/Manual/AttachedSheet/Resources/spinner.gif similarity index 100% rename from Tests/AttachedSheet/Resources/spinner.gif rename to Tests/Manual/AttachedSheet/Resources/spinner.gif diff --git a/Tests/AttachedSheet/index-debug.html b/Tests/Manual/AttachedSheet/index-debug.html similarity index 100% rename from Tests/AttachedSheet/index-debug.html rename to Tests/Manual/AttachedSheet/index-debug.html diff --git a/Tests/AttachedSheet/index.html b/Tests/Manual/AttachedSheet/index.html similarity index 100% rename from Tests/AttachedSheet/index.html rename to Tests/Manual/AttachedSheet/index.html diff --git a/Tests/AttachedSheet/main.j b/Tests/Manual/AttachedSheet/main.j similarity index 100% rename from Tests/AttachedSheet/main.j rename to Tests/Manual/AttachedSheet/main.j diff --git a/Tests/CPCursor/AppController.j b/Tests/Manual/CPCursor/AppController.j similarity index 100% rename from Tests/CPCursor/AppController.j rename to Tests/Manual/CPCursor/AppController.j diff --git a/Tests/CPCursor/Info.plist b/Tests/Manual/CPCursor/Info.plist similarity index 100% rename from Tests/CPCursor/Info.plist rename to Tests/Manual/CPCursor/Info.plist diff --git a/Tests/CPCursor/Jakefile b/Tests/Manual/CPCursor/Jakefile similarity index 100% rename from Tests/CPCursor/Jakefile rename to Tests/Manual/CPCursor/Jakefile diff --git a/Tests/CPCursor/Resources/spinner.gif b/Tests/Manual/CPCursor/Resources/spinner.gif similarity index 100% rename from Tests/CPCursor/Resources/spinner.gif rename to Tests/Manual/CPCursor/Resources/spinner.gif diff --git a/Tests/CPCursor/index-debug.html b/Tests/Manual/CPCursor/index-debug.html similarity index 100% rename from Tests/CPCursor/index-debug.html rename to Tests/Manual/CPCursor/index-debug.html diff --git a/Tests/CPCursor/index.html b/Tests/Manual/CPCursor/index.html similarity index 100% rename from Tests/CPCursor/index.html rename to Tests/Manual/CPCursor/index.html diff --git a/Tests/CPCursor/main.j b/Tests/Manual/CPCursor/main.j similarity index 100% rename from Tests/CPCursor/main.j rename to Tests/Manual/CPCursor/main.j diff --git a/Tests/CPSearchField/AppController.j b/Tests/Manual/CPSearchField/AppController.j similarity index 100% rename from Tests/CPSearchField/AppController.j rename to Tests/Manual/CPSearchField/AppController.j diff --git a/Tests/CPSearchField/Info.plist b/Tests/Manual/CPSearchField/Info.plist similarity index 100% rename from Tests/CPSearchField/Info.plist rename to Tests/Manual/CPSearchField/Info.plist diff --git a/Tests/CPSearchField/index-debug.html b/Tests/Manual/CPSearchField/index-debug.html similarity index 100% rename from Tests/CPSearchField/index-debug.html rename to Tests/Manual/CPSearchField/index-debug.html diff --git a/Tests/CPSearchField/index.html b/Tests/Manual/CPSearchField/index.html similarity index 100% rename from Tests/CPSearchField/index.html rename to Tests/Manual/CPSearchField/index.html diff --git a/Tests/CPSearchField/main.j b/Tests/Manual/CPSearchField/main.j similarity index 100% rename from Tests/CPSearchField/main.j rename to Tests/Manual/CPSearchField/main.j diff --git a/Tests/TableCibTest/AppController.j b/Tests/Manual/TableCibTest/AppController.j similarity index 100% rename from Tests/TableCibTest/AppController.j rename to Tests/Manual/TableCibTest/AppController.j diff --git a/Tests/TableCibTest/Info.plist b/Tests/Manual/TableCibTest/Info.plist similarity index 100% rename from Tests/TableCibTest/Info.plist rename to Tests/Manual/TableCibTest/Info.plist diff --git a/Tests/TableCibTest/Rakefile b/Tests/Manual/TableCibTest/Rakefile similarity index 100% rename from Tests/TableCibTest/Rakefile rename to Tests/Manual/TableCibTest/Rakefile diff --git a/Tests/TableCibTest/Resources/MainMenu.cib b/Tests/Manual/TableCibTest/Resources/MainMenu.cib similarity index 100% rename from Tests/TableCibTest/Resources/MainMenu.cib rename to Tests/Manual/TableCibTest/Resources/MainMenu.cib diff --git a/Tests/TableCibTest/Resources/MainMenu.xib b/Tests/Manual/TableCibTest/Resources/MainMenu.xib similarity index 100% rename from Tests/TableCibTest/Resources/MainMenu.xib rename to Tests/Manual/TableCibTest/Resources/MainMenu.xib diff --git a/Tests/TableCibTest/Resources/spinner.gif b/Tests/Manual/TableCibTest/Resources/spinner.gif similarity index 100% rename from Tests/TableCibTest/Resources/spinner.gif rename to Tests/Manual/TableCibTest/Resources/spinner.gif diff --git a/Tests/TableCibTest/index-debug.html b/Tests/Manual/TableCibTest/index-debug.html similarity index 100% rename from Tests/TableCibTest/index-debug.html rename to Tests/Manual/TableCibTest/index-debug.html diff --git a/Tests/TableCibTest/index.html b/Tests/Manual/TableCibTest/index.html similarity index 100% rename from Tests/TableCibTest/index.html rename to Tests/Manual/TableCibTest/index.html diff --git a/Tests/TableCibTest/main.j b/Tests/Manual/TableCibTest/main.j similarity index 100% rename from Tests/TableCibTest/main.j rename to Tests/Manual/TableCibTest/main.j diff --git a/Tests/TableTest/AppController.j b/Tests/Manual/TableTest/AppController.j similarity index 100% rename from Tests/TableTest/AppController.j rename to Tests/Manual/TableTest/AppController.j diff --git a/Tests/TableTest/Info.plist b/Tests/Manual/TableTest/Info.plist similarity index 100% rename from Tests/TableTest/Info.plist rename to Tests/Manual/TableTest/Info.plist diff --git a/Tests/TableTest/Rakefile b/Tests/Manual/TableTest/Rakefile similarity index 100% rename from Tests/TableTest/Rakefile rename to Tests/Manual/TableTest/Rakefile diff --git a/Tests/TableTest/Resources/spinner.gif b/Tests/Manual/TableTest/Resources/spinner.gif similarity index 100% rename from Tests/TableTest/Resources/spinner.gif rename to Tests/Manual/TableTest/Resources/spinner.gif diff --git a/Tests/TableTest/index-debug.html b/Tests/Manual/TableTest/index-debug.html similarity index 100% rename from Tests/TableTest/index-debug.html rename to Tests/Manual/TableTest/index-debug.html diff --git a/Tests/TableTest/index.html b/Tests/Manual/TableTest/index.html similarity index 100% rename from Tests/TableTest/index.html rename to Tests/Manual/TableTest/index.html diff --git a/Tests/TableTest/main.j b/Tests/Manual/TableTest/main.j similarity index 100% rename from Tests/TableTest/main.j rename to Tests/Manual/TableTest/main.j From ded413481c01aa122752eadaecf6b3eb08305928 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 18 Jan 2010 23:10:20 -0300 Subject: [PATCH 3/7] Fixed: under certain circumstances controls would not be drawn despite a call to setNeedsDisplay:YES. A typical symptom of this was custom CPViews' drawRect never being called. The error was caused by _CPDisplayServer throwing away its remaining work whenever the display code of a control called setNeedsLayout. --- AppKit/_CPDisplayServer.j | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AppKit/_CPDisplayServer.j b/AppKit/_CPDisplayServer.j index c2dfb3e1e..294e06898 100644 --- a/AppKit/_CPDisplayServer.j +++ b/AppKit/_CPDisplayServer.j @@ -28,10 +28,10 @@ PREPARE_DOM_OPTIMIZATION(); var displayObjects = [], displayObjectsByUID = { }, - + layoutObjects = [], layoutObjectsByUID = { }, - + runLoop = [CPRunLoop mainRunLoop]; function _CPDisplayServerAddDisplayObject(anObject) @@ -44,7 +44,7 @@ function _CPDisplayServerAddDisplayObject(anObject) var index = displayObjects.length; displayObjectsByUID[UID] = index; - displayObjects[index] = anObject; + displayObjects[index] = anObject; } function _CPDisplayServerAddLayoutObject(anObject) @@ -100,7 +100,7 @@ function _CPDisplayServerAddLayoutObject(anObject) displayObjectsByUID = { }; } else - displayObjects = displayObjects.splice(0, index); + displayObjects.splice(0, index); } [runLoop performSelector:@selector(run) target:self argument:nil order:0 modes:[CPDefaultRunLoopMode]]; From 0395287906e4243366292d500e2a707d1e400d6d Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 19 Jan 2010 15:00:43 -0800 Subject: [PATCH 4/7] Press bundle callbacks for theme/cib --flatten support. --- Tools/press/objj-analysis-tools.j | 50 +++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/Tools/press/objj-analysis-tools.j b/Tools/press/objj-analysis-tools.j index 8c6c68523..4dec8c8c5 100644 --- a/Tools/press/objj-analysis-tools.j +++ b/Tools/press/objj-analysis-tools.j @@ -199,8 +199,27 @@ function findImportInObjjFiles(scope, fragment) return importPath; } +@implementation PressBundleDelgate : CPObject +{ + Function didFinishLoadingCallback; +} +- (id)initWithCallback:(Function)aCallback +{ + if (self = [super init]) { + didFinishLoadingCallback = aCallback; + } + return self; +} +- (void)bundleDidFinishLoading:(CPBundle)aBundle +{ + print("didFinishLoading: "+aBundle); + if (didFinishLoadingCallback) + didFinishLoadingCallback(aBundle); +} +@end + // given a fresh scope and the path to a root source file, determine which files define each global variable -function findGlobalDefines(context, mainPath, evaledFragments) +function findGlobalDefines(context, mainPath, evaledFragments, bundleCallback) { var ignore = cloneProperties(context.scope, true); ignore['bundle'] = true; @@ -245,17 +264,30 @@ function findGlobalDefines(context, mainPath, evaledFragments) return result; } - runWithScope(context, function(importName) { - objj_import(importName, true, function() { - // Doesn't work due to lack of complete browser environment - //[_CPAppBootstrapper loadDefaultTheme]; - + 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"]; + + 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:nil]; - // FIXME: doesn't use objj_search mechanism. need to hook CPBundle or CPURLConnection instead. + [themeBundle loadWithDelegate:bundleDelegate]; + + // load additional bundles + bundlePaths.forEach(function(bundlePath) { + var bundle = [[CPBundle alloc] initWithPath:bundlePath]; + [bundle loadWithDelegate:bundleDelegate]; + }) }); - }, [mainPath]); + // ************************************************** + }, [mainPath, bundleDelegate, bundlePaths]); return dependencies; } From 2e1d6f24121b329909a77bc354ffd668bd76f009 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 19 Jan 2010 15:26:18 -0800 Subject: [PATCH 5/7] Migrate to use INTERPRETER.Context --- Tools/press/main.j | 13 +++--- Tools/press/objj-analysis-tools.j | 71 +++++++++++-------------------- 2 files changed, 31 insertions(+), 53 deletions(-) diff --git a/Tools/press/main.j b/Tools/press/main.j index 2b9e57f13..f92270a50 100644 --- a/Tools/press/main.j +++ b/Tools/press/main.j @@ -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..."); diff --git a/Tools/press/objj-analysis-tools.j b/Tools/press/objj-analysis-tools.j index 4dec8c8c5..344148bc8 100644 --- a/Tools/press/objj-analysis-tools.j +++ b/Tools/press/objj-analysis-tools.j @@ -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), "", 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) { From f1874eca8a3defdea94e5e50f5456d31c9b15453 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Wed, 20 Jan 2010 15:18:51 -0800 Subject: [PATCH 6/7] Don't use sudo in jake install by default, add "sudo-install" task. --- Jakefile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Jakefile b/Jakefile index d6e0210a5..54161d8b7 100644 --- a/Jakefile +++ b/Jakefile @@ -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 From 4e0404fce6d1900866452653095925cb427ddbe1 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Wed, 20 Jan 2010 17:12:46 -0800 Subject: [PATCH 7/7] IE sizeOfString temporary fix. --- AppKit/Platform/DOM/CPPlatformString.j | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j index 4e3920aa3..595ae184c 100644 --- a/AppKit/Platform/DOM/CPPlatformString.j +++ b/AppKit/Platform/DOM/CPPlatformString.j @@ -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;