care for new fontParameters, if changing from a non-string-list
back to a string-only list (i.e. IconAndLabel-list -> string-list)
--- a/ListView.st Tue Oct 22 19:51:45 1996 +0200
+++ b/ListView.st Wed Oct 23 00:20:39 1996 +0200
@@ -23,7 +23,7 @@
category:'Views-Text'
!
-!ListView class methodsFor:'documentation'!
+!ListView class methodsFor:'documentation'!
copyright
"
@@ -315,7 +315,7 @@
"
! !
-!ListView class methodsFor:'defaults'!
+!ListView class methodsFor:'defaults'!
defaultTabPositions
^ self tab8Positions
@@ -533,13 +533,15 @@
list add:aString.
includesNonStrings ifFalse:[
- includesNonStrings := (aString notNil and:[aString isString not]).
+ includesNonStrings := (aString notNil and:[aString isString not]).
+"/ includesNonStrings ifTrue:[self getFontParameters].
].
shown ifTrue:[
- self redrawLine:(self size).
- self contentsChanged. "recompute scrollbars"
+ self redrawLine:(self size).
+ self contentsChanged. "recompute scrollbars"
]
+ "Modified: 22.10.1996 / 23:18:47 / cg"
!
add:aString beforeIndex:index
@@ -547,13 +549,15 @@
list add:aString beforeIndex:index.
includesNonStrings ifFalse:[
- includesNonStrings := (aString notNil and:[aString isString not]).
+ includesNonStrings := (aString notNil and:[aString isString not]).
+"/ includesNonStrings ifTrue:[self getFontParameters].
].
shown ifTrue:[
- self redrawFromLine:index.
- self contentsChanged. "recompute scrollbars"
+ self redrawFromLine:index.
+ self contentsChanged. "recompute scrollbars"
]
+ "Modified: 22.10.1996 / 23:18:53 / cg"
!
at:lineNr
@@ -658,7 +662,7 @@
list:aCollection expandTabs:expand
"set the contents (a collection of strings) and scroll to top-left"
- |oldFirst oldLeft|
+ |oldFirst oldLeft nonStringsBefore|
(aCollection isNil and:[list isNil]) ifTrue:[
"no change"
@@ -674,7 +678,7 @@
] ifFalse:[
includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
].
- includesNonStrings ifTrue:[self getFontParameters].
+ (includesNonStrings or:[nonStringsBefore]) ifTrue:[self getFontParameters].
].
widthOfWidestLine := nil. "/ i.e. unknown
@@ -698,7 +702,7 @@
]
"Modified: 30.8.1995 / 19:07:13 / claus"
- "Modified: 1.10.1996 / 12:38:56 / cg"
+ "Modified: 22.10.1996 / 23:19:19 / cg"
!
removeIndex:lineNr
@@ -785,47 +789,48 @@
This can be used to update a self-changing list
(for example: a file list being shown, without disturbing the user too much)"
- |oldFirst|
+ |oldFirst nonStringsBefore|
(aCollection isNil and:[list isNil]) ifTrue:[
- "no change"
- ^ self
+ "no change"
+ ^ self
].
list := aCollection.
list notNil ifTrue:[
- expandTabs ifTrue:[
- self expandTabs
- ] ifFalse:[
- includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
- ].
- includesNonStrings ifTrue:[self getFontParameters].
+ nonStringsBefore := includesNonStrings.
+ expandTabs ifTrue:[
+ self expandTabs
+ ] ifFalse:[
+ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+ ].
+ (includesNonStrings or:[nonStringsBefore]) ifTrue:[self getFontParameters].
].
"/ new - reposition horizontally if too big
widthOfWidestLine := nil. "/ i.e. unknown
innerWidth >= self widthOfContents ifTrue:[
- leftOffset := 0.
+ leftOffset := 0.
].
self contentsChanged.
"/ new - reposition vertically if too big
(firstLineShown + nFullLinesShown) > self size ifTrue:[
- oldFirst := firstLineShown.
- firstLineShown := self size - nFullLinesShown + 1.
- firstLineShown < 1 ifTrue:[firstLineShown := 1].
- self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
- shown ifTrue:[
- self clear.
- ]
+ oldFirst := firstLineShown.
+ firstLineShown := self size - nFullLinesShown + 1.
+ firstLineShown < 1 ifTrue:[firstLineShown := 1].
+ self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
+ shown ifTrue:[
+ self clear.
+ ]
].
"/ end new
shown ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown
+ self redrawFromVisibleLine:1 to:nLinesShown
]
"Modified: 18.12.1995 / 23:27:54 / stefan"
- "Modified: 26.5.1996 / 15:59:59 / cg"
+ "Modified: 22.10.1996 / 23:17:58 / cg"
!
size
@@ -843,26 +848,27 @@
self checkForExistingLine:index.
list at:index put:aString.
includesNonStrings ifFalse:[
- includesNonStrings := (aString notNil and:[aString isString not]).
+ 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.
- ]
+ (aString isNil or:[aString isString]) ifTrue:[
+ includesNonStrings := (list findFirst:[:l | l notNil and:[l isString not]]) ~~ 0.
+ ]
].
+
widthOfWidestLine notNil ifTrue:[
- aString isString ifTrue:[
- w := font widthOf:aString
- ] ifFalse:[
- w := aString widthOn:self
- ].
- w > widthOfWidestLine ifTrue:[
- widthOfWidestLine := w
- ] ifFalse:[
- widthOfWidestLine := nil "/ means: unknown
- ].
+ aString isString ifTrue:[
+ w := font widthOf:aString
+ ] ifFalse:[
+ w := aString widthOn:self
+ ].
+ w > widthOfWidestLine ifTrue:[
+ widthOfWidestLine := w
+ ] ifFalse:[
+ widthOfWidestLine := nil "/ means: unknown
+ ].
]
- "Modified: 12.5.1996 / 20:09:56 / cg"
+ "Modified: 22.10.1996 / 23:19:29 / cg"
! !
!ListView methodsFor:'accessing-mvc'!
@@ -3454,8 +3460,8 @@
^ self withTabs:tabPositions expand:line
! !
-!ListView class methodsFor:'documentation'!
+!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.103 1996-10-01 11:40:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.104 1996-10-22 22:20:39 cg Exp $'
! !