[squeak-dev] The Trunk: EToys-tfel.243.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Sep 22 15:38:28 UTC 2016
Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.243.mcz
==================== Summary ====================
Name: EToys-tfel.243
Author: tfel
Time: 22 September 2016, 5:37:19.089089 pm
UUID: 5d05775b-7045-8c40-a02b-c8598754751b
Ancestors: EToys-jl.242
- improve the kedama morph accepting a drawing to be more stable
- don't show the step-button for kedama scripts, because it doesn't work
- allowEtoyUserCustomEvents preference was removed
=============== Diff against EToys-jl.242 ===============
Item was added:
+ ----- Method: KedamaMorph>>acceptFormFromDrawing: (in category 'event handling') -----
+ acceptFormFromDrawing: largeForm
+
+ | aForm c xArray yArray colorArray newX newY turtlesByColor colorArrays thisPlayer xArrays yArrays |
+ turtlesDict keysAndValuesDo: [:player :vector |
+ player setTurtleCount: 0].
+ turtlesByColor := Dictionary new.
+ turtlesDict keysAndValuesDo: [:player :vector |
+ turtlesByColor at: player color put: player].
+ xArrays := Dictionary new.
+ yArrays := Dictionary new.
+ colorArrays := Dictionary new.
+ aForm := largeForm scaledToSize: (largeForm extent / pixelsPerPatch) rounded smoothing: 1.
+ aForm offset: (largeForm offset / self pixelsPerPatch) rounded.
+ 0 to: aForm height do: [:y |
+ 0 to: aForm width do: [:x |
+ c := aForm colorAt: (x at y).
+ c isTransparent ifFalse: [
+ newX := x + aForm offset x.
+ newY := y + aForm offset y.
+ ((newX >= 0 and: [newX < self dimensions x]) and: [newY >= 0 and: [newY < self dimensions y]]) ifTrue: [
+ thisPlayer := turtlesByColor at: c ifAbsentPut: [
+ turtlesByColor keys
+ detect: [:thisColor | (thisColor diff: c) < 0.2]
+ ifFound: [:thisColor | turtlesByColor at: thisColor]
+ ifNone: [
+ turtlesDict associations first key. "all non-matching go to be the first turtle"
+ "(self player newTurtleSilently color: c; player)"]].
+ xArray := xArrays at: thisPlayer ifAbsentPut: [OrderedCollection new: aForm width * aForm height].
+ yArray := yArrays at: thisPlayer ifAbsentPut: [OrderedCollection new: aForm width * aForm height].
+ colorArray := colorArrays at: thisPlayer ifAbsentPut: [OrderedCollection new: aForm width * aForm height].
+
+ xArray add: newX asFloat.
+ yArray add: newY asFloat.
+ colorArray add: (c pixelValueForDepth: 32).
+ ].
+ ].
+ ].
+ ].
+ xArrays keysAndValuesDo: [:player :xArry |
+ self makeTurtlesAtPositionsIn: {xArry asArray. (yArrays at: player) asArray. (colorArrays at: player) asArray} examplerPlayer: player ofPrototype: nil.
+ player costume privateTurtleCount: (self turtlesCountOf: player)].!
Item was changed:
----- Method: KedamaMorph>>editDrawing (in category 'menu') -----
editDrawing
| bnds sketchEditor delBlock myForm mySketch |
self world assureNotPaintingElse: [^self].
self world
prepareToPaint;
displayWorld.
bnds := self boundsInWorld.
sketchEditor := SketchEditorMorph new.
self comeToFront.
myForm := self imageForm clippedToSize: (bnds extent - 2).
myForm mapColor: self color to: Color transparent.
mySketch := SketchMorph withForm: myForm.
mySketch position: self position.
self world addMorphFront: sketchEditor.
sketchEditor
initializeFor: mySketch
inBounds: bnds
pasteUpMorph: self world.
delBlock := [self world paintingFlapTab
ifNotNil: [:pt | pt hideFlap]
ifNil: [self world paintBox ifNotNil: [:pb | pb delete]]].
sketchEditor
afterNewPicDo: [:aForm :aRect |
aForm offset: aRect topLeft - self topLeft.
+ self acceptFormFromDrawing: aForm.
- self acceptForm: aForm.
delBlock value]
ifNoBits: [delBlock value]!
Item was added:
+ ----- Method: ReleaseBuilderSqueakland class>>updateProjects (in category 'scripts') -----
+ updateProjects
+ "self updateProjects"
+ "Use this script to load store the gallery projects in the expected format into the repository"
+ !
Item was changed:
----- Method: ScriptEditorMorph>>buttonRowForEditor (in category 'buttons') -----
buttonRowForEditor
"Answer a row of buttons that comprise the header at the top of the Scriptor"
| aRow aString aStatusMorph aButton aTile aMorph goldBoxButton aBox |
aRow := AlignmentMorph newRow color: ScriptingSystem baseColor; layoutInset: 1.
aRow hResizing: #spaceFill.
aRow vResizing: #shrinkWrap.
self addDismissButtonTo: aRow.
aRow addTransparentSpacerOfSize: 9.
"Player's name"
aString := playerScripted externalName.
aMorph := StringMorph contents: aString font: ScriptingSystem fontForTiles.
aMorph setNameTo: 'title'.
aRow addMorphBack: aMorph.
aRow addTransparentSpacerOfSize: 6.
"Script's name"
aBox := AlignmentMorph newRow.
aBox hResizing: #shrinkWrap; vResizing: #shrinkWrap.
aBox color: (Color r: 0.839 g: 1.0 b: 0.806).
aBox borderWidth: 1.
aBox borderColor: (Color r: 0.645 g: 0.774 b: 0.613).
aButton := UpdatingStringMorph new.
aButton useStringFormat;
target: self;
getSelector: #scriptTitle;
setNameTo: 'script name';
font: ScriptingSystem fontForNameEditingInScriptor;
putSelector: #setScriptNameTo:;
setProperty: #okToTextEdit toValue: true;
step;
yourself.
aBox addMorph: aButton.
aRow addMorphBack: aBox.
aBox setBalloonText: 'Click here to edit the name of the script.' translated.
"aRow addTransparentSpacerOfSize: 9."
aRow addVariableTransparentSpacer.
"Try It button"
self hasParameter ifFalse:
[aRow addMorphBack:
((ThreePhaseButtonMorph
labelSymbol: #TryIt
target: self
actionSelector: #tryMe
arguments: #())
actWhen: #whilePressed;
balloonTextSelector: #tryMe).
aRow addTransparentSpacerOfSize: 3].
+ "Step button, only for non-Kedama"
+ (self playerScripted isPrototypeTurtlePlayer or: [self hasParameter]) ifFalse:
- "Step button"
- self hasParameter ifFalse:
[aRow addMorphBack: (aButton := ThreePhaseButtonMorph
labelSymbol: #StepMe
target: self
actionSelector: #stepMe
arguments: #()).
aButton balloonTextSelector: #stepMe.
aRow addTransparentSpacerOfSize: 3].
"Status controller"
self hasParameter
ifTrue:
[aTile := TypeListTile new choices: Vocabulary typeChoicesForUserVariables dataType: nil.
aTile addArrows.
aTile setLiteral: self typeForParameter.
aRow addMorphBack: aTile.
aTile borderColor: Color red.
aTile color: ScriptingSystem uniformTileInteriorColor.
aTile setBalloonText: 'Drag from here to get a parameter tile' translated.
aTile addCaretsAsAppropriate: true]
ifFalse:
[aRow addMorphBack: (aStatusMorph := self scriptInstantiation statusControlMorph)].
"aRow addTransparentSpacerOfSize: 3."
aRow addVariableTransparentSpacer.
"Gold-box"
aRow addMorphBack: (goldBoxButton := IconicButton new).
goldBoxButton borderWidth: 0;
labelGraphic: (ScriptingSystem formAtKey: 'RoundGoldBox'); color: Color transparent;
actWhen: #buttonDown;
target: self;
actionSelector: #offerGoldBoxMenu;
shedSelvedge;
setBalloonText: 'click here to get a palette of useful tiles to use in your script.' translated.
aRow addTransparentSpacerOfSize: 6 at 1.
"Menu Button"
aButton := self menuButton.
aButton actionSelector: #offerScriptorMenu.
aRow addMorphBack: aButton.
(playerScripted existingScriptInstantiationForSelector: scriptName)
ifNotNilDo:
[:inst | inst updateStatusMorph: aStatusMorph].
^ aRow!
Item was changed:
----- Method: Vocabulary class>>typeChoicesForUserVariables (in category '*Etoys-Squeakland-type vocabularies') -----
typeChoicesForUserVariables
"Answer a list of all user-choosable value types for variables."
| aList |
aList := #(Boolean Color CustomEvents Graphic Number Patch Player Point ScriptName Sound String) asOrderedCollection.
(ActiveWorld notNil and: [ActiveWorld isKedamaPresent not]) ifTrue:
[aList remove: #Patch ifAbsent: []].
- Preferences allowEtoyUserCustomEvents ifFalse: [aList remove: #CustomEvents ifAbsent: []].
^ aList asSortedArray
"
Vocabulary typeChoicesForUserVariables
"!
More information about the Squeak-dev
mailing list
|