--- a/ImageEditor.st Wed Jul 22 17:24:12 1998 +0200
+++ b/ImageEditor.st Wed Jul 22 21:12:11 1998 +0200
@@ -11,7 +11,7 @@
"
ToolApplicationModel subclass:#ImageEditor
- instanceVariableNames:'colorMapMode selectedColorIndex postOpenAction'
+ instanceVariableNames:'imageEditView colorMapMode selectedColorIndex postOpenAction'
classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
@@ -1041,7 +1041,7 @@
image
"returns the current editing image"
- ^self imageEditView image
+ ^imageEditView image
!
postOpenAction: anAction
@@ -1059,9 +1059,9 @@
!
imageEditView
- "returns the image editing view"
+ "returns the view of the image"
- ^(builder componentAt: #imageEditView) subViews first
+ ^imageEditView := (builder componentAt: #imageEditView) subViews first
!
imagePreView
@@ -1126,7 +1126,7 @@
[
self colorMapMode: colorMapMode value: nil
].
- self imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])).
+ imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])).
self image mask notNil
ifTrue:
@@ -1136,11 +1136,11 @@
ifTrue:
[
self listOfColors addFirst: (Color basicNew setColorId:0).
- self imageEditView selectColors: (Array with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1]) with: (self listOfColors at: 1)).
+ imageEditView selectColors: (Array with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1]) with: (self listOfColors at: 1)).
]
].
self selectionOfColor value: 0.
- self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
+ self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
!
updateForNoneImage
@@ -1164,8 +1164,8 @@
self updateInfoLabel.
- self imageEditView resourceMessage asCollectionOfWords size = 2
- ifTrue: [self addToHistory: self imageEditView resourceMessage -> #loadFromMessage:].
+ imageEditView resourceMessage asCollectionOfWords size = 2
+ ifTrue: [self addToHistory: imageEditView resourceMessage -> #loadFromMessage:].
self image fileName notNil
ifTrue: [self addToHistory: self image fileName -> #loadFromFile:].
@@ -1179,10 +1179,10 @@
defaultInfoLabel
"returns the default info label"
- (self imageEditView resourceClass isSymbol and: [(Smalltalk at: self imageEditView resourceClass) isClass])
+ (imageEditView resourceClass isSymbol and: [(Smalltalk at: imageEditView resourceClass) isClass])
ifTrue:
[
- ^self imageEditView resourceClass, ' >> ', self imageEditView resourceSelector
+ ^imageEditView resourceClass, ' >> ', imageEditView resourceSelector
].
^'No class and selector defined.'
!
@@ -1199,7 +1199,7 @@
loadFromFile: aFileName
"loads an image from aFileName and sets up color map list and other info labels"
- (self imageEditView loadFromFile: aFileName) notNil
+ (imageEditView loadFromFile: aFileName) notNil
ifTrue:
[
self image notNil
@@ -1227,7 +1227,7 @@
loadFromImage: anImage
"loads an image from anImage and sets up color map list and other info labels"
- self imageEditView image: anImage.
+ imageEditView image: anImage.
self image notNil
ifTrue:
[
@@ -1252,7 +1252,7 @@
loadFromMessage: aMessage
"loads an image by evaluating aMessage and sets up color map list and other info labels"
- (self imageEditView loadFromMessage: aMessage) notNil
+ (imageEditView loadFromMessage: aMessage) notNil
ifTrue:
[
self image notNil
@@ -1274,7 +1274,7 @@
if no image could extract from aMessage; do set the class and the selector from
the aMessage for a saving at the end of editing"
- (self imageEditView loadFromMessage: aMessage) notNil
+ (imageEditView loadFromMessage: aMessage) notNil
ifTrue:
[
self listOfColors contents: self image usedColors asSet asOrderedCollection.
@@ -1282,7 +1282,7 @@
]
ifFalse:
[
- self imageEditView resourceMessage: aMessage.
+ imageEditView resourceMessage: aMessage.
].
self updateLabelsAndHistory.
! !
@@ -1300,7 +1300,7 @@
|depth newColorMap newImage image newColors realColorMap oldFileName|
- self imageEditView makeUndo.
+ imageEditView makeUndo.
newColorMap := self class listOfColorMaps at: aMode.
depth := (newColorMap size log: 2) asInteger.
@@ -1311,6 +1311,7 @@
[:ex|
Object errorSignal handle:
[:ex|
+ imageEditView undo.
^self warn: 'Convertation failed!!'
]
do:
@@ -1358,7 +1359,7 @@
].
image colorMap: newColors.
colorMapMode := aMode.
- (self imageEditView image: image) notNil
+ (imageEditView image: image) notNil
ifTrue:
[
self image fileName: oldFileName.
@@ -1371,27 +1372,27 @@
editMode: aMode
"returns whether editMode is equal to aMode"
- ^self imageEditView editMode = aMode
+ ^imageEditView editMode = aMode
!
editMode: aMode value: aValue
"sets the editMode to aMode"
- self imageEditView editMode: aMode
+ imageEditView editMode: aMode
!
mouseKeyColorMode: aMode
"sets the mouseKeyColorMode to aMode"
- ^self imageEditView mouseKeyColorMode = aMode
+ ^imageEditView mouseKeyColorMode = aMode
!
mouseKeyColorMode: aMode value: aValue
"sets the mouseKeyColorMode to aMode"
- self imageEditView mouseKeyColorMode: aMode.
+ imageEditView mouseKeyColorMode: aMode.
- self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
+ self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
! !
!ImageEditor methodsFor:'queries'!
@@ -1409,8 +1410,8 @@
magnification
"returns the magnification of the image"
- (builder componentAt: #imageEditView) isNil ifTrue: [^1].
- ^self imageEditView magnification x
+ self imageEditView isNil ifTrue: [^1].
+ ^imageEditView magnification x
!
magnification: aValue
@@ -1418,8 +1419,8 @@
|magnification|
magnification := (aValue ? 1) asPoint.
- (magnification = self imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil].
- self imageEditView magnification: magnification
+ (magnification = imageEditView magnification or: [magnification = (0@0)]) ifTrue: [^nil].
+ imageEditView magnification: magnification
!
selectedColorIndex
@@ -1432,7 +1433,7 @@
"sets the index of the selected color"
selectedColorIndex := anIndex.
- self imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil])
+ imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil])
! !
@@ -1441,7 +1442,7 @@
closeRequest
"close request"
- self imageEditView checkModified ifTrue:[super closeRequest]
+ imageEditView checkModified ifTrue:[super closeRequest]
!
@@ -1450,14 +1451,15 @@
super open.
- self imageEditView masterApplication: self
+ imageEditView := (builder componentAt: #imageEditView) subViews first.
+ imageEditView masterApplication: self
!
postOpenWith:aBuilder
"after opening, sets the masterApplication of the imageEditView to self;
evaluate the postOpenAction"
- self imageEditView masterApplication: self.
+ imageEditView masterApplication: self.
postOpenAction notNil ifTrue: [postOpenAction value].
super postOpenWith:aBuilder
@@ -1468,25 +1470,25 @@
doBrowseClass
"opens a System Browser on the resourceClass and the resourceSelector"
- SystemBrowser openInClass: (Smalltalk at: self imageEditView resourceClass ifAbsent: [^nil]) class selector: self imageEditView resourceSelector
+ SystemBrowser openInClass: (Smalltalk at: imageEditView resourceClass ifAbsent: [^nil]) class selector: imageEditView resourceSelector
!
doChangeGridMagnification
"change grid magnification"
- self imageEditView changeGridMagnification
+ imageEditView changeGridMagnification
!
doFlipHorizontal
"flips horizontally current image"
- self imageEditView flipHorizontal
+ imageEditView flipHorizontal
!
doFlipVertical
"flips vertically current image"
- self imageEditView flipVertical
+ imageEditView flipVertical
!
doMagnifyDown
@@ -1502,7 +1504,7 @@
doMagnifyImage
"magnifies current image"
- self imageEditView magnifyImage.
+ imageEditView magnifyImage.
self updateInfoLabel
!
@@ -1519,30 +1521,30 @@
doNegativeImage
"negates current image by negating the color map"
- self imageEditView negativeImage.
+ imageEditView negativeImage.
self listOfColors removeAll.
self findColorMapMode.
- self imageEditView undoImages removeLast
+ imageEditView undoImages removeLast
!
doResizeImage
"resizes current image"
- self imageEditView resizeImage.
+ imageEditView resizeImage.
self updateInfoLabel
!
doRotateImage
"rotates current image"
- self imageEditView rotateImage.
+ imageEditView rotateImage.
self updateInfoLabel
!
doUndo
"reverses last edit action"
- self imageEditView undo
+ imageEditView undo
! !
!ImageEditor methodsFor:'user actions - loading'!
@@ -1550,7 +1552,7 @@
doLoadFromClass
"opens a dialog for loading an image from class and a (resource-) selector"
- (self imageEditView loadFromClass) notNil
+ (imageEditView loadFromClass) notNil
ifTrue:
[
self image notNil
@@ -1608,7 +1610,7 @@
].
image colorMap: cMap.
image fillRectangleX:0 y:0 width:width height:height with:Color white.
- (self imageEditView image: image) notNil
+ (imageEditView image: image) notNil
ifTrue:
[
self listOfColors contents: cMap.
@@ -1623,32 +1625,32 @@
doPrint
"prints current image on the current printer"
- self imageEditView print
+ imageEditView print
!
doSaveImageFile
"saves current image to current file"
- self imageEditView save
+ imageEditView save
!
doSaveImageFileAs
"opens a dialog for saving current image to a file"
- self imageEditView saveImageFileAs.
+ imageEditView saveImageFileAs.
self updateLabelsAndHistory
!
doSaveImageMaskFileAs
"opens a dialog for saving mask of current image to a file"
- self imageEditView saveImageMaskFileAs
+ imageEditView saveImageMaskFileAs
!
doSaveMethod
"saves current image on current class and selector"
- self imageEditView saveMethod notNil
+ imageEditView saveMethod notNil
ifTrue:
[
self updateLabelsAndHistory
@@ -1658,7 +1660,7 @@
doSaveMethodAs
"opens a dialog for saving current image on a class and a selector"
- self imageEditView saveMethodAs notNil
+ imageEditView saveMethodAs notNil
ifTrue:
[
self updateLabelsAndHistory