'From Squeakland 3.2.4913 of 10 July 2002 [latest update: #136] on 2 October 2002 at 11:06:37 pm'! "Change Set: playfieldBackground-bf Date: 1 October 2002 Author: Bert Freudenberg Published as 4988playfieldBackground-bf.cs to 3.3a. - When the backgroundMorph of a Playfield was dragged outside, odd things happened because the background inst var was not nilled out. Fixed. - Playfields now expose the graphic slot (located in cleaned up 'playfield' category). "! !PasteUpMorph methodsFor: 'painting' stamp: 'bf 10/2/2002 18:36'! backgroundForm ^ self backgroundSketch ifNil: [Form extent: self extent depth: Display depth] ifNotNil: [backgroundMorph form]! ! !PasteUpMorph methodsFor: 'painting' stamp: 'bf 10/2/2002 18:41'! backgroundForm: aForm self backgroundSketch: (SketchMorph new center: self center; form: aForm)! ! !PasteUpMorph methodsFor: 'painting' stamp: 'bf 10/2/2002 17:07'! backgroundSketch backgroundMorph ifNil: [^ nil]. backgroundMorph owner == self ifFalse: [backgroundMorph _ nil]. "has been deleted" ^ backgroundMorph! ! !PasteUpMorph class methodsFor: 'scripting' stamp: 'bf 10/2/2002 17:06'! additionsToViewerCategories "Answer a list of ( ) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories." ^ # ( (playfield ( (command initiatePainting 'Initiate painting of a new object in the standard playfield.') (slot mouseX 'The x coordinate of the mouse pointer' Number readWrite Player getMouseX unused unused) (slot mouseY 'The y coordinate of the mouse pointer' Number readWrite Player getMouseY unused unused) (command roundUpStrays 'Bring all out-of-container subparts back into view.') (slot graphic 'The graphic shown in the background of this object' Graphic readWrite Player getGraphic Player setGraphic:) (command unhideHiddenObjects 'Unhide all hidden objects.'))) (collections ( (slot cursor 'The index of the chosen element' Number readWrite Player getCursor Player setCursorWrapped:) (slot playerAtCursor 'the object currently at the cursor' Player readWrite Player getValueAtCursor unused unused) (slot firstElement 'The first object in my contents' Player readWrite Player getFirstElement Player setFirstElement:) (slot numberAtCursor 'the number at the cursor' Number readWrite Player getNumberAtCursor Player setNumberAtCursor: ) (slot graphicAtCursor 'the graphic worn by the object at the cursor' Graphic readOnly Player getGraphicAtCursor unused unused) (command removeAll 'Remove all elements from the playfield') (command shuffleContents 'Shuffle the contents of the playfield') (command append: 'Add the object to the end of my contents list.' Player) (command prepend: 'Add the object at the beginning of my contents list.' Player) (command include: 'Add the object to my contents' Player) )) (#'stack navigation' ( (command goToNextCardInStack 'Go to the next card') (command goToPreviousCardInStack 'Go to the previous card') (command goToFirstCardInBackground 'Go to the first card of the current background') (command goToFirstCardOfStack 'Go to the first card of the entire stack') (command goToLastCardInBackground 'Go to the last card of the current background') (command goToLastCardOfStack 'Go to the last card of the entire stack') (command deleteCard 'Delete the current card') (command insertCard 'Create a new card'))) (viewing ( (slot viewingNormally 'whether contents are viewed normally' Boolean readWrite Player getViewingByIcon Player setViewingByIcon: ))) (#'pen trails' ( (command liftAllPens 'Lift the pens on all the objects in my interior.') (command lowerAllPens 'Lower the pens on all the objects in my interior.') (command arrowheadsOnAllPens 'Put arrowheads on the ends of strokes of pens on all objects.') (command noArrowheadsOnAllPens 'Stop putting arrowheads on the ends of strokes of pens on all objects.') (command clearTurtleTrails 'Clear all the pen trails in the interior.')))) ! ! !Player methodsFor: 'slot getters/setters' stamp: 'bf 10/2/2002 18:37'! getGraphic "Answer a form representing the receiver's primary graphic" | aMorph | ^ ((aMorph _ costume renderedMorph) isKindOf: SketchMorph) ifTrue: [aMorph form] ifFalse: [aMorph isPlayfieldLike ifTrue: [aMorph backgroundForm] ifFalse: [aMorph imageForm]]! ! !Player methodsFor: 'slot getters/setters' stamp: 'bf 10/2/2002 18:38'! getGraphicAtCursor "Answer the form representing the object at the current cursor" | anObject aMorph | anObject _ self getValueFromCostume: #valueAtCursor. ^ anObject == 0 "weird return from GraphMorph" ifTrue: [ScriptingSystem formAtKey: #Paint] ifFalse: [((aMorph _ anObject renderedMorph) isKindOf: SketchMorph) ifTrue: [aMorph form] ifFalse: [aMorph isPlayfieldLike ifTrue: [aMorph backgroundForm] ifFalse: [aMorph imageForm]]]! ! !Player methodsFor: 'slot getters/setters' stamp: 'bf 10/2/2002 18:42'! setGraphic: aForm "Set the receiver's graphic as indicated" | aMorph | ^ ((aMorph _ costume renderedMorph) isKindOf: SketchMorph) ifTrue: [aMorph form: aForm] ifFalse: [aMorph isPlayfieldLike ifTrue: [aMorph backgroundForm: aForm] ifFalse: ["what to do?"]]! !