From 45ebe2c905390d7170f3f65af095f85b121eac74 Mon Sep 17 00:00:00 2001 From: Paul Baumgart Date: Wed, 6 Oct 2010 23:04:00 -0700 Subject: [PATCH 1/6] Fix deprecation warnings --- AppKit/Themes/CommonJS/blendtask.j | 4 ++-- CommonJS/bin/flatten | 6 +++--- CommonJS/bin/ojdepcheck | 4 ++-- CommonJS/bin/press | 4 ++-- Jakefile | 4 ++-- Objective-J/CPLog.js | 2 +- Objective-J/CommonJS/bin/cplutil | 2 +- Objective-J/CommonJS/lib/objective-j.js | 2 +- Objective-J/CommonJS/lib/objective-j/jake/bundletask.js | 4 ++-- Objective-J/Jakefile | 2 +- Tools/capp/Generate.j | 6 +++--- Tools/nib2cib/main.j | 2 +- common.jake | 8 ++++---- 13 files changed, 25 insertions(+), 25 deletions(-) diff --git a/AppKit/Themes/CommonJS/blendtask.j b/AppKit/Themes/CommonJS/blendtask.j index 168fdbd8d..1cb7ee6f9 100644 --- a/AppKit/Themes/CommonJS/blendtask.j +++ b/AppKit/Themes/CommonJS/blendtask.j @@ -6,7 +6,7 @@ var FILE = require("file"), - TERM = require("term"), + TERM = require("narwhal/term"), task = require("jake").task, filedir = require("jake").filedir, BundleTask = require("objective-j/jake/bundletask").BundleTask; @@ -32,7 +32,7 @@ BlendTask.prototype.infoPlist = function() { var infoPlist = BundleTask.prototype.infoPlist.apply(this, arguments); - infoPlist.setValueForKey("CPKeyedThemes", require("util").unique(this._keyedThemes)); + infoPlist.setValueForKey("CPKeyedThemes", require("narwhal/util").unique(this._keyedThemes)); return infoPlist; } diff --git a/CommonJS/bin/flatten b/CommonJS/bin/flatten index f47fb1e19..7bf829451 100755 --- a/CommonJS/bin/flatten +++ b/CommonJS/bin/flatten @@ -8,12 +8,12 @@ require("narwhal").ensureEngine("rhino"); var FILE = require("file"); var OS = require("os"); -var UTIL = require("util"); +var UTIL = require("narwhal/util"); var CACHEMANIFEST = require("objective-j/cache-manifest"); -var stream = require("term").stream; -var parser = new (require("args").Parser)(); +var stream = require("narwhal/term").stream; +var parser = new (require("narwhal/args").Parser)(); parser.usage("INPUT_PROJECT OUTPUT_PROJECT"); parser.help("Combine a Cappuccino application into a single JavaScript file."); diff --git a/CommonJS/bin/ojdepcheck b/CommonJS/bin/ojdepcheck index a06f4f431..c373f6927 100755 --- a/CommonJS/bin/ojdepcheck +++ b/CommonJS/bin/ojdepcheck @@ -8,8 +8,8 @@ require("narwhal").ensureEngine("rhino"); var FILE = require("file"); -var stream = require("term").stream -var parser = new (require("args").Parser)(); +var stream = require("narwhal/term").stream +var parser = new (require("narwhal/args").Parser)(); parser.usage("INPUT_PROJECT"); parser.help("Checks a project for missing imports."); diff --git a/CommonJS/bin/press b/CommonJS/bin/press index 10b6dadf1..8d1b60025 100755 --- a/CommonJS/bin/press +++ b/CommonJS/bin/press @@ -12,8 +12,8 @@ var OS = require("os"); var CACHEMANIFEST = require("objective-j/cache-manifest"); -var stream = require("term").stream; -var parser = new (require("args").Parser)(); +var stream = require("narwhal/term").stream; +var parser = new (require("narwhal/args").Parser)(); parser.usage("INPUT_PROJECT OUTPUT_PROJECT"); parser.help("Analyze and strip unused files from a Cappuccino project's .sj bundles."); diff --git a/Jakefile b/Jakefile index 83ca1c030..8a103149d 100644 --- a/Jakefile +++ b/Jakefile @@ -4,9 +4,9 @@ require("./common.jake"); var FILE = require("file"), SYSTEM = require("system"), OS = require("os"), - UTIL = require("util"), + UTIL = require("narwhal/util"), jake = require("jake"), - stream = require("term").stream; + stream = require("narwhal/term").stream; var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"]; diff --git a/Objective-J/CPLog.js b/Objective-J/CPLog.js index dec1e0f06..3a9e863e4 100644 --- a/Objective-J/CPLog.js +++ b/Objective-J/CPLog.js @@ -182,7 +182,7 @@ GLOBAL(CPLogPrint) = function(aString, aLevel, aTitle, aFormatter) { if (stream === undefined) { try { - stream = require("term").stream; + stream = require("narwhal/term").stream; } catch (e) { stream = null; } diff --git a/Objective-J/CommonJS/bin/cplutil b/Objective-J/CommonJS/bin/cplutil index ceb11c71b..4d489ab0a 100755 --- a/Objective-J/CommonJS/bin/cplutil +++ b/Objective-J/CommonJS/bin/cplutil @@ -5,7 +5,7 @@ var FILE = require("file"), OS = require("os"), ObjectiveJ = require("objective-j"); -var parser = new (require("args").Parser)(); +var parser = new (require("narwhal/args").Parser)(); parser.usage("file..."); parser.help("Cappuccino plist converter."); diff --git a/Objective-J/CommonJS/lib/objective-j.js b/Objective-J/CommonJS/lib/objective-j.js index 444c47806..3bb275a27 100644 --- a/Objective-J/CommonJS/lib/objective-j.js +++ b/Objective-J/CommonJS/lib/objective-j.js @@ -23,7 +23,7 @@ var OBJJ_INCLUDE_PATHS = global.OBJJ_INCLUDE_PATHS = exports.OBJJ_INCLUDE_PATHS exports.objj_frameworks = []; exports.objj_debug_frameworks = []; -var catalog = require("packages").catalog; +var catalog = require("narwhal/packages").catalog; for (var name in catalog) { if (!catalog.hasOwnProperty(name)) diff --git a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js index 13e3d7a8b..e9cca5ee5 100644 --- a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js +++ b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js @@ -1,8 +1,8 @@ var FILE = require("file"), OS = require("os"), - UTIL = require("util"), - TERM = require("term"), + UTIL = require("narwhal/util"), + TERM = require("narwhal/term"), Jake = require("jake"), CLEAN = require("jake/clean").CLEAN, CLOBBER = require("jake/clean").CLOBBER, diff --git a/Objective-J/Jakefile b/Objective-J/Jakefile index 58f2de2db..1458c9210 100644 --- a/Objective-J/Jakefile +++ b/Objective-J/Jakefile @@ -24,7 +24,7 @@ require("../common.jake"); var FILE = require("file"), OS = require("os"), - stream = require("term").stream; + stream = require("narwhal/term").stream; //$BUILD_CONFIGURATION_DIR = "../Build" $BROWSER_FILE = FILE.join("Browser", "Objective-J.js"); diff --git a/Tools/capp/Generate.j b/Tools/capp/Generate.j index 0062ff735..e360500a0 100644 --- a/Tools/capp/Generate.j +++ b/Tools/capp/Generate.j @@ -6,9 +6,9 @@ var OS = require("os"), FILE = require("file"), OBJJ = require("objective-j"); -var stream = require("term").stream; +var stream = require("narwhal/term").stream; -var parser = new (require("args").Parser)(); +var parser = new (require("narwhal/args").Parser)(); parser.usage("DESTINATION_DIRECTORY"); @@ -63,7 +63,7 @@ parser.option("--list-frameworks", "listFrameworks") parser.helpful(); // FIXME: better way to do this: -var CAPP_HOME = require("packages").catalog["cappuccino"].directory; +var CAPP_HOME = require("narwhal/packages").catalog["cappuccino"].directory; var templatesDirectory = FILE.join(CAPP_HOME, "lib", "capp", "Resources", "Templates"); function gen(/*va_args*/) diff --git a/Tools/nib2cib/main.j b/Tools/nib2cib/main.j index ccb1a9f29..f718369a5 100644 --- a/Tools/nib2cib/main.j +++ b/Tools/nib2cib/main.j @@ -33,7 +33,7 @@ var FILE = require("file"); var OS = require("os"); -var parser = new (require("args").Parser)(); +var parser = new (require("narwhal/args").Parser)(); parser.usage("INPUT_FILE [OUTPUT_FILE]"); diff --git a/common.jake b/common.jake index 3607393e4..f9b755a80 100644 --- a/common.jake +++ b/common.jake @@ -1,8 +1,8 @@ var SYSTEM = require("system"); var FILE = require("file"); var OS = require("os"); -var UTIL = require("util"); -var stream = require("term").stream; +var UTIL = require("narwhal/util"); +var stream = require("narwhal/term").stream; var requiresSudo = false; @@ -15,7 +15,7 @@ function ensurePackageUpToDate(packageName, requiredVersion, options) { options = options || {}; - var packageInfo = require("packages").catalog[packageName]; + var packageInfo = require("narwhal/packages").catalog[packageName]; if (!packageInfo) { if (options.optional) @@ -163,7 +163,7 @@ function additionalPackages() // checks to see if a path is in the package catalog function packageInCatalog(path) { - var catalog = require("packages").catalog; + var catalog = require("narwhal/packages").catalog; for (var name in catalog) if (String(catalog[name].directory) === String(path)) return true; From 99201dc3db4ada36d8b59f9c26939d5ffc6cf002 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Fri, 8 Oct 2010 00:44:17 -0400 Subject: [PATCH 2/6] 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. --- AppKit/CPTableView.j | 147 ++++++++++++++++-- AppKit/CPTheme.j | 1 + AppKit/Themes/Aristo/ThemeDescriptors.j | 7 + .../TableTest/GroupRowTest/AppController.j | 144 +++++++++++++++++ .../Manual/TableTest/GroupRowTest/Info.plist | 12 ++ Tests/Manual/TableTest/GroupRowTest/Jakefile | 93 +++++++++++ .../GroupRowTest/Resources/spinner.gif | Bin 0 -> 1849 bytes .../TableTest/GroupRowTest/index-debug.html | 104 +++++++++++++ .../Manual/TableTest/GroupRowTest/index.html | 79 ++++++++++ Tests/Manual/TableTest/GroupRowTest/main.j | 18 +++ 10 files changed, 590 insertions(+), 15 deletions(-) create mode 100644 Tests/Manual/TableTest/GroupRowTest/AppController.j create mode 100644 Tests/Manual/TableTest/GroupRowTest/Info.plist create mode 100644 Tests/Manual/TableTest/GroupRowTest/Jakefile create mode 100644 Tests/Manual/TableTest/GroupRowTest/Resources/spinner.gif create mode 100644 Tests/Manual/TableTest/GroupRowTest/index-debug.html create mode 100644 Tests/Manual/TableTest/GroupRowTest/index.html create mode 100644 Tests/Manual/TableTest/GroupRowTest/main.j diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index f607581b0..c82daf67d 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -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 diff --git a/AppKit/CPTheme.j b/AppKit/CPTheme.j index a375b4f62..f930cb1ed 100644 --- a/AppKit/CPTheme.j +++ b/AppKit/CPTheme.j @@ -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"); diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index 76cc69b53..c74a23bee 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -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]; diff --git a/Tests/Manual/TableTest/GroupRowTest/AppController.j b/Tests/Manual/TableTest/GroupRowTest/AppController.j new file mode 100644 index 000000000..3c3f55c10 --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/AppController.j @@ -0,0 +1,144 @@ +/* + * AppController.j + * ScrollPerformanceTest + * + * Created by You on August 27, 2010. + * Copyright 2010, Your Company All rights reserved. + */ + +@import + + +@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 \ No newline at end of file diff --git a/Tests/Manual/TableTest/GroupRowTest/Info.plist b/Tests/Manual/TableTest/GroupRowTest/Info.plist new file mode 100644 index 000000000..481d76e99 --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/Info.plist @@ -0,0 +1,12 @@ + + + + + CPApplicationDelegateClass + AppController + CPBundleName + ScrollPerformanceTest + CPPrincipalClass + CPApplication + + diff --git a/Tests/Manual/TableTest/GroupRowTest/Jakefile b/Tests/Manual/TableTest/GroupRowTest/Jakefile new file mode 100644 index 000000000..6ba1b7c8b --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/Jakefile @@ -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("----------------------------"); +} diff --git a/Tests/Manual/TableTest/GroupRowTest/Resources/spinner.gif b/Tests/Manual/TableTest/GroupRowTest/Resources/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..06dbc2bc21dddcf0e09b566d5b211aee89570f52 GIT binary patch literal 1849 zcma*odr(tX9tZHtz31lM+(&Y`A`Ou`NeG&R#DrIfV%?hng21vs6v>ooRQQFbk7E_K!V( z{?5!fpZWgIZ%*d6t%i*j24bL}AZUJm9)h6R*;%L4IWse3G#VWaN1#$zSSXcBhlYlH zJ|D}n{r&w2f+Qp)SS*&n?*G4}{}!h?td_mjU6Kad-rW*QwWYCUk7d^e+sjpZAn6kT z5rM;`{~_}-wm+L@%+E;JphLm}C3WzQAQD0wBoY|rOTQX{(@pp-WAA8Iw0HKl|15j) zhGh(SFWu#5zUCw^T!}C~eC}~?{xG-r7ugQC>taC+|L^xr&a%{#cgUOZXIM&v?)k^2 z1i5%0!U00wq)r4vlAwXBA_m5J5WNeuBm-XJQ5pG4GD%vc|K){+TJ{AkHqN@SJKczX zU}QRd9n*_bf^h94)6Ctv{CUfz_;qs#RDuQ$DR%y1&5G-a6rhf*4Y zl+UOD1*GE{GQ7vv;c-tTIMkz0ovO>9j%b5hpa@a*CBJ#W!0@ndSwF|%hMkdFtXiU) z`BEp+yhkt8ZY>tg&uyH@%^%K4jDrbA;et&vnnzZ3z22@e6<27z2Vk13kb7OtISyxv z(XoO-LNQCZe3lfzc%*pNqU<9T+p~teThOEB+~e&U0mC|zS{Q)dJZ)!^1f7L(zg*L> z*vSW%?dR~@@0(}x6-V^A`~ImD;)NaBUnP8;RH=bS2@pk`wp>>8r&jGjmGPy%1BW}v zoPo}ca$~bze@efc3kapuEVW1!%teOZT3j2Tw5=hjiAf02d}7dL0oFC%@=RXp5Ow#% z@a>+AM|YWt$n&e`>sB-32gBcuTi>R>*|8@lp`y6thc7ydyqDsuUn~YzZf|{-R@-3y zL#wx{Ii}xxL_csiW*LBn0-A$>zp4WOmkf6=ilrjlW?-l9+bCd7|i?*b5NTmy<<6NZ0T8$SN@mwdC2f z6jqK=N@bS@!=YSj%>h0}*4p+%0HbTIrE$w7UMT6+AZZ&DAo*qZAAi(OtNbIfl#Dw^ zJWeiCp~zi#&t6x}m9)O^eR4HiLV3QA<<0>HZ8%$^lrSE94Wb}=+MM^!b>n#5&-JQR zkr-CEu9C;_F*7DqDisulV6Pmg$nFL0TPn%~*m^-`Z3^BgU(sNpnx%nW(!eV9A&FvI zHL3X3lw8Wji^6=8KbQDE-e%b?svdFxxdh$8r97@7$ojeI`6AL8Ob6QC$qh&>ZWVDX1F{0vJnT%%mE;GveKWR%C} zM&4d;Jf3s9|HAA)yVUPo`Aq;0do#)uHSXi5*QF*)x@MVVHr+cN)uMZ__F|&Ta#p8d z53TOKtce!PJUuie8UWol-S(`c2nH?UGqJP{!4RR4u$LCfn)q-hj0^f=h(VYy)T6eN zhRO!ja-aDBTcgeyP(8Ua4IdiOog^*CQa?R(cP#9AgL9`j>EX-6Yf1lzX(!~``M1XC zNmM<4<6d~wWZ$Xrk0K}UteTrq@LBBk#MsjkK;pbuVhe)NI7(7Pf(l?lxC7=1Z7Pzl zMbS;nV4NI5_N{1$P)&XC)huOGQ+h^zpYUZfb*1n6>!`#*b3y52LGmi+<4sY5jyD#- zw&$d}DTguLAfnRtjrM*JfqtHqUu6rQoU=g%1E9xk%;)TDm^2<8n-0IhTsQFaek)MY}>PK4;nBk=ow4pF>vzkO& gna%Org-kgQCf=+BeMi^RbuY;YE~rTjend;_cdi8t>i_@% literal 0 HcmV?d00001 diff --git a/Tests/Manual/TableTest/GroupRowTest/index-debug.html b/Tests/Manual/TableTest/GroupRowTest/index-debug.html new file mode 100644 index 000000000..a5adac35c --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/index-debug.html @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + ScrollPerformanceTest + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/TableTest/GroupRowTest/index.html b/Tests/Manual/TableTest/GroupRowTest/index.html new file mode 100644 index 000000000..3324fc6fd --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/index.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + ScrollPerformanceTest + + + + + + + + + + + + +
+
+ + + +
+
+ + + + diff --git a/Tests/Manual/TableTest/GroupRowTest/main.j b/Tests/Manual/TableTest/GroupRowTest/main.j new file mode 100644 index 000000000..48ff040f7 --- /dev/null +++ b/Tests/Manual/TableTest/GroupRowTest/main.j @@ -0,0 +1,18 @@ +/* + * AppController.j + * ScrollPerformanceTest + * + * Created by You on August 27, 2010. + * Copyright 2010, Your Company All rights reserved. + */ + +@import +@import + +@import "AppController.j" + + +function main(args, namedArgs) +{ + CPApplicationMain(args, namedArgs); +} From c72e136370854e97372a61de279c7e94c22642c5 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Thu, 14 Oct 2010 16:38:06 -0700 Subject: [PATCH 3/6] Require latest versions of all package to eliminate deprecation warnings. --- common.jake | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/common.jake b/common.jake index f9b755a80..19f58d1c5 100644 --- a/common.jake +++ b/common.jake @@ -39,7 +39,7 @@ function ensurePackageUpToDate(packageName, requiredVersion, options) if (!options.noupdate) { - print("Update? yes or no:"); + print("Update? Existing package will be overwritten. yes or no:"); if (!SYSTEM.env["CAPP_AUTO_UPGRADE"] && system.stdin.readLine() !== "yes\n") { print("Jake aborted."); @@ -58,25 +58,35 @@ function ensurePackageUpToDate(packageName, requiredVersion, options) else OS.system(["tusk", "install", "--force", packageName]); } - + + if (options.after) + { + options.after(packageInfo.directory); + } + if (options.message) { - print(options.message) + print(options.message); OS.exit(1); } } // UPDATE THESE TO PICK UP CORRESPONDING CHANGES IN DEPENDENCIES -ensurePackageUpToDate("jake", "0.1.5"); +ensurePackageUpToDate("jake", "0.3"); ensurePackageUpToDate("browserjs", "0.1.1"); ensurePackageUpToDate("shrinksafe", "0.2"); -ensurePackageUpToDate("narwhal", "0.2.2", { +ensurePackageUpToDate("narwhal", "0.3.1", { noupdate : true, - message : "Update Narwhal to 0.2.1 by running bootstrap.sh, or pulling the latest from git (see: http://github.com/280north/narwhal)." + message : "Update Narwhal by re-running bootstrap.sh, or pulling the latest from git (see: http://github.com/280north/narwhal)." }); -ensurePackageUpToDate("narwhal-jsc", "0.1.1", { +ensurePackageUpToDate("narwhal-jsc", "0.3", { optional : true, - message : "Rebuild narwhal-jsc by changing to the narwhal-jsc package directory and running \"make webkit\"." + after : function(dir) { + if (OS.system("cd " + OS.enquote(dir) + " && make webkit")) { + print("Problem building narwhal-jsc."); + OS.exit(1); + } + } }); var JAKE = require("jake"); From f0b527b680b24c07e2af198936537dcaf8c5a9a6 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Fri, 15 Oct 2010 01:52:22 -0400 Subject: [PATCH 4/6] Selection fixes for group rows in the tableview. --- AppKit/CPTableView.j | 44 ++++---- .../TableTest/GroupRowTest/AppController.j | 102 ++++++++---------- .../Manual/TableTest/GroupRowTest/Info.plist | 2 +- Tests/Manual/TableTest/GroupRowTest/Jakefile | 30 +++--- .../TableTest/GroupRowTest/index-debug.html | 6 +- .../Manual/TableTest/GroupRowTest/index.html | 6 +- 6 files changed, 87 insertions(+), 103 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index c82daf67d..639156bdb 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2666,7 +2666,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; } -- (void)highlightSelectionInClipRect:(CGRect)aRect +- (void)highlightSelectionInClipRect:(_CGRect)aRect { if (_selectionHighlightStyle === CPTableViewSelectionHighlightStyleNone) return; @@ -2723,21 +2723,27 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; { var currentIndex = indexes[count], rowRect = CGRectIntersection(objj_msgSend(self, rectSelector, currentIndex), aRect); - CGContextAddRect(context, rowRect); - var shouldUseGroupGradient = [_groupRows containsIndex:currentIndex]; - console.log(currentIndex, [_groupRows description], shouldUseGroupGradient); + // group rows get the same highlight style as other rows if they're source list... + if (!drawGradient) + var shouldUseGroupGradient = [_groupRows containsIndex:currentIndex]; if (drawGradient || shouldUseGroupGradient) { - //console.log("gradiant fill for row: " + currentIndex); var minX = _CGRectGetMinX(rowRect), minY = _CGRectGetMinY(rowRect), maxX = _CGRectGetMaxX(rowRect), maxY = _CGRectGetMaxY(rowRect) - deltaHeight; - // use a special selection gradient for group rows - + if (!drawGradient) + { + //If there is no source list gradient we need to close the selection path and fill it now + [normalSelectionHighlightColor setFill]; + CGContextClosePath(context); + CGContextFillPath(context); + CGContextBeginPath(context); + } + CGContextAddRect(context, rowRect); CGContextDrawLinearGradient(context, (shouldUseGroupGradient) ? gradientGroupColor : gradientColor, rowRect.origin, _CGPointMake(minX, maxY), 0); CGContextClosePath(context); @@ -2755,36 +2761,28 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; CGContextClosePath(context); CGContextSetStrokeColor(context, (shouldUseGroupGradient) ? bottomGroupLineColor : bottomLineColor); CGContextStrokePath(context); - CGContextClosePath(context); } else - { - CGContextClosePath(context); - //console.log("fill 1 for row:" + currentIndex); - [normalSelectionHighlightColor setFill]; - CGContextFillPath(context); - - } + CGContextAddRect(context, rowRect); } CGContextClosePath(context); - /*if (!drawGradient) + if (!drawGradient) { - console.log("fill 2 for row: " + currentIndex); [normalSelectionHighlightColor setFill]; CGContextFillPath(context); - }*/ + } CGContextBeginPath(context); var gridStyleMask = [self gridStyleMask]; for(var i = 0; i < count2; i++) { var rect = objj_msgSend(self, rectSelector, indexes[i]), - minX = CGRectGetMinX(rect) - 0.5, - maxX = CGRectGetMaxX(rect) - 0.5, - minY = CGRectGetMinY(rect) - 0.5, - maxY = CGRectGetMaxY(rect) - 0.5; + minX = _CGRectGetMinX(rect) - 0.5, + maxX = _CGRectGetMaxX(rect) - 0.5, + minY = _CGRectGetMinY(rect) - 0.5, + maxY = _CGRectGetMaxY(rect) - 0.5; if ([_selectedRowIndexes count] >= 1 && gridStyleMask & CPTableViewSolidVerticalGridLineMask) { @@ -2798,7 +2796,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; for (var c = firstExposedColumn; c < exposedColumnCount; c++) { var colRect = [self rectOfColumn:exposedColumnIndexes[c]], - colX = CGRectGetMaxX(colRect) + 0.5; + colX = _CGRectGetMaxX(colRect) + 0.5; CGContextMoveToPoint(context, colX, minY); CGContextAddLineToPoint(context, colX, maxY); diff --git a/Tests/Manual/TableTest/GroupRowTest/AppController.j b/Tests/Manual/TableTest/GroupRowTest/AppController.j index 3c3f55c10..1b9d493a9 100644 --- a/Tests/Manual/TableTest/GroupRowTest/AppController.j +++ b/Tests/Manual/TableTest/GroupRowTest/AppController.j @@ -1,6 +1,6 @@ /* * AppController.j - * ScrollPerformanceTest + * GroupRowTest * * Created by You on August 27, 2010. * Copyright 2010, Your Company All rights reserved. @@ -35,7 +35,7 @@ [iconColumn setWidth:32.0]; [iconColumn setMinWidth:32.0]; [iconColumn setDataView:iconView]; - //[tableView addTableColumn:iconColumn]; + [tableView addTableColumn:iconColumn]; iconImage = [[CPImage alloc] initWithContentsOfFile:"http://cappuccino.org/images/favicon.png" size:CGSizeMake(16,16)]; @@ -52,7 +52,48 @@ [tableView addTableColumn:column]; } - var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]))]; + var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]) / 2)]; + + [scrollView setDocumentView:tableView]; + [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; + + [contentView addSubview:scrollView]; + + tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)]; + + [tableView setAllowsMultipleSelection:YES]; + [tableView setAllowsColumnSelection:YES]; + + [tableView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle]; + [tableView setSelectionHighlightStyle:CPTableViewSelectionHighlightStyleSourceList]; + [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, CGRectGetHeight([contentView bounds]) / 2, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]) / 2)]; [scrollView setDocumentView:tableView]; [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; @@ -78,7 +119,6 @@ - (BOOL)tableView:(CPTableView)aTableView isGroupRow:(int)aRow { - console.log("called: "+aRow); var groups = []; for(var i = 0; i < 100; i+=5) @@ -88,57 +128,3 @@ } @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 \ No newline at end of file diff --git a/Tests/Manual/TableTest/GroupRowTest/Info.plist b/Tests/Manual/TableTest/GroupRowTest/Info.plist index 481d76e99..4b3910a3c 100644 --- a/Tests/Manual/TableTest/GroupRowTest/Info.plist +++ b/Tests/Manual/TableTest/GroupRowTest/Info.plist @@ -5,7 +5,7 @@ CPApplicationDelegateClass AppController CPBundleName - ScrollPerformanceTest + GroupRowTest CPPrincipalClass CPApplication diff --git a/Tests/Manual/TableTest/GroupRowTest/Jakefile b/Tests/Manual/TableTest/GroupRowTest/Jakefile index 6ba1b7c8b..082dcad38 100644 --- a/Tests/Manual/TableTest/GroupRowTest/Jakefile +++ b/Tests/Manual/TableTest/GroupRowTest/Jakefile @@ -1,6 +1,6 @@ /* * Jakefile - * ScrollPerformanceTest + * GroupRowTest * * Created by You on August 27, 2010. * Copyright 2010, Your Company All rights reserved. @@ -15,17 +15,17 @@ var ENV = require("system").env, configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", OS = require("os"); -app ("ScrollPerformanceTest", function(task) +app ("GroupRowTest", function(task) { - task.setBuildIntermediatesPath(FILE.join("Build", "ScrollPerformanceTest.build", configuration)); + task.setBuildIntermediatesPath(FILE.join("Build", "GroupRowTest.build", configuration)); task.setBuildPath(FILE.join("Build", configuration)); - task.setProductName("ScrollPerformanceTest"); - task.setIdentifier("com.yourcompany.ScrollPerformanceTest"); + task.setProductName("GroupRowTest"); + task.setIdentifier("com.yourcompany.GroupRowTest"); task.setVersion("1.0"); task.setAuthor("Your Company"); task.setEmail("feedback @nospam@ yourcompany.com"); - task.setSummary("ScrollPerformanceTest"); + task.setSummary("GroupRowTest"); task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**"))); task.setResources(new FileList("Resources/**")); task.setIndexFilePath("index.html"); @@ -37,7 +37,7 @@ app ("ScrollPerformanceTest", function(task) task.setCompilerFlags("-O"); }); -task ("default", ["ScrollPerformanceTest"], function() +task ("default", ["GroupRowTest"], function() { printResults(configuration); }); @@ -58,36 +58,36 @@ task ("release", function() task ("run", ["debug"], function() { - OS.system(["open", FILE.join("Build", "Debug", "ScrollPerformanceTest", "index.html")]); + OS.system(["open", FILE.join("Build", "Debug", "GroupRowTest", "index.html")]); }); task ("run-release", ["release"], function() { - OS.system(["open", FILE.join("Build", "Release", "ScrollPerformanceTest", "index.html")]); + OS.system(["open", FILE.join("Build", "Release", "GroupRowTest", "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")]); + FILE.mkdirs(FILE.join("Build", "Deployment", "GroupRowTest")); + OS.system(["press", "-f", FILE.join("Build", "Release", "GroupRowTest"), FILE.join("Build", "Deployment", "GroupRowTest")]); 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")); + FILE.mkdirs(FILE.join("Build", "Desktop", "GroupRowTest")); + require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "GroupRowTest"), FILE.join("Build", "Desktop", "GroupRowTest", "GroupRowTest.app")); printResults("Desktop") }); task ("run-desktop", ["desktop"], function() { - OS.system([FILE.join("Build", "Desktop", "ScrollPerformanceTest", "ScrollPerformanceTest.app", "Contents", "MacOS", "NativeHost"), "-i"]); + OS.system([FILE.join("Build", "Desktop", "GroupRowTest", "GroupRowTest.app", "Contents", "MacOS", "NativeHost"), "-i"]); }); function printResults(configuration) { print("----------------------------"); - print(configuration+" app built at path: "+FILE.join("Build", configuration, "ScrollPerformanceTest")); + print(configuration+" app built at path: "+FILE.join("Build", configuration, "GroupRowTest")); print("----------------------------"); } diff --git a/Tests/Manual/TableTest/GroupRowTest/index-debug.html b/Tests/Manual/TableTest/GroupRowTest/index-debug.html index a5adac35c..ff76f98ce 100644 --- a/Tests/Manual/TableTest/GroupRowTest/index-debug.html +++ b/Tests/Manual/TableTest/GroupRowTest/index-debug.html @@ -4,7 +4,7 @@