[Pkg] The Trunk: Morphic-ul.547.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jun 18 08:53:04 UTC 2011


Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.547.mcz

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

Name: Morphic-ul.547
Author: ul
Time: 17 June 2011, 4:38:20.312 pm
UUID: 7671f882-1a67-8e49-a3ef-f639d48b2eb0
Ancestors: Morphic-ul.546

- Use #repeat instead of [ true ] whileTrue and friends.
- Use #displayProgressFrom:to:during: instead of #displayProgressAt:from:to:during:.

=============== Diff against Morphic-ul.546 ===============

Item was changed:
  ----- Method: PasteUpMorph>>startBackgroundProcess (in category 'update cycle') -----
  startBackgroundProcess
  	"Start a process to update this world in the background. Return the process created."
  
  	| p |
+ 	p := [ [
- 	p := [[true] whileTrue: [
  		self doOneCycleInBackground.
+ 		(Delay forMilliseconds: 20) wait] repeat ] newProcess.
- 		(Delay forMilliseconds: 20) wait]] newProcess.
  	p resume.
  	^ p
  !

Item was changed:
  ----- Method: PolygonMorph class>>fromHand: (in category 'instance creation') -----
  fromHand: hand
  	"Let the user draw a polygon, clicking at each vertex, and ending
  		by clicking within 5 of the first point..."
  	| p1 poly oldVerts pN opposite |
  	Cursor crossHair showWhile:
  		[[Sensor anyButtonPressed] whileFalse:
  			[self currentWorld displayWorldSafely; runStepMethods].
  		p1 := Sensor cursorPoint].
  	opposite := (Display colorAt: p1) negated.
  	opposite = Color transparent ifTrue: [opposite := Color red].
  	(poly := LineMorph from: p1 to: p1 color: opposite width: 2) openInWorld.
  	oldVerts := {p1}.
  	self currentWorld displayWorldSafely; runStepMethods.
+ 	
+ 	[[Sensor anyButtonPressed] whileTrue:
+ 		[pN := Sensor cursorPoint.
+ 		poly setVertices: (oldVerts copyWith: pN).
+ 		self currentWorld displayWorldSafely; runStepMethods].
+ 	(oldVerts size > 1 and: [(pN dist: p1) < 5]) ifTrue:
+ 		[hand position: Sensor cursorPoint.  "Done -- update hand pos"
+ 		^ (poly setVertices: (poly vertices copyWith: p1)) delete].
+ 	oldVerts := poly vertices.
+ 	[Sensor anyButtonPressed] whileFalse:
+ 		[pN := Sensor cursorPoint.
+ 		poly setVertices: (oldVerts copyWith: pN).
+ 		self currentWorld displayWorldSafely; runStepMethods]] repeat!
- 	[true] whileTrue:
- 		[[Sensor anyButtonPressed] whileTrue:
- 			[pN := Sensor cursorPoint.
- 			poly setVertices: (oldVerts copyWith: pN).
- 			self currentWorld displayWorldSafely; runStepMethods].
- 		(oldVerts size > 1 and: [(pN dist: p1) < 5]) ifTrue:
- 			[hand position: Sensor cursorPoint.  "Done -- update hand pos"
- 			^ (poly setVertices: (poly vertices copyWith: p1)) delete].
- 		oldVerts := poly vertices.
- 		[Sensor anyButtonPressed] whileFalse:
- 			[pN := Sensor cursorPoint.
- 			poly setVertices: (oldVerts copyWith: pN).
- 			self currentWorld displayWorldSafely; runStepMethods]].
- !

Item was changed:
  ----- Method: SystemProgressMorph class>>example (in category 'examples') -----
  example
  	"SystemProgressMorph example"
  	'Progress' 
+ 		displayProgressFrom: 0 to: 1000
- 		displayProgressAt: Display center
- 		from: 0 to: 1000
  		during: [:bar | 0 to: 1000 do: [:i | bar value: i. (Delay forMilliseconds: 2) wait]]
  !

Item was changed:
  ----- Method: SystemProgressMorph class>>exampleChangeLabel (in category 'examples') -----
  exampleChangeLabel
  	"SystemProgressMorph exampleChangeLabel"
  	| classes |
  	classes := Smalltalk allClasses copyFrom: 1 to: 100.
  	'InitialLabel' 
+ 		displayProgressFrom: 0 to: classes size
- 		displayProgressAt: Display center
- 		from: 0 to: classes size
  		during: [:bar | 1 to: classes size do: [:i |
  				bar value: i.
  				bar value: i printString, '/', classes size printString, ' ', (classes at: i) printString.
  				(Delay forMilliseconds: 100) wait]]
  !



More information about the Packages mailing list