mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-19 08:53:30 +00:00
Merge branch 'master' into URL
This commit is contained in:
+14
-6
@@ -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];
|
||||
}
|
||||
|
||||
+25
-20
@@ -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++)
|
||||
{
|
||||
|
||||
@@ -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(" ");
|
||||
|
||||
@@ -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
|
||||
|
||||
Executable
+38
@@ -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
|
||||
@@ -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();
|
||||
|
||||
+20
-15
@@ -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]+)<script[^>]+Objective-J.js[^>]+>(?:\s*<\/script>)?/,
|
||||
'$&\n$1<script src = "Application.js" type = "text/javascript"></script>');
|
||||
// "$1" is the matching indentation
|
||||
var scriptTagsBefore = '$1<script type = "text/javascript">\n$1 OBJJ_AUTO_BOOTSTRAP = false;\n$1</script>';
|
||||
var scriptTagsAfter = '$1<script type = "text/javascript" src = "Application.js"></script>';
|
||||
|
||||
// attempt to find Objective-J script tag and add ours
|
||||
var newIndexHTML = indexHTML.replace(/([ \t]+)<script[^>]+Objective-J\.js[^>]+>(?:\s*<\/script>)?/,
|
||||
scriptTagsBefore+'\n$&\n'+scriptTagsAfter);
|
||||
|
||||
if (newIndexHTML === indexHTML) {
|
||||
print("Unable to automatically add Application.js script tag.");
|
||||
stream.print("\0yellow(Warning: Unable to automatically modify "+indexHTMLPath + "\0)");
|
||||
stream.print("\nAdd the following before the Objective-J script tag:");
|
||||
stream.print(scriptTagsBefore.replace(/\$1/g, " "));
|
||||
stream.print("\nAdd the following after the Objective-J script tag:");
|
||||
stream.print(scriptTagsAfter.replace(/\$1/g, " "));
|
||||
} else {
|
||||
indexHTMLPath.write(newIndexHTML);
|
||||
}
|
||||
|
||||
indexHTMLPath.write(newIndexHTML);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user