'From Squeak3.7gamma of ''17 July 2004'' [latest update: #5976] on 17 July 2004 at 11:09:12 am'! "Change Set: IsLineMorphFix-nk Date: 10 March 2004 Author: Ned Konz Replaces several calls of the form m isKindOf: PolygonMorph or (m isKindOf: PolygonMorph) and : [ m isOpen ] with m isLineMorph to allow for different kinds of line morphs (like the one that I wrote ). Fixes (I think) EToys' idea of 'length' and 'width' as applied to closed PolygonMorphs (i.e. makes them behave like other morphs). Without the CS applied, you can have a closed PolygonMorph that looks like a RectangleMorph but returns a different value for length and width. "! !Morph methodsFor: '*connectors-testing' stamp: 'nk 10/13/2003 18:36'! isLineMorph ^false! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 3/10/2004 12:15'! getLength "Answer the length of the object" | aLength cost | ((cost _ self costume) isLineMorph) "annoying special case" ifTrue: [^ cost unrotatedLength]. aLength _ cost renderedMorph height. "facing upward when unrotated" cost isRenderer ifTrue: [aLength _ aLength * cost scaleFactor]. ^ aLength! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 3/10/2004 12:15'! getWidth "Answer the width of the object" | aWidth cost | ((cost _ self costume) isLineMorph) "annoying special case" ifTrue: [^ cost unrotatedWidth]. aWidth _ cost renderedMorph width. "facing upward when unrotated" cost isRenderer ifTrue: [aWidth _ aWidth * cost scaleFactor]. ^ aWidth! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 3/10/2004 12:15'! setLength: aLength "Set the length of the receiver." | cost lengthToUse | ((cost _ self costume) isLineMorph) ifTrue: [^ cost unrotatedLength: aLength]. lengthToUse _ cost isRenderer ifTrue: [aLength / cost scaleFactor] ifFalse: [aLength]. cost renderedMorph height: lengthToUse! ! !Player methodsFor: 'slot getters/setters' stamp: 'nk 3/10/2004 12:15'! setWidth: aWidth "Set the width" | cost widthToUse | ((cost _ self costume) isLineMorph) ifTrue: [^ cost unrotatedWidth: aWidth]. widthToUse _ cost isRenderer ifTrue: [aWidth / cost scaleFactor] ifFalse: [aWidth]. cost renderedMorph width: widthToUse! ! !PolygonMorph methodsFor: '*connectors-testing' stamp: 'nk 10/13/2003 18:36'! isLineMorph ^closed not! ! !TextMorph methodsFor: 'menu' stamp: 'nk 3/10/2004 12:09'! addCustomMenuItems: aCustomMenu hand: aHandMorph | outer | super addCustomMenuItems: aCustomMenu hand: aHandMorph. aCustomMenu add: 'text color...' translated action: #changeTextColor. aCustomMenu addUpdating: #autoFitString target: self action: #autoFitOnOff. aCustomMenu addUpdating: #wrapString target: self action: #wrapOnOff. aCustomMenu add: 'text margins...' translated action: #changeMargins:. aCustomMenu add: 'add predecessor' translated action: #addPredecessor:. aCustomMenu add: 'add successor' translated action: #addSuccessor:. (Preferences noviceMode or: [Preferences simpleMenus]) ifFalse: [aCustomMenu add: 'code pane menu...' translated action: #yellowButtonActivity. aCustomMenu add: 'code pane shift menu...' translated action: #shiftedYellowButtonActivity]. outer _ self owner. outer isLineMorph ifTrue: [container isNil ifTrue: [aCustomMenu add: 'follow owner''s curve' translated action: #followCurve] ifFalse: [aCustomMenu add: 'reverse direction' translated action: #reverseCurveDirection. aCustomMenu add: 'set baseline' translated action: #setCurveBaseline:]] ifFalse: [(container isNil or: [container fillsOwner not]) ifTrue: [aCustomMenu add: 'fill owner''s shape' translated action: #fillingOnOff] ifFalse: [aCustomMenu add: 'rectangular bounds' translated action: #fillingOnOff]. (container isNil or: [container avoidsOcclusions not]) ifTrue: [aCustomMenu add: 'avoid occlusions' translated action: #occlusionsOnOff] ifFalse: [aCustomMenu add: 'ignore occlusions' translated action: #occlusionsOnOff]]. aCustomMenu addLine. aCustomMenu add: 'holder for characters' translated action: #holderForCharacters ! !