--- a/ImageEditor.st Wed Jul 29 18:13:00 1998 +0200
+++ b/ImageEditor.st Wed Jul 29 19:36:07 1998 +0200
@@ -11,10 +11,10 @@
"
ToolApplicationModel subclass:#ImageEditor
- instanceVariableNames:'imageEditView colorMapMode selectedColorIndex postOpenAction'
- classVariableNames:''
- poolDictionaries:''
- category:'Interface-UIPainter'
+ instanceVariableNames:'imageEditView colorMapMode selectedColorIndex postOpenAction'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Interface-UIPainter'
!
!ImageEditor class methodsFor:'documentation'!
@@ -249,6 +249,9 @@
#fileSaveMethodAs
'Save the image as resource method in a class.'
+#historyMenuItem
+'Edit this image.'
+
#magnificationNumber
'Shows the current magnification.'
@@ -268,6 +271,8 @@
'Change the grid magnification of the edit view.'
)
+
+ "Modified: / 29.7.1998 / 18:42:52 / cg"
! !
!ImageEditor class methodsFor:'image specs'!
@@ -422,11 +427,11 @@
#window:
#(#WindowSpec
#name: 'Image Editor'
- #layout: #(#LayoutFrame 176 0 156 0 675 0 501 0)
+ #layout: #(#LayoutFrame 216 0 173 0 715 0 518 0)
#label: 'Image Editor'
#min: #(#Point 400 320)
#max: #(#Point 1152 900)
- #bounds: #(#Rectangle 176 156 676 502)
+ #bounds: #(#Rectangle 216 173 716 519)
#menu: #menu
#usePreferredExtent: false
)
@@ -482,7 +487,6 @@
#hasVerticalScrollBar: true
#miniScrollerHorizontal: true
#miniScrollerVertical: true
- "/ #level: -1
#dataList: #listOfColors
#has3Dsepartors: true
#has3Dseparators: true
@@ -551,6 +555,7 @@
#(#LabelSpec
#name: 'coordLabel'
#layout: #(#LayoutFrame 2 0.0 -22 1 -83 1.0 0 1.0)
+ #labelChannel: #imageInfoHolder
#level: -1
#adjust: #left
#resizeForLabel: false
@@ -604,7 +609,7 @@
)
)
- "Modified: / 27.7.1998 / 17:41:55 / cg"
+ "Modified: / 29.7.1998 / 18:31:38 / cg"
! !
!ImageEditor class methodsFor:'menu specs'!
@@ -1103,12 +1108,28 @@
!ImageEditor methodsFor:'aspects'!
+activityInfoHolder
+ ^ self valueOfInfoLabel
+
+ "Modified: / 29.7.1998 / 18:49:03 / cg"
+!
+
colorColumnAdaptor
^ self
"Created: / 26.7.1998 / 12:17:03 / cg"
!
+imageInfoHolder
+ |holder|
+ (holder := builder bindingAt:#imageInfoHolder) isNil ifTrue:[
+ builder aspectAt:#imageInfoHolder put:(holder := '' asValue).
+ ].
+ ^ holder
+
+ "Modified: / 29.7.1998 / 18:32:08 / cg"
+!
+
imageIsLoaded
"returns whether an image is loaded as value holder"
@@ -1361,8 +1382,7 @@
editMode: aMode
"returns whether editMode is equal to aMode"
- imageEditView isNil ifTrue: [^false].
- ^imageEditView editMode = aMode
+ ^ imageEditView notNil and:[imageEditView editMode = aMode]
!
editMode: aMode value: aValue
@@ -1450,11 +1470,14 @@
evaluate the postOpenAction"
imageEditView masterApplication: self.
+ imageEditView imageInfoHolder:(self imageInfoHolder).
+ imageEditView activityInfoHolder:(self activityInfoHolder).
+
postOpenAction notNil ifTrue: [postOpenAction value].
super postOpenWith:aBuilder
- "Modified: / 26.7.1998 / 12:32:55 / cg"
+ "Modified: / 29.7.1998 / 18:49:20 / cg"
! !
!ImageEditor methodsFor:'user actions - colormap'!
@@ -1464,7 +1487,7 @@
|depth numColors newColorMap newImage
oldImage image newColors realColorMap oldFileName
- usedColors useNearest usageCounts tmpBits tmpMap|
+ usedColors useNearest usageCounts tmpBits tmpMap quest|
self withExecuteCursorDo:[
oldImage := self image.
@@ -1473,7 +1496,12 @@
depth := (newColorMap size log: 2) asInteger.
useNearest := false.
- (self confirm:'Keep colormap (or use standard)') ifTrue:[
+ depth == 1 ifTrue:[
+ quest := 'Keep colormap (or use standard B&W)'
+ ] ifFalse:[
+ quest := 'Keep colormap (or use standard)'
+ ].
+ (self confirm:(resources string:quest)) ifTrue:[
"/ keep the colormap
depth > oldImage depth ifTrue:[
"/ easy - simply copy the part
@@ -1514,10 +1542,11 @@
].
useNearest := Dialog
- confirmWithCancel:('Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to black) ?'
- bindWith:usedColors size
- with:(1 bitShift:depth)) withCRs
- labels:#('cancel' 'black' 'nearest').
+ confirmWithCancel:(resources
+ string:'Image requires %1 colors.\ColorMap has only space for %2\\Use nearest (or map to first color) ?'
+ with:usedColors size
+ with:(1 bitShift:depth)) withCRs
+ labels:(resources array:#('cancel' 'first' 'nearest')).
useNearest isNil ifTrue:[
^ self "/ cancel
].
@@ -1528,9 +1557,10 @@
usedColors := oldImage usedColors.
(usedColors conform:[:clr | newColorMap includes:clr]) ifFalse:[
useNearest := Dialog
- confirmWithCancel:('Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to black) ?'
+ confirmWithCancel:(resources
+ string:'Not all colors are present in the new colormap.\\Map missing ones to nearest (or map to first color) ?'
) withCRs
- labels:#('cancel' 'black' 'nearest').
+ labels:(resources string:#('cancel' 'first' 'nearest')).
useNearest isNil ifTrue:[
^ self "/ cancel
].
@@ -1547,7 +1577,7 @@
Object errorSignal handle:
[:ex|
imageEditView undo.
- ^self warn: 'Conversion failed!!'
+ ^self warn:(resources string:'Conversion failed !!')
]
do:
[
@@ -1619,7 +1649,7 @@
]
]
- "Modified: / 28.7.1998 / 22:29:53 / cg"
+ "Modified: / 29.7.1998 / 18:15:10 / cg"
!
compressColorMap