recompute property list when changing view ordering by
authorca
Sun, 29 Jun 1997 10:15:24 +0200
changeset 194 2b05bd327785
parent 193 450d9e5c6f4a
child 195 350f95af5d9d
recompute property list when changing view ordering by lower or raise
UIObjectView.st
UIPainter.st
UIPainterView.st
--- a/UIObjectView.st	Sat Jun 28 15:13:50 1997 +0200
+++ b/UIObjectView.st	Sun Jun 29 10:15:24 1997 +0200
@@ -1420,25 +1420,6 @@
 
 ! !
 
-!UIObjectView methodsFor:'user actions - arrange'!
-
-lowerSelection
-    "lower all objects in the selection
-    "
-    self selectionDo:[:aView| aView lower ].
-
-
-!
-
-raiseSelection
-    "raise all objects in the selection
-    "
-    self selectionDo:[:aView| aView raise ].
-    inputView raise.
-
-
-! !
-
 !UIObjectView methodsFor:'user actions - dimension'!
 
 copyExtent
--- a/UIPainter.st	Sat Jun 28 15:13:50 1997 +0200
+++ b/UIPainter.st	Sun Jun 29 10:15:24 1997 +0200
@@ -130,6 +130,55 @@
 'align selected components vertical to the center of
 the dominant component ( underlined )'
 
+#spreadSelectionVer
+'vertical spacing between selected components is made the same'
+
+#spreadSelectionHor
+'horizontal spacing between selected components is made the same'
+
+#centerSelectionHor
+'center components horizontal in contained view'
+
+#centerSelectionVer
+'center vertical horizontal in contained view'
+
+#setToDefaultExtent
+'set selected components to their default extent'
+
+#setToDefaultWidth
+'set selected components to their default width'
+
+#setToDefaultHeight
+'set selected components to their default height'
+
+#copyExtent
+'copy extent of the selected component'
+
+#pasteExtent
+'change extent of all selected components to the
+last copied extent'
+
+#pasteWidth
+'change width of all selected components to the
+last copied extent width'
+
+#pasteHeight
+'change height of all selected components to the
+last copied extent height'
+
+#copyLayout
+'copy layout of the selected component'
+
+#pasteLayout
+'change layout of all selected components to the
+last copied layout'
+
+#pasteBuffer
+'paste components at current mouse position'
+
+#pasteWithLayout
+'paste components without changing their layouts'
+
 )
 
 
--- a/UIPainterView.st	Sat Jun 28 15:13:50 1997 +0200
+++ b/UIPainterView.st	Sun Jun 29 10:15:24 1997 +0200
@@ -97,10 +97,12 @@
                                         #'label:' 'paste'
                                         #'value:' #pasteBuffer
                                         #'shortcutKeyCharacter:' #Paste
+                                        #'activeHelpKey:' #pasteBuffer
                                  )
                                 #(#MenuItem
                                         #'label:' 'keep layout'
                                         #'value:' #pasteWithLayout
+                                        #'activeHelpKey:' #pasteWithLayout
                                  )
                                 )
                                 nil 
@@ -137,38 +139,47 @@
                                 #(#MenuItem
                                         #'label:' 'default extent'
                                         #'value:' #setToDefaultExtent
+                                        #'activeHelpKey:' #setToDefaultExtent
                                  )
                                 #(#MenuItem
                                         #'label:' 'default width'
                                         #'value:' #setToDefaultWidth
+                                        #'activeHelpKey:' #setToDefaultWidth
                                  )
                                 #(#MenuItem
                                         #'label:' 'default height'
                                         #'value:' #setToDefaultHeight
+                                        #'activeHelpKey:' #setToDefaultHeight
                                  )
                                 #(#MenuItem
                                         #'label:' 'copy extent'
                                         #'value:' #copyExtent
+                                        #'activeHelpKey:' #copyExtent
                                  )
                                 #(#MenuItem
                                         #'label:' 'paste extent'
                                         #'value:' #pasteExtent
+                                        #'activeHelpKey:' #pasteExtent
                                  )
                                 #(#MenuItem
                                         #'label:' 'paste width'
                                         #'value:' #pasteWidth
+                                        #'activeHelpKey:' #pasteWidth
                                  )
                                 #(#MenuItem
                                         #'label:' 'paste height'
                                         #'value:' #pasteHeight
+                                        #'activeHelpKey:' #pasteHeight
                                  )
                                 #(#MenuItem
                                         #'label:' 'copy  layout'
                                         #'value:' #copyLayout
+                                        #'activeHelpKey:' #copyLayout
                                  )
                                 #(#MenuItem
                                         #'label:' 'paste layout'
                                         #'value:' #pasteLayout
+                                        #'activeHelpKey:' #pasteLayout
                                  )
                                 )
                                 #(3 1 3) 
@@ -223,18 +234,22 @@
                                 #(#MenuItem
                                         #'label:' 'spread horizontal'
                                         #'value:' #spreadSelectionHor
+                                        #'activeHelpKey:' #spreadSelectionHor
                                  )
                                 #(#MenuItem
                                         #'label:' 'spread vertical'
                                         #'value:' #spreadSelectionVer
+                                        #'activeHelpKey:' #spreadSelectionVer
                                  )
                                 #(#MenuItem
                                         #'label:' 'center horizontal in frame'
                                         #'value:' #centerSelectionHor
+                                        #'activeHelpKey:' #centerSelectionHor
                                  )
                                 #(#MenuItem
                                         #'label:' 'center vertical in frame'
                                         #'value:' #centerSelectionVer
+                                        #'activeHelpKey:' #centerSelectionVer
                                  )
                                 )
                                #(8 2)
@@ -1203,6 +1218,38 @@
 
 ! !
 
+!UIPainterView methodsFor:'user actions - arrange'!
+
+lowerSelection
+    "lower all objects in the selection
+    "
+    self hasSelection ifTrue:[
+        self selectionDo:[:aView|
+            aView lower.
+            aView superView changeSequenceOrderFor:aView to:1.
+        ].
+        listHolder recompute.
+    ]
+
+
+!
+
+raiseSelection
+    "raise all objects in the selection
+    "
+    self hasSelection ifTrue:[
+        self selectionDo:[:aView||sv|
+            aView raise.
+            sv := aView superView.
+            sv changeSequenceOrderFor:aView to:(sv subViews size)
+        ].
+        inputView raise.
+        listHolder recompute.
+    ].
+
+
+! !
+
 !UIPainterView::ListHolder class methodsFor:'instance creation'!
 
 for:aPainter
@@ -1400,6 +1447,29 @@
     ]
 ! !
 
+!UIPainterView::ListHolder methodsFor:'recomputing'!
+
+recompute
+    |list prop size osel|
+
+    osel := self selection copy.
+    size := self list size.
+    list := OrderedCollection new:size.
+    prop := OrderedCollection new:size.
+
+    painter allSubViewsDo:[:v|
+        size := self indexOfView:v.
+
+        size ~~ 0 ifTrue:[
+            list add:(self list at:size).
+            prop add:(propertyList at:size)
+        ]
+    ].
+    propertyList := prop.
+    self list:list.
+    self selection:osel.
+! !
+
 !UIPainterView::ListHolder methodsFor:'searching'!
 
 detectProperty:aBlock
@@ -1465,6 +1535,16 @@
 
 !
 
+indexOfView:aView
+    "returns index assigned to a view or 0
+    "
+    aView notNil ifTrue:[
+        ^ propertyList findFirst:[:p| p view == aView ]
+    ].
+    ^ 0
+
+!
+
 lastInGroupStartingAt:start
     "returns last index of a group
     "