ListView.st
changeset 1728 516cb89919f1
parent 1727 48c3cb92e8e2
child 1730 631a1d1a3dfb
--- a/ListView.st	Sat Dec 05 14:34:27 1998 +0100
+++ b/ListView.st	Thu Jan 07 13:09:16 1999 +0100
@@ -15,7 +15,7 @@
 		fgColor bgColor partialLines leftMargin topMargin textStartLeft
 		textStartTop innerWidth tabPositions lineSpacing fontHeight
 		fontAscent fontIsFixedWidth fontWidth autoScroll autoScrollBlock
-		autoScrollDeltaT lastSearchPattern lastSearchIgnoredCase
+		autoScrollDeltaT 
 		wordCheck includesNonStrings widthOfWidestLine listMsg viewOrigin
 		listChannel backgroundAlreadyClearedColor'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
@@ -1189,11 +1189,11 @@
     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).
+	self paint:bg.
+	self fillRectangleX:margin 
+			  y:y-sH
+		      width:(width - (margin * 2))
+		     height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
     ].
     list isNil ifTrue:[^ self].
 
@@ -1203,25 +1203,25 @@
     startLine := startVisLineNr + firstLineShown - 1.
     endLine := endVisLineNr + firstLineShown - 1.
     (startLine == 0) ifTrue:[
-        y := y + fontHeight.
-        startLine := startLine + 1
+	y := y + fontHeight.
+	startLine := startLine + 1
     ].
 
     (endLine > listSize) ifTrue:[
-        e := listSize
+	e := listSize
     ] ifFalse:[
-        e := endLine
+	e := endLine
     ].
 
     (startLine <= e) ifTrue:[
-        x := textStartLeft - leftOffset.
-        self paint:fg on:bg.
-        self from:startLine to:e do:[:line |
-            line notNil ifTrue:[
-                self displayOpaqueString:line x:x y:y
-            ].
-            y := y + fontHeight
-        ]
+	x := textStartLeft - leftOffset.
+	self paint:fg on:bg.
+	self from:startLine to:e do:[:line |
+	    line notNil ifTrue:[
+		self displayOpaqueString:line x:x y:y
+	    ].
+	    y := y + fontHeight
+	]
     ]
 
     "Modified: / 3.10.1998 / 23:06:41 / cg"
@@ -1236,14 +1236,14 @@
 
     y := self yOfVisibleLine:visLineNr.
     backgroundAlreadyClearedColor == bg ifFalse:[
-        self paint:bg.
-        self fillRectangleX:margin y:y - (lineSpacing//2)
-                      width:(width - (2 * margin)) 
-                     height:fontHeight.
+	self paint:bg.
+	self fillRectangleX:margin y:y - (lineSpacing//2)
+		      width:(width - (2 * margin)) 
+		     height:fontHeight.
     ].
     line notNil ifTrue:[
-        self paint:fg on:bg.
-        self displayOpaqueString:line x:x y:(y + fontAscent)
+	self paint:fg on:bg.
+	self displayOpaqueString:line x:x y:(y + fontAscent)
     ]
 
     "Modified: / 3.10.1998 / 23:05:17 / cg"
@@ -1322,56 +1322,56 @@
     |y yf x lineString len characterString w sCol eCol|
 
     (endCol >= startCol) ifTrue:[
-        sCol := startCol max:1.
-
-        lineString := self visibleAt:visLineNr.
-
-        (lineString notNil and:[lineString isString not])
-        ifTrue:[
-            self drawVisibleLine:visLineNr with:fg and:bg.
-        ] ifFalse:[
-            x := (self xOfCol:sCol inVisibleLine:visLineNr) - leftOffset.
-            y := (self yOfVisibleLine:visLineNr).
-            yf := y - (lineSpacing // 2).
-            len := lineString size.
-            (sCol > len) ifTrue:[
-                len := endCol - sCol + 1.
-                backgroundAlreadyClearedColor == bg ifFalse:[
-                    self paint:bg.
-                    self fillRectangleX:x y:yf 
-                                   width:(fontWidth * len) 
-                                  height:fontHeight
-                ]
-            ] ifFalse:[
-                eCol := endCol.
-                (endCol > len) ifTrue:[
-                    backgroundAlreadyClearedColor == bg ifFalse:[
-                        characterString := lineString species new:endCol.
-                        characterString replaceFrom:1 to:len with:lineString startingAt:1.
-                        lineString := characterString.
-                    ] ifTrue:[
-                        eCol := len.
-                    ].
-                ].
-                (lineString isMemberOf:String) ifTrue:[
-                    fontIsFixedWidth ifTrue:[
-                        w := (eCol - sCol + 1) * fontWidth
-                    ] ifFalse:[
-                        w := font widthOf:lineString from:sCol to:eCol
-                    ]
-                ] ifFalse:[
-                    w := (lineString copyFrom:sCol to:eCol) widthOn:self
-                ].
-                backgroundAlreadyClearedColor == bg ifFalse:[
-                    self paint:bg.
-                    self fillRectangleX:x y:yf 
-                                  width:w
-                                  height:fontHeight.
-                ].
-                self paint:fg on:bg.
-                self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
-            ]
-        ]
+	sCol := startCol max:1.
+
+	lineString := self visibleAt:visLineNr.
+
+	(lineString notNil and:[lineString isString not])
+	ifTrue:[
+	    self drawVisibleLine:visLineNr with:fg and:bg.
+	] ifFalse:[
+	    x := (self xOfCol:sCol inVisibleLine:visLineNr) - leftOffset.
+	    y := (self yOfVisibleLine:visLineNr).
+	    yf := y - (lineSpacing // 2).
+	    len := lineString size.
+	    (sCol > len) ifTrue:[
+		len := endCol - sCol + 1.
+		backgroundAlreadyClearedColor == bg ifFalse:[
+		    self paint:bg.
+		    self fillRectangleX:x y:yf 
+				   width:(fontWidth * len) 
+				  height:fontHeight
+		]
+	    ] ifFalse:[
+		eCol := endCol.
+		(endCol > len) ifTrue:[
+		    backgroundAlreadyClearedColor == bg ifFalse:[
+			characterString := lineString species new:endCol.
+			characterString replaceFrom:1 to:len with:lineString startingAt:1.
+			lineString := characterString.
+		    ] ifTrue:[
+			eCol := len.
+		    ].
+		].
+		(lineString isMemberOf:String) ifTrue:[
+		    fontIsFixedWidth ifTrue:[
+			w := (eCol - sCol + 1) * fontWidth
+		    ] ifFalse:[
+			w := font widthOf:lineString from:sCol to:eCol
+		    ]
+		] ifFalse:[
+		    w := (lineString copyFrom:sCol to:eCol) widthOn:self
+		].
+		backgroundAlreadyClearedColor == bg ifFalse:[
+		    self paint:bg.
+		    self fillRectangleX:x y:yf 
+				  width:w
+				  height:fontHeight.
+		].
+		self paint:fg on:bg.
+		self displayOpaqueString:lineString from:sCol to:eCol x:x y:(y + fontAscent)
+	    ]
+	]
     ]
 
     "Modified: / 3.10.1998 / 22:59:41 / cg"
@@ -1383,30 +1383,30 @@
     |y x lineString index1 index2|
 
     (startCol < 1) ifTrue:[
-        index1 := 1
+	index1 := 1
     ] ifFalse:[
-        index1 := startCol
+	index1 := startCol
     ].
     y := self yOfVisibleLine:visLineNr.
     x := (self xOfCol:index1 inVisibleLine:visLineNr) - leftOffset.
     backgroundAlreadyClearedColor == bg ifFalse:[
-        self paint:bg.
-        self fillRectangleX:x y:y - (lineSpacing // 2)
-                      width:(width + leftOffset - x)
-                     height:fontHeight.
+	self paint:bg.
+	self fillRectangleX:x y:y - (lineSpacing // 2)
+		      width:(width + leftOffset - x)
+		     height:fontHeight.
     ].
     lineString := self visibleAt:visLineNr.
     lineString notNil ifTrue:[
-        lineString isString ifFalse:[
-            self drawVisibleLine:visLineNr with:fg and:bg.
-        ] ifTrue:[
-            index2 := lineString size.
-            (index2 < index1) ifTrue:[^ self].
-            (index1 <= index2) ifTrue:[
-                self paint:fg on:bg.
-                self displayOpaqueString:lineString from:index1 to:index2 x:x y:(y + fontAscent)
-            ]
-        ]
+	lineString isString ifFalse:[
+	    self drawVisibleLine:visLineNr with:fg and:bg.
+	] ifTrue:[
+	    index2 := lineString size.
+	    (index2 < index1) ifTrue:[^ self].
+	    (index1 <= index2) ifTrue:[
+		self paint:fg on:bg.
+		self displayOpaqueString:lineString from:index1 to:index2 x:x y:(y + fontAscent)
+	    ]
+	]
     ]
 
     "Modified: / 3.10.1998 / 23:07:56 / cg"
@@ -2524,42 +2524,42 @@
     widthOfWidestLine notNil ifTrue:[^ widthOfWidestLine + (leftMargin * 2)].
 
     device isNil ifTrue:[
-        "/ mhmh - really dont know yet
-        f := font on:Screen current
+	"/ mhmh - really dont know yet
+	f := font on:Screen current
     ] ifFalse:[
-        f := font := font on:device.
+	f := font := font on:device.
     ].
 
     includesNonStrings ifTrue:[
-        max := list 
-                   inject:0 
-                   into:[:maxSoFar :entry |
-                             (
-                                 entry isNil ifTrue:[
-                                     0
-                                 ] ifFalse:[
-                                    entry isString ifTrue:[
-                                        f widthOf:entry
-                                    ] ifFalse:[
-                                        entry widthOn:self
-                                    ]
-                                 ]
-                             ) max:maxSoFar.
-                        ]
+	max := list 
+		   inject:0 
+		   into:[:maxSoFar :entry |
+			     (
+				 entry isNil ifTrue:[
+				     0
+				 ] ifFalse:[
+				    entry isString ifTrue:[
+					f widthOf:entry
+				    ] ifFalse:[
+					entry widthOn:self
+				    ]
+				 ]
+			     ) max:maxSoFar.
+			]
     ] ifFalse:[
-        false "fontIsFixedWidth" ifTrue:[
-            max := self lengthOfLongestLine * fontWidth
-        ] ifFalse:[
-            max := 0.
-            list notNil ifTrue:[
-                list do:[:line |
-                    line notNil ifTrue:[
-                        max := max max:(line widthOn:self)
-                    ]
-                ].
+	false "fontIsFixedWidth" ifTrue:[
+	    max := self lengthOfLongestLine * fontWidth
+	] ifFalse:[
+	    max := 0.
+	    list notNil ifTrue:[
+		list do:[:line |
+		    line notNil ifTrue:[
+			max := max max:(line widthOn:self)
+		    ]
+		].
 "/                max := max max:(f widthOf:list)
-            ].
-        ].
+	    ].
+	].
     ].
     widthOfWidestLine := max.
     ^ max + (leftMargin * 2)
@@ -2578,14 +2578,14 @@
     list isNil ifTrue:[^ 0].
 
     device isNil ifTrue:[
-        "/ mhmh - really dont know yet
-        f := font on:Screen current
+	"/ mhmh - really dont know yet
+	f := font on:Screen current
     ] ifFalse:[
-        f := font := font on:device.
+	f := font := font on:device.
     ].
 
     line isString ifTrue:[
-        ^ f widthOf:line
+	^ f widthOf:line
     ].
     ^ line widthOn:self
 
@@ -3264,43 +3264,43 @@
 "/  compute valid horizontal offset x
 
     (x := dltOrg x) ~~ 0 ifTrue:[
-        tmp := leftOffset + x.
-
-        x < 0 ifTrue:[                                          "/ scrolling left
-            tmp < 0 ifTrue:[x := 1 - leftOffset]
-        ] ifFalse:[                                             "/ scrolling right
-         "/ allows scrolling to the right of widest line
-            max := self widthOfContents + 10.
-
-            tmp + width > max ifTrue:[
-                x := (max - leftOffset - width) max:0
-            ]
-        ]
+	tmp := leftOffset + x.
+
+	x < 0 ifTrue:[                                          "/ scrolling left
+	    tmp < 0 ifTrue:[x := 1 - leftOffset]
+	] ifFalse:[                                             "/ scrolling right
+	 "/ allows scrolling to the right of widest line
+	    max := self widthOfContents + 10.
+
+	    tmp + width > max ifTrue:[
+		x := (max - leftOffset - width) max:0
+	    ]
+	]
     ].
 
 "/  compute valid vertical offset measured in lines
 
     (y := dltOrg y // fontHeight) ~~ 0 ifTrue:[
-        tmp := firstLineShown + y.
-
-        y < 0 ifTrue:[                                          "/ scrolling up
-            tmp < 1 ifTrue:[y := 1 - firstLineShown]
-        ] ifFalse:[                                             "/ scrolling down
-            max := self size.
-
-            tmp + nFullLinesShown > max ifTrue:[
-                y := (max - firstLineShown - nFullLinesShown + 1) max:0
-            ]
-        ]
+	tmp := firstLineShown + y.
+
+	y < 0 ifTrue:[                                          "/ scrolling up
+	    tmp < 1 ifTrue:[y := 1 - firstLineShown]
+	] ifFalse:[                                             "/ scrolling down
+	    max := self size.
+
+	    tmp + nFullLinesShown > max ifTrue:[
+		y := (max - firstLineShown - nFullLinesShown + 1) max:0
+	    ]
+	]
     ].
 
     (x == 0 and:[y == 0]) ifTrue:[                              "/ has viewOrigin changed ?
-        ^ self
+	^ self
     ].
 
 
     (noLn := y) ~~ 0 ifTrue:[
-        y := y * fontHeight
+	y := y * fontHeight
     ].
     delta := (x @ y).
 
@@ -3309,11 +3309,11 @@
     newLeftOffset := newViewOrigin x.
 
     (shown and:[doRedraw]) ifFalse:[
-        self originWillChange.
-        firstLineShown := newFirstLine.
-        viewOrigin := newViewOrigin.
-        leftOffset := newLeftOffset.
-        ^ self originChanged:delta
+	self originWillChange.
+	firstLineShown := newFirstLine.
+	viewOrigin := newViewOrigin.
+	leftOffset := newLeftOffset.
+	^ self originChanged:delta
     ].
 
 "/    (self sensor notNil and: [self sensor hasExposeEventFor:self]) ifTrue:[               "/ outstanding expose events
@@ -3326,12 +3326,12 @@
       or:[(noLn abs) >= nLinesShown                             "/ at least one area is
       or:[(x abs) > (width // 4 * 3)]]                          "/ big enough to redraw all
     ) ifTrue:[
-        self originWillChange.
-        firstLineShown := newFirstLine.
-        viewOrigin := newViewOrigin.
-        leftOffset := newLeftOffset.
-        self invalidate.
-        ^ self originChanged:delta
+	self originWillChange.
+	firstLineShown := newFirstLine.
+	viewOrigin := newViewOrigin.
+	leftOffset := newLeftOffset.
+	self invalidate.
+	^ self originChanged:delta
     ].
 
     hBefore := height.
@@ -3350,45 +3350,45 @@
 
     x == 0 ifTrue:[                                             "/ scrolling vertical
 
-        y0 := textStartTop + (y abs).
-        h  := hBefore - margin - y0.
-        w  := wBefore - margin.
-
-        y > 0 ifTrue:[                                          "/ copy down
-            self copyFrom:self
-                        x:0 y:y0 toX:0 y:textStartTop
-                    width:w height:h async:true.
-            y1 := h.
-        ] ifFalse:[                                             "/ copy up
-            self copyFrom:self
-                        x:margin y:textStartTop toX:margin y:y0
-                    width:w height:h async:true.
-            y1 := 0.
-        ].
-
-        inv := (margin@y1) extent:(w@y0).      
+	y0 := textStartTop + (y abs).
+	h  := hBefore - margin - y0.
+	w  := wBefore - margin.
+
+	y > 0 ifTrue:[                                          "/ copy down
+	    self copyFrom:self
+			x:0 y:y0 toX:0 y:textStartTop
+		    width:w height:h async:true.
+	    y1 := h.
+	] ifFalse:[                                             "/ copy up
+	    self copyFrom:self
+			x:margin y:textStartTop toX:margin y:y0
+		    width:w height:h async:true.
+	    y1 := 0.
+	].
+
+	inv := (margin@y1) extent:(w@y0).      
     ] ifFalse:[                                                 "/ scrolling horizontal
 
-        x > 0 ifTrue:[                                          "/ scrolling right
-            y0 := margin + x.
-            y1 := wBefore - y0.
-        ] ifFalse:[                                             "/ scrolling left
-            y0 := margin - x.
-            y1 := 0.
-        ].
-        h := hBefore - margin - margin.
-        w := wBefore - margin - y0.
-
-        x > 0 ifTrue:[                                          "/ copy right
-            self copyFrom:self x:y0 y:margin toX:margin y:margin
-                    width:w height:h async:true.
-        ] ifFalse:[                                             "/ copy left
-            "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
-            self copyFrom:self x:margin y:margin toX:y0 y:margin
-                    width:w height:h async:true.
-        ].
-
-        inv := (y1@margin) extent:(y0@h).      
+	x > 0 ifTrue:[                                          "/ scrolling right
+	    y0 := margin + x.
+	    y1 := wBefore - y0.
+	] ifFalse:[                                             "/ scrolling left
+	    y0 := margin - x.
+	    y1 := 0.
+	].
+	h := hBefore - margin - margin.
+	w := wBefore - margin - y0.
+
+	x > 0 ifTrue:[                                          "/ copy right
+	    self copyFrom:self x:y0 y:margin toX:margin y:margin
+		    width:w height:h async:true.
+	] ifFalse:[                                             "/ copy left
+	    "/self copyFrom:self x:textStartLeft y:margin toX:y0 y:margin
+	    self copyFrom:self x:margin y:margin toX:y0 y:margin
+		    width:w height:h async:true.
+	].
+
+	inv := (y1@margin) extent:(y0@h).      
     ].
 
     self invalidateDeviceRectangle:inv repairNow:true.
@@ -3866,5 +3866,5 @@
 !ListView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.182 1998-12-05 13:34:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.183 1999-01-07 12:09:06 cg Exp $'
 ! !