Squeak Class Documentation category index | class index  
 
ScriptEditorMorph
  category: Morphic-Scripting
  superclass: AlignmentMorph
  subclasses: ScriptEvaluatorMorph BooleanScriptEditor

Presents an EToy script to the user on the screen. Has in it:

a Morph with the controls for the script.
a Morph with the tiles. Either PhraseMorphs and TileMorphs,
or a TwoWayScroller with SyntaxMorphs in it.

WritingUniversalTiles -- only vlaid while a project is being written out.
True if using UniversalTiles in that project.

instance methods
  access
  morph
myMorph
objectViewed
scriptInstantiation

  buttons
  actuallyDestroyScript
addDestroyButtonTo:
addDismissButtonTo:
addYesNoToHand
buttonRowForEditor
chooseFrequency
chooseTrigger
destroyScript
dismiss
editMethodDescription
install
installWithNewLiteral
makeIsolatedCodePane
playerScripted
replaceRow1
scriptName
scriptTitle
scriptee
showSourceInScriptor
tryMe
updateStatus
updateStatusMorph:

  copying
  veryDeepFixupWith:
veryDeepInner:

  drawing
  drawOn:

  dropping/grabbing
  acceptDroppingMorph:event:
bringUpToDate
dismissViaHalo
handlesMouseOver:
handlesMouseOverDragging:
indexOfMorphAbove:
isCandidateForAutomaticViewing
mouseEnter:
mouseEnterDragging:
mouseLeave:
mouseLeaveDragging:
prepareToUndoDropOf:
removeSpaces
repelsMorph:event:
step
stepTime
wantsDroppedMorph:event:
willingToBeDiscarded

  frequency
  setFrequencyTo:
typeInFrequency

  initialization
  initialize
phrase:
playerScripted:
setDefaultBorderCharacteristics
setMorph:
setMorph:scriptName:
updateHeader
updateToPlayer:

  menu
  addCustomMenuItems:hand:
autoFitOnOff
autoFitString

  other
  adaptToWorld:
becomeTextuallyCoded
codeString
explainStatusAlternatives
extent:
handUserButtonDownTile
handUserButtonUpTile
handUserRandomTile
handUserTileForSelf
hasScriptInvoking:ofPlayer:
hasScriptReferencing:ofPlayer:
hibernate
insertUniversalTiles
insertUniversalTilesForClass:selector:
isEmpty
isTextuallyCoded
isTileScriptingElement
methodNodeMorph
methodString
modernize
offerScriptorMenu
recompileScript
recreateScript
reinsertSavedTiles:
releaseCachedState
renameScript
renameScriptTo:
revertScriptVersion
setScriptNameTo:
setTimeStamp
storeCodeOn:indent:
tearOfButtonToFireScript
tileRows
timeStamp
toggleWhetherShowingTiles
unhibernate
userScriptObject

  private
  addNewRow
insertTileRow:after:
removeEmptyRows
rowInsertionIndexFor:
scriptEdited

  save & revert
  revertToTileVersion
saveScriptVersion
savedTileVersionsCount

  testing
  isTileEditor

  textually-coded scripts
  showingMethodPane
showingMethodPane:

  tiles from method
  fromExistingMethod:forPlayer:

class methods
  instance creation
  includeInNewMorphMenu
writingUniversalTiles
writingUniversalTiles:

instance methods
  access top  
 

morph


 

myMorph

Answer the morph that serves as the costume of my associated player. If for some reason I have no associated player, answer nil


 

objectViewed

Answer the morph associated with the player that the structure the receiver currently finds itself within represents.


 

scriptInstantiation


  buttons top  
 

actuallyDestroyScript

Carry out the actual destruction of the associated script.


 

addDestroyButtonTo:


 

addDismissButtonTo:


 

addYesNoToHand

Place a test/yes/no complex in the hand of the beloved user


 

buttonRowForEditor

Answer a row of buttons that comprise the header at the top of the Scriptor


 

chooseFrequency


 

chooseTrigger

NB; the keyStroke branch commented out temporarily until keystrokes can actually be passed along to the user's scripting code


 

destroyScript

At user request, and only after confirmation, destroy the script, thus removing it from the uniclass's method dictionary and removing its instantiations from all instances of uniclass, etc.


 

dismiss

Dismiss the scriptor, usually nondestructively


 

editMethodDescription

Edit the balloon help associated with the script


 

install

Accept the current classic tiles as the new source code for the script. In the case of universalTiles, initialize the method and its methodInterface if not already done.


 

installWithNewLiteral


 

makeIsolatedCodePane


 

playerScripted


 

replaceRow1


 

scriptName


 

scriptTitle


 

scriptee


 

showSourceInScriptor

Remove tile panes, if any, and show textual source instead


 

tryMe

Evaluate the given script on behalf of the scripted object


 

updateStatus

Update that status in the receiver's header


 

updateStatusMorph:

my status button may need to reflect an externally-induced change in status


  copying top  
 

veryDeepFixupWith:

If target and arguments fields were weakly copied, fix them here. If they were in the tree being copied, fix them up, otherwise point to the originals!!


 

veryDeepInner:

Copy all of my instance variables. Some need to be not copied at all, but shared. Warning!! Every instance variable defined in this class must be handled. We must also implement veryDeepFixupWith:. See DeepCopier class comment.


  drawing top  
 

drawOn:

may need to unhibernate the script lazily here.


  dropping/grabbing top  
 

acceptDroppingMorph:event:

Allow the user to add tiles and program fragments just by dropping them on this morph.


 

bringUpToDate

Make certain that the player name in my header is up to date. Names emblazoned on submorphs of mine are handled separately by direct calls to their #bringUpToDate methods -- the responsibility here is strictly for the name in the header.


 

dismissViaHalo

The user has clicked in the delete halo-handle. This provides a hook in case some concomitant action should be taken, or if the particular morph is not one which should be put in the trash can, for example.


 

handlesMouseOver:

Do I want to receive mouseEnter: and mouseLeave: when the button is up and the hand is empty? The default response is false, except if you have added sensitivity to mouseEnter: or mouseLeave:, using the on:send:to: mechanism.


 

handlesMouseOverDragging:

Return true if I want to receive mouseEnterDragging: and mouseLeaveDragging: when the hand drags something over me (button up or button down), or when the mouse button is down but there is no mouseDown recipient. The default response is false, except if you have added sensitivity to mouseEnterLaden: or mouseLeaveLaden:, using the on:send:to: mechanism.


 

indexOfMorphAbove:

Return index of lowest morph whose bottom is above aPoint.
Will return 0 if the first morph is not above aPoint


 

isCandidateForAutomaticViewing


 

mouseEnter:

Handle a mouseEnter event, meaning the mouse just entered my bounds with no button pressed. The default response is to let my eventHandler, if any, handle it.


 

mouseEnterDragging:

Test button state elsewhere if at all


 

mouseLeave:

Handle a mouseLeave event, meaning the mouse just left my bounds with no button pressed. The default response is to let my eventHandler, if any, handle it.


 

mouseLeaveDragging:

Test button state elsewhere if at all


 

prepareToUndoDropOf:

No longer functional


 

removeSpaces


 

repelsMorph:event:

Answer whether the receiver shoul repel the given morph


 

step

Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.


 

stepTime

Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.


 

wantsDroppedMorph:event:

Answer whether the receiver would be interested in accepting the morph


 

willingToBeDiscarded

Resist the drag-into-trash gesture


  frequency top  
 

setFrequencyTo:


 

typeInFrequency


  initialization top  
 

initialize


 

phrase:

Make the receiver be an anonymous editor around aPhraseTileMorph


 

playerScripted:


 

setDefaultBorderCharacteristics


 

setMorph:

Not really the way to do this any more


 

setMorph:scriptName:

Create a script editor for editing a named script.


 

updateHeader

Replace my header morph with another one assured of being structurally au courant


 

updateToPlayer:

Make certain that the script name and the names of actors within are up to date


  menu top  
 

addCustomMenuItems:hand:

Add morph-specific items to the given menu which was invoked by the given hand. This method provides is invoked both from the halo-menu and from the control-menu regimes.


 

autoFitOnOff

Toggle between auto fit to size of code and manual resize with scrolling


 

autoFitString

Answer the string to put in a menu that will invite the user to switch autoFit mode


  other top  
 

adaptToWorld:

The receiver finds itself operating in a possibly-different new world. If any of the receiver's parts are world-dependent (such as a target of a SimpleButtonMorph, etc.), then have them adapt accordingly


 

becomeTextuallyCoded

If the receiver is not currently textually coded, make it become so now, and show its source in place in the Scriptor


 

codeString


 

explainStatusAlternatives


 

extent:


 

handUserButtonDownTile

Hand the user a button-down tile, presumably to drop in the script


 

handUserButtonUpTile

Hand the user a button-up tile, presumably to drop in the script


 

handUserRandomTile

Hand the user a random-number tile, presumably to drop in the script


 

handUserTileForSelf

Hand the user a tile representing the player who is current the 'self' of this script


 

hasScriptInvoking:ofPlayer:

Answer whether the receiver has any tiles in it which invoke the given script of the given player. Place-holder for now, needs to be implemented


 

hasScriptReferencing:ofPlayer:

Answer whether the receiver has any tiles in it which reference the given slot of the given player. Place-holder for now, needs to be implemented


 

hibernate

Possibly delete the tiles, but only if using universal tiles.


 

insertUniversalTiles

Insert universal tiles for the method at hand


 

insertUniversalTilesForClass:selector:

Add a submorph which holds the universal-tiles script for the given class and selector


 

isEmpty


 

isTextuallyCoded


 

isTileScriptingElement


 

methodNodeMorph

Answer the morph that constitutes the receiver's method node


 

methodString

Answer the source-code string for the receiver. This is for use by classic tiles, but is also used in universal tiles to formulate an initial method declaration for a nascent user-defined script; in universalTiles mode, the codeString (at present anyway) is empty -- the actual code derives from the SyntaxMorph in that case


 

modernize

If the receiver appears to date from the past, try to fix it up


 

offerScriptorMenu

Put up a menu in response to the user's clicking in the menu-request area of the scriptor's heaer


 

recompileScript

A hook called in several places in the UI when something has been dragged & dropped into or out of the script.


 

recreateScript


 

reinsertSavedTiles:

Revert the scriptor to show the saved tiles


 

releaseCachedState

Release any state that can be recomputed on demand, such as the pixel values for a color gradient or the editor state for a TextMorph. This method may be called to save space when a morph becomes inaccessible. Implementations of this method should do 'super releaseCachedState'.


 

renameScript

Rename the current script. Invoked at user menu request


 

renameScriptTo:

Rename the receiver's script so that it has given new selector


 

revertScriptVersion


 

setScriptNameTo:

The user has typed into the script-name pane. Accept the changed contents as the new script name, and take action accordingly


 

setTimeStamp


 

storeCodeOn:indent:


 

tearOfButtonToFireScript

Tear off a button to fire this script


 

tileRows

If using classic tiles, return a collection of arrays of Tiles in which each array is one line of tiles. (John Maloney's original design and code).


 

timeStamp


 

toggleWhetherShowingTiles

Toggle between showing the method pane and showing the tiles pane


 

unhibernate

Recreate my tiles from my method if I have new universal tiles.


 

userScriptObject

Answer the user-script object associated with the receiver


  private top  
 

addNewRow


 

insertTileRow:after:

Return a row to be used to insert an entire row of tiles.


 

removeEmptyRows


 

rowInsertionIndexFor:

Return the row into which the given morph should be inserted.


 

scriptEdited


  save & revert top  
 

revertToTileVersion

The receiver, currently showing textual code, is asked to revert to the last-saved tile version


 

saveScriptVersion


 

savedTileVersionsCount

Answer the number of saved tile versions that currently exist for this script


  testing top  
 

isTileEditor

Yes I am


  textually-coded scripts top  
 

showingMethodPane

Answer whether the receiver is currently showing the textual method pane


 

showingMethodPane:

Whether the receiver will show the textual method pane


  tiles from method top  
 

fromExistingMethod:forPlayer:

Create tiles for this method.


class methods
  instance creation top  
 

includeInNewMorphMenu

Not to be instantiated from the menu


 

writingUniversalTiles

Only valid during the write of a Project.


 

writingUniversalTiles: