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>
65 #import <MobileSMS/mSMSMessageTranscriptController.h>
67 #import <MediaPlayer/MPVideoView.h>
68 #import <MediaPlayer/MPVideoView-PlaybackControl.h>
70 #import <CoreGraphics/CGGeometry.h>
72 extern "C" void __clear_cache (char *beg, char *end);
76 @interface NSDictionary (WinterBoard)
77 - (UIColor *) colorForKey:(NSString *)key;
78 - (BOOL) boolForKey:(NSString *)key;
81 @implementation NSDictionary (WinterBoard)
83 - (UIColor *) colorForKey:(NSString *)key {
84 NSString *value = [self objectForKey:key];
91 - (BOOL) boolForKey:(NSString *)key {
92 if (NSString *value = [self objectForKey:key])
93 return [value boolValue];
100 bool Engineer_ = false;
102 @protocol WinterBoard
103 - (void) wb$setOperatorName:(NSString *)name fullSize:(BOOL)full;
104 - (NSString *) wb$operatorNameStyle;
105 - (void) wb$loadView;
106 - (NSString *) wb$localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)table;
107 - (id) wb$initWithBadge:(id)badge;
108 - (void) wb$cacheImageForIcon:(SBIcon *)icon;
109 - (UIImage *) wb$getCachedImagedForIcon:(SBIcon *)icon;
110 - (CGSize) wb$renderedSizeOfNode:(id)node constrainedToWidth:(float)width;
112 - (void) wb$updateDesktopImage:(UIImage *)image;
113 - (UIImage *) wb$defaultDesktopImage;
114 - (NSString *) wb$pathForIcon;
115 - (NSString *) wb$pathForResource:(NSString *)resource ofType:(NSString *)type;
118 - (id) wb$initWithSize:(CGSize)size;
119 - (id) wb$initWithSize:(CGSize)size label:(NSString *)label;
120 - (id) wb$initWithFrame:(CGRect)frame;
121 - (id) wb$initWithCoder:(NSCoder *)coder;
122 - (void) wb$setFrame:(CGRect)frame;
123 - (void) wb$drawRect:(CGRect)rect;
124 - (void) wb$setBackgroundColor:(id)color;
125 - (void) wb$setAlpha:(float)value;
126 - (void) wb$setBarStyle:(int)style;
127 - (id) wb$initWithFrame:(CGRect)frame withBarStyle:(int)style withTintColor:(UIColor *)color;
128 - (void) wb$setOpaque:(BOOL)opaque;
129 - (void) wb$setInDock:(BOOL)docked;
130 - (void) wb$didMoveToSuperview;
131 + (UIImage *) wb$imageNamed:(NSString *)name inBundle:(NSBundle *)bundle;
132 + (UIImage *) wb$applicationImageNamed:(NSString *)name;
133 - (NSDictionary *) wb$infoDictionary;
134 - (UIImage *) wb$icon;
135 - (void) wb$appendIconList:(SBIconList *)list;
136 - (id) wb$initWithStatusBar:(id)bar mode:(int)mode;
137 - (id) wb$initWithMode:(int)mode orientation:(int)orientation;
138 - (id) wb$imageAtPath:(NSString *)path;
139 - (id) wb$initWithContentsOfFile:(NSString *)file;
140 - (id) wb$initWithContentsOfFile:(NSString *)file cache:(BOOL)cache;
141 - (void) wb$setStatusBarMode:(int)mode orientation:(int)orientation duration:(float)duration fenceID:(int)id animation:(int)animation;
144 static NSMutableDictionary *UIImages_;
145 static NSMutableDictionary *PathImages_;
146 static NSMutableDictionary *Cache_;
147 static NSMutableDictionary *Strings_;
149 static NSFileManager *Manager_;
150 static NSDictionary *English_;
151 static NSMutableDictionary *Info_;
152 static NSMutableArray *themes_;
154 static NSString *$getTheme$(NSArray *files, bool parent = false) {
156 NSLog(@"WB:Debug: %@", [files description]);
158 for (NSString *theme in themes_)
159 for (NSString *file in files) {
160 NSString *path([NSString stringWithFormat:@"%@/%@", theme, file]);
161 if ([Manager_ fileExistsAtPath:path])
162 return parent ? theme : path;
168 static NSString *$pathForIcon$(SBApplication<WinterBoard> *self) {
169 NSString *identifier = [self bundleIdentifier];
170 NSString *path = [self path];
171 NSString *folder = [path lastPathComponent];
172 NSString *dname = [self displayName];
173 NSString *didentifier = [self displayIdentifier];
176 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
178 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
180 if (identifier != nil)
181 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
183 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]];
185 #define testForIcon(Name) \
186 if (NSString *name = Name) \
187 [names addObject:[NSString stringWithFormat:@"Icons/%@.png", name]];
189 testForIcon(identifier);
192 if (didentifier != nil) {
193 testForIcon([English_ objectForKey:didentifier]);
195 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
196 if ([parts count] != 1)
197 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
198 testForIcon([english objectForKey:[parts lastObject]]);
201 if (NSString *path = $getTheme$(names))
206 static void SBIconModel$cacheImageForIcon$(SBIconModel<WinterBoard> *self, SEL sel, SBIcon *icon) {
207 [self wb$cacheImageForIcon:icon];
208 NSString *key([icon displayIdentifier]);
210 if (UIImage *image = [icon icon]) {
211 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
212 CGRect rect = {CGPointMake(1, 1), [image size]};
213 CGSize size = {rect.size.width + 2, rect.size.height + 2};
215 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
216 CGColorSpaceRelease(space);
218 CGContextDrawImage(context, rect, [image CGImage]);
219 CGImageRef ref(CGBitmapContextCreateImage(context));
220 CGContextRelease(context);
222 UIImage *image([UIImage imageWithCGImage:ref]);
225 [Cache_ setObject:image forKey:key];
229 static UIImage *SBIconModel$getCachedImagedForIcon$(SBIconModel<WinterBoard> *self, SEL sel, SBIcon *icon) {
230 NSString *key([icon displayIdentifier]);
231 if (UIImage *image = [Cache_ objectForKey:key])
234 return [self wb$getCachedImagedForIcon:icon];
237 static UIImage *SBApplicationIcon$icon(SBApplicationIcon<WinterBoard> *self, SEL sel) {
238 if (![Info_ boolForKey:@"ComposeStoreIcons"])
239 if (NSString *path = $pathForIcon$([self application]))
240 return [UIImage imageWithContentsOfFile:path];
241 return [self wb$icon];
244 static UIImage *SBBookmarkIcon$icon(SBBookmarkIcon<WinterBoard> *self, SEL sel) {
246 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
247 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
248 return [UIImage imageWithContentsOfFile:path];
249 return [self wb$icon];
252 static NSString *SBApplication$pathForIcon(SBApplication<WinterBoard> *self, SEL sel) {
253 if (NSString *path = $pathForIcon$(self))
255 return [self wb$pathForIcon];
258 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle<WinterBoard> *bundle, bool ui) {
259 NSString *identifier = [bundle bundleIdentifier];
260 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
262 if (identifier != nil)
263 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
264 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
265 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
267 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
269 #define remapResourceName(oldname, newname) \
270 else if ([file isEqualToString:oldname]) \
271 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
273 if (identifier == nil);
274 else if ([identifier isEqualToString:@"com.apple.calculator"])
275 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
276 else if (![identifier isEqualToString:@"com.apple.springboard"]);
277 remapResourceName(@"FSO_BG.png", @"StatusBar")
278 remapResourceName(@"SBDockBG.png", @"Dock")
279 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
281 if (NSString *path = $getTheme$(names))
286 static UIImage *CachedImageAtPath(NSString *path) {
287 UIImage *image = [PathImages_ objectForKey:path];
289 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
290 image = [[UIImage alloc] wb$initWithContentsOfFile:path cache:true];
292 image = [image autorelease];
293 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
297 static UIImage *UIImage$imageNamed$inBundle$(Class<WinterBoard> self, SEL sel, NSString *name, NSBundle *bundle) {
298 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
299 UIImage *image = [PathImages_ objectForKey:key];
301 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
303 NSLog(@"WB:Debug: [UIImage(%@) imageNamed:\"%@\"]", [bundle bundleIdentifier], name);
304 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
305 image = CachedImageAtPath(path);
307 image = [self wb$imageNamed:name inBundle:bundle];
308 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
312 static UIImage *UIImage$imageNamed$(Class<WinterBoard> self, SEL sel, NSString *name) {
313 return UIImage$imageNamed$inBundle$(self, sel, name, [NSBundle mainBundle]);
316 static UIImage *UIImage$applicationImageNamed$(Class<WinterBoard> self, SEL sel, NSString *name) {
317 NSBundle *bundle = [NSBundle mainBundle];
319 NSLog(@"WB:Debug: [UIImage(%@) applicationImageNamed:\"%@\"]", [bundle bundleIdentifier], name);
320 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
321 return CachedImageAtPath(path);
322 return [self wb$applicationImageNamed:name];
325 @interface NSString (WinterBoard)
326 - (NSString *) wb$themedPath;
329 @implementation NSString (WinterBoard)
331 - (NSString *) wb$themedPath {
333 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
335 if (NSBundle *bundle = [NSBundle mainBundle]) {
336 NSString *prefix([bundle bundlePath]);
337 if ([self hasPrefix:prefix]) {
338 NSUInteger length([prefix length]);
339 if (length != [self length])
340 if (NSString *path = $pathForFile$inBundle$([self substringFromIndex:(length + 1)], bundle, false))
350 #define WBDelegate(delegate) \
351 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
353 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
354 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
356 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
360 - (void) forwardInvocation:(NSInvocation*)inv { \
361 SEL sel = [inv selector]; \
362 if ([delegate respondsToSelector:sel]) \
363 [inv invokeWithTarget:delegate]; \
365 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
368 static NSString *NSBundle$pathForResource$ofType$(NSBundle<WinterBoard> *self, SEL sel, NSString *resource, NSString *type) {
369 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
371 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
372 if (NSString *path = $pathForFile$inBundle$(file, self, false))
374 return [self wb$pathForResource:resource ofType:type];
377 static bool $setBarStyle$_(NSString *name, UIView<WinterBoard> *self, int style) {
379 NSLog(@"WB:Debug:%@Style:%d", name, style);
380 NSNumber *number = nil;
382 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
384 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
388 style = [number intValue];
390 NSLog(@"WB:Debug:%@Style=%d", name, style);
391 [self wb$setBarStyle:style];
396 static void SBCalendarIconContentsView$drawRect$(SBCalendarIconContentsView<WinterBoard> *self, SEL sel, CGRect rect) {
397 NSBundle *bundle([NSBundle mainBundle]);
399 CFLocaleRef locale(CFLocaleCopyCurrent());
400 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
403 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
405 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);
406 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
407 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"" table:@"SpringBoard"]);
408 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
412 CFRelease(formatter);
414 NSString *datestyle(@""
415 "font-family: Helvetica; "
416 "font-weight: bold; "
422 NSString *daystyle(@""
423 "font-family: Helvetica; "
424 "font-weight: bold; "
427 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
430 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
431 datestyle = [datestyle stringByAppendingString:style];
432 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
433 daystyle = [daystyle stringByAppendingString:style];
435 float width([self bounds].size.width);
437 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
438 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
440 [(NSString *)date drawAtPoint:CGPointMake(
441 (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2
442 ) withStyle:datestyle];
444 [(NSString *)day drawAtPoint:CGPointMake(
445 (width + 1 - daysize.width) / 2, (16 - daysize.height) / 2
446 ) withStyle:daystyle];
452 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
455 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
456 style = [number intValue];
458 if (UIColor *color = [Info_ colorForKey:@"NavigationBarTint"])
461 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
464 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
465 self = [self wb$initWithCoder:coder];
468 UINavigationBar$setBarStyle$_(self);
472 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
473 self = [self wb$initWithFrame:frame];
476 UINavigationBar$setBarStyle$_(self);
480 static void UIToolbar$setBarStyle$(UIToolbar<WinterBoard> *self, SEL sel, int style) {
481 if ($setBarStyle$_(@"Toolbar", self, style))
483 return [self wb$setBarStyle:style];
486 static void UINavigationBar$setBarStyle$(UINavigationBar<WinterBoard> *self, SEL sel, int style) {
487 if ($setBarStyle$_(@"NavigationBar", self, style))
489 return [self wb$setBarStyle:style];
492 static void $didMoveToSuperview(SBButtonBar<WinterBoard> *self, SEL sel) {
493 [[self superview] setBackgroundColor:[UIColor clearColor]];
494 [self wb$didMoveToSuperview];
497 static id UIImage$imageAtPath$(NSObject<WinterBoard> *self, SEL sel, NSString *path) {
498 return [self wb$imageAtPath:[path wb$themedPath]];
501 static id $initWithContentsOfFile$(NSObject<WinterBoard> *self, SEL sel, NSString *file) {
502 return [self wb$initWithContentsOfFile:[file wb$themedPath]];
505 static id UIImage$initWithContentsOfFile$cache$(UIImage<WinterBoard> *self, SEL sel, NSString *file, BOOL cache) {
506 return [self wb$initWithContentsOfFile:[file wb$themedPath] cache:cache];
509 static UIImage *UIImage$defaultDesktopImage$(UIImage<WinterBoard> *self, SEL sel) {
511 NSLog(@"WB:Debug:DefaultDesktopImage");
512 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
513 return [UIImage imageWithContentsOfFile:path];
514 return [self wb$defaultDesktopImage];
517 static NSArray *Wallpapers_;
518 static NSString *WallpaperFile_;
519 static UIImageView *WallpaperImage_;
520 static UIWebDocumentView *WallpaperPage_;
521 static NSURL *WallpaperURL_;
523 #define _release(object) \
524 do if (object != nil) { \
529 static id SBContentLayer$initWithSize$(SBContentLayer<WinterBoard> *self, SEL sel, CGSize size) {
530 self = [self wb$initWithSize:size];
534 _release(WallpaperFile_);
535 _release(WallpaperImage_);
536 _release(WallpaperPage_);
537 _release(WallpaperURL_);
539 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
540 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
541 if ([Manager_ fileExistsAtPath:mp4]) {
542 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[self bounds]] autorelease];
543 [video setMovieWithPath:mp4];
544 [video setRepeatMode:1];
545 [video setRepeatGap:0];
546 [self addSubview:video];
547 [video playFromBeginning];;
550 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
551 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
554 if ([Manager_ fileExistsAtPath:png])
556 else if ([Manager_ fileExistsAtPath:jpg])
562 image = [[UIImage alloc] wb$initWithContentsOfFile:path];
564 image = [image autorelease];
568 WallpaperFile_ = [path retain];
569 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
570 [self addSubview:WallpaperImage_];
573 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
574 if ([Manager_ fileExistsAtPath:html]) {
575 CGRect bounds = [self bounds];
577 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
578 [view setAutoresizes:true];
580 WallpaperPage_ = [view retain];
581 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
583 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
585 [[view webView] setDrawsBackground:false];
586 [view setBackgroundColor:[UIColor clearColor]];
588 [self addSubview:view];
595 static void SBSlidingAlertDisplay$updateDesktopImage$(SBSlidingAlertDisplay<WinterBoard> *self, SEL sel, UIImage *image) {
596 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
597 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
599 if (path != nil && _backgroundView != nil)
602 [self wb$updateDesktopImage:image];
605 CGRect bounds = [self bounds];
607 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
608 [view setAutoresizes:true];
610 if (WallpaperPage_ != nil)
611 [WallpaperPage_ release];
612 WallpaperPage_ = [view retain];
614 if (WallpaperURL_ != nil)
615 [WallpaperURL_ release];
616 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
618 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
620 [[view webView] setDrawsBackground:false];
621 [view setBackgroundColor:[UIColor clearColor]];
623 [self insertSubview:view aboveSubview:_backgroundView];
627 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
628 extern "C" CGColorRef CGGStateGetFillColor(void *);
629 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
630 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
632 /* WBTimeLabel {{{ */
633 @interface WBTimeLabel : NSProxy {
635 _transient SBStatusBarTimeView *view_;
638 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
642 @implementation WBTimeLabel
649 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
650 time_ = [time retain];
657 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
658 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
659 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
661 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
662 "font-family: Helvetica; "
663 "font-weight: bold; "
666 "%@", _mode ? @"white" : @"black", custom]];
671 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
676 /* WBBadgeLabel {{{ */
677 @interface WBBadgeLabel : NSProxy {
681 - (id) initWithBadge:(NSString *)badge;
685 @implementation WBBadgeLabel
692 - (id) initWithBadge:(NSString *)badge {
693 badge_ = [badge retain];
699 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
700 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
701 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
702 "font-family: Helvetica; "
703 "font-weight: bold; "
711 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
717 static id SBIconBadge$initWithBadge$(SBIconBadge<WinterBoard> *self, SEL sel, NSString *badge) {
718 if ((self = [self wb$initWithBadge:badge]) != nil) {
719 id &_badge(MSHookIvar<id>(self, "_badge"));
721 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
726 static void SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(SBStatusBarController<WinterBoard> *self, SEL sel, int mode, int orientation, float duration, int id, int animation) {
728 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
729 if (mode < 100) // 104:hidden 105:glowing
730 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
731 mode = [number intValue];
732 return [self wb$setStatusBarMode:mode orientation:orientation duration:duration fenceID:id animation:animation];
735 static id SBStatusBarContentsView$initWithStatusBar$mode$(SBStatusBarContentsView<WinterBoard> *self, SEL sel, id bar, int mode) {
736 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
737 mode = [number intValue];
738 return [self wb$initWithStatusBar:bar mode:mode];
741 static NSString *SBStatusBarOperatorNameView$operatorNameStyle(SBStatusBarOperatorNameView<WinterBoard> *self, SEL sel, NSString *name, BOOL full) {
742 NSString *style([self wb$operatorNameStyle]);
744 NSLog(@"operatorNameStyle= %@", style);
745 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
746 style = [NSString stringWithFormat:@"%@; %@", style, custom];
750 static void SBStatusBarOperatorNameView$setOperatorName$fullSize$(SBStatusBarOperatorNameView<WinterBoard> *self, SEL sel, NSString *name, BOOL full) {
752 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
753 [self wb$setOperatorName:name fullSize:NO];
756 static void SBStatusBarTimeView$drawRect$(SBStatusBarTimeView<WinterBoard> *self, SEL sel, CGRect rect) {
757 id &_time(MSHookIvar<id>(self, "_time"));
758 if (_time != nil && [_time class] != [WBTimeLabel class])
759 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
760 return [self wb$drawRect:rect];
763 static void SBIconController$appendIconList$(SBIconController<WinterBoard> *self, SEL sel, SBIconList *list) {
765 NSLog(@"appendIconList:%@", list);
766 return [self wb$appendIconList:list];
769 static id SBIconLabel$initWithSize$label$(SBIconLabel<WinterBoard> *self, SEL sel, CGSize size, NSString *label) {
770 self = [self wb$initWithSize:size label:label];
772 [self setClipsToBounds:NO];
776 static void SBIconLabel$setInDock$(SBIconLabel<WinterBoard> *self, SEL sel, BOOL docked) {
777 id &_label(MSHookIvar<id>(self, "_label"));
778 if (![Info_ boolForKey:@"UndockedIconLabels"])
780 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
781 [_label setInDock:docked];
782 return [self wb$setInDock:docked];
785 static NSString *NSBundle$localizedStringForKey$value$table$(NSBundle<WinterBoard> *self, SEL sel, NSString *key, NSString *value, NSString *table) {
786 NSString *identifier = [self bundleIdentifier];
787 NSLocale *locale = [NSLocale currentLocale];
788 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
790 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
791 NSString *file = table == nil ? @"Localizable" : table;
792 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
793 NSDictionary *strings;
794 if ((strings = [Strings_ objectForKey:name]) != nil) {
795 if (static_cast<id>(strings) != [NSNull null]) strings:
796 if (NSString *value = [strings objectForKey:key])
798 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
801 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
802 [Strings_ setObject:[strings autorelease] forKey:name];
806 [Strings_ setObject:[NSNull null] forKey:name];
807 return [self wb$localizedStringForKey:key value:value table:table];
810 @class WebCoreFrameBridge;
811 static CGSize WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(WebCoreFrameBridge<WinterBoard> *self, SEL sel, id node, float width) {
814 void **core(reinterpret_cast<void **>([node _node]));
815 if (core == NULL || core[6] == NULL)
817 return [self wb$renderedSizeOfNode:node constrainedToWidth:width];
820 static void SBIconLabel$drawRect$(SBIconLabel<WinterBoard> *self, SEL sel, CGRect rect) {
821 CGRect bounds = [self bounds];
823 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
826 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
827 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
829 NSString *&label(MSHookIvar<NSString *>(self, "_label"));
831 NSString *style = [NSString stringWithFormat:@""
832 "font-family: Helvetica; "
833 "font-weight: bold; "
836 "", docked ? @"white" : @"#b3b3b3"];
839 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
840 float max = 75, width = [label sizeWithStyle:style forWidth:320].width;
842 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", ((width - max) / ([label length] - 1))]];
843 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
844 style = [style stringByAppendingString:custom];
846 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
847 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
850 void mSMSMessageTranscriptController$loadView(mSMSMessageTranscriptController<WinterBoard> *self, SEL sel) {
852 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
853 if (UIImage *image = [[UIImage alloc] wb$initWithContentsOfFile:path]) {
855 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
856 UIView *parent([_transcriptLayer superview]);
857 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
858 [parent insertSubview:background belowSubview:_transcriptLayer];
859 [_transcriptLayer setBackgroundColor:[UIColor clearColor]];
863 extern "C" void FindMappedImages(void);
864 extern "C" NSData *UIImagePNGRepresentation(UIImage *);
866 //static CGImageRef *(*_UIImageRefAtPath)(NSString *path, bool cache, UIImageOrientation *orientation);
867 //_UIImageRefAtPath = (CGImageRef *(*)(NSString *, bool, UIImageOrientation *)) nl[3].n_value;
869 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
870 static UIImage *(*_UIImageWithName)(NSString *name);
871 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
872 static NSBundle *(*_UIKitBundle)();
873 static void (*_UISharedImageInitialize)(bool);
874 static int (*_UISharedImageNameGetIdentifier)(NSString *);
875 static UIImage *(*_UISharedImageWithIdentifier)(int);
877 static UIImage *$_UIImageWithName(NSString *name) {
878 int id(_UISharedImageNameGetIdentifier(name));
880 NSLog(@"WB:Debug: UIImageWithName(\"%@\", %d)", name, id);
883 return _UIImageAtPath(name, _UIKitBundle());
885 NSNumber *key([NSNumber numberWithInt:id]);
886 UIImage *image = [UIImages_ objectForKey:key];
888 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
889 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
890 image = [[UIImage alloc] wb$initWithContentsOfFile:path];
895 image = _UISharedImageWithIdentifier(id);
896 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
901 static UIImage *$_UIImageWithNameInDomain(NSString *name, NSString *domain) {
902 NSString *key = [NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name];
903 UIImage *image = [PathImages_ objectForKey:key];
905 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
907 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
908 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
909 image = [[UIImage alloc] wb$initWithContentsOfFile:path];
914 image = _UIImageWithNameInDomain(name, domain);
915 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
919 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
920 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
922 static bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long, char *, bool &);
924 static bool $_Z24GetFileNameForThisActionmPcRb(unsigned long a0, char *a1, bool &a2) {
925 bool value = _Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
927 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
930 NSString *path = [NSString stringWithUTF8String:a1];
931 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
932 NSString *file = [path substringFromIndex:31];
934 for (NSString *theme in themes_) {
935 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
936 if ([Manager_ fileExistsAtPath:path]) {
937 strcpy(a1, [path UTF8String]);
946 static void ChangeWallpaper(
947 CFNotificationCenterRef center,
954 NSLog(@"WB:Debug:ChangeWallpaper!");
957 if (WallpaperFile_ != nil) {
958 image = [[UIImage alloc] wb$initWithContentsOfFile:WallpaperFile_];
960 image = [image autorelease];
963 if (WallpaperImage_ != nil)
964 [WallpaperImage_ setImage:image];
965 if (WallpaperPage_ != nil)
966 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
970 #define Prefix_ "wb$"
972 void WBRename(bool instance, const char *name, SEL sel, IMP imp) {
973 if (Class _class = objc_getClass(name)) {
975 _class = object_getClass(_class);
976 MSHookMessage(_class, sel, imp, Prefix_);
978 NSLog(@"WB:Warning: cannot find class [%s]", name);
981 extern "C" void WBInitialize() {
982 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
984 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
986 NSLog(@"WB:Notice: WinterBoard");
989 memset(nl, 0, sizeof(nl));
991 nl[0].n_un.n_name = (char *) "__UIImageAtPath";
992 nl[1].n_un.n_name = (char *) "__UIImageWithName";
993 nl[2].n_un.n_name = (char *) "__UIImageWithNameInDomain";
994 nl[3].n_un.n_name = (char *) "__UIKitBundle";
995 nl[4].n_un.n_name = (char *) "__UISharedImageInitialize";
996 nl[5].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
997 nl[6].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
1001 _UIImageAtPath = (UIImage *(*)(NSString *, NSBundle *)) nl[0].n_value;
1002 _UIImageWithName = (UIImage *(*)(NSString *)) nl[1].n_value;
1003 _UIImageWithNameInDomain = (UIImage *(*)(NSString *, NSString *)) nl[2].n_value;
1004 _UIKitBundle = (NSBundle *(*)()) nl[3].n_value;
1005 _UISharedImageInitialize = (void (*)(bool)) nl[4].n_value;
1006 _UISharedImageNameGetIdentifier = (int (*)(NSString *)) nl[5].n_value;
1007 _UISharedImageWithIdentifier = (UIImage *(*)(int)) nl[6].n_value;
1009 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &_UIImageWithName);
1010 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &_UIImageWithNameInDomain);
1012 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1014 memset(nl, 0, sizeof(nl));
1015 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1016 nlist(AudioToolbox, nl);
1017 _Z24GetFileNameForThisActionmPcRb = (bool (*)(unsigned long, char *, bool &)) nl[0].n_value;
1018 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &_Z24GetFileNameForThisActionmPcRb);
1021 WBRename(false, "UIImage", @selector(applicationImageNamed:), (IMP) &UIImage$applicationImageNamed$);
1022 WBRename(false, "UIImage", @selector(defaultDesktopImage), (IMP) &UIImage$defaultDesktopImage$);
1023 WBRename(false, "UIImage", @selector(imageAtPath:), (IMP) &UIImage$imageAtPath$);
1024 WBRename(false, "UIImage", @selector(imageNamed:), (IMP) &UIImage$imageNamed$);
1025 WBRename(false, "UIImage", @selector(imageNamed:inBundle:), (IMP) &UIImage$imageNamed$inBundle$);
1027 //WBRename("UINavigationBar", @selector(initWithCoder:", (IMP) &UINavigationBar$initWithCoder$);
1028 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:", (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1030 WBRename(true, "NSBundle", @selector(localizedStringForKey:value:table:), (IMP) &NSBundle$localizedStringForKey$value$table$);
1031 WBRename(true, "NSBundle", @selector(pathForResource:ofType:), (IMP) &NSBundle$pathForResource$ofType$);
1033 WBRename(true, "UIImage", @selector(initWithContentsOfFile:), (IMP) &$initWithContentsOfFile$);
1034 WBRename(true, "UIImage", @selector(initWithContentsOfFile:cache:), (IMP) &UIImage$initWithContentsOfFile$cache$);
1035 WBRename(true, "UINavigationBar", @selector(setBarStyle:), (IMP) &UINavigationBar$setBarStyle$);
1036 WBRename(true, "UIToolbar", @selector(setBarStyle:), (IMP) &UIToolbar$setBarStyle$);
1038 _UISharedImageInitialize(false);
1040 Manager_ = [[NSFileManager defaultManager] retain];
1041 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1042 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1043 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1045 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1047 if (NSDictionary *settings = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1048 [settings autorelease];
1050 if (NSNumber *debug = [settings objectForKey:@"Debug"])
1051 Debug_ = [debug boolValue];
1053 NSArray *themes = [settings objectForKey:@"Themes"];
1055 if (NSString *theme = [settings objectForKey:@"Theme"])
1056 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1058 [NSNumber numberWithBool:true], @"Active",
1061 for (NSDictionary *theme in themes) {
1062 NSNumber *active = [theme objectForKey:@"Active"];
1063 if (![active boolValue])
1066 NSString *name = [theme objectForKey:@"Name"];
1070 NSString *theme = nil;
1072 #define testForTheme(format...) \
1073 if (theme == nil) { \
1074 NSString *path = [NSString stringWithFormat:format]; \
1075 if ([Manager_ fileExistsAtPath:path]) { \
1076 [themes_ addObject:path]; \
1081 testForTheme(@"/Library/Themes/%@.theme", name)
1082 testForTheme(@"/Library/Themes/%@", name)
1083 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1087 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1089 for (NSString *theme in themes_)
1090 if (NSDictionary *info = [[NSDictionary alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1091 for (NSString *key in [info allKeys])
1092 if ([Info_ objectForKey:key] == nil)
1093 [Info_ setObject:[info objectForKey:key] forKey:key];
1095 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1096 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1097 MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), (IMP) &mSMSMessageTranscriptController$loadView, Prefix_);
1098 } else if ([identifier isEqualToString:@"com.apple.springboard"]) {
1099 CFNotificationCenterAddObserver(
1100 CFNotificationCenterGetDarwinNotifyCenter(),
1101 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1104 NSBundle *MediaPlayer = [NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"];
1105 if (MediaPlayer != nil)
1108 $MPVideoView = objc_getClass("MPVideoView");
1110 WBRename(true, "WebCoreFrameBridge", @selector(renderedSizeOfNode:constrainedToWidth:), (IMP) &WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$);
1112 WBRename(true, "SBApplication", @selector(pathForIcon), (IMP) &SBApplication$pathForIcon);
1113 WBRename(true, "SBApplicationIcon", @selector(icon), (IMP) &SBApplicationIcon$icon);
1114 WBRename(true, "SBBookmarkIcon", @selector(icon), (IMP) &SBBookmarkIcon$icon);
1115 WBRename(true, "SBButtonBar", @selector(didMoveToSuperview), (IMP) &$didMoveToSuperview);
1116 WBRename(true, "SBCalendarIconContentsView", @selector(drawRect:), (IMP) &SBCalendarIconContentsView$drawRect$);
1117 WBRename(true, "SBContentLayer", @selector(initWithSize:), (IMP) &SBContentLayer$initWithSize$);
1118 WBRename(true, "SBIconBadge", @selector(initWithBadge:), (IMP) &SBIconBadge$initWithBadge$);
1119 WBRename(true, "SBIconController", @selector(appendIconList:), (IMP) &SBIconController$appendIconList$);
1120 WBRename(true, "SBIconLabel", @selector(drawRect:), (IMP) &SBIconLabel$drawRect$);
1121 WBRename(true, "SBIconLabel", @selector(initWithSize:label:), (IMP) &SBIconLabel$initWithSize$label$);
1122 WBRename(true, "SBIconLabel", @selector(setInDock:), (IMP) &SBIconLabel$setInDock$);
1123 WBRename(true, "SBIconModel", @selector(cacheImageForIcon:), (IMP) &SBIconModel$cacheImageForIcon$);
1124 WBRename(true, "SBIconModel", @selector(getCachedImagedForIcon:), (IMP) &SBIconModel$getCachedImagedForIcon$);
1126 WBRename(true, "SBSlidingAlertDisplay", @selector(updateDesktopImage:), (IMP) &SBSlidingAlertDisplay$updateDesktopImage$);
1127 WBRename(true, "SBStatusBarContentsView", @selector(didMoveToSuperview), (IMP) &$didMoveToSuperview);
1128 WBRename(true, "SBStatusBarContentsView", @selector(initWithStatusBar:mode:), (IMP) &SBStatusBarContentsView$initWithStatusBar$mode$);
1129 WBRename(true, "SBStatusBarController", @selector(setStatusBarMode:orientation:duration:fenceID:animation:), (IMP) &SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$);
1130 WBRename(true, "SBStatusBarOperatorNameView", @selector(operatorNameStyle), (IMP) &SBStatusBarOperatorNameView$operatorNameStyle);
1131 WBRename(true, "SBStatusBarOperatorNameView", @selector(setOperatorName:fullSize:), (IMP) &SBStatusBarOperatorNameView$setOperatorName$fullSize$);
1132 WBRename(true, "SBStatusBarTimeView", @selector(drawRect:), (IMP) &SBStatusBarTimeView$drawRect$);
1134 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1135 if (English_ != nil)
1136 English_ = [English_ retain];
1138 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1141 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1143 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
1144 [Info_ setObject:[NSNumber numberWithBool:(
1145 $getTheme$(Wallpapers_) == nil ||
1146 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
1147 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
1148 )] forKey:@"UndockedIconLabels"];
1151 NSLog(@"WB:Debug:Info = %@", [Info_ description]);