1// 2// PXCanvasResizePrompter.m 3// Pixen-XCode 4// 5// Created by Ian Henderson on Wed Jun 09 2004. 6// Copyright (c) 2004 Open Sword Group. All rights reserved. 7// 8 9#import "PXCanvasResizePrompter.h" 10#import "PXCanvasResizeView.h" 11 12 13@implementation PXCanvasResizePrompter 14 15- init 16{ 17 return [super initWithWindowNibName:@"PXCanvasResizePrompt"]; 18} 19 20- (void)setDelegate:newDelegate 21{ 22 delegate = newDelegate; 23} 24 25- (void)promptInWindow:window 26{ 27 if([[[NSProcessInfo processInfo] arguments] containsObject:@"-SenTest"]) { return; } 28 [NSApp beginSheet:[self window] modalForWindow:window modalDelegate:nil didEndSelector:NULL contextInfo:NULL]; 29} 30 31- (IBAction)updateBgColor:sender 32{ 33 [resizeView setBackgroundColor:[backgroundColor color]]; 34} 35 36- (IBAction)useEnteredFrame:sender 37{ 38 [delegate prompter:self didFinishWithSize:[resizeView newSize] position:[resizeView position] backgroundColor:[backgroundColor color]]; 39 [NSApp endSheet:[self window]]; 40 [self close]; 41} 42 43- (IBAction)cancel:sender 44{ 45 [NSApp endSheet:[self window]]; 46 [self close]; 47} 48 49- (IBAction)updateSize:sender 50{ 51 [resizeView setNewImageSize:NSMakeSize([[sizeForm cellAtIndex:0] intValue], [[sizeForm cellAtIndex:1] intValue])]; 52} 53 54- (void)setCurrentSize:(NSSize)size 55{ 56 [[sizeForm cellAtIndex:0] setIntValue:size.width]; 57 [[sizeForm cellAtIndex:1] setIntValue:size.height]; 58 [resizeView setNewImageSize:size]; 59 [resizeView setOldImageSize:size]; 60} 61 62- (void)setCachedImage:(NSImage *)image 63{ 64 [resizeView setCachedImage:image]; 65} 66 67 68@end 69