author | tz |
Wed, 04 Feb 1998 16:37:25 +0100 | |
changeset 582 | 3343d860b400 |
parent 579 | 0f86dfeb6890 |
child 611 | ba39b8506e97 |
permissions | -rw-r--r-- |
400 | 1 |
" |
503 | 2 |
COPYRIGHT (c) 1997 by eXept Software AG |
400 | 3 |
All Rights Reserved |
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
405 | 7 |
inclusion of the above copyright notice. This software may not |
400 | 8 |
be provided or otherwise made available to, or used by, any |
405 | 9 |
other person. No title to or ownership of the software is |
400 | 10 |
hereby transferred. |
11 |
" |
|
12 |
||
13 |
ToolApplicationModel subclass:#ImageEditor |
|
14 |
instanceVariableNames:'colorMapMode selectedColorIndex postOpenAction' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Interface-Advanced-Tools' |
|
18 |
! |
|
19 |
||
20 |
!ImageEditor class methodsFor:'documentation'! |
|
21 |
||
22 |
copyright |
|
23 |
" |
|
503 | 24 |
COPYRIGHT (c) 1997 by eXept Software AG |
400 | 25 |
All Rights Reserved |
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
405 | 29 |
inclusion of the above copyright notice. This software may not |
400 | 30 |
be provided or otherwise made available to, or used by, any |
405 | 31 |
other person. No title to or ownership of the software is |
400 | 32 |
hereby transferred. |
33 |
" |
|
34 |
! |
|
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
By the Image Editor you are able to create, design, modify or just inspect images. |
|
39 |
||
40 |
[start with:] |
|
41 |
ImageEditor open |
|
42 |
ImageEditor openOnClass:ImageEditor andSelector:#newImageIcon |
|
43 |
||
44 |
[see also:] |
|
45 |
ImageEditView Image |
|
46 |
||
47 |
[author:] |
|
544 | 48 |
Thomas Zwick, eXept Software AG |
400 | 49 |
" |
50 |
! ! |
|
51 |
||
52 |
!ImageEditor class methodsFor:'instance creation'! |
|
53 |
||
54 |
openModalOnClass: aClass andSelector: aSelector |
|
55 |
||
56 |
"self openModalOnClass: self andSelector: #newImageIcon" |
|
57 |
||
415 | 58 |
|imageEditor className resourceClassName resourceSelector| |
400 | 59 |
imageEditor := self new. |
60 |
aClass isClass ifTrue: [className := aClass name]. |
|
61 |
aClass isString ifTrue: [className := aClass]. |
|
62 |
||
415 | 63 |
imageEditor postOpenAction: [imageEditor loadFromOrPrepareForMessage: className, ' ', aSelector]. |
400 | 64 |
imageEditor openModal. |
65 |
||
66 |
resourceClassName := imageEditor valueOfResourceClass value. |
|
67 |
resourceSelector := imageEditor valueOfResourceSelector value. |
|
415 | 68 |
|
69 |
(className asString ~= resourceClassName) | (aSelector asString ~= resourceSelector) |
|
70 |
ifTrue: [^resourceClassName, ' ', resourceSelector] |
|
71 |
ifFalse:[^nil] |
|
400 | 72 |
! |
73 |
||
74 |
openOnClass: aClass andSelector: aSelector |
|
75 |
||
76 |
"self openOnClass: self andSelector: #newImageIcon" |
|
77 |
||
78 |
^self open loadFromMessage: aClass name, ' ', aSelector |
|
79 |
! |
|
80 |
||
81 |
openOnFile: image |
|
82 |
||
83 |
"self openOnFile: 'bitmaps/SmalltalkX.xbm'" |
|
84 |
||
85 |
^self open loadFromFile: image |
|
86 |
! |
|
87 |
||
88 |
openOnImage: image |
|
89 |
||
90 |
"self openOnImage: self stxIcon" |
|
91 |
||
92 |
^self open loadFromImage: image |
|
93 |
! ! |
|
94 |
||
95 |
!ImageEditor class methodsFor:'accessing'! |
|
96 |
||
97 |
listOfColorMaps |
|
98 |
||
99 |
|colorMap| |
|
100 |
(colorMap := OrderedCollection new) |
|
101 |
add: Color black; |
|
102 |
add: Color white; |
|
103 |
add: Color red; |
|
104 |
add: Color green; |
|
105 |
add: Color blue; |
|
106 |
add: Color cyan; |
|
107 |
add: Color yellow; |
|
108 |
add: Color magenta; |
|
109 |
add: (Color red: 50 green: 0 blue: 0); |
|
110 |
add: (Color red: 0 green: 50 blue: 0); |
|
111 |
add: (Color red: 0 green: 0 blue: 50); |
|
112 |
add: (Color red: 0 green: 50 blue: 50); |
|
113 |
add: (Color red: 50 green: 50 blue: 0); |
|
114 |
add: (Color red: 50 green: 0 blue: 50); |
|
115 |
add: Color gray; |
|
116 |
add: Color lightGray. |
|
117 |
0 to: 5 do: |
|
118 |
[:r| |
|
119 |
0 to: 5 do: |
|
120 |
[:g| |
|
121 |
0 to: 5 do: |
|
122 |
[:b| |
|
123 |
colorMap add: (Color red: (r*100//5) ceiling green: (g*100//5) ceiling blue: (b*100//5) ceiling) |
|
124 |
] |
|
125 |
] |
|
126 |
]. |
|
127 |
||
128 |
1 to: 25 do: |
|
129 |
[:g| |
|
130 |
colorMap add: (Color gray: (g*100//26) ceiling) |
|
131 |
]. |
|
132 |
||
133 |
^Dictionary new |
|
134 |
at: '8-plane' put: colorMap; |
|
135 |
at: '8-plane + mask' put: colorMap; |
|
136 |
at: '4-plane' put: (colorMap copyFrom: 1 to: 16); |
|
137 |
at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16); |
|
138 |
at: '2-plane' put: (colorMap copyFrom: 1 to: 4); |
|
139 |
at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4); |
|
140 |
at: '1-plane' put: (colorMap copyFrom: 1 to: 2); |
|
141 |
at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2); |
|
142 |
yourself |
|
143 |
! |
|
144 |
||
145 |
listOfDefaultSizes |
|
146 |
||
147 |
^#('24x24' '16x16' '32x32') |
|
148 |
! ! |
|
149 |
||
460 | 150 |
!ImageEditor class methodsFor:'help specs'! |
151 |
||
152 |
helpSpec |
|
153 |
"return a dictionary filled with helpKey -> helptext associations. |
|
154 |
These are used by the activeHelp tool." |
|
155 |
||
156 |
" |
|
157 |
UIHelpTool openOnClass:ImageEditor |
|
158 |
" |
|
159 |
||
160 |
^ super helpSpec addPairsFrom:#( |
|
161 |
||
162 |
#colorMap |
|
163 |
'Increases or reduces size of color map of the image.' |
|
164 |
||
487 | 165 |
#colorMapTable |
166 |
'Shows a list of used colors of the current image.' |
|
167 |
||
460 | 168 |
#drawModeBox |
169 |
'Switches to mode drawing boxes.' |
|
170 |
||
171 |
#drawModeCopy |
|
172 |
'Switches to mode copying areas.' |
|
173 |
||
174 |
#drawModeFill |
|
175 |
'Switches to mode filling areas around selected point.' |
|
176 |
||
177 |
#drawModeFilledBox |
|
178 |
'Switches to mode drawing filled boxes.' |
|
179 |
||
180 |
#drawModePaste |
|
181 |
'Switches to mode pasting areas at selected point.' |
|
182 |
||
183 |
#drawModePoint |
|
184 |
'Switches to mode drawing points.' |
|
185 |
||
186 |
#editFlipHorizontal |
|
187 |
'Flips horizontally the image.' |
|
188 |
||
189 |
#editFlipVertical |
|
190 |
'Flips vertically the image.' |
|
191 |
||
192 |
#editMagnifyImage |
|
193 |
'Opens a dialog to magnify the image.' |
|
194 |
||
195 |
#editNegate |
|
196 |
'Convertes colors of image by negating them.' |
|
197 |
||
198 |
#editResize |
|
199 |
'Opens a dialog to resize the image with preserving the old image.' |
|
200 |
||
201 |
#editRotate |
|
202 |
'Opens a dialog to rotate the image in degrees.' |
|
203 |
||
204 |
#fileLoadFromClass |
|
205 |
'Opens a dialog for selecting an image resource method.' |
|
206 |
||
207 |
#fileLoadFromClassWithSuperclass |
|
208 |
'Opens a dialog for opening the resource dialog on a superclass.' |
|
209 |
||
210 |
#fileLoadFromFile |
|
211 |
'Opens a dialog for selecting an image file.' |
|
212 |
||
213 |
#fileNewImage |
|
214 |
'Opens a dialog with choices of size and color depth.' |
|
215 |
||
216 |
#filePrint |
|
217 |
'Print the image on a postscript printer.' |
|
218 |
||
219 |
#fileSaveAs |
|
220 |
'Opens dialog to save the image on a file.' |
|
221 |
||
222 |
#fileSaveFile |
|
223 |
'Saves the image on selected file name.' |
|
224 |
||
225 |
#fileSaveMaskAs |
|
226 |
'Opens dialog to save the mask of the image on a file.' |
|
227 |
||
228 |
#fileSaveMethod |
|
229 |
'Saves current image into selected class and selector.' |
|
230 |
||
231 |
#fileSaveMethodAs |
|
232 |
'Opens dialog to save the image on a class and a selector.' |
|
233 |
||
234 |
#inputFieldFileName |
|
235 |
'File name of the image.' |
|
236 |
||
237 |
#inputFieldOfClass |
|
238 |
'Class implementing the image method.' |
|
239 |
||
240 |
#inputFieldOfSelector |
|
241 |
'Selector of the class returning the image.' |
|
242 |
||
487 | 243 |
#magnificationNumber |
244 |
'Shows current number of magnification.' |
|
245 |
||
246 |
#magnifyImageDown |
|
247 |
'Magnifies down current image.' |
|
248 |
||
249 |
#magnifyImageUp |
|
250 |
'Magnifies up current image.' |
|
251 |
||
252 |
#mouseKeyColorMode |
|
253 |
'Toggles between left and right mouse key color.' |
|
254 |
||
255 |
#previewView |
|
256 |
'Shows preview of the current image.' |
|
257 |
||
460 | 258 |
) |
259 |
! ! |
|
260 |
||
400 | 261 |
!ImageEditor class methodsFor:'interface specs'! |
262 |
||
519 | 263 |
windowSpec |
264 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
265 |
||
266 |
"do not manually edit this - the painter/builder may not be able to |
|
267 |
handle the specification if its corrupted." |
|
268 |
||
269 |
" |
|
270 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpec |
|
271 |
ImageEditor new openInterface:#windowSpec |
|
272 |
" |
|
273 |
"ImageEditor open" |
|
274 |
||
275 |
<resource: #canvas> |
|
276 |
||
277 |
^ |
|
278 |
||
279 |
#(#FullSpec |
|
280 |
#'window:' |
|
281 |
#(#WindowSpec |
|
282 |
#'name:' 'Image Editor' |
|
569 | 283 |
#'layout:' #(#LayoutFrame 275 0 400 0 774 0 745 0) |
519 | 284 |
#'label:' 'Image Editor' |
285 |
#'min:' #(#Point 400 320) |
|
286 |
#'max:' #(#Point 1152 900) |
|
569 | 287 |
#'bounds:' #(#Rectangle 275 400 775 746) |
519 | 288 |
#'menu:' #menu |
289 |
#'usePreferredExtent:' false |
|
290 |
) |
|
291 |
#'component:' |
|
292 |
#(#SpecCollection |
|
293 |
#'collection:' |
|
294 |
#( |
|
295 |
#(#MenuPanelSpec |
|
296 |
#'name:' 'menuToolbarView' |
|
297 |
#'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
298 |
#'menu:' #menuToolbar |
|
299 |
#'style:' #(#FontDescription #helvetica #medium #roman 10) |
|
300 |
#'showSeparatingLines:' true |
|
301 |
) |
|
302 |
#(#VariableHorizontalPanelSpec |
|
303 |
#'name:' 'variableHorizontalPanel1' |
|
569 | 304 |
#'layout:' #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
519 | 305 |
#'component:' |
306 |
#(#SpecCollection |
|
307 |
#'collection:' |
|
308 |
#( |
|
309 |
#(#ViewSpec |
|
310 |
#'name:' 'view1' |
|
311 |
#'component:' |
|
312 |
#(#SpecCollection |
|
313 |
#'collection:' |
|
314 |
#( |
|
315 |
#(#FramedBoxSpec |
|
316 |
#'name:' 'framedBox1' |
|
317 |
#'layout:' #(#LayoutFrame 1 0.0 3 0.0 110 0 65 0) |
|
318 |
#'component:' |
|
319 |
#(#SpecCollection |
|
320 |
#'collection:' |
|
321 |
#( |
|
322 |
#(#ArrowButtonSpec |
|
323 |
#'name:' 'magnifyDownButton' |
|
324 |
#'layout:' #(#LayoutFrame 13 0 20 0 35 0 42 0) |
|
325 |
#'activeHelpKey:' #magnifyImageDown |
|
326 |
#'model:' #magnifyDown |
|
327 |
#'enableChannel:' #imageIsLoaded |
|
328 |
#'isTriggerOnDown:' true |
|
329 |
#'direction:' #left |
|
330 |
) |
|
331 |
#(#ArrowButtonSpec |
|
332 |
#'name:' 'magnifyUpButton' |
|
333 |
#'layout:' #(#LayoutFrame 73 0 20 0 95 0 42 0) |
|
334 |
#'activeHelpKey:' #magnifyImageUp |
|
335 |
#'model:' #magnifyUp |
|
336 |
#'enableChannel:' #imageIsLoaded |
|
337 |
#'isTriggerOnDown:' true |
|
338 |
#'direction:' #right |
|
339 |
) |
|
340 |
#(#InputFieldSpec |
|
341 |
#'name:' 'magnificationInputField' |
|
342 |
#'layout:' #(#LayoutFrame 36 0 20 0.0 72 0 42 0) |
|
343 |
#'activeHelpKey:' #magnificationNumber |
|
344 |
#'enableChannel:' #imageIsLoaded |
|
345 |
#'model:' #valueOfMagnification |
|
346 |
#'type:' #number |
|
347 |
#'acceptOnReturn:' false |
|
348 |
#'acceptOnTab:' false |
|
349 |
#'numChars:' 2 |
|
350 |
) |
|
351 |
) |
|
352 |
) |
|
353 |
#'label:' 'Magnification' |
|
354 |
#'labelPosition:' #topLeft |
|
355 |
#'style:' #(#FontDescription #helvetica #medium #roman 12) |
|
356 |
) |
|
357 |
#(#ArbitraryComponentSpec |
|
358 |
#'name:' 'imagePreView' |
|
359 |
#'layout:' #(#LayoutFrame 111 0.0 9 0.0 -6 1 60 0) |
|
360 |
#'activeHelpKey:' #previewView |
|
361 |
#'hasHorizontalScrollBar:' true |
|
362 |
#'hasVerticalScrollBar:' true |
|
363 |
#'miniScrollerHorizontal:' true |
|
364 |
#'miniScrollerVertical:' true |
|
365 |
#'component:' #ImageView |
|
366 |
#'hasBorder:' true |
|
367 |
) |
|
368 |
#(#FramedBoxSpec |
|
369 |
#'name:' 'framedBox2' |
|
370 |
#'layout:' #(#LayoutFrame 1 0.0 68 0 0 1.0 -66 1) |
|
371 |
#'component:' |
|
372 |
#(#SpecCollection |
|
373 |
#'collection:' |
|
374 |
#( |
|
375 |
#(#DataSetSpec |
|
376 |
#'name:' 'colorDataSetView' |
|
377 |
#'layout:' #(#LayoutFrame 11 0.0 19 0.0 20 1.0 -10 1.0) |
|
378 |
#'activeHelpKey:' #colorMapTable |
|
379 |
#'model:' #selectionOfColor |
|
380 |
#'style:' #(#FontDescription #helvetica #medium #roman 12) |
|
381 |
#'hasHorizontalScrollBar:' true |
|
382 |
#'hasVerticalScrollBar:' true |
|
383 |
#'miniScrollerHorizontal:' true |
|
384 |
#'miniScrollerVertical:' true |
|
385 |
#'dataList:' #listOfColors |
|
386 |
#'level:' -1 |
|
387 |
#'has3Dsepartors:' true |
|
388 |
#'verticalSpacing:' 1 |
|
389 |
#'columns:' |
|
390 |
#( |
|
391 |
#(#DataSetColumnSpec |
|
392 |
#'rendererType:' #rowSelector |
|
393 |
#'backgroundSelector:' #yourself |
|
394 |
) |
|
395 |
#(#DataSetColumnSpec |
|
396 |
#'label:' 'Red' |
|
397 |
#'model:' #rowRedByte |
|
398 |
#'canSelect:' false |
|
399 |
) |
|
400 |
#(#DataSetColumnSpec |
|
401 |
#'label:' 'Green' |
|
402 |
#'model:' #rowGreenByte |
|
403 |
#'canSelect:' false |
|
404 |
) |
|
405 |
#(#DataSetColumnSpec |
|
406 |
#'label:' 'Blue' |
|
407 |
#'model:' #rowBlueByte |
|
408 |
#'canSelect:' false |
|
409 |
) |
|
410 |
) |
|
411 |
) |
|
412 |
#(#MenuPanelSpec |
|
413 |
#'name:' 'menuColorAssignmentPanel' |
|
414 |
#'layout:' #(#LayoutFrame 11 0 -10 1 18 1 17 1) |
|
415 |
#'activeHelpKey:' #mouseKeyColorMode |
|
416 |
#'enableChannel:' #imageIsLoaded |
|
417 |
#'menu:' #menuColorAssignment |
|
418 |
#'style:' #(#FontDescription #helvetica #medium #roman 10) |
|
419 |
) |
|
420 |
) |
|
421 |
) |
|
422 |
#'label:' 'Color Map' |
|
423 |
#'labelPosition:' #topLeft |
|
424 |
#'style:' #(#FontDescription #helvetica #medium #roman 12) |
|
425 |
) |
|
426 |
#(#VerticalPanelViewSpec |
|
427 |
#'name:' 'verticalPanelView1' |
|
428 |
#'layout:' #(#LayoutFrame 1 0.0 -68 1 83 0 0 1.0) |
|
429 |
#'component:' |
|
430 |
#(#SpecCollection |
|
431 |
#'collection:' |
|
432 |
#( |
|
433 |
#(#LabelSpec |
|
434 |
#'name:' 'classNameLabel' |
|
435 |
#'label:' 'Class:' |
|
436 |
#'adjust:' #right |
|
437 |
#'extent:' #(#Point 82 21) |
|
438 |
) |
|
439 |
#(#LabelSpec |
|
440 |
#'name:' 'selectorLabel' |
|
441 |
#'label:' 'Selector:' |
|
442 |
#'adjust:' #right |
|
443 |
#'extent:' #(#Point 82 20) |
|
444 |
) |
|
445 |
#(#LabelSpec |
|
446 |
#'name:' 'fileNameLabel' |
|
447 |
#'label:' 'File Name:' |
|
448 |
#'adjust:' #right |
|
449 |
#'extent:' #(#Point 82 21) |
|
450 |
) |
|
451 |
) |
|
452 |
) |
|
453 |
#'horizontalLayout:' #fit |
|
454 |
#'verticalLayout:' #fit |
|
455 |
#'horizontalSpace:' 3 |
|
456 |
#'verticalSpace:' 3 |
|
457 |
) |
|
458 |
#(#VerticalPanelViewSpec |
|
459 |
#'name:' 'verticalPanelView2' |
|
460 |
#'layout:' #(#LayoutFrame 85 0.0 -68 1 -6 1 0 1.0) |
|
461 |
#'component:' |
|
462 |
#(#SpecCollection |
|
463 |
#'collection:' |
|
464 |
#( |
|
465 |
#(#InputFieldSpec |
|
466 |
#'name:' 'resourceClassInputField' |
|
467 |
#'activeHelpKey:' #inputFieldOfClass |
|
468 |
#'model:' #valueOfResourceClass |
|
469 |
#'immediateAccept:' false |
|
569 | 470 |
#'extent:' #(#Point 155 21) |
519 | 471 |
) |
472 |
#(#InputFieldSpec |
|
473 |
#'name:' 'resourceSelectorInputField' |
|
474 |
#'activeHelpKey:' #inputFieldOfSelector |
|
475 |
#'model:' #valueOfResourceSelector |
|
476 |
#'immediateAccept:' false |
|
477 |
#'acceptOnTab:' false |
|
569 | 478 |
#'extent:' #(#Point 155 20) |
519 | 479 |
) |
480 |
#(#InputFieldSpec |
|
481 |
#'name:' 'fileNameInputField' |
|
482 |
#'activeHelpKey:' #inputFieldFileName |
|
483 |
#'model:' #valueOfFileName |
|
484 |
#'immediateAccept:' false |
|
485 |
#'acceptOnTab:' false |
|
569 | 486 |
#'extent:' #(#Point 155 21) |
519 | 487 |
) |
488 |
) |
|
489 |
) |
|
490 |
#'horizontalLayout:' #fit |
|
491 |
#'verticalLayout:' #fit |
|
492 |
#'horizontalSpace:' 3 |
|
493 |
#'verticalSpace:' 3 |
|
494 |
) |
|
495 |
) |
|
496 |
) |
|
497 |
#'level:' -1 |
|
498 |
) |
|
499 |
#(#ViewSpec |
|
500 |
#'name:' 'view2' |
|
501 |
#'component:' |
|
502 |
#(#SpecCollection |
|
503 |
#'collection:' |
|
504 |
#( |
|
505 |
#(#ArbitraryComponentSpec |
|
506 |
#'name:' 'imageEditView' |
|
507 |
#'layout:' #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
508 |
#'hasHorizontalScrollBar:' true |
|
509 |
#'hasVerticalScrollBar:' true |
|
510 |
#'component:' #ImageEditView |
|
511 |
#'hasBorder:' false |
|
512 |
) |
|
513 |
#(#LabelSpec |
|
514 |
#'name:' 'coordLabel' |
|
515 |
#'layout:' #(#LayoutFrame 2 0.0 -22 1 -4 1.0 0 1.0) |
|
516 |
#'level:' -1 |
|
517 |
#'adjust:' #left |
|
518 |
) |
|
519 |
) |
|
520 |
) |
|
521 |
#'level:' -1 |
|
522 |
) |
|
523 |
) |
|
524 |
) |
|
525 |
#'handles:' #(#Any 0.5 1.0) |
|
526 |
) |
|
527 |
#(#UISubSpecification |
|
528 |
#'name:' 'infoBarSubSpec' |
|
569 | 529 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
519 | 530 |
#'majorKey:' #ToolApplicationModel |
535 | 531 |
#'minorKey:' #windowSpecForInfoBarWithClock |
519 | 532 |
) |
533 |
) |
|
534 |
) |
|
535 |
) |
|
536 |
! |
|
537 |
||
538 |
windowSpecForNewImage |
|
539 |
"this window spec was automatically generated by the ST/X UIPainter" |
|
540 |
||
541 |
"do not manually edit this - the painter/builder may not be able to |
|
542 |
handle the specification if its corrupted." |
|
543 |
||
544 |
" |
|
545 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpecForNewImage |
|
546 |
ImageEditor new openInterface:#windowSpecForNewImage |
|
547 |
" |
|
548 |
||
549 |
<resource: #canvas> |
|
550 |
||
551 |
^ |
|
552 |
||
553 |
#(#FullSpec |
|
554 |
#'window:' |
|
555 |
#(#WindowSpec |
|
556 |
#'name:' 'New Image' |
|
557 |
#'layout:' #(#LayoutFrame 194 0 152 0 461 0 248 0) |
|
558 |
#'label:' 'New Image' |
|
559 |
#'min:' #(#Point 10 10) |
|
560 |
#'max:' #(#Point 1152 900) |
|
561 |
#'bounds:' #(#Rectangle 194 152 462 249) |
|
562 |
#'usePreferredExtent:' false |
|
563 |
) |
|
564 |
#'component:' |
|
565 |
#(#SpecCollection |
|
566 |
#'collection:' |
|
567 |
#( |
|
568 |
#(#ViewSpec |
|
569 |
#'name:' 'View' |
|
570 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -38 1.0) |
|
571 |
#'component:' |
|
572 |
#(#SpecCollection |
|
573 |
#'collection:' |
|
574 |
#( |
|
575 |
#(#FramedBoxSpec |
|
576 |
#'name:' 'framedBox1' |
|
577 |
#'layout:' #(#LayoutFrame 1 0.0 1 0.0 0 0.4 55 0) |
|
578 |
#'component:' |
|
579 |
#(#SpecCollection |
|
580 |
#'collection:' |
|
581 |
#( |
|
582 |
#(#ComboBoxSpec |
|
583 |
#'name:' 'defaultSizesComboBox' |
|
584 |
#'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0) |
|
585 |
#'model:' #selectionOfSize |
|
586 |
#'type:' #string |
|
587 |
#'comboList:' #listOfDefaultSizes |
|
588 |
) |
|
589 |
) |
|
590 |
) |
|
591 |
#'label:' 'Size' |
|
592 |
#'labelPosition:' #topLeft |
|
593 |
#'style:' #(#FontDescription #helvetica #medium #roman 12) |
|
594 |
) |
|
595 |
#(#FramedBoxSpec |
|
596 |
#'name:' 'framedBox2' |
|
597 |
#'layout:' #(#LayoutFrame 0 0.4 1 0.0 -1 1.0 55 0) |
|
598 |
#'component:' |
|
599 |
#(#SpecCollection |
|
600 |
#'collection:' |
|
601 |
#( |
|
602 |
#(#ComboListSpec |
|
603 |
#'name:' 'colorMapComboBox' |
|
604 |
#'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0) |
|
605 |
#'model:' #selectionOfColorMap |
|
606 |
#'comboList:' #listOfColorMaps |
|
607 |
#'useIndex:' false |
|
608 |
) |
|
609 |
) |
|
610 |
) |
|
611 |
#'label:' 'Color Map' |
|
612 |
#'labelPosition:' #topLeft |
|
613 |
#'style:' #(#FontDescription #helvetica #medium #roman 12) |
|
614 |
) |
|
615 |
) |
|
616 |
) |
|
617 |
#'level:' 1 |
|
618 |
) |
|
619 |
#(#HorizontalPanelViewSpec |
|
620 |
#'name:' 'horizontalPanelView1' |
|
621 |
#'layout:' #(#LayoutFrame 0 0.0 -38 1 0 1.0 0 1.0) |
|
622 |
#'component:' |
|
623 |
#(#SpecCollection |
|
624 |
#'collection:' |
|
625 |
#( |
|
626 |
#(#ActionButtonSpec |
|
627 |
#'name:' 'actionButton2' |
|
628 |
#'label:' 'Cancel' |
|
629 |
#'model:' #cancel |
|
630 |
#'extent:' #(#Point 100 22) |
|
631 |
) |
|
632 |
#(#ActionButtonSpec |
|
633 |
#'name:' 'actionButton1' |
|
634 |
#'label:' 'OK' |
|
635 |
#'model:' #accept |
|
636 |
#'isDefault:' true |
|
637 |
#'extent:' #(#Point 100 22) |
|
638 |
) |
|
639 |
) |
|
640 |
) |
|
641 |
#'horizontalLayout:' #center |
|
642 |
#'verticalLayout:' #center |
|
643 |
#'horizontalSpace:' 2 |
|
644 |
#'verticalSpace:' 1 |
|
645 |
) |
|
646 |
) |
|
647 |
) |
|
648 |
) |
|
649 |
! ! |
|
650 |
||
651 |
!ImageEditor class methodsFor:'menu specs'! |
|
652 |
||
400 | 653 |
menu |
654 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
655 |
||
656 |
"do not manually edit this - the builder may not be able to |
|
657 |
handle the specification if its corrupted." |
|
658 |
||
659 |
" |
|
660 |
MenuEditor new openOnClass:ImageEditor andSelector:#menu |
|
661 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp |
|
662 |
" |
|
663 |
||
664 |
<resource: #menu> |
|
665 |
||
666 |
^ |
|
667 |
||
668 |
#(#Menu |
|
669 |
||
670 |
#( |
|
671 |
#(#MenuItem |
|
672 |
#'label:' 'About' |
|
579 | 673 |
#'activeHelpKey:' #about |
544 | 674 |
#'labelImage:' #(#ResourceRetriever nil #menuIcon) |
400 | 675 |
#'submenuChannel:' #menuAbout |
676 |
) |
|
677 |
#(#MenuItem |
|
678 |
#'label:' 'File' |
|
679 |
#'translateLabel:' true |
|
579 | 680 |
#'activeHelpKey:' #file |
400 | 681 |
#'submenu:' |
682 |
#(#Menu |
|
683 |
||
684 |
#( |
|
685 |
#(#MenuItem |
|
686 |
#'label:' 'New...' |
|
687 |
#'value:' #newImage |
|
460 | 688 |
#'activeHelpKey:' #fileNewImage |
400 | 689 |
) |
690 |
#(#MenuItem |
|
691 |
#'label:' '-' |
|
692 |
) |
|
693 |
#(#MenuItem |
|
694 |
#'label:' 'Load From File...' |
|
695 |
#'value:' #loadFromFile |
|
460 | 696 |
#'activeHelpKey:' #fileLoadFromFile |
400 | 697 |
) |
698 |
#(#MenuItem |
|
699 |
#'label:' 'Load From Class...' |
|
700 |
#'value:' #loadFromClass |
|
460 | 701 |
#'activeHelpKey:' #fileLoadFromClass |
400 | 702 |
) |
703 |
#(#MenuItem |
|
704 |
#'label:' '-' |
|
705 |
) |
|
706 |
#(#MenuItem |
|
707 |
#'label:' 'Save' |
|
708 |
#'value:' #saveImageFile |
|
460 | 709 |
#'activeHelpKey:' #fileSaveFile |
400 | 710 |
#'enabled:' #imageIsLoaded |
711 |
) |
|
712 |
#(#MenuItem |
|
713 |
#'label:' 'Save As...' |
|
714 |
#'value:' #saveImageFileAs |
|
460 | 715 |
#'activeHelpKey:' #fileSaveAs |
400 | 716 |
#'enabled:' #imageIsLoaded |
717 |
) |
|
718 |
#(#MenuItem |
|
719 |
#'label:' 'Save Mask As...' |
|
720 |
#'value:' #saveImageMaskFileAs |
|
460 | 721 |
#'activeHelpKey:' #fileSaveMaskAs |
400 | 722 |
#'enabled:' #imageIsLoaded |
723 |
) |
|
724 |
#(#MenuItem |
|
725 |
#'label:' '-' |
|
726 |
) |
|
727 |
#(#MenuItem |
|
728 |
#'label:' 'Save Method' |
|
729 |
#'value:' #saveMethod |
|
460 | 730 |
#'activeHelpKey:' #fileSaveMethod |
400 | 731 |
#'enabled:' #imageIsLoaded |
732 |
) |
|
733 |
#(#MenuItem |
|
734 |
#'label:' 'Save Method As...' |
|
735 |
#'value:' #saveMethodAs |
|
460 | 736 |
#'activeHelpKey:' #fileSaveMethodAs |
400 | 737 |
#'enabled:' #imageIsLoaded |
738 |
) |
|
739 |
#(#MenuItem |
|
740 |
#'label:' '-' |
|
741 |
) |
|
742 |
#(#MenuItem |
|
743 |
#'label:' 'Print' |
|
744 |
#'value:' #print |
|
460 | 745 |
#'activeHelpKey:' #filePrint |
400 | 746 |
#'enabled:' #imageIsLoaded |
747 |
) |
|
748 |
#(#MenuItem |
|
749 |
#'label:' '-' |
|
750 |
) |
|
751 |
#(#MenuItem |
|
499 | 752 |
#'label:' 'Browse Image Class' |
400 | 753 |
#'value:' #browseClass |
460 | 754 |
#'activeHelpKey:' #fileBrowseClass |
400 | 755 |
#'enabled:' #imageIsLoaded |
756 |
) |
|
757 |
#(#MenuItem |
|
758 |
#'label:' '-' |
|
759 |
) |
|
760 |
#(#MenuItem |
|
761 |
#'label:' 'Exit' |
|
762 |
#'translateLabel:' true |
|
763 |
#'value:' #closeRequest |
|
460 | 764 |
#'activeHelpKey:' #fileExit |
400 | 765 |
) |
766 |
) nil |
|
767 |
nil |
|
768 |
) |
|
769 |
) |
|
770 |
#(#MenuItem |
|
771 |
#'label:' 'Edit' |
|
579 | 772 |
#'activeHelpKey:' #edit |
400 | 773 |
#'enabled:' #imageIsLoaded |
774 |
#'submenu:' |
|
775 |
#(#Menu |
|
776 |
||
777 |
#( |
|
778 |
#(#MenuItem |
|
779 |
#'label:' 'Undo' |
|
780 |
#'value:' #undo |
|
460 | 781 |
#'activeHelpKey:' #editUndo |
574 | 782 |
#'enabled:' #valueOfCanUndo |
400 | 783 |
) |
784 |
#(#MenuItem |
|
785 |
#'label:' '-' |
|
786 |
) |
|
787 |
#(#MenuItem |
|
788 |
#'label:' 'Flip - Vertical' |
|
789 |
#'value:' #flipVertical |
|
460 | 790 |
#'activeHelpKey:' #editFlipVertical |
400 | 791 |
) |
792 |
#(#MenuItem |
|
793 |
#'label:' 'Flip - Horizontal' |
|
794 |
#'value:' #flipHorizontal |
|
460 | 795 |
#'activeHelpKey:' #editFlipHorizontal |
400 | 796 |
) |
797 |
#(#MenuItem |
|
798 |
#'label:' '-' |
|
799 |
) |
|
800 |
#(#MenuItem |
|
801 |
#'label:' 'Resize...' |
|
802 |
#'value:' #resizeImage |
|
460 | 803 |
#'activeHelpKey:' #editResize |
400 | 804 |
) |
805 |
#(#MenuItem |
|
806 |
#'label:' 'Magnify...' |
|
807 |
#'value:' #magnifyImage |
|
460 | 808 |
#'activeHelpKey:' #editMagnifyImage |
400 | 809 |
) |
810 |
#(#MenuItem |
|
811 |
#'label:' 'Rotate...' |
|
812 |
#'value:' #rotateImage |
|
460 | 813 |
#'activeHelpKey:' #editRotate |
400 | 814 |
) |
815 |
#(#MenuItem |
|
816 |
#'label:' '-' |
|
817 |
) |
|
818 |
#(#MenuItem |
|
819 |
#'label:' 'Negative' |
|
820 |
#'value:' #negativeImage |
|
460 | 821 |
#'activeHelpKey:' #editNegate |
400 | 822 |
) |
823 |
) nil |
|
824 |
nil |
|
825 |
) |
|
826 |
) |
|
827 |
#(#MenuItem |
|
828 |
#'label:' 'Color Map' |
|
579 | 829 |
#'activeHelpKey:' #colorMap |
400 | 830 |
#'enabled:' #imageIsLoaded |
831 |
#'submenu:' |
|
832 |
#(#Menu |
|
833 |
||
834 |
#( |
|
835 |
#(#MenuItem |
|
836 |
#'label:' '8-Plane' |
|
460 | 837 |
#'activeHelpKey:' #colorMap |
400 | 838 |
#'argument:' '8-plane' |
839 |
#'indication:' #'colorMapMode:value:' |
|
840 |
) |
|
841 |
#(#MenuItem |
|
842 |
#'label:' '4-Plane' |
|
460 | 843 |
#'activeHelpKey:' #colorMap |
400 | 844 |
#'argument:' '4-plane' |
845 |
#'indication:' #'colorMapMode:value:' |
|
846 |
) |
|
847 |
#(#MenuItem |
|
848 |
#'label:' '2-Plane' |
|
460 | 849 |
#'activeHelpKey:' #colorMap |
400 | 850 |
#'argument:' '2-plane' |
851 |
#'indication:' #'colorMapMode:value:' |
|
852 |
) |
|
853 |
#(#MenuItem |
|
854 |
#'label:' '1-Plane' |
|
460 | 855 |
#'activeHelpKey:' #colorMap |
400 | 856 |
#'argument:' '1-plane' |
857 |
#'indication:' #'colorMapMode:value:' |
|
858 |
) |
|
859 |
#(#MenuItem |
|
860 |
#'label:' '-' |
|
861 |
) |
|
862 |
#(#MenuItem |
|
863 |
#'label:' '8-Plane + Mask' |
|
460 | 864 |
#'activeHelpKey:' #colorMap |
400 | 865 |
#'argument:' '8-plane + mask' |
866 |
#'indication:' #'colorMapMode:value:' |
|
867 |
) |
|
868 |
#(#MenuItem |
|
869 |
#'label:' '4-Plane + Mask' |
|
460 | 870 |
#'activeHelpKey:' #colorMap |
400 | 871 |
#'argument:' '4-plane + mask' |
872 |
#'indication:' #'colorMapMode:value:' |
|
873 |
) |
|
874 |
#(#MenuItem |
|
875 |
#'label:' '2-Plane + Mask' |
|
460 | 876 |
#'activeHelpKey:' #colorMap |
400 | 877 |
#'argument:' '2-plane + mask' |
878 |
#'indication:' #'colorMapMode:value:' |
|
879 |
) |
|
880 |
#(#MenuItem |
|
881 |
#'label:' '1-Plane + Mask' |
|
460 | 882 |
#'activeHelpKey:' #colorMap |
400 | 883 |
#'argument:' '1-plane + mask' |
884 |
#'indication:' #'colorMapMode:value:' |
|
885 |
) |
|
886 |
) nil |
|
887 |
nil |
|
888 |
) |
|
889 |
) |
|
890 |
#(#MenuItem |
|
891 |
#'label:' 'History' |
|
579 | 892 |
#'activeHelpKey:' #history |
400 | 893 |
#'submenuChannel:' #menuHistory |
894 |
) |
|
895 |
#(#MenuItem |
|
896 |
#'label:' 'Help' |
|
544 | 897 |
#'startGroup:' #right |
579 | 898 |
#'activeHelpKey:' #help |
400 | 899 |
#'submenuChannel:' #menuHelp |
900 |
) |
|
901 |
) nil |
|
902 |
nil |
|
903 |
) |
|
904 |
! |
|
905 |
||
906 |
menuColorAssignment |
|
907 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
908 |
||
909 |
"do not manually edit this - the builder may not be able to |
|
910 |
handle the specification if its corrupted." |
|
911 |
||
912 |
" |
|
913 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuColorAssignment |
|
914 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuColorAssignment)) startUp |
|
915 |
" |
|
916 |
||
917 |
<resource: #menu> |
|
918 |
||
919 |
^ |
|
920 |
||
921 |
#(#Menu |
|
922 |
||
923 |
#( |
|
924 |
#(#MenuItem |
|
925 |
#'label:' 'left' |
|
926 |
#'nameKey:' #leftMouseKeyButton |
|
927 |
#'argument:' '1' |
|
928 |
#'labelImage:' #(#ResourceRetriever nil #leftMouseKeyIcon) |
|
929 |
#'indication:' #'mouseKeyColorMode:value:' |
|
930 |
) |
|
931 |
#(#MenuItem |
|
932 |
#'label:' 'right' |
|
933 |
#'nameKey:' #rightMouseKeyButton |
|
934 |
#'argument:' '2' |
|
935 |
#'labelImage:' #(#ResourceRetriever nil #rightMouseKeyIcon) |
|
936 |
#'indication:' #'mouseKeyColorMode:value:' |
|
937 |
) |
|
938 |
) nil |
|
939 |
nil |
|
940 |
) |
|
941 |
! |
|
942 |
||
943 |
menuToolbar |
|
944 |
"this window spec was automatically generated by the ST/X MenuEditor" |
|
945 |
||
946 |
"do not manually edit this - the builder may not be able to |
|
947 |
handle the specification if its corrupted." |
|
948 |
||
949 |
" |
|
950 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar |
|
951 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp |
|
952 |
" |
|
953 |
||
954 |
<resource: #menu> |
|
955 |
||
956 |
^ |
|
957 |
||
958 |
#(#Menu |
|
959 |
||
960 |
#( |
|
961 |
#(#MenuItem |
|
962 |
#'label:' 'newImage' |
|
963 |
#'isButton:' true |
|
964 |
#'value:' #newImage |
|
460 | 965 |
#'activeHelpKey:' #fileNewImage |
400 | 966 |
#'labelImage:' #(#ResourceRetriever nil #newImageIcon) |
967 |
) |
|
968 |
#(#MenuItem |
|
969 |
#'label:' 'loadFromClass' |
|
970 |
#'isButton:' true |
|
971 |
#'value:' #loadFromClass |
|
460 | 972 |
#'activeHelpKey:' #fileLoadFromClass |
400 | 973 |
#'labelImage:' #(#ResourceRetriever nil #loadFromClassIcon) |
974 |
) |
|
975 |
#(#MenuItem |
|
976 |
#'label:' 'loadFromFile' |
|
977 |
#'isButton:' true |
|
978 |
#'value:' #loadFromFile |
|
460 | 979 |
#'activeHelpKey:' #fileLoadFromFile |
400 | 980 |
#'labelImage:' #(#ResourceRetriever nil #loadFromFileIcon) |
981 |
) |
|
982 |
#(#MenuItem |
|
519 | 983 |
#'label:' '' |
400 | 984 |
) |
985 |
#(#MenuItem |
|
986 |
#'label:' 'saveMethod' |
|
987 |
#'isButton:' true |
|
988 |
#'value:' #saveMethod |
|
460 | 989 |
#'activeHelpKey:' #fileSaveMethod |
400 | 990 |
#'enabled:' #imageIsLoaded |
991 |
#'labelImage:' #(#ResourceRetriever nil #saveAsMethodIcon) |
|
992 |
) |
|
993 |
#(#MenuItem |
|
994 |
#'label:' 'saveFile' |
|
995 |
#'isButton:' true |
|
996 |
#'value:' #saveImageFile |
|
460 | 997 |
#'activeHelpKey:' #fileSaveFile |
400 | 998 |
#'enabled:' #imageIsLoaded |
999 |
#'labelImage:' #(#ResourceRetriever nil #saveIcon) |
|
1000 |
) |
|
1001 |
#(#MenuItem |
|
519 | 1002 |
#'label:' '' |
400 | 1003 |
) |
1004 |
#(#MenuItem |
|
1005 |
#'label:' 'Point' |
|
460 | 1006 |
#'activeHelpKey:' #drawModePoint |
400 | 1007 |
#'enabled:' #imageIsLoaded |
1008 |
#'argument:' 'point' |
|
1009 |
#'indication:' #'editMode:value:' |
|
1010 |
) |
|
1011 |
#(#MenuItem |
|
1012 |
#'label:' 'Box' |
|
460 | 1013 |
#'activeHelpKey:' #drawModeBox |
400 | 1014 |
#'enabled:' #imageIsLoaded |
1015 |
#'argument:' 'box' |
|
1016 |
#'indication:' #'editMode:value:' |
|
1017 |
) |
|
1018 |
#(#MenuItem |
|
1019 |
#'label:' 'Filled Box' |
|
460 | 1020 |
#'activeHelpKey:' #drawModeFilledBox |
400 | 1021 |
#'enabled:' #imageIsLoaded |
1022 |
#'argument:' 'filledBox' |
|
1023 |
#'indication:' #'editMode:value:' |
|
1024 |
) |
|
1025 |
#(#MenuItem |
|
1026 |
#'label:' 'Fill' |
|
460 | 1027 |
#'activeHelpKey:' #drawModeFill |
400 | 1028 |
#'enabled:' #imageIsLoaded |
1029 |
#'argument:' 'fill' |
|
1030 |
#'indication:' #'editMode:value:' |
|
1031 |
) |
|
1032 |
#(#MenuItem |
|
1033 |
#'label:' 'Copy' |
|
460 | 1034 |
#'activeHelpKey:' #drawModeCopy |
400 | 1035 |
#'enabled:' #imageIsLoaded |
1036 |
#'argument:' 'copy' |
|
1037 |
#'indication:' #'editMode:value:' |
|
1038 |
) |
|
1039 |
#(#MenuItem |
|
1040 |
#'label:' 'Paste' |
|
460 | 1041 |
#'activeHelpKey:' #drawModePaste |
400 | 1042 |
#'enabled:' #imageIsLoaded |
1043 |
#'argument:' 'paste' |
|
1044 |
#'indication:' #'editMode:value:' |
|
1045 |
) |
|
1046 |
) nil |
|
1047 |
nil |
|
1048 |
) |
|
1049 |
! ! |
|
1050 |
||
1051 |
!ImageEditor class methodsFor:'resources'! |
|
1052 |
||
1053 |
leftMouseKeyIcon |
|
488 | 1054 |
"Generated by the Image Editor" |
1055 |
" |
|
1056 |
ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon |
|
1057 |
" |
|
400 | 1058 |
|
1059 |
<resource: #image> |
|
488 | 1060 |
|
1061 |
^Icon |
|
1062 |
constantNamed:#'ImageEditor leftMouseKeyIcon' |
|
1063 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@JEE@@B!!QP@@(TT@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b'); yourself); yourself]! |
|
400 | 1064 |
|
1065 |
loadFromClassIcon |
|
488 | 1066 |
"Generated by the Image Editor" |
1067 |
" |
|
1068 |
ImageEditor openOnClass:self andSelector:#loadFromClassIcon |
|
1069 |
" |
|
400 | 1070 |
|
1071 |
<resource: #image> |
|
488 | 1072 |
|
1073 |
^Icon |
|
1074 |
constantNamed:#'ImageEditor loadFromClassIcon' |
|
1075 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDOD_G?G?D_D_8QDP<_<_G1<_<_?!!DQC1?1<QG1G1G>DQDOG?G1<_<_<_8QDP<Q<QG1<Q<Q?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]! |
|
400 | 1076 |
|
1077 |
loadFromFileIcon |
|
488 | 1078 |
"Generated by the Image Editor" |
1079 |
" |
|
1080 |
ImageEditor openOnClass:self andSelector:#loadFromFileIcon |
|
1081 |
" |
|
400 | 1082 |
|
1083 |
<resource: #image> |
|
488 | 1084 |
|
1085 |
^Icon |
|
1086 |
constantNamed:#'ImageEditor loadFromFileIcon' |
|
1087 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDODQ<_<_?1D_8QDP<_?1?1??G??!!DQC1G?G?G?<Q?>DQDOG?<_<_?1??8QDP<_?1?1D_DQ?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]! |
|
400 | 1088 |
|
1089 |
newImageIcon |
|
488 | 1090 |
"Generated by the Image Editor" |
1091 |
" |
|
1092 |
ImageEditor openOnClass:self andSelector:#newImageIcon |
|
1093 |
" |
|
400 | 1094 |
|
1095 |
<resource: #image> |
|
488 | 1096 |
|
1097 |
^Icon |
|
1098 |
constantNamed:#'ImageEditor newImageIcon' |
|
1099 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQ@@@@@@@@@ADQDQDO????????G!!DQDP????????<^8QDQC4QG]4)G51DQDQDOQD]7)J5=??8QDP=DQ7]JQ=_??!!DQC3L6Y#$61/?>DQDOL3Y&$91,??8QDP<3M&X9M,[??!!DQC2H%UR %-_?>DQDOH"UU (-[??8QDP<"IUT(I[W??!!DQC??????????>DQDOG?G1D_G1<_8QDP<Q<_G?<_G1?!!DQC1DQ<Q?1<_G>DQDOG1G1??G1<_8QDP<_<_DQ?1<_?!!DQC??????????>DQG>;.;.;.;.;.8QDQDQDQDQDQDQDQDb'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@_??@_?? _??0_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8_??8'); yourself); yourself]! |
|
400 | 1100 |
|
1101 |
rightMouseKeyIcon |
|
488 | 1102 |
"Generated by the Image Editor" |
1103 |
" |
|
1104 |
ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon |
|
1105 |
" |
|
400 | 1106 |
|
1107 |
<resource: #image> |
|
488 | 1108 |
|
1109 |
^Icon |
|
1110 |
constantNamed:#'ImageEditor rightMouseKeyIcon' |
|
1111 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@EJJ@@AR" @@T((@@@@@@@AUUP@@UUT@@EUU@@AUUP@@UUT@@EUU@@@UU@@@@@@@@@@@@@@a'); colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@?0G? _>A?8G? _>A?8G? _>A?8G? O<@_ @@@b'); yourself); yourself]! |
|
400 | 1112 |
|
1113 |
saveAsMethodIcon |
|
488 | 1114 |
"Generated by the Image Editor" |
1115 |
" |
|
1116 |
ImageEditor openOnClass:self andSelector:#saveAsMethodIcon |
|
1117 |
" |
|
400 | 1118 |
|
1119 |
<resource: #image> |
|
488 | 1120 |
|
1121 |
^Icon |
|
1122 |
constantNamed:#'ImageEditor saveAsMethodIcon' |
|
1123 |
ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQD^8QDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDQDTQG]4)G5>G!!DQDQQD]7)J5=G!!DQDQEDQ7]JQ=_!!8QDQDSL6Y#$61 <ADQDQL3Y&$91,<ODQDQD3M&X9M,XO@QDQDRH%UR %-^;!!DQDQH"UU (-[;.DQDQD"IUT(I[W.8b'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@H@@@@@@@H3N@ID)@ID)@D3I@@@@@@@@@A @@A @@BP@@@@@@@_?<@_?<@_?<@_?<@_?<@_?<@_?<@_?<@_?<'); yourself); yourself]! ! |
|
400 | 1124 |
|
1125 |
!ImageEditor methodsFor:'accessing'! |
|
1126 |
||
1127 |
image |
|
1128 |
||
1129 |
^self imageEditView image |
|
1130 |
! |
|
1131 |
||
1132 |
postOpenAction: anAction |
|
1133 |
||
1134 |
postOpenAction := anAction |
|
1135 |
! ! |
|
1136 |
||
1137 |
!ImageEditor methodsFor:'accessing - views'! |
|
1138 |
||
487 | 1139 |
coordLabel |
1140 |
||
1141 |
^builder componentAt: #coordLabel |
|
1142 |
! |
|
1143 |
||
400 | 1144 |
fileNameInputField |
1145 |
||
1146 |
^builder componentAt: #fileNameInputField |
|
1147 |
! |
|
1148 |
||
1149 |
imageEditView |
|
1150 |
||
1151 |
^(builder componentAt: #imageEditView) subViews first |
|
1152 |
! |
|
1153 |
||
1154 |
imagePreView |
|
1155 |
||
1156 |
^(builder componentAt: #imagePreView) subViews first |
|
1157 |
! |
|
1158 |
||
1159 |
resourceClassInputField |
|
1160 |
||
1161 |
^builder componentAt: #resourceClassInputField |
|
1162 |
! |
|
1163 |
||
1164 |
resourceSelectorInputField |
|
1165 |
||
1166 |
^builder componentAt: #resourceSelectorInputField |
|
1167 |
! ! |
|
1168 |
||
475 | 1169 |
!ImageEditor methodsFor:'active help'! |
1170 |
||
1171 |
defaultInfoLabel |
|
1172 |
||
1173 |
|usedColors| |
|
499 | 1174 |
self image isNil ifTrue: [^'No image loaded.']. |
475 | 1175 |
self image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := self image usedColors size]. |
1176 |
^self image width printString, 'x', |
|
1177 |
self image height printString, 'x', |
|
1178 |
(2 raisedTo: self image depth) printString, |
|
1179 |
(self image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']), |
|
1180 |
usedColors printString, |
|
1181 |
' used colors)' |
|
1182 |
||
1183 |
! ! |
|
1184 |
||
400 | 1185 |
!ImageEditor methodsFor:'aspects'! |
1186 |
||
1187 |
imageIsLoaded |
|
1188 |
||
1189 |
|holder| |
|
1190 |
(holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ |
|
1191 |
builder aspectAt:#imageIsLoaded put:(holder := false asValue). |
|
1192 |
]. |
|
1193 |
^ holder |
|
1194 |
! |
|
1195 |
||
1196 |
listOfColors |
|
1197 |
||
1198 |
|holder| |
|
1199 |
(holder := builder bindingAt:#listOfColors) isNil ifTrue:[ |
|
1200 |
builder aspectAt:#listOfColors put:(holder := List new). |
|
1201 |
]. |
|
1202 |
^ holder |
|
1203 |
! |
|
1204 |
||
1205 |
selectionOfColor |
|
1206 |
||
1207 |
|holder| |
|
1208 |
(holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[ |
|
1209 |
builder aspectAt:#selectionOfColor put:( |
|
1210 |
holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex). |
|
1211 |
]. |
|
1212 |
^ holder |
|
1213 |
! |
|
1214 |
||
1215 |
valueOfCoordLabel |
|
1216 |
||
1217 |
|holder| |
|
1218 |
(holder := builder bindingAt:#valueOfCoordLabel) isNil ifTrue:[ |
|
1219 |
builder aspectAt:#valueOfCoordLabel put:(holder := ValueHolder new). |
|
1220 |
]. |
|
1221 |
^ holder |
|
1222 |
! |
|
1223 |
||
1224 |
valueOfFileName |
|
1225 |
||
1226 |
|holder| |
|
1227 |
(holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[ |
|
1228 |
builder aspectAt:#valueOfFileName put:(holder := '' asValue). |
|
1229 |
holder addDependent: self |
|
1230 |
]. |
|
1231 |
^ holder |
|
1232 |
! |
|
1233 |
||
1234 |
valueOfMagnification |
|
1235 |
||
1236 |
|holder| |
|
1237 |
(holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[ |
|
1238 |
builder aspectAt:#valueOfMagnification put:( |
|
1239 |
holder := AspectAdaptor new subject:self; forAspect:#magnification) |
|
1240 |
]. |
|
1241 |
^ holder |
|
1242 |
! |
|
1243 |
||
1244 |
valueOfResourceClass |
|
1245 |
||
1246 |
|holder| |
|
1247 |
(holder := builder bindingAt:#valueOfResourceClass) isNil ifTrue:[ |
|
1248 |
builder aspectAt:#valueOfResourceClass put: (holder := '' asValue). |
|
1249 |
holder addDependent: self |
|
1250 |
]. |
|
1251 |
^ holder |
|
1252 |
! |
|
1253 |
||
1254 |
valueOfResourceSelector |
|
1255 |
||
1256 |
|holder| |
|
1257 |
(holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[ |
|
1258 |
builder aspectAt:#valueOfResourceSelector put: (holder := '' asValue). |
|
1259 |
holder addDependent: self |
|
1260 |
]. |
|
1261 |
^ holder |
|
1262 |
! ! |
|
1263 |
||
1264 |
!ImageEditor methodsFor:'change & update'! |
|
1265 |
||
1266 |
update:something with:aParameter from:changedObject |
|
1267 |
||
1268 |
something == #value |
|
1269 |
ifTrue: |
|
1270 |
[ |
|
1271 |
(changedObject = self valueOfResourceClass) |
|
1272 |
ifTrue: |
|
1273 |
[ |
|
1274 |
|s what m| |
|
1275 |
s := self resourceClassInputField contents withoutSpaces. |
|
1276 |
what := Smalltalk classnameCompletion:s. |
|
1277 |
self resourceClassInputField contents:what first. |
|
1278 |
(what at:2) size ~~ 1 ifTrue:[ |
|
1279 |
Display beep |
|
1280 |
] |
|
1281 |
]. |
|
1282 |
(changedObject = self valueOfResourceClass) | (changedObject = self valueOfResourceSelector) |
|
1283 |
ifTrue: |
|
1284 |
[ |
|
1285 |
self loadFromMessage: self resourceClassInputField contents, ' ', self resourceSelectorInputField contents |
|
1286 |
]. |
|
1287 |
(changedObject = self valueOfFileName) |
|
1288 |
ifTrue: |
|
1289 |
[ |
|
1290 |
self loadFromFile: self fileNameInputField contents |
|
1291 |
]. |
|
1292 |
]. |
|
1293 |
||
1294 |
super update:something with:aParameter from:changedObject |
|
1295 |
||
1296 |
! ! |
|
1297 |
||
1298 |
!ImageEditor methodsFor:'menu modes'! |
|
1299 |
||
1300 |
colorMapMode: aMode |
|
1301 |
||
1302 |
^colorMapMode = aMode |
|
1303 |
! |
|
1304 |
||
1305 |
colorMapMode: aMode value: aValue |
|
1306 |
||
405 | 1307 |
|depth newColorMap newImage image newColors realColorMap oldFileName| |
400 | 1308 |
|
1309 |
newColorMap := self class listOfColorMaps at: aMode. |
|
1310 |
depth := (newColorMap size log: 2) asInteger. |
|
1311 |
newImage := (Image implementorForDepth: depth) new. |
|
1312 |
oldFileName := self image fileName. |
|
1313 |
Object errorSignal handle: |
|
1314 |
[:ex| |
|
1315 |
Object errorSignal handle: |
|
1316 |
[:ex| |
|
1317 |
^self warn: 'Convertation failed!!' |
|
1318 |
] |
|
1319 |
do: |
|
1320 |
[ |
|
1321 |
self image colorsFromX:0 y:0 toX:(self image width-1) y:(self image height-1) do: |
|
1322 |
[:x :y :clr | |
|
1323 |
(newColorMap includes: clr) |
|
1324 |
ifTrue: [self image colorAtX:x y:y put:clr] |
|
1325 |
ifFalse: [self image colorAtX:x y:y put: self image colorMap first] |
|
1326 |
]. |
|
1327 |
image := newImage fromImage: self image. |
|
1328 |
]. |
|
1329 |
] |
|
1330 |
do: |
|
1331 |
[ |
|
1332 |
image := newImage fromImage: self image |
|
1333 |
]. |
|
1334 |
(String fromString: aMode) reverse readStream nextWord reverse = 'mask' |
|
1335 |
ifTrue: |
|
1336 |
[ |
|
1337 |
image mask isNil |
|
1338 |
ifTrue: |
|
1339 |
[ |
|
1340 |
image mask: (Depth1Image fromImage: (image asThresholdMonochromeImage: 0.1)). |
|
1341 |
]. |
|
1342 |
] |
|
1343 |
ifFalse: |
|
1344 |
[ |
|
1345 |
image mask: nil. |
|
405 | 1346 |
]. |
1347 |
realColorMap := OrderedCollection new. |
|
1348 |
image realColorMap do: |
|
1349 |
[:clr| |
|
1350 |
(realColorMap includes: clr) ifFalse: [realColorMap add: clr] |
|
400 | 1351 |
]. |
405 | 1352 |
newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size). |
400 | 1353 |
newColorMap do: |
1354 |
[:clr| |
|
1355 |
((newColors size < newColorMap size) and: [(newColors includes: clr) not]) |
|
1356 |
ifTrue: |
|
1357 |
[ |
|
1358 |
newColors add: clr |
|
1359 |
] |
|
405 | 1360 |
]. |
400 | 1361 |
image colorMap: newColors. |
1362 |
colorMapMode := aMode. |
|
1363 |
(self imageEditView image: image) notNil |
|
1364 |
ifTrue: |
|
1365 |
[ |
|
1366 |
self image fileName: oldFileName. |
|
1367 |
self listOfColors contents: image colorMap. |
|
1368 |
self findColorMapMode. |
|
1369 |
self updateInputFieldsAndLabelsAndHistory. |
|
1370 |
] |
|
1371 |
! |
|
1372 |
||
1373 |
editMode: aMode |
|
1374 |
||
1375 |
^self imageEditView editMode = aMode |
|
1376 |
! |
|
1377 |
||
1378 |
editMode: aMode value: aValue |
|
1379 |
||
1380 |
self imageEditView editMode: aMode |
|
1381 |
! |
|
1382 |
||
1383 |
mouseKeyColorMode: aMode |
|
1384 |
||
1385 |
^self imageEditView mouseKeyColorMode = aMode |
|
1386 |
! |
|
1387 |
||
1388 |
mouseKeyColorMode: aMode value: aValue |
|
1389 |
||
1390 |
self imageEditView mouseKeyColorMode: aMode. |
|
1391 |
||
1392 |
self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor). |
|
1393 |
! ! |
|
1394 |
||
1395 |
!ImageEditor methodsFor:'private'! |
|
1396 |
||
1397 |
findColorMapMode |
|
1398 |
||
1399 |
self image depth > 8 ifTrue: [colorMapMode := ''. self listOfColors removeAll. ^nil]. |
|
1400 |
colorMapMode := self image depth printString, '-plane'. |
|
1401 |
self listOfColors isEmpty |
|
1402 |
ifTrue: |
|
1403 |
[ |
|
1404 |
self colorMapMode: colorMapMode value: nil |
|
1405 |
]. |
|
1406 |
self imageEditView selectColor: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2)). |
|
1407 |
self image mask notNil |
|
1408 |
ifTrue: |
|
1409 |
[ |
|
1410 |
colorMapMode := colorMapMode, ' + mask'. |
|
1411 |
self listOfColors addFirst: (Color basicNew setColorId:0). |
|
1412 |
self imageEditView selectColor: (Array with: (self listOfColors at: 2) with: (self listOfColors at: 1)). |
|
1413 |
]. |
|
1414 |
self selectionOfColor value: 0. |
|
1415 |
self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor). |
|
1416 |
! |
|
1417 |
||
1418 |
sortColorColumn: aColumn |
|
1419 |
||
1420 |
||
1421 |
||
1422 |
! |
|
1423 |
||
449 | 1424 |
updateForNoneImage |
1425 |
||
1426 |
self imageIsLoaded value: false. |
|
1427 |
self listOfColors removeAll. |
|
1428 |
self imagePreView image: nil |
|
1429 |
||
1430 |
||
1431 |
||
1432 |
||
1433 |
! |
|
1434 |
||
415 | 1435 |
updateInputFields |
1436 |
||
1437 |
self valueOfResourceSelector removeDependent: self. |
|
1438 |
self valueOfResourceSelector value: self imageEditView resourceSelector. |
|
1439 |
self valueOfResourceSelector addDependent: self. |
|
1440 |
||
1441 |
self valueOfResourceClass removeDependent: self. |
|
1442 |
self imageEditView resourceClass notNil |
|
1443 |
ifTrue: [self valueOfResourceClass value: self imageEditView resourceClass] |
|
1444 |
ifFalse: [self valueOfResourceClass value: '']. |
|
1445 |
self valueOfResourceClass addDependent: self. |
|
1446 |
||
1447 |
! |
|
1448 |
||
400 | 1449 |
updateInputFieldsAndLabelsAndHistory |
1450 |
||
1451 |
self imageIsLoaded value: self image notNil. |
|
1452 |
||
1453 |
self image isNil ifTrue: [^nil]. |
|
1454 |
||
1455 |
self updateInfoLabel. |
|
1456 |
||
1457 |
self valueOfFileName removeDependent: self. |
|
1458 |
self valueOfFileName value: self image fileName. |
|
1459 |
self valueOfFileName addDependent: self. |
|
1460 |
||
415 | 1461 |
self updateInputFields. |
400 | 1462 |
|
1463 |
self imageEditView resourceMessage asCollectionOfWords size = 2 |
|
1464 |
ifTrue: [self addToHistory: self imageEditView resourceMessage -> #loadFromMessage:]. |
|
1465 |
||
1466 |
self image fileName notNil |
|
1467 |
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:]. |
|
1468 |
||
1469 |
||
1470 |
||
1471 |
! ! |
|
1472 |
||
535 | 1473 |
!ImageEditor methodsFor:'queries'! |
1474 |
||
1475 |
preferredExtent |
|
1476 |
||
1477 |
^super preferredExtent max: (Screen current width//3)@(Screen current height//3.5) |
|
1478 |
||
1479 |
||
1480 |
! ! |
|
1481 |
||
400 | 1482 |
!ImageEditor methodsFor:'selection'! |
1483 |
||
1484 |
magnification |
|
1485 |
||
1486 |
(builder componentAt: #imageEditView) isNil ifTrue: [^1]. |
|
1487 |
^self imageEditView magnification x |
|
1488 |
! |
|
1489 |
||
1490 |
magnification: aValue |
|
1491 |
||
1492 |
|magnification| |
|
1493 |
magnification := aValue asInteger asPoint. |
|
1494 |
(magnification = self imageEditView magnification) | (magnification = (0@0)) ifTrue: [^nil]. |
|
1495 |
self imageEditView magnification: magnification |
|
1496 |
! |
|
1497 |
||
1498 |
selectedColorIndex |
|
1499 |
||
1500 |
^selectedColorIndex |
|
1501 |
! |
|
1502 |
||
1503 |
selectedColorIndex: anIndex |
|
1504 |
||
1505 |
selectedColorIndex := anIndex. |
|
1506 |
self imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil]) |
|
1507 |
||
1508 |
! ! |
|
1509 |
||
1510 |
!ImageEditor methodsFor:'startup / release'! |
|
1511 |
||
1512 |
closeRequest |
|
1513 |
||
1514 |
self imageEditView checkModified ifTrue:[super closeRequest] |
|
1515 |
||
1516 |
! |
|
1517 |
||
1518 |
open |
|
1519 |
||
1520 |
super open. |
|
444 | 1521 |
|
420 | 1522 |
self imageEditView masterApplication: self. |
444 | 1523 |
|
400 | 1524 |
self resourceClassInputField entryCompletionBlock: |
1525 |
[:value| |
|
1526 |
|what| |
|
1527 |
what := Smalltalk classnameCompletion: value withoutSpaces. |
|
1528 |
self resourceClassInputField contents:what first. |
|
1529 |
(what at:2) size ~~ 1 ifTrue:[ |
|
1530 |
Display beep |
|
1531 |
] |
|
444 | 1532 |
] |
400 | 1533 |
! |
1534 |
||
1535 |
postOpenWith:aBuilder |
|
1536 |
||
415 | 1537 |
self imageEditView masterApplication: self. |
400 | 1538 |
postOpenAction notNil ifTrue: [postOpenAction value]. |
1539 |
super postOpenWith:aBuilder. |
|
1540 |
! |
|
1541 |
||
1542 |
reOpen |
|
1543 |
||
1544 |
self imageEditView checkModified ifTrue:[super reOpen] |
|
1545 |
||
1546 |
! ! |
|
1547 |
||
1548 |
!ImageEditor methodsFor:'user actions - editing'! |
|
1549 |
||
1550 |
browseClass |
|
1551 |
||
1552 |
SystemBrowser openInClass: (Smalltalk at: self imageEditView resourceClass ifAbsent: [^nil]) class selector: self imageEditView resourceSelector |
|
1553 |
! |
|
1554 |
||
228524287573
intitial checkin
tz |