Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.139.mcz ==================== Summary ==================== Name: EToys-tfel.139 Author: tfel Time: 27 July 2016, 5:58:58.495152 pm UUID: 0a7e78da-2cb3-874b-8a82-0e22900f06c7 Ancestors: EToys-topa.138 push variableDocks from CardPlayer up to Player, to make older EToys examples work =============== Diff against EToys-topa.138 =============== Item was changed: Player subclass: #CardPlayer instanceVariableNames: 'privateMorphs' classVariableNames: '' poolDictionaries: '' category: 'Etoys-Stacks'! - CardPlayer class - instanceVariableNames: 'variableDocks'! !CardPlayer commentStamp: '<historical>' prior: 0! CardPlayer Instance variables of the Uniclass represent the data in the "fields" of each card in the stack. Each Instance variable is some kind of value holder. The code for the *buttons* on the background resides in the CardPlayer uniclass. privateMorphs -- OrderedCollection of objects specific to this card. Individual CardPlayer classes need to store the search results of any instances that are templates. As a hack, we use a class variable TemplateMatches in each individual class (CardPlayer21). It is initialized in #matchIndex:. TemplateMatches an IndentityDictionary of (aCardPlayer -> (list of matching cards, index in that list)) ! - CardPlayer class - instanceVariableNames: 'variableDocks'! Item was removed: - ----- Method: CardPlayer class>>newVariableDocks: (in category 'variable docks') ----- - newVariableDocks: dockList - "Set the receiver's variableDocks to be the list provided in dockList. Assimilate this new information into the receiver's slotInfo, which contains both automatically-generated variables such as the variable docks and also explicitly-user-specified variables" - - self variableDocks: dockList. - self setSlotInfoFromVariableDocks! Item was removed: - ----- Method: CardPlayer class>>resortInstanceVariables: (in category 'user-defined inst vars') ----- - resortInstanceVariables: newList - "Accept a new ordering for instance variables" - - variableDocks := newList collect: [:aName | variableDocks detect: [:d | d variableName = aName]]. - self setNewInstVarNames: newList asOrderedCollection. - self newVariableDocks: variableDocks. - ! Item was removed: - ----- Method: CardPlayer class>>setNewInstVarNames: (in category 'user-defined inst vars') ----- - setNewInstVarNames: listOfStrings - "Make listOfStrings be the new list of instance variable names for the receiver" - - | disappearing firstAppearing instVarString instVarList | - instVarList := self instVarNames asOrderedCollection. - disappearing := instVarList copy. - disappearing removeAllFoundIn: listOfStrings. - disappearing do: - [:oldName | self removeAccessorsFor: oldName]. - firstAppearing := listOfStrings copy. - firstAppearing removeAllFoundIn: instVarList. - instVarString := String streamContents: - [:aStream | listOfStrings do: [:aString | aStream nextPutAll: aString; nextPut: $ ]]. - - superclass subclass: self name instanceVariableNames: instVarString - classVariableNames: '' poolDictionaries: '' category: self categoryForUniclasses. - firstAppearing do: - [:newName | self compileAccessorsFor: newName]. - ! Item was removed: - ----- Method: CardPlayer class>>setSlotInfoFromVariableDocks (in category 'variable docks') ----- - setSlotInfoFromVariableDocks - "Get the slotInfo fixed up after a change in background shape. Those instance variables that are proactively added by the user will persist, whereas those that are automatically generated will be updated" - - self slotInfo copy do: "Remove old automatically-created slots" - [:aSlotInfo | | aDock | - (aDock := aSlotInfo variableDock) ifNotNil: - [slotInfo removeKey: aDock variableName]]. - - self variableDocks do: [:dock | | newInfo | "Generate fresh slots from variable docks" - newInfo := SlotInformation new type: dock variableType. - newInfo variableDock: dock. - slotInfo at: dock variableName asSymbol put: newInfo]! Item was removed: - ----- Method: CardPlayer class>>variableDocks (in category 'variable docks') ----- - variableDocks - "Answer the list of variable docks in the receiver. Initialize the variable-dock list if not already done." - - variableDocks ifNil: [variableDocks := OrderedCollection new]. - ^ variableDocks! Item was removed: - ----- Method: CardPlayer class>>variableDocks: (in category 'variable docks') ----- - variableDocks: dockList - "Set the variable-dock list as indicated" - - variableDocks := dockList! Item was changed: Model subclass: #Player instanceVariableNames: 'costume costumes' classVariableNames: 'BiggestSubclassNumber TimeOfError' poolDictionaries: 'References' category: 'Etoys-Scripting'! Player class + instanceVariableNames: 'scripts slotInfo variableDocks'! - instanceVariableNames: 'scripts slotInfo'! !Player commentStamp: '<historical>' prior: 0! The fundamental user-scriptable entity. Always represented by a user-specific subclass of Player; instance vars and methods relate to user-defined structures. costume is a Morph, the primary morph I am currently wearing for graphical display. Scripts are defined in subclasses of Player. These are UniClasses. Messages in scripts are sent to Players. A Player may delegate to its costume, or to an object the costume suggests. Or, a Player may designate some other object to receive the script messages it does not understand. (see doesNotUnderstand:) ! Player class + instanceVariableNames: 'scripts slotInfo variableDocks'! - instanceVariableNames: 'scripts slotInfo'! Item was added: + ----- Method: Player class>>newVariableDocks: (in category 'variable docks') ----- + newVariableDocks: dockList + "Set the receiver's variableDocks to be the list provided in dockList. Assimilate this new information into the receiver's slotInfo, which contains both automatically-generated variables such as the variable docks and also explicitly-user-specified variables" + + self variableDocks: dockList. + self setSlotInfoFromVariableDocks! Item was added: + ----- Method: Player class>>resortInstanceVariables: (in category 'user-defined inst vars') ----- + resortInstanceVariables: newList + "Accept a new ordering for instance variables" + + variableDocks := newList collect: [:aName | variableDocks detect: [:d | d variableName = aName]]. + self setNewInstVarNames: newList asOrderedCollection. + self newVariableDocks: variableDocks. + ! Item was added: + ----- Method: Player class>>setNewInstVarNames: (in category 'user-defined inst vars') ----- + setNewInstVarNames: listOfStrings + "Make listOfStrings be the new list of instance variable names for the receiver" + + | disappearing firstAppearing instVarString instVarList | + instVarList := self instVarNames asOrderedCollection. + disappearing := instVarList copy. + disappearing removeAllFoundIn: listOfStrings. + disappearing do: + [:oldName | self removeAccessorsFor: oldName]. + firstAppearing := listOfStrings copy. + firstAppearing removeAllFoundIn: instVarList. + instVarString := String streamContents: + [:aStream | listOfStrings do: [:aString | aStream nextPutAll: aString; nextPut: $ ]]. + + superclass subclass: self name instanceVariableNames: instVarString + classVariableNames: '' poolDictionaries: '' category: self categoryForUniclasses. + firstAppearing do: + [:newName | self compileAccessorsFor: newName]. + ! Item was added: + ----- Method: Player class>>setSlotInfoFromVariableDocks (in category 'variable docks') ----- + setSlotInfoFromVariableDocks + "Get the slotInfo fixed up after a change in background shape. Those instance variables that are proactively added by the user will persist, whereas those that are automatically generated will be updated" + + self slotInfo copy do: "Remove old automatically-created slots" + [:aSlotInfo | | aDock | + (aDock := aSlotInfo variableDock) ifNotNil: + [slotInfo removeKey: aDock variableName]]. + + self variableDocks do: [:dock | | newInfo | "Generate fresh slots from variable docks" + newInfo := SlotInformation new type: dock variableType. + newInfo variableDock: dock. + slotInfo at: dock variableName asSymbol put: newInfo]! Item was added: + ----- Method: Player class>>variableDocks (in category 'variable docks') ----- + variableDocks + "Answer the list of variable docks in the receiver. Initialize the variable-dock list if not already done." + + variableDocks ifNil: [variableDocks := OrderedCollection new]. + ^ variableDocks! Item was added: + ----- Method: Player class>>variableDocks: (in category 'variable docks') ----- + variableDocks: dockList + "Set the variable-dock list as indicated" + + variableDocks := dockList! Item was changed: Player subclass: #UnscriptedPlayer + instanceVariableNames: 'patch' - instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Etoys-Scripting'! UnscriptedPlayer class instanceVariableNames: 'ephemeralPlayerRef'! !UnscriptedPlayer commentStamp: '<historical>' prior: 0! My instances are Player objects that have not been scripted, and which hence do not require a unique scripts dictionary, etc. As soon as the needed, I am transformed automatically into a unique subclass of Player.! UnscriptedPlayer class instanceVariableNames: 'ephemeralPlayerRef'! Item was added: + ----- Method: UnscriptedPlayer>>getPatch (in category 'access') ----- + getPatch + ^ patch! Item was added: + ----- Method: UnscriptedPlayer>>setPatch: (in category 'access') ----- + setPatch: t1 + patch := t1! |
Free forum by Nabble | Edit this page |