mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 13:41:55 +00:00
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:
parent
709dcde42d
commit
ac2faeaa9e
2 changed files with 5 additions and 83 deletions
|
@ -208,7 +208,6 @@ GSStringFromBorderType(NSBorderType borderType)
|
||||||
|
|
||||||
@interface NSImage (Private)
|
@interface NSImage (Private)
|
||||||
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
|
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
|
||||||
+ (NSDictionary *) _nameToPathDictionaryWithMappings: (NSDictionary*)pathForName;
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GSTheme (Private)
|
@interface GSTheme (Private)
|
||||||
|
@ -453,10 +452,7 @@ typedef struct {
|
||||||
NSDictionary *infoDict;
|
NSDictionary *infoDict;
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
GSThemeControlState state;
|
GSThemeControlState state;
|
||||||
NSMutableDictionary *themeImagePathForName;
|
|
||||||
NSDictionary *themeImagePathForNameWithMappings;
|
|
||||||
NSString *imageName;
|
|
||||||
|
|
||||||
NSDebugMLLog(@"GSTheme", @"%@ %p", [self name], self);
|
NSDebugMLLog(@"GSTheme", @"%@ %p", [self name], self);
|
||||||
/* Get rid of any cached colors list so that we regenerate it when needed
|
/* Get rid of any cached colors list so that we regenerate it when needed
|
||||||
*/
|
*/
|
||||||
|
@ -477,7 +473,6 @@ typedef struct {
|
||||||
imagePaths = [_bundle pathsForResourcesOfType: nil
|
imagePaths = [_bundle pathsForResourcesOfType: nil
|
||||||
inDirectory: @"ThemeImages"];
|
inDirectory: @"ThemeImages"];
|
||||||
enumerator = [imagePaths objectEnumerator];
|
enumerator = [imagePaths objectEnumerator];
|
||||||
themeImagePathForName = [[NSMutableDictionary alloc] init];
|
|
||||||
while ((imagePath = [enumerator nextObject]) != nil)
|
while ((imagePath = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
NSString *ext = [imagePath pathExtension];
|
NSString *ext = [imagePath pathExtension];
|
||||||
|
@ -488,29 +483,11 @@ typedef struct {
|
||||||
|
|
||||||
imageName = [imagePath lastPathComponent];
|
imageName = [imagePath lastPathComponent];
|
||||||
imageName = [imageName stringByDeletingPathExtension];
|
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
|
* Use the GSThemeDomain key in the info dictionary of the theme to
|
||||||
* set a defaults domain which will establish user defaults values
|
* set a defaults domain which will establish user defaults values
|
||||||
|
|
|
@ -120,7 +120,6 @@ BOOL NSImageForceCaching = NO; /* use on missmatch */
|
||||||
static NSRecursiveLock *imageLock = nil;
|
static NSRecursiveLock *imageLock = nil;
|
||||||
static NSMutableDictionary *nameDict = nil;
|
static NSMutableDictionary *nameDict = nil;
|
||||||
static NSDictionary *nsmapping = nil;
|
static NSDictionary *nsmapping = nil;
|
||||||
static NSMutableDictionary *nsmapping_inverse = nil;
|
|
||||||
static NSColor *clearColor = nil;
|
static NSColor *clearColor = nil;
|
||||||
static Class cachedClass = 0;
|
static Class cachedClass = 0;
|
||||||
static Class bitmapClass = 0;
|
static Class bitmapClass = 0;
|
||||||
|
@ -155,7 +154,6 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
@interface NSImage (Private)
|
@interface NSImage (Private)
|
||||||
+ (void) _clearFileTypeCaches: (NSNotification*)notif;
|
+ (void) _clearFileTypeCaches: (NSNotification*)notif;
|
||||||
+ (NSDictionary *) _nameToPathDictionaryWithMappings: (NSDictionary*)pathForName;
|
|
||||||
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
|
+ (void) _setImagePath: (NSString*)path name: (NSString*)name;
|
||||||
+ (NSString *) _pathForImageNamed: (NSString *)aName;
|
+ (NSString *) _pathForImageNamed: (NSString *)aName;
|
||||||
- (BOOL) _useFromFile: (NSString *)fileName;
|
- (BOOL) _useFromFile: (NSString *)fileName;
|
||||||
|
@ -186,31 +184,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
ofType: @"strings"
|
ofType: @"strings"
|
||||||
inDirectory: @"Images"];
|
inDirectory: @"Images"];
|
||||||
if (path)
|
if (path)
|
||||||
{
|
nsmapping = RETAIN([[NSString stringWithContentsOfFile: path]
|
||||||
NSEnumerator *e;
|
|
||||||
NSString *nsName;
|
|
||||||
|
|
||||||
// read NS image name to GS image name mapping
|
|
||||||
nsmapping = RETAIN([[NSString stringWithContentsOfFile: path]
|
|
||||||
propertyListFromStringsFileFormat]);
|
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]);
|
clearColor = RETAIN([NSColor clearColor]);
|
||||||
cachedClass = [NSCachedImageRep class];
|
cachedClass = [NSCachedImageRep class];
|
||||||
bitmapClass = [NSBitmapImageRep class];
|
bitmapClass = [NSBitmapImageRep class];
|
||||||
|
@ -1933,7 +1908,7 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
|
||||||
}
|
}
|
||||||
[image setName: name];
|
[image setName: name];
|
||||||
}
|
}
|
||||||
else if (image != nil)
|
else
|
||||||
{
|
{
|
||||||
if (nil == path)
|
if (nil == path)
|
||||||
{
|
{
|
||||||
|
@ -1950,36 +1925,6 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
|
||||||
[imageLock unlock];
|
[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 *) _pathForImageNamed: (NSString *)aName
|
||||||
{
|
{
|
||||||
NSString *realName = [nsmapping objectForKey: aName];
|
NSString *realName = [nsmapping objectForKey: aName];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue