author | Claus Gittinger <cg@exept.de> |
Thu, 01 Oct 1998 12:48:20 +0200 | |
changeset 1158 | 9b413954d34d |
parent 1121 | af09c616fb7b |
child 1160 | 5d89296c4b04 |
permissions | -rw-r--r-- |
636 | 1 |
" |
704 | 2 |
COPYRIGHT (c) 1997 by eXept Software AG |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
3 |
All Rights Reserved |
636 | 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 |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
1 | 13 |
ImageView subclass:#ImageEditView |
1035 | 14 |
instanceVariableNames:'magnification selectColors imageReaderClass resourceClass |
15 |
resourceSelector mouseKeyColorMode undoImages modified |
|
16 |
masterApplication editMode lastPastePoint imageInfoHolder |
|
17 |
activityInfoHolder pickedColorHolder' |
|
18 |
classVariableNames:'Clipboard LastMagnification ClipboardMagnification |
|
19 |
GridMagnification MaxUndos' |
|
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Misc' |
|
1 | 22 |
! |
23 |
||
636 | 24 |
!ImageEditView class methodsFor:'documentation'! |
25 |
||
26 |
copyright |
|
27 |
" |
|
704 | 28 |
COPYRIGHT (c) 1997 by eXept Software AG |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
29 |
All Rights Reserved |
636 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
The ImageEditView is a view class which can be used by applications |
|
43 |
like the Image Editor for modifying or inspecting images. |
|
44 |
||
45 |
[see also:] |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
46 |
ImageEditor Image |
636 | 47 |
|
48 |
[author:] |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
49 |
Thomas Zwick |
636 | 50 |
" |
51 |
! ! |
|
353 | 52 |
|
7 | 53 |
!ImageEditView methodsFor:'accessing'! |
54 |
||
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
55 |
activityInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
56 |
"return the value of the instance variable 'activityInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
57 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
58 |
^ activityInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
59 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
60 |
"Created: / 29.7.1998 / 18:49:39 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
61 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
62 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
63 |
activityInfoHolder:something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
64 |
"set the value of the instance variable 'activityInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
65 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
66 |
activityInfoHolder := something. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
67 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
68 |
"Created: / 29.7.1998 / 18:49:39 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
69 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
70 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
71 |
imageInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
72 |
"return the value of the instance variable 'imageInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
73 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
74 |
^ imageInfoHolder |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
75 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
76 |
"Created: / 29.7.1998 / 18:29:50 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
77 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
78 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
79 |
imageInfoHolder:something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
80 |
"set the value of the instance variable 'imageInfoHolder' (automatically generated)" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
81 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
82 |
imageInfoHolder := something. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
83 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
84 |
"Created: / 29.7.1998 / 18:29:50 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
85 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
86 |
|
624 | 87 |
magnification |
88 |
||
89 |
^magnification |
|
90 |
||
255 | 91 |
! |
92 |
||
636 | 93 |
magnification: aPoint |
1037 | 94 |
|oldOrg| |
255 | 95 |
|
627 | 96 |
magnification ~= aPoint |
624 | 97 |
ifTrue: |
98 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
99 |
oldOrg := self viewOrigin / magnification. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
100 |
magnification := aPoint asPoint. |
1037 | 101 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
102 |
self scrollTo:(oldOrg * magnification) rounded redraw:false. |
1037 | 103 |
"/ self scrollToTopLeft. |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
104 |
self contentsChanged. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
105 |
self invalidate. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
106 |
ClipboardMagnification := nil. |
686 | 107 |
] |
1037 | 108 |
|
109 |
"Modified: / 31.7.1998 / 02:38:47 / cg" |
|
624 | 110 |
! |
255 | 111 |
|
662 | 112 |
masterApplication |
113 |
||
114 |
^masterApplication |
|
115 |
! |
|
116 |
||
117 |
masterApplication: anApplicationModel |
|
118 |
||
119 |
masterApplication := anApplicationModel |
|
120 |
! |
|
121 |
||
627 | 122 |
resourceClass |
123 |
||
124 |
^resourceClass |
|
125 |
! |
|
126 |
||
127 |
resourceClass: aClassOrSymbol |
|
128 |
||
686 | 129 |
resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol asSymbol] |
627 | 130 |
! |
131 |
||
132 |
resourceMessage |
|
133 |
||
134 |
^resourceClass, ' ', resourceSelector |
|
135 |
! |
|
136 |
||
636 | 137 |
resourceMessage: aString |
627 | 138 |
|
636 | 139 |
(aString isString and: [aString trimBlanks size > 0]) |
627 | 140 |
ifTrue: |
141 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
142 |
resourceClass := (aString readStream upTo: Character space) asSymbol. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
143 |
resourceSelector := (aString copy reverse readStream upTo: Character space) reverse asSymbol |
627 | 144 |
] |
145 |
ifFalse: |
|
146 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
147 |
^nil |
686 | 148 |
] |
627 | 149 |
|
150 |
||
151 |
! |
|
152 |
||
153 |
resourceSelector |
|
154 |
||
155 |
^resourceSelector |
|
156 |
! |
|
157 |
||
158 |
resourceSelector: aStringOrSymbol |
|
159 |
||
160 |
resourceSelector := aStringOrSymbol asSymbol |
|
161 |
! |
|
162 |
||
840 | 163 |
selectColors |
164 |
||
165 |
^selectColors |
|
166 |
! |
|
167 |
||
168 |
selectColors: anArrayTwoColors |
|
633 | 169 |
|
170 |
selectColors := anArrayTwoColors |
|
171 |
! |
|
172 |
||
627 | 173 |
selectedColor |
174 |
||
633 | 175 |
^selectColors at: mouseKeyColorMode |
627 | 176 |
! |
177 |
||
178 |
selectedColor: aColor |
|
179 |
||
180 |
selectColors at: mouseKeyColorMode put: aColor |
|
995 | 181 |
! |
182 |
||
183 |
undoImages |
|
184 |
||
185 |
^undoImages |
|
627 | 186 |
! ! |
187 |
||
188 |
!ImageEditView methodsFor:'drawing'! |
|
189 |
||
1036 | 190 |
drawFrame |
191 |
||
192 |
self paint:Color black. |
|
193 |
self lineWidth: (magnification x//3 min: 3). |
|
1104 | 194 |
self displayRectangle: ((0@0) extent:(image extent * magnification) + margin). |
1036 | 195 |
self lineWidth:1. |
196 |
! |
|
197 |
||
198 |
drawFramesIn: aRectangle |
|
199 |
||
200 |
magnification >= GridMagnification |
|
201 |
ifTrue: |
|
202 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
203 |
|origin lineStartingPoint lineEndingPoint oldColor| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
204 |
origin := aRectangle origin - 1. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
205 |
lineStartingPoint := origin + (0@magnification y). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
206 |
lineEndingPoint := lineStartingPoint + (aRectangle width@0). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
207 |
oldColor := self paint. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
208 |
self xoring: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
209 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
210 |
self displayLineFrom: lineStartingPoint to: lineEndingPoint. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
211 |
lineStartingPoint x to: lineStartingPoint x + aRectangle width - magnification x by: magnification x do: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
212 |
[:x| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
213 |
self displayLineFrom: x@(origin y) to: x@(origin y + magnification y) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
214 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
215 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
216 |
self paint: oldColor. |
1036 | 217 |
] |
218 |
||
219 |
||
220 |
||
221 |
! |
|
222 |
||
662 | 223 |
fillFramedRectangle: aRectangle |
224 |
||
225 |
self fillRectangle: aRectangle. |
|
226 |
self drawFramesIn: aRectangle |
|
227 |
! |
|
228 |
||
627 | 229 |
redrawImageX:x y:y width:w height:h |
636 | 230 |
|
1037 | 231 |
|ih iw magX magY minX maxX minY maxY |
232 |
color lastColor lastY runW x0 xI yI maskColor mask |
|
233 |
sizeOfMaskPoint| |
|
627 | 234 |
|
1037 | 235 |
mask := image mask. |
627 | 236 |
ih := image height. |
237 |
iw := image width. |
|
662 | 238 |
magX := magnification x. |
239 |
magY := magnification y. |
|
627 | 240 |
|
662 | 241 |
minX := (x // magX - 1) max: 0. |
725 | 242 |
minX >= iw ifTrue:[minX := (iw - 1) max: 0]. |
662 | 243 |
minY := (y // magY - 1) max: 0. |
725 | 244 |
minY >= ih ifTrue:[minY := (ih - 1) max: 0]. |
662 | 245 |
maxX := (x + w) // magX + 1. |
627 | 246 |
maxX > iw ifTrue:[maxX := iw]. |
662 | 247 |
maxY := (y + h) // magY + 1. |
627 | 248 |
maxY > ih ifTrue:[maxY := ih]. |
249 |
||
250 |
lastY := -1. |
|
251 |
||
252 |
x0 := minX. |
|
253 |
runW := 0. |
|
254 |
maskColor := false. |
|
662 | 255 |
sizeOfMaskPoint := magnification//3. |
256 |
image colorsFromX: minX y: minY toX: maxX-1 y: maxY-1 do: |
|
627 | 257 |
[:xx :yy :color| |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
258 |
yy ~~ lastY |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
259 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
260 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
261 |
runW ~~ 0 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
262 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
263 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
264 |
|origin| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
265 |
origin := (x0 * magX + margin)@(lastY * magY + margin). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
266 |
self fillFramedRectangle: (origin extent: (runW@magY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
267 |
maskColor ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
268 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
269 |
self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
270 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
271 |
runW := 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
272 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
273 |
x0 := xx. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
274 |
lastY := yy. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
275 |
]. |
624 | 276 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
277 |
color ~~ lastColor |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
278 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
279 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
280 |
runW ~~ 0 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
281 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
282 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
283 |
|origin| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
284 |
origin := (x0 * magX + margin)@(yy * magY + margin). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
285 |
self fillFramedRectangle: (origin extent: (runW@magY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
286 |
maskColor ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
287 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
288 |
self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
289 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
290 |
runW := 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
291 |
]. |
627 | 292 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
293 |
self paint: (lastColor := color). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
294 |
mask notNil ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
295 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
296 |
maskColor := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
297 |
(mask colorAtX:xx y:yy) = Color black ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
298 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
299 |
self paint: (lastColor := self viewBackground). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
300 |
maskColor := true. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
301 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
302 |
lastColor := nil. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
303 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
304 |
runW := 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
305 |
x0 := xx. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
306 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
307 |
runW := runW + magX |
627 | 308 |
]. |
309 |
runW ~~ 0 ifTrue: |
|
310 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
311 |
|origin| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
312 |
origin := (x0 * magX + margin)@(lastY * magY + margin). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
313 |
self fillFramedRectangle: (origin extent: runW@magY). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
314 |
maskColor ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
315 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
316 |
self xoring: [self fillRectangle: (origin + sizeOfMaskPoint extent: sizeOfMaskPoint)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
317 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
318 |
runW := 0. |
627 | 319 |
]. |
1037 | 320 |
|
321 |
"Modified: / 31.7.1998 / 02:33:42 / cg" |
|
627 | 322 |
! |
323 |
||
324 |
redrawX:x y:y width:w height:h |
|
636 | 325 |
|
627 | 326 |
|ih iw xI yI| |
327 |
||
1037 | 328 |
image isNil ifTrue:[^self]. |
662 | 329 |
|
1037 | 330 |
magnification = (1@1) ifTrue: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
331 |
^ super redrawX:x y:y width:w height:h |
1037 | 332 |
]. |
627 | 333 |
|
662 | 334 |
self clippingRectangle: (x@y extent: w@h). |
627 | 335 |
|
336 |
self redrawImageX:x y:y width:w height:h. |
|
337 |
||
338 |
"/ right of image ? |
|
339 |
adjust == #center ifTrue: |
|
340 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
341 |
xI := (width - ih) // 2 - margin. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
342 |
yI := (height - iw) // 2 - margin. |
627 | 343 |
] |
344 |
ifFalse: |
|
345 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
346 |
xI := yI := margin |
627 | 347 |
]. |
348 |
(x + w - 1) > (xI + (magnification x * image width)) ifTrue: |
|
349 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
350 |
self clearRectangleX:(xI + (magnification x * image width)) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
351 |
y:y |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
352 |
width:(x + w - (magnification x * image width) - xI) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
353 |
height:h |
627 | 354 |
]. |
355 |
(y + h - 1) > (yI + (magnification y * image height)) ifTrue: |
|
356 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
357 |
self clearRectangleX:margin |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
358 |
y:(yI + (magnification y * image height)) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
359 |
width:w |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
360 |
height:(y + h - (magnification y * image height) - yI) |
627 | 361 |
]. |
362 |
self drawFrame. |
|
363 |
self clippingRectangle: nil. |
|
1037 | 364 |
|
365 |
"Modified: / 31.7.1998 / 02:22:45 / cg" |
|
627 | 366 |
! ! |
367 |
||
368 |
!ImageEditView methodsFor:'edit modes'! |
|
369 |
||
370 |
editMode |
|
371 |
||
1106 | 372 |
^editMode |
627 | 373 |
! |
374 |
||
1106 | 375 |
editMode: anEditMode |
627 | 376 |
|
1106 | 377 |
editMode := anEditMode |
627 | 378 |
! |
379 |
||
380 |
mouseKeyColorMode |
|
381 |
||
382 |
^mouseKeyColorMode printString |
|
383 |
! |
|
384 |
||
385 |
mouseKeyColorMode:aMode |
|
386 |
||
1106 | 387 |
mouseKeyColorMode := aMode |
627 | 388 |
! ! |
389 |
||
390 |
!ImageEditView methodsFor:'event handling'! |
|
391 |
||
392 |
buttonMotion:state x:x y:y |
|
632 | 393 |
self drawCursorAt: x@y. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
394 |
state ~~ 0 ifTrue: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
395 |
("self selectedColor notNil" true and: [(self imageContainsPoint: x@y) and: [editMode value = #point]]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
396 |
ifTrue: [^self pointAt: x@y] |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
397 |
] ifFalse:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
398 |
(editMode = 'paste' or:[editMode = 'pasteUnder']) ifTrue: [ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
399 |
("self selectedColor notNil" true and: [self imageContainsPastePoint: x@y]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
400 |
ifTrue: [self drawPasteRectangleAt: x@y] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
401 |
ifFalse: [self cursor:Cursor stop. self releasePasteDrawing] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
402 |
] |
686 | 403 |
] |
1019
e68414752bc9
only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
404 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
405 |
"Modified: / 5.9.1998 / 13:28:15 / cg" |
624 | 406 |
! |
255 | 407 |
|
627 | 408 |
buttonPress:button x:x y:y |
409 |
||
632 | 410 |
self drawCursorAt: x@y. |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
411 |
("self selectedColor notNil" true and: [self imageContainsPoint: x@y]) |
627 | 412 |
ifTrue: |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
413 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
414 |
|mouseButtonColorToolBar clr| |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
415 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
416 |
self sensor shiftDown ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
417 |
pickedColorHolder notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
418 |
"/ select the color under the cursor, place it into the |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
419 |
"/ pickedColorHolder/ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
420 |
clr := image colorAt:((x@y)//magnification). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
421 |
pickedColorHolder value:clr |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
422 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
423 |
] ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
424 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
425 |
"/ which gets the information ... |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
426 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
427 |
mouseKeyColorMode := button. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
428 |
mouseButtonColorToolBar := masterApplication builder componentAt: #MouseButtonColorToolBar. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
429 |
self makeUndo. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
430 |
masterApplication valueOfCanUndo value: true. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
431 |
(mouseButtonColorToolBar itemAt: mouseKeyColorMode) toggleIndication. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
432 |
mouseButtonColorToolBar do: [:i| i updateIndicators]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
433 |
self perform: (editMode, 'At:') asSymbol with: x@y |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
434 |
] |
686 | 435 |
] |
995 | 436 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
437 |
"Modified: / 5.9.1998 / 13:28:02 / cg" |
632 | 438 |
! |
439 |
||
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
440 |
buttonRelease:button x:x y:y |
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
441 |
|
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
442 |
self drawCursorAt: x@y. |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
443 |
("self selectedColor notNil" true and: [self imageContainsPoint: x@y]) |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
444 |
ifTrue: |
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
445 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
446 |
image restored. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
447 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
448 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
449 |
"/ which gets the information ... |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
450 |
masterApplication imagePreView invalidate |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
451 |
] |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
452 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
453 |
"Modified: / 5.9.1998 / 13:20:12 / cg" |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
454 |
! |
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
455 |
|
686 | 456 |
pointerLeave:state |
457 |
||
688 | 458 |
super pointerLeave: state. |
686 | 459 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
460 |
self updateImageInfo: self imageInfoString. |
1019
e68414752bc9
only change the cursor for myself.
Claus Gittinger <cg@exept.de>
parents:
1013
diff
changeset
|
461 |
self cursor:Cursor normal. |
995 | 462 |
|
1106 | 463 |
(editMode value = #paste or:[editMode value = #pasteUnder]) ifTrue: [self releasePasteDrawing] |
995 | 464 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
465 |
"Modified: / 29.7.1998 / 18:27:42 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
466 |
! ! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
467 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
468 |
!ImageEditView methodsFor:'image - dragging & info'! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
469 |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
470 |
dragRectangleStartingAt: aPoint emphasis: emphasis |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
471 |
"drag a rectangle (filled or unfilled)" |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
472 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
473 |
|currentPoint currentExtent firstPoint lastCurrentPoint gridCorrection |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
474 |
mp lastMp p whichQuarter scrollX scrollY| |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
475 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
476 |
firstPoint := currentPoint := lastCurrentPoint := aPoint//magnification*magnification. |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
477 |
magnification >= GridMagnification ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1]. |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
478 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
479 |
[device anyButtonPressed] whileTrue: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
480 |
mp := self sensor mousePoint. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
481 |
mp = lastMp ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
482 |
Delay waitForSeconds:0.05 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
483 |
] ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
484 |
lastMp := mp. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
485 |
mp := device translatePoint:mp from:device rootView id to:self id. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
486 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
487 |
scrollX := 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
488 |
mp x > width ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
489 |
scrollX := mp x - width. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
490 |
] ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
491 |
mp x < 0 ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
492 |
scrollX := mp x. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
493 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
494 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
495 |
scrollY := 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
496 |
mp y > height ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
497 |
scrollY := mp y - height. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
498 |
] ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
499 |
mp y < 0 ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
500 |
scrollY := mp y. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
501 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
502 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
503 |
(scrollX + scrollY) ~~ 0 ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
504 |
self scrollTo:(self viewOrigin + (scrollX @ scrollY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
505 |
lastMp := nil. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
506 |
]. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
507 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
508 |
currentPoint := (0@0) max: (image extent * magnification min: (p := self translation negated + mp)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
509 |
currentPoint := currentPoint//magnification*magnification. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
510 |
currentExtent := (firstPoint - currentPoint) abs. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
511 |
whichQuarter := (firstPoint x - currentPoint x) > 0 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
512 |
ifTrue: [(firstPoint y - currentPoint y) > 0 ifTrue: ["4"1@1] ifFalse: ["3"1@0]] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
513 |
ifFalse: [(firstPoint y - currentPoint y) > 0 ifTrue: ["1"0@1] ifFalse: ["2"0@0]]. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
514 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
515 |
self drawCursorAt: p withLabel: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
516 |
((firstPoint//magnification - whichQuarter + 1) printString, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
517 |
' to: ', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
518 |
(currentPoint//magnification + whichQuarter) printString), |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
519 |
' (extent: ', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
520 |
(currentExtent//magnification) printString, ')'. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
521 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
522 |
currentPoint ~= lastCurrentPoint ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
523 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
524 |
emphasis = #inverseFilledBox |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
525 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
526 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
527 |
self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
528 |
self xoring: [self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
529 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
530 |
emphasis = #box |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
531 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
532 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
533 |
|origin extent lineWidthY lineWidthX| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
534 |
origin := (firstPoint min: lastCurrentPoint) - 1. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
535 |
extent := (firstPoint - lastCurrentPoint) abs + 2. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
536 |
lineWidthY := extent y min: (magnification y + 2). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
537 |
lineWidthX := extent x min: (magnification x + 2). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
538 |
self redraw: (origin extent: (extent x@lineWidthY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
539 |
self redraw: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
540 |
self redraw: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
541 |
self redraw: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
542 |
self selectedColor ~= Color noColor |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
543 |
ifTrue: [self paint: self selectedColor] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
544 |
ifFalse: [self paint: self viewBackground]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
545 |
origin := (firstPoint min: currentPoint) + margin. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
546 |
extent := currentExtent - gridCorrection. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
547 |
lineWidthY := extent y min: magnification y. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
548 |
lineWidthX := extent x min: magnification x. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
549 |
(lineWidthY > 0 and: [lineWidthX > 0]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
550 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
551 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
552 |
self fillRectangle: (origin extent: (extent x@lineWidthY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
553 |
self fillRectangle: ((origin x@(origin y + extent y - lineWidthY)) extent: (extent x@lineWidthY)). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
554 |
self fillRectangle: ((origin x@(origin y + lineWidthY)) extent: (lineWidthX@(0 max: (extent y - (lineWidthY * 2))))). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
555 |
self fillRectangle: (((origin x + extent x - lineWidthX)@(origin y + lineWidthY)) extent: (lineWidthX@(extent y - (lineWidthY * 2)))). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
556 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
557 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
558 |
emphasis = #filledBox |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
559 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
560 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
561 |
self redraw: ((firstPoint min: lastCurrentPoint) - 1 extent: (firstPoint - lastCurrentPoint) abs + 2). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
562 |
self selectedColor ~= Color noColor |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
563 |
ifTrue: [self paint: self selectedColor] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
564 |
ifFalse: [self paint: self viewBackground]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
565 |
self fillRectangle: ((firstPoint min: currentPoint) + margin extent: currentExtent - gridCorrection). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
566 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
567 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
568 |
lastCurrentPoint := currentPoint. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
569 |
]. |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
570 |
]. |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
571 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
572 |
^((0@0) max: (firstPoint min: currentPoint)) extent: (firstPoint - currentPoint) abs |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
573 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
574 |
"Created: / 21.8.1998 / 20:17:07 / cg" |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
575 |
"Modified: / 21.8.1998 / 20:34:42 / cg" |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
576 |
! |
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
577 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
578 |
drawCursorAt: aPoint |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
579 |
|clr| |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
580 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
581 |
image isNil ifTrue: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
582 |
self updateImageInfo: self imageInfoString. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
583 |
self cursor:Cursor stop. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
584 |
^ self |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
585 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
586 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
587 |
(aPoint x < (image width * magnification) |
1060 | 588 |
and:[aPoint y < (image height * magnification) |
589 |
and:[aPoint x >= 0 |
|
590 |
and:[aPoint y >= 0]]]) |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
591 |
ifFalse:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
592 |
self updateImageInfo: self imageInfoString. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
593 |
self cursor:Cursor stop. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
594 |
] ifTrue: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
595 |
clr := image colorAt:aPoint//magnification. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
596 |
self updateImageInfo: (aPoint//magnification) printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
597 |
, ' (red:' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
598 |
, clr redByte printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
599 |
, ' green:' , clr greenByte printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
600 |
, ' blue:' , clr blueByte printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
601 |
, ')'. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
602 |
self cursor:Cursor crossHair |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
603 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
604 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
605 |
"Modified: / 29.7.1998 / 18:26:01 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
606 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
607 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
608 |
drawCursorAt: aPoint withLabel: aLabel |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
609 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
610 |
((0@0 extent: image extent * magnification) containsPoint: aPoint) |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
611 |
ifFalse:[self cursor:Cursor stop] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
612 |
ifTrue: [self cursor:Cursor crossHair]. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
613 |
self updateImageInfo: aLabel. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
614 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
615 |
"Modified: / 29.7.1998 / 18:26:04 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
616 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
617 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
618 |
updateActivity: something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
619 |
|msg| |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
620 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
621 |
msg := something printString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
622 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
623 |
"/ cg: new code: |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
624 |
activityInfoHolder notNil ifTrue:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
625 |
activityInfoHolder value:msg. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
626 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
627 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
628 |
"Modified: / 29.7.1998 / 18:41:47 / cg" |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
629 |
! |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
630 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
631 |
updateImageInfo: something |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
632 |
|msg coordLabel| |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
633 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
634 |
msg := something printString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
635 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
636 |
"/ cg: new code: |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
637 |
imageInfoHolder notNil ifTrue:[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
638 |
msg ~= imageInfoHolder value ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
639 |
imageInfoHolder value:msg. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
640 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
641 |
^ self |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
642 |
]. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
643 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
644 |
"/ "/ cg: what a kludge - please change to use a valueHolder, |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
645 |
"/ "/ which gets the coordinate ... |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
646 |
"/ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
647 |
"/ (masterApplication respondsTo: #coordLabel) |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
648 |
"/ ifTrue:[ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
649 |
"/ coordLabel := masterApplication coordLabel. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
650 |
"/ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
651 |
"/ coordLabel label ~= msg |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
652 |
"/ ifTrue:[ |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
653 |
"/ coordLabel label: msg. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
654 |
"/ "/ coordLabel redraw |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
655 |
"/ ] |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
656 |
"/ ] |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
657 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
658 |
"Modified: / 29.7.1998 / 19:00:21 / cg" |
627 | 659 |
! ! |
660 |
||
636 | 661 |
!ImageEditView methodsFor:'image editing'! |
627 | 662 |
|
663 |
boxAt: aPoint |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
664 |
"draw a rectangular outline with the currently selected color" |
627 | 665 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
666 |
|choosedBox imageBox clr| |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
667 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
668 |
(clr := self selectedColor) notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
669 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #box. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
670 |
imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
671 |
image rectangle:imageBox withColor:clr. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
672 |
image restored. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
673 |
self redraw: (choosedBox expandedBy: 1). |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
674 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
675 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
676 |
"/ which gets the information ... |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
677 |
masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
678 |
modified := true |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
679 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
680 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
681 |
"Modified: / 5.9.1998 / 13:29:55 / cg" |
632 | 682 |
! |
683 |
||
1002 | 684 |
changeGridMagnification |
685 |
||
686 |
|box newGridMagnification| |
|
687 |
box := EnterBox new. |
|
688 |
box title:'Grid Magnification:'. |
|
689 |
box okText:'OK'. |
|
690 |
box abortText:'Cancel'. |
|
691 |
box initialText:GridMagnification x printString. |
|
692 |
box showAtPointer. |
|
693 |
(box accepted and: [(newGridMagnification := Number readFromString: box contents onError:[2]) notNil]) |
|
694 |
ifTrue: |
|
695 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
696 |
GridMagnification := (99 min: (2 max: newGridMagnification)) asPoint. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
697 |
self invalidate |
1002 | 698 |
] |
699 |
! |
|
700 |
||
632 | 701 |
copyAt: aPoint |
702 |
||
703 |
|choosedBox| |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
704 |
|
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
705 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox. |
995 | 706 |
ClipboardMagnification := nil. |
632 | 707 |
Clipboard := image subImageIn: (choosedBox origin//magnification extent: (choosedBox extent//magnification)). |
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
708 |
self redraw: (choosedBox expandedBy: 1) |
632 | 709 |
|
1084
87c661e6c333
scroll when dragging out of the view in copy-mode.
Claus Gittinger <cg@exept.de>
parents:
1060
diff
changeset
|
710 |
"Modified: / 21.8.1998 / 20:16:41 / cg" |
632 | 711 |
! |
712 |
||
1121 | 713 |
crobLeft:doLeft right:doRight top:doTop bottom:doBottom |
714 |
|yMinNew yMaxNew xMinNew xMaxNew |
|
715 |
pix stillCrobbing xMax yMax x y| |
|
716 |
||
717 |
xMax := image width - 1. |
|
718 |
yMax := image height - 1. |
|
719 |
||
720 |
xMinNew := 0. |
|
721 |
doLeft ifTrue:[ |
|
722 |
pix := image pixelAtX:xMinNew y:0. |
|
723 |
stillCrobbing := true. |
|
724 |
[stillCrobbing] whileTrue:[ |
|
725 |
0 to:yMax do:[:y | |
|
726 |
(image pixelAtX:xMinNew y:y) ~~ pix ifTrue:[ |
|
727 |
stillCrobbing := false |
|
728 |
] |
|
729 |
]. |
|
730 |
stillCrobbing ifTrue:[ |
|
731 |
xMinNew := xMinNew + 1. |
|
732 |
xMinNew >= image width ifTrue:[ |
|
733 |
self warn:'Image is all the same color - no crob.'. |
|
734 |
^ self |
|
735 |
] |
|
736 |
]. |
|
737 |
]. |
|
738 |
]. |
|
739 |
||
740 |
xMaxNew := xMax. |
|
741 |
doRight ifTrue:[ |
|
742 |
stillCrobbing := true. |
|
743 |
pix := image pixelAtX:xMaxNew y:0. |
|
744 |
[stillCrobbing] whileTrue:[ |
|
745 |
0 to:yMax do:[:y | |
|
746 |
(image pixelAtX:xMaxNew y:y) ~~ pix ifTrue:[ |
|
747 |
stillCrobbing := false |
|
748 |
] |
|
749 |
]. |
|
750 |
stillCrobbing ifTrue:[ |
|
751 |
xMaxNew := xMaxNew - 1. |
|
752 |
]. |
|
753 |
]. |
|
754 |
]. |
|
755 |
||
756 |
yMinNew := 0. |
|
757 |
doTop ifTrue:[ |
|
758 |
pix := image pixelAtX:xMinNew y:yMinNew. |
|
759 |
stillCrobbing := true. |
|
760 |
[stillCrobbing] whileTrue:[ |
|
761 |
xMinNew to:xMaxNew do:[:x | |
|
762 |
(image pixelAtX:x y:yMinNew) ~~ pix ifTrue:[ |
|
763 |
stillCrobbing := false |
|
764 |
] |
|
765 |
]. |
|
766 |
stillCrobbing ifTrue:[ |
|
767 |
yMinNew := yMinNew + 1. |
|
768 |
]. |
|
769 |
]. |
|
770 |
]. |
|
771 |
||
772 |
yMaxNew := yMax. |
|
773 |
doRight ifTrue:[ |
|
774 |
stillCrobbing := true. |
|
775 |
pix := image pixelAtX:xMaxNew y:yMaxNew. |
|
776 |
[stillCrobbing] whileTrue:[ |
|
777 |
xMinNew to:xMaxNew do:[:x | |
|
778 |
(image pixelAtX:x y:yMaxNew) ~~ pix ifTrue:[ |
|
779 |
stillCrobbing := false |
|
780 |
] |
|
781 |
]. |
|
782 |
stillCrobbing ifTrue:[ |
|
783 |
yMaxNew := yMaxNew - 1. |
|
784 |
]. |
|
785 |
]. |
|
786 |
]. |
|
787 |
||
788 |
(xMinNew == 0 |
|
789 |
and:[xMaxNew == (image width - 1) |
|
790 |
and:[yMinNew == 0 |
|
791 |
and:[yMaxNew == (image height - 1)]]]) ifTrue:[ |
|
792 |
self warn:'No border found - no crob.'. |
|
793 |
^ self |
|
794 |
]. |
|
795 |
||
796 |
"/ self warn:'extract subImage ' |
|
797 |
"/ , (xMinNew @ yMinNew) printString |
|
798 |
"/ , ' -> ' |
|
799 |
"/ , (xMaxNew @ yMaxNew) printString. |
|
800 |
||
801 |
self |
|
802 |
makeSubImageX:xMinNew y:yMinNew |
|
803 |
width:(xMaxNew - xMinNew + 1) |
|
804 |
height:(yMaxNew - yMinNew + 1) |
|
805 |
||
806 |
"Created: / 7.9.1998 / 14:25:52 / cg" |
|
807 |
"Modified: / 7.9.1998 / 16:35:35 / cg" |
|
808 |
! |
|
809 |
||
1035 | 810 |
drawPasteRectangleAt: aPoint |
811 |
||
812 |
|currentPoint gridCorrection extent| |
|
813 |
||
814 |
magnification >= GridMagnification ifFalse: [gridCorrection := 0] ifTrue: [gridCorrection := 1]. |
|
815 |
currentPoint := aPoint//magnification*magnification + margin. |
|
816 |
||
817 |
currentPoint ~= lastPastePoint |
|
818 |
ifTrue: |
|
819 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
820 |
ClipboardMagnification isNil ifTrue: [ClipboardMagnification := (Clipboard magnifiedBy: magnification) onDevice: device]. |
1035 | 821 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
822 |
extent := ClipboardMagnification extent. |
1035 | 823 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
824 |
currentPoint := currentPoint - self viewOrigin. |
1035 | 825 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
826 |
self redraw: ((lastPastePoint ? currentPoint) extent: extent). |
1035 | 827 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
828 |
(extent x > 200 or: [extent y > 200]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
829 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
830 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
831 |
self xoring: [self fillRectangle: (currentPoint extent: extent)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
832 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
833 |
ifFalse: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
834 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
835 |
self displayDeviceForm: ClipboardMagnification x: currentPoint x y: currentPoint y |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
836 |
] |
1035 | 837 |
]. |
838 |
lastPastePoint := currentPoint. |
|
839 |
||
840 |
"Modified: / 29.7.1998 / 02:18:11 / cg" |
|
841 |
! |
|
842 |
||
632 | 843 |
fillAt: aPoint |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
844 |
"perform a flood-fill with the currently selected color" |
627 | 845 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
846 |
windowGroup withExecuteCursorDo:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
847 |
|filledPoints clr| |
1002 | 848 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
849 |
(clr := self selectedColor) notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
850 |
self updateActivity:'Flood filling - press CTRL-y to abort ...'. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
851 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
852 |
filledPoints := image floodFillAt: aPoint//magnification withColor:clr. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
853 |
image restored. |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
854 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
855 |
"/ animation effect ... |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
856 |
filledPoints size < 300 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
857 |
ifTrue: [ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
858 |
filledPoints do: [:p| self redraw: ((p * magnification extent: magnification) expandedBy: 1)] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
859 |
] ifFalse: [ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
860 |
self invalidate |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
861 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
862 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
863 |
"/ which gets the information ... |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
864 |
masterApplication imagePreView invalidate. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
865 |
modified := true |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
866 |
] valueOnUnwindDo:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
867 |
self updateActivity:'Flood fill aborted.' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
868 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
869 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
870 |
self updateActivity:'' |
632 | 871 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
872 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
873 |
"Modified: / 5.9.1998 / 13:28:24 / cg" |
632 | 874 |
! |
875 |
||
876 |
filledBoxAt: aPoint |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
877 |
"fill a rectangular area with the currently selected color" |
632 | 878 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
879 |
|choosedBox imageBox clr| |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
880 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
881 |
(clr := self selectedColor) notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
882 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #filledBox. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
883 |
imageBox := choosedBox origin//magnification extent: (choosedBox extent//magnification). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
884 |
image fillRectangle:imageBox withColor:clr. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
885 |
image restored. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
886 |
self redraw: (choosedBox expandedBy: 1). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
887 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
888 |
"/ which gets the information ... |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
889 |
masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
890 |
modified := true |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
891 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
892 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
893 |
"Modified: / 5.9.1998 / 13:25:44 / cg" |
632 | 894 |
! |
895 |
||
636 | 896 |
flipHorizontal |
897 |
||
995 | 898 |
self makeUndo. |
725 | 899 |
self image: image copy flipHorizontal |
636 | 900 |
|
901 |
! |
|
902 |
||
903 |
flipVertical |
|
904 |
||
995 | 905 |
self makeUndo. |
725 | 906 |
self image: image copy flipVertical |
636 | 907 |
|
908 |
! |
|
909 |
||
910 |
magnifyImage |
|
911 |
||
912 |
|box newSize| |
|
913 |
box := EnterBox new. |
|
914 |
box title:'Image new size:'. |
|
915 |
box okText:'OK'. |
|
916 |
box abortText:'Cancel'. |
|
917 |
box initialText:image extent printString. |
|
918 |
box showAtPointer. |
|
919 |
(box accepted and: [(newSize := Object readFromString: box contents onError:nil) notNil]) |
|
920 |
ifTrue: |
|
921 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
922 |
self makeUndo. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
923 |
self image: (image magnifiedBy: newSize/image extent) |
686 | 924 |
] |
636 | 925 |
! |
926 |
||
1121 | 927 |
makeSubImageX:oldX y:oldY width:newWidth height:newHeight |
928 |
|newImage| |
|
929 |
||
930 |
newImage := image class width:newWidth height:newHeight depth:image depth. |
|
931 |
newImage photometric:image photometric. |
|
932 |
newImage colorMap:image colorMap copy. |
|
933 |
newImage bits:(ByteArray new:(newImage bytesPerRow * newHeight)). |
|
934 |
||
935 |
image mask notNil |
|
936 |
ifTrue:[ |
|
937 |
|newMaskImage| |
|
938 |
||
939 |
newMaskImage := Depth1Image width:newWidth height:newHeight. |
|
940 |
newMaskImage photometric: image mask photometric. |
|
941 |
newMaskImage colorMap: image mask colorMap copy. |
|
942 |
newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newHeight). |
|
943 |
newImage mask: newMaskImage |
|
944 |
]. |
|
945 |
||
946 |
newImage copyFrom:image x:oldX y:oldY toX:0 y:0 width:newWidth height:newHeight. |
|
947 |
self makeUndo. |
|
948 |
self image: newImage. |
|
949 |
||
950 |
"Created: / 7.9.1998 / 13:00:16 / cg" |
|
951 |
"Modified: / 7.9.1998 / 14:15:32 / cg" |
|
952 |
! |
|
953 |
||
636 | 954 |
negativeImage |
955 |
||
995 | 956 |
self makeUndo. |
725 | 957 |
self image: image copy negative |
636 | 958 |
! |
959 |
||
960 |
pasteAt: aPoint |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
961 |
"paste the image in the clipboard at aPoint" |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
962 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
963 |
self pasteAt:aPoint modeUnder:false. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
964 |
! |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
965 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
966 |
pasteAt: aPoint modeUnder:modeUnder |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
967 |
"paste the image in the clipboard at aPoint" |
636 | 968 |
|
995 | 969 |
ClipboardMagnification isNil ifTrue: [^self]. |
970 |
||
636 | 971 |
Object errorSignal handle: |
972 |
[:ex| |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
973 |
ex signal == Image unrepresentableColorSignal ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
974 |
ex reject |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
975 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
976 |
self undo. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
977 |
self warn: 'Paste failed !!\Increasing the images depth might help.' withCRs. |
636 | 978 |
] |
979 |
do: |
|
980 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
981 |
windowGroup withExecuteCursorDo:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
982 |
|choosedBox imagePoint imgX imgY copiedImage imageBox presentClr newColorMap| |
995 | 983 |
|
984 |
||
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
985 |
choosedBox := self dragRectangleStartingAt: aPoint emphasis: #inverseFilledBox. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
986 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
987 |
imagePoint := choosedBox origin//magnification. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
988 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
989 |
copiedImage := Clipboard copy. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
990 |
image photometric == #palette ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
991 |
"/ for all colors in the pasted image, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
992 |
"/ check, if its in the colormap of the |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
993 |
"/ target image. |
995 | 994 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
995 |
copiedImage usedValues do:[:pixel | |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
996 |
|pastedColor oldColorMap| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
997 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
998 |
pastedColor := copiedImage colorFromValue:pixel. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
999 |
oldColorMap := image colorMap. |
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1000 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1001 |
(oldColorMap detect: [:clr| clr = pastedColor] ifNone: nil) isNil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1002 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1003 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1004 |
oldColorMap size < (1 bitShift:image depth) ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1005 |
"/ add to colormap |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1006 |
newColorMap isNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1007 |
newColorMap := oldColorMap asOrderedCollection. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1008 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1009 |
newColorMap add:pastedColor. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1010 |
"/ Transcript showCR:'adding color:' , pastedColor displayString , ' to targets colorMap'. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1011 |
] ifFalse:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1012 |
"/ Transcript showCR:'color:' , pastedColor displayString , ' not found in targets colorMap'. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1013 |
copiedImage colorMap at: pixel+1 put: Color black |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1014 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1015 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1016 |
]. |
995 | 1017 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1018 |
newColorMap notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1019 |
image colorMap:(Colormap fromColors:newColorMap). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1020 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1021 |
]. |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1022 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1023 |
copiedImage := image class fromImage: copiedImage. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1024 |
(newColorMap isNil and:[modeUnder not]) ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1025 |
image copyFrom: copiedImage x:0 y:0 toX: imagePoint x y: imagePoint y width: copiedImage width height: copiedImage height. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1026 |
] ifFalse:[ |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
1027 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1028 |
imgX := imagePoint x. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1029 |
imgY := imagePoint y. |
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1030 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1031 |
0 to:copiedImage height-1 do:[:y | |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1032 |
0 to:copiedImage width-1 do:[:x | |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1033 |
|wasMasked newMasked dstX dstY oldColor| |
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1034 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1035 |
dstX := imgX + x. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1036 |
dstY := imgY + y. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1037 |
wasMasked := (image maskAtX:dstX y:dstY) == 0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1038 |
newMasked := (copiedImage maskAtX:x y:y) == 0. |
994
5727c2484ecd
bugs fixed in undo/mask and point painting/preview and pasting
tz
parents:
877
diff
changeset
|
1039 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1040 |
"/ with modeUnder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1041 |
"/ only replace, if its either unmasked, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1042 |
"/ or the current drawing color. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1043 |
(modeUnder not |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1044 |
or:[wasMasked |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1045 |
or:[(oldColor := image colorAtX:dstX y:dstY) = (selectColors at:1)]]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1046 |
ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1047 |
image |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1048 |
colorAtX:dstX |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1049 |
y:dstY |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1050 |
put:(copiedImage colorAtX:x y:y). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1051 |
(wasMasked and:[newMasked not]) ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1052 |
image mask pixelAtX:dstX y:dstY put:1 |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1053 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1054 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1055 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1056 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1057 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1058 |
image restored. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1059 |
self redraw: (imageBox := (imagePoint * magnification extent: (Clipboard extent * magnification)) expandedBy: 1@1). |
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1060 |
"/ masterApplication imagePreView redraw: (imageBox expandedBy: 1). |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1061 |
modified := true |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1062 |
] |
1028
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1063 |
] |
4dfe1c6cbc48
fixed paste-drag display (when scrolled)
Claus Gittinger <cg@exept.de>
parents:
1027
diff
changeset
|
1064 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1065 |
"Modified: / 5.9.1998 / 13:36:58 / cg" |
636 | 1066 |
! |
1067 |
||
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1068 |
pasteUnderAt: aPoint |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1069 |
"pasteUnder the image in the clipboard at aPoint. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1070 |
In this mode, only pixels which are not equal to |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1071 |
the current color or masked are pasted." |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1072 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1073 |
self pasteAt:aPoint modeUnder:true. |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1074 |
! |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1075 |
|
636 | 1076 |
pointAt: aPoint |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1077 |
"draw a single pixel with the currently selected color" |
636 | 1078 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1079 |
|imagePoint imageBox clr| |
796 | 1080 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1081 |
(clr := self selectedColor) notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1082 |
imagePoint := aPoint//magnification. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1083 |
image atImageAndMask:imagePoint put:clr. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1084 |
self redraw:(imageBox := (imagePoint * magnification extent: magnification) expandedBy: 1). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1085 |
modified := true. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1086 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1087 |
|
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1088 |
"Modified: / 5.9.1998 / 13:25:29 / cg" |
636 | 1089 |
! |
1090 |
||
1091 |
resizeImage |
|
1092 |
||
1093 |
|box newSize| |
|
1094 |
box := EnterBox new. |
|
1095 |
box title:'Image new size:'. |
|
1096 |
box okText:'OK'. |
|
1097 |
box abortText:'Cancel'. |
|
1098 |
box initialText:image extent printString. |
|
1099 |
box showAtPointer. |
|
1100 |
(box accepted and: [(newSize := Object readFromString: box contents onError:nil) notNil]) |
|
1101 |
ifTrue: |
|
1102 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1103 |
|newImage| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1104 |
newImage := image class width: newSize x height: newSize y depth: image depth. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1105 |
newImage photometric:image photometric. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1106 |
newImage colorMap:image colorMap copy. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1107 |
newImage bits: (ByteArray new: newImage bytesPerRow * newSize y). |
636 | 1108 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1109 |
image mask notNil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1110 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1111 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1112 |
|newMaskImage| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1113 |
newMaskImage := Depth1Image width: newSize x height: newSize y. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1114 |
newMaskImage photometric: image mask photometric. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1115 |
newMaskImage colorMap: image mask colorMap copy. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1116 |
newMaskImage bits:(ByteArray new: newMaskImage bytesPerRow * newSize y). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1117 |
newImage mask: newMaskImage |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1118 |
]. |
636 | 1119 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1120 |
newImage copyFrom:image x:0 y:0 toX:0 y:0 width: (image width min:newSize x) height: (image height min:newSize y). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1121 |
self makeUndo. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1122 |
self image: newImage. |
686 | 1123 |
] |
636 | 1124 |
! |
1125 |
||
1126 |
rotateImage |
|
1127 |
||
1128 |
|box rotation| |
|
1129 |
box := EnterBox new. |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1130 |
box title:'Rotate by (degrees, clockwise):'. |
636 | 1131 |
box okText:'OK'. |
1132 |
box abortText:'Cancel'. |
|
1133 |
box initialText: '0'. |
|
1134 |
box showAtPointer. |
|
1135 |
(box accepted and: [(rotation := Object readFromString: box contents onError:nil) notNil]) |
|
1136 |
ifTrue: |
|
1137 |
[ Object errorSignal handle: |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1138 |
[:ex| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1139 |
self warn: 'Image rotation failed!!\' withCRs, 'Increaing the image depth could help.' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1140 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1141 |
do: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1142 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1143 |
self makeUndo. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1144 |
self image: (image hardRotated: rotation) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1145 |
] |
686 | 1146 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1147 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1148 |
"Modified: / 29.7.1998 / 18:21:14 / cg" |
636 | 1149 |
! |
1150 |
||
1151 |
undo |
|
1152 |
||
995 | 1153 |
undoImages notEmpty |
636 | 1154 |
ifTrue: |
725 | 1155 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1156 |
windowGroup withExecuteCursorDo:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1157 |
modified := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1158 |
self image: undoImages removeLast. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1159 |
"/ cg: what a kludge - please change to use a valueHolder, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1160 |
masterApplication notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1161 |
masterApplication listOfColors contents: image colorMap. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1162 |
masterApplication findColorMapMode. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1163 |
undoImages isEmpty ifTrue: [masterApplication valueOfCanUndo value: false]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1164 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1165 |
"/ cg: not needed - image: already does it. |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1166 |
"/ self invalidate |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1167 |
] |
636 | 1168 |
] |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1169 |
|
1047 | 1170 |
"Modified: / 31.7.1998 / 20:12:58 / cg" |
627 | 1171 |
! ! |
1172 |
||
1173 |
!ImageEditView methodsFor:'image setting'! |
|
1174 |
||
1175 |
image:anImage |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1176 |
|retVal| |
627 | 1177 |
|
688 | 1178 |
anImage isImage |
627 | 1179 |
ifTrue: |
725 | 1180 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1181 |
(image isNil or: [self checkModified]) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1182 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1183 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1184 |
|fileName| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1185 |
masterApplication notNil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1186 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1187 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1188 |
undoImages notEmpty ifTrue: [masterApplication valueOfCanUndo value: true]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1189 |
masterApplication imagePreView image: anImage |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1190 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1191 |
image notNil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1192 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1193 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1194 |
fileName := image fileName. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1195 |
anImage fileName isNil ifTrue: [anImage fileName: fileName]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1196 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1197 |
super image: anImage. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1198 |
retVal := self. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1199 |
]. |
674 | 1200 |
] |
1201 |
ifFalse: |
|
1202 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1203 |
super image: nil. |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1204 |
]. |
1025
4470f3ad349f
update the image label, when a new image is assigned.
Claus Gittinger <cg@exept.de>
parents:
1019
diff
changeset
|
1205 |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1206 |
self updateImageInfo: self imageInfoString. |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1207 |
^ retVal |
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1208 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1209 |
"Modified: / 29.7.1998 / 18:27:31 / cg" |
627 | 1210 |
! |
1211 |
||
1212 |
loadFromFile: aFileName |
|
624 | 1213 |
|
676 | 1214 |
aFileName isNil ifTrue: [^nil]. |
624 | 1215 |
Object errorSignal handle: |
1216 |
[:exeption| |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1217 |
modified := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1218 |
self warn: exeption errorString. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1219 |
^nil |
624 | 1220 |
] |
1221 |
do: |
|
676 | 1222 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1223 |
|imageFromFile| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1224 |
(imageFromFile := Image fromFile: aFileName) notNil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1225 |
ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1226 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1227 |
self releaseUndos. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1228 |
self image: imageFromFile. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1229 |
imageReaderClass := ImageReader allSubclasses |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1230 |
detect: [:cls| cls isValidImageFile: aFileName] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1231 |
ifNone: [self error: 'Unknown image file format!!'] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1232 |
] |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1233 |
ifFalse: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1234 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1235 |
self error: 'Not an image file (or unrecognized format) !!' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1236 |
] |
676 | 1237 |
] |
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1238 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1239 |
"Modified: / 29.7.1998 / 18:09:13 / cg" |
624 | 1240 |
! |
255 | 1241 |
|
633 | 1242 |
loadFromMessage: aMessage |
1243 |
||
1244 |
(self resourceMessage: aMessage) isNil |
|
1245 |
ifTrue: |
|
1246 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1247 |
^nil |
633 | 1248 |
]. |
624 | 1249 |
|
633 | 1250 |
^self loadfromClass: resourceClass andSelector: resourceSelector |
1251 |
||
1252 |
||
1253 |
! |
|
1254 |
||
1255 |
loadfromClass: aClassOrSymbol andSelector: aStringOrSymbol |
|
1256 |
||
678 | 1257 |
|aClass| |
1258 |
||
627 | 1259 |
imageReaderClass := nil. |
1260 |
self resourceClass: aClassOrSymbol. |
|
1261 |
self resourceSelector: aStringOrSymbol. |
|
678 | 1262 |
|
1263 |
((aClass := Smalltalk at: resourceClass) isClass and: |
|
1264 |
[aClass class implements: resourceSelector]) |
|
624 | 1265 |
ifTrue: |
1266 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1267 |
self releaseUndos. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1268 |
^self image: (aClass perform: resourceSelector) copy |
674 | 1269 |
] |
1270 |
ifFalse: |
|
1271 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1272 |
modified := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1273 |
^nil |
674 | 1274 |
] |
1275 |
||
161 | 1276 |
! ! |
1277 |
||
1 | 1278 |
!ImageEditView methodsFor:'initialization'! |
1279 |
||
161 | 1280 |
initialize |
624 | 1281 |
|
161 | 1282 |
super initialize. |
627 | 1283 |
|
686 | 1284 |
self enableMotionEvents. |
995 | 1285 |
|
1036 | 1286 |
GridMagnification := GridMagnification ? (8@8). |
995 | 1287 |
MaxUndos := MaxUndos ? 3. |
1288 |
undoImages := OrderedCollection new: MaxUndos. |
|
1003 | 1289 |
magnification := LastMagnification ? GridMagnification. |
995 | 1290 |
modified := false. |
627 | 1291 |
mouseKeyColorMode := 1. |
995 | 1292 |
resourceClass := resourceSelector := ''. |
1293 |
selectColors := Array with: nil with: nil. |
|
1106 | 1294 |
editMode := #point. |
1036 | 1295 |
|
1 | 1296 |
! ! |
1297 |
||
636 | 1298 |
!ImageEditView methodsFor:'printing & storing'! |
1 | 1299 |
|
724 | 1300 |
loadFromClass |
404 | 1301 |
|
676 | 1302 |
^self loadFromMessage: |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1303 |
(ResourceSelectionBrowser |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1304 |
request: 'Load Image From Class' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1305 |
onSuperclass: nil |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1306 |
andClass: self resourceClass |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1307 |
andSelector: self resourceSelector |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1308 |
withResourceTypes: #(image fileImage)) |
636 | 1309 |
|
477 | 1310 |
|
161 | 1311 |
! |
1312 |
||
995 | 1313 |
makeUndo |
1314 |
||
1315 |
image notNil |
|
1316 |
ifTrue: |
|
1317 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1318 |
MaxUndos <= undoImages size |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1319 |
ifTrue: [undoImages contents: (undoImages copyFrom: 2 to: MaxUndos)]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1320 |
undoImages add: image copy |
995 | 1321 |
] |
1322 |
! |
|
1323 |
||
627 | 1324 |
|
624 | 1325 |
|
686 | 1326 |
image notNil |
1327 |
ifTrue: |
|
636 | 1328 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1329 |
|stream| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1330 |
Printer supportsPostscript ifFalse: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1331 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1332 |
^self warn:'No postscript printer detected!!' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1333 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1334 |
stream := Printer newNative. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1335 |
stream isNil ifTrue: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1336 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1337 |
^self warn:'Cannot open printer stream!!' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1338 |
]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1339 |
self withWaitCursorDo: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1340 |
[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1341 |
|psgc| |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1342 |
psgc := PSGraphicsContext on:stream. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1343 |
psgc displayForm: (image magnifiedBy: magnification) x:0 y:0. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1344 |
psgc close |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1345 |
] |
398
7b7255a4db0d
show a wait cursor while printing
Claus Gittinger <cg@exept.de>
parents:
362
diff
changeset
|
1346 |
] |
624 | 1347 |
! |
1348 |
||
1349 |
save |
|
1350 |
||
632 | 1351 |
self saveImageOrMask: #image. |
1352 |
||
624 | 1353 |
! |
1354 |
||
297 | 1355 |
saveAs |
1356 |
||
627 | 1357 |
self saveImageFileAs |
297 | 1358 |
! |
1359 |
||
627 | 1360 |
saveImageFileAs |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1361 |
"ask for a fileName and save the image" |
627 | 1362 |
|
633 | 1363 |
self saveImageFileAs: |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1364 |
(FileSelectionBrowser |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1365 |
request: 'Save Image To File' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1366 |
fileName: self image fileName |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1367 |
withFileFilters: FileSelectionBrowser saveImageFileNameFilters) |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1368 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1369 |
"Modified: / 30.9.1998 / 23:05:19 / cg" |
627 | 1370 |
! |
297 | 1371 |
|
627 | 1372 |
saveImageFileAs: aFileName |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1373 |
"save the image in aFileName" |
297 | 1374 |
|
633 | 1375 |
aFileName isNil ifTrue: [^nil]. |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1376 |
image notNil ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1377 |
image fileName: aFileName. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1378 |
self saveImageOrMask: #image |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1379 |
] ifFalse:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1380 |
self warn: 'No image or file name for saving detected!!' |
632 | 1381 |
] |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1382 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1383 |
"Modified: / 30.9.1998 / 23:04:55 / cg" |
632 | 1384 |
! |
1385 |
||
1386 |
saveImageMaskFileAs |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1387 |
"ask for a fileName and save the mask only" |
632 | 1388 |
|
633 | 1389 |
self saveImageMaskFileAs: |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1390 |
(FileSelectionBrowser |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1391 |
request: 'Save Image Mask To File' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1392 |
fileName: self image fileName |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1393 |
withFileFilters: FileSelectionBrowser saveImageFileNameFilters) |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1394 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1395 |
"Modified: / 30.9.1998 / 23:04:11 / cg" |
632 | 1396 |
! |
1397 |
||
1398 |
saveImageMaskFileAs: aFileName |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1399 |
"save the mask only in aFileName" |
632 | 1400 |
|
633 | 1401 |
aFileName isNil ifTrue: [^nil]. |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1402 |
(image notNil and:[image mask notNil]) ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1403 |
image mask fileName:aFileName. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1404 |
self saveImageOrMask: #mask |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1405 |
] ifFalse:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1406 |
self warn: 'No image or image mask detected!!' |
627 | 1407 |
] |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1408 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1409 |
"Modified: / 30.9.1998 / 23:06:24 / cg" |
628 | 1410 |
! |
1411 |
||
632 | 1412 |
saveImageOrMask: what |
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1413 |
"save the image or the mask only (if what == #mask)" |
628 | 1414 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1415 |
Object errorSignal handle:[:ex| |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1416 |
self warn: ex errorString. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1417 |
] do:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1418 |
Image informationLostQuerySignal handle:[:ex| |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1419 |
"/ should make those warnings visible ... |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1420 |
(self confirm:(ex errorString , '\\Save anyway ?') withCRs) ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1421 |
ex proceed. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1422 |
] |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1423 |
] do:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1424 |
windowGroup withCursor:Cursor write do:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1425 |
|fileName suff| |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1426 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1427 |
image isNil ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1428 |
^ self error: 'No image to save!!' |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1429 |
]. |
632 | 1430 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1431 |
what = #image ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1432 |
(fileName := image fileName) isNil ifTrue: [^self error: 'No file name for image detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1433 |
]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1434 |
what = #mask ifTrue:[ |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1435 |
image mask isNil ifTrue: [^self error: 'No image mask to save!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1436 |
(fileName := image mask fileName) isNil ifTrue: [^self error: 'No file name for image mask detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1437 |
]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1438 |
fileName := fileName asFilename. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1439 |
|
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1440 |
fileName name size = 0 ifTrue: [^self error: 'No file name detected!!']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1441 |
suff := fileName suffix asLowercase. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1442 |
(suff = 'tiff') | (suff = 'tif') ifTrue: [imageReaderClass := TIFFReader]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1443 |
suff = 'xpm' ifTrue: [imageReaderClass := XPMReader]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1444 |
suff = 'xbm' ifTrue: [imageReaderClass := XBMReader]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1445 |
suff = 'gif' ifTrue: [imageReaderClass := GIFReader]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1446 |
(suff = 'jpg') | (suff = 'jpeg') ifTrue: [imageReaderClass := JPEGReader]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1447 |
imageReaderClass isNil ifTrue: [imageReaderClass := XPMReader. image fileName: image fileName, '.xpm']. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1448 |
what = #image ifTrue: [image saveOn: image fileName using: imageReaderClass. modified := false]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1449 |
what = #mask ifTrue: [image mask saveOn: image mask fileName using: imageReaderClass]. |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1450 |
] |
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1451 |
] |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1452 |
] |
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1453 |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1454 |
"Modified: / 30.9.1998 / 23:19:39 / cg" |
633 | 1455 |
! |
1456 |
||
1457 |
saveMethod |
|
1458 |
||
1459 |
Object errorSignal handle: |
|
1460 |
[:ex| |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1461 |
self warn: ex errorString. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1462 |
^nil |
633 | 1463 |
] |
1464 |
do: |
|
1465 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1466 |
|category imageStoreStream cls sel mthd imageKey| |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1467 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1468 |
windowGroup withExecuteCursorDo:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1469 |
(self resourceSelector trimBlanks size = 0) | (cls := Smalltalk at: self resourceClass) isClass not |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1470 |
ifTrue: [^self saveMethodAs]. |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1471 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1472 |
self image storeOn: (imageStoreStream := WriteStream on: ''). |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1473 |
sel := self resourceSelector. |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1474 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1475 |
"/ if that method already exists, do not overwrite the category |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1476 |
category := 'image specs'. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1477 |
(mthd := cls class compiledMethodAt:sel) notNil ifTrue:[ |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1478 |
category := mthd category. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1479 |
]. |
822
cace81f0a86b
do not overwrite method categories + toggle between mouse button colors
tz
parents:
796
diff
changeset
|
1480 |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1481 |
imageKey := (cls name, ' ', sel) asSymbol. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1482 |
Icon constantNamed: imageKey put:nil. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1483 |
ByteCodeCompiler |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1484 |
compile: ((sel, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1485 |
'\', (ResourceSpecEditor codeGenerationCommentForClass: ImageEditor), |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1486 |
'\\' , |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1487 |
' "\', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1488 |
' self ' , self resourceSelector , ' inspect\', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1489 |
' ImageEditor openOnClass:self andSelector:#', self resourceSelector, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1490 |
'\ "', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1491 |
'\\', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1492 |
' <resource: #image>', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1493 |
'\\', |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1494 |
' ^Icon\') withCRs, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1495 |
' constantNamed:#''', imageKey, '''\' withCRs, |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1496 |
' ifAbsentPut:[', imageStoreStream contents, ']') |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1497 |
forClass: cls class inCategory: category. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1498 |
modified := false. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1499 |
] |
633 | 1500 |
] |
1027
5bffbe90b8e2
show a wait-cursor while saving
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
1501 |
|
1047 | 1502 |
"Modified: / 31.7.1998 / 20:12:54 / cg" |
633 | 1503 |
! |
1504 |
||
1505 |
saveMethodAs |
|
1506 |
||
636 | 1507 |
(self resourceMessage: |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1508 |
(ResourceSelectionBrowser |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1509 |
request: 'Save Image In Class' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1510 |
onSuperclass: #Object |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1511 |
andClass: self resourceClass |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1512 |
andSelector: self resourceSelector |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1513 |
withResourceTypes: #(image fileImage))) notNil |
633 | 1514 |
ifTrue: |
674 | 1515 |
[ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1516 |
^self saveMethod |
674 | 1517 |
]. |
633 | 1518 |
^nil |
1 | 1519 |
! ! |
1520 |
||
161 | 1521 |
!ImageEditView methodsFor:'queries'! |
5 | 1522 |
|
161 | 1523 |
heightOfContents |
1524 |
||
686 | 1525 |
image isNil ifTrue:[^0]. |
1526 |
^(image height * magnification y) rounded |
|
5 | 1527 |
! |
1528 |
||
995 | 1529 |
imageContainsPastePoint: aPoint |
1530 |
||
1531 |
^image notNil and: |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1532 |
[Clipboard notNil and: |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1533 |
[((0@0 corner:(image extent) "- 1" - Clipboard extent) containsPoint: (((aPoint - margin + 1) / magnification) floor))]] |
995 | 1534 |
! |
1535 |
||
627 | 1536 |
imageContainsPoint: aPoint |
632 | 1537 |
|
1538 |
^image notNil and: |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1539 |
[((0@0 corner:(image extent) - 1) containsPoint: (((aPoint - margin + 1) / magnification) floor))] |
627 | 1540 |
! |
1541 |
||
783 | 1542 |
imageInfoString |
1543 |
||
1544 |
|imageInfoString usedColors| |
|
1011
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1545 |
|
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1546 |
image isNil ifTrue: [imageInfoString := 'No image loaded.'] |
325d334e93c8
added paste-under (only paste where pixel ~= current selected)
Claus Gittinger <cg@exept.de>
parents:
1006
diff
changeset
|
1547 |
ifFalse: [ |
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1548 |
image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := image usedColors size]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1549 |
imageInfoString := image width printString, 'x' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1550 |
, image height printString, 'x' |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1551 |
, (2 raisedTo: image depth) printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1552 |
, (image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1553 |
, usedColors printString |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1554 |
, ' used colors)']. |
783 | 1555 |
|
1556 |
^imageInfoString |
|
1557 |
! |
|
1558 |
||
161 | 1559 |
widthOfContents |
5 | 1560 |
|
686 | 1561 |
image isNil ifTrue:[^0]. |
1562 |
^(image width * magnification x) rounded |
|
5 | 1563 |
! ! |
1564 |
||
627 | 1565 |
!ImageEditView methodsFor:'release'! |
1566 |
||
1567 |
destroy |
|
1568 |
||
996 | 1569 |
ClipboardMagnification := Clipboard := nil. |
1003 | 1570 |
LastMagnification := magnification. |
686 | 1571 |
|
1572 |
super destroy |
|
627 | 1573 |
|
995 | 1574 |
! |
1575 |
||
1576 |
releasePasteDrawing |
|
1577 |
||
1578 |
(lastPastePoint notNil and: [ClipboardMagnification notNil]) |
|
1579 |
ifTrue: |
|
1580 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1581 |
self redraw: (lastPastePoint extent: (ClipboardMagnification extent)). |
995 | 1582 |
]. |
1583 |
lastPastePoint := ClipboardMagnification := nil |
|
1584 |
! |
|
1585 |
||
1586 |
releaseUndos |
|
1587 |
||
1588 |
undoImages removeAll. |
|
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1589 |
"/ cg: what a kludge - please change to use a valueHolder, |
995 | 1590 |
masterApplication valueOfCanUndo value: false. |
1038
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1591 |
|
6c0bb03e88a1
no need to invalidate after assign of new image.
Claus Gittinger <cg@exept.de>
parents:
1037
diff
changeset
|
1592 |
"Modified: / 31.7.1998 / 02:47:21 / cg" |
627 | 1593 |
! ! |
1594 |
||
632 | 1595 |
!ImageEditView methodsFor:'testing'! |
1596 |
||
1597 |
checkModified |
|
1598 |
||
1599 |
modified |
|
1600 |
ifTrue: |
|
1601 |
[ |
|
1116
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1602 |
((YesNoBox title:(resources string:'Image was modified !!')) |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1603 |
noText:(resources string:'Cancel'); |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1604 |
yesText:(resources string:'Forget it and proceed'); |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1605 |
showAtPointer; |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1606 |
accepted) ifFalse: [^false]. |
441ff42c1472
fixes to allow 24bit images to be (at least) displayed
Claus Gittinger <cg@exept.de>
parents:
1106
diff
changeset
|
1607 |
modified := false |
632 | 1608 |
]. |
1609 |
^true |
|
1031
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1610 |
|
a5ab5869b2ba
cleaned up the interface to the apps infoPanel
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
1611 |
"Modified: / 29.7.1998 / 18:55:24 / cg" |
632 | 1612 |
! ! |
1613 |
||
255 | 1614 |
!ImageEditView class methodsFor:'documentation'! |
161 | 1615 |
|
1616 |
version |
|
1158
9b413954d34d
issue a warning, if information (mask) is
Claus Gittinger <cg@exept.de>
parents:
1121
diff
changeset
|
1617 |
^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.106 1998-10-01 10:48:20 cg Exp $' |
161 | 1618 |
! ! |