Added suport for model loading.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2665 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ovidiu 1997-12-04 01:58:57 +00:00
parent e46ccd1acf
commit 07252e51bb
33 changed files with 2684 additions and 43 deletions

View file

@ -71,9 +71,6 @@ typedef struct _rep_data_t
BOOL validCache;
} rep_data_t;
/* Class variables and functions for class methods */
static NSMutableDictionary* nameDict;
NSArray *iterate_reps_for_types(NSArray *imageReps, SEL method);
/* Find the rep_data_t holding a representation */
@ -132,20 +129,37 @@ set_repd_for_rep(NSMutableArray *_reps, NSImageRep *rep, rep_data_t *new_repd)
@implementation NSImage
/* Class variables and functions for class methods */
static NSMutableDictionary* nameDict = nil;
static NSDictionary* nsmapping = nil;
+ (void)initialize
{
if (self == [NSImage class])
{
NSBundle *system = [NSBundle bundleWithPath:gnustep_libdir];
NSString* path = [system pathForResource:@"nsmapping"
ofType:@"strings"
inDirectory:NSImage_PATH];
// Initial version
[self setVersion:1];
// initialize the class variables
nameDict = [[NSMutableDictionary alloc] initWithCapacity: 10];
if (path)
nsmapping = [[[NSString stringWithContentsOfFile:path]
propertyListFromStringsFileFormat]
retain];
}
}
+ imageNamed: (NSString *)aName
{
NSString* realName = [nsmapping objectForKey:aName];
if (realName)
aName = realName;
/* If there is no image with that name, search in the main bundle */
if (!nameDict || ![nameDict objectForKey:aName])
{