1 /* WinterBoard - Theme Manager for the iPhone
2 * Copyright (C) 2008 Jay Freeman (saurik)
6 * Redistribution and use in source and binary
7 * forms, with or without modification, are permitted
8 * provided that the following conditions are met:
10 * 1. Redistributions of source code must retain the
11 * above copyright notice, this list of conditions
12 * and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the
14 * above copyright notice, this list of conditions
15 * and the following disclaimer in the documentation
16 * and/or other materials provided with the
18 * 3. The name of the author may not be used to endorse
19 * or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
24 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
33 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #define _trace() NSLog(@"WB:_trace(%u)", __LINE__);
41 #import <CoreFoundation/CoreFoundation.h>
42 #import <Foundation/Foundation.h>
43 #import <CoreGraphics/CoreGraphics.h>
45 #include <substrate.h>
47 #import <UIKit/UIKit.h>
49 #import <SpringBoard/SBApplication.h>
50 #import <SpringBoard/SBApplicationIcon.h>
51 #import <SpringBoard/SBAppWindow.h>
52 #import <SpringBoard/SBBookmarkIcon.h>
53 #import <SpringBoard/SBButtonBar.h>
54 #import <SpringBoard/SBCalendarIconContentsView.h>
55 #import <SpringBoard/SBContentLayer.h>
56 #import <SpringBoard/SBIconController.h>
57 #import <SpringBoard/SBIconLabel.h>
58 #import <SpringBoard/SBSlidingAlertDisplay.h>
59 #import <SpringBoard/SBStatusBarContentsView.h>
60 #import <SpringBoard/SBStatusBarController.h>
61 #import <SpringBoard/SBStatusBarOperatorNameView.h>
62 #import <SpringBoard/SBStatusBarTimeView.h>
63 #import <SpringBoard/SBUIController.h>
64 #import <SpringBoard/SBWidgetApplicationIcon.h>
66 #import <MobileSMS/mSMSMessageTranscriptController.h>
68 #import <MediaPlayer/MPVideoView.h>
69 #import <MediaPlayer/MPVideoView-PlaybackControl.h>
71 #import <CoreGraphics/CGGeometry.h>
73 extern "C" void __clear_cache (char *beg, char *end);
80 Class $WebCoreFrameBridge;
85 Class $UINavigationBar;
89 Class $SBApplicationIcon;
90 Class $SBBookmarkIcon;
92 Class $SBCalendarIconContentsView;
93 Class $SBContentLayer;
95 Class $SBIconController;
98 Class $SBSlidingAlertDisplay;
99 Class $SBStatusBarContentsView;
100 Class $SBStatusBarController;
101 Class $SBStatusBarOperatorNameView;
102 Class $SBStatusBarTimeView;
103 Class $SBWidgetApplicationIcon;
105 @interface NSDictionary (WinterBoard)
106 - (UIColor *) colorForKey:(NSString *)key;
107 - (BOOL) boolForKey:(NSString *)key;
110 @implementation NSDictionary (WinterBoard)
112 - (UIColor *) colorForKey:(NSString *)key {
113 NSString *value = [self objectForKey:key];
120 - (BOOL) boolForKey:(NSString *)key {
121 if (NSString *value = [self objectForKey:key])
122 return [value boolValue];
129 bool Engineer_ = false;
131 static UIImage *(*_UIApplicationImageWithName)(NSString *name);
132 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
133 static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation);
134 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
135 static NSBundle *(*_UIKitBundle)();
136 static void (*_UISharedImageInitialize)(bool);
137 static int (*_UISharedImageNameGetIdentifier)(NSString *);
138 static UIImage *(*_UISharedImageWithIdentifier)(int);
140 static NSMutableDictionary *UIImages_;
141 static NSMutableDictionary *PathImages_;
142 static NSMutableDictionary *Cache_;
143 static NSMutableDictionary *Strings_;
144 static NSMutableDictionary *Themed_;
145 static NSMutableDictionary *Bundles_;
147 static NSFileManager *Manager_;
148 static NSDictionary *English_;
149 static NSMutableDictionary *Info_;
150 static NSMutableArray *themes_;
152 static NSString *$getTheme$(NSArray *files, bool parent = false) {
154 if (NSString *path = [Themed_ objectForKey:files])
155 return reinterpret_cast<id>(path) == [NSNull null] ? nil : path;
158 NSLog(@"WB:Debug: %@", [files description]);
162 for (NSString *theme in themes_)
163 for (NSString *file in files) {
164 path = [NSString stringWithFormat:@"%@/%@", theme, file];
165 if ([Manager_ fileExistsAtPath:path]) {
166 path = parent ? theme : path;
174 [Themed_ setObject:(path == nil ? [NSNull null] : reinterpret_cast<id>(path)) forKey:files];
178 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui) {
179 NSString *identifier = [bundle bundleIdentifier];
180 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
182 if (identifier != nil)
183 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
184 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
185 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
187 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
189 #define remapResourceName(oldname, newname) \
190 else if ([file isEqualToString:oldname]) \
191 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
193 if (identifier == nil);
194 else if ([identifier isEqualToString:@"com.apple.calculator"])
195 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
196 else if (![identifier isEqualToString:@"com.apple.springboard"]);
197 remapResourceName(@"FSO_BG.png", @"StatusBar")
198 remapResourceName(@"SBDockBG.png", @"Dock")
199 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
201 if (NSString *path = $getTheme$(names))
206 static NSString *$pathForIcon$(SBApplication *self) {
207 NSString *identifier = [self bundleIdentifier];
208 NSString *path = [self path];
209 NSString *folder = [path lastPathComponent];
210 NSString *dname = [self displayName];
211 NSString *didentifier = [self displayIdentifier];
214 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
216 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
218 if (identifier != nil)
219 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
221 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]];
223 #define testForIcon(Name) \
224 if (NSString *name = Name) \
225 [names addObject:[NSString stringWithFormat:@"Icons/%@.png", name]];
227 testForIcon(identifier);
230 if (didentifier != nil) {
231 testForIcon([English_ objectForKey:didentifier]);
233 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
234 if ([parts count] != 1)
235 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
236 testForIcon([english objectForKey:[parts lastObject]]);
239 if (NSString *path = $getTheme$(names))
244 @interface NSBundle (WinterBoard)
245 + (NSBundle *) wb$bundleWithFile:(NSString *)path;
248 @implementation NSBundle (WinterBoard)
250 + (NSBundle *) wb$bundleWithFile:(NSString *)path {
251 path = [path stringByDeletingLastPathComponent];
252 if (path == nil || [path length] == 0 || [path isEqualToString:@"/"])
255 NSBundle *bundle([Bundles_ objectForKey:path]);
256 if (reinterpret_cast<id>(bundle) == [NSNull null])
258 else if (bundle == nil) {
259 if ([Manager_ fileExistsAtPath:[path stringByAppendingPathComponent:@"Info.plist"]])
260 bundle = [NSBundle bundleWithPath:path];
262 bundle = [NSBundle wb$bundleWithFile:path];
264 NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle);
265 [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast<id>(bundle)) forKey:path];
273 @interface NSString (WinterBoard)
274 - (NSString *) wb$themedPath;
277 @implementation NSString (WinterBoard)
279 - (NSString *) wb$themedPath {
281 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
283 if (NSBundle *bundle = [NSBundle wb$bundleWithFile:self]) {
284 NSString *file([self stringByResolvingSymlinksInPath]);
285 NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
286 if ([file hasPrefix:prefix]) {
287 NSUInteger length([prefix length]);
288 if (length != [file length])
289 if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
299 MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
300 _SBIconModel$cacheImageForIcon$(self, sel, icon);
301 NSString *key([icon displayIdentifier]);
303 if (UIImage *image = [icon icon]) {
304 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
305 CGRect rect = {CGPointMake(1, 1), [image size]};
306 CGSize size = {rect.size.width + 2, rect.size.height + 2};
308 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
309 CGColorSpaceRelease(space);
311 CGContextDrawImage(context, rect, [image CGImage]);
312 CGImageRef ref(CGBitmapContextCreateImage(context));
313 CGContextRelease(context);
315 UIImage *image([UIImage imageWithCGImage:ref]);
318 [Cache_ setObject:image forKey:key];
322 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
323 NSString *key([icon displayIdentifier]);
324 if (UIImage *image = [Cache_ objectForKey:key])
327 return _SBIconModel$getCachedImagedForIcon$(self, sel, icon);
330 MSHook(UIImage *, SBApplicationIcon$icon, SBApplicationIcon *self, SEL sel) {
331 if (![Info_ boolForKey:@"ComposeStoreIcons"])
332 if (NSString *path = $pathForIcon$([self application]))
333 return [UIImage imageWithContentsOfFile:path];
334 return _SBApplicationIcon$icon(self, sel);
337 MSHook(UIImage *, SBWidgetApplicationIcon$icon, SBWidgetApplicationIcon *self, SEL sel) {
338 if (NSString *path = $pathForIcon$([self application]))
339 return [UIImage imageWithContentsOfFile:path];
340 return _SBApplicationIcon$icon(self, sel);
343 MSHook(UIImage *, SBBookmarkIcon$icon, SBBookmarkIcon *self, SEL sel) {
345 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
346 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
347 return [UIImage imageWithContentsOfFile:path];
348 return _SBBookmarkIcon$icon(self, sel);
351 MSHook(NSString *, SBApplication$pathForIcon, SBApplication *self, SEL sel) {
352 if (NSString *path = $pathForIcon$(self))
354 return _SBApplication$pathForIcon(self, sel);
357 static UIImage *CachedImageAtPath(NSString *path) {
358 path = [path stringByResolvingSymlinksInPath];
359 UIImage *image = [PathImages_ objectForKey:path];
361 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
362 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
364 image = [image autorelease];
365 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
369 MSHook(CGImageRef, _UIImageRefAtPath, NSString *name, bool cache, UIImageOrientation *orientation) {
371 NSLog(@"WB:Debug: _UIImageRefAtPath(\"%@\", %s)", name, cache ? "true" : "false");
372 return __UIImageRefAtPath([name wb$themedPath], cache, orientation);
375 /*MSHook(UIImage *, _UIImageAtPath, NSString *name, NSBundle *bundle) {
377 return __UIImageAtPath(name, nil);
379 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
380 UIImage *image = [PathImages_ objectForKey:key];
382 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
384 NSLog(@"WB:Debug: _UIImageAtPath(\"%@\", %@)", name, bundle);
385 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
386 image = CachedImageAtPath(path);
388 image = __UIImageAtPath(name, bundle);
389 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
394 MSHook(UIImage *, _UIApplicationImageWithName, NSString *name) {
395 NSBundle *bundle = [NSBundle mainBundle];
397 NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
398 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
399 return CachedImageAtPath(path);
400 return __UIApplicationImageWithName(name);
403 #define WBDelegate(delegate) \
404 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
406 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
407 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
409 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
413 - (void) forwardInvocation:(NSInvocation*)inv { \
414 SEL sel = [inv selector]; \
415 if ([delegate respondsToSelector:sel]) \
416 [inv invokeWithTarget:delegate]; \
418 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
421 MSHook(NSString *, NSBundle$pathForResource$ofType$, NSBundle *self, SEL sel, NSString *resource, NSString *type) {
422 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
424 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
425 if (NSString *path = $pathForFile$inBundle$(file, self, false))
427 return _NSBundle$pathForResource$ofType$(self, sel, resource, type);
430 void $setBarStyle$_(NSString *name, int &style) {
432 NSLog(@"WB:Debug:%@Style:%d", name, style);
433 NSNumber *number = nil;
435 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
437 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
439 style = [number intValue];
441 NSLog(@"WB:Debug:%@Style=%d", name, style);
445 MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *self, SEL sel, CGRect rect) {
446 NSBundle *bundle([NSBundle mainBundle]);
448 CFLocaleRef locale(CFLocaleCopyCurrent());
449 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
452 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
454 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);
455 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
456 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"" table:@"SpringBoard"]);
457 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
461 CFRelease(formatter);
463 NSString *datestyle(@""
464 "font-family: Helvetica; "
465 "font-weight: bold; "
471 NSString *daystyle(@""
472 "font-family: Helvetica; "
473 "font-weight: bold; "
476 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
479 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
480 datestyle = [datestyle stringByAppendingString:style];
481 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
482 daystyle = [daystyle stringByAppendingString:style];
484 float width([self bounds].size.width);
486 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
487 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
489 [(NSString *)date drawAtPoint:CGPointMake(
490 (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2
491 ) withStyle:datestyle];
493 [(NSString *)day drawAtPoint:CGPointMake(
494 (width + 1 - daysize.width) / 2, (16 - daysize.height) / 2
495 ) withStyle:daystyle];
501 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
504 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
505 style = [number intValue];
507 if (UIColor *color = [Info_ colorForKey:@"NavigationBarTint"])
510 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
513 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
514 self = [self wb$initWithCoder:coder];
517 UINavigationBar$setBarStyle$_(self);
521 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
522 self = [self wb$initWithFrame:frame];
525 UINavigationBar$setBarStyle$_(self);
529 MSHook(void, UIToolbar$setBarStyle$, UIToolbar *self, SEL sel, int style) {
530 $setBarStyle$_(@"Toolbar", style);
531 return _UIToolbar$setBarStyle$(self, sel, style);
534 MSHook(void, UINavigationBar$setBarStyle$, UINavigationBar *self, SEL sel, int style) {
535 $setBarStyle$_(@"NavigationBar", style);
536 return _UINavigationBar$setBarStyle$(self, sel, style);
539 MSHook(void, SBButtonBar$didMoveToSuperview, UIView *self, SEL sel) {
540 [[self superview] setBackgroundColor:[UIColor clearColor]];
541 _SBButtonBar$didMoveToSuperview(self, sel);
544 MSHook(void, SBStatusBarContentsView$didMoveToSuperview, UIView *self, SEL sel) {
545 [[self superview] setBackgroundColor:[UIColor clearColor]];
546 _SBStatusBarContentsView$didMoveToSuperview(self, sel);
549 MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) {
551 NSLog(@"WB:Debug:DefaultDesktopImage");
552 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
553 return [UIImage imageWithContentsOfFile:path];
554 return _UIImage$defaultDesktopImage(self, sel);
557 static NSArray *Wallpapers_;
558 static NSString *WallpaperFile_;
559 static UIImageView *WallpaperImage_;
560 static UIWebDocumentView *WallpaperPage_;
561 static NSURL *WallpaperURL_;
563 #define _release(object) \
564 do if (object != nil) { \
569 MSHook(id, SBContentLayer$initWithSize$, SBContentLayer *self, SEL sel, CGSize size) {
570 self = _SBContentLayer$initWithSize$(self, sel, size);
574 _release(WallpaperFile_);
575 _release(WallpaperImage_);
576 _release(WallpaperPage_);
577 _release(WallpaperURL_);
579 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
580 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
581 if ([Manager_ fileExistsAtPath:mp4]) {
582 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[self bounds]] autorelease];
583 [video setMovieWithPath:mp4];
584 [video setRepeatMode:1];
585 [video setRepeatGap:0];
586 [self addSubview:video];
587 [video playFromBeginning];;
590 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
591 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
594 if ([Manager_ fileExistsAtPath:png])
596 else if ([Manager_ fileExistsAtPath:jpg])
602 image = [[UIImage alloc] initWithContentsOfFile:path];
604 image = [image autorelease];
608 WallpaperFile_ = [path retain];
609 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
610 [self addSubview:WallpaperImage_];
613 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
614 if ([Manager_ fileExistsAtPath:html]) {
615 CGRect bounds = [self bounds];
617 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
618 [view setAutoresizes:true];
620 WallpaperPage_ = [view retain];
621 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
623 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
625 [[view webView] setDrawsBackground:false];
626 [view setBackgroundColor:[UIColor clearColor]];
628 [self addSubview:view];
632 for (size_t i(0), e([themes_ count]); i != e; ++i) {
633 NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
634 NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
635 if ([Manager_ fileExistsAtPath:html]) {
636 CGRect bounds = [self bounds];
638 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
639 [view setAutoresizes:true];
641 NSURL *url = [NSURL fileURLWithPath:html];
642 [view loadRequest:[NSURLRequest requestWithURL:url]];
644 [[view webView] setDrawsBackground:false];
645 [view setBackgroundColor:[UIColor clearColor]];
647 [self addSubview:view];
654 MSHook(void, SBSlidingAlertDisplay$updateDesktopImage$, SBSlidingAlertDisplay *self, SEL sel, UIImage *image) {
655 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
656 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
658 if (path != nil && _backgroundView != nil)
661 _SBSlidingAlertDisplay$updateDesktopImage$(self, sel, image);
664 CGRect bounds = [self bounds];
666 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
667 [view setAutoresizes:true];
669 if (WallpaperPage_ != nil)
670 [WallpaperPage_ release];
671 WallpaperPage_ = [view retain];
673 if (WallpaperURL_ != nil)
674 [WallpaperURL_ release];
675 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
677 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
679 [[view webView] setDrawsBackground:false];
680 [view setBackgroundColor:[UIColor clearColor]];
682 [self insertSubview:view aboveSubview:_backgroundView];
686 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
687 extern "C" CGColorRef CGGStateGetFillColor(void *);
688 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
689 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
691 /* WBTimeLabel {{{ */
692 @interface WBTimeLabel : NSProxy {
694 _transient SBStatusBarTimeView *view_;
697 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
701 @implementation WBTimeLabel
708 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
709 time_ = [time retain];
716 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
717 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
718 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
720 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
721 "font-family: Helvetica; "
722 "font-weight: bold; "
725 "%@", _mode ? @"white" : @"black", custom]];
730 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
735 /* WBBadgeLabel {{{ */
736 @interface WBBadgeLabel : NSProxy {
740 - (id) initWithBadge:(NSString *)badge;
744 @implementation WBBadgeLabel
751 - (id) initWithBadge:(NSString *)badge {
752 badge_ = [badge retain];
758 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
759 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
760 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
761 "font-family: Helvetica; "
762 "font-weight: bold; "
770 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
776 MSHook(id, SBIconBadge$initWithBadge$, SBIconBadge *self, SEL sel, NSString *badge) {
777 if ((self = _SBIconBadge$initWithBadge$(self, sel, badge)) != nil) {
778 id &_badge(MSHookIvar<id>(self, "_badge"));
780 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
785 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int id, int animation) {
787 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
788 if (mode < 100) // 104:hidden 105:glowing
789 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
790 mode = [number intValue];
791 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, id, animation);
794 MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
795 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
796 mode = [number intValue];
797 return _SBStatusBarContentsView$initWithStatusBar$mode$(self, sel, bar, mode);
800 MSHook(NSString *, SBStatusBarOperatorNameView$operatorNameStyle, SBStatusBarOperatorNameView *self, SEL sel) {
801 NSString *style(_SBStatusBarOperatorNameView$operatorNameStyle(self, sel));
803 NSLog(@"operatorNameStyle= %@", style);
804 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
805 style = [NSString stringWithFormat:@"%@; %@", style, custom];
809 MSHook(void, SBStatusBarOperatorNameView$setOperatorName$fullSize$, SBStatusBarOperatorNameView *self, SEL sel, NSString *name, BOOL full) {
811 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
812 return _SBStatusBarOperatorNameView$setOperatorName$fullSize$(self, sel, name, NO);
815 // XXX: replace this with [SBStatusBarTimeView tile]
816 MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, CGRect rect) {
817 id &_time(MSHookIvar<id>(self, "_time"));
818 if (_time != nil && [_time class] != [WBTimeLabel class])
819 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
820 return _SBStatusBarTimeView$drawRect$(self, sel, rect);
823 MSHook(void, SBIconController$appendIconList$, SBIconController *self, SEL sel, SBIconList *list) {
825 NSLog(@"appendIconList:%@", list);
826 return _SBIconController$appendIconList$(self, sel, list);
829 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
830 self = _SBIconLabel$initWithSize$label$(self, sel, size, label);
832 [self setClipsToBounds:NO];
836 MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
837 id &_label(MSHookIvar<id>(self, "_label"));
838 if (![Info_ boolForKey:@"UndockedIconLabels"])
840 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
841 [_label setInDock:docked];
842 return _SBIconLabel$setInDock$(self, sel, docked);
845 MSHook(NSString *, NSBundle$localizedStringForKey$value$table$, NSBundle *self, SEL sel, NSString *key, NSString *value, NSString *table) {
846 NSString *identifier = [self bundleIdentifier];
847 NSLocale *locale = [NSLocale currentLocale];
848 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
850 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
851 NSString *file = table == nil ? @"Localizable" : table;
852 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
853 NSDictionary *strings;
854 if ((strings = [Strings_ objectForKey:name]) != nil) {
855 if (static_cast<id>(strings) != [NSNull null]) strings:
856 if (NSString *value = [strings objectForKey:key])
858 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
861 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
862 [Strings_ setObject:[strings autorelease] forKey:name];
866 [Strings_ setObject:[NSNull null] forKey:name];
867 return _NSBundle$localizedStringForKey$value$table$(self, sel, key, value, table);
870 @class WebCoreFrameBridge;
871 MSHook(CGSize, WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$, WebCoreFrameBridge *self, SEL sel, id node, float width) {
874 void **core(reinterpret_cast<void **>([node _node]));
875 if (core == NULL || core[6] == NULL)
877 return _WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(self, sel, node, width);
880 MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) {
881 CGRect bounds = [self bounds];
883 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
886 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
887 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
889 NSString *&label(MSHookIvar<NSString *>(self, "_label"));
891 NSString *style = [NSString stringWithFormat:@""
892 "font-family: Helvetica; "
893 "font-weight: bold; "
896 "", docked ? @"white" : @"#b3b3b3"];
899 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
900 float max = 75, width = [label sizeWithStyle:style forWidth:320].width;
902 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", ((width - max) / ([label length] - 1))]];
903 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
904 style = [style stringByAppendingString:custom];
906 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
907 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
910 MSHook(void, mSMSMessageTranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) {
911 _mSMSMessageTranscriptController$loadView(self, sel);
913 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
914 if (UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]) {
916 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
917 UIView *parent([_transcriptLayer superview]);
918 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
919 [parent insertSubview:background belowSubview:_transcriptLayer];
920 [_transcriptLayer setBackgroundColor:[UIColor clearColor]];
924 MSHook(UIImage *, _UIImageWithName, NSString *name) {
925 int id(_UISharedImageNameGetIdentifier(name));
927 NSLog(@"WB:Debug: _UIImageWithName(\"%@\", %d)", name, id);
930 return _UIImageAtPath(name, _UIKitBundle());
932 NSNumber *key([NSNumber numberWithInt:id]);
933 UIImage *image = [UIImages_ objectForKey:key];
935 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
936 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
937 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
942 image = _UISharedImageWithIdentifier(id);
943 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
948 MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
949 NSString *key = [NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name];
950 UIImage *image = [PathImages_ objectForKey:key];
952 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
954 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
955 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
956 image = [[UIImage alloc] initWithContentsOfFile:path];
961 image = __UIImageWithNameInDomain(name, domain);
962 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
966 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
967 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
969 bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
971 MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
972 bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
974 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
977 NSString *path = [NSString stringWithUTF8String:a1];
978 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
979 NSString *file = [path substringFromIndex:31];
981 for (NSString *theme in themes_) {
982 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
983 if ([Manager_ fileExistsAtPath:path]) {
984 strcpy(a1, [path UTF8String]);
993 static void ChangeWallpaper(
994 CFNotificationCenterRef center,
1001 NSLog(@"WB:Debug:ChangeWallpaper!");
1004 if (WallpaperFile_ != nil) {
1005 image = [[UIImage alloc] initWithContentsOfFile:WallpaperFile_];
1007 image = [image autorelease];
1010 if (WallpaperImage_ != nil)
1011 [WallpaperImage_ setImage:image];
1012 if (WallpaperPage_ != nil)
1013 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
1017 #define WBRename(name, sel, imp) \
1018 _ ## name ## $ ## imp = MSHookMessage($ ## name, @selector(sel), &$ ## name ## $ ## imp)
1020 extern "C" void WBInitialize() {
1021 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1023 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
1025 NSLog(@"WB:Notice: WinterBoard");
1028 memset(nl, 0, sizeof(nl));
1030 nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
1031 nl[1].n_un.n_name = (char *) "__UIImageAtPath";
1032 nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
1033 nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
1034 nl[4].n_un.n_name = (char *) "__UIKitBundle";
1035 nl[5].n_un.n_name = (char *) "__UISharedImageInitialize";
1036 nl[6].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
1037 nl[7].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
1041 _UIApplicationImageWithName = (UIImage *(*)(NSString *)) nl[0].n_value;
1042 _UIImageAtPath = (UIImage *(*)(NSString *, NSBundle *)) nl[1].n_value;
1043 _UIImageRefAtPath = (CGImageRef (*)(NSString *, bool, UIImageOrientation *)) nl[2].n_value;
1044 _UIImageWithNameInDomain = (UIImage *(*)(NSString *, NSString *)) nl[3].n_value;
1045 _UIKitBundle = (NSBundle *(*)()) nl[4].n_value;
1046 _UISharedImageInitialize = (void (*)(bool)) nl[5].n_value;
1047 _UISharedImageNameGetIdentifier = (int (*)(NSString *)) nl[6].n_value;
1048 _UISharedImageWithIdentifier = (UIImage *(*)(int)) nl[7].n_value;
1050 MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
1051 MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
1052 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
1053 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
1055 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1057 memset(nl, 0, sizeof(nl));
1058 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1059 nlist(AudioToolbox, nl);
1060 _Z24GetFileNameForThisActionmPcRb = (bool (*)(unsigned long, char *, bool &)) nl[0].n_value;
1061 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
1064 $NSBundle = objc_getClass("NSBundle");
1066 _NSBundle$localizedStringForKey$value$table$ = MSHookMessage($NSBundle, @selector(localizedStringForKey:value:table:), &$NSBundle$localizedStringForKey$value$table$);
1067 _NSBundle$pathForResource$ofType$ = MSHookMessage($NSBundle, @selector(pathForResource:ofType:), &$NSBundle$pathForResource$ofType$);
1069 $UIImage = objc_getClass("UIImage");
1070 $UINavigationBar = objc_getClass("UINavigationBar");
1071 $UIToolbar = objc_getClass("UIToolbar");
1073 _UIImage$defaultDesktopImage = MSHookMessage(object_getClass($UIImage), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage);
1075 //WBRename("UINavigationBar", @selector(initWithCoder:", (IMP) &UINavigationBar$initWithCoder$);
1076 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:", (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1078 _UINavigationBar$setBarStyle$ = MSHookMessage($UINavigationBar, @selector(setBarStyle:), &$UINavigationBar$setBarStyle$);
1079 _UIToolbar$setBarStyle$ = MSHookMessage($UIToolbar, @selector(setBarStyle:), &$UIToolbar$setBarStyle$);
1081 _UISharedImageInitialize(false);
1083 Manager_ = [[NSFileManager defaultManager] retain];
1084 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1085 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1086 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1087 Bundles_ = [[NSMutableDictionary alloc] initWithCapacity:2];
1088 Themed_ = [[NSMutableDictionary alloc] initWithCapacity:128];
1090 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1092 if (NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1093 [settings autorelease];
1095 if (NSNumber *debug = [settings objectForKey:@"Debug"])
1096 Debug_ = [debug boolValue];
1098 NSArray *themes = [settings objectForKey:@"Themes"];
1100 if (NSString *theme = [settings objectForKey:@"Theme"])
1101 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1103 [NSNumber numberWithBool:true], @"Active",
1106 for (NSDictionary *theme in themes) {
1107 NSNumber *active = [theme objectForKey:@"Active"];
1108 if (![active boolValue])
1111 NSString *name = [theme objectForKey:@"Name"];
1115 NSString *theme = nil;
1117 #define testForTheme(format...) \
1118 if (theme == nil) { \
1119 NSString *path = [NSString stringWithFormat:format]; \
1120 if ([Manager_ fileExistsAtPath:path]) { \
1121 [themes_ addObject:path]; \
1126 testForTheme(@"/Library/Themes/%@.theme", name)
1127 testForTheme(@"/Library/Themes/%@", name)
1128 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1132 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1134 for (NSString *theme in themes_)
1135 if (NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1136 for (NSString *key in [info allKeys])
1137 if ([Info_ objectForKey:key] == nil)
1138 [Info_ setObject:[info objectForKey:key] forKey:key];
1140 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1141 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1142 _mSMSMessageTranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$mSMSMessageTranscriptController$loadView);
1143 } else if ([identifier isEqualToString:@"com.apple.springboard"]) {
1144 CFNotificationCenterAddObserver(
1145 CFNotificationCenterGetDarwinNotifyCenter(),
1146 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1149 NSBundle *MediaPlayer = [NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"];
1150 if (MediaPlayer != nil)
1153 $MPVideoView = objc_getClass("MPVideoView");
1154 $WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
1156 $SBApplication = objc_getClass("SBApplication");
1157 $SBApplicationIcon = objc_getClass("SBApplicationIcon");
1158 $SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
1159 $SBButtonBar = objc_getClass("SBButtonBar");
1160 $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
1161 $SBContentLayer = objc_getClass("SBContentLayer");
1162 $SBIconBadge = objc_getClass("SBIconBadge");
1163 $SBIconController = objc_getClass("SBIconController");
1164 $SBIconLabel = objc_getClass("SBIconLabel");
1165 $SBIconModel = objc_getClass("SBIconModel");
1166 $SBSlidingAlertDisplay = objc_getClass("SBSlidingAlertDisplay");
1167 $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
1168 $SBStatusBarController = objc_getClass("SBStatusBarController");
1169 $SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
1170 $SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
1171 $SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
1173 WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
1175 WBRename(SBApplication, pathForIcon, pathForIcon);
1176 WBRename(SBApplicationIcon, icon, icon);
1177 WBRename(SBBookmarkIcon, icon, icon);
1178 WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
1179 WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
1180 WBRename(SBContentLayer, initWithSize:, initWithSize$);
1181 WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
1182 WBRename(SBIconController, appendIconList:, appendIconList$);
1183 WBRename(SBWidgetApplicationIcon, icon, icon);
1185 WBRename(SBIconLabel, drawRect:, drawRect$);
1186 WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
1187 WBRename(SBIconLabel, setInDock:, setInDock$);
1189 WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
1190 WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
1192 WBRename(SBSlidingAlertDisplay, updateDesktopImage:, updateDesktopImage$);
1193 WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
1194 WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
1195 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
1196 WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
1197 WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
1198 WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
1200 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1201 if (English_ != nil)
1202 English_ = [English_ retain];
1204 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1207 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1209 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
1210 [Info_ setObject:[NSNumber numberWithBool:(
1211 $getTheme$(Wallpapers_) == nil ||
1212 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
1213 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
1214 )] forKey:@"UndockedIconLabels"];
1217 NSLog(@"WB:Debug:Info = %@", [Info_ description]);