'From etoys3.0 of 21 February 2008 [latest update: #1962] on 9 April 2008 at 10:20:26 pm'! "Change Set: savePasteUp-sw Date: 9 April 2008 Author: Scott Wallace TRAC 6868: Make the save-morph-on-file command found in the debug halo menu of a pasteup morph always save a .morph file, just as for any other paste-up-morph. Also, if the object has a known name, use that as the basis for the point-of-departure file name; thus, a Holder will have 'Holder' in its default file name, not 'My PasteUpMorph', etc."! !Morph methodsFor: 'debug and other' stamp: 'sw 4/9/2008 21:53'! buildDebugMenu: aHand "Answer a debugging menu for the receiver. The hand argument is seemingly historical and plays no role presently" | aMenu aPlayer aModel | aMenu _ MenuMorph new defaultTarget: self. aMenu addStayUpItem. (self hasProperty: #errorOnDraw) ifTrue: [aMenu add: 'start drawing again' translated action: #resumeAfterDrawError. aMenu addLine]. (self hasProperty: #errorOnStep) ifTrue: [aMenu add: 'start stepping again' translated action: #resumeAfterStepError. aMenu addLine]. aMenu add: 'inspect morph' translated action: #inspectInMorphic:. aMenu add: 'explore morph' translated target: self selector: #explore. aMenu add: 'inspect properties' action: #inspectMorphsProperties. aMenu add: 'inspect owner chain' translated action: #inspectOwnerChain. Smalltalk isMorphic ifFalse: [aMenu add: 'inspect morph (in MVC)' translated action: #inspect]. (aModel _ self modelOrNil) ifNotNil: [aMenu addLine. aMenu add: 'inspect model' translated target: aModel action: #inspect. aMenu add: 'explore model' target: aModel action: #explore. aMenu add: 'model protocol' target: aModel action: #haveFullProtocolBrowsed]. (aPlayer _ self player) ifNotNil: [aMenu add: 'inspect player' translated target: aPlayer action: #inspect]. aMenu addLine. aPlayer ifNotNil: [aMenu add: 'viewer for Player' translated target: self player action: #beViewed. aMenu balloonTextForLastItem: 'Opens a viewer on my Player -- this is the same thing you get if you click on the cyan "View" halo handle' translated]. aMenu add: 'viewer for Morph' translated target: self action: #viewMorphDirectly. aMenu balloonTextForLastItem: 'Opens a Viewer on this Morph, rather than on its Player' translated. aMenu add: 'morph protocol' translated target: self selector: #haveFullProtocolBrowsed. aMenu addLine. self addViewingItemsTo: aMenu. aMenu add: 'make own subclass' translated action: #subclassMorph; add: 'internal name ' translated action: #choosePartName. self isWorldMorph ifFalse: [aMenu add: 'save morph in file' translated action: #saveOnFile]. aMenu addLine; add: 'control-menu...' translated target: self selector: #invokeMetaMenu:. ^ aMenu! ! !Morph methodsFor: 'fileIn/out' stamp: 'sw 4/9/2008 22:00'! saveOnFile "Ask the user for a filename and save myself on a SmartReferenceStream file. Writes out the version and class structure. The file is fileIn-able. UniClasses will be filed out." | aFileName fileStream ok | aFileName := self knownName ifNil: [('my {1}' translated format: {self class name})]. aFileName := aFileName asFileName. aFileName _ FillInTheBlank request: 'File name? (".morph" will be added to end)' translated initialAnswer: aFileName. aFileName isEmpty ifTrue: [^ Beeper beep]. self allMorphsDo: [:m | m prepareToBeSaved]. ok _ aFileName endsWith: '.morph'. "don't double them" ok _ ok | (aFileName endsWith: '.sp'). ok ifFalse: [aFileName _ aFileName,'.morph']. fileStream _ FileStream newFileNamed: aFileName asFileName. fileStream fileOutClass: nil andObject: self. "Puts UniClass definitions out anyway"! ! !PasteUpMorph methodsFor: 'objects from disk' stamp: 'sw 4/9/2008 21:57'! saveOnFile "Ask the user for a filename and save myself on a SmartReferenceStream file. Writes out the version and class structure. The file is fileIn-able. UniClasses will be filed out." self isWorldMorph ifTrue: [self project saveAs] ifFalse: [super saveOnFile]! !