--- a/TextColl.st Tue Aug 30 00:54:47 1994 +0200
+++ b/TextColl.st Mon Oct 10 04:03:47 1994 +0100
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -12,8 +12,8 @@
EditTextView subclass:#TextCollector
instanceVariableNames:'entryStream lineLimit destroyAction
- outstandingLines outstandingLine
- flushBlock flushPending collecting timeDelay access'
+ outstandingLines outstandingLine
+ flushBlock flushPending collecting timeDelay access'
classVariableNames:''
poolDictionaries:''
category:'Views-Text'
@@ -21,9 +21,9 @@
TextCollector comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.9 1994-08-23 23:39:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.10 1994-10-10 03:03:08 claus Exp $
'!
!TextCollector class methodsFor:'documentation'!
@@ -31,7 +31,7 @@
copyright
"
COPYRIGHT (c) 1989 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -44,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.9 1994-08-23 23:39:16 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.10 1994-10-10 03:03:08 claus Exp $
"
!
@@ -86,7 +86,7 @@
!TextCollector class methodsFor:'instance creation'!
newTranscript
- |topView transcript f v|
+ |topView transcript f v fg bg cFg cBg|
topView := StandardSystemView label:'Transcript' minExtent:(100 @ 100).
topView icon:(Form fromFile:'SmalltalkX.xbm').
@@ -104,6 +104,14 @@
"fancy feature: whenever Transcript is closed, reset to StdError"
transcript destroyAction:[Smalltalk at:#Transcript put:Stderr].
+ fg := StyleSheet at:'transcriptForegroundColor' default:transcript foregroundColor.
+ bg := StyleSheet at:'transcriptBackgroundColor' default:transcript backgroundColor.
+ transcript foregroundColor:fg backgroundColor:bg.
+
+ cFg := StyleSheet at:'transcriptCursorForegroundColor' default:bg.
+ cBg := StyleSheet at:'transcriptCursorBackgroundColor' default:fg.
+ transcript cursorForegroundColor:cFg backgroundColor:cBg.
+
topView open.
"transcript lineLimit:1000. " "or whatever you think makes sense"
@@ -129,6 +137,24 @@
entryStream nextPutAllBlock:[:something | self nextPutAll:something]
!
+initializeMiddleButtonMenu
+ |idx|
+
+ super initializeMiddleButtonMenu.
+
+ "
+ textcollectors do not support #accept
+ remove it from the menu (and the preceeding separating line)
+ "
+ idx := middleButtonMenu indexOf:#accept.
+ idx ~~ 0 ifTrue:[
+ middleButtonMenu remove:idx.
+ (middleButtonMenu labels at:(idx - 1)) = '-' ifTrue:[
+ middleButtonMenu remove:idx - 1
+ ].
+ ].
+!
+
reinitialize
"recreate access-semaphore; image could have been save (theoretically)
with the semaphore locked - int this case, we had a deadlock"
@@ -147,7 +173,7 @@
destroy
destroyAction notNil ifTrue:[
- destroyAction value
+ destroyAction value
].
Processor removeTimedBlock:flushBlock.
flushBlock := nil.
@@ -187,30 +213,31 @@
shown ifFalse:[^ self].
Processor removeTimedBlock:flushBlock.
- flushPending := false.
+ flushPending ifFalse:[^ self].
access critical:[
- outstandingLines size ~~ 0 ifTrue:[
- "insert the bunch of lines - if any"
- lines := outstandingLines.
- outstandingLines := OrderedCollection new.
+ flushPending := false.
+ outstandingLines size ~~ 0 ifTrue:[
+ "insert the bunch of lines - if any"
+ lines := outstandingLines.
+ outstandingLines := OrderedCollection new.
- nLines := lines size.
- (nLines ~~ 0) ifTrue:[
- self insertLines:lines withCr:true.
- self withCursorOffDo:[
- (cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[
- self scrollDown:nLines
- ]
- ].
- ].
- ].
- "and the last partial line - if any"
- outstandingLine notNil ifTrue:[
- self insertStringAtCursor:outstandingLine.
- outstandingLine := ''.
- ].
- self checkLineLimit
+ nLines := lines size.
+ (nLines ~~ 0) ifTrue:[
+ self insertLines:lines withCr:true.
+ self withCursorOffDo:[
+ (cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[
+ self scrollDown:nLines
+ ]
+ ].
+ ].
+ ].
+ "and the last partial line - if any"
+ outstandingLine notNil ifTrue:[
+ self insertStringAtCursor:outstandingLine.
+ outstandingLine := ''.
+ ].
+ self checkLineLimit
]
! !
@@ -224,17 +251,17 @@
|nDel|
lineLimit notNil ifTrue:[
- (cursorLine > lineLimit) ifTrue:[
- nDel := list size - lineLimit.
- list removeFromIndex:1 toIndex:nDel.
- cursorLine := cursorLine - nDel.
- firstLineShown := firstLineShown - nDel.
- (firstLineShown < 1) ifTrue:[
- cursorLine := cursorLine - firstLineShown + 1.
- firstLineShown := 1
- ].
- self contentsChanged
- ]
+ (cursorLine > lineLimit) ifTrue:[
+ nDel := list size - lineLimit.
+ list removeFromIndex:1 toIndex:nDel.
+ cursorLine := cursorLine - nDel.
+ firstLineShown := firstLineShown - nDel.
+ (firstLineShown < 1) ifTrue:[
+ cursorLine := cursorLine - firstLineShown + 1.
+ firstLineShown := 1
+ ].
+ self contentsChanged
+ ]
]
!
@@ -247,19 +274,19 @@
|wg p|
flushPending ifFalse:[
- flushPending := true.
- "
- we could run under a process, which dies in the meantime;
- therefore, we have to arrange for the transcript process to
- be interrupted and do the update.
- "
- wg := self windowGroup.
- wg isNil ifTrue:[
- p := Processor activeProcess
- ] ifFalse:[
- p := wg process
- ].
- Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay.
+ flushPending := true.
+ "
+ we could run under a process, which dies in the meantime;
+ therefore, we have to arrange for the transcript process to
+ be interrupted and do the update.
+ "
+ wg := self windowGroup.
+ wg isNil ifTrue:[
+ p := Processor activeProcess
+ ] ifFalse:[
+ p := wg process
+ ].
+ Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay.
]
! !
@@ -273,16 +300,16 @@
"this allows TextCollectors to be used Stream-wise"
flushPending ifTrue:[
- self endEntry
+ self endEntry
].
(something isMemberOf:Character) ifTrue:[
- ((something == Character cr) or:[something == Character nl]) ifTrue:[
- ^ self cr
- ].
- self insertCharAtCursor:something
+ ((something == Character cr) or:[something == Character nl]) ifTrue:[
+ ^ self cr
+ ].
+ self insertCharAtCursor:something
] ifFalse:[
- self insertStringAtCursor:(something printString).
- self checkLineLimit
+ self insertStringAtCursor:(something printString).
+ self checkLineLimit
].
device synchronizeOutput
!
@@ -299,20 +326,20 @@
|wasBlocked|
collecting ifTrue:[
- access critical:[
- outstandingLine notNil ifTrue:[
- outstandingLines add:outstandingLine.
- ].
- outstandingLine := ''.
- ].
- flushPending ifFalse:[
- self installDelayedUpdate
- ]
+ access critical:[
+ outstandingLine notNil ifTrue:[
+ outstandingLines add:outstandingLine.
+ ].
+ outstandingLine := ''.
+ ].
+ flushPending ifFalse:[
+ self installDelayedUpdate
+ ]
] ifFalse:[
- access critical:[
- self cursorReturn.
- self checkLineLimit.
- ].
+ access critical:[
+ self cursorReturn.
+ self checkLineLimit.
+ ].
]
!
@@ -323,20 +350,20 @@
aString := anObject printString.
collecting ifTrue:[
- access critical:[
- outstandingLine notNil ifTrue:[
- outstandingLine := outstandingLine , aString
- ] ifFalse:[
- outstandingLine := aString
- ].
- ].
- flushPending ifFalse:[
- self installDelayedUpdate
- ]
+ access critical:[
+ outstandingLine notNil ifTrue:[
+ outstandingLine := outstandingLine , aString
+ ] ifFalse:[
+ outstandingLine := aString
+ ].
+ ].
+ flushPending ifFalse:[
+ self installDelayedUpdate
+ ]
] ifFalse:[
- access critical:[
- self nextPut:aString.
- ].
+ access critical:[
+ self nextPut:aString.
+ ].
]
!