mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 05:20:38 +00:00
Changes to refactor storyboard loader
This commit is contained in:
parent
e8d5653e47
commit
0ded1feee0
6 changed files with 37 additions and 33 deletions
|
@ -33,6 +33,7 @@
|
|||
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
#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 <NSCoding>
|
||||
{
|
||||
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 <NSCoding>
|
||||
{
|
||||
NSMutableArray *connectionRecords;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue