Merged changes from gnustep_testplant_branch branch and cleaned them up

a bit.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35417 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2012-08-17 13:16:12 +00:00
parent cd19623e53
commit ae0a552cc0
12 changed files with 209 additions and 40 deletions

View file

@ -1653,27 +1653,28 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
reps = [coder decodeObjectForKey: @"NSReps"];
reps = [reps objectAtIndex: 0];
id rep = [reps objectAtIndex: 1];
if([rep isKindOfClass:[NSImageRep class]])
if ([rep isKindOfClass: [NSImageRep class]])
{
[self addRepresentation: rep];
}
else
{
if([rep isKindOfClass:[NSURL class]])
if ([rep isKindOfClass: [NSURL class]])
{
rep = [NSImageRep imageRepWithContentsOfURL:rep];
NSURL *tmp = (NSURL*)rep;
rep = [NSImageRep imageRepWithContentsOfURL: rep];
// If we are unable to resolved the URL, try to get it from the
// resources folder.
if(rep == nil)
if (rep == nil)
{
NSString *fileName = [[rep absoluteString] lastPathComponent];
NSString *path = [[NSBundle mainBundle] pathForImageResource:fileName];
rep = [NSImageRep imageRepWithContentsOfFile:path];
NSString *fileName = [[tmp absoluteString] lastPathComponent];
NSString *path = [[NSBundle mainBundle] pathForImageResource: fileName];
rep = [NSImageRep imageRepWithContentsOfFile: path];
}
// If the representation was found, add it...
if(rep != nil)
if (rep != nil)
{
[self addRepresentation: rep];
}