[etoys-dev] Etoys: Morphic-bf.34.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Aug 14 12:40:06 EDT 2010


Bert Freudenberg uploaded a new version of Morphic to project Etoys:
http://source.squeak.org/etoys/Morphic-bf.34.mcz

==================== Summary ====================

Name: Morphic-bf.34
Author: bf
Time: 14 August 2010, 6:37:21 pm
UUID: e0e7e2ac-7524-485c-a4b5-7450b27c8a6b
Ancestors: Morphic-bf.33, Morphic-Richo.32

- merge Morphic-Richo.30 (saving morph on file)

=============== Diff against Morphic-bf.33 ===============

Item was added:
+ ----- Method: Morph class>>fromStreamedRepresentation: (in category 'fileIn/Out') -----
+ fromStreamedRepresentation: aString
+ 	^SmartRefStream objectFromStreamedRepresentation: aString!

Item was changed:
  ----- Method: Morph>>saveOnFile (in category 'fileIn/out') -----
  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 ok |
- 	| 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'].
+ 	self saveOnFile: aFileName.!
- 	fileStream _ FileStream newFileNamed: aFileName asFileName.
- 	fileStream fileOutClass: nil andObject: self.	"Puts UniClass definitions out anyway"!

Item was added:
+ ----- Method: Morph>>saveOnFile: (in category 'fileIn/out') -----
+ saveOnFile: fileName 
+ 	| file |
+ 	file := [[FileStream newFileNamed: fileName]
+ 				on: FileExistsException
+ 				do: [:err | err defaultAction]]
+ 				on: Error
+ 				do: [:err | ^ self].
+ 	[file
+ 		nextPutAll: (SmartRefStream streamedRepresentationOf: self topRendererOrSelf)]
+ 		ensure: [file close]!

Item was changed:
  ----- Method: Morph class>>fromFileName: (in category 'fileIn/Out') -----
  fromFileName: fullName
+ 	| file |
+ 	[file := FileStream readOnlyFileNamed: fullName.
+ 	[(Morph fromStreamedRepresentation: file contents) openInWorld] ensure: [file close].
+ 	] on: Error do: [self inform: 'The file doesn''t exists']!
- 	"Reconstitute a Morph from the file, presumed to be represent a Morph saved
- 	via the SmartRefStream mechanism, and open it in an appropriate Morphic world"
- 
-  	| aFileStream morphOrList |
- 	aFileStream _ (MultiByteBinaryOrTextStream with: ((FileStream readOnlyFileNamed: fullName) binary contentsOfEntireFile)) binary reset.
- 	morphOrList _ aFileStream fileInObjectAndCode.
- 	(morphOrList isKindOf: SqueakPage) ifTrue: [morphOrList _ morphOrList contentsMorph].
- 	Smalltalk isMorphic
- 		ifTrue: [ActiveWorld addMorphsAndModel: morphOrList]
- 		ifFalse:
- 			[morphOrList isMorph ifFalse: [self inform: 'Can only load a single morph
- into an mvc project via this mechanism.' translated].
- 			morphOrList openInWorld].
- 	^ morphOrList.
- !



More information about the etoys-dev mailing list