layout ....
--- a/UIObjectView.st Fri Feb 28 13:25:51 1997 +0100
+++ b/UIObjectView.st Fri Feb 28 18:03:28 1997 +0100
@@ -28,43 +28,66 @@
"convert layout from aView to a frameLayout. On success the frameLayout is
returned otherwise nil
"
- |lF lO rF rO tF tO bF bO layout|
-
- (layout := aView geometryLayout) isNil ifTrue:[
+ |lF lO rF rO tF tO bF bO type layout newLyt|
+
+ type := self layoutType:aView.
+ layout := aView geometryLayout.
+
+ (type isNil or:[layout isNil]) ifTrue:[
^ nil
].
- layout isLayout ifTrue:[
- layout isLayoutFrame ifTrue:[^ layout copy].
-
- lF := layout leftFraction.
- lO := layout leftOffset.
- tF := layout topFraction.
- tO := layout topOffset.
- bF := tF.
- bO := tO + aView extent y.
- rF := lF.
- rO := lO + aView extent x.
- ] ifFalse:[
- lF := rF := tF := bF := 0.
-
- layout isRectangle ifTrue:[
+ type == #LayoutFrame ifTrue:[
+ ^ layout copy
+ ].
+
+ layout isLayout ifFalse:[
+ type == #Rectangle ifTrue:[
lO := layout left.
tO := layout top.
rO := layout right.
bO := layout bottom.
] ifFalse:[
- layout isPoint ifFalse:[ ^ nil ].
-
lO := layout x.
tO := layout y.
rO := lO + aView extent x.
bO := tO + aView extent y.
].
+
+ ^ LayoutFrame leftFraction:0 offset:lO rightFraction:0 offset:rO
+ topFraction:0 offset:tO bottomFraction:0 offset:bO
].
- ^ LayoutFrame leftFraction:lF offset:lO rightFraction:rF offset:rO
- topFraction:tF offset:tO bottomFraction:bF offset:bO
+ lF := layout leftFraction.
+ lO := layout leftOffset.
+ tF := layout topFraction.
+ tO := layout topOffset.
+ bF := tF.
+ bO := tO + aView extent y.
+ rF := lF.
+ rO := lO + aView extent x.
+
+ newLyt := LayoutFrame leftFraction:lF offset:lO rightFraction:rF offset:rO
+ topFraction:tF offset:tO bottomFraction:bF offset:bO.
+
+ ( (type == #AlignmentOrigin)
+ and:[layout leftAlignmentFraction ~~ 0
+ or:[layout topAlignmentFraction ~~ 0]]
+ ) ifTrue:[
+ |svRc prBd dlta|
+
+ svRc := aView superView viewRectangle.
+ prBd := aView preferredBounds.
+ dlta := ( ((layout rectangleRelativeTo:svRc preferred:prBd) corner)
+ - ((newLyt rectangleRelativeTo:svRc preferred:prBd) corner)
+ ) rounded.
+
+ newLyt leftOffset:(lO + dlta x).
+ newLyt rightOffset:(rO + dlta x).
+ newLyt topOffset:(tO + dlta y).
+ newLyt bottomOffset:(bO + dlta y).
+ ].
+ ^ newLyt.
! !
!UIObjectView class methodsFor:'defaults'!
@@ -1608,6 +1631,8 @@
alignFrameLayout:aBlock
"perform block on a frameLayout assigned to the current single selection
"
+ |layout|
+
self transaction:#align selectionDo:[:aView|
layout := self class asLayoutFrameFromView:aView.
--- a/UIPainter.st Fri Feb 28 13:25:51 1997 +0100
+++ b/UIPainter.st Fri Feb 28 18:03:28 1997 +0100
@@ -961,10 +961,14 @@
!
doWindowSpec
- |code v|
+ |code code2 v|
code := workView generateWindowSpecMethodSource.
- code := code , workView generateAspectMethods.
+"/ code2 := workView generateAspectMethods.
+ code2 notNil ifTrue:[
+ code := code , code2.
+ ].
+
v := CodeView open.
v contents:code.
v label:'windowSpec'.
--- a/UIPropertyView.st Fri Feb 28 13:25:51 1997 +0100
+++ b/UIPropertyView.st Fri Feb 28 18:03:28 1997 +0100
@@ -49,7 +49,7 @@
#'name:' 'uIPainterView'
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
#'label:' 'unnamed'
- #'bounds:' #(#Rectangle 0 0 248 304)
+ #'bounds:' #(#Rectangle 0 0 356 379)
)
#'component:'
#(#SpecCollection
@@ -59,7 +59,6 @@
#'name:' 'label9'
#'layout:' #(#AlignmentOrigin 76 0 7 0 1 0)
#'label:' 'Layout:'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #center
@@ -69,7 +68,6 @@
#'name:' 'popUpList1'
#'layout:' #(#LayoutFrame 79 0.0 7 0 -6 1.0 30 0)
#'label:' 'popup'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'model:' #layoutType
#'menu:' #layoutTypeList
@@ -78,7 +76,6 @@
#'name:' 'label2'
#'layout:' #(#AlignmentOrigin 49 0 103 0 1 0)
#'label:' 'top'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #right
@@ -88,7 +85,6 @@
#'name:' 'label3'
#'layout:' #(#Point 58 48)
#'label:' 'relative'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #center
@@ -98,7 +94,6 @@
#'name:' 'label4'
#'layout:' #(#Point 154 49)
#'label:' 'offset'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #center
@@ -106,9 +101,8 @@
)
#(#LabelSpec
#'name:' 'label5'
- #'layout:' #(#AlignmentOrigin 66 0 167 0 1 0)
+ #'layout:' #(#AlignmentOrigin 63 0 175 0 1 0)
#'label:' 'align H'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #right
@@ -116,9 +110,8 @@
)
#(#LabelSpec
#'name:' 'label6'
- #'layout:' #(#AlignmentOrigin 66 0 193 0 1 0)
+ #'layout:' #(#AlignmentOrigin 63 0 201 0 1 0)
#'label:' 'align V'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #right
@@ -152,7 +145,7 @@
)
#(#InputFieldSpec
#'name:' 'editField5'
- #'layout:' #(#LayoutFrame 68 0 167 0 125 0 185 0)
+ #'layout:' #(#LayoutFrame 68 0 175 0 125 0 193 0)
#'model:' #leftAlignmentFraction
#'tabable:' true
#'type:' #numberOrNil
@@ -165,7 +158,7 @@
)
#(#InputFieldSpec
#'name:' 'editField6'
- #'layout:' #(#LayoutFrame 68 0 193 0 125 0 211 0)
+ #'layout:' #(#LayoutFrame 68 0 201 0 125 0 219 0)
#'model:' #topAlignmentFraction
#'tabable:' true
#'type:' #numberOrNil
@@ -206,7 +199,6 @@
#'name:' 'button1'
#'layout:' #(#LayoutFrame 119 0 76 0 138 0 94 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeRelativeLeft
)
@@ -214,7 +206,6 @@
#'name:' 'button2'
#'layout:' #(#LayoutFrame 119 0 103 0 138 0 121 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeRelativeTop
)
@@ -222,7 +213,6 @@
#'name:' 'button3'
#'layout:' #(#LayoutFrame 217 0 76 0 236 0 94 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeOffsetLeft
)
@@ -230,31 +220,27 @@
#'name:' 'button4'
#'layout:' #(#LayoutFrame 217 0 103 0 236 0 121 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeOffsetTop
)
#(#ActionButtonSpec
#'name:' 'button8'
- #'layout:' #(#LayoutFrame 119 0 129 0 138 0 147 0)
+ #'layout:' #(#LayoutFrame 119 0 137 0 138 0 155 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeRelativeLeftTop
)
#(#ActionButtonSpec
#'name:' 'button9'
- #'layout:' #(#LayoutFrame 217 0 129 0 236 0 147 0)
+ #'layout:' #(#LayoutFrame 217 0 137 0 236 0 155 0)
#'label:' ''
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
#'model:' #makeOffsetLeftTop
)
#(#LabelSpec
#'name:' 'label7'
- #'layout:' #(#AlignmentOrigin 49 0 129 0 1 0)
+ #'layout:' #(#AlignmentOrigin 49 0 137 0 1 0)
#'label:' 'all'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #right
@@ -264,17 +250,95 @@
#'name:' 'label1'
#'layout:' #(#AlignmentOrigin 49 0 76 0 1 0)
#'label:' 'left'
- #'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
#'level:' 0
#'adjust:' #right
#'hasCharacterOrientedLabel:' true
)
+ #(#DividerSpec
+ #'name:' 'separator1'
+ #'layout:' #(#Rectangle 154 177 203 188)
+ )
+ #(#DividerSpec
+ #'name:' 'separator2'
+ #'layout:' #(#Rectangle 154 208 203 219)
+ )
+ #(#DividerSpec
+ #'name:' 'separator3'
+ #'layout:' #(#Rectangle 145 187 155 208)
+ #'orientation:' #vertical
+ )
+ #(#DividerSpec
+ #'name:' 'separator4'
+ #'layout:' #(#Rectangle 203 187 213 208)
+ #'orientation:' #vertical
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignBR'
+ #'layout:' #(#Rectangle 201 207 213 219)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignBottomRight
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignTL'
+ #'layout:' #(#Rectangle 145 176 157 188)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignTopLeft
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignTR'
+ #'layout:' #(#Rectangle 201 176 213 188)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignTopRight
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignBL'
+ #'layout:' #(#Rectangle 145 206 157 218)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignBottomLeft
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignTC'
+ #'layout:' #(#Rectangle 173 176 185 188)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignTopCenter
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignBC'
+ #'layout:' #(#Rectangle 173 207 185 219)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignBottomCenter
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignLC'
+ #'layout:' #(#Rectangle 145 191 157 203)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignLeftCenter
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignRC'
+ #'layout:' #(#Rectangle 201 191 213 203)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignRightCenter
+ )
+ #(#ActionButtonSpec
+ #'name:' 'alignC'
+ #'layout:' #(#Rectangle 173 191 185 203)
+ #'label:' ''
+ #'tabable:' false
+ #'model:' #makeAlignCenter
+ )
)
)
)
-
- "Modified: 28.2.1997 / 13:17:26 / cg"
!
specificationExtent
@@ -719,7 +783,7 @@
)
#(#PopUpListSpec
#'name:' 'popUpList1'
- #'layout:' #(#LayoutFrame 75 0.0 7 0 -5 1.0 30 0)
+ #'layout:' #(#LayoutFrame 75 0.0 9 0 -5 1.0 32 0)
#'label:' 'popup'
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
@@ -728,7 +792,7 @@
)
#(#LabelSpec
#'name:' 'label1'
- #'layout:' #(#AlignmentOrigin 55 0 82 0 1 0)
+ #'layout:' #(#AlignmentOrigin 52 0 82 0 1 0)
#'label:' 'left'
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
@@ -738,7 +802,7 @@
)
#(#LabelSpec
#'name:' 'label2'
- #'layout:' #(#AlignmentOrigin 55 0 109 0 1 0)
+ #'layout:' #(#AlignmentOrigin 52 0 109 0 1 0)
#'label:' 'top'
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
@@ -852,7 +916,7 @@
)
#(#ActionButtonSpec
#'name:' 'button8'
- #'layout:' #(#LayoutFrame 119 0 135 0 138 0 153 0)
+ #'layout:' #(#LayoutFrame 119 0 141 0 138 0 159 0)
#'label:' ''
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
@@ -860,7 +924,7 @@
)
#(#ActionButtonSpec
#'name:' 'button9'
- #'layout:' #(#LayoutFrame 216 0 135 0 235 0 153 0)
+ #'layout:' #(#LayoutFrame 216 0 141 0 235 0 159 0)
#'label:' ''
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'tabable:' false
@@ -868,7 +932,7 @@
)
#(#LabelSpec
#'name:' 'label5'
- #'layout:' #(#AlignmentOrigin 55 0 135 0 1 0)
+ #'layout:' #(#AlignmentOrigin 52 0 141 0 1 0)
#'label:' 'all'
#'backgroundColor:' #(#Color 66.9993 66.9993 66.9993)
#'initiallyInvisible:' false
@@ -879,8 +943,6 @@
)
)
)
-
- "Modified: 28.2.1997 / 13:21:27 / cg"
!
specificationPoint
@@ -1466,20 +1528,14 @@
fetchAlignmentOrigin
"fetch alignmentOrigin
"
- |aLayout org|
+ |aLayout|
aLayout := currentView geometryLayout.
- org := currentView computeOrigin.
-
- (layoutAspects at:#absLeft) value:(org x).
- (layoutAspects at:#absTop) value:(org y).
(layoutAspects at:#leftAlignmentFraction) value:(aLayout leftAlignmentFraction).
(layoutAspects at:#topAlignmentFraction) value:(aLayout topAlignmentFraction).
self fetchLayoutOrigin
-
- "Modified: 28.2.1997 / 13:00:36 / cg"
!
fetchExtent
@@ -1677,6 +1733,70 @@
!UIPropertyView methodsFor:'private make layout'!
+makeAlignBottomCenter
+ self makeAlignLeft:0.5 top:1
+
+!
+
+makeAlignBottomLeft
+ self makeAlignLeft:0 top:1
+
+!
+
+makeAlignBottomRight
+ self makeAlignLeft:1 top:1
+
+!
+
+makeAlignCenter
+ self makeAlignLeft:0.5 top:0.5
+
+!
+
+makeAlignLeft:leftFraction top:topFraction
+ |lA tA lO tO|
+
+ lA := (layoutAspects at:#leftAlignmentFraction) value ? 0.
+ tA := (layoutAspects at:#topAlignmentFraction) value ? 0.
+
+ (layoutAspects at:#leftAlignmentFraction) value:leftFraction.
+ (layoutAspects at:#topAlignmentFraction) value:topFraction.
+
+ lO := (layoutAspects at:#leftOffset) value.
+ tO := (layoutAspects at:#topOffset) value.
+
+ lO := lO + (currentView computeExtent x * (leftFraction - lA)).
+ tO := tO + (currentView computeExtent y * (topFraction - tA)).
+
+ (layoutAspects at:#leftOffset) value:lO.
+ (layoutAspects at:#topOffset) value:tO.
+!
+
+makeAlignLeftCenter
+ self makeAlignLeft:0 top:0.5
+
+!
+
+makeAlignRightCenter
+ self makeAlignLeft:1 top:0.5
+
+!
+
+makeAlignTopCenter
+ self makeAlignLeft:0.5 top:0
+
+!
+
+makeAlignTopLeft
+ self makeAlignLeft:0 top:0
+
+!
+
+makeAlignTopRight
+ self makeAlignLeft:1 top:0
+
+!
+
makeLayout:what xOrY:xOrY offset:aBool
|layout extent fraction offset fractSymb offsetSymb|