Merge branch 'master' into URL

This commit is contained in:
Francisco Ryan Tolmasky I committed 2010-02-27 13:36:56 -08:00
commit f3a0710059
20 files changed
+242 -106

No files matched your search

+11 -1
View File
@@ -130,6 +130,16 @@ var _CPFonts = {},
return _name;
}
- (BOOL)isEqual:(id)anObject
{
return [anObject isKindOfClass:[CPFont class]] && [anObject cssString] === [self cssString];
}
- (CPString)description
{
return [CPString stringWithFormat:@"%@ %@ %f pt.", [super description], [self familyName], [self size]];
}
@end
var CPFontNameKey = @"CPFontNameKey",
@@ -161,4 +171,4 @@ var CPFontNameKey = @"CPFontNameKey",
[aCoder encodeBool:_isBold forKey:CPFontIsBoldKey];
}
@end
@end
+6 -11
View File
@@ -196,8 +196,9 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
var tableRange = _tableView._tableColumnRanges[aColumnIndex],
bounds = [self bounds];
bounds.origin.x = tableRange.location;
bounds.size.width = tableRange.length;
var rMinX = ROUND(tableRange.location);
bounds.origin.x = rMinX;
bounds.size.width = FLOOR(tableRange.length + tableRange.location - rMinX);
return bounds;
}
@@ -278,14 +279,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
return;
}
/*
else if (type & CPLeftMouseDragged && [_tableView allowsColumnREordering])
{
// Start dragging here
[[CPCursor closedHandCursor] set];
return;
}
*/
[CPApp setTarget:self selector:@selector(trackMouseWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask | CPLeftMouseDownMask untilDate:nil inMode:nil dequeue:YES];
}
@@ -343,7 +337,8 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
- (void)_updateResizeCursor:(CPEvent)theEvent
{
if (![_tableView allowsColumnResizing] || ![_tableView columnAutoresizingStyle])
// never get stuck in resize cursor mode (FIXME take out when we turn on tracking rects)
if (![_tableView allowsColumnResizing] || ([theEvent type] === CPLeftMouseUp && ![[self window] acceptsMouseMovedEvents]))
{
[[CPCursor arrowCursor] set];
return;
+23 -13
View File
@@ -746,7 +746,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[self _updateHighlightWithOldColumns:previousSelectedIndexes newColumns:_selectedColumnIndexes];
[_tableDrawView display]; // FIXME: should be setNeedsDisplayInRect:enclosing rect of new (de)selected columns
// but currently -drawRect: is not implemented here
[_headerView setNeedsDisplay:YES];
if (_headerView)
[_headerView setNeedsDisplay:YES];
[self _noteSelectionDidChange];
}
@@ -767,7 +768,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
{
[self _updateHighlightWithOldColumns:_selectedColumnIndexes newColumns:[CPIndexSet indexSet]];
_selectedColumnIndexes = [CPIndexSet indexSet];
[_headerView setNeedsDisplay:YES];
if (_headerView)
[_headerView setNeedsDisplay:YES];
}
var previousSelectedIndexes = [_selectedRowIndexes copy];
@@ -847,9 +849,12 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
dataView = dataViewsInTableColumn[rowIndex];
[dataView unsetThemeState:CPThemeStateHighlighted];
}
var headerView = [_tableColumns[columnIndex] headerView];
[headerView unsetThemeState:CPThemeStateHighlighted];
if (_headerView)
{
var headerView = [_tableColumns[columnIndex] headerView];
[headerView unsetThemeState:CPThemeStateHighlighted];
}
}
count = selectColumns.length;
@@ -865,9 +870,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
dataView = dataViewsInTableColumn[rowIndex];
[dataView setThemeState:CPThemeStateHighlighted];
}
var headerView = [_tableColumns[columnIndex] headerView];
[headerView setThemeState:CPThemeStateHighlighted];
if (_headerView)
{
var headerView = [_tableColumns[columnIndex] headerView];
[headerView setThemeState:CPThemeStateHighlighted];
}
}
}
@@ -1722,12 +1729,15 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
{
if (_currentHighlightedTableColumn == aTableColumn)
return;
if (_currentHighlightedTableColumn != nil)
[[_currentHighlightedTableColumn headerView] unsetThemeState:CPThemeStateHighlighted];
if (_headerView)
{
if (_currentHighlightedTableColumn != nil)
[[_currentHighlightedTableColumn headerView] unsetThemeState:CPThemeStateHighlighted];
if (aTableColumn != nil)
[[aTableColumn headerView] setThemeState:CPThemeStateHighlighted];
if (aTableColumn != nil)
[[aTableColumn headerView] setThemeState:CPThemeStateHighlighted];
}
_currentHighlightedTableColumn = aTableColumn;
}
+9
View File
@@ -15,6 +15,15 @@ new FileList("**/*").exclude("Jakefile").forEach(function(aFilename)
cp(aFilename, buildFilename);
});
// HACK: narwhal should copy permissions
if (FILE.dirname(aFilename) === FILE.join("bin"))
{
filedir (buildFilename, function ()
{
FILE.chmod(buildFilename, 0755);
});
}
task ("build", buildFilename);
CLOBBER.include(buildFilename);
});
@@ -1,7 +1,8 @@
#!/usr/bin/env objj
@import <Foundation/Foundation.j>
@import "cib-analysis-tools.j"
@import "../lib/cappuccino/cib-analysis-tools.j"
var FILE = require("file");
+48 -5
View File
@@ -3,9 +3,8 @@
require("narwhal").ensureEngine("rhino");
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "../press/objj-analysis-tools.j"
@import "../lib/cappuccino/objj-analysis-tools.j"
var FILE = require("file");
@@ -15,6 +14,26 @@ var parser = new (require("args").Parser)();
parser.usage("INPUT_PROJECT OUTPUT_PROJECT");
parser.help("Combine a Cappuccino application into a single JavaScript file.");
parser.option("-m", "--main", "main")
.def("main.j")
.set()
.help("The relative path (from INPUT_PROJECT) to the main file (default: 'main.j')");
parser.option("-F", "--framework", "frameworks")
.def(["Frameworks"])
.push()
.help("Add a frameworks directory, relative to INPUT_PROJECT (default: ['Frameworks'])");
parser.option("-f", "--force", "force")
.def(false)
.set(true)
.help("Force overwriting OUTPUT_PROJECT if it exists");
parser.option("-v", "--verbose", "verbose")
.def(false)
.set(true)
.help("Verbose logging");
parser.helpful();
function main(args)
@@ -29,12 +48,36 @@ function main(args)
var rootPath = FILE.path(options.args[0]).join("").absolute();
var outputPath = FILE.path(options.args[1]).join("").absolute();
if (outputPath.exists()) {
if (options.force) {
// FIXME: why doesn't this work?!
//outputPath.rmtree();
OS.system(["rm", "-rf", outputPath]);
} else {
CPLog.error("OUTPUT_PROJECT " + outputPath + " exists. Use -f to overwrite.");
OS.exit(1);
}
}
var mainPath = String(rootPath.join(options.main));
var frameworks = options.frameworks.map(function(framework) { return rootPath.join(framework); });
var environment = "Browser";
stream.print("\0yellow("+Array(81).join("=")+"\0)");
stream.print("Application root: \0green(" + rootPath + "\0)");
stream.print("Output directory: \0green(" + outputPath + "\0)");
stream.print("\0yellow("+Array(81).join("=")+"\0)");
stream.print("Main file: \0green(" + mainPath + "\0)");
stream.print("Frameworks: \0green(" + frameworks + "\0)");
stream.print("Environment: \0green(" + environment + "\0)");
var flattener = new ObjectiveJFlattener(rootPath);
flattener.setIncludePaths([rootPath.join("Frameworks")]);
flattener.setEnvironments(["Browser", "ObjJ"]);
flattener.setIncludePaths(frameworks);
flattener.setEnvironments([environment, "ObjJ"]);
flattener.load(rootPath.join("main.j"));
flattener.load(mainPath);
flattener.finishLoading();
var root = flattener.require("objective-j").StaticResource.root;
+1 -1
View File
@@ -4,7 +4,7 @@ require("narwhal").ensureEngine("rhino");
@import <Foundation/Foundation.j>
@import "press/objj-analysis-tools.j"
@import "../lib/cappuccino/objj-analysis-tools.j"
var FILE = require("file");
+9 -16
View File
@@ -1,10 +1,11 @@
#!/usr/bin/env objj
require("narwhal").ensureEngine("rhino");
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "objj-analysis-tools.j"
@import "cib-analysis-tools.j"
@import "../lib/cappuccino/objj-analysis-tools.j"
@import "../lib/cappuccino/cib-analysis-tools.j"
var FILE = require("file");
var OS = require("os");
@@ -25,11 +26,6 @@ parser.option("-F", "--framework", "frameworks")
.push()
.help("Add a frameworks directory, relative to INPUT_PROJECT (default: ['Frameworks'])");
parser.option("-E", "--environment", "environments")
.def(['Browser'])
.push()
.help("Add a platform name (default: ['Browser'])");
parser.option("-f", "--force", "force")
.def(false)
.set(true)
@@ -84,13 +80,12 @@ function press(rootPath, outputPath, options) {
var outputFiles = {},
totalBytes = {executable:0, data:0, mhtml:0};
var environment = "Browser";
// analyze and gather files for each environment:
options.environments.forEach(function(environment) {
var returnedBytes = pressEnvironment(rootPath, outputFiles, environment, options);
var returnedBytes = pressEnvironment(rootPath, outputFiles, environment, options);
for (var i in returnedBytes)
totalBytes[i] += returnedBytes[i];
});
for (var i in returnedBytes)
totalBytes[i] += returnedBytes[i];
// phase 4: copy everything and write out the new files
stream.print("\0red(PHASE 4:\0) copy to output \0green(" + rootPath + "\0) => \0green(" + outputPath + "\0)");
@@ -128,7 +123,7 @@ function press(rootPath, outputPath, options) {
if (FILE.exists(themePath))
{
var themeEnvPath = FILE.join(themePath, options.environments[0] + ".environment"),
var themeEnvPath = FILE.join(themePath, environment + ".environment"),
themeExecutablePath = FILE.join(themeEnvPath, themeName+".blend.sj"),
themeDataPath = FILE.join(themeEnvPath, "dataURLs.txt"),
themeMHTMLPath = FILE.join(themeEnvPath, "MHTMLPaths.txt");
@@ -167,9 +162,7 @@ function pressEnvironment(rootPath, outputFiles, environment, options) {
var _OBJJ = analyzer.require("objective-j");
// include paths:
analyzer.setIncludePaths(frameworks);
// environments:
analyzer.setEnvironments([environment, "ObjJ"]);
// build list of cibs to inspect for dependent classes
+2 -1
View File
@@ -73,7 +73,8 @@ new FileList("CommonJS/**/*").forEach(function(aFilename)
buildFilename,
environmentFlags("CommonJS", "ObjJ").concat($INCLUDE_FLAGS, $DEBUG_FLAGS), false);
});
// HACK: narwhal should copy permissions
if (FILE.dirname(aFilename) === FILE.join("CommonJS", "bin"))
{
filedir (buildFilename, function ()
+10 -1
View File
@@ -38,4 +38,13 @@
[self assert:[_boldCustomFont cssString] equals:@"bold 30px \"Helvetica\", Arial, sans-serif"];
}
@end
- (void)testIsEqual
{
[self assert:_customFont equals:_customFont];
[self assert:_systemFont equals:_systemFont];
[self assert:_systemFont notEqual:_customFont];
[self assert:_customFont notEqual:"a string"];
[self assert:_customFont notEqual:nil];
}
@end
+1 -1
View File
@@ -90,7 +90,7 @@ CPLogRegister(CPLogConsole);
[tableView setVerticalMotionCanBeginDrag:NO];
[tableView setDraggingDestinationFeedbackStyle:CPTableViewDropOn];
[tableView registerForDraggedTypes:[CPArray arrayWithObject:tableTestDragType]];
[window1 setAcceptsMouseMovedEvents:YES];
[window1 orderFront:self];
[self newWindow];
[self sourceList];
+1 -1
View File
@@ -1240,7 +1240,7 @@ ENABLE_PREPROCESSING = YES
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
+1 -1
View File
@@ -2,4 +2,4 @@
require("../common.jake");
// nib2cib has to come before capp since capp uses nib2cib
subtasks(["nib2cib", "capp"/*, "bake"*/, "press"], ["build"/*, "clean", "clobber"*/]);
subtasks(["nib2cib", "capp"], ["build"/*, "clean", "clobber"*/]);
+4 -2
View File
@@ -119,10 +119,12 @@ var DefaultDictionary = nil,
- (void)save
{
if (![self path])
var path = [self path];
if (!path)
return;
plist.writePlist([self path], dictionary);
CFPropertyList.writePropertyListToFile(dictionary, path);
}
@end
@@ -8,10 +8,12 @@
var ENV = require("system").env,
FILE = require("file"),
task = require("jake").task,
FileList = require("jake").FileList,
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug";
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("__project.nameasidentifier__", function(task)
{
@@ -24,7 +26,7 @@ app ("__project.nameasidentifier__", function(task)
task.setAuthor("__organization.name__");
task.setEmail("__organization.email__");
task.setSummary("__project.name__");
task.setSources(new FileList("**/*.j"));
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/*"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
@@ -35,4 +37,45 @@ app ("__project.nameasidentifier__", function(task)
task.setCompilerFlags("-O");
});
task ("default", ["__project.nameasidentifier__"]);
function printResults(configuration)
{
print("----------------------------")
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
print("----------------------------")
}
task ("default", ["__project.nameasidentifier__"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "__project.nameasidentifier__", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "__project.nameasidentifier__", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "__project.nameasidentifier__"));
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__), FILE.join("Build", "Deployment", __project.nameasidentifier__)]);
printResults("Deployment")
});
@@ -8,10 +8,12 @@
var ENV = require("system").env,
FILE = require("file"),
task = require("jake").task,
FileList = require("jake").FileList,
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug";
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("__project.nameasidentifier__", function(task)
{
@@ -24,7 +26,7 @@ app ("__project.nameasidentifier__", function(task)
task.setAuthor("__organization.name__");
task.setEmail("__organization.email__");
task.setSummary("__project.name__");
task.setSources(new FileList("**/*.j"));
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/*"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
@@ -36,4 +38,45 @@ app ("__project.nameasidentifier__", function(task)
task.setCompilerFlags("-O");
});
task ("default", ["__project.nameasidentifier__"]);
function printResults(configuration)
{
print("----------------------------")
print(configuration+" app built at path: "+FILE.join("Build", configuration, "__project.nameasidentifier__"));
print("----------------------------")
}
task ("default", ["__project.nameasidentifier__"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "__project.nameasidentifier__", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "__project.nameasidentifier__", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "__project.nameasidentifier__"));
OS.system(["press", "-f", FILE.join("Build", "Release", "__project.nameasidentifier__), FILE.join("Build", "Deployment", __project.nameasidentifier__)]);
printResults("Deployment")
});
@@ -24,5 +24,21 @@ blend ("__project.nameasidentifier__.blend", function(__project.nameasidentifier
__project.nameasidentifier__Task.setResources(new FileList("Resources/*"));
});
task ("build", ["__project.nameasidentifier__.blend"]);
task ("default", ["build"]);
task ("default", ["__project.nameasidentifier__.blend"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
-39
View File
@@ -1,39 +0,0 @@
require ("../../common.jake");
var app = require("objective-j/jake").app;
var BundleTask = require("objective-j/jake").BundleTask;
app ("press", function(pressTask)
{
pressTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "press.build", $CONFIGURATION))
pressTask.setBuildPath($BUILD_CJS_CAPPUCCINO_LIB);
pressTask.setAuthor("280 North, Inc.");
pressTask.setEmail("feedback @nospam@ 280north.com");
pressTask.setSummary("Deployment tool for Cappuccino applications");
pressTask.setIdentifier("com.280n.press");
pressTask.setLicense(BundleTask.License.LGPL_v2_1);
pressTask.setVersion("0.7.9");
pressTask.setSources(FILE.glob("*.j"));
pressTask.setResources(FILE.glob("Resources/*"));
pressTask.setEnvironments(require("objective-j/jake/environment").CommonJS);
pressTask.setFlattensSources(true);
if ($CONFIGURATION === "Release")
pressTask.setCompilerFlags("-O");
else
pressTask.setCompilerFlags("-DDEBUG -g");
});
$BUILD_CJS_PRESS = FILE.join($BUILD_CJS_CAPPUCCINO_BIN, 'press');
// executable in environment directory
filedir($BUILD_CJS_PRESS, ["press"], function()
{
make_objj_executable($BUILD_CJS_PRESS);
});
task ("build", ["press", $BUILD_CJS_PRESS]);
CLOBBER.include($BUILD_CJS_PRESS);