From 5a99011febd091920b06261ac9a07b19cc6a27dc Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sun, 11 Mar 2012 21:25:40 +0100 Subject: [PATCH] nib2cib support for CPView identifier property. --- AppKit/CPView.j | 8 ++++++-- Tools/nib2cib/NSView.j | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 7129b8cad..eda9ab837 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -2716,7 +2716,8 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", CPViewThemeStateKey = @"CPViewThemeStateKey", CPViewWindowKey = @"CPViewWindowKey", CPViewNextKeyViewKey = @"CPViewNextKeyViewKey", - CPViewPreviousKeyViewKey = @"CPViewPreviousKeyViewKey"; + CPViewPreviousKeyViewKey = @"CPViewPreviousKeyViewKey", + CPReuseIdentifierKey = @"CPReuseIdentifierKey"; @implementation CPView (CPCoding) @@ -2749,7 +2750,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", _window = [aCoder decodeObjectForKey:CPViewWindowKey]; _subviews = [aCoder decodeObjectForKey:CPViewSubviewsKey] || []; _superview = [aCoder decodeObjectForKey:CPViewSuperviewKey]; - + _identifier = [aCoder decodeObjectForKey:CPReuseIdentifierKey]; // FIXME: Should we encode/decode this? _registeredDraggedTypes = [CPSet set]; _registeredDraggedTypesArray = []; @@ -2890,6 +2891,9 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask", for (var attributeName in _themeAttributes) if (_themeAttributes.hasOwnProperty(attributeName)) CPThemeAttributeEncode(aCoder, _themeAttributes[attributeName]); + + if (_identifier) + [aCoder encodeObject:_identifier forKey:CPReuseIdentifierKey]; } @end diff --git a/Tools/nib2cib/NSView.j b/Tools/nib2cib/NSView.j index 743068b30..426f4de72 100644 --- a/Tools/nib2cib/NSView.j +++ b/Tools/nib2cib/NSView.j @@ -72,6 +72,9 @@ var NSViewAutoresizingMask = 0x3F, _themeAttributes = {}; _themeState = CPThemeStateNormal; [self _loadThemeAttributes]; + + if ([aCoder containsValueForKey:@"NSReuseIdentifierKey"]) + _identifier = [aCoder decodeObjectForKey:@"NSReuseIdentifierKey"]; } return self;