ImageEditor.st
changeset 405 8546da96ab11
parent 401 30ecf82e3ae7
child 415 f792d83774b3
--- a/ImageEditor.st	Sat Jan 10 11:53:03 1998 +0100
+++ b/ImageEditor.st	Sat Jan 10 12:06:28 1998 +0100
@@ -4,9 +4,9 @@
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
+ inclusion of the above copyright notice. This software may not
  be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
+ other person. No title to or ownership of the software is
  hereby transferred.
 "
 
@@ -26,9 +26,9 @@
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
- inclusion of the above copyright notice.   This software may not
+ inclusion of the above copyright notice. This software may not
  be provided or otherwise made available to, or used by, any
- other person.  No title to or ownership of the software is
+ other person. No title to or ownership of the software is
  hereby transferred.
 "
 !
@@ -524,11 +524,11 @@
           #'window:' 
            #(#WindowSpec
               #'name:' 'Image Editor'
-              #'layout:' #(#LayoutFrame 364 0 199 0 863 0 544 0)
+              #'layout:' #(#LayoutFrame 368 0 254 0 867 0 599 0)
               #'label:' 'Image Editor'
               #'min:' #(#Point 400 320)
               #'max:' #(#Point 1152 900)
-              #'bounds:' #(#Rectangle 364 199 864 545)
+              #'bounds:' #(#Rectangle 368 254 868 600)
               #'menu:' #menu
               #'usePreferredExtent:' false
           )
@@ -652,7 +652,7 @@
                                     )
                                      #(#VerticalPanelViewSpec
                                         #'name:' 'verticalPanelView1'
-                                        #'layout:' #(#LayoutFrame 1 0.0 -68 1 70 0 0 1.0)
+                                        #'layout:' #(#LayoutFrame 1 0.0 -68 1 83 0 0 1.0)
                                         #'component:' 
                                          #(#SpecCollection
                                             #'collection:' 
@@ -661,19 +661,19 @@
                                                   #'name:' 'classNameLabel'
                                                   #'label:' 'Class:'
                                                   #'adjust:' #right
-                                                  #'extent:' #(#Point 69 21)
+                                                  #'extent:' #(#Point 82 21)
                                               )
                                                #(#LabelSpec
                                                   #'name:' 'selectorLabel'
                                                   #'label:' 'Selector:'
                                                   #'adjust:' #right
-                                                  #'extent:' #(#Point 69 20)
+                                                  #'extent:' #(#Point 82 20)
                                               )
                                                #(#LabelSpec
                                                   #'name:' 'fileNameLabel'
                                                   #'label:' 'File Name:'
                                                   #'adjust:' #right
-                                                  #'extent:' #(#Point 69 21)
+                                                  #'extent:' #(#Point 82 21)
                                               )
                                             )
                                         )
@@ -684,7 +684,7 @@
                                     )
                                      #(#VerticalPanelViewSpec
                                         #'name:' 'verticalPanelView2'
-                                        #'layout:' #(#LayoutFrame 72 0.0 -68 1 -6 1 0 1.0)
+                                        #'layout:' #(#LayoutFrame 85 0.0 -68 1 -6 1 0 1.0)
                                         #'component:' 
                                          #(#SpecCollection
                                             #'collection:' 
@@ -694,7 +694,7 @@
                                                   #'activeHelpKey:' #classNameInputField
                                                   #'model:' #valueOfResourceClass
                                                   #'immediateAccept:' false
-                                                  #'extent:' #(#Point 142 21)
+                                                  #'extent:' #(#Point 129 21)
                                               )
                                                #(#InputFieldSpec
                                                   #'name:' 'resourceSelectorInputField'
@@ -702,7 +702,7 @@
                                                   #'model:' #valueOfResourceSelector
                                                   #'immediateAccept:' false
                                                   #'acceptOnTab:' false
-                                                  #'extent:' #(#Point 142 20)
+                                                  #'extent:' #(#Point 129 20)
                                               )
                                                #(#InputFieldSpec
                                                   #'name:' 'fileNameInputField'
@@ -710,7 +710,7 @@
                                                   #'model:' #valueOfFileName
                                                   #'immediateAccept:' false
                                                   #'acceptOnTab:' false
-                                                  #'extent:' #(#Point 142 21)
+                                                  #'extent:' #(#Point 129 21)
                                               )
                                             )
                                         )
@@ -764,14 +764,14 @@
                 )
                  #(#LabelSpec
                     #'name:' 'timeLabel'
-                    #'layout:' #(#LayoutFrame -65 1 -22 1 0 1.0 0 1.0)
+                    #'layout:' #(#LayoutFrame -80 1 -22 1 0 1.0 0 1.0)
                     #'labelChannel:' #valueOfTimeLabel
                     #'level:' 1
                     #'adjust:' #right
                 )
                  #(#LabelSpec
                     #'name:' 'coordLabel'
-                    #'layout:' #(#LayoutFrame -170 1 -22 1 -65 1 0 1.0)
+                    #'layout:' #(#LayoutFrame -170 1 -22 1 -80 1 0 1.0)
                     #'labelChannel:' #valueOfCoordLabel
                     #'level:' 1
                     #'adjust:' #left
@@ -1114,7 +1114,7 @@
 
 colorMapMode: aMode value: aValue
 
-    |depth newColorMap newImage image newColors oldFileName| 
+    |depth newColorMap newImage image newColors realColorMap oldFileName| 
 
     newColorMap := self class listOfColorMaps at: aMode.
     depth := (newColorMap size log: 2) asInteger. 
@@ -1153,8 +1153,13 @@
     ifFalse:
     [ 
         image mask: nil.
+    ]. 
+    realColorMap := OrderedCollection new.
+    image realColorMap do:
+    [:clr|
+        (realColorMap includes: clr) ifFalse: [realColorMap add: clr]
     ].
-    newColors := (image realColorMap copyFrom: 1 to: (newColorMap size min: image realColorMap size)) asOrderedCollection.
+    newColors := realColorMap copyFrom: 1 to: (newColorMap size min: realColorMap size).
     newColorMap do:
     [:clr|
         ((newColors size < newColorMap size) and: [(newColors includes: clr) not]) 
@@ -1162,7 +1167,7 @@
         [      
             newColors add: clr
         ]
-    ].
+    ].       
     image colorMap: newColors.
     colorMapMode := aMode.
     (self imageEditView image: image) notNil