diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 33685e18c..be0bb01ba 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -742,7 +742,7 @@ - (void)_modifySelectionWithNewIndex:(int)anIndex direction:(int)aDirection expand:(BOOL)shouldExpand { - anIndex = MIN(MAX(anIndex, 0), [[self items] count]-1); + anIndex = MIN(MAX(anIndex, 0), [[self items] count] - 1); if (_allowsMultipleSelection && shouldExpand) { @@ -834,8 +834,8 @@ [[self delegate] collectionView:self shouldDeleteItemsAtIndexes:[self selectionIndexes]]; var index = [[self selectionIndexes] firstIndex]; - if (index > [[self content] count]-1) - [self setSelectionIndexes:[CPIndexSet indexSetWithIndex:[[self content] count]-1]]; + if (index > [[self content] count] - 1) + [self setSelectionIndexes:[CPIndexSet indexSetWithIndex:[[self content] count] - 1]]; [self _scrollToSelection]; [self setNeedsDisplay:YES]; @@ -869,13 +869,14 @@ @end -var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey", - CPCollectionViewMaxItemSizeKey = @"CPCollectionViewMaxItemSizeKey", - CPCollectionViewVerticalMarginKey = @"CPCollectionViewVerticalMarginKey", - CPCollectionViewMaxNumberOfRowsKey = @"CPCollectionViewMaxNumberOfRowsKey", - CPCollectionViewMaxNumberOfColumnsKey = @"CPCollectionViewMaxNumberOfColumnsKey", - CPCollectionViewSelectableKey = @"CPCollectionViewSelectableKey", - CPCollectionViewBackgroundColorsKey = @"CPCollectionViewBackgroundColorsKey"; +var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey", + CPCollectionViewMaxItemSizeKey = @"CPCollectionViewMaxItemSizeKey", + CPCollectionViewVerticalMarginKey = @"CPCollectionViewVerticalMarginKey", + CPCollectionViewMaxNumberOfRowsKey = @"CPCollectionViewMaxNumberOfRowsKey", + CPCollectionViewMaxNumberOfColumnsKey = @"CPCollectionViewMaxNumberOfColumnsKey", + CPCollectionViewSelectableKey = @"CPCollectionViewSelectableKey", + CPCollectionViewAllowsMultipleSelectionKey = @"CPCollectionViewAllowsMultipleSelectionKey", + CPCollectionViewBackgroundColorsKey = @"CPCollectionViewBackgroundColorsKey"; @implementation CPCollectionView (CPCoding) @@ -902,6 +903,7 @@ var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey", _verticalMargin = [aCoder decodeFloatForKey:CPCollectionViewVerticalMarginKey]; _isSelectable = [aCoder decodeBoolForKey:CPCollectionViewSelectableKey]; + _allowsMultipleSelection = [aCoder decodeBoolForKey:CPCollectionViewAllowsMultipleSelectionKey]; [self setBackgroundColors:[aCoder decodeObjectForKey:CPCollectionViewBackgroundColorsKey]]; @@ -929,6 +931,7 @@ var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeKey", [aCoder encodeInt:_maxNumberOfColumns forKey:CPCollectionViewMaxNumberOfColumnsKey]; [aCoder encodeBool:_isSelectable forKey:CPCollectionViewSelectableKey]; + [aCoder encodeBool:_allowsMultipleSelection forKey:CPCollectionViewAllowsMultipleSelectionKey]; [aCoder encodeFloat:_verticalMargin forKey:CPCollectionViewVerticalMarginKey];