mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-20 01:13:29 +00:00
Initial commit for group rows in the TableView. Drawing code still needs to be cleaned up a LOT... still buggy. i.e. after you select a group row, any rows after that which are selected then get selected with a gray highlight color.
This commit is contained in:
+132
-15
@@ -178,6 +178,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
unsigned _gridStyleMask;
|
||||
|
||||
unsigned _numberOfRows;
|
||||
CPIndexSet _groupRows;
|
||||
|
||||
|
||||
CPTableHeaderView _headerView;
|
||||
@@ -318,6 +319,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
_exposedColumns = [CPIndexSet indexSet];
|
||||
_cachedDataViews = { };
|
||||
|
||||
_groupRows = [CPIndexSet indexSet];
|
||||
|
||||
_tableDrawView = [[_CPTableDrawView alloc] initWithTableView:self];
|
||||
[_tableDrawView setBackgroundColor:[CPColor clearColor]];
|
||||
[self addSubview:_tableDrawView];
|
||||
@@ -2361,6 +2364,22 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
else
|
||||
[dataView unsetThemeState:CPThemeStateSelectedDataView];
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_isGroupRow_)
|
||||
{
|
||||
if([_delegate tableView:self isGroupRow:row])
|
||||
{
|
||||
[_groupRows addIndex:row];
|
||||
[dataView setThemeState:CPThemeStateGroupRow];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_groupRows removeIndexesInRange:CPMakeRange(row, 1)];
|
||||
[dataView unsetThemeState:CPThemeStateGroupRow];
|
||||
}
|
||||
|
||||
[self setNeedsDisplay:YES]
|
||||
}
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_willDisplayView_forTableColumn_row_)
|
||||
[_delegate tableView:self willDisplayView:dataView forTableColumn:tableColumn row:row];
|
||||
|
||||
@@ -2516,18 +2535,24 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
firstRow = exposedRows.location,
|
||||
lastRow = CPMaxRange(exposedRows) - 1,
|
||||
colorIndex = MIN(exposedRows.length, colorCount),
|
||||
heightFilled = 0.0;
|
||||
heightFilled = 0.0,
|
||||
groupRowRects = [ ];
|
||||
|
||||
while (colorIndex--)
|
||||
{
|
||||
var row = firstRow - firstRow % colorCount + colorIndex,
|
||||
fillRect = nil;
|
||||
fillRect = _CGRectMakeZero();
|
||||
|
||||
CGContextBeginPath(context);
|
||||
|
||||
for (; row <= lastRow; row += colorCount)
|
||||
if (row >= firstRow)
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
{
|
||||
if (![_groupRows containsIndex:row] && _selectionHighlightStyle !== CPTableViewSelectionHighlightStyleSourceList)
|
||||
CGContextAddRect(context, CGRectIntersection(aRect, fillRect = [self rectOfRow:row]));
|
||||
else
|
||||
groupRowRects.push(CGRectIntersection(aRect, [self rectOfRow:row]));
|
||||
}
|
||||
|
||||
if (row - colorCount === lastRow)
|
||||
heightFilled = _CGRectGetMaxY(fillRect);
|
||||
@@ -2539,22 +2564,33 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
}
|
||||
// console.profileEnd("row-paint");
|
||||
|
||||
|
||||
|
||||
// FIX ME: this is really terrible, it seems like such a hack...
|
||||
var totalHeight = _CGRectGetMaxY(aRect);
|
||||
|
||||
if (heightFilled >= totalHeight || _rowHeight <= 0.0)
|
||||
{
|
||||
[self _drawGroupRowsForRects:groupRowRects];
|
||||
return;
|
||||
}
|
||||
|
||||
var rowHeight = _rowHeight + _intercellSpacing.height,
|
||||
fillRect = _CGRectMake(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect) + heightFilled, _CGRectGetWidth(aRect), rowHeight);
|
||||
|
||||
for (row = lastRow + 1; heightFilled < totalHeight; ++row)
|
||||
{
|
||||
CGContextSetFillColor(context, rowColors[row % colorCount]);
|
||||
CGContextFillRect(context, fillRect);
|
||||
if(![_groupRows containsIndex:row] && _selectionHighlightStyle !== CPTableViewSelectionHighlightStyleSourceList)
|
||||
{
|
||||
CGContextSetFillColor(context, rowColors[row % colorCount]);
|
||||
CGContextFillRect(context, fillRect);
|
||||
}
|
||||
|
||||
heightFilled += rowHeight;
|
||||
fillRect.origin.y += rowHeight;
|
||||
}
|
||||
|
||||
[self _drawGroupRowsForRects:groupRowRects];
|
||||
}
|
||||
|
||||
- (void)drawGridInClipRect:(CGRect)aRect
|
||||
@@ -2672,46 +2708,73 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var gradientCache = [self selectionGradientColors],
|
||||
topLineColor = [gradientCache objectForKey:CPSourceListTopLineColor],
|
||||
bottomLineColor = [gradientCache objectForKey:CPSourceListBottomLineColor],
|
||||
gradientColor = [gradientCache objectForKey:CPSourceListGradient];
|
||||
gradientColor = [gradientCache objectForKey:CPSourceListGradient],
|
||||
normalSelectionHighlightColor = [self selectionHighlightColor];
|
||||
|
||||
// dont do these lookups if there are no group rows
|
||||
if ([_groupRows count])
|
||||
{
|
||||
var topGroupLineColor = [CPColor colorWithCalibratedWhite:212.0 / 255.0 alpha:1.0],
|
||||
bottomGroupLineColor = [CPColor colorWithCalibratedWhite:185.0 / 255.0 alpha:1.0],
|
||||
gradientGroupColor = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [212.0 / 255.0, 212.0 / 255.0, 212.0 / 255.0,1.0, 197.0 / 255.0, 197.0 / 255.0, 197.0 / 255.0,1.0], [0,1], 2);
|
||||
}
|
||||
|
||||
while (count--)
|
||||
{
|
||||
var rowRect = CGRectIntersection(objj_msgSend(self, rectSelector, indexes[count]), aRect);
|
||||
{
|
||||
var currentIndex = indexes[count],
|
||||
rowRect = CGRectIntersection(objj_msgSend(self, rectSelector, currentIndex), aRect);
|
||||
CGContextAddRect(context, rowRect);
|
||||
|
||||
if (drawGradient)
|
||||
var shouldUseGroupGradient = [_groupRows containsIndex:currentIndex];
|
||||
console.log(currentIndex, [_groupRows description], shouldUseGroupGradient);
|
||||
|
||||
if (drawGradient || shouldUseGroupGradient)
|
||||
{
|
||||
//console.log("gradiant fill for row: " + currentIndex);
|
||||
var minX = _CGRectGetMinX(rowRect),
|
||||
minY = _CGRectGetMinY(rowRect),
|
||||
maxX = _CGRectGetMaxX(rowRect),
|
||||
maxY = _CGRectGetMaxY(rowRect) - deltaHeight;
|
||||
|
||||
CGContextDrawLinearGradient(context, gradientColor, rowRect.origin, CGPointMake(minX, maxY), 0);
|
||||
// use a special selection gradient for group rows
|
||||
|
||||
|
||||
CGContextDrawLinearGradient(context, (shouldUseGroupGradient) ? gradientGroupColor : gradientColor, rowRect.origin, _CGPointMake(minX, maxY), 0);
|
||||
CGContextClosePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, minY);
|
||||
CGContextAddLineToPoint(context, maxX, minY);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, topLineColor);
|
||||
CGContextSetStrokeColor(context, (shouldUseGroupGradient) ? topGroupLineColor : topLineColor);
|
||||
CGContextStrokePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, maxY);
|
||||
CGContextAddLineToPoint(context, maxX, maxY - 1);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, bottomLineColor);
|
||||
CGContextSetStrokeColor(context, (shouldUseGroupGradient) ? bottomGroupLineColor : bottomLineColor);
|
||||
CGContextStrokePath(context);
|
||||
CGContextClosePath(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGContextClosePath(context);
|
||||
//console.log("fill 1 for row:" + currentIndex);
|
||||
[normalSelectionHighlightColor setFill];
|
||||
CGContextFillPath(context);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
CGContextClosePath(context);
|
||||
|
||||
if (!drawGradient)
|
||||
/*if (!drawGradient)
|
||||
{
|
||||
[[self selectionHighlightColor] setFill];
|
||||
console.log("fill 2 for row: " + currentIndex);
|
||||
[normalSelectionHighlightColor setFill];
|
||||
CGContextFillPath(context);
|
||||
}
|
||||
}*/
|
||||
|
||||
CGContextBeginPath(context);
|
||||
var gridStyleMask = [self gridStyleMask];
|
||||
@@ -2755,6 +2818,59 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
CGContextStrokePath(context);
|
||||
}
|
||||
|
||||
- (void)_drawGroupRowsForRects:(CPArray)rects
|
||||
{
|
||||
if (_selectionHighlightStyle === CPTableViewSelectionHighlightStyleSourceList || !rects.length)
|
||||
return;
|
||||
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort],
|
||||
i = rects.length;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
|
||||
var gradientCache = [self selectionGradientColors],
|
||||
topLineColor = [CPColor colorWithHexString:"d3d3d3"],
|
||||
bottomLineColor = [CPColor colorWithHexString:"bebebd"],
|
||||
gradientColor = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0,1.0,
|
||||
199.0 / 255.0, 199.0 / 255.0, 199.0 / 255.0,1.0], [0,1], 2),
|
||||
drawGradient = YES;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
var rowRect = rects[i];
|
||||
|
||||
CGContextAddRect(context, rowRect);
|
||||
|
||||
if (drawGradient)
|
||||
{
|
||||
var minX = CGRectGetMinX(rowRect),
|
||||
minY = CGRectGetMinY(rowRect),
|
||||
maxX = CGRectGetMaxX(rowRect),
|
||||
maxY = CGRectGetMaxY(rowRect);
|
||||
|
||||
CGContextDrawLinearGradient(context, gradientColor, rowRect.origin, CGPointMake(minX, maxY), 0);
|
||||
CGContextClosePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, minY);
|
||||
CGContextAddLineToPoint(context, maxX, minY);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, topLineColor);
|
||||
CGContextStrokePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, maxY);
|
||||
CGContextAddLineToPoint(context, maxX, maxY - 1);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, bottomLineColor);
|
||||
CGContextStrokePath(context);
|
||||
}
|
||||
}
|
||||
|
||||
CGContextClosePath(context);
|
||||
}
|
||||
|
||||
|
||||
- (void)_drawRows:(CPIndexSet)rowsIndexes clipRect:(CGRect)clipRect
|
||||
{
|
||||
var row = [rowsIndexes firstIndex];
|
||||
@@ -2769,6 +2885,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
- (void)drawRow:(CPInteger)row clipRect:(CGRect)rect
|
||||
{
|
||||
// This method does currently nothing in cappuccino. Can be overriden by subclasses.
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
|
||||
@@ -403,6 +403,7 @@ CPThemeStateHighlighted = CPThemeState("highlighted");
|
||||
CPThemeStateSelected = CPThemeState("selected");
|
||||
CPThemeStateTableDataView = CPThemeState("tableDataView");
|
||||
CPThemeStateSelectedDataView = CPThemeStateSelectedTableDataView = CPThemeState("selectedTableDataView");
|
||||
CPThemeStateGroupRow = CPThemeState("CPThemeStateGroupRow");
|
||||
CPThemeStateBezeled = CPThemeState("bezeled");
|
||||
CPThemeStateBordered = CPThemeState("bordered");
|
||||
CPThemeStateEditable = CPThemeState("editable");
|
||||
|
||||
@@ -738,6 +738,13 @@ var themedButtonValues = nil,
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:51.0 / 255.0 alpha:1.0], CPThemeStateTableDataView],
|
||||
[@"text-color", [CPColor whiteColor], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView | CPThemeStateSelectedTableDataView],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:125.0 / 255.0 alpha:1.0], CPThemeStateTableDataView|CPThemeStateGroupRow],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:1.0 alpha:1.0], CPThemeStateTableDataView|CPThemeStateGroupRow|CPThemeStateSelectedTableDataView],
|
||||
[@"text-shadow-color", [CPColor whiteColor], CPThemeStateTableDataView|CPThemeStateGroupRow],
|
||||
[@"text-shadow-offset", CGSizeMake(0,1), CPThemeStateTableDataView|CPThemeStateGroupRow],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], CPThemeStateTableDataView|CPThemeStateGroupRow|CPThemeStateSelectedTableDataView],
|
||||
[@"font", [CPFont boldSystemFontOfSize:12.0], CPThemeStateTableDataView|CPThemeStateGroupRow]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedTextFieldValues forView:textfield];
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* ScrollPerformanceTest
|
||||
*
|
||||
* Created by You on August 27, 2010.
|
||||
* Copyright 2010, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)];
|
||||
|
||||
[tableView setAllowsMultipleSelection:YES];
|
||||
[tableView setAllowsColumnSelection:YES];
|
||||
[tableView setUsesAlternatingRowBackgroundColors:YES];
|
||||
|
||||
[tableView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
|
||||
[tableView setDelegate:self];
|
||||
[tableView setDataSource:self];
|
||||
|
||||
|
||||
var iconView = [[CPImageView alloc] initWithFrame:CGRectMake(16,16,0,0)];
|
||||
[iconView setImageScaling:CPScaleNone];
|
||||
var iconColumn = [[CPTableColumn alloc] initWithIdentifier:"icons"];
|
||||
[iconColumn setWidth:32.0];
|
||||
[iconColumn setMinWidth:32.0];
|
||||
[iconColumn setDataView:iconView];
|
||||
//[tableView addTableColumn:iconColumn];
|
||||
|
||||
iconImage = [[CPImage alloc] initWithContentsOfFile:"http://cappuccino.org/images/favicon.png" size:CGSizeMake(16,16)];
|
||||
|
||||
|
||||
for (var i = 1; i <= 5; i++)
|
||||
{
|
||||
var column = [[CPTableColumn alloc] initWithIdentifier:String(i)];
|
||||
|
||||
[[column headerView] setStringValue:"Number " + i];
|
||||
|
||||
[column setMaxWidth:500.0];
|
||||
[column setWidth:200.0];
|
||||
|
||||
[tableView addTableColumn:column];
|
||||
}
|
||||
|
||||
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]))];
|
||||
|
||||
[scrollView setDocumentView:tableView];
|
||||
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
[contentView addSubview:scrollView];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
}
|
||||
|
||||
- (int)numberOfRowsInTableView:(CPTableView)atableView
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
|
||||
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
|
||||
{
|
||||
if ([aColumn identifier] === "icons")
|
||||
return iconImage;
|
||||
|
||||
return aRow;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow
|
||||
{
|
||||
console.log("called: "+aRow);
|
||||
var groups = [];
|
||||
|
||||
for(var i = 0; i < 100; i+=5)
|
||||
groups.push(i);
|
||||
|
||||
return [groups containsObject:aRow];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPTableView (foo)
|
||||
- (void)_drawGroupRowsForRects:(CPArray)rects
|
||||
{
|
||||
if (_selectionHighlightStyle === CPTableViewSelectionHighlightStyleSourceList || !rects.length)
|
||||
return;
|
||||
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort],
|
||||
i = rects.length;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
|
||||
var gradientCache = [self selectionGradientColors],
|
||||
topLineColor = [CPColor colorWithHexString:"d3d3d3"],
|
||||
bottomLineColor = [CPColor colorWithHexString:"bebebd"],
|
||||
gradientColor = CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [220.0 / 255.0, 220.0 / 255.0, 220.0 / 255.0,1.0,
|
||||
199.0 / 255.0, 199.0 / 255.0, 199.0 / 255.0,1.0], [0,1], 2),
|
||||
drawGradient = YES;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
var rowRect = rects[i];
|
||||
|
||||
CGContextAddRect(context, rowRect);
|
||||
|
||||
if (drawGradient)
|
||||
{
|
||||
var minX = CGRectGetMinX(rowRect),
|
||||
minY = CGRectGetMinY(rowRect),
|
||||
maxX = CGRectGetMaxX(rowRect),
|
||||
maxY = CGRectGetMaxY(rowRect);
|
||||
|
||||
CGContextDrawLinearGradient(context, gradientColor, rowRect.origin, CGPointMake(minX, maxY), 0);
|
||||
CGContextClosePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, minY);
|
||||
CGContextAddLineToPoint(context, maxX, minY);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, topLineColor);
|
||||
CGContextStrokePath(context);
|
||||
|
||||
CGContextBeginPath(context);
|
||||
CGContextMoveToPoint(context, minX, maxY);
|
||||
CGContextAddLineToPoint(context, maxX, maxY - 1);
|
||||
CGContextClosePath(context);
|
||||
CGContextSetStrokeColor(context, bottomLineColor);
|
||||
CGContextStrokePath(context);
|
||||
}
|
||||
}
|
||||
|
||||
CGContextClosePath(context);
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CPApplicationDelegateClass</key>
|
||||
<string>AppController</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>ScrollPerformanceTest</string>
|
||||
<key>CPPrincipalClass</key>
|
||||
<string>CPApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* ScrollPerformanceTest
|
||||
*
|
||||
* Created by You on August 27, 2010.
|
||||
* Copyright 2010, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os");
|
||||
|
||||
app ("ScrollPerformanceTest", function(task)
|
||||
{
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "ScrollPerformanceTest.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("ScrollPerformanceTest");
|
||||
task.setIdentifier("com.yourcompany.ScrollPerformanceTest");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("ScrollPerformanceTest");
|
||||
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", ["ScrollPerformanceTest"], 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", "ScrollPerformanceTest", "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", "ScrollPerformanceTest", "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", "ScrollPerformanceTest"));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", "ScrollPerformanceTest"), FILE.join("Build", "Deployment", "ScrollPerformanceTest")]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", "ScrollPerformanceTest"));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "ScrollPerformanceTest"), FILE.join("Build", "Desktop", "ScrollPerformanceTest", "ScrollPerformanceTest.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", "ScrollPerformanceTest", "ScrollPerformanceTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, "ScrollPerformanceTest"));
|
||||
print("----------------------------");
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
ScrollPerformanceTest
|
||||
|
||||
Created by You on August 27, 2010.
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>ScrollPerformanceTest</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
|
||||
</script>
|
||||
|
||||
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading ScrollPerformanceTest...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html
|
||||
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<!--
|
||||
index.html
|
||||
ScrollPerformanceTest
|
||||
|
||||
Created by You on August 27, 2010.
|
||||
Copyright 2010, Your Company All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png" />
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png" />
|
||||
|
||||
<title>ScrollPerformanceTest</title>
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
body{margin:0; padding:0;}
|
||||
#container {position: absolute; top:50%; left:50%;}
|
||||
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
|
||||
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
|
||||
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
|
||||
</style>
|
||||
|
||||
<!--[if lt IE 7]>
|
||||
<STYLE type="text/css">
|
||||
#container { position: relative; top: 50%; }
|
||||
#content { position: relative;}
|
||||
</STYLE>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body style="">
|
||||
<div id="cappuccino-body">
|
||||
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
|
||||
<script type="text/javascript">
|
||||
document.write("<div id='container'><p id='content'>" +
|
||||
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
|
||||
"Loading ScrollPerformanceTest...</p></div>");
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<div id="container">
|
||||
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
|
||||
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
|
||||
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
|
||||
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
|
||||
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
|
||||
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
|
||||
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
|
||||
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
|
||||
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
|
||||
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* ScrollPerformanceTest
|
||||
*
|
||||
* Created by You on August 27, 2010.
|
||||
* Copyright 2010, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
Reference in New Issue
Block a user