'From etoys2.3 of 28 November 2007 [latest update: #1888] on 30 January 2008 at 4:30:59 pm'! "Change Set: TextFixJan30Again-yo Date: 30 January 2008 Author: Yoshiki Ohshima Revert the previous change and fix the null text case in a different way. It still would be nice if we don't refer to text in #fit, though..."! !TextMorph methodsFor: 'private' stamp: 'yo 1/30/2008 16:27'! fit "Adjust my bounds to fit the text. Should be a no-op if autoFit is not specified. Required after the text changes, or if wrapFlag is true and the user attempts to change the extent." | newExtent para cBounds lastOfLines heightOfLast wid | self isAutoFit ifTrue: [wid _ (text notNil and: [text size > 2]) ifTrue: [5] ifFalse: [40]. newExtent := (self paragraph extent max: wid @ ( self defaultLineHeight)) + (0 @ 2). newExtent := newExtent + (2 * borderWidth). margins ifNotNil: [newExtent := ((0 @ 0 extent: newExtent) expandBy: margins) extent]. newExtent ~= bounds extent ifTrue: [(container isNil and: [successor isNil]) ifTrue: [para := paragraph. "Save para (layoutChanged smashes it)" super extent: newExtent. paragraph := para]]. container notNil & successor isNil ifTrue: [cBounds := container bounds truncated. "23 sept 2000 - try to allow vertical growth" lastOfLines := self paragraph lines last. heightOfLast := lastOfLines bottom - lastOfLines top. (lastOfLines last < text size and: [lastOfLines bottom + heightOfLast >= self bottom]) ifTrue: [container releaseCachedState. cBounds := cBounds origin corner: cBounds corner + (0 @ heightOfLast)]. self privateBounds: cBounds]]. "These statements should be pushed back into senders" self paragraph positionWhenComposed: self position. successor ifNotNil: [successor predecessorChanged]. self changed "Too conservative: only paragraph composition should cause invalidation."! ! !ClipboardMorph methodsFor: 'parts bin' stamp: 'dgd 2/14/2003 22:09'! initializeToStandAlone super initializeToStandAlone. "" self initialize. "" self extent: 200 @ 100. self backgroundColor: (Color r: 0.484 g: 1.0 b: 0.484). self setBalloonText: 'This shows the current contents of the text clipboard'. self newContents: Clipboard clipboardText! !