diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 0768d9b69..1e1d7f30a 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -691,6 +691,49 @@ @end +var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey", + CPCollectionViewMaxItemSizeKey = @"CPCollectionViewMaxItemSizeKey", + CPCollectionViewVerticalMarginKey = @"CPCollectionViewVerticalMarginKey"; + + +@implementation CPCollectionView (CPCoding) + +- (id)initWithCoder:(CPCoder)aCoder +{ + self = [super initWithCoder:aCoder]; + + if (self) + { + _items = []; + _content = []; + + _cachedItems = []; + + _itemSize = CGSizeMakeZero(); + _minItemSize = [aCoder decodeSizeForKey:CPCollectionViewMinItemSizeKey]; + _maxItemSize = [aCoder decodeSizeForKey:CPCollectionViewMaxItemSizeKey]; + + _verticalMargin = [aCoder decodeSizeForKey:CPCollectionViewVerticalMarginKey]; + _tileWidth = -1.0; + + _selectionIndexes = [CPIndexSet indexSet]; + } + + return self; +} + +- (void)encodeWithCoder:(CPCoder)aCoder +{ + [super encodeWithCoder:aCoder]; + + [aCoder encodeSize:_minItemSize forKey:CPCollectionViewMinItemSizeKey]; + [aCoder encodeSize:_maxItemSize forKey:CPCollectionViewMaxItemSizeKey]; + + [aCoder encodeSize:_verticalMargin forKey:CPCollectionViewVerticalMarginKey]; +} + +@end + var CPCollectionViewItemViewKey = @"CPCollectionViewItemViewKey"; @implementation CPCollectionViewItem (CPCoding) diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index b06b00e47..626fe0cb8 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -597,10 +597,10 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey"; _controlState = [aCoder decodeObjectForKey:CPControlControlStateKey]; [self setObjectValue:[aCoder decodeObjectForKey:CPControlValueKey]]; - - /* + [self setTarget:[aCoder decodeObjectForKey:CPControlTargetKey]]; - [self setAction:[aCoder decodeObjectForKey:CPControlActionKey]];*/ + [self setAction:[aCoder decodeObjectForKey:CPControlActionKey]]; + [self sendActionOn:[aCoder decodeIntForKey:CPControlSendActionOnKey]]; } @@ -635,10 +635,10 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey"; [aCoder encodeObject:_value forKey:CPControlValueKey]; /*[aCoder encodeBool:_isEnabled forKey:CPControlIsEnabledKey]; - + */ [aCoder encodeConditionalObject:_target forKey:CPControlTargetKey]; [aCoder encodeObject:_action forKey:CPControlActionKey]; - */ + [aCoder encodeInt:_sendActionOn forKey:CPControlSendActionOnKey]; } diff --git a/AppKit/Cib/_CPCibObjectData.j b/AppKit/Cib/_CPCibObjectData.j index 2c3dfb2b6..9fc5620c2 100644 --- a/AppKit/Cib/_CPCibObjectData.j +++ b/AppKit/Cib/_CPCibObjectData.j @@ -199,7 +199,22 @@ var _CPCibObjectDataNamesKeysKey = @"_CPCibObjectDataNamesKeysKey var instantiatedObject = [object _cibInstantiate]; if (instantiatedObject !== object) + { _replacementObjects[[object hash]] = instantiatedObject; + + if ([instantiatedObject isKindOfClass:[CPView class]]) + { + var clipView = [instantiatedObject superview]; + + if ([clipView isKindOfClass:[CPClipView class]]) + { + var scrollView = [clipView superview]; + + if ([scrollView isKindOfClass:[CPScrollView class]]) + [scrollView setDocumentView:instantiatedObject]; + } + } + } } if (topLevelObjects && parent === _fileOwner && object !== _fileOwner) diff --git a/Tools/nib2cib/NSControl.j b/Tools/nib2cib/NSControl.j index 30c3ec0ec..2d86d9597 100644 --- a/Tools/nib2cib/NSControl.j +++ b/Tools/nib2cib/NSControl.j @@ -47,6 +47,9 @@ [self setEnabled:[aCoder decodeObjectForKey:@"NSEnabled"]]; [self setContinuous:[cell isContinuous]]; + + [self setTarget:[aCoder decodeObjectForKey:@"NSTarget"]]; + [self setAction:[aCoder decodeObjectForKey:@"NSAction"]]; } return self; diff --git a/Tools/nib2cib/NSScroller.j b/Tools/nib2cib/NSScroller.j index 30bd2be12..adb3ed7c7 100644 --- a/Tools/nib2cib/NSScroller.j +++ b/Tools/nib2cib/NSScroller.j @@ -44,8 +44,14 @@ // Cocoa uses NSCurValue instead of NSControl's NSContents if ([aCoder containsValueForKey:"NSCurValue"]) _value = [aCoder decodeFloatForKey:"NSCurValue"]; + + if (CPStringFromSelector([self action]) === @"_doScroller:") + if ([self isVertical]) + [self setAction:@selector(_verticalScrollerDidScroll)]; + else + [self setAction:@selector(_horizontalScrollerDidScroll)]; } - + return self; }