--- a/UIObjectView.st Sun May 02 13:40:15 1999 +0200
+++ b/UIObjectView.st Thu May 06 23:11:00 1999 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -47,7 +47,7 @@
copyright
"
COPYRIGHT (c) 1995 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -66,11 +66,11 @@
moving and changing layouts of painted components on a canvas.
[see also:]
- UIBuilder
- UIPainterView
+ UIBuilder
+ UIPainterView
[author:]
- Claus Atzkern
+ Claus Atzkern
"
! !
@@ -87,34 +87,34 @@
layout := aView geometryLayout.
layout isNil ifTrue:[
- type == #Extent ifTrue:[
- layout := aView bounds asLayout
- ]
+ type == #Extent ifTrue:[
+ layout := aView bounds asLayout
+ ]
].
(type isNil or:[layout isNil]) ifTrue:[
- ^ nil
+ ^ nil
].
type == #LayoutFrame ifTrue:[
- ^ layout copy
+ ^ layout copy
].
layout isLayout ifFalse:[
- type == #Rectangle ifTrue:[
- lO := layout left.
- tO := layout top.
- rO := layout right.
- bO := layout bottom.
- ] ifFalse:[
- 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
+ type == #Rectangle ifTrue:[
+ lO := layout left.
+ tO := layout top.
+ rO := layout right.
+ bO := layout bottom.
+ ] ifFalse:[
+ 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
].
lF := layout leftFraction.
@@ -127,24 +127,24 @@
rO := lO + aView extent x.
newLyt := LayoutFrame leftFraction:lF offset:lO rightFraction:rF offset:rO
- topFraction:tF offset:tO bottomFraction:bF offset:bO.
+ 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).
+ |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.
@@ -182,23 +182,23 @@
type := self layoutType:aView.
(type == #LayoutFrame or:[type == #Rectangle]) ifTrue:[
- v := self isVerticalResizable:aView.
- h := self isHorizontalResizable:aView.
-
- h ifTrue:[ aBlock value:(aView leftCenter ) value:#left.
- aBlock value:(aView rightCenter) value:#right.
- ].
- v ifTrue:[ aBlock value:(aView topCenter ) value:#top.
- aBlock value:(aView bottomCenter) value:#bottom.
- ].
-
- (h and:[v]) ifTrue:[
- aBlock value:(aView origin ) value:#origin.
- aBlock value:(aView topRight ) value:#topRight.
- aBlock value:(aView bottomLeft) value:#bottomLeft.
- aBlock value:(aView corner ) value:#corner.
- ^ self
- ]
+ v := self isVerticalResizable:aView.
+ h := self isHorizontalResizable:aView.
+
+ h ifTrue:[ aBlock value:(aView leftCenter ) value:#left.
+ aBlock value:(aView rightCenter) value:#right.
+ ].
+ v ifTrue:[ aBlock value:(aView topCenter ) value:#top.
+ aBlock value:(aView bottomCenter) value:#bottom.
+ ].
+
+ (h and:[v]) ifTrue:[
+ aBlock value:(aView origin ) value:#origin.
+ aBlock value:(aView topRight ) value:#topRight.
+ aBlock value:(aView bottomLeft) value:#bottomLeft.
+ aBlock value:(aView corner ) value:#corner.
+ ^ self
+ ]
].
aBlock value:(aView origin ) value:#view.
@@ -206,16 +206,16 @@
aBlock value:(aView bottomLeft) value:#view.
type == #Extent ifTrue:[
- v := self isVerticalResizable:aView.
- h := self isHorizontalResizable:aView.
-
- v ifTrue:[aBlock value:(aView bottomCenter) value:#bottom].
- h ifTrue:[aBlock value:(aView rightCenter ) value:#right ].
-
- (h and:[v]) ifTrue:[
- aBlock value:(aView corner) value:#corner.
- ^ self
- ]
+ v := self isVerticalResizable:aView.
+ h := self isHorizontalResizable:aView.
+
+ v ifTrue:[aBlock value:(aView bottomCenter) value:#bottom].
+ h ifTrue:[aBlock value:(aView rightCenter ) value:#right ].
+
+ (h and:[v]) ifTrue:[
+ aBlock value:(aView corner) value:#corner.
+ ^ self
+ ]
].
aBlock value:(aView corner) value:#view.
@@ -228,13 +228,13 @@
"returns true if instance is horizontal resizeable
"
(aComponent isKindOf:ScrollBar) ifTrue:[
- ^ aComponent orientation == #horizontal
+ ^ aComponent orientation == #horizontal
].
(aComponent isKindOf:Scroller) ifTrue:[
- ^ aComponent orientation == #horizontal
+ ^ aComponent orientation == #horizontal
].
(aComponent isKindOf:Slider) ifTrue:[
- ^ aComponent orientation == #horizontal
+ ^ aComponent orientation == #horizontal
].
^ true
@@ -244,22 +244,22 @@
"returns true if instance is vertical resizeable
"
(aComponent isKindOf:EditField) ifTrue:[
- ^ false
+ ^ false
].
(aComponent isKindOf:ComboBoxView) ifTrue:[
- ^ false
+ ^ false
].
(aComponent isKindOf:CheckBox) ifTrue:[
- ^ false
+ ^ false
].
(aComponent isKindOf:ScrollBar) ifTrue:[
- ^ aComponent orientation == #vertical
+ ^ aComponent orientation == #vertical
].
(aComponent isKindOf:Scroller) ifTrue:[
- ^ aComponent orientation == #vertical
+ ^ aComponent orientation == #vertical
].
(aComponent isKindOf:Slider) ifTrue:[
- ^ aComponent orientation == #vertical
+ ^ aComponent orientation == #vertical
].
^ true
@@ -271,24 +271,24 @@
|layout spec superView|
aView notNil ifTrue:[
- layout := aView geometryLayout.
- layout notNil ifTrue:[
- layout isLayout ifTrue:[
- layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ].
- layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ].
- layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ].
- ] ifFalse:[
- layout isRectangle ifTrue:[ ^ #Rectangle ].
- layout isPoint ifTrue:[ ^ #Point ].
- ]
- ] ifFalse:[
- (superView := aView superView) notNil ifTrue:[
- spec := superView specClass.
- spec canResizeSubComponents ifTrue:[
- ^ #Extent
- ]
- ]
- ]
+ layout := aView geometryLayout.
+ layout notNil ifTrue:[
+ layout isLayout ifTrue:[
+ layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ].
+ layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ].
+ layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ].
+ ] ifFalse:[
+ layout isRectangle ifTrue:[ ^ #Rectangle ].
+ layout isPoint ifTrue:[ ^ #Point ].
+ ]
+ ] ifFalse:[
+ (superView := aView superView) notNil ifTrue:[
+ spec := superView specClass.
+ spec canResizeSubComponents ifTrue:[
+ ^ #Extent
+ ]
+ ]
+ ]
].
^ nil
@@ -308,7 +308,7 @@
"change state of aligning to grid
"
aBool ifTrue:[self alignOn]
- ifFalse:[self alignOff]
+ ifFalse:[self alignOff]
!
@@ -319,18 +319,18 @@
which control the appearance of the grid-pattern.
the elements are:
- bigStepH number of pixels horizontally between 2 major steps
- bigStepV number of pixels vertically between 2 major steps
- littleStepH number of pixels horizontally between 2 minor steps
- littleStepV number of pixels vertically between 2 minor steps
- gridAlignH number of pixels for horizontal grid align (pointer snap)
- gridAlignV number of pixels for vertical grid align (pointer snap)
- docBounds true, if document boundary should be shown
+ bigStepH number of pixels horizontally between 2 major steps
+ bigStepV number of pixels vertically between 2 major steps
+ littleStepH number of pixels horizontally between 2 minor steps
+ littleStepV number of pixels vertically between 2 minor steps
+ gridAlignH number of pixels for horizontal grid align (pointer snap)
+ gridAlignV number of pixels for vertical grid align (pointer snap)
+ docBounds true, if document boundary should be shown
if littleStepH/V are nil, only bigSteps are drawn.
"
gridParameters isNil ifTrue:[
- gridParameters := #(10 10 nil nil 10 10 false)
+ gridParameters := #(10 10 nil nil 10 10 false)
].
^ gridParameters
@@ -344,18 +344,18 @@
which control the appearance of the grid-pattern.
the elements are:
- bigStepH number of pixels horizontally between 2 major steps
- bigStepV number of pixels vertically between 2 major steps
- littleStepH number of pixels horizontally between 2 minor steps
- littleStepV number of pixels vertically between 2 minor steps
- gridAlignH number of pixels for horizontal grid align (pointer snap)
- gridAlignV number of pixels for vertical grid align (pointer snap)
- docBounds true, if document boundary should be shown
+ bigStepH number of pixels horizontally between 2 major steps
+ bigStepV number of pixels vertically between 2 major steps
+ littleStepH number of pixels horizontally between 2 minor steps
+ littleStepV number of pixels vertically between 2 minor steps
+ gridAlignH number of pixels for horizontal grid align (pointer snap)
+ gridAlignV number of pixels for vertical grid align (pointer snap)
+ docBounds true, if document boundary should be shown
if littleStepH/V are nil, only bigSteps are drawn.
"
newGridParameters size == 7 ifTrue:[
- gridParameters := newGridParameters
+ gridParameters := newGridParameters
].
@@ -365,14 +365,14 @@
"change visibility of grid
"
aBool ifTrue:[self showGrid]
- ifFalse:[self hideGrid]
+ ifFalse:[self hideGrid]
!
hideGrid
"hide grid
"
gridShown ifTrue:[
- self withSelectionHiddenDo:[super hideGrid]
+ self withSelectionHiddenDo:[super hideGrid]
]
@@ -390,17 +390,17 @@
"set the modification / test mode
"
self shown ifTrue:[
- enableChannel value ifFalse:[
- saveSelection := selection.
- self hideSelection.
- selection := nil.
- inputView unmap.
- ] ifTrue:[
- inputView raise.
- inputView realize.
- selection := saveSelection.
- self showSelection
- ]
+ enableChannel value ifFalse:[
+ saveSelection := selection.
+ self hideSelection.
+ selection := nil.
+ inputView unmap.
+ ] ifTrue:[
+ inputView raise.
+ inputView realize.
+ selection := saveSelection.
+ self showSelection
+ ]
]
"Created: / 30.3.1999 / 16:17:24 / stefan"
@@ -471,7 +471,7 @@
spv := self findContainerOfView:aView.
selectionHiddenLevel ~~ 0 ifTrue:[setOfSuperViewsSizeChanged add:spv]
- ifFalse:[spv sizeChanged:nil]
+ ifFalse:[spv sizeChanged:nil]
!
exposeX:x y:y width:w height:h
@@ -479,19 +479,21 @@
"
resizeData isNil ifTrue:[
- super exposeX:x y:y width:w height:h.
-
- "/ handle any expose events (for subcomponents) before
- "/ redrawing the handles.
- (self sensor hasExposeEventFor:nil) ifTrue:[^ self].
-
- self selectionDo:[:aComponent |
- aComponent withAllSubViewsDo:[:v |
- self sensor flushExposeEventsFor:v.
- v exposeX:0 y:0 width:v width height:v height.
- ].
- self showSelected:aComponent
- ]
+ super exposeX:x y:y width:w height:h.
+
+ "/ handle any expose events (for subcomponents) before
+ "/ redrawing the handles.
+ (self sensor hasExposeEventFor:nil) ifTrue:[^ self].
+
+ self selectionDo:[:aComponent |
+ aComponent withAllSubViewsDo:[:v |
+ v realized ifTrue:[
+ self sensor flushExposeEventsFor:v.
+ v exposeX:0 y:0 width:v width height:v height.
+ ]
+ ].
+ self showSelected:aComponent
+ ]
].
"Modified: / 9.11.1998 / 12:50:34 / cg"
@@ -501,10 +503,10 @@
"any key pressed
"
<resource: #keyboard ( #CursorUp #CursorDown #CursorLeft #CursorRight
- #Delete #BackSpace #Cut #Copy #Paste #Cmdu ) >
+ #Delete #BackSpace #Cut #Copy #Paste #Cmdu ) >
(key == #Cut or:[key == #Delete or:[key == #BackSpace]]) ifTrue: [
- ^ self deleteSelection
+ ^ self deleteSelection
].
key == #Copy ifTrue:[ ^ self copySelection].
key == #Paste ifTrue:[ ^ self pasteBuffer].
@@ -525,7 +527,7 @@
the redraw when this happens
"
(anEvent type == #damage and:[self isSelected:(anEvent view)]) ifTrue:[
- self showSelected:(anEvent view)
+ self showSelected:(anEvent view)
].
^ false.
@@ -541,7 +543,7 @@
"size of a view(s) changed
"
self withSelectionHiddenDo:[
- super sizeChanged:how
+ super sizeChanged:how
]
@@ -574,7 +576,7 @@
selectionHiddenLevel := 0.
(self class gridShown) ifTrue:[
- super showGrid
+ super showGrid
].
"Modified: / 20.7.1998 / 18:14:51 / cg"
@@ -621,7 +623,7 @@
"set cursor
"
inputView realized ifTrue:[
- inputView cursor:aCursor
+ inputView cursor:aCursor
].
super cursor:aCursor
@@ -634,29 +636,29 @@
|wasClipped|
(wasClipped := clipChildren) ifTrue:[
- self clippedByChildren:(clipChildren := false).
+ self clippedByChildren:(clipChildren := false).
].
self xoring:[
- |p|
-
- something isCollection ifTrue:[
- something do:[:v |
- |p|
-
- p := v originRelativeTo:self.
- self displayRectangle:(p extent:v extent).
- ].
- ] ifFalse:[
- |p|
-
- p := something originRelativeTo:self.
- self displayRectangle:(p extent:something extent).
- ]
+ |p|
+
+ something isCollection ifTrue:[
+ something do:[:v |
+ |p|
+
+ p := v originRelativeTo:self.
+ self displayRectangle:(p extent:v extent).
+ ].
+ ] ifFalse:[
+ |p|
+
+ p := something originRelativeTo:self.
+ self displayRectangle:(p extent:something extent).
+ ]
].
wasClipped ifTrue:[
- self clippedByChildren:(clipChildren := true).
+ self clippedByChildren:(clipChildren := true).
].
!
@@ -664,11 +666,11 @@
minSetOfSuperViews:setOfViews
setOfViews isCollection ifFalse:[
- setOfViews notNil ifTrue:[^ Array with:setOfViews]
- ifFalse:[^ nil]
+ setOfViews notNil ifTrue:[^ Array with:setOfViews]
+ ifFalse:[^ nil]
].
^ setOfViews select:[:aView|
- (setOfViews detect:[:v|aView isComponentOf:v] ifNone:nil) isNil
+ (setOfViews detect:[:v|aView isComponentOf:v] ifNone:nil) isNil
]
!
@@ -698,12 +700,12 @@
"move selection
"
movedObject notNil ifTrue:[
- self invertOutlineOf:movedObject.
-
- movedObject keysAndValuesDo:[:i :v|
- self moveObject:v to:(aPoint - (moveDelta at:i)).
- ].
- self invertOutlineOf:movedObject.
+ self invertOutlineOf:movedObject.
+
+ movedObject keysAndValuesDo:[:i :v|
+ self moveObject:v to:(aPoint - (moveDelta at:i)).
+ ].
+ self invertOutlineOf:movedObject.
]
!
@@ -712,15 +714,15 @@
"cleanup after object(s) move
"
movedObject notNil ifTrue:[
- self invertOutlineOf:movedObject.
-
- movedObject size == 1 ifTrue:[
- movedObject := movedObject first
- ].
- self setSelection:movedObject withRedraw:true.
- movedObject := nil.
- self setDefaultActions.
- self layoutChanged.
+ self invertOutlineOf:movedObject.
+
+ movedObject size == 1 ifTrue:[
+ movedObject := movedObject first
+ ].
+ self setSelection:movedObject withRedraw:true.
+ movedObject := nil.
+ self setDefaultActions.
+ self layoutChanged.
].
!
@@ -730,16 +732,16 @@
|dX dY org delta|
anObject notNil ifTrue:[
- org := anObject computeOrigin.
-
- delta := aPoint - org.
- delta := (self alignToGrid:aPoint) - org.
- dX := delta x.
- dY := delta y.
-
- undoHistory withoutTransactionDo:[
- self shiftLayout:anObject top:dY bottom:dY left:dX right:dX
- ]
+ org := anObject computeOrigin.
+
+ delta := aPoint - org.
+ delta := (self alignToGrid:aPoint) - org.
+ dX := delta x.
+ dY := delta y.
+
+ undoHistory withoutTransactionDo:[
+ self shiftLayout:anObject top:dY bottom:dY left:dX right:dX
+ ]
]
!
@@ -751,12 +753,12 @@
movedObject := self selection.
movedObject isCollection ifFalse:[
- movedObject := Array with:movedObject
+ movedObject := Array with:movedObject
].
self setSelection:nil withRedraw:true.
moveDelta := movedObject collect:[:aView|
- aPoint - aView computeOrigin
+ aPoint - aView computeOrigin
].
self transaction:#move objects:movedObject do:[:v|self createUndoLayout:v].
self invertOutlineOf:movedObject.
@@ -771,11 +773,11 @@
anObject := self findObjectAt:aPoint.
anObject notNil ifTrue:[
- (self isSelected:anObject) ifTrue:[
- self removeFromSelection:anObject
- ] ifFalse:[
- self addToSelection:anObject
- ]
+ (self isSelected:anObject) ifTrue:[
+ self removeFromSelection:anObject
+ ] ifFalse:[
+ self addToSelection:anObject
+ ]
]
!
@@ -789,51 +791,51 @@
aView := self singleSelection.
aView notNil ifTrue:[
- v := self findContainerOfView:aView.
-
- v specClass canResizeSubComponents ifTrue:[
- b := self whichHandleOf:aView isHitBy:aPoint.
-
- (b notNil and:[b ~~ #view]) ifTrue:[
- ^ self startResizeBorder:b of:aView.
- ]
- ].
-
- (self sensor ctrlDown and:[self canChangeLayoutOfView:aView]) ifFalse:[
- aView := nil
- ]
+ v := self findContainerOfView:aView.
+
+ v specClass canResizeSubComponents ifTrue:[
+ b := self whichHandleOf:aView isHitBy:aPoint.
+
+ (b notNil and:[b ~~ #view]) ifTrue:[
+ ^ self startResizeBorder:b of:aView.
+ ]
+ ].
+
+ (self sensor ctrlDown and:[self canChangeLayoutOfView:aView]) ifFalse:[
+ aView := nil
+ ]
].
aView isNil ifTrue:[
- (aView := self findObjectAt:aPoint) isNil ifTrue:[
- ^ self select:nil
- ].
-
- (self canChangeLayoutOfView:aView) ifFalse:[
- ^ self select:aView
- ]
+ (aView := self findObjectAt:aPoint) isNil ifTrue:[
+ ^ self select:nil
+ ].
+
+ (self canChangeLayoutOfView:aView) ifFalse:[
+ ^ self select:aView
+ ]
].
(self isSelected:aView) ifFalse:[
- self select:aView.
+ self select:aView.
].
(self numberOfSelections ~~ 1) ifTrue:[
- releaseAction := [
- self setDefaultActions.
- self select:aView
- ]
+ releaseAction := [
+ self setDefaultActions.
+ self select:aView
+ ]
] ifFalse:[
- releaseAction := [self setDefaultActions]
+ releaseAction := [self setDefaultActions]
].
"prepare move operation for an object
"
motionAction := [:movePoint|
- (aPoint dist:movePoint) > 8.0 ifTrue:[
- self startObjectMoveAt:aPoint
- ]
+ (aPoint dist:movePoint) > 8.0 ifTrue:[
+ self startObjectMoveAt:aPoint
+ ]
].
! !
@@ -848,7 +850,7 @@
selector := ('resize:', aSelector, ':') asSymbol.
resizeData := ResizeData new
- object:anObject selector:selector delta:delta.
+ object:anObject selector:selector delta:delta.
"can change cursor dependent on vertical/horizontal resizing
"
@@ -890,7 +892,7 @@
"/ redrawing the handles.
Delay waitForSeconds:0.05.
[self sensor hasExposeEventFor:nil] whileTrue:[
- self windowGroup processExposeEvents
+ self windowGroup processExposeEvents
].
self setSelection:object withRedraw:true.
@@ -906,7 +908,7 @@
self actionResize:object selector:b.
self transaction:#resize selectionDo:[:aView|
- self createUndoLayout:aView
+ self createUndoLayout:aView
].
self setSelection:nil withRedraw:true.
@@ -923,15 +925,15 @@
|c|
self forEach:aViewOrSeqOfViews do:[:v|
- v shown ifTrue:[
- v fill:v viewBackground.
- v borderWidth ~~ 0 ifTrue:[
- c := v borderColor.
- v borderColor:(Color colorId:1).
- v borderColor:c.
- ].
- v exposeX:0 y:0 width:(v width) height:(v height)
- ]
+ v shown ifTrue:[
+ v fill:v viewBackground.
+ v borderWidth ~~ 0 ifTrue:[
+ c := v borderColor.
+ v borderColor:(Color colorId:1).
+ v borderColor:c.
+ ].
+ v exposeX:0 y:0 width:(v width) height:(v height)
+ ]
]
"Modified: / 16.9.1998 / 01:40:30 / cg"
@@ -947,7 +949,7 @@
ext := 6@6.
self class handlesOf:aComponent do:[:pnt :wht |
- aTwoArgAction value:(pnt + dlt extent:ext) value:wht
+ aTwoArgAction value:(pnt + dlt extent:ext) value:wht
]
!
@@ -994,36 +996,36 @@
"/ ^ self.
(wasClipped := clipChildren) ifTrue:[
- self clippedByChildren:(clipChildren := false).
+ self clippedByChildren:(clipChildren := false).
].
self handlesOf:aComponent do:[:rec :wht| self clearRectangle:rec ].
wasClipped ifTrue:[
- self clippedByChildren:(clipChildren := true).
+ self clippedByChildren:(clipChildren := true).
].
"/ must redraw all components which are affected b the handles
r := (aComponent originRelativeTo:self) - (3@3) extent:(aComponent extent + (6@6)).
subViews do:[:anotherComponent |
- |absOrg absFrame|
-
- anotherComponent ~~ inputView ifTrue:[
- absOrg := anotherComponent originRelativeTo:self.
- absFrame := absOrg extent:(anotherComponent extent).
- (absFrame intersects:r) ifTrue:[
- anotherComponent withAllSubViewsDo:[:v |
- v shown ifTrue:[
- aSet notNil ifTrue:[
- aSet add:v
- ] ifFalse:[
- self handleAffectedViews:v
- ]
- ]
- ]
- ]
- ]
+ |absOrg absFrame|
+
+ anotherComponent ~~ inputView ifTrue:[
+ absOrg := anotherComponent originRelativeTo:self.
+ absFrame := absOrg extent:(anotherComponent extent).
+ (absFrame intersects:r) ifTrue:[
+ anotherComponent withAllSubViewsDo:[:v |
+ v shown ifTrue:[
+ aSet notNil ifTrue:[
+ aSet add:v
+ ] ifFalse:[
+ self handleAffectedViews:v
+ ]
+ ]
+ ]
+ ]
+ ]
].
"Modified: / 24.8.1998 / 12:19:38 / cg"
@@ -1033,7 +1035,7 @@
"returns kind of handle or nil
"
self handlesOf:aComponent do:[:rectangle :what|
- (rectangle containsPoint:aPoint) ifTrue:[^ what]
+ (rectangle containsPoint:aPoint) ifTrue:[^ what]
].
^ nil
! !
@@ -1044,7 +1046,7 @@
"resize a views bottom
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
+ self shiftLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
]
!
@@ -1052,10 +1054,10 @@
"resize a views bottom and left
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:0
- bottom:((aPoint y) - (aView computeCorner y))
- left:((aPoint x) - (aView computeOrigin x))
- right:0
+ self shiftLayout:aView top:0
+ bottom:((aPoint y) - (aView computeCorner y))
+ left:((aPoint x) - (aView computeOrigin x))
+ right:0
]
@@ -1070,7 +1072,7 @@
delta := aPoint - aView computeCorner.
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
+ self shiftLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
]
!
@@ -1078,7 +1080,7 @@
"resize a views left
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
+ self shiftLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
]
!
@@ -1091,7 +1093,7 @@
delta := aPoint - aView computeOrigin.
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:(delta y) bottom:0 left:(delta x) right:0
+ self shiftLayout:aView top:(delta y) bottom:0 left:(delta x) right:0
]
!
@@ -1100,7 +1102,7 @@
"resize a views right
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView left:0 right:((aPoint x) - (aView computeCorner x))
+ self shiftLayout:aView left:0 right:((aPoint x) - (aView computeCorner x))
]
!
@@ -1108,7 +1110,7 @@
"resize a views top
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom:0
+ self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom:0
]
!
@@ -1116,10 +1118,10 @@
"resize a views top and right
"
undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y))
- bottom:0
- left:0
- right:((aPoint x) - (aView computeCorner x))
+ self shiftLayout:aView top:((aPoint y) - (aView computeOrigin y))
+ bottom:0
+ left:0
+ right:((aPoint x) - (aView computeCorner x))
]
@@ -1153,35 +1155,35 @@
type := self class layoutType:aView.
type notNil ifTrue:[
- self createUndoLayout:aView.
-
- type == #Extent ifTrue:[
- oldExt := aView extent.
- aView extent:(oldExt + ((r-l) @ (b-t))).
- ^ self
- ].
-
- layout := aView geometryLayout copy.
-
- layout isLayout ifTrue:[
- layout leftOffset:(layout leftOffset + l)
- topOffset:(layout topOffset + t).
+ self createUndoLayout:aView.
+
+ type == #Extent ifTrue:[
+ oldExt := aView extent.
+ aView extent:(oldExt + ((r-l) @ (b-t))).
+ ^ self
+ ].
+
+ layout := aView geometryLayout copy.
+
+ layout isLayout ifTrue:[
+ layout leftOffset:(layout leftOffset + l)
+ topOffset:(layout topOffset + t).
- type == #LayoutFrame ifTrue:[
- layout bottomOffset:(layout bottomOffset + b).
- layout rightOffset:(layout rightOffset + r).
- ]
- ] ifFalse:[
- type == #Rectangle ifTrue:[
- layout left:(layout left + l)
- right:(layout right + r)
- top:(layout top + t)
- bottom:(layout bottom + b).
- ] ifFalse:[ "POINT"
- layout x:(layout x + l) y:(layout y + t).
- ]
- ].
- aView geometryLayout:layout
+ type == #LayoutFrame ifTrue:[
+ layout bottomOffset:(layout bottomOffset + b).
+ layout rightOffset:(layout rightOffset + r).
+ ]
+ ] ifFalse:[
+ type == #Rectangle ifTrue:[
+ layout left:(layout left + l)
+ right:(layout right + r)
+ top:(layout top + t)
+ bottom:(layout bottom + b).
+ ] ifFalse:[ "POINT"
+ layout x:(layout x + l) y:(layout y + t).
+ ]
+ ].
+ aView geometryLayout:layout
]
! !
@@ -1198,8 +1200,8 @@
inputView lower.
[viewId notNil] whileTrue:[
- lastId := viewId.
- viewId := device viewIdFromPoint:point in:lastId
+ lastId := viewId.
+ viewId := device viewIdFromPoint:point in:lastId
].
inputView raise.
@@ -1212,18 +1214,18 @@
listOfViews := OrderedCollection new.
self allSubViewsDo:[:aView |
- |org|
-
- aView ~~ inputView ifTrue:[
- org := device translatePoint:0@0 from:(aView id) to:self id.
- ((org extent:aView extent) containsPoint:aPoint) ifTrue:[
- listOfViews add:aView.
- ]
- ]
+ |org|
+
+ aView ~~ inputView ifTrue:[
+ org := device translatePoint:0@0 from:(aView id) to:self id.
+ ((org extent:aView extent) containsPoint:aPoint) ifTrue:[
+ listOfViews add:aView.
+ ]
+ ]
].
listOfViews size > 0 ifTrue:[
- ^ listOfViews last
+ ^ listOfViews last
].
^ nil
@@ -1238,10 +1240,10 @@
|aSet|
self selectionDo:[:object|
- aSet isNil ifTrue:[
- aSet := IdentitySet new
- ].
- self showUnselected:object addAffectedViewsTo:aSet.
+ aSet isNil ifTrue:[
+ aSet := IdentitySet new
+ ].
+ self showUnselected:object addAffectedViewsTo:aSet.
].
self handleAffectedViews:aSet.
@@ -1255,9 +1257,9 @@
|coll|
self hasSelection ifTrue:[
- (self canMove:(coll := self selection)) ifTrue:[
- ^ coll
- ]
+ (self canMove:(coll := self selection)) ifTrue:[
+ ^ coll
+ ]
].
^ nil
!
@@ -1292,7 +1294,7 @@
"show the selection - draw handles
"
selectionHiddenLevel == 0 ifTrue:[
- self selectionDo:[:el| self showSelected:el ]
+ self selectionDo:[:el| self showSelected:el ]
].
!
@@ -1303,7 +1305,7 @@
|coll|
(coll := self selection) isCollection ifFalse:[
- ^ coll
+ ^ coll
].
coll size == 1 ifTrue:[ ^ coll first].
@@ -1317,7 +1319,7 @@
|view|
(view := self singleSelection) notNil ifTrue:[
- aBlock value:view
+ aBlock value:view
]
!
@@ -1333,23 +1335,23 @@
|coll|
selectionHiddenLevel == 0 ifTrue:[
- self hideSelection.
- device flush.
+ self hideSelection.
+ device flush.
].
selectionHiddenLevel := selectionHiddenLevel + 1.
aBlock valueNowOrOnUnwindDo:[
- selectionHiddenLevel == 1 ifTrue:[
- setOfSuperViewsSizeChanged notEmpty ifTrue:[
- coll := self minSetOfSuperViews:setOfSuperViewsSizeChanged.
- coll do:[:aView| aView sizeChanged:nil].
- setOfSuperViewsSizeChanged := IdentitySet new
- ].
- selectionHiddenLevel := 0.
- self selectionDo:[:aView| self showSelected:aView].
- ] ifFalse:[
- selectionHiddenLevel := selectionHiddenLevel - 1.
- ]
+ selectionHiddenLevel == 1 ifTrue:[
+ setOfSuperViewsSizeChanged notEmpty ifTrue:[
+ coll := self minSetOfSuperViews:setOfSuperViewsSizeChanged.
+ coll do:[:aView| aView sizeChanged:nil].
+ setOfSuperViewsSizeChanged := IdentitySet new
+ ].
+ selectionHiddenLevel := 0.
+ self selectionDo:[:aView| self showSelected:aView].
+ ] ifFalse:[
+ selectionHiddenLevel := selectionHiddenLevel - 1.
+ ]
]
!
@@ -1360,12 +1362,12 @@
|sel|
self hasSelection ifFalse:[
- aBlock value
+ aBlock value
] ifTrue:[
- sel := self selection.
- self setSelection:nil withRedraw:true.
- aBlock value.
- self setSelection:sel withRedraw:true.
+ sel := self selection.
+ self setSelection:nil withRedraw:true.
+ aBlock value.
+ self setSelection:sel withRedraw:true.
]
@@ -1387,15 +1389,15 @@
|sel|
(sel := aNewSelection) == self ifTrue:[
- sel := nil
+ sel := nil
].
doRedraw ifTrue:[
- self hideSelection.
- selection := sel.
- self showSelection
+ self hideSelection.
+ selection := sel.
+ self showSelection
] ifFalse:[
- selection := sel
+ selection := sel
]
! !
@@ -1431,7 +1433,7 @@
"return true, if the argument, anObject is selected
"
anObject notNil ifTrue:[
- self selectionDo:[:el| el == anObject ifTrue:[^ true]]
+ self selectionDo:[:el| el == anObject ifTrue:[^ true]]
].
^ false
@@ -1474,9 +1476,9 @@
object := self singleSelection.
object notNil ifTrue:[
- copiedExtent := object computeExtent
+ copiedExtent := object computeExtent
] ifFalse:[
- self warn:'exactly one element must be selected'.
+ self warn:'exactly one element must be selected'.
]
@@ -1491,9 +1493,9 @@
object := self singleSelection.
object notNil ifTrue:[
- copiedLayout := object geometryLayout copy
+ copiedLayout := object geometryLayout copy
] ifFalse:[
- self warn:'exactly one element must be selected'.
+ self warn:'exactly one element must be selected'.
]
@@ -1504,9 +1506,9 @@
"paste the copied extent to all objects in the selection
"
copiedExtent notNil ifTrue:[
- self transaction:#pasteExtent dimensionDo:[:v|
- self resize:v corner:(v computeOrigin + copiedExtent)
- ]
+ self transaction:#pasteExtent dimensionDo:[:v|
+ self resize:v corner:(v computeOrigin + copiedExtent)
+ ]
]
!
@@ -1514,9 +1516,9 @@
"paste the copied extent height to all objects in the selection
"
copiedExtent notNil ifTrue:[
- self transaction:#pasteHeight dimensionDo:[:v|
- self resize:v bottom:(v computeOrigin + copiedExtent)
- ]
+ self transaction:#pasteHeight dimensionDo:[:v|
+ self resize:v bottom:(v computeOrigin + copiedExtent)
+ ]
]
!
@@ -1525,9 +1527,9 @@
"paste layout to all objects in the selection
"
copiedLayout notNil ifTrue:[
- self transaction:#pasteLayout dimensionDo:[:v|
- v geometryLayout:(copiedLayout copy)
- ]
+ self transaction:#pasteLayout dimensionDo:[:v|
+ v geometryLayout:(copiedLayout copy)
+ ]
]
!
@@ -1535,9 +1537,9 @@
"paste the copied extent width to all objects in the selection
"
copiedExtent notNil ifTrue:[
- self transaction:#pasteWidth dimensionDo:[:v|
- self resize:v right:(v computeOrigin + copiedExtent)
- ]
+ self transaction:#pasteWidth dimensionDo:[:v|
+ self resize:v right:(v computeOrigin + copiedExtent)
+ ]
]
!
@@ -1546,8 +1548,8 @@
"change extent for all selected objects
"
self transaction:#extent dimensionDo:[:v|
- v geometryLayout:nil.
- v extent:anExtent.
+ v geometryLayout:nil.
+ v extent:anExtent.
].
"Modified: 28.2.1997 / 12:49:00 / cg"
@@ -1557,7 +1559,7 @@
"change layout for all selected objects
"
self transaction:#layout dimensionDo:[:v|
- v geometryLayout:(aLayout copy)
+ v geometryLayout:(aLayout copy)
].
!
@@ -1583,7 +1585,7 @@
"change extent of all selected views to their default extent
"
self transaction:#defaultExtent dimensionDo:[:v|
- self resize:v corner:(v computeOrigin + (v preferredExtent)).
+ self resize:v corner:(v computeOrigin + (v preferredExtent)).
]
!
@@ -1592,7 +1594,7 @@
"change height of all selected views to their default height
"
self transaction:#defaultHeight dimensionDo:[:v|
- self resize:v bottom:(v computeOrigin + (v preferredExtent))
+ self resize:v bottom:(v computeOrigin + (v preferredExtent))
]
!
@@ -1601,7 +1603,7 @@
"change width of all selected views to their default width
"
self transaction:#defaultWidth dimensionDo:[:v|
- self resize:v right:(v computeOrigin + (v preferredExtent))
+ self resize:v right:(v computeOrigin + (v preferredExtent))
]
!
@@ -1611,13 +1613,13 @@
the block with the argument a view.
"
self withSelectionHiddenDo:[
- self transaction:aType selectionDo:[:aView|
- (self class layoutType:aView) notNil ifTrue:[
- self createUndoLayout:aView.
- aOneArgBlock value:aView.
- self elementChangedSize:aView.
- ]
- ]
+ self transaction:aType selectionDo:[:aView|
+ (self class layoutType:aView) notNil ifTrue:[
+ self createUndoLayout:aView.
+ aOneArgBlock value:aView.
+ self elementChangedSize:aView.
+ ]
+ ]
].
self layoutChanged
@@ -1631,29 +1633,29 @@
|sensor tm|
self moveableSelection isNil ifTrue:[
- ^ self
+ ^ self
].
sensor := self sensor.
tm := 0.15.
self withSelectionHiddenDo:[
- self transaction:#move selectionDo:[:aView|self createUndoLayout:aView].
-
- [
- self selectionDo:[:aView| aOneArgBlock value:aView ].
- Delay waitForSeconds:tm.
- tm := 0.02.
- self layoutChanged.
- sensor leftButtonPressed.
- ] whileTrue.
-
- "/ handle any expose events (for subcomponents) before
- "/ redrawing the handles.
- Delay waitForSeconds:0.05.
- [self sensor hasExposeEventFor:nil] whileTrue:[
- self windowGroup processExposeEvents
- ]
+ self transaction:#move selectionDo:[:aView|self createUndoLayout:aView].
+
+ [
+ self selectionDo:[:aView| aOneArgBlock value:aView ].
+ Delay waitForSeconds:tm.
+ tm := 0.02.
+ self layoutChanged.
+ sensor leftButtonPressed.
+ ] whileTrue.
+
+ "/ handle any expose events (for subcomponents) before
+ "/ redrawing the handles.
+ Delay waitForSeconds:0.05.
+ [self sensor hasExposeEventFor:nil] whileTrue:[
+ self windowGroup processExposeEvents
+ ]
].
!
@@ -1663,21 +1665,21 @@
|gridY n|
gridAlign notNil ifTrue:[gridY := gridAlign y]
- ifFalse:[gridY := 1].
+ ifFalse:[gridY := 1].
self moveDo:[:aView|
- aligning ifTrue:[
- n := ((aView computeCorner y) \\ gridY).
-
- n ~~ 0 ifTrue:[
- n := gridY - n + 1.
- ] ifFalse:[
- n := gridY
- ]
- ] ifFalse:[
- n := 1
- ].
- self shiftLayout:aView top:n bottom:n
+ aligning ifTrue:[
+ n := ((aView computeCorner y) \\ gridY).
+
+ n ~~ 0 ifTrue:[
+ n := gridY - n + 1.
+ ] ifFalse:[
+ n := gridY
+ ]
+ ] ifFalse:[
+ n := 1
+ ].
+ self shiftLayout:aView top:n bottom:n
]
!
@@ -1687,17 +1689,17 @@
|gridX n|
gridAlign notNil ifTrue:[gridX := gridAlign x]
- ifFalse:[gridX := 1].
+ ifFalse:[gridX := 1].
self moveDo:[:aView|
- aligning ifTrue:[
- n := ((aView computeOrigin x) \\ gridX).
- n == 0 ifTrue:[n := gridX].
- n := n negated.
- ] ifFalse:[
- n := -1
- ].
- self shiftLayout:aView left:n right:n
+ aligning ifTrue:[
+ n := ((aView computeOrigin x) \\ gridX).
+ n == 0 ifTrue:[n := gridX].
+ n := n negated.
+ ] ifFalse:[
+ n := -1
+ ].
+ self shiftLayout:aView left:n right:n
]
!
@@ -1707,18 +1709,18 @@
|gridX n|
gridAlign notNil ifTrue:[gridX := gridAlign x]
- ifFalse:[gridX := 1].
+ ifFalse:[gridX := 1].
self moveDo:[:aView|
- aligning ifTrue:[
- n := ((aView computeCorner x) \\ gridX).
-
- n ~~ 0 ifTrue:[n := n negated]
- ifFalse:[n := gridX]
- ] ifFalse:[
- n := 1
- ].
- self shiftLayout:aView left:n right:n
+ aligning ifTrue:[
+ n := ((aView computeCorner x) \\ gridX).
+
+ n ~~ 0 ifTrue:[n := n negated]
+ ifFalse:[n := gridX]
+ ] ifFalse:[
+ n := 1
+ ].
+ self shiftLayout:aView left:n right:n
]
!
@@ -1728,17 +1730,17 @@
|gridY n|
gridAlign notNil ifTrue:[gridY := gridAlign y]
- ifFalse:[gridY := 1].
+ ifFalse:[gridY := 1].
self moveDo:[:aView|
- aligning ifTrue:[
- n := ((aView computeOrigin x) \\ gridY).
- n == 0 ifTrue:[n := gridY].
- n := n negated.
- ] ifFalse:[
- n := -1
- ].
- self shiftLayout:aView top:n bottom:n
+ aligning ifTrue:[
+ n := ((aView computeOrigin x) \\ gridY).
+ n == 0 ifTrue:[n := gridY].
+ n := n negated.
+ ] ifFalse:[
+ n := -1
+ ].
+ self shiftLayout:aView top:n bottom:n
]
! !
@@ -1752,23 +1754,23 @@
|bmost delta sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- bmost := (sel first) computeCorner y.
-
- self transaction:#alignBottom selectionDo:[:v|
- (delta := bmost - (v computeCorner y)) ~~ 0 ifTrue:[
- self shiftLayout:v top:delta bottom:delta.
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#Bottom do:[:aLayout|
- aLayout bottomOffset:0.
- aLayout bottomFraction:1.0
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ bmost := (sel first) computeCorner y.
+
+ self transaction:#alignBottom selectionDo:[:v|
+ (delta := bmost - (v computeCorner y)) ~~ 0 ifTrue:[
+ self shiftLayout:v top:delta bottom:delta.
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#Bottom do:[:aLayout|
+ aLayout bottomOffset:0.
+ aLayout bottomFraction:1.0
+ ]
+ ]
+ ].
+ self layoutChanged
]
@@ -1782,30 +1784,30 @@
|view center sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- view := self singleSelection.
-
- view notNil ifTrue:[
+ self withSelectionHiddenDo:[
+ view := self singleSelection.
+
+ view notNil ifTrue:[
- view := self findContainerOfView:view.
- center := view computeExtent
- ] ifFalse:[
- view := sel first.
- center := view computeCorner + view computeOrigin.
- ].
- center := center x // 2.
-
- self transaction:#alignCenterHorizontal selectionDo:[:v|
- |newX oldX delta|
-
- oldX := v computeOrigin x.
- newX := center - ((v computeCorner x - oldX) // 2).
- delta := newX - oldX.
-
- self shiftLayout:v left:delta right:delta
- ]
- ].
- self layoutChanged
+ view := self findContainerOfView:view.
+ center := view computeExtent
+ ] ifFalse:[
+ view := sel first.
+ center := view computeCorner + view computeOrigin.
+ ].
+ center := center x // 2.
+
+ self transaction:#alignCenterHorizontal selectionDo:[:v|
+ |newX oldX delta|
+
+ oldX := v computeOrigin x.
+ newX := center - ((v computeCorner x - oldX) // 2).
+ delta := newX - oldX.
+
+ self shiftLayout:v left:delta right:delta
+ ]
+ ].
+ self layoutChanged
]
@@ -1819,29 +1821,29 @@
|view center sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- view := self singleSelection.
-
- view notNil ifTrue:[
- view := self findContainerOfView:view.
- center := view computeExtent
- ] ifFalse:[
- view := sel first.
- center := view computeCorner + view computeOrigin.
- ].
- center := center y // 2.
-
- self transaction:#alignCenterVertical selectionDo:[:v|
- |newY oldY delta|
-
- oldY := v computeOrigin y.
- newY := center - ((v computeCorner y - oldY) // 2).
- delta := newY - oldY.
-
- self shiftLayout:v top:delta bottom:delta
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ view := self singleSelection.
+
+ view notNil ifTrue:[
+ view := self findContainerOfView:view.
+ center := view computeExtent
+ ] ifFalse:[
+ view := sel first.
+ center := view computeCorner + view computeOrigin.
+ ].
+ center := center y // 2.
+
+ self transaction:#alignCenterVertical selectionDo:[:v|
+ |newY oldY delta|
+
+ oldY := v computeOrigin y.
+ newY := center - ((v computeCorner y - oldY) // 2).
+ delta := newY - oldY.
+
+ self shiftLayout:v top:delta bottom:delta
+ ]
+ ].
+ self layoutChanged
]
!
@@ -1852,23 +1854,23 @@
|lmost delta sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- lmost := (sel first) computeOrigin x.
-
- self transaction:#alignLeft selectionDo:[:v|
- (delta := lmost - (v computeOrigin x)) ~~ 0 ifTrue:[
- self shiftLayout:v left:delta right:delta
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#Left do:[:aLayout|
- aLayout leftOffset:0.
- aLayout leftFraction:0.0.
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ lmost := (sel first) computeOrigin x.
+
+ self transaction:#alignLeft selectionDo:[:v|
+ (delta := lmost - (v computeOrigin x)) ~~ 0 ifTrue:[
+ self shiftLayout:v left:delta right:delta
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#Left do:[:aLayout|
+ aLayout leftOffset:0.
+ aLayout leftFraction:0.0.
+ ]
+ ]
+ ].
+ self layoutChanged
]
!
@@ -1879,36 +1881,36 @@
|lmost rmost sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- lmost := (sel first) computeOrigin x.
- rmost := (sel first) computeCorner x.
-
- self transaction:#alignLeftRight selectionDo:[:aView|
- |layout|
- layout := self class asLayoutFrameFromView:aView.
-
- layout notNil ifTrue:[
- self createUndoLayout:aView.
- aView geometryLayout:layout.
-
- undoHistory withoutTransactionDo:[
- self shiftLayout:aView left:(lmost - (aView computeOrigin x))
- right:(rmost - (aView computeCorner x)).
- ].
- self elementChangedSize:aView
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#LeftRight do:[:aLayout|
- aLayout leftOffset:0.
- aLayout leftFraction:0.0.
- aLayout rightOffset:0.
- aLayout rightFraction:1.0.
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ lmost := (sel first) computeOrigin x.
+ rmost := (sel first) computeCorner x.
+
+ self transaction:#alignLeftRight selectionDo:[:aView|
+ |layout|
+ layout := self class asLayoutFrameFromView:aView.
+
+ layout notNil ifTrue:[
+ self createUndoLayout:aView.
+ aView geometryLayout:layout.
+
+ undoHistory withoutTransactionDo:[
+ self shiftLayout:aView left:(lmost - (aView computeOrigin x))
+ right:(rmost - (aView computeCorner x)).
+ ].
+ self elementChangedSize:aView
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#LeftRight do:[:aLayout|
+ aLayout leftOffset:0.
+ aLayout leftFraction:0.0.
+ aLayout rightOffset:0.
+ aLayout rightFraction:1.0.
+ ]
+ ]
+ ].
+ self layoutChanged
].
!
@@ -1920,23 +1922,23 @@
|rmost delta sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- rmost := (sel first) computeCorner x.
-
- self transaction:#alignRight selectionDo:[:v|
- (delta := rmost - (v computeCorner x)) ~~ 0 ifTrue:[
- self shiftLayout:v left:delta right:delta
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#Right do:[:aLayout|
- aLayout rightOffset:0.
- aLayout rightFraction:1.0.
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ rmost := (sel first) computeCorner x.
+
+ self transaction:#alignRight selectionDo:[:v|
+ (delta := rmost - (v computeCorner x)) ~~ 0 ifTrue:[
+ self shiftLayout:v left:delta right:delta
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#Right do:[:aLayout|
+ aLayout rightOffset:0.
+ aLayout rightFraction:1.0.
+ ]
+ ]
+ ].
+ self layoutChanged
]
!
@@ -1947,23 +1949,23 @@
|tmost delta sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- tmost := (sel first) computeOrigin y.
-
- self transaction:#alignTop selectionDo:[:v|
- (delta := tmost - (v computeOrigin y)) ~~ 0 ifTrue:[
- self shiftLayout:v top:delta bottom:delta
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#Top do:[:aLayout|
- aLayout topOffset:0.
- aLayout topFraction:0.0.
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ tmost := (sel first) computeOrigin y.
+
+ self transaction:#alignTop selectionDo:[:v|
+ (delta := tmost - (v computeOrigin y)) ~~ 0 ifTrue:[
+ self shiftLayout:v top:delta bottom:delta
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#Top do:[:aLayout|
+ aLayout topOffset:0.
+ aLayout topFraction:0.0.
+ ]
+ ]
+ ].
+ self layoutChanged
]
!
@@ -1975,36 +1977,36 @@
|tmost bmost sel|
(sel := self moveableSelection) notNil ifTrue:[
- self withSelectionHiddenDo:[
- self numberOfSelections > 1 ifTrue:[
- tmost := (sel first) computeOrigin y.
- bmost := (sel first) computeCorner y.
-
- self transaction:#alignTopBottom selectionDo:[:aView|
- |layout|
- layout := self class asLayoutFrameFromView:aView.
-
- layout notNil ifTrue:[
- self createUndoLayout:aView.
- aView geometryLayout:layout.
-
- undoHistory withoutTransactionDo:[
- self shiftLayout:aView top:(tmost - (aView computeOrigin y))
- bottom:(bmost - (aView computeCorner y)).
- ].
- self elementChangedSize:aView
- ]
- ]
- ] ifFalse:[
- self extentToFrame:#TopBottom do:[:aLayout|
- aLayout topOffset:0.
- aLayout topFraction:0.0.
- aLayout bottomOffset:0.
- aLayout bottomFraction:1.0.
- ]
- ]
- ].
- self layoutChanged
+ self withSelectionHiddenDo:[
+ self numberOfSelections > 1 ifTrue:[
+ tmost := (sel first) computeOrigin y.
+ bmost := (sel first) computeCorner y.
+
+ self transaction:#alignTopBottom selectionDo:[:aView|
+ |layout|
+ layout := self class asLayoutFrameFromView:aView.
+
+ layout notNil ifTrue:[
+ self createUndoLayout:aView.
+ aView geometryLayout:layout.
+
+ undoHistory withoutTransactionDo:[
+ self shiftLayout:aView top:(tmost - (aView computeOrigin y))
+ bottom:(bmost - (aView computeCorner y)).
+ ].
+ self elementChangedSize:aView
+ ]
+ ]
+ ] ifFalse:[
+ self extentToFrame:#TopBottom do:[:aLayout|
+ aLayout topOffset:0.
+ aLayout topFraction:0.0.
+ aLayout bottomOffset:0.
+ aLayout bottomFraction:1.0.
+ ]
+ ]
+ ].
+ self layoutChanged
]
!
@@ -2015,47 +2017,47 @@
|superview min max delta val|
(self moveableSelection) isNil ifTrue:[
- ^ self
+ ^ self
].
self withSelectionHiddenDo:[
- max := 0.
-
- self selectionDo:[:aView |
- superview isNil ifTrue:[
- superview := self findContainerOfView:aView
- ] ifFalse:[
- (self findContainerOfView:aView) == superview ifFalse:[
- ^ self notify:'views must have same superview'.
- ]
- ].
- val := aOneArgBlockXorY value:(aView computeOrigin).
-
- min isNil ifTrue:[min := val]
- ifFalse:[min := min min:val].
-
- val := aOneArgBlockXorY value:(aView computeCorner).
- max := max max:val.
- ].
-
- val := aOneArgBlockXorY value:(superview computeExtent).
- max := (min + val - max) // 2.
-
- max == min ifFalse:[
- |type|
- (orientation == #y) ifTrue:[type := #centerVertical]
- ifFalse:[type := #centerHorizontal].
- delta := max - min.
-
- self transaction:type selectionDo:[:v|
- orientation == #y ifTrue:[
- self shiftLayout:v top:delta bottom:delta
- ] ifFalse:[
- self shiftLayout:v left:delta right:delta
- ]
- ]
- ].
- self layoutChanged
+ max := 0.
+
+ self selectionDo:[:aView |
+ superview isNil ifTrue:[
+ superview := self findContainerOfView:aView
+ ] ifFalse:[
+ (self findContainerOfView:aView) == superview ifFalse:[
+ ^ self notify:'views must have same superview'.
+ ]
+ ].
+ val := aOneArgBlockXorY value:(aView computeOrigin).
+
+ min isNil ifTrue:[min := val]
+ ifFalse:[min := min min:val].
+
+ val := aOneArgBlockXorY value:(aView computeCorner).
+ max := max max:val.
+ ].
+
+ val := aOneArgBlockXorY value:(superview computeExtent).
+ max := (min + val - max) // 2.
+
+ max == min ifFalse:[
+ |type|
+ (orientation == #y) ifTrue:[type := #centerVertical]
+ ifFalse:[type := #centerHorizontal].
+ delta := max - min.
+
+ self transaction:type selectionDo:[:v|
+ orientation == #y ifTrue:[
+ self shiftLayout:v top:delta bottom:delta
+ ] ifFalse:[
+ self shiftLayout:v left:delta right:delta
+ ]
+ ]
+ ].
+ self layoutChanged
]
@@ -2083,14 +2085,14 @@
type := ('extent', toWhat asString) asSymbol.
self transaction:type selectionDo:[:aView|
- layout := self class asLayoutFrameFromView:aView.
-
- layout notNil ifTrue:[
- self createUndoLayout:aView.
- aBlock value:layout.
- aView geometryLayout:layout.
- self elementChangedSize:aView.
- ]
+ layout := self class asLayoutFrameFromView:aView.
+
+ layout notNil ifTrue:[
+ self createUndoLayout:aView.
+ aBlock value:layout.
+ aView geometryLayout:layout.
+ self elementChangedSize:aView.
+ ]
]
!
@@ -2102,36 +2104,36 @@
sel := self moveableSelection.
(sel notNil and:[self numberOfSelections > 1]) ifFalse:[
- ^ self
+ ^ self
].
self withSelectionHiddenDo:[
- count := 0.
- sumWidths := 0.
- max := 0.
-
- self selectionDo:[:aView |
- sumWidths := sumWidths + aView width.
-
- min isNil ifTrue:[min := aView left]
- ifFalse:[min := min min:(aView left)].
-
- max := max max:(aView right).
- count := count + 1
- ].
- viewsInOrder := Array withAll:sel.
- topsInOrder := viewsInOrder collect:[:aView | aView left].
- topsInOrder sortWith:viewsInOrder.
-
- space := (((max - min) - sumWidths) / (count - 1)) rounded asInteger.
-
- self transaction:#spreadHorizontal objects:viewsInOrder do:[:aView|
- |delta|
-
- delta := min - aView computeOrigin x.
- self shiftLayout:aView left:delta right:delta.
- min := min + aView computeExtent x + space
- ]
+ count := 0.
+ sumWidths := 0.
+ max := 0.
+
+ self selectionDo:[:aView |
+ sumWidths := sumWidths + aView width.
+
+ min isNil ifTrue:[min := aView left]
+ ifFalse:[min := min min:(aView left)].
+
+ max := max max:(aView right).
+ count := count + 1
+ ].
+ viewsInOrder := Array withAll:sel.
+ topsInOrder := viewsInOrder collect:[:aView | aView left].
+ topsInOrder sortWith:viewsInOrder.
+
+ space := (((max - min) - sumWidths) / (count - 1)) rounded asInteger.
+
+ self transaction:#spreadHorizontal objects:viewsInOrder do:[:aView|
+ |delta|
+
+ delta := min - aView computeOrigin x.
+ self shiftLayout:aView left:delta right:delta.
+ min := min + aView computeExtent x + space
+ ]
].
self layoutChanged
@@ -2145,36 +2147,36 @@
sel := self moveableSelection.
(sel notNil and:[self numberOfSelections > 1]) ifFalse:[
- ^ self
+ ^ self
].
self withSelectionHiddenDo:[
- count := 0.
- sumHeights := 0.
- max := 0.
-
- self selectionDo:[:aView |
- sumHeights := sumHeights + aView height.
-
- min isNil ifTrue:[min := aView top]
- ifFalse:[min := min min:(aView top)].
-
- max := max max:(aView bottom).
- count := count + 1
- ].
- viewsInOrder := Array withAll:sel.
- topsInOrder := viewsInOrder collect:[:aView|aView top].
- topsInOrder sortWith:viewsInOrder.
-
- space := (((max - min) - sumHeights) / (count - 1)) rounded asInteger.
-
- self transaction:#spreadVertical objects:viewsInOrder do:[:aView|
- |delta|
-
- delta := min - aView computeOrigin y.
- self shiftLayout:aView top:delta bottom:delta.
- min := min + aView height + space
- ]
+ count := 0.
+ sumHeights := 0.
+ max := 0.
+
+ self selectionDo:[:aView |
+ sumHeights := sumHeights + aView height.
+
+ min isNil ifTrue:[min := aView top]
+ ifFalse:[min := min min:(aView top)].
+
+ max := max max:(aView bottom).
+ count := count + 1
+ ].
+ viewsInOrder := Array withAll:sel.
+ topsInOrder := viewsInOrder collect:[:aView|aView top].
+ topsInOrder sortWith:viewsInOrder.
+
+ space := (((max - min) - sumHeights) / (count - 1)) rounded asInteger.
+
+ self transaction:#spreadVertical objects:viewsInOrder do:[:aView|
+ |delta|
+
+ delta := min - aView computeOrigin y.
+ self shiftLayout:aView top:delta bottom:delta.
+ min := min + aView height + space
+ ]
].
self layoutChanged
! !
@@ -2206,26 +2208,26 @@
|newSel oldSel|
undoHistory isEmpty ifFalse:[
- self hasSelection ifTrue:[
- oldSel := OrderedCollection new.
- newSel := OrderedCollection new.
-
- self selectionDo:[:aView||p|
- (p := self propertyOfView:aView) notNil ifTrue:[
- oldSel add:(p identifier)
- ]
- ].
- self setSelection:nil withRedraw:true.
- ].
-
- self withSelectionHiddenDo:[undoHistory undoLast:1].
-
- oldSel notNil ifTrue:[
- oldSel do:[:id||v|
- (v := self findViewWithId:id) notNil ifTrue:[newSel add:v]
- ].
- self select:newSel.
- ]
+ self hasSelection ifTrue:[
+ oldSel := OrderedCollection new.
+ newSel := OrderedCollection new.
+
+ self selectionDo:[:aView||p|
+ (p := self propertyOfView:aView) notNil ifTrue:[
+ oldSel add:(p identifier)
+ ]
+ ].
+ self setSelection:nil withRedraw:true.
+ ].
+
+ self withSelectionHiddenDo:[undoHistory undoLast:1].
+
+ oldSel notNil ifTrue:[
+ oldSel do:[:id||v|
+ (v := self findViewWithId:id) notNil ifTrue:[newSel add:v]
+ ].
+ self select:newSel.
+ ]
].
! !
@@ -2277,11 +2279,11 @@
undo block will be performed.
[see also:]
- UIObjectView
- UIPainterView
+ UIObjectView
+ UIPainterView
[author:]
- Claus Atzkern
+ Claus Atzkern
"
@@ -2306,7 +2308,7 @@
transaction is opened or disabled the block will not be kept in the history.
"
self isTransactionOpen ifTrue:[
- transaction add:(Association key:aSelector value:anArray)
+ transaction add:(Association key:aSelector value:anArray)
]
@@ -2334,20 +2336,20 @@
"open a transaction; perform the block; at least close the transaction
"
(enabled and:[transaction isNil]) ifTrue:[
- transaction := Transaction type:aType text:aTextOrNil.
-
- aBlock value.
-
- transaction isEmpty ifFalse:[
- identifier := identifier + 1.
- transaction identifier:identifier.
- history addLast:transaction.
- history size > (self class maxHistorySize) ifTrue:[history removeFirst]
- ].
- transaction := nil
+ transaction := Transaction type:aType text:aTextOrNil.
+
+ aBlock value.
+
+ transaction isEmpty ifFalse:[
+ identifier := identifier + 1.
+ transaction identifier:identifier.
+ history addLast:transaction.
+ history size > (self class maxHistorySize) ifTrue:[history removeFirst]
+ ].
+ transaction := nil
] ifFalse:[
- aBlock value
+ aBlock value
]
!
@@ -2385,7 +2387,7 @@
|list tabs top slv hzp inset selection okButton|
history isEmpty ifTrue:[
- ^ self
+ ^ self
].
top := StandardSystemView new label:'undo history'; extent:250@350.
@@ -2409,11 +2411,11 @@
tabs align:#(#left #left).
list := history collect:[:aTrans||e|
- e := MultiColListEntry new.
- e colAt:1 put:(aTrans typeAsString).
- e colAt:2 put:(aTrans text ? '').
- e tabulatorSpecification:tabs.
- e
+ e := MultiColListEntry new.
+ e colAt:1 put:(aTrans typeAsString).
+ e colAt:2 put:(aTrans text ? '').
+ e tabulatorSpecification:tabs.
+ e
].
slv list:list.
@@ -2421,7 +2423,7 @@
top openModal.
selection notNil ifTrue:[
- self undoLast:(history size - selection + 1).
+ self undoLast:(history size - selection + 1).
]
! !
@@ -2439,7 +2441,7 @@
"returns true if history is modified
"
self isEmpty ifTrue:[
- ^ false
+ ^ false
].
^ history last identifier ~~ startIdentifier
!
@@ -2461,16 +2463,16 @@
repeatTimes := nTransactions min:(history size).
repeatTimes timesRepeat:[
- transaction := history removeLast.
- actions := transaction actions.
-
- actions isCollection ifTrue:[
- actions reverseDo:[:aBlock|
- painter perform:(aBlock key) with:(aBlock value)
- ]
- ] ifFalse:[
- painter perform:(actions key) with:(actions value)
- ]
+ transaction := history removeLast.
+ actions := transaction actions.
+
+ actions isCollection ifTrue:[
+ actions reverseDo:[:aBlock|
+ painter perform:(aBlock key) with:(aBlock value)
+ ]
+ ] ifFalse:[
+ painter perform:(actions key) with:(actions value)
+ ]
].
enabled := true.
! !
@@ -2483,10 +2485,10 @@
and the undo action performed on an undo request
[see also:]
- UndoHistory
+ UndoHistory
[author:]
- Claus Atzkern
+ Claus Atzkern
"
! !
@@ -2550,15 +2552,15 @@
sep := Character space.
line do:[:c|
- (c isUppercase) ifFalse:[
- name at:size put:c
- ] ifTrue:[
- name at:size put:sep.
- sep := $&.
- size := size + 1.
- name at:size put:(c asLowercase)
- ].
- size := size + 1
+ (c isUppercase) ifFalse:[
+ name at:size put:c
+ ] ifTrue:[
+ name at:size put:sep.
+ sep := $&.
+ size := size + 1.
+ name at:size put:(c asLowercase)
+ ].
+ size := size + 1
].
^ name
! !
@@ -2569,12 +2571,12 @@
"add an undo action to the current transaction
"
actions isNil ifTrue:[
- actions := anUndoBlock
+ actions := anUndoBlock
] ifFalse:[
- actions isCollection ifFalse:[
- actions := OrderedCollection with:actions
- ].
- actions add:anUndoBlock.
+ actions isCollection ifFalse:[
+ actions := OrderedCollection with:actions
+ ].
+ actions add:anUndoBlock.
]
! !