Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-nice.383.mcz ==================== Summary ==================== Name: Morphic-nice.383 Author: nice Time: 16 March 2010, 9:42:29.168 pm UUID: 0e2d679f-6b2b-474f-88d0-b770f847c40a Ancestors: Morphic-cmm.382 Minor clean-up: 1) merge some super initialize from Pharo 2) avoid cascading super (from Pharo) 3) avoid a few outer temp assignment in blocks 4) avoid (isKindOf: BlockContext) in menu enablement block =============== Diff against Morphic-cmm.382 =============== Item was changed: ----- Method: PasteUpMorph>>grabFloodFromScreen: (in category 'world menu') ----- grabFloodFromScreen: evt "Allow the user to plant a flood seed on the Display, and create a new drawing morph from the resulting region. Attach the result to the hand." | screenForm exterior p1 box | + p1 := Cursor crossHair showWhile: [Sensor waitButton]. - Cursor crossHair showWhile: [p1 := Sensor waitButton]. box := Display floodFill: Color transparent at: p1. exterior := ((Display copy: box) makeBWForm: Color transparent) reverse. self world invalidRect: box; displayWorldSafely. (box area > (Display boundingBox area // 2)) ifTrue: [^ UIManager default notify: 'Sorry, the region was too big']. (exterior deepCopy reverse anyShapeFill reverse) "save interior bits" displayOn: exterior at: 0@0 rule: Form and. screenForm := Form fromDisplay: box. screenForm eraseShape: exterior. screenForm isAllWhite ifFalse: [evt hand attachMorph: (self drawingClass withForm: screenForm)]! Item was changed: ----- Method: PolygonMorph>>midpoint (in category 'attachments') ----- midpoint "Answer the midpoint along my segments" | middle | + middle := self totalLength. - middle := 0. - self lineSegmentsDo: [ :a :b | middle := middle + (a dist: b) ]. middle < 2 ifTrue: [ ^ self center ]. middle := middle / 2. self lineSegmentsDo: [ :a :b | | dist | dist := (a dist: b). middle < dist ifTrue: [ ^(a + ((b - a) * (middle / dist))) asIntegerPoint ]. middle := middle - dist. ]. self error: 'can''t happen'! Item was changed: ----- Method: CircleMorph>>initialize (in category 'parts bin') ----- initialize + super initialize. + self extent: 40@40; - ^super initialize - extent: 40@40; color: Color green lighter; yourself! Item was changed: ----- Method: BalloonCanvas>>initialize (in category 'initialize') ----- initialize + super initialize. aaLevel := 1. deferred := false.! Item was changed: ----- Method: LayoutProperties>>initialize (in category 'initialize') ----- initialize + super initialize. hResizing := vResizing := #rigid. disableLayout := false.! Item was changed: ----- Method: BalloonCanvas>>ifNoTransformWithIn: (in category 'private') ----- ifNoTransformWithIn: box "Return true if the current transformation does not affect the given bounding box" | delta | + transform ifNil: [^true]. - "false ifFalse:[^false]." - transform isNil ifTrue:[^true]. delta := (transform localPointToGlobal: box origin) - box origin. ^(transform localPointToGlobal: box corner) - box corner = delta! Item was changed: ----- Method: SystemWindow>>convertAlignment (in category 'layout') ----- convertAlignment "Primarily Jesse Welton's code to convert old system windows to ones with modern layout scheme" - | frame | self layoutPolicy: ProportionalLayout new. (paneMorphs isNil or: [paneRects isNil or: [paneMorphs size ~= paneRects size]]) ifFalse: [self addLabelArea. self putLabelItemsInLabelArea. self setFramesForLabelArea. paneMorphs with: paneRects do: [:m :r | + | frame | frame := LayoutFrame new. frame leftFraction: r left; rightFraction: r right; topFraction: r top; bottomFraction: r bottom. m layoutFrame: frame. m hResizing: #spaceFill; vResizing: #spaceFill]]. labelArea isNil ifTrue: [self addLabelArea. self putLabelItemsInLabelArea. self setFramesForLabelArea. paneMorphs ifNotNil: [paneMorphs do: [:m | + | frame | frame := m layoutFrame ifNil: [LayoutFrame new]. frame topOffset: (frame topOffset ifNil: [0]) - self labelHeight. frame bottomFraction ~= 1.0 ifTrue: [frame bottomOffset: (frame bottomOffset ifNil: [0]) - self labelHeight]]]]. label ifNotNil: + [| frame | + frame := LayoutFrame new. - [frame := LayoutFrame new. frame leftFraction: 0.5; topFraction: 0; leftOffset: label width negated // 2. label layoutFrame: frame]. collapseBox ifNotNil: + [| frame | + frame := LayoutFrame new. - [frame := LayoutFrame new. frame rightFraction: 1; topFraction: 0; rightOffset: -1; topOffset: 1. collapseBox layoutFrame: frame]. stripes ifNotNil: + [| frame | + frame := LayoutFrame new. - [frame := LayoutFrame new. frame leftFraction: 0; topFraction: 0; rightFraction: 1; leftOffset: 1; topOffset: 1; rightOffset: -1. stripes first layoutFrame: frame. stripes first height: self labelHeight - 2. stripes first hResizing: #spaceFill. frame := LayoutFrame new. frame leftFraction: 0; topFraction: 0; rightFraction: 1; leftOffset: 3; topOffset: 3; rightOffset: -3. stripes last layoutFrame: frame. stripes last height: self labelHeight - 6. stripes last hResizing: #spaceFill]. menuBox ifNotNil: + [| frame | + frame := LayoutFrame new. - [frame := LayoutFrame new. frame leftFraction: 0; leftOffset: 19; topFraction: 0; topOffset: 1. menuBox layoutFrame: frame]. closeBox ifNotNil: + [| frame | + frame := LayoutFrame new. - [frame := LayoutFrame new. frame leftFraction: 0; leftOffset: 4; topFraction: 0; topOffset: 1. closeBox layoutFrame: frame]! Item was changed: ----- Method: Morph>>setRotationCenter (in category 'menus') ----- setRotationCenter | p | self world displayWorld. + p := Cursor crossHair showWhile: + [Sensor waitButton]. - Cursor crossHair showWhile: - [p := Sensor waitButton]. Sensor waitNoButton. self setRotationCenterFrom: (self transformFromWorld globalPointToLocal: p). ! Item was changed: ----- Method: UpdatingMenuItemMorph>>enablementSelector: (in category 'enablement') ----- enablementSelector: aSelector + enablementSelector := aSelector isBlock - enablementSelector := (aSelector isKindOf: BlockContext) ifTrue: [aSelector copyForSaving] ifFalse: [aSelector] ! |
Free forum by Nabble | Edit this page |