'From etoys2.1 of 8 August 2007 [Xlatest update: #X1547] on 14 August 2007 at 12:33:46 am'! "Change Set: transGoldBox-KR Date: 12 August 2007 Author: Korakurider translation stuff for scriptor menu/goldbox"! !GoldBoxMenu methodsFor: 'initialization' stamp: 'KR 8/12/2007 14:26'! initializeFor: aScriptor "Answer a graphical menu to be put up in conjunction with the Gold Box" | aButton goldBox aReceiver boxBounds | 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'. 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}. {Vocabulary vocabularyNamed: 'Number'. #defaultArgumentTile. 'number' translated. 'A tile holding a plain number' translated}. } do: [:tuple | aReceiver _ tuple first. aButton _ IconicButton new initializeWithThumbnail: (PartsBin thumbnailForQuad: tuple color: self color) 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: 'other' stamp: 'KR 8/14/2007 00:27'! offerScriptorMenu "Put up a menu in response to the user's clicking in the menu-request area of the scriptor's heaer" | aMenu count | self modernize. ActiveHand showTemporaryCursor: nil. Preferences eToyFriendly ifTrue: [^ self offerSimplerScriptorMenu]. aMenu _ MenuMorph new defaultTarget: self. aMenu addTitle: scriptName asString. aMenu addStayUpItem. "NB: the kids version in #offerSimplerScriptorMenu does not deploy the stay-up item" aMenu addList: (self hasParameter ifTrue: [{ {'remove parameter' translated. #ceaseHavingAParameter}}] ifFalse: [{ {'add parameter' translated. #addParameter}}]). self hasParameter ifFalse: [aMenu addTranslatedList: { {'button to fire this script' translatedNoop. #tearOfButtonToFireScript}. {'fires per tick...' translatedNoop. #chooseFrequency}. #- }]. aMenu addUpdating: #showingCaretsString target: self action: #toggleShowingCarets. aMenu addLine. aMenu addList: { {'edit balloon help for this script' translated. #editMethodDescription}. {'explain status alternatives' translated. #explainStatusAlternatives}. #- }. Preferences universalTiles ifFalse: [count _ self savedTileVersionsCount. self showingMethodPane ifFalse: "currently showing tiles" [aMenu add: 'show code textually' translated action: #toggleWhetherShowingTiles. count > 0 ifTrue: [aMenu add: 'revert to tile version...' translated action: #revertScriptVersion]. aMenu add: 'save this version' translated action: #saveScriptVersion] ifTrue: "current showing textual source" [count >= 1 ifTrue: [aMenu add: 'revert to tile version' translated action: #toggleWhetherShowingTiles]]]. "aMenu addLine. self addGoldBoxItemsTo: aMenu." aMenu addLine. aMenu addTranslatedList: { {'reveal my object' translatedNoop. #findObject. 'This script belongs to some object. Show me where that object is on the screen' translatedNoop}. {'open viewer' translatedNoop. #openObjectsViewer. 'open the viewer of the object to which this script belongs' translatedNoop}. {'detached method pane' translatedNoop. #makeIsolatedCodePane. 'open a little window that shows the Smalltalk code underlying this script.' translatedNoop}. #-. {'destroy this script' translatedNoop. #destroyScript} }. aMenu popUpInWorld: self currentWorld. ! !