TextCollector.st
author Claus Gittinger <cg@exept.de>
Mon, 02 Mar 2015 13:15:58 +0100
changeset 5301 3280021411a0
parent 5246 28887183d75f
child 5302 cb9b58fe53e9
permissions -rw-r--r--
class: TextCollector class definition added: #defaultCollectSize: #defaultLineLimit: #defaultTimeDelay: comment/format in: #current #newTranscript: changed: #defaultCollectSize #defaultLineLimit #defaultTimeDelay
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
     1
"{ Encoding: utf8 }"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
5
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    14
"{ Package: 'stx:libwidg' }"
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    15
5246
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
    16
"{ NameSpace: Smalltalk }"
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
EditTextView subclass:#TextCollector
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    19
	instanceVariableNames:'entryStream lineLimit destroyAction outstandingLines
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    20
		outstandingLine flushBlock flushPending inFlush collecting
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
    21
		timeDelay access currentEmphasis alwaysAppendAtEnd collectSize
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
    22
		autoRaise'
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
    23
	classVariableNames:'TranscriptQuerySignal DebugSendersOfMessagePattern
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
    24
		TraceSendersOfMessagePattern TimestampMessage s DefaultLineLimit
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
    25
		DefaultTimeDelay DefaultCollectSize'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    26
	poolDictionaries:''
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    27
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    28
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    29
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    30
!TextCollector class methodsFor:'documentation'!
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    31
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    32
copyright
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    33
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    34
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
    35
	      All Rights Reserved
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    36
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    37
 This software is furnished under a license and may be used
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    38
 only in accordance with the terms of that license and with the
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    40
 be provided or otherwise made available to, or used by, any
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    41
 other person.  No title to or ownership of the software is
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    42
 hereby transferred.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    43
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    44
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    45
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    46
documentation
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    47
"
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    48
    a view for editable text, which also understands some stream messages.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    49
    Instances of this view can take the place of a stream and display the 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    50
    received text.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    51
    Its main use in the system is the Transcript, but it can also be used for
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
    52
    things like trace-windows, errorLogs etc.
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    53
    It is also inherited by TerminalView, which especially uses the buffering and
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    54
    delayed output features for high performance output (compare to a windows console).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    56
    If collecting is turned on, a textcollector will not immediately display 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    57
    entered text, but wait for some short time (timeDelay) and collect incoming 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    58
    data - finally updating the whole chunk in one piece. 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    59
    This helps slow display devices, which would otherwise scroll a lot. 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    60
    (on fast displays this is less of a problem).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    61
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    62
    The total number of lines kept is controlled by lineLimit, if more lines 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    63
    than this limit are added at the bottom, the textcollector will forget lines 
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    64
    at the top. You can set linelimit to nil (i.e. no limit), but you may need a lot 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    65
    of memory then ...
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    66
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    67
    [StyleSheet paramters (transcript only):]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    68
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    69
        transcriptForegroundColor       defaults to textForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    70
        transcriptBackgroundColor'      defaults to textBackgroundColor.
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    71
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    72
        transcriptCursorForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    73
        transcriptCursorBackgroundColor
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    74
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    75
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    76
        Claus Gittinger
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    77
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    78
    [see also:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    79
        CodeView EditTextView
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    80
        ActorStream
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    81
"
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    82
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    84
!TextCollector class methodsFor:'instance creation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    85
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    86
initialize
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    87
    TranscriptQuerySignal := QuerySignal new.
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    88
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    89
!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    90
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    91
newTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    92
    "create and open a new transcript.
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    93
     This is a leftOver method from times were the Launcher & Transcript
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    94
     were two different views. It is no longer recommended."
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
    95
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    96
    ^ self newTranscript:#Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    97
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    98
    "
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    99
     TextCollector newTranscript.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   100
     Transcript lineLimit:3000.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   101
    "
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   102
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   103
    "Modified: 17.2.1997 / 18:20:27 / cg"
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   104
!
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   105
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   106
newTranscript:name
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   107
    "create and open a new transcript, unless one already exists by that name.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   108
     The transcript is remembered in a global by that name.
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   109
     This is a leftOver method from times were the Launcher & Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   110
     were two different views. It is no longer recommended."
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   111
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   112
    |topView transcript defSz f v lines cols|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   113
4476
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   114
    transcript := Smalltalk at:name.
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   115
    (transcript isTextView and:[transcript isOpen and:[transcript device == Screen current]]) ifTrue:[
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   116
        "if there is already an open Transcript on the same device, 
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   117
         do not open an additional one.
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   118
         expecco StandardLibrary <= 2.0.0.3 checked for Transcript>>#isStream and
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   119
         tries to opens a new Transcript window for each new Transcribe with expecco >=2.4"
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   120
        ^ transcript.
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   121
    ].
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   122
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   123
    topView := StandardSystemView label:name "minExtent:(100 @ 100)".
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   124
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   125
    v := HVScrollableView for:self miniScrollerH:true miniScrollerV:false in:topView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   126
    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   127
    transcript := v scrolledView.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   128
    "transcript partialLines:false."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   129
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   130
    f := transcript font.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   131
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   132
    "
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   133
     should add the height of the frame & scrollbars to be exact ...
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   134
    "
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   135
    defSz := self defaultTranscriptSize.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   136
    cols := defSz x.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   137
    lines := defSz y.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   138
    topView extent:(((f widthOf:'x') * cols) @ (f height * lines)).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   139
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   140
    transcript beTranscript:name.
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   141
80
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   142
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   143
     run it at a slightly higher prio, to allow for
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   144
     delayed buffered updates to be performed
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   145
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   146
    topView openWithPriority:(Processor userSchedulingPriority + 1).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   147
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   148
    ^ transcript
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   149
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   150
    "
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   151
     TextCollector newTranscript:#T2.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   152
     T2 showCR:'Hello world'.
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   153
    "
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   154
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   155
    "Modified: 17.2.1997 / 18:20:27 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   156
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   157
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   158
!TextCollector class methodsFor:'Signal constants'!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   159
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   160
transcriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   161
    ^ TranscriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   162
! !
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   163
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   164
!TextCollector class methodsFor:'debugging'!
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   165
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   166
debugSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   167
    ^ DebugSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   168
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   169
    "Created: / 02-02-2012 / 12:05:27 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   170
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   171
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   172
debugSendersOfMessagePattern:aGLOBMatchPattern
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   173
    "ever want to know, who sends a particular text-message to the transcript ?
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   174
     Call this with a match string and get a halt, when a matching text is sent to the transcript"
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   175
4654
a4c05a2b6c29 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4650
diff changeset
   176
    DebugSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   177
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   178
    "
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   179
     self debugSendersOfMessagePattern:'no such*'
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   180
     self debugSendersOfMessagePattern:'remove*'
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   181
     self debugSendersOfMessagePattern:nil.
4284
3e487b994a8b changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
   182
     self debugSendersOfMessagePattern:'*'.
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   183
    "
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   184
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   185
    "Modified: / 02-02-2012 / 12:07:11 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   186
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   187
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   188
timestampMessages
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   189
    ^ TimestampMessages
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   190
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   191
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   192
timestampMessages:aBoolean
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   193
    "if true, all messages are shown with a timestamp in front"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   194
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   195
    TimestampMessages := aBoolean 
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   196
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   197
    "
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   198
     self timestampMessages:true
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   199
     self timestampMessages:false.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   200
    "
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   201
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   202
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   203
traceSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   204
    ^ TraceSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   205
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   206
    "Created: / 02-02-2012 / 12:05:32 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   207
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   208
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   209
traceSendersOfMessagePattern:aGLOBMatchPattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   210
    "ever want to know, who sends a particular text-message to the transcript ?
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   211
     Call this with a match string and get a trace, when a matching text is sent to the transcript"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   212
4654
a4c05a2b6c29 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4650
diff changeset
   213
    TraceSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   214
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   215
    "
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   216
     self traceSendersOfMessagePattern:'removed unreached*'
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   217
     self traceSendersOfMessagePattern:nil.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   218
     self traceSendersOfMessagePattern:'*'.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   219
    "
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   220
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   221
    "Created: / 02-02-2012 / 11:59:22 / cg"
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   222
! !
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   223
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   224
!TextCollector class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   225
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   226
defaultCollectSize
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   227
    "the number of lines buffered for delayed update.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   228
     At most this number of lines to be shown are buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   229
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   230
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   231
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   232
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   233
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   234
     See also defaultTimeDelay"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   235
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   236
    ^ DefaultCollectSize ? 1000
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   237
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   238
    "Modified: / 27.7.1998 / 16:14:51 / cg"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   239
!
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   240
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   241
defaultCollectSize:numberOfLines
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   242
    "the number of lines buffered for delayed update.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   243
     At most this number of lines to be shown are buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   244
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   245
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   246
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   247
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   248
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   249
     See also defaultTimeDelay"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   250
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   251
    DefaultCollectSize := numberOfLines
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   252
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   253
    "Modified: / 27.7.1998 / 16:14:51 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   254
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   255
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   256
defaultLineLimit
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   257
    "the number of lines remembered by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   258
     Only the last n lines are remembered and can be seen by scrolling.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   259
     Older lines are forgotten.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   260
     This limit can be changed by the userPreferences dialog"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   261
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   262
    ^ DefaultLineLimit ? 1000
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   263
!
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   264
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   265
defaultLineLimit:numberOfLines
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   266
    "the number of lines remembered by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   267
     Only the last n lines are remembered and can be seen by scrolling.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   268
     Older lines are forgotten.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   269
     This limit can be changed by the userPreferences dialog"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   270
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   271
    DefaultLineLimit := numberOfLines
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   272
!
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   273
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   274
defaultTimeDelay
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   275
    "the time in seconds to wait & collect by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   276
     At most this number of seconds incoming text is buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   277
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   278
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   279
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   280
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   281
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   282
     The value may be a float (eg. 0.5)
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   283
     See also defaultCollectSize"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   284
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   285
    ^ DefaultTimeDelay ? 0.5 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   286
!
36
641fe12489b2 prevent deadlock on access-semaphore in image-restart
claus
parents: 34
diff changeset
   287
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   288
defaultTimeDelay:seconds
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   289
    "the time in seconds to wait & collect by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   290
     At most this number of seconds incoming text is buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   291
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   292
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   293
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   294
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   295
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   296
     The argument may be a float (eg. 0.5)
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   297
     See also defaultCollectSize"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   298
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   299
    DefaultTimeDelay := seconds 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   300
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   301
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   302
defaultTranscriptSize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   303
    "the number of cols/lines by which the Transcript should come up"
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   304
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   305
    ^ 70@11
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   306
! !
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   307
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   308
!TextCollector methodsFor:'Compatibility-ST80'!
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   309
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   310
deselect
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   311
    self unselect
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   312
!
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   313
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   314
flush
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   315
    self endEntry.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   316
    super flush
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   317
! !
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   318
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   319
!TextCollector methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   320
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   321
autoRaise
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   322
    ^ autoRaise ? false
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   323
!
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   324
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   325
autoRaise:something
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   326
    autoRaise := something.
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   327
!
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   328
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   329
collect:aBoolean
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   330
    "turn on/off collecting - if on, do not output immediately
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   331
     but collect text and output en-bloque after some time delta"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   332
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   333
    collecting := aBoolean
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   334
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   336
collectSize:numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   337
    "set the collect buffer size. If collect is enabled,
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   338
     the receiver will force update of the view, 
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   339
     whenever that many lines have been collected
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   340
     (or the updateTimeDelay interval has passed).
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   341
     With collect turned off, an immediate update is performed."
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   342
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   343
    collectSize := numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   344
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   345
    "Modified: / 27.7.1998 / 16:16:00 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   346
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   347
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   348
destroyAction:aBlock
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   349
    "define the action to be performed when I get destroyed.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   350
     This is a special feature, to allow resetting Transcript to Stderr
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   351
     when closed. (see TextCollectorclass>>newTranscript)"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   352
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   353
    destroyAction := aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   354
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   355
2103
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   356
lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   357
    "return the number of text-lines I am supposed to hold"
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   358
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   359
    ^ lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   360
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   361
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   362
     Transcript lineLimit:5000
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   363
     Transcript lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   364
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   365
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   366
    "Modified: / 16.5.1998 / 01:33:52 / cg"
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   367
!
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   368
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   369
lineLimit:aNumber
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   370
    "define the number of text-lines I am supposed to hold"
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   371
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   372
    lineLimit := aNumber
1611
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   373
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   374
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   375
     Transcript lineLimit:5000
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   376
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   377
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   378
    "Modified: / 16.5.1998 / 01:33:52 / cg"
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   379
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   380
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   381
updateTimeDelay:seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   382
    "if collect is enabled, the receiver will update its view, 
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   383
     after that time delay (i.e. it collects output during that period),
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   384
     or when collectSize lines have been collected without update.
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   385
     With collect turned off, an immediate update is performed."
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   386
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   387
    timeDelay := seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   388
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   389
    "Modified: / 27.7.1998 / 16:16:41 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   390
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   391
3969
a914bce039b7 category of: #exposeX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
   392
!TextCollector methodsFor:'event handling'!
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   393
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   394
exposeX:x y:y width:w height:h
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   395
    "flush buffered text when exposed"
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   396
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   397
    super exposeX:x y:y width:w height:h.
4657
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
   398
    "/ self endEntry
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   399
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   400
2750
94531b6049a3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   401
!TextCollector methodsFor:'initialization & release'!
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   402
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   403
destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   404
    "destroy this view"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   405
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3119
diff changeset
   406
    destroyAction value.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   407
    super destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   408
1714
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   409
    "Modified: / 9.11.1998 / 21:18:17 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   410
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   411
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   412
editMenu
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   413
    "return my popUpMenu; thats the superClasses menu,
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   414
     minus any accept item."
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   415
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   416
    <resource: #programMenu>
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
   417
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   418
    |m idx|
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   419
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   420
    m := super editMenu.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   421
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   422
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   423
     textcollectors do not support #accept
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   424
     remove it from the menu (and the preceeding separating line)
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   425
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   426
    idx := m indexOf:#accept.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   427
    idx ~~ 0 ifTrue:[
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   428
        m remove:idx.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   429
        (m labels at:(idx - 1)) = '-' ifTrue:[
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   430
            m remove:idx - 1
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   431
        ].
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   432
    ].
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   433
    ^ m
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   434
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   435
    "Modified: 3.7.1997 / 13:54:11 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   436
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   437
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   438
initialize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   439
    super initialize.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   440
2164
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   441
    scrollWhenUpdating := #endOfText.
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   442
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   443
    outstandingLines := nil.
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   444
    alwaysAppendAtEnd := true.
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   445
    collectSize := self class defaultCollectSize.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   446
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   447
    flushPending := inFlush := false.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   448
    collecting := true.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   449
    timeDelay := self class defaultTimeDelay.
4965
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
   450
    access := RecursionLock new name:'TextCollector access lock'.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   451
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   452
    lineLimit := self class defaultLineLimit.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   453
    entryStream := ActorStream new.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   454
    entryStream nextPutBlock:[:something | self nextPut:something].
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   455
    entryStream nextPutAllBlock:[:something | self nextPutAll:something]
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   456
2086
95ec18a17198 give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents: 2025
diff changeset
   457
    "Modified: / 14.12.1999 / 21:13:54 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   458
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   459
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   460
mapped
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   461
    "view became visible - show collected lines (if any)"
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   462
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   463
    super mapped.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   464
    self endEntry
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   465
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   466
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   467
reinitialize
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   468
    "reinit after a snapIn.
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   469
     recreate access-semaphore; image could have been save (theoretically)
1467
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   470
     with the semaphore locked - in this case, we had a deadlock"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   471
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   472
    flushPending := inFlush := false.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   473
    access := RecursionLock new. "/ Semaphore forMutualExclusion.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   474
    super reinitialize.
1467
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   475
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   476
    "Modified: / 5.3.1998 / 10:09:14 / stefan"
2591
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   477
!
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   478
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   479
release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   480
    flushBlock notNil ifTrue:[
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   481
        Processor removeTimedBlock:flushBlock.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   482
        flushBlock := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   483
    ].
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   484
    outstandingLines := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   485
    outstandingLine := ''.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   486
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   487
    super release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   488
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   489
    "Modified: / 9.11.1998 / 21:18:17 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   490
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   491
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   492
!TextCollector methodsFor:'private'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   493
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   494
checkLineLimit
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   495
    "this method checks if the text has become too large (> lineLimit)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   496
     and cuts off some lines at the top if so; it must be called whenever lines
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   497
     have been added to the bottom"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   498
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   499
    |nDel newCursorLine|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   500
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   501
    lineLimit notNil ifTrue:[
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   502
        (cursorLine > lineLimit) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   503
            nDel := list size - lineLimit.
4772
f1fb7b8ec64f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4687
diff changeset
   504
            self basicListRemoveFromIndex:1 toIndex:nDel.
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   505
            newCursorLine := cursorLine - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   506
            firstLineShown := firstLineShown - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   507
            (firstLineShown < 1) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   508
                newCursorLine := newCursorLine - firstLineShown + 1.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   509
                firstLineShown := 1
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   510
            ].
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   511
            self setCursorLine:newCursorLine.
3320
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   512
            self contentsChanged.
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   513
            self invalidate.
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   514
        ]
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   515
    ].
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   516
    self autoRaise ifTrue:[
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   517
        self topView 
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   518
            raise;
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   519
            "/ setForegroundWindow;
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   520
            yourself.
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   521
    ].
3320
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   522
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   523
    "Modified: / 26-07-2006 / 16:02:15 / fm"
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   524
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   525
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   526
installDelayedUpdate
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   527
    "arrange for collecting input for some time,
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   528
     and output all buffered strings at once after a while.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   529
     This makes output to the transcript much faster on systems
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   530
     with poor scrolling performance (i.e. dumb vga cards ...)."
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   531
131
claus
parents: 130
diff changeset
   532
    |p|
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   533
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   534
    flushPending ifFalse:[
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   535
        inFlush ifFalse:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   536
            flushPending := true.
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   537
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   538
             we could run under a process, which dies in the meantime;
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   539
             therefore, we have to arrange for the transcript process to
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   540
             be interrupted and do the update.
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   541
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   542
            windowGroup isNil ifTrue:[
4503
08d33a9017e2 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4476
diff changeset
   543
                p := Processor timeoutHandlerProcess
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   544
            ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   545
                p := windowGroup process
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   546
            ].
1221
0c2a4231fc9e Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents: 1109
diff changeset
   547
            (p isNil or:[p isSystemProcess]) ifTrue:[
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   548
                self endEntry
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   549
            ] ifFalse:[
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   550
                flushBlock isNil ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   551
                    flushBlock := [self delayedEndEntry].
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   552
                ].
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   553
                Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay.
3009
7eb1704fa5a6 Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents: 3006
diff changeset
   554
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   555
            p := nil.   "hack: avoid dangling references to p through the home context of flushBlock"
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   556
        ]
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   557
    ]
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   558
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   559
    "Modified: / 17.4.1997 / 13:03:15 / stefan"
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   560
    "Modified: / 9.11.1998 / 14:34:07 / cg"
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   561
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   562
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   563
senderTraceString
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   564
    "generate a sender trace string."
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   565
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   566
    |con|
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   567
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   568
    "/ skip over intermediate contexts
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   569
"/    con := con sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   570
"/    con := thisContext sender sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   571
"/    [ con receiver == self ] whileTrue:[
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   572
"/        con := con sender
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   573
"/    ].     
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   574
    con := DebugView interestingContextFrom:thisContext sender sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   575
    ^ con printString
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   576
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   577
    "Created: / 02-02-2012 / 11:58:17 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   578
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   579
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   580
!TextCollector methodsFor:'queries'!
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   581
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   582
current
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   583
    "return the current (your screen's) transcript.
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   584
     In multiDisplay applications, this need NOT be the main transcript,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   585
     as each display may have its own transcript.
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   586
     But typically, this is the same as Transcript."
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   587
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   588
    |theTranscript app|
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   589
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   590
    theTranscript := TranscriptQuerySignal query.
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   591
    theTranscript isNil ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   592
        app := self topView application class current.
2763
e2fba3262e07 Avoid recursion when getting the Transcript on extra displays
Stefan Vogel <sv@exept.de>
parents: 2750
diff changeset
   593
        (app notNil and:[thisContext isRecursive not]) ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   594
            theTranscript := (app transcript ? Stderr).
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   595
        ] ifFalse:[
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   596
            theTranscript := Stderr.
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   597
        ]
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   598
    ].
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   599
    ^ theTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   600
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   601
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   602
     Transcript current flash
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   603
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   604
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   605
    "Created: / 05-07-1996 / 14:14:34 / cg"
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   606
    "Modified (comment): / 29-08-2013 / 11:04:55 / cg"
4441
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   607
!
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   608
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   609
isStream
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   610
    "if I am the Transcript, I am used as a stream.
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   611
     See #displayOn:"
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   612
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   613
    ^ self == Transcript
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   614
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   615
    "
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   616
        Transcript isStream
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   617
    "
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   618
!
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   619
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   620
isTextCollector
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   621
    ^ true
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   622
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   623
    "
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   624
     Transcript isTextCollector
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   625
    "
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   626
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   627
    "Created: / 29-08-2013 / 11:32:46 / cg"
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   628
! !
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   629
2450
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   630
!TextCollector methodsFor:'scrolling'!
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   631
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   632
makeCursorVisible
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
   633
    (scrollLocked ? false) ifFalse:[
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   634
        access critical:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   635
            super makeCursorVisible
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   636
        ]
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   637
    ]
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   638
!
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   639
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   640
scrollLock:aBoolean
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   641
    aBoolean ifTrue:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   642
        scrollWhenUpdating := #endOfText.
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   643
    ] ifFalse:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   644
        scrollWhenUpdating := nil.
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   645
    ].
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
   646
    scrollLocked := aBoolean.
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   647
!
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   648
2450
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   649
scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   650
    access critical:[
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   651
        super scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   652
    ]
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   653
! !
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   654
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   655
!TextCollector methodsFor:'stream messages'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   656
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   657
addLine:line
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   658
    "append a line to the outstanding lines buffer"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   659
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   660
    access critical:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   661
        outstandingLine size ~~ 0 ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   662
            outstandingLine := outstandingLine , line
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   663
        ] ifFalse:[
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   664
            (TimestampMessages == true and:[self == Transcript]) ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   665
                outstandingLine := Timestamp now printString,' ',line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   666
            ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   667
                outstandingLine := line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   668
            ]
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   669
        ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   670
        "/ self ~~ Transcript ifTrue:['xa' printCR].
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   671
        outstandingLines isNil ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   672
            outstandingLines := OrderedCollection with:outstandingLine
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   673
        ] ifFalse:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   674
            outstandingLines add:outstandingLine.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   675
        ].
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   676
        outstandingLine := ''.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   677
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   678
        collecting ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   679
            flushPending ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   680
                self installDelayedUpdate
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   681
            ] ifTrue:[
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   682
                outstandingLines size > collectSize ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   683
                    self endEntry
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   684
                ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   685
            ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   686
        ] ifFalse:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   687
            self endEntry.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   688
            self cursorReturn.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   689
            self checkLineLimit.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   690
            self cursorToEnd.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   691
        ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   692
    ].
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   693
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   694
    "Created: / 28.7.1998 / 00:31:46 / cg"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   695
    "Modified: / 28.7.1998 / 00:34:58 / cg"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   696
!
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   697
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   698
cr
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   699
    "output a carriage return, finishing the current line"
135
claus
parents: 133
diff changeset
   700
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   701
    access critical:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   702
        |line|
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   703
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   704
        collecting ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   705
            line := outstandingLine.
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   706
            (TimestampMessages == true and:[self == Transcript]) ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   707
                outstandingLine size == 0 ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   708
                    line := Timestamp now printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   709
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   710
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   711
            "/ self ~~ Transcript ifTrue:['xc' printCR].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   712
            outstandingLines isNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   713
                outstandingLines := OrderedCollection with:line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   714
            ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   715
                outstandingLines add:line.
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   716
            ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   717
            outstandingLine := ''.
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   718
            flushPending ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   719
                self installDelayedUpdate
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   720
            ]
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   721
        ] ifFalse:[
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   722
            self cursorReturn.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   723
            self checkLineLimit.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   724
            self cursorToEnd.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   725
        ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   726
    ].
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   727
!
135
claus
parents: 133
diff changeset
   728
4460
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   729
display:someObject
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   730
    "dolphin compatibility"
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   731
5246
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
   732
    "/ someObject printOn:self.
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
   733
    self nextPutAll: someObject asString.
4460
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   734
!
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   735
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   736
doesNotUnderstand:aMessage
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   737
    "this is funny: all message we do not understand, are passed
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   738
     on to the stream which will send the characters via nextPut:
3006
e8a68c8dc2d6 use #sendTo: to send messages
Stefan Vogel <sv@exept.de>
parents: 2928
diff changeset
   739
     This way, we understand all Stream messages - great isn't it!!"
e8a68c8dc2d6 use #sendTo: to send messages
Stefan Vogel <sv@exept.de>
parents: 2928
diff changeset
   740
3243
Claus Gittinger <cg@exept.de>
parents: 3205
diff changeset
   741
    ^ aMessage sendTo:entryStream
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   742
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   743
4311
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   744
ensureCr
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   745
    "if the output position is not already at the beginning of a line,
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   746
     output a carriage return"
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   747
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   748
    |needCR|
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   749
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   750
    collecting ifTrue:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   751
        needCR := outstandingLine notEmptyOrNil
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   752
    ] ifFalse:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   753
        needCR := cursorCol > 0
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   754
    ].
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   755
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   756
    needCR ifTrue:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   757
        self cr.
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   758
    ].
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   759
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   760
    "Created: / 14-09-2011 / 09:01:03 / cg"
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   761
!
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   762
5025
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   763
format:formatSpec with:args
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   764
    ^ entryStream format:formatSpec with:args
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   765
!
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   766
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   767
lineLength
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   768
    "to make a textCollector (somewhat) compatible with printer
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   769
     streams, support the lineLength query"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   770
4918
8fec589c2230 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4772
diff changeset
   771
    ^ width // (gc font width)
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   772
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   773
    "Modified: 11.1.1997 / 14:42:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   774
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   775
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   776
nextPut:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   777
    "append somethings printString to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   778
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   779
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   780
    |txt|
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   781
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   782
    (something isCharacter) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   783
        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   784
            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   785
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   786
    ].
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   787
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   788
    txt := something asString.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   789
    currentEmphasis notNil ifTrue:[
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   790
        txt := txt emphasizeAllWith:currentEmphasis
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   791
    ].
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   792
    self show:txt.
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   793
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   794
"/    flushPending ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   795
"/        self endEntry
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   796
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   797
"/    (something isMemberOf:Character) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   798
"/        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   799
"/            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   800
"/        ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   801
"/        self insertCharAtCursor:something
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   802
"/    ] ifFalse:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   803
"/        self insertStringAtCursor:(something printString).
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   804
"/        self checkLineLimit
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   805
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   806
"/    device flush
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   807
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   808
    "Modified: 11.1.1997 / 14:43:05 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   809
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   810
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   811
nextPutAll:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   812
    "append all of something to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   813
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   814
3958
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   815
    self show:(currentEmphasis notNil 
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   816
                ifTrue:[something emphasizeAllWith:currentEmphasis]
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   817
                ifFalse:[something])
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   818
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   819
    "Modified: 11.1.1997 / 14:43:26 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   820
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   821
5130
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   822
println
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   823
    "for those used to Java/Javascript, a compatibility message.
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   824
     Most useful inside expecco"
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   825
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   826
    self cr
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   827
!
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   828
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   829
println:anObject
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   830
    "for those used to Java/Javascript, a compatibility message.
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   831
     Most useful inside expecco"
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   832
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   833
    self showCR:anObject
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   834
!
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
   835
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   836
show:anObject
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   837
    "insert the argument aString at current cursor position"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   838
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   839
    |printString lines|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   840
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   841
    printString := anObject printString.
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   842
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   843
    (self == Transcript) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   844
        DebugSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   845
            (DebugSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   846
                "disable all with: DebugSendersOfMessagePattern := nil"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   847
                self halt:('Transcript: text matches: "', printString,'"').
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   848
            ].
4122
fb942b02b048 changed:
Stefan Vogel <sv@exept.de>
parents: 4106
diff changeset
   849
        ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   850
        TraceSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   851
            (TraceSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   852
                printString := self senderTraceString,': ',printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   853
            ].
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   854
        ].
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   855
    ].
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   856
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   857
    (printString includes:(Character cr)) ifTrue:[
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   858
        lines := printString asStringCollection.
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   859
        lines keysAndValuesDo:[:nr :line |
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   860
            (nr == lines size 
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   861
            and:[(printString endsWith:(Character cr)) not]) ifTrue:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   862
                "/ the last one.
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   863
                self show:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   864
            ] ifFalse:[
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   865
                self showCR:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   866
            ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   867
        ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   868
        ^ self.
308
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   869
    ].
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   870
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   871
    access critical:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   872
        "/ self ~~ Transcript ifTrue:['xs' printCR].
3295
37cb2b5d579a Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3248
diff changeset
   873
        outstandingLine size ~~ 0 ifTrue:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   874
            outstandingLine := outstandingLine , printString
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   875
        ] ifFalse:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   876
            outstandingLine := printString
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   877
        ].
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   878
        collecting ifTrue:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   879
            flushPending ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   880
                self installDelayedUpdate
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   881
            ] ifTrue:[
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   882
                outstandingLines size > collectSize ifTrue:[
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   883
                    self endEntry
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   884
                ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   885
            ]
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   886
        ] ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   887
            self endEntry
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   888
        ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   889
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   890
4411
24a09ea995e2 changed: #show:
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
   891
    "Modified: / 24-03-2012 / 20:04:10 / cg"
4428
641c1d7198cf comment/format in: #show:
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
   892
    "Modified (format): / 02-06-2012 / 01:54:55 / cg"
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   893
!
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   894
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   895
showCR:anObject
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   896
    "insert the argument aString at current cursor position,
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   897
     and advance to the next line. This is the same as a #show:
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   898
     followed by a #cr."
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   899
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   900
    |printString lines|
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   901
4647
6e4bec2140ab oops oops
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
   902
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject].
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   903
    printString := anObject printString.
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   904
    printString size == 0 ifTrue:[
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   905
        self cr.
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   906
        ^ self.
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   907
    ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   908
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   909
    self == Transcript ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   910
        DebugSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   911
            (DebugSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   912
                "/ to disable this right from inside the debugger, evaluate:
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   913
                "/     DebugSendersOfMessagePattern := nil
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   914
                self halt:('Transcript: text matches: "', printString, '"').
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   915
            ].
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   916
        ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   917
        TraceSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   918
            (TraceSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   919
                printString := self senderTraceString,': ',printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   920
            ].
4122
fb942b02b048 changed:
Stefan Vogel <sv@exept.de>
parents: 4106
diff changeset
   921
        ].
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   922
    ].
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   923
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   924
    (printString includesAny:(String crlf)) ifTrue:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
   925
        lines := printString asStringCollection.
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   926
        lines do:[:line|
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   927
            (line endsWith:Character nl) ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   928
                (line endsWith:(String crlf)) ifTrue:[
4563
8a07934c6a20 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4503
diff changeset
   929
                    self addLine:(line copyButLast:2).
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   930
                ] ifFalse:[
4563
8a07934c6a20 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4503
diff changeset
   931
                    self addLine:(line copyButLast:1).
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   932
                ]
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   933
            ] ifFalse:[
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   934
                (line endsWith:Character return) ifTrue:[
4563
8a07934c6a20 Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents: 4503
diff changeset
   935
                    self addLine:(line copyButLast:1).
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   936
                ] ifFalse:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   937
                    self addLine:line
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   938
                ]
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   939
            ]
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   940
        ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   941
        ^ self.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   942
    ].
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   943
    self addLine:printString
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   944
4410
e164f4c1fda4 changed: #showCR:
Claus Gittinger <cg@exept.de>
parents: 4365
diff changeset
   945
    "Modified: / 24-03-2012 / 20:00:08 / cg"
4073
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   946
!
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   947
4473
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
   948
space
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
   949
    self show:' '
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
   950
!
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
   951
4073
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   952
tab
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   953
    "append a tab-character to the stream.
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   954
     This is only allowed, if the receiver supports writing."
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   955
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
   956
    self nextPut:(Character tab)
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   957
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   958
2746
e7a2aa5e1b92 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
   959
!TextCollector methodsFor:'stream messages-emphasis'!
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   960
2539
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   961
bgColor:aColor
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   962
    aColor isNil ifTrue:[
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   963
        currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   964
    ] ifFalse:[
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   965
        currentEmphasis := Text addEmphasis:(#backgroundColor->aColor) to:currentEmphasis
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   966
    ]
2539
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   967
!
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   968
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   969
bold
3205
934860f51257 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   970
    "switch to bold - followup text sent via show/nextPutAll: will be inserted in
934860f51257 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   971
     a bold font."
934860f51257 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   972
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   973
    currentEmphasis := Text addEmphasis:#bold to:currentEmphasis
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   974
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   975
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   976
color:aColor
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   977
    aColor isNil ifTrue:[
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   978
        currentEmphasis := Text removeEmphasis:#color from:currentEmphasis
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   979
    ] ifFalse:[
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   980
        currentEmphasis := Text addEmphasis:(#color->aColor) to:currentEmphasis
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   981
    ].
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   982
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   983
    "Modified: / 26.3.1999 / 14:29:21 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   984
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   985
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   986
italic
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
   987
    currentEmphasis := Text addEmphasis:#italic to:currentEmphasis
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   988
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   989
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   990
normal
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   991
    currentEmphasis := nil
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   992
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   993
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   994
notBold
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   995
    "switch to non-bold - followup text sent via show/nextPutAll: will be inserted in
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   996
     a non-bold font."
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   997
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   998
    currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
   999
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1000
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1001
notItalic
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1002
    "switch to non-italic - followup text sent via show/nextPutAll: will be inserted in
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1003
     a non-italic font."
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1004
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1005
    currentEmphasis := Text removeEmphasis:#italic from:currentEmphasis
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1006
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1007
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1008
notReverse
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1009
    currentEmphasis := Text removeEmphasis:#color from:currentEmphasis.
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1010
    currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis.
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1011
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1012
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1013
notUnderline
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1014
    currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1015
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1016
    "Created: / 26.3.1999 / 14:27:07 / cg"
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1017
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1018
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1019
reverse
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1020
    currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis.
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1021
    currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis.
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1022
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1023
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1024
underline
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1025
    currentEmphasis := Text addEmphasis:#underline to:currentEmphasis
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1026
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1027
    "Created: / 26.3.1999 / 14:27:07 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1028
! !
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1029
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1030
!TextCollector methodsFor:'transcript specials'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1031
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1032
beTranscript
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1033
    "make the receiver be the systemTranscript; this one
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1034
     is accessable via the global Transcript and gets relevant
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1035
     system messages from various places."
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1036
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1037
    self beTranscript:#Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1038
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1039
    "Modified: / 2.11.1997 / 22:34:47 / cg"
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1040
!
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1041
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1042
beTranscript:name
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1043
    "make the receiver be the systemTranscript; this one
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1044
     is accessable via the global Transcript and gets relevant
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1045
     system messages from various places."
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1046
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1047
    |fg bg cFg cBg|
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1048
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1049
    Smalltalk at:name put:self.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1050
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1051
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1052
     fancy feature: whenever Transcript is closed, reset to StdError
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1053
    "
1421
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1054
    self destroyAction:[
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1055
        self == (Smalltalk at:name) ifTrue:[
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1056
            Smalltalk at:name put:Stderr
1421
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1057
        ]
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1058
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1059
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1060
    "/ user may prefer a special color for this one;
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1061
    "/ look into the style definitions ...
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1062
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1063
    fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1064
    bg := styleSheet colorAt:'transcript.backgroundColor' default:self backgroundColor.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1065
    self foregroundColor:fg backgroundColor:bg.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1066
    self viewBackground:bg.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1067
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1068
    cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1069
    cBg := styleSheet colorAt:'transcript.cursorBackgroundColor' default:fg.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1070
    self cursorForegroundColor:cFg backgroundColor:cBg. 
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1071
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1072
    "self lineLimit:1000. " "or whatever you think makes sense"
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1073
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1074
    "Modified: / 2.11.1997 / 22:34:47 / cg"
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1075
!
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1076
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1077
beginEntry
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1078
    "noop for now, ST80 compatibility"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1079
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1080
    ^ self
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1081
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1082
    "Created: / 4.3.1998 / 11:08:14 / stefan"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1083
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1084
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1085
clear
3119
dcb3db1033e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
  1086
    self endEntry.
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1087
    self contents:nil.
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1088
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1089
    "
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1090
     Transcript clear
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1091
    "
3774
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1092
!
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1093
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1094
delayedEndEntry
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1095
    "flush collected output; displaying all that has been buffered so far"
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1096
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1097
    "/ self ~~ Transcript ifTrue:[ 'de0' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1098
    inFlush ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1099
        "/ self ~~ Transcript ifTrue:[ 'deX' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1100
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1101
    ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1102
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1103
    "/ self ~~ Transcript ifTrue:[ 'de1' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1104
    access owner == Processor activeProcess ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1105
        "/ self ~~ Transcript ifTrue:[ 'de2' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1106
        self installDelayedUpdate.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1107
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1108
    ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1109
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1110
    self endEntry
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1111
!
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1112
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1113
endEntry
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1114
    "flush collected output; displaying all that has been buffered so far"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1115
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1116
    |nLines lines device|
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1117
4965
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1118
    ((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1119
        "/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1120
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1121
    ].
4965
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1122
    shown ifFalse:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1123
        "/ when iconified or not yet shown, keep
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1124
        "/ collecting. But not too much ...
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1125
        outstandingLines size < 300 ifTrue:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1126
            "/ self ~~ Transcript ifTrue:[ 'eC' printCR ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1127
            access critical:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1128
                flushPending ifFalse:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1129
                    self installDelayedUpdate.
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1130
                ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1131
            ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1132
            ^ self
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1133
        ]
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1134
    ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1135
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1136
    device := self graphicsDevice.
4963
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1137
    (device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1138
        "on snapshot load, Transcript may not yet be re-created.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1139
         Write to Stderr then."
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1140
        Stderr notNil ifTrue:[
4963
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1141
            outstandingLines do:[:eachLine|
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1142
                eachLine printOn:Stderr.
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1143
            ].
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1144
            outstandingLines := nil.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1145
            outstandingLine notNil ifTrue:[
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1146
                outstandingLine printOn:Stderr.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1147
                outstandingLine := nil.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1148
            ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1149
            Stderr cr.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1150
        ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1151
        ^ self.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1152
    ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1153
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1154
    "/ self ~~ Transcript ifTrue:[ 'e ' print. 
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1155
    "/    thisContext fullPrintAll.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1156
    "/ ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1157
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1158
"/    access owner == Processor activeProcess ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1159
"/self ~~ Transcript ifTrue:[ 'eI' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1160
"/        self installDelayedUpdate.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1161
"/        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1162
"/    ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1163
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1164
    access critical:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1165
        collecting ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1166
            flushBlock notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1167
                Processor removeTimedBlock:flushBlock.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1168
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1169
"/            flushPending ifFalse:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1170
"/self ~~ Transcript ifTrue:[ 'eP' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1171
"/                ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1172
"/            ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1173
        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1174
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1175
        "/ self ~~ Transcript ifTrue:[ 'e1' printCR ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1176
        inFlush ifFalse:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1177
            "/ self ~~ Transcript ifTrue:[ 'e2' printCR ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1178
            inFlush := true.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1179
            [
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1180
                flushPending := false.
5147
b36c9ea52b1d class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5137
diff changeset
  1181
self withAutoIndent:false do:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1182
                "/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. 
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1183
                "/                             (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1184
                (nLines := outstandingLines size) ~~ 0 ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1185
                    "/ self ~~ Transcript ifTrue:[ 'e4' printCR.].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1186
                    "insert the bunch of lines - if any"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1187
                    lines := outstandingLines.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1188
                    outstandingLines := nil.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1189
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1190
                    "/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1191
                    (nLines ~~ 0) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1192
                        self isInInsertMode ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1193
                            "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1194
                            self insertLines:lines withCR:true.
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1195
                            "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1196
                        ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1197
                            self replaceLines:lines withCR:true
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1198
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1199
                        alwaysAppendAtEnd ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1200
                            self cursorToEnd.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1201
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1202
                        (cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1203
                            scrollLocked ifFalse:[
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1204
                                self withCursorOffDo:[
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1205
                                    self scrollDown:nLines
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1206
                                ]
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1207
                            ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1208
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1209
                    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1210
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1211
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1212
                "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1213
                "and the last partial line - if any"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1214
                outstandingLine size ~~ 0 ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1215
                    self isInInsertMode ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1216
                        self insertStringAtCursor:outstandingLine.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1217
                    ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1218
                        self replaceStringAtCursor:outstandingLine.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1219
                    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1220
                    outstandingLine := ''.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1221
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1222
                self checkLineLimit.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1223
                "/ device flush.
5147
b36c9ea52b1d class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5137
diff changeset
  1224
].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1225
            ] ensure:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1226
                inFlush := false.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1227
            ]
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1228
        ].
4657
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1229
"/        flushPending ifTrue:[
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1230
"/            flushPending := false.
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1231
"/            self installDelayedUpdate
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1232
"/        ]
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1233
    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1234
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1235
    "Modified: / 9.11.1998 / 21:17:56 / cg"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1236
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1237
3774
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1238
flash
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1239
    "make sure everything is visible, before flashing"
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1240
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1241
    self endEntry.
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1242
    super flash.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1243
! !
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1244
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1245
!TextCollector class methodsFor:'documentation'!
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1246
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1247
version
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
  1248
    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
3958
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1249
!
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1250
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1251
version_CVS
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
  1252
    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.141 2015-03-02 12:15:58 cg Exp $'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1253
! !
2632
80c3c7c5cc7a endEntry
penk
parents: 2613
diff changeset
  1254
4503
08d33a9017e2 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4476
diff changeset
  1255
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1256
TextCollector initialize!