Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Antoine Mercadal
2012-06-12 11:59:26 -07:00
59 changed files with 7718 additions and 533 deletions
+1 -1
View File
@@ -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;
+9 -10
View File
@@ -219,28 +219,22 @@ CPRunContinuesResponse = -1002;
// At this point we clear the window.status to eliminate Safari's "Cancelled" error message
// The message shouldn't be displayed, because only an XHR is cancelled, but it is a usability issue.
// We do it here so that applications can change it in willFinish or didFinishLaunching
#if PLATFORM(DOM)
window.status = " ";
#endif
// We also want to set the default cursor on the body, so that buttons and things don't have an iBeam
[[CPCursor arrowCursor] set];
var bundle = [CPBundle mainBundle],
types = [bundle objectForInfoDictionaryKey:@"CPBundleDocumentTypes"];
if ([types count] > 0)
_documentController = [CPDocumentController sharedDocumentController];
var delegateClassName = [bundle objectForInfoDictionaryKey:@"CPApplicationDelegateClass"];
delegateClassName = [bundle objectForInfoDictionaryKey:@"CPApplicationDelegateClass"];
if (delegateClassName)
{
var delegateClass = objj_getClass(delegateClassName);
if (delegateClass)
if ([_documentController class] == delegateClass)
[self setDelegate:_documentController];
else
[self setDelegate:[[delegateClass alloc] init]];
[self setDelegate:[[delegateClass alloc] init]];
}
var defaultCenter = [CPNotificationCenter defaultCenter];
@@ -249,6 +243,11 @@ CPRunContinuesResponse = -1002;
postNotificationName:CPApplicationWillFinishLaunchingNotification
object:self];
var types = [bundle objectForInfoDictionaryKey:@"CPBundleDocumentTypes"];
if ([types count] > 0)
_documentController = [CPDocumentController sharedDocumentController];
var needsUntitled = !!_documentController,
URLStrings = window.cpOpeningURLStrings && window.cpOpeningURLStrings(),
index = 0,
+6 -2
View File
@@ -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 "";
+5 -2
View File
@@ -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)
{
@@ -105,4 +108,4 @@ function CPDrawColorTiledRects(
CGContextRestoreGState(context);
return resultRect;
}
}
+1 -1
View File
@@ -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
-2
View File
@@ -110,8 +110,6 @@ var STICKY_TIME_INTERVAL = 500,
[_moreBelowView setFrameSize:[_CPMenuWindowMoreBelowImage size]];
[contentView addSubview:_moreBelowView];
[self setShadowStyle:CPWindowShadowStyleMenu];
}
return self;
@@ -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;
}
+1 -1
View File
@@ -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],
+1 -1
View File
@@ -1257,7 +1257,7 @@ NOT YET IMPLEMENTED
*/
- (int)selectedColumn
{
[_selectedColumnIndexes lastIndex];
return [_selectedColumnIndexes lastIndex];
}
/*!
+2 -2
View File
@@ -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))];
@@ -54,4 +54,4 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
return aContentRect;
}
@end
@end
+2 -2
View File
@@ -25,8 +25,8 @@
@implementation CPCibHelpConnector : CPCibConnector
{
id _destination;
id _file;
id _marker;
id _file;
id _marker;
}
- (id)initWithCoder:(CPCoder)aCoder
+1 -1
View File
@@ -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) \
{ \
+2 -2
View File
@@ -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)
+4 -6
View File
@@ -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];
@@ -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];
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* _CPToolTipWindowView.j
* _CPAttachedWindow.j
* AppKit
*
* Created by Antoine Mercadal
+165 -52
View File
@@ -334,7 +334,16 @@
- (void)sortUsingDescriptors:(CPArray)descriptors
{
[self sortUsingFunction:compareObjectsUsingDescriptors context:descriptors];
var i = [descriptors count],
jsDescriptors = [];
// Revert the order of the descriptors
while (i--)
{
var d = [descriptors objectAtIndex:i];
[jsDescriptors addObject:{ "k": [d key], "a": [d ascending], "s": [d selector]}];
}
sortArrayUsingJSDescriptors(self, jsDescriptors);
}
/*!
@@ -344,46 +353,7 @@
*/
- (void)sortUsingFunction:(Function)aFunction context:(id)aContext
{
var h,
i,
j,
k,
l,
m,
n = [self count],
o;
var A,
B = [];
for (h = 1; h < n; h += h)
{
for (m = n - 1 - h; m >= 0; m -= h + h)
{
l = m - h + 1;
if (l < 0)
l = 0;
for (i = 0, j = l; j <= m; i++, j++)
B[i] = self[j];
for (i = 0, k = l; k < j && j <= m + h; k++)
{
A = self[j];
o = aFunction(A, B[i], aContext);
if (o >= 0)
self[k] = B[i++];
else
{
self[k] = A;
j++;
}
}
while (k < j)
self[k++] = B[i++];
}
}
sortArrayUsingFunction(self, aFunction, aContext);
}
/*!
@@ -392,7 +362,7 @@
*/
- (void)sortUsingSelector:(SEL)aSelector
{
[self sortUsingFunction:selectorCompare context:aSelector];
sortArrayUsingFunction(self, selectorCompare, aSelector);
}
@end
@@ -408,20 +378,163 @@
@end
var selectorCompare = function selectorCompare(object1, object2, selector)
var selectorCompare = function(object1, object2, selector)
{
return [object1 performSelector:selector withObject:object2];
};
// sort using sort descriptors
var compareObjectsUsingDescriptors= function compareObjectsUsingDescriptors(lhs, rhs, descriptors)
var sortArrayUsingFunction = function(array, aFunction, aContext)
{
var result = CPOrderedSame,
i = 0,
n = [descriptors count];
var h,
i,
j,
k,
l,
m,
n = array.length,
o;
while (i < n && result === CPOrderedSame)
result = [descriptors[i++] compareObject:lhs withObject:rhs];
var A,
B = [];
return result;
};
for (h = 1; h < n; h += h)
{
for (m = n - 1 - h; m >= 0; m -= h + h)
{
l = m - h + 1;
if (l < 0)
l = 0;
for (i = 0, j = l; j <= m; i++, j++)
B[i] = array[j];
for (i = 0, k = l; k < j && j <= m + h; k++)
{
A = array[j];
o = aFunction(A, B[i], aContext);
if (o >= 0)
array[k] = B[i++];
else
{
array[k] = A;
j++;
}
}
while (k < j)
array[k++] = B[i++];
}
}
}
// Observe that the sort descriptors has the reversed order by the caller
var sortArrayUsingJSDescriptors = function(a, d)
{
var h,
i,
j,
k,
l,
m,
n = a.length,
dl = d.length - 1,
o,
c = {};
var A,
B = [],
C1,
C2,
cn,
aUID,
bUID,
key,
dd;
if (dl < 0)
return;
for (h = 1; h < n; h += h)
{
for (m = n - 1 - h; m >= 0; m -= h + h)
{
l = m - h + 1;
if (l < 0)
l = 0;
for (i = 0, j = l; j <= m; i++, j++)
B[i] = a[j];
for (i = 0, k = l; k < j && j <= m + h; k++)
{
A = a[j];
aUID = A._UID;
if (!aUID)
aUID = [A UID];
C1 = c[aUID];
if (!C1)
{
C1 = {};
cn = dl;
do
{
key = d[cn].k;
C1[key] = [A valueForKey:key];
} while (cn--)
c[aUID] = C1;
}
bUID = B[i]._UID;
if (!bUID)
bUID = [B[i] UID];
C2 = c[bUID];
if (!C2)
{
C2 = {};
cn = dl;
do
{
key = d[cn].k;
C2[key] = [B[i] valueForKey:key];
} while (cn--)
c[bUID] = C2;
}
cn = dl;
do
{
dd = d[cn];
key = dd.k;
o = objj_msgSend(C1[key], dd.s, C2[key]);
if (o && !dd.a)
o = -o;
} while (cn-- && o == CPOrderedSame)
if (o >= 0)
a[k] = B[i++];
else
{
a[k] = A;
j++;
}
}
while (k < j)
a[k++] = B[i++];
}
}
}
+6 -8
View File
@@ -24,14 +24,12 @@
@import "CPString.j"
@import "CPException.j"
var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
var CPDateReferenceDate = new Date(Date.UTC(2001, 0, 1, 0, 0, 0, 0));
/*!
@class CPDate
@ingroup foundation
@brief A representation of a single point in time.
*/
@implementation CPDate : CPObject
{
@@ -66,12 +64,12 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
+ (id)distantPast
{
return new Date(-10000, 1, 1, 0, 0, 0, 0);
return [CPDate dateWithTimeIntervalSinceReferenceDate:-63113817600.0];
}
+ (id)distantFuture
{
return new Date(10000, 1, 1, 0, 0, 0, 0);
return [CPDate dateWithTimeIntervalSinceReferenceDate:63113990400.0];
}
- (id)initWithTimeIntervalSinceNow:(CPTimeInterval)seconds
@@ -169,7 +167,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
- (CPComparisonResult)compare:(CPDate)anotherDate
{
return (self > anotherDate) ? CPOrderedDescending : ((self < anotherDate) ? CPOrderedAscending : CPOrderedSame);
return (self > anotherDate) ? CPOrderedDescending : ((self < anotherDate) ? CPOrderedAscending : CPOrderedSame);
}
- (CPDate)earlierDate:(CPDate)anotherDate
@@ -200,7 +198,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 1, 1, 0, 0, 0, 0));
*/
- (CPString)description
{
return [CPString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d %s", self.getFullYear(), self.getMonth()+1, self.getDate(), self.getHours(), self.getMinutes(), self.getSeconds(), [CPDate timezoneOffsetString:self.getTimezoneOffset()]];
return [CPString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d %s", self.getFullYear(), self.getMonth() + 1, self.getDate(), self.getHours(), self.getMinutes(), self.getSeconds(), [CPDate timezoneOffsetString:self.getTimezoneOffset()]];
}
- (id)copy
@@ -245,7 +243,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;
+2 -3
View File
@@ -181,7 +181,7 @@ function CPDecimalMakeWithParts(mantissa, exponent)
var m = [],
isNegative = NO;
if (mantissa < 0 )
if (mantissa < 0)
{
isNegative = YES;
mantissa = ABS(mantissa);
@@ -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
+24 -12
View File
@@ -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");
}
@@ -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;
}
@@ -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;
}
/*
@@ -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;
}
+1 -1
View File
@@ -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];
+32 -12
View File
@@ -66,9 +66,9 @@ CPNumericSearch = 64;
*/
CPDiacriticInsensitiveSearch = 128;
var CPStringUIDs = new CFMutableDictionary();
var CPStringUIDs = new CFMutableDictionary(),
var CPStringRegexSpecialCharacters = [
CPStringRegexSpecialCharacters = [
'/', '.', '*', '+', '?', '|', '$', '^',
'(', ')', '[', ']', '{', '}', '\\'
],
@@ -624,9 +624,9 @@ var CPStringRegexSpecialCharacters = [
rhs = [rhs lowercaseString];
}
for (; len < min; len++ )
for (; len < min; len++)
{
if ( [lhs characterAtIndex:len] !== [rhs characterAtIndex:len] )
if ([lhs characterAtIndex:len] !== [rhs characterAtIndex:len])
break;
}
@@ -710,24 +710,31 @@ var CPStringRegexSpecialCharacters = [
*/
- (CPArray)pathComponents
{
if (length === 0) return [""];
if (self === "/") return ["/"];
if (length === 0)
return [""];
if (self === "/")
return ["/"];
var result = split('/');
if (result[0] === "")
result[0] = "/";
var index = result.length - 1;
if (index > 0)
{
if (result[index] === "")
result[index] = "/";
while (index--)
{
while (result[index] === "")
{
result.splice(index--, 1);
}
}
}
return result;
}
@@ -750,10 +757,12 @@ var CPStringRegexSpecialCharacters = [
{
var component = components[i],
lenMinusOne = component.length - 1;
if (lenMinusOne >= 0 && (component !== "/" || firstRound)) // Skip "" and "/" (not first time)
{
if (lenMinusOne > 0 && component.indexOf("/",lenMinusOne) === lenMinusOne) // Ends with "/"
component = component.substring(0, lenMinusOne);
if (firstRound)
{
if (component === "/")
@@ -764,6 +773,7 @@ var CPStringRegexSpecialCharacters = [
result += "/";
else
firstIsSlash = false;
result += component;
}
}
@@ -793,6 +803,7 @@ var CPStringRegexSpecialCharacters = [
var components = [self pathComponents],
lastIndex = components.length - 1,
lastComponent = components[lastIndex];
return lastIndex > 0 && lastComponent === "/" ? components[lastIndex - 1] : lastComponent;
}
@@ -806,6 +817,7 @@ var CPStringRegexSpecialCharacters = [
{
var components = [self pathComponents],
addComponents = aString && aString !== "/" ? [aString pathComponents] : [];
return [CPString pathWithComponents:components.concat(addComponents)];
}
@@ -820,6 +832,7 @@ var CPStringRegexSpecialCharacters = [
{
if (ext.indexOf('/') >= 0 || length === 0 || self === "/") // Can't handle these
return self;
var components = [self pathComponents],
last = components.length - 1;
@@ -839,13 +852,17 @@ var CPStringRegexSpecialCharacters = [
*/
- (CPString)stringByDeletingLastPathComponent
{
if (length === 0) return "";
if (self === "/") return "/";
if (length === 0)
return "";
else if (self === "/")
return "/";
var components = [self pathComponents],
last = components.length - 1;
if (components[last] === "/")
last--;
components.splice(last, components.length - last);
return [CPString pathWithComponents:components];
@@ -860,10 +877,10 @@ var CPStringRegexSpecialCharacters = [
- (CPString)stringByDeletingPathExtension
{
var extension = [self pathExtension];
if (extension === "")
return self;
if (lastIndexOf('.') < 1)
else if (lastIndexOf('.') < 1)
return self;
return substr(0, [self length] - (extension.length + 1));
@@ -877,6 +894,7 @@ var CPStringRegexSpecialCharacters = [
@end
@implementation CPString (JSON)
/*!
@@ -916,12 +934,14 @@ var CPStringRegexSpecialCharacters = [
@end
var diacritics = [[192,198],[224,230],[231,231],[232,235],[236,239],[242,246],[249,252]], // Basic Latin ; Latin-1 Supplement.
normalized = [65,97,99,101,105,111,117];
String.prototype.stripDiacritics = function()
{
var output = "";
for (var indexSource = 0; indexSource < this.length; indexSource++)
{
var code = this.charCodeAt(indexSource);
+40 -2
View File
@@ -111,11 +111,27 @@
{
// Verify that the split view does not attempt to auto save without an auto save name.
// This storage class will cause a crash if a save is attempted.
[[CPUserDefaults standardUserDefaults] setPersistentStoreClass:CPUserDefaultsFailingStore forDomain:CPApplicationDomain reloadData:NO];
[splitView setPosition:50 ofDividerAtIndex:0];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
// Now test that it does work normally.
[[CPUserDefaults standardUserDefaults] setPersistentStoreClass:CPUserDefaultsTestStore forDomain:CPApplicationDomain reloadData:NO];
[splitView setAutosaveName:@"Charles"];
[splitView setPosition:25 ofDividerAtIndex:0];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
// Recreate the split view.
[self setUp];
[splitView setAutosaveName:@"Charles"];
// FIXME At the moment restore from autosave only happens if the split view is loaded from a
// coder. It seems like it should happen when initialising in code too, but some research of
// Cocoa's behaviour will need to be done first.
splitView._needsRestoreFromAutosave = YES;
// Trigger autosave restore.
[splitView setFrameSize:CGSizeMake(110, 100)];
[self assert:25 equals:[viewA frameSize].height message:@"divider position restored"];
}
@end
@@ -131,6 +147,7 @@
}
@end
/*!
This store always fails.
*/
@@ -149,3 +166,24 @@
}
@end
/*!
This is a temporary store.
*/
@implementation CPUserDefaultsTestStore : CPUserDefaultsStore
{
CPData _data;
}
- (CPData)data
{
return _data;
}
- (void)setData:(CPData)aData
{
_data = aData;
}
@end
+213 -45
View File
@@ -1,72 +1,136 @@
var FILE = require("file");
@import <Foundation/CPArray.j>
@import <Foundation/CPString.j>
@import <Foundation/CPNumber.j>
@import <Foundation/CPSortDescriptor.j>
var ELEMENTS = 100,
REPEATS = 10;
@implementation CPArrayPerformanceTest : OJTestCase
- (void)testSortUsingDescriptorsSpeed
{
var array = [self makeUnsorted];
var descriptors = [
[CPSortDescriptor sortDescriptorWithKey:"a" ascending:NO],
[CPSortDescriptor sortDescriptorWithKey:"b" ascending:YES]
];
var start = (new Date).getTime();
for (var i = 0; i < REPEATS; ++i)
{
var sorted = [array sortedArrayUsingDescriptors:descriptors];
[self checkSorted:sorted];
}
var end = (new Date).getTime();
CPLog.warn(_cmd + ": " + (end - start) + "ms");
CPArray descriptors;
}
- (void)testSortUsingNativeSort
- (void)setUp
{
var array = [self makeUnsorted];
var descriptors = [
[CPSortDescriptor sortDescriptorWithKey:"a" ascending:NO],
[CPSortDescriptor sortDescriptorWithKey:"b" ascending:YES]
];
[CPSortDescriptor sortDescriptorWithKey:"a" ascending:NO],
[CPSortDescriptor sortDescriptorWithKey:"b" ascending:YES]
];
}
function sortFunction(lhs, rhs)
{
return ([lhs a] === [rhs a]) ? ([lhs b] - [rhs b]) : ([rhs a] - [lhs a]);
}
- (void)testAlmostSortedNumericUsingMergeSort
{
CPLog.warn("\nNUMERIC ALMOST SORTED");
var a = [self makeUnsorted],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkAlmostSorted:sorted];
}
var start = (new Date).getTime();
- (void)testAlmostSortedNumericUsingNativeSort
{
var a = [self makeUnsorted],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkAlmostSorted:sorted];
}
- (void)testRandomNumericUsingMergeSort
{
CPLog.warn("\nNUMERIC RANDOM");
var a = [self makeRandomNumeric],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkRandomSorted:sorted];
}
- (void)testRandomNumericUsingNativeSort
{
var a = [self makeRandomNumeric],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkRandomSorted:sorted];
}
- (void)testRandomTextUsingMergeSort
{
CPLog.warn("\nTEXT RANDOM");
var a = [self makeRandomText],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkRandomSorted:sorted];
}
- (void)testRandomTextUsingNativeSort
{
var a = [self makeRandomText],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingDescriptors:) withObject:descriptors];
[self checkRandomSorted:sorted];
}
- (void)testAlmostSortedNumericUsingMergeSelectorSort
{
CPLog.warn("\nNUMERIC ALMOST SORTED (SELECTOR)");
var a = [self makeUnsorted],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkAlmostSorted:sorted];
}
- (void)testAlmostSortedNumericUsingNativeSelectorSort
{
var a = [self makeUnsorted],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkAlmostSorted:sorted];
}
- (void)testRandomNumericUsingMergeSelectorSort
{
CPLog.warn("\nNUMERIC RANDOM (SELECTOR)");
var a = [self makeRandomNumeric],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkRandomSorted:sorted];
}
- (void)testRandomNumericUsingNativeSelectorSort
{
var a = [self makeRandomNumeric],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkRandomSorted:sorted];
}
- (void)testRandomTextUsingMergeSelectorSort
{
CPLog.warn("\nTEXT RANDOM (SELECTOR)");
var a = [self makeRandomText],
sorted = [self sort:a usingSortSelector:@selector(sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkRandomSorted:sorted];
}
- (void)testRandomTextUsingNativeSelectorSort
{
var a = [self makeRandomText],
sorted = [self sort:a usingSortSelector:@selector(_native_sortedArrayUsingSelector:) withObject:@selector(compareAAscendingThenBDescending:)];
[self checkRandomSorted:sorted];
}
- (CPArray)sort:(CPArray)anArray usingSortSelector:(SEL)aSelector withObject:(id)anObject
{
var sorted,
start = (new Date).getTime();
for (var i = 0; i < REPEATS; ++i)
{
var sorted = [array copy];
sorted.sort(sortFunction)
[self checkSorted:sorted];
}
sorted = [anArray performSelector:aSelector withObject:anObject];
var end = (new Date).getTime();
CPLog.warn(_cmd+": " + (end - start) + "ms");
CPLog.warn(aSelector + ": " + (end - start) + "ms");
return sorted;
}
- (CPArray)makeUnsorted
{
var array = [];
for (var i=0; i < ELEMENTS; ++i)
for (var i = 0; i < ELEMENTS; ++i)
{
var s = [Sortable new];
@@ -79,12 +143,49 @@ var ELEMENTS = 100,
return array;
}
- (void)checkSorted:(CPArray)sorted
- (CPArray)makeRandomNumeric
{
var array = [];
for (var i = 0; i < ELEMENTS; i++)
{
var s = [Sortable new],
n1 = ROUND(RAND() * ELEMENTS),
n2 = ROUND(RAND() * ELEMENTS);
[s setA:n1];
[s setB:n2];
array.push(s);
}
return array;
}
- (CPArray)makeRandomText
{
var the_big_sort = FILE.read(FILE.join(FILE.dirname(module.path), "the_big_sort.txt"), { charset:"UTF-8" }),
words = the_big_sort.split(" ", ELEMENTS),
wordcount = words.length,
array = [];
for (var i = 0; i < wordcount - 1; i++)
{
var s = [Sortable new];
[s setA:words[i]];
[s setB:words[i + 1]];
array.push(s);
}
return array;
}
- (void)checkAlmostSorted:(CPArray)sorted
{
// Verify it really got sorted.
for (var j=0; j < ELEMENTS; ++j)
for (var j = 0; j < sorted.length; ++j)
{
var expectedA = 4-FLOOR(j * 5 / ELEMENTS);
var expectedA = 4 - FLOOR(j * 5 / ELEMENTS);
if (sorted[j].a != expectedA)
[self fail:"a out of order: " + expectedA + " != " + sorted[j].a];
@@ -96,6 +197,66 @@ var ELEMENTS = 100,
}
}
- (void)checkRandomSorted:(CPArray)sorted
{
// Verify that it really got sorted.
for (var j = 0; j < sorted.length - 1; ++j)
{
if ([sorted[j].a compare:sorted[j + 1].a] == CPOrderedAscending)
[self fail:"a out of order: " + sorted[j].a + " > " + sorted[j + 1].a];
if ([sorted[j].a compare:sorted[j + 1].a] == CPOrderedSame && [sorted[j].b compare: sorted[j + 1].b] == CPOrderedDescending)
[self fail:"b out of order: " + sorted[j].b + " < " + sorted[j + 1].b];
}
}
@end
@implementation CPArray (NativeSort)
- (CPArray)_native_sortedArrayUsingDescriptors:(CPArray)descriptors
{
var sorted = [self copy];
[sorted _native_sortUsingDescriptors:descriptors];
return sorted;
}
- (CPArray)_native_sortUsingDescriptors:(CPArray)descriptors
{
var count = [descriptors count];
sort(function(lhs, rhs)
{
var i = 0,
result = CPOrderedSame;
while (i < count)
if ((result = [descriptors[i++] compareObject:lhs withObject:rhs]) !== CPOrderedSame)
return result;
return result;
});
}
- (CPArray)_native_sortedArrayUsingSelector:(SEL)aSelector
{
var sorted = [self copy];
[sorted _native_sortUsingSelector:aSelector];
return sorted;
}
- (CPArray)_native_sortUsingSelector:(SEL)aSelector
{
sort(function(lhs, rhs)
{
return [lhs performSelector:aSelector withObject:rhs];
});
}
@end
@implementation Sortable : CPObject
@@ -104,4 +265,11 @@ var ELEMENTS = 100,
int b @accessors;
}
- (int)compareAAscendingThenBDescending:(Sortable)other
{
var aResult = [a compare:other.a];
return aResult === CPOrderedSame ? [b compare:other.b] : -aResult;
}
@end
+14
View File
@@ -539,6 +539,20 @@
[self assertTrue:d.indexOf("y: 6") !== -1 message:"Can't find 'y: 6' in description of array " + d];
}
- (void)testSortUsingDescriptorsWithDifferentSelectors
{
var a = [CPDictionary dictionaryWithJSObject:{"a": "AB", "b": "ba"}],
b = [CPDictionary dictionaryWithJSObject:{"a": "aa", "b": "BB"}],
array = [a, b],
d1 = [[CPSortDescriptor sortDescriptorWithKey:@"a" ascending:YES selector:@selector(compare:)]],
d2 = [[CPSortDescriptor sortDescriptorWithKey:@"a" ascending:YES selector:@selector(caseInsensitiveCompare:)]],
s1 = [array sortedArrayUsingDescriptors:d1],
s2 = [array sortedArrayUsingDescriptors:d2];
[self assertTrue:s1[0] === a message:s1[0] + " is larger then " + a + " when sorting case sensitive"];
[self assertTrue:s2[1] === a message:s2[1] + " is larger then " + a + " when sorting case insensitive"];
}
@end
@implementation AlwaysEqual : CPObject
+33 -12
View File
@@ -4,10 +4,20 @@
- (void)testSince1970
{
/* These two dates should be equal to Fri Feb 13 2009 15:31:30 GMT-0800 */
unixDate = [CPDate dateWithTimeIntervalSince1970: 1234567890];
cocoaDate = [CPDate dateWithTimeIntervalSinceReferenceDate: 253582290];
[self assertTrue:[unixDate isEqualToDate: cocoaDate]];
/* These two dates should be equal to Fri Jan 13 2009 23:31:30 +0000 */
unixDate = [CPDate dateWithTimeIntervalSince1970:1231889490];
cocoaDate = [CPDate dateWithTimeIntervalSinceReferenceDate:253582290];
[self assertTrue:[unixDate isEqualToDate:cocoaDate] message:[unixDate description] + " isEqualToDate: " + [cocoaDate description]];
}
- (void)testDistantPast
{
[self assert:[CPDate dateWithTimeIntervalSinceReferenceDate:-63113817600.0] equals:[CPDate distantPast]];
}
- (void)testDistantFuture
{
[self assert:[CPDate dateWithTimeIntervalSinceReferenceDate:63113990400.0] equals:[CPDate distantFuture]];
}
- (void)testDate
@@ -19,7 +29,7 @@
past = [CPDate distantPast];
[self assertTrue:(before <= middle) message:"before not less than middle"];
[self assertTrue:(middle <= after) message:"middle not less than after ("+middle+","+after+")"];
[self assertTrue:(middle <= after) message:"middle not less than after (" + middle + "," + after + ")"];
[self assert:middle equals:[middle earlierDate:future] message:"earlierDate incorrect"];
[self assert:middle equals:[middle laterDate:past] message:"laterDate incorrect"];
@@ -49,13 +59,14 @@
- (void)testInitWithString
{
var tests = [
["1970-01-01 00:00:00 +0000", 0],
["1970-01-01 00:01:00 +0000", 60],
["1970-01-01 01:00:00 +0000", 60*60],
["1970-01-02 00:00:00 +0000", 24*60*60],
["2009-11-17 17:52:04 +0000", 1258480324],
["2009-11-17 18:52:04 +0200", 1258476724],
];
["1800-01-01 00:00:00 +0000", -5364662400],
["1970-01-01 00:00:00 +0000", 0],
["1970-01-01 00:01:00 +0000", 60],
["1970-01-01 01:00:00 +0000", 60 * 60],
["1970-01-02 00:00:00 +0000", 24 * 60 * 60],
["2009-11-17 17:52:04 +0000", 1258480324],
["2009-11-17 18:52:04 +0200", 1258476724],
];
for (var i = 0; i < tests.length; i++)
{
@@ -65,6 +76,16 @@
}
}
- (void)testInitWithTimeIntervalSinceReferenceDate_
{
// Related issue #1556: "CPDateReferenceDate should be 'Jan 1 2001' instead of 'Feb 1 2001'".
var referenceDate = [[CPDate alloc] initWithTimeIntervalSinceReferenceDate:0],
referenceDatePlusOneHour = [[CPDate alloc] initWithTimeIntervalSinceReferenceDate:3600];
[self assert:[[CPDate alloc] initWithString:@"2001-01-01 00:00:00 +0000"] equals:referenceDate message:@"reference date"];
[self assert:[[CPDate alloc] initWithString:@"2001-01-01 01:00:00 +0000"] equals:referenceDatePlusOneHour message:@"reference date plus one hour"];
}
- (void)testEncoding
{
var date = new Date(),
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
This test includes two tests for two ways to subclass CPDocumentController.
Please refer to the pull request and its discussion here.
https://github.com/cappuccino/cappuccino/pull/1551
@@ -0,0 +1,35 @@
/*
* AppController.j
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "Document.j"
@import "DocumentController.j"
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (void)applicationWillFinishLaunching:(CPNotification)aNotification
{
// instantiate a subclass of DocumentController
//subclassedCPDocumentController = [[DocumentController alloc] init];
}
- (void)awakeFromCib
{
// This is called when the cib is done loading.
// You can implement this method on any object instantiated from a Cib.
// It's a useful hook for setting up current UI values, and other things.
}
@end
@@ -0,0 +1,12 @@
@import <AppKit/CPDocument.j>
@implementation Document : CPDocument
{
}
- (CPString)windowCibName
{
return @"Document";
}
@end
@@ -0,0 +1,23 @@
@import <AppKit/CPDocumentController.j>
@import <AppKit/CPAlert.j>
@implementation DocumentController : CPDocumentController
{
}
- (id)init
{
self = [super init];
return [CPDocumentController sharedDocumentController];
}
/* Instead of throwing error in browser environment, show an alert
*/
- (void)openDocument:(id)aSender
{
var anAlert = [CPAlert alertWithError:@"Opening a document is not available!"];
[anAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
@end
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CappDoc</string>
<key>CPBundleDocumentTypes</key>
<array>
<dict>
<key>CPDocumentClass</key>
<string>Document</string>
<key>CPBundleTypeName</key>
<string>CappDoc</string>
<key>CFBundleTypeExtentions</key>
<array>
<string>cappdoc</string>
</array>
</dict>
</array>
</dict>
</plist>
@@ -0,0 +1,94 @@
/*
* Jakefile
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CappDoc", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CappDoc.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CappDoc");
task.setIdentifier("com.yourcompany.CappDoc");
task.setVersion("1.0");
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CappDoc");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CappDoc"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CappDoc", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CappDoc", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CappDoc"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Deployment", "CappDoc")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CappDoc"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CappDoc"));
print("----------------------------");
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSCustomObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
<object class="NSCustomObject" id="512844837">
<string key="NSClassName">Document</string>
</object>
<object class="NSCustomObject" id="613418571">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSWindowTemplate" id="275939982">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{29, 539}, {507, 413}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSViewClass">View</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{94, 86}</string>
<object class="NSView" key="NSWindowView" id="568628114">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTextField" id="159857402">
<reference key="NSNextResponder" ref="568628114"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{201, 198}, {104, 17}}</string>
<reference key="NSSuperview" ref="568628114"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:1505</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="521114378">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">Contents Here</string>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSCellIdentifier">_NS:1505</string>
<reference key="NSControlView" ref="159857402"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
</array>
<string key="NSFrameSize">{507, 413}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="159857402"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMinSize">{94, 108}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="796877042">
<string key="NSClassName">NSApplication</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="275939982"/>
</object>
<int key="connectionID">18</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="275939982"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">17</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="580458321"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="512844837"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="613418571"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="275939982"/>
<array class="NSMutableArray" key="children">
<reference ref="568628114"/>
</array>
<reference key="parent" ref="0"/>
<string key="objectName">Window</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="568628114"/>
<array class="NSMutableArray" key="children">
<reference ref="159857402"/>
</array>
<reference key="parent" ref="275939982"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="796877042"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">100098</int>
<reference key="object" ref="159857402"/>
<array class="NSMutableArray" key="children">
<reference ref="521114378"/>
</array>
<reference key="parent" ref="568628114"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100099</int>
<reference key="object" ref="521114378"/>
<reference key="parent" ref="159857402"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100098.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100099.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBWindowTemplateEditedContentRect">{{133, 170}, {507, 413}}</string>
<boolean value="NO" key="5.NSWindowTemplate.visibleAtLaunch"/>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">100100</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">Document</string>
<string key="superclassName">NSDocument</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/Document.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,107 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
CappDoc
Created by You on May 24, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CappDoc</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CappDoc...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,77 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
CappDoc
Created by You on May 24, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CappDoc</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CappDoc...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,18 @@
/*
* AppController.j
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -0,0 +1,35 @@
/*
* AppController.j
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "Document.j"
@import "DocumentController.j"
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
// This is called when the application is done loading.
}
- (void)applicationWillFinishLaunching:(CPNotification)aNotification
{
// instantiate a subclass of DocumentController
[[DocumentController alloc] init];
}
- (void)awakeFromCib
{
// This is called when the cib is done loading.
// You can implement this method on any object instantiated from a Cib.
// It's a useful hook for setting up current UI values, and other things.
}
@end
@@ -0,0 +1,12 @@
@import <AppKit/CPDocument.j>
@implementation Document : CPDocument
{
}
- (CPString)windowCibName
{
return @"Document";
}
@end
@@ -0,0 +1,23 @@
@import <AppKit/CPDocumentController.j>
@import <AppKit/CPAlert.j>
@implementation DocumentController : CPDocumentController
{
}
- (id)init
{
self = [super init];
return self;
}
/* Instead of throwing error in browser environment, show an alert
*/
- (void)openDocument:(id)aSender
{
var anAlert = [CPAlert alertWithError:@"Opening a document is not available!"];
[anAlert beginSheetModalForWindow:[[CPApplication sharedApplication] mainWindow]];
}
@end
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CappDoc</string>
<key>CPBundleDocumentTypes</key>
<array>
<dict>
<key>CPDocumentClass</key>
<string>Document</string>
<key>CPBundleTypeName</key>
<string>CappDoc</string>
<key>CFBundleTypeExtentions</key>
<array>
<string>cappdoc</string>
</array>
</dict>
</array>
</dict>
</plist>
@@ -0,0 +1,94 @@
/*
* Jakefile
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CappDoc", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CappDoc.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CappDoc");
task.setIdentifier("com.yourcompany.CappDoc");
task.setVersion("1.0");
task.setAuthor("Your Company");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CappDoc");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CappDoc"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CappDoc", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CappDoc", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CappDoc"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Deployment", "CappDoc")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CappDoc"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CappDoc"), FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CappDoc", "CappDoc.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CappDoc"));
print("----------------------------");
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSTextField</string>
<string>NSTextFieldCell</string>
<string>NSWindowTemplate</string>
<string>NSView</string>
<string>NSCustomObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
<object class="NSCustomObject" id="512844837">
<string key="NSClassName">Document</string>
</object>
<object class="NSCustomObject" id="613418571">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSWindowTemplate" id="275939982">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{29, 539}, {507, 413}}</string>
<int key="NSWTFlags">1886912512</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSViewClass">View</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{94, 86}</string>
<object class="NSView" key="NSWindowView" id="568628114">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="NSTextField" id="159857402">
<reference key="NSNextResponder" ref="568628114"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{201, 198}, {104, 17}}</string>
<reference key="NSSuperview" ref="568628114"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:1505</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="521114378">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">Contents Here</string>
<object class="NSFont" key="NSSupport">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSCellIdentifier">_NS:1505</string>
<reference key="NSControlView" ref="159857402"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
</array>
<string key="NSFrameSize">{507, 413}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="159857402"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
<string key="NSMinSize">{94, 108}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="796877042">
<string key="NSClassName">NSApplication</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="275939982"/>
</object>
<int key="connectionID">18</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="275939982"/>
<reference key="destination" ref="512844837"/>
</object>
<int key="connectionID">17</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="580458321"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="512844837"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="613418571"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="275939982"/>
<array class="NSMutableArray" key="children">
<reference ref="568628114"/>
</array>
<reference key="parent" ref="0"/>
<string key="objectName">Window</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="568628114"/>
<array class="NSMutableArray" key="children">
<reference ref="159857402"/>
</array>
<reference key="parent" ref="275939982"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="796877042"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">100098</int>
<reference key="object" ref="159857402"/>
<array class="NSMutableArray" key="children">
<reference ref="521114378"/>
</array>
<reference key="parent" ref="568628114"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100099</int>
<reference key="object" ref="521114378"/>
<reference key="parent" ref="159857402"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="-3.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100098.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100099.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBWindowTemplateEditedContentRect">{{133, 170}, {507, 413}}</string>
<boolean value="NO" key="5.NSWindowTemplate.visibleAtLaunch"/>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">100100</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">Document</string>
<string key="superclassName">NSDocument</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/Document.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -0,0 +1,107 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
CappDoc
Created by You on May 24, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CappDoc</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CappDoc...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,77 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index.html
CappDoc
Created by You on May 24, 2012.
Copyright 2012, Your Company All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CappDoc</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CappDoc...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
@@ -0,0 +1,18 @@
/*
* AppController.j
* CappDoc
*
* Created by You on May 24, 2012.
* Copyright 2012, Your Company All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -2,7 +2,7 @@
* AppController.j
* DragAndDrop
*
* Created by You on December 10, 2010.
* Created by Mike Fellows on December 10, 2010.
* Copyright 2010, Your Company All rights reserved.
*/
@@ -10,7 +10,7 @@
@import <Foundation/CPIndexSet.j>
@import <Foundation/CPRange.j>
TableTestDragAndDropTableViewDataType = "@TableTestDragAndDropTableViewDataType";
TableTestDragAndDropTableViewDataType = @"TableTestDragAndDropTableViewDataType";
@implementation AppController : CPObject
{
@@ -25,10 +25,10 @@ TableTestDragAndDropTableViewDataType = "@TableTestDragAndDropTableViewDataType"
count = 100;
rowList = [];
while(count--)
while (count--)
rowList[count] = count;
[scroll setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
[scroll setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
var table = [[CPTableView alloc] initWithFrame:CGRectMakeZero()];
[table setDataSource:self];
@@ -101,7 +101,7 @@ TableTestDragAndDropTableViewDataType = "@TableTestDragAndDropTableViewDataType"
- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(int)aRow
{
if([aColumn identifier] == "Row")
if ([aColumn identifier] == "Row")
return aRow;
else
return "Col " + [aColumn identifier] + ", Started as Row " + rowList[aRow];
@@ -133,7 +133,7 @@ TableTestDragAndDropTableViewDataType = "@TableTestDragAndDropTableViewDataType"
destinationRange,
destinationIndexes;
if(operation == CPTableViewDropAbove)
if (operation == CPTableViewDropAbove)
{
// Save the first object in the list so we can determine where the
// beginning of the moved block begins once all the selected rows have
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10J869</string>
<string key="IBDocument.InterfaceBuilderVersion">1306</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1306</string>
<string key="NS.object.0">2182</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -27,11 +27,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1127,8 +1124,9 @@
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="439893737">
<reference key="NSNextResponder"/>
<nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1137,7 +1135,6 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{192, 143}, {96, 21}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="600801425">
<int key="NSCellFlags">-2079981824</int>
@@ -1164,7 +1161,6 @@
<int key="NSvFlags">301</int>
<string key="NSFrame">{{192, 191}, {96, 22}}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="46991665">
<int key="NSCellFlags">-1804468671</int>
@@ -1199,11 +1195,10 @@
</object>
</object>
<string key="NSFrame">{{7, 11}, {480, 360}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="635946545">
<string key="NSClassName">AppController</string>
@@ -1212,6 +1207,30 @@
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="632727374"/>
</object>
<int key="connectionID">449</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="238522557"/>
</object>
<int key="connectionID">142</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="635946545"/>
</object>
<int key="connectionID">451</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performMiniaturize:</string>
@@ -1252,14 +1271,6 @@
</object>
<int key="connectionID">127</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">orderFrontStandardAboutPanel:</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="238522557"/>
</object>
<int key="connectionID">142</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performClose:</string>
@@ -1692,21 +1703,13 @@
</object>
<int key="connectionID">448</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="632727374"/>
</object>
<int key="connectionID">449</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="635946545"/>
<string key="label">theWindow</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="972006081"/>
</object>
<int key="connectionID">451</int>
<int key="connectionID">459</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
@@ -1716,21 +1719,15 @@
</object>
<int key="connectionID">458</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">theWindow</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="972006081"/>
</object>
<int key="connectionID">459</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
@@ -1794,7 +1791,6 @@
<reference ref="374024848"/>
</object>
<reference key="parent" ref="649796088"/>
<string key="objectName">1</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">217</int>
@@ -1837,19 +1833,16 @@
<int key="objectID">75</int>
<reference key="object" ref="1023925487"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">3</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">80</int>
<reference key="object" ref="117038363"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">8</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">78</int>
<reference key="object" ref="49223823"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">6</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">72</int>
@@ -1860,7 +1853,6 @@
<int key="objectID">82</int>
<reference key="object" ref="705341025"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">9</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">124</int>
@@ -1875,31 +1867,26 @@
<int key="objectID">77</int>
<reference key="object" ref="294629803"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">5</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">73</int>
<reference key="object" ref="776162233"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">1</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">79</int>
<reference key="object" ref="425164168"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">7</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">112</int>
<reference key="object" ref="579971712"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">10</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">74</int>
<reference key="object" ref="1010469920"/>
<reference key="parent" ref="720053764"/>
<string key="objectName">2</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">125</int>
@@ -2072,7 +2059,6 @@
<reference ref="238773614"/>
</object>
<reference key="parent" ref="391199113"/>
<string key="objectName">2</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">111</int>
@@ -2117,7 +2103,6 @@
<int key="objectID">136</int>
<reference key="object" ref="632727374"/>
<reference key="parent" ref="110575045"/>
<string key="objectName">1111</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">144</int>
@@ -2128,7 +2113,6 @@
<int key="objectID">129</int>
<reference key="object" ref="609285721"/>
<reference key="parent" ref="110575045"/>
<string key="objectName">121</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">143</int>
@@ -2661,142 +2645,70 @@
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>103.IBPluginDependency</string>
<string>103.ImportedFromIB2</string>
<string>106.IBPluginDependency</string>
<string>106.ImportedFromIB2</string>
<string>106.editorWindowContentRectSynchronizationRect</string>
<string>111.IBPluginDependency</string>
<string>111.ImportedFromIB2</string>
<string>112.IBPluginDependency</string>
<string>112.ImportedFromIB2</string>
<string>124.IBPluginDependency</string>
<string>124.ImportedFromIB2</string>
<string>125.IBPluginDependency</string>
<string>125.ImportedFromIB2</string>
<string>125.editorWindowContentRectSynchronizationRect</string>
<string>126.IBPluginDependency</string>
<string>126.ImportedFromIB2</string>
<string>129.IBPluginDependency</string>
<string>129.ImportedFromIB2</string>
<string>130.IBPluginDependency</string>
<string>130.ImportedFromIB2</string>
<string>130.editorWindowContentRectSynchronizationRect</string>
<string>131.IBPluginDependency</string>
<string>131.ImportedFromIB2</string>
<string>134.IBPluginDependency</string>
<string>134.ImportedFromIB2</string>
<string>136.IBPluginDependency</string>
<string>136.ImportedFromIB2</string>
<string>143.IBPluginDependency</string>
<string>143.ImportedFromIB2</string>
<string>144.IBPluginDependency</string>
<string>144.ImportedFromIB2</string>
<string>145.IBPluginDependency</string>
<string>145.ImportedFromIB2</string>
<string>149.IBPluginDependency</string>
<string>149.ImportedFromIB2</string>
<string>150.IBPluginDependency</string>
<string>150.ImportedFromIB2</string>
<string>19.IBPluginDependency</string>
<string>19.ImportedFromIB2</string>
<string>195.IBPluginDependency</string>
<string>195.ImportedFromIB2</string>
<string>196.IBPluginDependency</string>
<string>196.ImportedFromIB2</string>
<string>197.IBPluginDependency</string>
<string>197.ImportedFromIB2</string>
<string>198.IBPluginDependency</string>
<string>198.ImportedFromIB2</string>
<string>199.IBPluginDependency</string>
<string>199.ImportedFromIB2</string>
<string>200.IBPluginDependency</string>
<string>200.ImportedFromIB2</string>
<string>200.editorWindowContentRectSynchronizationRect</string>
<string>201.IBPluginDependency</string>
<string>201.ImportedFromIB2</string>
<string>202.IBPluginDependency</string>
<string>202.ImportedFromIB2</string>
<string>203.IBPluginDependency</string>
<string>203.ImportedFromIB2</string>
<string>204.IBPluginDependency</string>
<string>204.ImportedFromIB2</string>
<string>205.IBPluginDependency</string>
<string>205.ImportedFromIB2</string>
<string>205.editorWindowContentRectSynchronizationRect</string>
<string>206.IBPluginDependency</string>
<string>206.ImportedFromIB2</string>
<string>207.IBPluginDependency</string>
<string>207.ImportedFromIB2</string>
<string>208.IBPluginDependency</string>
<string>208.ImportedFromIB2</string>
<string>209.IBPluginDependency</string>
<string>209.ImportedFromIB2</string>
<string>210.IBPluginDependency</string>
<string>210.ImportedFromIB2</string>
<string>211.IBPluginDependency</string>
<string>211.ImportedFromIB2</string>
<string>212.IBPluginDependency</string>
<string>212.ImportedFromIB2</string>
<string>212.editorWindowContentRectSynchronizationRect</string>
<string>213.IBPluginDependency</string>
<string>213.ImportedFromIB2</string>
<string>214.IBPluginDependency</string>
<string>214.ImportedFromIB2</string>
<string>215.IBPluginDependency</string>
<string>215.ImportedFromIB2</string>
<string>216.IBPluginDependency</string>
<string>216.ImportedFromIB2</string>
<string>217.IBPluginDependency</string>
<string>217.ImportedFromIB2</string>
<string>218.IBPluginDependency</string>
<string>218.ImportedFromIB2</string>
<string>219.IBPluginDependency</string>
<string>219.ImportedFromIB2</string>
<string>220.IBPluginDependency</string>
<string>220.ImportedFromIB2</string>
<string>220.editorWindowContentRectSynchronizationRect</string>
<string>221.IBPluginDependency</string>
<string>221.ImportedFromIB2</string>
<string>23.IBPluginDependency</string>
<string>23.ImportedFromIB2</string>
<string>236.IBPluginDependency</string>
<string>236.ImportedFromIB2</string>
<string>239.IBPluginDependency</string>
<string>239.ImportedFromIB2</string>
<string>24.IBPluginDependency</string>
<string>24.ImportedFromIB2</string>
<string>24.editorWindowContentRectSynchronizationRect</string>
<string>29.IBEditorWindowLastContentRect</string>
<string>29.IBPluginDependency</string>
<string>29.ImportedFromIB2</string>
<string>29.WindowOrigin</string>
<string>29.editorWindowContentRectSynchronizationRect</string>
<string>295.IBPluginDependency</string>
<string>296.IBPluginDependency</string>
<string>296.editorWindowContentRectSynchronizationRect</string>
<string>297.IBPluginDependency</string>
<string>298.IBPluginDependency</string>
<string>346.IBPluginDependency</string>
<string>346.ImportedFromIB2</string>
<string>348.IBPluginDependency</string>
<string>348.ImportedFromIB2</string>
<string>349.IBPluginDependency</string>
<string>349.ImportedFromIB2</string>
<string>349.editorWindowContentRectSynchronizationRect</string>
<string>350.IBPluginDependency</string>
<string>350.ImportedFromIB2</string>
<string>351.IBPluginDependency</string>
<string>351.ImportedFromIB2</string>
<string>354.IBPluginDependency</string>
<string>354.ImportedFromIB2</string>
<string>371.IBEditorWindowLastContentRect</string>
<string>371.IBPluginDependency</string>
<string>371.IBWindowTemplateEditedContentRect</string>
<string>371.NSWindowTemplate.visibleAtLaunch</string>
<string>371.editorWindowContentRectSynchronizationRect</string>
<string>372.IBPluginDependency</string>
<string>375.IBPluginDependency</string>
<string>376.IBEditorWindowLastContentRect</string>
<string>376.IBPluginDependency</string>
<string>377.IBPluginDependency</string>
<string>378.IBPluginDependency</string>
@@ -2809,7 +2721,6 @@
<string>385.IBPluginDependency</string>
<string>386.IBPluginDependency</string>
<string>387.IBPluginDependency</string>
<string>388.IBEditorWindowLastContentRect</string>
<string>388.IBPluginDependency</string>
<string>389.IBPluginDependency</string>
<string>390.IBPluginDependency</string>
@@ -2848,183 +2759,92 @@
<string>456.IBPluginDependency</string>
<string>457.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>5.ImportedFromIB2</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
<string>57.IBPluginDependency</string>
<string>57.ImportedFromIB2</string>
<string>57.editorWindowContentRectSynchronizationRect</string>
<string>58.IBPluginDependency</string>
<string>58.ImportedFromIB2</string>
<string>72.IBPluginDependency</string>
<string>72.ImportedFromIB2</string>
<string>73.IBPluginDependency</string>
<string>73.ImportedFromIB2</string>
<string>74.IBPluginDependency</string>
<string>74.ImportedFromIB2</string>
<string>75.IBPluginDependency</string>
<string>75.ImportedFromIB2</string>
<string>77.IBPluginDependency</string>
<string>77.ImportedFromIB2</string>
<string>78.IBPluginDependency</string>
<string>78.ImportedFromIB2</string>
<string>79.IBPluginDependency</string>
<string>79.ImportedFromIB2</string>
<string>80.IBPluginDependency</string>
<string>80.ImportedFromIB2</string>
<string>81.IBPluginDependency</string>
<string>81.ImportedFromIB2</string>
<string>81.editorWindowContentRectSynchronizationRect</string>
<string>82.IBPluginDependency</string>
<string>82.ImportedFromIB2</string>
<string>83.IBPluginDependency</string>
<string>83.ImportedFromIB2</string>
<string>92.IBPluginDependency</string>
<string>92.ImportedFromIB2</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{596, 852}, {216, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{522, 812}, {146, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{436, 809}, {64, 6}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {275, 83}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{187, 434}, {243, 243}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {167, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {241, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{525, 802}, {197, 73}}</string>
<string>{{143, 285}, {478, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{74, 862}</string>
<string>{{6, 978}, {478, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{475, 832}, {234, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{608, 612}, {215, 63}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{303, 221}, {480, 360}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{303, 221}, {480, 360}}</string>
<integer value="1"/>
<string>{{33, 99}, {480, 360}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{437, 242}, {86, 43}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3037,7 +2857,6 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{523, 2}, {178, 283}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3076,40 +2895,21 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{155, 102}, {245, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{23, 794}, {245, 183}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{145, 474}, {199, 203}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -3168,10 +2968,10 @@
<string>NSMenuCheckmark</string>
<string>NSMenuMixedState</string>
</object>
<object class="NSMutableArray" key="dict.values">
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{9, 8}</string>
<string>{7, 2}</string>
<string>{11, 11}</string>
<string>{10, 3}</string>
</object>
</object>
</data>
+176 -36
View File
@@ -36,7 +36,7 @@ import os
import os.path
import re
import sys
import unittest
EXIT_CODE_SHOW_HTML = 205
EXIT_CODE_SHOW_TOOLTIP = 206
@@ -77,7 +77,54 @@ def relative_path(basedir, filename):
return filename
def string_replacer(line):
"""Take string literals like 'hello' and replace them with empty string literals, while respecting escaping."""
r = []
in_quote = None
escapes = 0
for i, c in enumerate(line):
if in_quote:
if not escapes and c == in_quote:
in_quote = None
r.append(c)
continue
# We're inside of a string literal. Ignore everything.
else:
if not escapes and (c == '"' or c == "'"):
in_quote = c
r.append(c)
continue
# Outside of a string literal, preserve everything.
r.append(c)
if c == '\\':
escapes = (escapes + 1) % 2
else:
escapes = 0
if in_quote:
# Unterminated string literal.
pass
return "".join(r)
class LintChecker(object):
"""Examine Objective-J code statically and generate warnings for possible errors and deviations from the coding-style standard.
>>> LintChecker().lint_text('var b = 5+5;')
[{'positions': [9], 'filename': '<stdin>', 'lineNum': 1, 'message': 'binary operator without surrounding spaces', 'type': 2, 'line': u'var b = 5+5;'}]
>>> LintChecker().lint_text('''
... if( 1 ) {
... var b=7;
... c = 8;
... }
... ''')
[{'positions': [2], 'filename': '<stdin>', 'lineNum': 2, 'message': 'missing space between control statement and parentheses', 'type': 2, 'line': u'if( 1 ) {'}, {'positions': [8], 'filename': '<stdin>', 'lineNum': 2, 'message': 'braces should be on their own line', 'type': 1, 'line': u'if( 1 ) {'}, {'positions': [3, 5], 'filename': '<stdin>', 'lineNum': 2, 'message': 'space inside parentheses', 'type': 1, 'line': u'if( 1 ) {'}, {'positions': [7], 'filename': '<stdin>', 'lineNum': 3, 'message': 'assignment operator without surrounding spaces', 'type': 2, 'line': u' var b=7;'}, {'lineNum': 4, 'message': 'accidental global variable', 'type': 1, 'line': u' c = 8;', 'filename': '<stdin>'}]
"""
VAR_BLOCK_START_RE = re.compile(ur'''(?x)
(?P<indent>\s*) # indent before a var keyword
@@ -128,15 +175,33 @@ class LintChecker(object):
TRAILING_WHITESPACE_RE = re.compile(ur'^.*(\s+)$')
STRIP_LINE_COMMENT_RE = re.compile(ur'(.*)\s*(?://.*|/\*.*\*/\s*)$')
LINE_COMMENT_RE = re.compile(ur'\s*(?:/\*.*\*/\s*|//.*)$')
COMMENT_RE = re.compile(ur'/\*.*?\*/')
BLOCK_COMMENT_START_RE = re.compile(ur'\s*/\*.*(?!\*/\s*)$')
BLOCK_COMMENT_END_RE = re.compile(ur'.*?\*/')
METHOD_RE = ur'[-+]\s*\([a-zA-Z_$]\w*\)\s*[a-zA-Z_$]\w*'
FUNCTION_RE = re.compile(ur'\s*function\s*(?P<name>[a-zA-Z_$]\w*)?\(.*\)\s*\{?')
STRING_LITERAL_RE = re.compile(ur'(?<!\\)(["\'])(.*?)(?<!\\)\1')
RE_RE = re.compile(ur'(?<!\\)/.*?[^\\]/[gims]*')
EMPTY_STRING_LITERAL_FUNCTION = lambda match: match.group(1) + (len(match.group(2)) * ' ') + match.group(1)
EMPTY_SELF_STRING_LITERAL_FUNCTION = lambda self, match: match.group(1) + (len(match.group(2)) * ' ') + match.group(1)
def noncapturing(regex):
return ur'(?:%s)' % regex
def optional(regex):
return ur'(?:%s)?' % regex
DECIMAL_DIGIT_RE = ur'[0-9]'
NON_ZERO_DIGIT_RE = ur'[1-9]'
DECIMAL_DIGITS_RE = DECIMAL_DIGIT_RE + ur'+'
DECIMAL_DIGITS_OPT_RE = optional(DECIMAL_DIGIT_RE + ur'+')
EXPONENT_INDICATOR_RE = ur'[eE]'
SIGNED_INTEGER_RE = noncapturing(DECIMAL_DIGITS_RE) + ur'|' + noncapturing(ur'\+' + DECIMAL_DIGITS_RE) + ur'|' + noncapturing('-' + DECIMAL_DIGITS_RE)
DECIMAL_INTEGER_LITERAL_RE = ur'0|' + noncapturing(NON_ZERO_DIGIT_RE + DECIMAL_DIGIT_RE + ur'*')
EXPONENT_PART_RE = EXPONENT_INDICATOR_RE + noncapturing(SIGNED_INTEGER_RE)
EXPONENT_PART_OPT_RE = optional(EXPONENT_PART_RE)
DECIMAL_LITERAL_RE = re.compile(noncapturing(noncapturing(DECIMAL_INTEGER_LITERAL_RE) + ur'\.' + DECIMAL_DIGITS_OPT_RE + EXPONENT_PART_OPT_RE) + ur'|\.' + noncapturing(DECIMAL_DIGITS_RE + EXPONENT_PART_OPT_RE) + ur'|' + noncapturing(noncapturing(DECIMAL_INTEGER_LITERAL_RE) + EXPONENT_PART_OPT_RE))
ERROR_TYPE_ILLEGAL = 1
ERROR_TYPE_WARNING = 2
@@ -144,10 +209,19 @@ class LintChecker(object):
# with spaces so we don't get false matches within them
STD_IGNORES = (
{'regex': STRIP_LINE_COMMENT_RE, 'replace': ''},
{'regex': STRING_LITERAL_RE, 'replace': EMPTY_STRING_LITERAL_FUNCTION},
{'function': string_replacer},
{'regex': COMMENT_RE, 'replace': ''},
{'regex': RE_RE, 'replace': '/ /'},
)
# Convert exponential notation like 1.1e-6 to an arbitrary constant number so that the "e" notation doesn't
# need to be understood by the regular matchers. Obviously this is limited by the fact that we're regexing
# so this will probably catch some things which are not properly decimal literals (parts of strings or
# variable names for instance).
EXPONENTIAL_TO_SIMPLE = (
{'regex': DECIMAL_LITERAL_RE, 'replace': '42'},
)
LINE_CHECKLIST = (
{
'id': 'tabs',
@@ -175,6 +249,18 @@ class LintChecker(object):
'showPositionForGroup': 1,
'type': ERROR_TYPE_ILLEGAL
},
{
'regex': re.compile(ur'^\s*(?:(?:else )?if|for|switch|while|with)\s*\((\s+)?.+?(\s+)?\)\s*(?:(?:\{|//.*|/\*.*\*/)\s*)?$'),
'error': 'space inside parentheses',
'showPositionForGroup': [1, 2],
'type': ERROR_TYPE_ILLEGAL
},
{
'regex': re.compile(ur'^\s*(?:(?:else )?if|for|switch|while|with)\s*\(.+\)\s*(?:[\w_]|\[).+(;)\s*(?://.*|/\*.*\*/\s*)?$'),
'error': 'dependent statements must be on their own line',
'showPositionForGroup': 1,
'type': ERROR_TYPE_ILLEGAL
},
{
'regex': TRAILING_WHITESPACE_RE,
'error': 'trailing whitespace',
@@ -185,29 +271,20 @@ class LintChecker(object):
# Filter out @import statements, method declarations, method parameters, unary plus/minus/increment/decrement
'filter': {'regex': re.compile(ur'(^@import\b|^\s*' + METHOD_RE + '|^\s*[a-zA-Z_$]\w*:\s*\([a-zA-Z_$][\w<>]*\)\s*\w+|[a-zA-Z_$]\w*(\+\+|--)|([ -+*/%^&|<>!]=?|&&|\|\||<<|>>>|={1,3}|!==?)\s*[-+][\w(\[])'), 'pass': False},
'preprocess': STD_IGNORES,
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))([-+*/%^]|&&?|\|\|?|<<|>>>?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'binary operator without surrounding spaces',
# Also convert literals like 1.5e+7 to 42 so that the - or + in there is ignored for purposes of this warning.
'preprocess': STD_IGNORES + EXPONENTIAL_TO_SIMPLE,
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))([-+*/%^]|&&?|\|\|?|<<|>>>?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'binary operator without surrounding spaces',
'showPositionForGroup': 2,
'type': ERROR_TYPE_WARNING
},
{
# Filter out @import statements, method declarations
'filter': {'regex': re.compile(ur'^(@import\b|\s*' + METHOD_RE + ')'), 'pass': False},
'preprocess': STD_IGNORES,
'regex': re.compile(ur'(?:[-*/%^&|<>!]=?|&&|\|\||<<|>>>|={1,3}|!==?)\s*(?<!\+)(\+)[\w(\[]'),
'error': 'useless unary + operator',
'showPositionForGroup': 1,
'type': ERROR_TYPE_WARNING
},
{
# Filter out possible = within @accessors
'filter': {'regex': re.compile(ur'^\s*(?:@outlet\s+)?[a-zA-Z_$]\w*\s+[a-zA-Z_$]\w*\s+@accessors\b'), 'pass': False},
'preprocess': STD_IGNORES,
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(=|[-+*/%^&|]=|<<=|>>>?=)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'assignment operator without surrounding spaces',
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(=|[-+*/%^&|]=|<<=|>>>?=)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'assignment operator without surrounding spaces',
'showPositionForGroup': 2,
'type': ERROR_TYPE_WARNING
},
@@ -216,8 +293,8 @@ class LintChecker(object):
'filter': {'regex': re.compile(ur'^(@import\b|@implementation\b|\s*' + METHOD_RE + ')'), 'pass': False},
'preprocess': STD_IGNORES,
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(===?|!==?|[<>]=?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'comparison operator without surrounding spaces',
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(===?|!==?|[<>]=?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
'error': 'comparison operator without surrounding spaces',
'showPositionForGroup': 2,
'type': ERROR_TYPE_WARNING
},
@@ -254,7 +331,7 @@ class LintChecker(object):
TEXT_ERROR_SINGLE_FILE_TEMPLATE = Template(u'$lineNum: $message.\n+$line\n')
TEXT_ERROR_MULTI_FILE_TEMPLATE = Template(u'$filename:$lineNum: $message.\n+$line\n')
def __init__(self, view, basedir='', var_declarations=VAR_DECLARATIONS_SINGLE, verbose=False):
def __init__(self, view=None, basedir='', var_declarations=VAR_DECLARATIONS_SINGLE, verbose=False):
self.view = view
self.basedir = unicode(basedir, 'utf-8')
self.errors = []
@@ -284,6 +361,7 @@ class LintChecker(object):
continue
line = self.line
originalLine = line
lineFilter = check.get('filter')
if lineFilter:
@@ -304,6 +382,11 @@ class LintChecker(object):
if regex:
line = regex.sub(processor.get('replace', ''), line)
fnct = processor.get('function')
if fnct:
line = fnct(line)
regex = check.get('regex')
if not regex:
@@ -315,29 +398,40 @@ class LintChecker(object):
continue
positions = []
group = check.get('showPositionForGroup')
groups = check.get('showPositionForGroup')
if (check.get('id') == 'tabs'):
line = tabs2spaces(line, positions=positions)
elif group is not None:
elif groups is not None:
line = tabs2spaces(line)
for match in regex.finditer(line):
if group > 0:
positions.append(match.start(group))
else:
# group 0 means show the first non-empty match
for i in range(1, len(match.groups()) + 1):
if match.start(i) >= 0:
positions.append(match.start(i))
break
if not isinstance(groups, (list, tuple)):
groups = (groups,)
self.error(check['error'], line=line, positions=positions, type=check['type'])
for match in regex.finditer(line):
for group in groups:
if group > 0:
start = match.start(group)
if start >= 0:
positions.append(start)
else:
# group 0 means show the first non-empty match
for i in range(1, len(match.groups()) + 1):
if match.start(i) >= 0:
positions.append(match.start(i))
break
if positions:
self.error(check['error'], line=originalLine, positions=positions, type=check['type'])
def next_statement(self, expect_line=False, check_line=True):
try:
while True:
raw_line = self.sourcefile.next()[:-1] # strip EOL
raw_line = self.sourcefile.next()
# strip EOL
if raw_line[-1] == '\n': # ... unless this is the last line which might not have a \n.
raw_line = raw_line[:-1]
try:
self.line = unicode(raw_line, 'utf-8', 'strict') # convert to Unicode
@@ -410,7 +504,7 @@ class LintChecker(object):
# Remove all quoted strings from the expression so that we don't
# count unmatched pairs inside the strings.
self.expression = self.STRING_LITERAL_RE.sub(self.EMPTY_SELF_STRING_LITERAL_FUNCTION, self.expression)
self.expression = string_replacer(self.expression)
self.strip_comment()
self.expression = self.expression.strip()
@@ -727,7 +821,7 @@ class LintChecker(object):
print u'EOF\n'
pass
def lint_text(self, text, filename):
def lint_text(self, text, filename="<stdin>"):
self.filename = filename
self.filesToCheck = []
@@ -739,6 +833,8 @@ class LintChecker(object):
print u'EOF\n'
pass
return self.errors
def count_files_checked(self):
return len(self.filesToCheck)
@@ -939,6 +1035,50 @@ class LintChecker(object):
exit_show_html(html)
class MiscTest(unittest.TestCase):
def test_string_replacer(self):
self.assertEquals(string_replacer("x = 'hello';"), "x = '';")
self.assertEquals(string_replacer("x = '\\' hello';"), "x = '';")
self.assertEquals(string_replacer("x = '\\\\';"), "x = '';")
self.assertEquals(string_replacer("""x = '"string in string"';"""), "x = '';")
self.assertEquals(string_replacer('x = "hello";'), 'x = "";')
self.assertEquals(string_replacer('x = "\\" hello";'), 'x = "";')
self.assertEquals(string_replacer('x = "\\\\";'), 'x = "";')
self.assertEquals(string_replacer('''x = "'";'''), 'x = "";')
class LintCheckerTest(unittest.TestCase):
def test_exponential_notation(self):
"""Test that exponential notation such as 1.1e-6 doesn't cause a warning about missing whitespace."""
# This should not report "binary operator without surrounding spaces".
self.assertEquals(LintChecker().lint_text("a = 2.1e-6;"), [])
self.assertEquals(LintChecker().lint_text("a = 2.1e+6;"), [])
self.assertEquals(LintChecker().lint_text("a = 2e-0;"), [])
self.assertEquals(LintChecker().lint_text("a = 2e+0;"), [])
# But this should.
self.assertEquals(LintChecker().lint_text("a = 1.1e-6+2e2;"), [{'positions': [6], 'filename': '<stdin>', 'lineNum': 1, 'message': 'binary operator without surrounding spaces', 'type': 2, 'line': u'a = 1.1e-6+2e2;'}])
def test_function_types(self):
"""Test that function definitions like function(/*CPString*/key) don't cause warnings about surrounding spaces."""
# This should not report "binary operator without surrounding spaces".
self.assertEquals(LintChecker().lint_text("var resolveMultipleValues = function(/*CPString*/key, /*CPDictionary*/bindings, /*GSBindingOperationKind*/operation)"), [])
def test_unary_plus(self):
"""Test that = +<variable>, like in `x = +y;`, doesn't cause a warning."""
# +<variable> converts number in a string to a number.
self.assertEquals(LintChecker().lint_text("var y = +x;"), [])
def test_string_escaping(self):
"""Test that string literals are not parsed as syntax, even when they end with a double backslash."""
self.assertEquals(LintChecker().lint_text('var x = "(\\\\";'), [])
if __name__ == '__main__':
usage = 'usage: %prog [options] [file ... | -]'
parser = OptionParser(usage=usage, version='1.02')
+5 -5
View File
@@ -27,12 +27,12 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
{
_allTemplates = [aCoder decodeObjectForKey:@"NSPredicateTemplates"];
}
return self;
}
@@ -59,7 +59,7 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_templateType = [aCoder decodeIntForKey:@"NSPredicateTemplateType"];
@@ -71,7 +71,7 @@
_rightIsWildcard = [aCoder decodeBoolForKey:@"NSPredicateTemplateRightIsWildcard"];
_views = [aCoder decodeObjectForKey:@"NSPredicateTemplateViews"];
}
return self;
}
+6 -6
View File
@@ -32,7 +32,7 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
_alignmentGridWidth = [aCoder decodeFloatForKey:@"NSRuleEditorAlignmentGridWidth"];
@@ -40,20 +40,20 @@
_stringsFilename = [aCoder decodeObjectForKey:@"NSRuleEditorStringsFileName"];
_editable = [aCoder decodeBoolForKey:@"NSRuleEditorEditable"];
_allowsEmptyCompoundRows = [aCoder decodeBoolForKey:@"NSRuleEditorAllowsEmptyCompoundRows"];
_disallowEmpty = [aCoder decodeBoolForKey:@"NSRuleEditorDisallowEmpty"];
_disallowEmpty = [aCoder decodeBoolForKey:@"NSRuleEditorDisallowEmpty"];
_nestingMode = [aCoder decodeIntForKey:@"NSRuleEditorNestingMode"];
_typeKeyPath = [aCoder decodeObjectForKey:@"NSRuleEditorRowTypeKeyPath"];
_itemsKeyPath = [aCoder decodeObjectForKey:@"NSRuleEditorItemsKeyPath"];
_valuesKeyPath = [aCoder decodeObjectForKey:@"NSRuleEditorValuesKeyPath"];
_subrowsArrayKeyPath = [aCoder decodeObjectForKey:@"NSRuleEditorSubrowsArrayKeyPath"];
_boundArrayKeyPath = [aCoder decodeObjectForKey:@"NSRuleEditorBoundArrayKeyPath"];
//_slicesHolder = [aCoder decodeObjectForKey:@"NSRuleEditorViewSliceHolder"];
_boundArrayOwner = [aCoder decodeObjectForKey:@"NSRuleEditorBoundArrayOwner"];
_slices = [aCoder decodeObjectForKey:@"NSRuleEditorSlices"];
_ruleDelegate = [aCoder decodeObjectForKey:@"NSRuleEditorDelegate"];
_ruleDelegate = [aCoder decodeObjectForKey:@"NSRuleEditorDelegate"];
}
return self;
}
@@ -99,7 +99,7 @@
{
if (self = [super init])
boundArray = [aCoder decodeObjectForKey:@"NSBoundArray"];
return self;
}
+3 -1
View File
@@ -40,7 +40,7 @@ var FILE = require("file"),
DefaultTheme = "Aristo",
BuildTypes = ["Debug", "Release"],
DefaultFile = "MainMenu",
AllowedStoredOptionsRe = new RegExp("^(defaultTheme|auxThemes|verbosity|quiet|frameworks|format)$");
AllowedStoredOptionsRe = new RegExp("^(defaultTheme|auxThemes|verbosity|quiet|frameworks|format)$"),
ArgsRe = /"[^\"]+"|'[^\']+'|\S+/g;
@@ -127,6 +127,8 @@ var FILE = require("file"),
if (systemFontSize)
[CPFont setSystemFontSize:parseFloat(systemFontSize, 10)];
}
else
infoPlist = [CPDictionary dictionary];
var themeList = [self getThemeList:options],
themes = [self loadThemesFromList:themeList];