--- a/ImageEditor.st Thu Apr 13 18:59:19 2000 +0200
+++ b/ImageEditor.st Wed Apr 19 13:16:28 2000 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libtool2' }"
+
ToolApplicationModel subclass:#ImageEditor
instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode
selectedColorIndex postOpenAction'
@@ -1404,7 +1406,7 @@
image
"returns the current editing image"
- ^imageEditView image
+ ^ imageEditView image
!
postOpenAction: anAction
@@ -1432,7 +1434,11 @@
imageEditView
"returns the view of the image"
- ^ imageEditView := (builder componentAt: #imageEditView) scrolledView
+ imageEditView isNil ifTrue:[
+ imageEditView := (builder componentAt: #imageEditView) scrolledView.
+ imageEditView addDependent:self.
+ ].
+ ^ imageEditView
"Modified: / 10.2.2000 / 23:19:20 / cg"
!
@@ -1440,7 +1446,7 @@
imagePreView
"returns the preview of the image"
- ^(builder componentAt: #imagePreView) subViews first
+ ^ (builder componentAt: #imagePreView) subViews first
! !
!ImageEditor methodsFor:'aspects'!
@@ -1623,6 +1629,9 @@
^ self.
].
something == #subImageIn ifTrue:[
+self imagePreView image ~~ self image ifTrue:[
+self halt:'should not happen'.
+].
self imagePreView redraw:aParameter.
^ self.
].
@@ -1767,12 +1776,14 @@
defaultInfoLabel
"returns the default info label"
- (imageEditView resourceClass isSymbol and: [(Smalltalk at: imageEditView resourceClass) isClass])
- ifTrue:
- [
- ^imageEditView resourceClass, ' >> ', imageEditView resourceSelector
+ |resourceClass|
+
+ resourceClass := imageEditView resourceClass.
+ (resourceClass isSymbol and: [(Smalltalk at:resourceClass) isClass])
+ ifTrue:[
+ ^ resourceClass, ' >> ', imageEditView resourceSelector
].
- ^'No class and selector defined.'
+ ^ 'No class and selector defined.'
!
openDocumentation
@@ -1799,11 +1810,11 @@
].
self findColorMapMode.
self updateLabelsAndHistory.
+ img := img onDevice:device.
imageEditView image:img.
] ifFalse:[
self updateForNoImage
].
- self imagePreView image:img.
]
]
@@ -1813,11 +1824,17 @@
loadFromImage:anImage
"loads an image from anImage and sets up color map list and other info labels"
- imageEditView image:anImage.
- self imagePreView image: anImage.
+ |img|
+
anImage notNil ifTrue:[
- anImage colorMap notNil ifTrue:[
- self listOfColors contents:(anImage usedColors asSet asOrderedCollection).
+ img := anImage onDevice:device.
+ ].
+
+ imageEditView image:img.
+
+ img notNil ifTrue:[
+ img colorMap notNil ifTrue:[
+ self listOfColors contents:(img usedColors asSet asOrderedCollection).
] ifFalse:[
self listOfColors removeAll.
].
@@ -1837,11 +1854,11 @@
(imageEditView loadFromMessage: aMessage) notNil ifTrue:[
(img := self image) notNil ifTrue:[
+ img := img onDevice:device.
self listOfColors contents:(img usedColors asSet asOrderedCollection).
self findColorMapMode.
self updateLabelsAndHistory.
imageEditView image:img.
- self imagePreView image:img.
] ifFalse:[
self updateForNoImage
]
@@ -1856,17 +1873,13 @@
the aMessage for a saving at the end of editing"
(imageEditView loadFromMessage: aMessage) notNil
- ifTrue:
- [
+ ifTrue: [
self listOfColors contents: self image usedColors asSet asOrderedCollection.
self findColorMapMode.
- ]
- ifFalse:
- [
+ ] ifFalse: [
imageEditView resourceMessage: aMessage.
].
self updateLabelsAndHistory.
- self imagePreView image:(self image).
"Modified: / 16.3.1999 / 21:45:07 / cg"
! !
@@ -2092,7 +2105,8 @@
img := self image.
img release.
- imageEditView invalidate.
+
+ self imageEditView invalidate.
self imagePreView invalidate.
"/ (imageEditView image:img) notNil ifTrue:[
@@ -2727,10 +2741,10 @@
(img := self image) notNil ifTrue: [
self listOfColors contents: img usedColors asSet asOrderedCollection.
self findColorMapMode.
- self updateLabelsAndHistory
+ self updateLabelsAndHistory.
] ifFalse: [
self updateForNoImage
- ]
+ ].
]
!
@@ -2801,7 +2815,7 @@
[
self listOfColors contents: cMap.
self findColorMapMode.
- self updateLabelsAndHistory
+ self updateLabelsAndHistory.
]
]
!