diff --git a/Headers/Additions/GNUstepGUI/GSXibLoading.h b/Headers/Additions/GNUstepGUI/GSXibLoading.h index 346b929c5..33816cb18 100644 --- a/Headers/Additions/GNUstepGUI/GSXibLoading.h +++ b/Headers/Additions/GNUstepGUI/GSXibLoading.h @@ -33,6 +33,7 @@ #import #import + #import "GNUstepGUI/GSXibKeyedUnarchiver.h" @class NSString, NSDictionary, NSArray, NSMutableDictionary, NSMutableArray; @@ -42,11 +43,13 @@ // Hack: This allows the class name FirstResponder in NSCustomObject and // correctly returns nil as the corresponding object. +APPKIT_EXPORT_CLASS @interface FirstResponder: NSObject { } @end +APPKIT_EXPORT_CLASS @interface IBClassDescriptionSource: NSObject { NSString *majorKey; @@ -54,6 +57,7 @@ } @end +APPKIT_EXPORT_CLASS @interface IBPartialClassDescription: NSObject { NSString *className; @@ -70,6 +74,7 @@ } @end +APPKIT_EXPORT_CLASS @interface IBConnection: NSObject { NSString *label; @@ -84,23 +89,27 @@ - (void) establishConnection; @end +APPKIT_EXPORT_CLASS @interface IBActionConnection: IBConnection { NSString *trigger; } @end +APPKIT_EXPORT_CLASS @interface IBOutletConnection: IBConnection { } @end +APPKIT_EXPORT_CLASS @interface IBBindingConnection: IBConnection { NSNibBindingConnector *connector; } @end +APPKIT_EXPORT_CLASS @interface IBConnectionRecord: NSObject { IBConnection *connection; @@ -109,6 +118,7 @@ - (IBConnection *) connection; @end +APPKIT_EXPORT_CLASS @interface IBToolTipAttribute: NSObject { NSString *name; @@ -117,6 +127,7 @@ } @end +APPKIT_EXPORT_CLASS @interface IBInitialTabViewItemAttribute: NSObject { NSString *name; @@ -125,6 +136,7 @@ } @end +APPKIT_EXPORT_CLASS @interface IBObjectRecord: NSObject { id objectID; @@ -137,6 +149,7 @@ - (id) objectID; @end +APPKIT_EXPORT_CLASS @interface IBMutableOrderedSet: NSObject { NSArray *orderedObjects; @@ -145,6 +158,7 @@ - (id) objectWithObjectID: (id)objID; @end +APPKIT_EXPORT_CLASS @interface IBObjectContainer: NSObject { NSMutableArray *connectionRecords; diff --git a/Headers/AppKit/NSStoryboard.h b/Headers/AppKit/NSStoryboard.h index 29dc911ed..4e9e65798 100644 --- a/Headers/AppKit/NSStoryboard.h +++ b/Headers/AppKit/NSStoryboard.h @@ -34,6 +34,7 @@ extern "C" { #endif @class NSBundle; +@class NSData; @class NSMutableDictionary; @class NSString; @@ -45,6 +46,7 @@ DEFINE_BLOCK_TYPE(NSStoryboardControllerCreator, NSCoder*, id); APPKIT_EXPORT_CLASS @interface NSStoryboard : NSObject { + NSData *_data; NSMutableDictionary *_scenes; } diff --git a/Source/GSStoryboardLoader.m b/Source/GSStoryboardLoader.m index 9761f7669..7d9b570b6 100644 --- a/Source/GSStoryboardLoader.m +++ b/Source/GSStoryboardLoader.m @@ -39,6 +39,7 @@ #import "AppKit/NSApplication.h" #import "AppKit/NSMenu.h" #import "AppKit/NSNib.h" + #import "GNUstepGUI/GSModelLoaderFactory.h" #import "GNUstepGUI/GSNibLoading.h" #import "GNUstepGUI/GSXibLoading.h" @@ -122,9 +123,9 @@ return; } - NSDebugLLog(@"XIB", @"First object %@", [rootObjects objectAtIndex: 0]); - NSDebugLLog(@"XIB", @"Second object %@", [rootObjects objectAtIndex: 1]); - NSDebugLLog(@"XIB", @"Third object %@", [rootObjects objectAtIndex: 2]); + NSDebugLLog(@"Storyboard", @"First object %@", [rootObjects objectAtIndex: 0]); + NSDebugLLog(@"Storyboard", @"Second object %@", [rootObjects objectAtIndex: 1]); + NSDebugLLog(@"Storyboard", @"Third object %@", [rootObjects objectAtIndex: 2]); // Use the owner as first root object [(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner]; @@ -187,7 +188,7 @@ NSArray *rootObjects; IBObjectContainer *objects; - NSDebugLLog(@"XIB", @"Invoking unarchiver"); + NSDebugLLog(@"Storyboard", @"Invoking unarchiver"); [unarchiver setObjectZone: zone]; rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"]; objects = [unarchiver decodeObjectForKey: @"IBDocument.Objects"]; @@ -231,7 +232,7 @@ NSFileManager *mgr = [NSFileManager defaultManager]; BOOL isDir = NO; - NSDebugLLog(@"XIB", @"Loading Storyboard `%@'...\n", fileName); + NSDebugLLog(@"Storyboard", @"Loading Storyboard `%@'...\n", fileName); if ([mgr fileExistsAtPath: fileName isDirectory: &isDir]) { if (isDir == NO) @@ -247,6 +248,7 @@ { NSLog(@"Storyboard file specified %@, could not be found.", fileName); } + return nil; } diff --git a/Source/GSXib5KeyedUnarchiver.m b/Source/GSXib5KeyedUnarchiver.m index 051aae905..0f9bb33ab 100644 --- a/Source/GSXib5KeyedUnarchiver.m +++ b/Source/GSXib5KeyedUnarchiver.m @@ -233,7 +233,7 @@ static NSArray *XmlBoolDefaultYes = nil; @"NSStackViewContainer", @"middleViews", @"NSStackViewContainer", @"endViews", // @"GSScene", @"scene", - // @"NSMutableArray", @"scenes", + @"NSMutableArray", @"scenes", nil]; RETAIN(XmlTagToObjectClassMap); @@ -704,7 +704,7 @@ static NSArray *XmlBoolDefaultYes = nil; // Parse the XML data [theParser parse]; - // Decode optional resources + // Decode optional resourcess _resources = RETAIN([self decodeObjectForKey: @"resources"]); } NS_HANDLER diff --git a/Source/GSXibKeyedUnarchiver.m b/Source/GSXibKeyedUnarchiver.m index b77501b2a..04f7e1356 100644 --- a/Source/GSXibKeyedUnarchiver.m +++ b/Source/GSXibKeyedUnarchiver.m @@ -98,11 +98,12 @@ { NSKeyedUnarchiver *unarchiver = nil; - if ([self checkStoryboard: data]) - { - unarchiver = [[GSStoryboardKeyedUnarchiver alloc] initForReadingWithData: data]; - } - else if ([self checkXib5: data]) + // if ([self checkStoryboard: data]) + // { + // unarchiver = [[GSStoryboardKeyedUnarchiver alloc] initForReadingWithData: data]; + // } + // else + if ([self checkXib5: data]) { unarchiver = [[GSXib5KeyedUnarchiver alloc] initForReadingWithData: data]; } diff --git a/Source/NSStoryboard.m b/Source/NSStoryboard.m index befcd6e8b..b738b133e 100644 --- a/Source/NSStoryboard.m +++ b/Source/NSStoryboard.m @@ -111,32 +111,17 @@ static NSStoryboard *__mainStoryboard = nil; self = [super init]; if (self != nil) { - BOOL success = NO; - - success = [bundle loadNibFile: name - externalNameTable: nil - withZone: NSDefaultMallocZone()]; + NSString *path = [bundle pathForResource: name + ofType: @"storyboard"]; + _data = [NSData dataWithContentsOfFile: path]; - if (success) + if (_data != nil) { } - /* - if (unarchiver != nil) + else { - NSArray *rootObjects; - IBObjectContainer *objects; - - NSDebugLLog(@"XIB", @"Invoking unarchiver"); - [unarchiver setObjectZone: zone]; - rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"]; - objects = [unarchiver decodeObjectForKey: @"IBDocument.Objects"]; - NSDebugLLog(@"XIB", @"rootObjects %@", rootObjects); - [self awake: rootObjects - inContainer: objects - withContext: context]; - loaded = YES; + NSLog(@"Failed to load storyboard with name \"%@\" at \"%@.\"", name, path); } - */ } return self; }