Added better error message to initWithCoder in GSNibContainer and also added code in GSNibCompatibility to fix superview and window settings after a window is loaded in the nib file.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23180 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-07-19 03:16:49 +00:00
parent 06fed61392
commit 6462d48f4a
3 changed files with 52 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2006-07-18 23:11-EDT Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibCompatibility.m: Added category on NSView and
_fixSubviews method to correct window and superview after
loading the nib file. The _fixSubviews method is called in
nibInstantiate.
* Source/GSNibTemplates.m: More helpful error message for when
decoding fails due to the user attempting to load a version of
GSNibContainer that the container doesn't know about in initWithCoder:
2006-07-17 Enrico Sersale <enrico@fibernet.ro>
* Headers/AppKit/NSHelpManager.h:
@ -13,6 +23,7 @@
added a button to close the panel and changed the style mask of the window
to NSTitledWindowMask | NSResizableWindowMask.
>>>>>>> .r23179
2006-07-15 Enrico Sersale <enrico@fibernet.ro>
* Headers/AppKit/AppKit.h: added NSHelpManager.h.

View file

@ -56,6 +56,38 @@
static BOOL _isInInterfaceBuilder = NO;
@interface NSView (NibCompatibility)
- (void) _fixSubviews;
@end
@implementation NSView (NibCompatibility)
- (void) _setSuperview: (id) sv
{
ASSIGN(_super_view,sv);
}
- (void) _setWindow: (id) w
{
ASSIGN(_window,w);
}
- (void) _fixSubviews
{
NSEnumerator *en = [[self subviews] objectEnumerator];
id v = nil;
while((v = [en nextObject]) != nil)
{
if([v window] != [self window] ||
[v superview] != self)
{
[v _setWindow: [self window]];
[v _setSuperview: self];
}
[v _fixSubviews];
}
}
@end
@implementation NSWindowTemplate
+ (void) initialize
{
@ -201,6 +233,12 @@ static BOOL _isInInterfaceBuilder = NO;
}
}
- (void) _fixSubviews
{
id view = [_realObject contentView];
[view _fixSubviews];
}
- (id) nibInstantiate
{
if(_realObject == nil)
@ -250,6 +288,8 @@ static BOOL _isInInterfaceBuilder = NO;
[_realObject setMaxSize: _maxSize];
[_realObject setTitle: _title];
[self _fixSubviews];
// resize the window...
[_realObject setFrame: [NSWindow frameRectForContentRect: [self windowRect]
styleMask: [self windowStyle]]

View file

@ -471,7 +471,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN
else
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to read GSNibContainer version #%d. GSNibContainer version for the installed gui lib is %d.", version, GNUSTEP_NIB_VERSION];
format: @"Unable to read GSNibContainer version #%d. GSNibContainer version for the installed gui lib is %d. Please upgrade to a more recent version of the gui library.", version, GNUSTEP_NIB_VERSION];
}
return self;