From d85e8798c282530e2d8bbcb6b4a152b0eb281b79 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Mon, 8 Mar 2010 15:00:52 -0800 Subject: [PATCH 1/9] Create the args and namedArgs objects in Bootstrap.js, pass them along up to CPApplication. --- AppKit/CPApplication.j | 44 +++++++++++++--------------------------- Objective-J/Bootstrap.js | 31 +++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 31 deletions(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 7e5b948f1..cc588284b 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -973,10 +973,9 @@ CPRunContinuesResponse = -1002; [self endSheet:sheet returnCode:0]; } - - (CPArray)arguments { - if(_fullArgsString != window.location.hash) + if(_fullArgsString !== window.location.hash) [self _reloadArguments]; return _args; @@ -1009,12 +1008,18 @@ CPRunContinuesResponse = -1002; - (void)_reloadArguments { _fullArgsString = window.location.hash; - var args = _fullArgsString.replace("#", "").split("/").slice(0); - for(var i=0, count = args.length; i Date: Mon, 8 Mar 2010 18:22:53 -0800 Subject: [PATCH 2/9] Fix for classes declared in subfolders reporting wrong bundle (fictional). Reviewed by me. --- Objective-J/CFBundle.js | 63 +++++++++++++++++++++++++++++++++++---- Objective-J/Executable.js | 1 + 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/Objective-J/CFBundle.js b/Objective-J/CFBundle.js index 375379985..5d86df91b 100644 --- a/Objective-J/CFBundle.js +++ b/Objective-J/CFBundle.js @@ -49,6 +49,7 @@ GLOBAL(CFBundle) = function(/*CFURL|String*/ aURL) this._resourcesDirectoryURL = new CFURL("Resources/", aURL); this._staticResource = NULL; + this._isValid = NO; this._loadStatus = CFBundleUnloaded; this._loadRequests = []; @@ -58,34 +59,47 @@ GLOBAL(CFBundle) = function(/*CFURL|String*/ aURL) this._eventDispatcher = new EventDispatcher(this); } +DISPLAY_NAME(CFBundle); + CFBundle.environments = function() { // Passed in by GCC. return ENVIRONMENTS; } +DISPLAY_NAME(CFBundle.environments); + CFBundle.bundleContainingURL = function(/*CFURL|String*/ aURL) { aURL = new CFURL(".", makeAbsoluteURL(aURL)); - while (aURL.path() !== "/") - { - var bundle = CFBundlesForURLStrings[aURL.absoluteString()]; + var previousURLString, + URLString = aURL.absoluteString(); - if (bundle) + while (!previousURLString || previousURLString !== URLString) + { + var bundle = CFBundlesForURLStrings[URLString]; + + if (bundle && bundle._isValid) return bundle; aURL = new CFURL("..", aURL); + previousURLString = URLString; + URLString = aURL.absoluteString(); } return NULL; } +DISPLAY_NAME(CFBundle.bundleContainingURL); + CFBundle.mainBundle = function() { return new CFBundle(mainBundleURL); } +DISPLAY_NAME(CFBundle.mainBundle); + function addClassToBundle(aClass, aBundle) { if (aBundle) @@ -97,16 +111,22 @@ CFBundle.bundleForClass = function(/*Class*/ aClass) return CFBundlesForClasses[aClass.name] || CFBundle.mainBundle(); } +DISPLAY_NAME(CFBundle.bundleForClass); + CFBundle.prototype.bundleURL = function() { return this._bundleURL; } +DISPLAY_NAME(CFBundle.prototype.bundleURL); + CFBundle.prototype.resourcesDirectoryURL = function() { return this._resourcesDirectoryURL; } +DISPLAY_NAME(CFBundle.prototype.resourcesDirectoryURL); + CFBundle.prototype.resourceURL = function(/*String*/ aResourceName, /*String*/ aType, /*String*/ aSubDirectory) { if (aType) @@ -120,6 +140,8 @@ CFBundle.prototype.resourceURL = function(/*String*/ aResourceName, /*String*/ a return resourceURL.absoluteURL(); } +DISPLAY_NAME(CFBundle.prototype.resourceURL); + CFBundle.prototype.mostEligibleEnvironmentURL = function() { if (this._mostEligibleEnvironmentURL === undefined) @@ -128,6 +150,8 @@ CFBundle.prototype.mostEligibleEnvironmentURL = function() return this._mostEligibleEnvironmentURL; } +DISPLAY_NAME(CFBundle.prototype.mostEligibleEnvironmentURL); + CFBundle.prototype.executableURL = function() { if (this._executableURL === undefined) @@ -143,16 +167,22 @@ CFBundle.prototype.executableURL = function() return this._executableURL; } +DISPLAY_NAME(CFBundle.prototype.executableURL); + CFBundle.prototype.infoDictionary = function() { return this._infoDictionary; } +DISPLAY_NAME(CFBundle.prototype.infoDictionary); + CFBundle.prototype.valueForInfoDictionaryKey = function(/*String*/ aKey) { return this._infoDictionary.valueForKey(aKey); } +DISPLAY_NAME(CFBundle.prototype.valueForInfoDictionaryKey); + CFBundle.prototype.hasSpritedImages = function() { var environments = this._infoDictionary.valueForKey("CPBundleEnvironmentsWithImageSprites") || [], @@ -166,11 +196,15 @@ CFBundle.prototype.hasSpritedImages = function() return NO; } +DISPLAY_NAME(CFBundle.prototype.hasSpritedImages); + CFBundle.prototype.environments = function() { return this._infoDictionary.valueForKey("CPBundleEnvironments") || ["ObjJ"]; } +DISPLAY_NAME(CFBundle.prototype.environments); + CFBundle.prototype.mostEligibleEnvironment = function(/*Array*/ environments) { environments = environments || this.environments(); @@ -194,11 +228,15 @@ CFBundle.prototype.mostEligibleEnvironment = function(/*Array*/ environments) return NULL; } +DISPLAY_NAME(CFBundle.prototype.mostEligibleEnvironment); + CFBundle.prototype.isLoading = function() { return this._loadStatus & CFBundleLoading; } +DISPLAY_NAME(CFBundle.prototype.isLoading); + CFBundle.prototype.load = function(/*BOOL*/ shouldExecute) { if (this._loadStatus !== CFBundleUnloaded) @@ -223,7 +261,13 @@ CFBundle.prototype.load = function(/*BOOL*/ shouldExecute) function onsuccess(/*Event*/ anEvent) { self._loadStatus &= ~CFBundleLoadingInfoPlist; - self._infoDictionary = anEvent.request.responsePropertyList(); + + var infoDictionary = anEvent.request.responsePropertyList(); + + self._isValid = !!infoDictionary || CFBundle.mainBundle() === self; + + if (infoDictionary) + self._infoDictionary = infoDictionary; if (!self._infoDictionary) { @@ -240,6 +284,7 @@ CFBundle.prototype.load = function(/*BOOL*/ shouldExecute) function onfailure() { + self._isValid = CFBundle.mainBundle() === self; self._loadStatus = CFBundleUnloaded; finishBundleLoadingWithError(self, new Error("Could not load bundle at \"" + self.bundleURL() + "\"")); @@ -249,6 +294,8 @@ CFBundle.prototype.load = function(/*BOOL*/ shouldExecute) }); } +DISPLAY_NAME(CFBundle.prototype.load); + function finishBundleLoadingWithError(/*CFBundle*/ aBundle, /*Event*/ anError) { resolveStaticResource(aBundle._staticResource); @@ -615,16 +662,22 @@ CFBundle.prototype.addEventListener = function(/*String*/ anEventName, /*Functio this._eventDispatcher.addEventListener(anEventName, anEventListener); } +DISPLAY_NAME(CFBundle.prototype.addEventListener); + CFBundle.prototype.removeEventListener = function(/*String*/ anEventName, /*Function*/ anEventListener) { this._eventDispatcher.removeEventListener(anEventName, anEventListener); } +DISPLAY_NAME(CFBundle.prototype.removeEventListener); + CFBundle.prototype.onerror = function(/*Event*/ anEvent) { throw anEvent.error; } +DISPLAY_NAME(CFBundle.prototype.onerror); + CFBundle.prototype.bundlePath = function() { return this._bundleURL.absoluteURL().path(); diff --git a/Objective-J/Executable.js b/Objective-J/Executable.js index 999b6a9dc..e7b6dadb6 100644 --- a/Objective-J/Executable.js +++ b/Objective-J/Executable.js @@ -137,6 +137,7 @@ Executable.prototype.execute = function() #endif var oldContextBundle = CONTEXT_BUNDLE; + // FIXME: Should we have stored this? CONTEXT_BUNDLE = CFBundle.bundleContainingURL(this.URL()); var result = this._function.apply(global, this.functionArguments()); From 67def34e29fd14c6a3e129970817c04bc4bda0ea Mon Sep 17 00:00:00 2001 From: appden Date: Tue, 9 Mar 2010 03:20:00 -0500 Subject: [PATCH 3/9] Added semi-colons to global vars and removed accidental gloabl variable. --- AppKit/CPTableView.j | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 1b5bad6ed..7de403369 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -67,29 +67,29 @@ var CPTableViewDelegate_selectionShouldChangeInTableView_ CPTableViewDelegate_tableViewSelectionIsChanging_ = 1 << 19; //CPTableViewDraggingDestinationFeedbackStyles -CPTableViewDraggingDestinationFeedbackStyleNone = -1, -CPTableViewDraggingDestinationFeedbackStyleRegular = 0, +CPTableViewDraggingDestinationFeedbackStyleNone = -1; +CPTableViewDraggingDestinationFeedbackStyleRegular = 0; CPTableViewDraggingDestinationFeedbackStyleSourceList = 1; //CPTableViewDropOperations -CPTableViewDropOn = 0, +CPTableViewDropOn = 0; CPTableViewDropAbove = 1; // TODO: add docs -CPTableViewSelectionHighlightStyleNone = -1, -CPTableViewSelectionHighlightStyleRegular = 0, +CPTableViewSelectionHighlightStyleNone = -1; +CPTableViewSelectionHighlightStyleRegular = 0; CPTableViewSelectionHighlightStyleSourceList = 1; CPTableViewGridNone = 0; CPTableViewSolidVerticalGridLineMask = 1 << 0; CPTableViewSolidHorizontalGridLineMask = 1 << 1; -CPTableViewNoColumnAutoresizing = 0, -CPTableViewUniformColumnAutoresizingStyle = 1, -CPTableViewSequentialColumnAutoresizingStyle = 2, -CPTableViewReverseSequentialColumnAutoresizingStyle = 3, -CPTableViewLastColumnOnlyAutoresizingStyle = 4, +CPTableViewNoColumnAutoresizing = 0; +CPTableViewUniformColumnAutoresizingStyle = 1; +CPTableViewSequentialColumnAutoresizingStyle = 2; +CPTableViewReverseSequentialColumnAutoresizingStyle = 3; +CPTableViewLastColumnOnlyAutoresizingStyle = 4; CPTableViewFirstColumnOnlyAutoresizingStyle = 5; @@ -1996,7 +1996,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; // Now clear all the leftovers // FIXME: this could be faster! - for (identifier in _cachedDataViews) + for (var identifier in _cachedDataViews) { var dataViews = _cachedDataViews[identifier], count = dataViews.length; From 6d353f378d83691558596e7ad51854c97c2ac202 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Tue, 9 Mar 2010 14:39:26 -0500 Subject: [PATCH 4/9] Fixed bug where editable tableview would not honor setEditable:NO for columns unless resized. closes #426 --- AppKit/CPTableView.j | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 7de403369..10fb86793 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2156,10 +2156,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; - (void)_commitDataViewObjectValue:(CPTextView)sender { - [_dataSource tableView:self - setObjectValue:[sender objectValue] - forTableColumn:sender.tableViewEditedColumnObj - row:sender.tableViewEditedRowIndex]; + [_dataSource tableView:self setObjectValue:[sender objectValue] forTableColumn:sender.tableViewEditedColumnObj row:sender.tableViewEditedRowIndex]; + [sender setEditable:NO]; } - (CPView)_newDataViewForRow:(CPInteger)aRow tableColumn:(CPTableColumn)aTableColumn From 9cca7ead1757b849d83f462d3e3ea01da7d4ba2c Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 9 Mar 2010 15:32:13 -0800 Subject: [PATCH 5/9] Factor out nightly build portion of CI script so not all branches push builds --- Tools/Scripts/ci-extra-nightlies.sh | 10 ++++++++++ Tools/Scripts/ci.sh | 19 ++++++++----------- Tools/Scripts/cruise_config.rb | 6 ++++++ 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 Tools/Scripts/ci-extra-nightlies.sh create mode 100644 Tools/Scripts/cruise_config.rb diff --git a/Tools/Scripts/ci-extra-nightlies.sh b/Tools/Scripts/ci-extra-nightlies.sh new file mode 100644 index 000000000..b0726ab50 --- /dev/null +++ b/Tools/Scripts/ci-extra-nightlies.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +PACKAGE_BRANCH="nightly" jake push-packages +code=$? +if [ $code -ne 0 ]; then + echo "NIGHTLY BUILD PUSH FAILED ($code)" + exit $code +else + echo "NIGHTLY BUILD PUSH SUCCEEDED" +fi diff --git a/Tools/Scripts/ci.sh b/Tools/Scripts/ci.sh index 1500cc2fa..a3a93eae5 100755 --- a/Tools/Scripts/ci.sh +++ b/Tools/Scripts/ci.sh @@ -1,11 +1,12 @@ #!/bin/bash project_home="$(dirname "$PWD")" +extras = "$project_home/ci-extra.sh" export PATH="$HOME/narwhal/bin:$PATH" export CAPP_AUTO_UPGRADE="yes" -export CAPP_BUILD=$project_home/build_incremental +export CAPP_BUILD="$project_home/build_incremental" time jake test code=$? if [ $code -ne 0 ]; then @@ -15,8 +16,8 @@ else echo "INCREMENTAL BUILD SUCCEEDED" fi -export CAPP_BUILD=$project_home/build_clean -rm -rf $CAPP_BUILD +export CAPP_BUILD="$project_home/build_clean" +rm -rf "$CAPP_BUILD" time jake CommonJS test code=$? @@ -27,13 +28,9 @@ else echo "CLEAN BUILD SUCCEEDED" fi -PACKAGE_BRANCH="nightly" jake push-packages -code=$? -if [ $code -ne 0 ]; then - echo "NIGHTLY BUILD PUSH FAILED ($code)" - exit $code -else - echo "NIGHTLY BUILD PUSH SUCCEEDED" +# run any additional ci commands not common to all branches (like nightly builds) +if [ -f "$extras" ]; then + source "$extras" fi -exit 0 \ No newline at end of file +exit 0 diff --git a/Tools/Scripts/cruise_config.rb b/Tools/Scripts/cruise_config.rb new file mode 100644 index 000000000..17c14a20d --- /dev/null +++ b/Tools/Scripts/cruise_config.rb @@ -0,0 +1,6 @@ +Project.configure do |project| + + project.email_notifier.emails = ['objjbuild@googlegroups.com'] + project.build_command = 'Tools/Scripts/ci.sh' + +end From 68ab5bd4e75303966ef2b1fe087eec6f897ddd03 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Tue, 9 Mar 2010 16:07:39 -0800 Subject: [PATCH 6/9] Typo in CI script. --- Tools/Scripts/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/Scripts/ci.sh b/Tools/Scripts/ci.sh index a3a93eae5..045c90d63 100755 --- a/Tools/Scripts/ci.sh +++ b/Tools/Scripts/ci.sh @@ -1,7 +1,7 @@ #!/bin/bash project_home="$(dirname "$PWD")" -extras = "$project_home/ci-extra.sh" +extras="$project_home/ci-extra.sh" export PATH="$HOME/narwhal/bin:$PATH" export CAPP_AUTO_UPGRADE="yes" From b350c2be91943bdab490416e856912318dfb7d7d Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Tue, 9 Mar 2010 19:19:25 -0500 Subject: [PATCH 7/9] Fixed previous commit so it doesn't break buttons in the tableview. --- AppKit/CPTableView.j | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 10fb86793..fe91360b3 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2154,10 +2154,12 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; } } -- (void)_commitDataViewObjectValue:(CPTextView)sender +- (void)_commitDataViewObjectValue:(id)sender { [_dataSource tableView:self setObjectValue:[sender objectValue] forTableColumn:sender.tableViewEditedColumnObj row:sender.tableViewEditedRowIndex]; - [sender setEditable:NO]; + + if ([sender respondsToSelector:@selector(setEditable:)]) + [sender setEditable:NO]; } - (CPView)_newDataViewForRow:(CPInteger)aRow tableColumn:(CPTableColumn)aTableColumn From 39e1514620fdbc623e6cc2b9e90ae8be8021095c Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Thu, 11 Mar 2010 14:17:37 -0800 Subject: [PATCH 8/9] temporary fix for whiteSpace style issue in IE. --- AppKit/Platform/DOM/CPPlatformString.j | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j index 7b82f4493..96c1dccb2 100644 --- a/AppKit/Platform/DOM/CPPlatformString.j +++ b/AppKit/Platform/DOM/CPPlatformString.j @@ -67,11 +67,15 @@ var DOMSpanElement = nil, DOMSpanElement = DOMIFrameDocument.createElement("span"); DOMSpanElement.style.position = "absolute"; - DOMSpanElement.style.whiteSpace = "pre"; DOMSpanElement.style.visibility = "visible"; DOMSpanElement.style.padding = "0px"; DOMSpanElement.style.margin = "0px"; + try { + DOMSpanElement.style.whiteSpace = "pre"; + } + catch (e) {} + DOMDivElement.appendChild(DOMSpanElement); } @@ -93,16 +97,29 @@ var DOMSpanElement = nil, if (!aWidth) { style.width = ""; - style.whiteSpace = "pre"; + + try { + style.whiteSpace = "pre"; + } + catch (e) {} + + style.wordWrap = "normal"; } else { style.width = ROUND(aWidth) + "px"; + try + { + style.whiteSpace = "-o-pre-wrap"; + style.whiteSpace = "-pre-wrap"; + style.whiteSpace = "-moz-pre-wrap"; + style.whiteSpace = "pre-wrap"; + } catch(e) + { + //some versions of IE throw exceptions for unsupported properties. + } + style.wordWrap = "break-word"; - style.whiteSpace = "-o-pre-wrap"; - style.whiteSpace = "-pre-wrap"; - style.whiteSpace = "-moz-pre-wrap"; - style.whiteSpace = "pre-wrap"; } style.font = [aFont cssString]; From ed66d7858566e2cba590b41b80bc84b8669882a4 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Thu, 11 Mar 2010 14:27:15 -0800 Subject: [PATCH 9/9] Update the template files to more modern standards. --- .../Templates/Application/index-debug.html | 23 ++++++++------- .../Templates/Application/index.html | 13 ++++----- .../Templates/NibApplication/index-debug.html | 28 ++++++++++++++----- .../Templates/NibApplication/index.html | 13 ++++----- .../ThemeDescriptor/index-debug.html | 13 ++++----- .../Templates/ThemeDescriptor/index.html | 13 ++++----- 6 files changed, 56 insertions(+), 47 deletions(-) diff --git a/Tools/capp/Resources/Templates/Application/index-debug.html b/Tools/capp/Resources/Templates/Application/index-debug.html index 0bca39b8d..0bd1d11fe 100644 --- a/Tools/capp/Resources/Templates/Application/index-debug.html +++ b/Tools/capp/Resources/Templates/Application/index-debug.html @@ -1,8 +1,7 @@ - - + - + __project.name__ - - + - -