mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 17:52:42 +00:00
revert last change and do proper fix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28652 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d16088af08
commit
2aa64c58a9
4 changed files with 43 additions and 30 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,9 +1,12 @@
|
|||
2009-09-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSInfoPanel.m: When trying to locate image, try
|
||||
the applicationIconImage method before trying the image
|
||||
named NSApplicationIcon (the generic app icon). That way we get
|
||||
the actual icon used by the application.
|
||||
* Source/NSApplication.m: ([-setApplicationIconImage:]) ensure that
|
||||
the new image has its name set to NSApplicationIcon
|
||||
* Source/NSImage: ([+imageNamed:]) fixed bug exposed by recent change
|
||||
of nsmappings.strings file. The old code was using the mapped names
|
||||
as the image names which meant that a subsequent ([-setName:]) using
|
||||
the unmapped name would not effect the image retrieved by later calls
|
||||
to ([+imageNamed:]).
|
||||
|
||||
2009-09-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
|
|
|
@ -282,9 +282,10 @@ new_label (NSString *value)
|
|||
|
||||
if (nil_or_not_of_class (icon, [NSImage class]))
|
||||
{
|
||||
icon = [NSApp applicationIconImage];
|
||||
icon = [NSImage imageNamed: @"NSApplicationIcon"];
|
||||
|
||||
if (nil_or_not_of_class (icon, [NSImage class]))
|
||||
icon = [NSImage imageNamed: @"NSApplicationIcon"];
|
||||
icon = [NSApp applicationIconImage];
|
||||
}
|
||||
/* Release */
|
||||
if (dictionary)
|
||||
|
|
|
@ -2210,12 +2210,17 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
NSSize imageSize = [anImage size];
|
||||
|
||||
RETAIN(old_app_icon);
|
||||
[_app_icon setName: nil];
|
||||
|
||||
// Use a copy as we change the name and size
|
||||
ASSIGNCOPY(_app_icon, anImage);
|
||||
|
||||
/* Set the new image to be named 'NSApplicationIcon' ... to do that we
|
||||
* must first check that any existing eimage of the same name has their
|
||||
* name removed.
|
||||
*/
|
||||
[(NSImage*)[NSImage imageNamed: @"NSApplicationIcon"] setName: nil];
|
||||
[_app_icon setName: @"NSApplicationIcon"];
|
||||
|
||||
[_app_icon setScalesWhenResized: YES];
|
||||
|
||||
if (miniWindowSize.width <= 0 || miniWindowSize.height <= 0)
|
||||
|
|
|
@ -179,7 +179,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
{
|
||||
NSString *path = [NSBundle pathForLibraryResource: @"nsmapping"
|
||||
ofType: @"strings"
|
||||
inDirectory: @"Images"];
|
||||
inDirectory: @"Images"];
|
||||
|
||||
// Initial version
|
||||
[self setVersion: 1];
|
||||
|
@ -197,27 +197,32 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
|
||||
+ (id) imageNamed: (NSString *)aName
|
||||
{
|
||||
NSString *realName = [nsmapping objectForKey: aName];
|
||||
NSImage *image;
|
||||
|
||||
if (realName)
|
||||
aName = realName;
|
||||
|
||||
image = (NSImage*)[nameDict objectForKey: aName];
|
||||
NSImage *image = (NSImage*)[nameDict objectForKey: aName];
|
||||
|
||||
/* 2009-09-10 changed operation of nsmapping so that the loaded
|
||||
* image is stored under the key 'aName', not under the mapped
|
||||
* name. That way the image is created with the correct name and
|
||||
* a later call to -setName: will work properly.
|
||||
*/
|
||||
if (image == nil || [(id)image _resource] == nil)
|
||||
{
|
||||
NSString *ext;
|
||||
NSString *path = nil;
|
||||
NSBundle *main_bundle;
|
||||
NSArray *array;
|
||||
NSString *the_name = aName;
|
||||
NSString *realName = [nsmapping objectForKey: aName];
|
||||
NSString *ext;
|
||||
NSString *path = nil;
|
||||
NSBundle *main_bundle;
|
||||
NSArray *array;
|
||||
|
||||
if (realName == nil)
|
||||
{
|
||||
realName = aName;
|
||||
}
|
||||
|
||||
|
||||
// FIXME: This should use [NSBundle pathForImageResource], but this will
|
||||
// only allow imageUnfilteredFileTypes.
|
||||
/* If there is no image with that name, search in the main bundle */
|
||||
main_bundle = [NSBundle mainBundle];
|
||||
ext = [aName pathExtension];
|
||||
ext = [realName pathExtension];
|
||||
if (ext != nil && [ext length] == 0)
|
||||
{
|
||||
ext = nil;
|
||||
|
@ -225,23 +230,22 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
|
||||
/* Check if extension is one of the image types */
|
||||
array = [self imageFileTypes];
|
||||
if ([array indexOfObject: ext] != NSNotFound)
|
||||
if (ext != nil && [array indexOfObject: ext] != NSNotFound)
|
||||
{
|
||||
/* Extension is one of the image types
|
||||
So remove from the name */
|
||||
the_name = [aName stringByDeletingPathExtension];
|
||||
realName = [realName stringByDeletingPathExtension];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise extension is not an image type
|
||||
So leave it alone */
|
||||
the_name = aName;
|
||||
ext = nil;
|
||||
}
|
||||
|
||||
/* First search locally */
|
||||
if (ext)
|
||||
path = [main_bundle pathForResource: the_name ofType: ext];
|
||||
path = [main_bundle pathForResource: realName ofType: ext];
|
||||
else
|
||||
{
|
||||
id o, e;
|
||||
|
@ -249,8 +253,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
e = [array objectEnumerator];
|
||||
while ((o = [e nextObject]))
|
||||
{
|
||||
path = [main_bundle pathForResource: the_name
|
||||
ofType: o];
|
||||
path = [main_bundle pathForResource: realName
|
||||
ofType: o];
|
||||
if (path != nil && [path length] != 0)
|
||||
break;
|
||||
}
|
||||
|
@ -261,7 +265,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
{
|
||||
if (ext)
|
||||
{
|
||||
path = [NSBundle pathForLibraryResource: the_name
|
||||
path = [NSBundle pathForLibraryResource: realName
|
||||
ofType: ext
|
||||
inDirectory: @"Images"];
|
||||
}
|
||||
|
@ -272,8 +276,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
e = [array objectEnumerator];
|
||||
while ((o = [e nextObject]))
|
||||
{
|
||||
path = [NSBundle pathForLibraryResource: the_name
|
||||
ofType: o
|
||||
path = [NSBundle pathForLibraryResource: realName
|
||||
ofType: o
|
||||
inDirectory: @"Images"];
|
||||
if (path != nil && [path length] != 0)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue