'From etoys3.0 of 24 February 2008 [latest update: #1924] on 18 March 2008 at 1:11:40 am'! "Change Set: transTriggers-KR Date: 16 April 2008 Author: Korakurider translate ScriptStatus chooser"! !GeeMailMorph class methodsFor: '*customevents-class initialization' stamp: 'KR 3/18/2008 00:58'! initialize "AlansTextPlusMorph initialize" #('scrolledIntoView' 'scrolledOutOfView') translatedNoop. ScriptingSystem addCustomEventFor: self named: #scrolledIntoView help: 'when I am scrolled into view in a GeeMailMorph' targetMorphClass: self. ScriptingSystem addCustomEventFor: self named: #scrolledOutOfView help: 'when I am scrolled out of view in a GeeMailMorph' targetMorphClass: self. ! ! !NCAAConnectorMorph class methodsFor: 'class initialization' stamp: 'KR 3/18/2008 00:50'! initialize "NCAAConnectorMorph initialize" Preferences addPreference: #useSmartLabels category: 'connectors' default: false balloonHelp: 'if set, Connectors will use labels that try to re-position themselves to stay out of the way.'. Preferences addPreference: #alwaysShowConnectionVocabulary category: 'connectors' default: false balloonHelp: 'if set, viewers will display the ''connection'' vocabulary even for Morphs that aren''t connected to by Connectors.'. #('connectedTo' 'disconnectedFrom' 'sourceConnected' 'sourceDisconnecting' 'destinationConnected' 'destinationDisconnecting' 'attachmentOwnerChanged') translatedNoop. ScriptingSystem addCustomEventFor: self named: #connectedTo help: 'immediately after a connector has connected to me' targetMorphClass: Morph. ScriptingSystem addCustomEventFor: self named: #disconnectedFrom help: 'immediately before a connector is going to disconnect from me' targetMorphClass: Morph. ScriptingSystem addCustomEventFor: self named: #sourceConnected help: 'immediately after my first end has been connected' targetMorphClass: self. ScriptingSystem addCustomEventFor: self named: #sourceDisconnecting help: 'immediately before my first end is going to be disconnected' targetMorphClass: self. ScriptingSystem addCustomEventFor: self named: #destinationConnected help: 'immediately after my second end has been connected' targetMorphClass: self. ScriptingSystem addCustomEventFor: self named: #destinationDisconnecting help: 'immediately before my second end is going to be disconnected' targetMorphClass: self. ScriptingSystem addCustomEventFor: self named: #attachmentOwnerChanged help: 'when either of the morphs to which I''m connected have changed their owner or been grabbed or dropped with the hand.' targetMorphClass: self. Smalltalk addToStartUpList: self. self initializeArrowDictionary.! ! !NCTextMorph class methodsFor: 'class initialization' stamp: 'KR 3/18/2008 01:10'! initialize #('acceptedTextContents') translatedNoop. "NCTextMorph initialize" ScriptingSystem addCustomEventFor: self named: #acceptedTextContents help: 'when text is accepted into a text morph by hitting Enter or losing focus' targetMorphClass: self. ! ! !NCDisplayTextMorph class methodsFor: 'class initialization' stamp: 'KR 3/18/2008 01:10'! initialize "NCDisplayTextMorph initialize" #('acceptedTextContents') translatedNoop. ScriptingSystem addCustomEventFor: self named: #acceptedTextContents help: 'when text is accepted into a text morph by hitting Enter or losing focus' targetMorphClass: self. ! ! !PasteUpMorph class methodsFor: 'class initialization' stamp: 'KR 3/18/2008 01:09'! initialize "Initialize the class" #('keystroke') translatedNoop. self registerInFlapsRegistry. ScriptingSystem addCustomEventFor: self named: #keyStroke help: 'when a keystroke happens and nobody heard it' targetMorphClass: PasteUpMorph.! ! !ScriptInstantiation methodsFor: '*customevents-status control' stamp: 'KR 3/18/2008 00:44'! presentScriptStatusPopUp "Put up a menu of status alternatives and carry out the request" | reply m menu submenu | #('normal' 'paused' 'ticking' 'opening' 'closing') translatedNoop. menu _ MenuMorph new. self addStatusChoices: #( normal " -- run when called" ) toMenu: menu. self addStatusChoices: #( paused "ready to run all the time" ticking "run all the time" ) toMenu: menu. self addStatusChoices: (ScriptingSystem standardEventStati copyFrom: 1 to: 3) toMenu: menu. self addStatusChoices: (ScriptingSystem standardEventStati allButFirst: 3) toMenu: menu. self addStatusChoices: #(opening "when I am being opened" closing "when I am being closed" ) toMenu: menu. submenu _ MenuMorph new. self addStatusChoices: (ScriptingSystem globalCustomEventNamesFor: player) toSubMenu: submenu forMenu: menu. menu add: 'more... ' translated subMenu: submenu. (Preferences allowEtoyUserCustomEvents) ifTrue: [ submenu addLine. self addStatusChoices: ScriptingSystem userCustomEventNames toSubMenu: submenu forMenu: menu. submenu addLine. self addStatusChoices: (Array streamContents: [ :s | s nextPut: { 'define a new custom event' translated. #defineNewEvent }. ScriptingSystem userCustomEventNames isEmpty ifFalse: [ s nextPut: { 'delete a custom event' translated. #deleteCustomEvent } ]]) toSubMenu: submenu forMenu: menu ]. menu addLine. self addStatusChoices: #( ('what do these mean?'explainStatusAlternatives) ('apply my status to all siblings' assignStatusToAllSiblings) ) translatedNoop toMenu: menu. menu addTitle: 'When should this script run?' translated. menu submorphs last delete. menu invokeModal. reply := menu modalSelection. reply == #explainStatusAlternatives ifTrue: [^ self explainStatusAlternatives]. reply == #assignStatusToAllSiblings ifTrue: [^ self assignStatusToAllSiblings]. reply == #defineNewEvent ifTrue: [ ^self defineNewEvent ]. reply == #deleteCustomEvent ifTrue: [ ^self deleteCustomEvent ]. reply ifNotNil: [self status: reply. "Gets event handlers fixed up" reply == #paused ifTrue: [m _ player costume. (m isKindOf: SpeakerMorph) ifTrue: [m stopSound]]. self updateAllStatusMorphs] ! ! !StandardScriptingSystem methodsFor: '*customevents-custom events' stamp: 'KR 3/18/2008 00:06'! standardEventStati "Answer the events that can be directed to a particular morph by its event handler." #('mouseDown' 'mouseStillDown' 'mouseUp' 'mouseEnter' 'mouseLeave' 'mouseEnterDragging' 'mouseLeaveDragging') translatedNoop. ^ #( mouseDown "run when mouse goes down on me" mouseStillDown "while mouse still down" mouseUp "when mouse comes back up" mouseEnter "when mouse enters my bounds, button up" mouseLeave "when mouse exits my bounds, button up" mouseEnterDragging "when mouse enters my bounds, button down" mouseLeaveDragging "when mouse exits my bounds, button down" "keyStroke" "gesture" ) ! ! PasteUpMorph initialize! NCDisplayTextMorph initialize! NCTextMorph initialize! NCAAConnectorMorph initialize! GeeMailMorph initialize!