View coding fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11553 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2001-11-27 21:40:05 +00:00
parent 1c903d640a
commit b89ba69ae8
3 changed files with 25 additions and 8 deletions

View file

@ -1,3 +1,12 @@
2001-11-27 Adam Fedor <fedor@gnu.org>
* Source/NSClipView.m: Treat _documentView as a convienience
ivar. Don't release/retain or encode it.
(-initWithCoder:): Get _documentView from subview array.
* Source/NSTabView.m (-encodeWithCoder:): Conditionally encode
delegate.
(-initWithCoder:): Don't retain delegate.
2001-11-26 Fred Kiefer <FredKiefer@gmx.de>
* Headers/gnustep/gui/NSWindow.h

View file

@ -77,7 +77,11 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
}
/* Note that the ivar _documentView is really just a convienience
variable. The actual document view is stored in NSClipView's
subview array. Deallocation, coding, etc of the view is then
handled by NSView
*/
@implementation NSClipView
- (id) init
@ -102,7 +106,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
[nc removeObserver: _documentView name:nil object:self];
}
RELEASE(_documentView);
/* Don't RELEASE(_documentView), since it's already in our subviews. */
}
RELEASE(_cursor);
RELEASE(_backgroundColor);
@ -133,7 +137,8 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
[_documentView removeFromSuperview];
}
ASSIGN (_documentView, aView);
/* Don't retain this since it's stored in our subviews. */
_documentView = aView;
/* Call this before doing anything else ! */
_rFlags.flipped_view = [self isFlipped];
@ -656,7 +661,6 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
[aCoder encodeObject: _cursor];
[aCoder encodeObject: _documentView];
}
- (id) initWithCoder: (NSCoder*)aDecoder
@ -671,8 +675,12 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_drawsBackground];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cursor];
document = [aDecoder decodeObject];
[self setDocumentView: document];
if ([[self subviews] count] > 0)
{
document = AUTORELEASE(RETAIN([[self subviews] objectAtIndex: 0]));
[self removeSubview: document];
[self setDocumentView: document];
}
return self;
}

View file

@ -703,7 +703,7 @@
[aCoder encodeValueOfObjCType: @encode(NSTabViewType) at: &_type];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
[aCoder encodeObject: _delegate];
[aCoder encodeConditionalObject: _delegate];
[aCoder encodeValueOfObjCType: "i" at: &_selected_item];
}
@ -716,7 +716,7 @@
[aDecoder decodeValueOfObjCType: @encode(NSTabViewType) at: &_type];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_truncated_label];
[aDecoder decodeValueOfObjCType: @encode(id) at: &_delegate];
_delegate = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: "i" at: &_selected_item];
return self;