The Inbox: EToys-jl.235.mcz

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

The Inbox: EToys-jl.235.mcz

commits-2
A new version of EToys was added to project The Inbox:
http://source.squeak.org/inbox/EToys-jl.235.mcz

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

Name: EToys-jl.235
Author: jl
Time: 19 September 2016, 1:21:41.203006 pm
UUID: 605a7062-4fa8-5545-8482-9f59e261d0b8
Ancestors: EToys-jl.231, EToys-bf.234

fixed Kedama distanceTo: (with tfel)

=============== Diff against EToys-jl.231 ===============

Item was changed:
  ----- Method: BorderedMorph>>useRoundedCornersInEtoys (in category '*Etoys-Squeakland-accessing') -----
  useRoundedCornersInEtoys
+ SystemWindow roundedWindowCorners
- Preferences roundedWindowCorners
  ifTrue: [self useRoundedCorners]!

Item was removed:
- ----- Method: Character>>setValue: (in category '*Etoys-Squeakland-private') -----
- setValue: newValue
- ^self error:'Characters are immutable'
- !

Item was removed:
- ----- Method: ImageSegment>>cc:new:current:fake:refStrm: (in category '*Etoys-Squeakland-compact classes') -----
- cc: ind new: inTheSeg current: inTheImage fake: fakeCls refStrm: smartRefStream
- "Sort out all the cases and decide what to do.  Every Fake class is uncompacted before having insts converted.  As the segment is installed, instances of reshaped compact classes will have the wrong class.  Trouble cases:
- 1) Existing class is compact in the segment and not compact here.  Make that compact, (error if that slot is used), load the segment.  If an class was just filed in, it is an existing class as far as we are concerned.
- 2) A compact class has a different shape.  We created a Fake class.  Load the segment, with instances in the seg having the Wrong Class!!!!  Find the bad instancees, and copy them over to being the real class.
- 3) An existing class is not compact in the segment, but is in the image.  Just let the new instance be uncompact.  That is OK, and never reaches this code.
- A class that is a root in this segment cannot be compact.  That is not allowed."
-
- (inTheImage == nil) & (fakeCls == nil) ifTrue: ["case 1 and empty slot"
- inTheSeg becomeCompactSimplyAt: ind.  ^ true].
-
- (inTheImage == inTheSeg) & (fakeCls == nil) ifTrue: ["everything matches"
- ^ true].
-
- inTheImage ifNil: ["reshaped and is an empty slot"
- fakeCls becomeCompactSimplyAt: ind.  ^ true].
- "comeFullyUpOnReload: will clean up"
-
- (inTheSeg == String and:[inTheImage == ByteString]) ifTrue:[
- "ar 4/10/2005: Workaround after renaming String to ByteString"
- ^true
- ].
-
- "Is the image class really the class we are expecting?  inTheSeg came in as a DiskProxy, and was mapped if it was renamed!!"
- inTheImage == inTheSeg ifFalse: [
- self inform: 'The incoming class ', inTheSeg name, ' wants compact class \location ', ind printString, ', but that is occupied by ', inTheImage name, '.  \This file cannot be read into this system.  The author of the file \should make the class uncompact and create the file again.' withCRs.
- ^ false].
-
- "Instances of fakeCls think they are compact, and thus will say they are instances of the class inTheImage, which is a different shape.  Just allow this to happen.  Collect them and remap them as soon as the segment is installed."
- ^ true!

Item was removed:
- ----- Method: ImageSegment>>classOrganizersBeRoots: (in category '*Etoys-Squeakland-read/write segment') -----
- classOrganizersBeRoots: dummy
- "The ClassOrganizers of some UniClasses may slip into OutPointers.  They point directly at the class of the UniClass (in subject).  They need to be in arrayOfRoots.  Find them and insert them into dummy's references."
-
- dummy references keys do: [:anObject |
- anObject isBehavior & (anObject isKindOf: ClassDescription) ifTrue: [
- anObject theNonMetaClass isSystemDefined ifFalse: ["uniClass will be in image seg"
- (dummy references includesKey: anObject organization) ifFalse: [
- dummy references at: anObject organization put: 47]]]]. "will get into roots"!

Item was removed:
- ----- Method: ImageSegment>>rehashDictionaries: (in category '*Etoys-Squeakland-fileIn/Out') -----
- rehashDictionaries: aCollection
- ProgressInitiationException
- display: 'Rehash objects...'
- during: [:bar | 1
- to: aCollection size
- do: [:i |
- (aCollection at: i) rehash.
- i \\ 10 = 0
- ifTrue: [bar value: i / aCollection size]]]!

Item was removed:
- ----- Method: ImageSegment>>rehashMethodDictionaries: (in category '*Etoys-Squeakland-fileIn/Out') -----
- rehashMethodDictionaries: oldDictionaries
- | newDictionaries |
- newDictionaries := oldDictionaries collect: [:d | d rehashWithoutBecome].
- oldDictionaries asArray elementsForwardIdentityTo: newDictionaries asArray.
- !

Item was added:
+ ----- Method: KedamaExamplerPlayer>>getXAndY (in category 'slot getters/setters') -----
+ getXAndY
+
+ ^ self turtles getXAndY!

Item was added:
+ ----- Method: KedamaTurtlePlayer>>getXAndY (in category 'commands and slots') -----
+ getXAndY
+
+ ^ x@y.
+ !

Item was added:
+ ----- Method: KedamaTurtleVectorPlayer>>getXAndY (in category 'player commands') -----
+ getXAndY
+
+ ^ self getX @ self getY
+ !

Item was changed:
  ----- Method: KedamaTurtleVectorPlayer2 class>>primGetDistanceToX:toY:xArray:yArray:resultInto: (in category 'as yet unclassified') -----
  primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result
 
+ | ppx ppy tempMin |
- | ppx ppy |
  <primitive: 'vectorGetDistanceTo' module:'KedamaPlugin2'>
  "^ KedamaPlugin doPrimitive: #vectorGetDistanceTo."
 
  ppx := pX.
  ppy := pY.
  1 to: result size do: [:index |
  pX isCollection ifTrue: [
+ tempMin := SmallInteger maxVal.
+ 1 to: pX size do: [:index2 |
+ ppx := pX at: index2.
+ ppy := pY at: index2.
+ tempMin := tempMin min: ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt.
+ ].
+ self flag: #todo. "should really also remember the other side index to re-use inside the script"
+ result at: index put: tempMin.
+ ] ifFalse: [
+ result at: index put: ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt.
+ ]
- ppx := pX at: index.
- ppy := pY at: index.
- ].
- result at: index put: ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt.
-
  ].
  ^ result.
  !

Item was changed:
  ----- Method: KedamaTurtleVectorPlayer2>>getDistanceTo: (in category 'player commands') -----
  getDistanceTo: players
 
  | p xArray yArray result pX pY xy |
  players isCollection ifFalse: [
  p := players
  ].
  xArray := arrays at: 2.
  yArray := arrays at: 3.
  result := KedamaFloatArray new: self size.
  players isCollection ifTrue: [
  pX := KedamaFloatArray new: players size.
  pY := KedamaFloatArray new: players size.
  1 to: players size do: [:i |
  xy := (players at: i) getXAndY.
  pX at: i put: xy x.
  pY at: i put: xy y.
  ].
  ] ifFalse: [
+ pX := p turtles getX.
+ pY := p turtles getY.
- xy := p getXAndY.
- pX := xy x.
- pY := xy y.
  ].
  ^ KedamaTurtleVectorPlayer2 primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result.
  !

Item was added:
+ ----- Method: KedamaTurtleVectorPlayer2>>getXAndY (in category 'player commands') -----
+ getXAndY
+ | ys |
+ ys := self getY.
+ ^ self getX asArray withIndexCollect: [:ea :idx | ea @ (ys at: idx)]
+ !

Item was changed:
  ----- Method: Morph class>>unfilteredCategoriesForViewer (in category '*Etoys') -----
  unfilteredCategoriesForViewer
  "Answer a list of symbols representing the categories to offer in the viewer for one of my instances, in order of:
  - masterOrderingOfCategorySymbols first
  - others last in order by translated wording"
  "
  Morph unfilteredCategoriesForViewer
  "
 
  | aClass additions masterOrder |
  aClass := self.
  additions := OrderedCollection new.
+ [ aClass == Morph superclass ] whileFalse: [
- [aClass == Morph superclass ] whileFalse: [
  additions addAll: (aClass allAdditionsToViewerCategories keys asArray
+ "#translated can be super slow, so use Schwartzian transform"
+ replace: [ :each | each -> each translated ];
+ sort: [ :a :b | a value <= b value ];
+ replace: [ :each | each key ]).
- sort: [ :a :b | a translated < b translated ]).
  aClass := aClass superclass ].
 
  masterOrder := EToyVocabulary masterOrderingOfCategorySymbols.
 
  ^(masterOrder intersection: additions), (additions difference: masterOrder).!

Item was added:
+ ----- Method: Player>>getXAndY (in category 'slot getters/setters') -----
+ getXAndY
+
+ ^ self getX @ self getY
+ !