'From etoys3.0 of 21 February 2008 [latest update: #1957] on 9 April 2008 at 9:29:21 pm'! "Change Set: goldBoxIconSize-sw Date: 9 April 2008 Author: Scott Wallace TRAC 6867 Tiles in golden 'treasure box' are too small -- they can hardly be recognized on an XO Make the icons in the gold-box menu larger, and factors size-definition out so that it can more easily be changed. Also, force the gold-box to be entirely on-screen. Also, fixes a typo in the balloon-help for one of the gold-box icons. NB: The multiple scalings applied result in somewhat fuzzy-looking icons in some cases; this should probably be improved eventually."! !GoldBoxMenu methodsFor: 'initialization' stamp: 'sw 4/9/2008 21:25'! basicExtentForElements "Answer the nominal thumbnail extent" ^ Preferences parameterAt: #goldBoxElementExtent ifAbsentPut: (140 @ 40) " Preferences setParameter: #goldBoxElementExtent to: (140 @ 40). "! ! !GoldBoxMenu methodsFor: 'initialization' stamp: 'sw 4/9/2008 18:52'! initializeFor: aScriptor "Answer a graphical menu to be put up in conjunction with the Gold Box" | aButton goldBox aReceiver boxBounds th | 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}. { ScriptingSystem. #seminalFunctionTile. 'function' translated. 'A tile representing a function call. Click on the function name or the arrows to change functions.' translated}. {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. th := PartsBin thumbnailForQuad: tuple color: self color. th extent: self basicExtentForElements. aButton _ IconicButton new initializeWithThumbnail: th withLabel: '' andColor: self color andSend: tuple second to: aReceiver. aButton actionSelector: #launchPartOffsetVia:label:. aButton arguments: {tuple second. tuple third}. (tuple size > 3 and: [tuple fourth isEmptyOrNil not]) ifTrue: [aButton setBalloonText: tuple fourth]. aButton on: #mouseEnter send: #mousedOverEvent:button: to: self. aButton on: #click send: #clickEvent:button: 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.! ! !ScriptEditorMorph methodsFor: 'gold box' stamp: 'sw 4/9/2008 18:55'! offerGoldBoxMenu "Put up a gold-box menu beneath my gold-box icon. This will re-use an existing one" self goldBoxMenu openInWorld; goHome! !