From ece3fb524651229027f66cee8025a4325b079f23 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 21 Jun 2010 10:38:53 +0000 Subject: [PATCH] Support iOS 4.0. --- Tweak.mm | 31 +++++++++++++++++++++++++++++++ control | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Tweak.mm b/Tweak.mm index abe8c3a..9f492cb 100644 --- a/Tweak.mm +++ b/Tweak.mm @@ -3,14 +3,22 @@ #import #import #import + #import #import #import +@interface SBDockIconListView : NSObject { +} +- (NSArray *) icons; +@end + MSClassHook(SBButtonBar) +MSClassHook(SBDockIconListView) MSClassHook(SBIcon) MSClassHook(SBIconModel) +MSMetaClassHook(SBDockIconListView) MSMetaClassHook(SBIconModel) MSInstanceMessageHook1(float, SBButtonBar, leftMarginForIconRowArray, NSArray *, row) { @@ -21,6 +29,10 @@ MSInstanceMessageHook0(int, SBButtonBar, maxIconColumns) { return 5; } +MSClassMessageHook1(int, SBDockIconListView, iconColumnsForInterfaceOrientation, int, orientation) { + return 5; +} + static unsigned $SBButtonBar$count(SBButtonBar *self) { MSIvarHook(NSArray *, _iconMatrix); NSArray *row([_iconMatrix objectAtIndex:0]); @@ -71,6 +83,25 @@ MSInstanceMessageHook2(CGPoint, SBButtonBar, originForIconAtX,Y, int, x, int, y) return origin; } +// XXX: merge with previous function if possible, but not until after iPhone 4 +MSInstanceMessageHook2(CGPoint, SBDockIconListView, originForIconAtX,Y, int, x, int, y) { + CGPoint origin;//(MSOldCall(x, y, )); + //NSLog(@"f:%u,%u=(%f,%f)", x, y, origin.x, origin.y); + origin.y = 11; + + unsigned count([[self icons] count]), gap; + unsigned space(320 - 60 * count); + + if (count >= 4) + gap = space / (count + 1); + else // I hate people who love Apple. + gap = 16; + + origin.x = (space - gap * (count - 1)) / 2 + (60 + gap) * x; + + return origin; +} + /*MSClassMessageHook0(int, SBIconModel, maxIconListCount) { return 16; }*/ diff --git a/control b/control index 9a50793..3b6540a 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: optional Section: Tweaks Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.3184-1 +Version: 0.9.3202-1 Description: fits even more stuff right down there Name: Five Icon Dock Depends: mobilesubstrate (>= 0.9.3005-1), firmware (>= 2.2) -- 2.47.2