mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Added missing class checks in +initialize, regularized checking code
This commit is contained in:
+11
-11
@@ -134,18 +134,18 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self === [CPControl class])
|
||||
{
|
||||
[self exposeBinding:@"value"];
|
||||
[self exposeBinding:@"objectValue"];
|
||||
[self exposeBinding:@"stringValue"];
|
||||
[self exposeBinding:@"integerValue"];
|
||||
[self exposeBinding:@"intValue"];
|
||||
[self exposeBinding:@"doubleValue"];
|
||||
[self exposeBinding:@"floatValue"];
|
||||
if (self !== [CPControl class])
|
||||
return;
|
||||
|
||||
[self exposeBinding:@"enabled"];
|
||||
}
|
||||
[self exposeBinding:@"value"];
|
||||
[self exposeBinding:@"objectValue"];
|
||||
[self exposeBinding:@"stringValue"];
|
||||
[self exposeBinding:@"integerValue"];
|
||||
[self exposeBinding:@"intValue"];
|
||||
[self exposeBinding:@"doubleValue"];
|
||||
[self exposeBinding:@"floatValue"];
|
||||
|
||||
[self exposeBinding:@"enabled"];
|
||||
}
|
||||
|
||||
+ (Class)_binderClassForBinding:(CPString)theBinding
|
||||
|
||||
+4
-1
@@ -67,7 +67,7 @@ var _CPFonts = {},
|
||||
@code
|
||||
<key>CPSystemFontFace</key>
|
||||
<string>Lucida Grande</string>
|
||||
@endcode
|
||||
@endcode
|
||||
*/
|
||||
@implementation CPFont : CPObject
|
||||
{
|
||||
@@ -84,6 +84,9 @@ var _CPFonts = {},
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [CPFont class])
|
||||
return;
|
||||
|
||||
var systemFontFace = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPSystemFontFace"];
|
||||
|
||||
if (!systemFontFace)
|
||||
|
||||
@@ -59,6 +59,9 @@ var CPImageViewEmptyPlaceholderImage = nil;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [CPImageView class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[CPView class]];
|
||||
|
||||
CPImageViewEmptyPlaceholderImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"empty.png"]];
|
||||
|
||||
@@ -153,7 +153,7 @@ var CPKeyBindingCache = {};
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if ([self class] !== CPKeyBinding)
|
||||
if (self !== [CPKeyBinding class])
|
||||
return;
|
||||
|
||||
[self createKeyBindingsFromJSObject:CPStandardKeyBindings];
|
||||
|
||||
@@ -64,6 +64,9 @@ var _CPLevelIndicatorBezelColor = nil,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [CPLevelIndicator class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:CPLevelIndicator];
|
||||
|
||||
_CPLevelIndicatorBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
|
||||
|
||||
@@ -80,7 +80,7 @@ var _CPMenuBarVisible = NO,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== CPMenu)
|
||||
if (self !== [CPMenu class])
|
||||
return;
|
||||
|
||||
[[self class] setMenuBarAttributes:[CPDictionary dictionary]];
|
||||
|
||||
@@ -34,7 +34,7 @@ var _CPMenuBarWindowBackgroundColor = nil,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [_CPMenuBarWindow class])
|
||||
if (self !== [_CPMenuBarWindow class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
|
||||
@@ -65,7 +65,7 @@ var STICKY_TIME_INTERVAL = 500,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [_CPMenuWindow class])
|
||||
if (self !== [_CPMenuWindow class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
|
||||
@@ -40,7 +40,7 @@ var _CPMenuItemSelectionColor = nil,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [_CPMenuItemView class])
|
||||
if (self !== [_CPMenuItemView class])
|
||||
return;
|
||||
|
||||
_CPMenuItemSelectionColor = [CPColor colorWithCalibratedRed:95.0 / 255.0 green:131.0 / 255.0 blue:185.0 / 255.0 alpha:1.0];
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
|
||||
+ (id)initialize
|
||||
{
|
||||
if (self !== [CPObjectController class])
|
||||
return;
|
||||
|
||||
[self exposeBinding:@"editable"];
|
||||
[self exposeBinding:@"contentObject"];
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ var CPPasteboards = nil,
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPPasteboard class])
|
||||
if (self !== [CPPasteboard class])
|
||||
return;
|
||||
|
||||
[self setVersion:1.0];
|
||||
|
||||
@@ -78,7 +78,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPProgressIndicator class])
|
||||
if (self !== [CPProgressIndicator class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
@@ -120,11 +120,11 @@ var CPProgressIndicatorSpinningStyleColors = nil,
|
||||
|
||||
// Bar Style
|
||||
var prefixes = [
|
||||
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle],
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]
|
||||
];
|
||||
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorBarStyle],
|
||||
CPProgressIndicatorClassName + @"BezelBorder" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle],
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]
|
||||
];
|
||||
|
||||
for (var i = 0, count = prefixes.length; i < count; i++)
|
||||
{
|
||||
|
||||
@@ -125,6 +125,9 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [CPScrollView class])
|
||||
return;
|
||||
|
||||
var globalValue = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPScrollersGlobalStyle"];
|
||||
|
||||
if (globalValue == nil || globalValue == -1)
|
||||
|
||||
@@ -72,7 +72,7 @@ var RECENT_SEARCH_PREFIX = @" ";
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPSearchField class])
|
||||
if (self !== [CPSearchField class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
|
||||
@@ -54,7 +54,7 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPShadowView class])
|
||||
if (self !== [CPShadowView class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[self class]];
|
||||
|
||||
@@ -113,7 +113,7 @@ var CPSplitViewHorizontalImage = nil,
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPSplitView class])
|
||||
if (self !== [CPSplitView class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ var CPToolbarsByIdentifier = nil,
|
||||
/* @ignore */
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPToolbar class])
|
||||
if (self !== [CPToolbar class])
|
||||
return;
|
||||
|
||||
CPToolbarsByIdentifier = [CPDictionary dictionary];
|
||||
|
||||
@@ -78,8 +78,10 @@ var CPViewControllerCachedCibs;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self === CPViewController)
|
||||
CPViewControllerCachedCibs = [CPDictionary dictionary];
|
||||
if (self !== [CPViewController class])
|
||||
return;
|
||||
|
||||
CPViewControllerCachedCibs = [CPDictionary dictionary];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -343,7 +343,7 @@ var CPWindowActionMessageKeys = [
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPWindow class])
|
||||
if (self !== [CPWindow class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[CPWindow class]];
|
||||
|
||||
@@ -38,7 +38,7 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [_CPHUDWindowView class])
|
||||
if (self !== [_CPHUDWindowView class])
|
||||
return;
|
||||
|
||||
var bundle = [CPBundle bundleForClass:self];
|
||||
|
||||
@@ -45,7 +45,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [_CPWindowView class])
|
||||
if (self !== [_CPWindowView class])
|
||||
return;
|
||||
|
||||
_CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)];
|
||||
|
||||
@@ -125,7 +125,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPKeyedArchiver class])
|
||||
if (self !== [CPKeyedArchiver class])
|
||||
return;
|
||||
|
||||
_CPKeyedArchiverStringClass = [CPString class];
|
||||
|
||||
@@ -166,7 +166,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
||||
*/
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self != [CPRunLoop class])
|
||||
if (self !== [CPRunLoop class])
|
||||
return;
|
||||
|
||||
CPMainRunLoop = [[CPRunLoop alloc] init];
|
||||
|
||||
+3
@@ -26,6 +26,9 @@
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [StringToURLTransformer class])
|
||||
return;
|
||||
|
||||
[CPValueTransformer setValueTransformer:[self new]
|
||||
forName:@"StringToURLTransformer"];
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ BorderViewDefaultBorderColor = nil;
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
BorderViewDefaultBorderColor = [CPColor colorWithHexString:@"0000ff"];
|
||||
if (self === [BorderView class])
|
||||
BorderViewDefaultBorderColor = [CPColor colorWithHexString:@"0000ff"];
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
|
||||
@@ -54,6 +54,9 @@ var IBDefaultFontFace = @"Lucida Grande",
|
||||
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self !== [NSFont class])
|
||||
return;
|
||||
|
||||
CPLog.debug("NSFont: default IB font: %s %f", IBDefaultFontFace, IBDefaultFontSize);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user