--- a/ListView.st Fri Sep 25 20:20:31 1998 +0200
+++ b/ListView.st Mon Sep 28 11:25:54 1998 +0200
@@ -18,7 +18,8 @@
autoScrollDeltaT lastSearchPattern lastSearchIgnoredCase
wordCheck includesNonStrings widthOfWidestLine listMsg viewOrigin
listChannel backgroundAlreadyClearedColor'
- classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions'
+ classVariableNames:'DefaultForegroundColor DefaultBackgroundColor DefaultTabPositions
+ DefaultLeftMargin DefaultTopMargin'
poolDictionaries:''
category:'Views-Text'
!
@@ -101,9 +102,9 @@
leftOffset <Number> left offset for horizontal scroll
nFullLinesShown <Number> the number of unclipped lines in visible area
- (internal; updated on size changes)
+ (internal; updated on size changes)
nLinesShown <Number> the number of lines in visible area, incl. partial
- (internal; updated on size changes)
+ (internal; updated on size changes)
fgColor <Color> color to draw characters
bgColor <Color> the background
@@ -125,23 +126,23 @@
lastSearchIgnoredCase <Boolean> last search ignored case
(kept to provide a default for next search)
wordCheck <Block> rule used for check for word boundaries in word select
- The default rule is to return true for alphaNumeric characters.
- (can be changed to allow for underscore and other
- characters to be treated as alphaCharacters)
+ The default rule is to return true for alphaNumeric characters.
+ (can be changed to allow for underscore and other
+ characters to be treated as alphaCharacters)
autoScrollBlock <Block> block installed as timeoutBlock when doing an
- autoScroll (internal)
+ autoScroll (internal)
autoScrollDeltaT computed scroll time delta in seconds (internal)
includesNonStrings cached flag if any non-strings are in list
widthOfWidestLine cached width of widest line
listMsg if view has a model and listMsg is non-nil,
- this is sent to the model to aquired a new contents
- whenever a change of the aspect (aspectMsg) occurs.
+ this is sent to the model to aquired a new contents
+ whenever a change of the aspect (aspectMsg) occurs.
viewOrigin the current origin
- backgroundAlreadyClearedColor internal; speedup by avoiding
+ backgroundAlreadyClearedColor internal; speedup by avoiding
multiple fills when drawing
internal lines
@@ -153,10 +154,10 @@
textTabPositions defaults to #(1 9 17 25 ...)
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- TextView EditTextView
+ TextView EditTextView
"
!
@@ -321,15 +322,21 @@
!ListView class methodsFor:'defaults'!
defaultTabPositions
+ "return an array containing the default tab positions"
+
^ self tab8Positions
!
tab4Positions
+ "return an array containing tab positions for 4-col tabs"
+
^ #(1 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81
85 89 93 97 101 105 109 113 114 121 125 129 133 137 141 145)
!
tab8Positions
+ "return an array containing tab positions for 8-col tabs"
+
^ #(1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145)
!
@@ -337,14 +344,16 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#'text.foregroundColor' #'text.backgroundColor'
- #'text.tabPositions'
- #'text.font')>
+ #'text.tabPositions'
+ #'text.font')>
DefaultForegroundColor := StyleSheet colorAt:'text.foregroundColor' default:Black.
DefaultBackgroundColor := StyleSheet colorAt:'text.backgroundColor' default:White.
DefaultFont := StyleSheet fontAt:'text.font'.
DefaultTabPositions := StyleSheet at:'text.tabPositions'.
DefaultTabPositions isNil ifTrue:[DefaultTabPositions := self defaultTabPositions].
+ DefaultLeftMargin := 0.5.
+ DefaultTopMargin := 0.5.
"Modified: 20.10.1997 / 15:05:30 / cg"
! !
@@ -361,11 +370,11 @@
"set the background color of the contents"
bgColor ~~ aColor ifTrue:[
- bgColor := aColor.
- self viewBackground:bgColor.
- shown ifTrue:[
- self invalidate "/ clear; redraw
- ]
+ bgColor := aColor.
+ self viewBackground:bgColor.
+ shown ifTrue:[
+ self invalidate "/ clear; redraw
+ ]
]
"Modified: 3.5.1997 / 10:27:40 / cg"
@@ -375,28 +384,28 @@
"set the font for all shown text.
Redraws everything.
CAVEAT: with the addition of Text objects,
- this method is going to be obsoleted by a textStyle
- method, which allows specific control over
- normalFont/boldFont/italicFont parameters."
+ this method is going to be obsoleted by a textStyle
+ method, which allows specific control over
+ normalFont/boldFont/italicFont parameters."
aFont isNil ifTrue:[
- ^ self error:'nil font'
+ ^ self error:'nil font'
].
font ~~ aFont ifTrue:[
- super font:(aFont on:device).
- preferredExtent := nil.
- widthOfWidestLine := nil. "/ i.e. unknown
- self getFontParameters.
- realized ifTrue:[
- (font graphicsDevice == device) ifTrue:[
- self getFontParameters.
- self computeNumberOfLinesShown.
- shown ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown
- ]
- ].
- self contentsChanged
- ]
+ super font:(aFont on:device).
+ preferredExtent := nil.
+ widthOfWidestLine := nil. "/ i.e. unknown
+ self getFontParameters.
+ realized ifTrue:[
+ (font graphicsDevice == device) ifTrue:[
+ self getFontParameters.
+ self computeNumberOfLinesShown.
+ shown ifTrue:[
+ self redrawFromVisibleLine:1 to:nLinesShown
+ ]
+ ].
+ self contentsChanged
+ ]
]
"Modified: 5.7.1996 / 17:55:34 / cg"
@@ -407,7 +416,7 @@
by which lines are vertically separated."
fontHeight ~~ pixels ifTrue:[
- fontHeight := pixels.
+ fontHeight := pixels.
]
"Created: 17.4.1997 / 01:41:33 / cg"
@@ -493,12 +502,12 @@
|newMargin|
aNumber ~~ level ifTrue:[
- newMargin := aNumber abs.
- textStartLeft := leftMargin + newMargin.
- textStartTop := topMargin + newMargin.
- innerWidth := width - textStartLeft - newMargin.
-
- super level:aNumber.
+ newMargin := aNumber abs.
+ textStartLeft := leftMargin + newMargin.
+ textStartTop := topMargin + newMargin.
+ innerWidth := width - textStartLeft - newMargin.
+
+ super level:aNumber.
]
"Modified: 11.8.1997 / 02:59:15 / cg"
@@ -551,12 +560,12 @@
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"
@@ -568,12 +577,12 @@
list isNil ifTrue:[list := OrderedCollection new].
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"
@@ -597,21 +606,21 @@
self withoutRedrawAt:index put:aString.
shown ifTrue:[
- "/ synchronous drawing:
-
- "/ this could have changed the font height;
- "/ must clear all below last line, if it became smaller
- fontHeightBefore > fontHeight ifTrue:[
- (self listLineIsVisible:(self size)) ifTrue:[
- self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
- corner:(width-margin) @ (height-margin).
- ].
- self redrawFromLine:index
- ] ifFalse:[
- self redrawLine:index
- ].
-
- "/ asynchronous:
+ "/ synchronous drawing:
+
+ "/ this could have changed the font height;
+ "/ must clear all below last line, if it became smaller
+ fontHeightBefore > fontHeight ifTrue:[
+ (self listLineIsVisible:(self size)) ifTrue:[
+ self clearRectangle:(margin @ (self yOfVisibleLine:nLinesShown+1))
+ corner:(width-margin) @ (height-margin).
+ ].
+ self redrawFromLine:index
+ ] ifFalse:[
+ self redrawLine:index
+ ].
+
+ "/ asynchronous:
"/ visibleLine := self listLineToVisibleLine:index.
"/ visibleLine notNil ifTrue:[
"/ y := self yOfVisibleLine:visibleLine.
@@ -661,9 +670,9 @@
l := something.
l notNil ifTrue:[
- l isString ifTrue:[
- l := l asStringCollection
- ]
+ l isString ifTrue:[
+ l := l asStringCollection
+ ]
].
self list:l
@@ -726,7 +735,7 @@
(remembered to optimize later redraws)."
self
- list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
+ list:aCollection expandTabs:expand scanForNonStrings:scan includesNonStrings:true
"Modified: 5.6.1997 / 12:40:35 / cg"
!
@@ -741,10 +750,10 @@
|oldFirst oldLeft nonStringsBefore fontHeightBefore|
(aCollection isNil and:[list isNil]) ifTrue:[
- "no change"
- self scrollToTop.
- self scrollToLeft.
- ^ self
+ "no change"
+ self scrollToTop.
+ self scrollToLeft.
+ ^ self
].
list := aCollection.
@@ -753,18 +762,18 @@
includesNonStrings := false.
list notNil ifTrue:[
- expand ifTrue:[
- self expandTabs
- ] ifFalse:[
- scan ifTrue:[
- includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
- ] ifFalse:[
- includesNonStrings := nonStrings
- ]
- ].
+ expand ifTrue:[
+ self expandTabs
+ ] ifFalse:[
+ scan ifTrue:[
+ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+ ] ifFalse:[
+ includesNonStrings := nonStrings
+ ]
+ ].
].
(includesNonStrings ~~ nonStringsBefore) ifTrue:[
- self getFontParameters.
+ self getFontParameters.
].
widthOfWidestLine := nil. "/ i.e. unknown
@@ -774,28 +783,28 @@
leftOffset := 0.
realized ifTrue:[
- (includesNonStrings ~~ nonStringsBefore) ifTrue:[
- self computeNumberOfLinesShown.
- ].
- self contentsChanged.
- "
- dont use scroll here to avoid double redraw
- "
- viewOrigin := 0 @ 0.
-
- oldFirst ~~ firstLineShown ifTrue:[
- self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
- ].
- shown ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown.
-
- fontHeightBefore > fontHeight ifTrue:[
- (self listLineIsVisible:(self size)) ifTrue:[
+ (includesNonStrings ~~ nonStringsBefore) ifTrue:[
+ self computeNumberOfLinesShown.
+ ].
+ self contentsChanged.
+ "
+ dont use scroll here to avoid double redraw
+ "
+ viewOrigin := 0 @ 0.
+
+ oldFirst ~~ firstLineShown ifTrue:[
+ self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
+ ].
+ shown ifTrue:[
+ self redrawFromVisibleLine:1 to:nLinesShown.
+
+ fontHeightBefore > fontHeight ifTrue:[
+ (self listLineIsVisible:(self size)) ifTrue:[
"/ self clearRectangle:((margin @ (self yOfVisibleLine:nLinesShown+1))
"/ corner:(width-margin) @ (height-margin)).
- ].
- ]
- ]
+ ].
+ ]
+ ]
]
"Modified: / 30.8.1995 / 19:07:13 / claus"
@@ -817,34 +826,34 @@
shown ifFalse:[^ self].
visLine := self listLineToVisibleLine:lineNr.
visLine notNil ifTrue:[
- w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
+ w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
"/ x := textStartLeft.
"/ CLAUS fixes leftOver selection pixels
- w := w + leftMargin.
- x := margin.
-
- srcY := topMargin + (visLine * fontHeight).
+ w := w + leftMargin.
+ x := margin.
+
+ srcY := topMargin + (visLine * fontHeight).
"/ h := ((nLinesShown - visLine) * fontHeight).
- h := (height - margin - srcY).
- h > 0 ifTrue:[
- self catchExpose.
- self
- copyFrom:self
- x:x y:srcY
- toX:x y:(srcY - fontHeight)
- width:w height:h
- async:true.
- ].
- self redrawVisibleLine:nFullLinesShown.
- "
- redraw last partial line - if any
- "
- (nFullLinesShown ~~ nLinesShown) ifTrue:[
- self redrawVisibleLine:nLinesShown
- ].
- h > 0 ifTrue:[
- self waitForExpose
- ].
+ h := (height - margin - srcY).
+ h > 0 ifTrue:[
+ self catchExpose.
+ self
+ copyFrom:self
+ x:x y:srcY
+ toX:x y:(srcY - fontHeight)
+ width:w height:h
+ async:true.
+ ].
+ self redrawVisibleLine:nFullLinesShown.
+ "
+ redraw last partial line - if any
+ "
+ (nFullLinesShown ~~ nLinesShown) ifTrue:[
+ self redrawVisibleLine:nLinesShown
+ ].
+ h > 0 ifTrue:[
+ self waitForExpose
+ ].
]
"Modified: / 27.2.1998 / 12:36:59 / cg"
@@ -915,8 +924,8 @@
|oldFirst nonStringsBefore linesShownBefore|
(aCollection isNil and:[list isNil]) ifTrue:[
- "no change"
- ^ self
+ "no change"
+ ^ self
].
"/ list isNil ifTrue:[
@@ -932,42 +941,42 @@
includesNonStrings := false.
list notNil ifTrue:[
- expandTabs ifTrue:[
- self expandTabs
- ] ifFalse:[
- includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
- ].
+ expandTabs ifTrue:[
+ self expandTabs
+ ] ifFalse:[
+ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+ ].
].
(includesNonStrings ~~ nonStringsBefore) ifTrue:[
- self getFontParameters.
- self computeNumberOfLinesShown.
+ self getFontParameters.
+ self computeNumberOfLinesShown.
].
"/ new - reposition horizontally if too big
widthOfWidestLine := nil. "/ i.e. unknown
innerWidth >= self widthOfContents ifTrue:[
- viewOrigin x:0.
- leftOffset := 0.
+ viewOrigin x: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].
-
- viewOrigin y:(firstLineShown - 1 * fontHeight).
- self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
- linesShownBefore := nil.
- shown ifTrue:[
- self clear.
- ]
+ oldFirst := firstLineShown.
+ firstLineShown := self size - nFullLinesShown + 1.
+ firstLineShown < 1 ifTrue:[firstLineShown := 1].
+
+ viewOrigin y:(firstLineShown - 1 * fontHeight).
+ self originChanged:0 @ ((oldFirst - 1) negated * fontHeight).
+ linesShownBefore := nil.
+ shown ifTrue:[
+ self clear.
+ ]
].
"/ end new
(shown and:[doRedraw]) ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown
+ self redrawFromVisibleLine:1 to:nLinesShown
"/ linesShownBefore isNil ifTrue:[
"/ self redrawFromVisibleLine:1 to:nLinesShown
@@ -1013,16 +1022,16 @@
len := col2 - col1 + 1.
list notNil ifTrue:[
- line := self listAt:lineNr.
- line notNil ifTrue:[
- (line size >= col1) ifTrue:[
- s := line copyFrom:col1.
- s size < len ifTrue:[
- ^ s paddedTo:len
- ].
- ^ s copyTo:len
- ]
- ]
+ line := self listAt:lineNr.
+ line notNil ifTrue:[
+ (line size >= col1) ifTrue:[
+ s := line copyFrom:col1.
+ s size < len ifTrue:[
+ ^ s paddedTo:len
+ ].
+ ^ s copyTo:len
+ ]
+ ]
].
^ String new:len withAll:Character space
@@ -1038,29 +1047,29 @@
list at:index put:aString.
didIncludeNonStrings := includesNonStrings.
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.
+ ]
].
includesNonStrings ~~ didIncludeNonStrings ifTrue:[
- self getFontParameters.
- self computeNumberOfLinesShown
+ self getFontParameters.
+ self computeNumberOfLinesShown
].
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: / 26.7.1998 / 13:00:14 / cg"
@@ -1120,7 +1129,7 @@
"ST-80 compatibility"
aspectSymbol notNil ifTrue:[aspectMsg := aspectSymbol.
- listMsg isNil ifTrue:[listMsg := aspectSymbol]].
+ listMsg isNil ifTrue:[listMsg := aspectSymbol]].
listSymbol notNil ifTrue:[listMsg := listSymbol].
changeSymbol notNil ifTrue:[changeMsg := changeSymbol].
menuMsg := menuSymbol.
@@ -1151,14 +1160,14 @@
update:something with:aParameter from:changedObject
changedObject == model ifTrue:[
- (aspectMsg notNil
- and:[something == aspectMsg]) ifTrue:[
- ^ self getListFromModel.
- ].
-
- something == #size ifTrue:[
- ^ self getListFromModelScroll:false.
- ]
+ (aspectMsg notNil
+ and:[something == aspectMsg]) ifTrue:[
+ ^ self getListFromModel.
+ ].
+
+ something == #size ifTrue:[
+ ^ self getListFromModelScroll:false.
+ ]
].
^ super update:something with:aParameter from:changedObject
@@ -1275,14 +1284,14 @@
(lineString notNil and:[lineString isString not])
ifTrue:[
- self drawVisibleLine:visLineNr with:fg and:bg
+ self drawVisibleLine:visLineNr with:fg and:bg
] ifFalse:[
- yf := y - (lineSpacing // 2).
- col > lineString size ifTrue:[
- self fillRectangleX:x y:yf width:(font width) height:fontHeight.
- self paint:fg
- ] ifFalse:[
- characterString := lineString copyFrom:col to:col.
+ yf := y - (lineSpacing // 2).
+ col > lineString size ifTrue:[
+ self fillRectangleX:x y:yf width:(font width) height:fontHeight.
+ self paint:fg
+ ] ifFalse:[
+ characterString := lineString copyFrom:col to:col.
"/ (em := characterString emphasis) notNil ifTrue:[
"/ em := em at:1.
"/ (Text emphasis:em includes:#italic) ifTrue:[
@@ -1292,12 +1301,12 @@
"/ ]
"/ ].
- self fillRectangleX:x y:yf
- width:(font widthOf:characterString)
- height:fontHeight.
- self paint:fg.
- self displayString:characterString x:x y:(y + fontAscent)
- ]
+ self fillRectangleX:x y:yf
+ width:(font widthOf:characterString)
+ height:fontHeight.
+ self paint:fg.
+ self displayString:characterString x:x y:(y + fontAscent)
+ ]
]
"Modified: / 22.4.1998 / 09:13:32 / cg"
@@ -1309,47 +1318,47 @@
|y yf x lineString len characterString w sCol|
(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.
- self paint:bg.
- self fillRectangleX:x y:yf
- width:(fontWidth * len)
- height:fontHeight
- ] ifFalse:[
- (endCol > len) ifTrue:[
- characterString := lineString species new:endCol.
- characterString replaceFrom:1 to:len with:lineString startingAt:1.
- lineString := characterString
- ].
- self paint:bg.
- (lineString isMemberOf:String) ifTrue:[
- fontIsFixedWidth ifTrue:[
- w := (endCol - sCol + 1) * fontWidth
- ] ifFalse:[
- w := font widthOf:lineString from:sCol to:endCol
- ]
- ] ifFalse:[
- w := (lineString copyFrom:sCol to:endCol) widthOn:self
- ].
- self fillRectangleX:x y:yf
- width:w
- height:fontHeight.
- self paint:fg on:bg.
- self displayOpaqueString:lineString from:sCol to:endCol 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.
+ self paint:bg.
+ self fillRectangleX:x y:yf
+ width:(fontWidth * len)
+ height:fontHeight
+ ] ifFalse:[
+ (endCol > len) ifTrue:[
+ characterString := lineString species new:endCol.
+ characterString replaceFrom:1 to:len with:lineString startingAt:1.
+ lineString := characterString
+ ].
+ self paint:bg.
+ (lineString isMemberOf:String) ifTrue:[
+ fontIsFixedWidth ifTrue:[
+ w := (endCol - sCol + 1) * fontWidth
+ ] ifFalse:[
+ w := font widthOf:lineString from:sCol to:endCol
+ ]
+ ] ifFalse:[
+ w := (lineString copyFrom:sCol to:endCol) widthOn:self
+ ].
+ self fillRectangleX:x y:yf
+ width:w
+ height:fontHeight.
+ self paint:fg on:bg.
+ self displayOpaqueString:lineString from:sCol to:endCol x:x y:(y + fontAscent)
+ ]
+ ]
]
"Modified: / 3.9.1998 / 21:54:01 / cg"
@@ -1407,7 +1416,7 @@
the current paint (#redrawX:y:w:h).
"
backgroundAlreadyClearedColor ~~ paint ifTrue:[
- super fillRectangleX:x y:y width:w height:h
+ super fillRectangleX:x y:y width:w height:h
]
@@ -1425,12 +1434,12 @@
visLineNr := self listLineToVisibleLine:line.
visLineNr notNil ifTrue:[
- yTop := self yOfVisibleLine:visLineNr.
- yTop isNil ifTrue:[^ self]. "/ not visible
- (yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
- self invalidate:(Rectangle
- left:margin top:yTop
- width:(width - (2 * margin)) height:fontHeight).
+ yTop := self yOfVisibleLine:visLineNr.
+ yTop isNil ifTrue:[^ self]. "/ not visible
+ (yTop + fontHeight) < 0 ifTrue:[^ self]. "/ not visible
+ self invalidate:(Rectangle
+ left:margin top:yTop
+ width:(width - (2 * margin)) height:fontHeight).
]
"Created: / 5.3.1998 / 01:24:19 / cg"
@@ -1445,24 +1454,24 @@
|listSize newOrigin|
shown ifTrue:[
- list notNil ifTrue:[
- listSize := self numberOfLines.
-
- listSize == 0 ifTrue:[
- widthOfWidestLine := 0.
- ].
+ list notNil ifTrue:[
+ listSize := self numberOfLines.
+
+ listSize == 0 ifTrue:[
+ widthOfWidestLine := 0.
+ ].
- "
- if we are beyond the end, scroll up a bit
- "
- ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
- newOrigin := listSize - nFullLinesShown + 1.
- newOrigin < 1 ifTrue:[
- newOrigin := 1
- ].
- self scrollToLine: newOrigin.
- ].
- ].
+ "
+ if we are beyond the end, scroll up a bit
+ "
+ ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
+ newOrigin := listSize - nFullLinesShown + 1.
+ newOrigin < 1 ifTrue:[
+ newOrigin := 1
+ ].
+ self scrollToLine: newOrigin.
+ ].
+ ].
].
^ super contentsChanged
@@ -1528,48 +1537,43 @@
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 isMemberOf:String]) 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 isMemberOf:String) ifTrue:[
- self redrawVisibleLine:i from:startCol to:endCol
- ] ifFalse:[
- self redrawVisibleLine:i
- ]
- ]
- ]
- ]
- ]
+ line := self visibleAt:startLine.
+
+ (fontIsFixedWidth and:[line isMemberOf:String]) 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 isMemberOf:String) ifTrue:[
+ self redrawVisibleLine:i from:startCol to:endCol
+ ] ifFalse:[
+ self redrawVisibleLine:i
+ ]
+ ]
+ ]
+ ]
+ ]
].
backgroundAlreadyClearedColor := nil.
self clippingRectangle:saveClip.
-
-
-
-
-
!
sizeChanged:how
@@ -1594,12 +1598,12 @@
if we are beyond the end, scroll up a bit
"
((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
- newOrigin := listSize - nFullLinesShown + 1.
- newOrigin < 1 ifTrue:[
- newOrigin := 1
- ].
- self scrollToLine: newOrigin.
- ^ self
+ newOrigin := listSize - nFullLinesShown + 1.
+ newOrigin < 1 ifTrue:[
+ newOrigin := 1
+ ].
+ self scrollToLine: newOrigin.
+ ^ self
].
"Modified: / 18.11.1996 / 19:37:02 / stefan"
@@ -1637,18 +1641,27 @@
initStyle
"setup viewStyle specifics"
+ |n|
+
super initStyle.
"/ DefaultFont notNil ifTrue:[font := DefaultFont on:device]
- self topMargin:(self verticalPixelPerMillimeter:0.5) rounded.
- self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
+ n := DefaultTopMargin.
+ n isInteger ifFalse:[
+ n := (self verticalPixelPerMillimeter:n) rounded.
+ ].
+ self topMargin:n.
+
+ n := DefaultLeftMargin.
+ n isInteger ifFalse:[
+ n := (self verticalPixelPerMillimeter:n) rounded.
+ ].
+ self leftMargin:n.
lineSpacing := 0.
fgColor := DefaultForegroundColor.
bgColor := DefaultBackgroundColor.
-
- "Modified: 22.1.1997 / 11:57:21 / cg"
!
initialize
@@ -1679,14 +1692,14 @@
|sz|
extentChanged ifTrue:[
- self computeNumberOfLinesShown.
+ self computeNumberOfLinesShown.
].
firstLineShown ~~ 1 ifTrue:[
- sz := self size.
- firstLineShown + nLinesShown > sz ifTrue:[
- self scrollToLine:sz - nLinesShown.
- ]
+ sz := self size.
+ firstLineShown + nLinesShown > sz ifTrue:[
+ self scrollToLine:sz - nLinesShown.
+ ]
].
super realize.
@@ -1704,6 +1717,7 @@
recreate
"recreate after a snapin"
+ |n|
super recreate.
@@ -1711,9 +1725,24 @@
recompute margins and font parameters
- display may have different resolution/font sizes.
"
- topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
- self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
+"/ topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
+"/ self leftMargin:(self horizontalPixelPerMillimeter:0.5) rounded.
+
+ n := DefaultTopMargin.
+ n isInteger ifFalse:[
+ n := (self verticalPixelPerMillimeter:n) rounded.
+ ].
+ self topMargin:n.
+
+ n := DefaultLeftMargin.
+ n isInteger ifFalse:[
+ n := (self verticalPixelPerMillimeter:n) rounded.
+ ].
+ self leftMargin:n.
+
self getFontParameters
+
+ "Modified: / 26.9.1998 / 17:09:32 / cg"
! !
!ListView methodsFor:'private'!
@@ -1776,34 +1805,34 @@
"
(fontIsFixedWidth
and:[lineString isNil
- or:[lineString isMemberOf:String]]) ifTrue:[
- ^ (xRel // fontWidth) + 1
+ or:[lineString isMemberOf:String]]) ifTrue:[
+ ^ (xRel // fontWidth) + 1
].
"
for variable fonts, more work is required ...
"
lineString notNil ifTrue:[
- lineString := lineString asString.
- (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
- linePixelWidth := lineString widthOn:self
- ] ifFalse:[
- lineString := lineString string.
- linePixelWidth := font widthOf:lineString.
- ]
+ lineString := lineString asString.
+ (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
+ linePixelWidth := lineString widthOn:self
+ ] ifFalse:[
+ lineString := lineString string.
+ linePixelWidth := font widthOf:lineString.
+ ]
] ifFalse:[
- linePixelWidth := 0
+ linePixelWidth := 0
].
(linePixelWidth <= xRel) ifTrue:[
- fontWidth == 0 ifTrue:[
- "
- although this 'cannot happen',
- it seems that X reports this width for some strange fonts ...
- "
- ^ lineString size
- ].
- ^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
+ fontWidth == 0 ifTrue:[
+ "
+ although this 'cannot happen',
+ it seems that X reports this width for some strange fonts ...
+ "
+ ^ lineString size
+ ].
+ ^ lineString size + ((xRel - linePixelWidth) // fontWidth) + 1
].
"/ cannot simply count individual characters,
@@ -1813,46 +1842,46 @@
(runCol == 0) ifTrue:[runCol := 1].
hasEmphasis ifTrue:[
- posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
- posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
+ posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
+ posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
] ifFalse:[
- posLeft := font widthOf:lineString from:1 to:(runCol - 1).
- posRight := font widthOf:lineString from:1 to:runCol.
+ posLeft := font widthOf:lineString from:1 to:(runCol - 1).
+ posRight := font widthOf:lineString from:1 to:runCol.
].
done := (posLeft <= xRel) and:[posRight > xRel].
[done] whileFalse:[
- oPosRight := posRight.
- oPosLeft := posLeft.
-
- (posRight <= xRel) ifTrue:[
- runCol := runCol + 1.
- posLeft := posRight.
- hasEmphasis ifTrue:[
- posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
- ] ifFalse:[
- posRight := font widthOf:lineString from:1 to:runCol
- ]
- ] ifFalse:[
- (posLeft > xRel) ifTrue:[
- runCol := runCol - 1.
- (runCol == 0) ifTrue:[^ 0].
- posRight := posLeft.
- hasEmphasis ifTrue:[
- posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
- ] ifFalse:[
- posLeft := font widthOf:lineString from:1 to:(runCol - 1)
- ]
- ]
- ].
- done := (posLeft <= xRel) and:[posRight > xRel].
-
- ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
- "/ paranoia: just in case there are unprintable characters
- "/ (avoid endless loop if the binary search does not make progress)
- done := true.
- ]
+ oPosRight := posRight.
+ oPosLeft := posLeft.
+
+ (posRight <= xRel) ifTrue:[
+ runCol := runCol + 1.
+ posLeft := posRight.
+ hasEmphasis ifTrue:[
+ posRight := (lineString copyFrom:1 to:runCol) widthOn:self.
+ ] ifFalse:[
+ posRight := font widthOf:lineString from:1 to:runCol
+ ]
+ ] ifFalse:[
+ (posLeft > xRel) ifTrue:[
+ runCol := runCol - 1.
+ (runCol == 0) ifTrue:[^ 0].
+ posRight := posLeft.
+ hasEmphasis ifTrue:[
+ posLeft := (lineString copyFrom:1 to:(runCol - 1)) widthOn:self.
+ ] ifFalse:[
+ posLeft := font widthOf:lineString from:1 to:(runCol - 1)
+ ]
+ ]
+ ].
+ done := (posLeft <= xRel) and:[posRight > xRel].
+
+ ((oPosRight == posRight) and:[oPosLeft == posLeft]) ifTrue:[
+ "/ paranoia: just in case there are unprintable characters
+ "/ (avoid endless loop if the binary search does not make progress)
+ done := true.
+ ]
].
^ runCol
@@ -1942,20 +1971,20 @@
hMax := font height.
includesNonStrings == true ifTrue:[
- "/
- "/ find maximum height of lines
- "/
- hMax := list inject:hMax into:[:maxSoFar :thisLine |
- thisLine isNil ifTrue:[
- maxSoFar
- ] ifFalse:[
- (thisLine isMemberOf:String) ifTrue:[
- maxSoFar
- ] ifFalse:[
- maxSoFar max:(thisLine heightOn:self)
- ]
- ]
- ].
+ "/
+ "/ find maximum height of lines
+ "/
+ hMax := list inject:hMax into:[:maxSoFar :thisLine |
+ thisLine isNil ifTrue:[
+ maxSoFar
+ ] ifFalse:[
+ (thisLine isMemberOf:String) ifTrue:[
+ maxSoFar
+ ] ifFalse:[
+ maxSoFar max:(thisLine heightOn:self)
+ ]
+ ]
+ ].
].
fontHeight := hMax + lineSpacing.
@@ -1973,23 +2002,23 @@
|text msg|
model notNil ifTrue:[
- msg := listMsg.
- msg isNil ifTrue:[
- msg := aspectMsg
- ].
-
-
- msg notNil ifTrue:[
- text := model perform:msg.
- text notNil ifTrue:[
- text := text asStringCollection.
- ].
+ msg := listMsg.
+ msg isNil ifTrue:[
+ msg := aspectMsg
+ ].
+
+
+ msg notNil ifTrue:[
+ text := model perform:msg.
+ text notNil ifTrue:[
+ text := text asStringCollection.
+ ].
"/ SV: this does not work, if model uses (i.e. updates) the same stringCollection
"/ as the view!!
"/ text ~= list ifTrue:[
- self list:text
+ self list:text
"/ ].
- ].
+ ].
].
"Modified: 26.4.1996 / 14:09:42 / cg"
@@ -2003,26 +2032,26 @@
|text msg|
model notNil ifTrue:[
- msg := listMsg.
- msg isNil ifTrue:[
- msg := aspectMsg
- ].
-
- msg notNil ifTrue:[
- text := model perform:msg.
- text notNil ifTrue:[
- text := text asStringCollection.
- ].
+ msg := listMsg.
+ msg isNil ifTrue:[
+ msg := aspectMsg
+ ].
+
+ msg notNil ifTrue:[
+ text := model perform:msg.
+ text notNil ifTrue:[
+ text := text asStringCollection.
+ ].
"/ SV: this does not work, if model uses (i.e. updates) the same stringCollection
"/ as the view!!
"/ text ~= list ifTrue:[
- aBoolean ifTrue:[
- self list:text
- ] ifFalse:[
- self setList:text
- ]
+ aBoolean ifTrue:[
+ self list:text
+ ] ifFalse:[
+ self setList:text
+ ]
"/ ].
- ].
+ ].
].
"Modified: 19.2.1997 / 12:08:50 / stefan"
@@ -2041,11 +2070,11 @@
sum := 0.
lastLine := self size.
[(sum < charPos) and:[lineNr <= lastLine]] whileTrue:[
- sum := sum + (self at:lineNr) size + 1.
- lineNr := lineNr + 1
+ sum := sum + (self at:lineNr) size + 1.
+ lineNr := lineNr + 1
].
sum == charPos ifTrue:[
- ^ lineNr
+ ^ lineNr
].
^ lineNr - 1
@@ -2274,25 +2303,25 @@
line := self visibleAt:visLineNr.
(fontIsFixedWidth
and:[line isNil
- or:[line isMemberOf:String]]) ifTrue:[
- ^ (tcol * fontWidth) + textStartLeft
+ or:[line isMemberOf:String]]) ifTrue:[
+ ^ (tcol * fontWidth) + textStartLeft
].
line notNil ifTrue:[
- lineSize := line size
+ lineSize := line size
] ifFalse:[
- lineSize := 0
+ lineSize := 0
].
(lineSize == 0) ifTrue:[
- ^ (tcol * fontWidth) + textStartLeft
+ ^ (tcol * fontWidth) + textStartLeft
].
(lineSize < col) ifTrue:[
- ^ (line widthOn:self)
- + (fontWidth * (tcol - lineSize))
- + textStartLeft
+ ^ (line widthOn:self)
+ + (fontWidth * (tcol - lineSize))
+ + textStartLeft
].
(line isMemberOf:String) ifTrue:[
- ^ (font widthOf:line from:1 to:tcol) + textStartLeft
+ ^ (font widthOf:line from:1 to:tcol) + textStartLeft
].
^ ((line copyTo:tcol) widthOn:self) + textStartLeft
@@ -2786,27 +2815,27 @@
"/ ].
(self needScrollToMakeLine:aListLineNr) ifFalse:[
- ^ self
+ ^ self
].
(aListLineNr < nFullLinesShown) ifTrue:[
- "/ at the very top of the list - show from top
- newTopLine := 1
+ "/ at the very top of the list - show from top
+ newTopLine := 1
] ifFalse:[
- (nFullLinesShown < 3) ifTrue:[
- "/ a small view - show from that line
- newTopLine := aListLineNr
- ] ifFalse:[
- bott := self numberOfLines - (nFullLinesShown - 1).
- (aListLineNr > bott) ifTrue:[
- "/ at the end of the list - show the bottom of the list
- newTopLine := bott
- ] ifFalse:[
- "/ somewhere else - place selected line into the middle of
- "/ the view
- newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
- ]
- ]
+ (nFullLinesShown < 3) ifTrue:[
+ "/ a small view - show from that line
+ newTopLine := aListLineNr
+ ] ifFalse:[
+ bott := self numberOfLines - (nFullLinesShown - 1).
+ (aListLineNr > bott) ifTrue:[
+ "/ at the end of the list - show the bottom of the list
+ newTopLine := bott
+ ] ifFalse:[
+ "/ somewhere else - place selected line into the middle of
+ "/ the view
+ newTopLine := (aListLineNr - (nFullLinesShown // 2) + 1)
+ ]
+ ]
].
self scrollToLine:newTopLine.
@@ -2822,10 +2851,10 @@
|line index list|
(list := self list) notNil ifTrue:[
- index := list indexOf:someString.
- index ~~ 0 ifTrue:[
- self makeLineVisible:index
- ]
+ index := list indexOf:someString.
+ index ~~ 0 ifTrue:[
+ self makeLineVisible:index
+ ]
]
"Modified: 9.9.1997 / 10:10:13 / cg"
@@ -2836,9 +2865,9 @@
Numbering starts with 1 for the very first line of the text."
(aListLineNr >= firstLineShown) ifTrue:[
- (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
- ^ false
- ]
+ (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
+ ^ false
+ ]
].
^ true
@@ -2875,8 +2904,8 @@
"change origin to scroll down some lines (towards the bottom of the text)"
nLines > 0 ifTrue:[
- self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
- redraw:true
+ self scrollTo:(viewOrigin + (0 @ (fontHeight * nLines)))
+ redraw:true
]
@@ -2889,7 +2918,7 @@
THIS WILL VANISH!!"
pix > 0 ifTrue:[
- self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
+ self scrollTo:(viewOrigin + (0 @ (pix abs))) redraw:true
]
@@ -2922,7 +2951,7 @@
"change origin to scroll left some cols"
nPixel > 0 ifTrue:[
- self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
+ self scrollTo:(viewOrigin - (nPixel @ 0)) redraw:true
]
@@ -2939,7 +2968,7 @@
"change origin to scroll right some cols"
nPixel > 0 ifTrue:[
- self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
+ self scrollTo:(viewOrigin + (nPixel @ 0)) redraw:true
]
@@ -3036,8 +3065,8 @@
"change origin to scroll up some lines (towards the top of the text)"
nLines > 0 ifTrue:[
- self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
- redraw:true
+ self scrollTo:(viewOrigin - (0 @ (fontHeight * nLines)))
+ redraw:true
]
@@ -3049,7 +3078,7 @@
THIS WILL VANISH!!"
pix > 0 ifTrue:[
- self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
+ self scrollTo:(viewOrigin - (0 @ pix)) redraw:true
]
@@ -3194,43 +3223,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).
@@ -3239,11 +3268,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
@@ -3256,12 +3285,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
].
self repairDamage.
@@ -3275,46 +3304,46 @@
x == 0 ifTrue:[ "/ scrolling vertical
- y0 := textStartTop + (y abs).
- h := height - margin - y0.
- w := width - 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.
- ].
-
- self redrawX:margin y:y1 width:w height:y0.
+ y0 := textStartTop + (y abs).
+ h := height - margin - y0.
+ w := width - 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.
+ ].
+
+ self redrawX:margin y:y1 width:w height:y0.
] ifFalse:[ "/ scrolling horizontal
- x > 0 ifTrue:[ "/ scrolling right
- y0 := margin + x.
- y1 := width - y0.
- ] ifFalse:[ "/ scrolling left
- y0 := margin - x.
- y1 := 0.
- ].
- h := height - margin - margin.
- w := width - 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.
- ].
-
- self redrawX:y1 y:margin width:y0 height:h.
+ x > 0 ifTrue:[ "/ scrolling right
+ y0 := margin + x.
+ y1 := width - y0.
+ ] ifFalse:[ "/ scrolling left
+ y0 := margin - x.
+ y1 := 0.
+ ].
+ h := height - margin - margin.
+ w := width - 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.
+ ].
+
+ self redrawX:y1 y:margin width:y0 height:h.
].
self waitForExpose.
@@ -3422,60 +3451,60 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
- col := startCol - 1.
- firstChar1 := pattern at:1.
- ignCase ifTrue:[
- firstChar1 := firstChar1 asLowercase.
- firstChar2 := firstChar1 asUppercase.
- ] ifFalse:[
- firstChar2 := firstChar1
- ].
- col > (list at:startLine) size ifTrue:[
- col := -999
- ].
- line1 := startLine.
- line1 to:1 by:-1 do:[:lnr |
- lineString := list at:lnr.
- lineString notNil ifTrue:[
- lineSize := lineString size.
- col == -999 ifTrue:[col := lineSize - patternSize + 1].
- [(col > 0)
- and:[(c := lineString at:col) ~= firstChar1
- and:[c ~= firstChar2]]] whileTrue:[
- col := col - 1
- ].
- [col > 0] whileTrue:[
- cc := col.
- found := true.
- 1 to:patternSize do:[:cnr |
- cc > lineSize ifTrue:[
- found := false
- ] ifFalse:[
- pc := pattern at:cnr.
- c := lineString at:cc.
- pc ~= c ifTrue:[
- (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
- found := false
- ]
- ]
- ].
- cc := cc + 1
- ].
- found ifTrue:[
- ^ block1 value:lnr value:col.
- ].
- col := col - 1.
- [(col > 0)
- and:[(c := lineString at:col) ~= firstChar1
- and:[c ~= firstChar2]]] whileTrue:[
- col := col - 1
- ]
- ]
- ].
- col := -999.
- ]
- ]
+ self withCursor:Cursor questionMark do:[
+ col := startCol - 1.
+ firstChar1 := pattern at:1.
+ ignCase ifTrue:[
+ firstChar1 := firstChar1 asLowercase.
+ firstChar2 := firstChar1 asUppercase.
+ ] ifFalse:[
+ firstChar2 := firstChar1
+ ].
+ col > (list at:startLine) size ifTrue:[
+ col := -999
+ ].
+ line1 := startLine.
+ line1 to:1 by:-1 do:[:lnr |
+ lineString := list at:lnr.
+ lineString notNil ifTrue:[
+ lineSize := lineString size.
+ col == -999 ifTrue:[col := lineSize - patternSize + 1].
+ [(col > 0)
+ and:[(c := lineString at:col) ~= firstChar1
+ and:[c ~= firstChar2]]] whileTrue:[
+ col := col - 1
+ ].
+ [col > 0] whileTrue:[
+ cc := col.
+ found := true.
+ 1 to:patternSize do:[:cnr |
+ cc > lineSize ifTrue:[
+ found := false
+ ] ifFalse:[
+ pc := pattern at:cnr.
+ c := lineString at:cc.
+ pc ~= c ifTrue:[
+ (ignCase not or:[pc asLowercase ~= c asLowercase]) ifTrue:[
+ found := false
+ ]
+ ]
+ ].
+ cc := cc + 1
+ ].
+ found ifTrue:[
+ ^ block1 value:lnr value:col.
+ ].
+ col := col - 1.
+ [(col > 0)
+ and:[(c := lineString at:col) ~= firstChar1
+ and:[c ~= firstChar2]]] whileTrue:[
+ col := col - 1
+ ]
+ ]
+ ].
+ col := -999.
+ ]
+ ]
].
"not found"
@@ -3491,11 +3520,11 @@
Sorry, but pattern is no regular expression pattern (yet)"
^ self
- searchBackwardFor:pattern
- ignoreCase:false
- startingAtLine:startLine col:startCol
- ifFound:block1
- ifAbsent:block2
+ searchBackwardFor:pattern
+ ignoreCase:false
+ startingAtLine:startLine col:startCol
+ ifFound:block1
+ ifAbsent:block2
"Modified: 13.9.1997 / 01:07:36 / cg"
!
@@ -3511,68 +3540,68 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
-
- col := startCol + 1.
- line1 := startLine.
- line2 := list size.
-
- pattern includesUnescapedMatchCharacters ifTrue:[
- p := pattern species new:0.
- (pattern startsWith:$*) ifFalse:[
- p := p , '*'
- ].
- p := p , pattern.
- (pattern endsWith:$*) ifFalse:[
- p := p , '*'
- ].
- realPattern := pattern.
- (realPattern startsWith:$*) ifTrue:[
- realPattern := realPattern copyFrom:2
- ].
- line1 to:line2 do:[:lnr |
- lineString := list at:lnr.
- lineString notNil ifTrue:[
- "/ first a crude check ...
- (p match:lineString ignoreCase:ignCase) ifTrue:[
- "/ ok, there it is; look at which position
- col := lineString
- findMatchString:realPattern
- startingAt:col
- ignoreCase:ignCase
- ifAbsent:0.
- col ~~ 0 ifTrue:[
- ^ block1 value:lnr value:col.
- ]
- ].
- ].
- col := 1
- ]
- ] ifFalse:[
- p := pattern withoutMatchEscapes.
- line1 to:line2 do:[:lnr |
- lineString := list at:lnr.
- lineString isString ifTrue:[
- ignCase ifTrue:[
- col := lineString
- findMatchString:p
- startingAt:col
- ignoreCase:ignCase
- ifAbsent:0.
- ] ifFalse:[
- col := lineString
- findString:p
- startingAt:col
- ifAbsent:0.
- ].
- col ~~ 0 ifTrue:[
- ^ block1 value:lnr value:col.
- ]
- ].
- col := 1
- ]
- ].
- ]
+ self withCursor:Cursor questionMark do:[
+
+ col := startCol + 1.
+ line1 := startLine.
+ line2 := list size.
+
+ pattern includesUnescapedMatchCharacters ifTrue:[
+ p := pattern species new:0.
+ (pattern startsWith:$*) ifFalse:[
+ p := p , '*'
+ ].
+ p := p , pattern.
+ (pattern endsWith:$*) ifFalse:[
+ p := p , '*'
+ ].
+ realPattern := pattern.
+ (realPattern startsWith:$*) ifTrue:[
+ realPattern := realPattern copyFrom:2
+ ].
+ line1 to:line2 do:[:lnr |
+ lineString := list at:lnr.
+ lineString notNil ifTrue:[
+ "/ first a crude check ...
+ (p match:lineString ignoreCase:ignCase) ifTrue:[
+ "/ ok, there it is; look at which position
+ col := lineString
+ findMatchString:realPattern
+ startingAt:col
+ ignoreCase:ignCase
+ ifAbsent:0.
+ col ~~ 0 ifTrue:[
+ ^ block1 value:lnr value:col.
+ ]
+ ].
+ ].
+ col := 1
+ ]
+ ] ifFalse:[
+ p := pattern withoutMatchEscapes.
+ line1 to:line2 do:[:lnr |
+ lineString := list at:lnr.
+ lineString isString ifTrue:[
+ ignCase ifTrue:[
+ col := lineString
+ findMatchString:p
+ startingAt:col
+ ignoreCase:ignCase
+ ifAbsent:0.
+ ] ifFalse:[
+ col := lineString
+ findString:p
+ startingAt:col
+ ifAbsent:0.
+ ].
+ col ~~ 0 ifTrue:[
+ ^ block1 value:lnr value:col.
+ ]
+ ].
+ col := 1
+ ]
+ ].
+ ]
].
"not found"
@@ -3587,11 +3616,11 @@
found evaluate block2."
^ self
- searchForwardFor:pattern
- ignoreCase:false
- startingAtLine:startLine col:startCol
- ifFound:block1
- ifAbsent:block2
+ searchForwardFor:pattern
+ ignoreCase:false
+ startingAtLine:startLine col:startCol
+ ifFound:block1
+ ifAbsent:block2
"Modified: 13.9.1997 / 01:07:11 / cg"
! !
@@ -3790,5 +3819,5 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.173 1998-09-04 16:27:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.174 1998-09-28 09:25:54 cg Exp $'
! !