diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index a4852ce2a..0f1f5217a 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -24,6 +24,7 @@ @import "CGGeometry.j" @import "CPControl.j" +@import "CPStringDrawing.j" #include "CoreGraphics/CGGeometry.h" diff --git a/Objective-J/CommonJS/lib/objective-j.js b/Objective-J/CommonJS/lib/objective-j.js index cdcb6baba..70962bb9a 100644 --- a/Objective-J/CommonJS/lib/objective-j.js +++ b/Objective-J/CommonJS/lib/objective-j.js @@ -145,7 +145,7 @@ exports.objj_eval = function(/*String*/ aString) // We need this while code still refers to window. Executable.setCommonJSArguments(require, exports, module, system, print, window); - var executable = preprocess(aString, "", 0); + var executable = exports.preprocess(aString, "", 0); if (!executable.hasLoadedFileDependencies()) executable.loadFileDependencies(); diff --git a/Tests/AppKit/CPButtonTest.j b/Tests/AppKit/CPButtonTest.j new file mode 100644 index 000000000..030de6214 --- /dev/null +++ b/Tests/AppKit/CPButtonTest.j @@ -0,0 +1,15 @@ + +@import +@import + +@implementation CPButtonTest : OJTestCase +{ +} + +- (void)testCanCreate +{ + var button = [CPButton buttonWithTitle:"hello world"]; + [self assertTrue:!!button]; +} + +@end diff --git a/Tools/press/main.j b/Tools/press/main.j index 30b9b750e..188f9cb17 100644 --- a/Tools/press/main.j +++ b/Tools/press/main.j @@ -227,7 +227,7 @@ function pressEnvironment(rootPath, outputFiles, environment, options) { for (var path in requiredFiles) { var executable = analyzer.executableForImport(path), - bundle = _OBJJ.CFBundle.bundleContainingPath(executable.path()), + bundle = analyzer.context.global.CFBundle.bundleContainingPath(executable.path()), relativePath = FILE.relative(FILE.join(bundle.path(), ""), executable.path()); if (executable.path() !== path) diff --git a/Tools/press/objj-analysis-tools.j b/Tools/press/objj-analysis-tools.j index 4d73be993..582124977 100644 --- a/Tools/press/objj-analysis-tools.j +++ b/Tools/press/objj-analysis-tools.j @@ -2,7 +2,7 @@ var FILE = require("file"); var OBJJ = require("objective-j"); var Context = require("interpreter").Context; -function ObjectiveJRuntimeAnalyzer(rootPath) +ObjectiveJRuntimeAnalyzer = function(rootPath) { this.rootPath = rootPath; this.context = new Context(); @@ -57,8 +57,8 @@ ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function() } var _OBJJ = this.require("objective-j"); - var _fileExecuterForPath = _OBJJ.fileExecuterForPath; - _OBJJ.fileExecuterForPath = function(/*String*/ referencePath) { + var _fileExecuterForPath = _OBJJ.Executable.fileExecuterForPath; + _OBJJ.Executable.fileExecuterForPath = function(/*String*/ referencePath) { var fileExecutor = _fileExecuterForPath.apply(this, arguments); return function(/*String*/ aPath, /*BOOL*/ isLocal, /*BOOL*/ shouldForce) { recordAndReset(); @@ -68,7 +68,7 @@ ObjectiveJRuntimeAnalyzer.prototype.initializeGlobalRecorder = function() // NOTE: we distinguish local and library imports using absolute and relative paths. // we resolve the library paths later (in "mergeLibraryImports()") since doing it here seems // to change the resulting recorded globals. - if (isLocal) + if (isLocal && !FILE.isAbsolute(aPath)) currentFile = FILE.normal(FILE.join(referencePath, aPath)); else currentFile = aPath; @@ -88,7 +88,7 @@ ObjectiveJRuntimeAnalyzer.prototype.load = function(path) { this.require("objective-j").objj_eval( "("+(function(path) { - fileImporterForPath("/")(path, true, function() { + objj_importFile(path, true, function() { print("Done importing and evaluating: " + path); }); })+")" @@ -331,25 +331,6 @@ function markFilesReferencedByTokens(tokens, globalsToFiles, referencedFiles) { }); } -@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 - // create a new scope loaded with Narwhal and Objective-J function setupObjectiveJ(context) {