mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-22 18:30:43 +00:00
More capp_linting.
Reviewed by me.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@}
|
||||
*/
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user