Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.261.mcz ==================== Summary ==================== Name: EToys-tfel.261 Author: tfel Time: 29 September 2016, 2:00:18.299594 pm UUID: b41c90b3-754a-452e-add4-3637e2be7a97 Ancestors: EToys-tfel.260 make ScriptableButtons hold on to their own action scripts, rather than their enclosing paste up morph. Otherwise the button action changes when I drop it in a different world! =============== Diff against EToys-tfel.260 =============== Item was removed: - ----- Method: ButtonProperties>>editButtonsScript: (in category 'events') ----- - editButtonsScript: evt - "The user has touched my Scriptor halo-handle. Bring up a Scriptor on the script of the button." - - | cardsPasteUp cardsPlayer anEditor scriptSelector | - - cardsPasteUp := self pasteUpMorph. - (cardsPlayer := cardsPasteUp assuredPlayer) assureUniClass. - scriptSelector := self figureOutScriptSelector. - scriptSelector ifNil: [ - scriptSelector := cardsPasteUp scriptSelectorToTriggerFor: self. - anEditor := cardsPlayer newTextualScriptorFor: scriptSelector. - evt hand attachMorph: anEditor. - ^self - ]. - - (cardsPlayer class includesSelector: scriptSelector) ifTrue: [ - anEditor := cardsPlayer scriptEditorFor: scriptSelector. - evt hand attachMorph: anEditor. - ^self - ]. - "Method somehow got removed; I guess we start aftresh" - scriptSelector := nil. - ^ self editButtonsScript! Item was removed: - ----- Method: PasteUpMorph>>scriptSelectorToTriggerFor: (in category '*Etoys-viewing') ----- - scriptSelectorToTriggerFor: aButtonMorph - "Answer a new selector which will bear the code for aButtonMorph in the receiver" - - | buttonName selectorName | - buttonName := aButtonMorph externalName. - selectorName := self assuredPlayer acceptableScriptNameFrom: buttonName forScriptCurrentlyNamed: nil. - - buttonName ~= selectorName ifTrue: - [aButtonMorph setNameTo: selectorName]. - ^ selectorName! Item was changed: ----- Method: ScriptableButton>>doButtonAction (in category 'button') ----- doButtonAction "The user has pressed the button. Dispatch to the actual user script, if any." scriptSelector ifNil: [^ super doButtonAction]. + self player performScriptIfCan: scriptSelector! - self pasteUpMorph player performScriptIfCan: scriptSelector! Item was changed: ----- Method: ScriptableButton>>editButtonsScript (in category 'script') ----- editButtonsScript "The user has touched my Scriptor halo-handle. Bring up a Scriptor on the script of the button." + | anEditor player | + (player := self assuredPlayer) assureUniClass. - | cardsPasteUp cardsPlayer anEditor | - cardsPasteUp := self pasteUpMorph. - (cardsPlayer := cardsPasteUp assuredPlayer) assureUniClass. anEditor := scriptSelector ifNil: + [scriptSelector := self scriptSelectorToTriggerForMe. + player newTextualScriptorFor: scriptSelector. + player scriptEditorFor: scriptSelector] - [scriptSelector := cardsPasteUp scriptSelectorToTriggerFor: self. - cardsPlayer newTextualScriptorFor: scriptSelector. - cardsPlayer scriptEditorFor: scriptSelector - ] ifNotNil: + [(player class selectors includes: scriptSelector) + ifTrue: [player scriptEditorFor: scriptSelector] - [(cardsPlayer class selectors includes: scriptSelector) - ifTrue: [cardsPlayer scriptEditorFor: scriptSelector] ifFalse: ["Method somehow got removed; I guess we start afresh" - scriptSelector := nil. + ^ self editButtonsScript]]. - ^self editButtonsScript]]. anEditor showingMethodPane ifTrue: [anEditor toggleWhetherShowingTiles]. self currentHand attachMorph: anEditor! Item was added: + ----- Method: ScriptableButton>>scriptSelectorToTriggerForMe (in category 'accessing') ----- + scriptSelectorToTriggerForMe + "Answer a new selector which will bear the code for myself" + + | buttonName selectorName | + buttonName := self externalName. + selectorName := self assuredPlayer acceptableScriptNameFrom: buttonName forScriptCurrentlyNamed: nil. + + buttonName ~= selectorName ifTrue: + [self setNameTo: selectorName]. + ^ selectorName! |
Free forum by Nabble | Edit this page |