'From etoys2.2 of 1 October 2007 [latest update: #1768] on 8 November 2007 at 5:37:41 pm'! "Change Set: SISSProxy-yo Date: 8 November 2007 Author: Yoshiki Ohshima Enable a way to store some objects that are not reachable from the root object."! SISSDictionaryForScanning subclass: #SISSDictionaryForGuideBook instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'SISS-Core'! Object subclass: #SISSProxy instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'SISS-Core'! !Object methodsFor: '*sixx-private' stamp: 'yo 11/8/2007 17:24'! fromSexp: sexp from: from to: to | className classObj idref obj cls officialClass | idref := self idrefFromSexp: sexp. (obj _ self findIdref: idref context: to) ifNotNil: [^ obj]. sexp attributeAt: #uniclass ifPresent: [:uniId | officialClass _ self classFromClassName: sexp keyword. cls _ self uniclassUnder: officialClass fromSexp: (from at: uniId asSymbol) from: from to: to. (obj _ self findIdref: idref context: to) ifNotNil: [^ obj]. ^ cls sissCreateInstanceFromSexp: sexp idref: idref from: from to: to. ]. sexp keyword == #slot ifTrue: [ className _ sexp attributeAt: #class ifAbsent: [ ^ self fromSexp: (from at: idref) from: from to: to. ]. ] ifFalse: [ className _ sexp keyword. ]. classObj _ self classFromClassName: className. to addClass: classObj. ^ classObj sissCreateInstanceFromSexp: sexp idref: idref from: from to: to ! ! !Object methodsFor: '*sixx-private' stamp: 'yo 11/8/2007 15:26'! sissScanObjectsWithDict: dict ^ dict sissScanObjectsFrom: self. ! ! !Object methodsFor: '*siss-interface' stamp: 'yo 11/8/2007 15:27'! sissScanObjects | dict | dict _ SISSDictionaryForScanning new initialize. ^ dict sissScanObjectsFrom: self. ! ! !Morph methodsFor: '*siss-interface' stamp: 'yo 11/8/2007 15:26'! sissScanObjectsForMorphCopy | dict | dict _ SISSDictionaryForMorphCopying new initialize. dict initializeSubmorphs: self. ^ dict sissScanObjectsFrom: self. ! ! !Morph methodsFor: '*siss-interface' stamp: 'yo 11/8/2007 15:29'! sissScanObjectsWithoutOwner | dict | dict _ SISSDictionaryForScanning new initialize. self owner ifNotNil: [ dict boundaryObjects add: self owner. ]. ^ dict sissScanObjectsFrom: self. ! ! !BookMorph methodsFor: 'fileIn/out' stamp: 'yo 11/8/2007 16:08'! pagesAndColorInSISSFormat | dict | dict _ SISSDictionaryForGuideBook new initialize. self owner ifNotNil: [ dict boundaryObjects add: self. ]. ^ dict sissScanObjectsFrom: self.! ! !PasteUpMorph methodsFor: '*siss-interface' stamp: 'yo 11/8/2007 15:27'! sissScanObjectsAsEtoysProject | dict ret | dict _ SISSDictionaryForScanning new initialize. self cleanUpReferences. dict boundaryObjects add: Utilities scrapsBook. Utilities scrapsBook pages do: [:p | dict boundaryObjects add: p]. worldState ifNotNil: [self hands do: [:h | dict boundaryObjects add: h]]. submorphs do: [:s | (s isKindOf: Viewer) ifTrue: [dict boundaryObjects add: s]]. submorphs do: [:s | (s isKindOf: SystemWindow) ifTrue: [dict boundaryObjects add: s]]. ret _ dict sissScanObjectsFrom: self. ^ ret. ! ! !Player methodsFor: '*siss-interface' stamp: 'yo 11/8/2007 16:31'! sissProxySelector ^ self costume isWorldMorph ifTrue: [^ #worldPlayer] ifFalse: [^ #yourself]. ! ! !SExpElement methodsFor: 'serialization specific' stamp: 'yo 11/8/2007 17:15'! sissReadObjectsAsEtoysProject: aBoolean | to from root ret w | to _ SISSDictionaryForReading new initialize. from _ IdentityDictionary new. (elements isNil or: [elements isEmpty]) ifTrue: [ ^ self fromSexp: self from: from to: to. ]. root _ self attributeAt: #root. elements do: [:e | e attributeAt: #idref ifPresent: [:id | from at: id asSymbol put: e ]. ]. aBoolean ifTrue: [ProjectLoading worldLoading: nil]. w _ elements detect: [:e | (e attributeAt: #idref ifAbsent: []) = root]. ret _ self fromSexp: w from: from to: to. from do: [:v | (v keyword = #SISSProxy) ifTrue: [to at: v idref asSymbol put: (SISSProxy perform: (v attributeAt: #selector) asSymbol)]]. aBoolean ifTrue: [ProjectLoading worldLoading: ret]. to do: [:e | e sissComeFullyUpOnReloadFrom: from to: to]. aBoolean ifTrue: [ProjectLoading worldLoading: nil]. ^ ret. ! ! !SISSDictionaryForScanning methodsFor: 'all' stamp: 'yo 11/8/2007 16:13'! forceAdd: anObject | newName newElem | (boundaryObjects includes: anObject) ifTrue: [^ nil]. self at: anObject ifPresent: [:n | ^ n]. newName _ (tally + 1) printString. newElem _ SExpElement keyword: #SISSProxy attributes: (SExpAttributes with: #idref->newName with: #selector->anObject sissProxySelector asString). self at: anObject put: newElem. ^ newElem. ! ! !SISSDictionaryForScanning methodsFor: 'all' stamp: 'yo 11/8/2007 15:27'! sissScanObjectsFrom: object | ret n child | ret _ object sissElementInContext: self. ret ifNil: [^ self sissScanObjectsFrom: nil]. ret isString ifTrue: [ "if object is just a literal, make up an element and return it." n _ SExpElement keyword: object class name. n attributeAt: #value put: ret. ^ n ]. "Final fix up for scriptors." self keys do: [:e | (e isMemberOf: ScriptEditorMorph) ifTrue: [ child _ e sexpScriptWith: self. (self at: e) addElements: (Array with: child). ] ]. ^ self contents ! ! !SISSDictionaryForGuideBook methodsFor: 'as yet unclassified' stamp: 'yo 11/8/2007 17:15'! sissScanObjectsFrom: book | ret n child object | object _ (book pages copyWith: book color). ret _ object sissElementInContext: self. ret ifNil: [^ self sissScanObjectsFrom: nil]. ret isString ifTrue: [ "if object is just a literal, make up an element and return it." n _ SExpElement keyword: object class name. n attributeAt: #value put: ret. ^ n ]. book world player ifNotNil: [self forceAdd: book world player]. "Final fix up for scriptors." self keys do: [:e | (e isMemberOf: ScriptEditorMorph) ifTrue: [ child _ e sexpScriptWith: self. (self at: e) addElements: (Array with: child). ] ]. ^ self contents ! ! !SISSProxy class methodsFor: 'as yet unclassified' stamp: 'yo 11/8/2007 16:31'! worldPlayer ^ ActiveWorld assuredPlayer. ! ! SISSProxy class removeSelector: #sissCreateInstanceFromSexp:idref:from:to:! SISSProxy class removeSelector: #world! SISSDictionaryForScanning removeSelector: #forceAt:! SISSDictionaryForScanning removeSelector: #forceAt:put:!