'From Squeak3.1alpha of 28 February 2001 [latest update: #4318] on 4 September 2001 at 10:54:46 pm'! "Change Set: GuzdialFixes-mg Date: 4 September 2001 Author: Mark Guzdial & Ted Kaehler WaveEditor's controls had an error that caused the menu control to be left out. A user could not get the FFT or other items. This restores it. (from file WaveEditor-addControls.st) Define asColor for InfiniteForm. (from file InfiniteForm-asColor.st) In the fileList, yellow-button click on an .mdl file gave you a menu option to add the model as an actor in an existing Wonderland (if one is open in the current World), or, to open a Wonderland and stuff the actor into it. (from file mdl-loading-mg.cs=) A fix [by Ted]: Players created by vector arithmetic are not installed in the world. Use append: if you want the result to show in the world. A fix [by Ted]: Steps toward letting WonderlandActors be veryDeepCopied correctly."! !FileList methodsFor: 'file list menu' stamp: 'mjg 9/4/2001 12:42'! itemsForFileEnding: suffix | labels lines selectors | labels _ OrderedCollection new. lines _ OrderedCollection new. selectors _ OrderedCollection new. (suffix = 'bmp') | (suffix = 'gif') | (suffix = 'jpg') | (suffix = 'form') | (suffix = '*') | (suffix = 'png') ifTrue: [labels addAll: #('open image in a window' 'read image into ImageImports' 'open image as background'). selectors addAll: #(openImageInWindow importImage openAsBackground)]. (suffix = 'morph') | (suffix = 'morphs') | (suffix = 'sp') | (suffix = '*') ifTrue: [labels add: 'load as morph'. selectors add: #openMorphFromFile. labels add: 'load as project'. selectors add: #openProjectFromFile]. (suffix = 'mdl') ifTrue: [labels add: 'load into Wonderland'. selectors add: #openModelintoAlice]. (suffix = 'extseg') | (suffix = 'project') | (suffix = 'pr') ifTrue: [labels add: 'load as project'. selectors add: #openProjectFromFile]. (suffix = 'bo') | (suffix = '*') ifTrue:[ labels add: 'load as book'. selectors add: #openBookFromFile]. (suffix = 'mid') | (suffix = '*') ifTrue: [labels add: 'play midi file'. selectors add: #playMidiFile]. (suffix = 'movie') | (suffix = '*') ifTrue: [labels add: 'open as movie'. selectors add: #openAsMovie]. (suffix = 'st') | (suffix = 'cs') | (suffix = '*') ifTrue: [suffix = '*' ifTrue: [lines add: labels size]. labels addAll: #('fileIn' 'file into new change set' 'browse changes' 'browse code' 'remove line feeds' 'broadcast as update'). lines add: labels size - 1. selectors addAll: #(fileInSelection fileIntoNewChangeSet browseChanges browseFile removeLinefeeds putUpdate)]. (suffix = 'swf') | (suffix = '*') ifTrue:[ labels add:'open as Flash'. selectors add: #openAsFlash]. (suffix = 'ttf') | (suffix = '*') ifTrue:[ labels add: 'open true type font'. selectors add: #openAsTTF]. (suffix = 'gz') | (suffix = '*') ifTrue:[ labels addAll: #('view decompressed' 'decompress to file'). selectors addAll: #(viewGZipContents saveGZipContents)]. (suffix = '3ds') | (suffix = '*') ifTrue:[ labels add: 'Open 3DS file'. selectors add: #open3DSFile]. (suffix = 'tape') | (suffix = '*') ifTrue: [labels add: 'open for playback'. selectors add: #openTapeFromFile]. (suffix = 'wrl') | (suffix = '*') ifTrue: [labels add: 'open in Wonderland'. selectors add: #openVRMLFile]. (suffix = 'htm') | (suffix = 'html') ifTrue: [labels add: 'open in browser'. selectors add: #openInBrowser]. (suffix = 'zip') | (suffix = '*') ifTrue: [labels add: 'open archive viewer'. selectors add: #openArchiveViewer]. (suffix = '*') ifTrue: [labels addAll: #('generate HTML'). lines add: labels size - 1. selectors addAll: #(renderFile)]. (suffix = CRDictionary fileNameSuffix) ifTrue: [labels add: 'load Genie Gesture Dictionary'. selectors add: #loadCRDictionary]. (suffix = CRDisplayProperties fileNameSuffix) ifTrue: [labels add: 'load Genie Display Properties'. selectors add: #loadCRDisplayProperties]. ^ Array with: labels with: lines with: selectors! ! !FileList methodsFor: 'file list menu' stamp: 'mjg 9/4/2001 12:43'! openModelintoAlice "If a Wonderland exists, load this model into it as an actor. If it doesn't, make one first" | alice | Smalltalk isMorphic ifFalse: [^self error: 'Only works in Morphic - sorry!!']. alice _ World submorphs detect: [:m | m isKindOf: WonderlandEditor] ifNone: [nil]. alice isNil ifTrue: [alice _ Wonderland new] ifFalse: [alice _ alice getWonderland]. alice makeActorFrom: self fullName. ! ! !InfiniteForm methodsFor: 'accessing' stamp: 'mjg 7/9/2001 14:12'! asColor ^ patternForm dominantColor! ! !Player methodsFor: 'copying' stamp: 'tk 9/4/2001 21:47'! veryDeepInner: deepCopier "Special code that handles user-added instance variables of a uniClass. Copy all of my instance variables. Some need to be not copied at all, but shared. This is special code for the dictionary. See DeepCopier." | instVar weak subAss | super veryDeepInner: deepCopier. "my own instance variables are completely normal" costume _ costume veryDeepCopyWith: deepCopier. costumes _ costumes veryDeepCopyWith: deepCopier. Player instSize + 1 to: self class instSize do: [:index | instVar _ self instVarAt: index. weak _ instVar isMorph | instVar class isSystemDefined not. (subAss _ deepCopier references associationAt: instVar ifAbsent: [nil]) "use association, not value, so nil is an exceptional value" ifNil: [weak ifFalse: [ self instVarAt: index put: (instVar veryDeepCopyWith: deepCopier)]] ifNotNil: [self instVarAt: index put: subAss value]. ]. ! ]style[(25 205 10 672)f1b,f1,f1LDeepCopier Comment;,f1! ! !Player methodsFor: 'scripts-vector' stamp: 'tk 9/4/2001 22:48'! * aNumber "Treating Players like vectors, return a new Player that is myself scaled by the number" | new newCost | new _ costume usableSiblingInstance player. new setX: self getX * aNumber asPoint x. new setY: self getY * aNumber asPoint y. newCost _ new costume. newCost owner privateRemoveMorph: newCost. "Keep him out of the world" newCost privateOwner: nil. ^ new ! ! !Player methodsFor: 'scripts-vector' stamp: 'tk 9/4/2001 22:49'! + aPlayer "Treating Players like vectors, add aPlayer to me and return a new Player" | new newCost | new _ costume usableSiblingInstance player. new setX: self getX + aPlayer asPoint x. new setY: self getY + aPlayer asPoint y. newCost _ new costume. newCost owner privateRemoveMorph: newCost. "Keep him out of the world" newCost privateOwner: nil. ^ new! ! !Player methodsFor: 'scripts-vector' stamp: 'tk 9/4/2001 22:49'! - aPlayer "Treating Players like vectors, subtract aPlayer from me and return a new Player" | new newCost | new _ costume usableSiblingInstance player. new setX: self getX - aPlayer asPoint x. new setY: self getY - aPlayer asPoint y. newCost _ new costume. newCost owner privateRemoveMorph: newCost. "Keep him out of the world" newCost privateOwner: nil. ^ new! ! !Player methodsFor: 'scripts-vector' stamp: 'tk 9/4/2001 22:49'! / aNumber "Treating Players like vectors, return a new Player that is myself divided by the number" | new newCost | new _ costume usableSiblingInstance player. new setX: self getX / aNumber asPoint x. new setY: self getY / aNumber asPoint y. newCost _ new costume. newCost owner privateRemoveMorph: newCost. "Keep him out of the world" newCost privateOwner: nil. ^ new ! ! !WaveEditor methodsFor: 'initialization' stamp: 'mjg 7/4/2001 16:54'! addControls | slider bb r m | r _ AlignmentMorph newRow. bb _ SimpleButtonMorph new target: self; borderColor: Color black. r color: bb color; borderWidth: 0; layoutInset: 0. r hResizing: #shrinkWrap; vResizing: #shrinkWrap; extent: 5@5. r wrapCentering: #topLeft. bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'X'; actionSelector: #delete). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: '<>'; actWhen: #buttonDown; actionSelector: #invokeMenu). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Play'; actionSelector: #play). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Play Before'; actionSelector: #playBeforeCursor). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Play After'; actionSelector: #playAfterCursor). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Play Loop'; actionSelector: #playLoop). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Test'; actionSelector: #playTestNote). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Save'; actionSelector: #saveInstrument). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Set Loop End'; actionSelector: #setLoopEnd). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'One Cycle'; actionSelector: #setOneCycle). bb _ SimpleButtonMorph new target: self; borderColor: Color black. r addMorphBack: (bb label: 'Set Loop Start'; actionSelector: #setLoopStart). self addMorphBack: r. r _ AlignmentMorph newRow. r color: self color; borderWidth: 0; layoutInset: 0. r hResizing: #spaceFill; vResizing: #rigid; extent: 5@20; wrapCentering: #center; cellPositioning: #leftCenter. m _ StringMorph new contents: 'Index: '. r addMorphBack: m. m _ UpdatingStringMorph new target: graph; getSelector: #cursor; putSelector: #cursor:; growable: false; width: 71; step. r addMorphBack: m. m _ StringMorph new contents: 'Value: '. r addMorphBack: m. m _ UpdatingStringMorph new target: graph; getSelector: #valueAtCursor; putSelector: #valueAtCursor:; growable: false; width: 50; step. r addMorphBack: m. slider _ SimpleSliderMorph new color: color; extent: 200@2; target: self; actionSelector: #scrollTime:. r addMorphBack: slider. m _ Morph new color: r color; extent: 10@5. "spacer" r addMorphBack: m. m _ UpdatingStringMorph new target: graph; getSelector: #startIndex; putSelector: #startIndex:; width: 40; step. r addMorphBack: m. self addMorphBack: r. ! ! !WonderlandActor methodsFor: 'copying' stamp: 'tk 9/4/2001 21:46'! copyUniClassWith: deepCopier "my class is a subclass of WonderlandActor. Return another class just like my class." | newCls | newCls _ self class officialClass newUniqueClassInstVars: self class instanceVariablesString classInstVars: self class class instanceVariablesString. newCls copyMethodDictionaryFrom: self class. newCls class copyMethodDictionaryFrom: self class class. newCls copyAddedStateFrom: self class. "All class inst vars, if any" ^ newCls ! ! !WonderlandActor methodsFor: 'copying' stamp: 'tk 9/4/2001 22:22'! veryDeepFixupWith: deepCopier | old | "Any uniClass inst var may have been weakly copied. If they were in the tree being copied, fix them up, otherwise point to the originals." super veryDeepFixupWith: deepCopier. myWonderland _ deepCopier references at: myWonderland ifAbsent: [myWonderland]. "myWonderland getNamespace at: myName put: self." "register me" "That does not register it, and the name structure is messed up by green-handle copy" WonderlandActor instSize + 1 to: self class instSize do: [:ii | old _ self instVarAt: ii. self instVarAt: ii put: (deepCopier references at: old ifAbsent: [old])]. ! ! !WonderlandActor methodsFor: 'copying' stamp: 'tk 9/4/2001 21:50'! veryDeepInner: deepCopier "Special code that handles user-added instance variables of a uniClass. Copy all of my instance variables. Some need to be not copied at all, but shared. This is special code for the dictionary. See DeepCopier." | instVar weak subAss | super veryDeepInner: deepCopier. "my own instance variables are completely normal" myName _ myName veryDeepCopyWith: deepCopier. myWonderland _ myWonderland. "don't make a new one" myMesh _ myMesh veryDeepCopyWith: deepCopier. myTexture _ myTexture veryDeepCopyWith: deepCopier. myMaterial _ myMaterial veryDeepCopyWith: deepCopier. myColor _ myColor veryDeepCopyWith: deepCopier. scaleMatrix _ scaleMatrix veryDeepCopyWith: deepCopier. hidden _ hidden veryDeepCopyWith: deepCopier. firstClass _ firstClass veryDeepCopyWith: deepCopier. myReactions _ myReactions veryDeepCopyWith: deepCopier. myProperties _ myProperties veryDeepCopyWith: deepCopier. "may copy too deeply" WonderlandActor instSize + 1 to: self class instSize do: [:index | instVar _ self instVarAt: index. weak _ instVar isMorph | instVar class isSystemDefined not. (subAss _ deepCopier references associationAt: instVar ifAbsent: [nil]) "use association, not value, so nil is an exceptional value" ifNil: [weak ifFalse: [ self instVarAt: index put: (instVar veryDeepCopyWith: deepCopier)]] ifNotNil: [self instVarAt: index put: subAss value]. ]. ! ]style[(25 205 10 1183)f1b,f1,f1LDeepCopier Comment;,f1! !