mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 16:40:55 +00:00
More keyed decoding.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18603 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fb0c973e48
commit
0fba15f09b
6 changed files with 132 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2004-02-15 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSLayoutManager.m:
|
||||
* Source/NSTextContainer.m:
|
||||
* Source/NSTextStorage.m:
|
||||
* Source/GSNibCompatibility.m: (NSWindowTemplate
|
||||
More keyed dearchiving.
|
||||
* Source/NSView.m: (-initWithCoder:)
|
||||
Don't keyed decode next responder, as this gets set by superview
|
||||
anyway.
|
||||
|
||||
2004-02-14 23:05 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSNib.[hm]: Corrected previous issue with NSNib.
|
||||
|
|
|
@ -95,12 +95,49 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aCoder
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_className];
|
||||
[aCoder decodeValueOfObjCType: @encode(id) at: &_parentClassName];
|
||||
[aCoder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
|
||||
return [super initWithCoder: aCoder];
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSRect screenRect = [aDecoder decodeRectForKey: @"NSScreenRect"];
|
||||
NSRect windowRect = [aDecoder decodeRectForKey: @"NSWindowRect"];
|
||||
NSString *viewClass = [aDecoder decodeObjectForKey: @"NSViewClass"];
|
||||
NSString *windowClass = [aDecoder decodeObjectForKey: @"NSWindowClass"];
|
||||
NSString *title = [aDecoder decodeObjectForKey: @"NSWindowTitle"];
|
||||
NSView *view = [aDecoder decodeObjectForKey: @"NSWindowView"];
|
||||
int flags = [aDecoder decodeIntForKey: @"NSWTFlags"];
|
||||
int style = [aDecoder decodeIntForKey: @"NSWindowStyleMask"];
|
||||
int backing = [aDecoder decodeIntForKey: @"NSWindowBacking"];
|
||||
|
||||
ASSIGN(_className, windowClass);
|
||||
self = [self initWithContentRect: windowRect
|
||||
styleMask: style
|
||||
backing: backing
|
||||
defer: NO
|
||||
screen: nil];
|
||||
[self setContentView: view];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSMinSize"])
|
||||
{
|
||||
NSSize minSize = [aDecoder decodeSizeForKey: @"NSMinSize"];
|
||||
[self setMinSize: minSize];
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSMaxSize"])
|
||||
{
|
||||
NSSize maxSize = [aDecoder decodeSizeForKey: @"NSMaxSize"];
|
||||
[self setMaxSize: maxSize];
|
||||
}
|
||||
[self setTitle: title];
|
||||
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_className];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_parentClassName];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag];
|
||||
return [super initWithCoder: aDecoder];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
|
|
|
@ -2139,5 +2139,37 @@ no_soft_invalidation:
|
|||
}
|
||||
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
self = [self init];
|
||||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
int i;
|
||||
id delegate = [aDecoder decodeObjectForKey: @"NSDelegate"];
|
||||
int flags;
|
||||
NSArray *array = [aDecoder decodeObjectForKey: @"NSTextContainers"];
|
||||
NSTextStorage *storage = [aDecoder decodeObjectForKey: @"NSTextStorage"];
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSLMFlags"])
|
||||
{
|
||||
flags = [aDecoder decodeIntForKey: @"NSLMFlags"];
|
||||
// FIXME
|
||||
}
|
||||
[self setDelegate: delegate];
|
||||
[storage addLayoutManager: self];
|
||||
for (i = 0; i < [array count]; i++)
|
||||
{
|
||||
[self addTextContainer: [array objectAtIndex: i]];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -429,5 +429,33 @@ framework intact.
|
|||
return NSPointInRect(aPoint, _containerRect);
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
//NSLayoutManager *manager = [aDecoder decodeObjectForKey: @"NSLayoutManager"];
|
||||
NSTextView *view = [aDecoder decodeObjectForKey: @"NSTextView"];
|
||||
NSSize size = NSZeroSize;
|
||||
|
||||
if ([aDecoder containsValueForKey: @"NSWidth"])
|
||||
{
|
||||
size.width = [aDecoder decodeFloatForKey: @"NSWidth"];
|
||||
}
|
||||
self = [self initWithContainerSize: size];
|
||||
if ([aDecoder containsValueForKey: @"NSTCFlags"])
|
||||
{
|
||||
// FIXME
|
||||
//int flags = [aDecoder decodeIntForKey: @"NSTCFlags"];
|
||||
}
|
||||
// No need to set manager as the decoding of the layout manager does it
|
||||
[self setTextView: view];
|
||||
return self;
|
||||
}
|
||||
else
|
||||
{
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
@end /* NSTextContainer */
|
||||
|
||||
|
|
|
@ -337,4 +337,21 @@ static NSNotificationCenter *nc = nil;
|
|||
[self fixAttributesInRange: range];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
id delegate = [aDecoder decodeObjectForKey: @"NSDelegate"];
|
||||
NSString *string = [aDecoder decodeObjectForKey: @"NSString"];
|
||||
|
||||
self = [self initWithString: string];
|
||||
[self setDelegate: delegate];
|
||||
}
|
||||
else
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -3623,7 +3623,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
NSRect frame = NSZeroRect;
|
||||
id next = [aDecoder decodeObjectForKey: @"NSNextResponder"];
|
||||
//id next = [aDecoder decodeObjectForKey: @"NSNextResponder"];
|
||||
//NSView *superView = [aDecoder decodeObjectForKey: @"NSSuperview"];
|
||||
NSView *nextKeyView = [aDecoder decodeObjectForKey: @"NSNextKeyView"];
|
||||
NSArray *subViews = [aDecoder decodeObjectForKey: @"NSSubviews"];
|
||||
|
@ -3633,10 +3633,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
|
|||
frame = [aDecoder decodeRectForKey: @"NSFrame"];
|
||||
}
|
||||
self = [self initWithFrame: frame];
|
||||
if (next != nil)
|
||||
{
|
||||
[self setNextResponder: next];
|
||||
}
|
||||
|
||||
if (subViews != nil)
|
||||
{
|
||||
NSEnumerator *enumerator = [subViews objectEnumerator];
|
||||
|
|
Loading…
Reference in a new issue