#import "MainController.h" @implementation MainController - (void)awakeFromNib { myBadge = [[CTProgressBadge alloc] init]; [self setBadgeValue:scroller]; } - (void)windowWillClose:(NSNotification *)aNotification { RestoreApplicationDockTileImage(); [NSApp terminate:self]; } - (IBAction)setBadgeValue:(id)sender { float value = [sender floatValue]; [largeBadgeView setImage:[myBadge progressBadgeOfSize:46 withProgress:value/360]]; [smallBadgeView setImage:[myBadge progressBadgeOfSize:16 withProgress:value/360]]; [myBadge badgeApplicationDockIconWithProgress:value/360 insetX:2 y:3]; } - (IBAction)setForegroundColor:(id)sender { [myBadge setForegroundColor:[sender color]]; [self setBadgeValue:scroller]; } - (IBAction)setBackgroundColor:(id)sender { [myBadge setBackgroundColor:[sender color]]; [self setBadgeValue:scroller]; } - (IBAction)setApplicationIcon:(id)sender { NSOpenPanel *openPanel = [NSOpenPanel openPanel]; int result = [openPanel runModalForDirectory:NSHomeDirectory() file:nil types:[NSArray arrayWithObject:@"icns"]]; if(result == NSOKButton) { [self application:nil openFile:[openPanel filename]]; } } - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { NSImage *newAppIcon = [[NSImage alloc] initWithContentsOfFile:filename]; [(NSImage *)[NSImage imageNamed:@"NSApplicationIcon"] setName:nil]; [newAppIcon setName:@"NSApplicationIcon"]; [self setBadgeValue:scroller]; return YES; } @end