OSDN Git Service

open
[eliscolors/main.git] / ElisMovieSizeWindowController.m
1 //  Copyright (c) 2009 Yanagi Asakura
2 //
3 //  This software is provided 'as-is', without any express or implied
4 //  warranty. In no event will the authors be held liable for any damages
5 //  arising from the use of this software.
6 //
7 //  Permission is granted to anyone to use this software for any purpose,
8 //  including commercial applications, and to alter it and redistribute it
9 //  freely, subject to the following restrictions:
10 //
11 //  1. The origin of this software must not be misrepresented; you must not
12 //  claim that you wrote the original software. If you use this software
13 //  in a product, an acknowledgment in the product documentation would be
14 //  appreciated but is not required.
15 //
16 //  2. Altered source versions must be plainly marked as such, and must not be
17 //  misrepresented as being the original software.
18 //
19 //  3. This notice may not be removed or altered from any source
20 //  distribution.
21
22 //
23 //  ElisMovieSizeWindowController.m
24 //  Elis Colors
25 //
26 //  Created by 柳 on 09/09/26.
27 //  Copyright 2009 __MyCompanyName__. All rights reserved.
28 //
29
30 #import "ElisMovieSizeWindowController.h"
31
32
33 @implementation ElisMovieSizeWindowController
34
35 - (id)init
36 {
37     [NSBundle loadNibNamed:@"movieSizeWindow" owner:self];
38     return self;
39 }
40
41 - (void)run
42 {
43     [_widthField setIntValue:(int)ProjectMovieSize.size.width];
44     [_heightField setIntValue:(int)ProjectMovieSize.size.height];
45     
46     [NSApp beginSheet:_window modalForWindow:_mainWindow 
47         modalDelegate:self didEndSelector:nil contextInfo:nil];
48 }
49
50 - (IBAction)pushedOK:(id)sender
51 {
52     int x, y;
53     x = [_widthField intValue];
54     y = [_heightField intValue];
55     
56     if(x > 0 && y > 0){
57         ProjectMovieSize.size.width = x;
58         ProjectMovieSize.size.height = y;
59     }
60     
61     [_window close];
62     [NSApp endSheet:_window returnCode:NSCancelButton];
63     
64     [_mainView reshape];
65 }
66
67 - (IBAction)pushedCancel:(id)sender
68 {
69     [_window close];
70     [NSApp endSheet:_window];
71 }
72
73 - (void)setMainWindow:(NSWindow *)w
74 {
75     _mainWindow = w;
76 }
77
78 - (void)setMainView:(id)v
79 {
80     _mainView = v;
81 }
82
83 @end