* Source/GSTheme.m (-tilesNamed:state:): Interpret .9.png files

as NinePatch=YES. If a tile isn't listed in GSThemeTiles in the
plist, try to find it in the ThemeTiles directory anyway. This
lets you avoid declaring tiles in the info plist.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37208 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-10-08 19:32:09 +00:00
parent 02bc49e2d5
commit 8624e56f43
2 changed files with 33 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2013-10-08 Eric Wasylishen <ewasylishen@gmail.com>
* Source/GSTheme.m (-tilesNamed:state:): Interpret .9.png files
as NinePatch=YES. If a tile isn't listed in GSThemeTiles in the
plist, try to find it in the ThemeTiles directory anyway. This
lets you avoid declaring tiles in the info plist.
2013-10-08 Eric Wasylishen <ewasylishen@gmail.com>
* Source/GSThemeDrawing.m (NSBox): If drawing with theme tiles,

View file

@ -1170,7 +1170,8 @@ typedef struct {
image = [[_imageClass alloc] initWithContentsOfFile: path];
if (image != nil)
{
if ([[info objectForKey: @"NinePatch"] boolValue])
if ([[info objectForKey: @"NinePatch"] boolValue]
|| [file hasSuffix: @".9"])
{
tiles = [[GSDrawTiles alloc]
initWithNinePatchImage: image];
@ -1187,7 +1188,30 @@ typedef struct {
}
}
}
else
if (tiles == nil)
{
NSString *imagePath;
// Try 9-patch first
imagePath = [_bundle pathForResource: fullName
ofType: @"9.png"
inDirectory: @"ThemeTiles"];
if (imagePath != nil)
{
image
= [[_imageClass alloc] initWithContentsOfFile: imagePath];
if (image != nil)
{
tiles = [[GSDrawTiles alloc]
initWithNinePatchImage: image];
[tiles setFillStyle: GSThemeFillStyleScaleAll];
RELEASE(image);
}
}
}
if (tiles == nil)
{
NSArray *imageTypes;
NSString *imagePath;