#OTHER
class: NoteBookView
redraw bug if label is too large
(was drawing 1 pixel too wide into tabs border)
--- a/NoteBookView.st Sun Sep 20 12:31:11 2015 +0200
+++ b/NoteBookView.st Thu Sep 24 12:22:31 2015 +0200
@@ -3800,7 +3800,9 @@
displayOn:aGC inset:inset direction:aDirection textRightInset:aTextRightInset
"redraw this tab"
- |dispObj lft wdt top hgt x y|
+ |dispObj lft wdt top hgt x y mustClip|
+
+ mustClip := false.
"/ REDRAW LABEL
(aGC isEnabled and:[self isEnabled]) ifTrue:[
@@ -3814,14 +3816,19 @@
].
(aDirection == #top or:[aDirection == #bottom]) ifTrue:[
+ "/ horizontal drawing
wdt := layout width - inset - inset - aTextRightInset.
wdt > 4 ifFalse:[^ self].
lft := layout left + inset.
x := (wdt - extent x) // 2.
x < 0 ifTrue:[
- dispObj := '...'.
+ dispObj isString ifTrue:[
+ "/ dispObj := '...'.
+ "/ dispObj := (dispObj copyTo:3),'...'.
+ ].
x := 0.
+ mustClip := true.
].
x := x + lft.
y := layout top + ((layout height - inset - extent y - 1) // 2).
@@ -3829,38 +3836,44 @@
aDirection == #top ifTrue:[ y := y + inset ].
y := y + (dispObj ascentOn:aGC).
- dispObj displayOn:aGC x:x y:y.
- ^ self
- ].
-
- hgt := layout height - inset - inset - aTextRightInset.
- hgt > 4 ifFalse:[^ self].
- top := layout top + inset.
-
- y := (hgt - extent x) // 2.
- y < 0 ifTrue:[
- dispObj := '...'.
- y := 0.
- ].
- y := y + top.
- x := layout left + ((layout width - inset - extent y +2) // 2).
-
- aDirection == #left ifTrue:[ x := x + inset ].
-
- dispObj isImageOrForm ifFalse:[
- dispObj isString ifTrue:[
- x := x + aGC font descent.
+ mustClip ifTrue:[
+ aGC clippedTo:layout do:[
+ dispObj displayOn:aGC x:x y:y.
+ ]
+ ] ifFalse:[
+ dispObj displayOn:aGC x:x y:y.
+ ]
+ ] ifFalse:[
+ "/ vertical drawing
+ hgt := layout height - inset - inset - aTextRightInset.
+ hgt > 4 ifFalse:[^ self].
+ top := layout top + inset.
+
+ y := (hgt - extent x) // 2.
+ y < 0 ifTrue:[
+ dispObj := '...'.
+ y := 0.
].
- "/ workaround for a bug in display-with-angle,
- "/ iff displayed string is a labelAndIcon.
- "/ (In this case, display is always opaque, and the current
- "/ backgroundPaint color is used to fill the underlying rectangle)
- "/
- aGC backgroundPaint:aGC backgroundColor.
- aGC displayString:dispObj x:x y:y angle:90.
- ] ifTrue:[
- (dispObj rotated:90) displayOn:aGC x:x y:y.
- ].
+ y := y + top.
+ x := layout left + ((layout width - inset - extent y +2) // 2).
+
+ aDirection == #left ifTrue:[ x := x + inset ].
+
+ dispObj isImageOrForm ifFalse:[
+ dispObj isString ifTrue:[
+ x := x + aGC font descent.
+ ].
+ "/ workaround for a bug in display-with-angle,
+ "/ iff displayed string is a labelAndIcon.
+ "/ (In this case, display is always opaque, and the current
+ "/ backgroundPaint color is used to fill the underlying rectangle)
+ "/
+ aGC backgroundPaint:aGC backgroundColor.
+ aGC displayString:dispObj x:x y:y angle:90.
+ ] ifTrue:[
+ (dispObj rotated:90) displayOn:aGC x:x y:y.
+ ].
+ ]
! !
!NoteBookView::Tab methodsFor:'private'!