Format code, fix accidental global.

This commit is contained in:
Alexander Ljungberg committed 2012-05-25 00:04:46 +01:00
1 parent 9ffaf538e2
commit aa4eff9f8d
8 files changed
+37 -27

No files matched your search

+1 -1
View File
@@ -253,7 +253,7 @@ var _CPLevelIndicatorBezelColor = nil,
var location = [self convertPoint:[anEvent locationInWindow] fromView:nil], var location = [self convertPoint:[anEvent locationInWindow] fromView:nil],
bounds = [self bounds], bounds = [self bounds],
oldValue = [self doubleValue]; oldValue = [self doubleValue],
newValue = oldValue; newValue = oldValue;
// Moving the mouse outside of the widget to the left sets it // Moving the mouse outside of the widget to the left sets it
@@ -185,7 +185,8 @@ CPTransformableAttributeType = 1800;
if (![[self operators] containsObject:[predicate predicateOperatorType]]) if (![[self operators] containsObject:[predicate predicateOperatorType]])
return 0; return 0;
if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]]) return 0; if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]])
return 0;
return 1; return 1;
} }
+2 -2
View File
@@ -24,7 +24,7 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
if (self) if (self)
{ {
var theClass = [self class], var theClass = [self class],
bounds = [self bounds]; 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))];
@@ -54,4 +54,4 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
return aContentRect; return aContentRect;
} }
@end @end
+4 -6
View File
@@ -31,9 +31,8 @@
[_CPCibCustomResource imageResourceWithName:"horizontal-track-center.png" size:CPSizeMake(1.0, 4.0)], [_CPCibCustomResource imageResourceWithName:"horizontal-track-center.png" size:CPSizeMake(1.0, 4.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-right.png" size:CPSizeMake(2.0, 4.0)] [_CPCibCustomResource imageResourceWithName:"horizontal-track-right.png" size:CPSizeMake(2.0, 4.0)]
] ]
isVertical:NO]]; isVertical:NO]],
horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)];
var horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)];
[horizontalSlider setTrackWidth:4.0]; [horizontalSlider setTrackWidth:4.0];
[horizontalSlider setHorizontalTrackColor:horizontalTrackColor]; [horizontalSlider setHorizontalTrackColor:horizontalTrackColor];
@@ -55,9 +54,8 @@
[_CPCibCustomResource imageResourceWithName:"vertical-track-center.png" size:CPSizeMake(4.0, 1.0)], [_CPCibCustomResource imageResourceWithName:"vertical-track-center.png" size:CPSizeMake(4.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CPSizeMake(4.0, 2.0)] [_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CPSizeMake(4.0, 2.0)]
] ]
isVertical:YES]]; isVertical:YES]],
verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)];
var verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)];
[verticalSlider setTrackWidth:4]; [verticalSlider setTrackWidth:4];
[verticalSlider setVerticalTrackColor:verticalTrackColor]; [verticalSlider setVerticalTrackColor:verticalTrackColor];
+1 -1
View File
@@ -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))) 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) for (var i = 0, k; (k = numericKeys[i]); ++i)
struct[k] = +struct[k] || 0; struct[k] = +struct[k] || 0;
+2 -3
View File
@@ -181,7 +181,7 @@ function CPDecimalMakeWithParts(mantissa, exponent)
var m = [], var m = [],
isNegative = NO; isNegative = NO;
if (mantissa < 0 ) if (mantissa < 0)
{ {
isNegative = YES; isNegative = YES;
mantissa = ABS(mantissa); mantissa = ABS(mantissa);
@@ -1400,10 +1400,9 @@ function CPDecimalRound(result, dcm, scale ,roundingMode)
function CPDecimalCompact(dcm) function CPDecimalCompact(dcm)
{ {
// if positive or zero exp leading zeros simply delete, trailing ones u need to increment exponent // 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; return;
if (CPDecimalIsZero(dcm)) if (CPDecimalIsZero(dcm))
{ {
// handle zero number compacting // handle zero number compacting
+24 -12
View File
@@ -222,7 +222,8 @@ FIXME: Do we need this?
- (CPString)descriptionWithLocale:(CPDictionary)aDictionary - (CPString)descriptionWithLocale:(CPDictionary)aDictionary
{ {
if (!aDictionary) return toString(); if (!aDictionary)
return toString();
throw new Error("descriptionWithLocale: NOT YET IMPLEMENTED"); throw new Error("descriptionWithLocale: NOT YET IMPLEMENTED");
} }
@@ -234,37 +235,43 @@ FIXME: Do we need this?
- (double)doubleValue - (double)doubleValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (float)floatValue - (float)floatValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (int)intValue - (int)intValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (long long)longLongValue - (long long)longLongValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (long)longValue - (long)longValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (short)shortValue - (short)shortValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
@@ -280,7 +287,8 @@ FIXME: Do we need this?
- (unsigned int)unsignedIntValue - (unsigned int)unsignedIntValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
/* /*
@@ -292,20 +300,24 @@ FIXME: Do we need this?
*/ */
- (unsigned long)unsignedLongValue - (unsigned long)unsignedLongValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (unsigned short)unsignedShortValue - (unsigned short)unsignedShortValue
{ {
if (typeof self == "boolean") return self ? 1 : 0; if (typeof self == "boolean")
return self ? 1 : 0;
return self; return self;
} }
- (CPComparisonResult)compare:(CPNumber)aNumber - (CPComparisonResult)compare:(CPNumber)aNumber
{ {
if (self > aNumber) return CPOrderedDescending; if (self > aNumber)
else if (self < aNumber) return CPOrderedAscending; return CPOrderedDescending;
else if (self < aNumber) return
CPOrderedAscending;
return CPOrderedSame; return CPOrderedSame;
} }
+1 -1
View File
@@ -292,7 +292,7 @@
loc += (""+f).length; loc += (""+f).length;
var i = 0; var i = 0;
while (!isNaN(parseFloat(str.substring(loc+i, str.length)))) while (!isNaN(parseFloat(str.substring(loc + i, str.length))))
{i++;} {i++;}
[self setScanLocation:loc + i]; [self setScanLocation:loc + i];