# HG changeset patch # User ca # Date 857220181 -3600 # Node ID 407d25aca67023a698d82ce800e64a104e8d5f51 # Parent 4e667db109105d4cfe5c9d8df2de8d7905eb2c26 checkin from browser diff -r 4e667db10910 -r 407d25aca670 UIPainterView.st --- a/UIPainterView.st Fri Feb 28 20:25:14 1997 +0100 +++ b/UIPainterView.st Sat Mar 01 13:43:01 1997 +0100 @@ -28,7 +28,7 @@ ! UIPainterView::ViewProperty subclass:#GroupProperties - instanceVariableNames:'controlledObjects group' + instanceVariableNames:'controlledObjects group groupName' classVariableNames:'' poolDictionaries:'' privateIn:UIPainterView @@ -199,29 +199,31 @@ copySelection "copy the selection into the cut&paste-buffer " - |specs| + |specs coll| + + coll := self minSetOfSuperViews:selection. - specs := self generateSpecFor:selection. - - specs notNil ifTrue:[ + coll notNil ifTrue:[ + self unselect. + specs := self generateSpecFor:coll. self setSelection:specs ]. - self unselect. ! deleteSelection "delete the selection; copy the selection into the cut&paste-buffer and open a transaction " - |text specs| + |text specs newSel| + + newSel := self minSetOfSuperViews:selection. - self numberOfSelections ~~ 0 ifTrue:[ - specs := self generateSpecFor:selection. - text := self transactionTextFor:selection. + newSel notNil ifTrue:[ + self unselect. + specs := self generateSpecFor:newSel. + text := self transactionTextFor:newSel. - undoHistory transaction:#cut text:text do:[ - super deleteSelection - ]. + undoHistory transaction:#cut text:text do:[self remove:newSel]. self setSelection:specs ] ! @@ -1134,62 +1136,69 @@ menu "returns middle-button menu dependent on the selection " - |menu canPaste| + |menu canPaste undoIdx undoText| testMode ifTrue:[^ nil ]. canPaste := self canPaste:(self getSelection). + undoText := undoHistory lastTypeAsString. selection isNil ifTrue:[ - menu := PopUpMenu labels:( resources array:#('paste' 'undo')) + undoIdx := 2. + + menu := PopUpMenu labels:( resources array:#('paste' 'undo') ) selectors:#( #pasteBuffer #undoLast ) - accelerators:#( #Paste nil ) + accelerators:#( #Paste nil ) receiver:self. - canPaste ifFalse:[menu disable:#pasteBuffer]. - undoHistory isEmpty ifTrue:[menu disable:#undoLast]. - ^ menu - ]. + canPaste ifFalse:[menu disable:#pasteBuffer]. + ] ifFalse:[ + undoIdx := 4. - menu := PopUpMenu labels:( resources array:#( - 'copy' - 'cut' - 'paste' - 'undo' - '-' - 'arrange' - 'dimension' - 'align' - ) - ) - selectors:#( #copySelection - #deleteSelection - #pasteBuffer - #undoLast - nil - #arrange - #dimension - #align - ) - accelerators:#(#Copy - #Cut - #Paste - nil - nil - nil - nil - nil - ) - receiver:self. + menu := PopUpMenu labels:( resources array:#( + 'copy' + 'cut' + 'paste' + 'undo' + '-' + 'arrange' + 'dimension' + 'align' + ) + ) + selectors:#( #copySelection + #deleteSelection + #pasteBuffer + #undoLast + nil + #arrange + #dimension + #align + ) + accelerators:#(#Copy + #Cut + #Paste + nil + nil + nil + nil + nil + ) + receiver:self. - (canPaste and:[self canPasteInto:selection]) ifFalse:[ - menu disable:#pasteBuffer + (canPaste and:[self canPasteInto:selection]) ifFalse:[ + menu disable:#pasteBuffer + ]. + menu subMenuAt:#arrange put:(self subMenuArrange). + menu subMenuAt:#dimension put:(self subMenuDimension). + menu subMenuAt:#align put:(self subMenuAlign). ]. - undoHistory isEmpty ifTrue:[menu disable:#undoLast]. - menu subMenuAt:#arrange put:(self subMenuArrange). - menu subMenuAt:#dimension put:(self subMenuDimension). - menu subMenuAt:#align put:(self subMenuAlign). + undoText notNil ifTrue:[ + menu labelAt:undoIdx put:((menu labels at:undoIdx), ': ', undoText) + ] ifFalse:[ + menu disable:#undoLast + ]. ^ menu @@ -1501,6 +1510,51 @@ ifFalse:[^ nil] ! ! +!UIPainterView methodsFor:'selection'! + +addTreeFrom:aView to:aCollection + "add aView and contained subcomponents to collection + " + (self propertyOf:aView) notNil ifTrue:[ + aCollection add:aView. + + (aView subViews notNil) ifTrue:[ + aView subViews do:[:subView| + self addTreeFrom:subView to:aCollection + ] + ]. + ] + +! + +selectSubComponents + "select all subcomponents for current selection + " + |startAtView aCollection| + + aCollection := OrderedCollection new. + startAtView := self singleSelection. + + startAtView isNil ifTrue:[ + self subViews notNil ifTrue:[ + self subViews do:[:subView| + subView ~~ inputView ifTrue:[ + self addTreeFrom:subView to:aCollection + ] + ] + ] + ] ifFalse:[ + self addTreeFrom:startAtView to:aCollection + ]. + + aCollection size > 1 ifTrue:[ + self withSelectionHiddenDo:[ + selection := aCollection + ]. + self changed:#selection + ] +! ! + !UIPainterView methodsFor:'seraching property'! propertyOf:something @@ -1654,6 +1708,8 @@ " |view layout extent| + undoHistory isTransactionOpen ifFalse:[^ self]. + (view := self findViewWithId:aViewId) notNil ifTrue:[ (layout := view geometryLayout copy) isNil ifTrue:[ extent := view extent copy @@ -1686,6 +1742,8 @@ " |view prop spec parentId| + undoHistory isTransactionOpen ifFalse:[^ self]. + (view := self findViewWithId:aViewId) notNil ifTrue:[ spec := (self generateSpecFor:view) first. view := view superView. @@ -1724,6 +1782,8 @@ " |builder view spec| + undoHistory isTransactionOpen ifFalse:[^ self]. + (view := self findViewWithId:aViewId) notNil ifTrue:[ spec := (self generateSpecFor:view) first. view := nil. @@ -1955,7 +2015,15 @@ group:something "set the value of the instance variable 'group' (automatically generated)" - group := something.! ! + group := something.! + +name + ^ groupName +! + +name:aName + groupName := aName +! ! !UIPainterView class methodsFor:'documentation'!