diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j
index 940664f7a..2b3989af4 100644
--- a/AppKit/CPMenu/CPMenu.j
+++ b/AppKit/CPMenu/CPMenu.j
@@ -886,6 +886,13 @@ var _CPMenuBarVisible = NO,
subtype:0
data1:0
data2:0]];
+
+ // FIXME: We need to do this because this happens in a limitDateForMode:, thus
+ // the second limitDateForMode: won't take effect and the perform selector that
+ // actually draws also won't go into effect. In Safari this works because it sends
+ // an additional mouse move after all this, but not in other browsers.
+ // This will be fixed correctly with the coming run loop changes.
+ [_CPDisplayServer run];
}
/* @ignore */
@@ -980,13 +987,14 @@ var _CPMenuBarVisible = NO,
*/
- (void)_highlightItemAtIndex:(int)anIndex
{
- var previousHighlightedIndex = _highlightedIndex;
-
+ if (_highlightedIndex === anIndex)
+ return;
+
+ if (_highlightedIndex !== CPNotFound)
+ [[_items[_highlightedIndex] _menuItemView] highlight:NO];
+
_highlightedIndex = anIndex;
-
- if (previousHighlightedIndex !== CPNotFound)
- [[_items[previousHighlightedIndex] _menuItemView] highlight:NO];
-
+
if (_highlightedIndex !== CPNotFound)
[[_items[_highlightedIndex] _menuItemView] highlight:YES];
}
diff --git a/AppKit/CPSplitView.j b/AppKit/CPSplitView.j
index 33d243f22..6974c25e0 100644
--- a/AppKit/CPSplitView.j
+++ b/AppKit/CPSplitView.j
@@ -75,9 +75,9 @@ var CPSplitViewHorizontalImage = nil,
if (self = [super initWithFrame:aFrame])
{
_currentDivider = CPNotFound;
-
+
_DOMDividerElements = [];
-
+
[self _setVertical:YES];
}
@@ -102,9 +102,9 @@ var CPSplitViewHorizontalImage = nil,
// Just re-adjust evenly.
var frame = [self frame],
dividerThickness = [self dividerThickness];
-
+
[self _postNotificationWillResize];
-
+
var eachSize = ROUND((frame.size[_sizeComponent] - dividerThickness * (_subviews.length - 1)) / _subviews.length),
index = 0,
count = _subviews.length;
@@ -115,9 +115,9 @@ var CPSplitViewHorizontalImage = nil,
else
for (; index < count; ++index)
[_subviews[index] setFrame:CGRectMake(0, ROUND((eachSize + dividerThickness) * index), frame.size.width, eachSize)];
-
+
[self setNeedsDisplay:YES];
-
+
[self _postNotificationDidResize];
}
@@ -170,9 +170,9 @@ var CPSplitViewHorizontalImage = nil,
{
var frame = [_subviews[aDivider] frame],
rect = CGRectMakeZero();
-
+
rect.size = [self frame].size;
-
+
rect.size[_sizeComponent] = [self dividerThickness];
rect.origin[_originComponent] = frame.origin[_originComponent] + frame.size[_sizeComponent];
@@ -182,19 +182,19 @@ var CPSplitViewHorizontalImage = nil,
- (CGRect)effectiveRectOfDividerAtIndex:(int)aDivider
{
var realRect = [self rectOfDividerAtIndex:aDivider];
-
+
var padding = 2;
-
+
realRect.size[_sizeComponent] += padding * 2;
realRect.origin[_originComponent] -= padding;
-
+
return realRect;
}
- (void)drawRect:(CGRect)rect
{
var count = [_subviews count] - 1;
-
+
while ((count--) > 0)
{
_drawingDivider = count;
@@ -208,7 +208,12 @@ var CPSplitViewHorizontalImage = nil,
if (!_DOMDividerElements[_drawingDivider])
{
_DOMDividerElements[_drawingDivider] = document.createElement("div");
- _DOMDividerElements[_drawingDivider].style.cursor = "move";
+
+ if(_isVertical)
+ _DOMDividerElements[_drawingDivider].style.cursor = [[CPCursor resizeLeftRightCursor] _cssString];
+ else
+ _DOMDividerElements[_drawingDivider].style.cursor = [[CPCursor resizeUpDownCursor] _cssString];
+
_DOMDividerElements[_drawingDivider].style.position = "absolute";
_DOMDividerElements[_drawingDivider].style.backgroundRepeat = "repeat";
@@ -245,9 +250,9 @@ var CPSplitViewHorizontalImage = nil,
{
if (!_needsResizeSubviews)
return;
-
+
_needsResizeSubviews = NO;
-
+
var subviews = [self subviews],
count = subviews.length,
oldSize = CGSizeMakeZero();
@@ -262,10 +267,10 @@ var CPSplitViewHorizontalImage = nil,
oldSize.width = CGRectGetWidth([self frame]);
oldSize.height += [self dividerThickness] * (count - 1);
}
-
+
while (count--)
oldSize[_sizeComponent] += [subviews[count] frame].size[_sizeComponent];
-
+
[self resizeSubviewsWithOldSize:oldSize];
}
@@ -278,7 +283,7 @@ var CPSplitViewHorizontalImage = nil,
if ([_delegate respondsToSelector:@selector(splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:)])
effectiveRect = [_delegate splitView:self effectiveRect:effectiveRect forDrawnRect:effectiveRect ofDividerAtIndex:anIndex];
-
+
if ([_delegate respondsToSelector:@selector(splitView:additionalEffectiveRectOfDividerAtIndex:)])
additionalRect = [_delegate splitView:self additionalEffectiveRectOfDividerAtIndex:anIndex];
@@ -289,9 +294,9 @@ var CPSplitViewHorizontalImage = nil,
{
if ([self isHidden] || ![self hitTests] || !CGRectContainsPoint([self frame], aPoint))
return nil;
-
+
var point = [self convertPoint:aPoint fromView:[self superview]];
-
+
var count = [_subviews count] - 1;
for (var i = 0; i < count; i++)
{
diff --git a/Jakefile b/Jakefile
index 4687216af..36a6da3eb 100644
--- a/Jakefile
+++ b/Jakefile
@@ -188,47 +188,68 @@ task("test-only", function()
OS.exit(code);
});
-task("push-packages", ["CommonJS", "push-cappuccino", "push-objective-j"]);
+task("push-packages", ["push-cappuccino", "push-objective-j"]);
task("push-cappuccino", function() {
pushPackage(
$BUILD_CJS_CAPPUCCINO,
- "git@github.com:280north/cappuccino-package.git"
+ "git@github.com:280north/cappuccino-package.git",
+ SYSTEM.env["PACKAGE_BRANCH"]
);
});
task("push-objective-j", function() {
pushPackage(
$BUILD_CJS_OBJECTIVE_J,
- "git@github.com:280north/objective-j-package.git"
+ "git@github.com:280north/objective-j-package.git",
+ SYSTEM.env["PACKAGE_BRANCH"]
);
});
-function pushPackage(path, remote)
+function pushPackage(path, remote, branch)
{
- stream.print("Pushing \0blue(" + path + "\0) to \0blue(" + remote + "\0)");
+ branch = branch || "master";
+
+ stream.print("Pushing \0blue(" + path + "\0) to "+branch+" of \0blue(" + remote + "\0)");
FILE.mkdirs(".push-package");
var pushPackageDir = FILE.join(".push-package", remote.replace(/[^\w]/g, "_"));
if (FILE.exists(pushPackageDir))
- OS.system(buildCommandString([["cd", pushPackageDir], ["git", "pull"]]));
+ OS.system(buildCmd([["cd", pushPackageDir], ["git", "fetch"]]));
else
OS.system(["git", "clone", remote, pushPackageDir]);
- OS.system("cd "+OS.enquote(pushPackageDir)+" && git rm --ignore-unmatch -r * && rm -rf *");
- OS.system("cp -R "+OS.enquote(path)+"/* "+OS.enquote(pushPackageDir)+"/.");
+ if (OS.system(buildCmd([["cd", pushPackageDir], ["git", "checkout", "origin/"+branch]]))) {
+ if (OS.system(buildCmd([
+ ["cd", pushPackageDir],
+ ["git", "symbolic-ref", "HEAD", "refs/heads/"+branch],
+ ["rm", ".git/index"],
+ ["git", "clean", "-fdx"]
+ ])))
+ throw "pushPackage failed";
+ }
- OS.system(buildCommandString([
+ if (OS.system("cd "+OS.enquote(pushPackageDir)+" && git rm --ignore-unmatch -r * && rm -rf *"))
+ throw "pushPackage failed";
+ if (OS.system("cp -R "+OS.enquote(path)+"/* "+OS.enquote(pushPackageDir)+"/."))
+ throw "pushPackage failed";
+
+ OS.system(buildCmd([
["cd", pushPackageDir],
["git", "add", "."],
- ["git", "commit", "-m", "Pushed on " + new Date()],
- ["git", "push", "origin", "master"]
+ ["git", "commit", "-m", "Pushed on " + new Date()]
]));
+
+ if (OS.system(buildCmd([
+ ["cd", pushPackageDir],
+ ["git", "push", "origin", "HEAD:"+branch]
+ ])))
+ throw "pushPackage failed";
}
-function buildCommandString(arrayOfCommands)
+function buildCmd(arrayOfCommands)
{
return arrayOfCommands.map(function(cmd) {
return cmd.map(OS.enquote).join(" ");
diff --git a/Objective-J/Bootstrap.js b/Objective-J/Bootstrap.js
index 0bda2073c..abd530ff7 100644
--- a/Objective-J/Bootstrap.js
+++ b/Objective-J/Bootstrap.js
@@ -26,15 +26,19 @@ var cwd = FILE.cwd(),
StaticResource.root = rootResource;
#ifdef BROWSER
-if (rootResource.isResolved())
+
+exports.bootstrap = function()
{
- rootResource.nodeAtSubPath(FILE.dirname(cwd), YES);
- resolveCWD();
-}
-else
-{
- rootResource.resolve();
- rootResource.addEventListener("resolve", resolveCWD);
+ if (rootResource.isResolved())
+ {
+ rootResource.nodeAtSubPath(FILE.dirname(cwd), YES);
+ resolveCWD();
+ }
+ else
+ {
+ rootResource.resolve();
+ rootResource.addEventListener("resolve", resolveCWD);
+ }
}
function resolveCWD()
@@ -76,4 +80,9 @@ afterDocumentLoad(function()
{
documentLoaded = YES;
});
+
+
+if (typeof OBJJ_AUTO_BOOTSTRAP === "undefined" || OBJJ_AUTO_BOOTSTRAP)
+ exports.bootstrap();
+
#endif
diff --git a/Tools/Scripts/ci.sh b/Tools/Scripts/ci.sh
new file mode 100755
index 000000000..4bc798a70
--- /dev/null
+++ b/Tools/Scripts/ci.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+project_home="$(dirname "$PWD")"
+
+export PATH="$HOME/narwhal/bin:$PATH"
+
+export CAPP_BUILD=$project_home/build_incremental
+time jake test
+code=$?
+if [ $code -ne 0 ]; then
+ echo "INCREMENTAL BUILD FAILED ($code)"
+ exit $code
+else
+ echo "INCREMENTAL BUILD SUCCEEDED"
+fi
+
+export CAPP_BUILD=$project_home/build_clean
+rm -rf $CAPP_BUILD
+
+time jake CommonJS test
+code=$?
+if [ $code -ne 0 ]; then
+ echo "CLEAN BUILD FAILED ($code)"
+ exit $code
+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"
+fi
+
+exit 0
\ No newline at end of file
diff --git a/Tools/githooks/pre-commit b/Tools/Scripts/githooks/pre-commit
similarity index 100%
rename from Tools/githooks/pre-commit
rename to Tools/Scripts/githooks/pre-commit
diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j
index bcdd07a47..ce42fad38 100644
--- a/Tools/capp/Generate.j
+++ b/Tools/capp/Generate.j
@@ -69,7 +69,12 @@ var templatesDirectory = FILE.join(CAPP_HOME, "lib", "capp", "Resources", "Templ
function gen(/*va_args*/)
{
var args = ["capp gen"].concat(Array.prototype.slice.call(arguments));
- var options = parser.parse(args);
+ var options = parser.parse(args, null, null, true);
+
+ if (options.args.length > 1) {
+ parser.printUsage(options);
+ OS.exit(1);
+ }
if (options.listTemplates) {
listTemplates();
diff --git a/Tools/flatten/flatten b/Tools/flatten/flatten
index c6b24eb9e..9854df81a 100755
--- a/Tools/flatten/flatten
+++ b/Tools/flatten/flatten
@@ -39,19 +39,15 @@ function main(args)
var root = flattener.require("objective-j").StaticResource.root;
+ // FIXME: shouldn't have to do this manually
var components = rootPath.split("/").slice(1, -1);
- print(components)
var node = root;
while (components.length) {
- print(node._path);
node = node._children[components.shift()];
}
applicationRoot = node;
- print("applicationRoot._children="+Object.keys(applicationRoot._children));
- print("rootPath="+rootPath);
- print("applicationRoot="+applicationRoot.toString());
- print("root="+root);
+ print(applicationRoot.toString());
var applicationJS = flattener.buildApplicationJS(applicationRoot);
@@ -59,8 +55,8 @@ function main(args)
outputPath.join("Application.js").write(applicationJS);
- addApplicationScriptTag(outputPath.join("index.html"));
- addApplicationScriptTag(outputPath.join("index-debug.html"));
+ rewriteMainHTML(outputPath.join("index.html"));
+ rewriteMainHTML(outputPath.join("index-debug.html"));
}
// ObjectiveJFlattener inherits from ObjectiveJRuntimeAnalyzer
@@ -95,6 +91,7 @@ ObjectiveJFlattener.prototype.buildApplicationJS = function(applicationRoot) {
buffer.push("console.log(ObjectiveJ.StaticResource.root);");
buffer.push("console.log(applicationRoot);");
+ buffer.push("ObjectiveJ.bootstrap();");
buffer.push("})();");
return buffer.join("\n");
@@ -150,16 +147,24 @@ ObjectiveJFlattener.prototype.serializeStaticResources = function(node, depth) {
this.resourceBuffer.push("currentNode = nodeStack.pop();");
}
-function addApplicationScriptTag(indexHTMLPath) {
+function rewriteMainHTML(indexHTMLPath) {
var indexHTML = indexHTMLPath.read();
- // attempt to append the Application.js script tag after
- var newIndexHTML = indexHTML.replace(/([ \t]+)');
+ // "$1" is the matching indentation
+ var scriptTagsBefore = '$1';
+ var scriptTagsAfter = '$1';
+
+ // attempt to find Objective-J script tag and add ours
+ var newIndexHTML = indexHTML.replace(/([ \t]+)