From 91a2a62ea02d82651625f2bb71635537e5664f8d Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Fri, 11 Aug 2006 05:55:16 +0000 Subject: [PATCH] Correct issues encoding as a NSCustomView. Now loads properly in IB. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23250 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ GormCore/GormCustomView.m | 28 ++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 359dbb89..a5475678 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-11 01:53-EDT Gregory John Casamento + + * GormCore/GormCustomView.m: Corrected encoding issues with custom + view in encodeWithCoder: it now properly encodes itself as + an NSCustomView. + 2006-08-09 02:29-EDT Gregory John Casamento * GormCore/GormCustomView.m: encodeWithCoder: changes to encode the diff --git a/GormCore/GormCustomView.m b/GormCore/GormCustomView.m index af5d4f05..63b3c5e5 100644 --- a/GormCore/GormCustomView.m +++ b/GormCore/GormCustomView.m @@ -112,10 +112,30 @@ { if([aCoder allowsKeyedCoding]) { - id cv = [[NSCustomView alloc] initWithFrame: [self frame]]; - [cv setAutoresizingMask: [self autoresizingMask]]; - [cv setClassName: className]; - [cv encodeWithCoder: aCoder]; + GormClassManager *classManager = [(id)NSApp classManager]; + NSString *extension = nil; + + ASSIGNCOPY(extension,[classManager nonCustomSuperClassOf: className]); + + [aCoder encodeObject: className forKey: @"NSClassName"]; + [aCoder encodeRect: [self frame] forKey: @"NSFrame"]; + + if(extension != nil) + { + [aCoder encodeObject: extension forKey: @"NSExtension"]; + } + + if([self nextResponder] != nil) + { + [aCoder encodeObject: [self nextResponder] forKey: @"NSNextResponder"]; + } + + if([self superview] != nil) + { + [aCoder encodeObject: [self superview] forKey: @"NSSuperview"]; + } + + RELEASE(extension); } else {