Hi all,
Good bug find Rodney.
http://bugs.squeak.org/view.php?id=7635
Summary 0007635: Graphics primitives will raise errors when rectangles have widths in fractions.
Description For this one in a work space evaluate
box :=
RectangleMorph new openCenteredInWorld .
box bounds: ((375@280 corner: 425@320) insetBy: (3/4)).
The alternate form:
box bounds: ((375@280 corner: 425@320) insetBy: (0.75))
will work without error.
Yours in curiosity and service, --Jerome Peace
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-bf.543.mcz
==================== Summary ====================
Name: Morphic-bf.543
Author: bf
Time: 23 May 2011, 12:11:27.664 pm
UUID: b8b2ae61-d84f-4f1a-bf36-38ce1f256c7e
Ancestors: Morphic-dtl.542
bullet-proof Morphic drawing error handling
=============== Diff against Morphic-dtl.542 ===============
Item was changed:
----- Method: HandMorph>>fullDrawOn: (in category 'drawing') -----
fullDrawOn: aCanvas
"A HandMorph has unusual drawing requirements:
1. the hand itself (i.e., the cursor) appears in front of its submorphs
2. morphs being held by the hand cast a shadow on the world/morphs below
The illusion is that the hand plucks up morphs and carries them above the world."
"Note: This version caches an image of the morphs being held by the hand for
better performance. This cache is invalidated if one of those morphs changes."
| disableCaching subBnds roundCorners rounded |
self visible ifFalse: [^self].
(aCanvas isVisible: self fullBounds) ifFalse: [^self].
+ (self hasProperty: #errorOnDraw) ifTrue:[^self drawErrorOn: aCanvas].
disableCaching := false.
disableCaching
ifTrue:
[self nonCachingFullDrawOn: aCanvas.
^self].
submorphs isEmpty
ifTrue:
[cacheCanvas := nil.
^self drawOn: aCanvas]. "just draw the hand itself"
subBnds := Rectangle merging: (submorphs collect: [:m | m fullBounds]).
self updateCacheCanvas: aCanvas.
(cacheCanvas isNil
or: [cachedCanvasHasHoles and: [cacheCanvas depth = 1]])
ifTrue:
["could not use caching due to translucency; do full draw"
self nonCachingFullDrawOn: aCanvas.
^self].
"--> begin rounded corners hack <---"
roundCorners := cachedCanvasHasHoles == false
and: [submorphs size = 1 and: [submorphs first wantsRoundedCorners]].
roundCorners
ifTrue:
[rounded := submorphs first.
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
shadowCanvas roundCornersOf: rounded
during:
[(subBnds areasOutside: (rounded boundsWithinCorners
translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
aCanvas roundCornersOf: rounded
during:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
^self drawOn: aCanvas "draw the hand itself in front of morphs"].
"--> end rounded corners hack <---"
"draw the shadow"
aCanvas asShadowDrawingCanvas translateBy: self shadowOffset
during:
[:shadowCanvas |
cachedCanvasHasHoles
ifTrue:
["Have to draw the real shadow of the form"
shadowCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
["Much faster if only have to shade the edge of a solid rectangle"
(subBnds areasOutside: (subBnds translateBy: self shadowOffset negated))
do: [:r | shadowCanvas fillRectangle: r color: Color black]]].
"draw morphs in front of the shadow using the cached Form"
cachedCanvasHasHoles
ifTrue: [aCanvas paintImage: cacheCanvas form at: subBnds origin]
ifFalse:
[aCanvas
drawImage: cacheCanvas form
at: subBnds origin
sourceRect: cacheCanvas form boundingBox].
self drawOn: aCanvas "draw the hand itself in front of morphs"!
Item was changed:
----- Method: Morph>>drawErrorOn: (in category 'drawing') -----
drawErrorOn: aCanvas
"The morph (or one of its submorphs) had an error in its drawing method."
+ | saneBounds |
+ saneBounds := bounds rounded.
aCanvas
+ frameAndFillRectangle: saneBounds
- frameAndFillRectangle: bounds
fillColor: Color red
borderWidth: 1
borderColor: Color yellow.
+ aCanvas line: saneBounds topLeft to: saneBounds bottomRight width: 1 color: Color yellow.
+ aCanvas line: saneBounds topRight to: saneBounds bottomLeft width: 1 color: Color yellow.!
- aCanvas line: bounds topLeft to: bounds bottomRight width: 1 color: Color yellow.
- aCanvas line: bounds topRight to: bounds bottomLeft width: 1 color: Color yellow.!
Levente Uzonyi uploaded a new version of ToolsTests to project The Trunk:
http://source.squeak.org/trunk/ToolsTests-fbs.44.mcz
==================== Summary ====================
Name: ToolsTests-fbs.44
Author: fbs
Time: 13 May 2011, 10:42:43.121 pm
UUID: 38aab1aa-dadd-2b4d-b055-5a049109ec4d
Ancestors: ToolsTests-fbs.42
If you're looking at a method #foo, and you don't have a message category selected, and you move classes to something that also has a #foo, keep #foo selected.
=============== Diff against ToolsTests-fbs.42 ===============
Item was added:
+ ----- Method: BrowserTest>>testKeepMethodSelectedWhenChangingClass (in category 'testing - message list') -----
+ testKeepMethodSelectedWhenChangingClass
+ browser selectSystemCategory: SequenceableCollection category.
+ browser selectClass: SequenceableCollection.
+ browser selectMessageNamed: #add:.
+ self assert: browser selectedMessageName = #add:.
+
+ "Even though we have no message category selected, stay looking at the #add: method."
+ browser selectClass: Collection.
+ self assert: browser selectedMessageName = #add:.!
David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.542.mcz
==================== Summary ====================
Name: Morphic-dtl.542
Author: dtl
Time: 22 May 2011, 4:28:44.002 pm
UUID: 08000000-1508-341b-1508-341b14000000
Ancestors: Morphic-laza.541
Fix Mantis 7635: Graphics primitives will raise errors when rectangles have widths in fractions.
Morph>>extent: should send #rounded to the new extent to ensure integer values.
=============== Diff against Morphic-laza.541 ===============
Item was changed:
----- Method: Morph>>extent: (in category 'geometry') -----
extent: aPoint
(bounds extent closeTo: aPoint) ifTrue: [^ self].
self changed.
+ bounds := (bounds topLeft extent: aPoint) rounded.
- bounds := bounds topLeft extent: aPoint.
self layoutChanged.
self changed.
!