[squeak-dev] The Trunk: EToys-tfel.257.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Sep 28 12:02:56 UTC 2016


Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.257.mcz

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

Name: EToys-tfel.257
Author: tfel
Time: 28 September 2016, 2:02:17.012904 pm
UUID: a4bd9831-92ff-fb4f-9f7f-0681429e8add
Ancestors: EToys-tfel.256

make Kedama worlds copyable, by forcing it to always copy also its patches and turtles, and fixing up the deep copying so these players are copied correctly and their scripts are also recompiled correctly.

=============== Diff against EToys-tfel.256 ===============

Item was added:
+ ----- Method: KedamaExamplerPlayer>>veryDeepInner: (in category 'copying') -----
+ veryDeepInner: deepCopier
+ 	"Special code that handles user-added instance variables of a uniClass.
+ 	Copy all of my instance variables.  Some need to be not copied at all, but shared.  This is special code for the dictionary.  See DeepCopier."
+ 
+ 	kedamaWorld := kedamaWorld veryDeepCopyWith: deepCopier.
+ 	turtles := turtles veryDeepCopyWith: deepCopier.
+ 	sequentialStub := sequentialStub veryDeepCopyWith: deepCopier.
+ 	super veryDeepInner: deepCopier.
+ !

Item was added:
+ ----- Method: KedamaMorph>>duplicate (in category 'as yet unclassified') -----
+ duplicate
+ 
+ 	| allMorphBounds allMorphs allOwners copyW s w |
+ 	allMorphs := {self}, self player allPatchAndTurtleMorphs.
+ 	allOwners := allMorphs collect: #owner.
+ 	allMorphBounds := allMorphs allButFirst
+ 		inject: self bounds into: [:acc :next | next bounds merge: acc].
+ 	w := PasteUpMorph new.
+ 	w bounds: allMorphBounds.
+ 	w openInWorld.
+ 	w addAllMorphs: allMorphs.
+ 	copyW := w duplicate.
+ 	allMorphs withIndexDo: [:m :idx | (allOwners at: idx) addMorph: m].
+ 	w delete.
+ 	s := SelectionMorph new.
+ 	s bounds: copyW bounds.
+ 	s selectSubmorphsOf: copyW.
+ 	^ s!

Item was changed:
  ----- Method: KedamaMorph>>isVisible: (in category 'private') -----
  isVisible: examplerPlayer
  
  	| turtleMorph |
  	turtleMorph := examplerPlayer costume.
  	turtleMorph visible ifFalse: [^ false].
+ 	turtleMorph world ifNil: [^ false].
  	turtleMorph owner isRenderer ifFalse: [^ true].
  	^ turtleMorph owner visible.
  !

Item was changed:
  ----- Method: KedamaMorph>>offerCostumeViewerMenu: (in category 'menu') -----
  offerCostumeViewerMenu: aMenu
  	aMenu add: 'add a new patch variable' translated action: #newPatch.
  	aMenu balloonTextForLastItem: 'Add a new patch variable' translated.
  	aMenu add: 'add a new breed of turtle' translated action: #newTurtle.
  	aMenu balloonTextForLastItem: 'Add a new turtle' translated.
  	aMenu addLine.
+ 	aMenu add: 'gather patches and turtles' translated action: #gatherPatchesAndTurtles.
+ 	aMenu balloonTextForLastItem: 'Show all turtles next to me' translated.
  !

Item was added:
+ ----- Method: KedamaMorph>>patches (in category 'accessing') -----
+ patches
+ 
+ 	^ patchesToDisplay!

Item was added:
+ ----- Method: KedamaMorph>>turtles (in category 'accessing') -----
+ turtles
+ 
+ 	^ turtlesDict keys!

Item was added:
+ ----- Method: KedamaPatchMorph>>veryDeepInner: (in category 'as yet unclassified') -----
+ veryDeepInner: deepCopier
+ 	"the state of a Kedama patch is held in its forms, so we need to "
+ 	form := form deepCopy.
+ 	displayForm := displayForm deepCopy.
+ 	tmpForm := tmpForm deepCopy.
+ 	super veryDeepInner: deepCopier.!

Item was added:
+ ----- Method: Player>>allPatchAndTurtleMorphs (in category 'slot-kedama') -----
+ allPatchAndTurtleMorphs
+ 
+ 	self costume ifNil: [^ #()].
+ 	^ self costume patches, (self costume turtles collect: #costume)!

Item was added:
+ ----- Method: Player>>gatherPatchesAndTurtles (in category 'slot-kedama') -----
+ gatherPatchesAndTurtles
+ 
+ 	| position |
+ 	self costume owner ifNil: [^ self].
+ 	position := self costume topRight + (5 at 0).
+ 	self allPatchAndTurtleMorphs do: [:m |
+ 		m ifNotNil: [
+ 			m position: position.
+ 			self costume owner addMorph: m.
+ 			m visible: true.
+ 			position := position + (0@(m height + 5))]].!

Item was added:
+ ----- Method: UniclassScript>>veryDeepFixupWith: (in category 'copying') -----
+ veryDeepFixupWith: deepCopier
+ 
+ 	super veryDeepFixupWith: deepCopier.
+ 	self flag: #todo. "Textually coded scripts may also have to be adapted"
+ 	Project current addDeferredUIMessage: [
+ 		"We do this in a deferred way, because the deep copying may non-deterministically
+ 		 be in a state where not all referenced players already have copies, so then we recompile the
+ 		 script, but we still reference the wrong players!! - tfel,jl"
+ 		self recompileScriptFromTilesUnlessTextuallyCoded].!



More information about the Squeak-dev mailing list