checkin from browser
authorClaus Gittinger <cg@exept.de>
Tue, 04 Jun 1996 21:20:18 +0200
changeset 747 54cd4d5f9e66
parent 746 4442a4d4121f
child 748 d73bf4e4382e
checkin from browser
ObjView.st
ObjectView.st
--- a/ObjView.st	Tue Jun 04 20:32:31 1996 +0200
+++ b/ObjView.st	Tue Jun 04 21:20:18 1996 +0200
@@ -1629,6 +1629,34 @@
     ]
 !
 
+alignHorizontal:something
+    "align selection along their center horizontally"
+
+    |topMost bottomMost h|
+
+    topMost := 999999.
+    bottomMost := -999999.
+    self forEach:something do:[:anObject |
+        |f|
+        f := anObject frame.
+        topMost := topMost min:(f top).
+        bottomMost := bottomMost max:(f bottom).
+    ].
+    h := bottomMost - topMost.
+
+    self withSelectionHiddenDo:[
+        self forEach:something do:[:anObject |
+            self moveObject:anObject 
+                         to:(anObject frame left)
+                            @
+                            (topMost + ((h - anObject frame height) // 2))
+        ]
+    ]
+
+    "Created: 4.6.1996 / 20:01:19 / cg"
+    "Modified: 4.6.1996 / 21:19:48 / cg"
+!
+
 alignLeft:something
     |leftMost|
 
@@ -1672,6 +1700,34 @@
     ]
 !
 
+alignVertical:something
+    "align selection along their center vertically"
+
+    |leftMost rightMost w|
+
+    leftMost := 999999.
+    rightMost := -999999.
+    self forEach:something do:[:anObject |
+        |f|
+        f := anObject frame.
+        rightMost := rightMost max:(f right).
+        leftMost := leftMost min:(f left).
+    ].
+    w := rightMost - leftMost.
+
+    self withSelectionHiddenDo:[
+        self forEach:something do:[:anObject |
+            self moveObject:anObject 
+                         to:(leftMost + ((w - anObject frame width) // 2))
+                            @
+                            (anObject frame top)
+        ]
+    ]
+
+    "Created: 4.6.1996 / 19:59:16 / cg"
+    "Modified: 4.6.1996 / 21:19:58 / cg"
+!
+
 move:something by:delta
     "change the position of something, an Object or Collection 
      by delta, aPoint"
@@ -1829,6 +1885,15 @@
     self alignBottom:selection
 !
 
+selectionAlignHorizontal
+    "align selected objects horizontally"
+
+    self alignHorizontal:selection
+
+    "Created: 4.6.1996 / 19:58:46 / cg"
+    "Modified: 4.6.1996 / 19:59:10 / cg"
+!
+
 selectionAlignLeft
     "align selected objects left"
 
@@ -1847,6 +1912,14 @@
     self alignTop:selection
 !
 
+selectionAlignVertical
+    "align selected objects vertically"
+
+    self alignVertical:selection
+
+    "Created: 4.6.1996 / 19:59:00 / cg"
+!
+
 selectionToBack
     "bring the selection to back"
 
@@ -2806,5 +2879,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ObjView.st,v 1.45 1996-06-03 08:02:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/ObjView.st,v 1.46 1996-06-04 19:20:18 cg Exp $'
 ! !
--- a/ObjectView.st	Tue Jun 04 20:32:31 1996 +0200
+++ b/ObjectView.st	Tue Jun 04 21:20:18 1996 +0200
@@ -1629,6 +1629,34 @@
     ]
 !
 
+alignHorizontal:something
+    "align selection along their center horizontally"
+
+    |topMost bottomMost h|
+
+    topMost := 999999.
+    bottomMost := -999999.
+    self forEach:something do:[:anObject |
+        |f|
+        f := anObject frame.
+        topMost := topMost min:(f top).
+        bottomMost := bottomMost max:(f bottom).
+    ].
+    h := bottomMost - topMost.
+
+    self withSelectionHiddenDo:[
+        self forEach:something do:[:anObject |
+            self moveObject:anObject 
+                         to:(anObject frame left)
+                            @
+                            (topMost + ((h - anObject frame height) // 2))
+        ]
+    ]
+
+    "Created: 4.6.1996 / 20:01:19 / cg"
+    "Modified: 4.6.1996 / 21:19:48 / cg"
+!
+
 alignLeft:something
     |leftMost|
 
@@ -1672,6 +1700,34 @@
     ]
 !
 
+alignVertical:something
+    "align selection along their center vertically"
+
+    |leftMost rightMost w|
+
+    leftMost := 999999.
+    rightMost := -999999.
+    self forEach:something do:[:anObject |
+        |f|
+        f := anObject frame.
+        rightMost := rightMost max:(f right).
+        leftMost := leftMost min:(f left).
+    ].
+    w := rightMost - leftMost.
+
+    self withSelectionHiddenDo:[
+        self forEach:something do:[:anObject |
+            self moveObject:anObject 
+                         to:(leftMost + ((w - anObject frame width) // 2))
+                            @
+                            (anObject frame top)
+        ]
+    ]
+
+    "Created: 4.6.1996 / 19:59:16 / cg"
+    "Modified: 4.6.1996 / 21:19:58 / cg"
+!
+
 move:something by:delta
     "change the position of something, an Object or Collection 
      by delta, aPoint"
@@ -1829,6 +1885,15 @@
     self alignBottom:selection
 !
 
+selectionAlignHorizontal
+    "align selected objects horizontally"
+
+    self alignHorizontal:selection
+
+    "Created: 4.6.1996 / 19:58:46 / cg"
+    "Modified: 4.6.1996 / 19:59:10 / cg"
+!
+
 selectionAlignLeft
     "align selected objects left"
 
@@ -1847,6 +1912,14 @@
     self alignTop:selection
 !
 
+selectionAlignVertical
+    "align selected objects vertically"
+
+    self alignVertical:selection
+
+    "Created: 4.6.1996 / 19:59:00 / cg"
+!
+
 selectionToBack
     "bring the selection to back"
 
@@ -2806,5 +2879,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.45 1996-06-03 08:02:56 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.46 1996-06-04 19:20:18 cg Exp $'
 ! !