Revert "Allow themes to override only a "base" image like"

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@36481 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-04-06 19:30:30 +00:00
parent 5dcf9e3251
commit 23d47ca882
2 changed files with 5 additions and 83 deletions

View file

@ -208,7 +208,6 @@ GSStringFromBorderType(NSBorderType borderType)
@interface NSImage (Private)
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
+ (NSDictionary *) _nameToPathDictionaryWithMappings: (NSDictionary*)pathForName;
@end
@interface GSTheme (Private)
@ -453,10 +452,7 @@ typedef struct {
NSDictionary *infoDict;
NSWindow *window;
GSThemeControlState state;
NSMutableDictionary *themeImagePathForName;
NSDictionary *themeImagePathForNameWithMappings;
NSString *imageName;
NSDebugMLLog(@"GSTheme", @"%@ %p", [self name], self);
/* Get rid of any cached colors list so that we regenerate it when needed
*/
@ -477,7 +473,6 @@ typedef struct {
imagePaths = [_bundle pathsForResourcesOfType: nil
inDirectory: @"ThemeImages"];
enumerator = [imagePaths objectEnumerator];
themeImagePathForName = [[NSMutableDictionary alloc] init];
while ((imagePath = [enumerator nextObject]) != nil)
{
NSString *ext = [imagePath pathExtension];
@ -488,29 +483,11 @@ typedef struct {
imageName = [imagePath lastPathComponent];
imageName = [imageName stringByDeletingPathExtension];
[themeImagePathForName setObject: imagePath forKey: imageName];
[_imageNames addObject: imageName];
[NSImage _setImagePath: imagePath name: imageName];
}
}
/*
* "Expand" the themeImagePathForName dictionary by applying the
* mappings in nsmappings.strings.
*
* e.g. if the theme defines
* common_3DArrowRight but not NSMenuArrow, this will add an entry
* for NSMenuArrow pointing at the common_3DArrowRight path.
*/
themeImagePathForNameWithMappings = [NSImage _nameToPathDictionaryWithMappings: themeImagePathForName];
DESTROY(themeImagePathForName);
enumerator = [themeImagePathForNameWithMappings keyEnumerator];
while ((imageName = [enumerator nextObject]) != nil)
{
imagePath = [themeImagePathForNameWithMappings objectForKey: imageName];
[NSImage _setImagePath: imagePath name: imageName];
[_imageNames addObject: imageName];
}
/*
* Use the GSThemeDomain key in the info dictionary of the theme to
* set a defaults domain which will establish user defaults values

View file

@ -120,7 +120,6 @@ BOOL NSImageForceCaching = NO; /* use on missmatch */
static NSRecursiveLock *imageLock = nil;
static NSMutableDictionary *nameDict = nil;
static NSDictionary *nsmapping = nil;
static NSMutableDictionary *nsmapping_inverse = nil;
static NSColor *clearColor = nil;
static Class cachedClass = 0;
static Class bitmapClass = 0;
@ -155,7 +154,6 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
@interface NSImage (Private)
+ (void) _clearFileTypeCaches: (NSNotification*)notif;
+ (NSDictionary *) _nameToPathDictionaryWithMappings: (NSDictionary*)pathForName;
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
+ (NSString *) _pathForImageNamed: (NSString *)aName;
- (BOOL) _useFromFile: (NSString *)fileName;
@ -186,31 +184,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
ofType: @"strings"
inDirectory: @"Images"];
if (path)
{
NSEnumerator *e;
NSString *nsName;
// read NS image name to GS image name mapping
nsmapping = RETAIN([[NSString stringWithContentsOfFile: path]
nsmapping = RETAIN([[NSString stringWithContentsOfFile: path]
propertyListFromStringsFileFormat]);
// create a GS image name to array of NS image names dict
nsmapping_inverse = [[NSMutableDictionary alloc] init];
e = [nsmapping keyEnumerator];
while ((nsName = [e nextObject]) != nil)
{
NSString *gsName = [nsmapping objectForKey: nsName];
NSMutableArray *nsNames = [nsmapping_inverse objectForKey: gsName];
if (nsNames == nil)
{
nsNames = [NSMutableArray array];
[nsmapping_inverse setObject: nsNames forKey: gsName];
}
[nsNames addObject: nsName];
}
}
clearColor = RETAIN([NSColor clearColor]);
cachedClass = [NSCachedImageRep class];
bitmapClass = [NSBitmapImageRep class];
@ -1933,7 +1908,7 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
}
[image setName: name];
}
else if (image != nil)
else
{
if (nil == path)
{
@ -1950,36 +1925,6 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
[imageLock unlock];
}
/**
* Expands a name->path dictionary by applying all of the nsmappings.strings
* mappings.
*/
+ (NSDictionary *) _nameToPathDictionaryWithMappings: (NSDictionary*)pathForName
{
NSMutableDictionary *finalDict = [NSMutableDictionary dictionaryWithDictionary: pathForName];
NSEnumerator *e;
NSString *name;
e = [pathForName keyEnumerator];
while ((name = [e nextObject]) != nil)
{
NSString *path = [pathForName objectForKey: name];
NSEnumerator *namesMappedToNameEnumerator;
NSString *mappedName;
namesMappedToNameEnumerator = [[nsmapping_inverse objectForKey: name] objectEnumerator];
while ((mappedName = [namesMappedToNameEnumerator nextObject]) != nil)
{
if ([pathForName objectForKey: mappedName] == nil)
{
[finalDict setObject: path forKey: mappedName];
}
}
}
return finalDict;
}
+ (NSString *) _pathForImageNamed: (NSString *)aName
{
NSString *realName = [nsmapping objectForKey: aName];