mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 03:11:18 +00:00
This should fix old xibs and correct new ones as well
This commit is contained in:
parent
b03bcf7e4a
commit
d0c1d7f403
4 changed files with 32 additions and 5 deletions
|
@ -215,6 +215,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSView", @"tableCellView",
|
||||
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
|
||||
@"NSURL", @"url",
|
||||
@"NSStoryboardSegue", @"segue",
|
||||
nil];
|
||||
RETAIN(XmlTagToObjectClassMap);
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@
|
|||
NSEnumerator *en;
|
||||
id obj;
|
||||
NSUInteger index = 0;
|
||||
|
||||
BOOL ownerSetForOldXib = NO;
|
||||
|
||||
if ([rootObjects count] == 0)
|
||||
{
|
||||
NSWarnMLog(@"No root objects in XIB!");
|
||||
|
@ -113,7 +114,7 @@
|
|||
// these are represented by NSCustomObject or it's subclasses...
|
||||
if (obj != nil)
|
||||
{
|
||||
if ([obj isKindOfClass: [NSCustomObject class]])
|
||||
if ([obj isKindOfClass: [NSCustomObject5 class]])
|
||||
{
|
||||
NSCustomObject5 *co = (NSCustomObject5 *)obj;
|
||||
NSString *userLabel = [co userLabel];
|
||||
|
@ -122,6 +123,11 @@
|
|||
[co setRealObject: owner];
|
||||
}
|
||||
}
|
||||
else if ([obj class] == [NSCustomObject class] && ownerSetForOldXib == NO)
|
||||
{
|
||||
[obj setRealObject: owner]; // set on first object in list...
|
||||
ownerSetForOldXib = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
[topLevelObjects addObject: obj];
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#import "AppKit/NSStoryboard.h"
|
||||
#import "AppKit/NSWindowController.h"
|
||||
#import "AppKit/NSViewController.h"
|
||||
#import "AppKit/NSWindow.h"
|
||||
|
||||
#import "GNUstepGUI/GSModelLoaderFactory.h"
|
||||
|
||||
|
@ -159,6 +160,21 @@ static NSStoryboard *mainStoryboard = nil;
|
|||
NSXMLElement *ce = [windowControllers objectAtIndex: 0];
|
||||
NSXMLNode *attr = [ce attributeForName: @"id"];
|
||||
controllerId = [attr stringValue];
|
||||
|
||||
NSEnumerator *windowControllerEnum = [windowControllers objectEnumerator];
|
||||
NSXMLElement *o = nil;
|
||||
while ((o = [windowControllerEnum nextObject]) != nil)
|
||||
{
|
||||
NSXMLElement *objects = (NSXMLElement *)[o parent];
|
||||
NSArray *windows = [o nodesForXPath: @"//window" error: NULL];
|
||||
NSEnumerator *windowEn = [windows objectEnumerator];
|
||||
NSXMLNode *w = nil;
|
||||
while ((w = [windowEn nextObject]) != nil)
|
||||
{
|
||||
[w detach];
|
||||
[objects addChild: w];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ([viewControllers count] > 0)
|
||||
|
@ -323,10 +339,14 @@ static NSStoryboard *mainStoryboard = nil;
|
|||
{
|
||||
if ([o isKindOfClass: [NSWindowController class]])
|
||||
{
|
||||
NSWindowController *wc = (NSWindowController *)o;
|
||||
controller = o;
|
||||
[wc showWindow: self];
|
||||
}
|
||||
if ([o isKindOfClass: [NSWindow class]] &&
|
||||
[controller isKindOfClass: [NSWindowController class]])
|
||||
{
|
||||
[controller setWindow: o];
|
||||
[controller showWindow: self];
|
||||
}
|
||||
else if ([o isKindOfClass: [NSViewController class]])
|
||||
{
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@
|
|||
return _window;
|
||||
}
|
||||
|
||||
/** Sets the window that this controller managers to aWindow. The old
|
||||
/** Sets the window that this controller manages to aWindow. The old
|
||||
window is released. */
|
||||
- (void) setWindow: (NSWindow *)aWindow
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue