DataSetLabel.st
changeset 3490 f46a3c50dc15
parent 3468 075b137a1e67
child 3553 9387938a3c07
--- a/DataSetLabel.st	Tue Jul 22 14:47:53 2008 +0200
+++ b/DataSetLabel.st	Tue Jul 22 14:49:03 2008 +0200
@@ -99,7 +99,7 @@
     "
     |y0 x y ascent gcFont labelWidth 
      shownLabel prevClip mustUndoClip
-     netWidth|
+     netWidth goodLookingVerticalSpacing|
 
     label isNil ifTrue:[ ^ self ].
 
@@ -111,6 +111,8 @@
         ascent := gcFont ascent
     ].
     y0 := height - preferredHeight // 2.
+    goodLookingVerticalSpacing := aGC font descent.
+    y0 := y0 + goodLookingVerticalSpacing.
 
     netWidth := width-inset-inset.
 
@@ -146,7 +148,7 @@
         "/ y := shownLabel isImageOrForm ifTrue:[y0] ifFalse:[y0 + ascent].
         "/ y := shownLabel isString ifTrue:[y0 + ascent] ifFalse:[y0].
         shownLabel displayOn:aGC x:x y:y0 + (shownLabel ascentOn:aGC).
-        y0 := y0 + (shownLabel heightOn:aGC).
+        y0 := y0 + (shownLabel heightOn:aGC) + goodLookingVerticalSpacing.
 
         mustUndoClip == true ifTrue:[
             aGC clippingRectangle:prevClip
@@ -160,7 +162,7 @@
 !DataSetLabel methodsFor:'instance creation'!
 
 description:aDescription builder:aBuilder on:aGC
-    |device gcFont|
+    |device gcFont verticalSpace|
 
     label           := self resolveLabelFromDescription:aDescription withBuilder:aBuilder.
     selector        := aDescription  labelActionSelector.
@@ -175,9 +177,9 @@
 
     preferredHeight := preferredWidth := 0.
 
-    (label isNil or:[label perform:#isEmpty ifNotUnderstood:false]) ifTrue:[
+    (label isEmptyOrNil) ifTrue:[
         label := nil.
-      ^ self
+        ^ self
     ].
 
     (font := aDescription labelFont) notNil ifTrue:[
@@ -188,16 +190,24 @@
         ]
     ].
 
-    (label isSequenceable and:[label isString not]) ifFalse:[
-        label := Array with:label
+    label isString ifTrue:[
+        label := Array with:label.
+    ] ifFalse:[
+        (label isSequenceable not) ifTrue:[
+            label := Array with:label.
+        ]
     ].
 
-    label := label collect:[:el||lbl|
-        lbl := self label:el on:device.
-        preferredWidth  := (lbl widthOn:aGC) max:preferredWidth.
-        preferredHeight := preferredHeight + (lbl heightOn:aGC).
-        lbl
-    ].
+    verticalSpace := aGC font descent. "/ goodLookingVerticalSpacing
+    label := label 
+                collect:[:el|
+                    |lbl|
+
+                    lbl := self label:el on:device.
+                    preferredWidth  := (lbl widthOn:aGC) max:preferredWidth.
+                    preferredHeight := preferredHeight + verticalSpace + (lbl heightOn:aGC) + verticalSpace.
+                    lbl
+                ].
     font notNil ifTrue:[aGC font:gcFont].       "/ restore font
 ! !
 
@@ -319,5 +329,5 @@
 !DataSetLabel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetLabel.st,v 1.20 2008-07-08 10:22:59 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetLabel.st,v 1.21 2008-07-22 12:49:03 cg Exp $'
 ! !