bug fix in draw routine:
authorca
Mon, 03 Nov 1997 14:14:14 +0100
changeset 604 6cee1e2b14c2
parent 603 6b2fa42f9760
child 605 a8da1eb4e180
bug fix in draw routine: set paint
DSVLabelView.st
DataSetColumn.st
--- a/DSVLabelView.st	Sun Nov 02 19:28:49 1997 +0100
+++ b/DSVLabelView.st	Mon Nov 03 14:14:14 1997 +0100
@@ -264,9 +264,6 @@
                     label displayOn:self x:x0 + hSpace y:((height - (label heightOn:self)) // 2)
                 ].
             ].
-            fgLbl isNil ifTrue:[fgLbl := fg].
-            self paint:fgLbl on:bg.
-
           "/ draw separators
 
             (     aCol showColSeparator
@@ -274,7 +271,8 @@
               or:[columnView canFit not]]
             ) ifTrue:[
             "/ aCol showColSeparator ifTrue:[
-                has3D ifFalse:[                                                 "/ no 3D-Effect
+                has3D ifFalse:[
+                    self paint:fg.                                              "/ no 3D-Effect
                     self displayLineFromX:x1     y:0 toX:x1     y:height
                 ] ifTrue:[                                                      "/ with 3D-Effect
                     self paint:dkCol.
@@ -284,7 +282,6 @@
                     self paint:lgCol.
                     self displayLineFromX:x1 - 2 y:0 toX:x1 - 2 y:height.
                     self displayLineFromX:x1 - 3 y:0 toX:x1 - 3 y:height.
-                    self paint:fg on:bg.                                        "/ restore color
                 ]
             ]
         ].
@@ -296,9 +293,11 @@
     prevClipArea isNil ifTrue:[device noClipIn:drawableId  gc:gcId]
                       ifFalse:[self clippingRectangle:prevClipArea].
 
+    has3D ifTrue:[self paint:lgCol]
+         ifFalse:[self paint:fg].
+
     self displayLineFromX:0 y:(height - 1) toX:x1 y:(height - 1).
 
-
 !
 
 srollToDeltaX:deltaX
@@ -333,5 +332,5 @@
 !DSVLabelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.4 1997-10-29 07:42:29 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.5 1997-11-03 13:13:38 ca Exp $'
 ! !
--- a/DataSetColumn.st	Sun Nov 02 19:28:49 1997 +0100
+++ b/DataSetColumn.st	Mon Nov 03 14:14:14 1997 +0100
@@ -257,7 +257,7 @@
 drawFrom:start to:stop yTop:yTop yBot:yBot with:fgColor and:bgColor
     "redraw rows between start and stop
     "
-    |lgCol dkCol isLast fg bg selRowNr selRowY label drawColSep n
+    |lgCol dkCol isLast fg bg selRowNr label drawColSep n
      rowHeight "{ Class:SmallInteger }"
      nTimes    "{ Class:SmallInteger }"
      y         "{ Class:SmallInteger }"
@@ -266,50 +266,35 @@
     rowHeight := dataSet rowHeight.
     nTimes    := stop - start + 1.
 
-    backgroundColor notNil ifTrue:[
-        bg := backgroundColor.
+    (bg := backgroundColor) isNil ifTrue:[
+        bg := bgColor
+    ] ifFalse:[
         dataSet paint:bg.
-
-        dataSet fillRectangleX:0 y:yTop
-                          width:width 
-                         height:(stop - start + 1 * rowHeight).
-
-        dataSet paint:bg.
-    ] ifFalse:[
-        bg := bgColor
+        dataSet fillRectangleX:0 y:yTop width:width height:(nTimes * rowHeight)
     ].
 
-    foregroundColor isNil ifTrue:[fg := fgColor]
-                         ifFalse:[fg := foregroundColor].
-
-    y := yTop + textInset.
-    x := dataSet horizontalSpacing.
+    fg := foregroundColor ? fgColor.
+    y  := yTop + textInset.
+    x  := dataSet horizontalSpacing.
     selRowNr := dataSet selectedRowIndexInColumn:self.
 
     (selRowNr between:start and:stop) ifTrue:[
-        selRowY := selRowNr - 1 * rowHeight.
+        n := selRowNr - 1 * rowHeight.
 
-        dataSet paint:(dataSet hgLgBgColor).
-        dataSet fillRectangleX:1
-                             y:selRowY
-                         width:width - 1
-                        height:rowHeight - 1.
-
-        selRowY := selRowY + textInset.
-
-        dataSet paint:(dataSet hgLgFgColor) on:(dataSet hgLgBgColor).
+        dataSet paint:(lgCol := dataSet hgLgBgColor).
+        dataSet fillRectangleX:1 y:n width:width - 1 height:rowHeight - 1.
+        n := n + textInset.
+        dataSet paint:(dataSet hgLgFgColor) on:lgCol.
 
         drawableAction notNil ifTrue:[
             (label := drawableAction value:selRowNr) notNil ifTrue:[
-                label displayOn:dataSet x:x y:selRowY
+                label displayOn:dataSet x:x y:n
             ]
         ] ifFalse:[
             description rendererType == #rowSelector ifTrue:[
-                form2 displayOn:dataSet x:x y:selRowY    
+                form2 displayOn:dataSet x:x y:n    
             ]
         ]
-    ] ifFalse:[
-        selRowY := nil
     ].
     dataSet paint:fg on:bg.
 
@@ -353,7 +338,7 @@
     ].
 
     dataSet has3Dsepartors ifFalse:[
-        dataSet paint:fg.
+        dataSet paint:fgColor.
 
         drawColSep ifTrue:[
             dataSet displayLineFromX:width y:yTop toX:width y:yBot.
@@ -690,5 +675,5 @@
 !DataSetColumn class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.7 1997-10-30 15:50:43 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.8 1997-11-03 13:14:14 ca Exp $'
 ! !