ListView.st
branchjv
changeset 6085 4ecbe3a93aec
parent 6024 7fdee3dcd61a
parent 6053 74dd0568082d
child 6086 58d88b144b2b
--- a/ListView.st	Mon Jan 16 19:58:26 2017 +0000
+++ b/ListView.st	Wed Jan 25 17:40:20 2017 +0000
@@ -1942,11 +1942,10 @@
     sH := lineSpacing // 2.
 
     backgroundAlreadyClearedColor == bg ifFalse:[
-        self paint:bg.
-        self fillRectangleX:margin
-                          y:y-sH
-                      width:(width - (margin * 2))
-                     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
+        gc paint:bg.
+        gc fillRectangleX:margin y:y-sH
+           width:(width - (margin * 2))
+           height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
     ].
     list isNil ifTrue:[^ self].
 
@@ -1968,14 +1967,14 @@
 
     (startLine <= e) ifTrue:[
         x := textStartLeft - viewOrigin x.
-        self paint:fg on:bg.
+        gc paint:fg on:bg.
         "/ don't use list from:to:do:, to allow for subclasses to redefine the enumeration (TableView)
         self from:startLine to:e do:[:line |
             line notNil ifTrue:[
                 "/ remove line's color emphasis, to enforce color.
                 "/ otherwise blue text is not visible if selection-bg is blue
                 l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
-                self displayOpaqueString:l x:x y:y.
+                gc displayOpaqueString:l x:x y:y.
                 
                 checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
                     self updateWidthOfWidestLineFor:l
@@ -2003,12 +2002,12 @@
         self highlightLineSpacing ifTrue:[
             extraBelow := halfSpacing.
         ].
-        self fillRectangleX:margin y:y - halfSpacing
-                      width:(width - (2 * margin))
-                     height:fontHeight+extraBelow.
+        gc fillRectangleX:margin y:y - halfSpacing
+           width:(width - (2 * margin))
+           height:fontHeight+extraBelow.
     ].
     line notNil ifTrue:[
-        self paint:fg on:bg.
+        gc paint:fg on:bg.
 
         "/ remove lines color emphasis, to enforce color.
         "/ otherwise blue text is not visible if selection-bg is blue.
@@ -2018,7 +2017,7 @@
         ] ifFalse:[
             l := line
         ].
-        self displayOpaqueString:l x:x y:(y + fontAscent).
+        gc displayOpaqueString:l x:x y:(y + fontAscent).
         
         checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
             self updateWidthOfWidestLineFor:l
@@ -2037,12 +2036,12 @@
 
     y := self yOfVisibleLine:visLineNr.
     line notNil ifTrue:[
-        self paint:fg on:bg.
+        gc paint:fg on:bg.
 
         "/ remove lines color emphasis, to enforce color.
         "/ otherwise blue text is not visible if selection-bg is blue
         l := self withoutColorEmphasis:line ifFg:fg andBg:bg.
-        self displayOpaqueString:l x:x y:(y + fontAscent).
+        gc displayOpaqueString:l x:x y:(y + fontAscent).
         
         checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
             self updateWidthOfWidestLineFor:l
@@ -2064,14 +2063,14 @@
     y := self yOfVisibleLine:visLineNr.
     yf := y - (lineSpacing // 2).
 
-    self paint:bg.
+    gc paint:bg.
 
     (lineString notNil and:[lineString isString not]) ifTrue:[
         w := lineString widthFrom:col to:(col min:len) on:self.
         w <= 0 ifTrue:[
             w := gc font width.
-            self fillRectangleX:x y:yf width:w height:fontHeight.
-            self paint:fg
+            gc fillRectangleX:x y:yf width:w height:fontHeight.
+            gc paint:fg
         ].
         self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
             self drawVisibleLine:visLineNr with:fg and:bg
@@ -2080,8 +2079,8 @@
     ].
 
     (lineString isNil or:[col > len]) ifTrue:[
-        self fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
-        self paint:fg
+        gc fillRectangleX:x y:yf width:(gc font width) height:fontHeight.
+        gc paint:fg
     ] ifFalse:[
         characterString := lineString copyFrom:col to:col.
 
@@ -2090,10 +2089,10 @@
         characterString := self withoutColorEmphasis:characterString ifFg:fg andBg:bg.
         w := characterString widthOn:self.
 
-        self fillRectangleX:x y:yf width:w height:fontHeight.
-        self paint:fg.
+        gc fillRectangleX:x y:yf width:w height:fontHeight.
+        gc paint:fg.
         self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
-            self displayString:characterString x:x y:(y + fontAscent)
+            gc displayString:characterString x:x y:(y + fontAscent)
         ].
 
         checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
@@ -2130,12 +2129,12 @@
                 ] ifFalse:[
                     numExtraCols := (endCol - len" + 1").
                 ].
-                self paint:bg.
-                self fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
+                gc paint:bg.
+                gc fillRectangleX:x+w y:yf width:(numExtraCols * fontWidth) height:fontHeight.
             ].
             w > 0 ifTrue:[
                 self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
-                    self drawVisibleLine:visLineNr with:fg and:bg.
+                    gc drawVisibleLine:visLineNr with:fg and:bg.
                 ].
                 checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
                     self updateWidthOfWidestLineFor:characterString
@@ -2147,8 +2146,8 @@
         (sCol > len) ifTrue:[
             backgroundAlreadyClearedColor == bg ifFalse:[
                 len := endCol - sCol + 1.
-                self paint:bg.
-                self fillRectangleX:x y:yf
+                gc paint:bg.
+                gc fillRectangleX:x y:yf
                                width:(fontWidth * len)
                               height:fontHeight
             ]
@@ -2178,21 +2177,19 @@
                 ] ifFalse:[
                     w := lineString widthFrom:sCol to:endCol on:self
                 ].
-                self paint:bg.
-                self fillRectangleX:x y:yf
-                              width:w
-                              height:fontHeight.
+                gc paint:bg.
+                gc fillRectangleX:x y:yf width:w height:fontHeight.
             ].
-            self paint:fg on:bg.
+            gc paint:fg on:bg.
             w notNil ifTrue:[
                 "/ clip req'd for VISTAs new font rendering (which seems to shoot over the compute
                 self clippedTo:(Rectangle left:x top:yf width:w height:fontHeight) do:[
                     "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-                    self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
+                    gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
                 ]
             ] ifFalse:[
                 "/ self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-                self displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
+                gc displayString:lineString from:sCol to:eCol x:x y:(y + fontAscent) opaque:false maxWidth:self width
             ].
             checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
                 self updateWidthOfWidestLineFor:lineString
@@ -2216,10 +2213,9 @@
     y := self yOfVisibleLine:visLineNr.
     x := (self xOfCol:index1 inVisibleLine:visLineNr) - viewOrigin x.
     backgroundAlreadyClearedColor == bg ifFalse:[
-        self paint:bg.
-        self fillRectangleX:x y:y - (lineSpacing // 2)
-                      width:(width + viewOrigin x - x)
-                     height:fontHeight.
+        gc paint:bg.
+        gc fillRectangleX:x y:y - (lineSpacing // 2)
+           width:(width + viewOrigin x - x) height:fontHeight.
     ].
     lineString notNil ifTrue:[
         lineString isString ifFalse:[
@@ -2231,7 +2227,7 @@
             (index1 <= index2) ifTrue:[
                 self paint:fg on:bg.
                 "/ self displayOpaqueString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent)
-                self displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent).
+                gc displayString:lineWithoutColor from:index1 to:index2 x:x y:(y + fontAscent).
 
                 checkedLinesForWidthOfContentsComputation == 0 ifTrue:[
                     self updateWidthOfWidestLineFor:lineWithoutColor
@@ -2450,49 +2446,49 @@
     stopLine := self visibleLineOfY:(y + h).
 
     saveClip := gc clippingBoundsOrNil.
-    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
-    self paint:bgColor.
-    self fillRectangleX:x y:y width:w height:h.
+    self clippingBounds:(Rectangle left:x top:y width:w height:h).
+    gc paint:bgColor.
+    gc fillRectangleX:x y:y width:w height:h.
     backgroundAlreadyClearedColor := bgColor.
 
     (includesNonStrings or:[w > (width // 4 * 3)]) ifTrue:[
-	"includes non strings or area is big enough: redraw whole lines"
-	self redrawFromVisibleLine:startLine to:stopLine
+        "includes non strings or area is big enough: redraw whole lines"
+        self redrawFromVisibleLine:startLine to:stopLine
     ] ifFalse:[
-	line := self visibleAt:startLine.
-
-	(fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[
-	    "start/end col has to be computed for each line"
-
-	    startLine to:stopLine do:[:i |
-		startCol := self colOfX:x inVisibleLine:i.
-		endCol := self colOfX:(x + w) inVisibleLine:i.
-		startCol > 0 ifTrue:[
-		    endCol > 0 ifTrue:[
-			self redrawVisibleLine:i from:startCol to:endCol
-		    ]
-		]
-	    ]
-	] ifTrue:[
-	    "start/end col is the same for all lines"
-	    startCol := self colOfX:x inVisibleLine:startLine.
-	    endCol := self colOfX:(x + w) inVisibleLine:startLine.
-	    startCol > 0 ifTrue:[
-		endCol > 0 ifTrue:[
-		    startLine to:stopLine do:[:i |
-			line := self visibleAt:i.
-			(line isSingleByteString) ifTrue:[
-			    self redrawVisibleLine:i from:startCol to:endCol
-			] ifFalse:[
-			    self redrawVisibleLine:i
-			]
-		    ]
-		]
-	    ]
-	]
+        line := self visibleAt:startLine.
+
+        (fontIsFixedWidth and:[line isSingleByteString]) ifFalse:[
+            "start/end col has to be computed for each line"
+
+            startLine to:stopLine do:[:i |
+                startCol := self colOfX:x inVisibleLine:i.
+                endCol := self colOfX:(x + w) inVisibleLine:i.
+                startCol > 0 ifTrue:[
+                    endCol > 0 ifTrue:[
+                        self redrawVisibleLine:i from:startCol to:endCol
+                    ]
+                ]
+            ]
+        ] ifTrue:[
+            "start/end col is the same for all lines"
+            startCol := self colOfX:x inVisibleLine:startLine.
+            endCol := self colOfX:(x + w) inVisibleLine:startLine.
+            startCol > 0 ifTrue:[
+                endCol > 0 ifTrue:[
+                    startLine to:stopLine do:[:i |
+                        line := self visibleAt:i.
+                        (line isSingleByteString) ifTrue:[
+                            self redrawVisibleLine:i from:startCol to:endCol
+                        ] ifFalse:[
+                            self redrawVisibleLine:i
+                        ]
+                    ]
+                ]
+            ]
+        ]
     ].
     backgroundAlreadyClearedColor := nil.
-    self clippingRectangle:saveClip.
+    self clippingBounds:saveClip.
 !
 
 sizeChanged:how