Permalink
Browse files

lots o' updates

  • Loading branch information...
1 parent 3cd0c55 commit 2575a7ff6ca6a43c17e72a4cbcf1833e05460f8b @tomcool420 committed Dec 12, 2010
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -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
View
@@ -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
View
@@ -11,6 +11,16 @@
@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;
+
+/*
+ * Displays a popup using the BRPopupManager
+ * @arg1: a popup created using popupControlwithLines:andImage:
+ */
+(void)showPopup:(id)popup;
@end
View
@@ -19,12 +19,12 @@ +(id)popupControlWithLines:(NSArray *)array andImage:(BRImage *)image
NSDictionary *dict;
if (array==nil) {
dict = [NSDictionary dictionaryWithObjectsAndKeys:
- [[BRThemeInfo sharedTheme]geniusIcon],@"Image",
+ image,@"Image",
nil];
}
else {
dict = [NSDictionary dictionaryWithObjectsAndKeys:
- [[BRThemeInfo sharedTheme]geniusIcon],@"Image",
+ image,@"Image",
array,@"Lines",nil];
}
View
@@ -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
View
@@ -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
View
@@ -10,7 +10,8 @@
#import "SMFScreenCapture.h"
#import "SMFEventConfiguration.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 keyDict (CFStringRef)@"keyboardKeys"
@@ -159,7 +160,7 @@ -(BOOL)actionDefinedForBREvent:(BREvent *)event
}
else if([event value]==0x01)
{
- return [self actionDefinedForKey:[event remoteAction]];
+ return [self actionDefinedForAction:[event remoteAction]];
}
return NO;
}
@@ -211,8 +212,8 @@ -(void)restartLowtide
}
-(void)actionForEvent:(SMFEvent *)event
{
- NSLog(@"%@ %@ %@ %@",kSMFEventDefaultScreenshot,kSMFEventDefaultRestartLowtide,kSMFEventDefaultSetup,kSMFEventDefaultSlideshow);
- NSLog(@"event: %@ %@",event,[event name]);
+// NSLog(@"%@ %@ %@ %@",kSMFEventDefaultScreenshot,kSMFEventDefaultRestartLowtide,kSMFEventDefaultSetup,kSMFEventDefaultSlideshow);
+// NSLog(@"event: %@ %@",event,[event name]);
if ([[event name] isEqualToString:kSMFEventDefaultScreenshot])
[self takeScreenshot];
View
@@ -7,22 +7,28 @@
//
#import "SMFMediaMenuController.h"
+#import "SMFPreferences.h"
+#import "SMFPhotoMethods.h"
+@protocol SMFFolderBrowserDelegate
+-(BOOL)hasActionForFile:(NSString *)path;
+-(void)executeActionForFile:(NSString *)path;
+@end
@interface SMFFolderBrowser : SMFMediaMenuController
{
- NSString * path;
- NSMutableArray * _paths;
- NSFileManager * _man;
- NSMutableArray * _files;
- NSMutableArray * _folders;
- BOOL separate;
- BOOL showHidden;
- BOOL showOnlyFolders;
- NSString *plistPath;
- NSString *plistKey;
- id delegate;
- NSString *fpath;
+ NSString * path;
+ NSMutableArray * _paths;
+ NSFileManager * _man;
+ NSMutableArray * _files;
+ NSMutableArray * _folders;
+ BOOL separate;
+ BOOL showHidden;
+ BOOL showOnlyFolders;
+
+ NSObject<SMFFolderBrowserDelegate>* delegate;
+ NSString * fpath;
+
}
@@ -34,8 +40,9 @@
@property (assign) BOOL separate;
@property (assign) BOOL showHidden;
@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;
+
@end
Oops, something went wrong.

0 comments on commit 2575a7f

Please sign in to comment.