ListView.st
changeset 60 f3c738c24ce6
parent 59 450ce95a72a4
child 63 f4eaf04d1eaf
--- a/ListView.st	Mon Oct 10 04:03:47 1994 +0100
+++ b/ListView.st	Fri Oct 28 04:25:37 1994 +0100
@@ -36,7 +36,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.10 1994-10-10 03:02:06 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.11 1994-10-28 03:25:07 claus Exp $
 '!
 
 !ListView class methodsFor:'documentation'!
@@ -57,7 +57,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.10 1994-10-10 03:02:06 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.11 1994-10-28 03:25:07 claus Exp $
 "
 !
 
@@ -112,12 +112,9 @@
 !ListView class methodsFor:'defaults'!
 
 updateStyleCache
-    DefaultForegroundColor := StyleSheet at:'textForegroundColor' default:Black.
-    DefaultBackgroundColor := StyleSheet at:'textBackgroundColor' default:White.
-    DefaultFont := StyleSheet at:'textFont'.
-    DefaultFont notNil ifTrue:[
-	DefaultFont := DefaultFont on:Display
-    ]
+    DefaultForegroundColor := StyleSheet colorAt:'textForegroundColor' default:Black.
+    DefaultBackgroundColor := StyleSheet colorAt:'textBackgroundColor' default:White.
+    DefaultFont := StyleSheet fontAt:'textFont'.
 !
 
 tab4Positions
@@ -386,6 +383,13 @@
 
     self checkForExistingLine:index.
     list at:index put:aString.
+    includesNonStrings ifFalse:[
+	includesNonStrings := (aString notNil and:[aString isString not]).
+    ] ifTrue:[
+	(aString isNil or:[aString isString]) ifTrue:[
+	    includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
+	]
+    ].
     shown ifTrue:[
 	self redrawLine:index
     ]
@@ -1144,7 +1148,7 @@
     nTabs := line occurrencesOf:(Character tab).
     nTabs == 0 ifTrue:[^ line].
 
-    currentMax := 200.
+    currentMax := line size + (nTabs * 7).
     tmpString := String new:currentMax.
     dstIndex := 1.
     line do:[:character |
@@ -1159,6 +1163,9 @@
 	    dstIndex := dstIndex + 1
 	].
 	(dstIndex > currentMax) ifTrue:[
+	    "
+	     this cannot happen with <= 8 tabs
+	    "
 	    currentMax := currentMax + currentMax.
 	    nString := String new:currentMax.
 	    nString replaceFrom:1 to:(dstIndex - 1) 
@@ -1171,7 +1178,11 @@
 	 - no need to return value of ifTrue:/ifFalse above"
 	0
     ].
-    ^ tmpString copyTo:(dstIndex - 1)
+    dstIndex := dstIndex - 1.
+    dstIndex == currentMax ifTrue:[
+	^ tmpString
+    ].
+    ^ tmpString copyTo:dstIndex
 !
 
 withTabs:line
@@ -1985,6 +1996,22 @@
 
 !ListView methodsFor:'redrawing'!
 
+flash
+    "show contents in reverse colors for a moment - to wakeup the user :-)"
+
+    |savFg savBg|
+
+    savFg := fgColor.
+    savBg := bgColor.
+    fgColor := savBg.
+    bgColor := savFg.
+    self redraw.
+    (Delay forSeconds:0.1) wait.
+    fgColor := savFg.
+    bgColor := savBg.
+    self redraw
+!
+
 redrawVisibleLine:visLineNr col:col
     "redraw single character at col index of visible line"