mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 01:21:05 +00:00
theme system image fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe9e21f1e4
commit
e1cdeb9825
2 changed files with 35 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2009-08-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSImage.m: Image naming fixes so that setting nil as a name
|
||||||
|
works (so themes can replace/override system images).
|
||||||
|
|
||||||
2009-08-26 18:53-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
2009-08-26 18:53-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* Source/libgnustep-gui.def: Export GSTheme class.
|
* Source/libgnustep-gui.def: Export GSTheme class.
|
||||||
|
|
|
@ -205,7 +205,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
image = (NSImage*)[nameDict objectForKey: aName];
|
image = (NSImage*)[nameDict objectForKey: aName];
|
||||||
|
|
||||||
if (image == nil)
|
if (image == nil || [image _resource] == nil)
|
||||||
{
|
{
|
||||||
NSString *ext;
|
NSString *ext;
|
||||||
NSString *path = nil;
|
NSString *path = nil;
|
||||||
|
@ -508,21 +508,49 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This method is used by the GSTheme class to set the names of system
|
||||||
|
* images. It *must* be possible to unset an old system image name by
|
||||||
|
* passing a nil value to aName.
|
||||||
|
* The images are actually accessed via proxy objects, so that when a
|
||||||
|
* new system image is set, the proxies for that image just start using
|
||||||
|
* the new version.
|
||||||
|
*/
|
||||||
- (BOOL) setName: (NSString *)aName
|
- (BOOL) setName: (NSString *)aName
|
||||||
{
|
{
|
||||||
GSThemeProxy *proxy = nil;
|
GSThemeProxy *proxy = nil;
|
||||||
|
|
||||||
if (!aName || [[nameDict objectForKey: aName] _resource] != nil)
|
/* The name is already set... nothing to do.
|
||||||
|
*/
|
||||||
|
if (aName == _name || [aName isEqual: _name] == YES)
|
||||||
|
{
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the new name is already in use by another image,
|
||||||
|
* we must do nothing.
|
||||||
|
*/
|
||||||
|
if (aName != nil && [[nameDict objectForKey: aName] _resource] != nil)
|
||||||
{
|
{
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this image had another name, we remove it.
|
||||||
|
*/
|
||||||
if (_name && self == [(proxy = [nameDict objectForKey: _name]) _resource])
|
if (_name && self == [(proxy = [nameDict objectForKey: _name]) _resource])
|
||||||
{
|
{
|
||||||
/* We retain self in case removing from the dictionary releases us */
|
/* We retain self in case removing from the dictionary releases us */
|
||||||
IF_NO_GC([[self retain] autorelease]);
|
IF_NO_GC([[self retain] autorelease]);
|
||||||
|
DESTROY(_name);
|
||||||
[proxy _setResource: nil];
|
[proxy _setResource: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the new name is null, there is nothing more to do.
|
||||||
|
*/
|
||||||
|
if (aName == nil)
|
||||||
|
{
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
ASSIGN(_name, aName);
|
ASSIGN(_name, aName);
|
||||||
|
|
||||||
if ((proxy = [nameDict objectForKey: _name]) == nil)
|
if ((proxy = [nameDict objectForKey: _name]) == nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue