Small improvements on XIB loading.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30023 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-03-23 07:15:17 +00:00
parent 68ce541e5d
commit 42b91d0695
3 changed files with 34 additions and 25 deletions

View file

@ -1,3 +1,10 @@
2010-03-23 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSXibLoader.m: Try to be a bit closer to the current NIB
loading code.
* Source/NSTextView.m (-replaceTextContainer:): Retain the text
storage, the last change in buildUpTextNetwork: made this more volatile.
2010-03-22 Fred Kiefer <FredKiefer@gmx.de>
* Source/GSGormLoading.m (-awakeWithContext:): Add old NIB loading

View file

@ -576,13 +576,13 @@
NSEnumerator *en;
id obj;
IBObjectContainer *objects;
NSMutableArray *tlo = [context objectForKey: @"NSTopLevelObjects"];
NSMutableArray *topLevelObjects = [context objectForKey: @"NSTopLevelObjects"];
id owner = [context objectForKey: @"NSOwner"];
// get using the alternate names.
if (tlo == nil)
if (topLevelObjects == nil)
{
tlo = [context objectForKey: @"NSNibTopLevelObjects"];
topLevelObjects = [context objectForKey: @"NSNibTopLevelObjects"];
}
if (owner == nil)
@ -593,41 +593,40 @@
objects = [data objectForKey: @"IBDocument.Objects"];
[objects nibInstantiate];
// FIXME: Use the owner as first root object
rootObjects = [data objectForKey: @"IBDocument.RootObjects"];
NSDebugLog(@"rootObjects %@", rootObjects);
en = [rootObjects objectEnumerator];
while ((obj = [en nextObject]) != nil)
{
// instantiate all windows and fill in the top level array.
if ([obj isKindOfClass: [NSWindowTemplate class]])
if ([obj respondsToSelector: @selector(nibInstantiate)])
{
NSWindow *w = [obj nibInstantiate];
[tlo addObject: w];
// bring visible windows to front...
//if ([w isVisible])
obj = [obj nibInstantiate];
if (topLevelObjects == nil)
{
[w orderFront: self];
// When there is no top level object array, just retain these objects
RETAIN(obj);
}
else
{
[topLevelObjects addObject: obj];
}
}
// instantiate all windows and fill in the top level array.
if ([obj isKindOfClass: [NSWindow class]])
{
// bring visible windows to front...
//if ([obj isVisible])
{
[(NSWindow *)obj orderFront: self];
}
}
else if ([obj isKindOfClass: [NSMenu class]])
{
// add the menu...
if ([obj respondsToSelector: @selector(nibInstantiate)])
{
obj = [obj nibInstantiate];
}
[NSApp _setMainMenu: obj];
}
/*
else
{
id v = NSMapGet(_objects, obj);
if (v == nil || v == owner)
{
[tlo addObject: obj];
}
}
*/
// awaken the object.
if ([obj respondsToSelector: @selector(awakeFromNib)])

View file

@ -1153,12 +1153,15 @@ to this method from the text container or layout manager.
{
NSLayoutManager *lm = _layoutManager;
unsigned int index = [[lm textContainers] indexOfObject: _textContainer];
NSTextStorage *ts = _textStorage;
RETAIN(self);
RETAIN(ts);
[_textContainer setTextView: nil];
[lm removeTextContainerAtIndex: index];
[lm insertTextContainer: newContainer atIndex: index];
[newContainer setTextView: self];
RELEASE(ts);
RELEASE(self);
}