More capp_linting.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2010-12-09 13:45:29 -08:00
parent 3cda75986b
commit d69f46f7ee
32 changed files with 305 additions and 287 deletions
+6 -6
View File
@@ -459,7 +459,7 @@ CPOffState
if (supermenu)
[CPException raise:CPInvalidArgumentException
reason: @"Can't add submenu \"" + [aMenu title] + "\" to item \"" + [self title] + "\", because it is already submenu of \"" + [[aMenu supermenu] title] + "\""];
reason: @"Can't add submenu \"" + [aMenu title] + "\" to item \"" + [self title] + "\", because it is already submenu of \"" + [[aMenu supermenu] title] + "\""];
_submenu = aMenu;
@@ -592,7 +592,7 @@ CPControlKeyMask
return @"";
var string = _keyEquivalent.toUpperCase(),
needsShift = _keyEquivalentModifierMask & CPShiftKeyMask ||
needsShift = _keyEquivalentModifierMask & CPShiftKeyMask ||
(string === _keyEquivalent && _keyEquivalent.toLowerCase() !== _keyEquivalent.toUpperCase());
if (CPBrowserIsOperatingSystem(CPMacOperatingSystem))
@@ -791,12 +791,12 @@ CPControlKeyMask
- (id)copy
{
var item = [[CPMenuItem alloc] init];
// No point in going through accessors and doing lots of unnecessary state checking/updating
item._isSeparator = _isSeparator;
[item setTitle:_title];
[item setFont:_font];
[item setFont:_font];
[item setTarget:_target];
[item setAction:_action];
[item setEnabled:_isEnabled];
@@ -815,7 +815,7 @@ CPControlKeyMask
[item setIndentationLevel:_indentationLevel];
[item setToolTip:_toolTip];
[item setRepresentedObject:_representedObject];
return item;
}
+37 -38
View File
@@ -29,15 +29,14 @@ var _CPWindowViewResizeIndicatorImage = nil;
@implementation _CPWindowView : CPView
{
unsigned _styleMask;
CPImageView _resizeIndicator;
CGSize _resizeIndicatorOffset;
CPView _toolbarView;
CGSize _toolbarOffset;
// BOOL _isAnimatingToolbar;
CGRect _resizeFrame;
CGPoint _mouseDraggedPoint;
@@ -48,7 +47,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
if (self != [_CPWindowView class])
return;
_CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)];
}
@@ -75,14 +74,14 @@ var _CPWindowViewResizeIndicatorImage = nil;
- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask
{
self = [super initWithFrame:aFrame];
if (self)
{
_styleMask = aStyleMask;
_resizeIndicatorOffset = CGSizeMakeZero();
_toolbarOffset = CGSizeMakeZero();
}
return self;
}
@@ -107,14 +106,14 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
// FIXME: This should be better
var frame = [_resizeIndicator frame];
if (CGRectContainsPoint(frame, [self convertPoint:[anEvent locationInWindow] fromView:nil]))
return [self trackResizeWithEvent:anEvent];
}
if ([theWindow isMovableByWindowBackground])
[self trackMoveWithEvent:anEvent];
else
[super mouseDown:anEvent];
}
@@ -123,29 +122,29 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
var location = [anEvent locationInWindow],
type = [anEvent type];
if (type === CPLeftMouseUp)
return;
var theWindow = [self window];
if (type === CPLeftMouseDown)
{
var frame = [theWindow frame];
_resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(frame), CGRectGetHeight(frame));
}
else if (type === CPLeftMouseDragged)
{
var newSize = CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame));
{
var newSize = CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame));
if (theWindow._isSheet && theWindow._parentView && (theWindow._frame.size.width !== newSize.width))
[theWindow._parentView _setAttachedSheetFrameOrigin];
[theWindow setFrameSize:newSize];
[theWindow._parentView _setAttachedSheetFrameOrigin];
[theWindow setFrameSize:newSize];
}
[CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
@@ -161,10 +160,10 @@ var _CPWindowViewResizeIndicatorImage = nil;
visibleFrame = [[CPPlatformWindow primaryPlatformWindow] visibleFrame];
var minPointY = 0;
if([CPMenu menuBarVisible])
minPointY = [[CPApp mainMenu] menuBarHeight];
var restrictedPoint = CGPointMake(0, 0);
restrictedPoint.x = MIN(MAX(aPoint.x, -_frame.size.width + 4.0), CGRectGetMaxX(visibleFrame) - 4.0);
@@ -194,14 +193,14 @@ var _CPWindowViewResizeIndicatorImage = nil;
var theWindow = [self window],
frame = [theWindow frame],
location = [theWindow convertBaseToGlobal:[anEvent locationInWindow]],
origin = [self _pointWithinScreenFrame:CGPointMake(_CGRectGetMinX(frame) + (location.x - _mouseDraggedPoint.x),
origin = [self _pointWithinScreenFrame:CGPointMake(_CGRectGetMinX(frame) + (location.x - _mouseDraggedPoint.x),
_CGRectGetMinY(frame) + (location.y - _mouseDraggedPoint.y))];
[theWindow setFrameOrigin:origin];
_mouseDraggedPoint = [self _pointWithinScreenFrame:location];
}
[CPApp setTarget:self selector:@selector(trackMoveWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
}
@@ -211,9 +210,9 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
var size = [_CPWindowViewResizeIndicatorImage size],
boundsSize = [self frame].size;
_resizeIndicator = [[CPImageView alloc] initWithFrame:CGRectMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height, size.width, size.height)];
[_resizeIndicator setImage:_CPWindowViewResizeIndicatorImage];
[_resizeIndicator setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin];
@@ -236,15 +235,15 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
if (CGSizeEqualToSize(_resizeIndicatorOffset, anOffset))
return;
_resizeIndicatorOffset = anOffset;
if (!_resizeIndicator)
return;
var size = [_resizeIndicator frame].size,
boundsSize = [self frame].size;
[_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - anOffset.width, boundsSize.height - size.height - anOffset.height)];
}
@@ -280,7 +279,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
{
if (!_toolbarView || [_toolbarView isHidden])
return [self toolbarOffset].height;
return CGRectGetMaxY([_toolbarView frame]);
}
@@ -294,20 +293,20 @@ var _CPWindowViewResizeIndicatorImage = nil;
var theWindow = [self window],
bounds = [self bounds],
width = CGRectGetWidth(bounds);
if ([[theWindow toolbar] isVisible])
{
var toolbarView = [self toolbarView],
toolbarOffset = [self toolbarOffset];
[toolbarView setFrame:CGRectMake(toolbarOffset.width, toolbarOffset.height, width, CGRectGetHeight([toolbarView frame]))];
}
if ([self showsResizeIndicator])
{
var size = [_resizeIndicator frame].size,
boundsSize = [self bounds].size;
[_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height)];
}
}
@@ -317,11 +316,11 @@ var _CPWindowViewResizeIndicatorImage = nil;
var theWindow = [self window],
toolbar = [theWindow toolbar],
toolbarView = [toolbar _toolbarView];
if (_toolbarView !== toolbarView)
{
[_toolbarView removeFromSuperview];
if (toolbarView)
{
[toolbarView removeFromSuperview];
@@ -329,7 +328,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
[self addSubview:toolbarView];
}
_toolbarView = toolbarView;
}
+23 -23
View File
@@ -31,7 +31,7 @@ function CFHashCode(aCFObject)
{
if (!aCFObject.hash)
aCFObject.hash = ++CFTypeGlobalCount;
return aCFObject;
}
@@ -47,7 +47,7 @@ function CGColorGetConstantColor(aColorName)
}
/*!
This function is for source compatability.
This function is for source compatability.
*/
function CGColorRetain(aColor)
{
@@ -55,7 +55,7 @@ function CGColorRetain(aColor)
}
/*!
This function is for source compatability.
This function is for source compatability.
*/
function CGColorRelease()
{
@@ -74,14 +74,14 @@ function CGColorCreate(aColorSpace, components)
return NULL;
var components = components.slice();
CGColorSpaceStandardizeComponents(aColorSpace, components);
var UID = CFHashCode(aColorSpace) + components.join("");
if (_CGColorMap[UID])
return _CGColorMap[UID];
return _CGColorMap[UID] = { colorspace:aColorSpace, pattern:NULL, components:components };
}
@@ -150,9 +150,9 @@ function CGColorCreateGenericCMYK(cyan, magenta, yellow, black, alpha)
function CGColorCreateCopyWithAlpha(aColor, anAlpha)
{
var components = aColor.components;
if (!aColor || anAlpha == components[components.length - 1])
return aColor;
return aColor;
if (aColor.pattern)
var copy = CGColorCreateWithPattern(aColor.colorspace, aColor.pattern, components);
@@ -160,7 +160,7 @@ function CGColorCreateCopyWithAlpha(aColor, anAlpha)
var copy = CGColorCreate(aColor.colorspace, components);
copy.components[components.length - 1] = anAlpha;
return copy;
}
@@ -191,7 +191,7 @@ function CGColorEqualToColor(lhs, rhs)
{
if (lhs == rhs)
return true;
if (!lhs || !rhs)
return false;
@@ -201,17 +201,17 @@ function CGColorEqualToColor(lhs, rhs)
if (lhsComponentCount != rhsComponents.length)
return false;
while (lhsComponentCount--)
while (lhsComponentCount--)
if (lhsComponents[lhsComponentCount] != rhsComponents[lhsComponentCount])
return false;
if (lhs.pattern != rhs.pattern)
return false;
if (CGColorSpaceEqualToColorSpace(lhs.colorspace, rhs.colorspace))
return false;
return true;
}
@@ -224,7 +224,7 @@ function CGColorEqualToColor(lhs, rhs)
function CGColorGetAlpha(aColor)
{
var components = aColor.components;
return components[components.length - 1];
}
@@ -273,13 +273,13 @@ function CGColorGetPattern(aColor)
}
/* var components = aColor.components;
case : _CGCSSForColor[CFGetHash(aColor)] = "rgba(" + ROUND(components[0] * 255.0) + ',' + ROUND(components[0] * 255.0) + ',' ROUND(components[0] * 255.0) + ',' + ROUND(components[0] * 255.0);
_cssString = (hasAlpha ? "rgba(" : "rgb(") +
parseInt(_components[0] * 255.0) + ", " +
parseInt(_components[1] * 255.0) + ", " +
parseInt(_components[2] * 255.0) +
(hasAlpha ? (", " + _components[3]) : "") + ")";
_cssString = (hasAlpha ? "rgba(" : "rgb(") +
parseInt(_components[0] * 255.0) + ", " +
parseInt(_components[1] * 255.0) + ", " +
parseInt(_components[2] * 255.0) +
(hasAlpha ? (", " + _components[3]) : "") + ")";
function CFStringFromColor()
{
+26 -26
View File
@@ -27,7 +27,7 @@
kCGLineCapButt = 0;
kCGLineCapRound = 1;
kCGLineCapRound = 1;
kCGLineCapSquare = 2;
kCGLineJoinMiter = 0;
@@ -114,8 +114,8 @@ if (!CPFeatureIsCompatible(CPHTMLCanvasFeature))
*/
function CGGStateCreate()
{
return { alpha:1.0, strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
blendMode:kCGBlendModeNormal,
return { alpha:1.0, strokeStyle:"#000", fillStyle:"#ccc", lineWidth:1.0, lineJoin:kCGLineJoinMiter, lineCap:kCGLineCapButt, miterLimit:10.0, globalAlpha:1.0,
blendMode:kCGBlendModeNormal,
shadowOffset:_CGSizeMakeZero(), shadowBlur:0.0, shadowColor:NULL, CTM:_CGAffineTransformMakeIdentity() };
}
@@ -126,9 +126,9 @@ function CGGStateCreate()
*/
function CGGStateCreateCopy(aGState)
{
return { alpha:aGState.alpha, strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
lineJoin:aGState.lineJoin, lineCap:aGState.lineCap, miterLimit:aGState.miterLimit, globalAlpha:aGState.globalAlpha,
blendMode:aGState.blendMode,
return { alpha:aGState.alpha, strokeStyle:aGState.strokeStyle, fillStyle:aGState.fillStyle, lineWidth:aGState.lineWidth,
lineJoin:aGState.lineJoin, lineCap:aGState.lineCap, miterLimit:aGState.miterLimit, globalAlpha:aGState.globalAlpha,
blendMode:aGState.blendMode,
shadowOffset:aGState.shadowOffset, shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:_CGAffineTransformMakeCopy(aGState.CTM) };
}
@@ -256,10 +256,10 @@ function CGContextAddPath(aContext, aPath)
{
if (!aContext || CGPathIsEmpty(aPath))
return;
if (!aContext.path)
aContext.path = CGPathCreateMutable();
CGPathAddPath(aContext.path, aContext.gState.CTM, aPath);
}
@@ -332,7 +332,7 @@ function CGContextMoveToPoint(aContext, x, y)
{
if (!aContext.path)
aContext.path = CGPathCreateMutable();
CGPathMoveToPoint(aContext.path, aContext.gState.CTM, x, y);
}
@@ -358,11 +358,11 @@ function CGContextFillRects(aContext, rects, count)
{
if (arguments[2] === undefined)
var count = rects.length;
CGContextBeginPath(aContext);
CGContextAddRects(aContext, rects, count);
CGContextClosePath(aContext);
CGContextDrawPath(aContext, kCGPathFill);
}
@@ -373,11 +373,11 @@ function CGContextFillRects(aContext, rects, count)
@return void
*/
function CGContextStrokeRect(aContext, aRect)
{
{
CGContextBeginPath(aContext);
CGContextAddRect(aContext, aRect);
CGContextClosePath(aContext);
CGContextDrawPath(aContext, kCGPathStroke);
}
@@ -391,10 +391,10 @@ function CGContextStrokeRect(aContext, aRect)
function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
{
CGContextSaveGState(aContext);
CGContextSetLineWidth(aContext, aWidth);
CGContextStrokeRect(aContext, aRect);
CGContextRestoreGState(aContext);
}
@@ -407,7 +407,7 @@ function CGContextStrokeRectWithWidth(aContext, aRect, aWidth)
function CGContextConcatCTM(aContext, aTransform)
{
var CTM = aContext.gState.CTM;
_CGAffineTransformConcatTo(CTM, aTransform, CTM);
}
@@ -431,7 +431,7 @@ function CGContextGetCTM(aContext)
function CGContextRotateCTM(aContext, anAngle)
{
var gState = aContext.gState;
gState.CTM = CGAffineTransformRotate(gState.CTM, anAngle);
}
@@ -445,7 +445,7 @@ function CGContextRotateCTM(aContext, anAngle)
function CGContextScaleCTM(aContext, sx, sy)
{
var gState = aContext.gState;
gState.CTM = _CGAffineTransformScale(gState.CTM, sx, sy);
}
@@ -459,7 +459,7 @@ function CGContextScaleCTM(aContext, sx, sy)
function CGContextTranslateCTM(aContext, tx, ty)
{
var gState = aContext.gState;
gState.CTM = _CGAffineTransformTranslate(gState.CTM, tx, ty);
}
@@ -474,7 +474,7 @@ function CGContextTranslateCTM(aContext, tx, ty)
function CGContextSetShadow(aContext, aSize, aBlur)
{
var gState = aContext.gState;
gState.shadowOffset = _CGSizeMakeCopy(aSize);
gState.shadowBlur = aBlur;
gState.shadowColor = [CPColor shadowColor];
@@ -491,7 +491,7 @@ function CGContextSetShadow(aContext, aSize, aBlur)
function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor)
{
var gState = aContext.gState;
gState.shadowOffset = _CGSizeMakeCopy(aSize);
gState.shadowBlur = aBlur;
gState.shadowColor = aColor;
@@ -605,10 +605,10 @@ function CGContextStrokePath(aContext)
function CGContextStrokeLineSegments(aContext, points, count)
{
var i = 0;
if (arguments["count"] == NULL)
var count = points.length;
CGContextBeginPath(aContext);
for (; i < count; i += 2)
@@ -616,7 +616,7 @@ function CGContextStrokeLineSegments(aContext, points, count)
CGContextMoveToPoint(aContext, points[i].x, points[i].y);
CGContextAddLineToPoint(aContext, points[i + 1].x, points[i + 1].y);
}
CGContextStrokePath(aContext);
}
@@ -681,12 +681,12 @@ function CGContextFillRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, s
function CGContextStrokeRoundedRectangleInRect(aContext, aRect, aRadius, ne, se, sw, nw)
{
CGContextBeginPath(aContext);
CGContextAddPath(aContext, CGPathWithRoundedRectangleInRect(aRect, aRadius, aRadius, ne, se, sw, nw));
CGContextAddPath(aContext, CGPathWithRoundedRectangleInRect(aRect, aRadius, aRadius, ne, se, sw, nw));
CGContextClosePath(aContext);
CGContextStrokePath(aContext);
}
/*!
/*!
@}
*/
+44 -43
View File
@@ -267,21 +267,21 @@ var KAPPA = 4.0 * ((SQRT2 - 1.0) / 3.0);
function CGPathWithEllipseInRect(aRect)
{
var path = CGPathCreateMutable();
if (_CGRectGetWidth(aRect) == _CGRectGetHeight(aRect))
if (_CGRectGetWidth(aRect) == _CGRectGetHeight(aRect))
CGPathAddArc(path, nil, _CGRectGetMidX(aRect), _CGRectGetMidY(aRect), _CGRectGetWidth(aRect) / 2.0, 0.0, 2 * PI, YES);
else
{
var axis = _CGSizeMake(_CGRectGetWidth(aRect) / 2.0, _CGRectGetHeight(aRect) / 2.0),
center = _CGPointMake(_CGRectGetMinX(aRect) + axis.width, _CGRectGetMinY(aRect) + axis.height);
else
{
var axis = _CGSizeMake(_CGRectGetWidth(aRect) / 2.0, _CGRectGetHeight(aRect) / 2.0),
center = _CGPointMake(_CGRectGetMinX(aRect) + axis.width, _CGRectGetMinY(aRect) + axis.height);
CGPathMoveToPoint(path, nil, center.x, center.y - axis.height);
CGPathAddCurveToPoint(path, nil, center.x + (KAPPA * axis.width), center.y - axis.height, center.x + axis.width, center.y - (KAPPA * axis.height), center.x + axis.width, center.y);
CGPathAddCurveToPoint(path, nil, center.x + axis.width, center.y + (KAPPA * axis.height), center.x + (KAPPA * axis.width), center.y + axis.height, center.x, center.y + axis.height);
CGPathAddCurveToPoint(path, nil, center.x - (KAPPA * axis.width), center.y + axis.height, center.x - axis.width, center.y + (KAPPA * axis.height), center.x - axis.width, center.y);
CGPathAddCurveToPoint(path, nil, center.x - axis.width, center.y - (KAPPA * axis.height), center.x - (KAPPA * axis.width), center.y - axis.height, center.x, center.y - axis.height);
}
CGPathAddCurveToPoint(path, nil, center.x + (KAPPA * axis.width), center.y - axis.height, center.x + axis.width, center.y - (KAPPA * axis.height), center.x + axis.width, center.y);
CGPathAddCurveToPoint(path, nil, center.x + axis.width, center.y + (KAPPA * axis.height), center.x + (KAPPA * axis.width), center.y + axis.height, center.x, center.y + axis.height);
CGPathAddCurveToPoint(path, nil, center.x - (KAPPA * axis.width), center.y + axis.height, center.x - axis.width, center.y + (KAPPA * axis.height), center.x - axis.width, center.y);
CGPathAddCurveToPoint(path, nil, center.x - axis.width, center.y - (KAPPA * axis.height), center.x - (KAPPA * axis.width), center.y - axis.height, center.x, center.y - axis.height);
}
CGPathCloseSubpath(path);
@@ -297,37 +297,38 @@ function CGPathWithRoundedRectangleInRect(aRect, xRadius, yRadius/*not currently
yMax = _CGRectGetMaxY(aRect);
CGPathMoveToPoint(path, nil, xMin + xRadius, yMin);
if (ne)
{
CGPathAddLineToPoint(path, nil, xMax - xRadius, yMin);
CGPathAddCurveToPoint(path, nil, xMax - xRadius, yMin, xMax, yMin, xMax, yMin + xRadius);
}
else
CGPathAddLineToPoint(path, nil, xMax, yMin);
if (se)
{
CGPathAddLineToPoint(path, nil, xMax, yMax - xRadius);
CGPathAddCurveToPoint(path, nil, xMax, yMax - xRadius, xMax, yMax, xMax - xRadius, yMax);
}
else
CGPathAddLineToPoint(path, nil, xMax, yMax);
if (sw)
{
CGPathAddLineToPoint(path, nil, xMin + xRadius, yMax);
CGPathAddCurveToPoint(path, nil, xMin + xRadius, yMax, xMin, yMax, xMin, yMax - xRadius);
}
else
CGPathAddLineToPoint(path, nil, xMin, yMax);
if (nw)
{
CGPathAddLineToPoint(path, nil, xMin, yMin + xRadius);
CGPathAddCurveToPoint(path, nil, xMin, yMin + xRadius, xMin, yMin, xMin + xRadius, yMin);
} else
CGPathAddLineToPoint(path, nil, xMin, yMin);
if (ne)
{
CGPathAddLineToPoint(path, nil, xMax - xRadius, yMin);
CGPathAddCurveToPoint(path, nil, xMax - xRadius, yMin, xMax, yMin, xMax, yMin + xRadius);
}
else
CGPathAddLineToPoint(path, nil, xMax, yMin);
if (se)
{
CGPathAddLineToPoint(path, nil, xMax, yMax - xRadius);
CGPathAddCurveToPoint(path, nil, xMax, yMax - xRadius, xMax, yMax, xMax - xRadius, yMax);
}
else
CGPathAddLineToPoint(path, nil, xMax, yMax);
if (sw)
{
CGPathAddLineToPoint(path, nil, xMin + xRadius, yMax);
CGPathAddCurveToPoint(path, nil, xMin + xRadius, yMax, xMin, yMax, xMin, yMax - xRadius);
}
else
CGPathAddLineToPoint(path, nil, xMin, yMax);
if (nw)
{
CGPathAddLineToPoint(path, nil, xMin, yMin + xRadius);
CGPathAddCurveToPoint(path, nil, xMin, yMin + xRadius, xMin, yMin, xMin + xRadius, yMin);
}
else
CGPathAddLineToPoint(path, nil, xMin, yMin);
CGPathCloseSubpath(path);
+2 -2
View File
@@ -37,8 +37,8 @@
+ (id)alloc
{
var result = new CFMutableData();
result.isa = [self class];
return result;
result.isa = [self class];
return result;
}
+ (CPData)data
+2 -2
View File
@@ -39,8 +39,8 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
+ (id)alloc
{
var result = new Date;
result.isa = [self class];
var result = new Date;
result.isa = [self class];
return result;
}
+3 -3
View File
@@ -196,7 +196,7 @@ _cappdefaultDcmHandler = [CPDecimalNumberHandler decimalNumberHandlerWithRoundin
{
if (self = [self init])
{
if( flag )
if (flag)
mantissa *= -1;
_data = CPDecimalMakeWithParts(mantissa, exponent);
@@ -259,7 +259,7 @@ _cappdefaultDcmHandler = [CPDecimalNumberHandler decimalNumberHandlerWithRoundin
{
var s = @"",
i = 0;
for(;i < CPDecimalMaxDigits; i++)
for (;i < CPDecimalMaxDigits; i++)
s += "9";
s += "e" + CPDecimalMaxExponent;
return [[self alloc] initWithString:s];
@@ -269,7 +269,7 @@ _cappdefaultDcmHandler = [CPDecimalNumberHandler decimalNumberHandlerWithRoundin
{
var s = @"-",
i = 0;
for(;i < CPDecimalMaxDigits; i++)
for (;i < CPDecimalMaxDigits; i++)
s += "9";
s += "e" + CPDecimalMinExponent;
return [[self alloc] initWithString:s];
+2 -2
View File
@@ -84,8 +84,8 @@
*/
+ (id)alloc
{
var result = new CFMutableDictionary();
result.isa = [self class];
var result = new CFMutableDictionary();
result.isa = [self class];
return result;
}
+1 -1
View File
@@ -85,7 +85,7 @@
if (anObject === self)
return YES;
if([anObject class] !== [CPIndexPath class])
if ([anObject class] !== [CPIndexPath class])
return NO;
return [_indexes isEqualToArray:[anObject indexes]];
+4 -2
View File
@@ -115,7 +115,8 @@ function CPLocationInRange(aLocation, aRange)
function CPUnionRange(lhsRange, rhsRange)
{
var location = MIN(lhsRange.location, rhsRange.location);
return CPMakeRange(location, MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location);
return CPMakeRange(location, MAX(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location);
}
/*!
@@ -127,10 +128,11 @@ function CPUnionRange(lhsRange, rhsRange)
*/
function CPIntersectionRange(lhsRange, rhsRange)
{
if(CPMaxRange(lhsRange) < rhsRange.location || CPMaxRange(rhsRange) < lhsRange.location)
if (CPMaxRange(lhsRange) < rhsRange.location || CPMaxRange(rhsRange) < lhsRange.location)
return CPMakeRange(0, 0);
var location = MAX(lhsRange.location, rhsRange.location);
return CPMakeRange(location, MIN(CPMaxRange(lhsRange), CPMaxRange(rhsRange)) - location);
}
+24 -24
View File
@@ -72,12 +72,12 @@
- (id)copy
{
var copy = [[CPScanner alloc] initWithString:[self string]];
[copy setCharactersToBeSkipped:[self charactersToBeSkipped]];
[copy setCaseSensitive:[self caseSensitive]];
[copy setLocale:[self locale]];
[copy setScanLocation:[self scanLocation]];
return copy;
}
@@ -179,14 +179,14 @@
{
if ([self isAtEnd])
return nil;
var current = [self scanLocation];
var str = nil;
while (current < _string.length)
{
var c = (_string.charAt(current));
if ([scanSet characterIsMember:c] == stop)
break;
@@ -196,13 +196,13 @@
str = '';
str += c;
}
current++;
}
if (str)
[self setScanLocation:current];
return str;
}
@@ -215,15 +215,15 @@
var current = [self scanLocation];
var string = [self string];
var toSkip = [self charactersToBeSkipped];
while (current < string.length)
{
if (![toSkip characterIsMember:string.charAt(current)])
break;
current++;
}
[self setScanLocation:current];
}
@@ -265,22 +265,22 @@
var currentStr = str.substr(current, s.length);
if (currentStr == s || (!_caseSensitive && currentStr.toLowerCase() == s.toLowerCase()))
break;
if (!captured)
captured = '';
captured += str.charAt(current);
current++;
}
if (captured)
[self setScanLocation:current];
// evil private method use!
// this method is defined in the category on CPString
// in CPCharacterSet.j
if ([self charactersToBeSkipped])
captured = [captured _stringByTrimmingCharactersInSet:[self charactersToBeSkipped] options:_CPCharacterSetTrimAtBeginning];
return captured;
}
@@ -292,10 +292,10 @@
{
[self _movePastCharactersToBeSkipped];
var str = [self string], current = [self scanLocation];
if ([self isAtEnd])
return 0;
var s = str.substring(current, str.length);
var f = parseFloat(s); // wont work with non . decimal separator !!
if (f)
@@ -303,16 +303,16 @@
var pos, foundDash = NO;
/*
var decimalSeparatorString;
if(_locale != nil)
if (_locale != nil)
decimalSeparatorString = [_locale objectForKey:CPLocaleDecimalSeparator];
else
decimalSeparatorString = [[CPLocale systemLocale] objectForKey:CPLocaleDecimalSeparator];
var separatorCode = (decimalSeparatorString.length >0) decimalSeparatorString.charCodeAt(0) : 45;
*/
var separatorCode = 45;
for(pos = current; pos < current + str.length; pos++)
for (pos = current; pos < current + str.length; pos++)
{
var charCode = str.charCodeAt(pos);
if (charCode == separatorCode)
@@ -324,11 +324,11 @@
else if (charCode < 48 || charCode > 57 || (charCode == 45 && pos != current)) // not a digit or a "-" but not prefix
break;
}
[self setScanLocation:pos];
return f;
}
return nil;
}
@@ -357,11 +357,11 @@
else if (charCode < 48 || charCode > 57 || (charCode == 45 && pos != current))
break;
}
[self setScanLocation:pos];
return i;
}
return nil;
}
+2 -2
View File
@@ -152,8 +152,8 @@
{
if (self = [self init])
{
var argLength = arguments.length,
i = 2;
var argLength = arguments.length,
i = 2;
for (; i < argLength && (argument = arguments[i]) != nil; ++i)
[self addObject:argument];
+4 -3
View File
@@ -485,7 +485,7 @@ var CPStringRegexSpecialCharacters = [
rhs = rhs.toLowerCase();
}
if(aMask & CPDiacriticInsensitiveSearch)
if (aMask & CPDiacriticInsensitiveSearch)
{
lhs = lhs.stripDiacritics();
rhs = rhs.stripDiacritics();
@@ -493,7 +493,8 @@ var CPStringRegexSpecialCharacters = [
if (lhs < rhs)
return CPOrderedAscending;
else if (lhs > rhs)
if (lhs > rhs)
return CPOrderedDescending;
return CPOrderedSame;
@@ -818,7 +819,7 @@ String.prototype.stripDiacritics = function ()
{
var drange = diacritics[i];
if (code >= drange[0] && code <= drange[drange.length-1])
if (code >= drange[0] && code <= drange[drange.length - 1])
{
code = normalized[i];
break;
+4 -4
View File
@@ -55,8 +55,8 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
+ (id)alloc
{
var result = new CFURL();
result.isa = [self class];
return result;
result.isa = [self class];
return result;
}
- (id)init
@@ -84,8 +84,8 @@ CPURLCustomIconKey = @"CPURLCustomIconKey";
- (id)initWithString:(CPString)URLString relativeToURL:(CPURL)aBaseURL
{
var result = new CFURL(URLString, aBaseURL);
result.isa = [self class];
return result;
result.isa = [self class];
return result;
}
+ (id)URLWithString:(CPString)URLString relativeToURL:(CPURL)aBaseURL
+4 -2
View File
@@ -11,7 +11,7 @@
- (void)setUp
{
treeNode = [CPTreeNode treeNodeWithRepresentedObject:nil];
childNode = [CPTreeNode treeNodeWithRepresentedObject:nil];
[treeNode insertObject:childNode inChildNodesAtIndex:0];
}
@@ -19,9 +19,11 @@
- (void)testDescendantNodeAtIndexPath
{
var indexPath = [CPIndexPath indexPathWithIndex:0];
[self assert:childNode equals:[treeNode descendantNodeAtIndexPath:indexPath]];
indexPath = [CPIndexPath indexPathWithIndex:1];
[self assert:undefined equals:[treeNode descendantNodeAtIndexPath:indexPath]];
}
+27 -13
View File
@@ -3,6 +3,7 @@
@import <Foundation/CPNumber.j>
@import <Foundation/CPSortDescriptor.j>
var ELEMENTS = 100,
REPEATS = 10;
@@ -19,15 +20,16 @@ var ELEMENTS = 100,
var start = (new Date).getTime();
for (var i=0; i<REPEATS; i++)
for (var i = 0; i < REPEATS; ++i)
{
var sorted = [array sortedArrayUsingDescriptors:descriptors];
[self checkSorted:sorted];
}
var end = (new Date).getTime();
CPLog.warn(_cmd+": "+(end-start)+"ms");
CPLog.warn(_cmd + ": " + (end - start) + "ms");
}
- (void)testSortUsingNativeSort
@@ -38,47 +40,59 @@ var ELEMENTS = 100,
[CPSortDescriptor sortDescriptorWithKey:"a" ascending:NO],
[CPSortDescriptor sortDescriptorWithKey:"b" ascending:YES]
];
function sortFunction(lhs, rhs) {
function sortFunction(lhs, rhs)
{
return ([lhs a] === [rhs a]) ? ([lhs b] - [rhs b]) : ([rhs a] - [lhs a]);
}
var start = (new Date).getTime();
for (var i=0; i<REPEATS; i++)
for (var i = 0; i < REPEATS; ++i)
{
var sorted = [array copy];
sorted.sort(sortFunction)
[self checkSorted:sorted];
}
var end = (new Date).getTime();
CPLog.warn(_cmd+": "+(end-start)+"ms");
CPLog.warn(_cmd+": " + (end - start) + "ms");
}
- (CPArray)makeUnsorted
{
var array = [];
for (var i=0; i<ELEMENTS; i++) {
for (var i=0; i < ELEMENTS; ++i)
{
var s = [Sortable new];
[s setA:(i % 5)];
[s setB:(ELEMENTS-i)];
[s setB:(ELEMENTS - i)];
array.push(s);
}
return array;
}
- (void)checkSorted:(CPArray)sorted
{
// Verify it really got sorted.
for (var j=0; j<ELEMENTS; j++) {
for (var j=0; j < ELEMENTS; ++j)
{
var expectedA = 4-FLOOR(j * 5 / ELEMENTS);
if (sorted[j].a != expectedA)
[self fail:"a out of order: "+expectedA+" != "+sorted[j].a];
var expectedB = (5-expectedA) + 5 * (j % (ELEMENTS / 5))
[self fail:"a out of order: " + expectedA + " != " + sorted[j].a];
var expectedB = (5 - expectedA) + 5 * (j % (ELEMENTS / 5));
if (sorted[j].b != expectedB)
[self fail:"b out of order: "+expectedB+" != "+sorted[j].b];
[self fail:"b out of order: " + expectedB + " != " + sorted[j].b];
}
}
@@ -90,4 +104,4 @@ var ELEMENTS = 100,
int b @accessors;
}
@end
@end
+3 -3
View File
@@ -83,9 +83,9 @@
- (void)testRemoveObjectsAtIndexes
{
var array = [CPMutableArray arrayWithObjects:@"one", @"two", @"three", @"four", nil],
indexes = [CPMutableIndexSet indexSetWithIndex: 2];
indexes = [CPMutableIndexSet indexSetWithIndex: 2];
[array removeObjectsAtIndexes: indexes];
[array removeObjectsAtIndexes:indexes];
[self assert:array equals:[@"one", @"two", @"four", nil]];
}
@@ -425,7 +425,7 @@
- (CPArray)arrayByReversingArray
{
var a = [];
for (i = length - 1; i>0; --i)
for (i = length - 1; i > 0; --i)
a.push(self[i]);
return a;
+2 -2
View File
@@ -68,9 +68,9 @@
"key2": "This is a string",
"key3": null
}
var dict = [CPDictionary dictionaryWithJSObject:json_with_nulls recursively:YES];
[self assert:3 equals:[dict count]];
[self assert:[@"key1", @"key2", @"key3"] equals:[dict allKeys]];
[self assert:[CPNull null] equals:[dict objectForKey:@"key3"]];
+1 -1
View File
@@ -2,7 +2,7 @@
@implementation CPFormatterTest : OJTestCase
- (void)testThatCPFormatterIsConstructed
- (void)testThatCPFormatterIsConstructed
{
[self assertNotNull:[[CPFormatter alloc] init]];
}
+2 -3
View File
@@ -7,13 +7,12 @@
- (void)testImplementsSelector
{
var receiver = [[Receiver alloc] init];
[self assertTrue:[receiver implementsSelector:@selector(implementedInReceiverAndSuper)]];
[self assertTrue:[receiver implementsSelector:@selector(implementedInReceiverOnly)]];
[self assertFalse:[receiver implementsSelector:@selector(implementedInSuperOnly)]];
[self assertFalse:[receiver implementsSelector:@selector(notImplementedInSuperNorReceiver)]];
}
@end
+2 -2
View File
@@ -1,6 +1,6 @@
@import <Foundation/CPOperation.j>
@implementation TestOperation : CPOperation
@implementation TestOperation : CPOperation
{
CPString name @accessors;
CPString value @accessors;
@@ -177,7 +177,7 @@
[to cancel];
[self assert:@"isCancelled" equals:[[obs changedKeyPaths] objectAtIndex:9]];
[self assert:@"isCancelled" equals:[[obs changedKeyPaths] objectAtIndex:9]];
}
@end
+1 -1
View File
@@ -47,7 +47,7 @@
[self assert:"str" equals:str];
}
- (void) testInitWithFormat
- (void)testInitWithFormat
{
// this could be really big
var str = [[CPString alloc] initWithFormat:"%s", "str"];
+36 -36
View File
@@ -2,62 +2,62 @@
- (void)testThatSubclassTollFreeDoesAllowForSubclassingDictionary
{
var target = [[MyDict alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:0 equals:[target count]];
var target = [[MyDict alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:0 equals:[target count]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingString
{
var target = [[MyString alloc] initWithString:@"adsf"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:4 equals:[target length]];
var target2 = "agdsa";
[OJAssert assertThrows:function(){ [target2 newMessage]; }];
[OJAssert assert:5 equals:[target2 length]];
var target = [[MyString alloc] initWithString:@"adsf"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:4 equals:[target length]];
var target2 = "agdsa";
[OJAssert assertThrows:function(){ [target2 newMessage]; }];
[OJAssert assert:5 equals:[target2 length]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingNumber
{
var target = [[MyNum alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assertFalse:[target isEqualToNumber:5]];
var target = [[MyNum alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assertFalse:[target isEqualToNumber:5]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingException
{
var target = [[MyException alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
// there are no internal properties to test here.. so no need to jimmyrig it.
var target = [[MyException alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
// there are no internal properties to test here.. so no need to jimmyrig it.
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingArray
{
var target = [[MyArray alloc] initWithObjects:@"a"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:1 equals:[target count]];
var target = [[MyArray alloc] initWithObjects:@"a"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:1 equals:[target count]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingDate
{
var target = [[MyDate alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assertTrue:[target timeIntervalSince1970] > 0];
var target = [[MyDate alloc] init];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assertTrue:[target timeIntervalSince1970] > 0];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingData
{
var target = [[MyData alloc] initWithRawString:@"b"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:@"b" equals:[target rawString]];
var target = [[MyData alloc] initWithRawString:@"b"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:@"b" equals:[target rawString]];
}
- (void)testThatSubclassTollFreeDoesAllowForSubclassingURL
{
var target = [[MyURL alloc] initWithString:@"http://www.google.com"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:@"http://www.google.com" equals:[target absoluteString]];
var target = [[MyURL alloc] initWithString:@"http://www.google.com"];
[OJAssert assert:@"a" equals:[target newMessage]];
[OJAssert assert:@"http://www.google.com" equals:[target absoluteString]];
}
@@ -69,7 +69,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -78,7 +78,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -87,7 +87,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -96,7 +96,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -105,7 +105,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -114,7 +114,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -123,7 +123,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
@@ -132,7 +132,7 @@
- (id)newMessage
{
return "a";
return "a";
}
@end
+12 -12
View File
@@ -10,17 +10,18 @@
@implementation AppController : CPObject
{
CPWindow window;
CPWindow sheet;
CPTextField textField;
CPWindow window;
CPWindow sheet;
CPTextField textField;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
window = [[CPWindow alloc] initWithContentRect:CGRectMake(100,100,500,300) styleMask:CPResizableWindowMask],
contentView = [window contentView];
[window setMinSize:CGSizeMake(300, 200)];
sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0,0,300,100) styleMask:CPDocModalWindowMask|CPResizableWindowMask];
[window setMinSize:CGSizeMake(300, 200)];
sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0,0,300,100) styleMask:CPDocModalWindowMask | CPResizableWindowMask];
[sheet setMinSize:CGSizeMake(300,100)];
var sheetContent = [sheet contentView];
@@ -35,14 +36,14 @@
[okButton setTarget:self];
[okButton setTag:1];
[okButton setAction:@selector(closeSheet:)];
[okButton setAutoresizingMask:CPViewMinXMargin|CPViewMinYMargin];
[okButton setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin];
var cancelButton = [[CPButton alloc] initWithFrame:CGRectMake(120,70,100,24)];
[cancelButton setTitle:"Cancel"];
[cancelButton setTarget:self];
[cancelButton setTag:0];
[cancelButton setAction:@selector(closeSheet:)];
[cancelButton setAutoresizingMask:CPViewMinXMargin|CPViewMinYMargin];
[cancelButton setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin];
[sheetContent addSubview:textField];
[sheetContent addSubview:okButton];
@@ -52,9 +53,9 @@
[displayButton setTitle:"Display Sheet"];
[displayButton setTarget:self];
[displayButton setAction:@selector(displaySheet:)];
[contentView addSubview:displayButton];
[contentView addSubview:displayButton];
[window orderFront:self]
[window orderFront:self]
}
- (void)displaySheet:(id)sender
@@ -75,10 +76,9 @@
var str = [textField stringValue];
[sheet orderOut:self];
if (returnCode == CPOKButton && [str length] > 0)
{
[window setTitle:str];
}
[window setTitle:str];
}
@end
+4 -4
View File
@@ -55,13 +55,13 @@
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var box = [[CPBox alloc] initWithFrame:CGRectMake(0,0,500,300)];
browser = [[CPBrowser alloc] initWithFrame:CGRectMake(0,0,500,300)];
var box = [[CPBox alloc] initWithFrame:CGRectMake(0, 0, 500, 300)],
browser = [[CPBrowser alloc] initWithFrame:CGRectMake(0, 0, 500, 300)];
[browser setWidth:300 ofColumn:1];
[box setContentView:browser];
[box setBorderType:CPBezelBorder];
[box setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
[box setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[box setCenter:[contentView center]];
[contentView addSubview:box];
@@ -96,7 +96,7 @@
- (void)browserClicked:(id)sender
{
console.log("selected column: "+[browser selectedColumn]+" row: "+[browser selectedRowInColumn:[browser selectedColumn]]);
console.log("selected column: " + [browser selectedColumn] + " row: " + [browser selectedRowInColumn:[browser selectedColumn]]);
}
- (void)dblClicked:(id)sender
@@ -62,7 +62,7 @@ CPLogRegister(CPLogConsole);
- (void)changeDefault:(id)sender
{
var buttonWindow = [sender window]
var buttonWindow = [sender window],
tag = [[buttonWindow defaultButton] tag] === 1 ? 2 : 1;
[buttonWindow setDefaultButton:[[buttonWindow contentView] viewWithTag:tag]];
@@ -64,7 +64,7 @@ var UseFix = NO;
}
}
-(void)alertDidEnd:(CPAlert)theAlert returnCode:(int)returnCode
- (void)alertDidEnd:(CPAlert)theAlert returnCode:(int)returnCode
{
[button highlight:NO];
}
+6 -6
View File
@@ -23,39 +23,39 @@ var selectors = ["pointingHandCursor", "resizeDownCursor", "resizeLeftCursor", "
popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(100,100,150,24)];
var menu = [popup menu];
for (var i = 0 , count = [selectors count];i < count;i++)
{
{
var selector = selectors[i];
var item = [[CPMenuItem alloc] initWithTitle:selector action:nil keyEquivalent:@""];
[item setTarget:self];
[menu addItem:item];
}
[contentView addSubview:popup];
var button = [[CPButton alloc] initWithFrame:CGRectMake(270,100,100,24)];
[button setAction:@selector(setCursor:)];
[button setTarget:self];
[button setTitle:@"set Cursor"];
[contentView addSubview:button];
var button = [[CPButton alloc] initWithFrame:CGRectMake(270,150,150,24)];
[button setAction:@selector(setUrlCursor:)];
[button setTarget:self];
[button setTitle:@"set Cursor from url"];
[contentView addSubview:button];
[theWindow orderFront:self];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
-(void)setCursor:(id)sender
- (void)setCursor:(id)sender
{
var selector = CPSelectorFromString([popup titleOfSelectedItem]);
var cursor = [CPCursor performSelector:selector];
[cursor set];
}
-(void)setUrlCursor:(id)sender
- (void)setUrlCursor:(id)sender
{ // note gifs don't animate when they are used as a cursor.
var aImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:@"spinner.gif"]];
var cursor = [[CPCursor alloc] initWithImage:aImage hotSpot:CGPointMakeZero()];
+1 -1
View File
@@ -34,7 +34,7 @@
{
var bounds = [aView bounds],
sides = [CPMinYEdge, CPMaxYEdge, CPMinXEdge, CPMaxXEdge],
grays = [192.0/255.0, 1.0, 192.0/255.0, 1.0],
grays = [192.0 / 255.0, 1.0, 192.0 / 255.0, 1.0],
clipRect = [aView bounds];
if (aView === view2)
+1 -1
View File
@@ -31,7 +31,7 @@ var categories = ["firstName","lastName"],
[searchField setRecentsAutosaveName:"autosave"];
[searchField setTarget:self];
[searchField setAction:@selector(updateFilter:)];
[searchField setAutoresizingMask:CPViewMaxXMargin|CPViewMaxYMargin];
[searchField setAutoresizingMask:CPViewMaxXMargin | CPViewMaxYMargin];
searchMenuTemplate = [searchField defaultSearchMenuTemplate];
+17 -17
View File
@@ -17,27 +17,27 @@
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var tabView = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
[tabView setTabViewType:CPNoTabsBezelBorder];
[tabView setTabViewType:CPTopTabsBezelBorder];
var tabView = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
[tabView setTabViewType:CPNoTabsBezelBorder];
[tabView setTabViewType:CPTopTabsBezelBorder];
var view = [[CPView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
[view addSubview:[CPTextField labelWithTitle:@"First"]];
var item = [[CPTabViewItem alloc] initWithIdentifier:@"a"];
[item setView:view];
[item setLabel:"Test"];
[tabView addTabViewItem:item];
var view = [[CPView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
[view addSubview:[CPTextField labelWithTitle:@"First"]];
var item = [[CPTabViewItem alloc] initWithIdentifier:@"a"];
[item setView:view];
[item setLabel:"Test"];
[tabView addTabViewItem:item];
view = [[CPView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
[view addSubview:[CPTextField labelWithTitle:@"Second"]];
item = [[CPTabViewItem alloc] initWithIdentifier:@"a"];
[item setView:view];
[item setLabel:"Test2"];
[tabView addTabViewItem:item];
view = [[CPView alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];
[view addSubview:[CPTextField labelWithTitle:@"Second"]];
item = [[CPTabViewItem alloc] initWithIdentifier:@"a"];
[item setView:view];
[item setLabel:"Test2"];
[tabView addTabViewItem:item];
[contentView addSubview:tabView];
[contentView addSubview:tabView];
[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[theWindow orderFront:self];
}