⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library.mm

📁 iPhone winterboard - theme customizer
💻 MM
📖 第 1 页 / 共 4 页
字号:
}static UIImage *UIImage$imageNamed$inBundle$(Class<WinterBoard> self, SEL sel, NSString *name, NSBundle *bundle) {    NSString *key = [NSString stringWithFormat:@"B:%@/%@", [bundle bundleIdentifier], name];    UIImage *image = [PathImages_ objectForKey:key];    if (image != nil)        return reinterpret_cast<id>(image) == [NSNull null] ? nil : image;    if (Debug_)        NSLog(@"WB:Debug: [UIImage(%@) imageNamed:\"%@\"]", [bundle bundleIdentifier], name);    if (NSString *path = $pathForFile$inBundle$(name, bundle, false))        image = CachedImageAtPath(path);    if (image == nil)        image = [self wb$imageNamed:name inBundle:bundle];    [PathImages_ setObject:(image == nil ? [NSNull null] : reinterpret_cast<id>(image)) forKey:key];    return image;}static UIImage *UIImage$imageNamed$(Class<WinterBoard> self, SEL sel, NSString *name) {    return UIImage$imageNamed$inBundle$(self, sel, name, [NSBundle mainBundle]);}static UIImage *UIImage$applicationImageNamed$(Class<WinterBoard> self, SEL sel, NSString *name) {    NSBundle *bundle = [NSBundle mainBundle];    if (Debug_)        NSLog(@"WB:Debug: [UIImage(%@) applicationImageNamed:\"%@\"]", [bundle bundleIdentifier], name);    if (NSString *path = $pathForFile$inBundle$(name, bundle, false))        return CachedImageAtPath(path);    return [self wb$applicationImageNamed:name];}@interface NSString (WinterBoard)- (NSString *) wb$themedPath;@end@implementation NSString (WinterBoard)- (NSString *) wb$themedPath {    if (Debug_)        NSLog(@"WB:Debug:Bypass(\"%@\")", self);    if (NSBundle *bundle = [NSBundle mainBundle]) {        NSString *prefix([bundle bundlePath]);        if ([self hasPrefix:prefix]) {            NSUInteger length([prefix length]);            if (length != [self length])                if (NSString *path = $pathForFile$inBundle$([self substringFromIndex:(length + 1)], bundle, false))                    return path;        }    }    return self;}@end#define WBDelegate(delegate) \    - (NSMethodSignature*) methodSignatureForSelector:(SEL)sel { \        if (Engineer_) \            NSLog(@"WB:MS:%s:(%s)", class_getName([self class]), sel_getName(sel)); \        if (NSMethodSignature *sig = [delegate methodSignatureForSelector:sel]) \            return sig; \        NSLog(@"WB:Error: [%s methodSignatureForSelector:(%s)]", class_getName([self class]), sel_getName(sel)); \        return nil; \    } \\    - (void) forwardInvocation:(NSInvocation*)inv { \        SEL sel = [inv selector]; \        if ([delegate respondsToSelector:sel]) \            [inv invokeWithTarget:delegate]; \        else \            NSLog(@"WB:Error: [%s forwardInvocation:(%s)]", class_getName([self class]), sel_getName(sel)); \    }static NSString *NSBundle$pathForResource$ofType$(NSBundle<WinterBoard> *self, SEL sel, NSString *resource, NSString *type) {    NSString *file = type == nil ? resource : [NSString stringWithFormat:@"%@.%@", resource, type];    if (Debug_)        NSLog(@"WB:Debug: [NSBundle(%@) pathForResource:\"%@\"]", [self bundleIdentifier], file);    if (NSString *path = $pathForFile$inBundle$(file, self, false))        return path;    return [self wb$pathForResource:resource ofType:type];}static bool $setBarStyle$_(NSString *name, UIView<WinterBoard> *self, int style) {    if (Debug_)        NSLog(@"WB:Debug:%@Style:%d", name, style);    NSNumber *number = nil;    if (number == nil)        number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style-%d", name, style]];    if (number == nil)        number = [Info_ objectForKey:[NSString stringWithFormat:@"%@Style", name]];    if (number == nil)        return false;    else {        style = [number intValue];        if (Debug_)            NSLog(@"WB:Debug:%@Style=%d", name, style);        [self wb$setBarStyle:style];        return true;    }}static void SBCalendarIconContentsView$drawRect$(SBCalendarIconContentsView<WinterBoard> *self, SEL sel, CGRect rect) {    NSBundle *bundle([NSBundle mainBundle]);    CFLocaleRef locale(CFLocaleCopyCurrent());    CFDateFormatterRef formatter(CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle));    CFRelease(locale);    CFDateRef now(CFDateCreate(NULL, CFAbsoluteTimeGetCurrent()));    CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NUMBER_FORMAT" value:@"" table:@"SpringBoard"]);    CFStringRef date(CFDateFormatterCreateStringWithDate(NULL, formatter, now));    CFDateFormatterSetFormat(formatter, (CFStringRef) [bundle localizedStringForKey:@"CALENDAR_ICON_DAY_NAME_FORMAT" value:@"" table:@"SpringBoard"]);    CFStringRef day(CFDateFormatterCreateStringWithDate(NULL, formatter, now));    CFRelease(now);    CFRelease(formatter);    NSString *datestyle(@""        "font-family: Helvetica; "        "font-weight: bold; "        "font-size: 39px; "        "color: #333333; "        "alpha: 1.0; "    "");    NSString *daystyle(@""        "font-family: Helvetica; "        "font-weight: bold; "        "font-size: 9px; "        "color: white; "        "text-shadow: rgba(0, 0, 0, 0.2) -1px -1px 2px; "    "");    if (NSString *style = [Info_ objectForKey:@"CalendarIconDateStyle"])        datestyle = [datestyle stringByAppendingString:style];    if (NSString *style = [Info_ objectForKey:@"CalendarIconDayStyle"])        daystyle = [daystyle stringByAppendingString:style];    float width([self bounds].size.width);    float leeway(10);    CGSize datesize = [(NSString *)date sizeWithStyle:datestyle forWidth:(width + leeway)];    CGSize daysize = [(NSString *)day sizeWithStyle:daystyle forWidth:(width + leeway)];    [(NSString *)date drawAtPoint:CGPointMake(        (width + 1 - datesize.width) / 2, (71 - datesize.height) / 2    ) withStyle:datestyle];    [(NSString *)day drawAtPoint:CGPointMake(        (width + 1 - daysize.width) / 2, (16 - daysize.height) / 2    ) withStyle:daystyle];    CFRelease(date);    CFRelease(day);}/*static id UINavigationBarBackground$initWithFrame$withBarStyle$withTintColor$(UINavigationBarBackground<WinterBoard> *self, SEL sel, CGRect frame, int style, UIColor *tint) {    _trace();    if (NSNumber *number = [Info_ objectForKey:@"NavigationBarStyle"])        style = [number intValue];    if (UIColor *color = [Info_ colorForKey:@"NavigationBarTint"])        tint = color;    return [self wb$initWithFrame:frame withBarStyle:style withTintColor:tint];}*//*static id UINavigationBar$initWithCoder$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame, NSCoder *coder) {    self = [self wb$initWithCoder:coder];    if (self == nil)        return nil;    UINavigationBar$setBarStyle$_(self);    return self;}static id UINavigationBar$initWithFrame$(SBAppWindow<WinterBoard> *self, SEL sel, CGRect frame) {    self = [self wb$initWithFrame:frame];    if (self == nil)        return nil;    UINavigationBar$setBarStyle$_(self);    return self;}*/static void UIToolbar$setBarStyle$(UIToolbar<WinterBoard> *self, SEL sel, int style) {    if ($setBarStyle$_(@"Toolbar", self, style))        return;    return [self wb$setBarStyle:style];}static void UINavigationBar$setBarStyle$(UINavigationBar<WinterBoard> *self, SEL sel, int style) {    if ($setBarStyle$_(@"NavigationBar", self, style))        return;    return [self wb$setBarStyle:style];}static void $didMoveToSuperview(SBButtonBar<WinterBoard> *self, SEL sel) {    [[self superview] setBackgroundColor:[UIColor clearColor]];    [self wb$didMoveToSuperview];}static id UIImage$imageAtPath$(NSObject<WinterBoard> *self, SEL sel, NSString *path) {    return [self wb$imageAtPath:[path wb$themedPath]];}static id $initWithContentsOfFile$(NSObject<WinterBoard> *self, SEL sel, NSString *file) {    return [self wb$initWithContentsOfFile:[file wb$themedPath]];}static id UIImage$initWithContentsOfFile$cache$(UIImage<WinterBoard> *self, SEL sel, NSString *file, BOOL cache) {    return [self wb$initWithContentsOfFile:[file wb$themedPath] cache:cache];}static UIImage *UIImage$defaultDesktopImage$(UIImage<WinterBoard> *self, SEL sel) {    if (Debug_)        NSLog(@"WB:Debug:DefaultDesktopImage");    if (NSString *path = $getTheme$([NSArray arrayWithObjects:@"LockBackground.png", @"LockBackground.jpg", nil]))        return [UIImage imageWithContentsOfFile:path];    return [self wb$defaultDesktopImage];}static NSArray *Wallpapers_;static NSString *WallpaperFile_;static UIImageView *WallpaperImage_;static UIWebDocumentView *WallpaperPage_;static NSURL *WallpaperURL_;#define _release(object) \    do if (object != nil) { \        [object release]; \        object = nil; \    } while (false)static id SBContentLayer$initWithSize$(SBContentLayer<WinterBoard> *self, SEL sel, CGSize size) {    self = [self wb$initWithSize:size];    if (self == nil)        return nil;    _release(WallpaperFile_);    _release(WallpaperImage_);    _release(WallpaperPage_);    _release(WallpaperURL_);    if (NSString *theme = $getTheme$(Wallpapers_, true)) {        NSString *mp4 = [theme stringByAppendingPathComponent:@"Wallpaper.mp4"];        if ([Manager_ fileExistsAtPath:mp4]) {            MPVideoView *video = [[[$MPVideoView alloc] initWithFrame:[self bounds]] autorelease];            [video setMovieWithPath:mp4];            [video setRepeatMode:1];            [video setRepeatGap:0];            [self addSubview:video];            [video playFromBeginning];;        }        NSString *png = [theme stringByAppendingPathComponent:@"Wallpaper.png"];        NSString *jpg = [theme stringByAppendingPathComponent:@"Wallpaper.jpg"];        NSString *path;        if ([Manager_ fileExistsAtPath:png])            path = png;        else if ([Manager_ fileExistsAtPath:jpg])            path = jpg;        else path = nil;        UIImage *image;        if (path != nil) {            image = [[UIImage alloc] wb$initWithContentsOfFile:path];            if (image != nil)                image = [image autorelease];        } else image = nil;        if (image != nil) {            WallpaperFile_ = [path retain];            WallpaperImage_ = [[UIImageView alloc] initWithImage:image];            [self addSubview:WallpaperImage_];        }        NSString *html = [theme stringByAppendingPathComponent:@"Wallpaper.html"];        if ([Manager_ fileExistsAtPath:html]) {            CGRect bounds = [self bounds];            UIWebDocumentView *view([[[UIWebDocumentView alloc] initWithFrame:bounds] autorelease]);            [view setAutoresizes:true];            WallpaperPage_ = [view retain];            WallpaperURL_ = [[NSURL fileURLWithPath:html] retain];            [WallpaperPage_ loadRequest:[NSURLRequest requestWithURL:WallpaperURL_]];            [[view webView] setDrawsBackground:false];            [view setBackgroundColor:[UIColor clearColor]];            [self addSubview:view];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -