clip label on the left, if larger than columns width,
and layout is left or center.
--- a/DataSetLabel.st Wed Oct 13 23:58:23 1999 +0200
+++ b/DataSetLabel.st Wed Oct 13 23:59:13 1999 +0200
@@ -65,7 +65,7 @@
redrawX:xLeft w:width h:height inset:inset on:aGC
"redraw the label; the background is cleared and the paint is set
"
- |y0 margin x y ascent gcFont|
+ |y0 margin x y ascent gcFont prevClip mustUndoClip|
label isNil ifTrue:[ ^ self ].
@@ -80,6 +80,7 @@
y0 := height - preferredHeight // 2.
label do:[:aLabel|
+ mustUndoClip := false.
adjust == #left ifTrue:[
x := xLeft + inset.
] ifFalse:[
@@ -88,10 +89,24 @@
adjust == #right ifTrue:[x := x - inset]
ifFalse:[x := x // 2].
x := xLeft + x.
+
+ "/ cg: must clip left, if string is too large
+ x < xLeft ifTrue:[
+ "/ must clip ...
+ prevClip := aGC clippingRectangleOrNil.
+ mustUndoClip := true.
+ aGC clipRect:(Rectangle
+ left:xLeft top:y0
+ width:width height:height).
+ ].
].
y := aLabel isImageOrForm ifTrue:[y0] ifFalse:[y0 + ascent].
aLabel displayOn:aGC x:x y:y.
- y0 := y0 + (aLabel heightOn:aGC)
+ y0 := y0 + (aLabel heightOn:aGC).
+
+ mustUndoClip == true ifTrue:[
+ aGC clipRect:prevClip
+ ].
].
font notNil ifTrue:[aGC font:gcFont]. "/ restore font
! !
@@ -159,6 +174,7 @@
].
^ lbl
].
+
aLabel class == LabelAndIcon ifTrue:[
lbl := aLabel on:aDevice.
(img := lbl image) isImage ifTrue:[img clearMaskedPixels].
@@ -194,9 +210,16 @@
) ifTrue:[
^ label
].
- ( (lbl := appl resources string:label) isNil
- or:[(lbl := aBuilder aspectAt:(label asSymbol)) isNil]
- ) ifFalse:[
+"/ cg: the old code below did it in the wrong order ...
+ ( (lbl := aBuilder aspectAt:(label asSymbol)) notNil
+ or:[ (lbl := appl resources string:label) notNil]
+ ) ifTrue:
+
+"/ ( (lbl := appl resources string:label) isNil
+"/ or:[(lbl := aBuilder aspectAt:(label asSymbol)) isNil]
+"/ )
+"/ ifFalse:
+ [
label := lbl
]
]
@@ -230,5 +253,5 @@
!DataSetLabel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/DataSetLabel.st,v 1.5 1999-09-13 05:49:09 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/DataSetLabel.st,v 1.6 1999-10-13 21:59:13 cg Exp $'
! !