*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Wed, 22 Aug 2001 18:39:03 +0200
changeset 1479 18f7b6cc2514
parent 1478 0d8a60f17338
child 1480 43c18932d2e8
*** empty log message ***
ImageEditor.st
--- a/ImageEditor.st	Tue Aug 21 17:52:48 2001 +0200
+++ b/ImageEditor.st	Wed Aug 22 18:39:03 2001 +0200
@@ -1062,6 +1062,12 @@
                   #activeHelpKey: #editMagnifyImage
                 )
                #(#MenuItem
+                  #label: 'Magnify By...'
+                  #translateLabel: true
+                  #value: #doMagnifyImageBy
+                  #activeHelpKey: #editMagnifyImage
+                )
+               #(#MenuItem
                   #label: 'Rotate...'
                   #translateLabel: true
                   #value: #doRotateImage
@@ -2854,7 +2860,7 @@
 !
 
 doMagnifyImage
-    "magnifies current image"
+    "magnifies the current image to a new size"
 
     |box newSize image|
 
@@ -2869,6 +2875,39 @@
     (box accepted 
     and: [(newSize := Object readFromString:(box contents) onError:nil) notNil])
     ifTrue:[
+        newSize isPoint ifFalse:[
+            self warn:'please enter the new size as ''x @ y''.'.
+            ^ self.    
+        ].
+        imageEditView magnifyImageTo:newSize.
+    ].
+
+    self updateInfoLabel
+!
+
+doMagnifyImageBy
+    "magnifies the current image (by a scale)"
+
+    |box oldSize newSize scale image|
+
+    image := imageEditView image.
+    oldSize := image extent.
+
+    box := EnterBox new.
+    box title:(resources string:'Scale factor (<1 to shrink; >1 to magnify):').
+    box okText:(resources string:'OK').
+    box abortText:(resources string:'Cancel').
+    box initialText:1 printString.
+    box showAtPointer.
+
+    (box accepted 
+    and: [(scale := Object readFromString:(box contents) onError:nil) notNil])
+    ifTrue:[
+        scale isNumber ifFalse:[
+            self warn:'please enter a scale factor (<1 to shrink; >1 to magnify).'.
+            ^ self.    
+        ].
+        newSize := oldSize * scale.
         imageEditView magnifyImageTo:newSize.
     ].