author | Claus Gittinger <cg@exept.de> |
Thu, 24 Oct 2002 16:03:46 +0200 | |
changeset 1630 | d63d47fea8be |
parent 1613 | 1d4f11252d3b |
child 1637 | 2b0f24d74f8e |
permissions | -rw-r--r-- |
400 | 1 |
" |
767 | 2 |
COPYRIGHT (c) 1997-1998 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 |
||
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
13 |
"{ Package: 'stx:libtool2' }" |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
14 |
|
400 | 15 |
ToolApplicationModel subclass:#ImageEditor |
975 | 16 |
instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
17 |
selectedColorIndex postOpenAction imageSeqNr' |
1480 | 18 |
classVariableNames:'LastDirectory MaskClipboard' |
929 | 19 |
poolDictionaries:'' |
20 |
category:'Interface-UIPainter' |
|
400 | 21 |
! |
22 |
||
23 |
!ImageEditor class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
767 | 27 |
COPYRIGHT (c) 1997-1998 by eXept Software AG |
400 | 28 |
All Rights Reserved |
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
405 | 32 |
inclusion of the above copyright notice. This software may not |
400 | 33 |
be provided or otherwise made available to, or used by, any |
405 | 34 |
other person. No title to or ownership of the software is |
400 | 35 |
hereby transferred. |
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
737 | 41 |
Image Editor allows you to create, design, modify or just inspect images. |
400 | 42 |
|
43 |
[start with:] |
|
44 |
ImageEditor open |
|
941 | 45 |
ImageEditor openOnClass:Icon andSelector:#startIcon |
400 | 46 |
|
47 |
[see also:] |
|
48 |
ImageEditView Image |
|
49 |
||
50 |
[author:] |
|
544 | 51 |
Thomas Zwick, eXept Software AG |
400 | 52 |
" |
53 |
! ! |
|
54 |
||
55 |
!ImageEditor class methodsFor:'instance creation'! |
|
56 |
||
57 |
openModalOnClass: aClass andSelector: aSelector |
|
900 | 58 |
"opens modal a Image Editor on aClass and aSelector" |
767 | 59 |
" |
60 |
self openModalOnClass: self andSelector: #leftMouseKeyIcon |
|
61 |
" |
|
400 | 62 |
|
767 | 63 |
|imageEditor imageEditView className resourceClassName resourceSelector| |
64 |
||
400 | 65 |
imageEditor := self new. |
767 | 66 |
|
900 | 67 |
aClass isClass ifTrue: [className := aClass name]. |
68 |
aClass isString ifTrue: [className := aClass]. |
|
903 | 69 |
aClass isNil ifTrue: [className := '']. |
400 | 70 |
|
688 | 71 |
imageEditor postOpenAction: [imageEditView := imageEditor imageEditView. imageEditor loadFromOrPrepareForMessage: className, ' ', aSelector]. |
400 | 72 |
imageEditor openModal. |
73 |
||
688 | 74 |
resourceClassName := imageEditView resourceClass. |
767 | 75 |
resourceSelector := imageEditView resourceSelector. |
415 | 76 |
|
815 | 77 |
((className asString ~= resourceClassName) |
78 |
or:[aSelector asString ~= resourceSelector]) |
|
415 | 79 |
ifTrue: [^resourceClassName, ' ', resourceSelector] |
80 |
ifFalse:[^nil] |
|
400 | 81 |
! |
82 |
||
83 |
openOnClass: aClass andSelector: aSelector |
|
900 | 84 |
"opens a Image Editor on aClass and aSelector" |
767 | 85 |
" |
86 |
self openOnClass: self andSelector: #leftMouseKeyIcon |
|
87 |
" |
|
400 | 88 |
|
1057 | 89 |
|editor| |
90 |
||
91 |
editor := self new. |
|
92 |
editor allButOpen. |
|
1381 | 93 |
aSelector notNil ifTrue:[ |
94 |
editor loadFromMessage: aClass name, ' ', aSelector. |
|
95 |
] ifFalse:[ |
|
96 |
editor resourceClass:aClass |
|
97 |
]. |
|
1057 | 98 |
editor openWindow |
99 |
||
100 |
"Modified: / 16.3.1999 / 21:33:49 / cg" |
|
400 | 101 |
! |
102 |
||
767 | 103 |
openOnFile: aFileName |
900 | 104 |
"opens a Image Editor on aFileName" |
767 | 105 |
" |
106 |
self openOnFile: 'bitmaps/SmalltalkX.xbm' |
|
107 |
" |
|
400 | 108 |
|
1057 | 109 |
|editor| |
110 |
||
111 |
editor := self new. |
|
112 |
editor allButOpen. |
|
113 |
editor loadFromFile: aFileName. |
|
114 |
editor openWindow |
|
115 |
||
116 |
"Modified: / 16.3.1999 / 21:33:25 / cg" |
|
400 | 117 |
! |
118 |
||
767 | 119 |
openOnImage: anImage |
900 | 120 |
"opens a Image Editor on anImage" |
767 | 121 |
" |
895 | 122 |
self openOnImage: Icon startIcon |
767 | 123 |
" |
400 | 124 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
125 |
|editor| |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
126 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
127 |
editor := self new. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
128 |
editor allButOpen. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
129 |
editor loadFromImage: anImage. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
130 |
editor openWindow |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
131 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
132 |
"Modified: / 11.3.1999 / 16:18:33 / cg" |
400 | 133 |
! ! |
134 |
||
135 |
!ImageEditor class methodsFor:'accessing'! |
|
136 |
||
137 |
listOfColorMaps |
|
767 | 138 |
"returns the list of default color maps for a new image" |
400 | 139 |
|
140 |
|colorMap| |
|
898 | 141 |
|
400 | 142 |
(colorMap := OrderedCollection new) |
143 |
add: Color black; |
|
144 |
add: Color white; |
|
145 |
add: Color red; |
|
146 |
add: Color green; |
|
147 |
add: Color blue; |
|
148 |
add: Color cyan; |
|
149 |
add: Color yellow; |
|
150 |
add: Color magenta; |
|
898 | 151 |
add: (Color redByte: 127 greenByte: 0 blueByte: 0); |
152 |
add: (Color redByte: 0 greenByte: 127 blueByte: 0); |
|
153 |
add: (Color redByte: 0 greenByte: 0 blueByte: 127); |
|
154 |
add: (Color redByte: 0 greenByte: 127 blueByte: 127); |
|
155 |
add: (Color redByte: 127 greenByte: 127 blueByte: 0); |
|
156 |
add: (Color redByte: 127 greenByte: 0 blueByte: 127); |
|
157 |
add: (Color redByte: 127 greenByte: 127 blueByte: 127); |
|
158 |
add: (Color redByte: 170 greenByte: 170 blueByte: 170). |
|
159 |
||
400 | 160 |
0 to: 5 do: |
161 |
[:r| |
|
162 |
0 to: 5 do: |
|
163 |
[:g| |
|
164 |
0 to: 5 do: |
|
165 |
[:b| |
|
898 | 166 |
colorMap add: (Color redByte: (r*255//5) ceiling greenByte: (g*255//5) ceiling blueByte: (b*255//5) ceiling) |
400 | 167 |
] |
168 |
] |
|
169 |
]. |
|
170 |
||
171 |
1 to: 25 do: |
|
172 |
[:g| |
|
898 | 173 |
colorMap add: (Color redByte: (g*255//26) ceiling greenByte: (g*255//26) ceiling blueByte: (g*255//26) ceiling) |
400 | 174 |
]. |
175 |
||
176 |
^Dictionary new |
|
177 |
at: '8-plane' put: colorMap; |
|
178 |
at: '8-plane + mask' put: colorMap; |
|
179 |
at: '4-plane' put: (colorMap copyFrom: 1 to: 16); |
|
180 |
at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16); |
|
181 |
at: '2-plane' put: (colorMap copyFrom: 1 to: 4); |
|
182 |
at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4); |
|
183 |
at: '1-plane' put: (colorMap copyFrom: 1 to: 2); |
|
184 |
at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2); |
|
185 |
yourself |
|
186 |
! |
|
187 |
||
188 |
listOfDefaultSizes |
|
767 | 189 |
"returns the list of default sizes for a new image" |
400 | 190 |
|
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
191 |
^#('8x8' '16x16' '22x22' '32x32' '48x48' '64x64') |
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
192 |
|
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
193 |
"Modified: / 31.7.1998 / 01:57:34 / cg" |
400 | 194 |
! ! |
195 |
||
460 | 196 |
!ImageEditor class methodsFor:'help specs'! |
197 |
||
1545 | 198 |
flyByHelpSpec |
199 |
<resource: #help> |
|
200 |
||
201 |
^super flyByHelpSpec addPairsFrom:#( |
|
202 |
||
203 |
#drawModeBox |
|
204 |
'Rectangle' |
|
205 |
||
206 |
#drawModeCopy |
|
207 |
'Copy' |
|
208 |
||
209 |
#drawModeFill |
|
210 |
'Flood-fill' |
|
211 |
||
212 |
#drawModeFilledBox |
|
213 |
'Fill Rectangle' |
|
214 |
||
215 |
#drawModePaste |
|
216 |
'Paste' |
|
217 |
||
218 |
#drawModePasteUnder |
|
219 |
'Paste under' |
|
220 |
||
221 |
#drawModePoint |
|
222 |
'Point' |
|
223 |
||
224 |
#fileGrabImage |
|
225 |
'Pick from screen.' |
|
226 |
||
227 |
#fileLoadFromClass |
|
228 |
'Load from Method' |
|
229 |
||
230 |
#fileLoadFromFile |
|
231 |
'Load from File.' |
|
232 |
||
233 |
#fileNewImage |
|
234 |
'New image' |
|
235 |
||
236 |
#filePrint |
|
237 |
'Print' |
|
238 |
||
239 |
#fileSaveAs |
|
240 |
'Save to file.' |
|
241 |
||
242 |
#fileSaveMaskAs |
|
243 |
'Save to file.' |
|
244 |
||
245 |
#fileSaveMethod |
|
246 |
'Save as method' |
|
247 |
||
248 |
#fileSaveMethodAs |
|
249 |
'Save as method' |
|
250 |
||
251 |
) |
|
252 |
! |
|
253 |
||
460 | 254 |
helpSpec |
737 | 255 |
"This resource specification was automatically generated |
256 |
by the UIHelpTool of ST/X." |
|
257 |
||
258 |
"Do not manually edit this!! If it is corrupted, |
|
259 |
the UIHelpTool may not be able to read the specification." |
|
460 | 260 |
|
261 |
" |
|
737 | 262 |
UIHelpTool openOnClass:ImageEditor |
460 | 263 |
" |
264 |
||
737 | 265 |
<resource: #help> |
266 |
||
267 |
^super helpSpec addPairsFrom:#( |
|
460 | 268 |
|
269 |
#colorMap |
|
929 | 270 |
'ColorMap functions.' |
271 |
||
272 |
#colorMap1 |
|
273 |
'Convert to depth-1 image.' |
|
274 |
||
986 | 275 |
#colorMap1M |
276 |
'Convert to depth-1 image plus mask.' |
|
277 |
||
929 | 278 |
#colorMap2 |
279 |
'Convert to depth-2 image.' |
|
280 |
||
986 | 281 |
#colorMap2M |
282 |
'Convert to depth-2 image plus mask.' |
|
283 |
||
929 | 284 |
#colorMap4 |
285 |
'Convert to depth-4 image.' |
|
286 |
||
986 | 287 |
#colorMap4M |
288 |
'Convert to depth-4 image plus mask.' |
|
289 |
||
929 | 290 |
#colorMap8 |
291 |
'Convert to depth-8 image.' |
|
292 |
||
293 |
#colorMap8M |
|
294 |
'Convert to depth-8 image plus mask.' |
|
295 |
||
986 | 296 |
#colorMapTable |
297 |
'Shows a list of used colors of the image.' |
|
298 |
||
929 | 299 |
#compressColormap |
300 |
'Remove unneeded entries from the colorMap.' |
|
460 | 301 |
|
1045 | 302 |
#cropAll |
986 | 303 |
'Find and remove all borders.' |
304 |
||
1045 | 305 |
#cropBottom |
986 | 306 |
'Find and remove bottom border.' |
307 |
||
1045 | 308 |
#cropLeft |
986 | 309 |
'Find and remove left border.' |
310 |
||
1045 | 311 |
#cropManual |
986 | 312 |
'Specify border(s) to remove.' |
313 |
||
1045 | 314 |
#cropRight |
986 | 315 |
'Find and remove right border.' |
316 |
||
1045 | 317 |
#cropTop |
986 | 318 |
'Find and remove top border.' |
487 | 319 |
|
460 | 320 |
#drawModeBox |
914 | 321 |
'Switches to box-drawing mode.' |
460 | 322 |
|
323 |
#drawModeCopy |
|
914 | 324 |
'Switches to area-copy mode.' |
460 | 325 |
|
326 |
#drawModeFill |
|
914 | 327 |
'Switches to flood-fill mode.' |
460 | 328 |
|
329 |
#drawModeFilledBox |
|
914 | 330 |
'Switches to filled-box drawing mode.' |
460 | 331 |
|
332 |
#drawModePaste |
|
914 | 333 |
'Switches to paste mode.' |
334 |
||
335 |
#drawModePasteUnder |
|
336 |
'Switches to paste under mode.' |
|
460 | 337 |
|
338 |
#drawModePoint |
|
914 | 339 |
'Switches to point-drawing mode.' |
460 | 340 |
|
341 |
#editFlipHorizontal |
|
914 | 342 |
'Flips the image horizontally.' |
460 | 343 |
|
344 |
#editFlipVertical |
|
914 | 345 |
'Flips the image vertically.' |
460 | 346 |
|
347 |
#editMagnifyImage |
|
914 | 348 |
'Magnify the image.' |
460 | 349 |
|
350 |
#editNegate |
|
914 | 351 |
'Invert the images colors.' |
460 | 352 |
|
353 |
#editResize |
|
914 | 354 |
'Resize the image (preserving the old image).' |
460 | 355 |
|
356 |
#editRotate |
|
914 | 357 |
'Rotate the image.' |
460 | 358 |
|
929 | 359 |
#fileGrabImage |
360 |
'Pick an image from the screen.' |
|
361 |
||
460 | 362 |
#fileLoadFromClass |
929 | 363 |
'Select and load an image from a resource method.' |
460 | 364 |
|
365 |
#fileLoadFromFile |
|
929 | 366 |
'Select and load an image from a file.' |
460 | 367 |
|
368 |
#fileNewImage |
|
914 | 369 |
'Create a new image' |
460 | 370 |
|
371 |
#filePrint |
|
372 |
'Print the image on a postscript printer.' |
|
373 |
||
374 |
#fileSaveAs |
|
914 | 375 |
'Save the image to a file.' |
460 | 376 |
|
377 |
#fileSaveMaskAs |
|
914 | 378 |
'Save the mask of the image to a file.' |
460 | 379 |
|
1613 | 380 |
#fileSaveButtonImageAs |
381 |
'Save an image of a button with the image to a file (for html use).' |
|
382 |
||
460 | 383 |
#fileSaveMethod |
914 | 384 |
'Save the image as resource method in the current class and selector.' |
460 | 385 |
|
386 |
#fileSaveMethodAs |
|
914 | 387 |
'Save the image as resource method in a class.' |
460 | 388 |
|
487 | 389 |
#magnificationNumber |
914 | 390 |
'Shows the current magnification.' |
487 | 391 |
|
392 |
#magnifyImageDown |
|
914 | 393 |
'Decrease magnification.' |
487 | 394 |
|
395 |
#magnifyImageUp |
|
914 | 396 |
'Increase magnification.' |
487 | 397 |
|
398 |
#mouseKeyColorMode |
|
914 | 399 |
'Toggles between left and right mouse button color.' |
487 | 400 |
|
401 |
#previewView |
|
914 | 402 |
'Shows a preview of the image.' |
487 | 403 |
|
905 | 404 |
#settingsGridMagnification |
914 | 405 |
'Change the grid magnification of the edit view.' |
905 | 406 |
|
460 | 407 |
) |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
408 |
|
986 | 409 |
"Modified: / 7.9.1998 / 18:20:26 / cg" |
460 | 410 |
! ! |
411 |
||
737 | 412 |
!ImageEditor class methodsFor:'image specs'! |
413 |
||
414 |
leftMouseKeyIcon |
|
415 |
"This resource specification was automatically generated |
|
416 |
by the ImageEditor of ST/X." |
|
417 |
||
418 |
"Do not manually edit this!! If it is corrupted, |
|
419 |
the ImageEditor may not be able to read the specification." |
|
420 |
||
421 |
" |
|
1405 | 422 |
self leftMouseKeyIcon inspect |
737 | 423 |
ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon |
424 |
" |
|
425 |
||
426 |
<resource: #image> |
|
427 |
||
428 |
^Icon |
|
429 |
constantNamed:#'ImageEditor leftMouseKeyIcon' |
|
1433 | 430 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@EJJ@@AR" @@T((@@@@@@@B** @@**(@@J**@@B** @@**(@@J**@@@**@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; 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] |
431 |
! |
|
737 | 432 |
|
433 |
rightMouseKeyIcon |
|
434 |
"This resource specification was automatically generated |
|
435 |
by the ImageEditor of ST/X." |
|
436 |
||
437 |
"Do not manually edit this!! If it is corrupted, |
|
438 |
the ImageEditor may not be able to read the specification." |
|
439 |
||
440 |
" |
|
1405 | 441 |
self rightMouseKeyIcon inspect |
737 | 442 |
ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon |
443 |
" |
|
444 |
||
445 |
<resource: #image> |
|
446 |
||
447 |
^Icon |
|
448 |
constantNamed:#'ImageEditor rightMouseKeyIcon' |
|
1433 | 449 |
ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@JJE@@B"!!P@@((T@@@@@@@B** @@**(@@J**@@B** @@**(@@J**@@@**@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 0 0 255 255 255]; 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] |
450 |
! ! |
|
737 | 451 |
|
400 | 452 |
!ImageEditor class methodsFor:'interface specs'! |
453 |
||
767 | 454 |
dialogSpecForNewImage |
737 | 455 |
"This resource specification was automatically generated |
456 |
by the UIPainter of ST/X." |
|
519 | 457 |
|
737 | 458 |
"Do not manually edit this!! If it is corrupted, |
459 |
the UIPainter may not be able to read the specification." |
|
519 | 460 |
|
461 |
" |
|
767 | 462 |
UIPainter new openOnClass:ImageEditor andSelector:#dialogSpecForNewImage |
463 |
ImageEditor new openInterface:#dialogSpecForNewImage |
|
519 | 464 |
" |
465 |
||
466 |
<resource: #canvas> |
|
467 |
||
468 |
^ |
|
469 |
||
470 |
#(#FullSpec |
|
672 | 471 |
#window: |
519 | 472 |
#(#WindowSpec |
672 | 473 |
#name: 'New Image' |
975 | 474 |
#layout: #(#LayoutFrame 81 0 288 0 381 0 406 0) |
672 | 475 |
#label: 'New Image' |
476 |
#min: #(#Point 10 10) |
|
477 |
#max: #(#Point 1152 900) |
|
975 | 478 |
#bounds: #(#Rectangle 81 288 382 407) |
672 | 479 |
#usePreferredExtent: false |
519 | 480 |
) |
672 | 481 |
#component: |
519 | 482 |
#(#SpecCollection |
672 | 483 |
#collection: |
519 | 484 |
#( |
485 |
#(#ViewSpec |
|
672 | 486 |
#name: 'View' |
737 | 487 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -35 1.0) |
672 | 488 |
#component: |
519 | 489 |
#(#SpecCollection |
672 | 490 |
#collection: |
519 | 491 |
#( |
492 |
#(#FramedBoxSpec |
|
672 | 493 |
#name: 'framedBox1' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
494 |
#layout: #(#LayoutFrame 1 0.0 7 0.0 0 0.4 76 0) |
672 | 495 |
#component: |
519 | 496 |
#(#SpecCollection |
672 | 497 |
#collection: |
519 | 498 |
#( |
499 |
#(#ComboBoxSpec |
|
672 | 500 |
#name: 'defaultSizesComboBox' |
975 | 501 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 502 |
#model: #selectionOfSize |
503 |
#type: #string |
|
504 |
#comboList: #listOfDefaultSizes |
|
519 | 505 |
) |
506 |
) |
|
507 |
) |
|
672 | 508 |
#label: 'Size' |
509 |
#labelPosition: #topLeft |
|
510 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 511 |
) |
512 |
#(#FramedBoxSpec |
|
672 | 513 |
#name: 'framedBox2' |
932
7111238cda23
fixed dimension of new-image dialog.
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
514 |
#layout: #(#LayoutFrame 0 0.4 7 0.0 -1 1.0 76 0) |
672 | 515 |
#component: |
519 | 516 |
#(#SpecCollection |
672 | 517 |
#collection: |
519 | 518 |
#( |
519 |
#(#ComboListSpec |
|
672 | 520 |
#name: 'colorMapComboBox' |
975 | 521 |
#layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0) |
672 | 522 |
#model: #selectionOfColorMap |
523 |
#comboList: #listOfColorMaps |
|
524 |
#useIndex: false |
|
519 | 525 |
) |
526 |
) |
|
527 |
) |
|
672 | 528 |
#label: 'Color Map' |
529 |
#labelPosition: #topLeft |
|
530 |
#style: #(#FontDescription #helvetica #medium #roman 12) |
|
519 | 531 |
) |
532 |
) |
|
533 |
) |
|
672 | 534 |
#level: 1 |
519 | 535 |
) |
672 | 536 |
#(#UISubSpecification |
975 | 537 |
#name: 'windowSpecForCommitWithoutChannels' |
737 | 538 |
#layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0) |
672 | 539 |
#minorKey: #windowSpecForCommitWithoutChannels |
519 | 540 |
) |
541 |
) |
|
542 |
) |
|
543 |
) |
|
767 | 544 |
! |
545 |
||
1045 | 546 |
gropDialogSpec |
986 | 547 |
"This resource specification was automatically generated |
548 |
by the UIPainter of ST/X." |
|
549 |
||
550 |
"Do not manually edit this!! If it is corrupted, |
|
551 |
the UIPainter may not be able to read the specification." |
|
552 |
||
553 |
" |
|
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
554 |
UIPainter new openOnClass:ImageEditor andSelector:#gropDialogSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
555 |
ImageEditor new openInterface:#gropDialogSpec |
986 | 556 |
" |
557 |
||
558 |
<resource: #canvas> |
|
559 |
||
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
560 |
^ |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
561 |
#(#FullSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
562 |
#name: #gropDialogSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
563 |
#window: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
564 |
#(#WindowSpec |
1480 | 565 |
#label: 'Crop Border(s)' |
1490 | 566 |
#name: 'Crop Border(s)' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
567 |
#min: #(#Point 10 10) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
568 |
#max: #(#Point 800 478) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
569 |
#bounds: #(#Rectangle 16 46 261 229) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
570 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
571 |
#component: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
572 |
#(#SpecCollection |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
573 |
#collection: #( |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
574 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
575 |
#label: 'Left:' |
1502 | 576 |
#name: 'GropLeftLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
577 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
578 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
579 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
580 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
581 |
#(#InputFieldSpec |
1502 | 582 |
#name: 'GropLeftEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
583 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
1507 | 584 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
585 |
#model: #left |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
586 |
#type: #number |
1502 | 587 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
588 |
#acceptOnPointerLeave: false |
1502 | 589 |
) |
590 |
#(#ActionButtonSpec |
|
591 |
#label: 'Now' |
|
592 |
#name: 'GropLeftNowButton' |
|
593 |
#layout: #(#LayoutFrame 148 0 21 0 221 0 43 0) |
|
594 |
#translateLabel: true |
|
1507 | 595 |
#tabable: true |
1502 | 596 |
#model: #gropLeftNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
597 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
598 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
599 |
#label: 'Right:' |
1502 | 600 |
#name: 'GropRightLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
601 |
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
602 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
603 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
604 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
605 |
#(#InputFieldSpec |
1502 | 606 |
#name: 'GropRightEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
607 |
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0) |
1507 | 608 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
609 |
#model: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
610 |
#type: #number |
1502 | 611 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
612 |
#acceptOnPointerLeave: false |
1502 | 613 |
) |
614 |
#(#ActionButtonSpec |
|
615 |
#label: 'Now' |
|
616 |
#name: 'GropRightButton' |
|
617 |
#layout: #(#LayoutFrame 148 0 51 0 221 0 73 0) |
|
618 |
#translateLabel: true |
|
1507 | 619 |
#tabable: true |
1502 | 620 |
#model: #gropRightNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
621 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
622 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
623 |
#label: 'Top:' |
1502 | 624 |
#name: 'GropTopLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
625 |
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
626 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
627 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
628 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
629 |
#(#InputFieldSpec |
1502 | 630 |
#name: 'GropTopEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
631 |
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0) |
1507 | 632 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
633 |
#model: #top |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
634 |
#type: #number |
1502 | 635 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
636 |
#acceptOnPointerLeave: false |
1502 | 637 |
) |
638 |
#(#ActionButtonSpec |
|
639 |
#label: 'Now' |
|
640 |
#name: 'GropTopButton' |
|
641 |
#layout: #(#LayoutFrame 148 0 81 0 221 0 103 0) |
|
642 |
#translateLabel: true |
|
1507 | 643 |
#tabable: true |
1502 | 644 |
#model: #gropTopNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
645 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
646 |
#(#LabelSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
647 |
#label: 'Bottom:' |
1502 | 648 |
#name: 'GropBottomLabel' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
649 |
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
650 |
#translateLabel: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
651 |
#adjust: #right |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
652 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
653 |
#(#InputFieldSpec |
1502 | 654 |
#name: 'GropBottomEntryField' |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
655 |
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0) |
1507 | 656 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
657 |
#model: #bottom |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
658 |
#type: #number |
1502 | 659 |
#acceptChannel: #acceptChannel |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
660 |
#acceptOnPointerLeave: false |
1502 | 661 |
) |
662 |
#(#ActionButtonSpec |
|
663 |
#label: 'Now' |
|
664 |
#name: 'GropBottomButton' |
|
665 |
#layout: #(#LayoutFrame 148 0 111 0 221 0 133 0) |
|
666 |
#translateLabel: true |
|
1507 | 667 |
#tabable: true |
1502 | 668 |
#model: #gropBottomNow |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
669 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
670 |
#(#HorizontalPanelViewSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
671 |
#name: 'HorizontalPanel1' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
672 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
673 |
#horizontalLayout: #fitSpace |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
674 |
#verticalLayout: #center |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
675 |
#horizontalSpace: 3 |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
676 |
#verticalSpace: 3 |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
677 |
#reverseOrderIfOKAtLeft: true |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
678 |
#component: |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
679 |
#(#SpecCollection |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
680 |
#collection: #( |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
681 |
#(#ActionButtonSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
682 |
#label: 'Cancel' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
683 |
#name: 'Button1' |
986 | 684 |
#translateLabel: true |
1507 | 685 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
686 |
#model: #cancel |
1490 | 687 |
#extent: #(#Point 77 22) |
688 |
) |
|
689 |
#(#ActionButtonSpec |
|
690 |
#label: 'Apply' |
|
691 |
#name: 'Button3' |
|
692 |
#translateLabel: true |
|
1507 | 693 |
#tabable: true |
1490 | 694 |
#model: #applyAction |
695 |
#extent: #(#Point 78 22) |
|
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
696 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
697 |
#(#ActionButtonSpec |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
698 |
#label: 'OK' |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
699 |
#name: 'Button2' |
986 | 700 |
#translateLabel: true |
1507 | 701 |
#tabable: true |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
702 |
#model: #accept |
1490 | 703 |
#extent: #(#Point 78 22) |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
704 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
705 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
706 |
|
986 | 707 |
) |
1457
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
708 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
709 |
) |
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
710 |
|
8c15098c3469
ok button is left in some viewStyles
Claus Gittinger <cg@exept.de>
parents:
1449
diff
changeset
|
711 |
) |
986 | 712 |
) |
713 |
! |
|
714 |
||
1557 | 715 |
shiftDialogSpec |
716 |
"This resource specification was automatically generated |
|
717 |
by the UIPainter of ST/X." |
|
718 |
||
719 |
"Do not manually edit this!! If it is corrupted, |
|
720 |
the UIPainter may not be able to read the specification." |
|
721 |
||
722 |
" |
|
723 |
UIPainter new openOnClass:ImageEditor andSelector:#shiftDialogSpec |
|
724 |
ImageEditor new openInterface:#shiftDialogSpec |
|
725 |
" |
|
726 |
||
727 |
<resource: #canvas> |
|
728 |
||
729 |
^ |
|
730 |
#(#FullSpec |
|
731 |
#name: #shiftDialogSpec |
|
732 |
#window: |
|
733 |
#(#WindowSpec |
|
734 |
#label: 'Shift' |
|
735 |
#name: 'Shift' |
|
736 |
#min: #(#Point 10 10) |
|
737 |
#max: #(#Point 800 478) |
|
738 |
#bounds: #(#Rectangle 16 46 261 229) |
|
739 |
) |
|
740 |
#component: |
|
741 |
#(#SpecCollection |
|
742 |
#collection: #( |
|
743 |
#(#LabelSpec |
|
744 |
#label: 'Amount:' |
|
745 |
#name: 'AmountLabel' |
|
746 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
|
747 |
#translateLabel: true |
|
748 |
#adjust: #right |
|
749 |
) |
|
750 |
#(#InputFieldSpec |
|
751 |
#name: 'AmountEntryField' |
|
752 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
|
753 |
#tabable: true |
|
754 |
#model: #shiftAmount |
|
755 |
#type: #number |
|
756 |
#acceptChannel: #acceptChannel |
|
757 |
#acceptOnPointerLeave: false |
|
758 |
) |
|
759 |
#(#HorizontalPanelViewSpec |
|
760 |
#name: 'HorizontalPanel1' |
|
761 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
|
762 |
#horizontalLayout: #fitSpace |
|
763 |
#verticalLayout: #center |
|
764 |
#horizontalSpace: 3 |
|
765 |
#verticalSpace: 3 |
|
766 |
#reverseOrderIfOKAtLeft: true |
|
767 |
#component: |
|
768 |
#(#SpecCollection |
|
769 |
#collection: #( |
|
770 |
#(#ActionButtonSpec |
|
771 |
#label: 'Cancel' |
|
772 |
#name: 'Button1' |
|
773 |
#translateLabel: true |
|
774 |
#tabable: true |
|
775 |
#model: #cancel |
|
776 |
#extent: #(#Point 118 22) |
|
777 |
) |
|
778 |
#(#ActionButtonSpec |
|
779 |
#label: 'OK' |
|
780 |
#name: 'Button2' |
|
781 |
#translateLabel: true |
|
782 |
#tabable: true |
|
783 |
#model: #accept |
|
784 |
#extent: #(#Point 118 22) |
|
785 |
) |
|
786 |
) |
|
787 |
||
788 |
) |
|
789 |
) |
|
790 |
#(#ArrowButtonSpec |
|
791 |
#name: 'ArrowButton1' |
|
792 |
#layout: #(#LayoutFrame 105 0 67 0 127 0 89 0) |
|
793 |
#model: #shiftUpNow |
|
794 |
#isTriggerOnDown: true |
|
795 |
#actionValue: '' |
|
796 |
#direction: #up |
|
797 |
) |
|
798 |
#(#ArrowButtonSpec |
|
799 |
#name: 'ArrowButton2' |
|
800 |
#layout: #(#LayoutFrame 88 0 86 0 110 0 108 0) |
|
801 |
#model: #shiftLeftNow |
|
802 |
#isTriggerOnDown: true |
|
803 |
#actionValue: '' |
|
804 |
#direction: #left |
|
805 |
) |
|
806 |
#(#ArrowButtonSpec |
|
807 |
#name: 'ArrowButton3' |
|
808 |
#layout: #(#LayoutFrame 122 0 86 0 144 0 108 0) |
|
809 |
#model: #shiftRightNow |
|
810 |
#isTriggerOnDown: true |
|
811 |
#actionValue: '' |
|
812 |
#direction: #right |
|
813 |
) |
|
814 |
#(#ArrowButtonSpec |
|
815 |
#name: 'ArrowButton4' |
|
816 |
#layout: #(#LayoutFrame 105 0 103 0 127 0 125 0) |
|
817 |
#model: #shiftDownNow |
|
818 |
#isTriggerOnDown: true |
|
819 |
#actionValue: '' |
|
820 |
#direction: #down |
|
821 |
) |
|
822 |
) |
|
823 |
||
824 |
) |
|
825 |
) |
|
826 |
! |
|
827 |
||
1480 | 828 |
ungropDialogSpec |
829 |
"This resource specification was automatically generated |
|
830 |
by the UIPainter of ST/X." |
|
831 |
||
832 |
"Do not manually edit this!! If it is corrupted, |
|
833 |
the UIPainter may not be able to read the specification." |
|
834 |
||
835 |
" |
|
836 |
UIPainter new openOnClass:ImageEditor andSelector:#ungropDialogSpec |
|
837 |
ImageEditor new openInterface:#ungropDialogSpec |
|
838 |
" |
|
839 |
||
840 |
<resource: #canvas> |
|
841 |
||
842 |
^ |
|
843 |
#(#FullSpec |
|
844 |
#name: #ungropDialogSpec |
|
845 |
#window: |
|
846 |
#(#WindowSpec |
|
847 |
#label: 'Add Border(s)' |
|
848 |
#name: 'Add Borders' |
|
849 |
#min: #(#Point 10 10) |
|
850 |
#max: #(#Point 800 478) |
|
851 |
#bounds: #(#Rectangle 16 46 261 229) |
|
852 |
) |
|
853 |
#component: |
|
854 |
#(#SpecCollection |
|
855 |
#collection: #( |
|
856 |
#(#LabelSpec |
|
857 |
#label: 'Left:' |
|
858 |
#name: 'Label1' |
|
859 |
#layout: #(#LayoutFrame 14 0 21 0 90 0 43 0) |
|
860 |
#translateLabel: true |
|
861 |
#adjust: #right |
|
862 |
) |
|
863 |
#(#InputFieldSpec |
|
864 |
#name: 'EntryField1' |
|
865 |
#layout: #(#LayoutFrame 95 0 21 0 132 0 43 0) |
|
866 |
#model: #left |
|
867 |
#type: #number |
|
868 |
#acceptOnPointerLeave: false |
|
869 |
) |
|
870 |
#(#LabelSpec |
|
871 |
#label: 'Right:' |
|
872 |
#name: 'Label2' |
|
873 |
#layout: #(#LayoutFrame 14 0 51 0 90 0 73 0) |
|
874 |
#translateLabel: true |
|
875 |
#adjust: #right |
|
876 |
) |
|
877 |
#(#InputFieldSpec |
|
878 |
#name: 'EntryField2' |
|
879 |
#layout: #(#LayoutFrame 95 0 51 0 132 0 73 0) |
|
880 |
#model: #right |
|
881 |
#type: #number |
|
882 |
#acceptOnPointerLeave: false |
|
883 |
) |
|
884 |
#(#LabelSpec |
|
885 |
#label: 'Top:' |
|
886 |
#name: 'Label3' |
|
887 |
#layout: #(#LayoutFrame 14 0 81 0 90 0 103 0) |
|
888 |
#translateLabel: true |
|
889 |
#adjust: #right |
|
890 |
) |
|
891 |
#(#InputFieldSpec |
|
892 |
#name: 'EntryField3' |
|
893 |
#layout: #(#LayoutFrame 95 0 81 0 132 0 103 0) |
|
894 |
#model: #top |
|
895 |
#type: #number |
|
896 |
#acceptOnPointerLeave: false |
|
897 |
) |
|
898 |
#(#LabelSpec |
|
899 |
#label: 'Bottom:' |
|
900 |
#name: 'Label4' |
|
901 |
#layout: #(#LayoutFrame 14 0 111 0 90 0 133 0) |
|
902 |
#translateLabel: true |
|
903 |
#adjust: #right |
|
904 |
) |
|
905 |
#(#InputFieldSpec |
|
906 |
#name: 'EntryField4' |
|
907 |
#layout: #(#LayoutFrame 95 0 111 0 132 0 133 0) |
|
908 |
#model: #bottom |
|
909 |
#type: #number |
|
910 |
#acceptOnPointerLeave: false |
|
911 |
) |
|
912 |
#(#HorizontalPanelViewSpec |
|
913 |
#name: 'HorizontalPanel1' |
|
914 |
#layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1) |
|
915 |
#horizontalLayout: #fitSpace |
|
916 |
#verticalLayout: #center |
|
917 |
#horizontalSpace: 3 |
|
918 |
#verticalSpace: 3 |
|
919 |
#reverseOrderIfOKAtLeft: true |
|
920 |
#component: |
|
921 |
#(#SpecCollection |
|
922 |
#collection: #( |
|
923 |
#(#ActionButtonSpec |
|
924 |
#label: 'Cancel' |
|
925 |
#name: 'Button1' |
|
926 |
#translateLabel: true |
|
927 |
#model: #cancel |
|
928 |
#extent: #(#Point 118 22) |
|
929 |
) |
|
930 |
#(#ActionButtonSpec |
|
931 |
#label: 'OK' |
|
932 |
#name: 'Button2' |
|
933 |
#translateLabel: true |
|
934 |
#model: #accept |
|
935 |
#extent: #(#Point 118 22) |
|
936 |
) |
|
937 |
) |
|
938 |
||
939 |
) |
|
940 |
) |
|
941 |
) |
|
942 |
||
943 |
) |
|
944 |
) |
|
945 |
! |
|
946 |
||
767 | 947 |
windowSpec |
948 |
"This resource specification was automatically generated |
|
949 |
by the UIPainter of ST/X." |
|
950 |
||
951 |
"Do not manually edit this!! If it is corrupted, |
|
952 |
the UIPainter may not be able to read the specification." |
|
953 |
||
954 |
" |
|
955 |
UIPainter new openOnClass:ImageEditor andSelector:#windowSpec |
|
956 |
ImageEditor new openInterface:#windowSpec |
|
957 |
ImageEditor open |
|
958 |
" |
|
959 |
||
960 |
<resource: #canvas> |
|
961 |
||
1558 | 962 |
^ |
963 |
#(#FullSpec |
|
964 |
#name: #windowSpec |
|
965 |
#window: |
|
966 |
#(#WindowSpec |
|
967 |
#label: 'Image Editor' |
|
968 |
#name: 'Image Editor' |
|
969 |
#min: #(#Point 400 320) |
|
970 |
#bounds: #(#Rectangle 16 42 514 386) |
|
971 |
#menu: #menu |
|
972 |
) |
|
973 |
#component: |
|
974 |
#(#SpecCollection |
|
975 |
#collection: #( |
|
976 |
#(#MenuPanelSpec |
|
977 |
#name: 'menuToolbarView' |
|
978 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
979 |
#menu: #menuToolbar |
|
980 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
|
981 |
#showSeparatingLines: true |
|
982 |
) |
|
983 |
#(#VariableHorizontalPanelSpec |
|
984 |
#name: 'variableHorizontalPanel1' |
|
985 |
#layout: #(#LayoutFrame 0 0.0 34 0.0 0 1.0 -26 1.0) |
|
986 |
#component: |
|
987 |
#(#SpecCollection |
|
988 |
#collection: #( |
|
989 |
#(#ViewSpec |
|
990 |
#name: 'view1' |
|
767 | 991 |
#component: |
1558 | 992 |
#(#SpecCollection |
993 |
#collection: #( |
|
994 |
#(#VariableVerticalPanelSpec |
|
995 |
#name: 'VariableVerticalPanel1' |
|
996 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
997 |
#component: |
|
998 |
#(#SpecCollection |
|
999 |
#collection: #( |
|
1000 |
#(#ViewSpec |
|
1001 |
#name: 'View1' |
|
1002 |
#component: |
|
767 | 1003 |
#(#SpecCollection |
1558 | 1004 |
#collection: #( |
1005 |
#(#MenuPanelSpec |
|
1006 |
#name: 'MouseButtonColorToolBar' |
|
1007 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 24 0) |
|
1008 |
#menu: #menuMouseButtonColors |
|
1009 |
) |
|
1010 |
#(#DataSetSpec |
|
1011 |
#name: 'colorDataSetView' |
|
1012 |
#layout: #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0) |
|
1013 |
#activeHelpKey: #colorMapTable |
|
1014 |
#model: #selectionOfColor |
|
1015 |
#menu: #colorMapMenu |
|
1016 |
#style: #(#FontDescription #helvetica #medium #roman 10) |
|
1017 |
#hasHorizontalScrollBar: true |
|
1018 |
#hasVerticalScrollBar: true |
|
1019 |
#miniScrollerHorizontal: true |
|
1020 |
#miniScrollerVertical: true |
|
1021 |
#dataList: #listOfColors |
|
1022 |
#has3Dsepartors: true |
|
1023 |
#has3Dseparators: true |
|
1024 |
#verticalSpacing: 1 |
|
1025 |
#columns: |
|
1026 |
#(#OrderedCollection |
|
1027 |
||
1028 |
#(#DataSetColumnSpec |
|
1029 |
#labelButtonType: #Button |
|
1030 |
#rendererType: #rowSelector |
|
1031 |
#backgroundSelector: #theColorItSelf: |
|
1032 |
) |
|
1033 |
#(#DataSetColumnSpec |
|
1034 |
#label: 'R' |
|
1035 |
#labelAlignment: #left |
|
1036 |
#labelButtonType: #Button |
|
1037 |
#columnAlignment: #right |
|
1038 |
#editorType: #InputField |
|
1039 |
#type: #number |
|
1040 |
#model: #redFromColor: |
|
1041 |
#writeSelector: #redAtColor:put: |
|
1042 |
#selectSelector: #canSelectRedInColor: |
|
1043 |
) |
|
1044 |
||
1045 |
#(#DataSetColumnSpec |
|
1046 |
#label: 'G' |
|
1047 |
#labelAlignment: #left |
|
1048 |
#labelButtonType: #Button |
|
1049 |
#columnAlignment: #right |
|
1050 |
#editorType: #InputField |
|
1051 |
#type: #number |
|
1052 |
#model: #greenFromColor: |
|
1053 |
#writeSelector: #greenAtColor:put: |
|
1054 |
#selectSelector: #canSelectGreenInColor: |
|
1055 |
) |
|
1056 |
#(#DataSetColumnSpec |
|
1057 |
#label: 'B' |
|
1058 |
#labelAlignment: #left |
|
1059 |
#labelButtonType: #Button |
|
1060 |
#columnAlignment: #right |
|
1061 |
#editorType: #InputField |
|
1062 |
#type: #number |
|
1063 |
#model: #blueFromColor: |
|
1064 |
#writeSelector: #blueAtColor:put: |
|
1065 |
#selectSelector: #canSelectBlueInColor: |
|
767 | 1066 |
) |
1558 | 1067 |
) |
1068 |
#columnAdaptor: #colorColumnAdaptor |
|
767 | 1069 |
) |
1558 | 1070 |
) |
1071 |
||
1072 |
) |
|
1073 |
) |
|
1074 |
#(#ArbitraryComponentSpec |
|
1075 |
#name: 'imagePreView' |
|
1076 |
#activeHelpKey: #previewView |
|
1077 |
#menu: #previewMenu |
|
1078 |
#hasHorizontalScrollBar: true |
|
1079 |
#hasVerticalScrollBar: true |
|
1080 |
#miniScrollerHorizontal: true |
|
1081 |
#miniScrollerVertical: true |
|
1082 |
#hasBorder: false |
|
1083 |
#component: #ImageView |
|
767 | 1084 |
) |
1558 | 1085 |
) |
1086 |
||
767 | 1087 |
) |
1558 | 1088 |
#handles: #(#Any 0.723776 1.0) |
767 | 1089 |
) |
1558 | 1090 |
) |
1091 |
||
767 | 1092 |
) |
1558 | 1093 |
) |
1094 |
#(#ViewSpec |
|
1095 |
#name: 'view2' |
|
1096 |
#level: -1 |
|
1097 |
#component: |
|
1098 |
#(#SpecCollection |
|
1099 |
#collection: #( |
|
1100 |
#(#ArbitraryComponentSpec |
|
1101 |
#name: 'imageEditView' |
|
1102 |
#layout: #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 -24 1.0) |
|
1103 |
#hasHorizontalScrollBar: true |
|
1104 |
#hasVerticalScrollBar: true |
|
1105 |
#hasBorder: false |
|
1106 |
#component: #ImageEditView |
|
1107 |
) |
|
1108 |
#(#LabelSpec |
|
1109 |
#name: 'coordLabel' |
|
1110 |
#layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0) |
|
1111 |
#level: -1 |
|
1112 |
#labelChannel: #imageInfoHolder |
|
1113 |
#resizeForLabel: false |
|
1114 |
#adjust: #left |
|
1115 |
) |
|
1116 |
#(#ArrowButtonSpec |
|
1117 |
#name: 'magnifyDownButton' |
|
1118 |
#layout: #(#LayoutFrame -80 1 -22 1 -58 1 0 1) |
|
1119 |
#activeHelpKey: #magnifyImageDown |
|
1120 |
#model: #doMagnifyDown |
|
1121 |
#enableChannel: #imageIsLoaded |
|
1122 |
#isTriggerOnDown: true |
|
1123 |
#direction: #left |
|
1124 |
) |
|
1125 |
#(#ArrowButtonSpec |
|
1126 |
#name: 'magnifyUpButton' |
|
1127 |
#layout: #(#LayoutFrame -24 1 -22 1 -2 1 0 1) |
|
1128 |
#activeHelpKey: #magnifyImageUp |
|
1129 |
#model: #doMagnifyUp |
|
1130 |
#enableChannel: #imageIsLoaded |
|
1131 |
#isTriggerOnDown: true |
|
1132 |
#direction: #right |
|
1133 |
) |
|
1134 |
#(#InputFieldSpec |
|
1135 |
#name: 'magnificationInputField' |
|
1136 |
#layout: #(#LayoutFrame -57 1 -22 1 -26 1 0 1) |
|
1137 |
#activeHelpKey: #magnificationNumber |
|
1138 |
#enableChannel: #imageIsLoaded |
|
1139 |
#model: #valueOfMagnification |
|
1140 |
#type: #numberInRange |
|
1141 |
#acceptOnReturn: false |
|
1142 |
#acceptOnTab: false |
|
1143 |
#numChars: 2 |
|
1144 |
#minValue: 1 |
|
1145 |
#maxValue: 99 |
|
1146 |
#acceptOnPointerLeave: false |
|
1147 |
) |
|
1148 |
) |
|
1149 |
||
1150 |
) |
|
1151 |
) |
|
1152 |
) |
|
1153 |
||
767 | 1154 |
) |
1558 | 1155 |
#handles: #(#Any 0.276 1.0) |
1156 |
) |
|
1157 |
#(#UISubSpecification |
|
1158 |
#name: 'infoBarSubSpec' |
|
1159 |
#layout: #(#LayoutFrame 0 0.0 -24 1 0 1.0 0 1.0) |
|
1160 |
#majorKey: #ToolApplicationModel |
|
1161 |
#minorKey: #windowSpecForInfoBar |
|
1162 |
) |
|
1163 |
) |
|
1164 |
||
1165 |
) |
|
767 | 1166 |
) |
519 | 1167 |
! ! |
1168 |
||
1169 |
!ImageEditor class methodsFor:'menu specs'! |
|
1170 |
||
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1171 |
colorMapMenu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1172 |
"This resource specification was automatically generated |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1173 |
by the MenuEditor of ST/X." |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1174 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1175 |
"Do not manually edit this!! If it is corrupted, |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1176 |
the MenuEditor may not be able to read the specification." |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1177 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1178 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1179 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuSpec |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1180 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuSpec)) startUp |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1181 |
" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1182 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1183 |
<resource: #menu> |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1184 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1185 |
^ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1186 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1187 |
#(#Menu |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1188 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1189 |
#( |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1190 |
#(#MenuItem |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1191 |
#label: 'Add Color' |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1192 |
#translateLabel: true |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1193 |
#value: #addColorToColormap |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1194 |
) |
1544 | 1195 |
#(#MenuItem |
1196 |
#label: '-' |
|
1197 |
) |
|
1198 |
#(#MenuItem |
|
1199 |
#label: 'Inspect Color' |
|
1200 |
#translateLabel: true |
|
1201 |
#value: #inspectColor |
|
1202 |
) |
|
1446 | 1203 |
"/ #(#MenuItem |
1204 |
"/ #label: 'Make Brighter' |
|
1205 |
"/ #translateLabel: true |
|
1206 |
"/ #value: #makeSelectedColorBrighter |
|
1207 |
"/ ) |
|
1208 |
"/ #(#MenuItem |
|
1209 |
"/ #label: 'Make Darker' |
|
1210 |
"/ #translateLabel: true |
|
1211 |
"/ #value: #makeSelectedColorDarker |
|
1212 |
"/ ) |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1213 |
) nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1214 |
nil |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1215 |
) |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1216 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1217 |
"Created: / 12.3.1999 / 00:19:00 / cg" |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1218 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
1219 |
|
400 | 1220 |
menu |
737 | 1221 |
"This resource specification was automatically generated |
1222 |
by the MenuEditor of ST/X." |
|
400 | 1223 |
|
737 | 1224 |
"Do not manually edit this!! If it is corrupted, |
1225 |
the MenuEditor may not be able to read the specification." |
|
400 | 1226 |
|
1227 |
" |
|
1228 |
MenuEditor new openOnClass:ImageEditor andSelector:#menu |
|
1229 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp |
|
1230 |
" |
|
1231 |
||
1232 |
<resource: #menu> |
|
1233 |
||
1124 | 1234 |
^ |
1235 |
#(#Menu |
|
1236 |
#( |
|
1237 |
#(#MenuItem |
|
1489 | 1238 |
#label: '&File' |
1124 | 1239 |
#translateLabel: true |
1240 |
#activeHelpKey: #file |
|
1489 | 1241 |
#shortcutKeyCharacter: #Cmdf |
1124 | 1242 |
#submenu: |
1243 |
#(#Menu |
|
1244 |
#( |
|
1245 |
#(#MenuItem |
|
1246 |
#label: 'New...' |
|
1247 |
#translateLabel: true |
|
1248 |
#value: #doNewImage |
|
1249 |
#activeHelpKey: #fileNewImage |
|
1250 |
) |
|
1251 |
#(#MenuItem |
|
1252 |
#label: '-' |
|
1253 |
) |
|
1254 |
#(#MenuItem |
|
1255 |
#label: 'Load...' |
|
1256 |
#translateLabel: true |
|
1257 |
#value: #doLoadFromClass |
|
1258 |
#activeHelpKey: #fileLoadFromClass |
|
1259 |
) |
|
1260 |
#(#MenuItem |
|
1570 | 1261 |
#label: 'Load from File...' |
1124 | 1262 |
#translateLabel: true |
1263 |
#value: #doLoadFromFile |
|
1264 |
#activeHelpKey: #fileLoadFromFile |
|
1265 |
) |
|
1266 |
#(#MenuItem |
|
1570 | 1267 |
#label: 'Grab from Screen' |
1124 | 1268 |
#translateLabel: true |
1269 |
#value: #grabScreenImage |
|
1270 |
#activeHelpKey: #fileGrabImage |
|
1271 |
) |
|
1272 |
#(#MenuItem |
|
1496 | 1273 |
#label: 'Next in Sequence' |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1274 |
#translateLabel: true |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1275 |
#value: #nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1276 |
#enabled: #imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1277 |
) |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1278 |
#(#MenuItem |
1124 | 1279 |
#label: '-' |
1280 |
) |
|
1281 |
#(#MenuItem |
|
1282 |
#label: 'Save' |
|
1283 |
#translateLabel: true |
|
1284 |
#value: #doSaveMethod |
|
1285 |
#activeHelpKey: #fileSaveMethod |
|
1286 |
#enabled: #imageIsLoadedAndClassDefined |
|
1287 |
) |
|
1288 |
#(#MenuItem |
|
1289 |
#label: 'Save As...' |
|
1290 |
#translateLabel: true |
|
1291 |
#value: #doSaveMethodAs |
|
1292 |
#activeHelpKey: #fileSaveMethodAs |
|
1293 |
#enabled: #imageIsLoaded |
|
1294 |
) |
|
1295 |
#(#MenuItem |
|
1296 |
#label: '-' |
|
1297 |
) |
|
1298 |
#(#MenuItem |
|
1570 | 1299 |
#label: 'Save to File...' |
1124 | 1300 |
#translateLabel: true |
1301 |
#value: #doSaveImageFileAs |
|
1302 |
#activeHelpKey: #fileSaveAs |
|
1303 |
#enabled: #imageIsLoaded |
|
1304 |
) |
|
1305 |
#(#MenuItem |
|
1570 | 1306 |
#label: 'Save Mask to File...' |
1124 | 1307 |
#translateLabel: true |
1308 |
#value: #doSaveImageMaskFileAs |
|
1309 |
#activeHelpKey: #fileSaveMaskAs |
|
1310 |
#enabled: #imageIsLoaded |
|
1311 |
) |
|
1312 |
#(#MenuItem |
|
1613 | 1313 |
#label: 'Save As Button to File...' |
1314 |
#translateLabel: true |
|
1315 |
#value: #doSaveButtonImageToFileAs |
|
1316 |
#activeHelpKey: #fileSaveButtonImageAs |
|
1317 |
#enabled: #imageIsLoaded |
|
1318 |
) |
|
1319 |
#(#MenuItem |
|
1124 | 1320 |
#label: '-' |
1321 |
) |
|
1322 |
#(#MenuItem |
|
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1323 |
#label: 'Show storeString' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1324 |
#translateLabel: true |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1325 |
#value: #doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1326 |
#activeHelpKey: #fileShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1327 |
#enabled: #imageIsLoaded |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1328 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1329 |
#(#MenuItem |
1433 | 1330 |
#label: 'Edit Mask' |
1331 |
#translateLabel: true |
|
1332 |
#value: #doEditMask |
|
1333 |
#activeHelpKey: #fileEditMask |
|
1334 |
#enabled: #imageIsLoaded |
|
1335 |
) |
|
1336 |
#(#MenuItem |
|
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1337 |
#label: '-' |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1338 |
) |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
1339 |
#(#MenuItem |
1124 | 1340 |
#label: 'Print' |
1341 |
#translateLabel: true |
|
1342 |
#value: #doPrint |
|
1343 |
#activeHelpKey: #filePrint |
|
1344 |
#enabled: #imageIsLoaded |
|
1345 |
) |
|
1346 |
#(#MenuItem |
|
1347 |
#label: '-' |
|
1348 |
) |
|
1349 |
#(#MenuItem |
|
1350 |
#label: 'Browse Class' |
|
1351 |
#translateLabel: true |
|
1352 |
#value: #doBrowseClass |
|
1353 |
#activeHelpKey: #fileBrowseClass |
|
1354 |
#enabled: #hasClassDefined |
|
1355 |
) |
|
1356 |
#(#MenuItem |
|
1357 |
#label: '-' |
|
1358 |
) |
|
1359 |
#(#MenuItem |
|
1360 |
#label: 'Exit' |
|
1361 |
#translateLabel: true |
|
1362 |
#value: #closeRequest |
|
1363 |
#activeHelpKey: #fileExit |
|
1364 |
) |
|
1365 |
) |
|
1366 |
nil |
|
1367 |
nil |
|
400 | 1368 |
) |
1124 | 1369 |
) |
1370 |
#(#MenuItem |
|
1371 |
#label: 'Edit' |
|
1372 |
#translateLabel: true |
|
1373 |
#activeHelpKey: #edit |
|
1374 |
#enabled: #imageIsLoaded |
|
1375 |
#submenu: |
|
1376 |
#(#Menu |
|
1377 |
#( |
|
1378 |
#(#MenuItem |
|
1379 |
#label: 'Undo' |
|
1380 |
#translateLabel: true |
|
1381 |
#value: #doUndo |
|
1382 |
#activeHelpKey: #editUndo |
|
1383 |
#enabled: #valueOfCanUndo |
|
1384 |
) |
|
1385 |
#(#MenuItem |
|
1386 |
#label: '-' |
|
1387 |
) |
|
1388 |
#(#MenuItem |
|
1389 |
#label: 'Flip - Vertical' |
|
1390 |
#translateLabel: true |
|
1391 |
#value: #doFlipVertical |
|
1392 |
#activeHelpKey: #editFlipVertical |
|
1393 |
) |
|
1394 |
#(#MenuItem |
|
1395 |
#label: 'Flip - Horizontal' |
|
1396 |
#translateLabel: true |
|
1397 |
#value: #doFlipHorizontal |
|
1398 |
#activeHelpKey: #editFlipHorizontal |
|
1399 |
) |
|
1400 |
#(#MenuItem |
|
1401 |
#label: '-' |
|
1402 |
) |
|
1403 |
#(#MenuItem |
|
1404 |
#label: 'Resize...' |
|
1405 |
#translateLabel: true |
|
1406 |
#value: #doResizeImage |
|
1407 |
#activeHelpKey: #editResize |
|
1408 |
) |
|
1409 |
#(#MenuItem |
|
1410 |
#label: 'Magnify...' |
|
1411 |
#translateLabel: true |
|
1412 |
#value: #doMagnifyImage |
|
1413 |
#activeHelpKey: #editMagnifyImage |
|
1414 |
) |
|
1415 |
#(#MenuItem |
|
1479 | 1416 |
#label: 'Magnify By...' |
1417 |
#translateLabel: true |
|
1418 |
#value: #doMagnifyImageBy |
|
1419 |
#activeHelpKey: #editMagnifyImage |
|
1420 |
) |
|
1421 |
#(#MenuItem |
|
1124 | 1422 |
#label: 'Rotate...' |
1423 |
#translateLabel: true |
|
1424 |
#value: #doRotateImage |
|
1425 |
#activeHelpKey: #editRotate |
|
1426 |
) |
|
1427 |
#(#MenuItem |
|
1428 |
#label: '-' |
|
1429 |
) |
|
1430 |
#(#MenuItem |
|
1146 | 1431 |
#label: 'Invert' |
1432 |
#translateLabel: true |
|
1433 |
#value: #doNegativeImage |
|
1434 |
) |
|
1435 |
#(#MenuItem |
|
1436 |
#label: '-' |
|
1437 |
) |
|
1438 |
#(#MenuItem |
|
1124 | 1439 |
#label: 'Crop' |
1440 |
#translateLabel: true |
|
1441 |
#submenu: |
|
400 | 1442 |
#(#Menu |
1124 | 1443 |
#( |
1444 |
#(#MenuItem |
|
1445 |
#label: 'All' |
|
1446 |
#translateLabel: true |
|
1447 |
#value: #doCropAll |
|
1448 |
#activeHelpKey: #cropAll |
|
400 | 1449 |
) |
1124 | 1450 |
#(#MenuItem |
1451 |
#label: '-' |
|
986 | 1452 |
) |
1124 | 1453 |
#(#MenuItem |
1454 |
#label: 'Left' |
|
1455 |
#translateLabel: true |
|
1456 |
#value: #doCropLeft |
|
1457 |
#activeHelpKey: #cropLeft |
|
1458 |
) |
|
1459 |
#(#MenuItem |
|
1460 |
#label: 'Right' |
|
1461 |
#translateLabel: true |
|
1462 |
#value: #doCropRight |
|
1463 |
#activeHelpKey: #cropRight |
|
986 | 1464 |
) |
1124 | 1465 |
#(#MenuItem |
1466 |
#label: 'Top' |
|
1467 |
#translateLabel: true |
|
1468 |
#value: #doCropTop |
|
1469 |
#activeHelpKey: #cropTop |
|
672 | 1470 |
) |
1124 | 1471 |
#(#MenuItem |
1472 |
#label: 'Bottom' |
|
1473 |
#translateLabel: true |
|
1474 |
#value: #doCropBottom |
|
1475 |
#activeHelpKey: #cropBottom |
|
400 | 1476 |
) |
1124 | 1477 |
#(#MenuItem |
1478 |
#label: '-' |
|
400 | 1479 |
) |
1124 | 1480 |
#(#MenuItem |
1481 |
#label: 'Manual...' |
|
1482 |
#translateLabel: true |
|
1483 |
#value: #doCropManual |
|
1484 |
#activeHelpKey: #cropManual |
|
400 | 1485 |
) |
1124 | 1486 |
) |
1487 |
nil |
|
400 | 1488 |
nil |
1124 | 1489 |
) |
400 | 1490 |
) |
1489 | 1491 |
#(#MenuItem |
1557 | 1492 |
#label: 'Shift...' |
1493 |
#translateLabel: true |
|
1494 |
#value: #doShiftManual |
|
1495 |
#activeHelpKey: #shiftManual |
|
1496 |
) |
|
1497 |
#(#MenuItem |
|
1489 | 1498 |
#label: 'Ungrop (Add Border)...' |
1499 |
#translateLabel: true |
|
1500 |
#value: #doUnCropManual |
|
1501 |
#activeHelpKey: #uncropManual |
|
1502 |
) |
|
1124 | 1503 |
) |
1504 |
nil |
|
1505 |
nil |
|
400 | 1506 |
) |
1124 | 1507 |
) |
1508 |
#(#MenuItem |
|
1509 |
#label: 'ColorMap' |
|
1510 |
#translateLabel: true |
|
1511 |
#activeHelpKey: #colorMap |
|
1512 |
#enabled: #imageIsLoaded |
|
1513 |
#submenu: |
|
1514 |
#(#Menu |
|
1515 |
#( |
|
1516 |
#(#MenuItem |
|
1517 |
#label: '8-Plane' |
|
1518 |
#translateLabel: true |
|
1519 |
#value: #colorMapMode: |
|
1520 |
#activeHelpKey: #colorMap8 |
|
1521 |
#argument: '8-plane' |
|
1522 |
#choice: #colorMapMode |
|
1523 |
#choiceValue: '8-plane' |
|
1524 |
) |
|
1525 |
#(#MenuItem |
|
1526 |
#label: '4-Plane' |
|
1527 |
#translateLabel: true |
|
1528 |
#value: #colorMapMode: |
|
1529 |
#activeHelpKey: #colorMap4 |
|
1530 |
#argument: '4-plane' |
|
1531 |
#choice: #colorMapMode |
|
1532 |
#choiceValue: '4-plane' |
|
1533 |
) |
|
1534 |
#(#MenuItem |
|
1535 |
#label: '2-Plane' |
|
1536 |
#translateLabel: true |
|
1537 |
#value: #colorMapMode: |
|
1538 |
#activeHelpKey: #colorMap2 |
|
1539 |
#argument: '2-plane' |
|
1540 |
#choice: #colorMapMode |
|
1541 |
#choiceValue: '2-plane' |
|
1542 |
) |
|
1543 |
#(#MenuItem |
|
1544 |
#label: '1-Plane' |
|
1545 |
#translateLabel: true |
|
1546 |
#value: #colorMapMode: |
|
1547 |
#activeHelpKey: #colorMap1 |
|
1548 |
#argument: '1-plane' |
|
1549 |
#choice: #colorMapMode |
|
1550 |
#choiceValue: '1-plane' |
|
1551 |
) |
|
1552 |
#(#MenuItem |
|
1553 |
#label: '-' |
|
1554 |
) |
|
1555 |
#(#MenuItem |
|
1556 |
#label: '8-Plane + Mask' |
|
1557 |
#translateLabel: true |
|
1558 |
#value: #colorMapMode: |
|
1559 |
#activeHelpKey: #colorMap8M |
|
1560 |
#argument: '8-plane + mask' |
|
1561 |
#choice: #colorMapMode |
|
1562 |
#choiceValue: '8-plane + mask' |
|
1563 |
) |
|
1564 |
#(#MenuItem |
|
1565 |
#label: '4-Plane + Mask' |
|
1566 |
#translateLabel: true |
|
1567 |
#value: #colorMapMode: |
|
1568 |
#activeHelpKey: #colorMap4M |
|
1569 |
#argument: '4-plane + mask' |
|
1570 |
#choice: #colorMapMode |
|
1571 |
#choiceValue: '4-plane + mask' |
|
737 | 1572 |
) |
1124 | 1573 |
#(#MenuItem |
1574 |
#label: '2-Plane + Mask' |
|
1575 |
#translateLabel: true |
|
1576 |
#value: #colorMapMode: |
|
1577 |
#activeHelpKey: #colorMap2M |
|
1578 |
#argument: '2-plane + mask' |
|
1579 |
#choice: #colorMapMode |
|
1580 |
#choiceValue: '2-plane + mask' |
|
1581 |
) |
|
1582 |
#(#MenuItem |
|
1583 |
#label: '1-Plane + Mask' |
|
1584 |
#translateLabel: true |
|
1585 |
#value: #colorMapMode: |
|
1586 |
#activeHelpKey: #colorMap1M |
|
1587 |
#argument: '1-plane + mask' |
|
1588 |
#choice: #colorMapMode |
|
1589 |
#choiceValue: '1-plane + mask' |
|
1590 |
) |
|
1591 |
#(#MenuItem |
|
1592 |
#label: '-' |
|
1593 |
) |
|
1594 |
#(#MenuItem |
|
1570 | 1595 |
#label: 'Compress Colormap' |
1124 | 1596 |
#translateLabel: true |
1597 |
#value: #compressColorMap |
|
1598 |
#activeHelpKey: #compressColormap |
|
1599 |
#enabled: #hasColormap |
|
1600 |
) |
|
1601 |
#(#MenuItem |
|
1570 | 1602 |
#label: 'Sort Colormap' |
1124 | 1603 |
#translateLabel: true |
1604 |
#value: #sortColorMap |
|
1605 |
#enabled: #hasColormap |
|
1606 |
) |
|
1607 |
#(#MenuItem |
|
1598 | 1608 |
#label: 'Reduce Number of Colors...' |
1403 | 1609 |
#translateLabel: true |
1598 | 1610 |
#value: #reduceNumberOfColors |
1403 | 1611 |
) |
1612 |
#(#MenuItem |
|
1124 | 1613 |
#label: '-' |
1614 |
) |
|
1615 |
#(#MenuItem |
|
1598 | 1616 |
#label: 'Make GrayScale' |
1124 | 1617 |
#translateLabel: true |
1598 | 1618 |
#value: #makeGrayScale |
1124 | 1619 |
) |
1436 | 1620 |
#(#MenuItem |
1598 | 1621 |
#label: 'Make Brighter' |
1622 |
#translateLabel: true |
|
1623 |
#value: #makeBrighter |
|
1624 |
) |
|
1625 |
#(#MenuItem |
|
1626 |
#label: 'Make Darker' |
|
1436 | 1627 |
#translateLabel: true |
1598 | 1628 |
#value: #makeDarker |
1629 |
) |
|
1630 |
#(#MenuItem |
|
1631 |
#label: 'Make Inverse' |
|
1632 |
#translateLabel: true |
|
1633 |
#value: #makeInverse |
|
1436 | 1634 |
) |
1480 | 1635 |
#(#MenuItem |
1636 |
#label: '-' |
|
1637 |
) |
|
1638 |
#(#MenuItem |
|
1570 | 1639 |
#label: 'Copy Mask' |
1480 | 1640 |
#translateLabel: true |
1641 |
#value: #copyMask |
|
1642 |
#activeHelpKey: #copyMask |
|
1643 |
#enabled: #hasMask |
|
1644 |
) |
|
1645 |
#(#MenuItem |
|
1570 | 1646 |
#label: 'Paste Mask' |
1480 | 1647 |
#translateLabel: true |
1648 |
#value: #pasteMask |
|
1649 |
#activeHelpKey: #pasteMask |
|
1650 |
#enabled: #hasMask |
|
1651 |
) |
|
1598 | 1652 |
#(#MenuItem |
1653 |
#label: 'Clear Masked Pixels' |
|
1654 |
#translateLabel: true |
|
1655 |
#value: #clearMaskedPixels |
|
1656 |
) |
|
1124 | 1657 |
) |
1658 |
nil |
|
1659 |
nil |
|
756 | 1660 |
) |
1124 | 1661 |
) |
1662 |
#(#MenuItem |
|
1663 |
#label: 'Settings' |
|
1664 |
#translateLabel: true |
|
1665 |
#submenu: |
|
1666 |
#(#Menu |
|
1667 |
#( |
|
1668 |
#(#MenuItem |
|
1353 | 1669 |
#label: 'Grid Magnification Limit...' |
1124 | 1670 |
#translateLabel: true |
1671 |
#value: #doChangeGridMagnification |
|
1672 |
#activeHelpKey: #settingsGridMagnification |
|
1673 |
) |
|
1674 |
) |
|
1675 |
nil |
|
1676 |
nil |
|
400 | 1677 |
) |
1124 | 1678 |
) |
1679 |
#(#MenuItem |
|
1680 |
#label: 'History' |
|
1681 |
#translateLabel: true |
|
1682 |
#activeHelpKey: #history |
|
1683 |
#submenuChannel: #menuHistory |
|
1684 |
) |
|
1685 |
#(#MenuItem |
|
1686 |
#label: 'Help' |
|
1687 |
#translateLabel: true |
|
1688 |
#startGroup: #right |
|
1689 |
#activeHelpKey: #help |
|
1690 |
#submenuChannel: #menuHelp |
|
1691 |
) |
|
1692 |
) |
|
1693 |
nil |
|
1694 |
nil |
|
400 | 1695 |
) |
1696 |
! |
|
1697 |
||
679 | 1698 |
menuMouseButtonColors |
737 | 1699 |
"This resource specification was automatically generated |
1700 |
by the MenuEditor of ST/X." |
|
679 | 1701 |
|
737 | 1702 |
"Do not manually edit this!! If it is corrupted, |
1703 |
the MenuEditor may not be able to read the specification." |
|
679 | 1704 |
|
1705 |
" |
|
1706 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuMouseButtonColors |
|
1707 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuMouseButtonColors)) startUp |
|
1708 |
" |
|
1709 |
||
1710 |
<resource: #menu> |
|
1711 |
||
1712 |
^ |
|
1713 |
||
1714 |
#(#Menu |
|
1715 |
||
1716 |
#( |
|
1717 |
#(#MenuItem |
|
1718 |
#label: 'Left Mouse Button' |
|
1719 |
#nameKey: #leftMouseKeyButton |
|
1720 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1721 |
#enabled: #imageIsLoaded |
679 | 1722 |
#labelImage: #(#ResourceRetriever nil #leftMouseKeyIcon) |
975 | 1723 |
#choice: #mouseKeyColorMode |
1724 |
#choiceValue: 1 |
|
679 | 1725 |
) |
1726 |
#(#MenuItem |
|
1727 |
#label: 'Right Mouse Button' |
|
1728 |
#nameKey: #rightMouseKeyButton |
|
1729 |
#activeHelpKey: #mouseKeyColorMode |
|
975 | 1730 |
#enabled: #imageIsLoaded |
679 | 1731 |
#labelImage: #(#ResourceRetriever nil #rightMouseKeyIcon) |
975 | 1732 |
#choice: #mouseKeyColorMode |
1733 |
#choiceValue: 2 |
|
679 | 1734 |
) |
1735 |
) nil |
|
1736 |
nil |
|
1737 |
) |
|
1738 |
! |
|
1739 |
||
400 | 1740 |
menuToolbar |
737 | 1741 |
"This resource specification was automatically generated |
1742 |
by the MenuEditor of ST/X." |
|
400 | 1743 |
|
737 | 1744 |
"Do not manually edit this!! If it is corrupted, |
1745 |
the MenuEditor may not be able to read the specification." |
|
400 | 1746 |
|
1747 |
" |
|
1748 |
MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar |
|
1749 |
(Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp |
|
1750 |
" |
|
1751 |
||
1752 |
<resource: #menu> |
|
1753 |
||
1196 | 1754 |
^ |
1755 |
#(#Menu |
|
1756 |
#( |
|
1757 |
#(#MenuItem |
|
1758 |
#label: 'newImage' |
|
1759 |
#isButton: true |
|
1760 |
#value: #doNewImage |
|
1761 |
#activeHelpKey: #fileNewImage |
|
1762 |
#labelImage: #(#ResourceRetriever #Icon #newIcon) |
|
1763 |
) |
|
1764 |
#(#MenuItem |
|
1765 |
#label: 'loadFromClass' |
|
1766 |
#isButton: true |
|
1767 |
#value: #doLoadFromClass |
|
1768 |
#activeHelpKey: #fileLoadFromClass |
|
1769 |
#labelImage: #(#ResourceRetriever #Icon #loadIcon) |
|
1770 |
) |
|
1771 |
#(#MenuItem |
|
1772 |
#label: 'saveMethod' |
|
1773 |
#isButton: true |
|
1774 |
#value: #doSaveMethod |
|
1775 |
#activeHelpKey: #fileSaveMethod |
|
1776 |
#enabled: #imageIsLoaded |
|
1777 |
#labelImage: #(#ResourceRetriever #Icon #saveIcon) |
|
1778 |
) |
|
1779 |
#(#MenuItem |
|
1780 |
#label: '' |
|
1781 |
) |
|
1782 |
#(#MenuItem |
|
1783 |
#label: '' |
|
1784 |
) |
|
1785 |
#(#MenuItem |
|
1786 |
#label: '' |
|
1787 |
) |
|
1788 |
#(#MenuItem |
|
1789 |
#label: '' |
|
1790 |
) |
|
1791 |
#(#MenuItem |
|
1792 |
#label: 'Point' |
|
1793 |
#activeHelpKey: #drawModePoint |
|
1794 |
#enabled: #imageIsLoaded |
|
1795 |
#choice: #editMode |
|
1796 |
#choiceValue: #point |
|
1797 |
) |
|
1798 |
#(#MenuItem |
|
1799 |
#label: 'Rect' |
|
1800 |
#activeHelpKey: #drawModeBox |
|
1801 |
#enabled: #imageIsLoaded |
|
1802 |
#choice: #editMode |
|
1803 |
#choiceValue: #box |
|
1804 |
) |
|
1805 |
#(#MenuItem |
|
1806 |
#label: 'FillRect' |
|
1807 |
#activeHelpKey: #drawModeFilledBox |
|
1808 |
#enabled: #imageIsLoaded |
|
1809 |
#choice: #editMode |
|
1810 |
#choiceValue: #filledBox |
|
1811 |
) |
|
1812 |
#(#MenuItem |
|
1813 |
#label: 'Fill' |
|
1814 |
#activeHelpKey: #drawModeFill |
|
1815 |
#enabled: #imageIsLoaded |
|
1816 |
#choice: #editMode |
|
1817 |
#choiceValue: #fill |
|
1818 |
) |
|
1819 |
#(#MenuItem |
|
1820 |
#label: 'Copy' |
|
1821 |
#activeHelpKey: #drawModeCopy |
|
1822 |
#enabled: #imageIsLoaded |
|
1823 |
#choice: #editMode |
|
1824 |
#choiceValue: #copy |
|
1825 |
) |
|
1826 |
#(#MenuItem |
|
1827 |
#label: 'Paste' |
|
1828 |
#activeHelpKey: #drawModePaste |
|
1829 |
#enabled: #imageIsLoaded |
|
1830 |
#choice: #editMode |
|
1831 |
#choiceValue: #paste |
|
1832 |
) |
|
1833 |
#(#MenuItem |
|
1834 |
#label: 'Paste Under' |
|
1835 |
#activeHelpKey: #drawModePasteUnder |
|
1836 |
#enabled: #imageIsLoaded |
|
1837 |
#choice: #editMode |
|
1838 |
#choiceValue: #pasteUnder |
|
1839 |
) |
|
1411 | 1840 |
#(#MenuItem |
1579 | 1841 |
#label: 'Paste With Mask' |
1842 |
#activeHelpKey: #drawModePasteWithMask |
|
1843 |
#enabled: #imageIsLoaded |
|
1844 |
#choice: #editMode |
|
1845 |
#choiceValue: #pasteWithMask |
|
1846 |
) |
|
1847 |
#(#MenuItem |
|
1411 | 1848 |
#label: 'Special' |
1849 |
#activeHelpKey: #drawModeSpecial |
|
1850 |
#enabled: #imageIsLoaded |
|
1851 |
#choice: #editMode |
|
1852 |
#choiceValue: #specialOperation |
|
1853 |
) |
|
1196 | 1854 |
) |
1855 |
nil |
|
1856 |
nil |
|
400 | 1857 |
) |
1558 | 1858 |
! |
1859 |
||
1860 |
previewMenu |
|
1861 |
"This resource specification was automatically generated |
|
1862 |
by the MenuEditor of ST/X." |
|
1863 |
||
1864 |
"Do not manually edit this!! If it is corrupted, |
|
1865 |
the MenuEditor may not be able to read the specification." |
|
1866 |
||
1867 |
" |
|
1868 |
MenuEditor new openOnClass:ImageEditor andSelector:#previewMenu |
|
1869 |
(Menu new fromLiteralArrayEncoding:(ImageEditor previewMenu)) startUp |
|
1870 |
" |
|
1871 |
||
1872 |
<resource: #menu> |
|
1873 |
||
1874 |
^ |
|
1875 |
#(#Menu |
|
1876 |
#( |
|
1877 |
#(#MenuItem |
|
1878 |
#label: 'TileMode' |
|
1879 |
#translateLabel: true |
|
1880 |
#indication: #tileModeHolder |
|
1881 |
) |
|
1882 |
) |
|
1883 |
nil |
|
1884 |
nil |
|
1885 |
) |
|
400 | 1886 |
! ! |
1887 |
||
1888 |
!ImageEditor methodsFor:'accessing'! |
|
1889 |
||
1890 |
image |
|
767 | 1891 |
"returns the current editing image" |
400 | 1892 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1893 |
^ imageEditView image |
400 | 1894 |
! |
1895 |
||
1896 |
postOpenAction: anAction |
|
767 | 1897 |
"sets an action which is evaluated after opening" |
400 | 1898 |
|
1899 |
postOpenAction := anAction |
|
1381 | 1900 |
! |
1901 |
||
1902 |
resourceClass:aClass |
|
1903 |
imageEditView resourceClass:aClass |
|
400 | 1904 |
! ! |
1905 |
||
1398 | 1906 |
!ImageEditor methodsFor:'accessing-views'! |
400 | 1907 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1908 |
colorDataSetView |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1909 |
"returns the view of the colormap" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1910 |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
1911 |
^(self componentAt: #colorDataSetView) |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1912 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1913 |
"Created: / 26.7.1998 / 12:02:14 / cg" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1914 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1915 |
|
487 | 1916 |
coordLabel |
767 | 1917 |
"returns the view the coord label" |
487 | 1918 |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
1919 |
^self componentAt: #coordLabel |
487 | 1920 |
! |
1921 |
||
400 | 1922 |
imageEditView |
911 | 1923 |
"returns the view of the image" |
400 | 1924 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1925 |
imageEditView isNil ifTrue:[ |
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
1926 |
imageEditView := (self componentAt: #imageEditView) scrolledView. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1927 |
imageEditView addDependent:self. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1928 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
1929 |
^ imageEditView |
1345 | 1930 |
|
1931 |
"Modified: / 10.2.2000 / 23:19:20 / cg" |
|
400 | 1932 |
! |
1933 |
||
1934 |
imagePreView |
|
767 | 1935 |
"returns the preview of the image" |
400 | 1936 |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
1937 |
^ (self componentAt: #imagePreView) subViews first |
475 | 1938 |
! ! |
1939 |
||
400 | 1940 |
!ImageEditor methodsFor:'aspects'! |
1941 |
||
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1942 |
activityInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1943 |
^ self valueOfInfoLabel |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1944 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1945 |
"Modified: / 29.7.1998 / 18:49:03 / cg" |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1946 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1947 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1948 |
colorColumnAdaptor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1949 |
^ self |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1950 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1951 |
"Created: / 26.7.1998 / 12:17:03 / cg" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1952 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
1953 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1954 |
hasClassAndSelectorDefined |
1054 | 1955 |
^ [ |
1956 |
|clsName| |
|
1957 |
||
1958 |
(clsName := imageEditView resourceClass) size > 0 |
|
1959 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil |
|
1960 |
and:[imageEditView resourceSelector notNil]] |
|
1961 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1962 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1963 |
"Created: / 31.7.1998 / 02:02:54 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1964 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1965 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1966 |
hasClassDefined |
1054 | 1967 |
^ [ |
1968 |
|clsName| |
|
1969 |
||
1443 | 1970 |
(clsName := imageEditView resourceClass) size > 0 |
1054 | 1971 |
and:[(Smalltalk at:clsName ifAbsent:nil) notNil] |
1972 |
] |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1973 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1974 |
"Created: / 31.7.1998 / 02:02:22 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1975 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
1976 |
|
1008 | 1977 |
hasColormap |
1978 |
^ [self image notNil and:[self image colorMap notNil]] |
|
1979 |
||
1980 |
"Created: / 30.9.1998 / 23:53:55 / cg" |
|
1981 |
! |
|
1982 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1983 |
imageHasNextImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1984 |
"returns whether an image is loaded as value holder" |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1985 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1986 |
^ [self image notNil |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1987 |
and:[self image imageSequence notNil]] |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1988 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1989 |
"Created: / 31.7.1998 / 02:04:18 / cg" |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1990 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1991 |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1992 |
imageInfoHolder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1993 |
|holder| |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1994 |
(holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1995 |
builder aspectAt:#imageInfoHolder put:(holder := '' asValue). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1996 |
]. |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1997 |
^ holder |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1998 |
|
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
1999 |
"Modified: / 29.7.1998 / 18:32:08 / cg" |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2000 |
! |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2001 |
|
400 | 2002 |
imageIsLoaded |
767 | 2003 |
"returns whether an image is loaded as value holder" |
400 | 2004 |
|
2005 |
|holder| |
|
2006 |
(holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[ |
|
2007 |
builder aspectAt:#imageIsLoaded put:(holder := false asValue). |
|
2008 |
]. |
|
2009 |
^ holder |
|
2010 |
! |
|
2011 |
||
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2012 |
imageIsLoadedAndClassDefined |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2013 |
"returns whether an image is loaded as value holder" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2014 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2015 |
^ [self hasClassAndSelectorDefined value |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2016 |
and:[self imageIsLoaded value]] |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2017 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2018 |
"Created: / 31.7.1998 / 02:04:18 / cg" |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2019 |
! |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
2020 |
|
400 | 2021 |
listOfColors |
767 | 2022 |
"returns the list of colors in a List" |
400 | 2023 |
|
2024 |
|holder| |
|
2025 |
(holder := builder bindingAt:#listOfColors) isNil ifTrue:[ |
|
2026 |
builder aspectAt:#listOfColors put:(holder := List new). |
|
942 | 2027 |
holder addDependent:self. |
400 | 2028 |
]. |
2029 |
^ holder |
|
2030 |
! |
|
2031 |
||
2032 |
selectionOfColor |
|
767 | 2033 |
"returns current selection of the edit color as an AspectAdaptor" |
400 | 2034 |
|
2035 |
|holder| |
|
2036 |
(holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[ |
|
2037 |
builder aspectAt:#selectionOfColor put:( |
|
2038 |
holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex). |
|
2039 |
]. |
|
2040 |
^ holder |
|
2041 |
! |
|
2042 |
||
1558 | 2043 |
tileModeHolder |
2044 |
|holder| |
|
2045 |
(holder := builder bindingAt:#tileModeHolder) isNil ifTrue:[ |
|
2046 |
builder aspectAt:#tileModeHolder put:(holder := false asValue). |
|
2047 |
holder addDependent:self. |
|
2048 |
]. |
|
2049 |
^ holder |
|
2050 |
! |
|
2051 |
||
400 | 2052 |
valueOfMagnification |
767 | 2053 |
"returns current magnification of the image as an AspectAdaptor" |
400 | 2054 |
|
2055 |
|holder| |
|
2056 |
(holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[ |
|
2057 |
builder aspectAt:#valueOfMagnification put:( |
|
2058 |
holder := AspectAdaptor new subject:self; forAspect:#magnification) |
|
2059 |
]. |
|
2060 |
^ holder |
|
2061 |
! ! |
|
2062 |
||
767 | 2063 |
!ImageEditor methodsFor:'change & update'! |
2064 |
||
2065 |
findColorMapMode |
|
899 | 2066 |
"finds the colorMapMode for a new image" |
767 | 2067 |
|
1054 | 2068 |
|image listOfColors| |
2069 |
||
2070 |
image := self image. |
|
2071 |
image depth > 8 ifTrue: [ |
|
2072 |
colorMapMode value: ''. |
|
2073 |
self listOfColors removeAll. |
|
2074 |
^ nil |
|
2075 |
]. |
|
2076 |
||
2077 |
colorMapMode value:(image depth printString, '-plane'). |
|
2078 |
||
2079 |
(listOfColors := self listOfColors) isEmpty ifTrue:[ |
|
2080 |
self colorMapMode: colorMapMode value. |
|
2081 |
listOfColors := self listOfColors. |
|
2082 |
image := self image. |
|
767 | 2083 |
]. |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2084 |
imageEditView drawingColors:(Array |
1054 | 2085 |
with: (listOfColors at:1) |
2086 |
with: (listOfColors at:2 ifAbsent:[listOfColors at:1])). |
|
2087 |
||
2088 |
image mask notNil ifTrue: [ |
|
2089 |
colorMapMode value:(colorMapMode value, ' + mask'). |
|
2090 |
||
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2091 |
(listOfColors detect: [:clr| clr = (Color colorId:0)] ifNone: nil) isNil |
1054 | 2092 |
ifTrue:[ |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2093 |
listOfColors addFirst:(Color colorId:0). |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2094 |
imageEditView drawingColors: (Array |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2095 |
with:(listOfColors at:2 ifAbsent:[listOfColors at:1]) |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2096 |
with:(listOfColors at:1)). |
898 | 2097 |
] |
767 | 2098 |
]. |
1054 | 2099 |
self selectionOfColor |
1446 | 2100 |
setValue: 0; |
1054 | 2101 |
value: (self listOfColors indexOf: imageEditView selectedColor). |
767 | 2102 |
! |
2103 |
||
942 | 2104 |
update:something with:aParameter from:changedObject |
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2105 |
|clrIndex img | |
1436 | 2106 |
|
2107 |
img := self image. |
|
1558 | 2108 |
|
2109 |
changedObject == self tileModeHolder ifTrue:[ |
|
2110 |
self imagePreView tileMode:(changedObject value) tileOffset:(img extent). |
|
2111 |
self imagePreView clear; invalidate. |
|
2112 |
^ self |
|
2113 |
]. |
|
2114 |
||
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2115 |
changedObject == self listOfColors ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2116 |
something == #at: ifTrue:[ |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2117 |
"/ colormap entry changed at aParameter |
960 | 2118 |
|
2119 |
clrIndex := aParameter. |
|
2120 |
(self hasMask) ifTrue:[ |
|
2121 |
clrIndex := clrIndex - 1. |
|
2122 |
]. |
|
2123 |
||
1436 | 2124 |
img colorMap at:clrIndex put:(changedObject at:aParameter). |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2125 |
self colorMapChanged. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2126 |
^ self |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2127 |
]. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2128 |
]. |
1124 | 2129 |
|
2130 |
changedObject == imageEditView undoImages ifTrue:[ |
|
2131 |
self valueOfCanUndo value:(changedObject notEmpty). |
|
2132 |
^ self. |
|
2133 |
]. |
|
2134 |
||
1345 | 2135 |
changedObject == imageEditView ifTrue:[ |
2136 |
something == #imageColors ifTrue:[ |
|
1436 | 2137 |
self listOfColors contents:img colorMap. |
1345 | 2138 |
self findColorMapMode. |
2139 |
^ self. |
|
2140 |
]. |
|
2141 |
something == #image ifTrue:[ |
|
1436 | 2142 |
self imagePreView image:img. |
2143 |
self listOfColors contents:img colorMap. |
|
2144 |
self findColorMapMode. |
|
1558 | 2145 |
self tileModeHolder value ifTrue:[ |
2146 |
self imagePreView tileMode:true tileOffset:(img extent). |
|
2147 |
]. |
|
1345 | 2148 |
^ self. |
2149 |
]. |
|
2150 |
something == #subImageIn ifTrue:[ |
|
1436 | 2151 |
self imagePreView image ~~ img ifTrue:[ |
1406 | 2152 |
self halt:'should not happen'. |
2153 |
]. |
|
1558 | 2154 |
self tileModeHolder value ifTrue:[ |
2155 |
self imagePreView invalidate. |
|
2156 |
] ifFalse:[ |
|
2157 |
self imagePreView invalidate:aParameter. |
|
2158 |
]. |
|
1345 | 2159 |
^ self. |
2160 |
]. |
|
1491
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2161 |
something == #selectedColor ifTrue:[ |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2162 |
(aParameter = (Color colorId:0)) ifTrue:[ |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2163 |
self halt. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2164 |
]. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2165 |
clrIndex := self listOfColors indexOf:aParameter. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2166 |
self selectionOfColor value:clrIndex. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2167 |
^ self. |
4249a6a1b252
pick with SHIFT-click in the mag-view
Claus Gittinger <cg@exept.de>
parents:
1490
diff
changeset
|
2168 |
]. |
1345 | 2169 |
^ self. |
2170 |
]. |
|
2171 |
||
2172 |
changedObject == imageEditView image ifTrue:[ |
|
1377 | 2173 |
self halt:'to be implemented'. |
1345 | 2174 |
^ self. |
2175 |
]. |
|
2176 |
||
942 | 2177 |
super update:something with:aParameter from:changedObject |
2178 |
||
1345 | 2179 |
"Modified: / 10.2.2000 / 23:36:49 / cg" |
942 | 2180 |
! |
2181 |
||
1054 | 2182 |
updateForNoImage |
767 | 2183 |
"updates channels and view, if image is loaded" |
2184 |
||
2185 |
self imageIsLoaded value: false. |
|
2186 |
self listOfColors removeAll. |
|
2187 |
self imagePreView image: nil |
|
2188 |
||
2189 |
||
2190 |
||
2191 |
||
2192 |
! |
|
2193 |
||
2194 |
updateLabelsAndHistory |
|
2195 |
"updates labels and history, if something has changed" |
|
2196 |
||
2197 |
self imageIsLoaded value: self image notNil. |
|
2198 |
||
2199 |
self image isNil ifTrue: [^nil]. |
|
2200 |
||
2201 |
self updateInfoLabel. |
|
2202 |
||
911 | 2203 |
imageEditView resourceMessage asCollectionOfWords size = 2 |
2204 |
ifTrue: [self addToHistory: imageEditView resourceMessage -> #loadFromMessage:]. |
|
767 | 2205 |
|
2206 |
self image fileName notNil |
|
2207 |
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:]. |
|
2208 |
||
2209 |
||
2210 |
||
2211 |
! ! |
|
2212 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2213 |
!ImageEditor methodsFor:'data access'! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2214 |
|
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2215 |
atColor:aOldColor put:aNewColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2216 |
"a color changed to a new color |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2217 |
" |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2218 |
|index list| |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2219 |
|
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2220 |
list := self listOfColors. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2221 |
index := list identityIndexOf:aOldColor. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2222 |
|
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2223 |
index ~~ 0 ifTrue:[ |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2224 |
list at:index put:aNewColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2225 |
] ifFalse:[ |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2226 |
self halt:'should not happen'. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2227 |
list add:aNewColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2228 |
]. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2229 |
! |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2230 |
|
942 | 2231 |
blueAtColor:aColor put:newBlue |
2232 |
"helper used to return a new row element, when blue is changed" |
|
2233 |
||
2234 |
|byte| |
|
2235 |
||
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2236 |
aColor isNil ifTrue:[^ self]. "/ mask cannot be changed |
942 | 2237 |
byte := newBlue clampBetween:0 and:255. |
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2238 |
byte = aColor blueByte ifTrue:[^ self ]. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2239 |
|
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2240 |
self atColor:aColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2241 |
put:(Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte). |
942 | 2242 |
! |
2243 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2244 |
blueFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2245 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2246 |
|
930 | 2247 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2248 |
^ aColor blueByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2249 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2250 |
"Created: / 26.7.1998 / 12:30:35 / cg" |
930 | 2251 |
"Modified: / 31.7.1998 / 01:11:18 / cg" |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2252 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2253 |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2254 |
canSelectBlueInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2255 |
^ aColor blueByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2256 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2257 |
"Created: / 7.8.1998 / 22:50:34 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2258 |
"Modified: / 7.8.1998 / 22:52:57 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2259 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2260 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2261 |
canSelectGreenInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2262 |
^ aColor greenByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2263 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2264 |
"Created: / 7.8.1998 / 22:50:22 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2265 |
"Modified: / 7.8.1998 / 22:52:46 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2266 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2267 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2268 |
canSelectRedInColor:aColor |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2269 |
^ aColor redByte notNil |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2270 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2271 |
"Created: / 7.8.1998 / 22:50:00 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2272 |
"Modified: / 7.8.1998 / 22:51:03 / cg" |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2273 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2274 |
|
942 | 2275 |
greenAtColor:aColor put:newGreen |
2276 |
"helper used to return a new row element, when green is changed" |
|
2277 |
||
2278 |
|byte| |
|
2279 |
||
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2280 |
aColor isNil ifTrue:[^ self]. "/ mask cannot be changed |
942 | 2281 |
byte := newGreen clampBetween:0 and:255. |
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2282 |
byte = aColor greenByte ifTrue:[^ self]. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2283 |
|
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2284 |
self atColor:aColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2285 |
put:(Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte)). |
942 | 2286 |
! |
2287 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2288 |
greenFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2289 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2290 |
|
930 | 2291 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2292 |
^ aColor greenByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2293 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2294 |
"Created: / 26.7.1998 / 12:30:29 / cg" |
930 | 2295 |
"Modified: / 31.7.1998 / 01:11:31 / cg" |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2296 |
! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2297 |
|
942 | 2298 |
redAtColor:aColor put:newRed |
2299 |
"helper used to return a new row element, when red is changed" |
|
2300 |
||
2301 |
|byte| |
|
2302 |
||
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2303 |
aColor isNil ifTrue:[^ self]. "/ mask cannot be changed |
942 | 2304 |
byte := newRed clampBetween:0 and:255. |
1611
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2305 |
byte = aColor redByte ifTrue:[^ self]. |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2306 |
|
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2307 |
self atColor:aColor |
2f23751929d6
behavior of dataset changed if a write operation is invoked by a column adaptor
ca
parents:
1603
diff
changeset
|
2308 |
put:(Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte)). |
942 | 2309 |
! |
2310 |
||
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2311 |
redFromColor:aColor |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2312 |
"helper used to access a color as a row in the dataSet view" |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2313 |
|
930 | 2314 |
aColor isNil ifTrue:[^ 'none']. |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2315 |
^ aColor redByte ? 'mask' |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2316 |
|
930 | 2317 |
"Modified: / 31.7.1998 / 01:11:35 / cg" |
1449
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2318 |
! |
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2319 |
|
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2320 |
theColorItSelf:aColor |
49ad9f552d64
oops - fixed bg-color access in dataset
Claus Gittinger <cg@exept.de>
parents:
1446
diff
changeset
|
2321 |
^ aColor |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2322 |
! ! |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2323 |
|
672 | 2324 |
!ImageEditor methodsFor:'help'! |
2325 |
||
2326 |
defaultInfoLabel |
|
767 | 2327 |
"returns the default info label" |
672 | 2328 |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2329 |
|resourceClass| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2330 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2331 |
resourceClass := imageEditView resourceClass. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2332 |
(resourceClass isSymbol and: [(Smalltalk at:resourceClass) isClass]) |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2333 |
ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2334 |
^ resourceClass, ' >> ', imageEditView resourceSelector |
672 | 2335 |
]. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2336 |
^ 'No class and selector defined.' |
674 | 2337 |
! |
2338 |
||
702 | 2339 |
openDocumentation |
767 | 2340 |
"opens the documentation file of the Image Editor" |
674 | 2341 |
|
763 | 2342 |
self openHTMLDocument: 'tools/uipainter/ImageEditor.html' |
2343 |
||
672 | 2344 |
! ! |
2345 |
||
767 | 2346 |
!ImageEditor methodsFor:'loading'! |
2347 |
||
2348 |
loadFromFile: aFileName |
|
2349 |
"loads an image from aFileName and sets up color map list and other info labels" |
|
2350 |
||
960 | 2351 |
|img| |
2352 |
||
980
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2353 |
self withCursor:Cursor wait do:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2354 |
(imageEditView loadFromFile: aFileName) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2355 |
(img := self image) notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2356 |
img colorMap notNil ifTrue:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2357 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2358 |
] ifFalse:[ |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2359 |
self listOfColors removeAll. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2360 |
]. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2361 |
self findColorMapMode. |
bd21079f40e1
show waitCursor while loading from file.
Claus Gittinger <cg@exept.de>
parents:
976
diff
changeset
|
2362 |
self updateLabelsAndHistory. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2363 |
img := img onDevice:device. |
1057 | 2364 |
imageEditView image:img. |
960 | 2365 |
] ifFalse:[ |
1054 | 2366 |
self updateForNoImage |
1057 | 2367 |
]. |
767 | 2368 |
] |
2369 |
] |
|
960 | 2370 |
|
1057 | 2371 |
"Modified: / 16.3.1999 / 21:44:26 / cg" |
767 | 2372 |
! |
2373 |
||
960 | 2374 |
loadFromImage:anImage |
767 | 2375 |
"loads an image from anImage and sets up color map list and other info labels" |
2376 |
||
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2377 |
|img| |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2378 |
|
1057 | 2379 |
anImage notNil ifTrue:[ |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2380 |
img := anImage onDevice:device. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2381 |
]. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2382 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2383 |
imageEditView image:img. |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2384 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2385 |
img notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2386 |
img colorMap notNil ifTrue:[ |
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2387 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
960 | 2388 |
] ifFalse:[ |
767 | 2389 |
self listOfColors removeAll. |
2390 |
]. |
|
2391 |
self findColorMapMode. |
|
2392 |
self updateLabelsAndHistory. |
|
960 | 2393 |
] ifFalse:[ |
1054 | 2394 |
self updateForNoImage |
767 | 2395 |
] |
960 | 2396 |
|
1057 | 2397 |
"Modified: / 16.3.1999 / 21:43:56 / cg" |
767 | 2398 |
! |
2399 |
||
2400 |
loadFromMessage: aMessage |
|
2401 |
"loads an image by evaluating aMessage and sets up color map list and other info labels" |
|
2402 |
||
960 | 2403 |
|img| |
2404 |
||
2405 |
(imageEditView loadFromMessage: aMessage) notNil ifTrue:[ |
|
2406 |
(img := self image) notNil ifTrue:[ |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2407 |
img := img onDevice:device. |
960 | 2408 |
self listOfColors contents:(img usedColors asSet asOrderedCollection). |
767 | 2409 |
self findColorMapMode. |
2410 |
self updateLabelsAndHistory. |
|
1057 | 2411 |
imageEditView image:img. |
960 | 2412 |
] ifFalse:[ |
1054 | 2413 |
self updateForNoImage |
767 | 2414 |
] |
2415 |
] |
|
960 | 2416 |
|
1057 | 2417 |
"Modified: / 16.3.1999 / 21:44:41 / cg" |
767 | 2418 |
! |
2419 |
||
2420 |
loadFromOrPrepareForMessage: aMessage |
|
2421 |
"loads an image by evaluating aMessage; |
|
2422 |
if no image could extract from aMessage; do set the class and the selector from |
|
2423 |
the aMessage for a saving at the end of editing" |
|
2424 |
||
911 | 2425 |
(imageEditView loadFromMessage: aMessage) notNil |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2426 |
ifTrue: [ |
767 | 2427 |
self listOfColors contents: self image usedColors asSet asOrderedCollection. |
2428 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2429 |
] ifFalse: [ |
911 | 2430 |
imageEditView resourceMessage: aMessage. |
767 | 2431 |
]. |
2432 |
self updateLabelsAndHistory. |
|
1057 | 2433 |
|
2434 |
"Modified: / 16.3.1999 / 21:45:07 / cg" |
|
767 | 2435 |
! ! |
2436 |
||
400 | 2437 |
!ImageEditor methodsFor:'menu modes'! |
2438 |
||
975 | 2439 |
colorMapMode |
2440 |
"returns colorMapMode" |
|
400 | 2441 |
|
975 | 2442 |
colorMapMode isNil ifTrue: [colorMapMode := '' asValue]. |
400 | 2443 |
|
975 | 2444 |
^colorMapMode |
400 | 2445 |
! |
2446 |
||
975 | 2447 |
editMode |
2448 |
"returns editMode" |
|
400 | 2449 |
|
1054 | 2450 |
editMode isNil ifTrue: [ |
975 | 2451 |
editMode := #point asValue. |
1329 | 2452 |
editMode onChangeEvaluate:[imageEditView editMode:(editMode value)] |
975 | 2453 |
]. |
2454 |
||
2455 |
^editMode |
|
400 | 2456 |
! |
2457 |
||
975 | 2458 |
mouseKeyColorMode |
2459 |
"returns mouseKeyColorMode" |
|
400 | 2460 |
|
1345 | 2461 |
mouseKeyColorMode isNil ifTrue:[ |
975 | 2462 |
mouseKeyColorMode := 1 asValue. |
1345 | 2463 |
mouseKeyColorMode onChangeEvaluate: [ |
2464 |
imageEditView mouseKeyColorMode:mouseKeyColorMode value. |
|
2465 |
self selectionOfColor value: (self listOfColors indexOf:imageEditView selectedColor). |
|
2466 |
] |
|
956 | 2467 |
]. |
400 | 2468 |
|
975 | 2469 |
^mouseKeyColorMode |
1345 | 2470 |
|
2471 |
"Modified: / 10.2.2000 / 23:16:42 / cg" |
|
400 | 2472 |
! ! |
2473 |
||
1558 | 2474 |
!ImageEditor methodsFor:'private'! |
2475 |
||
1598 | 2476 |
updateImage |
2477 |
|img| |
|
2478 |
||
2479 |
img := imageEditView image. |
|
2480 |
imageEditView image:img. |
|
2481 |
self fetchImageData. |
|
2482 |
! |
|
2483 |
||
1558 | 2484 |
updateImagePreView |
2485 |
self tileModeHolder value ifTrue:[ |
|
2486 |
self imagePreView tileMode:true tileOffset:(self image extent). |
|
2487 |
] |
|
2488 |
! ! |
|
2489 |
||
535 | 2490 |
!ImageEditor methodsFor:'queries'! |
2491 |
||
960 | 2492 |
hasMask |
1556 | 2493 |
^ colorMapMode value notNil and:[colorMapMode value endsWith:'mask'] |
960 | 2494 |
|
2495 |
"Created: / 18.8.1998 / 17:17:38 / cg" |
|
2496 |
! |
|
2497 |
||
535 | 2498 |
preferredExtent |
767 | 2499 |
"returns the preferred extent" |
535 | 2500 |
|
2501 |
^super preferredExtent max: (Screen current width//3)@(Screen current height//3.5) |
|
2502 |
||
2503 |
||
2504 |
! ! |
|
2505 |
||
400 | 2506 |
!ImageEditor methodsFor:'selection'! |
2507 |
||
2508 |
magnification |
|
767 | 2509 |
"returns the magnification of the image" |
400 | 2510 |
|
911 | 2511 |
self imageEditView isNil ifTrue: [^1]. |
2512 |
^imageEditView magnification x |
|
400 | 2513 |
! |
2514 |
||
2515 |
magnification: aValue |
|
767 | 2516 |
"sets the magnification of the image" |
400 | 2517 |
|
905 | 2518 |
|magnification| |
2519 |
magnification := (aValue ? 1) asPoint. |
|
911 | 2520 |
(magnification = imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil]. |
2521 |
imageEditView magnification: magnification |
|
400 | 2522 |
! |
2523 |
||
2524 |
selectedColorIndex |
|
767 | 2525 |
"returns the index of the selected color" |
400 | 2526 |
|
2527 |
^selectedColorIndex |
|
2528 |
! |
|
2529 |
||
2530 |
selectedColorIndex: anIndex |
|
767 | 2531 |
"sets the index of the selected color" |
400 | 2532 |
|
1054 | 2533 |
|clr pixel| |
2534 |
||
2535 |
selectedColorIndex := anIndex. |
|
2536 |
clr := self listOfColors at:anIndex ifAbsent:nil. |
|
2537 |
clr isNil ifTrue:[^ self]. |
|
2538 |
||
1075 | 2539 |
pixel := anIndex - 1. |
1054 | 2540 |
(self listOfColors at:1) = Color noColor ifTrue:[ |
2541 |
anIndex == 1 ifTrue:[ |
|
2542 |
pixel := nil. "/ mask |
|
2543 |
] ifFalse:[ |
|
1075 | 2544 |
pixel := pixel - 1 |
1054 | 2545 |
] |
2546 |
]. |
|
2547 |
imageEditView selectedColorIndex:pixel. |
|
2548 |
imageEditView selectedColor:clr. |
|
400 | 2549 |
|
2550 |
! ! |
|
2551 |
||
2552 |
!ImageEditor methodsFor:'startup / release'! |
|
2553 |
||
2554 |
closeRequest |
|
767 | 2555 |
"close request" |
400 | 2556 |
|
911 | 2557 |
imageEditView checkModified ifTrue:[super closeRequest] |
400 | 2558 |
|
2559 |
! |
|
2560 |
||
2561 |
open |
|
767 | 2562 |
"after opening, sets the masterApplication of the imageEditView to self" |
400 | 2563 |
|
2564 |
super open. |
|
444 | 2565 |
|
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
2566 |
imageEditView := (self componentAt: #imageEditView) subViews first. |
400 | 2567 |
! |
2568 |
||
2569 |
postOpenWith:aBuilder |
|
767 | 2570 |
"after opening, sets the masterApplication of the imageEditView to self; |
2571 |
evaluate the postOpenAction" |
|
400 | 2572 |
|
1124 | 2573 |
imageEditView undoImages addDependent:self. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2574 |
imageEditView imageInfoHolder:(self imageInfoHolder). |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2575 |
imageEditView activityInfoHolder:(self activityInfoHolder). |
1345 | 2576 |
imageEditView clickInfoCallBack:[:button :point | |
2577 |
|mouseButtonColorToolBar| |
|
2578 |
||
1597
b670ad8c30e1
builder componentAt: -> self componentAt:
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
2579 |
mouseButtonColorToolBar := self componentAt:#MouseButtonColorToolBar. |
1345 | 2580 |
(mouseButtonColorToolBar itemAt:button) toggleIndication. |
2581 |
mouseButtonColorToolBar do: [:i| i updateIndicators]. |
|
2582 |
]. |
|
2583 |
imageEditView addDependent:self. |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2584 |
|
400 | 2585 |
postOpenAction notNil ifTrue: [postOpenAction value]. |
2586 |
||
1250 | 2587 |
super postOpenWith:aBuilder. |
2588 |
||
2589 |
aBuilder keyboardProcessor menuBar:nil. |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
2590 |
|
1345 | 2591 |
"Modified: / 10.2.2000 / 23:17:43 / cg" |
400 | 2592 |
! ! |
2593 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2594 |
!ImageEditor methodsFor:'user actions - colormap'! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2595 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2596 |
addColorToColormap |
1057 | 2597 |
|depth img cMap newColorMap newImage oldCListSize newMode| |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2598 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2599 |
img := self image. |
1499
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2600 |
img isNil ifTrue:[ |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2601 |
self warn:'No Image.'. |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2602 |
^ self |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2603 |
]. |
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2604 |
|
1054 | 2605 |
depth := img depth. |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2606 |
cMap := img colorMap. |
1054 | 2607 |
cMap isNil ifTrue:[ |
1499
0c57ab09156b
about menu items moved into the Help-menu
Claus Gittinger <cg@exept.de>
parents:
1496
diff
changeset
|
2608 |
self warn:'Image has no colormap.\Change colorMap mode first.' withCRs. |
1054 | 2609 |
^ self |
2610 |
]. |
|
2611 |
||
1583 | 2612 |
("(depth == 1)" false |
1054 | 2613 |
or:[cMap size == (1 bitShift:depth)]) ifTrue:[ |
2614 |
depth >= 8 ifTrue:[ |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2615 |
self warn:'No space for more colors in colormap.'. |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2616 |
^ self |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2617 |
]. |
1054 | 2618 |
(self confirm:'No space for more colors in colormap.\Change depth first.' withCRs) |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2619 |
ifFalse:[ |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2620 |
^ self |
1057 | 2621 |
]. |
2622 |
||
2623 |
imageEditView makeUndo. |
|
2624 |
newMode := (depth*2) printString , (colorMapMode value copyFrom:2). |
|
2625 |
self colorMapMode:newMode. |
|
2626 |
] ifFalse:[ |
|
2627 |
imageEditView makeUndo. |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2628 |
]. |
1054 | 2629 |
|
2630 |
cMap := cMap asArray. |
|
2631 |
oldCListSize := self listOfColors size. |
|
2632 |
||
2633 |
"/ (colorMapMode value asString endsWith:'mask') ifTrue:[ |
|
2634 |
"/ cMap last = Color noColor ifTrue:[ |
|
2635 |
"/ cMap := cMap copyWithoutLast:1 |
|
2636 |
"/ ] ifFalse:[ |
|
2637 |
"/ cMap first = Color noColor ifTrue:[ |
|
2638 |
"/ cMap := cMap copyFrom:2 |
|
2639 |
"/ ] |
|
2640 |
"/ ]. |
|
2641 |
"/ ]. |
|
2642 |
"/ |
|
2643 |
||
2644 |
newColorMap := cMap copyWith:(Color black). |
|
2645 |
||
2646 |
newImage := img species new |
|
2647 |
width:img width |
|
2648 |
height:img height |
|
2649 |
depth:depth |
|
2650 |
fromArray:img bits. |
|
2651 |
||
2652 |
newImage colorMap:newColorMap. |
|
2653 |
newImage fileName:img fileName. |
|
2654 |
newImage mask:(img mask copy). |
|
2655 |
||
2656 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
2657 |
self listOfColors contents: newImage colorMap. |
|
2658 |
self findColorMapMode. |
|
2659 |
"/ mhmh - somehow, we get two colors added ... (sigh findColorMapMode adds another one ...) |
|
2660 |
self listOfColors size > (oldCListSize + 1) ifTrue:[ |
|
2661 |
self listOfColors removeLast |
|
2662 |
]. |
|
2663 |
self selectionOfColor value:(self listOfColors size). |
|
2664 |
self updateLabelsAndHistory. |
|
2665 |
] |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2666 |
|
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2667 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
1057 | 2668 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2669 |
! |
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2670 |
|
1403 | 2671 |
clearMaskedPixels |
2672 |
"clear all masked pixels (to pixelValue 0)" |
|
2673 |
||
1460 | 2674 |
|newImage oldImage| |
1403 | 2675 |
|
2676 |
oldImage := self image. |
|
2677 |
||
2678 |
imageEditView makeUndo. |
|
2679 |
||
2680 |
self withExecuteCursorDo:[ |
|
2681 |
newImage := oldImage clearMaskedPixels. |
|
1460 | 2682 |
0 to:newImage height - 1 do:[:y | |
2683 |
0 to:newImage width - 1 do:[:x | |
|
2684 |
(newImage maskAtX:x y:y) == 0 ifTrue:[ |
|
2685 |
newImage pixelAtX:x y:y put:0 |
|
2686 |
] |
|
2687 |
] |
|
2688 |
]. |
|
2689 |
||
1403 | 2690 |
(imageEditView image:newImage) notNil ifTrue:[ |
1446 | 2691 |
self fetchImageData. |
1403 | 2692 |
] |
2693 |
] |
|
2694 |
! |
|
2695 |
||
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2696 |
colorMapChanged |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2697 |
|img| |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2698 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2699 |
img := self image. |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2700 |
img release. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2701 |
|
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
2702 |
self imageEditView invalidate. |
960 | 2703 |
self imagePreView invalidate. |
2704 |
||
2705 |
"/ (imageEditView image:img) notNil ifTrue:[ |
|
2706 |
"/ self updateLabelsAndHistory. |
|
2707 |
"/ self imagePreView image:img |
|
2708 |
"/ ] |
|
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2709 |
|
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2710 |
"Created: / 7.8.1998 / 22:26:10 / cg" |
960 | 2711 |
"Modified: / 18.8.1998 / 17:08:55 / cg" |
945
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2712 |
! |
cb689f3971ab
allow editing of color values;
Claus Gittinger <cg@exept.de>
parents:
942
diff
changeset
|
2713 |
|
975 | 2714 |
colorMapMode:aMode |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2715 |
"calculates a new color map for the image from aMode" |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2716 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2717 |
|depth numColors newColorMap newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2718 |
oldImage image newColors realColorMap oldFileName |
1008 | 2719 |
usedColors useNearest usageCounts tmpBits tmpMap quest |
2720 |
prevMode maskThreshold maskImage| |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2721 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2722 |
self withExecuteCursorDo:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2723 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2724 |
|
1053
31097504a15a
fixed startup (modal box in calling thread, instead of
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
2725 |
prevMode := colorMapMode value. |
1008 | 2726 |
oldImage depth > 8 ifTrue:[ |
2727 |
prevMode := nil |
|
2728 |
]. |
|
2729 |
||
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2730 |
newColorMap := self class listOfColorMaps at:aMode. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2731 |
depth := (newColorMap size log: 2) asInteger. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2732 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2733 |
useNearest := false. |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2734 |
depth == 1 ifTrue:[ |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2735 |
quest := 'Keep colormap (or use standard B&W)' |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2736 |
] ifFalse:[ |
1008 | 2737 |
prevMode isNil ifTrue:[ |
2738 |
quest := 'Compute colormap (or use standard)' |
|
2739 |
] ifFalse:[ |
|
2740 |
quest := 'Keep colormap (or use standard)' |
|
2741 |
] |
|
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2742 |
]. |
1008 | 2743 |
((prevMode = aMode) |
1057 | 2744 |
or:[depth > oldImage depth |
2745 |
or:[self confirm:(resources string:quest)]]) ifTrue:[ |
|
1008 | 2746 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2747 |
"/ keep the colormap |
1008 | 2748 |
newColorMap atAllPut:Color black. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2749 |
depth > oldImage depth ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2750 |
"/ easy - simply copy the part |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2751 |
numColors := 1 bitShift:oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2752 |
0 to:numColors-1 do:[:pixel | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2753 |
newColorMap at:(pixel+1) put:(oldImage colorFromValue:pixel) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2754 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2755 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2756 |
"/ see if all used color fit the new colormap |
986 | 2757 |
usedColors := oldImage usedColorsMax:(1 bitShift:depth). |
1403 | 2758 |
(usedColors notNil and:[usedColors size > (1 bitShift:depth)]) ifTrue:[ |
2759 |
usedColors := oldImage realUsedColors |
|
2760 |
]. |
|
986 | 2761 |
(usedColors notNil and:[usedColors size <= (1 bitShift:depth)]) ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2762 |
"/ yea - just install them |
986 | 2763 |
usedColors asArray keysAndValuesDo:[:idx :clr | |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2764 |
newColorMap at:idx put:clr |
1008 | 2765 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2766 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2767 |
"/ copy over those that are most often used. |
986 | 2768 |
oldImage depth < 8 ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2769 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2770 |
oldImage bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2771 |
expandPixels:(oldImage depth) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2772 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2773 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2774 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2775 |
mapping:nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2776 |
] ifFalse:[ |
986 | 2777 |
oldImage depth == 8 ifTrue:[ |
2778 |
tmpBits := oldImage bits |
|
2779 |
] ifFalse:[ |
|
1124 | 2780 |
colorMapMode value:prevMode. |
1471 | 2781 |
self warn:('Too many used colors in image (', oldImage usedColors size printString , ').'). |
986 | 2782 |
^ self |
1471 | 2783 |
"/ (self confirm:('Too many used colors in image (', oldImage usedColors size printString , ').\\Dither ?' withCRs)) |
2784 |
"/ ifFalse:[. |
|
2785 |
"/ ^ self |
|
2786 |
"/ ]. |
|
2787 |
"/ self image: (Image newForDepth:depth) fromImage:oldImage. |
|
2788 |
"/ ^ self. |
|
986 | 2789 |
] |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2790 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2791 |
usageCounts := tmpBits usageCounts. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2792 |
tmpMap := Array new:usageCounts size. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2793 |
oldImage colorMap asArray keysAndValuesDo:[:i :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2794 |
tmpMap at:i put:clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2795 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2796 |
usageCounts sort:[:a :b | a > b] with:tmpMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2797 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2798 |
1 to:(1 bitShift:depth) do:[:idx | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2799 |
newColorMap at:idx put:(tmpMap at:idx) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2800 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2801 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2802 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2803 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2804 |
string:'Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to first color) ?' |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2805 |
with:usedColors size |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2806 |
with:(1 bitShift:depth)) withCRs |
1542 | 2807 |
labels:(resources array:#('Cancel' 'First' 'Nearest')). |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2808 |
useNearest isNil ifTrue:[ |
1542 | 2809 |
colorMapMode value:prevMode. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2810 |
^ self "/ cancel |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2811 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2812 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2813 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2814 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2815 |
"/ standard colormap |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2816 |
usedColors := oldImage usedColors. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2817 |
(usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[ |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2818 |
useNearest := Dialog |
928
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2819 |
confirmWithCancel:(resources |
89bd2304da33
cleaned up imageEitViews interface to my infoPanel
Claus Gittinger <cg@exept.de>
parents:
927
diff
changeset
|
2820 |
string:'Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to first color) ?' |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2821 |
) withCRs |
1542 | 2822 |
labels:(resources string:#('Cancel' 'First' 'Nearest')). |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2823 |
useNearest isNil ifTrue:[ |
1542 | 2824 |
colorMapMode value:prevMode. |
921
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2825 |
^ self "/ cancel |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2826 |
]. |
a5aca21ea803
also allow nearest-color mode for standard colormap.
Claus Gittinger <cg@exept.de>
parents:
920
diff
changeset
|
2827 |
]. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2828 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2829 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2830 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2831 |
|
1424
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2832 |
newImage := Image newForDepth:depth. |
d7367ae7f85e
fixed conversion of 3-3-2 8-bit truecolor images
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
2833 |
newImage depth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2834 |
oldFileName := oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2835 |
|
1008 | 2836 |
Image imageErrorSignal handle:[:ex| |
2837 |
Color colorErrorSignal handle:[:ex| |
|
1542 | 2838 |
colorMapMode value:prevMode. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2839 |
imageEditView undo. |
1008 | 2840 |
^ self warn:(resources string:'Conversion failed !!') |
2841 |
] do:[ |
|
1393 | 2842 |
newImage := Image newForDepth:depth. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2843 |
newImage width:oldImage width height:oldImage height depth:depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2844 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2845 |
newImage photometric:#palette. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2846 |
newImage bits:(ByteArray new:(newImage bytesPerRow * newImage height)). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2847 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2848 |
oldImage colorsFromX:0 y:0 toX:(oldImage width-1) y:(oldImage height-1) do: |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2849 |
[:x :y :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2850 |
|newColor| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2851 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2852 |
(newColorMap includes:clr) |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2853 |
ifTrue: [newColor := clr] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2854 |
ifFalse: [ |
1008 | 2855 |
newColor := clr nearestIn:newColorMap. |
2856 |
useNearest ifFalse:[ |
|
2857 |
(newColor deltaFrom:clr) > 0.5 ifTrue:[ |
|
2858 |
newColor := oldImage colorFromValue:0 |
|
2859 |
] |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2860 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2861 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2862 |
newImage colorAtX:x y:y put:newColor. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2863 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2864 |
image := newImage |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2865 |
]. |
1008 | 2866 |
] do:[ |
2867 |
image := newImage fromImage:oldImage |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2868 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2869 |
|
1008 | 2870 |
(aMode asString endsWith:'mask') ifTrue:[ |
2871 |
image mask isNil ifTrue:[ |
|
2872 |
(self confirm:'Generate mask from black ?') ifTrue:[ |
|
2873 |
maskThreshold := 0.1. |
|
2874 |
maskImage := Depth1Image fromImage:(image asThresholdMonochromeImage:maskThreshold). |
|
2875 |
] ifFalse:[ |
|
2876 |
maskImage := Depth1Image extent:image extent. |
|
2877 |
maskImage data:(ByteArray |
|
2878 |
new:(maskImage bytesPerRow * maskImage height) |
|
2879 |
withAll:16rFF). |
|
2880 |
||
2881 |
"/ maskImage fillRectangle:(image bounds) withColor:(Color colorId:1). |
|
2882 |
]. |
|
2883 |
image mask:maskImage. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2884 |
]. |
1008 | 2885 |
] ifFalse:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2886 |
image mask: nil. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2887 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2888 |
realColorMap := OrderedCollection new. |
1054 | 2889 |
image realColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2890 |
(realColorMap includes: clr) ifFalse: [realColorMap add: clr] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2891 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2892 |
newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size). |
1054 | 2893 |
newColorMap do:[:clr| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2894 |
((newColors size < newColorMap size) and: [(newColors includes: clr) not]) |
1054 | 2895 |
ifTrue:[ |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2896 |
newColors add: clr |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2897 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2898 |
]. |
975 | 2899 |
image colorMap: newColors. |
1446 | 2900 |
image fileName: oldFileName. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2901 |
|
1054 | 2902 |
(imageEditView image: image) notNil ifTrue:[ |
1446 | 2903 |
self fetchImageData. |
2904 |
"/ self listOfColors contents: image colorMap. |
|
2905 |
"/ self findColorMapMode. |
|
2906 |
"/ self updateLabelsAndHistory. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2907 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2908 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2909 |
|
1057 | 2910 |
"Modified: / 16.3.1999 / 21:55:39 / cg" |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2911 |
! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2912 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2913 |
compressColorMap |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2914 |
"calculates a new color map for the image, using only used colors" |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2915 |
|
927 | 2916 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2917 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2918 |
oldImage := self image. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2919 |
depth := oldImage depth. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2920 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2921 |
oldImage photometric ~~ #palette ifTrue:[ |
930 | 2922 |
self information:'Compress colorMap: Only palette images have colormaps.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2923 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2924 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2925 |
|
1403 | 2926 |
usedColors := oldImage realUsedColors. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2927 |
usedColors size == (1 bitShift:depth) ifTrue:[ |
930 | 2928 |
self information:'Compress colorMap: All colors are used - no compression.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2929 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2930 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2931 |
usedColors size == oldImage colorMap size ifTrue:[ |
930 | 2932 |
self information:'Compress colorMap: Colormap already compressed - no compression.'. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2933 |
^ self |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2934 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2935 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2936 |
imageEditView makeUndo. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2937 |
|
930 | 2938 |
self information:('Compress colorMap: %1 colors used.' bindWith:usedColors size). |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2939 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2940 |
self withExecuteCursorDo:[ |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2941 |
"/ newColorMap := Array new:usedColors size. |
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2942 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2943 |
"/ translation table |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2944 |
oldToNew := ByteArray new:(1 bitShift:depth). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2945 |
newColorMap := usedColors asArray. |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2946 |
newColorMap sort:[:a :b | |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2947 |
a redByte == b redByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2948 |
a greenByte == b greenByte ifTrue:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2949 |
a blueByte < b blueByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2950 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2951 |
a greenByte < b greenByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2952 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2953 |
] ifFalse:[ |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2954 |
a redByte < b redByte |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2955 |
] |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2956 |
]. |
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
2957 |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2958 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2959 |
|newPixel| |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2960 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2961 |
(usedColors includes:clr) ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2962 |
newPixel := newColorMap indexOf:clr. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2963 |
oldToNew at:oldIdx put:newPixel-1. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2964 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2965 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2966 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2967 |
oldBits := oldImage bits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2968 |
newBits := ByteArray new:(oldBits size). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2969 |
depth ~~ 8 ifTrue:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2970 |
"/ expand/compress can only handle 8bits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2971 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2972 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2973 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2974 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2975 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2976 |
into:tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2977 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2978 |
tmpBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2979 |
compressPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2980 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2981 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2982 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2983 |
mapping:nil |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2984 |
] ifFalse:[ |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2985 |
oldBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2986 |
expandPixels:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2987 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2988 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2989 |
into:newBits |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2990 |
mapping:oldToNew. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2991 |
]. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2992 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2993 |
newImage := oldImage species new |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2994 |
width:oldImage width |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2995 |
height:oldImage height |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2996 |
depth:depth |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2997 |
fromArray:newBits. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2998 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
2999 |
newImage colorMap:newColorMap. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3000 |
newImage fileName:oldImage fileName. |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3001 |
newImage mask:(oldImage mask copy). |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3002 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3003 |
(imageEditView image:newImage) notNil ifTrue: |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3004 |
[ |
1446 | 3005 |
self fetchImageData. |
3006 |
"/ self listOfColors contents: newImage colorMap. |
|
3007 |
"/ self findColorMapMode. |
|
3008 |
"/ self updateLabelsAndHistory. |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3009 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3010 |
] |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3011 |
|
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3012 |
"Created: / 28.7.1998 / 20:03:11 / cg" |
996
9423ae277168
sort colors when compressing the colorMap
Claus Gittinger <cg@exept.de>
parents:
990
diff
changeset
|
3013 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
1008 | 3014 |
! |
3015 |
||
1480 | 3016 |
copyMask |
3017 |
|mask| |
|
3018 |
||
3019 |
mask := self image mask. |
|
3020 |
MaskClipboard := mask subImageIn: (0@0 extent:mask extent). |
|
3021 |
! |
|
3022 |
||
1446 | 3023 |
fetchImageData |
1460 | 3024 |
|image| |
3025 |
||
3026 |
(image := imageEditView image) notNil ifTrue:[ |
|
3027 |
self listOfColors contents:(image colorMap). |
|
3028 |
self findColorMapMode. |
|
3029 |
self updateLabelsAndHistory. |
|
3030 |
] |
|
1446 | 3031 |
! |
3032 |
||
1544 | 3033 |
inspectColor |
3034 |
| img clrIndex| |
|
3035 |
||
3036 |
img := self image. |
|
3037 |
img isNil ifTrue:[ |
|
3038 |
self warn:'No Image.'. |
|
3039 |
^ self |
|
3040 |
]. |
|
3041 |
clrIndex := self selectionOfColor value. |
|
1603 | 3042 |
img mask notNil ifTrue: [ clrIndex := clrIndex - 1 ]. |
1544 | 3043 |
(img colorFromValue:clrIndex-1) inspect |
3044 |
! |
|
3045 |
||
1598 | 3046 |
makeBrighter |
3047 |
| anyChange| |
|
3048 |
||
3049 |
self withExecuteCursorDo:[ |
|
3050 |
anyChange := imageEditView makeBrighter. |
|
3051 |
anyChange ifFalse:[ |
|
3052 |
Dialog warn:'Image unchanged'. |
|
3053 |
] ifTrue:[ |
|
3054 |
self updateImage. |
|
3055 |
] |
|
3056 |
]. |
|
3057 |
! |
|
3058 |
||
3059 |
makeDarker |
|
3060 |
| anyChange| |
|
3061 |
||
3062 |
self withExecuteCursorDo:[ |
|
3063 |
anyChange := imageEditView makeDarker. |
|
3064 |
anyChange ifFalse:[ |
|
3065 |
Dialog warn:'Image unchanged'. |
|
3066 |
] ifTrue:[ |
|
3067 |
self updateImage. |
|
3068 |
] |
|
3069 |
]. |
|
3070 |
! |
|
3071 |
||
1436 | 3072 |
makeGrayScale |
1598 | 3073 |
|anyChange| |
1436 | 3074 |
|
3075 |
self withExecuteCursorDo:[ |
|
3076 |
anyChange := imageEditView makeGrayScale. |
|
3077 |
anyChange ifFalse:[ |
|
3078 |
Dialog warn:'Image unchanged'. |
|
3079 |
] ifTrue:[ |
|
1598 | 3080 |
self updateImage. |
3081 |
] |
|
3082 |
]. |
|
3083 |
! |
|
3084 |
||
3085 |
makeInverse |
|
3086 |
| anyChange| |
|
3087 |
||
3088 |
self withExecuteCursorDo:[ |
|
3089 |
anyChange := imageEditView makeInverse. |
|
3090 |
anyChange ifFalse:[ |
|
3091 |
Dialog warn:'Image unchanged'. |
|
3092 |
] ifTrue:[ |
|
3093 |
self updateImage. |
|
1436 | 3094 |
] |
3095 |
]. |
|
3096 |
! |
|
3097 |
||
1446 | 3098 |
makeSelectedColorBrighter |
1559 | 3099 |
|img cMap newImage clr| |
1446 | 3100 |
|
3101 |
img := self image. |
|
3102 |
cMap := img colorMap. |
|
3103 |
cMap isNil ifTrue:[ |
|
3104 |
self warn:'Image has no colormap\change colorMap mode first.' withCRs. |
|
3105 |
^ self |
|
3106 |
]. |
|
3107 |
||
3108 |
imageEditView makeUndo. |
|
3109 |
||
3110 |
cMap := cMap asArray. |
|
3111 |
clr := cMap at:imageEditView selectedColorIndex. |
|
3112 |
cMap at:imageEditView selectedColorIndex put:clr lightened. |
|
3113 |
||
3114 |
newImage := img species new |
|
3115 |
width:img width |
|
3116 |
height:img height |
|
1559 | 3117 |
depth:nil |
1446 | 3118 |
fromArray:img bits. |
3119 |
||
3120 |
newImage colorMap:cMap. |
|
3121 |
newImage fileName:img fileName. |
|
3122 |
newImage mask:(img mask copy). |
|
3123 |
||
3124 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
3125 |
self fetchImageData. |
|
3126 |
"/ self listOfColors contents: newImage colorMap. |
|
3127 |
"/ self findColorMapMode. |
|
3128 |
"/ self updateLabelsAndHistory. |
|
3129 |
] |
|
3130 |
||
3131 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
|
3132 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
|
3133 |
! |
|
3134 |
||
3135 |
makeSelectedColorDarker |
|
1559 | 3136 |
|img cMap clr newImage| |
1446 | 3137 |
|
3138 |
img := self image. |
|
3139 |
cMap := img colorMap. |
|
3140 |
cMap isNil ifTrue:[ |
|
3141 |
self warn:'Image has no colormap\change colorMap mode first.' withCRs. |
|
3142 |
^ self |
|
3143 |
]. |
|
3144 |
imageEditView makeUndo. |
|
3145 |
||
3146 |
cMap := cMap asArray. |
|
3147 |
clr := cMap at:imageEditView selectedColorIndex. |
|
3148 |
cMap at:imageEditView selectedColorIndex put:clr darkened. |
|
3149 |
||
3150 |
newImage := img species new |
|
3151 |
width:img width |
|
3152 |
height:img height |
|
1559 | 3153 |
depth:nil |
1446 | 3154 |
fromArray:img bits. |
3155 |
||
3156 |
newImage colorMap:cMap. |
|
3157 |
newImage fileName:img fileName. |
|
3158 |
newImage mask:(img mask copy). |
|
3159 |
||
3160 |
(imageEditView image:newImage) notNil ifTrue:[ |
|
3161 |
self fetchImageData. |
|
3162 |
"/ self listOfColors contents: newImage colorMap. |
|
3163 |
"/ self findColorMapMode. |
|
3164 |
"/ self updateLabelsAndHistory. |
|
3165 |
] |
|
3166 |
||
3167 |
"Created: / 12.3.1999 / 00:20:28 / cg" |
|
3168 |
"Modified: / 16.3.1999 / 21:57:26 / cg" |
|
3169 |
! |
|
3170 |
||
1480 | 3171 |
pasteMask |
3172 |
|img mask| |
|
3173 |
||
3174 |
imageEditView makeUndo. |
|
3175 |
||
3176 |
img := self image. |
|
3177 |
mask := img mask. |
|
3178 |
||
3179 |
mask |
|
3180 |
copyFrom:MaskClipboard |
|
3181 |
x:0 y:0 |
|
3182 |
toX:0 y:0 |
|
3183 |
width:(mask width min:MaskClipboard width) |
|
3184 |
height:(mask height min:MaskClipboard height). |
|
3185 |
img mask:mask. |
|
3186 |
(imageEditView image:img copy) notNil ifTrue:[ |
|
3187 |
self fetchImageData. |
|
3188 |
] |
|
3189 |
! |
|
3190 |
||
1124 | 3191 |
reduceNumberOfColors |
3192 |
|s n anyChange img| |
|
3193 |
||
3194 |
s := Dialog request:'Number of color bits to strip (1-7) ?'. |
|
1435 | 3195 |
s size == 0 ifTrue:[^ self]. |
1124 | 3196 |
n := Integer readFrom:s onError:0. |
3197 |
(n between:1 and:7) ifFalse:[ |
|
3198 |
Dialog warn:'Image unchanged'. |
|
3199 |
^ self |
|
3200 |
]. |
|
3201 |
||
3202 |
self withExecuteCursorDo:[ |
|
3203 |
anyChange := imageEditView reduceColorResolutionBy:n. |
|
3204 |
anyChange ifFalse:[ |
|
3205 |
Dialog warn:'Image unchanged'. |
|
3206 |
] ifTrue:[ |
|
3207 |
img := imageEditView image. |
|
3208 |
imageEditView image:img. |
|
1446 | 3209 |
|
3210 |
self fetchImageData. |
|
3211 |
"/ self listOfColors contents:(img colorMap). |
|
3212 |
"/ self findColorMapMode. |
|
3213 |
"/ self updateLabelsAndHistory. |
|
1124 | 3214 |
Dialog information:(img usedColors size printString , ' colors used.') |
3215 |
] |
|
3216 |
]. |
|
3217 |
! |
|
3218 |
||
1008 | 3219 |
sortColorMap |
3220 |
"calculates a new color map for the image, sorting colors" |
|
3221 |
||
3222 |
|depth newColorMap newImage oldImage usedColors oldToNew oldBits newBits tmpBits| |
|
3223 |
||
3224 |
oldImage := self image. |
|
3225 |
depth := oldImage depth. |
|
3226 |
||
3227 |
oldImage photometric ~~ #palette ifTrue:[ |
|
3228 |
self information:'Compress colorMap: Only palette images have colormaps.'. |
|
3229 |
^ self |
|
3230 |
]. |
|
3231 |
||
3232 |
usedColors := oldImage realColorMap. |
|
3233 |
||
3234 |
imageEditView makeUndo. |
|
3235 |
||
3236 |
self withExecuteCursorDo:[ |
|
3237 |
"/ newColorMap := Array new:usedColors size. |
|
3238 |
||
3239 |
"/ translation table |
|
3240 |
oldToNew := ByteArray new:(1 bitShift:depth). |
|
3241 |
newColorMap := usedColors asArray. |
|
3242 |
newColorMap sort:[:a :b | |
|
3243 |
a redByte == b redByte ifTrue:[ |
|
3244 |
a greenByte == b greenByte ifTrue:[ |
|
3245 |
a blueByte < b blueByte |
|
3246 |
] ifFalse:[ |
|
3247 |
a greenByte < b greenByte |
|
3248 |
] |
|
3249 |
] ifFalse:[ |
|
3250 |
a redByte < b redByte |
|
3251 |
] |
|
3252 |
]. |
|
3253 |
||
3254 |
oldImage colorMap asArray keysAndValuesDo:[:oldIdx :clr | |
|
3255 |
|newPixel| |
|
3256 |
||
3257 |
(usedColors includes:clr) ifTrue:[ |
|
3258 |
newPixel := newColorMap indexOf:clr. |
|
3259 |
oldToNew at:oldIdx put:newPixel-1. |
|
3260 |
] |
|
3261 |
]. |
|
3262 |
||
3263 |
oldBits := oldImage bits. |
|
3264 |
newBits := ByteArray new:(oldBits size). |
|
3265 |
depth ~~ 8 ifTrue:[ |
|
3266 |
"/ expand/compress can only handle 8bits |
|
3267 |
tmpBits := ByteArray uninitializedNew:(oldImage width*oldImage height). |
|
3268 |
oldBits |
|
3269 |
expandPixels:depth |
|
3270 |
width:oldImage width |
|
3271 |
height:oldImage height |
|
3272 |
into:tmpBits |
|
3273 |
mapping:oldToNew. |
|
3274 |
tmpBits |
|
3275 |
compressPixels:depth |
|
3276 |
width:oldImage width |
|
3277 |
height:oldImage height |
|
3278 |
into:newBits |
|
3279 |
mapping:nil |
|
3280 |
] ifFalse:[ |
|
3281 |
oldBits |
|
3282 |
expandPixels:depth |
|
3283 |
width:oldImage width |
|
3284 |
height:oldImage height |
|
3285 |
into:newBits |
|
3286 |
mapping:oldToNew. |
|
3287 |
]. |
|
3288 |
||
3289 |
newImage := oldImage species new |
|
3290 |
width:oldImage width |
|
3291 |
height:oldImage height |
|
3292 |
depth:depth |
|
3293 |
fromArray:newBits. |
|
3294 |
||
3295 |
newImage colorMap:newColorMap. |
|
3296 |
newImage fileName:oldImage fileName. |
|
3297 |
newImage mask:(oldImage mask copy). |
|
3298 |
||
1054 | 3299 |
(imageEditView image:newImage) notNil ifTrue:[ |
1446 | 3300 |
self fetchImageData. |
3301 |
"/ self listOfColors contents: newImage colorMap. |
|
3302 |
"/ self findColorMapMode. |
|
3303 |
"/ self updateLabelsAndHistory. |
|
1008 | 3304 |
] |
3305 |
] |
|
3306 |
||
3307 |
"Modified: / 15.9.1998 / 17:53:32 / cg" |
|
3308 |
"Created: / 30.9.1998 / 23:51:23 / cg" |
|
919
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3309 |
! ! |
4e50c3164625
more options (preserving colorMap) when changing the colorMapMode;
Claus Gittinger <cg@exept.de>
parents:
917
diff
changeset
|
3310 |
|
400 | 3311 |
!ImageEditor methodsFor:'user actions - editing'! |
3312 |
||
767 | 3313 |
doBrowseClass |
3314 |
"opens a System Browser on the resourceClass and the resourceSelector" |
|
400 | 3315 |
|
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3316 |
|cls| |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3317 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3318 |
cls := Smalltalk at:(imageEditView resourceClass) ifAbsent:nil. |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3319 |
cls isNil ifTrue:[^ self warn:'No Class specified']. |
1488 | 3320 |
UserPreferences systemBrowserClass |
933
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3321 |
openInClass:cls class |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3322 |
selector:(imageEditView resourceSelector) |
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3323 |
|
f090206aadff
disable some menu items if no class/selector is defined
Claus Gittinger <cg@exept.de>
parents:
932
diff
changeset
|
3324 |
"Modified: / 31.7.1998 / 02:01:15 / cg" |
400 | 3325 |
! |
3326 |
||
1045 | 3327 |
doCropAll |
986 | 3328 |
"find all borders and cut them off" |
3329 |
||
1045 | 3330 |
imageEditView cropLeft:true right:true top:true bottom:true. |
986 | 3331 |
self updateInfoLabel |
3332 |
||
3333 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
3334 |
"Created: / 7.9.1998 / 16:33:43 / cg" |
|
3335 |
! |
|
3336 |
||
1045 | 3337 |
doCropBottom |
986 | 3338 |
"find a bottom border and cut it off" |
3339 |
||
1045 | 3340 |
imageEditView cropLeft:false right:false top:false bottom:true. |
986 | 3341 |
self updateInfoLabel |
3342 |
||
3343 |
"Created: / 7.9.1998 / 13:00:20 / cg" |
|
3344 |
"Modified: / 7.9.1998 / 14:26:23 / cg" |
|
3345 |
! |
|
3346 |
||
1045 | 3347 |
doCropLeft |
986 | 3348 |
"find a left border and cut it off" |
3349 |
||
1045 | 3350 |
imageEditView cropLeft:true right:false top:false bottom:false. |
986 | 3351 |
self updateInfoLabel |
3352 |
||
3353 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
3354 |
"Modified: / 7.9.1998 / 14:26:34 / cg" |
|
3355 |
! |
|
3356 |
||
1045 | 3357 |
doCropManual |
986 | 3358 |
"let user specify borders and cut them off" |
3359 |
||
1502 | 3360 |
|bindings left top right bottom img firstChange gropAction acceptChannel| |
3361 |
||
3362 |
acceptChannel := TriggerValue new. |
|
1490 | 3363 |
|
3364 |
firstChange := true. |
|
3365 |
||
1502 | 3366 |
gropAction := |
3367 |
[:lV :rV :tV :bV | |l r t b| |
|
3368 |
acceptChannel value:true. |
|
3369 |
||
3370 |
l := lV value. |
|
3371 |
r := rV value. |
|
3372 |
t := tV value. |
|
3373 |
b := bV value. |
|
3374 |
(l + r + t + b) == 0 ifTrue:[ |
|
3375 |
Screen current beep |
|
3376 |
] ifFalse:[ |
|
3377 |
img := imageEditView image. |
|
3378 |
firstChange ifTrue:[ |
|
3379 |
imageEditView makeUndo. |
|
3380 |
firstChange := false. |
|
3381 |
]. |
|
3382 |
imageEditView |
|
3383 |
makeSubImageX:l y:t |
|
3384 |
width:(img width - l - r) |
|
3385 |
height:(img height - t - b). |
|
3386 |
self updateInfoLabel |
|
3387 |
]. |
|
1490 | 3388 |
]. |
986 | 3389 |
|
3390 |
bindings := IdentityDictionary new. |
|
1507 | 3391 |
bindings at:#left put:(left := 1 asValue). |
3392 |
bindings at:#right put:(right := 1 asValue). |
|
3393 |
bindings at:#top put:(top := 1 asValue). |
|
3394 |
bindings at:#bottom put:(bottom := 1 asValue). |
|
1502 | 3395 |
bindings at:#acceptChannel put:acceptChannel. |
3396 |
||
3397 |
bindings at:#gropLeftNow put:[ gropAction value:left value:0 value:0 value:0 ]. |
|
3398 |
bindings at:#gropRightNow put:[ gropAction value:0 value:right value:0 value:0 ]. |
|
3399 |
bindings at:#gropTopNow put:[ gropAction value:0 value:0 value:top value:0 ]. |
|
3400 |
bindings at:#gropBottomNow put:[ gropAction value:0 value:0 value:0 value:bottom ]. |
|
3401 |
||
3402 |
bindings at:#applyAction put:[ gropAction value:left value:right value:top value:bottom ]. |
|
1490 | 3403 |
|
3404 |
(self openDialogInterface:#gropDialogSpec withBindings:bindings) |
|
1507 | 3405 |
ifFalse:[ |
3406 |
firstChange ~~ true ifTrue:[ |
|
1558 | 3407 |
imageEditView undo. |
3408 |
self updateImagePreView. |
|
1507 | 3409 |
] |
3410 |
]. |
|
986 | 3411 |
|
3412 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3413 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3414 |
! |
|
3415 |
||
1045 | 3416 |
doCropRight |
986 | 3417 |
"find a right border and cut it off" |
3418 |
||
1045 | 3419 |
imageEditView cropLeft:false right:true top:false bottom:false. |
986 | 3420 |
self updateInfoLabel |
3421 |
||
3422 |
"Created: / 7.9.1998 / 13:00:14 / cg" |
|
3423 |
"Modified: / 7.9.1998 / 14:26:44 / cg" |
|
3424 |
! |
|
3425 |
||
1045 | 3426 |
doCropTop |
986 | 3427 |
"find a top border and cut it off" |
3428 |
||
1045 | 3429 |
imageEditView cropLeft:false right:false top:true bottom:false. |
986 | 3430 |
self updateInfoLabel |
3431 |
||
3432 |
"Created: / 7.9.1998 / 13:00:19 / cg" |
|
3433 |
"Modified: / 7.9.1998 / 14:26:52 / cg" |
|
3434 |
! |
|
3435 |
||
1433 | 3436 |
doEditMask |
3437 |
"" |
|
3438 |
||
3439 |
self image mask edit |
|
3440 |
! |
|
3441 |
||
767 | 3442 |
doFlipHorizontal |
3443 |
"flips horizontally current image" |
|
400 | 3444 |
|
911 | 3445 |
imageEditView flipHorizontal |
400 | 3446 |
! |
3447 |
||
767 | 3448 |
doFlipVertical |
3449 |
"flips vertically current image" |
|
400 | 3450 |
|
911 | 3451 |
imageEditView flipVertical |
400 | 3452 |
! |
3453 |
||
767 | 3454 |
doMagnifyDown |
3455 |
"magnifies current image one step down" |
|
400 | 3456 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3457 |
|magHolder mag| |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3458 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3459 |
magHolder := self valueOfMagnification. |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3460 |
(mag := magHolder value) > 1 ifTrue: [ |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3461 |
magHolder value: mag - 1 |
400 | 3462 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3463 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3464 |
"Modified: / 26.7.1998 / 20:24:08 / cg" |
400 | 3465 |
! |
3466 |
||
767 | 3467 |
doMagnifyImage |
1479 | 3468 |
"magnifies the current image to a new size" |
400 | 3469 |
|
1353 | 3470 |
|box newSize image| |
3471 |
||
3472 |
image := imageEditView image. |
|
3473 |
||
3474 |
box := EnterBox new. |
|
3475 |
box title:(resources string:'Images new size:'). |
|
3476 |
box okText:(resources string:'OK'). |
|
3477 |
box abortText:(resources string:'Cancel'). |
|
3478 |
box initialText:image extent printString. |
|
3479 |
box showAtPointer. |
|
3480 |
(box accepted |
|
3481 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
3482 |
ifTrue:[ |
|
1479 | 3483 |
newSize isPoint ifFalse:[ |
3484 |
self warn:'please enter the new size as ''x @ y''.'. |
|
3485 |
^ self. |
|
3486 |
]. |
|
3487 |
imageEditView magnifyImageTo:newSize. |
|
3488 |
]. |
|
3489 |
||
3490 |
self updateInfoLabel |
|
3491 |
! |
|
3492 |
||
3493 |
doMagnifyImageBy |
|
3494 |
"magnifies the current image (by a scale)" |
|
3495 |
||
3496 |
|box oldSize newSize scale image| |
|
3497 |
||
3498 |
image := imageEditView image. |
|
3499 |
oldSize := image extent. |
|
3500 |
||
3501 |
box := EnterBox new. |
|
3502 |
box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):'). |
|
3503 |
box okText:(resources string:'OK'). |
|
3504 |
box abortText:(resources string:'Cancel'). |
|
3505 |
box initialText:1 printString. |
|
3506 |
box showAtPointer. |
|
3507 |
||
3508 |
(box accepted |
|
3509 |
and: [(scale := Object readFromString:(box contents) onError:nil) notNil]) |
|
3510 |
ifTrue:[ |
|
3511 |
scale isNumber ifFalse:[ |
|
3512 |
self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'. |
|
3513 |
^ self. |
|
3514 |
]. |
|
3515 |
newSize := oldSize * scale. |
|
1353 | 3516 |
imageEditView magnifyImageTo:newSize. |
3517 |
]. |
|
3518 |
||
400 | 3519 |
self updateInfoLabel |
3520 |
! |
|
3521 |
||
767 | 3522 |
doMagnifyUp |
3523 |
"magnifies current image one step up" |
|
400 | 3524 |
|
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3525 |
|magHolder mag| |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3526 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3527 |
magHolder := self valueOfMagnification. |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3528 |
(mag := magHolder value) < 99 ifTrue: [ |
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3529 |
magHolder value: mag + 1 |
400 | 3530 |
] |
915
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3531 |
|
99f8e19aab3a
better use a columnAdaptor to fetch r/g/b values from a color.
Claus Gittinger <cg@exept.de>
parents:
914
diff
changeset
|
3532 |
"Modified: / 26.7.1998 / 20:23:52 / cg" |
400 | 3533 |
! |
3534 |
||
767 | 3535 |
doNegativeImage |
3536 |
"negates current image by negating the color map" |
|
400 | 3537 |
|
1598 | 3538 |
self image depth ~~ 1 ifTrue:[ |
3539 |
Dialog warn:'Only useful for depth 1 images'. |
|
3540 |
^ self |
|
3541 |
]. |
|
911 | 3542 |
imageEditView negativeImage. |
400 | 3543 |
self listOfColors removeAll. |
901 | 3544 |
self findColorMapMode. |
911 | 3545 |
imageEditView undoImages removeLast |
400 | 3546 |
! |
3547 |
||
767 | 3548 |
doResizeImage |
1353 | 3549 |
"resizes the current image" |
3550 |
||
3551 |
|box newSize image| |
|
3552 |
||
3553 |
image := imageEditView image. |
|
3554 |
||
3555 |
box := EnterBox new. |
|
3556 |
box title:(resources string:'Images new size:'). |
|
3557 |
box okText:(resources string:'OK'). |
|
3558 |
box abortText:(resources string:'Cancel'). |
|
3559 |
box initialText:image extent printString. |
|
3560 |
box showAtPointer. |
|
3561 |
(box accepted |
|
3562 |
and: [(newSize := Object readFromString:(box contents) onError:nil) notNil]) |
|
3563 |
ifTrue:[ |
|
3564 |
imageEditView resizeImageTo:newSize. |
|
3565 |
]. |
|
400 | 3566 |
! |
3567 |
||
767 | 3568 |
doRotateImage |
3569 |
"rotates current image" |
|
400 | 3570 |
|
1353 | 3571 |
|box rotation| |
3572 |
||
3573 |
box := EnterBox new. |
|
3574 |
box title:(resources string:'Rotate by (degrees, clockwise):'). |
|
3575 |
box okText:(resources string:'OK'). |
|
3576 |
box abortText:(resources string:'Cancel'). |
|
3577 |
box initialText: '0'. |
|
3578 |
box showAtPointer. |
|
3579 |
(box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil]) |
|
3580 |
ifTrue:[ |
|
3581 |
imageEditView rotateImageBy:rotation. |
|
1558 | 3582 |
self updateInfoLabel. |
1353 | 3583 |
]. |
400 | 3584 |
! |
3585 |
||
1557 | 3586 |
doShiftManual |
3587 |
"let user specify amount and shift" |
|
3588 |
||
3589 |
|bindings amount img firstChange shiftAction acceptChannel| |
|
3590 |
||
3591 |
acceptChannel := TriggerValue new. |
|
3592 |
||
3593 |
firstChange := true. |
|
3594 |
||
3595 |
shiftAction := |
|
3596 |
[:shiftH :shiftV | |
|
3597 |
acceptChannel value:true. |
|
3598 |
||
3599 |
img := imageEditView image. |
|
3600 |
firstChange ifTrue:[ |
|
3601 |
imageEditView makeUndo. |
|
3602 |
firstChange := false. |
|
3603 |
]. |
|
3604 |
imageEditView shiftImageHorizontal:shiftH value vertical:shiftV value. |
|
3605 |
self updateInfoLabel |
|
3606 |
]. |
|
3607 |
||
3608 |
bindings := IdentityDictionary new. |
|
3609 |
bindings at:#shiftAmount put:(amount := 1 asValue). |
|
3610 |
bindings at:#acceptChannel put:acceptChannel. |
|
3611 |
||
3612 |
bindings at:#shiftLeftNow put:[ shiftAction value:(-1*amount value) value:0 ]. |
|
3613 |
bindings at:#shiftRightNow put:[ shiftAction value:amount value value:0 ]. |
|
3614 |
bindings at:#shiftUpNow put:[ shiftAction value:0 value:(-1*amount value) ]. |
|
3615 |
bindings at:#shiftDownNow put:[ shiftAction value:0 value:amount value ]. |
|
3616 |
||
3617 |
(self openDialogInterface:#shiftDialogSpec withBindings:bindings) |
|
3618 |
ifFalse:[ |
|
3619 |
firstChange ~~ true ifTrue:[ |
|
3620 |
imageEditView undo |
|
3621 |
] |
|
3622 |
]. |
|
3623 |
||
3624 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3625 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3626 |
! |
|
3627 |
||
1480 | 3628 |
doUnCropManual |
3629 |
"let user specify borders and add them" |
|
3630 |
||
3631 |
|bindings left top right bottom img| |
|
3632 |
||
3633 |
bindings := IdentityDictionary new. |
|
3634 |
bindings at:#left put:(left := 0 asValue). |
|
3635 |
bindings at:#right put:(right := 0 asValue). |
|
3636 |
bindings at:#top put:(top := 0 asValue). |
|
3637 |
bindings at:#bottom put:(bottom := 0 asValue). |
|
3638 |
(self openDialogInterface:#ungropDialogSpec withBindings:bindings) |
|
3639 |
ifTrue:[ |
|
3640 |
left := left value. |
|
3641 |
right := right value. |
|
3642 |
top := top value. |
|
3643 |
bottom := bottom value. |
|
3644 |
img := imageEditView image. |
|
3645 |
||
3646 |
imageEditView |
|
3647 |
makeBorderedImageX:left y:top |
|
3648 |
width:(img width + left + right) |
|
3649 |
height:(img height + top + bottom). |
|
3650 |
self updateInfoLabel |
|
3651 |
]. |
|
3652 |
||
3653 |
"Created: / 7.9.1998 / 18:16:07 / cg" |
|
3654 |
"Modified: / 7.9.1998 / 18:20:42 / cg" |
|
3655 |
! |
|
3656 |
||
767 | 3657 |
doUndo |
3658 |
"reverses last edit action" |
|
400 | 3659 |
|
1436 | 3660 |
imageEditView undo. |
400 | 3661 |
! ! |
3662 |
||
3663 |
!ImageEditor methodsFor:'user actions - loading'! |
|
3664 |
||
767 | 3665 |
doLoadFromClass |
3666 |
"opens a dialog for loading an image from class and a (resource-) selector" |
|
400 | 3667 |
|
1122 | 3668 |
|img| |
3669 |
||
1054 | 3670 |
(imageEditView loadFromClass) notNil ifTrue:[ |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3671 |
imageSeqNr := nil. |
1122 | 3672 |
(img := self image) notNil ifTrue: [ |
3673 |
self listOfColors contents: img usedColors asSet asOrderedCollection. |
|
574 | 3674 |
self findColorMapMode. |
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3675 |
self updateLabelsAndHistory. |
1054 | 3676 |
] ifFalse: [ |
3677 |
self updateForNoImage |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3678 |
]. |
449 | 3679 |
] |
400 | 3680 |
! |
3681 |
||
767 | 3682 |
doLoadFromFile |
3683 |
"opens a dialog for loading an image from a file" |
|
400 | 3684 |
|
1353 | 3685 |
|img file dir filters| |
3686 |
||
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3687 |
imageSeqNr := nil. |
1353 | 3688 |
img := self image. |
3689 |
img notNil ifTrue: [ |
|
3690 |
file := img fileName |
|
3691 |
] ifFalse:[ |
|
3692 |
dir := LastDirectory |
|
3693 |
]. |
|
3694 |
||
3695 |
filters := FileSelectionBrowser loadImageFileNameFilters. |
|
3696 |
||
3697 |
file notNil ifTrue:[ |
|
3698 |
file := FileSelectionBrowser |
|
3699 |
request:'Load Image From' |
|
3700 |
fileName:file |
|
3701 |
withFileFilters:filters. |
|
3702 |
] ifFalse:[ |
|
3703 |
file := FileSelectionBrowser |
|
3704 |
request:'Load Image From' |
|
3705 |
inDirectory:dir |
|
3706 |
withFileFilters:filters. |
|
3707 |
]. |
|
3708 |
file notNil ifTrue:[ |
|
3709 |
LastDirectory := file asFilename directoryName. |
|
3710 |
self loadFromFile:file |
|
3711 |
] |
|
400 | 3712 |
! |
3713 |
||
767 | 3714 |
doNewImage |
3715 |
"opens a dialog with choices of size and color map for creating a new image" |
|
400 | 3716 |
|
1383 | 3717 |
|aspects width height cMap imageClass image szString| |
3718 |
||
767 | 3719 |
|
400 | 3720 |
aspects := IdentityDictionary new |
767 | 3721 |
at:#listOfSizes put: self class listOfDefaultSizes asValue; |
3722 |
at:#listOfColorMaps put: self class listOfColorMaps keys asSortedCollection asValue; |
|
3723 |
at:#selectionOfSize put: self class listOfDefaultSizes first copy asValue; |
|
400 | 3724 |
at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue; |
3725 |
yourself. |
|
3726 |
||
767 | 3727 |
(self openDialogInterface:#dialogSpecForNewImage withBindings:aspects) |
1383 | 3728 |
ifTrue:[ |
3729 |
szString := (aspects at:#selectionOfSize) value. |
|
3730 |
width := 128 min: (Integer readFromString: (szString upTo: $x) onError:[24]). |
|
3731 |
height := 128 min: (Integer readFromString: (szString copy reverse upTo: $x) reverse onError:[24]). |
|
400 | 3732 |
|
975 | 3733 |
cMap := (self class listOfColorMaps at: (colorMapMode value: (aspects at:#selectionOfColorMap) value) value). |
400 | 3734 |
imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger). |
767 | 3735 |
image := imageClass width: width height: height fromArray: (ByteArray new: width*height). |
400 | 3736 |
|
975 | 3737 |
(colorMapMode value endsWith: 'mask') |
400 | 3738 |
ifTrue: |
3739 |
[ |
|
767 | 3740 |
image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels |
400 | 3741 |
]. |
3742 |
image colorMap: cMap. |
|
3743 |
image fillRectangleX:0 y:0 width:width height:height with:Color white. |
|
911 | 3744 |
(imageEditView image: image) notNil |
400 | 3745 |
ifTrue: |
3746 |
[ |
|
3747 |
self listOfColors contents: cMap. |
|
3748 |
self findColorMapMode. |
|
1376
ce3cf26e201e
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1353
diff
changeset
|
3749 |
self updateLabelsAndHistory. |
400 | 3750 |
] |
767 | 3751 |
] |
929 | 3752 |
! |
3753 |
||
3754 |
grabScreenImage |
|
3755 |
"let user choose an area and grab that are for editing" |
|
3756 |
||
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3757 |
Processor |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3758 |
addTimedBlock:[ |
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3759 |
|image d8image img| |
929 | 3760 |
|
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3761 |
imageSeqNr := nil. |
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3762 |
image := Image fromUser. |
1121 | 3763 |
image isNil ifFalse:[ |
3764 |
image depth > 8 ifTrue:[ |
|
1122 | 3765 |
Object errorSignal handle:[:ex | |sig| |
1537
e86a686eeba2
class based exceptions - no longer need to send #haltSÃgnal
Claus Gittinger <cg@exept.de>
parents:
1507
diff
changeset
|
3766 |
(sig := ex signal) == HaltInterrupt ifTrue:[ex reject]. |
1122 | 3767 |
sig == Signal noHandlerSignal ifTrue:[ex reject]. |
1121 | 3768 |
|
3769 |
self warn:'Could not convert to depth8 image (too many colors)'. |
|
3770 |
d8image := nil. |
|
3771 |
] do:[ |
|
3772 |
d8image := Depth8Image new. |
|
3773 |
d8image fromImage:image. |
|
3774 |
]. |
|
3775 |
d8image notNil ifTrue:[ |
|
3776 |
image := d8image |
|
3777 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3778 |
]. |
1121 | 3779 |
(imageEditView image:image) notNil ifTrue:[ |
3780 |
self listOfColors contents:(image colorMap). |
|
3781 |
self findColorMapMode. |
|
3782 |
self updateLabelsAndHistory. |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3783 |
] |
1121 | 3784 |
] |
3785 |
] |
|
990
4303f0064410
delay a second before grabbing screen image (to allow for redraws to happen)
Claus Gittinger <cg@exept.de>
parents:
986
diff
changeset
|
3786 |
afterSeconds:1 |
929 | 3787 |
|
3788 |
"Created: / 29.7.1998 / 21:24:42 / cg" |
|
1537
e86a686eeba2
class based exceptions - no longer need to send #haltSÃgnal
Claus Gittinger <cg@exept.de>
parents:
1507
diff
changeset
|
3789 |
"Modified: / 16.11.2001 / 16:21:19 / cg" |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3790 |
! |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3791 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3792 |
nextImageInSequence |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3793 |
"display the next image in the image sequence" |
1383 | 3794 |
|img seq frame listOfColors| |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3795 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3796 |
imageEditView releaseUndos. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3797 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3798 |
seq := self image imageSequence. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3799 |
imageSeqNr isNil ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3800 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3801 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3802 |
imageSeqNr := imageSeqNr + 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3803 |
imageSeqNr > seq size ifTrue:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3804 |
self information:'Back to first image in sequence'. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3805 |
imageSeqNr := 1. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3806 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3807 |
frame := seq at:imageSeqNr. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3808 |
imageEditView image:(frame image). |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3809 |
|
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3810 |
(img := self image) notNil ifTrue:[ |
1383 | 3811 |
listOfColors := self listOfColors. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3812 |
img colorMap notNil ifTrue:[ |
1383 | 3813 |
listOfColors contents:(img usedColors asSet asOrderedCollection). |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3814 |
] ifFalse:[ |
1383 | 3815 |
listOfColors removeAll. |
1380
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3816 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3817 |
self findColorMapMode. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3818 |
self updateLabelsAndHistory. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3819 |
img := img onDevice:device. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3820 |
imageEditView image:img. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3821 |
] ifFalse:[ |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3822 |
self updateForNoImage |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3823 |
]. |
9787c42843c2
allow display and extract from image sequences (gif anims)
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
3824 |
|
400 | 3825 |
! ! |
3826 |
||
3827 |
!ImageEditor methodsFor:'user actions - saving'! |
|
3828 |
||
767 | 3829 |
doPrint |
3830 |
"prints current image on the current printer" |
|
400 | 3831 |
|
911 | 3832 |
imageEditView print |
400 | 3833 |
! |
3834 |
||
1613 | 3835 |
doSaveButtonImageToFileAs |
3836 |
"opens a dialog for saving current image to a file" |
|
3837 |
||
3838 |
imageEditView saveButtonImageToFileAs. |
|
3839 |
self updateLabelsAndHistory. |
|
3840 |
! |
|
3841 |
||
767 | 3842 |
doSaveImageFile |
3843 |
"saves current image to current file" |
|
400 | 3844 |
|
1481 | 3845 |
imageEditView save. |
400 | 3846 |
! |
3847 |
||
767 | 3848 |
doSaveImageFileAs |
3849 |
"opens a dialog for saving current image to a file" |
|
400 | 3850 |
|
911 | 3851 |
imageEditView saveImageFileAs. |
1481 | 3852 |
self updateLabelsAndHistory. |
400 | 3853 |
! |
3854 |
||
767 | 3855 |
doSaveImageMaskFileAs |
3856 |
"opens a dialog for saving mask of current image to a file" |
|
400 | 3857 |
|
1481 | 3858 |
imageEditView saveImageMaskFileAs. |
400 | 3859 |
! |
3860 |
||
767 | 3861 |
doSaveMethod |
3862 |
"saves current image on current class and selector" |
|
400 | 3863 |
|
911 | 3864 |
imageEditView saveMethod notNil |
400 | 3865 |
ifTrue: |
3866 |
[ |
|
694 | 3867 |
self updateLabelsAndHistory |
400 | 3868 |
] |
3869 |
! |
|
3870 |
||
767 | 3871 |
doSaveMethodAs |
3872 |
"opens a dialog for saving current image on a class and a selector" |
|
400 | 3873 |
|
911 | 3874 |
imageEditView saveMethodAs notNil |
400 | 3875 |
ifTrue: |
3876 |
[ |
|
694 | 3877 |
self updateLabelsAndHistory |
400 | 3878 |
] |
1309
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3879 |
! |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3880 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3881 |
doShowStoreString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3882 |
"opens a dialog showing the storeString |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3883 |
(sometimes useful to embed an image into source code)" |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3884 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3885 |
|img| |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3886 |
|
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3887 |
img := imageEditView image. |
0a45ef81b47e
added showStoreString menu function
Claus Gittinger <cg@exept.de>
parents:
1250
diff
changeset
|
3888 |
TextBox openOn:img storeString |
400 | 3889 |
! ! |
3890 |
||
1353 | 3891 |
!ImageEditor methodsFor:'user actions - settings'! |
3892 |
||
3893 |
doChangeGridMagnification |
|
3894 |
"change grid magnification" |
|
3895 |
||
3896 |
|box oldGridLimit newGridLimit| |
|
3897 |
||
3898 |
oldGridLimit := imageEditView class gridMagnificationLimit asPoint. |
|
3899 |
||
3900 |
box := EnterBox new. |
|
3901 |
box title:(resources string:'Grid Magnification Limit:'). |
|
3902 |
box okText:(resources string:'OK'). |
|
3903 |
box abortText:(resources string:'Cancel'). |
|
3904 |
box initialText:(oldGridLimit x printString). |
|
3905 |
box showAtPointer. |
|
3906 |
||
3907 |
(box accepted |
|
3908 |
and: [(newGridLimit := Number readFromString:(box contents) onError:[2]) notNil] |
|
3909 |
) ifTrue:[ |
|
3910 |
newGridLimit := (99 min: (2 max:newGridLimit)) asPoint. |
|
3911 |
imageEditView class gridMagnificationLimit:newGridLimit. |
|
3912 |
imageEditView invalidate |
|
3913 |
] |
|
3914 |
||
3915 |
! ! |
|
3916 |
||
400 | 3917 |
!ImageEditor class methodsFor:'documentation'! |
3918 |
||
3919 |
version |
|
3920 |
^ '$Header$' |
|
3921 |
! ! |