#REFACTORING
authorStefan Vogel <sv@exept.de>
Fri, 18 Dec 2015 08:06:18 +0100
changeset 4878 5928056755ab
parent 4876 8edcf9875271
child 4879 9a3a73693cfd
#REFACTORING class: LabelAndIcon changed: #displayOn:x:y:opaque: #on:
LabelAndIcon.st
--- a/LabelAndIcon.st	Fri Dec 11 17:23:07 2015 +0100
+++ b/LabelAndIcon.st	Fri Dec 18 08:06:18 2015 +0100
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libwidg2' }"
 
+"{ NameSpace: Smalltalk }"
+
 ModelListEntry subclass:#LabelAndIcon
 	instanceVariableNames:'icon gap image offset'
 	classVariableNames:''
@@ -375,18 +377,18 @@
 displayOn:aGC x:x y:y opaque:opaque
     "display the receiver on a GC"
 
-    |y1 x1 iconValue imageValue iconHeight imageHeight stringHeight maxHeight gapY asc|
+    |y1 x1 iconValue imageValue iconHeight imageHeight stringHeight maxHeight gapY asc device|
 
-    gapY := (aGC device pixelPerMillimeter x) rounded.
-    "/ gapY := 0.
-    asc  := (aGC font onDevice:aGC device) ascent.
+    device := aGC device.
+    gapY := (device pixelPerMillimeter x) rounded.
+    asc  := (aGC font onDevice:device) ascent.
 
     iconValue := icon value.
     imageValue := image value.
 
     iconHeight   := iconValue notNil ifTrue:[iconValue height]   ifFalse:[0].
     imageHeight  := imageValue notNil ifTrue:[imageValue height]  ifFalse:[0].
-    stringHeight := string size > 0 ifTrue:[string heightOn:aGC] ifFalse:[0].
+    stringHeight := string size ~~ 0 ifTrue:[string heightOn:aGC] ifFalse:[0].
 
     "/ maxHeight := ((iconHeight max: imageHeight) + gapY) max: stringHeight.
     maxHeight := self heightOn:aGC.
@@ -396,7 +398,7 @@
     iconValue notNil ifTrue:[
         y1 := y - asc + (maxHeight - iconHeight + 1 // 2).
 
-        icon := iconValue onDevice:aGC device.
+        icon := iconValue onDevice:device.
 
         (opaque and:[iconValue mask isNil]) ifTrue:[aGC displayOpaqueForm:iconValue x:x1 y:y1]
                                             ifFalse:[aGC displayForm:iconValue x:x1 y:y1].
@@ -406,7 +408,7 @@
 
     imageValue notNil ifTrue:[
         y1 := y - asc + (maxHeight - imageHeight + 1 // 2).
-        image := imageValue onDevice:aGC device.
+        image := imageValue onDevice:device.
 
         (opaque and:[imageValue mask isNil]) ifTrue:[aGC displayOpaqueForm:imageValue x:x1 y:y1]
                                              ifFalse:[aGC displayForm:imageValue x:x1 y:y1].
@@ -423,6 +425,7 @@
 !
 
 on:aDevice
+    <resource: #obsolete>
     "return a new image on a device
     "
     ^ self onDevice:aDevice
@@ -532,10 +535,10 @@
 !LabelAndIcon class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.43 2014-12-01 22:16:24 cg Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/LabelAndIcon.st,v 1.43 2014-12-01 22:16:24 cg Exp $'
+    ^ '$Header$'
 ! !