diff --git a/ChangeLog b/ChangeLog index 22e82e2a1..0f8d2b318 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-11-29 00:40-EST Gregory John Casamento + + * Source/GSNibCompatibility.m: Added back in _root assignment in + -[NSIBObjectData initWithCoder:] which was causing an issue. + 2008-11-28 15:20-EST Gregory John Casamento * Source/GSNibCompatibility.m: Correct issue when loading into diff --git a/Source/GSNibCompatibility.m b/Source/GSNibCompatibility.m index 717f30954..cfa486307 100644 --- a/Source/GSNibCompatibility.m +++ b/Source/GSNibCompatibility.m @@ -490,6 +490,11 @@ static BOOL _isInInterfaceBuilder = NO; } } +- (id) nibInstantiate +{ + return _realObject; +} + // setters and getters - (void) setClassName: (NSString *)name { @@ -505,11 +510,6 @@ static BOOL _isInInterfaceBuilder = NO; { return _realObject; } - -- (id) nibInstantiate -{ - return [self realObject]; -} @end // Template for any classes which derive from NSText @@ -611,34 +611,6 @@ static BOOL _isInInterfaceBuilder = NO; { ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]); ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]); - - if (_object == nil) - { - Class aClass; - - if ([NSClassSwapper isInInterfaceBuilder]) - { - aClass = [self class]; - } - else - { - aClass = NSClassFromString(_className); - } - - if (aClass == nil) - { - [NSException raise: NSInternalInconsistencyException - format: @"Unable to find class '%@'", _className]; - } - if(GSObjCIsKindOf(aClass, [NSApplication class])) - { - _object = [aClass sharedApplication]; - } - else - { - _object = [[aClass allocWithZone: NSDefaultMallocZone()] init]; - } - } } else { @@ -646,8 +618,7 @@ static BOOL _isInInterfaceBuilder = NO; format: @"Can't decode %@ with %@.",NSStringFromClass([self class]), NSStringFromClass([coder class])]; } - - return _object; + return self; } - (void) encodeWithCoder: (NSCoder *)coder @@ -668,6 +639,27 @@ static BOOL _isInInterfaceBuilder = NO; - (id) nibInstantiate { + if (_object == nil) + { + Class aClass; + + if ([NSClassSwapper isInInterfaceBuilder]) + { + aClass = [self class]; + } + else + { + aClass = NSClassFromString(_className); + } + + if (aClass == nil) + { + [NSException raise: NSInternalInconsistencyException + format: @"Unable to find class '%@'", _className]; + } + + _object = [[aClass allocWithZone: NSDefaultMallocZone()] init]; + } return _object; } @@ -709,6 +701,46 @@ static BOOL _isInInterfaceBuilder = NO; - (id) nibInstantiate { + if (_view == nil) + { + Class aClass; + + if ([NSClassSwapper isInInterfaceBuilder]) + { + aClass = [self class]; + } + else + { + aClass = NSClassFromString(_className); + } + + if (aClass == nil) + { + [NSException raise: NSInternalInconsistencyException + format: @"Unable to find class '%@'", _className]; + } + else + { + _view = [[aClass allocWithZone: NSDefaultMallocZone()] initWithFrame: [self frame]]; + [_view setAutoresizingMask: [self autoresizingMask]]; + [self setAutoresizesSubviews: [self autoresizesSubviews]]; + [self setHidden: [self isHidden]]; + [_view setNextResponder: [self nextResponder]]; + [[self superview] replaceSubview: self with: _view]; // replace the old view... + if (_rFlags.has_subviews) + { + NSArray *subviews = [self subviews]; + int i; + + for (i = 0; i < [subviews count]; i++) + { + [_view addSubview: [subviews objectAtIndex: i]]; + } + } + // FIXME: Need to transfer all other settings as well + } + } + return _view; } @@ -729,48 +761,7 @@ static BOOL _isInInterfaceBuilder = NO; NSStringFromClass([coder class])]; } } - - if (_view == nil) - { - Class aClass; - - if ([NSClassSwapper isInInterfaceBuilder]) - { - aClass = [self class]; - } - else - { - aClass = NSClassFromString(_className); - } - - if (aClass == nil) - { - [NSException raise: NSInternalInconsistencyException - format: @"Unable to find class '%@'", _className]; - } - else - { - _view = [[aClass allocWithZone: NSDefaultMallocZone()] initWithFrame: [self frame]]; - [_view setAutoresizingMask: [self autoresizingMask]]; - [self setAutoresizesSubviews: [self autoresizesSubviews]]; - [self setHidden: [self isHidden]]; - [_view setNextResponder: [self nextResponder]]; - [[self superview] replaceSubview: self with: _view]; // replace the old view... - if (_rFlags.has_subviews) - { - NSArray *subviews = [self subviews]; - int i; - - for (i = 0; i < [subviews count]; i++) - { - [_view addSubview: [subviews objectAtIndex: i]]; - } - } - // FIXME: Need to transfer all other settings as well - } - } - - return _view; + return self; } - (void) encodeWithCoder: (NSCoder *)coder @@ -1119,7 +1110,7 @@ static BOOL _isInInterfaceBuilder = NO; id menu = nil; // replace the owner with the actual instance provided. - [self setRoot: owner]; + [_root setObject: owner]; // iterate over connections, instantiate, and then establish them. while ((obj = [en nextObject]) != nil) @@ -1331,7 +1322,7 @@ static BOOL _isInInterfaceBuilder = NO; { if ([coder allowsKeyedCoding]) { - // ASSIGN(_root, [coder decodeObjectForKey: @"NSRoot"]); + ASSIGN(_root, [coder decodeObjectForKey: @"NSRoot"]); ASSIGN(_visibleWindows, (NSMutableArray *)[coder decodeObjectForKey: @"NSVisibleWindows"]); ASSIGN(_accessibilityConnectors, (NSMutableArray *)[coder decodeObjectForKey: @"NSAccessibilityConnectors"]); ASSIGN(_fontManager, [coder decodeObjectForKey: @"NSFontManager"]);