From a8d008e485cdbfd2dc55348e1a229f5bdb9d06aa Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 4 Jan 2009 03:22:01 +0000 Subject: [PATCH] Root page papers at top of screen. --- Library.mm | 51 ++++++++++++++++++++++++++++++++++++++++++--------- control | 2 +- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/Library.mm b/Library.mm index e46acb6..c65b182 100644 --- a/Library.mm +++ b/Library.mm @@ -59,6 +59,7 @@ #import #import #import +#import #import #import #import @@ -101,6 +102,7 @@ Class $SBContentLayer; Class $SBIconBadge; Class $SBIconController; Class $SBIconLabel; +Class $SBIconList; Class $SBIconModel; Class $SBSlidingAlertDisplay; Class $SBStatusBarContentsView; @@ -856,29 +858,54 @@ MSHook(void, SBStatusBarTimeView$drawRect$, SBStatusBarTimeView *self, SEL sel, } @interface UIView (WinterBoard) -- (bool) wb$isImageView; +- (bool) wb$isWBImageView; @end @implementation UIView (WinterBoard) -- (bool) wb$isImageView { +- (bool) wb$isWBImageView { return false; } @end -@interface UIImageView (WinterBoard) -- (bool) wb$isImageView; +@interface WBImageView : UIImageView { +} + +- (bool) wb$isWBImageView; +- (void) wb$updateFrame; @end -@implementation UIImageView (WinterBoard) +@implementation WBImageView -- (bool) wb$isImageView { +- (bool) wb$isWBImageView { return true; } +- (void) wb$updateFrame { + CGRect frame([self frame]); + frame.origin.y = 0; + + for (UIView *view(self); ; ) { + view = [view superview]; + if (view == nil) + break; + frame.origin.y -= [view frame].origin.y; + } + + [self setFrame:frame]; +} + @end +MSHook(void, SBIconList$setFrame$, SBIconList *self, SEL sel, CGRect frame) { + NSArray *subviews([self subviews]); + WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]); + if (view != nil && [view wb$isWBImageView]) + [view wb$updateFrame]; + _SBIconList$setFrame$(self, sel, frame); +} + MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *self, SEL sel) { SBIconModel *&_iconModel(MSHookIvar(self, "_iconModel")); NSArray *lists([_iconModel iconLists]); @@ -887,13 +914,16 @@ MSHook(void, SBIconController$noteNumberOfIconListsChanged, SBIconController *se if (NSString *path = $getTheme$([NSArray arrayWithObject:[NSString stringWithFormat:@"Page%u.png", i]])) { SBIconList *list([lists objectAtIndex:i]); NSArray *subviews([list subviews]); - UIImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]); - if (view == nil || ![view wb$isImageView]) { - view = [[[UIImageView alloc] init] autorelease]; + + WBImageView *view([subviews count] == 0 ? nil : [subviews objectAtIndex:0]); + if (view == nil || ![view wb$isWBImageView]) { + view = [[[WBImageView alloc] init] autorelease]; [list insertSubview:view atIndex:0]; } + UIImage *image([UIImage imageWithContentsOfFile:path]); [view setImage:image]; + [view wb$updateFrame]; } return _SBIconController$noteNumberOfIconListsChanged(self, sel); @@ -1263,6 +1293,7 @@ extern "C" void WBInitialize() { $SBIconBadge = objc_getClass("SBIconBadge"); $SBIconController = objc_getClass("SBIconController"); $SBIconLabel = objc_getClass("SBIconLabel"); + $SBIconList = objc_getClass("SBIconList"); $SBIconModel = objc_getClass("SBIconModel"); $SBSlidingAlertDisplay = objc_getClass("SBSlidingAlertDisplay"); $SBStatusBarContentsView = objc_getClass("SBStatusBarContentsView"); @@ -1287,6 +1318,8 @@ extern "C" void WBInitialize() { WBRename(SBIconLabel, initWithSize:label:, initWithSize$label$); WBRename(SBIconLabel, setInDock:, setInDock$); + WBRename(SBIconList, setFrame:, setFrame$); + WBRename(SBIconModel, cacheImageForIcon:, cacheImageForIcon$); WBRename(SBIconModel, getCachedImagedForIcon:, getCachedImagedForIcon$); diff --git a/control b/control index 820dd3c..57a8e3d 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: optional Section: System Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.2694-1 +Version: 0.9.2695-1 Description: more powerful, open-source SummerBoard Name: WinterBoard Depends: mobilesubstrate (>= 0.9.2660-1) -- 2.45.2