--- a/ListView.st Wed Sep 11 20:01:21 1996 +0200
+++ b/ListView.st Thu Sep 12 15:04:52 1996 +0200
@@ -100,9 +100,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
@@ -121,26 +121,26 @@
lineSpacing <Number> pixels between lines
searchPattern <String> last pattern for searching
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
menuHolder who has a menu
- (default: nil or model here, self in textViews)
+ (default: nil or model here, self in textViews)
menuPerformer who performs menu actions
- (default: nil or model here, self in textViews)
+ (default: nil or model here, self in textViews)
[StyleSheet parameters:]
@@ -150,10 +150,10 @@
textTabPositions defaults to #(1 9 17 25 ...)
[author:]
- Claus Gittinger
+ Claus Gittinger
[see also:]
- TextView EditTextView
+ TextView EditTextView
"
!
@@ -166,151 +166,151 @@
anyway, here are a few examples:
basic simple setup:
- [exBegin]
- |top l|
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- l list:#('one' 'two' 'three').
-
- top open
- [exEnd]
+ [exBegin]
+ |top l|
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ l list:#('one' 'two' 'three').
+
+ top open
+ [exEnd]
specifying textMargins (these have NOTHING to do with the viewInset):
- [exBegin]
- |top l|
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- l list:#('one' 'two' 'three').
- l topMargin:10.
- l leftMargin:20.
-
- top open
- [exEnd]
+ [exBegin]
+ |top l|
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ l list:#('one' 'two' 'three').
+ l topMargin:10.
+ l leftMargin:20.
+
+ top open
+ [exEnd]
globally set the fg/bg colors:
- [exBegin]
- |top l|
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- l list:#('one' 'two' 'three').
- l foregroundColor:(Color white).
- l backgroundColor:(Color blue).
-
- top open
- [exEnd]
+ [exBegin]
+ |top l|
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ l list:#('one' 'two' 'three').
+ l foregroundColor:(Color white).
+ l backgroundColor:(Color blue).
+
+ top open
+ [exEnd]
non-string (text) entries:
- [exBegin]
- |top list l|
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- list := #('all' 'of' 'your' 'preferred' 'colors')
- with:#(red green blue 'orange' cyan)
- collect:[:s :clr |
- Text string:s
- emphasis:(Array with:#bold
- with:(#color->(Color name:clr))) ].
- l list:list.
-
- top open
- [exEnd]
+ [exBegin]
+ |top list l|
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ list := #('all' 'of' 'your' 'preferred' 'colors')
+ with:#(red green blue 'orange' cyan)
+ collect:[:s :clr |
+ Text string:s
+ emphasis:(Array with:#bold
+ with:(#color->(Color name:clr))) ].
+ l list:list.
+
+ top open
+ [exEnd]
generic non-string entries:
(notice: ColoredListEntry is obsoleted by Text)
- [exBegin]
- |top list l|
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- list := #('all' 'of' 'your' 'preferred' 'colors')
- with:#(red green blue 'orange' cyan)
- collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
- l list:list.
-
- top open
- [exEnd]
+ [exBegin]
+ |top list l|
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ list := #('all' 'of' 'your' 'preferred' 'colors')
+ with:#(red green blue 'orange' cyan)
+ collect:[:s :clr | ColoredListEntry string:s color:(Color name:clr) ].
+ l list:list.
+
+ top open
+ [exEnd]
using a model (default listMessage is aspectMessage):
- [exBegin]
- |top model l theModelsText|
-
- model := Plug new.
- model respondTo:#modelsAspect
- with:[ theModelsText ].
-
- top := StandardSystemView new.
- top extent:100@200.
-
- l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
- l model:model.
- l aspect:#modelsAspect.
-
- top open.
-
- Delay waitForSeconds:3.
- theModelsText := #('foo' 'bar' 'baz').
- model changed:#modelsAspect.
- [exEnd]
+ [exBegin]
+ |top model l theModelsText|
+
+ model := Plug new.
+ model respondTo:#modelsAspect
+ with:[ theModelsText ].
+
+ top := StandardSystemView new.
+ top extent:100@200.
+
+ l := ListView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
+ l model:model.
+ l aspect:#modelsAspect.
+
+ top open.
+
+ Delay waitForSeconds:3.
+ theModelsText := #('foo' 'bar' 'baz').
+ model changed:#modelsAspect.
+ [exEnd]
using a model with different aspects
for two listViews:
- [exBegin]
- |top model l1 l2 plainText|
-
- plainText := #('').
-
- model := Plug new.
- model respondTo:#modelsUppercaseText
- with:[ plainText asStringCollection
- collect:[:l | l asUppercase]].
- model respondTo:#modelsLowercaseText
- with:[ plainText asStringCollection
- collect:[:l | l asLowercase]].
-
- top := StandardSystemView extent:200@200.
-
- l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
- l1 model:model.
- l1 aspect:#modelsAspect.
- l1 listMessage:#modelsUppercaseText.
-
- l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
- l2 model:model.
- l2 aspect:#modelsAspect.
- l2 listMessage:#modelsLowercaseText.
-
- top open.
-
- Delay waitForSeconds:3.
- plainText := #('foo' 'bar' 'baz').
- model changed:#modelsAspect.
- [exEnd]
+ [exBegin]
+ |top model l1 l2 plainText|
+
+ plainText := #('').
+
+ model := Plug new.
+ model respondTo:#modelsUppercaseText
+ with:[ plainText asStringCollection
+ collect:[:l | l asUppercase]].
+ model respondTo:#modelsLowercaseText
+ with:[ plainText asStringCollection
+ collect:[:l | l asLowercase]].
+
+ top := StandardSystemView extent:200@200.
+
+ l1 := ListView origin:0.0 @ 0.0 corner:1.0 @ 0.5 in:top.
+ l1 model:model.
+ l1 aspect:#modelsAspect.
+ l1 listMessage:#modelsUppercaseText.
+
+ l2 := ListView origin:0.0 @ 0.5 corner:1.0 @ 1.0 in:top.
+ l2 model:model.
+ l2 aspect:#modelsAspect.
+ l2 listMessage:#modelsLowercaseText.
+
+ top open.
+
+ Delay waitForSeconds:3.
+ plainText := #('foo' 'bar' 'baz').
+ model changed:#modelsAspect.
+ [exEnd]
"
! !
@@ -334,8 +334,8 @@
"extract values from the styleSheet and cache them in class variables"
<resource: #style (#textForegroundColor #textBackgroundColor
- #textTabPositions
- #textFont)>
+ #textTabPositions
+ #textFont)>
DefaultForegroundColor := StyleSheet colorAt:'textForegroundColor' default:Black.
DefaultBackgroundColor := StyleSheet colorAt:'textBackgroundColor' default:White.
@@ -358,11 +358,11 @@
"set the background color"
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: 29.5.1996 / 16:18:48 / cg"
@@ -372,26 +372,26 @@
"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.
- realized ifTrue:[
- widthOfWidestLine := nil. "/ i.e. unknown
- (font graphicsDevice == device) ifTrue:[
- self getFontParameters.
- self computeNumberOfLinesShown.
- shown ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown
- ]
- ].
- self contentsChanged
- ]
+ super font:aFont.
+ realized ifTrue:[
+ widthOfWidestLine := nil. "/ i.e. unknown
+ (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,10 +407,10 @@
"set the foreground color"
fgColor ~~ aColor ifTrue:[
- fgColor := aColor.
- shown ifTrue:[
- self invalidate
- ]
+ fgColor := aColor.
+ shown ifTrue:[
+ self invalidate
+ ]
]
"Modified: 29.5.1996 / 16:19:02 / cg"
@@ -420,11 +420,11 @@
"set both foreground and background colors"
((fgColor ~~ color1) or:[bgColor ~~ color2]) ifTrue:[
- fgColor := color1.
- bgColor := color2.
- shown ifTrue:[
- self invalidate
- ]
+ fgColor := color1.
+ bgColor := color2.
+ shown ifTrue:[
+ self invalidate
+ ]
]
"Modified: 29.5.1996 / 16:19:05 / cg"
@@ -491,8 +491,8 @@
by which lines are vertically separated."
lineSpacing ~~ pixels ifTrue:[
- lineSpacing := pixels.
- self getFontParameters.
+ lineSpacing := pixels.
+ self getFontParameters.
]
"Modified: 22.5.1996 / 12:22:29 / cg"
@@ -583,12 +583,12 @@
|line|
list notNil ifTrue:[
- line := self listAt:lineNr.
- line notNil ifTrue:[
- (line size >= colNr) ifTrue:[
- ^ line at:colNr
- ]
- ]
+ line := self listAt:lineNr.
+ line notNil ifTrue:[
+ (line size >= colNr) ifTrue:[
+ ^ line at:colNr
+ ]
+ ]
].
^ Character space
@@ -612,9 +612,9 @@
l := something.
l notNil ifTrue:[
- l isString ifTrue:[
- l := l asStringCollection
- ]
+ l isString ifTrue:[
+ l := l asStringCollection
+ ]
].
self list:l
@@ -661,20 +661,20 @@
|oldFirst oldLeft|
(aCollection isNil and:[list isNil]) ifTrue:[
- "no change"
- self scrollToTop.
- self scrollToLeft.
- ^ self
+ "no change"
+ self scrollToTop.
+ self scrollToLeft.
+ ^ self
].
list := aCollection.
list notNil ifTrue:[
- expand ifTrue:[
- self expandTabs
- ] ifFalse:[
- includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
- ].
- includesNonStrings ifTrue:[self getFontParameters].
+ expand ifTrue:[
+ self expandTabs
+ ] ifFalse:[
+ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+ ].
+ includesNonStrings ifTrue:[self getFontParameters].
].
widthOfWidestLine := nil. "/ i.e. unknown
@@ -683,16 +683,16 @@
firstLineShown := 1.
leftOffset := 0.
realized ifTrue:[
- self contentsChanged.
- "
- dont use scroll here to avoid the redraw
- "
- oldFirst ~~ firstLineShown ifTrue:[
- self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
- ].
- shown ifTrue:[
- self redrawFromVisibleLine:1 to:nLinesShown
- ]
+ self contentsChanged.
+ "
+ dont use scroll here to avoid the redraw
+ "
+ oldFirst ~~ firstLineShown ifTrue:[
+ self originChanged:0 @ ((oldFirst - 1) * fontHeight negated).
+ ].
+ shown ifTrue:[
+ self redrawFromVisibleLine:1 to:nLinesShown
+ ]
]
"Modified: 30.8.1995 / 19:07:13 / claus"
@@ -713,20 +713,20 @@
shown ifFalse:[^ self].
visLine := self listLineToVisibleLine:lineNr.
visLine notNil ifTrue:[
- w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
- srcY := topMargin + (visLine * fontHeight).
- self catchExpose.
- self copyFrom:self x:textStartLeft y:srcY
- toX:textStartLeft y:(srcY - fontHeight)
- width:w height:((nLinesShown - visLine) * fontHeight).
- self redrawVisibleLine:nFullLinesShown.
- "
- redraw last partial line - if any
- "
- (nFullLinesShown ~~ nLinesShown) ifTrue:[
- self redrawVisibleLine:nLinesShown
- ].
- self waitForExpose
+ w := self widthForScrollBetween:lineNr and:(firstLineShown + nLinesShown).
+ srcY := topMargin + (visLine * fontHeight).
+ self catchExpose.
+ self copyFrom:self x:textStartLeft y:srcY
+ toX:textStartLeft y:(srcY - fontHeight)
+ width:w height:((nLinesShown - visLine) * fontHeight).
+ self redrawVisibleLine:nFullLinesShown.
+ "
+ redraw last partial line - if any
+ "
+ (nFullLinesShown ~~ nLinesShown) ifTrue:[
+ self redrawVisibleLine:nLinesShown
+ ].
+ self waitForExpose
]
"Modified: 26.4.1996 / 13:44:47 / cg"
@@ -786,40 +786,40 @@
|oldFirst|
(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].
+ expandTabs ifTrue:[
+ self expandTabs
+ ] ifFalse:[
+ includesNonStrings := (list findFirst:[:e | e isString not]) ~~ 0.
+ ].
+ includesNonStrings 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"
@@ -841,23 +841,23 @@
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"
@@ -913,7 +913,7 @@
Can be changed with #menuPerformer:"
menuPerformer notNil ifTrue:[
- ^ menuPerformer
+ ^ menuPerformer
].
^ super menuPerformer
@@ -932,15 +932,15 @@
plug := Plug new.
plug respondTo:#textMenu
- with:[ |m|
- m := PopUpMenu
- labels:#('copy' 'foo' '-' 'others')
- selectors:#(copySelection foo nil others).
- m subMenuAt:#others
- put:(PopUpMenu
- labels:#('bar' 'goto')
- selectors:#(bar gotoLine))
- ].
+ with:[ |m|
+ m := PopUpMenu
+ labels:#('copy' 'foo' '-' 'others')
+ selectors:#(copySelection foo nil others).
+ m subMenuAt:#others
+ put:(PopUpMenu
+ labels:#('bar' 'goto')
+ selectors:#(bar gotoLine))
+ ].
top := StandardSystemView new.
top extent:300@300.
@@ -1022,9 +1022,9 @@
self paint:bg.
self fillRectangleX:margin
- y:y-sH
- width:(width - (margin * 2))
- height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
+ y:y-sH
+ width:(width - (margin * 2))
+ height:(endVisLineNr - startVisLineNr + 1) * fontHeight + (lineSpacing - sH).
list isNil ifTrue:[^ self].
y := y + fontAscent.
@@ -1033,25 +1033,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: 24.2.1996 / 16:41:48 / cg"
@@ -1067,11 +1067,11 @@
y := self yOfVisibleLine:visLineNr.
self paint:bg.
self fillRectangleX:margin y:y - (lineSpacing//2)
- width:(width - (2 * margin))
- height:fontHeight.
+ 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: 28.2.1996 / 14:46:07 / cg"
@@ -1090,8 +1090,8 @@
"/ width:(width - margin - x)
"/ 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: 28.2.1996 / 18:36:33 / cg"
@@ -1116,20 +1116,20 @@
(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.
- self fillRectangleX:x y:yf
- width:(font widthOf:characterString)
- height:fontHeight.
- self paint:fg.
- self displayString:characterString x:x y:(y + fontAscent)
- ]
+ 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.
+ self fillRectangleX:x y:yf
+ width:(font widthOf:characterString)
+ height:fontHeight.
+ self paint:fg.
+ self displayString:characterString x:x y:(y + fontAscent)
+ ]
]
"Modified: 12.5.1996 / 12:47:07 / cg"
@@ -1141,45 +1141,45 @@
|y yf x lineString len characterString w|
(endCol >= startCol) ifTrue:[
- lineString := self visibleAt:visLineNr.
-
- (lineString notNil and:[lineString isString not])
- ifTrue:[
- self drawVisibleLine:visLineNr with:fg and:bg.
- ] ifFalse:[
- x := (self xOfCol:startCol inVisibleLine:visLineNr) - leftOffset.
- y := (self yOfVisibleLine:visLineNr).
- yf := y - (lineSpacing // 2).
- len := lineString size.
- (startCol > len) ifTrue:[
- len := endCol - startCol + 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.
- fontIsFixedWidth ifTrue:[
- w := (endCol - startCol + 1) * fontWidth
- ] ifFalse:[
- (lineString isMemberOf:String) ifTrue:[
- w := font widthOf:lineString from:startCol to:endCol
- ] ifFalse:[
- w := (lineString copyFrom:startCol to:endCol) widthOn:self
- ]
- ].
- self fillRectangleX:x y:yf
- width:w
- height:fontHeight.
- self paint:fg on:bg.
- self displayOpaqueString:lineString from:startCol to:endCol x:x y:(y + fontAscent)
- ]
- ]
+ lineString := self visibleAt:visLineNr.
+
+ (lineString notNil and:[lineString isString not])
+ ifTrue:[
+ self drawVisibleLine:visLineNr with:fg and:bg.
+ ] ifFalse:[
+ x := (self xOfCol:startCol inVisibleLine:visLineNr) - leftOffset.
+ y := (self yOfVisibleLine:visLineNr).
+ yf := y - (lineSpacing // 2).
+ len := lineString size.
+ (startCol > len) ifTrue:[
+ len := endCol - startCol + 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.
+ fontIsFixedWidth ifTrue:[
+ w := (endCol - startCol + 1) * fontWidth
+ ] ifFalse:[
+ (lineString isMemberOf:String) ifTrue:[
+ w := font widthOf:lineString from:startCol to:endCol
+ ] ifFalse:[
+ w := (lineString copyFrom:startCol to:endCol) widthOn:self
+ ]
+ ].
+ self fillRectangleX:x y:yf
+ width:w
+ height:fontHeight.
+ self paint:fg on:bg.
+ self displayOpaqueString:lineString from:startCol to:endCol x:x y:(y + fontAscent)
+ ]
+ ]
]
"Modified: 22.5.1996 / 15:52:35 / cg"
@@ -1191,29 +1191,29 @@
|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.
self paint:bg.
self fillRectangleX:x y:y - (lineSpacing // 2)
- width:(width + leftOffset - x)
- height:fontHeight.
+ 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: 12.5.1996 / 12:47:49 / cg"
@@ -1223,11 +1223,11 @@
"draw a visible line in fg/bg"
self
- drawLine:(self visibleAt:visLineNr)
- atX:(textStartLeft - leftOffset)
- inVisible:visLineNr
- with:fg
- and:bg
+ drawLine:(self visibleAt:visLineNr)
+ atX:(textStartLeft - leftOffset)
+ inVisible:visLineNr
+ with:fg
+ and:bg
"Modified: 28.2.1996 / 19:30:23 / cg"
! !
@@ -1350,12 +1350,12 @@
if we are behond 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: 29.5.1996 / 16:19:23 / cg"
@@ -1417,19 +1417,19 @@
|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.
list isNil ifTrue:[
- self getListFromModel
+ self getListFromModel
]
"Modified: 26.5.1996 / 16:00:07 / cg"
@@ -1507,7 +1507,7 @@
for fix fonts, this is easy ...
"
fontIsFixedWidth ifTrue:[
- ^ (xRel // fontWidth) + 1
+ ^ (xRel // fontWidth) + 1
].
"
@@ -1515,25 +1515,25 @@
"
lineString := self visibleAt:visLineNr.
lineString notNil ifTrue:[
- lineString := lineString asString.
- (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
- linePixelWidth := lineString widthOn:self
- ] ifFalse:[
- linePixelWidth := font widthOf:lineString
- ]
+ lineString := lineString asString.
+ (hasEmphasis := lineString hasChangeOfEmphasis) ifTrue:[
+ linePixelWidth := lineString widthOn:self
+ ] ifFalse:[
+ 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,
@@ -1543,37 +1543,37 @@
(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:[
- (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]
+ (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]
].
^ runCol
@@ -1591,9 +1591,9 @@
nLinesShown := nFullLinesShown.
partialLines ifTrue:[
- ((nLinesShown * fontHeight) < innerHeight) ifTrue:[
- nLinesShown := nLinesShown + 1
- ]
+ ((nLinesShown * fontHeight) < innerHeight) ifTrue:[
+ nLinesShown := nLinesShown + 1
+ ]
]
"Modified: 29.5.1996 / 14:48:43 / cg"
@@ -1612,38 +1612,38 @@
newLine := ''.
aList do:[:line |
- ((line size == 0) or:[line isBlank]) ifTrue:[
- newList add:newLine.
- newLine := ''
- ] ifFalse:[
- special := ((line at:1) == ${) or:[(line includes:$\)].
- special := special or:[(line at:1) == $}].
- special ifFalse:[
- newList add:(newLine , line)
- ] ifTrue:[
- charIndex := 1.
- [charIndex <= line size] whileTrue:[
- char := line at:charIndex.
- ((char == ${ ) or:[char == $} ]) ifTrue:[
- "left-brace: ignore rest of line"
- charIndex := line size + 1
- ] ifFalse:[
- (char == $\) ifTrue:[
- inEscape := true
- ] ifFalse:[
- inEscape ifTrue:[
- (char == Character space) ifTrue:[
- inEscape := false
- ]
- ] ifFalse:[
- newLine := newLine copyWith:char
- ]
- ].
- charIndex := charIndex + 1
- ]
- ]
- ]
- ]
+ ((line size == 0) or:[line isBlank]) ifTrue:[
+ newList add:newLine.
+ newLine := ''
+ ] ifFalse:[
+ special := ((line at:1) == ${) or:[(line includes:$\)].
+ special := special or:[(line at:1) == $}].
+ special ifFalse:[
+ newList add:(newLine , line)
+ ] ifTrue:[
+ charIndex := 1.
+ [charIndex <= line size] whileTrue:[
+ char := line at:charIndex.
+ ((char == ${ ) or:[char == $} ]) ifTrue:[
+ "left-brace: ignore rest of line"
+ charIndex := line size + 1
+ ] ifFalse:[
+ (char == $\) ifTrue:[
+ inEscape := true
+ ] ifFalse:[
+ inEscape ifTrue:[
+ (char == Character space) ifTrue:[
+ inEscape := false
+ ]
+ ] ifFalse:[
+ newLine := newLine copyWith:char
+ ]
+ ].
+ charIndex := charIndex + 1
+ ]
+ ]
+ ]
+ ]
].
^ newList
@@ -1659,10 +1659,10 @@
font := font on:device.
includesNonStrings == true ifTrue:[
- "/ for now, we do not support variable height entries ...
- fontHeight := list first heightOn:self
+ "/ for now, we do not support variable height entries ...
+ fontHeight := list first heightOn:self
] ifFalse:[
- fontHeight := font height. "/ maxHeight.
+ fontHeight := font height. "/ maxHeight.
].
fontHeight := fontHeight + lineSpacing.
fontAscent := font ascent. "/ maxAscent.
@@ -1679,21 +1679,21 @@
|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.
- ].
- text ~~ list ifTrue:[
- self list:text
- ].
- ].
+ msg := listMsg.
+ msg isNil ifTrue:[
+ msg := aspectMsg
+ ].
+
+
+ msg notNil ifTrue:[
+ text := model perform:msg.
+ text notNil ifTrue:[
+ text := text asStringCollection.
+ ].
+ text ~~ list ifTrue:[
+ self list:text
+ ].
+ ].
].
"Modified: 26.4.1996 / 14:09:42 / cg"
@@ -1866,7 +1866,7 @@
entry isNil ifTrue:[^ 0].
entry isString ifTrue:[
- ^ font widthOf:entry
+ ^ font widthOf:entry
].
^ entry widthOn:self
@@ -1918,25 +1918,25 @@
tcol := col - 1.
fontIsFixedWidth ifTrue:[
- ^ (tcol * fontWidth) + textStartLeft
+ ^ (tcol * fontWidth) + textStartLeft
].
line := self visibleAt:visLineNr.
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
@@ -2018,9 +2018,9 @@
lineString := self listAt:lineNr.
lineString notNil ifTrue:[
- indent := lineString leftIndent.
- indent == lineString size ifTrue:[^ 0].
- ^ indent.
+ indent := lineString leftIndent.
+ indent == lineString size ifTrue:[^ 0].
+ ^ indent.
].
^ 0
@@ -2106,42 +2106,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:[
- fontIsFixedWidth ifTrue:[
- max := self lengthOfLongestLine * fontWidth
- ] ifFalse:[
- max := 0.
- list notNil ifTrue:[
- list do:[:line |
- line notNil ifTrue:[
- max := max max:(line widthOn:self)
- ]
- ].
+ 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)
@@ -2396,24 +2396,24 @@
(aListLineNr isNil "or:[shown not]") ifTrue:[^ self].
shown ifFalse:[
- firstLineShown := (aListLineNr - 1) max:1.
- ^ self
+ firstLineShown := (aListLineNr - 1) max:1.
+ ^ self
].
(aListLineNr >= firstLineShown) ifTrue:[
- (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
- ^ self
- ]
+ (aListLineNr < (firstLineShown + nFullLinesShown)) ifTrue:[
+ ^ self
+ ]
].
(aListLineNr < nFullLinesShown) ifTrue:[
- ^ self scrollToLine:1
+ ^ self scrollToLine:1
].
(nFullLinesShown < 3) ifTrue:[
- ^ self scrollToLine:aListLineNr
+ ^ self scrollToLine:aListLineNr
].
bott := self numberOfLines - (nFullLinesShown - 1).
(aListLineNr > bott) ifTrue:[
- ^ self scrollToLine:bott
+ ^ self scrollToLine:bott
].
self scrollToLine:(aListLineNr - (nFullLinesShown // 2) + 1)
@@ -2439,7 +2439,7 @@
nLines := nFullLinesShown.
(firstLineShown + nLines + nFullLinesShown > self size) ifTrue:[
- nLines := self size - firstLineShown - nFullLinesShown + 1
+ nLines := self size - firstLineShown - nFullLinesShown + 1
].
nLines <= 0 ifTrue:[^ self].
@@ -2456,14 +2456,14 @@
|oldOrg|
(firstLineShown == 1) ifFalse:[
- self originWillChange.
- oldOrg := firstLineShown.
- firstLineShown := firstLineShown - nFullLinesShown.
- (firstLineShown < 1) ifTrue:[
- firstLineShown := 1
- ].
- self originChanged:0 @ (firstLineShown - oldOrg * fontHeight).
- self redrawFromVisibleLine:1 to:nLinesShown
+ self originWillChange.
+ oldOrg := firstLineShown.
+ firstLineShown := firstLineShown - nFullLinesShown.
+ (firstLineShown < 1) ifTrue:[
+ firstLineShown := 1
+ ].
+ self originChanged:0 @ (firstLineShown - oldOrg * fontHeight).
+ self redrawFromVisibleLine:1 to:nLinesShown
]
!
@@ -2490,7 +2490,7 @@
count := nLines.
sz := self size.
(firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
- count := sz - firstLineShown - nFullLinesShown + 1
+ count := sz - firstLineShown - nFullLinesShown + 1
].
count <= 0 ifTrue:[^ self].
@@ -2498,46 +2498,46 @@
nPixel := fontHeight * count.
shown ifFalse:[
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
] ifTrue:[
- (count >= nLinesShown) ifTrue:[
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
- self redrawFromVisibleLine:1 to:nLinesShown.
- ] ifFalse:[
- m2 := margin * 2.
- w := self widthForScrollBetween:firstLineShown
- and:(firstLineShown + nLinesShown).
- w := w + leftMargin.
-
- sH := lineSpacing // 2.
- y0 := textStartTop - sH.
- h := nPixel + y0.
- n := height - h + (lineSpacing " //2 ").
-
- y1 := h + n - 1.
- y1 >= (height - margin) ifTrue:[
- partialCopy := true.
- y1 := height - margin - 1
- ].
-
- self catchExpose.
- self copyFrom:self x:margin y:h
- toX:margin y:y0
- width:w height:(y1 - h + 1).
-
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
-
- (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
- self paint:bgColor.
- self fillRectangleX:margin y:(y0 + (y1 - h + 1))
- width:w height:sH.
- ].
- self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
- self waitForExpose.
- ].
+ (count >= nLinesShown) ifTrue:[
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+ self redrawFromVisibleLine:1 to:nLinesShown.
+ ] ifFalse:[
+ m2 := margin * 2.
+ w := self widthForScrollBetween:firstLineShown
+ and:(firstLineShown + nLinesShown).
+ w := w + leftMargin.
+
+ sH := lineSpacing // 2.
+ y0 := textStartTop - sH.
+ h := nPixel + y0.
+ n := height - h + (lineSpacing " //2 ").
+
+ y1 := h + n - 1.
+ y1 >= (height - margin) ifTrue:[
+ partialCopy := true.
+ y1 := height - margin - 1
+ ].
+
+ self catchExpose.
+ self copyFrom:self x:margin y:h
+ toX:margin y:y0
+ width:w height:(y1 - h + 1).
+
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+
+ (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
+ self paint:bgColor.
+ self fillRectangleX:margin y:(y0 + (y1 - h + 1))
+ width:w height:sH.
+ ].
+ self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
+ self waitForExpose.
+ ].
].
self originChanged:(0 @ nPixel).
@@ -2562,7 +2562,7 @@
count := nLines.
sz := self size.
(firstLineShown + nLines + nFullLinesShown > sz) ifTrue:[
- count := sz - firstLineShown - nFullLinesShown + 1
+ count := sz - firstLineShown - nFullLinesShown + 1
].
count <= 0 ifTrue:[^ self].
@@ -2570,46 +2570,46 @@
nPixel := fontHeight * count.
shown ifFalse:[
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
] ifTrue:[
- (count >= nLinesShown) ifTrue:[
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
- self redrawFromVisibleLine:1 to:nLinesShown.
- ] ifFalse:[
- m2 := margin * 2.
- w := self widthForScrollBetween:firstLineShown
- and:(firstLineShown + nLinesShown).
- w := w + leftMargin.
-
- sH := lineSpacing // 2.
- y0 := textStartTop - sH.
- h := nPixel + y0.
- n := height - h + (lineSpacing " //2 ").
-
- y1 := h + n - 1.
- y1 >= (height - margin) ifTrue:[
- partialCopy := true.
- y1 := height - margin - 1
- ].
-
- self catchExpose.
- self copyFrom:self x:margin y:h
- toX:margin y:y0
- width:w height:(y1 - h + 1).
-
- firstLineShown := firstLineShown + count.
- viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
-
- (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
- self paint:bgColor.
- self fillRectangleX:margin y:(y0 + (y1 - h + 1))
- width:w height:sH.
- ].
- self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
- self waitForExpose.
- ].
+ (count >= nLinesShown) ifTrue:[
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+ self redrawFromVisibleLine:1 to:nLinesShown.
+ ] ifFalse:[
+ m2 := margin * 2.
+ w := self widthForScrollBetween:firstLineShown
+ and:(firstLineShown + nLinesShown).
+ w := w + leftMargin.
+
+ sH := lineSpacing // 2.
+ y0 := textStartTop - sH.
+ h := nPixel + y0.
+ n := height - h + (lineSpacing " //2 ").
+
+ y1 := h + n - 1.
+ y1 >= (height - margin) ifTrue:[
+ partialCopy := true.
+ y1 := height - margin - 1
+ ].
+
+ self catchExpose.
+ self copyFrom:self x:margin y:h
+ toX:margin y:y0
+ width:w height:(y1 - h + 1).
+
+ firstLineShown := firstLineShown + count.
+ viewOrigin := viewOrigin x @ (viewOrigin y + nPixel).
+
+ (partialCopy == true and:[lineSpacing ~~ 0]) ifTrue:[
+ self paint:bgColor.
+ self fillRectangleX:margin y:(y0 + (y1 - h + 1))
+ width:w height:sH.
+ ].
+ self redrawFromVisibleLine:(nFullLinesShown - count + 1) to:nLinesShown.
+ self waitForExpose.
+ ].
].
self originChanged:(0 @ nPixel).
@@ -2648,8 +2648,8 @@
newLeftOffset := leftOffset - nPixel.
newLeftOffset <= 0 ifTrue:[
- leftOffset == 0 ifTrue:[^ self].
- newLeftOffset := 0
+ leftOffset == 0 ifTrue:[^ self].
+ newLeftOffset := 0
].
self originWillChange.
@@ -2685,7 +2685,7 @@
"
wMax := self widthOfContents + 10.
(leftOffset + nPixel + width > wMax) ifTrue:[
- cnt := wMax - leftOffset - width
+ cnt := wMax - leftOffset - width
].
" "
cnt <= 0 ifTrue:[^ self].
@@ -2725,38 +2725,38 @@
orgY "{ Class:SmallInteger }" |
transformation isNil ifTrue:[
- orgY := orgX := 0
+ orgY := orgX := 0
] ifFalse:[
- orgY := transformation translation y negated.
- orgX := transformation translation x negated
+ orgY := transformation translation y negated.
+ orgX := transformation translation x negated
].
dX := newOrigin x - orgX.
dY := newOrigin y - orgY.
dX = 0 ifTrue:[
- dY < 0 ifTrue:[
- ^ self scrollUp:(dY negated).
- ].
- dY > 0 ifTrue:[
- ^ self scrollDown:dY.
- ].
- ^ self
+ dY < 0 ifTrue:[
+ ^ self scrollUp:(dY negated).
+ ].
+ dY > 0 ifTrue:[
+ ^ self scrollDown:dY.
+ ].
+ ^ self
].
dY = 0 ifTrue:[
- dX < 0 ifTrue:[
- ^ self scrollLeft:dX negated
- ].
- dX > 0 ifTrue:[
- ^ self scrollRight:dX
- ].
+ dX < 0 ifTrue:[
+ ^ self scrollLeft:dX negated
+ ].
+ dX > 0 ifTrue:[
+ ^ self scrollRight:dX
+ ].
].
self originWillChange.
self setViewOrigin:newOrigin.
shown ifTrue:[
- m2 := margin * 2. "top & bottom margins"
- self redrawDeviceX:margin y:margin
- width:(width - m2)
- height:(height - m2).
+ m2 := margin * 2. "top & bottom margins"
+ self redrawDeviceX:margin y:margin
+ width:(width - m2)
+ height:(height - m2).
].
self originChanged:(dX negated @ dY negated).
@@ -2816,6 +2816,15 @@
]
!
+scrollToPercent:percentOrigin
+ "scroll to a position given in percent of total"
+
+ "kludge - ListView thinks in lines"
+
+ self scrollHorizontalToPercent:percentOrigin x.
+ self scrollVerticalToPercent:percentOrigin y.
+!
+
scrollToTop
"change origin to start of text"
@@ -2840,34 +2849,34 @@
count := nLines.
count >= firstLineShown ifTrue:[
- count := firstLineShown - 1
+ count := firstLineShown - 1
].
(count == 0) ifTrue:[^ self].
self originWillChange.
nPixel := fontHeight * count.
shown ifFalse:[
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
] ifTrue:[
- (count >= nLinesShown) ifTrue:[
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
- self redrawFromVisibleLine:1 to:nLinesShown.
- ] ifFalse:[
- w := self widthForScrollBetween:firstLineShown
- and:(firstLineShown + nLinesShown).
- w := w + leftMargin.
- h := nPixel + margin.
- self catchExpose.
- self copyFrom:self x:margin y:margin
- toX:margin y:h
- width:w height:(height - h).
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
- self redrawFromVisibleLine:1 to:count.
- self waitForExpose.
- ].
+ (count >= nLinesShown) ifTrue:[
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ self redrawFromVisibleLine:1 to:nLinesShown.
+ ] ifFalse:[
+ w := self widthForScrollBetween:firstLineShown
+ and:(firstLineShown + nLinesShown).
+ w := w + leftMargin.
+ h := nPixel + margin.
+ self catchExpose.
+ self copyFrom:self x:margin y:margin
+ toX:margin y:h
+ width:w height:(height - h).
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ self redrawFromVisibleLine:1 to:count.
+ self waitForExpose.
+ ].
].
self originChanged:(0 @ (nPixel negated)).
@@ -2888,34 +2897,34 @@
count := nLines.
count >= firstLineShown ifTrue:[
- count := firstLineShown - 1
+ count := firstLineShown - 1
].
(count == 0) ifTrue:[^ self].
self originWillChange.
nPixel := fontHeight * count.
shown ifFalse:[
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
] ifTrue:[
- (count >= nLinesShown) ifTrue:[
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
- self redrawFromVisibleLine:1 to:nLinesShown.
- ] ifFalse:[
- w := self widthForScrollBetween:firstLineShown
- and:(firstLineShown + nLinesShown).
- w := w + leftMargin.
- h := nPixel + margin.
- self catchExpose.
- self copyFrom:self x:margin y:margin
- toX:margin y:h
- width:w height:(height - h).
- firstLineShown := firstLineShown - count.
- viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
- self redrawFromVisibleLine:1 to:count.
- self waitForExpose.
- ].
+ (count >= nLinesShown) ifTrue:[
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ self redrawFromVisibleLine:1 to:nLinesShown.
+ ] ifFalse:[
+ w := self widthForScrollBetween:firstLineShown
+ and:(firstLineShown + nLinesShown).
+ w := w + leftMargin.
+ h := nPixel + margin.
+ self catchExpose.
+ self copyFrom:self x:margin y:margin
+ toX:margin y:h
+ width:w height:(height - h).
+ firstLineShown := firstLineShown - count.
+ viewOrigin := viewOrigin x @ (viewOrigin y - nPixel).
+ self redrawFromVisibleLine:1 to:count.
+ self waitForExpose.
+ ].
].
self originChanged:(0 @ (nPixel negated)).
@@ -3136,47 +3145,47 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
+ self withCursor:Cursor questionMark do:[
"/ searchPattern := pattern.
- col := startCol - 1.
- firstChar := pattern at:1.
- col > (list at:startLine) size ifTrue:[
- col := -999
- ].
- line1 := startLine.
- line1 to:1 by:-1 do:[:lnr |
- lineString := list at:lnr.
- lineString notNil ifTrue:[
+ col := startCol - 1.
+ firstChar := pattern at:1.
+ 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:[(lineString at:col) ~= firstChar]] whileTrue:[
- col := col - 1
- ].
- [col > 0] whileTrue:[
- cc := col.
- found := true.
- 1 to:patternSize do:[:cnr |
- cc > lineSize ifTrue:[
- found := false
- ] ifFalse:[
- (pattern at:cnr) ~= (lineString at:cc) ifTrue:[
- found := false
- ]
- ].
- cc := cc + 1
- ].
- found ifTrue:[
- ^ block1 value:lnr value:col.
- ].
- col := col - 1.
- [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
- col := col - 1
- ]
- ]
- ].
- col := -999.
- ]
- ]
+ col == -999 ifTrue:[col := lineSize - patternSize + 1].
+ [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
+ col := col - 1
+ ].
+ [col > 0] whileTrue:[
+ cc := col.
+ found := true.
+ 1 to:patternSize do:[:cnr |
+ cc > lineSize ifTrue:[
+ found := false
+ ] ifFalse:[
+ (pattern at:cnr) ~= (lineString at:cc) ifTrue:[
+ found := false
+ ]
+ ].
+ cc := cc + 1
+ ].
+ found ifTrue:[
+ ^ block1 value:lnr value:col.
+ ].
+ col := col - 1.
+ [(col > 0) and:[(lineString at:col) ~= firstChar]] whileTrue:[
+ col := col - 1
+ ]
+ ]
+ ].
+ col := -999.
+ ]
+ ]
].
"not found"
@@ -3197,52 +3206,52 @@
patternSize := pattern size.
(list notNil and:[patternSize ~~ 0]) ifTrue:[
- self withCursor:Cursor questionMark do:[
-
- col := startCol + 1.
- line1 := startLine.
- line2 := list size.
-
- pattern includesMatchCharacters 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) ifTrue:[
- "/ ok, there it is; look at which position
- col := lineString findMatchString:realPattern startingAt:col ignoreCase:false ifAbsent:0.
- col ~~ 0 ifTrue:[
- ^ block1 value:lnr value:col.
- ]
- ].
- ].
- col := 1
- ]
- ] ifFalse:[
- line1 to:line2 do:[:lnr |
- lineString := list at:lnr.
- lineString isString ifTrue:[
- col := lineString findString:pattern 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 includesMatchCharacters 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) ifTrue:[
+ "/ ok, there it is; look at which position
+ col := lineString findMatchString:realPattern startingAt:col ignoreCase:false ifAbsent:0.
+ col ~~ 0 ifTrue:[
+ ^ block1 value:lnr value:col.
+ ]
+ ].
+ ].
+ col := 1
+ ]
+ ] ifFalse:[
+ line1 to:line2 do:[:lnr |
+ lineString := list at:lnr.
+ lineString isString ifTrue:[
+ col := lineString findString:pattern startingAt:col ifAbsent:0.
+ col ~~ 0 ifTrue:[
+ ^ block1 value:lnr value:col.
+ ]
+ ].
+ col := 1
+ ]
+ ].
+ ]
].
"not found"
@@ -3262,20 +3271,20 @@
includesNonStrings := false.
list notNil ifTrue:[
- nLines := self size.
- 1 to:nLines do:[:index |
- line := self at:index.
- line notNil ifTrue:[
- line isString ifTrue:[
- newLine := line withTabsExpanded.
- newLine ~~ line ifTrue:[
- self withoutRedrawAt:index put:newLine
- ].
- ] ifFalse:[
- includesNonStrings := true.
- ]
- ]
- ]
+ nLines := self size.
+ 1 to:nLines do:[:index |
+ line := self at:index.
+ line notNil ifTrue:[
+ line isString ifTrue:[
+ newLine := line withTabsExpanded.
+ newLine ~~ line ifTrue:[
+ self withoutRedrawAt:index put:newLine
+ ].
+ ] ifFalse:[
+ includesNonStrings := true.
+ ]
+ ]
+ ]
]
"Modified: 30.8.1995 / 19:06:37 / claus"
@@ -3365,8 +3374,8 @@
nTabs := 1.
newLine := line copyFrom:9.
[newLine startsWith:eightSpaces] whileTrue:[
- newLine := newLine copyFrom:9.
- nTabs := nTabs + 1.
+ newLine := newLine copyFrom:9.
+ nTabs := nTabs + 1.
].
^ (line species new:nTabs withAll:Character tab) asString , newLine.
@@ -3399,35 +3408,35 @@
tmpString := line species new:currentMax.
dstIndex := 1.
line do:[:character |
- (character == (Character tab)) ifTrue:[
- nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
- [dstIndex < nextTab] whileTrue:[
- tmpString at:dstIndex put:(Character space).
- dstIndex := dstIndex + 1
- ]
- ] ifFalse:[
- tmpString at:dstIndex put:character.
- dstIndex := dstIndex + 1
- ].
- (dstIndex > currentMax) ifTrue:[
- "
- this cannot happen with <= 8 tabs
- "
- currentMax := currentMax + currentMax.
- nString := line species new:currentMax.
- nString replaceFrom:1 to:(dstIndex - 1)
- with:tmpString startingAt:1.
- tmpString := nString.
- nString := nil
- ].
-
- "make stc-optimizer happy
- - no need to return value of ifTrue:/ifFalse above"
- 0
+ (character == (Character tab)) ifTrue:[
+ nextTab := self nextTabAfter:dstIndex in:tabulatorTable.
+ [dstIndex < nextTab] whileTrue:[
+ tmpString at:dstIndex put:(Character space).
+ dstIndex := dstIndex + 1
+ ]
+ ] ifFalse:[
+ tmpString at:dstIndex put:character.
+ dstIndex := dstIndex + 1
+ ].
+ (dstIndex > currentMax) ifTrue:[
+ "
+ this cannot happen with <= 8 tabs
+ "
+ currentMax := currentMax + currentMax.
+ nString := line species new:currentMax.
+ nString replaceFrom:1 to:(dstIndex - 1)
+ with:tmpString startingAt:1.
+ tmpString := nString.
+ nString := nil
+ ].
+
+ "make stc-optimizer happy
+ - no need to return value of ifTrue:/ifFalse above"
+ 0
].
dstIndex := dstIndex - 1.
dstIndex == currentMax ifTrue:[
- ^ tmpString
+ ^ tmpString
].
^ tmpString copyTo:dstIndex
@@ -3445,5 +3454,5 @@
!ListView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.101 1996-08-19 08:25:20 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.102 1996-09-12 13:04:52 cg Exp $'
! !