mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 22:10:58 +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
21c9e0dca8
commit
726ab25f1e
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>
|
2009-09-10 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSInfoPanel.m: When trying to locate image, try
|
* Source/NSApplication.m: ([-setApplicationIconImage:]) ensure that
|
||||||
the applicationIconImage method before trying the image
|
the new image has its name set to NSApplicationIcon
|
||||||
named NSApplicationIcon (the generic app icon). That way we get
|
* Source/NSImage: ([+imageNamed:]) fixed bug exposed by recent change
|
||||||
the actual icon used by the application.
|
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>
|
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]))
|
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]))
|
if (nil_or_not_of_class (icon, [NSImage class]))
|
||||||
icon = [NSImage imageNamed: @"NSApplicationIcon"];
|
icon = [NSApp applicationIconImage];
|
||||||
}
|
}
|
||||||
/* Release */
|
/* Release */
|
||||||
if (dictionary)
|
if (dictionary)
|
||||||
|
|
|
@ -2210,12 +2210,17 @@ image.</p><p>See Also: -applicationIconImage</p>
|
||||||
NSSize imageSize = [anImage size];
|
NSSize imageSize = [anImage size];
|
||||||
|
|
||||||
RETAIN(old_app_icon);
|
RETAIN(old_app_icon);
|
||||||
[_app_icon setName: nil];
|
|
||||||
|
|
||||||
// Use a copy as we change the name and size
|
// Use a copy as we change the name and size
|
||||||
ASSIGNCOPY(_app_icon, anImage);
|
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 setName: @"NSApplicationIcon"];
|
||||||
|
|
||||||
[_app_icon setScalesWhenResized: YES];
|
[_app_icon setScalesWhenResized: YES];
|
||||||
|
|
||||||
if (miniWindowSize.width <= 0 || miniWindowSize.height <= 0)
|
if (miniWindowSize.width <= 0 || miniWindowSize.height <= 0)
|
||||||
|
|
|
@ -179,7 +179,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
{
|
{
|
||||||
NSString *path = [NSBundle pathForLibraryResource: @"nsmapping"
|
NSString *path = [NSBundle pathForLibraryResource: @"nsmapping"
|
||||||
ofType: @"strings"
|
ofType: @"strings"
|
||||||
inDirectory: @"Images"];
|
inDirectory: @"Images"];
|
||||||
|
|
||||||
// Initial version
|
// Initial version
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
|
@ -197,27 +197,32 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
+ (id) imageNamed: (NSString *)aName
|
+ (id) imageNamed: (NSString *)aName
|
||||||
{
|
{
|
||||||
NSString *realName = [nsmapping objectForKey: aName];
|
NSImage *image = (NSImage*)[nameDict objectForKey: aName];
|
||||||
NSImage *image;
|
|
||||||
|
|
||||||
if (realName)
|
|
||||||
aName = realName;
|
|
||||||
|
|
||||||
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)
|
if (image == nil || [(id)image _resource] == nil)
|
||||||
{
|
{
|
||||||
NSString *ext;
|
NSString *realName = [nsmapping objectForKey: aName];
|
||||||
NSString *path = nil;
|
NSString *ext;
|
||||||
NSBundle *main_bundle;
|
NSString *path = nil;
|
||||||
NSArray *array;
|
NSBundle *main_bundle;
|
||||||
NSString *the_name = aName;
|
NSArray *array;
|
||||||
|
|
||||||
|
if (realName == nil)
|
||||||
|
{
|
||||||
|
realName = aName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// FIXME: This should use [NSBundle pathForImageResource], but this will
|
// FIXME: This should use [NSBundle pathForImageResource], but this will
|
||||||
// only allow imageUnfilteredFileTypes.
|
// only allow imageUnfilteredFileTypes.
|
||||||
/* If there is no image with that name, search in the main bundle */
|
/* If there is no image with that name, search in the main bundle */
|
||||||
main_bundle = [NSBundle mainBundle];
|
main_bundle = [NSBundle mainBundle];
|
||||||
ext = [aName pathExtension];
|
ext = [realName pathExtension];
|
||||||
if (ext != nil && [ext length] == 0)
|
if (ext != nil && [ext length] == 0)
|
||||||
{
|
{
|
||||||
ext = nil;
|
ext = nil;
|
||||||
|
@ -225,23 +230,22 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
/* Check if extension is one of the image types */
|
/* Check if extension is one of the image types */
|
||||||
array = [self imageFileTypes];
|
array = [self imageFileTypes];
|
||||||
if ([array indexOfObject: ext] != NSNotFound)
|
if (ext != nil && [array indexOfObject: ext] != NSNotFound)
|
||||||
{
|
{
|
||||||
/* Extension is one of the image types
|
/* Extension is one of the image types
|
||||||
So remove from the name */
|
So remove from the name */
|
||||||
the_name = [aName stringByDeletingPathExtension];
|
realName = [realName stringByDeletingPathExtension];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Otherwise extension is not an image type
|
/* Otherwise extension is not an image type
|
||||||
So leave it alone */
|
So leave it alone */
|
||||||
the_name = aName;
|
|
||||||
ext = nil;
|
ext = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* First search locally */
|
/* First search locally */
|
||||||
if (ext)
|
if (ext)
|
||||||
path = [main_bundle pathForResource: the_name ofType: ext];
|
path = [main_bundle pathForResource: realName ofType: ext];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
id o, e;
|
id o, e;
|
||||||
|
@ -249,8 +253,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
e = [array objectEnumerator];
|
e = [array objectEnumerator];
|
||||||
while ((o = [e nextObject]))
|
while ((o = [e nextObject]))
|
||||||
{
|
{
|
||||||
path = [main_bundle pathForResource: the_name
|
path = [main_bundle pathForResource: realName
|
||||||
ofType: o];
|
ofType: o];
|
||||||
if (path != nil && [path length] != 0)
|
if (path != nil && [path length] != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +265,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
{
|
{
|
||||||
if (ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
path = [NSBundle pathForLibraryResource: the_name
|
path = [NSBundle pathForLibraryResource: realName
|
||||||
ofType: ext
|
ofType: ext
|
||||||
inDirectory: @"Images"];
|
inDirectory: @"Images"];
|
||||||
}
|
}
|
||||||
|
@ -272,8 +276,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
e = [array objectEnumerator];
|
e = [array objectEnumerator];
|
||||||
while ((o = [e nextObject]))
|
while ((o = [e nextObject]))
|
||||||
{
|
{
|
||||||
path = [NSBundle pathForLibraryResource: the_name
|
path = [NSBundle pathForLibraryResource: realName
|
||||||
ofType: o
|
ofType: o
|
||||||
inDirectory: @"Images"];
|
inDirectory: @"Images"];
|
||||||
if (path != nil && [path length] != 0)
|
if (path != nil && [path length] != 0)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue