[etoys-dev] Etoys: Etoys-bf.45.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Sep 7 16:33:07 EDT 2010
Bert Freudenberg uploaded a new version of Etoys to project Etoys:
http://source.squeak.org/etoys/Etoys-bf.45.mcz
==================== Summary ====================
Name: Etoys-bf.45
Author: bf
Time: 7 September 2010, 10:32:13 pm
UUID: 623c3a58-cab1-4757-9990-7ec576925957
Ancestors: Etoys-bf.44
SQ-783: Add back TimesRepeatMorph
=============== Diff against Etoys-bf.44 ===============
Item was added:
+ CompoundTileMorph subclass: #TimesRepeatMorph
+ instanceVariableNames: 'numberOfTimesToRepeatPart whatToRepeatPart'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Etoys-Scripting Tiles'!
+
+ !TimesRepeatMorph commentStamp: '<historical>' prior: 0!
+ This class is not used anymore. We keep it to let old projects work.
+ If we added code to auto-convert old instances of this classs to TimesRepeatTile instances, we could delete it for good.!
Item was added:
+ ----- Method: TimesRepeatMorph>>initialize (in category 'initialization') -----
+ initialize
+ "Fully initialize the receiver."
+
+ | dummyColumn timesRow timesRepeatColumn repeatRow separator repeatLabel placeHolder doLabel ephemerum |
+ submorphs _ EmptyArray.
+ bounds _ 0 at 0 corner: 50 at 40.
+ self color: Color orange muchLighter.
+
+ self layoutPolicy: TableLayout new.
+ self "border, and layout properties in alphabetical order..."
+ borderColor: self color darker;
+ borderWidth: 2;
+ cellSpacing: #none;
+ cellPositioning: #topLeft;
+ hResizing: #spaceFill;
+ layoutInset: 0;
+ listDirection: #leftToRight;
+ rubberBandCells: true;
+ vResizing: #shrinkWrap;
+ wrapCentering: #none.
+
+ self setNameTo: 'Repeat Complex'.
+
+ dummyColumn _ AlignmentMorph newColumn.
+ dummyColumn cellInset: 0; layoutInset: 0.
+ dummyColumn width: 0.
+ dummyColumn cellPositioning: #leftCenter.
+ dummyColumn hResizing: #shrinkWrap; vResizing: #spaceFill.
+ self addMorph: dummyColumn.
+
+ timesRepeatColumn _ AlignmentMorph newColumn.
+ timesRepeatColumn setNameTo: 'Times Repeat'.
+
+ timesRepeatColumn cellPositioning: #topLeft.
+ timesRepeatColumn hResizing: #spaceFill.
+ timesRepeatColumn vResizing: #shrinkWrap.
+ timesRepeatColumn layoutInset: 0.
+ timesRepeatColumn borderWidth: 0.
+ timesRepeatColumn color: Color orange muchLighter.
+
+ timesRow _ AlignmentMorph newRow color: color; layoutInset: 0.
+ timesRow minCellSize: (2 at 16).
+ timesRow setNameTo: 'Times'.
+ repeatLabel _ StringMorph contents: 'Repeat' translated font: Preferences standardEToysFont.
+ timesRow addMorphBack: repeatLabel.
+ timesRow vResizing: #shrinkWrap.
+ timesRow addMorphBack: (Morph new color: color; extent: 6 at 5). "spacer"
+
+ numberOfTimesToRepeatPart := TilePadMorph new setType: #Number.
+ numberOfTimesToRepeatPart hResizing: #shrinkWrap; color: Color transparent.
+ numberOfTimesToRepeatPart addMorphBack: (TileMorph new addArrows; setLiteral: 2).
+ numberOfTimesToRepeatPart borderWidth: 0; layoutInset: (1 at 0).
+
+ timesRow addMorphBack: numberOfTimesToRepeatPart.
+ timesRow addMorphBack: (StringMorph contents: ' times ' font: Preferences standardEToysFont).
+ timesRow addMorphBack: AlignmentMorph newVariableTransparentSpacer.
+ timesRepeatColumn addMorphBack: timesRow.
+
+ separator _ AlignmentMorph newRow color: Color transparent.
+ separator vResizing: #rigid; hResizing: #spaceFill; height: 2.
+ separator borderWidth: 0.
+ timesRepeatColumn addMorphBack: separator.
+
+ repeatRow _ AlignmentMorph newRow color: color; layoutInset: 0.
+ repeatRow minCellSize: (2 at 16).
+ repeatRow setNameTo: 'Repeat '.
+ placeHolder _ Morph new.
+ placeHolder beTransparent; extent: (8 at 0).
+ repeatRow addMorphBack: placeHolder.
+ repeatRow vResizing: #shrinkWrap.
+ doLabel _ StringMorph contents: 'Do' font: Preferences standardEToysFont.
+ repeatRow addMorphBack: doLabel.
+ repeatRow addMorphBack: (Morph new color: color; extent: 5 at 5). "spacer"
+ repeatRow addMorphBack: (whatToRepeatPart _ ScriptEditorMorph new borderWidth: 0; layoutInset: 0).
+
+ whatToRepeatPart hResizing: #spaceFill.
+ whatToRepeatPart vResizing: #shrinkWrap.
+ whatToRepeatPart color: Color transparent.
+ whatToRepeatPart setNameTo: 'Script to repeat'.
+ whatToRepeatPart addMorphBack: (ephemerum := Morph new height: 14) beTransparent.
+
+ timesRepeatColumn addMorphBack: repeatRow.
+
+ self addMorphBack: timesRepeatColumn.
+ self bounds: self fullBounds.
+
+ ephemerum delete!
Item was added:
+ ----- Method: TimesRepeatMorph>>labelMorphs (in category 'access') -----
+ labelMorphs
+
+ | w |
+ w := WriteStream on: (Array new: 3).
+ w nextPut: self submorphs second submorphs first submorphs first.
+ w nextPut: self submorphs second submorphs first submorphs fourth.
+ w nextPut: self submorphs second submorphs third submorphs second.
+ ^ w contents.
+ !
Item was added:
+ ----- Method: TimesRepeatMorph>>parseNodeWith: (in category 'code generation') -----
+ parseNodeWith: encoder
+
+ | rec selector arg |
+ rec _ numberOfTimesToRepeatPart submorphs
+ ifEmpty:
+ [encoder encodeLiteral: 0]
+ ifNotEmpty:
+ [numberOfTimesToRepeatPart parseNodeWith: encoder].
+ selector _ #timesRepeat:.
+ arg _ self blockNode: whatToRepeatPart with: encoder.
+ ^ MessageNode new
+ receiver: rec
+ selector: selector
+ arguments: (Array with: arg)
+ precedence: (selector precedence)
+ from: encoder
+ sourceRange: nil.
+ !
Item was added:
+ ----- Method: TimesRepeatMorph>>sexpWith: (in category 'code generation') -----
+ sexpWith: dictionary
+
+ | n elements e |
+ n _ SExpElement keyword: #loop.
+ n attributeAt: #type put: 'repeat'.
+ elements _ WriteStream on: (Array new: 3).
+ e _ SExpElement keyword: #initial.
+ e elements: (Array with: ((SExpElement keyword: #literal) attributeAt: #value put: '1'; yourself)).
+ elements nextPut: e.
+ e _ SExpElement keyword: #increment.
+ e elements: (Array with: ((SExpElement keyword: #literal) attributeAt: #value put: '1'; yourself)).
+ elements nextPut: e.
+
+ e _ SExpElement keyword: #test.
+ numberOfTimesToRepeatPart submorphs
+ ifEmpty:
+ [e elements: (Array with: ((SExpElement keyword: #literal) attributeAt: #value put: '0'; yourself))]
+ ifNotEmpty:
+ [e elements: (Array with: (numberOfTimesToRepeatPart sexpWith: dictionary))].
+
+ elements nextPut: e.
+
+ elements nextPut: (self sexpBlockFor: whatToRepeatPart with: dictionary).
+ n elements: elements contents.
+ ^ n.
+
+ !
Item was added:
+ ----- Method: TimesRepeatMorph>>storeCodeOn:indent: (in category 'code generation') -----
+ storeCodeOn: aStream indent: tabCount
+ "Store code representing the receiver on the stream, obeying the tab state."
+
+ aStream nextPutAll: '(('.
+ numberOfTimesToRepeatPart submorphs
+ ifEmpty:
+ [aStream nextPutAll: '0']
+ ifNotEmpty:
+ [numberOfTimesToRepeatPart storeCodeOn: aStream indent: tabCount + 2].
+ aStream nextPutAll: ' ) asInteger max: 0) timesRepeat:'.
+ tabCount + 1 timesRepeat: [aStream tab].
+ aStream nextPutAll: '['; cr.
+ self storeCodeBlockFor: whatToRepeatPart on: aStream indent: tabCount + 2.
+ aStream nextPut: $].
+ !
Item was added:
+ ----- Method: TimesRepeatMorph>>targetPartFor: (in category 'initialization') -----
+ targetPartFor: aMorph
+ "Return the row into which the given morph should be inserted."
+
+ | centerY |
+ centerY _ aMorph fullBounds center y.
+ {numberOfTimesToRepeatPart, whatToRepeatPart} do: [:m |
+ (centerY <= m bounds bottom) ifTrue: [^ m]].
+ ^ noPart
+ !
More information about the etoys-dev
mailing list