File: PRCConvolve55.m

package info (click to toggle)
price.app 0.8.2%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,764 kB
  • ctags: 46
  • sloc: objc: 3,470; ansic: 274; makefile: 41
file content (207 lines) | stat: -rw-r--r-- 5,337 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
//
//  PRCConvolve55.m
//  PRICE
//  Convolve 5x5 Controller
//
//  Created by Riccardo Mottola on Tue Jan 21 2003.
//  Copyright (c) 2003-2004 Carduus. All rights reserved.
//
// This program is free software; you can redistribute it and/or modify it under the terms of the version 2 of the GNU General Public License as published by the Free Software Foundation.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

#import "PRCConvolve55.h"
#import "MyDocument.h"

@implementation PRCConvolve55

- (IBAction)showConvolve55:(id)sender
{
    if (!filterWindow)
        [NSBundle loadNibNamed:@"Convolve55" owner:self];
    [filterWindow makeKeyAndOrderFront:nil];
    convMatrix[0][0] = [matField11 intValue];
    convMatrix[0][1] = [matField12 intValue];
    convMatrix[0][2] = [matField13 intValue];
    convMatrix[0][3] = [matField14 intValue];
    convMatrix[0][4] = [matField15 intValue];
    convMatrix[1][0] = [matField21 intValue];
    convMatrix[1][1] = [matField22 intValue];
    convMatrix[1][2] = [matField23 intValue];
    convMatrix[1][3] = [matField24 intValue];
    convMatrix[1][4] = [matField25 intValue];
    convMatrix[2][0] = [matField31 intValue];
    convMatrix[2][1] = [matField32 intValue];
    convMatrix[2][2] = [matField33 intValue];
    convMatrix[2][3] = [matField34 intValue];
    convMatrix[2][4] = [matField35 intValue];
    convMatrix[3][0] = [matField41 intValue];
    convMatrix[3][1] = [matField42 intValue];
    convMatrix[3][2] = [matField43 intValue];
    convMatrix[3][3] = [matField44 intValue];
    convMatrix[3][4] = [matField45 intValue];
    convMatrix[4][0] = [matField51 intValue];
    convMatrix[4][1] = [matField52 intValue];
    convMatrix[4][2] = [matField53 intValue];
    convMatrix[4][3] = [matField54 intValue];
    convMatrix[4][4] = [matField55 intValue];
    if ([autoScaleCheck state] == NSOnState)
    {
        [scaleField setEnabled:NO];
        [offsetField setEnabled:NO];
        autoScale = YES;
    } else
    {
        [scaleField setEnabled:YES];
        [offsetField setEnabled:YES];
        autoScale = NO;
    }
    offset = [offsetField intValue];
    scale = [scaleField floatValue];
}

- (IBAction)convMatrix11:(id)sender
{
    convMatrix[0][0] = [sender intValue];
}
- (IBAction)convMatrix12:(id)sender
{
    convMatrix[0][1] = [sender intValue];
}
- (IBAction)convMatrix13:(id)sender
{
    convMatrix[0][2] = [sender intValue];
}
- (IBAction)convMatrix14:(id)sender
{
    convMatrix[0][3] = [sender intValue];
}
- (IBAction)convMatrix15:(id)sender
{
    convMatrix[0][4] = [sender intValue];
}
- (IBAction)convMatrix21:(id)sender
{
    convMatrix[1][0] = [sender intValue];
}
- (IBAction)convMatrix22:(id)sender
{
    convMatrix[1][1] = [sender intValue];
}
- (IBAction)convMatrix23:(id)sender
{
    convMatrix[1][2] = [sender intValue];
}
- (IBAction)convMatrix24:(id)sender
{
    convMatrix[1][3] = [sender intValue];
}
- (IBAction)convMatrix25:(id)sender
{
    convMatrix[1][4] = [sender intValue];
}
- (IBAction)convMatrix31:(id)sender
{
    convMatrix[2][0] = [sender intValue];
}
- (IBAction)convMatrix32:(id)sender
{
    convMatrix[2][1] = [sender intValue];
}
- (IBAction)convMatrix33:(id)sender
{
    convMatrix[2][2] = [sender intValue];
}
- (IBAction)convMatrix34:(id)sender
{
    convMatrix[2][3] = [sender intValue];
}
- (IBAction)convMatrix35:(id)sender
{
    convMatrix[2][4] = [sender intValue];
}
- (IBAction)convMatrix41:(id)sender
{
    convMatrix[3][0] = [sender intValue];
}
- (IBAction)convMatrix42:(id)sender
{
    convMatrix[3][1] = [sender intValue];
}
- (IBAction)convMatrix43:(id)sender
{
    convMatrix[3][2] = [sender intValue];
}
- (IBAction)convMatrix44:(id)sender
{
    convMatrix[3][3] = [sender intValue];
}
- (IBAction)convMatrix45:(id)sender
{
    convMatrix[3][4] = [sender intValue];
}
- (IBAction)convMatrix51:(id)sender
{
    convMatrix[4][0] = [sender intValue];
}
- (IBAction)convMatrix52:(id)sender
{
    convMatrix[4][1] = [sender intValue];
}
- (IBAction)convMatrix53:(id)sender
{
    convMatrix[4][2] = [sender intValue];
}
- (IBAction)convMatrix54:(id)sender
{
    convMatrix[4][3] = [sender intValue];
}
- (IBAction)convMatrix55:(id)sender
{
    convMatrix[4][4] = [sender intValue];
}

- (IBAction)autoRange:(id)sender
{
    autoScale = !autoScale;
    if (autoScale)
    {
        [scaleField setEnabled:NO];
        [offsetField setEnabled:NO];
    } else
    {
        [scaleField setEnabled:YES];
        [offsetField setEnabled:YES];
    }
}

- (IBAction)scaleFactor:(id)sender
{
    scale = [sender floatValue];
}

- (IBAction)offsetFactor:(id)sender
{
    offset = [sender intValue];
}

- (IBAction)conv55Cancel:(id)sender
{
    [filterWindow performClose:nil];
}

- (IBAction)conv55OK:(id)sender
{
    PRCProgress *convProgr;
    
    convProgr = [[PRCProgress alloc] init];
    [convProgr showProgress:self];
    [convProgr setTitle: @"Convolve 5x5"];
    
    [[[NSDocumentController sharedDocumentController] currentDocument] makeConvolve55:convMatrix :offset :scale :autoScale :convProgr];
    
    [convProgr release];
    if ([[NSApp delegate] prefClosePanels])
        [filterWindow performClose:nil];
}

@end