Permalink
Browse files

Merge branch 'master' of github.com:tomcool420/SMFramework

  • Loading branch information...
2 parents 1ee2ef1 + cfda17e commit 8a4da763556212ec965c4952a7fdcf8cd0a5e499 @tomcool420 committed Sep 25, 2011
Showing with 1,476 additions and 187 deletions.
  1. +1 −0 .gitignore
  2. +5 −4 Makefile
  3. +26 −0 SMFAnimation.h
  4. +137 −0 SMFAnimation.m
  5. +4 −2 SMFComplexDropShadowControl.h
  6. +59 −10 SMFComplexDropShadowControl.mm
  7. +2 −0 SMFDefines.h
  8. +30 −0 SMFDropShadowControl.h
  9. +261 −0 SMFDropShadowControl.m
  10. +12 −0 SMFListDropShadowControl.h
  11. +205 −4 SMFListDropShadowControl.m
  12. +4 −0 SMFMenuItem.h
  13. +14 −1 SMFMenuItem.m
  14. +22 −0 SMFMockMenuItem.h
  15. +16 −0 SMFMockMenuItem.m
  16. +9 −9 SMFMoviePreviewController.m
  17. +2 −2 SMFPopup.mm
  18. +1 −1 SMFScreenCapture.h
  19. +7 −0 SMFScreenCapture.m
  20. +2 −2 SMFTextDropShadowControl.h
  21. +8 −8 SMFTextDropShadowControl.mm
  22. +24 −0 SMFramework.xcodeproj/project.pbxproj
  23. +2 −2 _/DEBIAN/control
  24. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/BRMenuItem_SMF.h
  25. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFBaseAsset.h
  26. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFCenteredMenuController.h
  27. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFClockController.h
  28. +56 −25 _/Library/Frameworks/SMFramework.framework/Headers/SMFCommonTools.h
  29. +6 −6 _/Library/Frameworks/SMFramework.framework/Headers/SMFController.h
  30. +2 −0 _/Library/Frameworks/SMFramework.framework/Headers/SMFDefines.h
  31. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEvent.h
  32. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEventConfiguration.h
  33. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFEventManager.h
  34. +44 −40 _/Library/Frameworks/SMFramework.framework/Headers/SMFFolderBrowser.h
  35. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFFolderDelegate.h
  36. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFInvocationCenteredMenuController.h
  37. +34 −16 _/Library/Frameworks/SMFramework.framework/Headers/SMFMediaMenuController.h
  38. +68 −4 _/Library/Frameworks/SMFramework.framework/Headers/SMFMediaPreview.h
  39. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFMenuController.h
  40. +5 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFMenuItem.h
  41. +61 −5 _/Library/Frameworks/SMFramework.framework/Headers/SMFPasscodeController.h
  42. +110 −13 _/Library/Frameworks/SMFramework.framework/Headers/SMFPhotoMethods.h
  43. +1 −1 _/Library/Frameworks/SMFramework.framework/Headers/SMFProgressBarControl.h
  44. +7 −2 _/Library/Frameworks/SMFramework.framework/Headers/SMFQueryMenu.h
  45. +2 −2 _/Library/Frameworks/SMFramework.framework/Headers/SMFScreenCapture.h
  46. +196 −12 _/Library/Frameworks/SMFramework.framework/Headers/SMFThemeInfo.h
  47. +16 −2 _/Library/Frameworks/SMFramework.framework/Headers/SMFramework.h
  48. BIN _/Library/Frameworks/SMFramework.framework/SMFramework
  49. BIN _/Library/MobileSubstrate/DynamicLibraries/EventCatcher.dylib
  50. +2 −0 atvTwo_Prefix.pch
  51. +1 −1 control
  52. +2 −2 eventcatcher/Makefile
  53. BIN eventcatcher/obj/EventCatcher.dylib
  54. BIN eventcatcher/obj/Tweak.xm.o
  55. 0 obj/.stamp
  56. BIN obj/BRMenuItem_SMF.m.o
  57. BIN obj/SMFBaseAsset.m.o
  58. BIN obj/SMFCenteredMenuController.m.o
  59. BIN obj/SMFClockController.m.o
  60. BIN obj/SMFEvent.m.o
  61. BIN obj/SMFEventConfiguration.m.o
  62. BIN obj/SMFEventManager.m.o
  63. BIN obj/SMFFolderBrowser.m.o
  64. BIN obj/SMFInvocationCenteredMenuController.m.o
  65. BIN obj/SMFMediaMenuController.m.o
  66. BIN obj/SMFMediaPreview.mm.o
  67. BIN obj/SMFMenuController.m.o
  68. BIN obj/SMFMenuItem.m.o
  69. BIN obj/SMFPasscodeController.m.o
  70. BIN obj/SMFPhotoMethods.mm.o
  71. BIN obj/SMFProgressBarControl.m.o
  72. BIN obj/SMFQueryMenu.m.o
  73. BIN obj/SMFScreenCapture.m.o
  74. BIN obj/SMFThemeInfo.m.o
  75. BIN obj/SMFramework
View
@@ -1,3 +1,4 @@
+obj
build
._*
*.deb
View
@@ -1,7 +1,7 @@
GO_EASY_ON_ME=1
-SDKVERSION=5.0
-FW_DEVICE_IP=test.local
-#FW_DEVICE_IP=appletv.local
+SDKVERSION=4.3
+#FW_DEVICE_IP=test.local
+FW_DEVICE_IP=appletv.local
first: clean package install
include $(THEOS)/makefiles/common.mk
@@ -16,6 +16,7 @@ SMFramework_FILES += SMFMoviePreviewController.m SMFControlFactory.m SMFAssetPr
SMFramework_FILES += SMFBookcaseController.m SMFComplexDropShadowControl.mm SMFComplexProcessDropShadowControl.m SMFPrefsMenuItem.m
SMFramework_FILES += SMFDictionaryEditor.m SMFDictionaryObjectEditor.m SMFCustomQueryMenu.m SMFPrefsSelectionItem.m
SMFramework_FILES += BRMediaShelfView_SMF.m
+SMFramework_FILES += SMFDropShadowControl.m SMFMockMenuItem.m SMFAnimation.m
SMFramework_FILES += Example/SMFExamples.m Example/SMFMoviePreviewDelegateAndDatasourceExample.m Example/SMFBookcaseDelegateAndDatasourceExample.m Example/SMFGridController.m
@@ -45,4 +46,4 @@ after-SMFramework-stage::
cp Backrow/*.h "$(FW_SHARED_BUNDLE_RESOURCE_PATH)/Headers/Backrow/"
rm -rf ../ATV2Includes/SMFramework
mkdir ../ATV2Includes/SMFramework
- cp -rf Headers/ ../ATV2Includes/SMFramework/
+ cp -rf Headers/ ../ATV2Includes/SMFramework/
View
@@ -0,0 +1,26 @@
+//
+// SMFAnimation.h
+// SMFramework
+//
+// Created by Kevin Bradley on 9/18/11.
+// Copyright 2011 nito, LLC. All rights reserved.
+//
+
+
+@interface SMFAnimation : NSObject {
+
+}
+
+
++ (CAAnimationGroup *)zoomOutFadedToRect:(CGRect)outRect;
++ (CAAnimationGroup *)zoomInFadedToRect:(CGRect)inRect;
++ (CABasicAnimation *)fadeInAnimation;
++ (CABasicAnimation *)fadeOutAnimation;
++ (CABasicAnimation *)zoomOutToRect:(CGRect)outRect;
++ (CABasicAnimation *)zoomInToRect:(CGRect)inRect;
+
+ //deprecated
++ (CABasicAnimation *)zoomOutAnimation:(CATransform3D)zoomTransform;
++ (CABasicAnimation *)zoomInAnimation:(CATransform3D)zoomTransform;
+
+@end
View
@@ -0,0 +1,137 @@
+//
+// SMFAnimation.m
+// SMFramework
+//
+// Created by Kevin Bradley on 9/18/11.
+// Copyright 2011 nito, LLC. All rights reserved.
+//
+
+#import "SMFAnimation.h"
+
+#define ZOOM_TO_BOUNDS CGRectMake(0, 0, 108, 108)
+#define ZOOM_TO_POINT CGPointMake(591.5999755859375, 284.39999389648438)
+
+/*
+
+ This class kind of a lazy convience "work in progress", the animations are geared solely to the SMFDropShadowControl classes/subclasses
+
+ you also need to account for - (void)setZoomInPosition when zooming in and out manually, to see an implementation of these animations take a look at SMFDropShadowControl in
+
+ -(void)addToController:(BRController *)ctrl and - (void)removeFromParent
+
+ this is far from elegant right now, but works quite nicely.
+
+ */
+
+
+@implementation SMFAnimation
+
+
++ (CAAnimationGroup *)zoomOutFadedToRect:(CGRect)outRect
+{
+ CAAnimationGroup *outAnimation = [CAAnimationGroup animation];
+ [outAnimation setAnimations:[NSArray arrayWithObjects:[SMFAnimation zoomOutToRect:outRect], [SMFAnimation fadeOutAnimation], nil]];
+ outAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
+ outAnimation.fillMode = kCAFillModeForwards; //if you dont set this it reverts to its old mode before removing and looks really stupid.
+ outAnimation.removedOnCompletion = NO;
+ return outAnimation;
+
+}
+
++ (CAAnimationGroup *)zoomInFadedToRect:(CGRect)inRect
+{
+ CAAnimationGroup *outAnimation = [CAAnimationGroup animation];
+ [outAnimation setAnimations:[NSArray arrayWithObjects:[SMFAnimation zoomInToRect:inRect], [SMFAnimation fadeInAnimation], nil]];
+ outAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
+ outAnimation.fillMode = kCAFillModeForwards; //if you dont set this it reverts to its old mode before removing and looks really stupid.
+ outAnimation.removedOnCompletion = NO;
+ return outAnimation;
+
+}
+
++ (CABasicAnimation *)fadeInAnimation
+{
+ CABasicAnimation *theAnimation =[CABasicAnimation animationWithKeyPath:@"opacity"];
+ theAnimation.fromValue=[NSNumber numberWithFloat:0.0];
+ theAnimation.toValue=[NSNumber numberWithFloat:1.0];
+ return theAnimation;
+}
+
++ (CABasicAnimation *)fadeOutAnimation
+{
+ CABasicAnimation *theAnimation =[CABasicAnimation animationWithKeyPath:@"opacity"];
+ theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
+ theAnimation.toValue=[NSNumber numberWithFloat:0.0];
+ return theAnimation;
+}
+
+
++ (CABasicAnimation *)zoomOutToRect:(CGRect)outRect
+{
+ CABasicAnimation *zoomOutAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ zoomOutAnimation.fromValue = [NSNumber numberWithInt:1.0];
+ if (CGRectEqualToRect(outRect, CGRectZero))
+ {
+ zoomOutAnimation.toValue = [NSValue valueWithCGRect:ZOOM_TO_BOUNDS];
+
+ } else {
+
+ zoomOutAnimation.toValue = [NSValue valueWithCGRect:outRect];
+
+ }
+
+ //zoomOutAnimation.duration = 0.25f;
+ return zoomOutAnimation;
+}
+
++ (CABasicAnimation *)zoomInToRect:(CGRect)inRect
+{
+ CABasicAnimation *zoomInAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ if (CGRectEqualToRect(inRect, CGRectZero))
+ {
+ zoomInAnimation.fromValue = [NSValue valueWithCGRect:ZOOM_TO_BOUNDS];
+
+ } else {
+
+ zoomInAnimation.fromValue = [NSValue valueWithCGRect:inRect];
+ }
+
+ zoomInAnimation.toValue = [NSNumber numberWithInt:1.0];
+ return zoomInAnimation;
+}
+
+
+/*
+
+ deprecated code left in for posterity / laziness (in case we ever decide to grapple with transforms, a refresher/reminder
+
+ */
+
++ (CABasicAnimation *)zoomOutAnimation:(CATransform3D)zoomTransform //edits the transform directly, so this cant be properly paired with other animations - deprecated
+{
+
+ CABasicAnimation *zoomOutAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ //[zoomOutAnimation setDelegate:SMFAnimation];
+ zoomOutAnimation.repeatCount = 0;
+ zoomOutAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
+ zoomOutAnimation.toValue = [NSValue valueWithCATransform3D:zoomTransform];
+ zoomOutAnimation.fillMode = kCAFillModeForwards;
+ zoomOutAnimation.removedOnCompletion = NO;
+ return zoomOutAnimation;
+
+}
+
+
++ (CABasicAnimation *)zoomInAnimation:(CATransform3D)zoomTransform
+{
+
+ CABasicAnimation *zoomInAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
+ zoomInAnimation.fromValue = [NSValue valueWithCATransform3D:zoomTransform];
+ zoomInAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
+ return zoomInAnimation;
+
+}
+
+
+
+@end
@@ -8,8 +8,9 @@
#import "Backrow/AppleTV.h"
#import "SMFProgressBarControl.h"
+#import "SMFDropShadowControl.h"
-@interface SMFComplexDropShadowControl : BRDropShadowControl {
+@interface SMFComplexDropShadowControl : SMFDropShadowControl {
BRControl *_bg;
BRScrollingTextBoxControl *_scrolling;
BRWaitSpinnerControl *_spinner;
@@ -35,7 +36,7 @@
@property(readwrite,assign)NSObject *delegate;
-(void)appendToText:(NSString *)t;
--(void)addToController:(BRController *)ctrl;
+ //-(void)addToController:(BRController *)ctrl;
-(void)setShowsProgressBar:(BOOL)shows;
-(void)setShowsWaitSpinner:(BOOL)spinner;
@@ -46,5 +47,6 @@
-(BOOL)blocking;
-(id)attributedStringForString:(NSString*)s;
-(void)updateHeader;
+- (void)removeBlueLozenge;
@end
@@ -11,6 +11,9 @@
#import "SMFDefines.h"
#import <substrate.h>
+#define SHRINK_RECT CGRectMake(270.0,85.0,730.0,530.0)
+
+
@implementation SMFComplexDropShadowControl
@synthesize title=_title;
@synthesize subtitle=_subtitle;
@@ -23,41 +26,53 @@ -(id)init
CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
[self setFrame:f];
_bg=[[BRControl alloc] init];
+
_progress=[[SMFProgressBarControl alloc]init];
_titleControl=[[BRMetadataTitleControl alloc]init];
_scrolling=[[BRScrollingTextBoxControl alloc]init];
_list=MSHookIvar<BRListControl *>(_scrolling, "_list");
+ [_list setSelectionLozengeStyle:0];
+ _list.avoidsCursor = TRUE;
+ _list.displaysSelectionWidget = FALSE;
self.backgroundColor=[[SMFThemeInfo sharedTheme]blackColor];
self.borderColor=[[SMFThemeInfo sharedTheme] whiteColor];
self.borderWidth=3.0;
- self.title=@"Installing SMFramework";
+ self.title=@" ";
self.subtitle=@" ";
[self setContent:_bg];
_text=[[NSMutableString alloc] initWithString:@" "];
[self addObserver:self forKeyPath:@"title" options:0 context:nil];
[self addObserver:self forKeyPath:@"subtitle" options:0 context:nil];
return self;
}
--(void)addToController:(BRController *)ctrl
+
+void logFrame(CGRect frame)
{
+ NSLog(@"{{%f, %f},{%f,%f}}",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height);
+}
- CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
- [self setFrame:f];
- [ctrl addControl:self];
- [ctrl setFocusedControl:self];
- [ctrl _setFocus:self];
+ //this is taken care of by the superclass now
-}
+//-(void)addToController:(BRController *)ctrl
+//{
+//
+// CGRect f = CGRectMake(256.0,72.0,768.0,576.0);//(s.width*0.2, s.height*0.1, s.width*0.6, s.height*0.8);
+// [self setFrame:f];
+// [ctrl addControl:self];
+// [ctrl setFocusedControl:self];
+// [ctrl _setFocus:self];
+//
+//}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)o change:(NSDictionary *)change context:(void *)context
{
if (o==self && [keyPath isEqualToString:@"title"]) {
- NSLog(@"changing title");
+ // NSLog(@"changing title");
[_titleControl setTitle:_title];
[_titleControl layoutSubcontrols];
}
else if(o==self && [keyPath isEqualToString:@"subtitle"])
{
- NSLog(@"changing subtitle");
+ // NSLog(@"changing subtitle");
[_titleControl setTitleSubtext:_subtitle];
[_titleControl layoutSubcontrols];
}
@@ -77,6 +92,7 @@ -(void)reload
[_scrolling setFrame:CGRectMake(0.0, pf.size.height*0.11, pf.size.width, pf.size.height*0.75f)];
[_scrolling setText:[self attributedStringForString:_text]];
[_bg addControl:_scrolling];
+
}
-(id)attributedStringForString:(NSString*)s
@@ -92,10 +108,43 @@ -(void)appendToText:(NSString *)t
[_scrolling setText:[self attributedStringForString:_text]];
[_list setSelection:([_list dataCount]-1)];
[_scrolling layoutSubcontrols];
+ [self _setFocus:nil];
+ [self setFocusedControl:nil];
+}
+
+- (void)removeBlueLozenge //thats (sort of) the weird thing going on when you use this controller in conjunction w/ SMFMoviePreviewController
+{
+ NSEnumerator *controlEnum = [[_list controls] objectEnumerator];
+ id current = nil;
+ while ((current = [controlEnum nextObject]))
+ {
+ NSString *currentClass = NSStringFromClass([current class]);
+ if ([currentClass isEqualToString:@"BRBlueGlowSelectionLozengeLayer"])
+ {
+
+ [current removeFromParent];
+
+ [_list layoutSubcontrols];
+ }
+ }
}
+
+
+//- (CGRect)focusCursorFrame
+//{
+// //right now i am just shrinking the rect down so its only noticable during its exit animation (which was a default animation that we have nothing to do w/)
+// return SHRINK_RECT;
+//}
+
-(void)controlWasActivated
{
[super controlWasActivated];
+ //NSArray *listControls = [_list controls];
+// if ([listControls count] > 1)
+// {
+// [self removeBlueLozenge];
+// }
+
[self reload];
}
-(void)setShowsProgressBar:(BOOL)shows
View
@@ -32,3 +32,5 @@ typedef enum {
kBREventRemoteActionHoldUp,
kBREventRemoteActionHoldDown,
} BREventRemoteAction;
+
+#define LOG_SELF NSLog(@"%@ %s", self, _cmd)
View
@@ -0,0 +1,30 @@
+//
+// SMFDropShadowControl.h
+// SMFramework
+//
+// Created by Kevin Bradley on 9/13/11.
+// Copyright 2011 nito, LLC. All rights reserved.
+//
+
+#import "Backrow/AppleTV.h"
+
+
+@interface SMFDropShadowControl : BRDropShadowControl {
+
+ BOOL isAnimated;
+ id sender;
+
+}
+
+@property (readwrite, assign) BOOL isAnimated;
+@property (nonatomic, retain) id sender;
+
+- (void)setZoomInPosition;
+- (void)setZoomOutPosition;
+
+- (void)updateSender;
+- (id)getListFromMenuItem:(id)menuItem;
+- (id)synthesizeMockItemFrom:(id)theSender withX:(float)xValue;
+- (id)synthesizeMockItem;
+
+@end
Oops, something went wrong.

0 comments on commit 8a4da76

Please sign in to comment.