*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 17 Mar 1999 16:31:03 +0100
changeset 1057 36f9d47e1249
parent 1056 bd9a9fc7a7fc
child 1058 243d945b1daf
*** empty log message ***
ImageEditor.st
--- a/ImageEditor.st	Sat Mar 13 13:52:22 1999 +0100
+++ b/ImageEditor.st	Wed Mar 17 16:31:03 1999 +0100
@@ -84,7 +84,14 @@
      self openOnClass: self andSelector: #leftMouseKeyIcon
     "
 
-    ^self open loadFromMessage: aClass name, ' ', aSelector
+    |editor|
+
+    editor := self new.
+    editor allButOpen.
+    editor loadFromMessage: aClass name, ' ', aSelector.
+    editor openWindow
+
+    "Modified: / 16.3.1999 / 21:33:49 / cg"
 !
 
 openOnFile: aFileName
@@ -93,7 +100,14 @@
      self openOnFile: 'bitmaps/SmalltalkX.xbm'
     "
 
-    ^self open loadFromFile: aFileName
+    |editor|
+
+    editor := self new.
+    editor allButOpen.
+    editor loadFromFile: aFileName.
+    editor openWindow
+
+    "Modified: / 16.3.1999 / 21:33:25 / cg"
 !
 
 openOnImage: anImage
@@ -1740,24 +1754,25 @@
                 ].
                 self findColorMapMode.     
                 self updateLabelsAndHistory.
+                imageEditView image:img.
             ] ifFalse:[
                 self updateForNoImage
-            ]
+            ].
+            self imagePreView image:img.
         ]
     ]
 
-    "Modified: / 18.8.1998 / 17:03:54 / cg"
+    "Modified: / 16.3.1999 / 21:44:26 / cg"
 !
 
 loadFromImage:anImage
     "loads an image from anImage and sets up color map list and other info labels"
 
-    |img|
-
     imageEditView image:anImage.
-    (img := self image) notNil ifTrue:[    
-        img colorMap notNil ifTrue:[
-            self listOfColors contents:(img usedColors asSet asOrderedCollection).
+    self imagePreView image: anImage.
+    anImage notNil ifTrue:[    
+        anImage colorMap notNil ifTrue:[
+            self listOfColors contents:(anImage usedColors asSet asOrderedCollection).
         ] ifFalse:[
             self listOfColors removeAll.
         ].
@@ -1767,7 +1782,7 @@
         self updateForNoImage
     ]
 
-    "Modified: / 18.8.1998 / 17:04:46 / cg"
+    "Modified: / 16.3.1999 / 21:43:56 / cg"
 !
 
 loadFromMessage: aMessage
@@ -1780,12 +1795,14 @@
             self listOfColors contents:(img usedColors asSet asOrderedCollection).
             self findColorMapMode.
             self updateLabelsAndHistory.
+            imageEditView image:img.
+            self imagePreView image:img.
         ] ifFalse:[
             self updateForNoImage
         ]
     ]
 
-    "Modified: / 18.8.1998 / 17:03:01 / cg"
+    "Modified: / 16.3.1999 / 21:44:41 / cg"
 !
 
 loadFromOrPrepareForMessage: aMessage
@@ -1804,6 +1821,9 @@
         imageEditView resourceMessage: aMessage.
     ].
     self updateLabelsAndHistory.
+    self imagePreView image:(self image).
+
+    "Modified: / 16.3.1999 / 21:45:07 / cg"
 ! !
 
 !ImageEditor methodsFor:'menu modes'!
@@ -1940,7 +1960,7 @@
 !ImageEditor methodsFor:'user actions - colormap'!
 
 addColorToColormap
-    |depth img cMap newColorMap newImage oldCListSize|
+    |depth img cMap newColorMap newImage oldCListSize newMode|
 
     img := self image.
     depth := img depth.
@@ -1959,11 +1979,16 @@
         (self confirm:'No space for more colors in colormap.\Change depth first.' withCRs)
         ifFalse:[
             ^ self
-        ]
+        ].
+
+        imageEditView makeUndo.
+        newMode := (depth*2) printString , (colorMapMode value copyFrom:2).
+        self colorMapMode:newMode.
+    ] ifFalse:[
+        imageEditView makeUndo.
     ].
 
-    imageEditView makeUndo.
-
+self halt.
     cMap := cMap asArray.
     oldCListSize := self listOfColors size.
 
@@ -2002,7 +2027,7 @@
     ]
 
     "Created: / 12.3.1999 / 00:20:28 / cg"
-    "Modified: / 12.3.1999 / 02:09:01 / cg"
+    "Modified: / 16.3.1999 / 21:57:26 / cg"
 !
 
 colorMapChanged
@@ -2052,7 +2077,8 @@
             ]
         ].
         ((prevMode = aMode)
-        or:[self confirm:(resources string:quest)]) ifTrue:[
+        or:[depth > oldImage depth
+        or:[self confirm:(resources string:quest)]]) ifTrue:[
 
             "/ keep the colormap
             newColorMap atAllPut:Color black.
@@ -2202,7 +2228,7 @@
         ]
     ]
 
-    "Modified: / 11.3.1999 / 16:20:09 / cg"
+    "Modified: / 16.3.1999 / 21:55:39 / cg"
 !
 
 compressColorMap