The Trunk: Morphic-tfel.1305.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-tfel.1305.mcz

commits-2
Tim Felgentreff uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-tfel.1305.mcz

==================== Summary ====================

Name: Morphic-tfel.1305
Author: tfel
Time: 31 August 2016, 11:11:43.198793 am
UUID: 556342b2-8907-b240-ba46-ac3638687c87
Ancestors: Morphic-tfel.1304

remove ugly owner hacks when we draw a new sketch and add its flex shell

=============== Diff against Morphic-tfel.1304 ===============

Item was changed:
  ----- Method: Morph>>addFlexShell (in category 'rotate scale and flex') -----
  addFlexShell
  "Wrap a rotating and scaling shell around this morph."
 
+ | oldHalo myWorld flexMorph anIndex |
- | oldHalo flexMorph myWorld anIndex morphOwner |
 
- myWorld := self world.
  oldHalo:= self halo.
+ myWorld := self world.
+ self owner
+ ifNil: [flexMorph := self newTransformationMorph asFlexOf: self]
+ ifNotNil: [:myOwner |
+ anIndex := myOwner submorphIndexOf: self.
+ flexMorph := self newTransformationMorph asFlexOf: self.
+ myOwner addMorph: flexMorph asElementNumber: anIndex.
+ myWorld ifNotNil: [myWorld startSteppingSubmorphsOf: flexMorph]].
- self owner ifNotNil:[ morphOwner := self owner]
- ifNil:[morphOwner := self currentWorld].
-
- anIndex := morphOwner  submorphIndexOf: self.
- morphOwner  addMorph: (flexMorph := self newTransformationMorph asFlexOf: self)
- asElementNumber: anIndex.
  self transferStateToRenderer: flexMorph.
  oldHalo ifNotNil: [oldHalo setTarget: flexMorph].
- myWorld ifNotNil: [myWorld startSteppingSubmorphsOf: flexMorph].
 
  ^ flexMorph!

Item was changed:
  ----- Method: PasteUpMorph>>makeNewDrawing:at: (in category 'world menu') -----
  makeNewDrawing: evt at: aPoint
  "make a new drawing, triggered by the given event, with the painting area centered around the given point"
 
  | w newSketch newPlayer sketchEditor aPalette rect aPaintBox aPaintTab aWorld |
  w := self world.
  w assureNotPaintingElse: [^ self].
  rect := self paintingBoundsAround: aPoint.
  aPalette := self standardPalette.
  aPalette ifNotNil: [aPalette showNoPalette; layoutChanged].
  w prepareToPaint.
 
  newSketch := self drawingClass new.
  Smalltalk at: #UnscriptedPlayer ifPresent:[:aClass|
  newSketch player: (newPlayer := aClass newUserInstance).
  newPlayer costume: newSketch.
  ].
  newSketch nominalForm: (Form extent: rect extent depth: w assuredCanvas depth).
  newSketch bounds: rect.
  sketchEditor := SketchEditorMorph new.
  w addMorphFront: sketchEditor.
  sketchEditor initializeFor: newSketch inBounds: rect pasteUpMorph: self.
  sketchEditor
+ afterNewPicDo: [:aForm :aRect | | tfx whereToPresent |
- afterNewPicDo: [:aForm :aRect | | tfx ownerBeforeHack whereToPresent |
  whereToPresent := self presenter.
  newSketch form: aForm.
  tfx := self transformFrom: w.
  newSketch position: (tfx globalPointToLocal: aRect origin).
  newSketch rotationStyle: sketchEditor rotationStyle.
  newSketch forwardDirection: sketchEditor forwardDirection.
 
- ownerBeforeHack := newSketch owner. "about to break the invariant!!!!"
- newSketch privateOwner: self. "temp for halo access"
  newPlayer ifNotNil:[newPlayer setHeading: sketchEditor forwardDirection].
  (aPaintTab := (aWorld := self world) paintingFlapTab)
  ifNotNil:[aPaintTab hideFlap]
  ifNil:[(aPaintBox := aWorld paintBox) ifNotNil:[aPaintBox delete]].
 
- "Includes  newSketch rotationDegrees: sketchEditor forwardDirection."
- newSketch privateOwner: ownerBeforeHack. "probably nil, but let's be certain"
-
  self addMorphFront: (newPlayer ifNil:[newSketch] ifNotNil:[newPlayer costume]).
  w startSteppingSubmorphsOf: newSketch.
  whereToPresent drawingJustCompleted: newSketch]
  ifNoBits:[
  (aPaintTab := (aWorld := self world) paintingFlapTab)
  ifNotNil:[aPaintTab hideFlap]
  ifNil:[(aPaintBox := aWorld paintBox) ifNotNil:[aPaintBox delete]].
  aPalette ifNotNil: [aPalette showNoPalette].]!