/* WinterBoard - Theme Manager for the iPhone
- * Copyright (C) 2008 Jay Freeman (saurik)
+ * Copyright (C) 2008-2010 Jay Freeman (saurik)
*/
/*
if (NSString *name = Name) \
[names addObject:[NSString stringWithFormat:@"Icons/%@.png", name]];
+ if (![didentifier isEqualToString:identifier])
+ testForIcon(didentifier);
testForIcon(identifier);
testForIcon(dname);
}
- (id) initWithBadge:(NSString *)badge;
+- (NSString *) description;
@end
return self;
}
+- (NSString *) description {
+ return [badge_ description];
+}
+
WBDelegate(badge_)
- (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
NSNumber *key([NSNumber numberWithInt:id]);
UIImage *image = [UIImages_ objectForKey:key];
if (image != nil)
- return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
+ return reinterpret_cast<id>(image) == [NSNull null] ? _UISharedImageWithIdentifier(id) : image;
if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
if (image != nil)
[image autorelease];
}
- if (image == nil)
- image = _UISharedImageWithIdentifier(id);
[UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
- return image;
+ return image == nil ? _UISharedImageWithIdentifier(id) : image;
}
}
MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
- NSString *key = [NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name];
- UIImage *image = [PathImages_ objectForKey:key];
+ NSString *key([NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name]);
+ UIImage *image([PathImages_ objectForKey:key]);
if (image != nil)
- return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
+ return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image;
if (Debug_)
NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
if (image != nil)
[image autorelease];
}
- if (image == nil)
- image = __UIImageWithNameInDomain(name, domain);
[PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
- return image;
+ return image == nil ? __UIImageWithNameInDomain(name, domain) : image;
}
MSHook(GSFontRef, GSFontCreateWithName, const char *name, GSFontSymbolicTraits traits, float size) {