1 /* WinterBoard - Theme Manager for the iPhone
2 * Copyright (C) 2008-2010 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.
43 #define _trace() do { \
44 struct timeval _ctv; \
45 gettimeofday(&_ctv, NULL); \
50 fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \
51 _ctv.tv_sec, _ctv.tv_usec, \
52 (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \
53 __FILE__, __LINE__, __FUNCTION__\
60 #import <CoreFoundation/CoreFoundation.h>
61 #import <Foundation/Foundation.h>
62 #import <CoreGraphics/CoreGraphics.h>
63 #import <ImageIO/CGImageSource.h>
65 #import <Celestial/AVController.h>
66 #import <Celestial/AVItem.h>
67 #import <Celestial/AVQueue.h>
69 #include <substrate.h>
71 #import <UIKit/UIKit.h>
73 #import <SpringBoard/SBApplication.h>
74 #import <SpringBoard/SBApplicationIcon.h>
75 #import <SpringBoard/SBAppWindow.h>
76 #import <SpringBoard/SBAwayView.h>
77 #import <SpringBoard/SBBookmarkIcon.h>
78 #import <SpringBoard/SBButtonBar.h>
79 #import <SpringBoard/SBCalendarIconContentsView.h>
80 #import <SpringBoard/SBIconController.h>
81 #import <SpringBoard/SBIconLabel.h>
82 #import <SpringBoard/SBIconList.h>
83 #import <SpringBoard/SBIconModel.h>
84 #import <SpringBoard/SBImageCache.h>
85 // XXX: #import <SpringBoard/SBSearchView.h>
86 #import <SpringBoard/SBSearchTableViewCell.h>
87 #import <SpringBoard/SBStatusBarContentsView.h>
88 #import <SpringBoard/SBStatusBarController.h>
89 #import <SpringBoard/SBStatusBarOperatorNameView.h>
90 #import <SpringBoard/SBStatusBarTimeView.h>
91 #import <SpringBoard/SBUIController.h>
92 #import <SpringBoard/SBWidgetApplicationIcon.h>
94 #import <MobileSMS/mSMSMessageTranscriptController.h>
96 #import <MediaPlayer/MPMoviePlayerController.h>
97 #import <MediaPlayer/MPVideoView.h>
98 #import <MediaPlayer/MPVideoView-PlaybackControl.h>
100 #import <CoreGraphics/CGGeometry.h>
102 #import <ChatKit/CKMessageCell.h>
104 extern "C" void __clear_cache (char *beg, char *end);
106 @protocol WinterBoard
110 Class $MPMoviePlayerController;
112 Class $WebCoreFrameBridge;
117 Class $UINavigationBar;
120 Class $CKMessageCell;
121 Class $CKTimestampView;
122 Class $CKTranscriptController;
123 Class $CKTranscriptTableView;
125 Class $SBApplication;
126 Class $SBApplicationIcon;
128 Class $SBBookmarkIcon;
130 Class $SBCalendarIconContentsView;
133 Class $SBIconController;
137 //Class $SBImageCache;
139 Class $SBSearchTableViewCell;
140 Class $SBStatusBarContentsView;
141 Class $SBStatusBarController;
142 Class $SBStatusBarOperatorNameView;
143 Class $SBStatusBarTimeView;
144 Class $SBUIController;
145 Class $SBWidgetApplicationIcon;
149 @interface NSDictionary (WinterBoard)
150 - (UIColor *) wb$colorForKey:(NSString *)key;
151 - (BOOL) wb$boolForKey:(NSString *)key;
154 @implementation NSDictionary (WinterBoard)
156 - (UIColor *) wb$colorForKey:(NSString *)key {
157 NSString *value = [self objectForKey:key];
164 - (BOOL) wb$boolForKey:(NSString *)key {
165 if (NSString *value = [self objectForKey:key])
166 return [value boolValue];
172 static BOOL (*_GSFontGetUseLegacyFontMetrics)();
173 #define $GSFontGetUseLegacyFontMetrics() \
174 (_GSFontGetUseLegacyFontMetrics == NULL ? YES : _GSFontGetUseLegacyFontMetrics())
176 static bool Debug_ = false;
177 static bool Engineer_ = false;
178 static bool SummerBoard_ = true;
179 static bool SpringBoard_;
181 static UIImage *(*_UIApplicationImageWithName)(NSString *name);
182 static UIImage *(*_UIImageAtPath)(NSString *name, NSBundle *path);
183 static CGImageRef (*_UIImageRefAtPath)(NSString *name, bool cache, UIImageOrientation *orientation);
184 static UIImage *(*_UIImageWithNameInDomain)(NSString *name, NSString *domain);
185 static NSBundle *(*_UIKitBundle)();
186 static int (*_UISharedImageNameGetIdentifier)(NSString *);
187 static UIImage *(*_UISharedImageWithIdentifier)(int);
189 static NSMutableDictionary *UIImages_;
190 static NSMutableDictionary *PathImages_;
191 static NSMutableDictionary *Cache_;
192 static NSMutableDictionary *Strings_;
193 static NSMutableDictionary *Themed_;
194 static NSMutableDictionary *Bundles_;
196 static NSFileManager *Manager_;
197 static NSDictionary *English_;
198 static NSMutableDictionary *Info_;
199 static NSMutableArray *themes_;
201 static NSString *$getTheme$(NSArray *files, bool parent = false) {
203 if (NSString *path = [Themed_ objectForKey:files])
204 return reinterpret_cast<id>(path) == [NSNull null] ? nil : path;
207 NSLog(@"WB:Debug: %@", [files description]);
211 for (NSString *theme in themes_)
212 for (NSString *file in files) {
213 path = [NSString stringWithFormat:@"%@/%@", theme, file];
214 if ([Manager_ fileExistsAtPath:path]) {
215 path = parent ? theme : path;
223 [Themed_ setObject:(path == nil ? [NSNull null] : reinterpret_cast<id>(path)) forKey:files];
227 static NSString *$pathForFile$inBundle$(NSString *file, NSBundle *bundle, bool ui) {
228 NSString *identifier = [bundle bundleIdentifier];
229 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
231 if (identifier != nil)
232 [names addObject:[NSString stringWithFormat:@"Bundles/%@/%@", identifier, file]];
233 if (NSString *folder = [[bundle bundlePath] lastPathComponent])
234 [names addObject:[NSString stringWithFormat:@"Folders/%@/%@", folder, file]];
236 [names addObject:[NSString stringWithFormat:@"UIImages/%@", file]];
238 #define remapResourceName(oldname, newname) \
239 else if ([file isEqualToString:oldname]) \
240 [names addObject:[NSString stringWithFormat:@"%@.png", newname]]; \
242 bool summer(SpringBoard_ && SummerBoard_);
244 if (identifier == nil);
245 else if ([identifier isEqualToString:@"com.apple.chatkit"])
246 [names addObject:[NSString stringWithFormat:@"Bundles/com.apple.MobileSMS/%@", file]];
247 else if ([identifier isEqualToString:@"com.apple.calculator"])
248 [names addObject:[NSString stringWithFormat:@"Files/Applications/Calculator.app/%@", file]];
250 remapResourceName(@"FSO_BG.png", @"StatusBar")
251 remapResourceName(@"SBDockBG.png", @"Dock")
252 remapResourceName(@"SBWeatherCelsius.png", @"Icons/Weather")
254 if (NSString *path = $getTheme$(names))
260 static NSString *$pathForIcon$(SBApplication *self, NSString *suffix = @"") {
261 NSString *identifier = [self bundleIdentifier];
262 NSString *path = [self path];
263 NSString *folder = [path lastPathComponent];
264 NSString *dname = [self displayName];
265 NSString *didentifier = [self displayIdentifier];
268 NSLog(@"WB:Debug: [SBApplication(%@:%@:%@:%@) pathForIcon]", identifier, folder, dname, didentifier);
270 NSMutableArray *names = [NSMutableArray arrayWithCapacity:8];
272 /* XXX: I might need to keep this for backwards compatibility
273 if (identifier != nil)
274 [names addObject:[NSString stringWithFormat:@"Bundles/%@/icon.png", identifier]];
276 [names addObject:[NSString stringWithFormat:@"Folders/%@/icon.png", folder]]; */
278 #define testForIcon(Name) \
279 if (NSString *name = Name) \
280 [names addObject:[NSString stringWithFormat:@"Icons%@/%@.png", suffix, name]];
282 if (![didentifier isEqualToString:identifier])
283 testForIcon(didentifier);
285 testForIcon(identifier);
288 if ([identifier isEqualToString:@"com.apple.MobileSMS"])
291 if (didentifier != nil) {
292 testForIcon([English_ objectForKey:didentifier]);
294 NSArray *parts = [didentifier componentsSeparatedByString:@"-"];
295 if ([parts count] != 1)
296 if (NSDictionary *english = [[[NSDictionary alloc] initWithContentsOfFile:[path stringByAppendingString:@"/English.lproj/UIRoleDisplayNames.strings"]] autorelease])
297 testForIcon([english objectForKey:[parts lastObject]]);
300 if (NSString *path = $getTheme$(names))
306 @interface NSBundle (WinterBoard)
307 + (NSBundle *) wb$bundleWithFile:(NSString *)path;
310 @implementation NSBundle (WinterBoard)
312 + (NSBundle *) wb$bundleWithFile:(NSString *)path {
313 path = [path stringByDeletingLastPathComponent];
314 if (path == nil || [path length] == 0 || [path isEqualToString:@"/"])
317 NSBundle *bundle([Bundles_ objectForKey:path]);
318 if (reinterpret_cast<id>(bundle) == [NSNull null])
320 else if (bundle == nil) {
321 if ([Manager_ fileExistsAtPath:[path stringByAppendingPathComponent:@"Info.plist"]])
322 bundle = [NSBundle bundleWithPath:path];
324 bundle = [NSBundle wb$bundleWithFile:path];
326 NSLog(@"WB:Debug:PathBundle(%@, %@)", path, bundle);
327 [Bundles_ setObject:(bundle == nil ? [NSNull null] : reinterpret_cast<id>(bundle)) forKey:path];
335 @interface NSString (WinterBoard)
336 - (NSString *) wb$themedPath;
339 @implementation NSString (WinterBoard)
341 - (NSString *) wb$themedPath {
343 NSLog(@"WB:Debug:Bypass(\"%@\")", self);
345 if (NSBundle *bundle = [NSBundle wb$bundleWithFile:self]) {
346 NSString *file([self stringByResolvingSymlinksInPath]);
347 NSString *prefix([[bundle bundlePath] stringByResolvingSymlinksInPath]);
348 if ([file hasPrefix:prefix]) {
349 NSUInteger length([prefix length]);
350 if (length != [file length])
351 if (NSString *path = $pathForFile$inBundle$([file substringFromIndex:(length + 1)], bundle, false))
361 void WBLogRect(const char *tag, struct CGRect rect) {
362 NSLog(@"%s:{%f,%f+%f,%f}", tag, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
365 void WBLogHierarchy(UIView *view, unsigned index = 0, unsigned indent = 0) {
366 CGRect frame([view frame]);
367 NSLog(@"%*s|%2d:%p:%s : {%f,%f+%f,%f} (%@)", indent * 3, "", index, view, class_getName([view class]), frame.origin.x, frame.origin.y, frame.size.width, frame.size.height, [view backgroundColor]);
369 for (UIView *child in [view subviews])
370 WBLogHierarchy(child, index++, indent + 1);
373 UIImage *$cacheForImage$(UIImage *image) {
374 CGColorSpaceRef space(CGColorSpaceCreateDeviceRGB());
375 CGRect rect = {CGPointMake(1, 1), [image size]};
376 CGSize size = {rect.size.width + 2, rect.size.height + 2};
378 CGContextRef context(CGBitmapContextCreate(NULL, size.width, size.height, 8, 4 * size.width, space, kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
379 CGColorSpaceRelease(space);
381 CGContextDrawImage(context, rect, [image CGImage]);
382 CGImageRef ref(CGBitmapContextCreateImage(context));
383 CGContextRelease(context);
385 UIImage *cache([UIImage imageWithCGImage:ref]);
391 /*MSHook(id, SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$, SBImageCache *self, SEL sel, NSString *name, unsigned width, unsigned height, unsigned capacity) {
392 //if ([name isEqualToString:@"icons"]) return nil;
393 return _SBImageCache$initWithName$forImageWidth$imageHeight$initialCapacity$(self, sel, name, width, height, capacity);
396 MSHook(void, SBIconModel$cacheImageForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
397 NSString *key([icon displayIdentifier]);
399 if (UIImage *image = [icon icon]) {
400 CGSize size = [image size];
401 if (size.width != 59 || size.height != 60) {
402 UIImage *cache($cacheForImage$(image));
403 [Cache_ setObject:cache forKey:key];
408 _SBIconModel$cacheImageForIcon$(self, sel, icon);
411 MSHook(void, SBIconModel$cacheImagesForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
412 /* XXX: do I /really/ have to do this? figure out how to cache the small icon! */
413 _SBIconModel$cacheImagesForIcon$(self, sel, icon);
415 NSString *key([icon displayIdentifier]);
417 if (UIImage *image = [icon icon]) {
418 CGSize size = [image size];
419 if (size.width != 59 || size.height != 60) {
420 UIImage *cache($cacheForImage$(image));
421 [Cache_ setObject:cache forKey:key];
427 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$, SBIconModel *self, SEL sel, SBIcon *icon) {
428 NSString *key([icon displayIdentifier]);
429 if (UIImage *image = [Cache_ objectForKey:key])
432 return _SBIconModel$getCachedImagedForIcon$(self, sel, icon);
435 MSHook(UIImage *, SBIconModel$getCachedImagedForIcon$smallIcon$, SBIconModel *self, SEL sel, SBIcon *icon, BOOL small) {
437 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
438 NSString *key([icon displayIdentifier]);
439 if (UIImage *image = [Cache_ objectForKey:key])
442 return _SBIconModel$getCachedImagedForIcon$smallIcon$(self, sel, icon, small);
445 MSHook(id, SBSearchView$initWithFrame$, id /* XXX: SBSearchView */ self, SEL sel, struct CGRect frame) {
446 if ((self = _SBSearchView$initWithFrame$(self, sel, frame)) != nil) {
447 [self setBackgroundColor:[UIColor clearColor]];
448 for (UIView *child in [self subviews])
449 [child setBackgroundColor:[UIColor clearColor]];
453 MSHook(id, SBSearchTableViewCell$initWithStyle$reuseIdentifier$, SBSearchTableViewCell *self, SEL sel, int style, NSString *reuse) {
454 if ((self = _SBSearchTableViewCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
455 [self setBackgroundColor:[UIColor clearColor]];
459 MSHook(void, SBSearchTableViewCell$drawRect$, SBSearchTableViewCell *self, SEL sel, struct CGRect rect, BOOL selected) {
460 _SBSearchTableViewCell$drawRect$(self, sel, rect, selected);
461 float inset([self edgeInset]);
462 [[UIColor clearColor] set];
463 UIRectFill(CGRectMake(0, 0, inset, rect.size.height));
464 UIRectFill(CGRectMake(rect.size.width - inset, 0, inset, rect.size.height));
467 MSHook(UIImage *, SBApplicationIcon$icon, SBApplicationIcon *self, SEL sel) {
468 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"])
469 if (NSString *path = $pathForIcon$([self application]))
470 return [UIImage imageWithContentsOfFile:path];
471 return _SBApplicationIcon$icon(self, sel);
474 MSHook(UIImage *, SBApplicationIcon$generateIconImage$, SBApplicationIcon *self, SEL sel, int type) {
476 if (![Info_ wb$boolForKey:@"ComposeStoreIcons"]) {
477 if (NSString *path72 = $pathForIcon$([self application], @"-72"))
478 return [UIImage imageWithContentsOfFile:path72];
479 else if (NSString *path = $pathForIcon$([self application]))
480 if (UIImage *image = [UIImage imageWithContentsOfFile:path])
481 return [image _imageScaledToProportion:1.2 interpolationQuality:5];
483 return _SBApplicationIcon$generateIconImage$(self, sel, type);
486 MSHook(UIImage *, SBWidgetApplicationIcon$icon, SBWidgetApplicationIcon *self, SEL sel) {
488 NSLog(@"WB:Debug:Widget(%@:%@)", [self displayIdentifier], [self displayName]);
489 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
490 return [UIImage imageWithContentsOfFile:path];
491 return _SBWidgetApplicationIcon$icon(self, sel);
494 MSHook(UIImage *, SBBookmarkIcon$icon, SBBookmarkIcon *self, SEL sel) {
496 NSLog(@"WB:Debug:Bookmark(%@:%@)", [self displayIdentifier], [self displayName]);
497 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Icons/%@.png", [self displayName]]]))
498 return [UIImage imageWithContentsOfFile:path];
499 return _SBBookmarkIcon$icon(self, sel);
502 MSHook(NSString *, SBApplication$pathForIcon, SBApplication *self, SEL sel) {
503 if (NSString *path = $pathForIcon$(self))
505 return _SBApplication$pathForIcon(self, sel);
508 static UIImage *CachedImageAtPath(NSString *path) {
509 path = [path stringByResolvingSymlinksInPath];
510 UIImage *image = [PathImages_ objectForKey:path];
512 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
513 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
515 image = [image autorelease];
516 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:path];
520 MSHook(CGImageSourceRef, CGImageSourceCreateWithURL, CFURLRef url, CFDictionaryRef options) {
522 NSLog(@"WB:Debug: CGImageSourceCreateWithURL(\"%@\", %s)", url, options);
523 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
524 if (NSString *path = (NSString *) CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle))
525 if (NSString *themed = [path wb$themedPath])
527 url = (CFURLRef) [NSURL fileURLWithPath:themed];
528 CGImageSourceRef source(_CGImageSourceCreateWithURL(url, options));
533 MSHook(CGImageRef, _UIImageRefAtPath, NSString *name, bool cache, UIImageOrientation *orientation) {
535 NSLog(@"WB:Debug: _UIImageRefAtPath(\"%@\", %s)", name, cache ? "true" : "false");
537 NSString *themed([name wb$themedPath]);
539 if (false && SpringBoard_ && SummerBoard_ && themed == name) {
540 if ([name isEqualToString:@"/System/Library/CoreServices/SpringBoard.app/SBDockBGT-Portrait.png"])
541 if (NSString *path = $getTheme$([NSArray arrayWithObject:@"Dock.png"])) {
542 UIImage *image([UIImage imageWithContentsOfFile:path]);
543 CGImageRef ref([[image _imageScaledToProportion:2.4 interpolationQuality:5] imageRef]);
549 return __UIImageRefAtPath(themed, cache, orientation);
552 /*MSHook(UIImage *, _UIImageAtPath, NSString *name, NSBundle *bundle) {
554 return __UIImageAtPath(name, nil);
556 NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];
557 UIImage *image = [PathImages_ objectForKey:key];
559 return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;
561 NSLog(@"WB:Debug: _UIImageAtPath(\"%@\", %@)", name, bundle);
562 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
563 image = CachedImageAtPath(path);
565 image = __UIImageAtPath(name, bundle);
566 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
571 MSHook(UIImage *, _UIApplicationImageWithName, NSString *name) {
572 NSBundle *bundle = [NSBundle mainBundle];
574 NSLog(@"WB:Debug: _UIApplicationImageWithName(\"%@\", %@)", name, bundle);
575 if (NSString *path = $pathForFile$inBundle$(name, bundle, false))
576 return CachedImageAtPath(path);
577 return __UIApplicationImageWithName(name);
580 #define WBDelegate(delegate) \
581 - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \
583 NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \
584 if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \
586 NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \
590 - (void) forwardInvocation:(NSInvocation*)inv { \
591 SEL sel = [inv selector]; \
592 if ([delegate respondsToSelector:sel]) \
593 [inv invokeWithTarget:delegate]; \
595 NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \
598 MSHook(NSString *, NSBundle$pathForResource$ofType$, NSBundle *self, SEL sel, NSString *resource, NSString *type) {
599 NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];
601 NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);
602 if (NSString *path = $pathForFile$inBundle$(file, self, false))
604 return _NSBundle$pathForResource$ofType$(self, sel, resource, type);
607 void $setBarStyle$_(NSString *name, int &style) {
609 NSLog(@"WB:Debug:%@Style:%d", name, style);
610 NSNumber *number = nil;
612 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];
614 number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];
616 style = [number intValue];
618 NSLog(@"WB:Debug:%@Style=%d", name, style);
622 MSHook(void, SBCalendarIconContentsView$drawRect$, SBCalendarIconContentsView *self, SEL sel, CGRect rect) {
623 NSBundle *bundle([NSBundle mainBundle]);
625 CFLocaleRef locale(CFLocaleCopyCurrent());
626 CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));
629 CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));
631 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);
632 CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
633 CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"cccc" table:@"SpringBoard"]);
634 CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));
638 CFRelease(formatter);
640 NSString *datestyle([@""
641 "font-family: Helvetica; "
642 "font-weight: bold; "
645 "" stringByAppendingString:(IsWild_
646 ? @"font-size: 54px; "
647 : @"font-size: 39px; "
650 NSString *daystyle([@""
651 "font-family: Helvetica; "
652 "font-weight: bold; "
654 "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "
655 "" stringByAppendingString:(IsWild_
656 ? @"font-size: 11px; "
657 : @"font-size: 9px; "
660 if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])
661 datestyle = [datestyle stringByAppendingString:style];
662 if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])
663 daystyle = [daystyle stringByAppendingString:style];
665 float width([self bounds].size.width);
667 CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];
668 CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];
670 unsigned base(IsWild_ ? 89 : 70);
671 if ($GSFontGetUseLegacyFontMetrics())
674 [(NSString *)date drawAtPoint:CGPointMake(
675 (width + 1 - datesize.width) / 2, (base - datesize.height) / 2
676 ) withStyle:datestyle];
678 [(NSString *)day drawAtPoint:CGPointMake(
679 (width + 1 - daysize.width) / 2, ((IsWild_ ? 18 : 16) - daysize.height) / 2
680 ) withStyle:daystyle];
686 /*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {
689 if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])
690 style = [number intValue];
692 if (UIColor *color = [Info_ wb$colorForKey:@"NavigationBarTint"])
695 return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];
698 /*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {
699 self = [self wb$initWithCoder:coder];
702 UINavigationBar$setBarStyle$_(self);
706 static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {
707 self = [self wb$initWithFrame:frame];
710 UINavigationBar$setBarStyle$_(self);
714 MSHook(void, UIToolbar$setBarStyle$, UIToolbar *self, SEL sel, int style) {
715 $setBarStyle$_(@"Toolbar", style);
716 return _UIToolbar$setBarStyle$(self, sel, style);
719 MSHook(void, UINavigationBar$setBarStyle$, UINavigationBar *self, SEL sel, int style) {
720 $setBarStyle$_(@"NavigationBar", style);
721 return _UINavigationBar$setBarStyle$(self, sel, style);
724 MSHook(void, SBButtonBar$didMoveToSuperview, UIView *self, SEL sel) {
725 [[self superview] setBackgroundColor:[UIColor clearColor]];
726 _SBButtonBar$didMoveToSuperview(self, sel);
729 MSHook(void, SBStatusBarContentsView$didMoveToSuperview, UIView *self, SEL sel) {
730 [[self superview] setBackgroundColor:[UIColor clearColor]];
731 _SBStatusBarContentsView$didMoveToSuperview(self, sel);
734 MSHook(UIImage *, UIImage$defaultDesktopImage, UIImage *self, SEL sel) {
736 NSLog(@"WB:Debug:DefaultDesktopImage");
737 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))
738 return [UIImage imageWithContentsOfFile:path];
739 return _UIImage$defaultDesktopImage(self, sel);
742 static NSArray *Wallpapers_;
743 static bool Papered_;
744 static NSString *WallpaperFile_;
745 static UIImageView *WallpaperImage_;
746 static UIWebDocumentView *WallpaperPage_;
747 static NSURL *WallpaperURL_;
749 #define _release(object) \
750 do if (object != nil) { \
755 MSHook(id, SBUIController$init, SBUIController *self, SEL sel) {
756 self = _SBUIController$init(self, sel);
760 UIDevice *device([UIDevice currentDevice]);
761 IsWild_ = [device respondsToSelector:@selector(isWildcat)] && [device isWildcat];
764 UIWindow *&_wallpaperView(MSHookIvar<UIWindow *>(self, "_wallpaperView"));
765 if (&_wallpaperView != NULL) {
766 [_wallpaperView removeFromSuperview];
767 [_wallpaperView release];
768 _wallpaperView = nil;
772 UIWindow *&_window(MSHookIvar<UIWindow *>(self, "_window"));
773 UIView *&_contentLayer(MSHookIvar<UIView *>(self, "_contentLayer"));
774 UIView *&_contentView(MSHookIvar<UIView *>(self, "_contentView"));
777 if (&_contentLayer != NULL)
778 layer = _contentLayer;
779 else if (&_contentView != NULL)
780 layer = _contentView;
784 UIView *content([[[UIView alloc] initWithFrame:[layer frame]] autorelease]);
786 [content setBackgroundColor:[layer backgroundColor]];
787 [layer setBackgroundColor:[UIColor clearColor]];
788 [layer setFrame:[content bounds]];
789 [_window setContentView:content];
792 if (!SummerBoard_ || !IsWild_)
795 CGRect bounds([content bounds]);
796 bounds.origin.y = -30;
797 indirect = [[[UIView alloc] initWithFrame:bounds] autorelease];
798 [content addSubview:indirect];
799 [indirect zoomToScale:2.4];
802 _release(WallpaperFile_);
803 _release(WallpaperImage_);
804 _release(WallpaperPage_);
805 _release(WallpaperURL_);
807 if (NSString *theme = $getTheme$(Wallpapers_, true)) {
808 NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];
809 if ([Manager_ fileExistsAtPath:mp4]) {
813 static AVController *controller_(nil);
814 if (controller_ == nil) {
815 AVQueue *queue([AVQueue avQueue]);
816 controller_ = [[AVController avControllerWithQueue:queue error:&error] retain];
819 AVQueue *queue([controller_ queue]);
821 UIView *video([[[UIView alloc] initWithFrame:[indirect bounds]] autorelease]);
822 [controller_ setLayer:[video _layer]];
824 AVItem *item([[[AVItem alloc] initWithPath:mp4 error:&error] autorelease]);
825 [queue appendItem:item error:&error];
827 [controller_ play:&error];
828 #elif UseMPMoviePlayerController
829 NSURL *url([NSURL fileURLWithPath:mp4]);
830 MPMoviePlayerController *controller = [[$MPMoviePlayerController alloc] initWithContentURL:url];
831 controller.movieControlMode = MPMovieControlModeHidden;
834 MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[indirect bounds]] autorelease];
835 [video setMovieWithPath:mp4];
836 [video setRepeatMode:1];
837 [video setRepeatGap:-1];
838 [video playFromBeginning];;
841 [indirect addSubview:video];
844 NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];
845 NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];
848 if ([Manager_ fileExistsAtPath:png])
850 else if ([Manager_ fileExistsAtPath:jpg])
856 image = [[UIImage alloc] initWithContentsOfFile:path];
858 image = [image autorelease];
862 WallpaperFile_ = [path retain];
863 WallpaperImage_ = [[UIImageView alloc] initWithImage:image];
864 if (NSNumber *number = [Info_ objectForKey:@"WallpaperAlpha"])
865 [WallpaperImage_ setAlpha:[number floatValue]];
866 [indirect addSubview:WallpaperImage_];
869 NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];
870 if ([Manager_ fileExistsAtPath:html]) {
871 CGRect bounds = [indirect bounds];
873 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
874 [view setAutoresizes:true];
876 WallpaperPage_ = [view retain];
877 WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];
879 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
881 [view setBackgroundColor:[UIColor clearColor]];
882 if ([view respondsToSelector:@selector(setDrawsBackground:)])
883 [view setDrawsBackground:NO];
884 [[view webView] setDrawsBackground:NO];
886 [indirect addSubview:view];
890 for (size_t i(0), e([themes_ count]); i != e; ++i) {
891 NSString *theme = [themes_ objectAtIndex:(e - i - 1)];
892 NSString *html = [theme stringByAppendingPathComponent:@"Widget.html"];
893 if ([Manager_ fileExistsAtPath:html]) {
894 CGRect bounds = [indirect bounds];
896 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
897 [view setAutoresizes:true];
899 NSURL *url = [NSURL fileURLWithPath:html];
900 [view loadRequest:[NSURLRequest requestWithURL:url]];
902 [view setBackgroundColor:[UIColor clearColor]];
903 if ([view respondsToSelector:@selector(setDrawsBackground:)])
904 [view setDrawsBackground:NO];
905 [[view webView] setDrawsBackground:NO];
907 [indirect addSubview:view];
911 [content addSubview:layer];
916 MSHook(void, SBAwayView$updateDesktopImage$, SBAwayView *self, SEL sel, UIImage *image) {
917 NSString *path = $getTheme$([NSArray arrayWithObject:@"LockBackground.html"]);
918 UIView *&_backgroundView(MSHookIvar<UIView *>(self, "_backgroundView"));
920 if (path != nil && _backgroundView != nil)
923 _SBAwayView$updateDesktopImage$(self, sel, image);
926 CGRect bounds = [self bounds];
928 UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);
929 [view setAutoresizes:true];
931 if (WallpaperPage_ != nil)
932 [WallpaperPage_ release];
933 WallpaperPage_ = [view retain];
935 if (WallpaperURL_ != nil)
936 [WallpaperURL_ release];
937 WallpaperURL_ = [[NSURL fileURLWithPath:path] retain];
939 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
941 [[view webView] setDrawsBackground:false];
942 [view setBackgroundColor:[UIColor clearColor]];
944 [self insertSubview:view aboveSubview:_backgroundView];
948 /*extern "C" CGColorRef CGGStateGetSystemColor(void *);
949 extern "C" CGColorRef CGGStateGetFillColor(void *);
950 extern "C" CGColorRef CGGStateGetStrokeColor(void *);
951 extern "C" NSString *UIStyleStringFromColor(CGColorRef);*/
953 /* WBTimeLabel {{{ */
954 @interface WBTimeLabel : NSProxy {
956 _transient SBStatusBarTimeView *view_;
959 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view;
963 @implementation WBTimeLabel
970 - (id) initWithTime:(NSString *)time view:(SBStatusBarTimeView *)view {
971 time_ = [time retain];
976 - (NSString *) description {
982 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
983 if (NSString *custom = [Info_ objectForKey:@"TimeStyle"]) {
984 BOOL &_mode(MSHookIvar<BOOL>(view_, "_mode"));;
986 [time_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
987 "font-family: Helvetica; "
988 "font-weight: bold; "
991 "%@", _mode ? @"white" : @"black", custom]];
996 return [time_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1001 /* WBBadgeLabel {{{ */
1002 @interface WBBadgeLabel : NSProxy {
1006 - (id) initWithBadge:(NSString *)badge;
1007 - (NSString *) description;
1011 @implementation WBBadgeLabel
1018 - (id) initWithBadge:(NSString *)badge {
1019 badge_ = [badge retain];
1023 - (NSString *) description {
1024 return [badge_ description];
1029 - (CGSize) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font lineBreakMode:(int)mode {
1030 if (NSString *custom = [Info_ objectForKey:@"BadgeStyle"]) {
1031 [badge_ drawAtPoint:point withStyle:[NSString stringWithFormat:@""
1032 "font-family: Helvetica; "
1033 "font-weight: bold; "
1041 return [badge_ drawAtPoint:point forWidth:width withFont:font lineBreakMode:mode];
1047 MSHook(void, SBIcon$setAlpha$, SBIcon *self, SEL sel, float alpha) {
1048 if (NSNumber *number = [Info_ objectForKey:@"IconAlpha"])
1049 alpha = [number floatValue];
1050 return _SBIcon$setAlpha$(self, sel, alpha);
1053 MSHook(id, SBIconBadge$initWithBadge$, SBIconBadge *self, SEL sel, NSString *badge) {
1054 if ((self = _SBIconBadge$initWithBadge$(self, sel, badge)) != nil) {
1055 id &_badge(MSHookIvar<id>(self, "_badge"));
1057 if (id label = [[WBBadgeLabel alloc] initWithBadge:[_badge autorelease]])
1062 void SBStatusBarController$setStatusBarMode(int &mode) {
1064 NSLog(@"WB:Debug:setStatusBarMode:%d", mode);
1065 if (mode < 100) // 104:hidden 105:glowing
1066 if (NSNumber *number = [Info_ objectForKey:@"StatusBarMode"])
1067 mode = [number intValue];
1070 /*MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int animation) {
1071 NSLog(@"mode:%d orientation:%d duration:%f animation:%d", mode, orientation, duration, animation);
1072 SBStatusBarController$setStatusBarMode(mode);
1073 return _SBStatusBarController$setStatusBarMode$orientation$duration$animation$(self, sel, mode, orientation, duration, animation);
1076 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$, SBStatusBarController *self, SEL sel, int mode, int orientation, float duration, int fenceID, int animation) {
1077 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d", mode, orientation, duration, fenceID, animation);
1078 SBStatusBarController$setStatusBarMode(mode);
1079 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$(self, sel, mode, orientation, duration, fenceID, animation);
1082 MSHook(void, SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$, SBStatusBarController *self, SEL sel, int mode, int orientation, double duration, int fenceID, int animation, double startTime) {
1083 //NSLog(@"mode:%d orientation:%d duration:%f fenceID:%d animation:%d startTime:%f", mode, orientation, duration, fenceID, animation, startTime);
1084 SBStatusBarController$setStatusBarMode(mode);
1085 //NSLog(@"mode=%u", mode);
1086 return _SBStatusBarController$setStatusBarMode$orientation$duration$fenceID$animation$startTime$(self, sel, mode, orientation, duration, fenceID, animation, startTime);
1089 /*MSHook(id, SBStatusBarContentsView$initWithStatusBar$mode$, SBStatusBarContentsView *self, SEL sel, id bar, int mode) {
1090 if (NSNumber *number = [Info_ objectForKey:@"StatusBarContentsMode"])
1091 mode = [number intValue];
1092 return _SBStatusBarContentsView$initWithStatusBar$mode$(self, sel, bar, mode);
1095 MSHook(NSString *, SBStatusBarOperatorNameView$operatorNameStyle, SBStatusBarOperatorNameView *self, SEL sel) {
1096 NSString *style(_SBStatusBarOperatorNameView$operatorNameStyle(self, sel));
1098 NSLog(@"operatorNameStyle= %@", style);
1099 if (NSString *custom = [Info_ objectForKey:@"OperatorNameStyle"])
1100 style = [NSString stringWithFormat:@"%@; %@", style, custom];
1104 MSHook(void, SBStatusBarOperatorNameView$setOperatorName$fullSize$, SBStatusBarOperatorNameView *self, SEL sel, NSString *name, BOOL full) {
1106 NSLog(@"setOperatorName:\"%@\" fullSize:%u", name, full);
1107 return _SBStatusBarOperatorNameView$setOperatorName$fullSize$(self, sel, name, NO);
1110 // XXX: replace this with [SBStatusBarTimeView tile]
1111 MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, CGRect rect) {
1112 id &_time(MSHookIvar<id>(self, "_time"));
1113 if (_time != nil && [_time class] != [WBTimeLabel class])
1114 object_setInstanceVariable(self, "_time", reinterpret_cast<void *>([[WBTimeLabel alloc] initWithTime:[_time autorelease] view:self]));
1115 return _SBStatusBarTimeView$drawRect$(self, sel, rect);
1118 @interface UIView (WinterBoard)
1119 - (bool) wb$isWBImageView;
1120 - (void) wb$logHierarchy;
1123 @implementation UIView (WinterBoard)
1125 - (bool) wb$isWBImageView {
1129 - (void) wb$logHierarchy {
1130 WBLogHierarchy(self);
1135 @interface WBImageView : UIImageView {
1138 - (bool) wb$isWBImageView;
1139 - (void) wb$updateFrame;
1142 @implementation WBImageView
1144 - (bool) wb$isWBImageView {
1148 - (void) wb$updateFrame {
1149 CGRect frame([self frame]);
1152 for (UIView *view(self); ; ) {
1153 view = [view superview];
1156 frame.origin.y -= [view frame].origin.y;
1159 [self setFrame:frame];
1164 MSHook(void, SBIconList$setFrame$, SBIconList *self, SEL sel, CGRect frame) {
1165 NSArray *subviews([self subviews]);
1166 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1167 if (view != nil && [view wb$isWBImageView])
1168 [view wb$updateFrame];
1169 _SBIconList$setFrame$(self, sel, frame);
1172 MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *self, SEL sel) {
1173 SBIconModel *&_iconModel(MSHookIvar<SBIconModel *>(self, "_iconModel"));
1174 NSArray *lists([_iconModel iconLists]);
1176 for (unsigned i(0), e([lists count]); i != e; ++i)
1177 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Page%u.png", i]])) {
1178 SBIconList *list([lists objectAtIndex:i]);
1179 NSArray *subviews([list subviews]);
1181 WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]);
1182 if (view == nil || ![view wb$isWBImageView]) {
1183 view = [[[WBImageView alloc] init] autorelease];
1184 [list insertSubview:view atIndex:0];
1187 UIImage *image([UIImage imageWithContentsOfFile:path]);
1189 CGRect frame([view frame]);
1190 frame.size = [image size];
1191 [view setFrame:frame];
1193 [view setImage:image];
1194 [view wb$updateFrame];
1197 return _SBIconController$noteNumberOfIconListsChanged(self, sel);
1200 MSHook(id, SBIconLabel$initWithSize$label$, SBIconLabel *self, SEL sel, CGSize size, NSString *label) {
1201 self = _SBIconLabel$initWithSize$label$(self, sel, size, label);
1203 [self setClipsToBounds:NO];
1207 MSHook(void, SBIconLabel$setInDock$, SBIconLabel *self, SEL sel, BOOL docked) {
1208 id &_label(MSHookIvar<id>(self, "_label"));
1209 if (![Info_ wb$boolForKey:@"UndockedIconLabels"])
1211 if (_label != nil && [_label respondsToSelector:@selector(setInDock:)])
1212 [_label setInDock:docked];
1213 return _SBIconLabel$setInDock$(self, sel, docked);
1216 MSHook(NSString *, NSBundle$localizedStringForKey$value$table$, NSBundle *self, SEL sel, NSString *key, NSString *value, NSString *table) {
1217 NSString *identifier = [self bundleIdentifier];
1218 NSLocale *locale = [NSLocale currentLocale];
1219 NSString *language = [locale objectForKey:NSLocaleLanguageCode];
1221 NSLog(@"WB:Debug:[NSBundle(%@) localizedStringForKey:\"%@\" value:\"%@\" table:\"%@\"] (%@)", identifier, key, value, table, language);
1222 NSString *file = table == nil ? @"Localizable" : table;
1223 NSString *name = [NSString stringWithFormat:@"%@:%@", identifier, file];
1224 NSDictionary *strings;
1225 if ((strings = [Strings_ objectForKey:name]) != nil) {
1226 if (static_cast<id>(strings) != [NSNull null]) strings:
1227 if (NSString *value = [strings objectForKey:key])
1229 } else if (NSString *path = $pathForFile$inBundle$([NSString stringWithFormat:@"%@.lproj/%@.strings",
1232 if ((strings = [[NSDictionary alloc] initWithContentsOfFile:path]) != nil) {
1233 [Strings_ setObject:[strings autorelease] forKey:name];
1237 [Strings_ setObject:[NSNull null] forKey:name];
1238 return _NSBundle$localizedStringForKey$value$table$(self, sel, key, value, table);
1241 @class WebCoreFrameBridge;
1242 MSHook(CGSize, WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$, WebCoreFrameBridge *self, SEL sel, id node, float width) {
1245 void **core(reinterpret_cast<void **>([node _node]));
1246 if (core == NULL || core[6] == NULL)
1248 return _WebCoreFrameBridge$renderedSizeOfNode$constrainedToWidth$(self, sel, node, width);
1251 MSHook(void, SBIconLabel$drawRect$, SBIconLabel *self, SEL sel, CGRect rect) {
1252 CGRect bounds = [self bounds];
1254 static Ivar drawMoreLegibly = object_getInstanceVariable(self, "_drawMoreLegibly", NULL);
1257 Ivar ivar = object_getInstanceVariable(self, "_inDock", reinterpret_cast<void **>(&docked));
1258 docked = (docked & (ivar_getOffset(ivar) == ivar_getOffset(drawMoreLegibly) ? 0x2 : 0x1)) != 0;
1260 NSString *label(MSHookIvar<NSString *>(self, "_label"));
1262 NSString *style = [NSString stringWithFormat:@""
1263 "font-family: Helvetica; "
1264 "font-weight: bold; "
1266 "", (docked || !SummerBoard_ ? @"white" : @"#b3b3b3"), (IsWild_
1267 ? @"font-size: 12px; "
1268 : @"font-size: 11px; "
1272 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px 1px 0px; "];
1274 style = [style stringByAppendingString:@"text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px; "];
1276 bool ellipsis(false);
1277 float max = 75, width;
1279 width = [(ellipsis ? [label stringByAppendingString:@"..."] : label) sizeWithStyle:style forWidth:320].width;
1282 size_t length([label length]);
1283 float spacing((width - max) / (length - 1));
1285 if (spacing > 1.25) {
1287 label = [label substringToIndex:(length - 1)];
1291 style = [style stringByAppendingString:[NSString stringWithFormat:@"letter-spacing: -%f; ", spacing]];
1295 label = [label stringByAppendingString:@"..."];
1297 if (NSString *custom = [Info_ objectForKey:(docked ? @"DockedIconLabelStyle" : @"UndockedIconLabelStyle")])
1298 style = [style stringByAppendingString:custom];
1300 CGSize size = [label sizeWithStyle:style forWidth:bounds.size.width];
1301 [label drawAtPoint:CGPointMake((bounds.size.width - size.width) / 2, 0) withStyle:style];
1304 MSHook(void, CKMessageCell$addBalloonView$, id self, SEL sel, CKBalloonView *balloon) {
1305 _CKMessageCell$addBalloonView$(self, sel, balloon);
1306 [balloon setBackgroundColor:[UIColor clearColor]];
1309 MSHook(id, CKMessageCell$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1310 if ((self = _CKMessageCell$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1311 [[self contentView] setBackgroundColor:[UIColor clearColor]];
1315 MSHook(id, CKTimestampView$initWithStyle$reuseIdentifier$, id self, SEL sel, int style, NSString *reuse) {
1316 if ((self = _CKTimestampView$initWithStyle$reuseIdentifier$(self, sel, style, reuse)) != nil) {
1317 UILabel *&_label(MSHookIvar<UILabel *>(self, "_label"));
1318 [_label setBackgroundColor:[UIColor clearColor]];
1322 MSHook(void, CKTranscriptTableView$setSeparatorStyle$, id self, SEL sel, int style) {
1323 _CKTranscriptTableView$setSeparatorStyle$(self, sel, UITableViewCellSeparatorStyleNone);
1326 MSHook(id, CKTranscriptTableView$initWithFrame$style$, id self, SEL sel, CGRect frame, int style) {
1328 if ((self = _CKTranscriptTableView$initWithFrame$style$(self, sel, frame, style)) != nil) {
1329 [self setSeparatorStyle:UITableViewCellSeparatorStyleNone];
1333 MSHook(void, TranscriptController$loadView, mSMSMessageTranscriptController *self, SEL sel) {
1334 _TranscriptController$loadView(self, sel);
1336 if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]))
1337 if (UIImage *image = [[UIImage alloc] initWithContentsOfFile:path]) {
1338 [image autorelease];
1340 UIView *&_transcriptTable(MSHookIvar<UIView *>(self, "_transcriptTable"));
1341 UIView *&_transcriptLayer(MSHookIvar<UIView *>(self, "_transcriptLayer"));
1343 if (&_transcriptTable != NULL)
1344 table = _transcriptTable;
1345 else if (&_transcriptLayer != NULL)
1346 table = _transcriptLayer;
1350 UIView *placard(table != nil ? [table superview] : MSHookIvar<UIView *>(self, "_backPlacard"));
1351 UIImageView *background([[[UIImageView alloc] initWithImage:image] autorelease]);
1354 [placard insertSubview:background atIndex:0];
1356 [table setBackgroundColor:[UIColor clearColor]];
1357 [placard insertSubview:background belowSubview:table];
1362 MSHook(UIImage *, _UIImageWithName, NSString *name) {
1363 int id(_UISharedImageNameGetIdentifier(name));
1365 NSLog(@"WB:Debug: _UIImageWithName(\"%@\": %d)", name, id);
1368 return _UIImageAtPath(name, _UIKitBundle());
1370 NSNumber *key([NSNumber numberWithInt:id]);
1371 UIImage *image = [UIImages_ objectForKey:key];
1373 return reinterpret_cast<id>(image) == [NSNull null] ? _UISharedImageWithIdentifier(id) : image;
1374 if (NSString *path = $pathForFile$inBundle$(name, _UIKitBundle(), true)) {
1375 image = [[UIImage alloc] initWithContentsOfFile:path cache:true];
1377 [image autorelease];
1379 [UIImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1380 return image == nil ? _UISharedImageWithIdentifier(id) : image;
1384 MSHook(UIImage *, _UIImageWithNameInDomain, NSString *name, NSString *domain) {
1385 NSString *key([NSString stringWithFormat:@"D:%zu%@%@", [domain length], domain, name]);
1386 UIImage *image([PathImages_ objectForKey:key]);
1388 return reinterpret_cast<id>(image) == [NSNull null] ? __UIImageWithNameInDomain(name, domain) : image;
1390 NSLog(@"WB:Debug: UIImageWithNameInDomain(\"%@\", \"%@\")", name, domain);
1391 if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Domains/%@/%@", domain, name]])) {
1392 image = [[UIImage alloc] initWithContentsOfFile:path];
1394 [image autorelease];
1396 [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];
1397 return image == nil ? __UIImageWithNameInDomain(name, domain) : image;
1400 MSHook(GSFontRef, GSFontCreateWithName, const char *name, GSFontSymbolicTraits traits, float size) {
1402 NSLog(@"WB:Debug: GSFontCreateWithName(\"%s\", %f)", name, size);
1403 if (NSString *font = [Info_ objectForKey:[NSString stringWithFormat:@"FontName-%s", name]])
1404 name = [font UTF8String];
1405 //if (NSString *scale = [Info_ objectForKey:[NSString stringWithFormat:@"FontScale-%s", name]])
1406 // size *= [scale floatValue];
1407 return _GSFontCreateWithName(name, traits, size);
1410 #define AudioToolbox "/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox"
1411 #define UIKit "/System/Library/Frameworks/UIKit.framework/UIKit"
1413 bool (*_Z24GetFileNameForThisActionmPcRb)(unsigned long a0, char *a1, bool &a2);
1415 MSHook(bool, _Z24GetFileNameForThisActionmPcRb, unsigned long a0, char *a1, bool &a2) {
1417 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %p, %u)", a0, a1, a2);
1418 bool value = __Z24GetFileNameForThisActionmPcRb(a0, a1, a2);
1420 NSLog(@"WB:Debug:GetFileNameForThisAction(%u, %s, %u) = %u", a0, value ? a1 : NULL, a2, value);
1423 NSString *path = [NSString stringWithUTF8String:a1];
1424 if ([path hasPrefix:@"/System/Library/Audio/UISounds/"]) {
1425 NSString *file = [path substringFromIndex:31];
1426 for (NSString *theme in themes_) {
1427 NSString *path([NSString stringWithFormat:@"%@/UISounds/%@", theme, file]);
1428 if ([Manager_ fileExistsAtPath:path]) {
1429 strcpy(a1, [path UTF8String]);
1438 static void ChangeWallpaper(
1439 CFNotificationCenterRef center,
1443 CFDictionaryRef info
1446 NSLog(@"WB:Debug:ChangeWallpaper!");
1449 if (WallpaperFile_ != nil) {
1450 image = [[UIImage alloc] initWithContentsOfFile:WallpaperFile_];
1452 image = [image autorelease];
1455 if (WallpaperImage_ != nil)
1456 [WallpaperImage_ setImage:image];
1457 if (WallpaperPage_ != nil)
1458 [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];
1462 #define WBRename(name, sel, imp) \
1463 _ ## name ## $ ## imp = MSHookMessage($ ## name, @selector(sel), &$ ## name ## $ ## imp)
1465 template <typename Type_>
1466 static void nlset(Type_ &function, struct nlist *nl, size_t index) {
1467 struct nlist &name(nl[index]);
1468 uintptr_t value(name.n_value);
1469 if ((name.n_desc & N_ARM_THUMB_DEF) != 0)
1470 value |= 0x00000001;
1471 function = reinterpret_cast<Type_>(value);
1474 template <typename Type_>
1475 static void dlset(Type_ &function, const char *name) {
1476 function = reinterpret_cast<Type_>(dlsym(RTLD_DEFAULT, name));
1479 /*static void WBImage(const struct mach_header* mh, intptr_t vmaddr_slide) {
1480 uint32_t count(_dyld_image_count());
1481 for (uint32_t index(0); index != count; ++index)
1482 if (_dyld_get_image_header(index) == mh) {
1483 CGImageSourceRef (*CGImageSourceCreateWithURL)(CFURLRef url, CFDictionaryRef options);
1484 dlset(CGImageSourceCreateWithURL, "CGImageSourceCreateWithURL");
1485 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1489 extern "C" void WBInitialize() {
1490 NSAutoreleasePool *pool([[NSAutoreleasePool alloc] init]);
1492 NSString *identifier([[NSBundle mainBundle] bundleIdentifier]);
1494 NSLog(@"WB:Notice: WinterBoard");
1496 dlset(_GSFontGetUseLegacyFontMetrics, "GSFontGetUseLegacyFontMetrics");
1498 //if ([NSBundle bundleWithIdentifier:@"com.apple.ImageIO.framework"] != nil)
1499 MSHookFunction(&CGImageSourceCreateWithURL, &$CGImageSourceCreateWithURL, &_CGImageSourceCreateWithURL);
1501 // _dyld_register_func_for_add_image(&WBImage);
1505 if ([NSBundle bundleWithIdentifier:@"com.apple.UIKit"] != nil) {
1507 memset(nl, 0, sizeof(nl));
1508 nl[0].n_un.n_name = (char *) "__UIApplicationImageWithName";
1509 nl[1].n_un.n_name = (char *) "__UIImageAtPath";
1510 nl[2].n_un.n_name = (char *) "__UIImageRefAtPath";
1511 nl[3].n_un.n_name = (char *) "__UIImageWithNameInDomain";
1512 nl[4].n_un.n_name = (char *) "__UIKitBundle";
1513 nl[5].n_un.n_name = (char *) "__UISharedImageNameGetIdentifier";
1514 nl[6].n_un.n_name = (char *) "__UISharedImageWithIdentifier";
1517 nlset(_UIApplicationImageWithName, nl, 0);
1518 nlset(_UIImageAtPath, nl, 1);
1519 nlset(_UIImageRefAtPath, nl, 2);
1520 nlset(_UIImageWithNameInDomain, nl, 3);
1521 nlset(_UIKitBundle, nl, 4);
1522 nlset(_UISharedImageNameGetIdentifier, nl, 5);
1523 nlset(_UISharedImageWithIdentifier, nl, 6);
1525 MSHookFunction(_UIApplicationImageWithName, &$_UIApplicationImageWithName, &__UIApplicationImageWithName);
1526 MSHookFunction(_UIImageRefAtPath, &$_UIImageRefAtPath, &__UIImageRefAtPath);
1527 MSHookFunction(_UIImageWithName, &$_UIImageWithName, &__UIImageWithName);
1528 MSHookFunction(_UIImageWithNameInDomain, &$_UIImageWithNameInDomain, &__UIImageWithNameInDomain);
1532 MSHookFunction(&GSFontCreateWithName, &$GSFontCreateWithName, &_GSFontCreateWithName);
1534 if (dlopen(AudioToolbox, RTLD_LAZY | RTLD_NOLOAD) != NULL) {
1537 memset(nl, 0, sizeof(nl));
1538 nl[0].n_un.n_name = (char *) "__Z24GetFileNameForThisActionmPcRb";
1539 nlist(AudioToolbox, nl);
1540 nlset(_Z24GetFileNameForThisActionmPcRb, nl, 0);
1541 MSHookFunction(_Z24GetFileNameForThisActionmPcRb, &$_Z24GetFileNameForThisActionmPcRb, &__Z24GetFileNameForThisActionmPcRb);
1545 $NSBundle = objc_getClass("NSBundle");
1547 _NSBundle$localizedStringForKey$value$table$ = MSHookMessage($NSBundle, @selector(localizedStringForKey:value:table:), &$NSBundle$localizedStringForKey$value$table$);
1548 _NSBundle$pathForResource$ofType$ = MSHookMessage($NSBundle, @selector(pathForResource:ofType:), &$NSBundle$pathForResource$ofType$);
1550 $UIImage = objc_getClass("UIImage");
1551 $UINavigationBar = objc_getClass("UINavigationBar");
1552 $UIToolbar = objc_getClass("UIToolbar");
1554 _UIImage$defaultDesktopImage = MSHookMessage(object_getClass($UIImage), @selector(defaultDesktopImage), &$UIImage$defaultDesktopImage);
1556 //WBRename("UINavigationBar", @selector(initWithCoder:), (IMP) &UINavigationBar$initWithCoder$);
1557 //WBRename("UINavigationBarBackground", @selector(initWithFrame:withBarStyle:withTintColor:), (IMP) &UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$);
1559 _UINavigationBar$setBarStyle$ = MSHookMessage($UINavigationBar, @selector(setBarStyle:), &$UINavigationBar$setBarStyle$);
1560 _UIToolbar$setBarStyle$ = MSHookMessage($UIToolbar, @selector(setBarStyle:), &$UIToolbar$setBarStyle$);
1562 Manager_ = [[NSFileManager defaultManager] retain];
1563 UIImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1564 PathImages_ = [[NSMutableDictionary alloc] initWithCapacity:16];
1565 Strings_ = [[NSMutableDictionary alloc] initWithCapacity:0];
1566 Bundles_ = [[NSMutableDictionary alloc] initWithCapacity:2];
1567 Themed_ = [[NSMutableDictionary alloc] initWithCapacity:128];
1569 themes_ = [[NSMutableArray alloc] initWithCapacity:8];
1571 if (NSDictionary *settings = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/User/Library/Preferences/com.saurik.WinterBoard.plist"]]) {
1572 // Load Settings {{{
1573 if (NSNumber *value = [settings objectForKey:@"SummerBoard"])
1574 SummerBoard_ = [value boolValue];
1575 if (NSNumber *value = [settings objectForKey:@"Debug"])
1576 Debug_ = [value boolValue];
1578 NSArray *themes([settings objectForKey:@"Themes"]);
1580 if (NSString *theme = [settings objectForKey:@"Theme"])
1581 themes = [NSArray arrayWithObject:[NSDictionary dictionaryWithObjectsAndKeys:
1583 [NSNumber numberWithBool:true], @"Active",
1587 for (NSDictionary *theme in themes) {
1588 NSNumber *active([theme objectForKey:@"Active"]);
1589 if (![active boolValue])
1592 NSString *name([theme objectForKey:@"Name"]);
1596 NSString *theme(nil);
1598 #define testForTheme(format...) \
1599 if (theme == nil) { \
1600 NSString *path = [NSString stringWithFormat:format]; \
1601 if ([Manager_ fileExistsAtPath:path]) { \
1602 [themes_ addObject:path]; \
1607 testForTheme(@"/Library/Themes/%@.theme", name)
1608 testForTheme(@"/Library/Themes/%@", name)
1609 testForTheme(@"%@/Library/SummerBoard/Themes/%@", NSHomeDirectory(), name)
1615 Info_ = [[NSMutableDictionary dictionaryWithCapacity:16] retain];
1617 for (NSString *theme in themes_)
1618 if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", theme]])
1619 for (NSString *key in [info allKeys])
1620 if ([Info_ objectForKey:key] == nil)
1621 [Info_ setObject:[info objectForKey:key] forKey:key];
1623 bool sms($getTheme$([NSArray arrayWithObjects:@"SMSBackground.png", @"SMSBackground.jpg", nil]) != nil);
1625 SpringBoard_ = [identifier isEqualToString:@"com.apple.springboard"];
1627 if ([NSBundle bundleWithIdentifier:@"com.apple.chatkit"] != nil)
1630 $CKMessageCell = objc_getClass("CKMessageCell");
1631 _CKMessageCell$addBalloonView$ = MSHookMessage($CKMessageCell, @selector(addBalloonView:), &$CKMessageCell$addBalloonView$);
1632 _CKMessageCell$initWithStyle$reuseIdentifier$ = MSHookMessage($CKMessageCell, @selector(initWithStyle:reuseIdentifier:), &$CKMessageCell$initWithStyle$reuseIdentifier$);
1634 $CKTranscriptTableView = objc_getClass("CKTranscriptTableView");
1635 _CKTranscriptTableView$setSeparatorStyle$ = MSHookMessage($CKTranscriptTableView, @selector(setSeparatorStyle:), &$CKTranscriptTableView$setSeparatorStyle$);
1636 _CKTranscriptTableView$initWithFrame$style$ = MSHookMessage($CKTranscriptTableView, @selector(initWithFrame:style:), &$CKTranscriptTableView$initWithFrame$style$);
1638 $CKTimestampView = objc_getClass("CKTimestampView");
1639 _CKTimestampView$initWithStyle$reuseIdentifier$ = MSHookMessage($CKTimestampView, @selector(initWithStyle:reuseIdentifier:), &$CKTimestampView$initWithStyle$reuseIdentifier$);
1641 $CKTranscriptController = objc_getClass("CKTranscriptController");
1642 _TranscriptController$loadView = MSHookMessage($CKTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1646 if ([identifier isEqualToString:@"com.apple.MobileSMS"]) {
1649 if (_TranscriptController$loadView == NULL) {
1650 Class mSMSMessageTranscriptController = objc_getClass("mSMSMessageTranscriptController");
1651 _TranscriptController$loadView = MSHookMessage(mSMSMessageTranscriptController, @selector(loadView), &$TranscriptController$loadView);
1655 } else if (SpringBoard_) {
1657 CFNotificationCenterAddObserver(
1658 CFNotificationCenterGetDarwinNotifyCenter(),
1659 NULL, &ChangeWallpaper, (CFStringRef) @"com.saurik.winterboard.lockbackground", NULL, 0
1662 if ($getTheme$([NSArray arrayWithObject:@"Wallpaper.mp4"]) != nil) {
1663 NSBundle *MediaPlayer([NSBundle bundleWithPath:@"/System/Library/Frameworks/MediaPlayer.framework"]);
1664 if (MediaPlayer != nil)
1667 $MPMoviePlayerController = objc_getClass("MPMoviePlayerController");
1668 $MPVideoView = objc_getClass("MPVideoView");
1671 $WebCoreFrameBridge = objc_getClass("WebCoreFrameBridge");
1673 $SBApplication = objc_getClass("SBApplication");
1674 $SBApplicationIcon = objc_getClass("SBApplicationIcon");
1675 $SBAwayView = objc_getClass("SBAwayView");
1676 $SBBookmarkIcon = objc_getClass("SBBookmarkIcon");
1677 $SBButtonBar = objc_getClass("SBButtonBar");
1678 $SBCalendarIconContentsView = objc_getClass("SBCalendarIconContentsView");
1679 $SBIcon = objc_getClass("SBIcon");
1680 $SBIconBadge = objc_getClass("SBIconBadge");
1681 $SBIconController = objc_getClass("SBIconController");
1682 $SBIconLabel = objc_getClass("SBIconLabel");
1683 $SBIconList = objc_getClass("SBIconList");
1684 $SBIconModel = objc_getClass("SBIconModel");
1685 //$SBImageCache = objc_getClass("SBImageCache");
1686 $SBSearchView = objc_getClass("SBSearchView");
1687 $SBSearchTableViewCell = objc_getClass("SBSearchTableViewCell");
1688 $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView");
1689 $SBStatusBarController = objc_getClass("SBStatusBarController");
1690 $SBStatusBarOperatorNameView = objc_getClass("SBStatusBarOperatorNameView");
1691 $SBStatusBarTimeView = objc_getClass("SBStatusBarTimeView");
1692 $SBUIController = objc_getClass("SBUIController");
1693 $SBWidgetApplicationIcon = objc_getClass("SBWidgetApplicationIcon");
1695 WBRename(WebCoreFrameBridge, renderedSizeOfNode:constrainedToWidth:, renderedSizeOfNode$constrainedToWidth$);
1698 WBRename(SBApplication, pathForIcon, pathForIcon);
1699 WBRename(SBApplicationIcon, icon, icon);
1700 WBRename(SBApplicationIcon, generateIconImage:, generateIconImage$);
1703 WBRename(SBBookmarkIcon, icon, icon);
1704 WBRename(SBButtonBar, didMoveToSuperview, didMoveToSuperview);
1705 WBRename(SBCalendarIconContentsView, drawRect:, drawRect$);
1706 WBRename(SBIcon, setAlpha:, setAlpha$);
1707 WBRename(SBIconBadge, initWithBadge:, initWithBadge$);
1708 WBRename(SBIconController, noteNumberOfIconListsChanged, noteNumberOfIconListsChanged);
1709 WBRename(SBUIController, init, init);
1710 WBRename(SBWidgetApplicationIcon, icon, icon);
1712 WBRename(SBIconLabel, drawRect:, drawRect$);
1713 WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$);
1714 WBRename(SBIconLabel, setInDock:, setInDock$);
1716 WBRename(SBIconList, setFrame:, setFrame$);
1718 WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$);
1719 WBRename(SBIconModel, cacheImagesForIcon:, cacheImagesForIcon$);
1720 WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$);
1721 WBRename(SBIconModel, getCachedImagedForIcon:smallIcon:, getCachedImagedForIcon$smallIcon$);
1723 WBRename(SBSearchView, initWithFrame:, initWithFrame$);
1724 WBRename(SBSearchTableViewCell, drawRect:, drawRect$);
1725 WBRename(SBSearchTableViewCell, initWithStyle:reuseIdentifier:, initWithStyle$reuseIdentifier$);
1727 //WBRename(SBImageCache, initWithName:forImageWidth:imageHeight:initialCapacity:, initWithName$forImageWidth$imageHeight$initialCapacity$);
1729 WBRename(SBAwayView, updateDesktopImage:, updateDesktopImage$);
1730 WBRename(SBStatusBarContentsView, didMoveToSuperview, didMoveToSuperview);
1731 //WBRename(SBStatusBarContentsView, initWithStatusBar:mode:, initWithStatusBar$mode$);
1732 //WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:animation:, setStatusBarMode$orientation$duration$animation$);
1733 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:, setStatusBarMode$orientation$duration$fenceID$animation$);
1734 WBRename(SBStatusBarController, setStatusBarMode:orientation:duration:fenceID:animation:startTime:, setStatusBarMode$orientation$duration$fenceID$animation$startTime$);
1735 WBRename(SBStatusBarOperatorNameView, operatorNameStyle, operatorNameStyle);
1736 WBRename(SBStatusBarOperatorNameView, setOperatorName:fullSize:, setOperatorName$fullSize$);
1737 WBRename(SBStatusBarTimeView, drawRect:, drawRect$);
1740 English_ = [[NSDictionary alloc] initWithContentsOfFile:@"/System/Library/CoreServices/SpringBoard.app/English.lproj/LocalizedApplicationNames.strings"];
1742 Cache_ = [[NSMutableDictionary alloc] initWithCapacity:64];
1746 Wallpapers_ = [[NSArray arrayWithObjects:@"Wallpaper.mp4", @"Wallpaper.png", @"Wallpaper.jpg", @"Wallpaper.html", nil] retain];
1747 Papered_ = $getTheme$(Wallpapers_) != nil;
1749 if ([Info_ objectForKey:@"UndockedIconLabels"] == nil)
1750 [Info_ setObject:[NSNumber numberWithBool:(
1752 [Info_ objectForKey:@"DockedIconLabelStyle"] != nil ||
1753 [Info_ objectForKey:@"UndockedIconLabelStyle"] != nil
1754 )] forKey:@"UndockedIconLabels"];
1757 NSLog(@"WB:Debug:Info = %@", [Info_ description]);