From 6472ac7701ac71c691df2a2ed3d70f3e533c4895 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 12 Feb 2013 22:29:31 -0500 Subject: [PATCH] Formatting, import fixes --- AppKit/CPButton.j | 14 +++++++------- AppKit/CPKeyValueBinding.j | 20 +++++++++++--------- AppKit/Cib/CPCibConnector.j | 3 ++- AppKit/Cib/_CPCibWindowTemplate.j | 4 ++-- Tools/nib2cib/NSCustomResource.j | 2 +- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/AppKit/CPButton.j b/AppKit/CPButton.j index 6b31d2aa9..c51cf61f0 100644 --- a/AppKit/CPButton.j +++ b/AppKit/CPButton.j @@ -60,11 +60,11 @@ CPMomentaryPushInButton = 7; CPMomentaryPushButton = 0; CPMomentaryLight = 7; -CPNoButtonMask = 0; -CPContentsButtonMask = 1; -CPPushInButtonMask = 2; -CPGrayButtonMask = 4; -CPBackgroundButtonMask = 8; +CPNoButtonMask = 0; +CPContentsButtonMask = 1; +CPPushInButtonMask = 2; +CPGrayButtonMask = 4; +CPBackgroundButtonMask = 8; CPNoCellMask = CPNoButtonMask; CPContentsCellMask = CPContentsButtonMask; @@ -72,8 +72,8 @@ CPPushInCellMask = CPPushInButtonMask; CPChangeGrayCellMask = CPGrayButtonMask; CPChangeBackgroundCellMask = CPBackgroundButtonMask; -CPButtonStateMixed = CPThemeState("mixed"); -CPButtonStateBezelStyleRounded = CPThemeState("rounded"); +CPButtonStateMixed = CPThemeState("mixed"); +CPButtonStateBezelStyleRounded = CPThemeState("rounded"); // add all future correspondance between bezel styles and theme state here. var CPButtonBezelStyleStateMap = [CPDictionary dictionaryWithObjects:[CPButtonStateBezelStyleRounded, [CPNull null]] diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index d71a77725..a7103418e 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -106,6 +106,7 @@ var CPBindingOperationAnd = 0, + (void)unbindAllForObject:(id)anObject { var bindings = [bindingsMap objectForKey:[anObject UID]]; + if (!bindings) return; @@ -125,7 +126,7 @@ var CPBindingOperationAnd = 0, if (self) { _source = aSource; - _info = [CPDictionary dictionaryWithObjects:[aDestination, aKeyPath] forKeys:[CPObservedObjectKey, CPObservedKeyPathKey]]; + _info = [CPDictionary dictionaryWithObjects:[aDestination, aKeyPath] forKeys:[CPObservedObjectKey, CPObservedKeyPathKey]]; _suppressedNotifications = {}; _placeholderForMarker = {}; @@ -137,6 +138,7 @@ var CPBindingOperationAnd = 0, [aDestination addObserver:self forKeyPath:aKeyPath options:CPKeyValueObservingOptionNew context:aBinding]; var bindings = [bindingsMap objectForKey:[_source UID]]; + if (!bindings) { bindings = [CPDictionary new]; @@ -211,6 +213,7 @@ var CPBindingOperationAnd = 0, return; var objectSuppressions = _suppressedNotifications[[anObject UID]]; + if (objectSuppressions && objectSuppressions[aKeyPath]) return; @@ -229,6 +232,7 @@ var CPBindingOperationAnd = 0, if (!valueTransformer) { var valueTransformerClass = CPClassFromString(valueTransformerName); + if (valueTransformerClass) { valueTransformer = [[valueTransformerClass alloc] init]; @@ -425,13 +429,13 @@ var CPBindingOperationAnd = 0, /*! @ignore - Provides stub implementations that simply call super for the "objectValue" binding - This class should not be necessary but assures backwards compliance with our old way of doing bindings - Every class with a value binding should implement a subclass to handle it's specific value binding logic + Provides stub implementations that simply calls super for the "objectValue" binding. + This class should not be necessary but assures backwards compliance with our old way of doing bindings. + + IMPORTANT! + Every class with a value binding should implement a subclass to handle its specific value binding logic. */ @implementation _CPValueBinder : CPBinder -{ -} - (void)setValueFor:(CPString)theBinding { @@ -446,8 +450,6 @@ var CPBindingOperationAnd = 0, @end @implementation _CPKeyValueOrBinding : CPBinder -{ -} - (void)setValueFor:(CPString)aBinding { @@ -487,7 +489,7 @@ var CPBindingOperationAnd = 0, @end -var resolveMultipleValues = function(/*CPString*/key, /*CPDictionary*/bindings, /*GSBindingOperationKind*/operation) +var resolveMultipleValues = function(/*CPString*/key, /*CPDictionary*/bindings, /*CPBindingOperationKind*/operation) { var bindingName = key, theBinding, diff --git a/AppKit/Cib/CPCibConnector.j b/AppKit/Cib/CPCibConnector.j index 78eddadc0..6c43d7db8 100644 --- a/AppKit/Cib/CPCibConnector.j +++ b/AppKit/Cib/CPCibConnector.j @@ -85,4 +85,5 @@ var _CPCibConnectorSourceKey = @"_CPCibConnectorSourceKey", @end // For backwards compatibility. -@implementation _CPCibConnector : CPCibConnector { } @end +@implementation _CPCibConnector : CPCibConnector +@end diff --git a/AppKit/Cib/_CPCibWindowTemplate.j b/AppKit/Cib/_CPCibWindowTemplate.j index a6c210a79..869469626 100644 --- a/AppKit/Cib/_CPCibWindowTemplate.j +++ b/AppKit/Cib/_CPCibWindowTemplate.j @@ -24,10 +24,10 @@ @import @import "CGGeometry.j" +@import "CPToolbar.j" @import "CPView.j" @import "CPWindow_Constants.j" - -@class CPToolbar +@import "_CPToolTip.j" @implementation _CPCibWindowTemplate : CPObject diff --git a/Tools/nib2cib/NSCustomResource.j b/Tools/nib2cib/NSCustomResource.j index 4c641e9cd..9ffff46f6 100644 --- a/Tools/nib2cib/NSCustomResource.j +++ b/Tools/nib2cib/NSCustomResource.j @@ -67,7 +67,7 @@ var FILE = require("file"), if (resourcePath && FILE.extension(resourcePath) !== FILE.extension(_resourceName)) _resourceName += FILE.extension(resourcePath); - CPLog.debug(" Path: %s\n Size: %dx%d", FILE.canonical(resourcePath), size.width, size.height); + CPLog.debug(" Path: %s\n Size: %d x %d", FILE.canonical(resourcePath), size.width, size.height); } _properties = [CPDictionary dictionaryWithObject:size forKey:@"size"];