Fixing standalone view handling.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@26818 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2008-08-24 17:20:16 +00:00
parent 31c6238394
commit adefb08ae6
4 changed files with 65 additions and 28 deletions

View file

@ -1,3 +1,9 @@
2008-08-24 13:20-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormCustomView.m
* GormCore/GormDocument.m
* GormCore/GormViewWindow.m: Fixing handling of standalone views.
2008-07-20 09:32-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* GormObjCHeaderParser/OCIVar.m

View file

@ -105,45 +105,76 @@
return cls;
}
- (BOOL) _classNameIsSet
{
if([className isEqualToString: @"CustomView"] ||
[className isEqualToString: @""] || className == nil)
{
return NO;
}
return YES;
}
- (Class) classForCoder
{
if([self _classNameIsSet])
{
return [NSView class];
}
return [self class];
}
/*
* This needs to be coded like a GSNibItem. How do we make sure this
* tracks changes in GSNibItem coding?
*/
- (void) encodeWithCoder: (NSCoder*)aCoder
{
if([aCoder allowsKeyedCoding])
if([self _classNameIsSet] && [self superview] != nil)
{
GormClassManager *classManager = [(id<Gorm>)NSApp classManager];
NSString *extension = nil;
ASSIGNCOPY(extension,[classManager nonCustomSuperClassOf: className]);
[aCoder encodeObject: className forKey: @"NSClassName"];
[aCoder encodeRect: [self frame] forKey: @"NSFrame"];
if(extension != nil)
if([aCoder allowsKeyedCoding])
{
[aCoder encodeObject: extension forKey: @"NSExtension"];
GormClassManager *classManager = [(id<Gorm>)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);
}
if([self nextResponder] != nil)
else
{
[aCoder encodeObject: [self nextResponder] forKey: @"NSNextResponder"];
[aCoder encodeObject: [self stringValue]];
[aCoder encodeRect: _frame];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &_autoresizingMask];
}
if([self superview] != nil)
{
[aCoder encodeObject: [self superview] forKey: @"NSSuperview"];
}
RELEASE(extension);
}
else
{
[aCoder encodeObject: [self stringValue]];
[aCoder encodeRect: _frame];
[aCoder encodeValueOfObjCType: @encode(unsigned int)
at: &_autoresizingMask];
if([aCoder allowsKeyedCoding] == NO)
{
NSView *temp = [[NSView alloc] initWithFrame: [self frame]];
[temp setNextResponder: [self nextResponder]];
[(NSArchiver *)aCoder replaceObject: self withObject: temp];
}
}
}

View file

@ -2820,10 +2820,10 @@ static void _real_close(GormDocument *self,
*/
- (NSString *) description
{
return [NSString stringWithFormat: @"<%s: %lx> = %@",
return [NSString stringWithFormat: @"<%s: %lx> = <<name table: %@, connections: %@>>",
GSClassNameFromObject(self),
(unsigned long)self,
nameTable];
nameTable, connections];
}
/**

View file

@ -145,7 +145,7 @@
[self setTitle: title];
[self setFrame: NSMakeRect(0,0,400,300) display: YES];
// [self setBackgroundColor: [NSColor redColor]];
[self setBackgroundColor: [NSColor darkGrayColor]];
[self setReleasedWhenClosed: NO];
[self setView: view];
}