[Pkg] The Trunk: ToolBuilder-MVC-kb.28.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Apr 18 15:30:51 UTC 2011


Balázs Kósi uploaded a new version of ToolBuilder-MVC to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-MVC-kb.28.mcz

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

Name: ToolBuilder-MVC-kb.28
Author: kb
Time: 18 April 2011, 5:15:35.23 pm
UUID: df5c61c9-52c3-0543-8728-bf77976857ba
Ancestors: ToolBuilder-MVC-ul.27

Remove Morphic/MVC dependencies from ProgressInitiationException.

=============== Diff against ToolBuilder-MVC-ul.27 ===============

Item was changed:
  ----- Method: MVCUIManager>>displayProgress:at:from:to:during: (in category 'ui requests') -----
  displayProgress: titleString at: aPoint from: minVal to: maxVal during: workBlock
  	"Display titleString as a caption over a progress bar while workBlock is evaluated."
+ 	| delta savedArea captionText textFrame barFrame outerFrame result range lastW |
+ 	barFrame := aPoint - (75 at 10) corner: aPoint + (75 at 10).
+ 	captionText := DisplayText text: titleString asText allBold.
+ 	captionText
+ 		foregroundColor: Color black
+ 		backgroundColor: Color white.
+ 	textFrame := captionText boundingBox insetBy: -4.
+ 	textFrame := textFrame align: textFrame bottomCenter
+ 					with: barFrame topCenter + (0 at 2).
+ 	outerFrame := barFrame merge: textFrame.
+ 	delta := outerFrame amountToTranslateWithin: Display boundingBox.
+ 	barFrame := barFrame translateBy: delta.
+ 	textFrame := textFrame translateBy: delta.
+ 	outerFrame := outerFrame translateBy: delta.
+ 	savedArea := Form fromDisplay: outerFrame.
+ 	Display fillBlack: barFrame; fillWhite: (barFrame insetBy: 2).
+ 	Display fillBlack: textFrame; fillWhite: (textFrame insetBy: 2).
+ 	captionText displayOn: Display at: textFrame topLeft + (4 at 4).
+ 	range := maxVal = minVal ifTrue: [1] ifFalse: [maxVal - minVal].  "Avoid div by 0"
+ 	lastW := 0.
+ 	[result := workBlock value:  "Supply the bar-update block for evaluation in the work block"
+ 		[:barVal |
+ 		| w |
+ 		w := ((barFrame width-4) asFloat * ((barVal-minVal) asFloat / range min: 1.0)) asInteger.
+ 		w ~= lastW ifTrue: [
+ 			Display fillGray: (barFrame topLeft + (2 at 2) extent: w at 16).
+ 			lastW := w]]]
+ 		ensure: [savedArea displayOn: Display at: outerFrame topLeft].
+ 	^result!
- 	^ProgressInitiationException 
- 		display: titleString
- 		at: aPoint 
- 		from: minVal 
- 		to: maxVal 
- 		during: workBlock!



More information about the Packages mailing list