'From etoys3.0 of 28 February 2008 [latest update: #2002] on 18 May 2008 at 12:31:17 pm'! "Change Set: goldBoxFix-sw Date: 18 May 2008 Author: Scott Wallace Fix for TRAC Ticket #7028 A tile from golden box is duplicated "! !GoldBoxMenu methodsFor: 'initialization' stamp: 'sw 5/18/2008 12:29'! initializeFor: aScriptor "Answer a graphical menu to be put up in conjunction with the Gold Box" | aButton goldBox aReceiver boxBounds example toScale | scriptor _ aScriptor. lastItemMousedOver _ nil. self removeAllMorphs. self setProperty: #goldBox toValue: true. self listDirection: #topToBottom; hResizing: #spaceFill; extent: 1@1; vResizing: #spaceFill. "standard #newColumn stuff" self setNameTo: 'Gold Box' translated. self useRoundedCorners. self color: Color white. self borderColor: (Color r: 1.0 g: 0.839 b: 0.065). self hResizing: #shrinkWrap; vResizing: #shrinkWrap; borderWidth: 4. { {ScriptingSystem. #yesNoComplexOfTiles. 'test' translated. 'Test/Yes/No panes for testing a condition.' translated}. {ScriptingSystem. #timesRepeatComplexOfTiles. 'repeat' translated. 'TimesRepeat panes for running a section of code repeatedly.' translated}. { ScriptingSystem. #randomNumberTile. 'random' translated. 'A tile that will produce a random number in a given range.' translated. #randomTileIconForm}. { ScriptingSystem. #seminalFunctionTile. 'function' translated. 'A tile representing a function call. Click on the function name or the arrows to change functions.' translated.#absTileIconForm}. {ScriptingSystem. #buttonUpTile. 'button up?' translated. 'Reports whether the mouse button is up' translated}. {ScriptingSystem. #buttonDownTile. 'button down?' translated. 'Reports whether the mouse button is down' translated}. {scriptor playerScripted. #tileToRefer. 'tile for me' translated. 'A tile representing the object being scripted' translated}. {self. #numericConstantTile. 'number' translated. 'A tile holding a plain number' translated}. } do: [:tuple | aReceiver _ tuple first. example := aReceiver perform: tuple second. aButton := IconicButton new target: aReceiver. aButton borderWidth: 0; color: Color transparent. toScale := tuple size >= 5 ifTrue: [tuple first perform: tuple fifth] "bail-out for intractable images." ifFalse: [example imageForm]. aButton labelGraphic: (toScale copy scaledToHeight: 40). aButton actionSelector: #launchPartOffsetVia:label:. aButton arguments: {tuple second. tuple third}. (tuple size > 3 and: [tuple fourth isEmptyOrNil not]) ifTrue: [aButton setBalloonText: tuple fourth]. aButton actWhen: #buttonDown. aButton on: #mouseEnter send: #mousedOverEvent:button: to: self. aButton on: #click send: #delete to: self. self addMorphBack: aButton]. goldBox _ aScriptor submorphs first submorphThat: [:m | (m isKindOf: SimpleButtonMorph) and: [m actionSelector == #offerGoldBoxMenu]] ifNone: [nil]. goldBox ifNil: [self position: ActiveHand position] ifNotNil: [boxBounds _ goldBox boundsInWorld. self center: boxBounds center. self left: (boxBounds center x - (self width // 2)). self top: boxBounds bottom]. lastItemMousedOver _ nil. self on: #mouseLeave send: #mouseLeftMenuWithEvent: to: self. self on: #mouseLeaveDragging send: #delete to: self.! ! GoldBoxMenu removeSelector: #clickEvent:button:!