diff -r 335faeed1663 -r 035c98964c38 UIObjectView.st --- a/UIObjectView.st Wed Jun 04 13:28:48 1997 +0200 +++ b/UIObjectView.st Wed Jun 04 13:31:50 1997 +0200 @@ -321,6 +321,10 @@ a selected instance " + "/ 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. @@ -823,6 +827,14 @@ self invertOutlineOf:object. self setDefaultActions. self elementChangedSize:object. + + "/ handle any expose events (for subcomponents) before + "/ redrawing the handles. + Delay waitForSeconds:0.05. + [self sensor hasExposeEventFor:nil] whileTrue:[ + self windowGroup processExposeEvents + ]. + self setSelection:object withRedraw:true. self changed:#layout. ! @@ -897,6 +909,8 @@ " |wasClipped delta| + selectionHiddenLevel ~~ 0 ifTrue:[^ self]. + self paint:Color black. (wasClipped := clipChildren) ifTrue:[ @@ -919,6 +933,8 @@ " |wasClipped delta r| + selectionHiddenLevel ~~ 0 ifTrue:[^ self]. + (wasClipped := clipChildren) ifTrue:[ self clippedByChildren:(clipChildren := false). ]. @@ -1314,12 +1330,11 @@ " |coll| - selectionHiddenLevel := selectionHiddenLevel + 1. - - selectionHiddenLevel == 1 ifTrue:[ + selectionHiddenLevel == 0 ifTrue:[ self selectionDo:[:aView| self showUnselected:aView]. device flush. ]. + selectionHiddenLevel := selectionHiddenLevel + 1. aBlock valueNowOrOnUnwindDo:[ selectionHiddenLevel == 1 ifTrue:[ @@ -1328,9 +1343,11 @@ coll do:[:aView| aView sizeChanged:nil]. setOfSuperViewsSizeChanged := IdentitySet new ]. + selectionHiddenLevel := 0. self selectionDo:[:aView| self showSelected:aView]. - ]. - selectionHiddenLevel := selectionHiddenLevel - 1. + ] ifFalse:[ + selectionHiddenLevel := selectionHiddenLevel - 1. + ] ] ! @@ -1710,33 +1727,60 @@ !UIObjectView methodsFor:'user actions - move'! +moveDo:aOneArgBlock + "perform a move operation + " + |sensor tm| + + self moveableSelection isNil ifTrue:[ + ^ 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 changed:#layout. + 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 + ] + ]. +! + moveSelectionDown "move selection down " - |gridY n sel| - - self moveableSelection notNil ifTrue:[ - gridAlign notNil ifTrue:[gridY := gridAlign y]. - - self withSelectionHiddenDo:[ - self selectionDo:[: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 + |gridY n| + + gridAlign notNil ifTrue:[gridY := gridAlign y] + 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 changed:#layout + self shiftLayout:aView top:n bottom:n ] - ! moveSelectionLeft @@ -1744,22 +1788,18 @@ " |gridX n| - self moveableSelection notNil ifTrue:[ - gridAlign notNil ifTrue:[gridX := gridAlign x]. - - self withSelectionHiddenDo:[ - self selectionDo:[: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 - ] + gridAlign notNil ifTrue:[gridX := gridAlign x] + 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 changed:#layout + self shiftLayout:aView left:n right:n ] ! @@ -1768,23 +1808,19 @@ " |gridX n| - self moveableSelection notNil ifTrue:[ - gridAlign notNil ifTrue:[gridX := gridAlign x]. - - self withSelectionHiddenDo:[ - self selectionDo:[: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 - ] + gridAlign notNil ifTrue:[gridX := gridAlign x] + 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 changed:#layout + self shiftLayout:aView left:n right:n ] ! @@ -1793,22 +1829,18 @@ " |gridY n| - self moveableSelection notNil ifTrue:[ - gridAlign notNil ifTrue:[gridY := gridAlign y]. - - self withSelectionHiddenDo:[ - self selectionDo:[: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 - ] + gridAlign notNil ifTrue:[gridY := gridAlign y] + 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 changed:#layout + self shiftLayout:aView top:n bottom:n ] ! ! @@ -2259,14 +2291,8 @@ openUndoMenu "open undo menu " - undoHistory isEmpty ifFalse:[ - self select:nil. - - self withSelectionHiddenDo:[ - undoHistory openUndoMenu - ] - ]. - + self selection:nil. + undoHistory openUndoMenu ! removeUndoHistory @@ -2278,14 +2304,32 @@ undoLast "undo last action " + |newSel oldSel| + undoHistory isEmpty ifFalse:[ - self select:nil. - - self withSelectionHiddenDo:[ - undoHistory undoLast:1 + 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. ] ]. - ! ! !UIObjectView::UndoHistory class methodsFor:'constants'!