'From Squeakland 3.8.5976 of 25 August 2004 [latest update: #388] on 11 February 2005 at 4:23:19 pm'! "Change Set: TranslationViewers Date: 11 February 2005 Author: Yoshiki Ohshima Translates some elements in viewers."! !ObjectWithDocumentation methodsFor: 'documentation' stamp: 'yo 2/11/2005 15:41'! editDescription "Allow the user to see and edit the documentation for this object" | reply helpMessage | helpMessage _ self documentation isNil ifTrue: [String new] ifFalse: [self documentation]. reply _ FillInTheBlank multiLineRequest: 'Kindly edit the description' translated centerAt: Sensor cursorPoint initialAnswer: helpMessage answerHeight: 200. reply isEmptyOrNil ifFalse: [self documentation: reply]! ! !Player methodsFor: 'scripts-kernel' stamp: 'yo 2/11/2005 15:37'! renameScript: oldSelector "The user has asked to rename the script formerly known by oldSelector; obtain a new selector from the user, check it out, and if all is well, ascribe the new name as appropriate" | reply newSelector aUserScript | self flag: #deferred. "Relax the restriction below, before too long" aUserScript := self class userScriptForPlayer: self selector: oldSelector. aUserScript okayToRename ifFalse: [self inform: 'Sorry, we do not permit you to rename classic-tiled scripts that are currently textually coded. Go back to tile scripts and try again. Humble apologies.' translated. ^self]. reply := FillInTheBlank request: 'Script Name' translated initialAnswer: oldSelector. reply isEmpty ifTrue: [^self]. reply = oldSelector ifTrue: [^Beeper beep]. newSelector := self acceptableScriptNameFrom: reply forScriptCurrentlyNamed: oldSelector. Preferences universalTiles ifTrue: ["allow colons" (reply copyWithout: $:) = newSelector ifTrue: [newSelector := reply asSymbol] ifFalse: [self inform: 'name will be modified']]. self renameScript: oldSelector newSelector: newSelector! ! !Player methodsFor: 'slots-user' stamp: 'yo 2/11/2005 16:01'! chooseSlotTypeFor: aGetter "Let the user designate a type for the slot associated with the given getter" | typeChoices typeChosen slotName | slotName _ Utilities inherentSelectorForGetter: aGetter. typeChoices _ Vocabulary typeChoices. typeChosen _ (SelectionMenu labelList: (typeChoices collect: [:t | t translated]) lines: #() selections: typeChoices) startUpWithCaption: ('Choose the TYPE for ' translated, slotName, ' (currently ' translated, (self slotInfoAt: slotName) type translated, ')'). typeChosen isEmptyOrNil ifTrue: [^ self]. (self typeForSlot: slotName) capitalized = typeChosen ifTrue: [^ self]. (self slotInfoAt: slotName) type: typeChosen. self class allInstancesDo: "allSubInstancesDo:" [:anInst | anInst instVarNamed: slotName asString put: (anInst valueOfType: typeChosen from: (anInst instVarNamed: slotName))]. self updateAllViewers. "does siblings too" ! ! !Player methodsFor: 'slots-user' stamp: 'yo 2/11/2005 15:44'! removeSlotNamed: aSlotName "The user has requested that an instance variable be removed..." | aSetter aGetter | (self okayToRemoveSlotNamed: aSlotName) ifFalse: [^ self inform: ('Sorry, {1} is in use in a script.' translated format: {aSlotName})]. aSetter _ Utilities setterSelectorFor: aSlotName. aGetter _ Utilities getterSelectorFor: aSlotName. ((self systemNavigation allCallsOn: aSetter) size > 0 or: [(self systemNavigation allCallsOn: aGetter) size > 0]) ifTrue: [self inform: 'Caution!! There may be scripts belonging to other objects that may rely on the presence of this variable. If there are, they may now be broken. You may need to fix them up manually.' translated]. self class removeInstVarName: aSlotName asString. self updateAllViewers! ! !Player methodsFor: 'viewer' stamp: 'yo 2/11/2005 15:48'! infoFor: anElement inViewer: aViewer "The user made a gesture asking for info/menu relating" | aMenu elementType aSelector | elementType := self elementTypeFor: anElement vocabulary: aViewer currentVocabulary. elementType = #systemSlot | (elementType == #userSlot) ifTrue: [^self slotInfoButtonHitFor: anElement inViewer: aViewer]. aMenu := MenuMorph new defaultTarget: self. aMenu defaultTarget: self. aSelector := anElement asSymbol. elementType == #userScript ifTrue: [aMenu add: 'destroy "' translated , anElement , '"' selector: #removeScriptWithSelector: argument: aSelector. aMenu add: 'rename "' translated, anElement , '"' selector: #renameScript: argument: aSelector. aMenu add: 'textual scripting pane' translated selector: #makeIsolatedCodePaneForSelector: argument: aSelector. aSelector numArgs > 0 ifTrue: [aMenu add: 'remove parameter' translated selector: #ceaseHavingAParameterFor: argument: aSelector] ifFalse: [aMenu add: 'add parameter' translated selector: #startHavingParameterFor: argument: aSelector. aMenu add: 'button to fire this script' translated selector: #tearOffButtonToFireScriptForSelector: argument: aSelector]. aMenu add: 'edit balloon help' translated selector: #editDescriptionForSelector: argument: aSelector]. aMenu add: 'show categories....' translated target: aViewer selector: #showCategoriesFor: argument: aSelector. aMenu items isEmpty ifTrue: ["Never 0 at the moment because of show categories addition" aMenu add: 'ok' translated action: nil]. aMenu addTitle: anElement asString , ' (' , elementType translated , ')'. aMenu popUpInWorld: aViewer world! ! !SoundReadoutTile methodsFor: 'arrows' stamp: 'yo 2/11/2005 16:12'! setLiteral: aLiteral super setLiteral: aLiteral. (self findA: UpdatingStringMorph) useSymbolFormat; lock! ! !SoundReadoutTile methodsFor: 'arrows' stamp: 'yo 2/11/2005 16:08'! soundNameFromUser "Obtain a sound from the user. Exclude the items designated as being discouraged, except that if the current selection is one of those, show it anyway" | choices | choices _ self soundChoices. ^ (SelectionMenu labels: (choices collect: [:t | t translated]) selections: self soundChoices) startUpWithCaption: 'Sounds' translated! ! !SoundReadoutTile methodsFor: 'private' stamp: 'yo 2/11/2005 16:13'! updateLiteralLabel "Update the wording emblazoned on the tile, if needed" super updateLiteralLabel. (self findA: UpdatingStringMorph) useSymbolFormat; lock! !