[ENH] Reframing, the second
Bert Freudenberg
bert at isgnw.CS.Uni-Magdeburg.De
Fri Sep 10 15:23:03 UTC 1999
"Change Set: reframe2-bf
Date: 10 September 1999
Author: Bert Freudenberg
Makes spawnPaneFrameHandle: use the new
withSideOrCorner:setToPoint:minExtent:limit: to provide maximum and
minimum extents when reframing panes, too"
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="reframe2-bf.10Sep419pm.cs"
Content-ID: <Pine.LNX.3.96.990910172303.21602C at balloon.cs.uni-magdeburg.de>
Content-Description:
'From Squeak 2.5 of August 6, 1999 on 10 September 1999 at 4:19:58 pm'!
"Change Set: reframe2-bf
Date: 10 September 1999
Author: Bert Freudenberg
Makes spawnPaneFrameHandle: use the new withSideOrCorner:setToPoint:minExtent:limit: to provide maximum and minimum extents when reframing panes"!
!Rectangle methodsFor: 'rectangle functions' stamp: 'bf 9/10/1999 16:16'!
withSideOrCorner: side setToPoint: newPoint minExtent: minExtent
"Return a copy with side set to newPoint"
^self withSideOrCorner: side setToPoint: newPoint minExtent: minExtent
limit: ((#(left top) includes: side) ifTrue: [SmallInteger minVal] ifFalse: [SmallInteger maxVal])! !
!Rectangle methodsFor: 'rectangle functions' stamp: 'bf 9/10/1999 16:07'!
withSideOrCorner: side setToPoint: newPoint minExtent: minExtent limit: limit
"Return a copy with side set to newPoint"
side = #top ifTrue: [^ self withTop: (newPoint y min: corner y - minExtent y max: limit + minExtent y)].
side = #bottom ifTrue: [^ self withBottom: (newPoint y min: limit - minExtent y max: origin y + minExtent y)].
side = #left ifTrue: [^ self withLeft: (newPoint x min: corner x - minExtent x max: limit + minExtent x)].
side = #right ifTrue: [^ self withRight: (newPoint x min: limit - minExtent x max: origin x + minExtent x)].
side = #topLeft ifTrue: [^ (newPoint min: corner - minExtent) corner: self bottomRight].
side = #bottomRight ifTrue: [^ self topLeft corner: (newPoint max: origin + minExtent)].
side = #bottomLeft ifTrue: [^ self topRight rect: ((newPoint x min: corner x - minExtent x) @ (newPoint y max: origin y + minExtent y))].
side = #topRight ifTrue: [^ self bottomLeft rect: ((newPoint x max: origin x + minExtent x) @ (newPoint y min: corner y - minExtent y))].! !
!SystemWindow methodsFor: 'resize/collapse' stamp: 'bf 9/10/1999 16:01'!
spawnPaneFrameHandle: event
| resizer localPt side growingPane newBounds vbtl adjoiningPanes limit |
(self world firstSubmorph isKindOf: NewHandleMorph) ifTrue:
[ ^ self "Prevent multiple handles"].
((self innerBounds withHeight: self labelHeight+4) containsPoint: event cursorPoint)
ifTrue: [^ self "in label or top of top pane"].
growingPane _ self paneWithLongestSide: [:s | side _ s] near: event cursorPoint.
growingPane ifNil: [^ self].
adjoiningPanes _ paneMorphs select: [:pane | pane bounds bordersOn: growingPane bounds along: side].
limit _ adjoiningPanes isEmpty
ifFalse: [ (adjoiningPanes collect: [:pane | pane bounds perform: side])
perform: ((#(top left) includes: side) ifTrue: [#max] ifFalse: [#min])]
ifTrue: [self bounds perform: side].
vbtl _ self world viewBox topLeft.
resizer _ NewHandleMorph new
followHand: event hand
forEachPointDo:
[:p | localPt _ self pointFromWorld: p.
newBounds _ growingPane bounds withSideOrCorner: side setToPoint: localPt minExtent: 40 at 20 limit: limit.
Preferences fastDragWindowForMorphic
ifTrue:
["For fast display, only higlight the rectangle during loop"
newBounds _ (growingPane bounds translateBy: vbtl)
newRectFrom:
[:f | (growingPane bounds translateBy: vbtl) withSideOrCorner: side
setToPoint: (self pointFromWorld: Sensor cursorPoint)
minExtent: 40 at 20 limit: limit].
self reframePanesAdjoining: growingPane along: side
to: (newBounds translateBy: vbtl negated)]
ifFalse:
[self reframePanesAdjoining: growingPane along: side to: newBounds]]
lastPointDo: [:p | ].
event hand world addMorph: resizer.
resizer startStepping! !
More information about the Squeak-dev
mailing list
|