Some capp_linting.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2010-12-01 11:04:17 -08:00
1 parent 94d28a2593
commit ff60125183
41 files changed
+319 -313

No files matched your search

+21 -21
View File
@@ -32,10 +32,10 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
@implementation CPFlashView : CPView
{
CPFlashMovie _flashMovie;
CPDictionary _params;
CPDictionary _paramElements;
#if PLATFORM(DOM)
#if PLATFORM(DOM)
DOMElement _DOMParamElement;
DOMElement _DOMObjectElement;
DOMElement _DOMInnerObjectElement;
@@ -45,7 +45,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self)
{
#if PLATFORM(DOM)
@@ -58,24 +58,24 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
_DOMObjectElement.style.left = @"0px";
_DOMObjectElement.type = @"application/x-shockwave-flash";
_DOMObjectElement.setAttribute(@"classid", IEFlashCLSID);
_DOMParamElement = document.createElement(@"param");
_DOMParamElement.name = @"movie";
_DOMInnerObjectElement = document.createElement(@"object");
_DOMInnerObjectElement.width = @"100%";
_DOMInnerObjectElement.height = @"100%";
_DOMObjectElement.appendChild(_DOMParamElement);
_DOMObjectElement.appendChild(_DOMInnerObjectElement);
_DOMElement.appendChild(_DOMObjectElement);
}
else
[self _rebuildIEObjects];
#endif
}
return self;
}
@@ -83,7 +83,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
{
if (_flashMovie == aFlashMovie)
return;
_flashMovie = aFlashMovie;
#if PLATFORM(DOM)
if (!CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
@@ -105,14 +105,14 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
{
var varString = @"",
enumerator = [aDictionary keyEnumerator];
var key;
while (key = [enumerator nextObject])
varString = [varString stringByAppendingFormat:@"&%@=%@", key, [aDictionary objectForKey:key]];
if (!_params)
_params = [CPDictionary dictionary];
[_params setObject:varString forKey:@"flashvars"];
[self setParameters:_params];
}
@@ -129,7 +129,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
{
var elements = [_paramElements allValues],
count = [elements count];
for (var i = 0; i < count; i++)
_DOMObjectElement.removeChild([elements objectAtIndex:i]);
}
@@ -139,18 +139,18 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
if (!CPBrowserIsEngine(CPInternetExplorerBrowserEngine))
{
_paramElements = [CPDictionary dictionary];
var enumerator = [_params keyEnumerator],
key;
while (key = [enumerator nextObject] && _DOMObjectElement)
{
var param = document.createElement(@"param");
param.name = key;
param.value = [_params objectForKey:key];
_DOMObjectElement.appendChild(param);
[_paramElements setObject:param forKey:key];
}
}
@@ -170,17 +170,17 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
_DOMElement.innerHTML = @"";
if (![_flashMovie filename])
return;
var paramString = [CPString stringWithFormat:@"<param name='movie' value='%@' />", [_flashMovie filename]],
paramEnumerator = [_params keyEnumerator],
key;
while (key = [paramEnumerator nextObject])
paramString = [paramString stringByAppendingFormat:@"<param name='%@' value='%@' />", key, [_params objectForKey:key]];
_DOMObjectElement = document.createElement(@"object");
_DOMElement.appendChild(_DOMObjectElement);
_DOMObjectElement.outerHTML = [CPString stringWithFormat:@"<object classid=%@ width=%@ height=%@>%@</object>", IEFlashCLSID, CGRectGetWidth([self bounds]), CGRectGetHeight([self bounds]), paramString];
}
#endif
+30 -28
View File
@@ -45,7 +45,7 @@ var CPSharedFontManager = nil,
{
if (!CPSharedFontManager)
CPSharedFontManager = [[CPFontManagerFactory alloc] init];
return CPSharedFontManager;
}
@@ -65,7 +65,7 @@ var CPSharedFontManager = nil,
- (CPArray)availableFonts
{
if (!_availableFonts)
{
{
_CPFontDetectSpan = document.createElement("span");
_CPFontDetectSpan.fontSize = "24px";
_CPFontDetectSpan.appendChild(document.createTextNode("mmmmmmmmmml"));
@@ -74,13 +74,13 @@ var CPSharedFontManager = nil,
div.style.top = "-1000px";
div.appendChild(_CPFontDetectSpan);
document.getElementsByTagName("body")[0].appendChild(div);
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
_availableFonts = [];
for (var i = 0; i < _CPFontDetectAllFonts.length; i++) {
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
if (available)
if (available)
_availableFonts.push(_CPFontDetectAllFonts[i]);
}
}
@@ -101,8 +101,8 @@ var CPSharedFontManager = nil,
var _CPFontDetectSpan,
_CPFontDetectReferenceFonts,
_CPFontDetectAllFonts = [
/* "04b_21","A Charming Font","Abadi MT Condensed","Abadi MT Condensed Extra Bold","Abadi MT Condensed Light","Academy Engraved LET","Agency FB","Alba","Alba Matter","Alba Super","Algerian",*/
"American Typewriter",
/* "04b_21","A Charming Font","Abadi MT Condensed","Abadi MT Condensed Extra Bold","Abadi MT Condensed Light","Academy Engraved LET","Agency FB","Alba","Alba Matter","Alba Super","Algerian",*/
"American Typewriter",
/* "Andale Mono","Andale Mono IPA","Andy", */
"Apple Chancery","Arial","Arial Black","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS",
/* "Avant Garde","Avantgarde","Baby Kruffy","Base 02","Baskerville","Baskerville Old Face","Bauhaus 93","Beesknees ITC","Bell MT","Berlin Sans FB","Berlin Sans FB Demi","Bernard MT Condensed","Bickley Script",*/
@@ -122,8 +122,8 @@ var _CPFontDetectSpan,
/* "GlooGun","Gloucester MT Extra Condensed","Goudy Old Style","Goudy Stout","Haettenschweiler","Harlow Solid Italic","Harrington",*/
"Helvetica","Helvetica Narrow","Helvetica Neue","Herculanum","High Tower Text","Highlight LET","Hoefler Text","Impact","Imprint MT Shadow",
/* "Informal Roman","Jenkins v2.0","John Handy LET","Jokerman","Jokerman LET","Jokewood","Juice ITC","Kabel Ult BT","Kartika","Kino MT","Kristen ITC","Kunstler Script","La Bamba LET", */
"Lucida","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","Lucida Grande","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode",
/* "Luxi Mono","Luxi Sans","Luxi Serif","MARKETPRO","MS Reference Sans Serif","MS Reference Serif","Magneto","Maiandra GD", */
"Lucida","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","Lucida Grande","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode",
/* "Luxi Mono","Luxi Sans","Luxi Serif","MARKETPRO","MS Reference Sans Serif","MS Reference Serif","Magneto","Maiandra GD", */
"Marker Felt",
/* "Matisse ITC","Matura MT Script Capitals","Mead Bold","Mekanik LET","Mercurius Script MT Bold", */
"Microsoft Sans Serif","Milano LET","Minion Web","MisterEarl BT","Mistral","Monaco","Monotype Corsiva","Monotype.com","New Century Schoolbook","New York","News Gothic MT",
@@ -137,10 +137,10 @@ var _CPFontDetectSpan,
// Compare against the reference fonts. Return true if it produces a different size than at least one of them.
var _CPFontDetectFontAvailable = function(font) {
for (var i = 0; i < _CPFontDetectReferenceFonts.length; i++)
if (_CPFontDetectCompareFonts(_CPFontDetectReferenceFonts[i], font))
return true;
return false;
for (var i = 0; i < _CPFontDetectReferenceFonts.length; i++)
if (_CPFontDetectCompareFonts(_CPFontDetectReferenceFonts[i], font))
return true;
return false;
}
var _CPFontDetectCache = {};
@@ -148,27 +148,29 @@ var _CPFontDetectCache = {};
// Compares two given fonts. Returns true if they produce different sizes (i.e. fontA didn't fallback to fontB)
var _CPFontDetectCompareFonts = function(fontA, fontB) {
var a;
if (_CPFontDetectCache[fontA]) {
if (_CPFontDetectCache[fontA])
a = _CPFontDetectCache[fontA];
} else {
_CPFontDetectSpan.style.fontFamily = '"' + fontA + '"';
else
{
_CPFontDetectSpan.style.fontFamily = '"' + fontA + '"';
_CPFontDetectCache[fontA] = a = { w: _CPFontDetectSpan.offsetWidth, h: _CPFontDetectSpan.offsetHeight };
}
_CPFontDetectSpan.style.fontFamily= '"' + fontB + '", "' + fontA + '"';
var bWidth = _CPFontDetectSpan.offsetWidth;
var bHeight = _CPFontDetectSpan.offsetHeight;
return (a.w != bWidth || a.h != bHeight);
_CPFontDetectSpan.style.fontFamily = '"' + fontB + '", "' + fontA + '"';
var bWidth = _CPFontDetectSpan.offsetWidth,
Height = _CPFontDetectSpan.offsetHeight;
return (a.w != bWidth || a.h != bHeight);
}
// Test the candidate fonts pairwise until we find two that are different. Otherwise return the first.
var _CPFontDetectPickTwoDifferentFonts = function(candidates) {
for (var i = 0; i < candidates.length; i++)
for (var j = 0; j < i; j++)
if (_CPFontDetectCompareFonts(candidates[i], candidates[j]))
return [candidates[i], candidates[j]];
return [candidates[0]];
for (var i = 0; i < candidates.length; i++)
for (var j = 0; j < i; j++)
if (_CPFontDetectCompareFonts(candidates[i], candidates[j]))
return [candidates[i], candidates[j]];
return [candidates[0]];
}
[CPFontManager setFontManagerFactory:[CPFontManager class]];
+1 -1
View File
@@ -71,7 +71,7 @@ function CPPointMake(x, y)
function CPRectInset(aRect, dX, dY)
{
return CPRectMake( aRect.origin.x + dX, aRect.origin.y + dY,
aRect.size.width - 2 * dX, aRect.size.height - 2*dY);
aRect.size.width - 2 * dX, aRect.size.height - 2 * dY);
}
/*!
+2 -2
View File
@@ -71,10 +71,10 @@ var CPGraphicsContextCurrent = nil;
- (id)initWithGraphicsPort:(CPContext)aGraphicsPort
{
self = [super init];
if (self)
_graphicsPort = aGraphicsPort;
return self;
}
+45 -44
View File
@@ -43,7 +43,7 @@ CPImageAlignRight = 8;
var CPImageViewShadowBackgroundColor = nil,
CPImageViewEmptyPlaceholderImage = nil;
var LEFT_SHADOW_INSET = 3.0,
RIGHT_SHADOW_INSET = 3.0,
TOP_SHADOW_INSET = 3.0,
@@ -51,7 +51,7 @@ var LEFT_SHADOW_INSET = 3.0,
VERTICAL_SHADOW_INSET = TOP_SHADOW_INSET + BOTTOM_SHADOW_INSET,
HORIZONTAL_SHADOW_INSET = LEFT_SHADOW_INSET + RIGHT_SHADOW_INSET;
/*!
/*!
@ingroup appkit
@class CPImageView
@@ -60,7 +60,7 @@ var LEFT_SHADOW_INSET = 3.0,
@implementation CPImageView : CPControl
{
DOMElement _DOMImageElement;
BOOL _hasShadow;
CPView _shadowView;
@@ -73,14 +73,14 @@ var LEFT_SHADOW_INSET = 3.0,
+ (void)initialize
{
var bundle = [CPBundle bundleForClass:[CPView class]];
CPImageViewEmptyPlaceholderImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"empty.png"]];
}
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self)
{
#if PLATFORM(DOM)
@@ -96,11 +96,11 @@ var LEFT_SHADOW_INSET = 3.0,
}
CPDOMDisplayServerAppendChild(_DOMElement, _DOMImageElement);
_DOMImageElement.style.visibility = "hidden";
#endif
}
return self;
}
@@ -121,29 +121,29 @@ var LEFT_SHADOW_INSET = 3.0,
- (void)setObjectValue:(CPImage)anImage
{
var oldImage = [self objectValue];
if (oldImage === anImage)
return;
[super setObjectValue:anImage];
var defaultCenter = [CPNotificationCenter defaultCenter];
if (oldImage)
[defaultCenter removeObserver:self name:CPImageDidLoadNotification object:oldImage];
var newImage = [self objectValue];
#if PLATFORM(DOM)
_DOMImageElement.src = newImage ? [newImage filename] : [CPImageViewEmptyPlaceholderImage filename];
#endif
var size = [newImage size];
if (size && size.width === -1 && size.height === -1)
{
[defaultCenter addObserver:self selector:@selector(imageDidLoad:) name:CPImageDidLoadNotification object:newImage];
#if PLATFORM(DOM)
_DOMImageElement.width = 0;
_DOMImageElement.height = 0;
@@ -162,7 +162,7 @@ var LEFT_SHADOW_INSET = 3.0,
- (void)imageDidLoad:(CPNotification)aNotification
{
[self hideOrDisplayContents];
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
@@ -184,25 +184,25 @@ var LEFT_SHADOW_INSET = 3.0,
{
if (_hasShadow == shouldHaveShadow)
return;
_hasShadow = shouldHaveShadow;
if (_hasShadow)
{
_shadowView = [[CPShadowView alloc] initWithFrame:[self bounds]];
[self addSubview:_shadowView];
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
else
{
[_shadowView removeFromSuperview];
_shadowView = nil;
}
[self hideOrDisplayContents];
}
@@ -215,12 +215,12 @@ var LEFT_SHADOW_INSET = 3.0,
{
if (_imageAlignment == anImageAlignment)
return;
_imageAlignment = anImageAlignment;
if (![self image])
return;
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
@@ -238,14 +238,14 @@ var LEFT_SHADOW_INSET = 3.0,
- (void)setImageScaling:(CPImageScaling)anImageScaling
{
[super setImageScaling:anImageScaling];
#if PLATFORM(DOM)
if ([self currentValueForThemeAttribute:@"image-scaling"] === CPScaleToFit)
{
CPDOMDisplayServerSetStyleLeftTop(_DOMImageElement, NULL, 0.0, 0.0);
}
#endif
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
@@ -314,7 +314,7 @@ var LEFT_SHADOW_INSET = 3.0,
else
{
var size = [image size];
if (size.width == -1 && size.height == -1)
return;
@@ -331,7 +331,7 @@ var LEFT_SHADOW_INSET = 3.0,
{
var imageRatio = size.width / size.height,
viewRatio = width / height;
if (viewRatio > imageRatio)
width = height * imageRatio;
else
@@ -348,7 +348,7 @@ var LEFT_SHADOW_INSET = 3.0,
width = size.width;
height = size.height;
}
if (imageScaling == CPScaleNone)
{
#if PLATFORM(DOM)
@@ -357,8 +357,9 @@ var LEFT_SHADOW_INSET = 3.0,
#endif
}
var x, y;
var x,
y;
switch (_imageAlignment)
{
case CPImageAlignLeft:
@@ -366,7 +367,7 @@ var LEFT_SHADOW_INSET = 3.0,
case CPImageAlignBottomLeft:
x = 0.0;
break;
case CPImageAlignRight:
case CPImageAlignTopRight:
case CPImageAlignBottomRight:
@@ -377,7 +378,7 @@ var LEFT_SHADOW_INSET = 3.0,
x = (boundsWidth - width) / 2.0;
break;
}
switch (_imageAlignment)
{
case CPImageAlignTop:
@@ -385,7 +386,7 @@ var LEFT_SHADOW_INSET = 3.0,
case CPImageAlignTopRight:
y = 0.0;
break;
case CPImageAlignBottom:
case CPImageAlignBottomLeft:
case CPImageAlignBottomRight:
@@ -395,7 +396,7 @@ var LEFT_SHADOW_INSET = 3.0,
default:
y = (boundsHeight - height) / 2.0;
break;
}
}
#if PLATFORM(DOM)
CPDOMDisplayServerSetStyleLeftTop(_DOMImageElement, NULL, x, y);
@@ -403,7 +404,7 @@ var LEFT_SHADOW_INSET = 3.0,
}
_imageRect = _CGRectMake(x, y, width, height);
if (_hasShadow)
[_shadowView setFrame:_CGRectMake(x - LEFT_SHADOW_INSET, y - TOP_SHADOW_INSET, width + insetWidth, height + insetHeight)];
}
@@ -450,7 +451,7 @@ var LEFT_SHADOW_INSET = 3.0,
[self setImage:images[0]];
[self sendAction:[self action] to:[self target]];
}
return YES;
}
@@ -485,7 +486,7 @@ var CPImageViewImageKey = @"CPImageViewImageKey",
#endif
self = [super initWithCoder:aCoder];
if (self)
{
#if PLATFORM(DOM)
@@ -494,14 +495,14 @@ var CPImageViewImageKey = @"CPImageViewImageKey",
[self setHasShadow:[aCoder decodeBoolForKey:CPImageViewHasShadowKey]];
[self setImageAlignment:[aCoder decodeIntForKey:CPImageViewImageAlignmentKey]];
if ([aCoder decodeBoolForKey:CPImageViewIsEditableKey] || NO)
[self setEditable:YES];
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
return self;
}
@@ -512,21 +513,21 @@ var CPImageViewImageKey = @"CPImageViewImageKey",
*/
- (void)encodeWithCoder:(CPCoder)aCoder
{
// We do this in order to avoid encoding the _shadowView, which
// We do this in order to avoid encoding the _shadowView, which
// should just automatically be created programmatically as needed.
if (_shadowView)
{
var actualSubviews = _subviews;
_subviews = [_subviews copy];
[_subviews removeObjectIdenticalTo:_shadowView];
}
[super encodeWithCoder:aCoder];
if (_shadowView)
_subviews = actualSubviews;
[aCoder encodeBool:_hasShadow forKey:CPImageViewHasShadowKey];
[aCoder encodeInt:_imageAlignment forKey:CPImageViewImageAlignmentKey];
+13 -9
View File
@@ -513,10 +513,10 @@ CPOutlineViewDropOnItemIndex = -1;
],
delegateCount = [delegateMethods count];
for (var i=0; i < delegateCount; i += 2)
for (var i = 0; i < delegateCount; i += 2)
{
var bitMask = delegateMethods[i],
selector = delegateMethods[i+1];
selector = delegateMethods[i + 1];
if ([_outlineViewDelegate respondsToSelector:selector])
_implementedOutlineViewDelegateMethods |= bitMask;
@@ -670,8 +670,8 @@ CPOutlineViewDropOnItemIndex = -1;
if (_shouldRetargetItem)
return _retargetedItem;
var lowerLevel = [self levelForRow:theLowerRowIndex]
upperItem = [self itemAtRow:theUpperRowIndex];
var lowerLevel = [self levelForRow:theLowerRowIndex],
upperItem = [self itemAtRow:theUpperRowIndex],
upperLevel = [self levelForItem:upperItem];
// If the row above us has a higher level the item can be added to multiple parent items
@@ -875,7 +875,7 @@ var _reloadItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem)
if (!anItem)
return;
with(anOutlineView)
with (anOutlineView)
{
// Get the existing info if it exists.
var itemInfosForItems = _itemInfosForItems,
@@ -911,7 +911,7 @@ var _reloadItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem)
// FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever...
var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anItem, /*BOOL*/ isIntermediate)
{
with(anOutlineView)
with (anOutlineView)
{
var itemInfosForItems = _itemInfosForItems,
dataSource = _outlineViewDataSource;
@@ -1261,12 +1261,16 @@ var _loadItemInfoForItem = function(/*CPOutlineView*/ anOutlineView, /*id*/ anIt
CGContextBeginPath(context);
CGContextMoveToPoint(context, 0.0, 0.0);
if(_angle === 0.0) {
if (_angle === 0.0)
{
CGContextAddLineToPoint(context, 4.5, 8.0);
CGContextAddLineToPoint(context, 9.0, 0.0);
} else {
CGContextAddLineToPoint(context, 4.5, 8.0);
}
else
CGContextAddLineToPoint(context, 4.5, 8.0);
CGContextSetStrokeColor(context, [CPColor colorWithCalibratedWhite:1.0 alpha: 0.8]);
CGContextStrokePath(context);
}
+24 -24
View File
@@ -50,18 +50,18 @@ CPImagePboardType = @"CPImagePboardType";
var CPPasteboards = nil,
supportsNativePasteboard = NO;
/*!
/*!
@ingroup appkit
@class CPPasteboard
CPPasteBoard is the object responsible for cut/copy/paste and drag&drop operations.
CPPasteBoard is the object responsible for cut/copy/paste and drag&drop operations.
*/
@implementation CPPasteboard : CPObject
{
CPArray _types;
CPDictionary _owners;
CPDictionary _provided;
unsigned _changeCount;
CPString _stateUID;
@@ -77,7 +77,7 @@ var CPPasteboards = nil,
return;
[self setVersion:1.0];
CPPasteboards = [CPDictionary dictionary];
if (typeof window.cpPasteboardWithName !== "undefined")
@@ -103,10 +103,10 @@ var CPPasteboards = nil,
if (pasteboard)
return pasteboard;
pasteboard = [[CPPasteboard alloc] _initWithName:aName];
[CPPasteboards setObject:pasteboard forKey:aName];
return pasteboard;
}
@@ -114,15 +114,15 @@ var CPPasteboards = nil,
- (id)_initWithName:(CPString)aName
{
self = [super init];
if (self)
{
_name = aName;
_types = [];
_owners = [CPDictionary dictionary];
_provided = [CPDictionary dictionary];
_changeCount = 0;
if (supportsNativePasteboard)
@@ -131,7 +131,7 @@ var CPPasteboards = nil,
[self _synchronizePasteboard];
}
}
return self;
}
@@ -145,17 +145,17 @@ var CPPasteboards = nil,
{
var i = 0,
count = types.length;
for (; i < count; ++i)
{
var type = types[i];
if(![_owners objectForKey:type])
if (![_owners objectForKey:type])
{
[_types addObject:type];
[_provided removeObjectForKey:type];
}
[_owners setObject:anOwner forKey:type];
}
@@ -191,7 +191,7 @@ var CPPasteboards = nil,
_provided = [CPDictionary dictionary];
var count = _types.length;
while (count--)
[_owners setObject:anOwner forKey:_types[count]];
@@ -283,18 +283,18 @@ var CPPasteboards = nil,
- (CPData)dataForType:(CPString)aType
{
var data = [_provided objectForKey:aType];
if (data)
return data;
var owner = [_owners objectForKey:aType];
if (owner)
{
[owner pasteboard:self provideDataForType:aType];
[owner pasteboard:self provideDataForType:aType];
return [_provided objectForKey:aType];
}
if (aType === CPStringPboardType)
return [self dataForType:UTF8PboardType];
@@ -339,10 +339,10 @@ var CPPasteboards = nil,
- (id)propertyListForType:(CPString)aType
{
var data = [self dataForType:aType];
if (data)
return [CPPropertyListSerialization propertyListFromData:data format:CPPropertyList280NorthFormat_v1_0];
return nil;
}
@@ -360,9 +360,9 @@ var CPPasteboards = nil,
- (CPString)_generateStateUID
{
var bits = 32;
_stateUID = @"";
while (bits--)
_stateUID += FLOOR(RAND() * 16.0).toString(16).toUpperCase();
+39 -40
View File
@@ -47,7 +47,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
CPProgressIndicatorStyleIdentifiers = nil,
CPProgressIndicatorStyleSizes = nil;
/*!
/*!
@ingroup appkit
@class CPProgressIndicator
@@ -59,19 +59,19 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
double _minValue;
double _maxValue;
double _doubleValue;
CPControlSize _controlSize;
BOOL _isIndeterminate;
CPProgressIndicatorStyle _style;
BOOL _isAnimating;
BOOL _isDisplayedWhenStoppedSet;
BOOL _isDisplayedWhenStopped;
CPView _barView;
}
@@ -82,11 +82,11 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (self != [CPProgressIndicator class])
return;
var bundle = [CPBundle bundleForClass:self];
CPProgressIndicatorSpinningStyleColors = [];
CPProgressIndicatorSpinningStyleColors[CPMiniControlSize] = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:
[bundle pathForResource:@"CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif"] size:CGSizeMake(64.0, 64.0)]];
CPProgressIndicatorSpinningStyleColors[CPSmallControlSize] = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:
@@ -95,10 +95,10 @@ var CPProgressIndicatorSpinningStyleColors = nil,
[bundle pathForResource:@"CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif"] size:CGSizeMake(64.0, 64.0)]];
CPProgressIndicatorBezelBorderViewPool = [];
var start = CPProgressIndicatorBarStyle,
end = CPProgressIndicatorHUDBarStyle;
for (; start <= end; ++start)
{
CPProgressIndicatorBezelBorderViewPool[start] = [];
@@ -106,14 +106,14 @@ var CPProgressIndicatorSpinningStyleColors = nil,
CPProgressIndicatorBezelBorderViewPool[start][CPSmallControlSize] = [];
CPProgressIndicatorBezelBorderViewPool[start][CPRegularControlSize] = [];
}
CPProgressIndicatorClassName = [self className];
CPProgressIndicatorStyleIdentifiers = [];
CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle] = @"Bar";
CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorSpinningStyle] = @"Spinny";
CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle] = @"HUDBar";
var regularIdentifier = _CPControlIdentifierForControlSize(CPRegularControlSize),
smallIdentifier = _CPControlIdentifierForControlSize(CPSmallControlSize),
miniIdentifier = _CPControlIdentifierForControlSize(CPMiniControlSize);
@@ -140,23 +140,23 @@ var CPProgressIndicatorSpinningStyleColors = nil,
- (id)initWithFrame:(CGRect)aFrame
{
self = [super initWithFrame:aFrame];
if (self)
{
_minValue = 0.0;
_maxValue = 100.0;
_doubleValue = 0.0;
_style = CPProgressIndicatorBarStyle;
_isDisplayedWhenStoppedSet = NO;
_controlSize = CPRegularControlSize;
[self updateBackgroundColor];
[self drawBar];
}
return self;
}
@@ -174,7 +174,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
- (void)startAnimation:(id)aSender
{
_isAnimating = YES;
[self _hideOrDisplay];
}
@@ -213,7 +213,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
- (void)setDoubleValue:(double)aValue
{
_doubleValue = MIN(MAX(aValue, _minValue), _maxValue);
[self drawBar];
}
@@ -268,7 +268,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_controlSize == aControlSize)
return;
_controlSize = aControlSize;
[self updateBackgroundColor];
@@ -320,7 +320,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_isIndeterminate == isIndeterminate)
return;
_isIndeterminate = isIndeterminate;
[self updateBackgroundColor];
@@ -342,9 +342,9 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_style == aStyle)
return;
_style = aStyle;
[self updateBackgroundColor];
}
@@ -357,8 +357,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
[self setFrameSize:[[CPProgressIndicatorSpinningStyleColors[_controlSize] patternImage] size]];
else
[self setFrameSize:CGSizeMake(CGRectGetWidth([self frame]), CPProgressIndicatorStyleSizes[
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle] +
_CPControlIdentifierForControlSize(_controlSize)][0].height)];
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle] + _CPControlIdentifierForControlSize(_controlSize)][0].height)];
}
/*!
@@ -370,11 +369,11 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_isDisplayedWhenStoppedSet && _isDisplayedWhenStopped == isDisplayedWhenStopped)
return;
_isDisplayedWhenStoppedSet = YES;
_isDisplayedWhenStopped = isDisplayedWhenStopped;
[self _hideOrDisplay];
}
@@ -385,10 +384,10 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_isDisplayedWhenStoppedSet)
return _isDisplayedWhenStopped;
if (_style == CPProgressIndicatorBarStyle || _style == CPProgressIndicatorHUDBarStyle)
return YES;
return NO;
}
@@ -401,7 +400,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
- (void)setFrameSize:(CGSize)aSize
{
[super setFrameSize:aSize];
[self drawBar];
}
@@ -410,13 +409,13 @@ var CPProgressIndicatorSpinningStyleColors = nil,
{
if (_style == CPProgressIndicatorSpinningStyle)
return;
if (!_barView)
{
_barView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 16.0)];
_barView = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 16.0)];
[self addSubview:_barView];
}
[_barView setBackgroundColor:_CPControlThreePartImagePattern(
NO,
CPProgressIndicatorStyleSizes,
@@ -442,9 +441,9 @@ var CPProgressIndicatorSpinningStyleColors = nil,
if (_style == CPProgressIndicatorSpinningStyle)
{
[_barView removeFromSuperview];
_barView = nil;
[self setBackgroundColor:CPProgressIndicatorSpinningStyleColors[_controlSize]];
}
else
@@ -456,7 +455,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
@"BezelBorder",
CPProgressIndicatorStyleIdentifiers[_style],
_CPControlIdentifierForControlSize(_controlSize))];
[self drawBar];
}
}
+10 -10
View File
@@ -8,7 +8,7 @@
function main(args)
{
args.shift();
if (args.length < 1)
return printUsage();
@@ -18,7 +18,7 @@ function main(args)
for (; index < count; ++index)
{
var argument = args[index];
switch (argument)
{
case "version":
@@ -30,7 +30,7 @@ function main(args)
case "config": return config.apply(this, args.slice(index + 1));
case "gen": return gen.apply(this, args.slice(index + 1));
default: print("unknown command " + argument);
}
}
@@ -66,38 +66,38 @@ function getFiles(/*File*/ sourceDirectory, /*nil|String|Array<String>*/ extensi
{
var index = 0,
count = files.length;
for (; index < count; ++index)
{
var file = files[index],
name = FILE.basename(file),
isValidExtension = !extensions;
if (exclusions && fileArrayContainsFile(exclusions, file))
continue;
if (!isValidExtension)
if (hasMultipleExtensions)
{
var extensionCount = extensions.length;
while (extensionCount-- && !isValidExtension)
{
var extension = extensions[extensionCount];
if (name.substring(name.length - extension.length - 1) === ("." + extension))
isValidExtension = true;
}
}
else if (name.substring(name.length - extensions.length - 1) === ("." + extensions))
isValidExtension = true;
if (FILE.isDirectory(file))
matches = matches.concat(getFiles(file, extensions, exclusions));
else if (isValidExtension)
matches.push(file);
}
}
return matches;
}
+1 -1
View File
@@ -52,7 +52,7 @@ ConverterConversionException = @"ConverterConversionException";
}
- (void)convert
{
{
try
{
if ([resourcesPath length] && !FILE.isReadable(resourcesPath))
+1 -1
View File
@@ -19,7 +19,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
+1 -1
View File
@@ -45,7 +45,7 @@ var NSButtonIsBorderedMask = 0x00800000,
NSButtonImagePositionShift = 16,
NSButtonNoImagePositionMask = 0x04,
NSButtonImageAbovePositionMask = 0x0C,
NSButtonImageBelowPositionMask = 0x1C;
NSButtonImageBelowPositionMask = 0x1C,
NSButtonImageRightPositionMask = 0x2C,
NSButtonImageLeftPositionMask = 0x3C,
NSButtonImageOnlyPositionMask = 0x44,
+3 -3
View File
@@ -11,7 +11,7 @@ var _CPCibClassSwapperClassNameKey = @"_CPCibClassSwapperClassNameKey",
+ (id)swapperClassForClassName:(CPString)aClassName originalClassName:(CPString)anOriginalClassName
{
var swapperClassName = "$NSClassSwapper_" + aClassName + "_" + anOriginalClassName;
var swapperClassName = "$NSClassSwapper_" + aClassName + "_" + anOriginalClassName,
swapperClass = objj_lookUpClass(swapperClassName);
if (!swapperClass)
@@ -41,11 +41,11 @@ var _CPCibClassSwapperClassNameKey = @"_CPCibClassSwapperClassNameKey",
{
return [_CPCibClassSwapper class];
}, "");
class_addMethod(swapperClass, @selector(encodeWithCoder:), function(self, _cmd, aCoder)
{
objj_msgSendSuper({super_class:originalClass, receiver:self}, _cmd, aCoder);
// FIXME: map class name as well?
[aCoder encodeObject:aClassName forKey:_CPCibClassSwapperClassNameKey];
[aCoder encodeObject:CP_NSMapClassName(anOriginalClassName) forKey:_CPCibClassSwapperOriginalClassNameKey];
+3 -3
View File
@@ -30,13 +30,13 @@
if (self = [super NS_initWithCoder:aCoder])
{
_documentView = [aCoder decodeObjectForKey:"NSDocView"];
if ([aCoder containsValueForKey:"NSBGColor"])
[self setBackgroundColor:[aCoder decodeObjectForKey:"NSBGColor"]];
//var flags = [aCoder decodeIntForKey:"NScvFlags"];
}
return self;
}
+6 -6
View File
@@ -28,30 +28,30 @@
{
_items = [];
_content = [];
_cachedItems = [];
_itemSize = CGSizeMakeZero();
_minItemSize = CGSizeMakeZero();
_maxItemSize = CGSizeMakeZero();
_verticalMargin = 5.0;
_tileWidth = -1.0;
_selectionIndexes = [CPIndexSet indexSet];
_allowsEmptySelection = YES;
if (self = [super NS_initWithCoder:aCoder])
{
_backgroundColors = [aCoder decodeObjectForKey:@"NSBackgroundColors"];
_maxNumberOfRows = [aCoder decodeIntForKey:@"NSMaxNumberOfGridRows"];
_maxNumberOfColumns = [aCoder decodeIntForKey:@"NSMaxNumberOfGridColumns"];
_isSelectable = [aCoder decodeBoolForKey:@"NSSelectable"];
_allowsMultipleSelection = [aCoder decodeBoolForKey:@"NSAllowsMultipleSelection"];
}
return self;
}
+7 -7
View File
@@ -47,7 +47,7 @@ var NSUnknownColorSpaceModel = -1,
{
case 1: // [NSColor colorWithCalibratedRed:values[0] green:values[1] blue:values[2] alpha:values[3]];
case 2: // [NSColor colorWithDeviceRed:values[0] green:values[1] blue:values[2] alpha:values[3]];
// NSComponents data
// NSCustomColorSpace NSColorSpace
var rgb = [aCoder decodeBytesForKey:@"NSRGB"],
@@ -60,15 +60,15 @@ var NSUnknownColorSpaceModel = -1,
result = [CPColor colorWithCalibratedRed:values[0] green:values[1] blue:values[2] alpha:values[3]];
break;
case 3: // [NSColor colorWithCalibratedWhite:values[0] alpha:values[1]];
case 4: // [NSColor colorWithDeviceWhite:values[0] alpha:values[1]];
var bytes = [aCoder decodeBytesForKey:@"NSWhite"],
string = CFData.bytesToString(bytes),
components = [string componentsSeparatedByString:@" "],
values = [0,1];
for (var i = 0; i < components.length && i < 2; i++)
values[i] = [components[i] floatValue];
@@ -80,7 +80,7 @@ var NSUnknownColorSpaceModel = -1,
string = CFData.bytesToString(rgb),
components = [string componentsSeparatedByString:@" "],
values = [0,0,0,0,1];
for (var i = 0; i < components.length && i < 5; i++)
values[i] = [components[i] floatValue];
@@ -91,9 +91,9 @@ var NSUnknownColorSpaceModel = -1,
var catalogName = [aCoder decodeObjectForKey:@"NSCatalogName"],
colorName = [aCoder decodeObjectForKey:@"NSColorName"],
color = [aCoder decodeObjectForKey:@"NSColor"];
// We don't having color mappings implemented, so just use the cached NSColor
if (catalogName === @"System")
{
var //display = [NSDisplay currentDisplay],
+2 -2
View File
@@ -31,13 +31,13 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
[self setBordered:[aCoder decodeBoolForKey:"NSIsBordered"]];
[self setColor:[aCoder decodeObjectForKey:"NSColor"]];
}
return self;
}
+6 -6
View File
@@ -31,18 +31,18 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
[self sendActionOn:CPLeftMouseUpMask];
var cell = [aCoder decodeObjectForKey:@"NSCell"];
[self setObjectValue:[cell objectValue]];
[self setFont:[cell font]];
[self setAlignment:[cell alignment]];
[self setEnabled:[aCoder decodeObjectForKey:@"NSEnabled"]];
[self setContinuous:[cell isContinuous]];
@@ -51,7 +51,7 @@
[self setLineBreakMode:[cell lineBreakMode]];
}
return self;
}
+3 -3
View File
@@ -28,10 +28,10 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self){
if (self)
_className = CP_NSMapClassName([aCoder decodeObjectForKey:@"NSClassName"]);
}
return self;
}
+3 -3
View File
@@ -35,17 +35,17 @@ var _CPCibCustomViewClassNameKey = @"_CPCibCustomViewClassNameKey";
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
_className = [aCoder decodeObjectForKey:@"NSClassName"];
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:CP_NSMapClassName(_className) forKey:_CPCibCustomViewClassNameKey];
}
+6 -6
View File
@@ -30,14 +30,14 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [self init];
if (self)
{
/* id owner;
if((owner=[nameTable objectForKey:NSNibOwner])!=nil)
[nameTable setObject:owner forKey:@"File's Owner"];
[nameTable setObject:[NSFontManager sharedFontManager] forKey:@"Font Manager"];
*/
_namesKeys = [aCoder decodeObjectForKey:@"NSNamesKeys"];
@@ -51,7 +51,7 @@
_classesValues = [aCoder decodeObjectForKey:@"NSClassesValues"];
_connections = [aCoder decodeObjectForKey:@"NSConnections"];
//_fontManager = [aCoder decodeObjectForKey:@"NSFontManager"] retain];
_framework = [aCoder decodeObjectForKey:@"NSFramework"];
@@ -76,8 +76,8 @@
{
// FIXME: Remove from top level objects and connections?
// Most cell references should be naturally removed by the fact that we don't manually
// encode them anywhere, however, they remain in our object graph. For each cell found,
// Most cell references should be naturally removed by the fact that we don't manually
// encode them anywhere, however, they remain in our object graph. For each cell found,
// take its children and promote them to our parent object's children.
var count = _objectsKeys.length,
parentForCellUIDs = { },
+11 -11
View File
@@ -28,16 +28,16 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
var cell = [aCoder decodeObjectForKey:@"NSCell"];
[self setImageScaling:[cell imageScaling]];
[self setImageAlignment:[cell imageAlignment]];
_isEditable = [cell isEditable];
}
return self;
}
@@ -92,24 +92,24 @@ NSImageScalingToCPImageScaling[NSImageScaleProportionallyUpOrDown] = CPScalePro
@implementation NSImageCell : NSCell
{
BOOL _animates @accessors;
BOOL _animates @accessors;
NSImageAlignment _imageAlignment @accessors(readonly, getter=imageAlignment);
NSImageScaling _imageScaling @accessors(readonly, getter=imageScaling);
NSImageFrameStyle _frameStyle @accessors;
}
- (id)initWithCoder:(CPCoder)aCoder
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
self = [super initWithCoder:aCoder];
if (self)
{
_animates = [aCoder decodeBoolForKey:@"NSAnimates"];
_imageAlignment = [aCoder decodeIntForKey:@"NSAlign"];
_imageScaling = NSImageScalingToCPImageScaling[[aCoder decodeIntForKey:@"NSScale"]];
_animates = [aCoder decodeBoolForKey:@"NSAnimates"];
_imageAlignment = [aCoder decodeIntForKey:@"NSAlign"];
_imageScaling = NSImageScalingToCPImageScaling[[aCoder decodeIntForKey:@"NSScale"]];
_frameStyle = [aCoder decodeIntForKey:@"NSStyle"];
}
return self;
}
+2 -2
View File
@@ -41,7 +41,7 @@ NS_CPMenuNameMap =
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_title = [aCoder decodeObjectForKey:@"NSTitle"];
@@ -55,7 +55,7 @@ NS_CPMenuNameMap =
_showsStateColumn = ![aCoder containsValueForKey:@"NSMenuExcludeMarkColumn"] || ![aCoder decodeBoolForKey:@"NSMenuExcludeMarkColumn"];
}
return self;
}
+4 -4
View File
@@ -31,7 +31,7 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_isSeparator = [aCoder decodeObjectForKey:@"NSIsSeparator"] || NO;
@@ -62,15 +62,15 @@
_keyEquivalentModifierMask = CP_NSMapKeyMask([aCoder decodeObjectForKey:"NSKeyEquivModMask"]);
// _mnemonicLocation = [aCoder decodeObjectForKey:"NSMnemonicLoc"];
// _isAlternate = [aCoder decodeBoolForKey:"NSIsAlternate"];
_indentationLevel = [aCoder decodeIntForKey:"NSIndent"];
// _toolTip;
// _representedObject = [aCoder decodeObjectForKey:CPMenuItemRepresentedObjectKey];
}
return self;
}
+5 -5
View File
@@ -28,20 +28,20 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
if([aCoder containsValueForKey:"NSOutlineViewOutlineTableColumnKey"])
if ([aCoder containsValueForKey:"NSOutlineViewOutlineTableColumnKey"])
_outlineTableColumn = [aCoder decodeObjectForKey:@"NSOutlineViewOutlineTableColumnKey"];
else
_outlineTableColumn = [[self tableColumns] objectAtIndex:0];
_indentationPerLevel = [aCoder decodeFloatForKey:@"NSOutlineViewIndentationPerLevelKey"];
_outlineViewDataSource = [aCoder decodeObjectForKey:@"NSDataSource"];
_outlineViewDelegate = [aCoder decodeObjectForKey:@"NSDelegate"];
}
return self;
}
+6 -6
View File
@@ -32,17 +32,17 @@
if (self = [super NS_initWithCoder:aCoder])
{
var cell = [aCoder decodeObjectForKey:@"NSCell"];
_menu = [cell menu];
// make sure it's not null/undefined
//FIXME push this check to CPPopUpButton?
_selectedIndex = [cell selectedIndex] || 0;
[self setPullsDown:[cell pullsDown]];
_preferredEdge = [cell preferredEdge];
}
return self;
}
@@ -76,15 +76,15 @@
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
{
pullsDown = [aCoder decodeBoolForKey:@"NSPullDown"];
selectedIndex = [aCoder decodeIntForKey:@"NSSelectedIndex"];
preferredEdge = [aCoder decodeIntForKey:@"NSPreferredEdge"];
menu = [aCoder decodeObjectForKey:@"NSMenu"];
}
return self;
}
+2 -2
View File
@@ -28,10 +28,10 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
[self setNextResponder:[aCoder decodeObjectForKey:@"NSNextResponder"]];
return self;
}
+4 -4
View File
@@ -30,11 +30,11 @@
if (self = [super NS_initWithCoder:aCoder])
{
var flags = [aCoder decodeIntForKey:"NSsFlags"];
_verticalScroller = [aCoder decodeObjectForKey:"NSVScroller"];
_horizontalScroller = [aCoder decodeObjectForKey:"NSHScroller"];
_contentView = [aCoder decodeObjectForKey:"NSContentView"];
_headerClipView = [aCoder decodeObjectForKey:"NSHeaderClipView"];
_cornerView = [aCoder decodeObjectForKey:"NSCornerView"];
_bottomCornerView = [[CPView alloc] init];
@@ -44,7 +44,7 @@
_hasVerticalScroller = !!(flags & (1 << 4));
_hasHorizontalScroller = !!(flags & (1 << 5));
_autohidesScrollers = !!(flags & (1 << 9));
_borderType = flags & 0x03;
//[aCoder decodeBytesForKey:"NSScrollAmts"];
@@ -53,7 +53,7 @@
_horizontalLineScroll = 10.0;
_horizontalPageScroll = 10.0;
}
return self;
}
+2 -2
View File
@@ -31,7 +31,7 @@
{
//"NSsFlags"
//"NSArrowsLoc"
_controlSize = CPRegularControlSize;
//if ([aCoder containsValueForKey:CPScrollerControlSizeKey])
// _controlSize = [aCoder decodeIntForKey:CPScrollerControlSizeKey];
@@ -39,7 +39,7 @@
_knobProportion = 1.0;
if ([aCoder containsValueForKey:"NSPercent"])
_knobProportion = [aCoder decodeFloatForKey:"NSPercent"];
_value = 0.0;
// Cocoa uses NSCurValue instead of NSControl's NSContents
if ([aCoder containsValueForKey:"NSCurValue"])
+4 -4
View File
@@ -47,7 +47,7 @@
_trackingMode = [cell trackingMode];
[self setValue:CPCenterTextAlignment forThemeAttribute:@"alignment"];
// HACK
for (var i = 0; i < _segments.length; i++)
@@ -98,11 +98,11 @@
_selectedSegment = [aCoder decodeIntForKey:"NSSelectedSegment"] || -1;
_segmentStyle = [aCoder decodeIntForKey:"NSSegmentStyle"];
_trackingMode = [aCoder decodeIntForKey:"NSTrackingMode"] || CPSegmentSwitchTrackingSelectOne;
if (_trackingMode == CPSegmentSwitchTrackingSelectOne && _selectedSegment == -1)
_selectedSegment = 0;
}
return self;
}
@@ -128,7 +128,7 @@
// NSSegmentItemImageScaling
// NSSegmentItemTooltip
}
return self;
}
+1 -1
View File
@@ -19,7 +19,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
@import <Foundation/CPSet.j>
+7 -6
View File
@@ -42,14 +42,15 @@
_altIncrementValue = [cell altIncrementValue];
[self setSliderType:[cell sliderType]];
if ([self sliderType] === CPCircularSlider)
{
var frame = [self frame];
[self setFrameSize:CGSizeMake(frame.size.width + 4.0, frame.size.height + 2.0)];
}
}
return self;
}
@@ -83,19 +84,19 @@
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
_objectValue = [aCoder decodeDoubleForKey:@"NSValue"];
_minValue = [aCoder decodeDoubleForKey:@"NSMinValue"];
_maxValue = [aCoder decodeDoubleForKey:@"NSMaxValue"];
_altIncrementValue = [aCoder decodeDoubleForKey:@"NSAltIncValue"];
_isVertical = [aCoder decodeBoolForKey:@"NSVertical"];
_sliderType = [aCoder decodeIntForKey:@"NSSliderType"] || 0;
}
return self;
}
+1 -1
View File
@@ -32,7 +32,7 @@
_isVertical = [aCoder decodeBoolForKey:@"NSIsVertical"];
_isPaneSplitter = [aCoder decodeIntForKey:@"NSDividerStyle"] == 2 ? YES : NO;
}
return self;
}
+2 -2
View File
@@ -36,10 +36,10 @@
_bounds.size.height = 23;
_frame.size.height = 23;
}
_drawsColumnLines = YES;
}
return self;
}
+17 -17
View File
@@ -28,52 +28,52 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
var flags = [aCoder decodeIntForKey:@"NSTvFlags"];
//_dataSource = [aCoder decodeObjectForKey:CPTableViewDataSourceKey];
//_delegate = [aCoder decodeObjectForKey:CPTableViewDelegateKey];
_rowHeight = [aCoder decodeFloatForKey:@"NSRowHeight"];
// Convert xib default to cib default
if (_rowHeight == 17)
_rowHeight = 23;
_headerView = [aCoder decodeObjectForKey:@"NSHeaderView"];
_headerView = [aCoder decodeObjectForKey:@"NSHeaderView"];
_cornerView = [aCoder decodeObjectForKey:@"NSCornerView"];
_autosaveName = [aCoder decodeObjectForKey:@"NSAutosaveName"];
_tableColumns = [aCoder decodeObjectForKey:@"NSTableColumns"];
[_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
_intercellSpacing = CGSizeMake([aCoder decodeFloatForKey:@"NSIntercellSpacingWidth"],
_intercellSpacing = CGSizeMake([aCoder decodeFloatForKey:@"NSIntercellSpacingWidth"],
[aCoder decodeFloatForKey:@"NSIntercellSpacingHeight"]);
var gridColor = [aCoder decodeObjectForKey:@"NSGridColor"];
if (![gridColor isEqual:[CPColor colorWithRed:127.0 / 255.0 green:127.0 / 255.0 blue:127.0 / 255.0 alpha:1.0]])
[self setValue:gridColor forThemeAttribute:@"grid-color"];
_gridStyleMask = [aCoder decodeIntForKey:@"NSGridStyleMask"];
_usesAlternatingRowBackgroundColors = (flags & 0x00800000) ? YES : NO;
_alternatingRowBackgroundColors =[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
_alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
_selectionHighlightStyle = [aCoder decodeIntForKey:@"NSTableViewSelectionHighlightStyle"] || CPTableViewSelectionHighlightStyleRegular;
_columnAutoResizingStyle = [aCoder decodeIntForKey:@"NSColumnAutoresizingStyle"];
_allowsMultipleSelection = (flags & 0x08000000) ? YES : NO;
_allowsEmptySelection = (flags & 0x10000000) ? YES : NO;
_allowsColumnSelection = (flags & 0x04000000) ? YES : NO;
_allowsColumnResizing = (flags & 0x40000000) ? YES : NO;
_allowsColumnReordering = (flags & 0x80000000) ? YES : NO;
}
return self;
}
+3 -3
View File
@@ -34,15 +34,15 @@
_showsBaselineSeparator = [aCoder decodeBoolForKey:"NSToolbarShowsBaselineSeparator"];
_allowsUserCustomization = [aCoder decodeBoolForKey:"NSToolbarAllowsUserCustomization"];
_isVisible = [aCoder decodeBoolForKey:"NSToolbarPrefersToBeShown"];
_identifiedItems = [aCoder decodeObjectForKey:"NSToolbarIBIdentifiedItems"];
_defaultItems = [aCoder decodeObjectForKey:"NSToolbarIBDefaultItems"];
_allowedItems = [aCoder decodeObjectForKey:"NSToolbarIBAllowedItems"];
_selectableItems = [aCoder decodeObjectForKey:"NSToolbarIBSelectableItems"];
_delegate = [aCoder decodeObjectForKey:"NSToolbarDelegate"];
}
return self;
}
+6 -6
View File
@@ -46,24 +46,24 @@ var NSViewAutoresizingMask = 0x3F,
if (self)
{
_tag = 0;
if ([aCoder containsValueForKey:@"NSTag"])
_tag = [aCoder decodeIntForKey:@"NSTag"];
_bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame));
_window = [aCoder decodeObjectForKey:@"NSWindow"];
_superview = [aCoder decodeObjectForKey:@"NSSuperview"];
_subviews = [aCoder decodeObjectForKey:@"NSSubviews"];
if (!_subviews)
_subviews = [];
var vFlags = [aCoder decodeIntForKey:@"NSvFlags"];
_autoresizingMask = vFlags & NSViewAutoresizingMask;
_autoresizesSubviews = vFlags & NSViewAutoresizesSubviewsMask;
_hitTests = YES;
_isHidden = vFlags & NSViewHiddenMask;
_opacity = 1.0;//[aCoder decodeIntForKey:CPViewOpacityKey];
@@ -72,7 +72,7 @@ var NSViewAutoresizingMask = 0x3F,
_themeState = CPThemeStateNormal;
[self _loadThemeAttributes];
}
return self;
}
+2 -1
View File
@@ -34,7 +34,8 @@
_title = [aCoder decodeObjectForKey:@"NSTitle"];
_cibName = [aCoder decodeObjectForKey:@"NSNibName"];
var bundlePath = [aCoder decodeObjectForKey:@"NSNibBundleIdentifier"]
var bundlePath = [aCoder decodeObjectForKey:@"NSNibBundleIdentifier"];
if (bundlePath)
_cibBundle = [CPBundle bundleWithPath:bundlePath];
}
+8 -7
View File
@@ -38,22 +38,23 @@ var NSBorderlessWindowMask = 0x00,
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
{
if ([aCoder containsValueForKey:@"NSMinSize"])
_minSize = [aCoder decodeSizeForKey:@"NSMinSize"];
if ([aCoder containsValueForKey:@"NSMaxSize"])
_maxSize = [aCoder decodeSizeForKey:@"NSMaxSize"];
_screenRect = [aCoder decodeRectForKey:@"NSScreenRect"]; // screen created on
_viewClass = [aCoder decodeObjectForKey:@"NSViewClass"]; // references the toolbar if present (anything else?)
_wtFlags = [aCoder decodeIntForKey:@"NSWTFlags"];
_windowBacking = [aCoder decodeIntForKey:@"NSWindowBacking"];
// Convert NSWindows to CPWindows.
_windowClass = CP_NSMapClassName([aCoder decodeObjectForKey:@"NSWindowClass"]);
_windowRect = [aCoder decodeRectForKey:@"NSWindowRect"];
_windowStyleMask = [aCoder decodeIntForKey:@"NSWindowStyleMask"];
_windowTitle = [aCoder decodeObjectForKey:@"NSWindowTitle"];
@@ -66,7 +67,7 @@ var NSBorderlessWindowMask = 0x00,
_windowStyleMask = CPBorderlessWindowMask;
else
_windowStyleMask = (_windowStyleMask & NSTitledWindowMask ? CPTitledWindowMask : 0) |
_windowStyleMask = (_windowStyleMask & NSTitledWindowMask ? CPTitledWindowMask : 0) |
(_windowStyleMask & NSClosableWindowMask ? CPClosableWindowMask : 0) |
(_windowStyleMask & NSMiniaturizableWindowMask ? CPMiniaturizableWindowMask : 0) |
(_windowStyleMask & NSResizableWindowMask ? CPResizableWindowMask : 0) |
@@ -75,7 +76,7 @@ var NSBorderlessWindowMask = 0x00,
(_windowStyleMask & NSHUDBackgroundWindowMask ? CPHUDBackgroundWindowMask : 0);
_windowIsFullBridge = [aCoder decodeObjectForKey:"NSFrameAutosaveName"] === "CPBorderlessBridgeWindowMask";
/*if (![_windowClass isEqualToString:@"NSPanel"])
_windowRect.origin.y -= [NSMainMenuView menuHeight]; // compensation for the additional menu bar
*/
+1 -5
View File
@@ -27,11 +27,7 @@
- (id)NS_initWithCoder:(CPCoder)aCoder
{
if (self = [super NS_initWithCoder:aCoder])
{
}
return self;
return [super NS_initWithCoder:aCoder];
}
@end
+4 -3
View File
@@ -87,7 +87,8 @@ function main(args)
{
var options = parser.parse(args, null, null, true);
if (options.args.length < 1 || options.args.length > 2) {
if (options.args.length < 1 || options.args.length > 2)
{
parser.printUsage(options);
OS.exit(1);
}
@@ -101,9 +102,9 @@ function main(args)
CPLogRegister(CPLogPrint);
CPLog.debug("Input: " + options.args[0]);
CPLog.debug("Output: " + (options.args[1]||""));
CPLog.debug("Output: " + (options.args[1] || ""));
CPLog.debug("Format: " + ["Auto","Mac","iPhone"][options.format]);
CPLog.debug("Resources: " + (options.resources||""));
CPLog.debug("Resources: " + (options.resources || ""));
CPLog.debug("Frameworks: " + options.frameworks);
var converter = [[Converter alloc] init];