diff -r fcf2ecbdde67 -r 85b9b5da0b8d UIObjectView.st --- a/UIObjectView.st Mon Nov 13 12:14:23 2000 +0100 +++ b/UIObjectView.st Wed Nov 15 11:35:31 2000 +0100 @@ -942,26 +942,6 @@ !UIObjectView methodsFor:'private handles'! -handleAffectedViews:aViewOrSeqOfViews - "update affected views - " - |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) - ] - ] - - "Modified: / 16.9.1998 / 01:40:30 / cg" -! - handlesOf:aComponent do:aTwoArgAction "perform action on each handle of a component " @@ -972,88 +952,10 @@ 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 ] ! -showUnselected:aComponent - "show object unselected - " - self showUnselected:aComponent addAffectedViewsTo:nil -! - -showUnselected:aComponent addAffectedViewsTo:aSet - "show object unselected. If the set, an IdentitySet, is not nil, the - affected subviews are added into the set, otherwise an expose event - to each affected component is raised. - " - |wasClipped r v| - - selectionHiddenLevel ~~ 0 ifTrue:[^ self]. - -"/ "/ new: simply create a little view ontop, -"/ "/ and move it over the handles. This will generate -"/ "/ the required expose events automatically. -"/ "/ mhmh - does not work correctly with inverted frame (exposes destroy it) -"/ -"/ v := SimpleView in:self. -"/ self handlesOf:aComponent do:[:rec :wht | -"/ r isNil -"/ ifTrue:[r := rec] -"/ ifFalse:[r := r merge:rec]. -"/ ]. -"/ -"/ "/ if the area is small, make one big rectangle-expose -"/ r area < 10000 ifTrue:[ -"/ v origin:r origin extent:r extent. -"/ v map. -"/ v unmap. -"/ ] ifFalse:[ -"/ self handlesOf:aComponent do:[:rec :wht | -"/ v origin:rec origin extent:rec extent. -"/ v map. -"/ v unmap. -"/ ]. -"/ ]. -"/ v destroy. -"/ ^ self. - - (wasClipped := clipChildren) ifTrue:[ - self clippedByChildren:(clipChildren := false). - ]. - - self handlesOf:aComponent do:[:rec :wht| self clearRectangle:rec ]. - - wasClipped ifTrue:[ - 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 - ] - ] - ] - ] - ] - ]. - - "Modified: / 24.8.1998 / 12:19:38 / cg" -! - whichHandleOf:aComponent isHitBy:aPoint "returns kind of handle or nil " @@ -1258,19 +1160,9 @@ !UIObjectView methodsFor:'selections'! hideSelection - "hide the selection - undraw hilights - whatever that is" - - |aSet| - - self selectionDo:[:object| - aSet isNil ifTrue:[ - aSet := IdentitySet new - ]. - self showUnselected:object addAffectedViewsTo:aSet. - ]. - self handleAffectedViews:aSet. - - + "hide the selection - undraw hilights - whatever that is + " + self showUnselected:selection. ! moveableSelection @@ -1413,6 +1305,85 @@ !UIObjectView methodsFor:'selections basic'! +recursiveRepair:theDamages startIn:aView + "repair all views and contained views, which intersects the damage. + !!!! all damages repaired are removed from the list of damages !!!! + " + |color isRepaired relOrg damage + bwWidth "{ Class:SmallInteger }" + x "{ Class:SmallInteger }" + y "{ Class:SmallInteger }" + w "{ Class:SmallInteger }" + h "{ Class:SmallInteger }" + relOrgX "{ Class:SmallInteger }" + relOrgY "{ Class:SmallInteger }" + width "{ Class:SmallInteger }" + height "{ Class:SmallInteger }" + size "{ Class:SmallInteger }" + | + aView isInputOnly ifTrue:[^ self]. + + (aView shown and:[theDamages notEmpty]) ifFalse:[ ^ theDamages ]. + + aView subViews notNil ifTrue:[ + aView subViews reverseDo:[:v| self recursiveRepair:theDamages startIn:v ]. + theDamages isEmpty ifTrue:[ ^ self ]. + ]. + + relOrg := aView originRelativeTo:self. + bwWidth := aView borderWidth. + size := theDamages size. + + "/ compute relative origin starting from border left@top + relOrgX := relOrg x - bwWidth. + relOrgY := relOrg y - bwWidth. + width := aView width + bwWidth + bwWidth. + height := aView height + bwWidth + bwWidth. + + size to:1 by:-1 do:[:anIndex| + damage := theDamages at:anIndex. + + "/ compute the rectangle into the view + y := damage top - relOrgY. + x := damage left - relOrgX. + w := damage width. + h := damage height. + + isRepaired := true. + + x < 0 ifTrue:[ w := w + x. x := 0. isRepaired := false ]. + y < 0 ifTrue:[ h := h + y. y := 0. isRepaired := false ]. + x + w > width ifTrue:[ w := width - x. isRepaired := false ]. + y + h > height ifTrue:[ h := height - y. isRepaired := false ]. + + (w > 0 and:[h > 0]) ifTrue:[ + bwWidth ~~ 0 ifTrue:[ + color isNil ifTrue:[ + "/ must force redraw of border + color := aView borderColor. + aView borderColor:(Color colorId:1). + aView borderColor:color. + ]. + w := w - bwWidth. + h := h - bwWidth. + + (x := x - bwWidth) < 0 ifTrue:[w := w + x. x := 0]. + (y := y - bwWidth) < 0 ifTrue:[h := h + y. y := 0]. + + (w > 0 and:[h > 0]) ifFalse:[w := 0]. + ]. + + w > 0 ifTrue:[ +"/ aView clearRectangleX:x y:y width:w height:h. + aView exposeX:x y:y width:w height:h + ]. + ] ifFalse:[ + isRepaired := false + ]. + isRepaired ifTrue:[ theDamages removeIndex:anIndex ]. + ]. +! + selection "returns the current selection " @@ -1437,6 +1408,36 @@ ] ifFalse:[ selection := sel ] +! + +showUnselected:something + "show a component ot list of components unselected + " + |damages oldClipped| + + (selectionHiddenLevel ~~ 0 or:[something isNil]) ifTrue:[ + ^ self + ]. + damages := OrderedCollection new. + + (oldClipped := clipChildren) ifTrue:[ + self clippedByChildren:(clipChildren := false) + ]. + + self forEach:something do:[:v| + self handlesOf:v do:[:rec :wht| + self clearRectangle:rec. + damages add:rec + ] + ]. + + subViews notNil ifTrue:[ + self clippedByChildren:(clipChildren := true). + subViews reverseDo:[:v| self recursiveRepair:damages startIn:v ]. + ]. + oldClipped ~~ clipChildren ifTrue:[ + self clippedByChildren:(clipChildren := oldClipped). + ]. ! ! !UIObjectView methodsFor:'testing'!