Skip to content

Commit

Permalink
lots o' updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcool420 committed Dec 12, 2010
1 parent 3cd0c55 commit 2575a7f
Show file tree
Hide file tree
Showing 26 changed files with 827 additions and 46 deletions.
Binary file added Resources/Keyboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/btstack.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Resources/colorAppleTVNameImage.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions SMFColorSelectionMenu.h
@@ -0,0 +1,24 @@
//
// SMFColorSelectionMenu.h
// SMFramework
//
// Created by Thomas Cool on 11/22/10.
// Copyright 2010 tomcool.org. All rights reserved.
//

#import "SMFMediaMenuController.h"
#import <UIKit/UIColor.h>

@protocol SMFColorSelectionDelegate
-(void)colorSelected:(NSArray *)rgba forKey:(NSString *)key;
@end

@interface SMFColorSelectionMenu : SMFMediaMenuController {
id<SMFColorSelectionDelegate>delegate;
NSString *key;
NSArray *colors;
}
+(SMFColorSelectionMenu *)colorMenuForKey:(NSString *)k andDelegate:(id<SMFColorSelectionDelegate>)del;
@property (assign) id<SMFColorSelectionDelegate> delegate;
@property (retain) NSString * key;
@end
98 changes: 98 additions & 0 deletions SMFColorSelectionMenu.m
@@ -0,0 +1,98 @@
//
// SMFColorSelectionMenu.m
// SMFramework
//
// Created by Thomas Cool on 11/22/10.
// Copyright 2010 tomcool.org. All rights reserved.
//

#import "SMFColorSelectionMenu.h"
#import "SMFMenuItem.h"
#import "SMFBaseAsset.h"
#import "SMFMediaPreview.h"
#import "SMFThemeInfo.h"
#import <UIKit/UIColor.h>
#define SMFFloat(val) [NSNumber numberWithFloat:(val)]
#define SMFFloatString(val) [NSString stringWithFormat:@"%.1f",(val)]
@implementation SMFColorSelectionMenu
@synthesize delegate;
@synthesize key;
+(SMFColorSelectionMenu *)colorMenuForKey:(NSString *)k andDelegate:(id<SMFColorSelectionDelegate>)del
{
SMFColorSelectionMenu *col = [[SMFColorSelectionMenu alloc] init];
[col setDelegate:del];
[col setKey:k];
return [col autorelease];
}
static float red[]= {0.0,0.0,0.6,0.0,0.33,0.0,0.66,1.0,1.0,0.5,1.0,1.0,1.0};
static float green[]={0.0,0.0,0.4,1.0,0.33,1.0,0.66,0.0,0.5,0.0,0.0,1.0,1.0};
static float blue[] ={0.0,1.0,0.2,1.0,0.33,0.0,0.66,1.0,0.0,0.5,0.0,1.0,0.0};
-(id)previewControlForItem:(long)row
{
if (row>=[_items count])
return nil;
SMFMediaPreview *p = [[SMFMediaPreview alloc] init];
SMFBaseAsset *a = [[SMFBaseAsset alloc] init];
[a setCoverArt:[[SMFThemeInfo sharedTheme] colorAppleTVNameImage]];
[a setTitle:[self titleForRow:row]];
[a setCustomKeys:[NSArray arrayWithObjects:@"Red",@"Green",@"Blue",@"Alpha",nil]
forObjects:[NSArray arrayWithObjects:SMFFloatString(red[row]),SMFFloatString(green[row]),
SMFFloatString(blue[row]),SMFFloatString(1.0),nil]];
[p setAsset:a];
[a release];
return [p autorelease];
}

-(id)init
{
self=[super init];
if (self) {
[self setListTitle:@"Select A Color"];
NSArray *strings = [NSArray arrayWithObjects:@"Black",@"Blue",@"Brown",@"Cyan",@"Dark Gray",@"Green",
@"Light Gray",@"Magenta",@"Orange",@"Purple",@"Red",@"White",@"Yellow",nil];
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
for(int i=0;i<[strings count];i++)
{
//UIColor*c = [[[UIColor alloc] initWithRed:red[i] green:green[i] blue:blue[i] alpha:1.0] autorelease];
//NSLog(@"%@:%@",[strings objectAtIndex:i],c);
SMFMenuItem *it = [[SMFMenuItem alloc] init];
NSMutableDictionary *d = [[[BRThemeInfo sharedTheme]menuItemTextAttributes] mutableCopy];

const CGFloat myColor[] = {red[i], green[i], blue[i], 1.0};
CGColorRef color = CGColorCreate(rgb, myColor);

[d setObject:color forKey:@"CTForegroundColor"];
CGColorRelease(color);
[it setText:[strings objectAtIndex:i] withAttributes:d];
[d release];
[_items addObject:it];
[it release];
}
CGColorSpaceRelease(rgb);

}
return self;
}
-(void)itemSelected:(long)selected
{
if ([self.delegate conformsToProtocol:@protocol(SMFColorSelectionDelegate)])
{

NSArray *colorArray = [NSArray arrayWithObjects:
SMFFloat(red[selected]),
SMFFloat(green[selected]),
SMFFloat(blue[selected]),
SMFFloat(1.0),
nil];
[[self delegate] colorSelected:colorArray forKey:[self key]];
}
}
-(void)dealloc
{
[colors release];
colors=nil;
delegate=nil;
self.key=nil;
[super dealloc];
}
@end
10 changes: 10 additions & 0 deletions SMFCommonTools.h
Expand Up @@ -11,6 +11,16 @@
@interface SMFCommonTools : NSObject { @interface SMFCommonTools : NSObject {


} }
/*
* Returns a SMFPopupInfo to show using showPopup
* @arg1: an NSArray with 1-3 NSStrings inside (can be nil)
* @arg2: a BRImage (cannot be nil)
*/
+(id)popupControlWithLines:(NSArray *)array andImage:(BRImage *)image; +(id)popupControlWithLines:(NSArray *)array andImage:(BRImage *)image;

/*
* Displays a popup using the BRPopupManager
* @arg1: a popup created using popupControlwithLines:andImage:
*/
+(void)showPopup:(id)popup; +(void)showPopup:(id)popup;
@end @end
4 changes: 2 additions & 2 deletions SMFCommonTools.m
Expand Up @@ -19,12 +19,12 @@ +(id)popupControlWithLines:(NSArray *)array andImage:(BRImage *)image
NSDictionary *dict; NSDictionary *dict;
if (array==nil) { if (array==nil) {
dict = [NSDictionary dictionaryWithObjectsAndKeys: dict = [NSDictionary dictionaryWithObjectsAndKeys:
[[BRThemeInfo sharedTheme]geniusIcon],@"Image", image,@"Image",
nil]; nil];
} }
else { else {
dict = [NSDictionary dictionaryWithObjectsAndKeys: dict = [NSDictionary dictionaryWithObjectsAndKeys:
[[BRThemeInfo sharedTheme]geniusIcon],@"Image", image,@"Image",
array,@"Lines",nil]; array,@"Lines",nil];


} }
Expand Down
16 changes: 16 additions & 0 deletions SMFDebAsset.h
@@ -0,0 +1,16 @@
//
// SMFDebAsset.h
// SMFramework
//
// Created by Thomas Cool on 12/12/10.
// Copyright 2010 tomcool.org. All rights reserved.
//

#import "SMFBaseAsset.h"


@interface SMFDebAsset : SMFBaseAsset {
NSString *_path;
}

@end
37 changes: 37 additions & 0 deletions SMFDebAsset.m
@@ -0,0 +1,37 @@
//
// SMFDebAsset.m
// SMFramework
//
// Created by Thomas Cool on 12/12/10.
// Copyright 2010 tomcool.org. All rights reserved.
//

#import "SMFDebAsset.h"


@implementation SMFDebAsset
-(id)initWithPath:(NSString *)path
{
if ([[path pathExtension] localizedCaseInsensitiveCompare:@"deb" ]!=NSOrderedSame)
return nil;
self=[super init];
if (self!=nil) {
char line[200];

NSString *commandString = [NSString stringWithFormat:@"dpkg-deb -I %@",path,nil];
FILE* fp = popen([commandString UTF8String], "r");
NSMutableArray *lines = [[NSMutableArray alloc]init];
if (fp)
{
while (fgets(line, sizeof line, fp))
{
NSString *s = [NSString stringWithCString:line];
[lines addObject:s];
NSLog(@"%@",s);
}
}
pclose(fp);
}
return self;
}
@end
9 changes: 5 additions & 4 deletions SMFEventManager.m
Expand Up @@ -10,7 +10,8 @@
#import "SMFScreenCapture.h" #import "SMFScreenCapture.h"
#import "SMFEventConfiguration.h" #import "SMFEventConfiguration.h"
#import "SMFPhotoMethods.h" #import "SMFPhotoMethods.h"
#define eventsPlist (CFStringRef)@"org.tomcool.eventManager" #define eventsPlist (CFStringRef)@"org.tomcool.SMFramework.eventManager"
#define eventString @"org.tomcool.SMFramework.eventManager"
#define remoteActionDict (CFStringRef)@"remoteActions" #define remoteActionDict (CFStringRef)@"remoteActions"
#define keyDict (CFStringRef)@"keyboardKeys" #define keyDict (CFStringRef)@"keyboardKeys"


Expand Down Expand Up @@ -159,7 +160,7 @@ -(BOOL)actionDefinedForBREvent:(BREvent *)event
} }
else if([event value]==0x01) else if([event value]==0x01)
{ {
return [self actionDefinedForKey:[event remoteAction]]; return [self actionDefinedForAction:[event remoteAction]];
} }
return NO; return NO;
} }
Expand Down Expand Up @@ -211,8 +212,8 @@ -(void)restartLowtide
} }
-(void)actionForEvent:(SMFEvent *)event -(void)actionForEvent:(SMFEvent *)event
{ {
NSLog(@"%@ %@ %@ %@",kSMFEventDefaultScreenshot,kSMFEventDefaultRestartLowtide,kSMFEventDefaultSetup,kSMFEventDefaultSlideshow); // NSLog(@"%@ %@ %@ %@",kSMFEventDefaultScreenshot,kSMFEventDefaultRestartLowtide,kSMFEventDefaultSetup,kSMFEventDefaultSlideshow);
NSLog(@"event: %@ %@",event,[event name]); // NSLog(@"event: %@ %@",event,[event name]);


if ([[event name] isEqualToString:kSMFEventDefaultScreenshot]) if ([[event name] isEqualToString:kSMFEventDefaultScreenshot])
[self takeScreenshot]; [self takeScreenshot];
Expand Down
37 changes: 22 additions & 15 deletions SMFFolderBrowser.h
Expand Up @@ -7,22 +7,28 @@
// //


#import "SMFMediaMenuController.h" #import "SMFMediaMenuController.h"
#import "SMFPreferences.h"
#import "SMFPhotoMethods.h"
@protocol SMFFolderBrowserDelegate
-(BOOL)hasActionForFile:(NSString *)path;
-(void)executeActionForFile:(NSString *)path;
@end


@interface SMFFolderBrowser : SMFMediaMenuController @interface SMFFolderBrowser : SMFMediaMenuController
{ {


NSString * path; NSString * path;
NSMutableArray * _paths; NSMutableArray * _paths;
NSFileManager * _man; NSFileManager * _man;
NSMutableArray * _files; NSMutableArray * _files;
NSMutableArray * _folders; NSMutableArray * _folders;
BOOL separate; BOOL separate;
BOOL showHidden; BOOL showHidden;
BOOL showOnlyFolders; BOOL showOnlyFolders;
NSString *plistPath;
NSString *plistKey; NSObject<SMFFolderBrowserDelegate>* delegate;
id delegate; NSString * fpath;
NSString *fpath;


} }


Expand All @@ -34,8 +40,9 @@
@property (assign) BOOL separate; @property (assign) BOOL separate;
@property (assign) BOOL showHidden; @property (assign) BOOL showHidden;
@property (assign) BOOL showOnlyFolders; @property (assign) BOOL showOnlyFolders;
@property (retain) NSString *plistKey;
@property (retain) NSString *plistPath;
@property (retain) id delegate; @property (retain) NSObject<SMFFolderBrowserDelegate>* delegate;
@property (retain) NSString *fpath; @property (retain) NSString *fpath;

@end @end

0 comments on commit 2575a7f

Please sign in to comment.