// // LOGOSXcontroler.m // LOGOSX // // Created by micah aci on Tue May 25 2004. // Copyright (c) 2004 __MyCompanyName__. All rights reserved. // #import "LOGOSXcontroller.h" @implementation LOGOSXcontroller -(IBAction)save:(id)sender { NSData *myImageData = [logosx dataWithPDFInsideRect:[logosx bounds]]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:[[[NSImage alloc] initWithData:myImageData] TIFFRepresentation]]; NSNumber *ditherTransparency = [NSNumber numberWithBool:YES]; NSDictionary *propertyDict = [NSDictionary dictionaryWithObject:ditherTransparency forKey:NSImageInterlaced]; myImageData = [imageRep representationUsingType:NSPNGFileType properties:propertyDict]; // [logosx retain]; // [logosx lockFocus]; // NSBitmapImageRep * myImageRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[logosx bounds]]; // NSData * myImageData = [myImageRep representationUsingType:NSJPEGFileType properties:nil]; //save code taken from : http://developer.apple.com/documentation/Cocoa/Conceptual/AppFileMgmt/Tasks/UsingASavePanel.html NSSavePanel *sp; int runResult; /* create or get the shared instance of NSSavePanel */ sp = [NSSavePanel savePanel]; /* set up new attributes */ //[sp setAccessoryView:logosx]; [sp setRequiredFileType:@"png"]; /* display the NSSavePanel */ runResult = [sp runModalForDirectory:NSHomeDirectory() file:@""]; /* if successful, save file under designated name */ if (runResult == NSOKButton) { if (![myImageData writeToFile:[sp filename] atomically:YES]) NSBeep(); } // [logosx unlockFocus]; } - (IBAction)onward:(id)sender { [logosx forward:0]; [currentStep setIntValue:[logosx get_step]]; } -(IBAction)undo:(id)sender { [logosx reconstruct]; [currentStep setIntValue:[logosx get_step]]; } -(IBAction)processCommand:(id)sender { if([logosx checkCommand:[commandString stringValue]]) { [logosx executeCommand:[commandString stringValue]]; [logosx reconstruct]; [currentStep setIntValue:[logosx get_step]]; } else { [logosx showBezel]; NSLog(@"showBezel"); } } -(IBAction)clear:(id)sender { [logosx initWithFrame:[logosx frame]]; [currentStep setIntValue:[logosx get_step]]; } -(IBAction)openWeb:(id)sender { [[[NSAppleScript alloc] initWithSource:@"do shell script \"open http://www.stealthiscode.com\""] executeAndReturnError:nil]; } @end