Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into CPTableView-conte…
Browse files Browse the repository at this point in the history
…nt-binding
  • Loading branch information
cacaodev committed May 26, 2012
2 parents db8f2fd + 02b65e6 commit 086c0e6
Show file tree
Hide file tree
Showing 27 changed files with 629 additions and 376 deletions.
2 changes: 1 addition & 1 deletion AppKit/CPAnimation.j
Expand Up @@ -307,7 +307,7 @@ ACTUAL_FRAME_RATE = 0;

if ([_delegate respondsToSelector:@selector(animation:valueForProgress:)])
return [_delegate animation:self valueForProgress:t];

if (_animationCurve == CPAnimationLinear)
return t;

Expand Down
8 changes: 6 additions & 2 deletions AppKit/CPCookie.j
Expand Up @@ -111,8 +111,12 @@
for (var i = 0; i < ca.length; i++)
{
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);

while (c.charAt(0) == ' ')
c = c.substring(1, c.length);

if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length, c.length);
}
#endif
return "";
Expand Down
7 changes: 5 additions & 2 deletions AppKit/CPGraphics.j
Expand Up @@ -70,7 +70,10 @@ function CPDrawColorTiledRects(
if (_CGRectIsEmpty(slice))
continue;

var minX, maxX, minY, maxY;
var minX,
maxX,
minY,
maxY;

if (side == CPMinXEdge || side == CPMaxXEdge)
{
Expand Down Expand Up @@ -105,4 +108,4 @@ function CPDrawColorTiledRects(
CGContextRestoreGState(context);

return resultRect;
}
}
2 changes: 1 addition & 1 deletion AppKit/CPLevelIndicator.j
Expand Up @@ -253,7 +253,7 @@ var _CPLevelIndicatorBezelColor = nil,

var location = [self convertPoint:[anEvent locationInWindow] fromView:nil],
bounds = [self bounds],
oldValue = [self doubleValue];
oldValue = [self doubleValue],
newValue = oldValue;

// Moving the mouse outside of the widget to the left sets it
Expand Down
4 changes: 2 additions & 2 deletions AppKit/CPPopover.j
Expand Up @@ -296,7 +296,7 @@ Set the behavior of the CPPopover. It can be:
/*! @ignore */
- (BOOL)attachedWindowShouldClose:(_CPAttachedWindow)anAttachedWindow
{
[self close];
[self performClose:self];

// We return NO, because we want the CPPopover to determine
// if the attached window can be closed and to give us a chance
Expand Down Expand Up @@ -375,4 +375,4 @@ var CPPopoverNeedsNewAttachedWindowKey = @"CPPopoverNeedsNewAttachedWindowKey",
[aCoder encodeInt:_behavior forKey:CPPopoverBehaviorKey];
}

@end
@end
3 changes: 2 additions & 1 deletion AppKit/CPRuleEditor/CPPredicateEditorRowTemplate.j
Expand Up @@ -185,7 +185,8 @@ CPTransformableAttributeType = 1800;
if (![[self operators] containsObject:[predicate predicateOperatorType]])
return 0;

if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]]) return 0;
if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]])
return 0;

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion AppKit/CPSplitView.j
Expand Up @@ -1065,7 +1065,7 @@ The sum of the views and the sum of the dividers should be equal to the size of
*/
- (void)_autosave
{
if (!_shouldAutosave || !autosaveName)
if (!_shouldAutosave || !_autosaveName)
return;

var userDefaults = [CPUserDefaults standardUserDefaults],
Expand Down
4 changes: 2 additions & 2 deletions AppKit/CPWindow/_CPDocModalWindowView.j
Expand Up @@ -24,7 +24,7 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
if (self)
{
var theClass = [self class],
bounds = [self bounds];
bounds = [self bounds];

_bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))];

Expand Down Expand Up @@ -54,4 +54,4 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
return aContentRect;
}

@end
@end
4 changes: 2 additions & 2 deletions AppKit/Cib/CPCibHelpConnector.j
Expand Up @@ -25,8 +25,8 @@
@implementation CPCibHelpConnector : CPCibConnector
{
id _destination;
id _file;
id _marker;
id _file;
id _marker;
}

- (id)initWithCoder:(CPCoder)aCoder
Expand Down
2 changes: 1 addition & 1 deletion AppKit/CoreGraphics/CGColorSpace.j
Expand Up @@ -193,7 +193,7 @@ function CGColorSpaceRetain(aColorSpace)
}

// FIXME: We should refer to some default values.
#define STANDARDIZE(components, index, minimum, maximum, multiplier) \
#define STANDARDIZE(components, index, minimum, maximum, multiplier) \
{ \
if (index > components.length) \
{ \
Expand Down
4 changes: 2 additions & 2 deletions AppKit/CoreGraphics/CGGeometry.j
Expand Up @@ -245,14 +245,14 @@ function CGPointFromString(aString)
{
var comma = aString.indexOf(',');

return { x:parseInt(aString.substr(1, comma - 1)), y:parseInt(aString.substring(comma + 1, aString.length)) };
return { x:parseFloat(aString.substr(1, comma - 1)), y:parseFloat(aString.substring(comma + 1, aString.length)) };
}

function CGSizeFromString(aString)
{
var comma = aString.indexOf(',');

return { width:parseInt(aString.substr(1, comma - 1)), height:parseInt(aString.substring(comma + 1, aString.length)) };
return { width:parseFloat(aString.substr(1, comma - 1)), height:parseFloat(aString.substring(comma + 1, aString.length)) };
}

function CGRectFromString(aString)
Expand Down
10 changes: 4 additions & 6 deletions AppKit/Themes/Default/AppController.j
Expand Up @@ -31,9 +31,8 @@
[_CPCibCustomResource imageResourceWithName:"horizontal-track-center.png" size:CPSizeMake(1.0, 4.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-right.png" size:CPSizeMake(2.0, 4.0)]
]
isVertical:NO]];

var horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)];
isVertical:NO]],
horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)];

[horizontalSlider setTrackWidth:4.0];
[horizontalSlider setHorizontalTrackColor:horizontalTrackColor];
Expand All @@ -55,9 +54,8 @@
[_CPCibCustomResource imageResourceWithName:"vertical-track-center.png" size:CPSizeMake(4.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CPSizeMake(4.0, 2.0)]
]
isVertical:YES]];

var verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)];
isVertical:YES]],
verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)];

[verticalSlider setTrackWidth:4];
[verticalSlider setVerticalTrackColor:verticalTrackColor];
Expand Down
2 changes: 1 addition & 1 deletion Foundation/CPDate.j
Expand Up @@ -245,7 +245,7 @@ Date.parseISO8601 = function (date)

if (isNaN(timestamp) && (struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date)))
{
// avoid NaN timestamps caused by undefined values being passed to Date.UTC
// avoid NaN timestamps caused by "undefined" values being passed to Date.UTC
for (var i = 0, k; (k = numericKeys[i]); ++i)
struct[k] = +struct[k] || 0;

Expand Down
5 changes: 2 additions & 3 deletions Foundation/CPDecimal.j
Expand Up @@ -181,7 +181,7 @@ function CPDecimalMakeWithParts(mantissa, exponent)
var m = [],
isNegative = NO;

if (mantissa < 0 )
if (mantissa < 0)
{
isNegative = YES;
mantissa = ABS(mantissa);
Expand Down Expand Up @@ -1400,10 +1400,9 @@ function CPDecimalRound(result, dcm, scale ,roundingMode)
function CPDecimalCompact(dcm)
{
// if positive or zero exp leading zeros simply delete, trailing ones u need to increment exponent
if (!dcm || dcm._mantissa.length == 0 || CPDecimalIsNotANumber(dcm) )
if (!dcm || dcm._mantissa.length == 0 || CPDecimalIsNotANumber(dcm))
return;


if (CPDecimalIsZero(dcm))
{
// handle zero number compacting
Expand Down
36 changes: 24 additions & 12 deletions Foundation/CPNumber.j
Expand Up @@ -222,7 +222,8 @@ FIXME: Do we need this?

- (CPString)descriptionWithLocale:(CPDictionary)aDictionary
{
if (!aDictionary) return toString();
if (!aDictionary)
return toString();

throw new Error("descriptionWithLocale: NOT YET IMPLEMENTED");
}
Expand All @@ -234,37 +235,43 @@ FIXME: Do we need this?

- (double)doubleValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (float)floatValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (int)intValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (long long)longLongValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (long)longValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (short)shortValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

Expand All @@ -280,7 +287,8 @@ FIXME: Do we need this?

- (unsigned int)unsignedIntValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}
/*
Expand All @@ -292,20 +300,24 @@ FIXME: Do we need this?
*/
- (unsigned long)unsignedLongValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (unsigned short)unsignedShortValue
{
if (typeof self == "boolean") return self ? 1 : 0;
if (typeof self == "boolean")
return self ? 1 : 0;
return self;
}

- (CPComparisonResult)compare:(CPNumber)aNumber
{
if (self > aNumber) return CPOrderedDescending;
else if (self < aNumber) return CPOrderedAscending;
if (self > aNumber)
return CPOrderedDescending;
else if (self < aNumber)
return CPOrderedAscending;

return CPOrderedSame;
}
Expand Down
2 changes: 1 addition & 1 deletion Foundation/CPScanner.j
Expand Up @@ -292,7 +292,7 @@

loc += (""+f).length;
var i = 0;
while (!isNaN(parseFloat(str.substring(loc+i, str.length))))
while (!isNaN(parseFloat(str.substring(loc + i, str.length))))
{i++;}

[self setScanLocation:loc + i];
Expand Down

0 comments on commit 086c0e6

Please sign in to comment.