diff -r 96728cae02c4 -r 6196f12b97f6 ImageEditor.st --- a/ImageEditor.st Tue Aug 18 16:21:45 1998 +0200 +++ b/ImageEditor.st Tue Aug 18 18:19:58 1998 +0200 @@ -1278,17 +1278,25 @@ ! update:something with:aParameter from:changedObject + |clrIndex| + changedObject == self listOfColors ifTrue:[ something == #at: ifTrue:[ "/ colormap entry changed at aParameter - self image colorMap at:aParameter put:(changedObject at:aParameter). + + clrIndex := aParameter. + (self hasMask) ifTrue:[ + clrIndex := clrIndex - 1. + ]. + + self image colorMap at:clrIndex put:(changedObject at:aParameter). self colorMapChanged. ^ self ]. ]. super update:something with:aParameter from:changedObject - "Modified: / 7.8.1998 / 22:32:09 / cg" + "Modified: / 18.8.1998 / 17:18:42 / cg" ! updateForNoneImage @@ -1331,7 +1339,10 @@ aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed byte := newBlue clampBetween:0 and:255. + byte = aColor blueByte ifTrue:[^ aColor]. ^ Color redByte:(aColor redByte) greenByte:(aColor greenByte) blueByte:byte + + "Modified: / 18.8.1998 / 17:00:12 / cg" ! blueFromColor:aColor @@ -1372,7 +1383,10 @@ aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed byte := newGreen clampBetween:0 and:255. + byte = aColor greenByte ifTrue:[^ aColor]. ^ Color redByte:(aColor redByte) greenByte:byte blueByte:(aColor blueByte) + + "Modified: / 18.8.1998 / 17:00:38 / cg" ! greenFromColor:aColor @@ -1392,7 +1406,10 @@ aColor isNil ifTrue:[^ aColor]. "/ mask cannot be changed byte := newRed clampBetween:0 and:255. + byte = aColor redByte ifTrue:[^ aColor]. ^ Color redByte:byte greenByte:(aColor greenByte) blueByte:(aColor blueByte) + + "Modified: / 18.8.1998 / 17:00:49 / cg" ! redFromColor:aColor @@ -1429,74 +1446,62 @@ loadFromFile: aFileName "loads an image from aFileName and sets up color map list and other info labels" - (imageEditView loadFromFile: aFileName) notNil - ifTrue: - [ - self image notNil - ifTrue: - [ - self image colorMap notNil - ifTrue: - [ - self listOfColors contents: self image usedColors asSet. - ] - ifFalse: - [ + |img| + + (imageEditView loadFromFile: aFileName) notNil ifTrue:[ + (img := self image) notNil ifTrue:[ + img colorMap notNil ifTrue:[ + self listOfColors contents:(img usedColors asSet asOrderedCollection). + ] ifFalse:[ self listOfColors removeAll. ]. self findColorMapMode. self updateLabelsAndHistory. - ] - ifFalse: - [ + ] ifFalse:[ self updateForNoneImage ] ] + + "Modified: / 18.8.1998 / 17:03:54 / cg" ! -loadFromImage: anImage +loadFromImage:anImage "loads an image from anImage and sets up color map list and other info labels" - imageEditView image: anImage. - self image notNil - ifTrue: - [ - self image colorMap notNil - ifTrue: - [ - self listOfColors contents: self image usedColors asSet asOrderedCollection. - ] - ifFalse: - [ + |img| + + imageEditView image:anImage. + (img := self image) notNil ifTrue:[ + img colorMap notNil ifTrue:[ + self listOfColors contents:(img usedColors asSet asOrderedCollection). + ] ifFalse:[ self listOfColors removeAll. ]. self findColorMapMode. self updateLabelsAndHistory. - ] - ifFalse: - [ + ] ifFalse:[ self updateForNoneImage ] + + "Modified: / 18.8.1998 / 17:04:46 / cg" ! loadFromMessage: aMessage "loads an image by evaluating aMessage and sets up color map list and other info labels" - (imageEditView loadFromMessage: aMessage) notNil - ifTrue: - [ - self image notNil - ifTrue: - [ - self listOfColors contents: self image usedColors asSet asOrderedCollection. + |img| + + (imageEditView loadFromMessage: aMessage) notNil ifTrue:[ + (img := self image) notNil ifTrue:[ + self listOfColors contents:(img usedColors asSet asOrderedCollection). self findColorMapMode. self updateLabelsAndHistory. - ] - ifFalse: - [ + ] ifFalse:[ self updateForNoneImage ] ] + + "Modified: / 18.8.1998 / 17:03:01 / cg" ! loadFromOrPrepareForMessage: aMessage @@ -1556,6 +1561,12 @@ !ImageEditor methodsFor:'queries'! +hasMask + ^ colorMapMode notNil and:[colorMapMode endsWith:'mask'] + + "Created: / 18.8.1998 / 17:17:38 / cg" +! + preferredExtent "returns the preferred extent" @@ -1636,14 +1647,16 @@ img := self image. img release. - (imageEditView image:img) notNil ifTrue: - [ - self updateLabelsAndHistory. - self imagePreView image:img - ] + imageEditView invalidate. + self imagePreView invalidate. + +"/ (imageEditView image:img) notNil ifTrue:[ +"/ self updateLabelsAndHistory. +"/ self imagePreView image:img +"/ ] "Created: / 7.8.1998 / 22:26:10 / cg" - "Modified: / 7.8.1998 / 22:37:29 / cg" + "Modified: / 18.8.1998 / 17:08:55 / cg" ! colorMapMode:aMode value: aValue