--- a/ImageEditor.st Sun Aug 30 14:11:15 1998 +0200
+++ b/ImageEditor.st Wed Sep 02 13:13:04 1998 +0200
@@ -11,7 +11,8 @@
"
ToolApplicationModel subclass:#ImageEditor
- instanceVariableNames:'imageEditView colorMapMode selectedColorIndex postOpenAction'
+ instanceVariableNames:'imageEditView colorMapMode editMode mouseKeyColorMode
+ selectedColorIndex postOpenAction'
classVariableNames:''
poolDictionaries:''
category:'Interface-UIPainter'
@@ -365,11 +366,11 @@
#window:
#(#WindowSpec
#name: 'New Image'
- #layout: #(#LayoutFrame 216 0 173 0 516 0 291 0)
+ #layout: #(#LayoutFrame 81 0 288 0 381 0 406 0)
#label: 'New Image'
#min: #(#Point 10 10)
#max: #(#Point 1152 900)
- #bounds: #(#Rectangle 216 173 517 292)
+ #bounds: #(#Rectangle 81 288 382 407)
#usePreferredExtent: false
)
#component:
@@ -392,7 +393,7 @@
#(
#(#ComboBoxSpec
#name: 'defaultSizesComboBox'
- #layout: #(#LayoutFrame -8 0.0 13 0.0 89 0.0 36 0.0)
+ #layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0)
#model: #selectionOfSize
#type: #string
#comboList: #listOfDefaultSizes
@@ -412,7 +413,7 @@
#(
#(#ComboListSpec
#name: 'colorMapComboBox'
- #layout: #(#LayoutFrame -4 0.0 12 0.0 144 0.0 35 0.0)
+ #layout: #(#LayoutFrame 0 0.0 10 0.0 0 1 35 0.0)
#model: #selectionOfColorMap
#comboList: #listOfColorMaps
#useIndex: false
@@ -428,16 +429,13 @@
#level: 1
)
#(#UISubSpecification
- #name: 'UISubSpecification1'
+ #name: 'windowSpecForCommitWithoutChannels'
#layout: #(#LayoutFrame 2 0.0 -26 1 -2 1.0 -2 1.0)
- #majorKey: #ToolApplicationModel
#minorKey: #windowSpecForCommitWithoutChannels
)
)
)
)
-
- "Modified: / 13.8.1998 / 19:56:22 / cg"
!
windowSpec
@@ -856,30 +854,38 @@
#(#MenuItem
#label: '8-Plane'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap8
#argument: '8-plane'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '8-plane'
)
#(#MenuItem
#label: '4-Plane'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap4
#argument: '4-plane'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '4-plane'
)
#(#MenuItem
#label: '2-Plane'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap2
#argument: '2-plane'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '2-plane'
)
#(#MenuItem
#label: '1-Plane'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap1
#argument: '1-plane'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '1-plane'
)
#(#MenuItem
#label: '-'
@@ -887,30 +893,38 @@
#(#MenuItem
#label: '8-Plane + Mask'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap8M
#argument: '8-plane + mask'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '8-plane + mask'
)
#(#MenuItem
#label: '4-Plane + Mask'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap4M
#argument: '4-plane + mask'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '4-plane + mask'
)
#(#MenuItem
#label: '2-Plane + Mask'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap2M
#argument: '2-plane + mask'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '2-plane + mask'
)
#(#MenuItem
#label: '1-Plane + Mask'
#translateLabel: true
+ #value: #colorMapMode:
#activeHelpKey: #colorMap1M
#argument: '1-plane + mask'
- #indication: #colorMapMode:value:
+ #choice: #colorMapMode
+ #choiceValue: '1-plane + mask'
)
#(#MenuItem
#label: '-'
@@ -966,8 +980,6 @@
) nil
nil
)
-
- "Modified: / 31.7.1998 / 02:04:49 / cg"
!
menuMouseButtonColors
@@ -993,17 +1005,19 @@
#label: 'Left Mouse Button'
#nameKey: #leftMouseKeyButton
#activeHelpKey: #mouseKeyColorMode
- #argument: '1'
+ #enabled: #imageIsLoaded
#labelImage: #(#ResourceRetriever nil #leftMouseKeyIcon)
- #indication: #mouseKeyColorMode:value:
+ #choice: #mouseKeyColorMode
+ #choiceValue: 1
)
#(#MenuItem
#label: 'Right Mouse Button'
#nameKey: #rightMouseKeyButton
#activeHelpKey: #mouseKeyColorMode
- #argument: '2'
+ #enabled: #imageIsLoaded
#labelImage: #(#ResourceRetriever nil #rightMouseKeyIcon)
- #indication: #mouseKeyColorMode:value:
+ #choice: #mouseKeyColorMode
+ #choiceValue: 2
)
) nil
nil
@@ -1067,50 +1081,50 @@
#label: 'Point'
#activeHelpKey: #drawModePoint
#enabled: #imageIsLoaded
- #argument: 'point'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #point
)
#(#MenuItem
#label: 'Box'
#activeHelpKey: #drawModeBox
#enabled: #imageIsLoaded
- #argument: 'box'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #box
)
#(#MenuItem
#label: 'Filled Box'
#activeHelpKey: #drawModeFilledBox
#enabled: #imageIsLoaded
- #argument: 'filledBox'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #filledBox
)
#(#MenuItem
#label: 'Fill'
#activeHelpKey: #drawModeFill
#enabled: #imageIsLoaded
- #argument: 'fill'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #fill
)
#(#MenuItem
#label: 'Copy'
#activeHelpKey: #drawModeCopy
#enabled: #imageIsLoaded
- #argument: 'copy'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #copy
)
#(#MenuItem
#label: 'Paste'
#activeHelpKey: #drawModePaste
#enabled: #imageIsLoaded
- #argument: 'paste'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #paste
)
#(#MenuItem
#label: 'Paste Under'
#activeHelpKey: #drawModePasteUnder
#enabled: #imageIsLoaded
- #argument: 'pasteUnder'
- #indication: #editMode:value:
+ #choice: #editMode
+ #choiceValue: #pasteUnder
)
) nil
nil
@@ -1253,19 +1267,22 @@
findColorMapMode
"finds the colorMapMode for a new image"
- self image depth > 8 ifTrue: [colorMapMode := ''. self listOfColors removeAll. ^nil].
- colorMapMode := self image depth printString, '-plane'.
+ self image depth > 8 ifTrue: [colorMapMode value: ''. self listOfColors removeAll. ^nil].
+
+ colorMapMode setValue: self image depth printString, '-plane'.
+
self listOfColors isEmpty
ifTrue:
[
- self colorMapMode: colorMapMode value: nil
+ self colorMapMode: colorMapMode value
].
imageEditView selectColors: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2 ifAbsent: [self listOfColors at: 1])).
self image mask notNil
ifTrue:
- [
- colorMapMode := colorMapMode, ' + mask'.
+ [
+ colorMapMode setValue: colorMapMode value, ' + mask'.
+
(self listOfColors detect: [:clr| clr = (Color basicNew setColorId:0)] ifNone: nil) isNil
ifTrue:
[
@@ -1524,45 +1541,44 @@
!ImageEditor methodsFor:'menu modes'!
-colorMapMode: aMode
- "returns whether colorMapMode is equal to aMode"
+colorMapMode
+ "returns colorMapMode"
- ^colorMapMode = aMode
-!
+ colorMapMode isNil ifTrue: [colorMapMode := '' asValue].
-editMode: aMode
- "returns whether editMode is equal to aMode"
-
- ^ imageEditView notNil and:[imageEditView editMode = aMode]
+ ^colorMapMode
!
-editMode: aMode value: aValue
- "sets the editMode to aMode"
+editMode
+ "returns editMode"
- imageEditView editMode: aMode
+ editMode isNil
+ ifTrue:
+ [
+ editMode := #point asValue.
+ editMode onChangeSend: #value to: [imageEditView editMode: editMode value]
+ ].
+
+ ^editMode
!
-mouseKeyColorMode: aMode
- "sets the mouseKeyColorMode to aMode"
+mouseKeyColorMode
+ "returns mouseKeyColorMode"
- imageEditView isNil ifTrue:[
- ^ true
+ mouseKeyColorMode isNil
+ ifTrue:
+ [
+ mouseKeyColorMode := 1 asValue.
+ mouseKeyColorMode onChangeSend: #value to: [imageEditView mouseKeyColorMode: mouseKeyColorMode value. self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).]
].
- ^imageEditView mouseKeyColorMode = aMode
-!
-mouseKeyColorMode: aMode value: aValue
- "sets the mouseKeyColorMode to aMode"
-
- imageEditView mouseKeyColorMode: aMode.
-
- self selectionOfColor value: (self listOfColors indexOf: imageEditView selectedColor).
+ ^mouseKeyColorMode
! !
!ImageEditor methodsFor:'queries'!
hasMask
- ^ colorMapMode notNil and:[colorMapMode endsWith:'mask']
+ ^ colorMapMode notNil and:[colorMapMode value endsWith:'mask']
"Created: / 18.8.1998 / 17:17:38 / cg"
!
@@ -1622,7 +1638,8 @@
super open.
imageEditView := (builder componentAt: #imageEditView) subViews first.
- imageEditView masterApplication: self
+ imageEditView masterApplication: self.
+
!
postOpenWith:aBuilder
@@ -1659,7 +1676,7 @@
"Modified: / 18.8.1998 / 17:08:55 / cg"
!
-colorMapMode:aMode value: aValue
+colorMapMode:aMode
"calculates a new color map for the image from aMode"
|depth numColors newColorMap newImage
@@ -1678,7 +1695,7 @@
] ifFalse:[
quest := 'Keep colormap (or use standard)'
].
- ((colorMapMode == aMode)
+ ((colorMapMode value = aMode)
or:[self confirm:(resources string:quest)]) ifTrue:[
"/ keep the colormap
depth > oldImage depth ifTrue:[
@@ -1815,8 +1832,7 @@
newColors add: clr
]
].
- image colorMap: newColors.
- colorMapMode := aMode.
+ image colorMap: newColors.
(imageEditView image: image) notNil ifTrue:
[
@@ -2068,11 +2084,11 @@
width := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value upTo: $x) onError:[24]).
height := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value copy reverse upTo: $x) reverse onError:[24]).
- cMap := (self class listOfColorMaps at: (colorMapMode := (aspects at:#selectionOfColorMap) value)).
+ cMap := (self class listOfColorMaps at: (colorMapMode value: (aspects at:#selectionOfColorMap) value) value).
imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger).
image := imageClass width: width height: height fromArray: (ByteArray new: width*height).
- (colorMapMode copy reverse readStream nextWord reverse = 'mask')
+ (colorMapMode value endsWith: 'mask')
ifTrue:
[
image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels