12 |
12 |
13 "{ Package: 'stx:libwidg2' }" |
13 "{ Package: 'stx:libwidg2' }" |
14 |
14 |
15 ImageView subclass:#ImageEditView |
15 ImageView subclass:#ImageEditView |
16 instanceVariableNames:'magnification imageReaderClass resourceClass resourceSelector |
16 instanceVariableNames:'magnification imageReaderClass resourceClass resourceSelector |
17 mouseKeyColorMode undoImages modified editMode lastPastePoint |
17 mouseKeyColorMode undoImages modifiedHolder editMode |
18 imageInfoHolder activityInfoHolder pickedColorHolder |
18 lastPastePoint imageInfoHolder activityInfoHolder |
19 drawingColors drawingPixels drawingColorHolders |
19 pickedColorHolder drawingColors drawingPixels drawingColorHolders |
20 drawingPixelHolders clickInfoCallBack' |
20 drawingPixelHolders clickInfoCallBack' |
21 classVariableNames:'Clipboard ClipboardMagnified LastMagnification |
21 classVariableNames:'Clipboard ClipboardMagnified LastMagnification |
22 GridMagnificationLimit MaxUndos LastSaveDirectory LastSaveClass' |
22 GridMagnificationLimit MaxUndos LastSaveDirectory LastSaveClass' |
23 poolDictionaries:'' |
23 poolDictionaries:'' |
24 category:'Views-Misc' |
24 category:'Views-Misc' |
1842 |
1850 |
1843 self enableMotionEvents. |
1851 self enableMotionEvents. |
1844 |
1852 |
1845 undoImages := List new: MaxUndos. |
1853 undoImages := List new: MaxUndos. |
1846 magnification := LastMagnification ? (8@8). |
1854 magnification := LastMagnification ? (8@8). |
1847 modified := false. |
1855 modifiedHolder := false asValue. |
1848 mouseKeyColorMode := 1. |
1856 mouseKeyColorMode := 1. |
1849 resourceClass := resourceSelector := ''. |
1857 resourceClass := resourceSelector := ''. |
1850 drawingColorHolders := Array with:(nil asValue) with:(nil asValue). "/ left/right mouse colors |
1858 drawingColorHolders := Array with:(nil asValue) with:(nil asValue). "/ left/right mouse colors |
1851 drawingPixelHolders := Array with:(nil asValue) with:(nil asValue). "/ left/right mouse colors |
1859 drawingPixelHolders := Array with:(nil asValue) with:(nil asValue). "/ left/right mouse colors |
1852 editMode := #point. |
1860 editMode := #point. |
2207 ! ! |
2215 ! ! |
2208 |
2216 |
2209 !ImageEditView methodsFor:'release'! |
2217 !ImageEditView methodsFor:'release'! |
2210 |
2218 |
2211 releasePasteDrawing |
2219 releasePasteDrawing |
2212 |
|
2213 self repairDamage. |
2220 self repairDamage. |
2214 (lastPastePoint notNil and: [ClipboardMagnified notNil]) |
2221 (lastPastePoint notNil and: [ClipboardMagnified notNil]) |
2215 ifTrue: |
2222 ifTrue: [ |
2216 [ |
|
2217 self redraw: ((lastPastePoint"-self viewOrigin") extent: (ClipboardMagnified extent)). |
2223 self redraw: ((lastPastePoint"-self viewOrigin") extent: (ClipboardMagnified extent)). |
2218 "/ self repairDamage. |
2224 "/ self repairDamage. |
2219 ]. |
2225 ]. |
2220 lastPastePoint := ClipboardMagnified := nil |
2226 lastPastePoint := ClipboardMagnified := nil |
2221 ! |
2227 ! |
2222 |
2228 |
2223 releaseUndos |
2229 releaseUndos |
2224 |
|
2225 undoImages removeAll. |
2230 undoImages removeAll. |
2226 "/ cg: what a kludge - please change to use a valueHolder, |
|
2227 "/ masterApplication notNil ifTrue:[ |
|
2228 "/ masterApplication valueOfCanUndo value: false. |
|
2229 "/ ]. |
|
2230 |
|
2231 "Modified: / 31.7.1998 / 02:47:21 / cg" |
|
2232 ! ! |
2231 ! ! |
2233 |
2232 |
2234 !ImageEditView methodsFor:'testing'! |
2233 !ImageEditView methodsFor:'testing'! |
2235 |
2234 |
2236 checkModified |
2235 checkModified |
2237 |
2236 modifiedHolder value ifTrue:[ |
2238 modified ifTrue: |
|
2239 [ |
|
2240 ((YesNoBox title:(resources string:'Image was not saved. Exit anyway ?')) |
2237 ((YesNoBox title:(resources string:'Image was not saved. Exit anyway ?')) |
2241 noText:(resources string:'Cancel'); |
2238 noText:(resources string:'Cancel'); |
2242 yesText:(resources string:'Exit without Saving'); |
2239 yesText:(resources string:'Exit without Saving'); |
2243 showAtPointer; |
2240 showAtPointer; |
2244 accepted) ifFalse: [^false]. |
2241 accepted |
2245 modified := false |
2242 ) ifFalse: [^false]. |
|
2243 |
|
2244 self modified:false. |
2246 ]. |
2245 ]. |
2247 ^ true |
2246 ^ true |
2248 |
2247 |
2249 "Modified: / 29.7.1998 / 18:55:24 / cg" |
2248 "Modified: / 29.7.1998 / 18:55:24 / cg" |
2250 ! ! |
2249 ! ! |
2251 |
2250 |
2252 !ImageEditView class methodsFor:'documentation'! |
2251 !ImageEditView class methodsFor:'documentation'! |
2253 |
2252 |
2254 version |
2253 version |
2255 ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.195 2004-03-29 14:16:30 cg Exp $' |
2254 ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.196 2004-09-29 11:31:22 cg Exp $' |
2256 ! ! |
2255 ! ! |
2257 |
2256 |
2258 ImageEditView initialize! |
2257 ImageEditView initialize! |