diff -r d6dccf1ad344 -r 35c5711729c2 UIObjectView.st --- a/UIObjectView.st Tue Mar 18 10:58:13 1997 +0100 +++ b/UIObjectView.st Fri Mar 28 15:57:20 1997 +0100 @@ -1,6 +1,6 @@ ObjectView subclass:#UIObjectView - instanceVariableNames:'inputView testMode undoHistory copiedExtent actionData - createClass clipChildren selectionHiddenLevel + instanceVariableNames:'inputView testMode undoHistory copiedExtent copiedLayout + actionData createClass clipChildren selectionHiddenLevel setOfSuperViewsSizeChanged' classVariableNames:'' poolDictionaries:'' @@ -464,10 +464,11 @@ createWidgetWithClass:aClass "prepare to create new widgets " - createClass := aClass. - pressAction := [:pressPoint | self startCreate:pressPoint]. - self cursor:Cursor origin. - + aClass notNil ifTrue:[ + createClass := aClass. + pressAction := [:aPoint| self startCreate:aPoint]. + self cursor:Cursor origin. + ] ! @@ -501,14 +502,13 @@ endCreate "end a widget create drag " - |layout x y object| + |object specClass| object := actionData object. self invertOutlineOf:object. inputView raise. - object superView specClass basicNew setupInitialLayoutFor:object. - + self setupInitialLayoutFor:object. self changed:#tree. self select:object. actionData := nil. @@ -521,24 +521,39 @@ self subclassResponsibility ! +setupInitialLayoutFor:anObject + "setup initial layout for an object; !!!! some kludge !!!! + " + |spec topSpec| + + topSpec := anObject superView specClass basicNew. + + topSpec class isLayoutContainer ifFalse:[ + +"/ ... KLUDGE .... + + spec := anObject specClass. + + ( spec == ViewSpec + or:[spec == SubCanvasSpec + or:[spec == TextEditorSpec + or:[spec == SequenceViewSpec]]] + ) ifTrue:[ + anObject geometryLayout:(anObject bounds asLayout). + ^ self + ] + ]. + topSpec setupInitialLayoutFor:anObject. + +! + startCreate:aPoint "start a widget create " |widget object start frame delta| - self selection notNil ifTrue:[ - self numberOfSelections > 1 ifTrue:[ - self warn:'to much elements selected'. - ^ self setDefaultActions. - ]. - self unselect - ]. - - ( (widget := self findObjectAt:aPoint) notNil - and:[widget specClass supportsSubComponents] - ) ifFalse:[ - widget := self - ]. + self unselect. + widget := self findContainerViewAt:aPoint. motionAction := [:movePoint| self doDragCreate:movePoint]. releaseAction := [ self endCreate]. @@ -559,8 +574,6 @@ self actionCreate:object frame:frame delta:delta. object extent:(actionData minExtent). object realize. - - self actionCreate:object frame:frame delta:delta. self invertOutlineOf:object. ! ! @@ -1062,6 +1075,14 @@ !UIObjectView methodsFor:'searching'! +findContainerViewAt:aPoint + "find container view responds to aPoint. + " + ^ self subclassResponsibility + + +! + findObjectAt:aPoint "find the origin/corner of the currentWidget " @@ -1428,6 +1449,23 @@ ! +copyLayout + "copy the layout from the selected object + " + |object| + + object := self singleSelection. + + object notNil ifTrue:[ + copiedLayout := object geometryLayout copy + ] ifFalse:[ + self warn:'exactly one element must be selected'. + ] + + + +! + pasteExtent "paste the copied extent to all objects in the selection " @@ -1449,6 +1487,16 @@ ! +pasteLayout + "paste layout to all objects in the selection + " + copiedLayout notNil ifTrue:[ + self transition:#pasteLayout dimensionDo:[:v| + v geometryLayout:(copiedLayout copy) + ] + ] +! + pasteWidth "paste the copied extent width to all objects in the selection "