mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Work on xib loading support for Gorm
This commit is contained in:
parent
405c345ab1
commit
63a4b4f456
2 changed files with 16 additions and 11 deletions
|
@ -59,14 +59,14 @@ static GormWrapperLoaderFactory *_sharedWrapperLoaderFactory = nil;
|
||||||
{
|
{
|
||||||
NSMutableArray *images = [NSMutableArray array];
|
NSMutableArray *images = [NSMutableArray array];
|
||||||
NSMutableArray *sounds = [NSMutableArray array];
|
NSMutableArray *sounds = [NSMutableArray array];
|
||||||
|
NSArray *imageFileTypes = [NSImage imageFileTypes];
|
||||||
|
NSArray *soundFileTypes = [NSSound soundUnfilteredFileTypes];
|
||||||
|
|
||||||
document = doc; // don't retain...
|
document = doc; // don't retain...
|
||||||
if ([wrapper isDirectory])
|
if ([wrapper isDirectory])
|
||||||
{
|
{
|
||||||
NSDictionary *fileWrappers = nil;
|
NSDictionary *fileWrappers = nil;
|
||||||
NSString *key = nil;
|
NSString *key = nil;
|
||||||
NSArray *imageFileTypes = [NSImage imageFileTypes];
|
|
||||||
NSArray *soundFileTypes = [NSSound soundUnfilteredFileTypes];
|
|
||||||
NSEnumerator *enumerator = nil;
|
NSEnumerator *enumerator = nil;
|
||||||
|
|
||||||
key = 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...
|
// fill in the images and sounds arrays...
|
||||||
[document setSounds: sounds];
|
[document setSounds: sounds];
|
||||||
|
|
|
@ -49,18 +49,14 @@
|
||||||
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
// NSData *classes = nil;
|
|
||||||
// NSString *key = nil;
|
|
||||||
GormPalettesManager *palettesManager = [(id<Gorm>)NSApp palettesManager];
|
GormPalettesManager *palettesManager = [(id<Gorm>)NSApp palettesManager];
|
||||||
NSDictionary *substituteClasses = [palettesManager substituteClasses];
|
NSDictionary *substituteClasses = [palettesManager substituteClasses];
|
||||||
NSString *subClassName = nil;
|
NSString *subClassName = nil;
|
||||||
// NSDictionary *fileWrappers = nil;
|
|
||||||
|
|
||||||
if ([super loadFileWrapper: wrapper
|
if ([super loadFileWrapper: wrapper
|
||||||
withDocument: doc] &&
|
withDocument: doc] &&
|
||||||
[wrapper isDirectory] == NO)
|
[wrapper isDirectory] == NO)
|
||||||
{
|
{
|
||||||
// NSString *path = [[wrapper filename] stringByDeletingLastPathComponent];
|
|
||||||
NSData *data = [wrapper regularFileContents];
|
NSData *data = [wrapper regularFileContents];
|
||||||
GormClassManager *classManager = [document classManager];
|
GormClassManager *classManager = [document classManager];
|
||||||
id docFilesOwner;
|
id docFilesOwner;
|
||||||
|
@ -76,13 +72,14 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSEnumerator *en;
|
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
|
// handling class replacement so that standard objects understood
|
||||||
// by the gui library are converted to their Gorm internal equivalents.
|
// by the gui library are converted to their Gorm internal equivalents.
|
||||||
//
|
//
|
||||||
u = [[GSXibKeyedUnarchiver alloc] initForReadingWithData: data];
|
u = [GSXibKeyedUnarchiver unarchiverForReadingWithData: data];
|
||||||
[u setDelegate: self];
|
[u setDelegate: self];
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue