Work on xib loading support for Gorm

This commit is contained in:
Gregory John Casamento 2021-04-22 05:58:49 -04:00
parent 405c345ab1
commit 63a4b4f456
2 changed files with 16 additions and 11 deletions

View file

@ -59,14 +59,14 @@ static GormWrapperLoaderFactory *_sharedWrapperLoaderFactory = nil;
{
NSMutableArray *images = [NSMutableArray array];
NSMutableArray *sounds = [NSMutableArray array];
NSArray *imageFileTypes = [NSImage imageFileTypes];
NSArray *soundFileTypes = [NSSound soundUnfilteredFileTypes];
document = doc; // don't retain...
if ([wrapper isDirectory])
{
NSDictionary *fileWrappers = nil;
NSString *key = nil;
NSArray *imageFileTypes = [NSImage imageFileTypes];
NSArray *soundFileTypes = [NSSound soundUnfilteredFileTypes];
NSEnumerator *enumerator = nil;
key = nil;
@ -106,6 +106,14 @@ static GormWrapperLoaderFactory *_sharedWrapperLoaderFactory = nil;
}
}
}
else if ([wrapper isRegularFile]) // handle wrappers which are just plain files...
{
}
else
{
NSLog(@"Unsupported wrapper type");
}
// fill in the images and sounds arrays...
[document setSounds: sounds];

View file

@ -49,18 +49,14 @@
NS_DURING
{
// NSData *classes = nil;
// NSString *key = nil;
GormPalettesManager *palettesManager = [(id<Gorm>)NSApp palettesManager];
NSDictionary *substituteClasses = [palettesManager substituteClasses];
NSString *subClassName = nil;
// NSDictionary *fileWrappers = nil;
if ([super loadFileWrapper: wrapper
withDocument: doc] &&
[wrapper isDirectory] == NO)
{
// NSString *path = [[wrapper filename] stringByDeletingLastPathComponent];
NSData *data = [wrapper regularFileContents];
GormClassManager *classManager = [document classManager];
id docFilesOwner;
@ -76,13 +72,14 @@
else
{
NSEnumerator *en;
GSXibKeyedUnarchiver *u;
NSKeyedUnarchiver *u; // using superclass for its interface.
//
// Create an unarchiver, and use it to unarchive the gorm file while
// Create an unarchiver, and use it to unarchive the xib file while
// handling class replacement so that standard objects understood
// by the gui library are converted to their Gorm internal equivalents.
//
u = [[GSXibKeyedUnarchiver alloc] initForReadingWithData: data];
u = [GSXibKeyedUnarchiver unarchiverForReadingWithData: data];
[u setDelegate: self];
//