From f73d8a55de62810d61915b0ebdfe72c594c6a2f2 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Tue, 29 Jun 2010 17:47:36 +0200 Subject: [PATCH 01/15] implemented isEditable nib2cib support for CPTableColumn --- AppKit/CPTableColumn.j | 10 ++++++---- Tools/nib2cib/NSTableColumn.j | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 91edc5d50..77967f816 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -468,9 +468,9 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", CPTableColumnMinWidthKey = @"CPTableColumnMinWidthKey", CPTableColumnMaxWidthKey = @"CPTableColumnMaxWidthKey", CPTableColumnResizingMaskKey = @"CPTableColumnResizingMaskKey", - CPTableColumnIsHiddenkey = @"CPTableColumnIsHiddenKey", + CPTableColumnIsHiddenKey = @"CPTableColumnIsHiddenKey", CPSortDescriptorPrototypeKey = @"CPSortDescriptorPrototypeKey"; - CPTableColumnIsHiddenkey = @"CPTableColumnIsHiddenKey"; + CPTableColumnIsEditableKey = @"CPTableColumnIsEditableKey"; @implementation CPTableColumn (CPCoding) @@ -492,7 +492,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", [self setHeaderView:[aCoder decodeObjectForKey:CPTableColumnHeaderViewKey]]; _resizingMask = [aCoder decodeBoolForKey:CPTableColumnResizingMaskKey]; - _isHidden = [aCoder decodeBoolForKey:CPTableColumnIsHiddenkey]; + _isHidden = [aCoder decodeBoolForKey:CPTableColumnIsHiddenKey]; + _isEditable = [aCoder decodeBoolForKey:CPTableColumnIsEditableKey]; _sortDescriptorPrototype = [aCoder decodeObjectForKey:CPSortDescriptorPrototypeKey]; } @@ -512,7 +513,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", [aCoder encodeObject:_dataView forKey:CPTableColumnDataViewKey]; [aCoder encodeObject:_resizingMask forKey:CPTableColumnResizingMaskKey]; - [aCoder encodeBool:_isHidden forKey:CPTableColumnIsHiddenkey]; + [aCoder encodeBool:_isHidden forKey:CPTableColumnIsHiddenKey]; + [aCoder encodeBool:_isEditable forKey:CPTableColumnIsEditableKey]; [aCoder encodeObject:_sortDescriptorPrototype forKey:CPSortDescriptorPrototypeKey]; } diff --git a/Tools/nib2cib/NSTableColumn.j b/Tools/nib2cib/NSTableColumn.j index 8af344031..d85cb70c5 100644 --- a/Tools/nib2cib/NSTableColumn.j +++ b/Tools/nib2cib/NSTableColumn.j @@ -60,6 +60,8 @@ _resizingMask = [aCoder decodeBoolForKey:@"NSIsResizeable"] ? CPTableColumnUserResizingMask : CPTableColumnAutoresizingMask; _isHidden = [aCoder decodeBoolForKey:@"NSHidden"]; + _isEditable = [aCoder decodeBoolForKey:@"NSIsEditable"]; + _sortDescriptorPrototype = [aCoder decodeObjectForKey:@"NSSortDescriptorPrototype"]; } From acf5e5b75f37393318e2554ab8a93219efe281b4 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Mon, 26 Jul 2010 18:44:50 +0200 Subject: [PATCH 02/15] call super in _CPObservableArray removeObjectAtIndex: The current implementation calls self, which causes an infinite loop --- AppKit/CPObjectController.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPObjectController.j b/AppKit/CPObjectController.j index 65815caf2..f070d33bf 100644 --- a/AppKit/CPObjectController.j +++ b/AppKit/CPObjectController.j @@ -452,7 +452,7 @@ var CPObjectControllerObjectClassNameKey = @"CPObjectControllerOb [self didChangeValueForKey:keyPath]; } - [self removeObjectAtIndex:anIndex]; + [super removeObjectAtIndex:anIndex]; } - (void)addObject:(id)anObject From ff8e5ae42e2f2f141ff2a3ba80a397bafd08d785 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 7 Jul 2010 15:35:12 +0200 Subject: [PATCH 03/15] save _replacedKeys on the class in stead of the object instance reviewed: Ross --- Foundation/CPKeyValueObserving.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Foundation/CPKeyValueObserving.j b/Foundation/CPKeyValueObserving.j index 0ff9fdd26..6ea9c9a42 100644 --- a/Foundation/CPKeyValueObserving.j +++ b/Foundation/CPKeyValueObserving.j @@ -213,7 +213,6 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld, _targetObject = aTarget; _nativeClass = [aTarget class]; - _replacedKeys = [CPSet set]; _observersForKey = {}; _changesForKey = {}; _observersForKeyLength = 0; @@ -230,6 +229,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld, if (existingKVOClass) { _targetObject.isa = existingKVOClass; + _replacedKeys = existingKVOClass._replacedKeys; return; } @@ -237,6 +237,9 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld, objj_registerClassPair(kvoClass); + _replacedKeys = [CPSet set]; + kvoClass._replacedKeys = _replacedKeys; + //copy in the methods from our model subclass var methodList = _CPKVOModelSubclass.method_list, count = methodList.length, @@ -293,6 +296,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld, var theMethod = class_getInstanceMethod(_nativeClass, theSelector); class_addMethod(_targetObject.isa, theSelector, theReplacementMethod(aKey, theMethod), ""); + [_replacedKeys addObject:aKey]; } } From 0306c35b54e6233911f45f31fd4254af28ab8fbe Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 7 Jul 2010 18:24:24 +0200 Subject: [PATCH 04/15] don't copy the selection indexes in setContent: --- AppKit/CPArrayController.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPArrayController.j b/AppKit/CPArrayController.j index c11206f79..4953c3016 100644 --- a/AppKit/CPArrayController.j +++ b/AppKit/CPArrayController.j @@ -154,7 +154,7 @@ value = [value]; var oldSelection = nil, - oldSelectionIndexes = [[self selectionIndexes] copy]; + oldSelectionIndexes = [self selectionIndexes]; if ([self preservesSelection]) oldSelection = [self selectedObjects]; From 8ce63a244cabef7cb2038b3a5afe2ca7e5ba8b50 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 7 Jul 2010 18:24:44 +0200 Subject: [PATCH 05/15] store accessors in a javascript object not a CPDictionary, for slight performance improvement --- Foundation/CPKeyValueCoding.j | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Foundation/CPKeyValueCoding.j b/Foundation/CPKeyValueCoding.j index 104a6931f..c2691bd47 100644 --- a/Foundation/CPKeyValueCoding.j +++ b/Foundation/CPKeyValueCoding.j @@ -33,6 +33,9 @@ CPUndefinedKeyException = @"CPUndefinedKeyException"; CPTargetObjectUserInfoKey = @"CPTargetObjectUserInfoKey"; CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; +var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey", + CPObjectModifiersForClassKey = @"$CPObjectModifiersForClassKey"; + @implementation CPObject (CPKeyValueCoding) + (BOOL)accessInstanceVariablesDirectly @@ -43,26 +46,18 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; /* @ignore */ + (SEL)_accessorForKey:(CPString)aKey { - if (!CPObjectAccessorsForClass) - CPObjectAccessorsForClass = [CPDictionary dictionary]; - - var UID = [isa UID], - selector = nil, - accessors = [CPObjectAccessorsForClass objectForKey:UID]; + var selector = nil, + accessors = isa[CPObjectAccessorsForClassKey]; if (accessors) { - selector = [accessors objectForKey:aKey]; + selector = accessors[aKey]; if (selector) return selector === [CPNull null] ? nil : selector; } else - { - accessors = [CPDictionary dictionary]; - - [CPObjectAccessorsForClass setObject:accessors forKey:UID]; - } + accessors = isa[CPObjectAccessorsForClassKey] = {}; var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1); @@ -73,12 +68,12 @@ CPUnknownUserInfoKey = @"CPUnknownUserInfoKey"; [self instancesRespondToSelector:selector = CPSelectorFromString("_" + aKey)] || [self instancesRespondToSelector:selector = CPSelectorFromString("_is" + capitalizedKey)]) { - [accessors setObject:selector forKey:aKey]; + accessors[aKey] = selector; return selector; } - [accessors setObject:[CPNull null] forKey:aKey]; + accessors[aKey] = [CPNull null]; return nil; } From d947c849c87598921b860d399fd5e11cc31349bd Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Thu, 8 Jul 2010 16:26:17 +0200 Subject: [PATCH 06/15] made _accessorForKey slightly faster by inlining it as a function --- Foundation/CPKeyValueCoding.j | 37 ++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Foundation/CPKeyValueCoding.j b/Foundation/CPKeyValueCoding.j index c2691bd47..1449899e4 100644 --- a/Foundation/CPKeyValueCoding.j +++ b/Foundation/CPKeyValueCoding.j @@ -151,7 +151,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey", - (id)valueForKey:(CPString)aKey { var theClass = [self class], - selector = [theClass _accessorForKey:aKey]; + selector = _accessorForKey(theClass, aKey); if (selector) return objj_msgSend(self, selector); @@ -259,6 +259,41 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey", @end +var Null = [CPNull null]; +var _accessorForKey = function(theClass, aKey) +{ + var selector = nil, + accessors = theClass.isa[CPObjectAccessorsForClassKey]; + + if (accessors) + { + selector = accessors[aKey]; + + if (selector) + return selector === Null ? nil : selector; + } + else + accessors = theClass.isa[CPObjectAccessorsForClassKey] = {}; + + var capitalizedKey = aKey.charAt(0).toUpperCase() + aKey.substr(1); + + if ([theClass instancesRespondToSelector:selector = CPSelectorFromString("get" + capitalizedKey)] || + [theClass instancesRespondToSelector:selector = CPSelectorFromString(aKey)] || + [theClass instancesRespondToSelector:selector = CPSelectorFromString("is" + capitalizedKey)] || + [theClass instancesRespondToSelector:selector = CPSelectorFromString("_get" + capitalizedKey)] || + [theClass instancesRespondToSelector:selector = CPSelectorFromString("_" + aKey)] || + [theClass instancesRespondToSelector:selector = CPSelectorFromString("_is" + capitalizedKey)]) + { + accessors[aKey] = selector; + + return selector; + } + + accessors[aKey] = Null; + + return nil; +} + @implementation CPDictionary (KeyValueCoding) - (id)valueForKey:(CPString)aKey From 78fd9723120e6bc3dc96a7e1fd8cad1083d8c3d1 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 2 Jun 2010 15:50:21 +0200 Subject: [PATCH 07/15] only reverse set the binding on end editing --- AppKit/CPControl.j | 1 + 1 file changed, 1 insertion(+) diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 7de6719c4..db8a22cd9 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -545,6 +545,7 @@ var CPControlBlackColor = [CPColor blackColor]; return; [self _reverseSetBinding]; + [[CPNotificationCenter defaultCenter] postNotificationName:CPControlTextDidEndEditingNotification object:self userInfo:[CPDictionary dictionaryWithObject:[note object] forKey:"CPFieldEditor"]]; } From 560ea75a253e44d8242f7314ebe795e8ceec34d0 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Fri, 4 Jun 2010 15:41:12 +0200 Subject: [PATCH 08/15] added CPArrayController to AppKit.j --- AppKit/AppKit.j | 1 + 1 file changed, 1 insertion(+) diff --git a/AppKit/AppKit.j b/AppKit/AppKit.j index 9c820be65..95bbe6201 100644 --- a/AppKit/AppKit.j +++ b/AppKit/AppKit.j @@ -88,3 +88,4 @@ @import "CPWebView.j" @import "CPWindow.j" @import "CPWindowController.j" +@import "CPArrayController.j" From 90e9b86497ef767015f08f0043fca9965cace6de Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Mon, 26 Jul 2010 14:23:52 +0200 Subject: [PATCH 09/15] match CPTableView's alternating row colors with Aristo's --- AppKit/Themes/Aristo/ThemeDescriptors.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index 7950ac5ba..ec1245de8 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -838,7 +838,7 @@ // Now theme the tableview var sortImage = [_CPCibCustomResource imageResourceWithName:"tableview-headerview-ascending.png" size:CGSizeMake(9.0, 8.0)], sortImageReversed = [_CPCibCustomResource imageResourceWithName:"tableview-headerview-descending.png" size:CGSizeMake(9.0, 8.0)], - alternatingRowColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]], + alternatingRowColors = [[CPColor whiteColor], [CPColor colorWithRed:245.0 / 255.0 green:249.0 / 255.0 blue:252.0 / 255.0 alpha:1.0]], gridColor = [CPColor colorWithHexString:@"dce0e2"], selectionColor = [CPColor colorWithHexString:@"5f83b9"], sourceListSelectionColor = [CPDictionary dictionaryWithObjects: [ CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [89.0/255.0, 153.0/255.0, 209.0/255.0,1.0, 33.0/255.0, 94.0/255.0, 208.0/255.0,1.0], [0,1], 2), From c3c996f1f765f7c58e42dbb686fe34fe8f484494 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 27 Jul 2010 16:48:54 -0400 Subject: [PATCH 10/15] Don't substitute the font if the textfield is not editable (a label) --- Tools/nib2cib/NSTextField.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/nib2cib/NSTextField.j b/Tools/nib2cib/NSTextField.j index 8b1b1eeda..8ded6c08e 100644 --- a/Tools/nib2cib/NSTextField.j +++ b/Tools/nib2cib/NSTextField.j @@ -36,7 +36,7 @@ { var cell = [aCoder decodeObjectForKey:@"NSCell"]; - if ([[cell font] isEqual:[CPFont boldSystemFontOfSize:12.0]]) + if ([cell isEditable] && [[cell font] isEqual:[CPFont boldSystemFontOfSize:12.0]]) [self setFont:[CPFont systemFontOfSize:12.0]]; [self sendActionOn:CPKeyUpMask|CPKeyDownMask]; From 6ff3fa0e523325c0097b12be5de37611aaeadcec Mon Sep 17 00:00:00 2001 From: Mike Fellows Date: Tue, 27 Jul 2010 17:44:05 -0700 Subject: [PATCH 11/15] Fix for issue #769, allow ctrl/cmd keys and F1-F12 keys to propagate to the browser unless they are blacklisted --- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 43 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 7af9e9888..ea8badbbe 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -136,6 +136,7 @@ var CPDOMEventGetClickCount, //might be mac only, we should investigate futher later. var KeyCodesToPrevent = {}, CharacterKeysToPrevent = {}, + KeyCodesToAllow = {}, MozKeyCodeToKeyCodeMap = { 61: 187, // =, equals 59: 186 // ;, semicolon @@ -144,6 +145,19 @@ var KeyCodesToPrevent = {}, KeyCodesToPrevent[CPKeyCodes.A] = YES; +KeyCodesToAllow[CPKeyCodes.F1] = YES; +KeyCodesToAllow[CPKeyCodes.F2] = YES; +KeyCodesToAllow[CPKeyCodes.F3] = YES; +KeyCodesToAllow[CPKeyCodes.F4] = YES; +KeyCodesToAllow[CPKeyCodes.F5] = YES; +KeyCodesToAllow[CPKeyCodes.F6] = YES; +KeyCodesToAllow[CPKeyCodes.F7] = YES; +KeyCodesToAllow[CPKeyCodes.F8] = YES; +KeyCodesToAllow[CPKeyCodes.F9] = YES; +KeyCodesToAllow[CPKeyCodes.F10] = YES; +KeyCodesToAllow[CPKeyCodes.F11] = YES; +KeyCodesToAllow[CPKeyCodes.F12] = YES; + KeyCodesToUnicodeMap[CPKeyCodes.BACKSPACE] = CPDeleteCharacter; KeyCodesToUnicodeMap[CPKeyCodes.DELETE] = CPDeleteFunctionKey; KeyCodesToUnicodeMap[CPKeyCodes.TAB] = CPTabCharacter; @@ -634,10 +648,31 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; (aDOMEvent.altKey ? CPAlternateKeyMask : 0) | (aDOMEvent.metaKey ? CPCommandKeyMask : 0); - //We want to stop propagation if this is a command key AND this character or keycode has been added to our blacklist - StopDOMEventPropagation = !!(!(modifierFlags & (CPControlKeyMask | CPCommandKeyMask)) || - CharacterKeysToPrevent[String.fromCharCode(aDOMEvent.keyCode || aDOMEvent.charCode).toLowerCase()] || - KeyCodesToPrevent[aDOMEvent.keyCode]); + // With a few exceptions, all key events are blocked from propagating to + // the browser. Here the following exceptions are being allowed: + // + // - All keys pressed along with a ctrl or cmd key _unless_ they are in + // one of the two blacklists. + // - Any key listed in the whitelist. + // + // The ctrl/cmd keys are used for browser hotkeys as are the keys listed in + // the whitelist (F1-F12 at the time of writing). + // + // If a key is listed in both the blacklist and whitelist, the blacklist is + // checked first. The key will be blocked from propagating in that case. + + StopDOMEventPropagation = YES; + + // Make sure it is not in the blacklists. + if(! (CharacterKeysToPrevent[String.fromCharCode(aDOMEvent.keyCode || aDOMEvent.charCode).toLowerCase()] || KeyCodesToPrevent[aDOMEvent.keyCode])) + { + // It is not in the blacklist, let it through if the ctrl/cmd key is + // also down or it's in the whitelist. + if((modifierFlags & (CPControlKeyMask | CPCommandKeyMask)) || KeyCodesToAllow[aDOMEvent.keyCode]) + { + StopDOMEventPropagation = NO; + } + } var isNativePasteEvent = NO, isNativeCopyOrCutEvent = NO, From 05e435633ff7ef1dd77fb028b8887a311706cb2d Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Tue, 27 Jul 2010 16:50:24 -0400 Subject: [PATCH 12/15] Fixed: if a custom CPTableView header view was used for a column, such as a CPImageView, sorting by that column would cause an exception as CPTableView tried to send _setIndicatorImage: to the view. The fix is to only send the message if the view supports it. --- AppKit/CPTableView.j | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 24c961792..cda709b43 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -1920,7 +1920,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; - (void)setIndicatorImage:(CPImage)anImage inTableColumn:(CPTableColumn)aTableColumn { if (aTableColumn) - [[aTableColumn headerView] _setIndicatorImage:anImage]; + { + var headerView = [aTableColumn headerView]; + if ([headerView respondsToSelector:@selector(_setIndicatorImage:)]) + [headerView _setIndicatorImage:anImage]; + } } - (CPImage)_tableHeaderSortImage From cce13b4b45768fb1954f31a34785494f458b2485 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 27 Jul 2010 16:49:30 -0400 Subject: [PATCH 13/15] NSMenuItem is not reading the tag for some reason --- Tools/nib2cib/NSMenuItem.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/nib2cib/NSMenuItem.j b/Tools/nib2cib/NSMenuItem.j index 292cbb815..0076382d7 100644 --- a/Tools/nib2cib/NSMenuItem.j +++ b/Tools/nib2cib/NSMenuItem.j @@ -46,7 +46,7 @@ _isEnabled = ![aCoder decodeBoolForKey:"NSIsDisabled"]; _isHidden = [aCoder decodeBoolForKey:"NSIsHidden"]; -// _tag = [aCoder decodeIntForKey:"NSTag"]; + _tag = [aCoder decodeIntForKey:"NSTag"]; _state = [aCoder decodeIntForKey:"NSState"]; // _image = [aCoder decodeObjectForKey:"NSImage"]; From 8cfba4c2424d3a185ff394b84c606bcb0bad1d36 Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Thu, 8 Jul 2010 16:42:57 +0200 Subject: [PATCH 14/15] only offset a nib2cib'ed textfield if it has a bezel --- Tools/nib2cib/NSTextField.j | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tools/nib2cib/NSTextField.j b/Tools/nib2cib/NSTextField.j index 8ded6c08e..d9d935085 100644 --- a/Tools/nib2cib/NSTextField.j +++ b/Tools/nib2cib/NSTextField.j @@ -58,8 +58,16 @@ var frame = [self frame]; - [self setFrameOrigin:CGPointMake(frame.origin.x - 4.0, frame.origin.y - 4.0)]; - [self setFrameSize:CGSizeMake(frame.size.width + 8.0, frame.size.height + 8.0)]; + [self setFrameOrigin:CGPointMake(frame.origin.x, frame.origin.y)]; + [self setFrameSize:CGSizeMake(frame.size.width, frame.size.height)]; + + // Only adjust the origin and size if this is a bezeled textfield + // this makes sure that labels positioned in IB are properly positioned after nibcib + if ([self isBezeled]) + { + [self setFrameOrigin:CGPointMake(frame.origin.x - 4.0, frame.origin.y - 4.0)]; + [self setFrameSize:CGSizeMake(frame.size.width + 8.0, frame.size.height + 8.0)]; + } CPLog.debug([self stringValue] + " => isBordered=" + [self isBordered] + ", isBezeled=" + [self isBezeled] + ", bezelStyle=" + [self bezelStyle] + "("+[cell stringValue]+", " + [cell placeholderString] + ")"); } From e586273a3f65778fd8fd5c59cdcb228b435e7a06 Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 28 Jul 2010 14:13:12 -0700 Subject: [PATCH 15/15] Fix accidental global. --- AppKit/CPTableColumn.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTableColumn.j b/AppKit/CPTableColumn.j index 04e2b4fdf..17b731d18 100644 --- a/AppKit/CPTableColumn.j +++ b/AppKit/CPTableColumn.j @@ -460,8 +460,8 @@ var CPTableColumnIdentifierKey = @"CPTableColumnIdentifierKey", CPTableColumnMaxWidthKey = @"CPTableColumnMaxWidthKey", CPTableColumnResizingMaskKey = @"CPTableColumnResizingMaskKey", CPTableColumnIsHiddenKey = @"CPTableColumnIsHiddenKey", - CPSortDescriptorPrototypeKey = @"CPSortDescriptorPrototypeKey"; - CPTableColumnIsEditableKey = @"CPTableColumnIsEditableKey"; + CPSortDescriptorPrototypeKey = @"CPSortDescriptorPrototypeKey", + CPTableColumnIsEditableKey = @"CPTableColumnIsEditableKey"; @implementation CPTableColumn (CPCoding)