# HG changeset patch # User Stefan Vogel # Date 1237986357 -3600 # Node ID b8999543e2b48dfc75af090180aa0161a11df595 # Parent 6effcbfba4e3cdf5160b82bdac8c45f8202417fc UIPainter can now resize subviews of PanelViews diff -r 6effcbfba4e3 -r b8999543e2b4 UIObjectView.st --- a/UIObjectView.st Wed Mar 25 12:58:07 2009 +0100 +++ b/UIObjectView.st Wed Mar 25 14:05:57 2009 +0100 @@ -1288,6 +1288,21 @@ ^ 1 ! +resizableSelection + "checks whether the selection is not empty and all selected instances + can be resized. If true the selection is returned otherwise nil + " + |coll| + + self hasSelection ifTrue:[ + coll := self selection. + (self canResize:coll) ifTrue:[ + ^ coll + ] + ]. + ^ nil +! + selectNextUpInHierarchy self halt:#ca. ! @@ -1437,48 +1452,7 @@ 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 - ]. - isRepaired ifTrue:[ theDamages removeIndex:anIndex ]. - ] - ]. + height := aView height + bwWidth + bwWid ! selection @@ -2177,7 +2151,7 @@ " |lmost rmost sel| - (sel := self moveableSelection) notNil ifTrue:[ + (sel := self resizableSelection) notNil ifTrue:[ self withSelectionHiddenDo:[ self numberOfSelections > 1 ifTrue:[ lmost := (sel first) computeOrigin x. @@ -2185,18 +2159,26 @@ self transaction:#alignLeftRight selectionDo:[:aView| |layout| - layout := self class asLayoutFrameFromView:aView. - - layout notNil ifTrue:[ + + aView superView isLayoutWrapper ifTrue:[ + "change size only" self createUndoLayout:aView. - aView geometryLayout:layout. - - undoHistory withoutTransactionDo:[ - self shiftLayout:aView left:(lmost - (aView computeOrigin x)) - right:(rmost - (aView computeCorner x)). + aView width:sel first width. + self elementChangedSize:aView + ] ifFalse:[ + 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 ]. - self elementChangedSize:aView - ] + ]. ] ] ifFalse:[ self extentToFrame:#LeftRight do:[:aLayout| @@ -2273,7 +2255,7 @@ " |tmost bmost sel| - (sel := self moveableSelection) notNil ifTrue:[ + (sel := self resizableSelection) notNil ifTrue:[ self withSelectionHiddenDo:[ self numberOfSelections > 1 ifTrue:[ tmost := (sel first) computeOrigin y. @@ -2281,18 +2263,25 @@ self transaction:#alignTopBottom selectionDo:[:aView| |layout| - layout := self class asLayoutFrameFromView:aView. - - layout notNil ifTrue:[ + aView superView isLayoutWrapper ifTrue:[ + "change size only" self createUndoLayout:aView. - aView geometryLayout:layout. - - undoHistory withoutTransactionDo:[ - self shiftLayout:aView top:(tmost - (aView computeOrigin y)) - bottom:(bmost - (aView computeCorner y)). + aView height:sel first height. + self elementChangedSize:aView + ] ifFalse:[ + 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 ]. - self elementChangedSize:aView - ] + ]. ] ] ifFalse:[ self extentToFrame:#TopBottom do:[:aLayout|