diff -r 1bc26edd0d3e -r f7df2a53d042 UIPainterView.st --- a/UIPainterView.st Fri Jun 20 19:26:08 1997 +0200 +++ b/UIPainterView.st Fri Jun 20 19:29:36 1997 +0200 @@ -17,16 +17,16 @@ category:'Interface-UIPainter' ! -MultiSelectionInList subclass:#ListHolder - instanceVariableNames:'painter propertyList masterElement disabledChanged' - classVariableNames:'' +Object subclass:#ViewProperty + instanceVariableNames:'view spec identifier' + classVariableNames:'Identifier' poolDictionaries:'' privateIn:UIPainterView ! -Object subclass:#ViewProperty - instanceVariableNames:'view spec identifier' - classVariableNames:'Identifier' +MultiSelectionInList subclass:#ListHolder + instanceVariableNames:'painter propertyList masterElement disabledChanged' + classVariableNames:'' poolDictionaries:'' privateIn:UIPainterView ! @@ -434,58 +434,60 @@ (self canPaste:aSpecificationOrList) ifFalse:[ ^ self ]. - aSpecificationOrList isCollection ifTrue:[ - paste := aSpecificationOrList - ] ifFalse:[ - paste := Array with:aSpecificationOrList - ]. - frame := self singleSelection. + listHolder disableNotificationsWhileEvaluating:[ + aSpecificationOrList isCollection ifTrue:[ + paste := aSpecificationOrList + ] ifFalse:[ + paste := Array with:aSpecificationOrList + ]. + frame := self singleSelection. - (self canPasteInto:frame) ifFalse:[ - frame := self - ]. - self select:nil. + (self canPasteInto:frame) ifFalse:[ + frame := self + ]. + self setSelection:nil withRedraw:true. - newSel := OrderedCollection new. - builder := UIBuilder new. + newSel := OrderedCollection new. + builder := UIBuilder new. - keepLayout ifFalse:[ - pasteOffset := 0@0. - pasteOrigin := self sensor mousePoint. - pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id. - ]. + keepLayout ifFalse:[ + pasteOffset := 0@0. + pasteOrigin := self sensor mousePoint. + pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id. + ]. - listHolder disableNotificationsWhileEvaluating:[ - paste do:[:aSpec| - |view| + listHolder disableNotificationsWhileEvaluating:[ + paste do:[:aSpec| + |view| - view := self addSpec:aSpec builder:builder in:frame. + view := self addSpec:aSpec builder:builder in:frame. - keepLayout ifFalse:[ - (frame bounds containsPoint:pasteOrigin) ifFalse:[ - self moveObject:view to:pasteOffset. - ] ifTrue:[ - self moveObject:view to:pasteOrigin + pasteOffset. + keepLayout ifFalse:[ + (frame bounds containsPoint:pasteOrigin) ifFalse:[ + self moveObject:view to:pasteOffset. + ] ifTrue:[ + self moveObject:view to:pasteOrigin + pasteOffset. + ]. + pasteOffset := pasteOffset + 4 ]. - pasteOffset := pasteOffset + 4 + view realize. + newSel add:view. ]. - view realize. - newSel add:view. ]. - ]. - self withinTransaction:#paste objects:newSel do:[ - undoHistory addUndoSelector:#undoCreate: - withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]) - ]. + self withinTransaction:#paste objects:newSel do:[ + undoHistory addUndoSelector:#undoCreate: + withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]) + ]. - newSel size == 1 ifTrue:[ - newSel := newSel at:1 - ]. - self realizeAllSubViews. - inputView raise. - self select:newSel. - self elementChangedSize:frame. + newSel size == 1 ifTrue:[ + newSel := newSel at:1 + ]. + self realizeAllSubViews. + inputView raise. + self select:newSel. + self elementChangedSize:frame. + ] ! pasteWithLayout @@ -1457,6 +1459,105 @@ ! ! +!UIPainterView::ViewProperty class methodsFor:'documentation'! + +version + ^ '$Header$' +! ! + +!UIPainterView::ViewProperty class methodsFor:'instance creation'! + +new + Identifier notNil ifTrue:[Identifier := Identifier + 1] + ifFalse:[Identifier := 1]. + + ^ self basicNew initialize +! ! + +!UIPainterView::ViewProperty methodsFor:'accessing'! + +identifier + "return the unique identifier assigned to property + " + ^ identifier +! + +identifier:anIdentifier + "set the unique identifier assigned to property; called after an restore of + a deleted instance + " + identifier := anIdentifier +! + +spec + "return the value of the instance variable 'spec' (automatically generated)" + + ^ spec! + +spec:something + "set the value of the instance variable 'spec' (automatically generated)" + + spec := something.! + +view + "return the value of the instance variable 'view' (automatically generated)" + + ^ view! + +view:something + "set the value of the instance variable 'view' (automatically generated)" + + view := something.! ! + +!UIPainterView::ViewProperty methodsFor:'initialization'! + +initialize + super initialize. + identifier := Identifier +! ! + +!UIPainterView::ViewProperty methodsFor:'misc'! + +extractNumberStartingAt:anIndex + "return the number from the name starting at anIndex or 0. + " + |val| + + val := 0. + + self name from:anIndex do:[:c| + c isDigit ifTrue:[val := val * 10 + c digitValue] + ifFalse:[^ 0] + ]. + ^ val + +! ! + +!UIPainterView::ViewProperty methodsFor:'spec messages'! + +doesNotUnderstand:aMessage + spec notNil ifTrue:[ + (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] + ]. + ^ nil +! + +layout + spec layout +! + +layout:aLayout + spec layout:aLayout +! + +name + ^ spec name +! + +name:aName + spec name:aName +! ! + !UIPainterView::ListHolder class methodsFor:'instance creation'! for:aPainter @@ -1790,105 +1891,6 @@ super selectionIndex:aSel ! ! -!UIPainterView::ViewProperty class methodsFor:'documentation'! - -version - ^ '$Header$' -! ! - -!UIPainterView::ViewProperty class methodsFor:'instance creation'! - -new - Identifier notNil ifTrue:[Identifier := Identifier + 1] - ifFalse:[Identifier := 1]. - - ^ self basicNew initialize -! ! - -!UIPainterView::ViewProperty methodsFor:'accessing'! - -identifier - "return the unique identifier assigned to property - " - ^ identifier -! - -identifier:anIdentifier - "set the unique identifier assigned to property; called after an restore of - a deleted instance - " - identifier := anIdentifier -! - -spec - "return the value of the instance variable 'spec' (automatically generated)" - - ^ spec! - -spec:something - "set the value of the instance variable 'spec' (automatically generated)" - - spec := something.! - -view - "return the value of the instance variable 'view' (automatically generated)" - - ^ view! - -view:something - "set the value of the instance variable 'view' (automatically generated)" - - view := something.! ! - -!UIPainterView::ViewProperty methodsFor:'initialization'! - -initialize - super initialize. - identifier := Identifier -! ! - -!UIPainterView::ViewProperty methodsFor:'misc'! - -extractNumberStartingAt:anIndex - "return the number from the name starting at anIndex or 0. - " - |val| - - val := 0. - - self name from:anIndex do:[:c| - c isDigit ifTrue:[val := val * 10 + c digitValue] - ifFalse:[^ 0] - ]. - ^ val - -! ! - -!UIPainterView::ViewProperty methodsFor:'spec messages'! - -doesNotUnderstand:aMessage - spec notNil ifTrue:[ - (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec] - ]. - ^ nil -! - -layout - spec layout -! - -layout:aLayout - spec layout:aLayout -! - -name - ^ spec name -! - -name:aName - spec name:aName -! ! - !UIPainterView class methodsFor:'documentation'! version