--- a/HierarchicalListView.st Thu Jul 25 13:00:23 2019 +0200
+++ b/HierarchicalListView.st Thu Jul 25 14:02:11 2019 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1999 by eXept Software AG
All Rights Reserved
@@ -770,7 +768,7 @@
super listChangedInsert:firstAddedIndex nItems:nLines.
- item := self last.
+ (item := self last) isNil ifTrue:[^ self].
levelOfLastItem := item level.
( shown
@@ -780,54 +778,65 @@
and:[(item := self at:firstAddedIndex ifAbsent:nil) notNil
and:[(level := item level) > 1]]]]]
) ifFalse:[
- ^ self.
+ ^ self.
].
xLft := self xVisibleOfVerticalLineAt:level.
(xLft > margin and:[xLft < (width - margin)]) ifFalse:[
- ^ self
+ ^ self
].
start := firstAddedIndex - 1.
start to:1 by:-1 do:[:i| |el|
- el := self at:i.
+ el := self at:i.
- el level <= level ifTrue:[
- i == start ifTrue:[^ self].
+ el level <= level ifTrue:[
+ i == start ifTrue:[^ self].
- yTop := (self yVisibleOfLine:i + 1) max:margin.
- maxY := height - margin.
+ yTop := (self yVisibleOfLine:i + 1) max:margin.
+ maxY := height - margin.
- yTop < maxY ifTrue:[
- yBot := (self yVisibleOfLine:firstAddedIndex) - 1 min:maxY.
- self invalidate:(Rectangle left:xLft top:yTop width:2 height:(yBot - yTop))
- ].
- ^ self
- ]
+ yTop < maxY ifTrue:[
+ yBot := (self yVisibleOfLine:firstAddedIndex) - 1 min:maxY.
+ self invalidate:(Rectangle left:xLft top:yTop width:2 height:(yBot - yTop))
+ ].
+ ^ self
+ ]
].
+
+ "Modified: / 25-07-2019 / 13:58:59 / Claus Gittinger"
!
listChangedRemove:aStart toIndex:aStop
"test whether last items are deleted;
than we have to redraw lines because of different levels
"
- |listSize index y0 searchLevel|
+ |listSize index y0 searchLevel item|
listSize := self size.
searchLevel := levelOfLastItem.
- listSize == 0 ifTrue:[ levelOfLastItem := 1 ]
- ifFalse:[ levelOfLastItem := self last level ].
+ listSize == 0 ifTrue:[
+ levelOfLastItem := 1
+ ] ifFalse:[
+ (item := self last) isNil ifTrue:[
+ levelOfLastItem := 1
+ ] ifFalse:[
+ levelOfLastItem := item level
+ ].
+ ].
(shown and:[showLines and:[listSize ~~ 0 and:[aStart > listSize]]]) ifTrue:[
- index := self findLast:[:el| el level <= searchLevel ].
+ index := self findLast:[:el| el level <= searchLevel ].
- (index ~~ 0 and:[index < listSize]) ifTrue:[
- y0 := (self yVisibleOfLine:index) max:margin.
- self invalidateX:0 y:y0 width:width height:(height - margin - y0).
- ]
+ (index ~~ 0 and:[index < listSize]) ifTrue:[
+ y0 := (self yVisibleOfLine:index) max:margin.
+ self invalidateX:0 y:y0 width:width height:(height - margin - y0).
+ ]
].
^ super listChangedRemove:aStart toIndex:aStop
+
+ "Modified: / 25-07-2019 / 14:01:35 / Claus Gittinger"
!
updateFromList:what with:aPara