From afd59254999b0bbd25adb3b2c5bea775722c202f Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Wed, 13 Mar 2013 12:22:10 -0400 Subject: [PATCH] Fixed: _CG and _CP macros were confusing and could degrade performance Previously, Cappuccino was using preprocessor macros internally for the CGPoint/Size/Rect/Inset/Affine functions, as well as for CPRange. These macros had the same name as the corresponding function, but began with _. The functions were actually defined using the macros. The motivation behind using macros was to increase performance by reducing function calls. However, there were a number of problems with this approach: - There was an artificial dichotomy between _CG macros and the corresponding CG functions. We never completely replaced CG function calls with _CG macros. In fact, they were often mixed up in the same file. There was an extra burden on the programmer to remember to use the macro instead of the function. - If a method call was passed as an argument to a macro, performance could actually be significantly *worse* than a function call. For example, _CGGetRectMakeCopy([view frame]) would expand to `{ origin:{ x:[view frame].origin.x, y:[view frame].origin.y }, size:{ width:[view frame].size.width, height:[view frame].size.height } }`. So instead of a single objj_msgSend and a single simple function call, we ended up with 4 objj_msgSend calls, which are way more expensive than simple function calls. - Because of this expansion problem, to use macros efficiently required us to remember to use variables for all macro parameters. This didn't happen, and shouldn't have to happen. - Finally, with modern Javascript engines, function call overhead is so small that it really isn't worth using the macros. This commit eliminates the _CGGeometry, CGAffineTransformation and CPRange macros and replaces them with function calls. BREAKING CHANGE: The macros are no longer available. They could only be used with compiled code, but if there is any user code that used them, they will have to be replaced with the corresponding functions. --- AppKit/CPAccordionView.j | 28 +- AppKit/CPApplication.j | 21 +- AppKit/CPBox.j | 12 +- AppKit/CPButton.j | 12 +- AppKit/CPClipView.j | 8 +- AppKit/CPCollectionView.j | 70 +++-- AppKit/CPColorPicker.j | 6 +- AppKit/CPColorWell.j | 14 +- AppKit/CPComboBox.j | 6 +- AppKit/CPControl.j | 6 +- AppKit/CPDragServer.j | 32 +-- AppKit/CPEvent.j | 4 +- AppKit/CPGradient.j | 12 +- AppKit/CPGraphics.j | 24 +- AppKit/CPImage.j | 16 +- AppKit/CPImageView.j | 10 +- AppKit/CPLevelIndicator.j | 12 +- AppKit/CPMenu/CPMenu.j | 2 +- AppKit/CPMenu/_CPMenuBarWindow.j | 2 +- AppKit/CPMenu/_CPMenuManager.j | 4 +- AppKit/CPMenu/_CPMenuWindow.j | 12 +- AppKit/CPOutlineView.j | 22 +- AppKit/CPProgressIndicator.j | 4 +- AppKit/CPScreen.j | 4 +- AppKit/CPScrollView.j | 100 +++---- AppKit/CPScroller.j | 70 ++--- AppKit/CPSearchField.j | 18 +- AppKit/CPSegmentedControl.j | 8 +- AppKit/CPShadowView.j | 2 +- AppKit/CPSlider.j | 52 ++-- AppKit/CPSplitView.j | 6 +- AppKit/CPStepper.j | 18 +- AppKit/CPTabView.j | 18 +- AppKit/CPTableColumn.j | 2 +- AppKit/CPTableHeaderView.j | 52 ++-- AppKit/CPTableView.j | 126 ++++----- AppKit/CPTextField.j | 28 +- AppKit/CPTokenField.j | 60 ++-- AppKit/CPToolbar.j | 38 +-- AppKit/CPView.j | 116 ++++---- AppKit/CPViewAnimation.j | 8 +- AppKit/CPWindow/CPWindow.j | 108 ++++---- AppKit/CPWindow/_CPDocModalWindowView.j | 4 +- AppKit/CPWindow/_CPHUDWindowView.j | 14 +- AppKit/CPWindow/_CPPopoverWindowView.j | 42 +-- AppKit/CPWindow/_CPShadowWindowView.j | 2 +- AppKit/CPWindow/_CPStandardWindowView.j | 52 ++-- AppKit/CPWindow/_CPTitleableWindowView.j | 2 +- AppKit/CPWindow/_CPWindowView.j | 130 ++++----- AppKit/CoreAnimation/CALayer.j | 82 +++--- AppKit/CoreGraphics/CGAffineTransform.h | 62 ----- AppKit/CoreGraphics/CGAffineTransform.j | 131 +++++++-- AppKit/CoreGraphics/CGContext.j | 14 +- AppKit/CoreGraphics/CGContextCanvas.j | 10 +- AppKit/CoreGraphics/CGContextVML.j | 12 +- AppKit/CoreGraphics/CGPath.j | 98 +++---- AppKit/Platform/CPPlatformString.j | 4 +- AppKit/Platform/CPPlatformWindow.j | 18 +- AppKit/Platform/DOM/CPDOMDisplayServer.h | 20 +- AppKit/Platform/DOM/CPDOMWindowLayer.j | 2 +- AppKit/Platform/DOM/CPPlatformString.j | 2 +- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 38 +-- AppKit/_CPCornerView.j | 4 +- AppKit/_CPImageAndTextView.j | 20 +- AppKit/_CPPopoverWindow.j | 16 +- Foundation/CPArray+KVO.j | 2 +- Foundation/CPIndexSet.j | 89 +++--- Foundation/CPRange.h | 27 -- Foundation/CPRange.j | 29 +- Foundation/CPString.j | 4 +- Foundation/_CGGeometry.h | 90 ------ Foundation/_CGGeometry.j | 306 +++++++++++++++------ Tests/AppKit/CPBrowserTest.j | 2 +- Tests/Foundation/CPGeometryTest.j | 9 +- 74 files changed, 1276 insertions(+), 1234 deletions(-) delete mode 100644 AppKit/CoreGraphics/CGAffineTransform.h delete mode 100644 Foundation/CPRange.h delete mode 100644 Foundation/_CGGeometry.h diff --git a/AppKit/CPAccordionView.j b/AppKit/CPAccordionView.j index 3f28cfa3c..c3e4b4f52 100644 --- a/AppKit/CPAccordionView.j +++ b/AppKit/CPAccordionView.j @@ -106,7 +106,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection _itemViews = []; _expandedItemIndexes = [CPIndexSet indexSet]; - [self setItemHeaderPrototype:[[CPButton alloc] initWithFrame:_CGRectMake(0.0, 0.0, 100.0, 24.0)]]; + [self setItemHeaderPrototype:[[CPButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 24.0)]]; } return self; @@ -258,18 +258,18 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection - (void)setFrameSize:(CGSize)aSize { - var width = _CGRectGetWidth([self frame]); + var width = CGRectGetWidth([self frame]); [super setFrameSize:aSize]; - if (width !== _CGRectGetWidth([self frame])) + if (width !== CGRectGetWidth([self frame])) [self _invalidateItemsStartingAtIndex:0]; } - (void)layoutSubviews { if (_items.length <= 0) - return [self setFrameSize:_CGSizeMake(_CGRectGetWidth([self frame]), 0.0)]; + return [self setFrameSize:CGSizeMake(CGRectGetWidth([self frame]), 0.0)]; if (_dirtyItemIndex === CPNotFound) return; @@ -278,7 +278,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection var index = _dirtyItemIndex, count = _itemViews.length, - width = _CGRectGetWidth([self bounds]), + width = CGRectGetWidth([self bounds]), y = index > 0 ? CGRectGetMaxY([_itemViews[index - 1] frame]) : 0.0; // Do this now (instead of after looping), so that if we are made dirty again in the middle we don't blow this value away. @@ -293,7 +293,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection y = CGRectGetMaxY([itemView frame]); } - [self setFrameSize:_CGSizeMake(_CGRectGetWidth([self frame]), y)]; + [self setFrameSize:CGSizeMake(CGRectGetWidth([self frame]), y)]; } @end @@ -310,7 +310,7 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection - (id)initWithAccordionView:(CPAccordionView)anAccordionView { - self = [super initWithFrame:_CGRectMakeZero()]; + self = [super initWithFrame:CGRectMakeZero()]; if (self) { @@ -376,21 +376,21 @@ var secondItem = [[CPAccordionViewItem alloc] initWithIdentifier:@"secondSection - (void)setFrameY:(float)aY width:(float)aWidth { - var headerHeight = _CGRectGetHeight([_headerView frame]); + var headerHeight = CGRectGetHeight([_headerView frame]); // Size to fit or something? - [_headerView setFrameSize:_CGSizeMake(aWidth, headerHeight)]; - [_contentView setFrameOrigin:_CGPointMake(0.0, headerHeight)]; + [_headerView setFrameSize:CGSizeMake(aWidth, headerHeight)]; + [_contentView setFrameOrigin:CGPointMake(0.0, headerHeight)]; if ([self isCollapsed]) - [self setFrame:_CGRectMake(0.0, aY, aWidth, headerHeight)]; + [self setFrame:CGRectMake(0.0, aY, aWidth, headerHeight)]; else { - var contentHeight = _CGRectGetHeight([_contentView frame]); + var contentHeight = CGRectGetHeight([_contentView frame]); - [_contentView setFrameSize:_CGSizeMake(aWidth, contentHeight)]; - [self setFrame:_CGRectMake(0.0, aY, aWidth, contentHeight + headerHeight)]; + [_contentView setFrameSize:CGSizeMake(aWidth, contentHeight)]; + [self setFrame:CGRectMake(0.0, aY, aWidth, contentHeight + headerHeight)]; } } diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 82db09c8e..7309bbf04 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -20,8 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#import "../Foundation/CPRange.h" - @import @import "CPCompatibility.j" @@ -706,7 +704,7 @@ CPRunContinuesResponse = -1002; - (CPArray)windows { // Return all windows, but not the CPNull placeholder in _windows[0]. - return [_windows subarrayWithRange:_CPMakeRange(1, [_windows count] - 1)]; + return [_windows subarrayWithRange:CPMakeRange(1, [_windows count] - 1)]; } /*! @@ -989,10 +987,10 @@ CPRunContinuesResponse = -1002; @param aSheet the window to display as a sheet @param aWindow the window that will hold the sheet as a child @param aModalDelegate - @param aDidEndSelector - @param aContextInfo + @param didEndSelector + @param contextInfo */ -- (void)beginSheet:(CPWindow)aSheet modalForWindow:(CPWindow)aWindow modalDelegate:(id)aModalDelegate didEndSelector:(SEL)aDidEndSelector contextInfo:(id)aContextInfo +- (void)beginSheet:(CPWindow)aSheet modalForWindow:(CPWindow)aWindow modalDelegate:(id)aModalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(id)contextInfo { if ([aWindow isSheet]) { @@ -1001,16 +999,7 @@ CPRunContinuesResponse = -1002; } [aSheet._windowView _enableSheet:YES inWindow:aWindow]; - - // -dw- if a sheet is already visible, we skip this since it serves no purpose and causes - // orderOut: to be called on the sheet, which is not what we want. - if (![aWindow isVisible]) - { - [aWindow orderFront:self]; - [aSheet setPlatformWindow:[aWindow platformWindow]]; - } - - [aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:aDidEndSelector contextInfo:aContextInfo]; + [aWindow _attachSheet:aSheet modalDelegate:aModalDelegate didEndSelector:didEndSelector contextInfo:contextInfo]; } /*! diff --git a/AppKit/CPBox.j b/AppKit/CPBox.j index 9dc3742b2..0a9240d7b 100644 --- a/AppKit/CPBox.j +++ b/AppKit/CPBox.j @@ -444,9 +444,9 @@ CPBelowBottom = 6; case CPBoxSeparator: // NSBox does not include a horizontal flag for the separator type. We have to determine // the type of separator to draw by the width and height of the frame. - if (_CGRectGetWidth(bounds) === 5.0) + if (CGRectGetWidth(bounds) === 5.0) return [self _drawVerticalSeparatorInRect:bounds]; - else if (_CGRectGetHeight(bounds) === 5.0) + else if (CGRectGetHeight(bounds) === 5.0) return [self _drawHorizontalSeparatorInRect:bounds]; break; @@ -493,8 +493,8 @@ CPBelowBottom = 6; CGContextSetStrokeColor(context, [self borderColor]); CGContextSetLineWidth(context, 1.0); - CGContextMoveToPoint(context, _CGRectGetMinX(aRect), _CGRectGetMidY(aRect)); - CGContextAddLineToPoint(context, _CGRectGetWidth(aRect), _CGRectGetMidY(aRect)); + CGContextMoveToPoint(context, CGRectGetMinX(aRect), CGRectGetMidY(aRect)); + CGContextAddLineToPoint(context, CGRectGetWidth(aRect), CGRectGetMidY(aRect)); CGContextStrokePath(context); } @@ -505,8 +505,8 @@ CPBelowBottom = 6; CGContextSetStrokeColor(context, [self borderColor]); CGContextSetLineWidth(context, 1.0); - CGContextMoveToPoint(context, _CGRectGetMidX(aRect), _CGRectGetMinY(aRect)); - CGContextAddLineToPoint(context, _CGRectGetMidX(aRect), _CGRectGetHeight(aRect)); + CGContextMoveToPoint(context, CGRectGetMidX(aRect), CGRectGetMinY(aRect)); + CGContextAddLineToPoint(context, CGRectGetMidX(aRect), CGRectGetHeight(aRect)); CGContextStrokePath(context); } diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index ca041056e..ac9b1b4bb 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -154,8 +154,8 @@ CPButtonImageOffset = 3.0; return @{ @"image": [CPNull null], @"image-offset": 0.0, - @"bezel-inset": _CGInsetMakeZero(), - @"content-inset": _CGInsetMakeZero(), + @"bezel-inset": CGInsetMakeZero(), + @"content-inset": CGInsetMakeZero(), @"bezel-color": [CPNull null], }; } @@ -596,7 +596,7 @@ CPButtonImageOffset = 3.0; { var contentInset = [self currentValueForThemeAttribute:@"content-inset"]; - return _CGRectInsetByInset(bounds, contentInset); + return CGRectInsetByInset(bounds, contentInset); } - (CGRect)bezelRectForBounds:(CGRect)bounds @@ -607,7 +607,7 @@ CPButtonImageOffset = 3.0; var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"]; - return _CGRectInsetByInset(bounds, bezelInset); + return CGRectInsetByInset(bounds, bezelInset); } - (CGSize)_minimumFrameSize @@ -667,14 +667,14 @@ CPButtonImageOffset = 3.0; { if (aName === "bezel-view") { - var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; return view; } else - return [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; + return [[_CPImageAndTextView alloc] initWithFrame:CGRectMakeZero()]; } - (void)layoutSubviews diff --git a/AppKit/CPClipView.j b/AppKit/CPClipView.j index 6d3518e73..a59f83f12 100644 --- a/AppKit/CPClipView.j +++ b/AppKit/CPClipView.j @@ -108,19 +108,19 @@ - (CGPoint)constrainScrollPoint:(CGPoint)aPoint { if (!_documentView) - return _CGPointMakeZero(); + return CGPointMakeZero(); var documentFrame = [_documentView frame]; - aPoint.x = MAX(0.0, MIN(aPoint.x, MAX(_CGRectGetWidth(documentFrame) - _CGRectGetWidth(_bounds), 0.0))); - aPoint.y = MAX(0.0, MIN(aPoint.y, MAX(_CGRectGetHeight(documentFrame) - _CGRectGetHeight(_bounds), 0.0))); + aPoint.x = MAX(0.0, MIN(aPoint.x, MAX(CGRectGetWidth(documentFrame) - CGRectGetWidth(_bounds), 0.0))); + aPoint.y = MAX(0.0, MIN(aPoint.y, MAX(CGRectGetHeight(documentFrame) - CGRectGetHeight(_bounds), 0.0))); return aPoint; } - (void)setBoundsOrigin:(CGPoint)aPoint { - if (_CGPointEqualToPoint(_bounds.origin, aPoint)) + if (CGPointEqualToPoint(_bounds.origin, aPoint)) return; [super setBoundsOrigin:aPoint]; diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 0df770496..4bbbeeeba 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -20,8 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#import "../Foundation/CPRange.h" - @import @import @import @@ -127,8 +125,8 @@ var HORIZONTAL_MARGIN = 2; _maxNumberOfRows = 0; _maxNumberOfColumns = 0; - _minItemSize = _CGSizeMakeZero(); - _maxItemSize = _CGSizeMakeZero(); + _minItemSize = CGSizeMakeZero(); + _maxItemSize = CGSizeMakeZero(); [self setBackgroundColors:nil]; @@ -152,11 +150,11 @@ var HORIZONTAL_MARGIN = 2; _numberOfColumns = CPNotFound; _numberOfRows = CPNotFound; - _itemSize = _CGSizeMakeZero(); + _itemSize = CGSizeMakeZero(); _selectionIndexes = [CPIndexSet indexSet]; - _storedFrameSize = _CGSizeMakeZero(); + _storedFrameSize = CGSizeMakeZero(); _needsMinMaxItemSizeUpdate = YES; _uniformSubviewsResizing = NO; @@ -504,7 +502,7 @@ var HORIZONTAL_MARGIN = 2; if (!lazyFlag || _numberOfColumns !== oldNumberOfColumns || _numberOfRows !== oldNumberOfRows || - !_CGSizeEqualToSize(_itemSize, oldItemSize)) + !CGSizeEqualToSize(_itemSize, oldItemSize)) [self displayItems:_items frameSize:_storedFrameSize itemSize:_itemSize columns:_numberOfColumns rows:_numberOfRows count:count]; } @@ -513,7 +511,7 @@ var HORIZONTAL_MARGIN = 2; { var width = aSuperviewSize.width, height = aSuperviewSize.height, - itemSize = _CGSizeMakeCopy(_minItemSize), + itemSize = CGSizeMakeCopy(_minItemSize), maxItemSizeWidth = _maxItemSize.width, maxItemSizeHeight = _maxItemSize.height, itemsCount = [_items count], @@ -552,8 +550,8 @@ var HORIZONTAL_MARGIN = 2; if (maxItemSizeHeight > 0) itemSizeHeight = MIN(itemSizeHeight, maxItemSizeHeight); - _itemSize = _CGSizeMake(MAX(_minItemSize.width, itemSize.width), MAX(_minItemSize.height, itemSizeHeight)); - _storedFrameSize = _CGSizeMake(MAX(width, _minItemSize.width), height); + _itemSize = CGSizeMake(MAX(_minItemSize.width, itemSize.width), MAX(_minItemSize.height, itemSizeHeight)); + _storedFrameSize = CGSizeMake(MAX(width, _minItemSize.width), height); _numberOfColumns = numberOfColumns; _numberOfRows = numberOfRows; countRef(MIN(itemsCount, numberOfColumns * numberOfRows)); @@ -574,7 +572,7 @@ var HORIZONTAL_MARGIN = 2; if (idx >= displayCount) { - [view setFrameOrigin:_CGPointMake(-anItemSize.width, -anItemSize.height)]; + [view setFrameOrigin:CGPointMake(-anItemSize.width, -anItemSize.height)]; return; } @@ -584,7 +582,7 @@ var HORIZONTAL_MARGIN = 2; y += _verticalMargin + anItemSize.height; } - [view setFrameOrigin:_CGPointMake(x, y)]; + [view setFrameOrigin:CGPointMake(x, y)]; [view setFrameSize:anItemSize]; x += anItemSize.width + _horizontalMargin; @@ -687,12 +685,12 @@ var HORIZONTAL_MARGIN = 2; if (aSize === nil || aSize === undefined) [CPException raise:CPInvalidArgumentException reason:"Invalid value provided for minimum size"]; - if (_CGSizeEqualToSize(_minItemSize, aSize)) + if (CGSizeEqualToSize(_minItemSize, aSize)) return; - _minItemSize = _CGSizeMakeCopy(aSize); + _minItemSize = CGSizeMakeCopy(aSize); - if (_CGSizeEqualToSize(_minItemSize, _CGSizeMakeZero())) + if (CGSizeEqualToSize(_minItemSize, CGSizeMakeZero())) _needsMinMaxItemSizeUpdate = YES; [self tile]; @@ -712,10 +710,10 @@ var HORIZONTAL_MARGIN = 2; */ - (void)setMaxItemSize:(CGSize)aSize { - if (_CGSizeEqualToSize(_maxItemSize, aSize)) + if (CGSizeEqualToSize(_maxItemSize, aSize)) return; - _maxItemSize = _CGSizeMakeCopy(aSize); + _maxItemSize = CGSizeMakeCopy(aSize); // if (_maxItemSize.width == 0 || _maxItemSize.height == 0) // _needsMinMaxItemSizeUpdate = YES; @@ -787,9 +785,9 @@ var HORIZONTAL_MARGIN = 2; newSelectedRange = nil; if (index < firstSelectedIndex) - newSelectedRange = _CPMakeRange(index, (firstSelectedIndex - index) + 1); + newSelectedRange = CPMakeRange(index, (firstSelectedIndex - index) + 1); else - newSelectedRange = _CPMakeRange(firstSelectedIndex, (index - firstSelectedIndex) + 1); + newSelectedRange = CPMakeRange(firstSelectedIndex, (index - firstSelectedIndex) + 1); indexes = [[self selectionIndexes] copy]; [indexes addIndexesInRange:newSelectedRange]; @@ -938,9 +936,9 @@ var HORIZONTAL_MARGIN = 2; // Create and position the drop indicator view. if (!_dropView) - _dropView = [[_CPCollectionViewDropIndicator alloc] initWithFrame:_CGRectMake(-8, -8, 0, 0)]; + _dropView = [[_CPCollectionViewDropIndicator alloc] initWithFrame:CGRectMake(-8, -8, 0, 0)]; - [_dropView setFrameSize:_CGSizeMake(10, _itemSize.height + _verticalMargin)]; + [_dropView setFrameSize:CGSizeMake(10, _itemSize.height + _verticalMargin)]; [self addSubview:_dropView]; } @@ -976,14 +974,14 @@ var HORIZONTAL_MARGIN = 2; [[CPPasteboard pasteboardWithName:CPDragPboard] declareTypes:dragTypes owner:self]; - var dragImageOffset = _CGSizeMakeZero(), + var dragImageOffset = CGSizeMakeZero(), view = [self _draggingViewForItemsAtIndexes:_selectionIndexes withEvent:_mouseDownEvent offset:dragImageOffset]; [view setFrameSize:_itemSize]; [view setAlphaValue:0.7]; var dragLocation = [self convertPoint:locationInWindow fromView:nil], - dragPoint = _CGPointMake(dragLocation.x - _itemSize.width / 2 , dragLocation.y - _itemSize.height / 2); + dragPoint = CGPointMake(dragLocation.x - _itemSize.width / 2 , dragLocation.y - _itemSize.height / 2); [self dragView:view at:dragPoint @@ -1115,12 +1113,12 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: _currentDragOperation = dragOperation; var frameOrigin, - dropviewFrameWidth = _CGRectGetWidth([_dropView frame]); + dropviewFrameWidth = CGRectGetWidth([_dropView frame]); if (_currentDropIndex == -1 || _currentDragOperation == CPDragOperationNone) - frameOrigin = _CGPointMake(-dropviewFrameWidth, 0); + frameOrigin = CGPointMake(-dropviewFrameWidth, 0); else if (_currentDropIndex == 0) - frameOrigin = _CGPointMake(0, 0); + frameOrigin = CGPointMake(0, 0); else { var offset; @@ -1137,7 +1135,7 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: var rect = [self frameForItemAtIndex:dropIndex]; - frameOrigin = _CGPointMake(_CGRectGetMaxX(rect) + offset, rect.origin.y - _verticalMargin); + frameOrigin = CGPointMake(CGRectGetMaxX(rect) + offset, rect.origin.y - _verticalMargin); } [_dropView setFrameOrigin:frameOrigin]; @@ -1184,8 +1182,8 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: - (void)drawRect:(CGRect)aRect { var context = [[CPGraphicsContext currentContext] graphicsPort], - width = _CGRectGetWidth(aRect), - circleRect = _CGRectMake(1, 1, width - 2, width - 2); + width = CGRectGetWidth(aRect), + circleRect = CGRectMake(1, 1, width - 2, width - 2); CGContextSetStrokeColor(context, [CPColor colorWithHexString:@"4886ca"]); CGContextSetFillColor(context, [CPColor whiteColor]); @@ -1199,8 +1197,8 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: //then draw the line CGContextBeginPath(context); - CGContextMoveToPoint(context, FLOOR(width / 2), _CGRectGetMinY(aRect) + width); - CGContextAddLineToPoint(context, FLOOR(width / 2), _CGRectGetHeight(aRect)); + CGContextMoveToPoint(context, FLOOR(width / 2), CGRectGetMinY(aRect) + width); + CGContextAddLineToPoint(context, FLOOR(width / 2), CGRectGetHeight(aRect)); CGContextStrokePath(context); } @@ -1225,9 +1223,9 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: // if the direction is backward (-1) check with the bottom anchor if (aDirection === -1) - [indexes addIndexesInRange:_CPMakeRange(anIndex, bottomAnchor - anIndex + 1)]; + [indexes addIndexesInRange:CPMakeRange(anIndex, bottomAnchor - anIndex + 1)]; else - [indexes addIndexesInRange:_CPMakeRange(topAnchor, anIndex - topAnchor + 1)]; + [indexes addIndexesInRange:CPMakeRange(topAnchor, anIndex - topAnchor + 1)]; } else indexes = [CPIndexSet indexSetWithIndex:anIndex]; @@ -1240,7 +1238,7 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype: { var frame = [self frameForItemsAtIndexes:[self selectionIndexes]]; - if (!_CGRectIsNull(frame)) + if (!CGRectIsEmpty(frame)) [self scrollRectToVisible:frame]; } @@ -1388,10 +1386,10 @@ var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeK { [super encodeWithCoder:aCoder]; - if (!_CGSizeEqualToSize(_minItemSize, _CGSizeMakeZero())) + if (!CGSizeEqualToSize(_minItemSize, CGSizeMakeZero())) [aCoder encodeSize:_minItemSize forKey:CPCollectionViewMinItemSizeKey]; - if (!_CGSizeEqualToSize(_maxItemSize, _CGSizeMakeZero())) + if (!CGSizeEqualToSize(_maxItemSize, CGSizeMakeZero())) [aCoder encodeSize:_maxItemSize forKey:CPCollectionViewMaxItemSizeKey]; [aCoder encodeInt:_maxNumberOfRows forKey:CPCollectionViewMaxNumberOfRowsKey]; diff --git a/AppKit/CPColorPicker.j b/AppKit/CPColorPicker.j index 39451d0cf..7a1d43961 100644 --- a/AppKit/CPColorPicker.j +++ b/AppKit/CPColorPicker.j @@ -115,12 +115,12 @@ - (id)initView { - var aFrame = _CGRectMake(0, 0, CPColorPickerViewWidth, CPColorPickerViewHeight); + var aFrame = CGRectMake(0, 0, CPColorPickerViewWidth, CPColorPickerViewHeight); _pickerView = [[CPView alloc] initWithFrame:aFrame]; [_pickerView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; - _brightnessSlider = [[CPSlider alloc] initWithFrame:_CGRectMake(0, (aFrame.size.height - 34), aFrame.size.width, 15)]; + _brightnessSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0, (aFrame.size.height - 34), aFrame.size.width, 15)]; [_brightnessSlider setValue:15.0 forThemeAttribute:@"track-width"]; [_brightnessSlider setValue:[CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPColorPicker class]] pathForResource:@"brightness_bar.png"]]] forThemeAttribute:@"track-color"]; @@ -133,7 +133,7 @@ [_brightnessSlider setAction:@selector(brightnessSliderDidChange:)]; [_brightnessSlider setAutoresizingMask:CPViewWidthSizable | CPViewMinYMargin]; - _hueSaturationView = [[__CPColorWheel alloc] initWithFrame:_CGRectMake(0, 0, aFrame.size.width, aFrame.size.height - 38)]; + _hueSaturationView = [[__CPColorWheel alloc] initWithFrame:CGRectMake(0, 0, aFrame.size.width, aFrame.size.height - 38)]; [_hueSaturationView setDelegate:self]; [_hueSaturationView setAutoresizingMask:(CPViewWidthSizable | CPViewHeightSizable)]; diff --git a/AppKit/CPColorWell.j b/AppKit/CPColorWell.j index 274f9c04e..8ebe88ce9 100644 --- a/AppKit/CPColorWell.j +++ b/AppKit/CPColorWell.j @@ -61,10 +61,10 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv + (id)themeAttributes { return @{ - @"bezel-inset": _CGInsetMakeZero(), + @"bezel-inset": CGInsetMakeZero(), @"bezel-color": [CPNull null], - @"content-inset": _CGInsetMake(3.0, 3.0, 3.0, 3.0), - @"content-border-inset": _CGInsetMakeZero(), + @"content-inset": CGInsetMake(3.0, 3.0, 3.0, 3.0), + @"content-border-inset": CGInsetMakeZero(), @"content-border-color": [CPNull null], }; } @@ -249,21 +249,21 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv { var contentInset = [self currentValueForThemeAttribute:@"content-inset"]; - return _CGRectInsetByInset(bounds, contentInset); + return CGRectInsetByInset(bounds, contentInset); } - (CGRect)bezelRectForBounds:(CGRect)bounds { var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"]; - return _CGRectInsetByInset(bounds, bezelInset); + return CGRectInsetByInset(bounds, bezelInset); } - (CGRect)contentBorderRectForBounds:(CGRect)bounds { var contentBorderInset = [self currentValueForThemeAttribute:@"content-border-inset"]; - return _CGRectInsetByInset(bounds, contentBorderInset); + return CGRectInsetByInset(bounds, contentBorderInset); } - (CGRect)rectForEphemeralSubviewNamed:(CPString)aName @@ -283,7 +283,7 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv - (CPView)createEphemeralSubviewNamed:(CPString)aName { - var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; diff --git a/AppKit/CPComboBox.j b/AppKit/CPComboBox.j index 73e3097e5..0651d53ee 100644 --- a/AppKit/CPComboBox.j +++ b/AppKit/CPComboBox.j @@ -61,8 +61,8 @@ var CPComboBoxTextSubview = @"text", + (id)themeAttributes { return @{ - @"popup-button-size": _CGSizeMake(21.0, 29.0), - @"border-inset": _CGInsetMake(3.0, 3.0, 3.0, 3.0), + @"popup-button-size": CGSizeMake(21.0, 29.0), + @"border-inset": CGInsetMake(3.0, 3.0, 3.0, 3.0), }; } @@ -854,7 +854,7 @@ var CPComboBoxTextSubview = @"text", { if (aName === "popup-button-view") { - var view = [[_CPComboBoxPopUpButton alloc] initWithFrame:_CGRectMakeZero() comboBox:self]; + var view = [[_CPComboBoxPopUpButton alloc] initWithFrame:CGRectMakeZero() comboBox:self]; return view; } diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 8481c864d..fb11b6ebc 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -117,11 +117,11 @@ var CPControlBlackColor = [CPColor blackColor]; @"text-color": [CPColor blackColor], @"font": [CPFont systemFontOfSize:CPFontCurrentSystemSize], @"text-shadow-color": [CPNull null], - @"text-shadow-offset": _CGSizeMakeZero(), + @"text-shadow-offset": CGSizeMakeZero(), @"image-position": CPImageLeft, @"image-scaling": CPScaleToFit, - @"min-size": _CGSizeMakeZero(), - @"max-size": _CGSizeMake(-1.0, -1.0), + @"min-size": CGSizeMakeZero(), + @"max-size": CGSizeMake(-1.0, -1.0), }; } diff --git a/AppKit/CPDragServer.j b/AppKit/CPDragServer.j index e96bd56aa..f025d3ff7 100644 --- a/AppKit/CPDragServer.j +++ b/AppKit/CPDragServer.j @@ -163,7 +163,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, if (self) { - _draggedWindow = [[CPWindow alloc] initWithContentRect:_CGRectMakeZero() styleMask:CPBorderlessWindowMask]; + _draggedWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessWindowMask]; [_draggedWindow setLevel:CPDraggingWindowLevel]; } @@ -201,7 +201,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, - (void)draggingSourceUpdatedWithGlobalLocation:(CGPoint)aGlobalLocation { if (![CPPlatform supportsDragAndDrop]) - [_draggedWindow setFrameOrigin:_CGPointMake(aGlobalLocation.x - _draggingOffset.width, aGlobalLocation.y - _draggingOffset.height)]; + [_draggedWindow setFrameOrigin:CGPointMake(aGlobalLocation.x - _draggingOffset.width, aGlobalLocation.y - _draggingOffset.height)]; if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_movedTo_) [_draggingSource draggedImage:[_draggedView image] movedTo:aGlobalLocation]; @@ -265,10 +265,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, { if ([scrollView hasVerticalScroller]) { - if (eventLocation.y < _CGRectGetMinY(insetBounds)) - deltaY = _CGRectGetMinY(insetBounds) - eventLocation.y; - else if (eventLocation.y > _CGRectGetMaxY(insetBounds)) - deltaY = _CGRectGetMaxY(insetBounds) - eventLocation.y; + if (eventLocation.y < CGRectGetMinY(insetBounds)) + deltaY = CGRectGetMinY(insetBounds) - eventLocation.y; + else if (eventLocation.y > CGRectGetMaxY(insetBounds)) + deltaY = CGRectGetMaxY(insetBounds) - eventLocation.y; if (deltaY < -insetBounds.size.height) deltaY = -insetBounds.size.height; if (deltaY > insetBounds.size.height) @@ -277,17 +277,17 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, if ([scrollView hasHorizontalScroller]) { - if (eventLocation.x < _CGRectGetMinX(insetBounds)) - deltaX = _CGRectGetMinX(insetBounds) - eventLocation.x; - else if (eventLocation.x > _CGRectGetMaxX(insetBounds)) - deltaX = _CGRectGetMaxX(insetBounds) - eventLocation.x; + if (eventLocation.x < CGRectGetMinX(insetBounds)) + deltaX = CGRectGetMinX(insetBounds) - eventLocation.x; + else if (eventLocation.x > CGRectGetMaxX(insetBounds)) + deltaX = CGRectGetMaxX(insetBounds) - eventLocation.x; if (deltaX < -insetBounds.size.width) deltaX = -insetBounds.size.width; if (deltaX > insetBounds.size.width) deltaX = insetBounds.size.width; } - var scrollPoint = _CGPointMake(bounds.origin.x - deltaX, bounds.origin.y - deltaY); + var scrollPoint = CGPointMake(bounds.origin.x - deltaX, bounds.origin.y - deltaY); [contentView scrollToPoint:scrollPoint]; [[scrollView _headerView] scrollPoint:scrollPoint]; @@ -365,20 +365,20 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, if (mouseDownWindow) mouseDownEventLocation = [mouseDownWindow convertBaseToGlobal:mouseDownEventLocation]; - _draggingOffset = _CGSizeMake(mouseDownEventLocation.x - viewLocation.x, mouseDownEventLocation.y - viewLocation.y); + _draggingOffset = CGSizeMake(mouseDownEventLocation.x - viewLocation.x, mouseDownEventLocation.y - viewLocation.y); } else - _draggingOffset = _CGSizeMakeZero(); + _draggingOffset = CGSizeMakeZero(); if ([CPPlatform isBrowser]) [_draggedWindow setPlatformWindow:[aWindow platformWindow]]; - [aView setFrameOrigin:_CGPointMakeZero()]; + [aView setFrameOrigin:CGPointMakeZero()]; var mouseLocation = [CPEvent mouseLocation]; // Place it where the mouse pointer is. - _startDragLocation = _CGPointMake(mouseLocation.x - _draggingOffset.width, mouseLocation.y - _draggingOffset.height); + _startDragLocation = CGPointMake(mouseLocation.x - _draggingOffset.width, mouseLocation.y - _draggingOffset.height); [_draggedWindow setFrameOrigin:_startDragLocation]; [_draggedWindow setFrameSize:[aView frame].size]; @@ -429,7 +429,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0, var imageSize = [anImage size]; if (!_imageView) - _imageView = [[CPImageView alloc] initWithFrame:_CGRectMake(0.0, 0.0, imageSize.width, imageSize.height)]; + _imageView = [[CPImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, imageSize.width, imageSize.height)]; [_imageView setImage:anImage]; diff --git a/AppKit/CPEvent.j b/AppKit/CPEvent.j index 77ea70792..478a08897 100644 --- a/AppKit/CPEvent.j +++ b/AppKit/CPEvent.j @@ -235,7 +235,7 @@ var _CPEventPeriodicEventPeriod = 0, */ - (CGPoint)locationInWindow { - return _CGPointMakeCopy(_location); + return CGPointMakeCopy(_location); } - (CGPoint)globalLocation @@ -527,7 +527,7 @@ var _CPEventPeriodicEventPeriod = 0, function _CPEventFirePeriodEvent() { - [CPApp sendEvent:[CPEvent otherEventWithType:CPPeriodic location:_CGPointMakeZero() modifierFlags:0 timestamp:[CPEvent currentTimestamp] windowNumber:0 context:nil subtype:0 data1:0 data2:0]]; + [CPApp sendEvent:[CPEvent otherEventWithType:CPPeriodic location:CGPointMakeZero() modifierFlags:0 timestamp:[CPEvent currentTimestamp] windowNumber:0 context:nil subtype:0 data1:0 data2:0]]; } var CPEventClass = [CPEvent class]; diff --git a/AppKit/CPGradient.j b/AppKit/CPGradient.j index dcd861fb0..dfa7a3437 100644 --- a/AppKit/CPGradient.j +++ b/AppKit/CPGradient.j @@ -108,13 +108,13 @@ CPGradientDrawsAfterEndingLocation = kCGGradientDrawsAfterEndLocation; angle = ((angle % 360.0) + 360.0) % 360.0; if (angle < 90.0) - startPoint = _CGPointMake(_CGRectGetMinX(rect), _CGRectGetMinY(rect)); + startPoint = CGPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)); else if (angle < 180.0) - startPoint = _CGPointMake(_CGRectGetMaxX(rect), _CGRectGetMinY(rect)); + startPoint = CGPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)); else if (angle < 270.0) - startPoint = _CGPointMake(_CGRectGetMaxX(rect), _CGRectGetMaxY(rect)); + startPoint = CGPointMake(CGRectGetMaxX(rect), CGRectGetMaxY(rect)); else - startPoint = _CGPointMake(_CGRectGetMinX(rect), _CGRectGetMaxY(rect)); + startPoint = CGPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)); // A line segment comes out of the starting point at the given angle, with the first colour // at the starting point and the last at the end. To do what drawInRect: is supposed to do @@ -129,9 +129,9 @@ CPGradientDrawsAfterEndingLocation = kCGGradientDrawsAfterEndLocation; // This simplifies down to (in the first quadrant) rectWidth * cos(a) + rectHeight * sin(a). var radians = PI * angle / 180.0, - length = ABS(_CGRectGetWidth(rect) * COS(radians)) + ABS(_CGRectGetHeight(rect) * SIN(radians)); + length = ABS(CGRectGetWidth(rect) * COS(radians)) + ABS(CGRectGetHeight(rect) * SIN(radians)); - endPoint = _CGPointMake(startPoint.x + length * COS(radians), + endPoint = CGPointMake(startPoint.x + length * COS(radians), startPoint.y + length * SIN(radians)); [self drawFromPoint:startPoint toPoint:endPoint options:CPGradientDrawsBeforeStartingLocation | CPGradientDrawsAfterEndingLocation]; diff --git a/AppKit/CPGraphics.j b/AppKit/CPGraphics.j index cbf51c440..380bea393 100644 --- a/AppKit/CPGraphics.j +++ b/AppKit/CPGraphics.j @@ -60,9 +60,9 @@ function CPDrawColorTiledRects( if (sides.length != colors.length) [CPException raise:CPInvalidArgumentException reason:@"sides (length: " + sides.length + ") and colors (length: " + colors.length + ") must have the same length."]; - var resultRect = _CGRectMakeCopy(boundsRect), - slice = _CGRectMakeZero(), - remainder = _CGRectMakeZero(), + var resultRect = CGRectMakeCopy(boundsRect), + slice = CGRectMakeZero(), + remainder = CGRectMakeZero(), context = [[CPGraphicsContext currentContext] graphicsPort]; CGContextSaveGState(context); @@ -77,7 +77,7 @@ function CPDrawColorTiledRects( slice = CGRectIntersection(slice, clipRect); // Cocoa docs say that only slices that are within the clipRect are actually drawn - if (_CGRectIsEmpty(slice)) + if (CGRectIsEmpty(slice)) continue; var minX, @@ -88,23 +88,23 @@ function CPDrawColorTiledRects( if (side == CPMinXEdge || side == CPMaxXEdge) { // Make sure we have at least 1 pixel to draw a line - if (_CGRectGetWidth(slice) < 1.0) + if (CGRectGetWidth(slice) < 1.0) continue; - minX = _CGRectGetMinX(slice) + 0.5; + minX = CGRectGetMinX(slice) + 0.5; maxX = minX; - minY = _CGRectGetMinY(slice); - maxY = _CGRectGetMaxY(slice); + minY = CGRectGetMinY(slice); + maxY = CGRectGetMaxY(slice); } else // CPMinYEdge || CPMaxYEdge { // Make sure we have at least 1 pixel to draw a line - if (_CGRectGetHeight(slice) < 1.0) + if (CGRectGetHeight(slice) < 1.0) continue; - minX = _CGRectGetMinX(slice); - maxX = _CGRectGetMaxX(slice); - minY = _CGRectGetMinY(slice) + 0.5; + minX = CGRectGetMinX(slice); + maxX = CGRectGetMaxX(slice); + minY = CGRectGetMinY(slice) + 0.5; maxY = minY; } diff --git a/AppKit/CPImage.j b/AppKit/CPImage.j index 60730cf3c..cc9a9901f 100644 --- a/AppKit/CPImage.j +++ b/AppKit/CPImage.j @@ -48,8 +48,8 @@ var imagesForNames = { }, AppKitImageForNames = { }, ImageDescriptionFormat = "%s {\n filename: \"%s\",\n size: { width:%f, height:%f }\n}"; -AppKitImageForNames[CPImageNameColorPanel] = _CGSizeMake(26.0, 29.0); -AppKitImageForNames[CPImageNameColorPanelHighlighted] = _CGSizeMake(26.0, 29.0); +AppKitImageForNames[CPImageNameColorPanel] = CGSizeMake(26.0, 29.0); +AppKitImageForNames[CPImageNameColorPanelHighlighted] = CGSizeMake(26.0, 29.0); /*! Returns a resource image with a relative path and size @@ -72,7 +72,7 @@ function CPImageInBundle() if (typeof(arguments[1]) === "number") { if (arguments[1] !== nil && arguments[1] !== undefined) - size = _CGSizeMake(arguments[1], arguments[2]); + size = CGSizeMake(arguments[1], arguments[2]); bundle = arguments[3]; } @@ -131,7 +131,7 @@ function CPAppKitImage(aFilename, aSize) - (id)init { - return [self initByReferencingFile:@"" size:_CGSizeMake(-1, -1)]; + return [self initByReferencingFile:@"" size:CGSizeMake(-1, -1)]; } /*! @@ -148,7 +148,7 @@ function CPAppKitImage(aFilename, aSize) if (self) { - _size = _CGSizeMakeCopy(aSize); + _size = CGSizeMakeCopy(aSize); _filename = aFilename; _loadStatus = CPImageLoadStatusInitialized; } @@ -180,7 +180,7 @@ function CPAppKitImage(aFilename, aSize) */ - (id)initWithContentsOfFile:(CPString)aFilename { - self = [self initByReferencingFile:aFilename size:_CGSizeMake(-1, -1)]; + self = [self initByReferencingFile:aFilename size:CGSizeMake(-1, -1)]; if (self) [self load]; @@ -247,7 +247,7 @@ function CPAppKitImage(aFilename, aSize) */ - (void)setSize:(CGSize)aSize { - _size = _CGSizeMakeCopy(aSize); + _size = CGSizeMakeCopy(aSize); } /*! @@ -446,7 +446,7 @@ function CPAppKitImage(aFilename, aSize) // FIXME: IE is wrong on image sizes???? if (!_size || (_size.width == -1 && _size.height == -1)) - _size = _CGSizeMake(_image.width, _image.height); + _size = CGSizeMake(_image.width, _image.height); [[CPNotificationCenter defaultCenter] postNotificationName:CPImageDidLoadNotification diff --git a/AppKit/CPImageView.j b/AppKit/CPImageView.j index 1205fe12c..64a0fe156 100644 --- a/AppKit/CPImageView.j +++ b/AppKit/CPImageView.j @@ -302,8 +302,8 @@ var CPImageViewEmptyPlaceholderImage = nil; y = 0.0, insetWidth = (_hasShadow ? [_shadowView horizontalInset] : 0.0), insetHeight = (_hasShadow ? [_shadowView verticalInset] : 0.0), - boundsWidth = _CGRectGetWidth(bounds), - boundsHeight = _CGRectGetHeight(bounds), + boundsWidth = CGRectGetWidth(bounds), + boundsHeight = CGRectGetHeight(bounds), width = boundsWidth - insetWidth, height = boundsHeight - insetHeight; @@ -401,10 +401,10 @@ var CPImageViewEmptyPlaceholderImage = nil; #endif } - _imageRect = _CGRectMake(x, y, width, height); + _imageRect = CGRectMake(x, y, width, height); if (_hasShadow) - [_shadowView setFrame:_CGRectMake(x - [_shadowView leftInset], y - [_shadowView topInset], width + insetWidth, height + insetHeight)]; + [_shadowView setFrame:CGRectMake(x - [_shadowView leftInset], y - [_shadowView topInset], width + insetWidth, height + insetHeight)]; } - (void)mouseDown:(CPEvent)anEvent @@ -601,4 +601,4 @@ var CPImageViewImageKey = @"CPImageViewImageKey", return image; } -@end \ No newline at end of file +@end diff --git a/AppKit/CPLevelIndicator.j b/AppKit/CPLevelIndicator.j index aa0cb9c76..92a631c42 100644 --- a/AppKit/CPLevelIndicator.j +++ b/AppKit/CPLevelIndicator.j @@ -122,7 +122,7 @@ CPRatingLevelIndicatorStyle = 3; - (CPView)createEphemeralSubviewNamed:(CPString)aName { - return [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + return [[CPView alloc] initWithFrame:CGRectMakeZero()]; } - (CGRect)rectForEphemeralSubviewNamed:(CPString)aViewName @@ -130,11 +130,11 @@ CPRatingLevelIndicatorStyle = 3; // TODO Put into theme attributes. var bezelHeight = 18, segmentHeight = 17, - bounds = _CGRectCreateCopy([self bounds]); + bounds = CGRectCreateCopy([self bounds]); if (aViewName == "bezel") { - bounds.origin.y = (_CGRectGetHeight(bounds) - bezelHeight) / 2.0; + bounds.origin.y = (CGRectGetHeight(bounds) - bezelHeight) / 2.0; bounds.size.height = bezelHeight; return bounds; } @@ -144,13 +144,13 @@ CPRatingLevelIndicatorStyle = 3; segmentCount = _maxValue - _minValue; if (segment >= segmentCount) - return _CGRectMakeZero(); + return CGRectMakeZero(); var basicSegmentWidth = bounds.size.width / segmentCount, segmentFrame = CGRectCreateCopy([self bounds]), spacing = [self valueForThemeAttribute:@"spacing"]; - segmentFrame.origin.y = (_CGRectGetHeight(bounds) - bezelHeight) / 2.0; + segmentFrame.origin.y = (CGRectGetHeight(bounds) - bezelHeight) / 2.0; segmentFrame.origin.x = FLOOR(segment * basicSegmentWidth); segmentFrame.size.width = (segment == segmentCount - 1) ? bounds.size.width - segmentFrame.origin.x : FLOOR(((segment + 1) * basicSegmentWidth)) - FLOOR((segment * basicSegmentWidth)) - spacing; segmentFrame.size.height = segmentHeight; @@ -158,7 +158,7 @@ CPRatingLevelIndicatorStyle = 3; return segmentFrame; } - return _CGRectMakeZero(); + return CGRectMakeZero(); } /*! diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j index 26ae6da2b..5cb310e01 100644 --- a/AppKit/CPMenu/CPMenu.j +++ b/AppKit/CPMenu/CPMenu.j @@ -963,7 +963,7 @@ var _CPMenuBarVisible = NO, { [CPApp sendEvent:[CPEvent otherEventWithType:CPAppKitDefined - location:_CGPointMakeZero() + location:CGPointMakeZero() modifierFlags:0 timestamp:0 windowNumber:0 diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j index bd6c781fe..f02011e7d 100644 --- a/AppKit/CPMenu/_CPMenuBarWindow.j +++ b/AppKit/CPMenu/_CPMenuBarWindow.j @@ -413,7 +413,7 @@ [super setFrame:aRect display:shouldDisplay animate:shouldAnimate]; - if (!_CGSizeEqualToSize(size, aRect.size)) + if (!CGSizeEqualToSize(size, aRect.size)) [self tile]; } diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index 9bd2d363c..85f42419e 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -457,8 +457,8 @@ var STICKY_TIME_INTERVAL = 0.4, { var menuContainer = _menuContainerStack[index], menuContainerFrame = [menuContainer globalFrame], - menuContainerMinX = _CGRectGetMinX(menuContainerFrame), - menuContainerMaxX = _CGRectGetMaxX(menuContainerFrame); + menuContainerMinX = CGRectGetMinX(menuContainerFrame), + menuContainerMaxX = CGRectGetMaxX(menuContainerFrame); // If within the x bounds of this menu container, return it. if (x < menuContainerMaxX && x >= menuContainerMinX) diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index 3b5fad84f..19cf4d6f7 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -80,8 +80,8 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2; - (id)initWithContentRect:(CGRect)aRect styleMask:(unsigned)aStyleMask { - _constraintRect = _CGRectMakeZero(); - _unconstrainedFrame = _CGRectMakeZero(); + _constraintRect = CGRectMakeZero(); + _unconstrainedFrame = CGRectMakeZero(); self = [super initWithContentRect:aRect styleMask:CPBorderlessWindowMask]; @@ -209,26 +209,26 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2; - (CGRect)unconstrainedFrame { - return _CGRectMakeCopy(_unconstrainedFrame); + return CGRectMakeCopy(_unconstrainedFrame); } // We need this because if not this will call setFrame: with -frame instead of -unconstrainedFrame, turning // the constrained frame into the unconstrained frame. - (void)setFrameOrigin:(CGPoint)aPoint { - [super setFrame:_CGRectMake(aPoint.x, aPoint.y, _CGRectGetWidth(_unconstrainedFrame), _CGRectGetHeight(_unconstrainedFrame))]; + [super setFrame:CGRectMake(aPoint.x, aPoint.y, CGRectGetWidth(_unconstrainedFrame), CGRectGetHeight(_unconstrainedFrame))]; } - (void)setFrameSize:(CGSize)aSize { - [super setFrame:_CGRectMake(_CGRectGetMinX(_unconstrainedFrame), _CGRectGetMinY(_unconstrainedFrame), aSize.width, aSize.height)]; + [super setFrame:CGRectMake(CGRectGetMinX(_unconstrainedFrame), CGRectGetMinY(_unconstrainedFrame), aSize.width, aSize.height)]; } - (void)setFrame:(CGRect)aFrame display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate { // FIXME: There are integral window issues with platform windows. // FIXME: This gets called far too often. - _unconstrainedFrame = _CGRectMakeCopy(aFrame); + _unconstrainedFrame = CGRectMakeCopy(aFrame); var constrainedFrame = CGRectIntersection(_unconstrainedFrame, _constraintRect), marginInset = [_menuView valueForThemeAttribute:@"menu-window-margin-inset"], diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 079fb0099..fd538f9e8 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -709,11 +709,11 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, { var theItem = [self itemAtRow:aRow]; if (![self isExpandable:theItem] || ![self _shouldShowOutlineDisclosureControlForItem:theItem]) - return _CGRectMakeZero(); + return CGRectMakeZero(); var dataViewFrame = [self _frameOfOutlineDataViewAtRow:aRow], - disclosureWidth = _CGRectGetWidth([_disclosureControlPrototype frame]), - frame = _CGRectMake(_CGRectGetMinX(dataViewFrame) - disclosureWidth, _CGRectGetMinY(dataViewFrame), disclosureWidth, _CGRectGetHeight(dataViewFrame)); + disclosureWidth = CGRectGetWidth([_disclosureControlPrototype frame]), + frame = CGRectMake(CGRectGetMinX(dataViewFrame) - disclosureWidth, CGRectGetMinY(dataViewFrame), disclosureWidth, CGRectGetHeight(dataViewFrame)); return frame; } @@ -1060,7 +1060,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]], tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], defaultRowHeight = [self valueForThemeAttribute:@"default-row-height"], - bounds = _CGRectMake(0.0, 0.0, [tableColumn width], _CGRectGetHeight([self exposedRect]) + defaultRowHeight), + bounds = CGRectMake(0.0, 0.0, [tableColumn width], CGRectGetHeight([self exposedRect]) + defaultRowHeight), columnRect = [self rectOfColumn:theColumnIndex], headerView = [tableColumn headerView], row = [_exposedRows firstIndex]; @@ -1074,7 +1074,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, dataViewFrame.origin.x = 0.0; // Offset by table header height - scroll position - dataViewFrame.origin.y = ( _CGRectGetMinY(dataViewFrame) - _CGRectGetMinY([self exposedRect]) ) + defaultRowHeight; + dataViewFrame.origin.y = (CGRectGetMinY(dataViewFrame) - CGRectGetMinY([self exposedRect])) + defaultRowHeight; [dataView setFrame:dataViewFrame]; [dataView setObjectValue:[self _objectValueForTableColumn:tableColumn row:row]]; @@ -1098,7 +1098,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, // Add the column header view var headerFrame = [headerView frame]; - headerFrame.origin = _CGPointMakeZero(); + headerFrame.origin = CGPointMakeZero(); var columnHeaderView = [[_CPTableColumnHeaderView alloc] initWithFrame:headerFrame]; [columnHeaderView setStringValue:[headerView stringValue]]; @@ -1304,7 +1304,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, var disclosureControlFrame = [self frameOfOutlineDisclosureControlAtRow:row]; - if (_CGRectIsEmpty(disclosureControlFrame)) + if (CGRectIsEmpty(disclosureControlFrame)) continue; var control = [self _dequeueDisclosureControl]; @@ -1361,7 +1361,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, - (void)_toggleFromDisclosureControl:(CPControl)aControl { var controlFrame = [aControl frame], - item = [self itemAtRow:[self rowAtPoint:_CGPointMake(_CGRectGetMinX(controlFrame), _CGRectGetMidY(controlFrame))]]; + item = [self itemAtRow:[self rowAtPoint:CGPointMake(CGRectGetMinX(controlFrame), CGRectGetMidY(controlFrame))]]; if ([self isItemExpanded:item]) [self collapseItem:item]; @@ -1936,14 +1936,14 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt { var bounds = [self bounds], context = [[CPGraphicsContext currentContext] graphicsPort], - width = _CGRectGetWidth(bounds), - height = _CGRectGetHeight(bounds); + width = CGRectGetWidth(bounds), + height = CGRectGetHeight(bounds); CGContextBeginPath(context); if (_angle) { - var centre = _CGPointMake(FLOOR(width / 2.0), FLOOR(height / 2.0)); + var centre = CGPointMake(FLOOR(width / 2.0), FLOOR(height / 2.0)); CGContextTranslateCTM(context, centre.x, centre.y); CGContextRotateCTM(context, _angle); CGContextTranslateCTM(context, -centre.x, -centre.y); diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j index 1bc74dcaa..e0ea06ab4 100644 --- a/AppKit/CPProgressIndicator.j +++ b/AppKit/CPProgressIndicator.j @@ -371,7 +371,7 @@ var CPProgressIndicatorSpinningStyleColors = []; - (CPView)createEphemeralSubviewNamed:(CPString)aName { - return [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + return [[CPView alloc] initWithFrame:CGRectMakeZero()]; } - (CGRect)rectForEphemeralSubviewNamed:(CPString)aViewName @@ -387,7 +387,7 @@ var CPProgressIndicatorSpinningStyleColors = []; if (_indeterminate) barWidth = width; - return _CGRectMake(0, 0, barWidth, [self valueForThemeAttribute:@"default-height"]); + return CGRectMake(0, 0, barWidth, [self valueForThemeAttribute:@"default-height"]); } return nil; diff --git a/AppKit/CPScreen.j b/AppKit/CPScreen.j index afa8ef2d5..e4a763088 100644 --- a/AppKit/CPScreen.j +++ b/AppKit/CPScreen.j @@ -43,9 +43,9 @@ - (CGRect)visibleFrame { #if PLATFORM(DOM) - return _CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight); + return CGRectMake(window.screen.availLeft, window.screen.availTop, window.screen.availWidth, window.screen.availHeight); #else - return _CGRectMakeZero(); + return CGRectMakeZero(); #endif } diff --git a/AppKit/CPScrollView.j b/AppKit/CPScrollView.j index fa957fc60..f8ce6820b 100644 --- a/AppKit/CPScrollView.j +++ b/AppKit/CPScrollView.j @@ -151,7 +151,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay, + (CGSize)contentSizeForFrameSize:(CGSize)frameSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType { - var bounds = [self _insetBounds:_CGRectMake(0.0, 0.0, frameSize.width, frameSize.height) borderType:borderType], + var bounds = [self _insetBounds:CGRectMake(0.0, 0.0, frameSize.width, frameSize.height) borderType:borderType], scrollerWidth = [CPScroller scrollerWidth]; if (hFlag) @@ -165,10 +165,10 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay, + (CGSize)frameSizeForContentSize:(CGSize)contentSize hasHorizontalScroller:(BOOL)hFlag hasVerticalScroller:(BOOL)vFlag borderType:(CPBorderType)borderType { - var bounds = [self _insetBounds:_CGRectMake(0.0, 0.0, contentSize.width, contentSize.height) borderType:borderType], + var bounds = [self _insetBounds:CGRectMake(0.0, 0.0, contentSize.width, contentSize.height) borderType:borderType], widthInset = contentSize.width - bounds.size.width, heightInset = contentSize.height - bounds.size.height, - frameSize = _CGSizeMake(contentSize.width + widthInset, contentSize.height + heightInset), + frameSize = CGSizeMake(contentSize.width + widthInset, contentSize.height + heightInset), scrollerWidth = [CPScroller scrollerWidth]; if (hFlag) @@ -186,10 +186,10 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay, { case CPLineBorder: case CPBezelBorder: - return _CGRectInset(bounds, 1.0, 1.0); + return CGRectInset(bounds, 1.0, 1.0); case CPGrooveBorder: - bounds = _CGRectInset(bounds, 2.0, 2.0); + bounds = CGRectInset(bounds, 2.0, 2.0); ++bounds.origin.y; --bounds.size.height; return bounds; @@ -517,8 +517,8 @@ Notifies the delegate when the scroll view has finished scrolling. { var bounds = [self _insetBounds]; - [self setHorizontalScroller:[[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, MAX(_CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1), [CPScroller scrollerWidthInStyle:_scrollerStyle])]]; - [[self horizontalScroller] setFrameSize:CGSizeMake(_CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle])]; + [self setHorizontalScroller:[[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, MAX(CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1), [CPScroller scrollerWidthInStyle:_scrollerStyle])]]; + [[self horizontalScroller] setFrameSize:CGSizeMake(CGRectGetWidth(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle])]; } [self reflectScrolledClipView:_contentView]; @@ -582,8 +582,8 @@ Notifies the delegate when the scroll view has finished scrolling. { var bounds = [self _insetBounds]; - [self setVerticalScroller:[[CPScroller alloc] initWithFrame:_CGRectMake(0.0, 0.0, [CPScroller scrollerWidthInStyle:_scrollerStyle], MAX(_CGRectGetHeight(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1))]]; - [[self verticalScroller] setFrameSize:CGSizeMake([CPScroller scrollerWidthInStyle:_scrollerStyle], _CGRectGetHeight(bounds))]; + [self setVerticalScroller:[[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, [CPScroller scrollerWidthInStyle:_scrollerStyle], MAX(CGRectGetHeight(bounds), [CPScroller scrollerWidthInStyle:_scrollerStyle] + 1))]]; + [[self verticalScroller] setFrameSize:CGSizeMake([CPScroller scrollerWidthInStyle:_scrollerStyle], CGRectGetHeight(bounds))]; } [self reflectScrolledClipView:_contentView]; @@ -859,13 +859,13 @@ Notifies the delegate when the scroll view has finished scrolling. - (CGRect)_cornerViewFrame { if (!_cornerView) - return _CGRectMakeZero(); + return CGRectMakeZero(); var bounds = [self _insetBounds], frame = [_cornerView frame]; - frame.origin.x = _CGRectGetMaxX(bounds) - _CGRectGetWidth(frame); - frame.origin.y = _CGRectGetMinY(bounds); + frame.origin.x = CGRectGetMaxX(bounds) - CGRectGetWidth(frame); + frame.origin.y = CGRectGetMinY(bounds); return frame; } @@ -876,14 +876,14 @@ Notifies the delegate when the scroll view has finished scrolling. var headerView = [self _headerView]; if (!headerView) - return _CGRectMakeZero(); + return CGRectMakeZero(); var frame = [self _insetBounds]; - frame.size.height = _CGRectGetHeight([headerView frame]); + frame.size.height = CGRectGetHeight([headerView frame]); if (SHOULD_SHOW_CORNER_VIEW()) - frame.size.width -= _CGRectGetWidth([self _cornerViewFrame]); + frame.size.width -= CGRectGetWidth([self _cornerViewFrame]); return frame; } @@ -924,18 +924,18 @@ Notifies the delegate when the scroll view has finished scrolling. break; case CPScrollerDecrementPage: - contentBounds.origin.y -= _CGRectGetHeight(contentBounds) - _verticalPageScroll; + contentBounds.origin.y -= CGRectGetHeight(contentBounds) - _verticalPageScroll; break; case CPScrollerIncrementPage: - contentBounds.origin.y += _CGRectGetHeight(contentBounds) - _verticalPageScroll; + contentBounds.origin.y += CGRectGetHeight(contentBounds) - _verticalPageScroll; break; // We want integral bounds! case CPScrollerKnobSlot: case CPScrollerKnob: default: - contentBounds.origin.y = ROUND(value * (_CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds))); + contentBounds.origin.y = ROUND(value * (CGRectGetHeight(documentFrame) - CGRectGetHeight(contentBounds))); } [self _sendDelegateMessages]; @@ -961,18 +961,18 @@ Notifies the delegate when the scroll view has finished scrolling. break; case CPScrollerDecrementPage: - contentBounds.origin.x -= _CGRectGetWidth(contentBounds) - _horizontalPageScroll; + contentBounds.origin.x -= CGRectGetWidth(contentBounds) - _horizontalPageScroll; break; case CPScrollerIncrementPage: - contentBounds.origin.x += _CGRectGetWidth(contentBounds) - _horizontalPageScroll; + contentBounds.origin.x += CGRectGetWidth(contentBounds) - _horizontalPageScroll; break; // We want integral bounds! case CPScrollerKnobSlot: case CPScrollerKnob: default: - contentBounds.origin.x = ROUND(value * (_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentBounds))); + contentBounds.origin.x = ROUND(value * (CGRectGetWidth(documentFrame) - CGRectGetWidth(contentBounds))); } [self _sendDelegateMessages]; @@ -1096,7 +1096,7 @@ Notifies the delegate when the scroll view has finished scrolling. } [_contentView setFrame:[self _insetBounds]]; - [_headerClipView setFrame:_CGRectMakeZero()]; + [_headerClipView setFrame:CGRectMakeZero()]; --_recursionCount; @@ -1106,12 +1106,12 @@ Notifies the delegate when the scroll view has finished scrolling. var documentFrame = [documentView frame], // the size of the whole document contentFrame = [self _insetBounds], // assume it takes up the entire size of the scrollview (no scrollers) headerClipViewFrame = [self _headerClipViewFrame], - headerClipViewHeight = _CGRectGetHeight(headerClipViewFrame); + headerClipViewHeight = CGRectGetHeight(headerClipViewFrame); contentFrame.origin.y += headerClipViewHeight; contentFrame.size.height -= headerClipViewHeight; - var difference = _CGSizeMake(_CGRectGetWidth(documentFrame) - _CGRectGetWidth(contentFrame), _CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentFrame)), + var difference = CGSizeMake(CGRectGetWidth(documentFrame) - CGRectGetWidth(contentFrame), CGRectGetHeight(documentFrame) - CGRectGetHeight(contentFrame)), verticalScrollerWidth = [CPScroller scrollerWidthInStyle:[_verticalScroller style]], horizontalScrollerHeight = [CPScroller scrollerWidthInStyle:[_horizontalScroller style]], hasVerticalScroll = difference.height > 0.0, @@ -1162,18 +1162,18 @@ Notifies the delegate when the scroll view has finished scrolling. if (shouldShowVerticalScroller) { var verticalScrollerY = - MAX(_CGRectGetMinY(contentFrame), MAX(_CGRectGetMaxY([self _cornerViewFrame]), _CGRectGetMaxY(headerClipViewFrame))); + MAX(CGRectGetMinY(contentFrame), MAX(CGRectGetMaxY([self _cornerViewFrame]), CGRectGetMaxY(headerClipViewFrame))); - var verticalScrollerHeight = _CGRectGetMaxY(contentFrame) - verticalScrollerY; + var verticalScrollerHeight = CGRectGetMaxY(contentFrame) - verticalScrollerY; // Make a gap at the bottom of the vertical scroller so that the horizontal and vertical can't overlap. if (_scrollerStyle === CPScrollerStyleOverlay && hasHorizontalScroll) verticalScrollerHeight -= horizontalScrollerHeight; - var documentHeight = _CGRectGetHeight(documentFrame); + var documentHeight = CGRectGetHeight(documentFrame); [_verticalScroller setFloatValue:(difference.height <= 0.0) ? 0.0 : scrollPoint.y / difference.height]; - [_verticalScroller setKnobProportion:documentHeight > 0 ? _CGRectGetHeight(contentFrame) / documentHeight : 1.0]; - [_verticalScroller setFrame:_CGRectMake(_CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)]; + [_verticalScroller setKnobProportion:documentHeight > 0 ? CGRectGetHeight(contentFrame) / documentHeight : 1.0]; + [_verticalScroller setFrame:CGRectMake(CGRectGetMaxX(contentFrame) - overlay, verticalScrollerY, verticalScrollerWidth, verticalScrollerHeight)]; } else if (wasShowingVerticalScroller) { @@ -1183,16 +1183,16 @@ Notifies the delegate when the scroll view has finished scrolling. if (shouldShowHorizontalScroller) { - var horizontalScrollerWidth = _CGRectGetWidth(contentFrame); + var horizontalScrollerWidth = CGRectGetWidth(contentFrame); // Make a gap at the bottom of the vertical scroller so that the horizontal and vertical can't overlap. if (_scrollerStyle === CPScrollerStyleOverlay && hasVerticalScroll) horizontalScrollerWidth -= verticalScrollerWidth; - var documentWidth = _CGRectGetWidth(documentFrame); + var documentWidth = CGRectGetWidth(documentFrame); [_horizontalScroller setFloatValue:(difference.width <= 0.0) ? 0.0 : scrollPoint.x / difference.width]; - [_horizontalScroller setKnobProportion:documentWidth > 0 ? _CGRectGetWidth(contentFrame) / documentWidth : 1.0]; - [_horizontalScroller setFrame:_CGRectMake(_CGRectGetMinX(contentFrame), _CGRectGetMaxY(contentFrame) - overlay, horizontalScrollerWidth, horizontalScrollerHeight)]; + [_horizontalScroller setKnobProportion:documentWidth > 0 ? CGRectGetWidth(contentFrame) / documentWidth : 1.0]; + [_horizontalScroller setFrame:CGRectMake(CGRectGetMinX(contentFrame), CGRectGetMaxY(contentFrame) - overlay, horizontalScrollerWidth, horizontalScrollerHeight)]; } else if (wasShowingHorizontalScroller) { @@ -1272,7 +1272,7 @@ Notifies the delegate when the scroll view has finished scrolling. { case CPLineBorder: CGContextSetStrokeColor(context, [self currentValueForThemeAttribute:@"border-color"]); - CGContextStrokeRect(context, _CGRectInset(strokeRect, 0.5, 0.5)); + CGContextStrokeRect(context, CGRectInset(strokeRect, 0.5, 0.5)); break; case CPBezelBorder: @@ -1290,10 +1290,10 @@ Notifies the delegate when the scroll view has finished scrolling. - (void)_drawGrayBezelInContext:(CGContext)context bounds:(CGRect)aRect { - var minX = _CGRectGetMinX(aRect), - maxX = _CGRectGetMaxX(aRect), - minY = _CGRectGetMinY(aRect), - maxY = _CGRectGetMaxY(aRect), + var minX = CGRectGetMinX(aRect), + maxX = CGRectGetMaxX(aRect), + minY = CGRectGetMinY(aRect), + maxY = CGRectGetMaxY(aRect), y = minY + 0.5; // Slightly darker line on top. @@ -1324,10 +1324,10 @@ Notifies the delegate when the scroll view has finished scrolling. - (void)_drawGrooveInContext:(CGContext)context bounds:(CGRect)aRect { - var minX = _CGRectGetMinX(aRect), - maxX = _CGRectGetMaxX(aRect), - minY = _CGRectGetMinY(aRect), - maxY = _CGRectGetMaxY(aRect); + var minX = CGRectGetMinX(aRect), + maxX = CGRectGetMaxX(aRect), + minY = CGRectGetMinY(aRect), + maxY = CGRectGetMaxY(aRect); CGContextBeginPath(context); CGContextSetStrokeColor(context, [CPColor colorWithWhite:159.0 / 255.0 alpha:1.0]); @@ -1357,11 +1357,11 @@ Notifies the delegate when the scroll view has finished scrolling. CGContextBeginPath(context); CGContextSetStrokeColor(context, [CPColor whiteColor]); - var rect = _CGRectOffset(aRect, 1.0, 1.0); + var rect = CGRectOffset(aRect, 1.0, 1.0); rect.size.width -= 1.0; rect.size.height -= 1.0; - CGContextStrokeRect(context, _CGRectInset(rect, 0.5, 0.5)); + CGContextStrokeRect(context, CGRectInset(rect, 0.5, 0.5)); CGContextBeginPath(context); CGContextSetStrokeColor(context, [CPColor colorWithWhite:192.0 / 255.0 alpha:1.0]); @@ -1395,29 +1395,29 @@ Notifies the delegate when the scroll view has finished scrolling. - (void)scrollPageUp:(id)sender { var contentBounds = [_contentView bounds]; - [self moveByOffset:CGSizeMake(0.0, -(_CGRectGetHeight(contentBounds) - _verticalPageScroll))]; + [self moveByOffset:CGSizeMake(0.0, -(CGRectGetHeight(contentBounds) - _verticalPageScroll))]; } - (void)scrollPageDown:(id)sender { var contentBounds = [_contentView bounds]; - [self moveByOffset:CGSizeMake(0.0, _CGRectGetHeight(contentBounds) - _verticalPageScroll)]; + [self moveByOffset:CGSizeMake(0.0, CGRectGetHeight(contentBounds) - _verticalPageScroll)]; } - (void)scrollToBeginningOfDocument:(id)sender { - [_contentView scrollToPoint:_CGPointMakeZero()]; - [_headerClipView scrollToPoint:_CGPointMakeZero()]; + [_contentView scrollToPoint:CGPointMakeZero()]; + [_headerClipView scrollToPoint:CGPointMakeZero()]; } - (void)scrollToEndOfDocument:(id)sender { var contentBounds = [_contentView bounds], documentFrame = [[self documentView] frame], - scrollPoint = _CGPointMake(0.0, _CGRectGetHeight(documentFrame) - _CGRectGetHeight(contentBounds)); + scrollPoint = CGPointMake(0.0, CGRectGetHeight(documentFrame) - CGRectGetHeight(contentBounds)); [_contentView scrollToPoint:scrollPoint]; - [_headerClipView scrollToPoint:_CGPointMakeZero()]; + [_headerClipView scrollToPoint:CGPointMakeZero()]; } - (void)moveLeft:(id)sender diff --git a/AppKit/CPScroller.j b/AppKit/CPScroller.j index 92afb74ca..e5a19a0f8 100644 --- a/AppKit/CPScroller.j +++ b/AppKit/CPScroller.j @@ -116,11 +116,11 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); @"decrement-line-color": [CPNull null], @"increment-line-color": [CPNull null], @"knob-color": [CPNull null], - @"decrement-line-size":_CGSizeMakeZero(), - @"increment-line-size":_CGSizeMakeZero(), - @"track-inset":_CGInsetMakeZero(), - @"knob-inset": _CGInsetMakeZero(), - @"minimum-knob-length":21.0, + @"decrement-line-size": CGSizeMakeZero(), + @"increment-line-size": CGSizeMakeZero(), + @"track-inset": CGInsetMakeZero(), + @"knob-inset": CGInsetMakeZero(), + @"minimum-knob-length": 21.0, @"track-border-overlay": 9.0 }; } @@ -194,7 +194,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); // We have to choose an orientation. If for some bizarre reason width === height, // punt and choose vertical. - [self _setIsVertical:_CGRectGetHeight(aFrame) >= _CGRectGetWidth(aFrame)]; + [self _setIsVertical:CGRectGetHeight(aFrame) >= CGRectGetWidth(aFrame)]; } return self; @@ -321,7 +321,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); - (CGRect)rectForPart:(CPScrollerPart)aPart { if (aPart == CPScrollerNoPart) - return _CGRectMakeZero(); + return CGRectMakeZero(); return _partRects[aPart]; } @@ -391,8 +391,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); var knobInset = [self currentValueForThemeAttribute:@"knob-inset"], trackInset = [self currentValueForThemeAttribute:@"track-inset"], - width = _CGRectGetWidth(bounds), - height = _CGRectGetHeight(bounds); + width = CGRectGetWidth(bounds), + height = CGRectGetHeight(bounds); if ([self isVertical]) { @@ -406,21 +406,21 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); knobHeight = MAX(minimumKnobLength, (slotSize * _knobProportion)), knobLocation = effectiveDecrementLineHeight + (slotSize - knobHeight) * [self floatValue]; - _partRects[CPScrollerDecrementPage] = _CGRectMake(0.0, effectiveDecrementLineHeight, width, knobLocation - effectiveDecrementLineHeight); - _partRects[CPScrollerKnob] = _CGRectMake(knobInset.left, knobLocation, knobWidth, knobHeight); - _partRects[CPScrollerIncrementPage] = _CGRectMake(0.0, knobLocation + knobHeight, width, height - (knobLocation + knobHeight) - effectiveIncrementLineHeight); - _partRects[CPScrollerKnobSlot] = _CGRectMake(trackInset.left, effectiveDecrementLineHeight, width - trackInset.left - trackInset.right, slotSize); - _partRects[CPScrollerDecrementLine] = _CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height); - _partRects[CPScrollerIncrementLine] = _CGRectMake(0.0, height - incrementLineSize.height, incrementLineSize.width, incrementLineSize.height); + _partRects[CPScrollerDecrementPage] = CGRectMake(0.0, effectiveDecrementLineHeight, width, knobLocation - effectiveDecrementLineHeight); + _partRects[CPScrollerKnob] = CGRectMake(knobInset.left, knobLocation, knobWidth, knobHeight); + _partRects[CPScrollerIncrementPage] = CGRectMake(0.0, knobLocation + knobHeight, width, height - (knobLocation + knobHeight) - effectiveIncrementLineHeight); + _partRects[CPScrollerKnobSlot] = CGRectMake(trackInset.left, effectiveDecrementLineHeight, width - trackInset.left - trackInset.right, slotSize); + _partRects[CPScrollerDecrementLine] = CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height); + _partRects[CPScrollerIncrementLine] = CGRectMake(0.0, height - incrementLineSize.height, incrementLineSize.width, incrementLineSize.height); if (height < knobHeight + decrementLineSize.height + incrementLineSize.height + trackInset.top + trackInset.bottom) - _partRects[CPScrollerKnob] = _CGRectMakeZero(); + _partRects[CPScrollerKnob] = CGRectMakeZero(); if (height < decrementLineSize.height + incrementLineSize.height - 2) { - _partRects[CPScrollerIncrementLine] = _CGRectMakeZero(); - _partRects[CPScrollerDecrementLine] = _CGRectMakeZero(); - _partRects[CPScrollerKnobSlot] = _CGRectMake(trackInset.left, 0, width - trackInset.left - trackInset.right, height); + _partRects[CPScrollerIncrementLine] = CGRectMakeZero(); + _partRects[CPScrollerDecrementLine] = CGRectMakeZero(); + _partRects[CPScrollerKnobSlot] = CGRectMake(trackInset.left, 0, width - trackInset.left - trackInset.right, height); } } else @@ -435,21 +435,21 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); knobHeight = height - knobInset.top - knobInset.bottom, knobLocation = effectiveDecrementLineWidth + (slotSize - knobWidth) * [self floatValue]; - _partRects[CPScrollerDecrementPage] = _CGRectMake(effectiveDecrementLineWidth, 0.0, knobLocation - effectiveDecrementLineWidth, height); - _partRects[CPScrollerKnob] = _CGRectMake(knobLocation, knobInset.top, knobWidth, knobHeight); - _partRects[CPScrollerIncrementPage] = _CGRectMake(knobLocation + knobWidth, 0.0, width - (knobLocation + knobWidth) - effectiveIncrementLineWidth, height); - _partRects[CPScrollerKnobSlot] = _CGRectMake(effectiveDecrementLineWidth, trackInset.top, slotSize, height - trackInset.top - trackInset.bottom); - _partRects[CPScrollerDecrementLine] = _CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height); - _partRects[CPScrollerIncrementLine] = _CGRectMake(width - incrementLineSize.width, 0.0, incrementLineSize.width, incrementLineSize.height); + _partRects[CPScrollerDecrementPage] = CGRectMake(effectiveDecrementLineWidth, 0.0, knobLocation - effectiveDecrementLineWidth, height); + _partRects[CPScrollerKnob] = CGRectMake(knobLocation, knobInset.top, knobWidth, knobHeight); + _partRects[CPScrollerIncrementPage] = CGRectMake(knobLocation + knobWidth, 0.0, width - (knobLocation + knobWidth) - effectiveIncrementLineWidth, height); + _partRects[CPScrollerKnobSlot] = CGRectMake(effectiveDecrementLineWidth, trackInset.top, slotSize, height - trackInset.top - trackInset.bottom); + _partRects[CPScrollerDecrementLine] = CGRectMake(0.0, 0.0, decrementLineSize.width, decrementLineSize.height); + _partRects[CPScrollerIncrementLine] = CGRectMake(width - incrementLineSize.width, 0.0, incrementLineSize.width, incrementLineSize.height); if (width < knobWidth + decrementLineSize.width + incrementLineSize.width + trackInset.left + trackInset.right) - _partRects[CPScrollerKnob] = _CGRectMakeZero(); + _partRects[CPScrollerKnob] = CGRectMakeZero(); if (width < decrementLineSize.width + incrementLineSize.width - 2) { - _partRects[CPScrollerIncrementLine] = _CGRectMakeZero(); - _partRects[CPScrollerDecrementLine] = _CGRectMakeZero(); - _partRects[CPScrollerKnobSlot] = _CGRectMake(0.0, 0.0, width, slotSize); + _partRects[CPScrollerIncrementLine] = CGRectMakeZero(); + _partRects[CPScrollerDecrementLine] = CGRectMakeZero(); + _partRects[CPScrollerKnobSlot] = CGRectMake(0.0, 0.0, width, slotSize); } } } @@ -517,7 +517,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); - (CPView)createViewForPart:(CPScrollerPart)aPart { - var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; @@ -531,7 +531,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); - (CPView)createEphemeralSubviewNamed:(CPString)aName { - var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; @@ -606,7 +606,7 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); { var knobRect = [self rectForPart:CPScrollerKnob], knobSlotRect = [self rectForPart:CPScrollerKnobSlot], - remainder = ![self isVertical] ? (_CGRectGetWidth(knobSlotRect) - _CGRectGetWidth(knobRect)) : (_CGRectGetHeight(knobSlotRect) - _CGRectGetHeight(knobRect)); + remainder = ![self isVertical] ? (CGRectGetWidth(knobSlotRect) - CGRectGetWidth(knobRect)) : (CGRectGetHeight(knobSlotRect) - CGRectGetHeight(knobRect)); if (remainder <= 0) [self setFloatValue:0.0]; @@ -660,11 +660,11 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark"); else if (_trackingPart === CPScrollerDecrementPage || _trackingPart === CPScrollerIncrementPage) { var knobRect = [self rectForPart:CPScrollerKnob], - knobWidth = ![self isVertical] ? _CGRectGetWidth(knobRect) : _CGRectGetHeight(knobRect), + knobWidth = ![self isVertical] ? CGRectGetWidth(knobRect) : CGRectGetHeight(knobRect), knobSlotRect = [self rectForPart:CPScrollerKnobSlot], - remainder = (![self isVertical] ? _CGRectGetWidth(knobSlotRect) : _CGRectGetHeight(knobSlotRect)) - knobWidth; + remainder = (![self isVertical] ? CGRectGetWidth(knobSlotRect) : CGRectGetHeight(knobSlotRect)) - knobWidth; - [self setFloatValue:((![self isVertical] ? _trackingStartPoint.x - _CGRectGetMinX(knobSlotRect) : _trackingStartPoint.y - _CGRectGetMinY(knobSlotRect)) - knobWidth / 2.0) / remainder]; + [self setFloatValue:((![self isVertical] ? _trackingStartPoint.x - CGRectGetMinX(knobSlotRect) : _trackingStartPoint.y - CGRectGetMinY(knobSlotRect)) - knobWidth / 2.0) / remainder]; _hitPart = CPScrollerKnob; diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 11a2ce4ef..4fea175d5 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -229,22 +229,22 @@ var RECENT_SEARCH_PREFIX = @" "; - (CGRect)searchTextRectForBounds:(CGRect)rect { var leftOffset = 0, - width = _CGRectGetWidth(rect), + width = CGRectGetWidth(rect), bounds = [self bounds]; if (_searchButton) { var searchBounds = [self searchButtonRectForBounds:bounds]; - leftOffset = _CGRectGetMaxX(searchBounds) + 2; + leftOffset = CGRectGetMaxX(searchBounds) + 2; } if (_cancelButton) { var cancelRect = [self cancelButtonRectForBounds:bounds]; - width = _CGRectGetMinX(cancelRect) - leftOffset; + width = CGRectGetMinX(cancelRect) - leftOffset; } - return _CGRectMake(leftOffset, _CGRectGetMinY(rect), width, _CGRectGetHeight(rect)); + return CGRectMake(leftOffset, CGRectGetMinY(rect), width, CGRectGetHeight(rect)); } /*! @@ -256,7 +256,7 @@ var RECENT_SEARCH_PREFIX = @" "; { var size = [[self valueForThemeAttribute:@"image-search"] size] || CGSizeMakeZero(); - return _CGRectMake(5, (_CGRectGetHeight(rect) - size.height) / 2, size.width, size.height); + return CGRectMake(5, (CGRectGetHeight(rect) - size.height) / 2, size.width, size.height); } /*! @@ -268,7 +268,7 @@ var RECENT_SEARCH_PREFIX = @" "; { var size = [[self valueForThemeAttribute:@"image-cancel"] size] || CGSizeMakeZero(); - return _CGRectMake(_CGRectGetWidth(rect) - size.width - 5, (_CGRectGetHeight(rect) - size.width) / 2, size.height, size.height); + return CGRectMake(CGRectGetWidth(rect) - size.width - 5, (CGRectGetHeight(rect) - size.width) / 2, size.height, size.height); } // Managing Menu Templates @@ -482,7 +482,7 @@ var RECENT_SEARCH_PREFIX = @" "; - (CPView)hitTest:(CGPoint)aPoint { // Make sure a hit anywhere within the search field returns the search field itself - if (_CGRectContainsPoint([self frame], aPoint)) + if (CGRectContainsPoint([self frame], aPoint)) return self; else return nil; @@ -498,7 +498,7 @@ var RECENT_SEARCH_PREFIX = @" "; var location = [anEvent locationInWindow], point = [self convertPoint:location fromView:nil]; - if (_CGRectContainsPoint([self searchButtonRectForBounds:[self bounds]], point)) + if (CGRectContainsPoint([self searchButtonRectForBounds:[self bounds]], point)) { if (_searchMenuTemplate == nil) { @@ -510,7 +510,7 @@ var RECENT_SEARCH_PREFIX = @" "; else [self _showMenu]; } - else if (_CGRectContainsPoint([self cancelButtonRectForBounds:[self bounds]], point)) + else if (CGRectContainsPoint([self cancelButtonRectForBounds:[self bounds]], point)) [_cancelButton mouseDown:anEvent]; else [super mouseDown:anEvent]; diff --git a/AppKit/CPSegmentedControl.j b/AppKit/CPSegmentedControl.j index 2c04d19b8..28f8bdc95 100644 --- a/AppKit/CPSegmentedControl.j +++ b/AppKit/CPSegmentedControl.j @@ -63,8 +63,8 @@ CPSegmentSwitchTrackingMomentary = 2; @"vertical-alignment": CPCenterVerticalTextAlignment, @"image-position": CPImageLeft, @"image-scaling": CPImageScaleNone, - @"bezel-inset": _CGInsetMakeZero(), - @"content-inset": _CGInsetMakeZero(), + @"bezel-inset": CGInsetMakeZero(), + @"content-inset": CGInsetMakeZero(), @"left-segment-bezel-color": [CPNull null], @"right-segment-bezel-color": [CPNull null], @"center-segment-bezel-color": [CPNull null], @@ -564,9 +564,9 @@ CPSegmentSwitchTrackingMomentary = 2; - (CPView)createEphemeralSubviewNamed:(CPString)aName { if ([aName hasPrefix:@"segment-content"]) - return [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; + return [[_CPImageAndTextView alloc] initWithFrame:CGRectMakeZero()]; - return [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + return [[CPView alloc] initWithFrame:CGRectMakeZero()]; } - (void)layoutSubviews diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index fb1092022..942477ecf 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -60,7 +60,7 @@ CPThemeStateShadowViewHeavy = CPThemeState("shadowview-style-heavy"); var shadowView = [CPShadowView new], inset = [shadowView valueForThemeAttribute:@"content-inset" inState:(aWeight == CPLightShadow) ? CPThemeStateShadowViewLight : CPThemeStateShadowViewHeavy]; - return CGRectMake(_CGRectGetMinX(aFrame) - inset.left, _CGRectGetMinY(aFrame) - inset.top, _CGRectGetWidth(aFrame) + inset.left + inset.right, _CGRectGetHeight(aFrame) + inset.top + inset.bottom); + return CGRectMake(CGRectGetMinX(aFrame) - inset.left, CGRectGetMinY(aFrame) - inset.top, CGRectGetWidth(aFrame) + inset.left + inset.right, CGRectGetHeight(aFrame) + inset.top + inset.bottom); } + (id)shadowViewEnclosingView:(CPView)aView diff --git a/AppKit/CPSlider.j b/AppKit/CPSlider.j index 54bc0c36f..b9b7e92da 100644 --- a/AppKit/CPSlider.j +++ b/AppKit/CPSlider.j @@ -53,7 +53,7 @@ CPCircularSlider = 1; { return @{ @"knob-color": [CPNull null], - @"knob-size": _CGSizeMakeZero(), + @"knob-size": CGSizeMakeZero(), @"track-width": 0.0, @"track-color": [CPNull null], }; @@ -162,16 +162,16 @@ CPCircularSlider = 1; var trackWidth = [self currentValueForThemeAttribute:@"track-width"]; if (trackWidth <= 0) - return _CGRectMakeZero(); + return CGRectMakeZero(); if ([self isVertical]) { - bounds.origin.x = (_CGRectGetWidth(bounds) - trackWidth) / 2.0; + bounds.origin.x = (CGRectGetWidth(bounds) - trackWidth) / 2.0; bounds.size.width = trackWidth; } else { - bounds.origin.y = (_CGRectGetHeight(bounds) - trackWidth) / 2.0; + bounds.origin.y = (CGRectGetHeight(bounds) - trackWidth) / 2.0; bounds.size.height = trackWidth; } } @@ -184,13 +184,13 @@ CPCircularSlider = 1; var knobSize = [self currentValueForThemeAttribute:@"knob-size"]; if (knobSize.width <= 0 || knobSize.height <= 0) - return _CGRectMakeZero(); + return CGRectMakeZero(); - var knobRect = _CGRectMake(0.0, 0.0, knobSize.width, knobSize.height), + var knobRect = CGRectMake(0.0, 0.0, knobSize.width, knobSize.height), trackRect = [self trackRectForBounds:bounds]; // No track, do our best to approximate a place for this thing. - if (!trackRect || _CGRectIsEmpty(trackRect)) + if (!trackRect || CGRectIsEmpty(trackRect)) trackRect = bounds; if ([self hasThemeState:CPThemeStateCircular]) @@ -203,13 +203,13 @@ CPCircularSlider = 1; } else if ([self isVertical]) { - knobRect.origin.x = _CGRectGetMidX(trackRect) - knobSize.width / 2.0; - knobRect.origin.y = ((_maxValue - [self doubleValue]) / (_maxValue - _minValue)) * (_CGRectGetHeight(trackRect) - knobSize.height); + knobRect.origin.x = CGRectGetMidX(trackRect) - knobSize.width / 2.0; + knobRect.origin.y = ((_maxValue - [self doubleValue]) / (_maxValue - _minValue)) * (CGRectGetHeight(trackRect) - knobSize.height); } else { - knobRect.origin.x = (([self doubleValue] - _minValue) / (_maxValue - _minValue)) * (_CGRectGetWidth(trackRect) - knobSize.width); - knobRect.origin.y = _CGRectGetMidY(trackRect) - knobSize.height / 2.0; + knobRect.origin.x = (([self doubleValue] - _minValue) / (_maxValue - _minValue)) * (CGRectGetWidth(trackRect) - knobSize.width); + knobRect.origin.y = CGRectGetMidY(trackRect) - knobSize.height / 2.0; } return knobRect; @@ -260,8 +260,8 @@ CPCircularSlider = 1; { // Recalculate isVertical. var bounds = [self bounds], - width = _CGRectGetWidth(bounds), - height = _CGRectGetHeight(bounds); + width = CGRectGetWidth(bounds), + height = CGRectGetHeight(bounds); _isVertical = width < height ? 1 : (width > height ? 0 : -1); @@ -306,55 +306,55 @@ CPCircularSlider = 1; if ([self hasThemeState:CPThemeStateCircular]) { - var knobWidth = _CGRectGetWidth(knobRect); + var knobWidth = CGRectGetWidth(knobRect); trackRect.origin.x += knobWidth / 2; trackRect.size.width -= knobWidth; var minValue = [self minValue], - dx = aPoint.x - _CGRectGetMidX(trackRect), - dy = aPoint.y - _CGRectGetMidY(trackRect); + dx = aPoint.x - CGRectGetMidX(trackRect), + dy = aPoint.y - CGRectGetMidY(trackRect); return MAX(0.0, MIN(1.0, 1.0 - (3 * PI_2 - ATAN2(dy, dx)) % PI2 / PI2)) * ([self maxValue] - minValue) + minValue; } else if ([self isVertical]) { - var knobHeight = _CGRectGetHeight(knobRect); + var knobHeight = CGRectGetHeight(knobRect); trackRect.origin.y += knobHeight / 2; trackRect.size.height -= knobHeight; var minValue = [self minValue]; - return MAX(0.0, MIN(1.0, (_CGRectGetMaxY(trackRect) - aPoint.y) / _CGRectGetHeight(trackRect))) * ([self maxValue] - minValue) + minValue; + return MAX(0.0, MIN(1.0, (CGRectGetMaxY(trackRect) - aPoint.y) / CGRectGetHeight(trackRect))) * ([self maxValue] - minValue) + minValue; } else { - var knobWidth = _CGRectGetWidth(knobRect); + var knobWidth = CGRectGetWidth(knobRect); trackRect.origin.x += knobWidth / 2; trackRect.size.width -= knobWidth; var minValue = [self minValue]; - return MAX(0.0, MIN(1.0, (aPoint.x - _CGRectGetMinX(trackRect)) / _CGRectGetWidth(trackRect))) * ([self maxValue] - minValue) + minValue; + return MAX(0.0, MIN(1.0, (aPoint.x - CGRectGetMinX(trackRect)) / CGRectGetWidth(trackRect))) * ([self maxValue] - minValue) + minValue; } } - (BOOL)startTrackingAt:(CGPoint)aPoint { var bounds = [self bounds], - knobRect = [self knobRectForBounds:_CGRectMakeCopy(bounds)]; + knobRect = [self knobRectForBounds:CGRectMakeCopy(bounds)]; - if (_CGRectContainsPoint(knobRect, aPoint)) - _dragOffset = _CGSizeMake(_CGRectGetMidX(knobRect) - aPoint.x, _CGRectGetMidY(knobRect) - aPoint.y); + if (CGRectContainsPoint(knobRect, aPoint)) + _dragOffset = CGSizeMake(CGRectGetMidX(knobRect) - aPoint.x, CGRectGetMidY(knobRect) - aPoint.y); else { var trackRect = [self trackRectForBounds:bounds]; - if (trackRect && _CGRectContainsPoint(trackRect, aPoint)) + if (trackRect && CGRectContainsPoint(trackRect, aPoint)) { - _dragOffset = _CGSizeMakeZero(); + _dragOffset = CGSizeMakeZero(); [self setObjectValue:[self _valueAtPoint:aPoint]]; } @@ -373,7 +373,7 @@ CPCircularSlider = 1; - (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint { - [self setObjectValue:[self _valueAtPoint:_CGPointMake(aPoint.x + _dragOffset.width, aPoint.y + _dragOffset.height)]]; + [self setObjectValue:[self _valueAtPoint:CGPointMake(aPoint.x + _dragOffset.width, aPoint.y + _dragOffset.height)]]; return YES; } diff --git a/AppKit/CPSplitView.j b/AppKit/CPSplitView.j index f9090ea8a..7e62a4d5d 100644 --- a/AppKit/CPSplitView.j +++ b/AppKit/CPSplitView.j @@ -334,8 +334,8 @@ var ShouldSuppressResizeNotifications = 1, } [self _setupDOMDivider]; - CPDOMDisplayServerSetStyleLeftTop(_DOMDividerElements[_drawingDivider], NULL, _CGRectGetMinX(aRect), _CGRectGetMinY(aRect)); - CPDOMDisplayServerSetStyleSize(_DOMDividerElements[_drawingDivider], _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)); + CPDOMDisplayServerSetStyleLeftTop(_DOMDividerElements[_drawingDivider], NULL, CGRectGetMinX(aRect), CGRectGetMinY(aRect)); + CPDOMDisplayServerSetStyleSize(_DOMDividerElements[_drawingDivider], CGRectGetWidth(aRect), CGRectGetHeight(aRect)); #endif } @@ -1110,7 +1110,7 @@ The sum of the views and the sum of the dividers should be equal to the size of */ - (void)_restoreFromAutosaveIfNeeded { - if (_shouldRestoreFromAutosaveUnlessFrameSize && !_CGSizeEqualToSize([self frameSize], _shouldRestoreFromAutosaveUnlessFrameSize)) + if (_shouldRestoreFromAutosaveUnlessFrameSize && !CGSizeEqualToSize([self frameSize], _shouldRestoreFromAutosaveUnlessFrameSize)) { [self _restoreFromAutosave]; } diff --git a/AppKit/CPStepper.j b/AppKit/CPStepper.j index 15b16684b..0e7fc7586 100644 --- a/AppKit/CPStepper.j +++ b/AppKit/CPStepper.j @@ -55,7 +55,7 @@ */ + (CPStepper)stepperWithInitialValue:(float)aValue minValue:(float)aMinValue maxValue:(float)aMaxValue { - var stepper = [[CPStepper alloc] initWithFrame:_CGRectMakeZero()]; + var stepper = [[CPStepper alloc] initWithFrame:CGRectMakeZero()]; [stepper setDoubleValue:aValue]; [stepper setMinValue:aMinValue]; @@ -122,14 +122,14 @@ - (void)_init { - _buttonUp = [[CPButton alloc] initWithFrame:_CGRectMakeZero()]; + _buttonUp = [[CPButton alloc] initWithFrame:CGRectMakeZero()]; [_buttonUp setContinuous:_autorepeat]; [_buttonUp setTarget:self]; [_buttonUp setAction:@selector(_buttonDidClick:)]; [_buttonUp setAutoresizingMask:CPViewNotSizable]; [self addSubview:_buttonUp]; - _buttonDown = [[CPButton alloc] initWithFrame:_CGRectMakeZero()]; + _buttonDown = [[CPButton alloc] initWithFrame:CGRectMakeZero()]; [_buttonDown setContinuous:_autorepeat]; [_buttonDown setTarget:self]; [_buttonDown setAction:@selector(_buttonDidClick:)]; @@ -161,8 +161,8 @@ { var upSize = [self valueForThemeAttribute:@"up-button-size"], downSize = [self valueForThemeAttribute:@"down-button-size"], - minSize = _CGSizeMake(upSize.width, upSize.height + downSize.height), - frame = _CGRectMakeCopy(aFrame); + minSize = CGSizeMake(upSize.width, upSize.height + downSize.height), + frame = CGRectMakeCopy(aFrame); frame.size.width = MAX(minSize.width, frame.size.width); frame.size.height = MAX(minSize.height, frame.size.height); @@ -175,8 +175,8 @@ var aFrame = [self frame], upSize = [self valueForThemeAttribute:@"up-button-size"], downSize = [self valueForThemeAttribute:@"down-button-size"], - upFrame = _CGRectMake(aFrame.size.width - upSize.width, 0, upSize.width, upSize.height), - downFrame = _CGRectMake(aFrame.size.width - downSize.width, upSize.height, downSize.width, downSize.height); + upFrame = CGRectMake(aFrame.size.width - upSize.width, 0, upSize.width, upSize.height), + downFrame = CGRectMake(aFrame.size.width - downSize.width, upSize.height, downSize.width, downSize.height); [_buttonUp setFrame:upFrame]; [_buttonDown setFrame:downFrame]; @@ -272,8 +272,8 @@ return @{ @"bezel-color-up-button": [CPNull null], @"bezel-color-down-button": [CPNull null], - @"up-button-size": _CGSizeMakeZero(), - @"down-button-size": _CGSizeMakeZero(), + @"up-button-size": CGSizeMakeZero(), + @"down-button-size": CGSizeMakeZero(), }; } diff --git a/AppKit/CPTabView.j b/AppKit/CPTabView.j index 77c13a390..b6874a01b 100644 --- a/AppKit/CPTabView.j +++ b/AppKit/CPTabView.j @@ -79,11 +79,11 @@ var CPTabViewDidSelectTabViewItemSelector = 1, { _selectedIndex = CPNotFound; - _tabs = [[CPSegmentedControl alloc] initWithFrame:_CGRectMake(0, 0, 0, 0)]; + _tabs = [[CPSegmentedControl alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; [_tabs setHitTests:NO]; var height = [_tabs valueForThemeAttribute:@"default-height"]; - [_tabs setFrameSize:_CGSizeMake(0, height)]; + [_tabs setFrameSize:CGSizeMake(0, height)]; _box = [[CPBox alloc] initWithFrame:[self bounds]]; [self setBackgroundColor:[CPColor colorWithCalibratedWhite:0.95 alpha:1.0]]; @@ -373,11 +373,11 @@ var CPTabViewDidSelectTabViewItemSelector = 1, else { var aFrame = [self frame], - segmentedHeight = _CGRectGetHeight([_tabs frame]), + segmentedHeight = CGRectGetHeight([_tabs frame]), origin = _type === CPTopTabsBezelBorder ? segmentedHeight / 2 : 0; - [_box setFrame:_CGRectMake(0, origin, _CGRectGetWidth(aFrame), - _CGRectGetHeight(aFrame) - segmentedHeight / 2)]; + [_box setFrame:CGRectMake(0, origin, CGRectGetWidth(aFrame), + CGRectGetHeight(aFrame) - segmentedHeight / 2)]; [self _repositionTabs]; } @@ -447,13 +447,13 @@ var CPTabViewDidSelectTabViewItemSelector = 1, - (void)_repositionTabs { - var horizontalCenterOfSelf = _CGRectGetWidth([self bounds]) / 2, - verticalCenterOfTabs = _CGRectGetHeight([_tabs bounds]) / 2; + var horizontalCenterOfSelf = CGRectGetWidth([self bounds]) / 2, + verticalCenterOfTabs = CGRectGetHeight([_tabs bounds]) / 2; if (_type === CPBottomTabsBezelBorder) - [_tabs setCenter:_CGPointMake(horizontalCenterOfSelf, _CGRectGetHeight([self bounds]) - verticalCenterOfTabs)]; + [_tabs setCenter:CGPointMake(horizontalCenterOfSelf, CGRectGetHeight([self bounds]) - verticalCenterOfTabs)]; else - [_tabs setCenter:_CGPointMake(horizontalCenterOfSelf, verticalCenterOfTabs)]; + [_tabs setCenter:CGPointMake(horizontalCenterOfSelf, verticalCenterOfTabs)]; } - (void)_setSelectedIndex:(CPNumber)index diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index e0cf361f9..823fdc73a 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -283,7 +283,7 @@ CPTableColumnUserResizingMask = 1 << 1; */ - (void)sizeToFit { - var width = _CGRectGetWidth([_headerView frame]); + var width = CGRectGetWidth([_headerView frame]); if (width < [self minWidth]) [self setMinWidth:width]; diff --git a/AppKit/CPTableHeaderView.j b/AppKit/CPTableHeaderView.j index 44c34e1ac..25c14845a 100644 --- a/AppKit/CPTableHeaderView.j +++ b/AppKit/CPTableHeaderView.j @@ -69,7 +69,7 @@ - (void)_init { - _textField = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; + _textField = [[_CPImageAndTextView alloc] initWithFrame:CGRectMakeZero()]; [_textField setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; @@ -87,7 +87,7 @@ var inset = [self currentValueForThemeAttribute:@"text-inset"], bounds = [self bounds]; - [_textField setFrame:_CGRectMake(inset.right, inset.top, bounds.size.width - inset.right - inset.left, bounds.size.height - inset.top - inset.bottom)]; + [_textField setFrame:CGRectMake(inset.right, inset.top, bounds.size.width - inset.right - inset.left, bounds.size.height - inset.top - inset.bottom)]; [_textField setTextColor:[self currentValueForThemeAttribute:@"text-color"]]; [_textField setFont:[self currentValueForThemeAttribute:@"font"]]; [_textField setTextShadowColor:[self currentValueForThemeAttribute:@"text-shadow-color"]]; @@ -255,8 +255,8 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal - (void)_init { - _mouseDownLocation = _CGPointMakeZero(); - _previousTrackingLocation = _CGPointMakeZero(); + _mouseDownLocation = CGPointMakeZero(); + _previousTrackingLocation = CGPointMakeZero(); _activeColumn = -1; _pressedColumn = -1; @@ -290,8 +290,8 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal var headerRect = CGRectMakeCopy([self bounds]), columnRect = [_tableView rectOfColumn:aColumnIndex]; - headerRect.origin.x = _CGRectGetMinX(columnRect); - headerRect.size.width = _CGRectGetWidth(columnRect); + headerRect.origin.x = CGRectGetMinX(columnRect); + headerRect.size.width = CGRectGetWidth(columnRect); return headerRect; } @@ -309,11 +309,11 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal - (CGRect)_cursorRectForColumn:(int)column { if (column == -1 || !([_tableView._tableColumns[column] resizingMask] & CPTableColumnUserResizingMask)) - return _CGRectMakeZero(); + return CGRectMakeZero(); var rect = [self headerRectOfColumn:column]; - rect.origin.x = _CGRectGetMaxX(rect) - 5; + rect.origin.x = CGRectGetMaxX(rect) - 5; rect.size.width = 20; return rect; @@ -353,7 +353,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal currentLocation.x -= 5.0; var columnIndex = [self columnAtPoint:currentLocation], - shouldResize = [self shouldResizeTableColumn:columnIndex at:_CGPointMake(currentLocation.x + 5.0, currentLocation.y)]; + shouldResize = [self shouldResizeTableColumn:columnIndex at:CGPointMake(currentLocation.x + 5.0, currentLocation.y)]; if (type === CPLeftMouseUp) { @@ -397,7 +397,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal [self continueResizingTableColumn:_activeColumn at:currentLocation]; else { - if (_activeColumn === columnIndex && _CGRectContainsPoint([self headerRectOfColumn:columnIndex], currentLocation)) + if (_activeColumn === columnIndex && CGRectContainsPoint([self headerRectOfColumn:columnIndex], currentLocation)) { if (_isTrackingColumn && _pressedColumn !== -1) { @@ -425,14 +425,14 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal if ([self _shouldDragTableColumn:aColumnIndex at:aPoint]) { var columnRect = [self headerRectOfColumn:aColumnIndex], - offset = _CGPointMakeZero(), + offset = CGPointMakeZero(), view = [_tableView _dragViewForColumn:aColumnIndex event:[CPApp currentEvent] offset:offset], - viewLocation = _CGPointMakeZero(); + viewLocation = CGPointMakeZero(); - viewLocation.x = ( _CGRectGetMinX(columnRect) + offset.x ) + ( aPoint.x - _mouseDownLocation.x ); - viewLocation.y = _CGRectGetMinY(columnRect) + offset.y; + viewLocation.x = ( CGRectGetMinX(columnRect) + offset.x ) + ( aPoint.x - _mouseDownLocation.x ); + viewLocation.y = CGRectGetMinY(columnRect) + offset.y; - [self dragView:view at:viewLocation offset:_CGSizeMakeZero() event:[CPApp currentEvent] + [self dragView:view at:viewLocation offset:CGSizeMakeZero() event:[CPApp currentEvent] pasteboard:[CPPasteboard pasteboardWithName:CPDragPboard] source:self slideBack:YES]; return NO; @@ -444,7 +444,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal - (BOOL)_shouldStopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint { return _isTrackingColumn && _activeColumn === aColumnIndex && - _CGRectContainsPoint([self headerRectOfColumn:aColumnIndex], aPoint); + CGRectContainsPoint([self headerRectOfColumn:aColumnIndex], aPoint); } - (void)stopTrackingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint @@ -488,10 +488,10 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal frame.origin = [self convertPoint:frame.origin fromView:nil]; // This effectively clamps the value between the minimum and maximum - frame.origin.x = MAX(0.0, MIN(_CGRectGetMinX(frame), _CGRectGetMaxX(lastColumnRect) - _CGRectGetWidth(activeColumnRect))); + frame.origin.x = MAX(0.0, MIN(CGRectGetMinX(frame), CGRectGetMaxX(lastColumnRect) - CGRectGetWidth(activeColumnRect))); // Make sure the column cannot move vertically - frame.origin.y = _CGRectGetMinY(lastColumnRect); + frame.origin.y = CGRectGetMinY(lastColumnRect); // Convert the calculated origin back to the window coordinate system frame.origin = [self convertPoint:frame.origin toView:nil]; @@ -530,9 +530,9 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal var hoverPoint = CGPointCreateCopy(aPoint); if (aPoint.x < _previousTrackingLocation.x) - hoverPoint = _CGPointMake(_CGRectGetMinX(dragWindowFrame), _CGRectGetMinY(dragWindowFrame)); + hoverPoint = CGPointMake(CGRectGetMinX(dragWindowFrame), CGRectGetMinY(dragWindowFrame)); else if (aPoint.x > _previousTrackingLocation.x) - hoverPoint = _CGPointMake(_CGRectGetMaxX(dragWindowFrame), _CGRectGetMinY(dragWindowFrame)); + hoverPoint = CGPointMake(CGRectGetMaxX(dragWindowFrame), CGRectGetMinY(dragWindowFrame)); // Convert the hover point from the global coordinate system to windows' coordinate system hoverPoint = [[self window] convertGlobalToBase:hoverPoint]; @@ -544,7 +544,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal if (hoveredColumn !== -1) { var columnRect = [self headerRectOfColumn:hoveredColumn], - columnCenterPoint = [self convertPoint:CGPointMake(_CGRectGetMidX(columnRect), _CGRectGetMidY(columnRect)) fromView:self]; + columnCenterPoint = [self convertPoint:CGPointMake(CGRectGetMidX(columnRect), CGRectGetMidY(columnRect)) fromView:self]; if (hoveredColumn < _activeColumn && hoverPoint.x < columnCenterPoint.x) [self _moveColumn:_activeColumn toColumn:hoveredColumn]; else if (hoveredColumn > _activeColumn && hoverPoint.x > columnCenterPoint.x) @@ -576,7 +576,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal if (_isTrackingColumn) return NO; - return [_tableView allowsColumnResizing] && _CGRectContainsPoint([self _cursorRectForColumn:aColumnIndex], aPoint); + return [_tableView allowsColumnResizing] && CGRectContainsPoint([self _cursorRectForColumn:aColumnIndex], aPoint); } - (void)startResizingTableColumn:(int)aColumnIndex at:(CGPoint)aPoint @@ -632,7 +632,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal mouseOverLocation = CGPointMake(mouseLocation.x - 5, mouseLocation.y), overColumn = [self columnAtPoint:mouseOverLocation]; - if (overColumn >= 0 && _CGRectContainsPoint([self _cursorRectForColumn:overColumn], mouseLocation)) + if (overColumn >= 0 && CGRectContainsPoint([self _cursorRectForColumn:overColumn], mouseLocation)) { var tableColumn = [[_tableView tableColumns] objectAtIndex:overColumn], width = [tableColumn width]; @@ -721,10 +721,10 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal var columnIndex = columnsArray[columnArrayIndex], columnToStroke = [self headerRectOfColumn:columnIndex]; - columnMaxX = _CGRectGetMaxX(columnToStroke); + columnMaxX = CGRectGetMaxX(columnToStroke); - CGContextMoveToPoint(context, FLOOR(columnMaxX) - 0.5, ROUND(_CGRectGetMinY(columnToStroke))); - CGContextAddLineToPoint(context, FLOOR(columnMaxX) - 0.5, ROUND(_CGRectGetMaxY(columnToStroke)) - 1.0); + CGContextMoveToPoint(context, FLOOR(columnMaxX) - 0.5, ROUND(CGRectGetMinY(columnToStroke))); + CGContextAddLineToPoint(context, FLOOR(columnMaxX) - 0.5, ROUND(CGRectGetMaxY(columnToStroke)) - 1.0); } CGContextClosePath(context); diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 7e6c9645a..2c942755e 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -137,7 +137,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; var frame = [self frame], context = [[CPGraphicsContext currentContext] graphicsPort]; - CGContextTranslateCTM(context, -_CGRectGetMinX(frame), -_CGRectGetMinY(frame)); + CGContextTranslateCTM(context, -CGRectGetMinX(frame), -CGRectGetMinY(frame)); [_tableView _drawRect:aRect]; } @@ -320,14 +320,14 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; _dirtyTableColumnRangeIndex = CPNotFound; _numberOfHiddenColumns = 0; - _intercellSpacing = _CGSizeMake(3.0, 2.0); + _intercellSpacing = CGSizeMake(3.0, 2.0); _rowHeight = [self valueForThemeAttribute:@"default-row-height"]; [self setGridColor:[CPColor colorWithHexString:@"dce0e2"]]; [self setGridStyleMask:CPTableViewGridNone]; - [self setHeaderView:[[CPTableHeaderView alloc] initWithFrame:_CGRectMake(0, 0, [self bounds].size.width, _rowHeight)]]; - [self setCornerView:[[_CPCornerView alloc] initWithFrame:_CGRectMake(0, 0, [CPScroller scrollerWidth], _CGRectGetHeight([_headerView frame]))]]; + [self setHeaderView:[[CPTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, [self bounds].size.width, _rowHeight)]]; + [self setCornerView:[[_CPCornerView alloc] initWithFrame:CGRectMake(0, 0, [CPScroller scrollerWidth], CGRectGetHeight([_headerView frame]))]]; _currentHighlightedTableColumn = nil; @@ -360,7 +360,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; _selectedColumnIndexes = [CPIndexSet indexSet]; _selectedRowIndexes = [CPIndexSet indexSet]; - _dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:_CGRectMakeZero()]; + _dropOperationFeedbackView = [[_CPDropOperationDrawingView alloc] initWithFrame:CGRectMakeZero()]; [_dropOperationFeedbackView setTableView:self]; _lastColumnShouldSnap = NO; @@ -694,10 +694,10 @@ NOT YET IMPLEMENTED */ - (void)setIntercellSpacing:(CGSize)aSize { - if (_CGSizeEqualToSize(_intercellSpacing, aSize)) + if (CGSizeEqualToSize(_intercellSpacing, aSize)) return; - _intercellSpacing = _CGSizeMakeCopy(aSize); + _intercellSpacing = CGSizeMakeCopy(aSize); _dirtyTableColumnRangeIndex = 0; // so that _recalculateTableColumnRanges will work [self _recalculateTableColumnRanges]; @@ -714,7 +714,7 @@ NOT YET IMPLEMENTED */ - (CGSize)intercellSpacing { - return _CGSizeMakeCopy(_intercellSpacing); + return CGSizeMakeCopy(_intercellSpacing); } /*! @@ -1592,7 +1592,7 @@ NOT YET IMPLEMENTED if (_headerView) { [_headerView setTableView:self]; - [_headerView setFrameSize:_CGSizeMake(_CGRectGetWidth([self frame]), _CGRectGetHeight([_headerView frame]))]; + [_headerView setFrameSize:CGSizeMake(CGRectGetWidth([self frame]), CGRectGetHeight([_headerView frame]))]; } else { @@ -1662,18 +1662,18 @@ NOT YET IMPLEMENTED aColumnIndex = +aColumnIndex; if (aColumnIndex < 0 || aColumnIndex >= NUMBER_OF_COLUMNS()) - return _CGRectMakeZero(); + return CGRectMakeZero(); var column = [[self tableColumns] objectAtIndex:aColumnIndex]; if ([column isHidden]) - return _CGRectMakeZero(); + return CGRectMakeZero(); UPDATE_COLUMN_RANGES_IF_NECESSARY(); var range = _tableColumnRanges[aColumnIndex]; - return _CGRectMake(range.location, 0.0, range.length, _CGRectGetHeight([self bounds])); + return CGRectMake(range.location, 0.0, range.length, CGRectGetHeight([self bounds])); } // Complexity: @@ -1690,7 +1690,7 @@ NOT YET IMPLEMENTED var lastIndex = [self numberOfRows] - 1; if (checkRange && (aRowIndex > lastIndex || aRowIndex < 0)) - return _CGRectMakeZero(); + return CGRectMakeZero(); if (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_) { @@ -1722,7 +1722,7 @@ NOT YET IMPLEMENTED height = _rowHeight + _intercellSpacing.height; } - return _CGRectMake(0.0, y, _CGRectGetWidth([self bounds]), height); + return CGRectMake(0.0, y, CGRectGetWidth([self bounds]), height); } /*! @@ -1760,7 +1760,7 @@ NOT YET IMPLEMENTED if (firstRow < 0) firstRow = 0; - var lastRow = [self rowAtPoint:_CGPointMake(0.0, _CGRectGetMaxY(aRect))]; + var lastRow = [self rowAtPoint:CGPointMake(0.0, CGRectGetMaxY(aRect))]; // last row has to be overshot, because if not we wouldn't be intersecting. if (lastRow < 0) @@ -1778,8 +1778,8 @@ NOT YET IMPLEMENTED var boundedRange = [self rowsInRect:aRect], lastRow = CPMaxRange(boundedRange), rectOfLastRow = [self _rectOfRow:lastRow checkRange:NO], - bottom = _CGRectGetMaxY(aRect), - bottomOfBoundedRows = _CGRectGetMaxY(rectOfLastRow); + bottom = CGRectGetMaxY(aRect), + bottomOfBoundedRows = CGRectGetMaxY(rectOfLastRow); // we only have to worry about the rows below the last... if (bottom <= bottomOfBoundedRows) @@ -1803,8 +1803,8 @@ NOT YET IMPLEMENTED */ - (CPIndexSet)columnIndexesInRect:(CGRect)aRect { - var column = MAX(0, [self columnAtPoint:_CGPointMake(aRect.origin.x, 0.0)]), - lastColumn = [self columnAtPoint:_CGPointMake(_CGRectGetMaxX(aRect), 0.0)]; + var column = MAX(0, [self columnAtPoint:CGPointMake(aRect.origin.x, 0.0)]), + lastColumn = [self columnAtPoint:CGPointMake(CGRectGetMaxX(aRect), 0.0)]; if (lastColumn === CPNotFound) lastColumn = NUMBER_OF_COLUMNS() - 1; @@ -1839,7 +1839,7 @@ NOT YET IMPLEMENTED { var bounds = [self bounds]; - if (!_CGRectContainsPoint(bounds, aPoint)) + if (!CGRectContainsPoint(bounds, aPoint)) return CPNotFound; UPDATE_COLUMN_RANGES_IF_NECESSARY(); @@ -2010,14 +2010,14 @@ NOT YET IMPLEMENTED UPDATE_COLUMN_RANGES_IF_NECESSARY(); if (aColumn > [self numberOfColumns] || aRow > [self numberOfRows]) - return _CGRectMakeZero(); + return CGRectMakeZero(); var tableColumnRange = _tableColumnRanges[aColumn], rectOfRow = [self rectOfRow:aRow], leftInset = FLOOR(_intercellSpacing.width / 2.0), topInset = FLOOR(_intercellSpacing.height / 2.0); - return _CGRectMake(tableColumnRange.location + leftInset, _CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, _CGRectGetHeight(rectOfRow) - _intercellSpacing.height); + return CGRectMake(tableColumnRange.location + leftInset, CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, CGRectGetHeight(rectOfRow) - _intercellSpacing.height); } /*! @@ -2042,7 +2042,7 @@ NOT YET IMPLEMENTED return; var superviewWidth = [superview bounds].size.width, - lastColumnMaxX = _CGRectGetMaxX([self rectOfColumn:[self numberOfColumns] -1]); + lastColumnMaxX = CGRectGetMaxX([self rectOfColumn:[self numberOfColumns] -1]); // Fix me: this fires on the table setup at times if (lastColumnMaxX >= superviewWidth && lastColumnMaxX <= aSize.width || lastColumnMaxX <= superviewWidth && lastColumnMaxX >= aSize.width) @@ -2132,7 +2132,7 @@ NOT YET IMPLEMENTED [resizableColumns addIndex:i]; } - var maxXofColumns = _CGRectGetMaxX([self rectOfColumn:[resizableColumns lastIndex]]), + var maxXofColumns = CGRectGetMaxX([self rectOfColumn:[resizableColumns lastIndex]]), remainingSpace = superviewWidth - maxXofColumns, resizeableColumnsCount = [resizableColumns count], proportionate = 0; @@ -2169,7 +2169,7 @@ NOT YET IMPLEMENTED while (count-- && [_tableColumns[count] isHidden]); // find the max x, but subtract a single pixel since the spacing isn't applicable here. - var delta = superviewWidth - _CGRectGetMaxX([self rectOfColumn:count]) - ([self intercellSpacing].width || 1), + var delta = superviewWidth - CGRectGetMaxX([self rectOfColumn:count]) - ([self intercellSpacing].width || 1), newSize = [item width] + delta; [item _tryToResizeToWidth:newSize]; @@ -2329,7 +2329,7 @@ NOT YET IMPLEMENTED height = MAX(superviewSize.height, height); } - [self setFrameSize:_CGSizeMake(width, height)]; + [self setFrameSize:CGSizeMake(width, height)]; [self setNeedsLayout]; [self setNeedsDisplay:YES]; @@ -3026,8 +3026,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad } var dragPoint = [self convertPoint:[theDragEvent locationInWindow] fromView:nil]; - dragViewOffset.x = _CGRectGetWidth(bounds) / 2 - dragPoint.x; - dragViewOffset.y = _CGRectGetHeight(bounds) / 2 - dragPoint.y; + dragViewOffset.x = CGRectGetWidth(bounds) / 2 - dragPoint.x; + dragViewOffset.y = CGRectGetHeight(bounds) / 2 - dragPoint.y; return view; } @@ -3043,7 +3043,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad var dragView = [[_CPColumnDragView alloc] initWithLineColor:[self gridColor]], tableColumn = [[self tableColumns] objectAtIndex:theColumnIndex], defaultRowHeight = [self valueForThemeAttribute:@"default-row-height"], - bounds = _CGRectMake(0.0, 0.0, [tableColumn width], _CGRectGetHeight([self exposedRect]) + defaultRowHeight), + bounds = CGRectMake(0.0, 0.0, [tableColumn width], CGRectGetHeight([self exposedRect]) + defaultRowHeight), columnRect = [self rectOfColumn:theColumnIndex], headerView = [tableColumn headerView], row = [_exposedRows firstIndex]; @@ -3059,7 +3059,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad dataViewFrame.origin.x = 0.0; // Offset by table header height - scroll position - dataViewFrame.origin.y = ( _CGRectGetMinY(dataViewFrame) - _CGRectGetMinY([self exposedRect]) ) + defaultRowHeight; + dataViewFrame.origin.y = ( CGRectGetMinY(dataViewFrame) - CGRectGetMinY([self exposedRect]) ) + defaultRowHeight; [dataView setFrame:dataViewFrame]; [self _setObjectValueForTableColumn:tableColumn row:row forView:dataView]; @@ -3795,7 +3795,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad [super setFrameSize:aSize]; if (_headerView) - [_headerView setFrameSize:_CGSizeMake(_CGRectGetWidth([self frame]), _CGRectGetHeight([_headerView frame]))]; + [_headerView setFrameSize:CGSizeMake(CGRectGetWidth([self frame]), CGRectGetHeight([_headerView frame]))]; _exposedRect = nil; } @@ -3946,14 +3946,14 @@ Your delegate can implement this method to avoid subclassing the tableview to ad row = exposedRows.location, lastRow = CPMaxRange(exposedRows) - 1, rowY = -0.5, - minX = _CGRectGetMinX(aRect), - maxX = _CGRectGetMaxX(aRect); + minX = CGRectGetMinX(aRect), + maxX = CGRectGetMaxX(aRect); for (; row <= lastRow; ++row) { // grab each row rect and add the top and bottom lines var rowRect = [self _rectOfRow:row checkRange:NO], - rowY = _CGRectGetMaxY(rowRect) - 0.5; + rowY = CGRectGetMaxY(rowRect) - 0.5; CGContextMoveToPoint(context, minX, rowY); CGContextAddLineToPoint(context, maxX, rowY); @@ -3962,7 +3962,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad if (_rowHeight > 0.0) { var rowHeight = _rowHeight + _intercellSpacing.height, - totalHeight = _CGRectGetMaxY(aRect); + totalHeight = CGRectGetMaxY(aRect); while (rowY < totalHeight) { @@ -3983,13 +3983,13 @@ Your delegate can implement this method to avoid subclassing the tableview to ad var columnArrayIndex = 0, columnArrayCount = columnsArray.length, - minY = _CGRectGetMinY(aRect), - maxY = _CGRectGetMaxY(aRect); + minY = CGRectGetMinY(aRect), + maxY = CGRectGetMaxY(aRect); for (; columnArrayIndex < columnArrayCount; ++columnArrayIndex) { var columnRect = [self rectOfColumn:columnsArray[columnArrayIndex]], - columnX = _CGRectGetMaxX(columnRect) - 0.5; + columnX = CGRectGetMaxX(columnRect) - 0.5; CGContextMoveToPoint(context, columnX, minY); CGContextAddLineToPoint(context, columnX, maxY); @@ -4074,10 +4074,10 @@ Your delegate can implement this method to avoid subclassing the tableview to ad if (drawGradient || shouldUseGroupGradient) { - var minX = _CGRectGetMinX(rowRect), - minY = _CGRectGetMinY(rowRect), - maxX = _CGRectGetMaxX(rowRect), - maxY = _CGRectGetMaxY(rowRect) - deltaHeight; + var minX = CGRectGetMinX(rowRect), + minY = CGRectGetMinY(rowRect), + maxX = CGRectGetMaxX(rowRect), + maxY = CGRectGetMaxY(rowRect) - deltaHeight; if (!drawGradient) { @@ -4090,7 +4090,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad CGContextAddRect(context, rowRect); - CGContextDrawLinearGradient(context, (shouldUseGroupGradient) ? gradientGroupColor : gradientColor, rowRect.origin, _CGPointMake(minX, maxY), 0); + CGContextDrawLinearGradient(context, (shouldUseGroupGradient) ? gradientGroupColor : gradientColor, rowRect.origin, CGPointMake(minX, maxY), 0); CGContextBeginPath(context); CGContextMoveToPoint(context, minX, minY + .5); @@ -4141,10 +4141,10 @@ Your delegate can implement this method to avoid subclassing the tableview to ad 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) { @@ -4160,7 +4160,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad 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); @@ -4651,12 +4651,12 @@ Your delegate can implement this method to avoid subclassing the tableview to ad // Determine if the mouse is currently closer to this row or the row below it lowerRow = row + 1, rect = [self rectOfRow:row], - bottomPoint = _CGRectGetMaxY(rect), - bottomThirty = bottomPoint - ((bottomPoint - _CGRectGetMinY(rect)) * 0.3), + bottomPoint = CGRectGetMaxY(rect), + bottomThirty = bottomPoint - ((bottomPoint - CGRectGetMinY(rect)) * 0.3), numberOfRows = [self numberOfRows]; if (row < 0) - row = (_CGRectGetMaxY(rect) < dragPoint.y) ? numberOfRows : row; + row = (CGRectGetMaxY(rect) < dragPoint.y) ? numberOfRows : row; else if (dragPoint.y > MAX(bottomThirty, bottomPoint - 6)) row = lowerRow; @@ -4721,7 +4721,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad if (dropOperation === CPTableViewDropOn && row >= numberOfRows) row = numberOfRows - 1; - var rect = _CGRectMakeZero(); + var rect = CGRectMakeZero(); if (row === -1) rect = [self exposedRect]; @@ -5267,8 +5267,8 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", _rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey] || [self valueForThemeAttribute:@"default-row-height"]; _intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey]; - if (_CGSizeEqualToSize(_intercellSpacing, _CGSizeMakeZero())) - _intercellSpacing = _CGSizeMake(3.0, 2.0); + if (CGSizeEqualToSize(_intercellSpacing, CGSizeMakeZero())) + _intercellSpacing = CGSizeMake(3.0, 2.0); [self setGridColor:[aCoder decodeObjectForKey:CPTableViewGridColorKey]]; _gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey]; @@ -5390,7 +5390,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", { //if row is selected don't fill and stroke white var selectedRows = [tableView selectedRowIndexes], - newRect = _CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5); + newRect = CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5); if ([selectedRows containsIndex:currentRow]) { @@ -5409,7 +5409,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", else if (dropOperation === CPTableViewDropAbove) { //reposition the view up a tad - [self setFrameOrigin:_CGPointMake(_frame.origin.x, _frame.origin.y - 8)]; + [self setFrameOrigin:CGPointMake(_frame.origin.x, _frame.origin.y - 8)]; var selectedRows = [tableView selectedRowIndexes]; @@ -5418,7 +5418,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", CGContextSetStrokeColor(context, [CPColor whiteColor]); CGContextSetLineWidth(context, 4); //draw the circle thing - CGContextStrokeEllipseInRect(context, _CGRectMake(aRect.origin.x + 4, aRect.origin.y + 4, 8, 8)); + CGContextStrokeEllipseInRect(context, CGRectMake(aRect.origin.x + 4, aRect.origin.y + 4, 8, 8)); //then draw the line CGContextBeginPath(context); CGContextMoveToPoint(context, 10, aRect.origin.y + 8); @@ -5430,7 +5430,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", } //draw the circle thing - CGContextStrokeEllipseInRect(context, _CGRectMake(aRect.origin.x + 4, aRect.origin.y + 4, 8, 8)); + CGContextStrokeEllipseInRect(context, CGRectMake(aRect.origin.x + 4, aRect.origin.y + 4, 8, 8)); //then draw the line CGContextBeginPath(context); CGContextMoveToPoint(context, 10, aRect.origin.y + 8); @@ -5475,7 +5475,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", - (id)initWithLineColor:(CPColor)aColor { - self = [super initWithFrame:_CGRectMakeZero()]; + self = [super initWithFrame:CGRectMakeZero()]; if (self) _lineColor = aColor; @@ -5490,15 +5490,15 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", CGContextSetStrokeColor(context, _lineColor); var points = [ - _CGPointMake(0.5, 0), - _CGPointMake(0.5, aRect.size.height) + CGPointMake(0.5, 0), + CGPointMake(0.5, aRect.size.height) ]; CGContextStrokeLineSegments(context, points, 2); points = [ - _CGPointMake(aRect.size.width - 0.5, 0), - _CGPointMake(aRect.size.width - 0.5, aRect.size.height) + CGPointMake(aRect.size.width - 0.5, 0), + CGPointMake(aRect.size.width - 0.5, aRect.size.height) ]; CGContextStrokeLineSegments(context, points, 2); diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index fc8b6996a..9fc5db7c9 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -212,8 +212,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); + (id)themeAttributes { return @{ - @"bezel-inset": _CGInsetMakeZero(), - @"content-inset": _CGInsetMake(1.0, 0.0, 0.0, 0.0), + @"bezel-inset": CGInsetMakeZero(), + @"content-inset": CGInsetMake(1.0, 0.0, 0.0, 0.0), @"bezel-color": [CPNull null], }; } @@ -252,7 +252,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); return; var cappEvent = [CPEvent keyEventWithType:CPKeyUp - location:_CGPointMakeZero() + location:CGPointMakeZero() modifierFlags:0 timestamp:[CPEvent currentTimestamp] windowNumber:[[CPApp keyWindow] windowNumber] @@ -607,32 +607,32 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); switch (verticalAlign) { case CPTopVerticalTextAlignment: - var topPoint = _CGRectGetMinY(contentRect) + "px"; + var topPoint = CGRectGetMinY(contentRect) + "px"; break; case CPCenterVerticalTextAlignment: - var topPoint = (_CGRectGetMidY(contentRect) - (lineHeight / 2)) + "px"; + var topPoint = (CGRectGetMidY(contentRect) - (lineHeight / 2)) + "px"; break; case CPBottomVerticalTextAlignment: - var topPoint = (_CGRectGetMaxY(contentRect) - lineHeight) + "px"; + var topPoint = (CGRectGetMaxY(contentRect) - lineHeight) + "px"; break; default: - var topPoint = _CGRectGetMinY(contentRect) + "px"; + var topPoint = CGRectGetMinY(contentRect) + "px"; break; } element.style.top = topPoint; - var left = _CGRectGetMinX(contentRect); + var left = CGRectGetMinX(contentRect); // If the browser has a built in left padding, compensate for it. We need the input text to be exactly on top of the original text. if (CPFeatureIsCompatible(CPInput1PxLeftPadding)) left -= 1; element.style.left = left + "px"; - element.style.width = _CGRectGetWidth(contentRect) + "px"; + element.style.width = CGRectGetWidth(contentRect) + "px"; element.style.height = ROUND(lineHeight) + "px"; element.style.lineHeight = ROUND(lineHeight) + "px"; element.style.verticalAlign = "top"; @@ -1191,7 +1191,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); maxSize = [self currentValueForThemeAttribute:@"max-size"], lineBreakMode = [self lineBreakMode], text = (_stringValue || @" "), - textSize = _CGSizeMakeCopy(frameSize), + textSize = CGSizeMakeCopy(frameSize), font = [self currentValueForThemeAttribute:@"font"]; textSize.width -= contentInset.left + contentInset.right; @@ -1485,14 +1485,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); { var contentInset = [self currentValueForThemeAttribute:@"content-inset"]; - return _CGRectInsetByInset(bounds, contentInset); + return CGRectInsetByInset(bounds, contentInset); } - (CGRect)bezelRectForBounds:(CGRect)bounds { var bezelInset = [self currentValueForThemeAttribute:@"bezel-inset"]; - return _CGRectInsetByInset(bounds, bezelInset); + return CGRectInsetByInset(bounds, bezelInset); } - (CGRect)rectForEphemeralSubviewNamed:(CPString)aName @@ -1510,7 +1510,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); { if (aName === "bezel-view") { - var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; @@ -1518,7 +1518,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); } else { - var view = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()]; + var view = [[_CPImageAndTextView alloc] initWithFrame:CGRectMakeZero()]; [view setHitTests:NO]; diff --git a/AppKit/CPTokenField.j b/AppKit/CPTokenField.j index 2cbffc30e..5f7d3d425 100755 --- a/AppKit/CPTokenField.j +++ b/AppKit/CPTokenField.j @@ -100,7 +100,7 @@ CPTokenFieldDeleteButtonType = 1; + (id)themeAttributes { - return @{ @"editor-inset": _CGInsetMakeZero() }; + return @{ @"editor-inset": CGInsetMakeZero() }; } - (id)initWithFrame:(CGRect)frame @@ -124,7 +124,7 @@ CPTokenFieldDeleteButtonType = 1; - (void)_init { - _selectedRange = _CPMakeRange(0, 0); + _selectedRange = CPMakeRange(0, 0); var frame = [self frame]; @@ -214,7 +214,7 @@ CPTokenFieldDeleteButtonType = 1; if (delegateApprovedObjectsCount) location += delegateApprovedObjectsCount; - _selectedRange = _CPMakeRange(location, 0); + _selectedRange = CPMakeRange(location, 0); [self _inputElement].value = @""; [self setNeedsLayout]; @@ -234,12 +234,12 @@ CPTokenFieldDeleteButtonType = 1; if (indexOfToken == CPNotFound) { if (!extend) - _selectedRange = _CPMakeRange([[self _tokens] count], 0); + _selectedRange = CPMakeRange([[self _tokens] count], 0); } else if (extend) - _selectedRange = CPUnionRange(_selectedRange, _CPMakeRange(indexOfToken, 1)); + _selectedRange = CPUnionRange(_selectedRange, CPMakeRange(indexOfToken, 1)); else - _selectedRange = _CPMakeRange(indexOfToken, 1); + _selectedRange = CPMakeRange(indexOfToken, 1); [self setNeedsLayout]; } @@ -249,7 +249,7 @@ CPTokenFieldDeleteButtonType = 1; var indexOfToken = [[self _tokens] indexOfObject:token]; if (CPLocationInRange(indexOfToken, _selectedRange)) - _selectedRange = _CPMakeRange(MAX(indexOfToken, _selectedRange.location), MIN(_selectedRange.length, indexOfToken - _selectedRange.location)); + _selectedRange = CPMakeRange(MAX(indexOfToken, _selectedRange.location), MIN(_selectedRange.length, indexOfToken - _selectedRange.location)); [self setNeedsLayout]; } @@ -302,7 +302,7 @@ CPTokenFieldDeleteButtonType = 1; [self setObjectValue:tokens]; // setObjectValue moves the cursor to the end of the selection. We want it to stay // where the selected tokens were. - _selectedRange = _CPMakeRange(collapsedSelection, 0); + _selectedRange = CPMakeRange(collapsedSelection, 0); [self _controlTextDidChange]; } @@ -481,7 +481,7 @@ CPTokenFieldDeleteButtonType = 1; - (void)_mouseUpOnToken:(_CPTokenFieldToken)aToken withEvent:(CPEvent)anEvent { - if (_mouseDownEvent && _CGPointEqualToPoint([_mouseDownEvent locationInWindow], [anEvent locationInWindow])) + if (_mouseDownEvent && CGPointEqualToPoint([_mouseDownEvent locationInWindow], [anEvent locationInWindow])) { [self _selectToken:aToken byExtendingSelection:[anEvent modifierFlags] & CPShiftKeyMask]; [[self window] makeFirstResponder:self]; @@ -817,7 +817,7 @@ CPTokenFieldDeleteButtonType = 1; if (_selectedRange.length) { // Place the cursor at the end of the selection and collapse. - _selectedRange.location = _CPMaxRange(_selectedRange); + _selectedRange.location = CPMaxRange(_selectedRange); _selectedRange.length = 0; } else @@ -838,7 +838,7 @@ CPTokenFieldDeleteButtonType = 1; - (void)moveRightAndModifySelection:(id)sender { - if (_CPMaxRange(_selectedRange) < [[self _tokens] count] && [self _editorValue] == "") + if (CPMaxRange(_selectedRange) < [[self _tokens] count] && [self _editorValue] == "") { // Leave the selection location in place but include the next token to the right. _selectedRange.length++; @@ -917,7 +917,7 @@ CPTokenFieldDeleteButtonType = 1; // Finish any editing. [self _autocomplete]; - _selectedRange = _CPMakeRange(0, [[self _tokens] count]); + _selectedRange = CPMakeRange(0, [[self _tokens] count]); [self setNeedsLayout]; } @@ -1009,7 +1009,7 @@ CPTokenFieldDeleteButtonType = 1; return; // Move each token into the right position. - var contentRect = _CGRectMakeCopy([contentView bounds]), + var contentRect = CGRectMakeCopy([contentView bounds]), contentOrigin = contentRect.origin, contentSize = contentRect.size, offset = CGPointMake(contentOrigin.x, contentOrigin.y), @@ -1026,11 +1026,11 @@ CPTokenFieldDeleteButtonType = 1; // Get the height of a typical token, or a token token if you will. [tokenToken sizeToFit]; - var tokenHeight = _CGRectGetHeight([tokenToken bounds]); + var tokenHeight = CGRectGetHeight([tokenToken bounds]); var fitAndFrame = function(width, height) { - var r = _CGRectMake(0, 0, width, height); + var r = CGRectMake(0, 0, width, height); if (offset.x + width >= contentSize.width && offset.x > contentOrigin.x) { @@ -1043,8 +1043,8 @@ CPTokenFieldDeleteButtonType = 1; // Make sure the frame fits. var scrollHeight = offset.y + tokenHeight + CEIL(spaceBetweenTokens.height / 2.0); - if (_CGRectGetHeight([contentView bounds]) < scrollHeight) - [contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; + if (CGRectGetHeight([contentView bounds]) < scrollHeight) + [contentView setFrameSize:CGSizeMake(CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; offset.x += width + spaceBetweenTokens.width; @@ -1078,12 +1078,12 @@ CPTokenFieldDeleteButtonType = 1; // When editing, always scroll to the cursor. if (_selectedRange.length == 0) - [[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, _inputFrame.origin.y)]; + [[_tokenScrollView documentView] scrollPoint:CGPointMake(0, _inputFrame.origin.y)]; }; for (var i = 0, count = [tokens count]; i < count; i++) { - if (isEditing && !_selectedRange.length && i == _CPMaxRange(_selectedRange)) + if (isEditing && !_selectedRange.length && i == CPMaxRange(_selectedRange)) placeEditor(false); var tokenView = [tokens objectAtIndex:i]; @@ -1104,7 +1104,7 @@ CPTokenFieldDeleteButtonType = 1; [tokenView setButtonType:_buttonType]; } - if (isEditing && !_selectedRange.length && _CPMaxRange(_selectedRange) >= [tokens count]) + if (isEditing && !_selectedRange.length && CPMaxRange(_selectedRange) >= [tokens count]) placeEditor(true); // Hide the editor if there are selected tokens, but still keep it active @@ -1125,8 +1125,8 @@ CPTokenFieldDeleteButtonType = 1; // Trim off any excess height downwards (in case we shrank). var scrollHeight = offset.y + tokenHeight; - if (_CGRectGetHeight([contentView bounds]) > scrollHeight) - [contentView setFrameSize:_CGSizeMake(_CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; + if (CGRectGetHeight([contentView bounds]) > scrollHeight) + [contentView setFrameSize:CGSizeMake(CGRectGetWidth([_tokenScrollView bounds]), scrollHeight)]; if (_shouldScrollTo !== CPScrollDestinationNone) { @@ -1138,7 +1138,7 @@ CPTokenFieldDeleteButtonType = 1; if (scrollToToken === CPScrollDestinationLeft) scrollToToken = tokens[_selectedRange.location] else if (scrollToToken === CPScrollDestinationRight) - scrollToToken = tokens[MAX(0, _CPMaxRange(_selectedRange) - 1)]; + scrollToToken = tokens[MAX(0, CPMaxRange(_selectedRange) - 1)]; [self _scrollTokenViewToVisible:scrollToToken]; } @@ -1151,7 +1151,7 @@ CPTokenFieldDeleteButtonType = 1; if (!aToken) return; - return [[_tokenScrollView documentView] scrollPoint:_CGPointMake(0, [aToken frameOrigin].y)]; + return [[_tokenScrollView documentView] scrollPoint:CGPointMake(0, [aToken frameOrigin].y)]; } @end @@ -1183,7 +1183,7 @@ CPTokenFieldDeleteButtonType = 1; - (CGPoint)_completionOrigin:(_CPAutocompleteMenu)anAutocompleteMenu { var relativeFrame = _inputFrame ? [[_tokenScrollView documentView] convertRect:_inputFrame toView:self ] : [self bounds]; - return _CGPointMake(_CGRectGetMinX(relativeFrame), _CGRectGetMaxY(relativeFrame)); + return CGPointMake(CGRectGetMinX(relativeFrame), CGRectGetMaxY(relativeFrame)); } /*! @@ -1403,7 +1403,7 @@ CPTokenFieldDeleteButtonType = 1; - (CGSize)_minimumFrameSize { - var size = _CGSizeMakeZero(), + var size = CGSizeMakeZero(), minSize = [self currentValueForThemeAttribute:@"min-size"], contentInset = [self currentValueForThemeAttribute:@"content-inset"]; @@ -1478,7 +1478,7 @@ CPTokenFieldDeleteButtonType = 1; buttonOffset = [_disclosureButton currentValueForThemeAttribute:@"offset"], buttonSize = [_disclosureButton currentValueForThemeAttribute:@"min-size"]; - [_disclosureButton setFrame:_CGRectMake(CGRectGetMaxX(frame) - buttonOffset.x, CGRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)]; + [_disclosureButton setFrame:CGRectMake(CGRectGetMaxX(frame) - buttonOffset.x, CGRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)]; break; case CPTokenFieldDeleteButtonType: [_deleteButton setEnabled:[self isEditable] && [self isEnabled]]; @@ -1487,7 +1487,7 @@ CPTokenFieldDeleteButtonType = 1; buttonOffset = [_deleteButton currentValueForThemeAttribute:@"offset"], buttonSize = [_deleteButton currentValueForThemeAttribute:@"min-size"]; - [_deleteButton setFrame:_CGRectMake(CGRectGetMaxX(frame) - buttonOffset.x, CGRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)]; + [_deleteButton setFrame:CGRectMake(CGRectGetMaxX(frame) - buttonOffset.x, CGRectGetMinY(frame) + buttonOffset.y, buttonSize.width, buttonSize.height)]; break; } } @@ -1529,7 +1529,7 @@ CPTokenFieldDeleteButtonType = 1; { var attributes = [CPButton themeAttributes]; - [attributes setObject:_CGPointMake(15, 5) forKey:@"offset"]; + [attributes setObject:CGPointMake(15, 5) forKey:@"offset"]; return attributes; } @@ -1559,7 +1559,7 @@ CPTokenFieldDeleteButtonType = 1; { var attributes = [CPButton themeAttributes]; - [attributes setObject:_CGPointMake(15, 5) forKey:@"offset"]; + [attributes setObject:CGPointMake(15, 5) forKey:@"offset"]; return attributes; } diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index fd97bf531..8f1974f34 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -610,7 +610,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) @"extra-item-width": 20.0, @"extra-item-extra-image": [CPNull null], @"extra-item-extra-alternate-image": [CPNull null], - @"content-inset": _CGInsetMake(4.0, 4.0, 4.0, 10), + @"content-inset": CGInsetMake(4.0, 4.0, 4.0, 10), @"regular-size-height": 59.0, @"small-size-height": 46.0, @"image-item-separator-color": [CPNull null], @@ -629,7 +629,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) _labelColor = [CPColor blackColor]; _labelShadowColor = [CPColor colorWithWhite:1.0 alpha:0.75]; - _additionalItemsButton = [[CPPopUpButton alloc] initWithFrame:_CGRectMake(0.0, 0.0, 10.0, 15.0) pullsDown:YES]; + _additionalItemsButton = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 10.0, 15.0) pullsDown:YES]; [_additionalItemsButton setBordered:NO]; [_additionalItemsButton setImagePosition:CPImageOnly]; @@ -679,7 +679,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) { // We begin by recalculating the visible items. var items = [_toolbar items], - itemsWidth = _CGRectGetWidth([self bounds]), + itemsWidth = CGRectGetWidth([self bounds]), minWidth = _minWidth, // FIXME: This should be a CPSet. invisibleItemsSortedByPriority = []; @@ -766,7 +766,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) // static width (min==max). This handles the case where the user did setView: // with a view of a different size than minSize/maxSize else - [view setFrameSize:_CGSizeMake(minSize.width, height)]; + [view setFrameSize:CGSizeMake(minSize.width, height)]; [view setHidden:NO]; } @@ -801,7 +801,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) remainingSpace += proposedWidth - constrainedWidth; } - [view setFrameSize:_CGSizeMake(constrainedWidth, height)]; + [view setFrameSize:CGSizeMake(constrainedWidth, height)]; } } @@ -815,9 +815,9 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) for (; index < count; ++index) { var view = [self viewForItem:_visibleItems[index]], - viewWidth = _CGRectGetWidth([view frame]); + viewWidth = CGRectGetWidth([view frame]); - [view setFrame:_CGRectMake(x, y, viewWidth, height)]; + [view setFrame:CGRectMake(x, y, viewWidth, height)]; x += viewWidth + [self valueForThemeAttribute:@"item-margin"]; } @@ -851,7 +851,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth) if (needsAdditionalItemsButton) { - [_additionalItemsButton setFrameOrigin:_CGPointMake(itemsWidth + 5.0, (_CGRectGetHeight([self bounds]) - _CGRectGetHeight([_additionalItemsButton frame])) / 2.0)]; + [_additionalItemsButton setFrameOrigin:CGPointMake(itemsWidth + 5.0, (CGRectGetHeight([self bounds]) - CGRectGetHeight([_additionalItemsButton frame])) / 2.0)]; [self addSubview:_additionalItemsButton]; @@ -994,12 +994,12 @@ var LABEL_MARGIN = 2.0; { _toolbarItem = aToolbarItem; - _labelField = [[CPTextField alloc] initWithFrame:_CGRectMakeZero()]; + _labelField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; [_labelField setFont:[CPFont systemFontOfSize:11.0]]; [_labelField setTextColor:[self FIXME_labelColor]]; [_labelField setTextShadowColor:[self FIXME_labelShadowColor]]; - [_labelField setTextShadowOffset:_CGSizeMake(0.0, 1.0)]; + [_labelField setTextShadowOffset:CGSizeMake(0.0, 1.0)]; [_labelField setAutoresizingMask:CPViewWidthSizable | CPViewMinXMargin]; [self addSubview:_labelField]; @@ -1101,8 +1101,8 @@ var LABEL_MARGIN = 2.0; [_labelField setHidden:iconOnly]; [_view setHidden:labelOnly]; - _minSize = _CGSizeMake(MAX(_labelSize.width, minSize.width), (labelOnly ? 0 : minSize.height) + (iconOnly ? 0 : _labelSize.height + LABEL_MARGIN)); - _maxSize = _CGSizeMake(MAX(_labelSize.width, maxSize.width), 100000000.0); + _minSize = CGSizeMake(MAX(_labelSize.width, minSize.width), (labelOnly ? 0 : minSize.height) + (iconOnly ? 0 : _labelSize.height + LABEL_MARGIN)); + _maxSize = CGSizeMake(MAX(_labelSize.width, maxSize.width), 100000000.0); [_toolbar tile]; } @@ -1116,14 +1116,14 @@ var LABEL_MARGIN = 2.0; return; var bounds = [self bounds], - width = _CGRectGetWidth(bounds); + width = CGRectGetWidth(bounds); if (identifier === CPToolbarSeparatorItemIdentifier) { var itemSeparatorColor = [_toolbar valueForThemeAttribute:@"image-item-separator-color"], itemSeparatorSize = [_toolbar valueForThemeAttribute:@"image-item-separator-size"]; - [_view setFrame:_CGRectMake(ROUND((width - itemSeparatorSize.size.width) / 2.0), 0.0, itemSeparatorSize.size.width, _CGRectGetHeight(bounds))]; + [_view setFrame:CGRectMake(ROUND((width - itemSeparatorSize.size.width) / 2.0), 0.0, itemSeparatorSize.size.width, CGRectGetHeight(bounds))]; [_view setBackgroundColor:itemSeparatorColor]; return; @@ -1133,17 +1133,17 @@ var LABEL_MARGIN = 2.0; var view = _view || _imageView, itemMaxSize = [_toolbarItem maxSize], iconOnly = [[_toolbarItem toolbar] displayMode] === CPToolbarDisplayModeIconOnly, - height = _CGRectGetHeight(bounds) - (iconOnly ? 0 : _labelSize.height), + height = CGRectGetHeight(bounds) - (iconOnly ? 0 : _labelSize.height), viewWidth = MIN(itemMaxSize.width, width), viewHeight = MIN(itemMaxSize.height, height); - [view setFrame:_CGRectMake(ROUND((width - viewWidth) / 2.0), + [view setFrame:CGRectMake(ROUND((width - viewWidth) / 2.0), ROUND((height - viewHeight) / 2.0), viewWidth, viewHeight)]; // Label is always drawn at the bottom of the view. So if the view is really tall but the icon is tiny, the icon is centred above the label while the label remains on the bottom. - [_labelField setFrameOrigin:_CGPointMake(ROUND((width - _labelSize.width) / 2.0), _CGRectGetHeight(bounds) - _labelSize.height)]; + [_labelField setFrameOrigin:CGPointMake(ROUND((width - _labelSize.width) / 2.0), CGRectGetHeight(bounds) - _labelSize.height)]; } - (void)mouseDown:(CPEvent)anEvent @@ -1210,7 +1210,7 @@ var LABEL_MARGIN = 2.0; if (alternateImage) [_imageView setImage:alternateImage]; - [_labelField setTextShadowOffset:_CGSizeMakeZero()]; + [_labelField setTextShadowOffset:CGSizeMakeZero()]; } else { @@ -1219,7 +1219,7 @@ var LABEL_MARGIN = 2.0; if (image) [_imageView setImage:image]; - [_labelField setTextShadowOffset:_CGSizeMake(0.0, 1.0)]; + [_labelField setTextShadowOffset:CGSizeMake(0.0, 1.0)]; } [_labelField setTextShadowColor:[self FIXME_labelShadowColor]]; diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 5d2c042c1..27cb53ff9 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -294,8 +294,8 @@ var CPViewFlags = { }, if (self) { - var width = _CGRectGetWidth(aFrame), - height = _CGRectGetHeight(aFrame); + var width = CGRectGetWidth(aFrame), + height = CGRectGetHeight(aFrame); _subviews = []; _registeredDraggedTypes = [CPSet set]; @@ -303,8 +303,8 @@ var CPViewFlags = { }, _tag = -1; - _frame = _CGRectMakeCopy(aFrame); - _bounds = _CGRectMake(0.0, 0.0, width, height); + _frame = CGRectMakeCopy(aFrame); + _bounds = CGRectMake(0.0, 0.0, width, height); _autoresizingMask = CPViewNotSizable; _autoresizesSubviews = YES; @@ -317,7 +317,7 @@ var CPViewFlags = { }, #if PLATFORM(DOM) _DOMElement = DOMElementPrototype.cloneNode(false); - CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, _CGRectGetMinX(aFrame), _CGRectGetMinY(aFrame)); + CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(aFrame), CGRectGetMinY(aFrame)); CPDOMDisplayServerSetStyleSize(_DOMElement, width, height); if (typeof(appkit_tag_dom_elements) !== "undefined" && !!appkit_tag_dom_elements) @@ -829,7 +829,7 @@ var CPViewFlags = { }, */ - (void)setFrame:(CGRect)aFrame { - if (_CGRectEqualToRect(_frame, aFrame)) + if (CGRectEqualToRect(_frame, aFrame)) return; _inhibitFrameAndBoundsChangedNotifications = YES; @@ -849,17 +849,17 @@ var CPViewFlags = { }, */ - (CGRect)frame { - return _CGRectMakeCopy(_frame); + return CGRectMakeCopy(_frame); } - (CGPoint)frameOrigin { - return _CGPointMakeCopy(_frame.origin); + return CGPointMakeCopy(_frame.origin); } - (CGSize)frameSize { - return _CGSizeMakeCopy(_frame.size); + return CGSizeMakeCopy(_frame.size); } /*! @@ -894,7 +894,7 @@ var CPViewFlags = { }, { var origin = _frame.origin; - if (!aPoint || _CGPointEqualToPoint(origin, aPoint)) + if (!aPoint || CGPointEqualToPoint(origin, aPoint)) return; origin.x = aPoint.x; @@ -920,10 +920,10 @@ var CPViewFlags = { }, { var size = _frame.size; - if (!aSize || _CGSizeEqualToSize(size, aSize)) + if (!aSize || CGSizeEqualToSize(size, aSize)) return; - var oldSize = _CGSizeMakeCopy(size); + var oldSize = CGSizeMakeCopy(size); size.width = aSize.width; size.height = aSize.height; @@ -1060,7 +1060,7 @@ var CPViewFlags = { }, */ - (void)setBounds:(CGRect)bounds { - if (_CGRectEqualToRect(_bounds, bounds)) + if (CGRectEqualToRect(_bounds, bounds)) return; _inhibitFrameAndBoundsChangedNotifications = YES; @@ -1080,17 +1080,17 @@ var CPViewFlags = { }, */ - (CGRect)bounds { - return _CGRectMakeCopy(_bounds); + return CGRectMakeCopy(_bounds); } - (CGPoint)boundsOrigin { - return _CGPointMakeCopy(_bounds.origin); + return CGPointMakeCopy(_bounds.origin); } - (CGSize)boundsSize { - return _CGSizeMakeCopy(_bounds.size); + return CGSizeMakeCopy(_bounds.size); } /*! @@ -1103,7 +1103,7 @@ var CPViewFlags = { }, { var origin = _bounds.origin; - if (_CGPointEqualToPoint(origin, aPoint)) + if (CGPointEqualToPoint(origin, aPoint)) return; origin.x = aPoint.x; @@ -1111,7 +1111,7 @@ var CPViewFlags = { }, if (origin.x != 0 || origin.y != 0) { - _boundsTransform = _CGAffineTransformMakeTranslation(-origin.x, -origin.y); + _boundsTransform = CGAffineTransformMakeTranslation(-origin.x, -origin.y); _inverseBoundsTransform = CGAffineTransformInvert(_boundsTransform); } else @@ -1146,12 +1146,12 @@ var CPViewFlags = { }, { var size = _bounds.size; - if (_CGSizeEqualToSize(size, aSize)) + if (CGSizeEqualToSize(size, aSize)) return; var frameSize = _frame.size; - if (!_CGSizeEqualToSize(size, frameSize)) + if (!CGSizeEqualToSize(size, frameSize)) { var origin = _bounds.origin; @@ -1162,7 +1162,7 @@ var CPViewFlags = { }, size.width = aSize.width; size.height = aSize.height; - if (!_CGSizeEqualToSize(size, frameSize)) + if (!CGSizeEqualToSize(size, frameSize)) { var origin = _bounds.origin; @@ -1187,7 +1187,7 @@ var CPViewFlags = { }, return; var frame = _superview._frame, - newFrame = _CGRectMakeCopy(_frame), + newFrame = CGRectMakeCopy(_frame), dX = frame.size.width - aSize.width, dY = frame.size.height - aSize.height, evenFractionX = 1.0 / ((mask & CPViewMinXMargin ? 1 : 0) + (mask & CPViewWidthSizable ? 1 : 0) + (mask & CPViewMaxXMargin ? 1 : 0)), @@ -1547,15 +1547,15 @@ var CPViewFlags = { }, */ - (CPView)hitTest:(CGPoint)aPoint { - if (_isHidden || !_hitTests || !_CGRectContainsPoint(_frame, aPoint)) + if (_isHidden || !_hitTests || !CGRectContainsPoint(_frame, aPoint)) return nil; var view = nil, i = _subviews.length, - adjustedPoint = _CGPointMake(aPoint.x - _CGRectGetMinX(_frame), aPoint.y - _CGRectGetMinY(_frame)); + adjustedPoint = CGPointMake(aPoint.x - CGRectGetMinX(_frame), aPoint.y - CGRectGetMinY(_frame)); if (_inverseBoundsTransform) - adjustedPoint = _CGPointApplyAffineTransform(adjustedPoint, _inverseBoundsTransform); + adjustedPoint = CGPointApplyAffineTransform(adjustedPoint, _inverseBoundsTransform); while (i--) if (view = [_subviews[i] hitTest:adjustedPoint]) @@ -2136,20 +2136,20 @@ setBoundsOrigin: if (!(_viewClassFlags & CPViewHasCustomDrawRect)) return; - if (_CGRectIsEmpty(aRect)) + if (CGRectIsEmpty(aRect)) return; - if (_dirtyRect && !_CGRectIsEmpty(_dirtyRect)) + if (_dirtyRect && !CGRectIsEmpty(_dirtyRect)) _dirtyRect = CGRectUnion(aRect, _dirtyRect); else - _dirtyRect = _CGRectMakeCopy(aRect); + _dirtyRect = CGRectMakeCopy(aRect); _CPDisplayServerAddDisplayObject(self); } - (BOOL)needsDisplay { - return _dirtyRect && !_CGRectIsEmpty(_dirtyRect); + return _dirtyRect && !CGRectIsEmpty(_dirtyRect); } /*! @@ -2225,13 +2225,13 @@ setBoundsOrigin: _DOMContentsElement.style.position = "absolute"; _DOMContentsElement.style.visibility = "visible"; - _DOMContentsElement.width = ROUND(_CGRectGetWidth(_frame)); - _DOMContentsElement.height = ROUND(_CGRectGetHeight(_frame)); + _DOMContentsElement.width = ROUND(CGRectGetWidth(_frame)); + _DOMContentsElement.height = ROUND(CGRectGetHeight(_frame)); _DOMContentsElement.style.top = "0px"; _DOMContentsElement.style.left = "0px"; - _DOMContentsElement.style.width = ROUND(_CGRectGetWidth(_frame)) + "px"; - _DOMContentsElement.style.height = ROUND(_CGRectGetHeight(_frame)) + "px"; + _DOMContentsElement.style.width = ROUND(CGRectGetWidth(_frame)) + "px"; + _DOMContentsElement.style.height = ROUND(CGRectGetHeight(_frame)) + "px"; // The performance implications of this aren't clear, but without this subviews might not be redrawn when this // view moves. @@ -2339,7 +2339,7 @@ setBoundsOrigin: aRect = CGRectIntersection(aRect, _bounds); // If aRect is empty no scrolling required. - if (_CGRectIsEmpty(aRect)) + if (CGRectIsEmpty(aRect)) return NO; var enclosingClipView = [self _enclosingClipView]; @@ -2362,18 +2362,18 @@ setBoundsOrigin: if (CGRectContainsRect(documentViewVisibleRect, rectInDocumentView)) return NO; - var scrollPoint = _CGPointMakeCopy(documentViewVisibleRect.origin); + var scrollPoint = CGPointMakeCopy(documentViewVisibleRect.origin); // One of the following has to be true since our current visible rect didn't contain aRect. - if (_CGRectGetMinX(rectInDocumentView) < _CGRectGetMinX(documentViewVisibleRect)) - scrollPoint.x = _CGRectGetMinX(rectInDocumentView); - else if (_CGRectGetMaxX(rectInDocumentView) > _CGRectGetMaxX(documentViewVisibleRect)) - scrollPoint.x += _CGRectGetMaxX(rectInDocumentView) - _CGRectGetMaxX(documentViewVisibleRect); + if (CGRectGetMinX(rectInDocumentView) < CGRectGetMinX(documentViewVisibleRect)) + scrollPoint.x = CGRectGetMinX(rectInDocumentView); + else if (CGRectGetMaxX(rectInDocumentView) > CGRectGetMaxX(documentViewVisibleRect)) + scrollPoint.x += CGRectGetMaxX(rectInDocumentView) - CGRectGetMaxX(documentViewVisibleRect); - if (_CGRectGetMinY(rectInDocumentView) < _CGRectGetMinY(documentViewVisibleRect)) - scrollPoint.y = _CGRectGetMinY(rectInDocumentView); - else if (_CGRectGetMaxY(rectInDocumentView) > _CGRectGetMaxY(documentViewVisibleRect)) - scrollPoint.y += _CGRectGetMaxY(rectInDocumentView) - _CGRectGetMaxY(documentViewVisibleRect); + if (CGRectGetMinY(rectInDocumentView) < CGRectGetMinY(documentViewVisibleRect)) + scrollPoint.y = CGRectGetMinY(rectInDocumentView); + else if (CGRectGetMaxY(rectInDocumentView) > CGRectGetMaxY(documentViewVisibleRect)) + scrollPoint.y += CGRectGetMaxY(rectInDocumentView) - CGRectGetMaxY(documentViewVisibleRect); [enclosingClipView scrollToPoint:scrollPoint]; @@ -2950,7 +2950,7 @@ setBoundsOrigin: - (CGRect)rectForEphemeralSubviewNamed:(CPString)aViewName { - return _CGRectMakeZero(); + return CGRectMakeZero(); } - (CPView)layoutEphemeralSubviewNamed:(CPString)aViewName @@ -3089,8 +3089,8 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", _DOMImageParts = []; _DOMImageSizes = []; - CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, _CGRectGetMinX(_frame), _CGRectGetMinY(_frame)); - CPDOMDisplayServerSetStyleSize(_DOMElement, _CGRectGetWidth(_frame), _CGRectGetHeight(_frame)); + CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(_frame), CGRectGetMinY(_frame)); + CPDOMDisplayServerSetStyleSize(_DOMElement, CGRectGetWidth(_frame), CGRectGetHeight(_frame)); var index = 0, count = _subviews.length; @@ -3242,12 +3242,12 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) { var frame = view._frame; - transform.tx += _CGRectGetMinX(frame); - transform.ty += _CGRectGetMinY(frame); + transform.tx += CGRectGetMinX(frame); + transform.ty += CGRectGetMinY(frame); if (view._boundsTransform) { - _CGAffineTransformConcatTo(transform, view._boundsTransform, transform); + CGAffineTransformConcatTo(transform, view._boundsTransform, transform); } view = view._superview; @@ -3268,8 +3268,8 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) var frame = [fromWindow frame]; - transform.tx += _CGRectGetMinX(frame); - transform.ty += _CGRectGetMinY(frame); + transform.tx += CGRectGetMinX(frame); + transform.ty += CGRectGetMinY(frame); } } } @@ -3281,12 +3281,12 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) { var frame = view._frame; - transform.tx -= _CGRectGetMinX(frame); - transform.ty -= _CGRectGetMinY(frame); + transform.tx -= CGRectGetMinX(frame); + transform.ty -= CGRectGetMinY(frame); if (view._boundsTransform) { - _CGAffineTransformConcatTo(transform, view._inverseBoundsTransform, transform); + CGAffineTransformConcatTo(transform, view._inverseBoundsTransform, transform); } view = view._superview; @@ -3296,8 +3296,8 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) { var frame = [toWindow frame]; - transform.tx -= _CGRectGetMinX(frame); - transform.ty -= _CGRectGetMinY(frame); + transform.tx -= CGRectGetMinX(frame); + transform.ty -= CGRectGetMinY(frame); } /* var views = [], view = toView; @@ -3314,8 +3314,8 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView) { var frame = views[index]._frame; - transform.tx -= _CGRectGetMinX(frame); - transform.ty -= _CGRectGetMinY(frame); + transform.tx -= CGRectGetMinX(frame); + transform.ty -= CGRectGetMinY(frame); }*/ return transform; diff --git a/AppKit/CPViewAnimation.j b/AppKit/CPViewAnimation.j index 932085442..85f76e2a2 100644 --- a/AppKit/CPViewAnimation.j +++ b/AppKit/CPViewAnimation.j @@ -116,7 +116,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect"; view = [self _targetView:dictionary], startFrame = [self _startFrame:dictionary], endFrame = [self _endFrame:dictionary], - differenceFrame = _CGRectMakeZero(), + differenceFrame = CGRectMakeZero(), value = [super currentValue]; differenceFrame.origin.x = endFrame.origin.x - startFrame.origin.x; @@ -124,7 +124,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect"; differenceFrame.size.width = endFrame.size.width - startFrame.size.width; differenceFrame.size.height = endFrame.size.height - startFrame.size.height; - var intermediateFrame = _CGRectMakeZero(); + var intermediateFrame = CGRectMakeZero(); intermediateFrame.origin.x = startFrame.origin.x + differenceFrame.origin.x * value; intermediateFrame.origin.y = startFrame.origin.y + differenceFrame.origin.y * value; intermediateFrame.size.width = startFrame.size.width + differenceFrame.size.width * value; @@ -140,7 +140,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect"; [view setAlphaValue:1.0 + ( 0.0 - 1.0 ) * value]; if (progress === 1.0) - [self _targetView:view setHidden:_CGRectIsNull(endFrame) || [view alphaValue] === 0.0]; + [self _targetView:view setHidden:CGRectIsEmpty(endFrame) || [view alphaValue] === 0.0]; } } @@ -161,7 +161,7 @@ CPViewAnimationFadeOutEffect = @"CPViewAnimationFadeOutEffect"; else if (effect === CPViewAnimationFadeOutEffect) [view setAlphaValue:0.0]; - [self _targetView:view setHidden:_CGRectIsNull(endFrame) || [view alphaValue] === 0.0]; + [self _targetView:view setHidden:CGRectIsEmpty(endFrame) || [view alphaValue] === 0.0]; } [super stopAnimation]; diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index 138bd63f9..514d30a29 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -230,7 +230,7 @@ var CPWindowActionMessageKeys = [ - (id)init { - return [self initWithContentRect:_CGRectMakeZero() styleMask:CPTitledWindowMask]; + return [self initWithContentRect:CGRectMakeZero() styleMask:CPTitledWindowMask]; } /*! @@ -303,19 +303,19 @@ CPTexturedBackgroundWindowMask [self setLevel:CPNormalWindowLevel]; // Create our border view which is the actual root of our view hierarchy. - _windowView = [[windowViewClass alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(_frame), _CGRectGetHeight(_frame)) styleMask:aStyleMask]; + _windowView = [[windowViewClass alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)) styleMask:aStyleMask]; [_windowView _setWindow:self]; [_windowView setNextResponder:self]; // Size calculation needs _windowView - _minSize = [self _calculateMinSizeForProposedSize:_CGSizeMake(0.0, 0.0)]; - _maxSize = _CGSizeMake(1000000.0, 1000000.0); + _minSize = [self _calculateMinSizeForProposedSize:CGSizeMake(0.0, 0.0)]; + _maxSize = CGSizeMake(1000000.0, 1000000.0); [self setMovableByWindowBackground:aStyleMask & CPHUDBackgroundWindowMask]; // Create a generic content view. - [self setContentView:[[CPView alloc] initWithFrame:_CGRectMakeZero()]]; + [self setContentView:[[CPView alloc] initWithFrame:CGRectMakeZero()]]; _firstResponder = self; @@ -328,7 +328,7 @@ CPTexturedBackgroundWindowMask if (![self _sharesChromeWithPlatformWindow]) { - CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, _CGRectGetMinX(_frame), _CGRectGetMinY(_frame)); + CPDOMDisplayServerSetStyleLeftTop(_DOMElement, NULL, CGRectGetMinX(_frame), CGRectGetMinY(_frame)); } CPDOMDisplayServerSetStyleSize(_DOMElement, 1, 1); @@ -547,7 +547,7 @@ CPTexturedBackgroundWindowMask _fullPlatformWindowSession = _CPWindowFullPlatformWindowSessionMake(_windowView, [self contentRectForFrameRect:[self frame]], [self hasShadow], [self level]); var fullPlatformWindowViewClass = [[self class] _windowViewClassForFullPlatformWindowStyleMask:_styleMask], - windowView = [[fullPlatformWindowViewClass alloc] initWithFrame:_CGRectMakeZero() styleMask:_styleMask]; + windowView = [[fullPlatformWindowViewClass alloc] initWithFrame:CGRectMakeZero() styleMask:_styleMask]; [self _setWindowView:windowView]; @@ -633,7 +633,7 @@ CPTexturedBackgroundWindowMask */ - (CGRect)frame { - return _CGRectMakeCopy(_frame); + return CGRectMakeCopy(_frame); } /*! @@ -688,11 +688,11 @@ CPTexturedBackgroundWindowMask { var origin = _frame.origin, newOrigin = frame.origin, - originMoved = !_CGPointEqualToPoint(origin, newOrigin); + originMoved = !CGPointEqualToPoint(origin, newOrigin); if (originMoved) { - delta = _CGPointMake(newOrigin.x - origin.x, newOrigin.y - origin.y); + delta = CGPointMake(newOrigin.x - origin.x, newOrigin.y - origin.y); origin.x = newOrigin.x; origin.y = newOrigin.y; @@ -709,7 +709,7 @@ CPTexturedBackgroundWindowMask var size = _frame.size, newSize = frame.size; - if (!_CGSizeEqualToSize(size, newSize)) + if (!CGSizeEqualToSize(size, newSize)) { size.width = newSize.width; size.height = newSize.height; @@ -811,7 +811,7 @@ CPTexturedBackgroundWindowMask { var origin = [childWindow frame].origin; - [childWindow setFrameOrigin:_CGPointMake(origin.x + delta.x, origin.y + delta.y)]; + [childWindow setFrameOrigin:CGPointMake(origin.x + delta.x, origin.y + delta.y)]; } ]; } @@ -855,7 +855,7 @@ CPTexturedBackgroundWindowMask */ - (void)setFrameSize:(CGSize)aSize { - [self setFrame:_CGRectMake(_CGRectGetMinX(_frame), _CGRectGetMinY(_frame), aSize.width, aSize.height) display:YES animate:NO]; + [self setFrame:CGRectMake(CGRectGetMinX(_frame), CGRectGetMinY(_frame), aSize.width, aSize.height) display:YES animate:NO]; } /*! @@ -1083,7 +1083,7 @@ CPTexturedBackgroundWindowMask if (_contentView) [_contentView removeFromSuperview]; - var bounds = _CGRectMake(0.0, 0.0, _CGRectGetWidth(_frame), _CGRectGetHeight(_frame)); + var bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame)); _contentView = aView; [_contentView setFrame:[self contentRectForFrameRect:bounds]]; @@ -1150,12 +1150,12 @@ CPTexturedBackgroundWindowMask */ - (void)setMinSize:(CGSize)aSize { - if (_CGSizeEqualToSize(_minSize, aSize)) + if (CGSizeEqualToSize(_minSize, aSize)) return; _minSize = [self _calculateMinSizeForProposedSize:aSize]; - var size = _CGSizeMakeCopy([self frame].size), + var size = CGSizeMakeCopy([self frame].size), needsFrameChange = NO; if (size.width < _minSize.width) @@ -1186,9 +1186,9 @@ CPTexturedBackgroundWindowMask - (CGSize)_calculateMinSizeForProposedSize:(CGSize)proposedSize { var contentFrame = [self contentRectForFrameRect:_frame], - minHeight = _CGRectGetHeight(_frame) - _CGRectGetHeight(contentFrame); + minHeight = CGRectGetHeight(_frame) - CGRectGetHeight(contentFrame); - return _CGSizeMake(MAX(proposedSize.width, 0), MAX(proposedSize.height, minHeight)); + return CGSizeMake(MAX(proposedSize.width, 0), MAX(proposedSize.height, minHeight)); } /*! @@ -1199,12 +1199,12 @@ CPTexturedBackgroundWindowMask */ - (void)setMaxSize:(CGSize)aSize { - if (_CGSizeEqualToSize(_maxSize, aSize)) + if (CGSizeEqualToSize(_maxSize, aSize)) return; - _maxSize = _CGSizeMakeCopy(aSize); + _maxSize = CGSizeMakeCopy(aSize); - var size = _CGSizeMakeCopy([self frame].size), + var size = CGSizeMakeCopy([self frame].size), needsFrameChange = NO; if (size.width > _maxSize.width) @@ -1639,7 +1639,7 @@ CPTexturedBackgroundWindowMask var size = [self frame].size, containerSize = [CPPlatform isBrowser] ? [_platformWindow contentBounds].size : [[self screen] visibleFrame].size; - var origin = _CGPointMake((containerSize.width - size.width) / 2.0, (containerSize.height - size.height) / 2.0); + var origin = CGPointMake((containerSize.width - size.width) / 2.0, (containerSize.height - size.height) / 2.0); if (origin.x < 0.0) origin.x = 0.0; @@ -2473,7 +2473,7 @@ CPTexturedBackgroundWindowMask - (void)_noteToolbarChanged { - var frame = _CGRectMakeCopy([self frame]), + var frame = CGRectMakeCopy([self frame]), newFrame; [_windowView noteToolbarChanged]; @@ -2482,7 +2482,7 @@ CPTexturedBackgroundWindowMask newFrame = [_platformWindow visibleFrame]; else { - newFrame = _CGRectMakeCopy([self frame]); + newFrame = CGRectMakeCopy([self frame]); newFrame.origin = frame.origin; } @@ -2580,10 +2580,10 @@ CPTexturedBackgroundWindowMask // Position the sheet above the contentRect. var attachedSheet = [self attachedSheet], contentRect = [_contentView frame], - sheetFrame = _CGRectMakeCopy([attachedSheet frame]); + sheetFrame = CGRectMakeCopy([attachedSheet frame]); - sheetFrame.origin.y = _CGRectGetMinY(_frame) + _CGRectGetMinY(contentRect); - sheetFrame.origin.x = _CGRectGetMinX(_frame) + FLOOR((_CGRectGetWidth(_frame) - _CGRectGetWidth(sheetFrame)) / 2.0); + sheetFrame.origin.y = CGRectGetMinY(_frame) + CGRectGetMinY(contentRect); + sheetFrame.origin.x = CGRectGetMinX(_frame) + FLOOR((CGRectGetWidth(_frame) - CGRectGetWidth(sheetFrame)) / 2.0); [attachedSheet setFrame:sheetFrame display:YES animate:NO]; } @@ -2592,7 +2592,7 @@ CPTexturedBackgroundWindowMask Starting point for sheet session, called from CPApplication beginSheet: */ - (void)_attachSheet:(CPWindow)aSheet modalDelegate:(id)aModalDelegate - didEndSelector:(SEL)aDidEndSelector contextInfo:(id)aContextInfo + didEndSelector:(SEL)didEndSelector contextInfo:(id)contextInfo { if (_sheetContext) { @@ -2794,13 +2794,13 @@ CPTexturedBackgroundWindowMask var sheet = _sheetContext["sheet"], sheetFrame = [sheet frame], fullHeight = sheet._hasShadow ? [sheet._shadowView frame].size.height : sheetFrame.size.height, - endFrame = _CGRectMakeCopy(sheetFrame), + endFrame = CGRectMakeCopy(sheetFrame), contentOrigin = [self convertBaseToGlobal:[[self contentView] frame].origin]; // Don't constrain sheets, they are controlled by the parent sheet._constrainsToUsableScreen = NO; - [sheet setFrameOrigin:_CGPointMake(sheetFrame.origin.x, sheetFrame.origin.y - contentOrigin.y)]; + [sheet setFrameOrigin:CGPointMake(sheetFrame.origin.x, sheetFrame.origin.y - contentOrigin.y)]; [self _clipSheet:sheet]; endFrame.origin.y = -fullHeight; @@ -2827,10 +2827,10 @@ CPTexturedBackgroundWindowMask else { var sheetFrame = [sheet frame], - sheetOrigin = _CGPointMakeCopy(sheetFrame.origin); + sheetOrigin = CGPointMakeCopy(sheetFrame.origin); [self _removeClipForSheet:sheet]; - [sheet setFrameOrigin:_CGPointMake(sheetOrigin.x, [sheet frame].origin.y + sheetOrigin.y)]; + [sheet setFrameOrigin:CGPointMake(sheetOrigin.x, [sheet frame].origin.y + sheetOrigin.y)]; } } else @@ -3217,11 +3217,11 @@ var keyViewComparator = function(lhs, rhs, context) { var lhsBounds = [lhs convertRect:[lhs bounds] toView:nil], rhsBounds = [rhs convertRect:[rhs bounds] toView:nil], - lhsY = _CGRectGetMinY(lhsBounds), - rhsY = _CGRectGetMinY(rhsBounds), - lhsX = _CGRectGetMinX(lhsBounds), - rhsX = _CGRectGetMinX(rhsBounds), - intersectsVertically = MIN(_CGRectGetMaxY(lhsBounds), _CGRectGetMaxY(rhsBounds)) - MAX(lhsY, rhsY); + lhsY = CGRectGetMinY(lhsBounds), + rhsY = CGRectGetMinY(rhsBounds), + lhsX = CGRectGetMinX(lhsBounds), + rhsX = CGRectGetMinX(rhsBounds), + intersectsVertically = MIN(CGRectGetMaxY(lhsBounds), CGRectGetMaxY(rhsBounds)) - MAX(lhsY, rhsY); // If two views are "on the same line" (intersect vertically), then rely on the x comparison. if (intersectsVertically > 0) @@ -3258,10 +3258,10 @@ var keyViewComparator = function(lhs, rhs, context) return; var frame = [_platformWindow contentBounds], - newFrame = _CGRectMakeCopy(_frame), - dX = (_CGRectGetWidth(frame) - aSize.width) / + newFrame = CGRectMakeCopy(_frame), + dX = (CGRectGetWidth(frame) - aSize.width) / (((_autoresizingMask & CPWindowMinXMargin) ? 1 : 0) + (_autoresizingMask & CPWindowWidthSizable ? 1 : 0) + (_autoresizingMask & CPWindowMaxXMargin ? 1 : 0)), - dY = (_CGRectGetHeight(frame) - aSize.height) / + dY = (CGRectGetHeight(frame) - aSize.height) / ((_autoresizingMask & CPWindowMinYMargin ? 1 : 0) + (_autoresizingMask & CPWindowHeightSizable ? 1 : 0) + (_autoresizingMask & CPWindowMaxYMargin ? 1 : 0)); if (_autoresizingMask & CPWindowMinXMargin) @@ -3317,11 +3317,11 @@ var keyViewComparator = function(lhs, rhs, context) - (CGPoint)convertBaseToPlatformWindow:(CGPoint)aPoint { if ([self _sharesChromeWithPlatformWindow]) - return _CGPointMakeCopy(aPoint); + return CGPointMakeCopy(aPoint); var origin = [self frame].origin; - return _CGPointMake(aPoint.x + origin.x, aPoint.y + origin.y); + return CGPointMake(aPoint.x + origin.x, aPoint.y + origin.y); } /*! @@ -3330,11 +3330,11 @@ var keyViewComparator = function(lhs, rhs, context) - (CGPoint)convertPlatformWindowToBase:(CGPoint)aPoint { if ([self _sharesChromeWithPlatformWindow]) - return _CGPointMakeCopy(aPoint); + return CGPointMakeCopy(aPoint); var origin = [self frame].origin; - return _CGPointMake(aPoint.x - origin.x, aPoint.y - origin.y); + return CGPointMake(aPoint.x - origin.x, aPoint.y - origin.y); } - (CGPoint)convertScreenToBase:(CGPoint)aPoint @@ -3410,7 +3410,7 @@ var keyViewComparator = function(lhs, rhs, context) - (BOOL)containsPoint:(CGPoint)aPoint { - return _CGRectContainsPoint(_frame, aPoint); + return CGRectContainsPoint(_frame, aPoint); } /* aPoint should be global */ @@ -3418,9 +3418,9 @@ var keyViewComparator = function(lhs, rhs, context) { // If we are using the new resizing mode, mouse events are valid // outside the window's frame for non-full platform windows. - var mouseFrame = (!_isFullPlatformWindow && (_styleMask & CPResizableWindowMask) && (CPWindowResizeStyle === CPWindowResizeStyleModern)) ? _CGRectInset(_frame, -_CPWindowViewResizeSlop, -_CPWindowViewResizeSlop) : _frame; + var mouseFrame = (!_isFullPlatformWindow && (_styleMask & CPResizableWindowMask) && (CPWindowResizeStyle === CPWindowResizeStyleModern)) ? CGRectInset(_frame, -_CPWindowViewResizeSlop, -_CPWindowViewResizeSlop) : _frame; - return _CGRectContainsPoint(mouseFrame, aPoint); + return CGRectContainsPoint(mouseFrame, aPoint); } @end @@ -3486,8 +3486,8 @@ var interpolate = function(fromValue, toValue, progress) { _window = aWindow; - _targetFrame = _CGRectMakeCopy(aTargetFrame); - _startFrame = _CGRectMakeCopy([_window frame]); + _targetFrame = CGRectMakeCopy(aTargetFrame); + _startFrame = CGRectMakeCopy([_window frame]); } return self; @@ -3509,11 +3509,11 @@ var interpolate = function(fromValue, toValue, progress) if (value == 1.0) _window._isAnimating = NO; - var newFrame = _CGRectMake( - interpolate(_CGRectGetMinX(_startFrame), _CGRectGetMinX(_targetFrame), value), - interpolate(_CGRectGetMinY(_startFrame), _CGRectGetMinY(_targetFrame), value), - interpolate(_CGRectGetWidth(_startFrame), _CGRectGetWidth(_targetFrame), value), - interpolate(_CGRectGetHeight(_startFrame), _CGRectGetHeight(_targetFrame), value)); + var newFrame = CGRectMake( + interpolate(CGRectGetMinX(_startFrame), CGRectGetMinX(_targetFrame), value), + interpolate(CGRectGetMinY(_startFrame), CGRectGetMinY(_targetFrame), value), + interpolate(CGRectGetWidth(_startFrame), CGRectGetWidth(_targetFrame), value), + interpolate(CGRectGetHeight(_startFrame), CGRectGetHeight(_targetFrame), value)); [_window setFrame:newFrame display:YES animate:NO]; } diff --git a/AppKit/CPWindow/_CPDocModalWindowView.j b/AppKit/CPWindow/_CPDocModalWindowView.j index 4b187fd05..775b9542d 100644 --- a/AppKit/CPWindow/_CPDocModalWindowView.j +++ b/AppKit/CPWindow/_CPDocModalWindowView.j @@ -49,7 +49,7 @@ */ var contentRect = [super contentRectForFrameRect:aFrameRect]; - return _CGRectInset(contentRect, 1.0, 1.0); + return CGRectInset(contentRect, 1.0, 1.0); } - (id)initWithFrame:(CGRect)aFrame styleMask:(unsigned)aStyleMask @@ -60,7 +60,7 @@ { var bounds = [self bounds]; - _bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))]; + _bodyView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), CGRectGetHeight(bounds))]; [_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [_bodyView setHitTests:NO]; diff --git a/AppKit/CPWindow/_CPHUDWindowView.j b/AppKit/CPWindow/_CPHUDWindowView.j index d5aeb55a7..829f78eee 100644 --- a/AppKit/CPWindow/_CPHUDWindowView.j +++ b/AppKit/CPWindow/_CPHUDWindowView.j @@ -127,7 +127,7 @@ - (CGSize)toolbarOffset { - return _CGSizeMake(0.0, [[self class] titleBarHeight]); + return CGSizeMake(0.0, [[self class] titleBarHeight]); } - (void)tile @@ -136,15 +136,15 @@ var theWindow = [self window], bounds = [self bounds], - width = _CGRectGetWidth(bounds); + width = CGRectGetWidth(bounds); - [_titleField setFrame:_CGRectMake(20.0, 0, width - 40.0, [self toolbarOffset].height)]; + [_titleField setFrame:CGRectMake(20.0, 0, width - 40.0, [self toolbarOffset].height)]; var maxY = [self toolbarMaxY]; if ([_titleField isHidden]) maxY -= ([self toolbarOffset]).height; - var contentRect = _CGRectMake(0.0, maxY, width, _CGRectGetHeight(bounds) - maxY); + var contentRect = CGRectMake(0.0, maxY, width, CGRectGetHeight(bounds) - maxY); [[theWindow contentView] setFrame:contentRect]; } @@ -164,12 +164,12 @@ if (enable) dy = -dy; - var newHeight = _CGRectGetMaxY(frame) + dy, - newWidth = _CGRectGetMaxX(frame); + var newHeight = CGRectGetMaxY(frame) + dy, + newWidth = CGRectGetMaxX(frame); frame.size.height += dy; - [self setFrameSize:_CGSizeMake(newWidth, newHeight)]; + [self setFrameSize:CGSizeMake(newWidth, newHeight)]; [self tile]; [theWindow setFrame:frame display:NO animate:NO]; [theWindow setMovableByWindowBackground:!enable]; diff --git a/AppKit/CPWindow/_CPPopoverWindowView.j b/AppKit/CPWindow/_CPPopoverWindowView.j index 020896213..958bb7b34 100644 --- a/AppKit/CPWindow/_CPPopoverWindowView.j +++ b/AppKit/CPWindow/_CPPopoverWindowView.j @@ -28,10 +28,10 @@ @global CPPopoverAppearanceMinimal -var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), +var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10), _CPPopoverWindowViewRadius = 5.0, _CPPopoverWindowViewStrokeWidth = 1.0, - _CPPopoverWindowViewShadowSize = _CGSizeMake(0, 6), + _CPPopoverWindowViewShadowSize = CGSizeMake(0, 6), _CPPopoverWindowViewShadowBlur = 15.0; /*! @@ -71,7 +71,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), */ - (CGRect)contentRectForFrameRect:(CGRect)aFrameRect { - var contentRect = _CGRectMakeCopy(aFrameRect), + var contentRect = CGRectMakeCopy(aFrameRect), modifierX = 16, modifierY = 19; @@ -79,7 +79,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), // // @comment: If we use this, each time we open the popover, the content // view is reduced a little over and over - // return _CGRectInset(contentRect, modifierX, modifierY); + // return CGRectInset(contentRect, modifierX, modifierY); contentRect.origin.x += modifierX; contentRect.origin.y += modifierY; @@ -96,7 +96,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), */ + (CGRect)frameRectForContentRect:(CGRect)aContentRect { - var frameRect = _CGRectMakeCopy(aContentRect), + var frameRect = CGRectMakeCopy(aContentRect), modifierX = 16, modifierY = 19; @@ -104,7 +104,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), // @comment: If we use this, each time we open the popover, the content // // view is reduced a little over and over - // return _CGRectOffset(frameRect, modifierX, modifierY); + // return CGRectOffset(frameRect, modifierX, modifierY); frameRect.origin.x -= modifierX; frameRect.origin.y -= modifierY; @@ -124,7 +124,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), _arrowOffsetX = 0.0; _arrowOffsetY = 0.0; _appearance = CPPopoverAppearanceMinimal; - _cursorSize = _CGSizeMakeCopy(_CPPopoverWindowViewDefaultCursorSize); + _cursorSize = CGSizeMakeCopy(_CPPopoverWindowViewDefaultCursorSize); } return self; @@ -135,7 +135,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), */ - (void)hideCursor { - _cursorSize = _CGSizeMakeZero(); + _cursorSize = CGSizeMakeZero(); [self setNeedsDisplay:YES]; } @@ -144,7 +144,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), */ - (void)showCursor { - _cursorSize = _CGSizeMakeCopy(_CPPopoverWindowViewDefaultCursorSize); + _cursorSize = CGSizeMakeCopy(_CPPopoverWindowViewDefaultCursorSize); [self setNeedsDisplay:YES]; } @@ -190,19 +190,19 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), CGContextBeginPath(context); CGContextSetShadowWithColor(context, shadowSize, shadowBlur, shadowColor); - CGContextDrawLinearGradient(context, gradient, _CGPointMake(_CGRectGetMidX(frame), 0.0), _CGPointMake(_CGRectGetMidX(frame), frame.size.height), 0); + CGContextDrawLinearGradient(context, gradient, CGPointMake(CGRectGetMidX(frame), 0.0), CGPointMake(CGRectGetMidX(frame), frame.size.height), 0); - var xMin = _CGRectGetMinX(frame), - xMax = _CGRectGetMaxX(frame), - yMin = _CGRectGetMinY(frame), - yMax = _CGRectGetMaxY(frame), + var xMin = CGRectGetMinX(frame), + xMax = CGRectGetMaxX(frame), + yMin = CGRectGetMinY(frame), + yMax = CGRectGetMaxY(frame), arrowMinX = CGAlignCoordinate(xMin + radius + strokeWidth), arrowMaxX = CGAlignCoordinate(xMax - radius - strokeWidth), arrowMinY = CGAlignCoordinate(yMin + radius + strokeWidth), arrowMaxY = CGAlignCoordinate(yMax - radius + strokeWidth), - arrowAnchor = _CGPointMakeZero(), - arrowStart = _CGPointMakeZero(), - pt = _CGPointMakeZero(); + arrowAnchor = CGPointMakeZero(), + arrowStart = CGPointMakeZero(), + pt = CGPointMakeZero(); // draw! var path = CGPathCreateMutable(); @@ -237,7 +237,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), pt.y = arrowMaxY - arrowWidth; pt.x = arrowAnchor.x; - arrowStart = _CGPointMakeCopy(pt); + arrowStart = CGPointMakeCopy(pt); CGPathAddLineToPoint(path, NULL, pt.x, pt.y); // top edge -> point @@ -279,7 +279,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), pt.y = arrowMaxY; pt.x = arrowAnchor.x; - arrowStart = _CGPointMakeCopy(pt); + arrowStart = CGPointMakeCopy(pt); CGPathAddLineToPoint(path, NULL, pt.x, pt.y); // bottom edge -> point @@ -328,7 +328,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), pt.x = arrowMaxX - arrowWidth; pt.y = arrowAnchor.y; - arrowStart = _CGPointMakeCopy(pt); + arrowStart = CGPointMakeCopy(pt); CGPathAddLineToPoint(path, NULL, pt.x, pt.y); // left edge -> point @@ -370,7 +370,7 @@ var _CPPopoverWindowViewDefaultCursorSize = _CGSizeMake(16, 10), pt.x = arrowMaxX; pt.y = arrowAnchor.y; - arrowStart = _CGPointMakeCopy(pt); + arrowStart = CGPointMakeCopy(pt); CGPathAddLineToPoint(path, NULL, pt.x, pt.y); // right edge -> point diff --git a/AppKit/CPWindow/_CPShadowWindowView.j b/AppKit/CPWindow/_CPShadowWindowView.j index c78811141..d7095a750 100644 --- a/AppKit/CPWindow/_CPShadowWindowView.j +++ b/AppKit/CPWindow/_CPShadowWindowView.j @@ -54,7 +54,7 @@ shadowDistance = [_windowView valueForThemeAttribute:@"shadow-distance"], shadowInset = [_windowView valueForThemeAttribute:@"shadow-inset"], size = [_windowView frameSize], - shadowSize = _CGSizeMake(size.width, size.height); + shadowSize = CGSizeMake(size.width, size.height); // if the shadow would be taller/wider than the window height, // make it the same as the window height. this allows views to diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index f92fcd129..b2c68ef6a 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -51,10 +51,10 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; if (self) { _parentView = parentView; - _gradientView = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + _gradientView = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [self addSubview:_gradientView]; - _solidView = [[CPView alloc] initWithFrame:_CGRectMakeZero()]; + _solidView = [[CPView alloc] initWithFrame:CGRectMakeZero()]; [self addSubview:_solidView]; } @@ -68,10 +68,10 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; var gradientHeight = [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView], bounds = [self bounds]; - [_gradientView setFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), gradientHeight)]; + [_gradientView setFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), gradientHeight)]; [_gradientView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"bezel-head-color" inState:[_parentView themeState] forClass:_CPStandardWindowView]]; - [_solidView setFrame:_CGRectMake(0.0, gradientHeight, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds) - gradientHeight)]; + [_solidView setFrame:CGRectMake(0.0, gradientHeight, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - gradientHeight)]; [_solidView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"solid-color" forClass:_CPStandardWindowView]]; } @@ -79,8 +79,8 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; { var bounds = [self bounds]; - [_gradientView setFrameSize:_CGSizeMake(_CGRectGetWidth(bounds), [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView])]; - [_solidView setFrameSize:_CGSizeMake(_CGRectGetWidth(bounds), _CGRectGetHeight(bounds) - [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView])]; + [_gradientView setFrameSize:CGSizeMake(CGRectGetWidth(bounds), [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView])]; + [_solidView setFrameSize:CGSizeMake(CGRectGetWidth(bounds), CGRectGetHeight(bounds) - [[CPTheme defaultTheme] valueForAttributeWithName:@"gradient-height" forClass:_CPStandardWindowView])]; } @end @@ -150,34 +150,34 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; var theClass = [self class], bounds = [self bounds]; - _headView = [[_CPTexturedWindowHeadView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), [self valueForThemeAttribute:@"title-bar-height"]) windowView:self]; + _headView = [[_CPTexturedWindowHeadView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds), [self valueForThemeAttribute:@"title-bar-height"]) windowView:self]; [_headView setAutoresizingMask:CPViewWidthSizable];; [_headView setHitTests:NO]; [self addSubview:_headView positioned:CPWindowBelow relativeTo:_titleField]; - _dividerView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, _CGRectGetMaxY([_headView frame]), _CGRectGetWidth(bounds), _CPStandardWindowViewDividerViewHeight)]; + _dividerView = [[CPView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY([_headView frame]), CGRectGetWidth(bounds), _CPStandardWindowViewDividerViewHeight)]; [_dividerView setAutoresizingMask:CPViewWidthSizable]; [_dividerView setHitTests:NO]; [self addSubview:_dividerView]; - var y = _CGRectGetMinY([_dividerView frame]); + var y = CGRectGetMinY([_dividerView frame]); - _bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, y, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds) - y)]; + _bodyView = [[CPView alloc] initWithFrame:CGRectMake(0.0, y, CGRectGetWidth(bounds), CGRectGetHeight(bounds) - y)]; [_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [_bodyView setHitTests:NO]; [self addSubview:_bodyView]; - [self setResizeIndicatorOffset:_CGSizeMake(2.0, 2.0)]; + [self setResizeIndicatorOffset:CGSizeMake(2.0, 2.0)]; if (_styleMask & CPClosableWindowMask) { - _closeButton = [[CPButton alloc] initWithFrame:_CGRectMake(8.0, 8.0, 16.0, 16.0)]; + _closeButton = [[CPButton alloc] initWithFrame:CGRectMake(8.0, 8.0, 16.0, 16.0)]; [_closeButton setButtonType:CPMomentaryChangeButton]; [_closeButton setBordered:NO]; @@ -188,7 +188,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; if (_styleMask & CPMiniaturizableWindowMask && ![CPPlatform isBrowser]) { - _minimizeButton = [[CPButton alloc] initWithFrame:_CGRectMake(27.0, 7.0, 16.0, 16.0)]; + _minimizeButton = [[CPButton alloc] initWithFrame:CGRectMake(27.0, 7.0, 16.0, 16.0)]; [_minimizeButton setButtonType:CPMomentaryChangeButton]; [_minimizeButton setBordered:NO]; @@ -212,7 +212,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; - (CGSize)toolbarOffset { - return _CGSizeMake(0.0, [self valueForThemeAttribute:@"title-bar-height"]); + return CGSizeMake(0.0, [self valueForThemeAttribute:@"title-bar-height"]); } - (void)tile @@ -221,19 +221,19 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; var theWindow = [self window], bounds = [self bounds], - width = _CGRectGetWidth(bounds), + width = CGRectGetWidth(bounds), headHeight = [self toolbarMaxY]; - [_headView setFrameSize:_CGSizeMake(width, headHeight)]; - [_dividerView setFrame:_CGRectMake(0.0, headHeight, width, _CPStandardWindowViewDividerViewHeight)]; + [_headView setFrameSize:CGSizeMake(width, headHeight)]; + [_dividerView setFrame:CGRectMake(0.0, headHeight, width, _CPStandardWindowViewDividerViewHeight)]; var dividerMinY = 0, dividerFrame = [_dividerView frame]; if (![_dividerView isHidden]) - dividerMinY = _CGRectGetMinY(dividerFrame); + dividerMinY = CGRectGetMinY(dividerFrame); - [_bodyView setFrame:_CGRectMake(0.0, dividerMinY, width, _CGRectGetHeight(bounds) - dividerMinY)]; + [_bodyView setFrame:CGRectMake(0.0, dividerMinY, width, CGRectGetHeight(bounds) - dividerMinY)]; var leftOffset = 8; @@ -242,10 +242,10 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; if (_minimizeButton) leftOffset += 19.0; - [_titleField setFrame:_CGRectMake(leftOffset, 0, width - leftOffset * 2.0, [self valueForThemeAttribute:@"title-bar-height"])]; + [_titleField setFrame:CGRectMake(leftOffset, 0, width - leftOffset * 2.0, [self valueForThemeAttribute:@"title-bar-height"])]; var contentFrame = [_bodyView frame]; - [[theWindow contentView] setFrame:_CGRectInset(contentFrame, 1.0, 1.0)]; + [[theWindow contentView] setFrame:CGRectInset(contentFrame, 1.0, 1.0)]; } /* @@ -302,7 +302,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; - (BOOL)couldBeMoveEvent:(CPEvent)anEvent { if (![_headView isHidden]) - if (_CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil])) + if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil])) return YES; return [super couldBeMoveEvent:anEvent]; @@ -324,7 +324,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; // Move the shadow view down so it is inside the content border var shadowFrame = [_sheetShadowView frame]; - [_sheetShadowView setFrameOrigin:_CGPointMake(shadowFrame.origin.x, shadowFrame.origin.y + 1)]; + [_sheetShadowView setFrameOrigin:CGPointMake(shadowFrame.origin.x, shadowFrame.origin.y + 1)]; } else [_bodyView setBackgroundColor:[self valueForThemeAttribute:@"body-color"]]; @@ -340,12 +340,12 @@ var _CPStandardWindowViewDividerViewHeight = 1.0; else dy = [self toolbarMaxY] + dividerHeight; - var newHeight = _CGRectGetHeight(frame) + dy, - newWidth = _CGRectGetWidth(frame); + var newHeight = CGRectGetHeight(frame) + dy, + newWidth = CGRectGetWidth(frame); frame.size.height += dy; - [self setFrameSize:_CGSizeMake(newWidth, newHeight)]; + [self setFrameSize:CGSizeMake(newWidth, newHeight)]; [self tile]; [theWindow setFrame:frame display:NO animate:NO]; diff --git a/AppKit/CPWindow/_CPTitleableWindowView.j b/AppKit/CPWindow/_CPTitleableWindowView.j index dd83d10eb..4a5dcae4b 100644 --- a/AppKit/CPWindow/_CPTitleableWindowView.j +++ b/AppKit/CPWindow/_CPTitleableWindowView.j @@ -95,7 +95,7 @@ // The vertical alignment of the title is set by the theme, so just give it all available space. By default // the title will vertically centre within. - [_titleField setFrame:_CGRectMake(20.0, 0, width - 40.0, [[self class] titleBarHeight])]; + [_titleField setFrame:CGRectMake(20.0, 0, width - 40.0, [[self class] titleBarHeight])]; } - (void)layoutSubviews diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 4f1af0714..91c8f5ff4 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -68,12 +68,12 @@ _CPWindowViewResizeSlop = 3; + (CGRect)contentRectForFrameRect:(CGRect)aFrameRect { - return _CGRectMakeCopy(aFrameRect); + return CGRectMakeCopy(aFrameRect); } + (CGRect)frameRectForContentRect:(CGRect)aContentRect { - return _CGRectMakeCopy(aContentRect); + return CGRectMakeCopy(aContentRect); } + (CPString)defaultThemeClass @@ -100,7 +100,7 @@ _CPWindowViewResizeSlop = 3; @"title-text-color": [CPColor blackColor], @"title-font": [CPFont systemFontOfSize:CPFontCurrentSystemSize], @"title-text-shadow-color": [CPNull null], - @"title-text-shadow-offset": _CGSizeMakeZero(), + @"title-text-shadow-offset": CGSizeMakeZero(), @"title-alignment": CPCenterTextAlignment, @"title-line-break-mode": CPLineBreakByTruncatingTail, @"title-vertical-alignment": CPTopVerticalTextAlignment, @@ -114,7 +114,7 @@ _CPWindowViewResizeSlop = 3; if ([theToolbar isVisible]) { - var toolbarHeight = _CGRectGetHeight([[theToolbar _toolbarView] frame]); + var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); contentRect.origin.y += toolbarHeight; contentRect.size.height -= toolbarHeight; @@ -130,7 +130,7 @@ _CPWindowViewResizeSlop = 3; if ([theToolbar isVisible]) { - var toolbarHeight = _CGRectGetHeight([[theToolbar _toolbarView] frame]); + var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); frameRect.origin.y -= toolbarHeight; frameRect.size.height += toolbarHeight; @@ -146,8 +146,8 @@ _CPWindowViewResizeSlop = 3; if (self) { _styleMask = aStyleMask; - _resizeIndicatorOffset = _CGSizeMakeZero(); - _toolbarOffset = _CGSizeMakeZero(); + _resizeIndicatorOffset = CGSizeMakeZero(); + _toolbarOffset = CGSizeMakeZero(); } return self; @@ -202,8 +202,8 @@ _CPWindowViewResizeSlop = 3; { // Extend the resize frame to the edge of the window frame var resizeFrame = [_resizeIndicator frame]; - resizeFrame.size.width = _CGRectGetWidth(windowFrame) - _CGRectGetMinX(resizeFrame); - resizeFrame.size.height = _CGRectGetHeight(windowFrame) - _CGRectGetMinY(resizeFrame); + resizeFrame.size.width = CGRectGetWidth(windowFrame) - CGRectGetMinX(resizeFrame); + resizeFrame.size.height = CGRectGetHeight(windowFrame) - CGRectGetMinY(resizeFrame); var localPoint = [self convertPoint:[anEvent locationInWindow] fromView:nil]; shouldResize = CGRectContainsPoint(resizeFrame, localPoint); @@ -260,83 +260,83 @@ _CPWindowViewResizeSlop = 3; if (isFixedWidth) { - rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + rect = CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, frame.origin.y - _CPWindowViewResizeSlop, frame.size.width + (_CPWindowViewResizeSlop * 2), _CPWindowViewResizeSlop * 2); - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop; - rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; + rect.origin.y = CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottom; } else if (isFixedHeight) { - rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + rect = CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, frame.origin.y - _CPWindowViewResizeSlop, _CPWindowViewResizeSlop * 2, frame.size.height + (_CPWindowViewResizeSlop * 2)); - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionLeft; - rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; + rect.origin.x = CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionRight; } else { - rect = _CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, + rect = CGRectMake(frame.origin.x - _CPWindowViewResizeSlop, frame.origin.y - _CPWindowViewResizeSlop, _CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop, _CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop); - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopLeft; - rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewCornerResizeRectWidth; + rect.origin.x = CGRectGetMaxX(frame) - _CPWindowViewCornerResizeRectWidth; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopRight; - rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewCornerResizeRectWidth; + rect.origin.y = CGRectGetMaxY(frame) - _CPWindowViewCornerResizeRectWidth; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottomRight; rect.origin.x = frame.origin.x - _CPWindowViewResizeSlop; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottomLeft; - rect = _CGRectMake(rect.origin.x, + rect = CGRectMake(rect.origin.x, frame.origin.y + _CPWindowViewCornerResizeRectWidth, _CPWindowViewResizeSlop * 2, - _CGRectGetHeight(frame) - (_CPWindowViewCornerResizeRectWidth * 2)); + CGRectGetHeight(frame) - (_CPWindowViewCornerResizeRectWidth * 2)); - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionLeft; - rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; + rect.origin.x = CGRectGetMaxX(frame) - _CPWindowViewResizeSlop; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionRight; - rect = _CGRectMake(frame.origin.x + _CPWindowViewCornerResizeRectWidth, + rect = CGRectMake(frame.origin.x + _CPWindowViewCornerResizeRectWidth, frame.origin.y - _CPWindowViewResizeSlop, - _CGRectGetWidth(frame) - (_CPWindowViewCornerResizeRectWidth * 2), + CGRectGetWidth(frame) - (_CPWindowViewCornerResizeRectWidth * 2), _CPWindowViewResizeSlop * 2); - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop; - rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; + rect.origin.y = CGRectGetMaxY(frame) - _CPWindowViewResizeSlop; - if (_CGRectContainsPoint(rect, aPoint)) + if (CGRectContainsPoint(rect, aPoint)) return _CPWindowViewResizeRegionBottom; } @@ -371,9 +371,9 @@ _CPWindowViewResizeSlop = 3; switch (resizeRegion) { case _CPWindowViewResizeRegionTopLeft: - if (minSize && _CGSizeEqualToSize(frameSize, minSize)) + if (minSize && CGSizeEqualToSize(frameSize, minSize)) [[CPCursor resizeNorthwestCursor] set]; - else if (maxSize && _CGSizeEqualToSize(frameSize, maxSize)) + else if (maxSize && CGSizeEqualToSize(frameSize, maxSize)) [[CPCursor resizeSoutheastCursor] set]; else [[CPCursor resizeNorthwestSoutheastCursor] set]; @@ -384,16 +384,16 @@ _CPWindowViewResizeSlop = 3; [[CPCursor resizeUpCursor] set]; else if (maxSize && (frameSize.height === maxSize.height)) [[CPCursor resizeDownCursor] set]; - else if ([CPMenu menuBarVisible] && (_CGRectGetMinY([theWindow frame]) <= [CPMenu menuBarHeight])) + else if ([CPMenu menuBarVisible] && (CGRectGetMinY([theWindow frame]) <= [CPMenu menuBarHeight])) [[CPCursor resizeDownCursor] set]; else [[CPCursor resizeNorthSouthCursor] set]; break; case _CPWindowViewResizeRegionTopRight: - if (minSize && _CGSizeEqualToSize(frameSize, minSize)) + if (minSize && CGSizeEqualToSize(frameSize, minSize)) [[CPCursor resizeNortheastCursor] set]; - else if (maxSize && _CGSizeEqualToSize(frameSize, maxSize)) + else if (maxSize && CGSizeEqualToSize(frameSize, maxSize)) [[CPCursor resizeSouthwestCursor] set]; else [[CPCursor resizeNortheastSouthwestCursor] set]; @@ -409,9 +409,9 @@ _CPWindowViewResizeSlop = 3; break; case _CPWindowViewResizeRegionBottomRight: - if (minSize && _CGSizeEqualToSize(frameSize, minSize)) + if (minSize && CGSizeEqualToSize(frameSize, minSize)) [[CPCursor resizeSoutheastCursor] set]; - else if (maxSize && _CGSizeEqualToSize(frameSize, maxSize)) + else if (maxSize && CGSizeEqualToSize(frameSize, maxSize)) [[CPCursor resizeNorthwestCursor] set]; else [[CPCursor resizeNorthwestSoutheastCursor] set]; @@ -427,9 +427,9 @@ _CPWindowViewResizeSlop = 3; break; case _CPWindowViewResizeRegionBottomLeft: - if (minSize && _CGSizeEqualToSize(frameSize, minSize)) + if (minSize && CGSizeEqualToSize(frameSize, minSize)) [[CPCursor resizeSouthwestCursor] set]; - else if (maxSize && _CGSizeEqualToSize(frameSize, maxSize)) + else if (maxSize && CGSizeEqualToSize(frameSize, maxSize)) [[CPCursor resizeNortheastCursor] set]; else [[CPCursor resizeNortheastSouthwestCursor] set]; @@ -466,18 +466,18 @@ _CPWindowViewResizeSlop = 3; if (type === CPLeftMouseDown) { - _mouseDraggedPoint = _CGPointMake(globalLocation.x, globalLocation.y); - _cachedFrame = _CGRectMakeCopy(frame); + _mouseDraggedPoint = CGPointMake(globalLocation.x, globalLocation.y); + _cachedFrame = CGRectMakeCopy(frame); _cachedScreenFrame = [[CPPlatformWindow primaryPlatformWindow] visibleFrame]; } else if (type === CPLeftMouseDragged) { var deltaX = globalLocation.x - _mouseDraggedPoint.x, deltaY = globalLocation.y - _mouseDraggedPoint.y, - startX = _CGRectGetMinX(_cachedFrame), - startY = _CGRectGetMinY(_cachedFrame), - startWidth = _CGRectGetWidth(_cachedFrame), - startHeight = _CGRectGetHeight(_cachedFrame), + startX = CGRectGetMinX(_cachedFrame), + startY = CGRectGetMinY(_cachedFrame), + startWidth = CGRectGetWidth(_cachedFrame), + startHeight = CGRectGetHeight(_cachedFrame), newX, newY, newWidth, @@ -486,7 +486,7 @@ _CPWindowViewResizeSlop = 3; minSize = [theWindow minSize], maxSize = [theWindow maxSize]; - minSize = _CGSizeMake(MAX(minSize.width, resizeMinSize.width), MAX(minSize.height, resizeMinSize.height)); + minSize = CGSizeMake(MAX(minSize.width, resizeMinSize.width), MAX(minSize.height, resizeMinSize.height)); // If it's a sheet, horizontal resizing is symmetrical, so the movement is effectively doubled if (theWindow._isSheet) @@ -514,7 +514,7 @@ _CPWindowViewResizeSlop = 3; newX = startX + deltaX; // Pin the left edge to the usable screen left edge - var pinnedX = MAX(newX, _CGRectGetMinX(_cachedScreenFrame)); + var pinnedX = MAX(newX, CGRectGetMinX(_cachedScreenFrame)); if (pinnedX !== newX) { @@ -547,7 +547,7 @@ _CPWindowViewResizeSlop = 3; // Pin the right edge to the usable screen right edge var newMaxX = startX + startWidth + deltaX, - pinnedX = MIN(newMaxX, _CGRectGetMaxX(_cachedScreenFrame)); + pinnedX = MIN(newMaxX, CGRectGetMaxX(_cachedScreenFrame)); if (pinnedX !== newMaxX) deltaX += pinnedX - newMaxX; @@ -588,7 +588,7 @@ _CPWindowViewResizeSlop = 3; newY = startY + deltaY; // Pin the top edge to the usable screen top edge - var pinnedY = MAX(newY, _CGRectGetMinY(_cachedScreenFrame)); + var pinnedY = MAX(newY, CGRectGetMinY(_cachedScreenFrame)); if (pinnedY !== newY) { @@ -617,7 +617,7 @@ _CPWindowViewResizeSlop = 3; // Pin the bottom edge to the usable screen bottom edge var newMaxY = startY + startHeight + deltaY, - pinnedY = MIN(newMaxY, _CGRectGetMaxY(_cachedScreenFrame)); + pinnedY = MIN(newMaxY, CGRectGetMaxY(_cachedScreenFrame)); if (pinnedY !== newMaxY) deltaY += pinnedY - newMaxY; @@ -631,7 +631,7 @@ _CPWindowViewResizeSlop = 3; newHeight = startHeight; } - [theWindow _setFrame:_CGRectMake(newX, newY, newWidth, newHeight) display:YES animate:NO constrainWidth:NO constrainHeight:NO]; + [theWindow _setFrame:CGRectMake(newX, newY, newWidth, newHeight) display:YES animate:NO constrainWidth:NO constrainHeight:NO]; [self setCursorForLocation:location resizing:YES]; } @@ -654,7 +654,7 @@ _CPWindowViewResizeSlop = 3; else if (type === CPLeftMouseDown) { _mouseDraggedPoint = [theWindow convertBaseToGlobal:[anEvent locationInWindow]]; - _cachedFrame = _CGRectMakeCopy([theWindow frame]); + _cachedFrame = CGRectMakeCopy([theWindow frame]); } else if (type === CPLeftMouseDragged) { @@ -662,7 +662,7 @@ _CPWindowViewResizeSlop = 3; location = [theWindow convertBaseToGlobal:[anEvent locationInWindow]], deltaX = location.x - _mouseDraggedPoint.x, deltaY = location.y - _mouseDraggedPoint.y, - origin = _CGPointMake(_cachedFrame.origin.x + deltaX, _cachedFrame.origin.y + deltaY); + origin = CGPointMake(_cachedFrame.origin.x + deltaX, _cachedFrame.origin.y + deltaY); [theWindow setFrameOrigin:origin]; } @@ -709,7 +709,7 @@ _CPWindowViewResizeSlop = 3; - (void)setResizeIndicatorOffset:(CGSize)anOffset { - if (_CGSizeEqualToSize(_resizeIndicatorOffset, anOffset)) + if (CGSizeEqualToSize(_resizeIndicatorOffset, anOffset)) return; _resizeIndicatorOffset = anOffset; @@ -720,7 +720,7 @@ _CPWindowViewResizeSlop = 3; var size = [_resizeIndicator frame].size, boundsSize = [self frame].size; - [_resizeIndicator setFrameOrigin:_CGPointMake(boundsSize.width - size.width - anOffset.width, boundsSize.height - size.height - anOffset.height)]; + [_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - anOffset.width, boundsSize.height - size.height - anOffset.height)]; } - (CGSize)resizeIndicatorOffset @@ -756,7 +756,7 @@ _CPWindowViewResizeSlop = 3; if (!_toolbarView || [_toolbarView isHidden]) return [self toolbarOffset].height; - return _CGRectGetMaxY([_toolbarView frame]); + return CGRectGetMaxY([_toolbarView frame]); } - (_CPToolbarView)toolbarView @@ -768,14 +768,14 @@ _CPWindowViewResizeSlop = 3; { var theWindow = [self window], bounds = [self bounds], - width = _CGRectGetWidth(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]))]; + [toolbarView setFrame:CGRectMake(toolbarOffset.width, toolbarOffset.height, width, CGRectGetHeight([toolbarView frame]))]; } if ([self showsResizeIndicator]) @@ -783,7 +783,7 @@ _CPWindowViewResizeSlop = 3; var size = [_resizeIndicator frame].size, boundsSize = [self bounds].size; - [_resizeIndicator setFrameOrigin:_CGPointMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height)]; + [_resizeIndicator setFrameOrigin:CGPointMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height)]; } } @@ -869,7 +869,7 @@ _CPWindowViewResizeSlop = 3; shadowWidth = [self _shadowViewWidthForParentWindow:parentWindow], shadowHeight = [self currentValueForThemeAttribute:@"shadow-height"]; - _sheetShadowView = [[CPView alloc] initWithFrame:_CGRectMake(FLOOR((myWidth - shadowWidth) / 2), 0, shadowWidth, shadowHeight)]; + _sheetShadowView = [[CPView alloc] initWithFrame:CGRectMake(FLOOR((myWidth - shadowWidth) / 2), 0, shadowWidth, shadowHeight)]; [_sheetShadowView setAutoresizingMask:CPViewWidthSizable]; [self addSubview:_sheetShadowView]; } @@ -922,7 +922,7 @@ _CPWindowViewResizeSlop = 3; - (CGSize)_minimumResizeSize { - return _CGSizeMake(0, _CPWindowViewMinContentHeight); + return CGSizeMake(0, _CPWindowViewMinContentHeight); } - (int)bodyOffset diff --git a/AppKit/CoreAnimation/CALayer.j b/AppKit/CoreAnimation/CALayer.j index 1baf8e3cd..188334a42 100644 --- a/AppKit/CoreAnimation/CALayer.j +++ b/AppKit/CoreAnimation/CALayer.j @@ -184,7 +184,7 @@ var CALayerRegisteredRunLoopUpdates = nil; var oldOrigin = _bounds.origin; - _bounds = _CGRectMakeCopy(aBounds); + _bounds = CGRectMakeCopy(aBounds); if (_hasSublayerTransform) _CALayerUpdateSublayerTransformForSublayers(self); @@ -219,7 +219,7 @@ var CALayerRegisteredRunLoopUpdates = nil; if (CGPointEqualToPoint(_position, aPosition)) return; - _position = _CGPointMakeCopy(aPosition); + _position = CGPointMakeCopy(aPosition); _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask); } @@ -252,7 +252,7 @@ var CALayerRegisteredRunLoopUpdates = nil; */ - (void)setAnchorPoint:(CGPoint)anAnchorPoint { - anAnchorPoint = _CGPointMakeCopy(anAnchorPoint); + anAnchorPoint = CGPointMakeCopy(anAnchorPoint); anAnchorPoint.x = MIN(1.0, MAX(0.0, anAnchorPoint.x)); anAnchorPoint.y = MIN(1.0, MAX(0.0, anAnchorPoint.y)); @@ -265,7 +265,7 @@ var CALayerRegisteredRunLoopUpdates = nil; _CALayerUpdateSublayerTransformForSublayers(self); if (_owningView) - _position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y); + _position = CGPointMake(CGRectGetWidth(_bounds) * _anchorPoint.x, CGRectGetHeight(_bounds) * _anchorPoint.y); _CALayerRecalculateGeometry(self, CALayerGeometryAnchorPointMask); } @@ -287,7 +287,7 @@ var CALayerRegisteredRunLoopUpdates = nil; if (CGAffineTransformEqualToTransform(_affineTransform, anAffineTransform)) return; - _affineTransform = _CGAffineTransformMakeCopy(anAffineTransform); + _affineTransform = CGAffineTransformMakeCopy(anAffineTransform); _CALayerRecalculateGeometry(self, CALayerGeometryAffineTransformMask); } @@ -311,8 +311,8 @@ var CALayerRegisteredRunLoopUpdates = nil; var hadSublayerTransform = _hasSublayerTransform; - _sublayerTransform = _CGAffineTransformMakeCopy(anAffineTransform); - _hasSublayerTransform = !_CGAffineTransformIsIdentity(_sublayerTransform); + _sublayerTransform = CGAffineTransformMakeCopy(anAffineTransform); + _hasSublayerTransform = !CGAffineTransformIsIdentity(_sublayerTransform); if (_hasSublayerTransform) { @@ -400,8 +400,8 @@ var CALayerRegisteredRunLoopUpdates = nil; var bounds = [_superlayer bounds], frame = [_superlayer convertRect:bounds toLayer:nil]; - aFrame.origin.x -= _CGRectGetMinX(frame); - aFrame.origin.y -= _CGRectGetMinY(frame); + aFrame.origin.x -= CGRectGetMinX(frame); + aFrame.origin.y -= CGRectGetMinY(frame); } else aFrame = CGRectMakeCopy(aFrame); @@ -449,7 +449,7 @@ var CALayerRegisteredRunLoopUpdates = nil; if (USE_BUFFER && !_contents || !_context) return; - CGContextClearRect(_context, _CGRectMake(0.0, 0.0, _CGRectGetWidth(_backingStoreFrame), _CGRectGetHeight(_backingStoreFrame))); + CGContextClearRect(_context, CGRectMake(0.0, 0.0, CGRectGetWidth(_backingStoreFrame), CGRectGetHeight(_backingStoreFrame))); // Recomposite var transform; @@ -469,8 +469,8 @@ var CALayerRegisteredRunLoopUpdates = nil; // Copy so we don't affect the original. transform = CGAffineTransformCreateCopy(_transformFromLayer); - transform.tx -= _CGRectGetMinX(_backingStoreFrame); - transform.ty -= _CGRectGetMinY(_backingStoreFrame); + transform.tx -= CGRectGetMinX(_backingStoreFrame); + transform.ty -= CGRectGetMinY(_backingStoreFrame); CGContextSaveGState(_context); @@ -479,7 +479,7 @@ var CALayerRegisteredRunLoopUpdates = nil; if (USE_BUFFER) { // CGContextDrawImage(_context, _bounds, _contents.context); - _context.drawImage(_contents.buffer, _CGRectGetMinX(_bounds), _CGRectGetMinY(_bounds));//, _CGRectGetWidth(_standardBackingStoreFrame), _CGRectGetHeight(_standardBackingStoreFrame)); + _context.drawImage(_contents.buffer, CGRectGetMinX(_bounds), CGRectGetMinY(_bounds));//, CGRectGetWidth(_standardBackingStoreFrame), CGRectGetHeight(_standardBackingStoreFrame)); } else [self drawInContext:_context]; @@ -504,13 +504,13 @@ var CALayerRegisteredRunLoopUpdates = nil; _DOMContentsElement.style.position = "absolute"; _DOMContentsElement.style.visibility = "visible"; - _DOMContentsElement.width = ROUND(_CGRectGetWidth(_backingStoreFrame)); - _DOMContentsElement.height = ROUND(_CGRectGetHeight(_backingStoreFrame)); + _DOMContentsElement.width = ROUND(CGRectGetWidth(_backingStoreFrame)); + _DOMContentsElement.height = ROUND(CGRectGetHeight(_backingStoreFrame)); _DOMContentsElement.style.top = "0px"; _DOMContentsElement.style.left = "0px"; - _DOMContentsElement.style.width = ROUND(_CGRectGetWidth(_backingStoreFrame)) + "px"; - _DOMContentsElement.style.height = ROUND(_CGRectGetHeight(_backingStoreFrame)) + "px"; + _DOMContentsElement.style.width = ROUND(CGRectGetWidth(_backingStoreFrame)) + "px"; + _DOMContentsElement.style.height = ROUND(CGRectGetHeight(_backingStoreFrame)) + "px"; _DOMElement.appendChild(_DOMContentsElement); } @@ -520,7 +520,7 @@ var CALayerRegisteredRunLoopUpdates = nil; if (_delegateRespondsToDisplayLayerSelector) return [_delegate displayInLayer:self]; - if (_CGRectGetWidth(_backingStoreFrame) == 0.0 || _CGRectGetHeight(_backingStoreFrame) == 0.0) + if (CGRectGetWidth(_backingStoreFrame) == 0.0 || CGRectGetHeight(_backingStoreFrame) == 0.0) return; if (!_contents) @@ -913,7 +913,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) */ - (BOOL)containsPoint:(CGPoint)aPoint { - return _CGRectContainsPoint(_bounds, aPoint); + return CGRectContainsPoint(_bounds, aPoint); } /*! @@ -928,7 +928,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) var point = CGPointApplyAffineTransform(aPoint, _transformToLayer); - if (!_CGRectContainsPoint(_bounds, point)) + if (!CGRectContainsPoint(_bounds, point)) return nil; var layer = nil, @@ -979,7 +979,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) _owningView = anOwningView; _bounds.size = CGSizeMakeCopy([_owningView bounds].size); - _position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y); + _position = CGPointMake(CGRectGetWidth(_bounds) * _anchorPoint.x, CGRectGetHeight(_bounds) * _anchorPoint.y); } _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask); @@ -989,7 +989,7 @@ if (_DOMContentsElement && aLayer._zPosition > _DOMContentsElement.style.zIndex) - (void)_owningViewBoundsChanged { _bounds.size = CGSizeMakeCopy([_owningView bounds].size); - _position = CGPointMake(_CGRectGetWidth(_bounds) * _anchorPoint.x, _CGRectGetHeight(_bounds) * _anchorPoint.y); + _position = CGPointMake(CGRectGetWidth(_bounds) * _anchorPoint.x, CGRectGetHeight(_bounds) * _anchorPoint.y); _CALayerRecalculateGeometry(self, CALayerGeometryPositionMask | CALayerGeometryBoundsMask); } @@ -1021,8 +1021,8 @@ function _CALayerUpdateSublayerTransformForSublayers(aLayer) { var bounds = aLayer._bounds, anchorPoint = aLayer._anchorPoint, - translateX = _CGRectGetWidth(bounds) * anchorPoint.x, - translateY = _CGRectGetHeight(bounds) * anchorPoint.y; + translateX = CGRectGetWidth(bounds) * anchorPoint.x, + translateY = CGRectGetHeight(bounds) * anchorPoint.y; aLayer._sublayerTransformForSublayers = CGAffineTransformConcat( CGAffineTransformMakeTranslation(-translateX, -translateY), @@ -1041,14 +1041,14 @@ function _CALayerUpdateDOM(aLayer, aMask) if (aMask & CALayerFrameOriginUpdateMask) { - DOMElementStyle.top = ROUND(_CGRectGetMinY(frame)) + "px"; - DOMElementStyle.left = ROUND(_CGRectGetMinX(frame)) + "px"; + DOMElementStyle.top = ROUND(CGRectGetMinY(frame)) + "px"; + DOMElementStyle.left = ROUND(CGRectGetMinX(frame)) + "px"; } if (aMask & CALayerFrameSizeUpdateMask) { - var width = MAX(0.0, ROUND(_CGRectGetWidth(frame))), - height = MAX(0.0, ROUND(_CGRectGetHeight(frame))), + var width = MAX(0.0, ROUND(CGRectGetWidth(frame))), + height = MAX(0.0, ROUND(CGRectGetHeight(frame))), DOMContentsElement = aLayer._DOMContentsElement; DOMElementStyle.width = width + "px"; @@ -1068,24 +1068,24 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange) { var bounds = aLayer._bounds, superlayer = aLayer._superlayer, - width = _CGRectGetWidth(bounds), - height = _CGRectGetHeight(bounds), + width = CGRectGetWidth(bounds), + height = CGRectGetHeight(bounds), position = aLayer._position, anchorPoint = aLayer._anchorPoint, affineTransform = aLayer._affineTransform, - backingStoreFrameSize = _CGSizeMakeCopy(aLayer._backingStoreFrame), + backingStoreFrameSize = CGSizeMakeCopy(aLayer._backingStoreFrame), hasCustomBackingStoreFrame = aLayer._hasCustomBackingStoreFrame; // Go to anchor, transform, go back to bounds. aLayer._transformFromLayer = CGAffineTransformConcat( - CGAffineTransformMakeTranslation(-width * anchorPoint.x - _CGRectGetMinX(aLayer._bounds), -height * anchorPoint.y - _CGRectGetMinY(aLayer._bounds)), + CGAffineTransformMakeTranslation(-width * anchorPoint.x - CGRectGetMinX(aLayer._bounds), -height * anchorPoint.y - CGRectGetMinY(aLayer._bounds)), CGAffineTransformConcat(affineTransform, CGAffineTransformMakeTranslation(position.x, position.y))); if (superlayer && superlayer._hasSublayerTransform) { // aLayer._transformFromLayer = CGAffineTransformConcat(aLayer._transformFromLayer, superlayer._sublayerTransformForSublayers); - _CGAffineTransformConcatTo(aLayer._transformFromLayer, superlayer._sublayerTransformForSublayers, aLayer._transformFromLayer); + CGAffineTransformConcatTo(aLayer._transformFromLayer, superlayer._sublayerTransformForSublayers, aLayer._transformFromLayer); } aLayer._transformToLayer = CGAffineTransformInvert(aLayer._transformFromLayer); @@ -1101,8 +1101,8 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange) var bounds = [superlayer bounds], frame = [superlayer convertRect:bounds toLayer:nil]; - aLayer._standardBackingStoreFrame.origin.x -= _CGRectGetMinX(frame); - aLayer._standardBackingStoreFrame.origin.y -= _CGRectGetMinY(frame); + aLayer._standardBackingStoreFrame.origin.x -= CGRectGetMinX(frame); + aLayer._standardBackingStoreFrame.origin.y -= CGRectGetMinY(frame); } // We used to use CGRectIntegral here, but what we actually want, is the largest integral @@ -1128,13 +1128,13 @@ function _CALayerRecalculateGeometry(aLayer, aGeometryChange) // These values get rounded in the DOM, so don't both updating them if they're // not going to be different after rounding. - if (ROUND(_CGRectGetMinX(backingStoreFrame)) != ROUND(_CGRectGetMinX(aLayer._backingStoreFrame)) || - ROUND(_CGRectGetMinY(backingStoreFrame)) != ROUND(_CGRectGetMinY(aLayer._backingStoreFrame))) + if (ROUND(CGRectGetMinX(backingStoreFrame)) != ROUND(CGRectGetMinX(aLayer._backingStoreFrame)) || + ROUND(CGRectGetMinY(backingStoreFrame)) != ROUND(CGRectGetMinY(aLayer._backingStoreFrame))) [aLayer registerRunLoopUpdateWithMask:CALayerFrameOriginUpdateMask]; // Any change in size due to a geometry change is purely due to rounding error. - if ((_CGRectGetWidth(backingStoreFrame) != ROUND(_CGRectGetWidth(aLayer._backingStoreFrame)) || - _CGRectGetHeight(backingStoreFrame) != ROUND(_CGRectGetHeight(aLayer._backingStoreFrame)))) + if ((CGRectGetWidth(backingStoreFrame) != ROUND(CGRectGetWidth(aLayer._backingStoreFrame)) || + CGRectGetHeight(backingStoreFrame) != ROUND(CGRectGetHeight(aLayer._backingStoreFrame)))) [aLayer registerRunLoopUpdateWithMask:CALayerFrameSizeUpdateMask]; aLayer._backingStoreFrame = backingStoreFrame; @@ -1172,7 +1172,7 @@ function _CALayerGetTransform(fromLayer, toLayer) var transformFromLayer = layer._transformFromLayer; //transform = CGAffineTransformConcat(transform, layer._transformFromLayer); - _CGAffineTransformConcatTo(transform, transformFromLayer, transform); + CGAffineTransformConcatTo(transform, transformFromLayer, transform); layer = layer._superlayer; } @@ -1197,7 +1197,7 @@ function _CALayerGetTransform(fromLayer, toLayer) { var transformToLayer = layers[index]._transformToLayer; - _CGAffineTransformConcatTo(transform, transformToLayer, transform); + CGAffineTransformConcatTo(transform, transformToLayer, transform); } return transform; diff --git a/AppKit/CoreGraphics/CGAffineTransform.h b/AppKit/CoreGraphics/CGAffineTransform.h deleted file mode 100644 index 4eea12e67..000000000 --- a/AppKit/CoreGraphics/CGAffineTransform.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CGAffineTransform.h - * AppKit - * - * Created by Francisco Tolmasky. - * Copyright 2008, 280 North, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "../../Foundation/_CGGeometry.h" - -#define _CGAffineTransformMake(a_, b_, c_, d_, tx_, ty_) { a:a_, b:b_, c:c_, d:d_, tx:tx_, ty:ty_ } -#define _CGAffineTransformMakeIdentity() _CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, 0.0, 0.0) -#define _CGAffineTransformMakeCopy(aTransform) _CGAffineTransformMake(aTransform.a, aTransform.b, aTransform.c, aTransform.d, aTransform.tx, aTransform.ty) - -#define _CGAffineTransformMakeScale(sx, sy) _CGAffineTransformMake(sx, 0.0, 0.0, sy, 0.0, 0.0) -#define _CGAffineTransformMakeTranslation(tx, ty) _CGAffineTransformMake(1.0, 0.0, 0.0, 1.0, tx, ty) - -#define _CGAffineTransformTranslate(aTransform, tx, ty) _CGAffineTransformMake(aTransform.a, aTransform.b, aTransform.c, aTransform.d, aTransform.tx + aTransform.a * tx + aTransform.c * ty, aTransform.ty + aTransform.b * tx + aTransform.d * ty) -#define _CGAffineTransformScale(aTransform, sx, sy) _CGAffineTransformMake(aTransform.a * sx, aTransform.b * sx, aTransform.c * sy, aTransform.d * sy, aTransform.tx, aTransform.ty) - -#define _CGAffineTransformConcat(lhs, rhs) _CGAffineTransformMake(lhs.a * rhs.a + lhs.b * rhs.c, lhs.a * rhs.b + lhs.b * rhs.d, lhs.c * rhs.a + lhs.d * rhs.c, lhs.c * rhs.b + lhs.d * rhs.d, lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx, lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty) - -#define _CGPointApplyAffineTransform(aPoint, aTransform) _CGPointMake(aPoint.x * aTransform.a + aPoint.y * aTransform.c + aTransform.tx, aPoint.x * aTransform.b + aPoint.y * aTransform.d + aTransform.ty) -#define _CGSizeApplyAffineTransform(aSize, aTransform) _CGSizeMake(aSize.width * aTransform.a + aSize.height * aTransform.c, aSize.width * aTransform.b + aSize.height * aTransform.d) -#define _CGRectApplyAffineTransform(aRect, aTransform) { origin:_CGPointApplyAffineTransform(aRect.origin, aTransform), size:_CGSizeApplyAffineTransform(aRect.size, aTransform) } - -#define _CGAffineTransformIsIdentity(aTransform) (aTransform.a == 1 && aTransform.b == 0 && aTransform.c == 0 && aTransform.d == 1 && aTransform.tx == 0 && aTransform.ty == 0) -#define _CGAffineTransformEqualToTransform(lhs, rhs) (lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c && lhs.d == rhs.d && lhs.tx == rhs.tx && lhs.ty == rhs.ty) - -#define _CGStringCreateWithCGAffineTransform(aTransform) (" [[ " + aTransform.a + ", " + aTransform.b + ", 0 ], [ " + aTransform.c + ", " + aTransform.d + ", 0 ], [ " + aTransform.tx + ", " + aTransform.ty + ", 1]]") - -#define _CGAffineTransformConcatTo(lhs, rhs, to) \ -var tx = lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx;\ -to.ty = lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty;\ -to.tx = tx;\ -var a = lhs.a * rhs.a + lhs.b * rhs.c,\ - b = lhs.a * rhs.b + lhs.b * rhs.d,\ - c = lhs.c * rhs.a + lhs.d * rhs.c;\ -to.d = lhs.c * rhs.b + lhs.d * rhs.d;\ -to.a = a;\ -to.b = b;\ -to.c = c;\ - -/* -a b 0 cos sin 0 -c d 0 -sin cos 0 -tx ty 1 0 0 1 -*/ diff --git a/AppKit/CoreGraphics/CGAffineTransform.j b/AppKit/CoreGraphics/CGAffineTransform.j index e55fbb24f..b73f26f07 100644 --- a/AppKit/CoreGraphics/CGAffineTransform.j +++ b/AppKit/CoreGraphics/CGAffineTransform.j @@ -23,35 +23,110 @@ @import "CGGeometry.j" -#define _function(inline) function inline { return _##inline; } +function CGAffineTransformMake(a, b, c, d, tx, ty) +{ + return { a:a, b:b, c:c, d:d, tx:tx, ty:ty }; +} -_function(CGAffineTransformMake(a, b, c, d, tx, ty)) -_function(CGAffineTransformMakeIdentity()) -_function(CGAffineTransformMakeCopy(anAffineTransform)) +function CGAffineTransformMakeIdentity() +{ + return { a:1.0, b:0.0, c:0.0, d:1.0, tx:0.0, ty:0.0 }; +} -_function(CGAffineTransformMakeScale(sx, sy)) -_function(CGAffineTransformMakeTranslation(tx, ty)) -_function(CGAffineTransformTranslate(aTransform, tx, ty)) -_function(CGAffineTransformScale(aTransform, sx, sy)) +function CGAffineTransformMakeCopy(anAffineTransform) +{ + return { a:anAffineTransform.a, b:anAffineTransform.b, c:anAffineTransform.c, d:anAffineTransform.d, tx:anAffineTransform.tx, ty:anAffineTransform.ty }; +} -_function(CGAffineTransformConcat(lhs, rhs)) -_function(CGPointApplyAffineTransform(aPoint, aTransform)) -_function(CGSizeApplyAffineTransform(aSize, aTransform)) +function CGAffineTransformMakeScale(sx, sy) +{ + return { a:sx, b:0.0, c:0.0, d:sy, tx:0.0, ty:0.0 }; +} -_function(CGAffineTransformIsIdentity(aTransform)) -_function(CGAffineTransformEqualToTransform(lhs, rhs)) +function CGAffineTransformMakeTranslation(tx, ty) +{ + return { a:1.0, b:0.0, c:0.0, d:1.0, tx:tx, ty:ty }; +} + +function CGAffineTransformTranslate(aTransform, tx, ty) +{ + return CGAffineTransformMake(aTransform.a, aTransform.b, aTransform.c, aTransform.d, aTransform.tx + aTransform.a * tx + aTransform.c * ty, aTransform.ty + aTransform.b * tx + aTransform.d * ty); +} + +function CGAffineTransformScale(aTransform, sx, sy) +{ + return CGAffineTransformMake(aTransform.a * sx, aTransform.b * sx, aTransform.c * sy, aTransform.d * sy, aTransform.tx, aTransform.ty); +} + + +function CGAffineTransformConcat(lhs, rhs) +{ + return CGAffineTransformMake(lhs.a * rhs.a + lhs.b * rhs.c, lhs.a * rhs.b + lhs.b * rhs.d, lhs.c * rhs.a + lhs.d * rhs.c, lhs.c * rhs.b + lhs.d * rhs.d, lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx, lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty); +} + +function CGAffineTransformConcatTo(lhs, rhs, to) +{ + var tx = lhs.tx * rhs.a + lhs.ty * rhs.c + rhs.tx; + + to.ty = lhs.tx * rhs.b + lhs.ty * rhs.d + rhs.ty; + to.tx = tx; + + var a = lhs.a * rhs.a + lhs.b * rhs.c, + b = lhs.a * rhs.b + lhs.b * rhs.d, + c = lhs.c * rhs.a + lhs.d * rhs.c; + + to.d = lhs.c * rhs.b + lhs.d * rhs.d; + to.a = a; + to.b = b; + to.c = c; +} + +function CGPointApplyAffineTransform(aPoint, aTransform) +{ + return { x:aPoint.x * aTransform.a + aPoint.y * aTransform.c + aTransform.tx, + y:aPoint.x * aTransform.b + aPoint.y * aTransform.d + aTransform.ty }; +} + +function CGSizeApplyAffineTransform(aSize, aTransform) +{ + return { width:aSize.width * aTransform.a + aSize.height * aTransform.c, + height:aSize.width * aTransform.b + aSize.height * aTransform.d }; +} + + +function CGAffineTransformIsIdentity(aTransform) +{ + return (aTransform.a === 1.0 && + aTransform.b === 0.0 && + aTransform.c === 0.0 && + aTransform.d === 1.0 && + aTransform.tx === 0.0 && + aTransform.ty === 0.0); +} + +function CGAffineTransformEqualToTransform(lhs, rhs) +{ + return (lhs.a === rhs.a && + lhs.b === rhs.b && + lhs.c === rhs.c && + lhs.d === rhs.d && + lhs.tx === rhs.tx && + lhs.ty === rhs.ty); +} + + +function CGStringCreateWithCGAffineTransform(aTransform) +{ + return (" [[ " + aTransform.a + ", " + aTransform.b + ", 0 ], [ " + aTransform.c + ", " + aTransform.d + ", 0 ], [ " + aTransform.tx + ", " + aTransform.ty + ", 1]]"); +} -_function(CGStringCreateWithCGAffineTransform(aTransform)) /* FIXME: !!!! @return void @group CGAffineTransform */ -function CGAffineTransformCreateCopy(aTransform) -{ - return _CGAffineTransformMakeCopy(aTransform); -} +CGAffineTransformCreateCopy = CGAffineTransformMakeCopy; /*! Returns a transform that rotates a coordinate system. @@ -66,7 +141,7 @@ function CGAffineTransformMakeRotation(anAngle) var sin = SIN(anAngle), cos = COS(anAngle); - return _CGAffineTransformMake(cos, sin, -sin, cos, 0.0, 0.0); + return CGAffineTransformMake(cos, sin, -sin, cos, 0.0, 0.0); } /*! @@ -121,20 +196,20 @@ function CGAffineTransformInvert(aTransform) */ function CGRectApplyAffineTransform(aRect, anAffineTransform) { - var top = _CGRectGetMinY(aRect), - left = _CGRectGetMinX(aRect), - right = _CGRectGetMaxX(aRect), - bottom = _CGRectGetMaxY(aRect), - topLeft = CGPointApplyAffineTransform(_CGPointMake(left, top), anAffineTransform), - topRight = CGPointApplyAffineTransform(_CGPointMake(right, top), anAffineTransform), - bottomLeft = CGPointApplyAffineTransform(_CGPointMake(left, bottom), anAffineTransform), - bottomRight = CGPointApplyAffineTransform(_CGPointMake(right, bottom), anAffineTransform), + var top = CGRectGetMinY(aRect), + left = CGRectGetMinX(aRect), + right = CGRectGetMaxX(aRect), + bottom = CGRectGetMaxY(aRect), + topLeft = CGPointApplyAffineTransform(CGPointMake(left, top), anAffineTransform), + topRight = CGPointApplyAffineTransform(CGPointMake(right, top), anAffineTransform), + bottomLeft = CGPointApplyAffineTransform(CGPointMake(left, bottom), anAffineTransform), + bottomRight = CGPointApplyAffineTransform(CGPointMake(right, bottom), anAffineTransform), minX = MIN(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x), maxX = MAX(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x), minY = MIN(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y), maxY = MAX(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y); - return _CGRectMake(minX, minY, (maxX - minX), (maxY - minY)); + return CGRectMake(minX, minY, (maxX - minX), (maxY - minY)); } /*! diff --git a/AppKit/CoreGraphics/CGContext.j b/AppKit/CoreGraphics/CGContext.j index b60d38c22..de62c0c89 100644 --- a/AppKit/CoreGraphics/CGContext.j +++ b/AppKit/CoreGraphics/CGContext.j @@ -116,7 +116,7 @@ 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, - shadowOffset:_CGSizeMakeZero(), shadowBlur:0.0, shadowColor:NULL, CTM:_CGAffineTransformMakeIdentity() }; + shadowOffset:CGSizeMakeZero(), shadowBlur:0.0, shadowColor:NULL, CTM:CGAffineTransformMakeIdentity() }; } /*! @@ -129,7 +129,7 @@ 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, - shadowOffset:_CGSizeMakeCopy(aGState.shadowOffset), shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:_CGAffineTransformMakeCopy(aGState.CTM) }; + shadowOffset:CGSizeMakeCopy(aGState.shadowOffset), shadowBlur:aGState.shadowBlur, shadowColor:aGState.shadowColor, CTM:CGAffineTransformMakeCopy(aGState.CTM) }; } /*! @@ -418,7 +418,7 @@ function CGContextConcatCTM(aContext, aTransform) { var CTM = aContext.gState.CTM; - _CGAffineTransformConcatTo(CTM, aTransform, CTM); + CGAffineTransformConcatTo(CTM, aTransform, CTM); } /*! @@ -456,7 +456,7 @@ function CGContextScaleCTM(aContext, sx, sy) { var gState = aContext.gState; - gState.CTM = _CGAffineTransformScale(gState.CTM, sx, sy); + gState.CTM = CGAffineTransformScale(gState.CTM, sx, sy); } /*! @@ -470,7 +470,7 @@ function CGContextTranslateCTM(aContext, tx, ty) { var gState = aContext.gState; - gState.CTM = _CGAffineTransformTranslate(gState.CTM, tx, ty); + gState.CTM = CGAffineTransformTranslate(gState.CTM, tx, ty); } /*! @@ -485,7 +485,7 @@ function CGContextSetShadow(aContext, aSize, aBlur) { var gState = aContext.gState; - gState.shadowOffset = _CGSizeMakeCopy(aSize); + gState.shadowOffset = CGSizeMakeCopy(aSize); gState.shadowBlur = aBlur; gState.shadowColor = [CPColor shadowColor]; } @@ -502,7 +502,7 @@ function CGContextSetShadowWithColor(aContext, aSize, aBlur, aColor) { var gState = aContext.gState; - gState.shadowOffset = _CGSizeMakeCopy(aSize); + gState.shadowOffset = CGSizeMakeCopy(aSize); gState.shadowBlur = aBlur; gState.shadowColor = aColor; } diff --git a/AppKit/CoreGraphics/CGContextCanvas.j b/AppKit/CoreGraphics/CGContextCanvas.j index 6d83aa799..73da49036 100644 --- a/AppKit/CoreGraphics/CGContextCanvas.j +++ b/AppKit/CoreGraphics/CGContextCanvas.j @@ -38,9 +38,9 @@ var CANVAS_LINECAP_TABLE = [ "butt", "round", "square" ], #define _CGContextClosePathCanvas(aContext) aContext.closePath() #define _CGContextMoveToPointCanvas(aContext, x, y) aContext.moveTo(x, y) -#define _CGContextAddRectCanvas(aContext, aRect) aContext.rect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)) +#define _CGContextAddRectCanvas(aContext, aRect) aContext.rect(CGRectGetMinX(aRect), CGRectGetMinY(aRect), CGRectGetWidth(aRect), CGRectGetHeight(aRect)) #define _CGContextBeginPathCanvas(aContext) aContext.beginPath() -#define _CGContextFillRectCanvas(aContext, aRect) aContext.fillRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)) +#define _CGContextFillRectCanvas(aContext, aRect) aContext.fillRect(CGRectGetMinX(aRect), CGRectGetMinY(aRect), CGRectGetWidth(aRect), CGRectGetHeight(aRect)) #define _CGContextClipCanvas(aContext) aContext.clip() // In Cocoa, all primitives excepts rects cannot be added to the context's path @@ -247,7 +247,7 @@ function CGContextMoveToPoint(aContext, x, y) function CGContextClearRect(aContext, aRect) { - aContext.clearRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)); + aContext.clearRect(CGRectGetMinX(aRect), CGRectGetMinY(aRect), CGRectGetWidth(aRect), CGRectGetHeight(aRect)); aContext.hasPath = NO; } @@ -288,7 +288,7 @@ function CGContextFillRects(aContext, rects, count) function CGContextStrokeRect(aContext, aRect) { - aContext.strokeRect(_CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)); + aContext.strokeRect(CGRectGetMinX(aRect), CGRectGetMinY(aRect), CGRectGetWidth(aRect), CGRectGetHeight(aRect)); aContext.hasPath = NO; } @@ -560,7 +560,7 @@ CGContextConcatCTM = function(aContext, anAffineTransform) function CGContextDrawImage(aContext, aRect, anImage) { - aContext.drawImage(anImage._image, _CGRectGetMinX(aRect), _CGRectGetMinY(aRect), _CGRectGetWidth(aRect), _CGRectGetHeight(aRect)); + aContext.drawImage(anImage._image, CGRectGetMinX(aRect), CGRectGetMinY(aRect), CGRectGetWidth(aRect), CGRectGetHeight(aRect)); aContext.hasPath = NO; } diff --git a/AppKit/CoreGraphics/CGContextVML.j b/AppKit/CoreGraphics/CGContextVML.j index 66d17d89f..d8431a857 100644 --- a/AppKit/CoreGraphics/CGContextVML.j +++ b/AppKit/CoreGraphics/CGContextVML.j @@ -82,7 +82,7 @@ function CGContextDrawImage(aContext, aRect, anImage) { var angle = CGPointMake(1.0, 0.0); - angle = _CGPointApplyAffineTransform(angle, ctm); + angle = CGPointApplyAffineTransform(angle, ctm); vml.push(";rotation:", ATAN2(angle.y - ctm.ty, angle.x - ctm.tx) * 180 / PI); }*/ @@ -95,7 +95,7 @@ function CGContextDrawImage(aContext, aRect, anImage) { var transformedRect = CGRectApplyAffineTransform(aRect, ctm); - vml.push( ";padding:0 ", ROUND(_CGRectGetMaxX(transformedRect)), "px ", ROUND(_CGRectGetMaxY(transformedRect)), + vml.push( ";padding:0 ", ROUND(CGRectGetMaxX(transformedRect)), "px ", ROUND(CGRectGetMaxY(transformedRect)), "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(", "M11='", ctm.a, "',M12='", ctm.c, "',M21='", ctm.b, "',M22='", ctm.d, "',", "Dx='", ROUND(origin.x), "', Dy='", ROUND(origin.y), "', sizingmethod='clip');"); @@ -104,7 +104,7 @@ function CGContextDrawImage(aContext, aRect, anImage) // vml.push(";top:", ROUND(origin.y - 0.5), "px;left:", ROUND(origin.x - 0.5), "px;"); vml.push( "\">"); string = vml.join(""); @@ -175,7 +175,7 @@ function CGContextDrawPath(aContext, aMode) endAngle = element.endAngle, startAngle = element.startAngle, - start = _CGPointMake(x + radius * COS(startAngle), y + radius * SIN(startAngle)); + start = CGPointMake(x + radius * COS(startAngle), y + radius * SIN(startAngle)); // If the angle's are equal, then we won't actually draw an arc, but instead // simply move to its start/end to get the proper fill. @@ -188,12 +188,12 @@ function CGContextDrawPath(aContext, aMode) continue; } - var end = _CGPointMake(x + radius * COS(endAngle), y + radius * SIN(endAngle)); + var end = CGPointMake(x + radius * COS(endAngle), y + radius * SIN(endAngle)); // Only do the start correction if the angles aren't equal. If they are, then // let the circle be empty. // FIXME: Should this be |star.x - end.x| < 0.125 ? - if (clockwise && startAngle != endAngle && _CGPointEqualToPoint(start, end)) + if (clockwise && startAngle != endAngle && CGPointEqualToPoint(start, end)) if (start.x >= x) { if (start.y < y) diff --git a/AppKit/CoreGraphics/CGPath.j b/AppKit/CoreGraphics/CGPath.j index fb01d5c34..05d1651d8 100644 --- a/AppKit/CoreGraphics/CGPath.j +++ b/AppKit/CoreGraphics/CGPath.j @@ -43,7 +43,7 @@ kCGPathElementAddArcToPoint = 6; */ function CGPathCreateMutable() { - return { count:0, start:_CGPointMake(0, 0), current:_CGPointMake(0, 0), elements:[] }; + return { count:0, start:CGPointMake(0, 0), current:CGPointMake(0, 0), elements:[] }; } /*! @@ -79,15 +79,15 @@ function CGPathRetain(aPath) function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, isClockwise) { - if (aTransform && !_CGAffineTransformIsIdentity(aTransform)) + if (aTransform && !CGAffineTransformIsIdentity(aTransform)) { - var center = _CGPointMake(x, y), - end = _CGPointMake(COS(anEndAngle), SIN(anEndAngle)), - start = _CGPointMake(COS(aStartAngle), SIN(aStartAngle)); + var center = CGPointMake(x, y), + end = CGPointMake(COS(anEndAngle), SIN(anEndAngle)), + start = CGPointMake(COS(aStartAngle), SIN(aStartAngle)); - end = _CGPointApplyAffineTransform(end, aTransform); - start = _CGPointApplyAffineTransform(start, aTransform); - center = _CGPointApplyAffineTransform(center, aTransform); + end = CGPointApplyAffineTransform(end, aTransform); + start = CGPointApplyAffineTransform(start, aTransform); + center = CGPointApplyAffineTransform(center, aTransform); x = center.x; y = center.y; @@ -107,8 +107,8 @@ function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, else aStartAngle = aStartAngle - PI2; - aRadius = _CGSizeMake(aRadius, 0); - aRadius = _CGSizeApplyAffineTransform(aRadius, aTransform); + aRadius = CGSizeMake(aRadius, 0); + aRadius = CGSizeApplyAffineTransform(aRadius, aTransform); aRadius = SQRT(aRadius.width * aRadius.width + aRadius.height * aRadius.height); } @@ -132,22 +132,22 @@ function CGPathAddArc(aPath, aTransform, x, y, aRadius, aStartAngle, anEndAngle, var arcStartX = x + aRadius * COS(aStartAngle), arcStartY = y + aRadius * SIN(aStartAngle); - aPath.start = _CGPointMake(arcStartX, arcStartY); + aPath.start = CGPointMake(arcStartX, arcStartY); } - aPath.current = _CGPointMake(arcEndX, arcEndY); + aPath.current = CGPointMake(arcEndX, arcEndY); aPath.elements[aPath.count++] = { type:kCGPathElementAddArc, x:x, y:y, radius:aRadius, startAngle:aStartAngle, endAngle:anEndAngle, clockwise:isClockwise }; } function CGPathAddArcToPoint(aPath, aTransform, x1, y1, x2, y2, aRadius) { - var p1 = _CGPointMake(x1, y1), - p2 = _CGPointMake(x2, y2); + var p1 = CGPointMake(x1, y1), + p2 = CGPointMake(x2, y2); if (aTransform) { - p1 = _CGPointApplyAffineTransform(p1, aTransform); - p2 = _CGPointApplyAffineTransform(p2, aTransform); + p1 = CGPointApplyAffineTransform(p1, aTransform); + p2 = CGPointApplyAffineTransform(p2, aTransform); } /* @@ -171,15 +171,15 @@ function CGPathAddArcToPoint(aPath, aTransform, x1, y1, x2, y2, aRadius) function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y) { - var cp1 = _CGPointMake(cp1x, cp1y), - cp2 = _CGPointMake(cp2x, cp2y), - end = _CGPointMake(x, y); + var cp1 = CGPointMake(cp1x, cp1y), + cp2 = CGPointMake(cp2x, cp2y), + end = CGPointMake(x, y); if (aTransform) { - cp1 = _CGPointApplyAffineTransform(cp1, aTransform); - cp2 = _CGPointApplyAffineTransform(cp2, aTransform); - end = _CGPointApplyAffineTransform(end, aTransform); + cp1 = CGPointApplyAffineTransform(cp1, aTransform); + cp2 = CGPointApplyAffineTransform(cp2, aTransform); + end = CGPointApplyAffineTransform(end, aTransform); } aPath.current = end; @@ -202,10 +202,10 @@ function CGPathAddLines(aPath, aTransform, points, count) function CGPathAddLineToPoint(aPath, aTransform, x, y) { - var point = _CGPointMake(x, y); + var point = CGPointMake(x, y); if (aTransform !== NULL) - point = _CGPointApplyAffineTransform(point, aTransform); + point = CGPointApplyAffineTransform(point, aTransform); aPath.elements[aPath.count++] = { type: kCGPathElementAddLineToPoint, x:point.x, y:point.y }; aPath.current = point; @@ -262,13 +262,13 @@ function CGPathAddPath(aPath, aTransform, anotherPath) function CGPathAddQuadCurveToPoint(aPath, aTransform, cpx, cpy, x, y) { - var cp = _CGPointMake(cpx, cpy), - end = _CGPointMake(x, y); + var cp = CGPointMake(cpx, cpy), + end = CGPointMake(x, y); if (aTransform) { - cp = _CGPointApplyAffineTransform(cp, aTransform); - end = _CGPointApplyAffineTransform(end, aTransform); + cp = CGPointApplyAffineTransform(cp, aTransform); + end = CGPointApplyAffineTransform(end, aTransform); } aPath.elements[aPath.count++] = { type:kCGPathElementAddQuadCurveToPoint, cpx:cp.x, cpy:cp.y, x:end.x, y:end.y } @@ -291,10 +291,10 @@ function CGPathAddRects(aPath, aTransform, rects, count) { var rect = rects[i]; - CGPathMoveToPoint(aPath, aTransform, _CGRectGetMinX(rect), _CGRectGetMinY(rect)); - CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMaxX(rect), _CGRectGetMinY(rect)); - CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMaxX(rect), _CGRectGetMaxY(rect)); - CGPathAddLineToPoint(aPath, aTransform, _CGRectGetMinX(rect), _CGRectGetMaxY(rect)); + CGPathMoveToPoint(aPath, aTransform, CGRectGetMinX(rect), CGRectGetMinY(rect)); + CGPathAddLineToPoint(aPath, aTransform, CGRectGetMaxX(rect), CGRectGetMinY(rect)); + CGPathAddLineToPoint(aPath, aTransform, CGRectGetMaxX(rect), CGRectGetMaxY(rect)); + CGPathAddLineToPoint(aPath, aTransform, CGRectGetMinX(rect), CGRectGetMaxY(rect)); CGPathCloseSubpath(aPath); } @@ -302,10 +302,10 @@ function CGPathAddRects(aPath, aTransform, rects, count) function CGPathMoveToPoint(aPath, aTransform, x, y) { - var point = _CGPointMake(x, y); + var point = CGPointMake(x, y); if (aTransform !== NULL) - point = _CGPointApplyAffineTransform(point, aTransform); + point = CGPointApplyAffineTransform(point, aTransform); aPath.start = aPath.current = point; @@ -331,12 +331,12 @@ function CGPathWithEllipseInRect(aRect) { var path = CGPathCreateMutable(); - if (_CGRectGetWidth(aRect) === _CGRectGetHeight(aRect)) - CGPathAddArc(path, nil, _CGRectGetMidX(aRect), _CGRectGetMidY(aRect), _CGRectGetWidth(aRect) / 2.0, 0.0, 2 * PI, YES); + 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); + 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); @@ -354,10 +354,10 @@ function CGPathWithEllipseInRect(aRect) function CGPathWithRoundedRectangleInRect(aRect, xRadius, yRadius/*not currently supported*/, ne, se, sw, nw) { var path = CGPathCreateMutable(), - xMin = _CGRectGetMinX(aRect), - xMax = _CGRectGetMaxX(aRect), - yMin = _CGRectGetMinY(aRect), - yMax = _CGRectGetMaxY(aRect); + xMin = CGRectGetMinX(aRect), + xMax = CGRectGetMaxX(aRect), + yMin = CGRectGetMinY(aRect), + yMax = CGRectGetMaxY(aRect); CGPathMoveToPoint(path, nil, xMin + xRadius, yMin); @@ -407,7 +407,7 @@ function CGPathCloseSubpath(aPath) return; // After closing, the current point is the previous path's starting point - aPath.current = _CGPointCreateCopy(aPath.start); + aPath.current = CGPointCreateCopy(aPath.start); aPath.elements[aPath.count++] = { type:kCGPathElementCloseSubpath, start:aPath.start }; } @@ -416,7 +416,7 @@ function CGPathEqualToPath(aPath, anotherPath) if (aPath === anotherPath) return YES; - if (aPath.count !== anotherPath.count || !_CGPointEqualToPoint(aPath.start, anotherPath.start) || !_CGPointEqualToPoint(aPath.current, anotherPath.current)) + if (aPath.count !== anotherPath.count || !CGPointEqualToPoint(aPath.start, anotherPath.start) || !CGPointEqualToPoint(aPath.current, anotherPath.current)) return NO; var i = 0, @@ -487,7 +487,7 @@ function CGPathEqualToPath(aPath, anotherPath) break; case kCGPathElementCloseSubpath: - if (!_CGPointEqualToPoint(element.start, anotherElement.start)) + if (!CGPointEqualToPoint(element.start, anotherElement.start)) return NO; break; } @@ -498,7 +498,7 @@ function CGPathEqualToPath(aPath, anotherPath) function CGPathGetCurrentPoint(aPath) { - return _CGPointCreateCopy(aPath.current); + return CGPointCreateCopy(aPath.current); } function CGPathIsEmpty(aPath) @@ -512,7 +512,7 @@ function CGPathIsEmpty(aPath) function CGPathGetBoundingBox(aPath) { if (!aPath || !aPath.count) - return _CGRectMakeZero(); + return CGRectMakeZero(); var ox = 0, oy = 0, @@ -591,7 +591,7 @@ function CGPathGetBoundingBox(aPath) break; case kCGPathElementMoveToPoint: - movePoint = _CGPointMake(element.x, element.y); + movePoint = CGPointMake(element.x, element.y); break; case kCGPathElementCloseSubpath: @@ -605,7 +605,7 @@ function CGPathGetBoundingBox(aPath) } } - return _CGRectMake(ox, oy, rx - ox, ry - oy); + return CGRectMake(ox, oy, rx - ox, ry - oy); } /*! diff --git a/AppKit/Platform/CPPlatformString.j b/AppKit/Platform/CPPlatformString.j index ddc7e29d1..b0a930c6d 100644 --- a/AppKit/Platform/CPPlatformString.j +++ b/AppKit/Platform/CPPlatformString.j @@ -33,7 +33,7 @@ + (CGSize)sizeOfString:(CPString)aString withFont:(CPFont)aFont forWidth:(float)aWidth { - return _CGSizeMakeZero(); + return CGSizeMakeZero(); } @end @@ -45,7 +45,7 @@ + (CGSize)sizeOfString:(CPString)aString withFont:(CPFont)aFont forWidth:(float)aWidth { - return _CGSizeMakeZero(); + return CGSizeMakeZero(); } + (CPDictionary)metricsOfFont:(CPFont)aFont diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index d5988787c..d75858dca 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -106,7 +106,7 @@ var PrimaryPlatformWindow = NULL; if (self) { - _contentRect = _CGRectMakeCopy(aRect); + _contentRect = CGRectMakeCopy(aRect); #if PLATFORM(DOM) _windowLevels = []; @@ -121,19 +121,19 @@ var PrimaryPlatformWindow = NULL; - (id)init { - return [self initWithContentRect:_CGRectMake(0.0, 0.0, 400.0, 500.0)]; + return [self initWithContentRect:CGRectMake(0.0, 0.0, 400.0, 500.0)]; } - (CGRect)contentRect { - return _CGRectMakeCopy(_contentRect); + return CGRectMakeCopy(_contentRect); } - (CGRect)contentBounds { var contentBounds = [self contentRect]; - contentBounds.origin = _CGPointMakeZero(); + contentBounds.origin = CGPointMakeZero(); return contentBounds; } @@ -142,7 +142,7 @@ var PrimaryPlatformWindow = NULL; { var frame = [self contentBounds]; - frame.origin = _CGPointMakeZero(); + frame.origin = CGPointMakeZero(); if ([CPMenu menuBarVisible] && [CPPlatformWindow primaryPlatformWindow] === self) { @@ -162,10 +162,10 @@ var PrimaryPlatformWindow = NULL; - (void)setContentRect:(CGRect)aRect { - if (!aRect || _CGRectEqualToRect(_contentRect, aRect)) + if (!aRect || CGRectEqualToRect(_contentRect, aRect)) return; - _contentRect = _CGRectMakeCopy(aRect); + _contentRect = CGRectMakeCopy(aRect); #if PLATFORM(DOM) [self updateNativeContentRect]; @@ -181,14 +181,14 @@ var PrimaryPlatformWindow = NULL; { var contentRect = [self contentRect]; - return _CGPointMake(aPoint.x + _CGRectGetMinX(contentRect), aPoint.y + _CGRectGetMinY(contentRect)); + return CGPointMake(aPoint.x + CGRectGetMinX(contentRect), aPoint.y + CGRectGetMinY(contentRect)); } - (CGPoint)convertScreenToBase:(CGPoint)aPoint { var contentRect = [self contentRect]; - return _CGPointMake(aPoint.x - _CGRectGetMinX(contentRect), aPoint.y - _CGRectGetMinY(contentRect)); + return CGPointMake(aPoint.x - CGRectGetMinX(contentRect), aPoint.y - CGRectGetMinY(contentRect)); } - (BOOL)isVisible diff --git a/AppKit/Platform/DOM/CPDOMDisplayServer.h b/AppKit/Platform/DOM/CPDOMDisplayServer.h index 34e3ba838..3aa1a22af 100644 --- a/AppKit/Platform/DOM/CPDOMDisplayServer.h +++ b/AppKit/Platform/DOM/CPDOMDisplayServer.h @@ -49,26 +49,26 @@ CPDOMDisplayServerInstructions[__index + 4] = y; #if !DOM_OPTIMIZATION #define CPDOMDisplayServerSetStyleLeftTop(aDOMElement, aTransform, aLeft, aTop) \ -if (aTransform) var ____p = _CGPointApplyAffineTransform(CGPointMake(aLeft, aTop), aTransform); \ -else var ____p = _CGPointMake(aLeft, aTop); \ +if (aTransform) var ____p = CGPointApplyAffineTransform(CGPointMake(aLeft, aTop), aTransform); \ +else var ____p = CGPointMake(aLeft, aTop); \ aDOMElement.style.left = ROUND(____p.x) + "px";\ aDOMElement.style.top = ROUND(____p.y) + "px"; #define CPDOMDisplayServerSetStyleRightTop(aDOMElement, aTransform, aRight, aTop) \ -if (aTransform) var ____p = _CGPointApplyAffineTransform(CGPointMake(aRight, aTop), aTransform); \ -else var ____p = _CGPointMake(aRight, aTop); \ +if (aTransform) var ____p = CGPointApplyAffineTransform(CGPointMake(aRight, aTop), aTransform); \ +else var ____p = CGPointMake(aRight, aTop); \ aDOMElement.style.right = ROUND(____p.x) + "px";\ aDOMElement.style.top = ROUND(____p.y) + "px"; #define CPDOMDisplayServerSetStyleLeftBottom(aDOMElement, aTransform, aLeft, aBottom) \ -if (aTransform) var ____p = _CGPointApplyAffineTransform(CGPointMake(aLeft, aBottom), aTransform); \ -else var ____p = _CGPointMake(aLeft, aBottom); \ +if (aTransform) var ____p = CGPointApplyAffineTransform(CGPointMake(aLeft, aBottom), aTransform); \ +else var ____p = CGPointMake(aLeft, aBottom); \ aDOMElement.style.left = ROUND(____p.x) + "px";\ aDOMElement.style.bottom = ROUND(____p.y) + "px"; #define CPDOMDisplayServerSetStyleRightBottom(aDOMElement, aTransform, aRight, aBottom) \ -if (aTransform) var ____p = _CGPointApplyAffineTransform(CGPointMake(aRight, aBottom), aTransform); \ -else var ____p = _CGPointMake(aRight, aBottom); \ +if (aTransform) var ____p = CGPointApplyAffineTransform(CGPointMake(aRight, aBottom), aTransform); \ +else var ____p = CGPointMake(aRight, aBottom); \ aDOMElement.style.right = ROUND(____p.x) + "px";\ aDOMElement.style.bottom = ROUND(____p.y) + "px"; @@ -166,8 +166,8 @@ CPDOMDisplayServerInstructionCount = 0; var transform = CPDOMDisplayServerInstructions[index++];\ if (transform)\ {\ - var point = _CGPointMake(CPDOMDisplayServerInstructions[index++], CPDOMDisplayServerInstructions[index++]),\ - transformed = _CGPointApplyAffineTransform(point, transform);\ + var point = CGPointMake(CPDOMDisplayServerInstructions[index++], CPDOMDisplayServerInstructions[index++]),\ + transformed = CGPointApplyAffineTransform(point, transform);\ style[x] = ROUND(transformed.x) + "px";\ style[y] = ROUND(transformed.y) + "px";\ }\ diff --git a/AppKit/Platform/DOM/CPDOMWindowLayer.j b/AppKit/Platform/DOM/CPDOMWindowLayer.j index cb693f20c..5ef90849d 100644 --- a/AppKit/Platform/DOM/CPDOMWindowLayer.j +++ b/AppKit/Platform/DOM/CPDOMWindowLayer.j @@ -173,7 +173,7 @@ parent = clip.parentNode; CPDOMDisplayServerRemoveChild(clip, windowElement); - [aWindow setFrameOrigin:_CGPointMake([aWindow frame].origin.x, clip.offsetTop)]; + [aWindow setFrameOrigin:CGPointMake([aWindow frame].origin.x, clip.offsetTop)]; CPDOMDisplayServerInsertBefore(parent, windowElement, clip); CPDOMDisplayServerRemoveChild(parent, clip); } diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j index aff149962..f35c891f5 100644 --- a/AppKit/Platform/DOM/CPPlatformString.j +++ b/AppKit/Platform/DOM/CPPlatformString.j @@ -151,7 +151,7 @@ var DOMFixedWidthSpanElement = nil, else if (CPFeatureIsCompatible(CPJavaScriptTextContentFeature)) span.textContent = aString; - return _CGSizeMake(span.clientWidth, span.clientHeight); + return CGSizeMake(span.clientWidth, span.clientHeight); } + (CPDictionary)metricsOfFont:(CPFont)aFont diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index b4af9d0de..546c05871 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -210,7 +210,7 @@ var resizeTimer = nil; if (self) { _DOMWindow = window; - _contentRect = _CGRectMakeZero(); + _contentRect = CGRectMakeZero(); _windowLevels = []; _windowLayers = @{}; @@ -232,25 +232,25 @@ var resizeTimer = nil; if (_DOMWindow.cpFrame) return _DOMWindow.cpFrame(); - var contentRect = _CGRectMakeZero(); + var contentRect = CGRectMakeZero(); if (window.screenTop) - contentRect.origin = _CGPointMake(_DOMWindow.screenLeft, _DOMWindow.screenTop); + contentRect.origin = CGPointMake(_DOMWindow.screenLeft, _DOMWindow.screenTop); else if (window.screenX) - contentRect.origin = _CGPointMake(_DOMWindow.screenX, _DOMWindow.screenY); + contentRect.origin = CGPointMake(_DOMWindow.screenX, _DOMWindow.screenY); // Safari, Mozilla, Firefox, and Opera if (_DOMWindow.innerWidth) - contentRect.size = _CGSizeMake(_DOMWindow.innerWidth, _DOMWindow.innerHeight); + contentRect.size = CGSizeMake(_DOMWindow.innerWidth, _DOMWindow.innerHeight); // Internet Explorer 6 in Strict Mode else if (document.documentElement && document.documentElement.clientWidth) - contentRect.size = _CGSizeMake(_DOMWindow.document.documentElement.clientWidth, _DOMWindow.document.documentElement.clientHeight); + contentRect.size = CGSizeMake(_DOMWindow.document.documentElement.clientWidth, _DOMWindow.document.documentElement.clientHeight); // Internet Explorer X else - contentRect.size = _CGSizeMake(_DOMWindow.document.body.clientWidth, _DOMWindow.document.body.clientHeight); + contentRect.size = CGSizeMake(_DOMWindow.document.body.clientWidth, _DOMWindow.document.body.clientHeight); return contentRect; } @@ -548,7 +548,7 @@ var resizeTimer = nil; if (_DOMWindow) return _DOMWindow.focus(); - _DOMWindow = window.open("about:blank", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + _CGRectGetMinX(_contentRect) + ",top=" + _CGRectGetMinY(_contentRect) + ",width=" + _CGRectGetWidth(_contentRect) + ",height=" + _CGRectGetHeight(_contentRect)); + _DOMWindow = window.open("about:blank", "_blank", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no,left=" + CGRectGetMinX(_contentRect) + ",top=" + CGRectGetMinY(_contentRect) + ",width=" + CGRectGetWidth(_contentRect) + ",height=" + CGRectGetHeight(_contentRect)); [PlatformWindows addObject:self]; @@ -585,7 +585,7 @@ var resizeTimer = nil; { var type = aDOMEvent.type, dragServer = [CPDragServer sharedDragServer], - location = _CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), + location = CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), pasteboard = [_CPDOMDataTransferPasteboard DOMDataTransferPasteboard]; [pasteboard _setDataTransfer:aDOMEvent.dataTransfer]; @@ -600,8 +600,8 @@ var resizeTimer = nil; draggedWindowFrame = [draggedWindow frame], DOMDragElement = draggedWindow._DOMElement; - DOMDragElement.style.left = -_CGRectGetWidth(draggedWindowFrame) + "px"; - DOMDragElement.style.top = -_CGRectGetHeight(draggedWindowFrame) + "px"; + DOMDragElement.style.left = -CGRectGetWidth(draggedWindowFrame) + "px"; + DOMDragElement.style.top = -CGRectGetHeight(draggedWindowFrame) + "px"; var parentNode = DOMDragElement.parentNode; @@ -615,7 +615,7 @@ var resizeTimer = nil; aDOMEvent.dataTransfer.setDragImage(DOMDragElement, draggingOffset.width, draggingOffset.height); aDOMEvent.dataTransfer.effectAllowed = "all"; - [dragServer draggingStartedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY)]; + [dragServer draggingStartedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY)]; } else if (type === "drag") { @@ -624,7 +624,7 @@ var resizeTimer = nil; if (CPFeatureIsCompatible(CPHTML5DragAndDropSourceYOffBy1)) y -= 1; - [dragServer draggingSourceUpdatedWithGlobalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, y)]; + [dragServer draggingSourceUpdatedWithGlobalLocation:[CPPlatform isBrowser] ? location : CGPointMake(aDOMEvent.screenX, y)]; } else if (type === "dragover" || type === "dragleave") { @@ -656,7 +656,7 @@ var resizeTimer = nil; else dragOperation = CPDragOperationNone; - [dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY) operation:dragOperation]; + [dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY) operation:dragOperation]; } else //if (type === "drop") { @@ -676,7 +676,7 @@ var resizeTimer = nil; - (void)keyEvent:(DOMEvent)aDOMEvent { var event, - location = _lastMouseEventLocation || _CGPointMakeZero(), + location = _lastMouseEventLocation || CGPointMakeZero(), timestamp = [CPEvent currentTimestamp], sourceElement = aDOMEvent.target || aDOMEvent.srcElement, windowNumber = [[CPApp keyWindow] windowNumber], @@ -897,7 +897,7 @@ var resizeTimer = nil; timestamp = [CPEvent currentTimestamp], // fake event, might as well use current timestamp windowNumber = [[CPApp keyWindow] windowNumber], modifierFlags = CPPlatformActionKeyMask, - location = _lastMouseEventLocation || _CGPointMakeZero(), + location = _lastMouseEventLocation || CGPointMakeZero(), event = [CPEvent keyEventWithType:CPKeyDown location:location modifierFlags:modifierFlags timestamp:timestamp windowNumber:windowNumber context:nil characters:characters charactersIgnoringModifiers:characters isARepeat:NO keyCode:keyCode]; @@ -1018,12 +1018,12 @@ var resizeTimer = nil; } while (element = element.offsetParent); } - location = _CGPointMake((x + ((aDOMEvent.clientX - 8) / 15)), (y + ((aDOMEvent.clientY - 8) / 15))); + location = CGPointMake((x + ((aDOMEvent.clientX - 8) / 15)), (y + ((aDOMEvent.clientY - 8) / 15))); } else if (aDOMEvent._overrideLocation) location = aDOMEvent._overrideLocation; else - location = _CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY); + location = CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY); var deltaX = 0.0, deltaY = 0.0, @@ -1212,7 +1212,7 @@ var resizeTimer = nil; } var event, - location = _CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), + location = CGPointMake(aDOMEvent.clientX, aDOMEvent.clientY), timestamp = [CPEvent currentTimestamp], sourceElement = (aDOMEvent.target || aDOMEvent.srcElement), windowNumber = 0, diff --git a/AppKit/_CPCornerView.j b/AppKit/_CPCornerView.j index da7dd48fe..02371b3c5 100644 --- a/AppKit/_CPCornerView.j +++ b/AppKit/_CPCornerView.j @@ -47,8 +47,8 @@ CGContextSetLineWidth(context, 1); CGContextSetStrokeColor(context, [self currentValueForThemeAttribute:@"divider-color"]); - CGContextMoveToPoint(context, _CGRectGetMinX(aRect) + 0.5, ROUND(_CGRectGetMinY(aRect))); - CGContextAddLineToPoint(context, _CGRectGetMinX(aRect) + 0.5, ROUND(_CGRectGetMaxY(aRect)) - 1.0); + CGContextMoveToPoint(context, CGRectGetMinX(aRect) + 0.5, ROUND(CGRectGetMinY(aRect))); + CGContextAddLineToPoint(context, CGRectGetMinX(aRect) + 0.5, ROUND(CGRectGetMaxY(aRect)) - 1.0); CGContextClosePath(context); CGContextStrokePath(context); diff --git a/AppKit/_CPImageAndTextView.j b/AppKit/_CPImageAndTextView.j index 131beeb61..0bca4ca41 100644 --- a/AppKit/_CPImageAndTextView.j +++ b/AppKit/_CPImageAndTextView.j @@ -80,7 +80,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, if (self) { - _textShadowOffset = _CGSizeMakeZero(); + _textShadowOffset = CGSizeMakeZero(); [self setVerticalAlignment:CPTopVerticalTextAlignment]; if (aControl) @@ -277,10 +277,10 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, - (void)setTextShadowOffset:(CGSize)anOffset { - if (_CGSizeEqualToSize(_textShadowOffset, anOffset)) + if (CGSizeEqualToSize(_textShadowOffset, anOffset)) return; - _textShadowOffset = _CGSizeMakeCopy(anOffset); + _textShadowOffset = CGSizeMakeCopy(anOffset); [self setNeedsLayout]; } @@ -294,7 +294,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, { [self layoutIfNeeded]; - var textFrame = _CGRectMakeZero(); + var textFrame = CGRectMakeZero(); #if PLATFORM(DOM) if (_DOMTextElement) @@ -602,7 +602,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, } var size = [self bounds].size, - textRect = _CGRectMake(0.0, 0.0, size.width, size.height); + textRect = CGRectMake(0.0, 0.0, size.width, size.height); if (hasDOMImageElement) { @@ -680,10 +680,10 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, if (hasDOMTextElement) { - var textRectX = _CGRectGetMinX(textRect), - textRectY = _CGRectGetMinY(textRect), - textRectWidth = _CGRectGetWidth(textRect), - textRectHeight = _CGRectGetHeight(textRect); + var textRectX = CGRectGetMinX(textRect), + textRectY = CGRectGetMinY(textRect), + textRectWidth = CGRectGetWidth(textRect), + textRectHeight = CGRectGetHeight(textRect); if (textRectWidth <= 0 || textRectHeight <= 0) { @@ -753,7 +753,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0, - (void)sizeToFit { - var size = _CGSizeMakeZero(); + var size = CGSizeMakeZero(); if ((_imagePosition !== CPNoImage) && _image) { diff --git a/AppKit/_CPPopoverWindow.j b/AppKit/_CPPopoverWindow.j index 914af3b3d..b801b880d 100644 --- a/AppKit/_CPPopoverWindow.j +++ b/AppKit/_CPPopoverWindow.j @@ -185,11 +185,11 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0, nativeRect = [platformWindow nativeContentRect], baseOrigin = [positioningView convertPointToBase:aRect.origin], platformOrigin = [mainWindow convertBaseToPlatformWindow:baseOrigin], - platformRect = _CGRectMake(platformOrigin.x, platformOrigin.y, aRect.size.width, aRect.size.height), - originLeft = _CGPointCreateCopy(platformOrigin), - originRight = _CGPointCreateCopy(platformOrigin), - originTop = _CGPointCreateCopy(platformOrigin), - originBottom = _CGPointCreateCopy(platformOrigin), + platformRect = CGRectMake(platformOrigin.x, platformOrigin.y, aRect.size.width, aRect.size.height), + originLeft = CGPointCreateCopy(platformOrigin), + originRight = CGPointCreateCopy(platformOrigin), + originTop = CGPointCreateCopy(platformOrigin), + originBottom = CGPointCreateCopy(platformOrigin), frameSize = [self frame].size, menuBarHeight = [CPMenu menuBarVisible] ? [CPMenu menuBarHeight] : 0; @@ -270,7 +270,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0, switch (edge) { case CPMaxXEdge: - if (origin.x >= _CGRectGetMaxX(platformRect)) + if (origin.x >= CGRectGetMaxX(platformRect)) return origin; break; @@ -280,7 +280,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0, break; case CPMaxYEdge: - if (origin.y >= _CGRectGetMaxY(platformRect)) + if (origin.y >= CGRectGetMaxY(platformRect)) return origin; break; @@ -317,7 +317,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0, { var wasVisible = [self isVisible]; - if (!aRect || _CGRectIsEmpty(aRect)) + if (!aRect || CGRectIsEmpty(aRect)) aRect = [positioningView bounds]; var point = [self computeOriginFromRect:aRect ofView:positioningView preferredEdge:anEdge]; diff --git a/Foundation/CPArray+KVO.j b/Foundation/CPArray+KVO.j index c82d56c97..c3238f6a1 100644 --- a/Foundation/CPArray+KVO.j +++ b/Foundation/CPArray+KVO.j @@ -317,7 +317,7 @@ while (index--) { - while ((position = [self indexOfObject:[theObjects objectAtIndex:index] inRange:_CPMakeRange(position + 1, count)]) !== CPNotFound) + while ((position = [self indexOfObject:[theObjects objectAtIndex:index] inRange:CPMakeRange(position + 1, count)]) !== CPNotFound) [indexes addIndex:position]; } diff --git a/Foundation/CPIndexSet.j b/Foundation/CPIndexSet.j index f00e1922d..b2a362300 100644 --- a/Foundation/CPIndexSet.j +++ b/Foundation/CPIndexSet.j @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "CPRange.h" #include "Foundation.h" @import "CPArray.j" @@ -71,7 +70,7 @@ - (id)init { - return [self initWithIndexesInRange:_CPMakeRange(0, 0)]; + return [self initWithIndexesInRange:CPMakeRange(0, 0)]; } /*! @@ -84,7 +83,7 @@ [CPException raise:CPInvalidArgumentException reason:"Invalid index"]; - return [self initWithIndexesInRange:_CPMakeRange(anIndex, 1)]; + return [self initWithIndexesInRange:CPMakeRange(anIndex, 1)]; } /*! @@ -130,7 +129,7 @@ otherRangesCount = otherRanges.length; while (otherRangesCount--) - _ranges[otherRangesCount] = _CPMakeRangeCopy(otherRanges[otherRangesCount]); + _ranges[otherRangesCount] = CPMakeRangeCopy(otherRanges[otherRangesCount]); } return self; @@ -260,7 +259,7 @@ if (FLOOR(lhsRangeIndex) === lhsRangeIndex) return YES; - var rhsRangeIndex = assumedPositionOfIndex(_ranges, _CPMaxRange(aRange) - 1); + var rhsRangeIndex = assumedPositionOfIndex(_ranges, CPMaxRange(aRange) - 1); if (FLOOR(rhsRangeIndex) === rhsRangeIndex) return YES; @@ -294,7 +293,7 @@ - (CPInteger)lastIndex { if (_count > 0) - return _CPMaxRange(_ranges[_ranges.length - 1]) - 1; + return CPMaxRange(_ranges[_ranges.length - 1]) - 1; return CPNotFound; } @@ -323,7 +322,7 @@ var range = _ranges[rangeIndex]; // Check if it's actually in this range. - if (_CPLocationInRange(anIndex, range)) + if (CPLocationInRange(anIndex, range)) return anIndex; // If not, it must be the first element of this range. @@ -354,11 +353,11 @@ var range = _ranges[rangeIndex]; // Check if it's actually in this range. - if (_CPLocationInRange(anIndex, range)) + if (CPLocationInRange(anIndex, range)) return anIndex; // If not, it must be the first element of this range. - return _CPMaxRange(range) - 1; + return CPMaxRange(range) - 1; } /*! @@ -403,7 +402,7 @@ if (aRange) { var firstIndex = aRange.location, - lastIndex = _CPMaxRange(aRange) - 1, + lastIndex = CPMaxRange(aRange) - 1, rangeIndex = CEIL(assumedPositionOfIndex(_ranges, firstIndex)), lastRangeIndex = FLOOR(assumedPositionOfIndex(_ranges, lastIndex)); } @@ -419,7 +418,7 @@ { var range = _ranges[rangeIndex], index = MAX(firstIndex, range.location), - maxRange = MIN(lastIndex + 1, _CPMaxRange(range)); + maxRange = MIN(lastIndex + 1, CPMaxRange(range)); for (; index < maxRange; ++index) { @@ -498,12 +497,12 @@ { if (!_count) return; - [self enumerateIndexesInRange:CPMakeRange(0, _CPMaxRange(_ranges[_ranges.length - 1])) options:options usingBlock:aFunction]; + [self enumerateIndexesInRange:CPMakeRange(0, CPMaxRange(_ranges[_ranges.length - 1])) options:options usingBlock:aFunction]; } - (void)enumerateIndexesInRange:(CPRange)enumerationRange options:(CPEnumerationOptions)options usingBlock:(Function /*(int idx, @ref BOOL stop)*/)aFunction { - if (!_count || _CPEmptyRange(enumerationRange)) + if (!_count || CPEmptyRange(enumerationRange)) return; var shouldStop = NO, @@ -533,20 +532,20 @@ if (options & CPEnumerationReverse) { - rangeIndex = _CPMaxRange(range) - 1; + rangeIndex = CPMaxRange(range) - 1; rangeStop = range.location - 1; rangeIncrement = -1; } else { rangeIndex = range.location; - rangeStop = _CPMaxRange(range); + rangeStop = CPMaxRange(range); rangeIncrement = 1; } for (; rangeIndex !== rangeStop; rangeIndex += rangeIncrement) { - if (_CPLocationInRange(rangeIndex, enumerationRange)) + if (CPLocationInRange(rangeIndex, enumerationRange)) { aFunction(rangeIndex, @ref(shouldStop)); if (shouldStop) @@ -571,7 +570,7 @@ if (!_count) return CPNotFound; - return [self indexInRange:_CPMakeRange(0, _CPMaxRange(_ranges[_ranges.length - 1])) options:anOptions passingTest:aPredicate]; + return [self indexInRange:CPMakeRange(0, CPMaxRange(_ranges[_ranges.length - 1])) options:anOptions passingTest:aPredicate]; } - (CPIndexSet)indexesWithOptions:(CPEnumerationOptions)anOptions passingTest:(Function /*(int anIndex)*/)aPredicate @@ -579,12 +578,12 @@ if (!_count) return [CPIndexSet indexSet]; - return [self indexesInRange:_CPMakeRange(0, _CPMaxRange(_ranges[_ranges.length - 1])) options:anOptions passingTest:aPredicate]; + return [self indexesInRange:CPMakeRange(0, CPMaxRange(_ranges[_ranges.length - 1])) options:anOptions passingTest:aPredicate]; } - (unsigned)indexInRange:(CPRange)aRange options:(CPEnumerationOptions)anOptions passingTest:(Function /*(int anIndex)*/)aPredicate { - if (!_count || _CPEmptyRange(aRange)) + if (!_count || CPEmptyRange(aRange)) return CPNotFound; var shouldStop = NO, @@ -614,20 +613,20 @@ if (anOptions & CPEnumerationReverse) { - rangeIndex = _CPMaxRange(range) - 1; + rangeIndex = CPMaxRange(range) - 1; rangeStop = range.location - 1; rangeIncrement = -1; } else { rangeIndex = range.location; - rangeStop = _CPMaxRange(range); + rangeStop = CPMaxRange(range); rangeIncrement = 1; } for (; rangeIndex !== rangeStop; rangeIndex += rangeIncrement) { - if (_CPLocationInRange(rangeIndex, aRange)) + if (CPLocationInRange(rangeIndex, aRange)) { if (aPredicate(rangeIndex, @ref(shouldStop))) return rangeIndex; @@ -643,7 +642,7 @@ - (CPIndexSet)indexesInRange:(CPRange)aRange options:(CPEnumerationOptions)anOptions passingTest:(Function /*(int anIndex)*/)aPredicate { - if (!_count || _CPEmptyRange(aRange)) + if (!_count || CPEmptyRange(aRange)) return [CPIndexSet indexSet]; var shouldStop = NO, @@ -675,20 +674,20 @@ if (anOptions & CPEnumerationReverse) { - rangeIndex = _CPMaxRange(range) - 1; + rangeIndex = CPMaxRange(range) - 1; rangeStop = range.location - 1; rangeIncrement = -1; } else { rangeIndex = range.location; - rangeStop = _CPMaxRange(range); + rangeStop = CPMaxRange(range); rangeIncrement = 1; } for (; rangeIndex !== rangeStop; rangeIndex += rangeIncrement) { - if (_CPLocationInRange(rangeIndex, aRange)) + if (CPLocationInRange(rangeIndex, aRange)) { if (aPredicate(rangeIndex, @ref(shouldStop))) [indexesPassingTest addIndex:rangeIndex]; @@ -713,7 +712,7 @@ */ - (void)addIndex:(CPInteger)anIndex { - [self addIndexesInRange:_CPMakeRange(anIndex, 1)]; + [self addIndexesInRange:CPMakeRange(anIndex, 1)]; } /*! @@ -759,7 +758,7 @@ if (lhsRangeIndexCEIL === lhsRangeIndex && lhsRangeIndexCEIL < rangeCount) aRange = CPUnionRange(aRange, _ranges[lhsRangeIndexCEIL]); - var rhsRangeIndex = assumedPositionOfIndex(_ranges, _CPMaxRange(aRange)), + var rhsRangeIndex = assumedPositionOfIndex(_ranges, CPMaxRange(aRange)), rhsRangeIndexFLOOR = FLOOR(rhsRangeIndex); if (rhsRangeIndexFLOOR === rhsRangeIndex && rhsRangeIndexFLOOR >= 0) @@ -792,7 +791,7 @@ for (; removal <= lastRemoval; ++removal) _count -= _ranges[removal].length; - [_ranges removeObjectsInRange:_CPMakeRange(lhsRangeIndexCEIL, removalCount)]; + [_ranges removeObjectsInRange:CPMakeRange(lhsRangeIndexCEIL, removalCount)]; } [_ranges insertObject:aRange atIndex:lhsRangeIndexCEIL]; @@ -808,7 +807,7 @@ */ - (void)removeIndex:(CPInteger)anIndex { - [self removeIndexesInRange:_CPMakeRange(anIndex, 1)]; + [self removeIndexesInRange:CPMakeRange(anIndex, 1)]; } /*! @@ -862,8 +861,8 @@ // If these ranges don't start in the same place, we have to cull it. if (aRange.location !== existingRange.location) { - var maxRange = _CPMaxRange(aRange), - existingMaxRange = _CPMaxRange(existingRange); + var maxRange = CPMaxRange(aRange), + existingMaxRange = CPMaxRange(existingRange); existingRange.length = aRange.location - existingRange.location; @@ -871,7 +870,7 @@ if (maxRange < existingMaxRange) { _count -= aRange.length; - [_ranges insertObject:_CPMakeRange(maxRange, existingMaxRange - maxRange) atIndex:lhsRangeIndexCEIL + 1]; + [_ranges insertObject:CPMakeRange(maxRange, existingMaxRange - maxRange) atIndex:lhsRangeIndexCEIL + 1]; return; } @@ -883,14 +882,14 @@ } } - var rhsRangeIndex = assumedPositionOfIndex(_ranges, _CPMaxRange(aRange) - 1), + var rhsRangeIndex = assumedPositionOfIndex(_ranges, CPMaxRange(aRange) - 1), rhsRangeIndexFLOOR = FLOOR(rhsRangeIndex); if (rhsRangeIndex === rhsRangeIndexFLOOR && rhsRangeIndexFLOOR >= 0) { - var maxRange = _CPMaxRange(aRange), + var maxRange = CPMaxRange(aRange), existingRange = _ranges[rhsRangeIndexFLOOR], - existingMaxRange = _CPMaxRange(existingRange); + existingMaxRange = CPMaxRange(existingRange); if (maxRange !== existingMaxRange) { @@ -912,7 +911,7 @@ for (; removal <= lastRemoval; ++removal) _count -= _ranges[removal].length; - [_ranges removeObjectsInRange:_CPMakeRange(lhsRangeIndexCEIL, removalCount)]; + [_ranges removeObjectsInRange:CPMakeRange(lhsRangeIndexCEIL, removalCount)]; } } @@ -936,7 +935,7 @@ for (; i >= 0; --i) { var range = _ranges[i], - maximum = _CPMaxRange(range); + maximum = CPMaxRange(range); if (anIndex >= maximum) break; @@ -956,7 +955,7 @@ // If it's negative, it needs to be added properly later. else if (shifted.location < 0) { - shifted.length = _CPMaxRange(shifted); + shifted.length = CPMaxRange(shifted); shifted.location = 0; } @@ -967,8 +966,8 @@ // Shift the range, and normalize it if the result is negative. if ((range.location += aDelta) < 0) { - _count -= range.length - _CPMaxRange(range); - range.length = _CPMaxRange(range); + _count -= range.length - CPMaxRange(range); + range.length = CPMaxRange(range); range.location = 0; } } @@ -988,7 +987,7 @@ if ((j = i + 1) < count) { - [_ranges removeObjectsInRange:_CPMakeRange(j, count - j)]; + [_ranges removeObjectsInRange:CPMakeRange(j, count - j)]; for (j = 0, count = shifts.length; j < count; ++j) [self addIndexesInRange:shifts[j]]; @@ -1104,7 +1103,7 @@ var positionOfIndex = function(ranges, anIndex) if (anIndex < range.location) high = middle - 1; - else if (anIndex >= _CPMaxRange(range)) + else if (anIndex >= CPMaxRange(range)) low = middle + 1; else @@ -1132,7 +1131,7 @@ var assumedPositionOfIndex = function(ranges, anIndex) if (position === positionFLOOR) { - if (positionFLOOR - 1 >= 0 && anIndex < _CPMaxRange(ranges[positionFLOOR - 1])) + if (positionFLOOR - 1 >= 0 && anIndex < CPMaxRange(ranges[positionFLOOR - 1])) high = middle - 1; else if (positionFLOOR < count && anIndex >= ranges[positionFLOOR].location) @@ -1148,7 +1147,7 @@ var assumedPositionOfIndex = function(ranges, anIndex) if (anIndex < range.location) high = middle - 1; - else if (anIndex >= _CPMaxRange(range)) + else if (anIndex >= CPMaxRange(range)) low = middle + 1; else diff --git a/Foundation/CPRange.h b/Foundation/CPRange.h deleted file mode 100644 index ffd15058b..000000000 --- a/Foundation/CPRange.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * CPRange.h - * Foundation - * - * Created by Alexander Ljungberg. - * Copyright 2012, SlevenBits Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define _CPMaxRange(aRange) ((aRange).location + (aRange).length) -#define _CPMakeRange(aLocation, aLength) { location:(aLocation), length:aLength } -#define _CPMakeRangeCopy(aRange) { location:(aRange).location, length:(aRange).length } -#define _CPEmptyRange(aRange) ((aRange).length === 0) -#define _CPLocationInRange(aLocation, aRange) (((aLocation) >= (aRange).location) && ((aLocation) < _CPMaxRange(aRange))) diff --git a/Foundation/CPRange.j b/Foundation/CPRange.j index f9f09a3ae..c9f9c7c2a 100755 --- a/Foundation/CPRange.j +++ b/Foundation/CPRange.j @@ -20,10 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _function(inline) function inline { return _##inline; } - -#include "CPRange.h" - /*! @addtogroup foundation @{ @@ -36,7 +32,10 @@ @group CPRange @return CPRange the new range object */ -_function(CPMakeRange(location, length)) +function CPMakeRange(location, length) +{ + return { location:location, length:length }; +} /*! Makes a copy of a CPRange. @@ -44,7 +43,10 @@ _function(CPMakeRange(location, length)) @group CPRange @return CPRange the copy of the range */ -_function(CPMakeRangeCopy(aRange)) +function CPMakeRangeCopy(aRange) +{ + return { location:aRange.location, length:aRange.length }; +} /*! Determines if a range is empty \c length is 0. @@ -52,7 +54,10 @@ _function(CPMakeRangeCopy(aRange)) @group CPRange @return YES if the range is empty */ -_function(CPEmptyRange(aRange)) +function CPEmptyRange(aRange) +{ + return aRange.length === 0; +} /*! Finds the range maximum. (\c location + length) @@ -60,7 +65,10 @@ _function(CPEmptyRange(aRange)) @group CPRange @return int the range maximum */ -_function(CPMaxRange(aRange)) +function CPMaxRange(aRange) +{ + return aRange.location + aRange.length; +} /*! Determines if two CPRanges are equal. @@ -80,7 +88,10 @@ function CPEqualRanges(lhsRange, rhsRange) @group CPRange @return BOOL \c YES if \c aLocation is within the range */ -_function(CPLocationInRange(aLocation, aRange)) +function CPLocationInRange(aLocation, aRange) +{ + return ((aLocation >= aRange.location) && (aLocation < CPMaxRange(aRange))); +} /*! Creates a new range with the minimum \c location and a \c length diff --git a/Foundation/CPString.j b/Foundation/CPString.j index 1dd8c1526..dc04d6aa2 100644 --- a/Foundation/CPString.j +++ b/Foundation/CPString.j @@ -34,8 +34,6 @@ @global CPInvalidArgumentException @global CPRangeException -#define _CPMaxRange(aRange) ((aRange).location + (aRange).length) - /*! A case insensitive search @global @@ -305,7 +303,7 @@ var CPStringUIDs = new CFMutableDictionary(), */ - (CPString)substringWithRange:(CPRange)aRange { - if (aRange.location < 0 || _CPMaxRange(aRange) > self.length) + if (aRange.location < 0 || CPMaxRange(aRange) > self.length) [CPException raise:CPRangeException reason:"aRange out of bounds"]; return self.substr(aRange.location, aRange.length); diff --git a/Foundation/_CGGeometry.h b/Foundation/_CGGeometry.h deleted file mode 100644 index 48f91807d..000000000 --- a/Foundation/_CGGeometry.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * CGGeometry.h - * Foundation - * - * Created by Francisco Tolmasky. - * Copyright 2008, 280 North, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - -CGGeometry is not a part of Foundation. The reason _CGGeometry.h exists, and is in Foundation, is that CPGeometry and CGGeometry both use the same code so the shared basis needs to be in the lowest layer. If for some reason Cappuccino was ever reimplemented such that CPRect !== CGRect etc, this class could be removed and CPGeometry.j and CGGeometry.j updated with relevant functions without breaking any client code. - -*/ - -#define _CGPointMake(x_, y_) { x:x_, y:y_ } -#define _CGPointMakeCopy(aPoint) _CGPointMake(aPoint.x, aPoint.y) -#define _CGPointMakeZero() _CGPointMake(0.0, 0.0) - -#define _CGPointEqualToPoint(lhsPoint, rhsPoint) (lhsPoint.x == rhsPoint.x && lhsPoint.y == rhsPoint.y) -#define _CGStringFromPoint(aPoint) ("{" + aPoint.x + ", " + aPoint.y + "}") - -#define _CGSizeMake(width_, height_) { width:width_, height:height_ } -#define _CGSizeMakeCopy(aSize) _CGSizeMake(aSize.width, aSize.height) -#define _CGSizeMakeZero() _CGSizeMake(0.0, 0.0) - -#define _CGSizeEqualToSize(lhsSize, rhsSize) (lhsSize.width == rhsSize.width && lhsSize.height == rhsSize.height) -#define _CGStringFromSize(aSize) ("{" + aSize.width + ", " + aSize.height + "}") - -#define _CGRectMake(x, y, width, height) { origin: _CGPointMake(x, y), size: _CGSizeMake(width, height) } -#define _CGRectMakeZero() _CGRectMake(0.0, 0.0, 0.0, 0.0) -#define _CGRectMakeCopy(aRect) _CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height) -#define _CGRectCreateCopy(aRect) _CGRectMake(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height) - -#define _CGRectEqualToRect(lhsRect, rhsRect) (_CGPointEqualToPoint(lhsRect.origin, rhsRect.origin) && _CGSizeEqualToSize(lhsRect.size, rhsRect.size)) -#define _CGStringFromRect(aRect) ("{" + _CGStringFromPoint(aRect.origin) + ", " + _CGStringFromSize(aRect.size) + "}") - -#define _CGRectOffset(aRect, dX, dY) _CGRectMake(aRect.origin.x + dX, aRect.origin.y + dY, aRect.size.width, aRect.size.height) -#define _CGRectInset(aRect, dX, dY) _CGRectMake(aRect.origin.x + dX, aRect.origin.y + dY, aRect.size.width - 2 * dX, aRect.size.height - 2 * dY) - -/*! - Slow: - - var theInsetRect = _CGRectInsetByInset([self bounds], [self contentInset]); - - Fast: - - var aRect = [self bounds], - anInset = [self contentInset], - theInsetRect = _CGRectInsetByInset(aRect, anInset); -*/ -#define _CGRectInsetByInset(aRect, anInset) _CGRectMake((aRect).origin.x + (anInset).left, (aRect).origin.y + (anInset).top, (aRect).size.width - (anInset).left - (anInset).right, (aRect).size.height - (anInset).top - (anInset).bottom) - -#define _CGRectGetHeight(aRect) (aRect.size.height) -#define _CGRectGetMaxX(aRect) (aRect.origin.x + aRect.size.width) -#define _CGRectGetMaxY(aRect) (aRect.origin.y + aRect.size.height) -#define _CGRectGetMidX(aRect) (aRect.origin.x + (aRect.size.width) / 2.0) -#define _CGRectGetMidY(aRect) (aRect.origin.y + (aRect.size.height) / 2.0) -#define _CGRectGetMinX(aRect) (aRect.origin.x) -#define _CGRectGetMinY(aRect) (aRect.origin.y) -#define _CGRectGetWidth(aRect) (aRect.size.width) - -#define _CGRectIsEmpty(aRect) (aRect.size.width <= 0.0 || aRect.size.height <= 0.0) -#define _CGRectIsNull(aRect) (aRect.size.width <= 0.0 || aRect.size.height <= 0.0) - -#define _CGRectContainsPoint(aRect, aPoint) (aPoint.x >= _CGRectGetMinX(aRect) && aPoint.y >= _CGRectGetMinY(aRect) && aPoint.x < _CGRectGetMaxX(aRect) && aPoint.y < _CGRectGetMaxY(aRect)) - -#define _CGInsetMake(_top, _right, _bottom, _left) { top:(_top), right:(_right), bottom:(_bottom), left:(_left) } -#define _CGInsetMakeCopy(anInset) _CGInsetMake(anInset.top, anInset.right, anInset.bottom, anInset.left) -#define _CGInsetMakeInvertedCopy(anInset) _CGInsetMake(-anInset.top, -anInset.right, -anInset.bottom, -anInset.left) -#define _CGInsetMakeZero() _CGInsetMake(0, 0, 0, 0) -#define _CGInsetIsEmpty(anInset) ((anInset).top === 0 && (anInset).right === 0 && (anInset).bottom === 0 && (anInset).left === 0) -#define _CGInsetEqualToInset(lhsInset, rhsInset) ((lhsInset).top === (rhsInset).top && (lhsInset).right === (rhsInset).right && (lhsInset).bottom === (rhsInset).bottom && (lhsInset).left === (rhsInset).left) - -// DEPRECATED -#define _CGPointCreateCopy(aPoint) _CGPointMake(aPoint.x, aPoint.y) -#define _CGSizeCreateCopy(aSize) _CGSizeMake(aSize.width, aSize.height) diff --git a/Foundation/_CGGeometry.j b/Foundation/_CGGeometry.j index 7e99d5e2e..480e814ab 100644 --- a/Foundation/_CGGeometry.j +++ b/Foundation/_CGGeometry.j @@ -26,62 +26,207 @@ CGGeometry is not a part of Foundation. The reason _CGGeometry.j exists, and is */ -#define _function(inline) function inline { return _##inline; } +function CGPointMake(x, y) +{ + return { x:x, y:y }; +} -_function(CGPointMake(x, y)) -_function(CGPointMakeZero()) -_function(CGPointMakeCopy(aPoint)) -_function(CGPointCreateCopy(aPoint)) +function CGPointMakeZero() +{ + return { x:0, y:0 }; +} -_function(CGPointEqualToPoint(lhsPoint, rhsPoint)) -_function(CGStringFromPoint(aPoint)) +function CGPointMakeCopy(aPoint) +{ + return { x:aPoint.x, y:aPoint.y }; +} -_function(CGSizeMake(width, height)) -_function(CGSizeMakeZero()) -_function(CGSizeMakeCopy(aSize)) -_function(CGSizeCreateCopy(aSize)) +CGPointCreateCopy = CGPointMakeCopy; -_function(CGSizeEqualToSize(lhsSize, rhsSize)) -_function(CGStringFromSize(aSize)) +function CGPointEqualToPoint(lhsPoint, rhsPoint) +{ + return (lhsPoint.x == rhsPoint.x && lhsPoint.y == rhsPoint.y); +} -_function(CGRectMake(x, y, width, height)) -_function(CGRectMakeZero()) -_function(CGRectMakeCopy(aRect)) -_function(CGRectCreateCopy(aRect)) +function CGStringFromPoint(aPoint) +{ + return "{" + aPoint.x + ", " + aPoint.y + "}"; +} -_function(CGRectEqualToRect(lhsRect, rhsRect)) -_function(CGStringFromRect(aRect)) -_function(CGRectOffset(aRect, dX, dY)) -_function(CGRectInset(aRect, dX, dY)) +function CGSizeMake(width, height) +{ + return { width:width, height:height }; +} -_function(CGRectGetHeight(aRect)) -_function(CGRectGetMaxX(aRect)) -_function(CGRectGetMaxY(aRect)) -_function(CGRectGetMidX(aRect)) -_function(CGRectGetMidY(aRect)) -_function(CGRectGetMinX(aRect)) -_function(CGRectGetMinY(aRect)) -_function(CGRectGetWidth(aRect)) +function CGSizeMakeZero() +{ + return { width:0, height:0 }; +} -_function(CGRectIsEmpty(aRect)) -_function(CGRectIsNull(aRect)) +function CGSizeMakeCopy(aSize) +{ + return { width:aSize.width, height:aSize.height }; +} -_function(CGRectContainsPoint(aRect, aPoint)) +CGSizeCreateCopy = CGSizeMakeCopy; -_function(CGInsetMake(top, right, bottom, left)) -_function(CGInsetMakeZero()) -_function(CGInsetMakeCopy(anInset)) -_function(CGInsetMakeInvertedCopy(anInset)) -_function(CGInsetIsEmpty(anInset)) -_function(CGInsetEqualToInset(lhsInset, rhsInset)) +function CGSizeEqualToSize(lhsSize, rhsSize) +{ + return (lhsSize.width == rhsSize.width && lhsSize.height == rhsSize.height); +} + +function CGStringFromSize(aSize) +{ + return "{" + aSize.width + ", " + aSize.height + "}"; +} + + +function CGRectMake(x, y, width, height) +{ + return { origin:{ x:x, y:y }, size:{ width:width, height:height } }; +} + +function CGRectMakeZero() +{ + return { origin:{ x:0, y:0 }, size:{ width:0, height:0 } }; +} + +function CGRectMakeCopy(aRect) +{ + return { origin:{ x:aRect.origin.x, y:aRect.origin.y }, size:{ width:aRect.size.width, height:aRect.size.height } }; +} + +CGRectCreateCopy = CGRectMakeCopy; + +function CGRectEqualToRect(lhsRect, rhsRect) +{ + return (lhsRect.origin.x == rhsRect.origin.x && + lhsRect.origin.y == rhsRect.origin.y && + lhsRect.size.width == rhsRect.size.width && + lhsRect.size.height == rhsRect.size.height); +} + +function CGStringFromRect(aRect) +{ + return "{" + CGStringFromPoint(aRect.origin) + ", " + CGStringFromSize(aRect.size) + "}"; +} + + +function CGRectOffset(aRect, dX, dY) +{ + return { origin:{ x:aRect.origin.x + dX, y:aRect.origin.y + dY }, size:{ width:aRect.size.width, height:aRect.size.height } }; +} + +function CGRectInset(aRect, dX, dY) +{ + return { origin:{ x:aRect.origin.x + dX, y:aRect.origin.y + dY }, size:{ width:aRect.size.width - 2 * dX, height:aRect.size.height - 2 * dY } }; +} + + +function CGRectGetHeight(aRect) +{ + return aRect.size.height; +} + +function CGRectGetMaxX(aRect) +{ + return aRect.origin.x + aRect.size.width; +} + +function CGRectGetMaxY(aRect) +{ + return aRect.origin.y + aRect.size.height; +} + +function CGRectGetMidX(aRect) +{ + return aRect.origin.x + (aRect.size.width / 2.0); +} + +function CGRectGetMidY(aRect) +{ + return aRect.origin.y + (aRect.size.height / 2.0); +} + +function CGRectGetMinX(aRect) +{ + return aRect.origin.x; +} + +function CGRectGetMinY(aRect) +{ + return aRect.origin.y; +} + +function CGRectGetWidth(aRect) +{ + return aRect.size.width; +} + + +function CGRectIsEmpty(aRect) +{ + return (aRect.size.width <= 0.0 || aRect.size.height <= 0.0 || aRect.origin.x === Infinity || aRect.origin.y === Infinity); +} + +function CGRectIsNull(aRect) +{ + return (aRect.origin.x === Infinity || aRect.origin.y === Infinity); +} + + +function CGRectContainsPoint(aRect, aPoint) +{ + return (aPoint.x >= aRect.origin.x && + aPoint.y >= aRect.origin.y && + aPoint.x < CGRectGetMaxX(aRect) && + aPoint.y < CGRectGetMaxY(aRect)); +} + + +function CGInsetMake(top, right, bottom, left) +{ + return { top:top, right:right, bottom:bottom, left:left }; +} + +function CGInsetMakeZero() +{ + return { top:0, right:0, bottom:0, left:0 }; +} + +function CGInsetMakeCopy(anInset) +{ + return { top:anInset.top, right:anInset.right, bottom:anInset.bottom, left:anInset.left }; +} + +function CGInsetMakeInvertedCopy(anInset) +{ + return { top:-anInset.top, right:-anInset.right, bottom:-anInset.bottom, left:-anInset.left }; +} + +function CGInsetIsEmpty(anInset) +{ + return (anInset.top === 0 && + anInset.right === 0 && + anInset.bottom === 0 && + anInset.left === 0); +} + +function CGInsetEqualToInset(lhsInset, rhsInset) +{ + return (lhsInset.top === (rhsInset).top && + lhsInset.right === rhsInset.right && + lhsInset.bottom === rhsInset.bottom && + lhsInset.left === rhsInset.left); +} CGMinXEdge = 0; CGMinYEdge = 1; CGMaxXEdge = 2; CGMaxYEdge = 3; -CGRectNull = _CGRectMake(Infinity, Infinity, 0.0, 0.0); +CGRectNull = CGRectMake(Infinity, Infinity, 0.0, 0.0); /*! @addtogroup appkit @@ -100,10 +245,10 @@ CGRectNull = _CGRectMake(Infinity, Infinity, 0.0, 0.0); */ function CGRectDivide(inRect, slice, rem, amount, edge) { - slice.origin = _CGPointMakeCopy(inRect.origin); - slice.size = _CGSizeMakeCopy(inRect.size); - rem.origin = _CGPointMakeCopy(inRect.origin); - rem.size = _CGSizeMakeCopy(inRect.size); + slice.origin = CGPointMakeCopy(inRect.origin); + slice.size = CGSizeMakeCopy(inRect.size); + rem.origin = CGPointMakeCopy(inRect.origin); + rem.size = CGSizeMakeCopy(inRect.size); switch (edge) { @@ -114,7 +259,7 @@ function CGRectDivide(inRect, slice, rem, amount, edge) break; case CGMaxXEdge: - slice.origin.x = _CGRectGetMaxX(slice) - amount; + slice.origin.x = CGRectGetMaxX(slice) - amount; slice.size.width = amount; rem.size.width -= amount; break; @@ -126,7 +271,7 @@ function CGRectDivide(inRect, slice, rem, amount, edge) break; case CGMaxYEdge: - slice.origin.y = _CGRectGetMaxY(slice) - amount; + slice.origin.y = CGRectGetMaxY(slice) - amount; slice.size.height = amount; rem.size.height -= amount; } @@ -144,7 +289,7 @@ function CGRectContainsRect(lhsRect, rhsRect) { var union = CGRectUnion(lhsRect, rhsRect); - return _CGRectEqualToRect(union, lhsRect); + return CGRectEqualToRect(union, lhsRect); } /*! @@ -158,7 +303,7 @@ function CGRectIntersectsRect(lhsRect, rhsRect) { var intersection = CGRectIntersection(lhsRect, rhsRect); - return !_CGRectIsEmpty(intersection); + return !CGRectIsEmpty(intersection); } /*! @@ -173,11 +318,11 @@ function CGRectIntegral(aRect) aRect = CGRectStandardize(aRect); // Store these out separately, if not the GetMaxes will return incorrect values. - var x = FLOOR(_CGRectGetMinX(aRect)), - y = FLOOR(_CGRectGetMinY(aRect)); + var x = FLOOR(CGRectGetMinX(aRect)), + y = FLOOR(CGRectGetMinY(aRect)); - aRect.size.width = CEIL(_CGRectGetMaxX(aRect)) - x; - aRect.size.height = CEIL(_CGRectGetMaxY(aRect)) - y; + aRect.size.width = CEIL(CGRectGetMaxX(aRect)) - x; + aRect.size.height = CEIL(CGRectGetMaxY(aRect)) - y; aRect.origin.x = x; aRect.origin.y = y; @@ -194,15 +339,14 @@ function CGRectIntegral(aRect) */ function CGRectIntersection(lhsRect, rhsRect) { - var intersection = _CGRectMake( - MAX(_CGRectGetMinX(lhsRect), _CGRectGetMinX(rhsRect)), - MAX(_CGRectGetMinY(lhsRect), _CGRectGetMinY(rhsRect)), - 0, 0); + var intersection = CGRectMake(MAX(CGRectGetMinX(lhsRect), CGRectGetMinX(rhsRect)), + MAX(CGRectGetMinY(lhsRect), CGRectGetMinY(rhsRect)), + 0, 0); - intersection.size.width = MIN(_CGRectGetMaxX(lhsRect), _CGRectGetMaxX(rhsRect)) - _CGRectGetMinX(intersection); - intersection.size.height = MIN(_CGRectGetMaxY(lhsRect), _CGRectGetMaxY(rhsRect)) - _CGRectGetMinY(intersection); + intersection.size.width = MIN(CGRectGetMaxX(lhsRect), CGRectGetMaxX(rhsRect)) - CGRectGetMinX(intersection); + intersection.size.height = MIN(CGRectGetMaxY(lhsRect), CGRectGetMaxY(rhsRect)) - CGRectGetMinY(intersection); - return _CGRectIsEmpty(intersection) ? _CGRectMakeZero() : intersection; + return CGRectIsEmpty(intersection) ? CGRectMakeZero() : intersection; } /* @@ -210,9 +354,9 @@ function CGRectIntersection(lhsRect, rhsRect) */ function CGRectStandardize(aRect) { - var width = _CGRectGetWidth(aRect), - height = _CGRectGetHeight(aRect), - standardized = _CGRectMakeCopy(aRect); + var width = CGRectGetWidth(aRect), + height = CGRectGetHeight(aRect), + standardized = CGRectMakeCopy(aRect); if (width < 0.0) { @@ -240,12 +384,12 @@ function CGRectUnion(lhsRect, rhsRect) if (rhsRectIsNull) return lhsRectIsNull ? CGRectNull : lhsRect; - var minX = MIN(_CGRectGetMinX(lhsRect), _CGRectGetMinX(rhsRect)), - minY = MIN(_CGRectGetMinY(lhsRect), _CGRectGetMinY(rhsRect)), - maxX = MAX(_CGRectGetMaxX(lhsRect), _CGRectGetMaxX(rhsRect)), - maxY = MAX(_CGRectGetMaxY(lhsRect), _CGRectGetMaxY(rhsRect)); + var minX = MIN(CGRectGetMinX(lhsRect), CGRectGetMinX(rhsRect)), + minY = MIN(CGRectGetMinY(lhsRect), CGRectGetMinY(rhsRect)), + maxX = MAX(CGRectGetMaxX(lhsRect), CGRectGetMaxX(rhsRect)), + maxY = MAX(CGRectGetMaxY(lhsRect), CGRectGetMaxY(rhsRect)); - return _CGRectMake(minX, minY, maxX - minX, maxY - minY); + return CGRectMake(minX, minY, maxX - minX, maxY - minY); } /*! @@ -254,7 +398,13 @@ function CGRectUnion(lhsRect, rhsRect) @param anInset a CGInset to inset by @return CGRect aRect inset by anInset */ -_function(CGRectInsetByInset(aRect, anInset)); +function CGRectInsetByInset(aRect, anInset) +{ + return CGRectMake(aRect.origin.x + anInset.left, + aRect.origin.y + anInset.top, + aRect.size.width - anInset.left - anInset.right, + aRect.size.height - anInset.top - anInset.bottom); +} function CGPointFromString(aString) { @@ -279,7 +429,7 @@ function CGRectFromString(aString) function CGPointFromEvent(anEvent) { - return _CGPointMake(anEvent.clientX, anEvent.clientY); + return CGPointMake(anEvent.clientX, anEvent.clientY); } /*! @@ -289,10 +439,10 @@ function CGPointFromEvent(anEvent) */ function CGInsetUnion(lhsInset, rhsInset) { - return _CGInsetMake(lhsInset.top + rhsInset.top, - lhsInset.right + rhsInset.right, - lhsInset.bottom + rhsInset.bottom, - lhsInset.left + rhsInset.left); + return CGInsetMake(lhsInset.top + rhsInset.top, + lhsInset.right + rhsInset.right, + lhsInset.bottom + rhsInset.bottom, + lhsInset.left + rhsInset.left); } /*! @@ -302,24 +452,24 @@ function CGInsetUnion(lhsInset, rhsInset) */ function CGInsetDifference(lhsInset, rhsInset) { - return _CGInsetMake(lhsInset.top - rhsInset.top, - lhsInset.right - rhsInset.right, - lhsInset.bottom - rhsInset.bottom, - lhsInset.left - rhsInset.left); + return CGInsetMake(lhsInset.top - rhsInset.top, + lhsInset.right - rhsInset.right, + lhsInset.bottom - rhsInset.bottom, + lhsInset.left - rhsInset.left); } function CGInsetFromString(aString) { var numbers = aString.substr(1, aString.length - 2).split(','); - return _CGInsetMake(parseFloat(numbers[0]), parseFloat(numbers[1]), parseFloat(numbers[2]), parseFloat(numbers[3])); + return CGInsetMake(parseFloat(numbers[0]), parseFloat(numbers[1]), parseFloat(numbers[2]), parseFloat(numbers[3])); } CGInsetFromCPString = CGInsetFromString; function CPStringFromCGInset(anInset) { - return '{' + anInset.top + ", " + anInset.left + ", " + anInset.bottom + ", " + anInset.right + '}'; + return "{" + anInset.top + ", " + anInset.left + ", " + anInset.bottom + ", " + anInset.right + "}"; } /*! diff --git a/Tests/AppKit/CPBrowserTest.j b/Tests/AppKit/CPBrowserTest.j index 0ff38a0fb..420dfb279 100644 --- a/Tests/AppKit/CPBrowserTest.j +++ b/Tests/AppKit/CPBrowserTest.j @@ -101,4 +101,4 @@ [aCoder encodeObject:entries forKey:"entries"]; } -@end \ No newline at end of file +@end diff --git a/Tests/Foundation/CPGeometryTest.j b/Tests/Foundation/CPGeometryTest.j index 2aa9fb909..b902744b0 100644 --- a/Tests/Foundation/CPGeometryTest.j +++ b/Tests/Foundation/CPGeometryTest.j @@ -38,6 +38,7 @@ - (void)textCPRectIsEmpty { + [self assertTrue:CPRectIsEmpty(CGRectMake(Infinity, 0, 10, 10))]; [self assertTrue:CPRectIsEmpty(CGRectMake(0, 0, 0, 10))]; [self assertTrue:CPRectIsEmpty(CGRectMake(0, 0, 10, 0))]; [self assertTrue:CPRectIsEmpty(CGRectMake(0, 0, -10, 10))]; @@ -217,10 +218,10 @@ - (void)testCPRectIsNull { - [self assertTrue:CPRectIsNull(CGRectMake(0, 0, 0, 10))]; - [self assertTrue:CPRectIsNull(CGRectMake(0, 0, 10, 0))]; - [self assertTrue:CPRectIsNull(CGRectMake(0, 0, -10, 10))]; - [self assertTrue:CPRectIsNull(CGRectMake(0, 0, 10, -10))]; + [self assertFalse:CPRectIsNull(CGRectMake(0, 0, 0, 10))]; + [self assertTrue:CPRectIsNull(CGRectMake(Infinity, 0, 0, 0))]; + [self assertTrue:CPRectIsNull(CGRectMake(0, Infinity, -10, 10))]; + [self assertFalse:CPRectIsNull(CGRectMake(0, 0, 10, -10))]; [self assertFalse:CPRectIsNull(CGRectMake(0, 0, 10, 10))]; }