mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 19:01:54 +00:00
Simplify loading of gmodels
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7063 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4640660056
commit
5c128c3b91
2 changed files with 35 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2000-07-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSBundleAdditions.m: patch by borgheron@yahoo.com to simplify
|
||||||
|
loading of gmodel files.
|
||||||
|
|
||||||
2000-07-06 Richard Frith-Macdonald <rfm@gnu.org>
|
2000-07-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GNUmakefile: Install GSFontInfo.h
|
* Source/GNUmakefile: Install GSFontInfo.h
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#include <AppKit/NSWindow.h>
|
#include <AppKit/NSWindow.h>
|
||||||
#include <AppKit/NSNibConnector.h>
|
#include <AppKit/NSNibConnector.h>
|
||||||
#include <AppKit/NSNibLoading.h>
|
#include <AppKit/NSNibLoading.h>
|
||||||
|
#include <AppKit/IMLoading.h>
|
||||||
|
|
||||||
@implementation NSNibConnector
|
@implementation NSNibConnector
|
||||||
|
|
||||||
|
@ -203,6 +203,17 @@
|
||||||
{
|
{
|
||||||
BOOL loaded = NO;
|
BOOL loaded = NO;
|
||||||
NSUnarchiver *unarchiver = nil;
|
NSUnarchiver *unarchiver = nil;
|
||||||
|
id owner = [context objectForKey: @"NSOwner"];
|
||||||
|
NSString *ext = [fileName pathExtension];
|
||||||
|
|
||||||
|
|
||||||
|
// If the file to be read is a gmodel, use the GMModel method to
|
||||||
|
// read it in and skip the dearchiving below.
|
||||||
|
if([ext isEqualToString: @"gmodel"])
|
||||||
|
{
|
||||||
|
return [GMModel loadIMFile: fileName
|
||||||
|
owner: owner];
|
||||||
|
}
|
||||||
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
{
|
{
|
||||||
|
@ -315,16 +326,18 @@
|
||||||
{
|
{
|
||||||
NSString *path;
|
NSString *path;
|
||||||
|
|
||||||
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
rootPath = [rootPath stringByAppendingPathComponent: fileName];
|
||||||
if ([ext isEqualToString: @""] == NO)
|
// If the file does not have an extension, then we need to
|
||||||
|
// figure out what type of model file to load.
|
||||||
|
if ([ext isEqualToString: @""] == YES)
|
||||||
{
|
{
|
||||||
path = [rootPath stringByAppendingPathExtension: ext];
|
path = [rootPath stringByAppendingPathExtension: @"gorm"];
|
||||||
if ([mgr isReadableFileAtPath: path] == NO)
|
if ([mgr isReadableFileAtPath: path] == NO)
|
||||||
{
|
{
|
||||||
path = [rootPath stringByAppendingPathExtension: @".gorm"];
|
path = [rootPath stringByAppendingPathExtension: @"nib"];
|
||||||
if ([mgr isReadableFileAtPath: path] == NO)
|
if ([mgr isReadableFileAtPath: path] == NO)
|
||||||
{
|
{
|
||||||
path = [rootPath stringByAppendingPathExtension: @".nib"];
|
path = [rootPath stringByAppendingPathExtension: @"gmodel"];
|
||||||
if ([mgr isReadableFileAtPath: path] == NO)
|
if ([mgr isReadableFileAtPath: path] == NO)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -335,7 +348,18 @@
|
||||||
externalNameTable: context
|
externalNameTable: context
|
||||||
withZone: (NSZone*)zone];
|
withZone: (NSZone*)zone];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = [rootPath stringByAppendingPathExtension: ext];
|
||||||
|
if([mgr isReadableFileAtPath: path])
|
||||||
|
{
|
||||||
|
return [NSBundle loadNibFile: path
|
||||||
|
externalNameTable: context
|
||||||
|
withZone: (NSZone*)zone];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue