TextCollector.st
author Claus Gittinger <cg@exept.de>
Thu, 18 Sep 2003 16:15:08 +0200
changeset 2805 171183735212
parent 2763 e2fba3262e07
child 2831 d2b64aae97e3
permissions -rw-r--r--
handle returns in showCR:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    13
"{ Package: 'stx:libwidg' }"
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    14
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    15
EditTextView subclass:#TextCollector
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    16
	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
    17
		outstandingLine flushBlock flushPending inFlush collecting
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
    18
		timeDelay access currentEmphasis alwaysAppendAtEnd collectSize'
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    19
	classVariableNames:'TranscriptQuerySignal'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    20
	poolDictionaries:''
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    21
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    24
!TextCollector class methodsFor:'documentation'!
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    25
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    26
copyright
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    27
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    28
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
    29
	      All Rights Reserved
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    30
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    31
 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
    32
 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
    33
 inclusion of the above copyright notice.   This software may not
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    34
 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
    35
 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
    36
 hereby transferred.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    37
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    38
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    39
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    40
documentation
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    41
"
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    42
    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
    43
    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
    44
    received text.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    45
    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
    46
    things like trace-windows, errorLogs etc.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    47
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    48
    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
    49
    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
    50
    data - finally updating the whole chunk in one piece. 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    51
    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
    52
    (on fast displays this is less of a problem).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    53
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    54
    The total number of lines kept is controlled by lineLimit, if more lines 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    55
    than this limit are added at the bottom, the textcollector will forget lines 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    56
    at the top. 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    57
    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
    58
    of memory then ...
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    59
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    60
    [StyleSheet paramters (transcript only):]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    61
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    62
        transcriptForegroundColor       defaults to textForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    63
        transcriptBackgroundColor'      defaults to textBackgroundColor.
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    64
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    65
        transcriptCursorForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    66
        transcriptCursorBackgroundColor
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    67
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    68
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    69
        Claus Gittinger
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    70
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    71
    [see also:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    72
        CodeView EditTextView
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    73
        ActorStream
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    74
"
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    75
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    76
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    77
!TextCollector class methodsFor:'instance creation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    78
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    79
initialize
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    80
    TranscriptQuerySignal := QuerySignal new.
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    81
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    82
!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    83
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    84
newTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    85
    "create and open a new transcript.
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    86
     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
    87
     were two different views. It is no longer recommended."
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
    88
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
    89
    |topView transcript defSz f v lines cols|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    90
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
    91
    topView := StandardSystemView label:'Transcript' "minExtent:(100 @ 100)".
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    92
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    93
    v := HVScrollableView for:self miniScrollerH:true miniScrollerV:false in:topView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    94
    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    95
    transcript := v scrolledView.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    96
    "transcript partialLines:false."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    97
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    98
    f := transcript font.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    99
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   100
    "
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   101
     should add the height of the frame & scrollbars to be exact ...
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   102
    "
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   103
    defSz := self defaultTranscriptSize.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   104
    cols := defSz x.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   105
    lines := defSz y.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   106
    topView extent:(((f widthOf:'x') * cols) @ (f height * lines)).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   107
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   108
    transcript beTranscript.
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   109
80
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   110
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   111
     run it at a slightly higher prio, to allow for
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   112
     delayed buffered updates to be performed
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   113
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   114
    topView openWithPriority:(Processor userSchedulingPriority + 1).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   115
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   116
    ^ transcript
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   117
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   118
    "
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   119
     TextCollector newTranscript.
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   120
     Transcript lineLimit:3000.
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   121
    "
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   122
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   123
    "Modified: 17.2.1997 / 18:20:27 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   124
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   125
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   126
!TextCollector class methodsFor:'Signal constants'!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   127
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   128
transcriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   129
    ^ TranscriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   130
! !
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   131
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   132
!TextCollector class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   133
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   134
defaultCollectSize
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   135
    "the number of lines buffered for delayed update"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   136
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   137
    ^ 50
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   138
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   139
    "Modified: / 27.7.1998 / 16:14:51 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   140
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   141
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   142
defaultLineLimit
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   143
    "the number of lines remembered by default"
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   144
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   145
    ^ 600
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   146
!
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   147
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   148
defaultTimeDelay
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   149
    "the time in seconds to wait & collect by default"
36
641fe12489b2 prevent deadlock on access-semaphore in image-restart
claus
parents: 34
diff changeset
   150
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   151
    ^ 0.3 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   152
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   153
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   154
defaultTranscriptSize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   155
    "the number of cols/lines by which the Transcript should come up"
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   156
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   157
    ^ 70@11
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   158
! !
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   159
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   160
!TextCollector methodsFor:'Compatibility-ST80'!
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   161
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   162
deselect
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   163
    self unselect
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   164
!
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   165
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   166
flush
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   167
    self endEntry.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   168
    super flush
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   169
! !
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   170
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   171
!TextCollector methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   172
1467
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   173
beginEntry
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   174
    "noop for now, ST80 compatibility"
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   175
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   176
    ^ self
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   177
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   178
    "Created: / 4.3.1998 / 11:08:14 / stefan"
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   179
!
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   180
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   181
collect:aBoolean
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   182
    "turn on/off collecting - if on, do not output immediately
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   183
     but collect text and output en-bloque after some time delta"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   184
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   185
    collecting := aBoolean
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   186
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   187
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   188
collectSize:numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   189
    "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
   190
     the receiver will force update of the view, 
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   191
     whenever that many lines have been collected
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   192
     (or the updateTimeDelay interval has passed).
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   193
     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
   194
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   195
    collectSize := numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   196
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   197
    "Modified: / 27.7.1998 / 16:16:00 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   198
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   199
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   200
destroyAction:aBlock
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   201
    "define the action to be performed when I get destroyed.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   202
     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
   203
     when closed. (see TextCollectorclass>>newTranscript)"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   204
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   205
    destroyAction := aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   206
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   207
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   208
endEntry
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   209
    "flush collected output; displaying all that has been buffered so far"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   210
36
641fe12489b2 prevent deadlock on access-semaphore in image-restart
claus
parents: 34
diff changeset
   211
    |nLines lines|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   212
133
claus
parents: 131
diff changeset
   213
    shown ifFalse:[
1971
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   214
        "/ when iconified or not yet shown, keep
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   215
        "/ collecting. But not too much ...
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   216
        outstandingLines size < 300 ifTrue:[
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   217
            flushPending ifFalse:[
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   218
                self installDelayedUpdate.
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   219
            ].
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   220
            ^ self
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   221
        ]
133
claus
parents: 131
diff changeset
   222
    ].
1971
cff41b7cfb54 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1900
diff changeset
   223
119
claus
parents: 110
diff changeset
   224
    inFlush ifTrue:[^ self].
1714
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   225
    flushBlock notNil ifTrue:[
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   226
        Processor removeTimedBlock:flushBlock.
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   227
    ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   228
    flushPending ifFalse:[^ self].
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   229
52
e69fade0aa8e mutual exclusion when updating contents
claus
parents: 36
diff changeset
   230
    access critical:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   231
        inFlush := true.
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   232
        [
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   233
            flushPending := false.
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   234
            outstandingLines size ~~ 0 ifTrue:[
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   235
                "insert the bunch of lines - if any"
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   236
                lines := outstandingLines.
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   237
                outstandingLines := nil.
36
641fe12489b2 prevent deadlock on access-semaphore in image-restart
claus
parents: 34
diff changeset
   238
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   239
                nLines := lines size.
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   240
                (nLines ~~ 0) ifTrue:[
1565
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   241
                    insertMode ifTrue:[
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   242
                        self insertLines:lines withCR:true.
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   243
                    ] ifFalse:[
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   244
                        self replaceLines:lines withCR:true
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   245
                    ].
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   246
                    alwaysAppendAtEnd ifTrue:[
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   247
                        self cursorToEnd.
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   248
                    ].
2371
8fa75853dae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2278
diff changeset
   249
                    (cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[
8fa75853dae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2278
diff changeset
   250
                        self withCursorOffDo:[
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   251
                            self scrollDown:nLines
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   252
                        ]
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   253
                    ].
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   254
                ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   255
            ].
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   256
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   257
            "and the last partial line - if any"
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   258
            outstandingLine size > 0 ifTrue:[
1565
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   259
                insertMode ifTrue:[
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   260
                    self insertStringAtCursor:outstandingLine.
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   261
                ] ifFalse:[
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   262
                    self replaceStringAtCursor:outstandingLine.
9109e9848c6f care for insertMode when handling collected text.
Claus Gittinger <cg@exept.de>
parents: 1562
diff changeset
   263
                ].
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   264
                outstandingLine := ''.
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   265
            ].
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   266
            self checkLineLimit.
2632
80c3c7c5cc7a endEntry
penk
parents: 2613
diff changeset
   267
            "/ device flush.
2520
aed8069b4477 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2450
diff changeset
   268
        ] ensure:[
1491
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   269
            inFlush := false.
0445841f7852 care for unwind (clear inFlush flag)
Claus Gittinger <cg@exept.de>
parents: 1489
diff changeset
   270
        ]
119
claus
parents: 110
diff changeset
   271
    ].
claus
parents: 110
diff changeset
   272
    flushPending ifTrue:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   273
        flushPending := false.
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   274
        self installDelayedUpdate
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   275
    ]
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   276
1714
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   277
    "Modified: / 9.11.1998 / 21:17:56 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   278
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   279
2103
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   280
lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   281
    "return the number of text-lines I am supposed to hold"
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   282
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   283
    ^ lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   284
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   285
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   286
     Transcript lineLimit:5000
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   287
     Transcript lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   288
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   289
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   290
    "Modified: / 16.5.1998 / 01:33:52 / cg"
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   291
!
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   292
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   293
lineLimit:aNumber
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   294
    "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
   295
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   296
    lineLimit := aNumber
1611
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   297
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   298
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   299
     Transcript lineLimit:5000
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   300
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   301
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   302
    "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
   303
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   304
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   305
updateTimeDelay:seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   306
    "if collect is enabled, the receiver will update its view, 
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   307
     after that time delay (i.e. it collects more output during that period),
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   308
     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
   309
     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
   310
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   311
    timeDelay := seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   312
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   313
    "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
   314
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   315
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   316
!TextCollector methodsFor:'events'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   317
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   318
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
   319
    "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
   320
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   321
    super 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
   322
    self endEntry
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   323
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   324
2750
94531b6049a3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   325
!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
   326
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   327
destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   328
    "destroy this view"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   329
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   330
    destroyAction notNil ifTrue:[
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   331
        destroyAction value
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   332
    ].
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   333
    super destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   334
1714
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   335
    "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
   336
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   337
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   338
editMenu
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   339
    "return my popUpMenu; thats the superClasses menu,
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   340
     minus any accept item."
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   341
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   342
    <resource: #programMenu>
1109
83d8c0143ef9 commentary
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
   343
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   344
    |m idx|
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   345
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   346
    m := super editMenu.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   347
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   348
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   349
     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
   350
     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
   351
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   352
    idx := m indexOf:#accept.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   353
    idx ~~ 0 ifTrue:[
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   354
        m remove:idx.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   355
        (m labels at:(idx - 1)) = '-' ifTrue:[
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   356
            m remove:idx - 1
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   357
        ].
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   358
    ].
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   359
    ^ m
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   360
1262
d69149b5be1f resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
   361
    "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
   362
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   364
initialize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   365
    super initialize.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   366
2164
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   367
    scrollWhenUpdating := #endOfText.
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   368
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   369
    outstandingLines := nil.
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   370
    alwaysAppendAtEnd := true.
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   371
    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
   372
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   373
    flushPending := inFlush := false.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   374
    collecting := true.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   375
    timeDelay := self class defaultTimeDelay.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   376
    access := RecursionLock new. "/ Semaphore forMutualExclusion.
2086
95ec18a17198 give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents: 2025
diff changeset
   377
    access 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
   378
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   379
    lineLimit := self class defaultLineLimit.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   380
    entryStream := ActorStream new.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   381
    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
   382
    entryStream nextPutAllBlock:[:something | self nextPutAll:something]
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   383
2086
95ec18a17198 give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents: 2025
diff changeset
   384
    "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
   385
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   386
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   387
mapped
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   388
    "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
   389
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   390
    super mapped.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   391
    self endEntry
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   392
!
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
reinitialize
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   395
    "reinit after a snapIn.
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   396
     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
   397
     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
   398
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   399
    flushPending := false.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   400
    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
   401
    super reinitialize.
1467
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   402
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   403
    "Modified: / 5.3.1998 / 10:09:14 / stefan"
2591
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   404
!
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   405
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   406
release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   407
    flushBlock notNil ifTrue:[
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   408
        Processor removeTimedBlock:flushBlock.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   409
        flushBlock := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   410
    ].
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   411
    outstandingLines := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   412
    outstandingLine := ''.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   413
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   414
    super release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   415
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   416
    "Modified: / 9.11.1998 / 21:18:17 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   417
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   418
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   419
!TextCollector methodsFor:'private'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   420
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   421
checkLineLimit
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   422
    "this method checks if the text has become too large (> lineLimit)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   423
     and cuts off some lines at the top if so; it must be called whenever lines
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   424
     have been added to the bottom"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   425
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   426
    |nDel newCursorLine|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   427
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   428
    lineLimit notNil ifTrue:[
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   429
        (cursorLine > lineLimit) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   430
            nDel := list size - lineLimit.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   431
            list removeFromIndex:1 toIndex:nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   432
            newCursorLine := cursorLine - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   433
            firstLineShown := firstLineShown - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   434
            (firstLineShown < 1) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   435
                newCursorLine := newCursorLine - firstLineShown + 1.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   436
                firstLineShown := 1
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   437
            ].
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   438
            self setCursorLine:newCursorLine.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   439
            self contentsChanged
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   440
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   441
    ]
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   442
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   443
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   444
installDelayedUpdate
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   445
    "arrange for collecting input for some time,
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   446
     and output all buffered strings at once after a while.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   447
     This makes output to the transcript much faster on systems
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   448
     with poor scrolling performance (i.e. dumb vga cards ...)."
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   449
131
claus
parents: 130
diff changeset
   450
    |p|
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   451
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   452
    flushPending ifFalse:[
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   453
        flushPending := true.
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   454
        inFlush ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   455
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   456
             we could run under a process, which dies in the meantime;
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   457
             therefore, we have to arrange for the transcript process to
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   458
             be interrupted and do the update.
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   459
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   460
            windowGroup isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   461
                p := Processor activeProcess
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   462
            ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   463
                p := windowGroup process
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   464
            ].
1221
0c2a4231fc9e Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents: 1109
diff changeset
   465
            (p isNil or:[p isSystemProcess]) ifTrue:[
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   466
                self endEntry
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   467
            ] ifFalse:[
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   468
                flushBlock isNil ifTrue:[
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   469
                    flushBlock := [self endEntry].
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   470
                ].
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   471
                Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   472
            ]
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   473
        ]
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   474
    ]
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   475
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   476
    "Modified: / 17.4.1997 / 13:03:15 / stefan"
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   477
    "Modified: / 9.11.1998 / 14:34:07 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   478
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   479
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   480
!TextCollector methodsFor:'queries'!
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   481
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   482
current
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   483
    "return the current (your screens) transcript.
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   484
     In multiDisplay applications, this need NOT be the main transcript.
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   485
     But typically, this is the same as Transcript."
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   486
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   487
    |theTranscript app|
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   488
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   489
    theTranscript := TranscriptQuerySignal query.
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   490
    theTranscript isNil ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   491
        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
   492
        (app notNil and:[thisContext isRecursive not]) ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   493
            theTranscript := (app transcript ? Stderr).
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   494
        ] ifFalse:[
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   495
            theTranscript := Stderr.
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   496
        ]
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   497
    ].
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   498
    ^ theTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   499
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   500
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   501
     Transcript current flash
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   502
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   503
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   504
    "Created: 5.7.1996 / 14:14:34 / cg"
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   505
    "Modified: 5.7.1996 / 14:14:52 / cg"
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   506
! !
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   507
2450
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   508
!TextCollector methodsFor:'scrolling'!
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   509
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   510
scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   511
    access critical:[
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   512
        super scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   513
    ]
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   514
! !
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   515
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   516
!TextCollector methodsFor:'stream messages'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   517
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   518
cr
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   519
    "output a carriage return, finishing the current line"
135
claus
parents: 133
diff changeset
   520
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   521
    access critical:[
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   522
        collecting ifTrue:[
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   523
            outstandingLine notNil ifTrue:[  "/ mhmh - is never nil
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   524
                outstandingLines isNil ifTrue:[
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   525
                    outstandingLines := OrderedCollection with:outstandingLine
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   526
                ] ifFalse:[
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   527
                    outstandingLines add:outstandingLine.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   528
                ]
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   529
            ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   530
            outstandingLine := ''.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   531
        ] ifFalse:[
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   532
            self cursorReturn.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   533
            self checkLineLimit.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   534
            self cursorToEnd.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   535
        ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   536
    ].
135
claus
parents: 133
diff changeset
   537
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   538
    collecting ifTrue:[
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   539
        flushPending ifFalse:[
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   540
            self installDelayedUpdate
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   541
        ]
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   542
    ]
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   543
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   544
    "Modified: 11.1.1997 / 14:39:00 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   545
!
135
claus
parents: 133
diff changeset
   546
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   547
doesNotUnderstand:aMessage
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   548
    "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
   549
     on to the stream which will send the characters via nextPut:
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   550
     This way, we understand all Stream messages - great isn't it !!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   551
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   552
     ^ entryStream perform:(aMessage selector) withArguments:(aMessage arguments)
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   553
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   554
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   555
lineLength
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   556
    "to make a textCollector (somewhat) compatible with printer
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   557
     streams, support the lineLength query"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   558
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   559
    ^ width // (font width)
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   560
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   561
    "Modified: 11.1.1997 / 14:42:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   562
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   563
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   564
nextPut:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   565
    "append somethings printString to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   566
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   567
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   568
    |txt|
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   569
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   570
    (something isCharacter) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   571
        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   572
            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   573
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   574
    ].
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   575
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   576
    txt := something asString.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   577
    currentEmphasis notNil ifTrue:[
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   578
        txt := txt emphasizeAllWith:currentEmphasis
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   579
    ].
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   580
    self show:txt.
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   581
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   582
"/    flushPending ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   583
"/        self endEntry
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   584
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   585
"/    (something isMemberOf:Character) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   586
"/        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   587
"/            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   588
"/        ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   589
"/        self insertCharAtCursor:something
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   590
"/    ] ifFalse:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   591
"/        self insertStringAtCursor:(something printString).
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   592
"/        self checkLineLimit
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   593
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   594
"/    device flush
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   595
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   596
    "Modified: 11.1.1997 / 14:43:05 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   597
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   598
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   599
nextPutAll:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   600
    "append all of something to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   601
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   602
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   603
    currentEmphasis notNil ifTrue:[
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   604
        ^ self show:(something emphasizeAllWith:currentEmphasis)
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   605
    ].
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   606
    ^ self show:something
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   607
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   608
    "Modified: 11.1.1997 / 14:43:26 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   609
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   610
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   611
show:anObject
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   612
    "insert the argument aString at current cursor position"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   613
308
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   614
    |aString lines|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   615
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   616
    aString := anObject printString.
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   617
308
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   618
    (aString includes:(Character cr)) ifTrue:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   619
        lines := aString asStringCollection.
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   620
        lines keysAndValuesDo:[:nr :line |
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   621
            (nr == lines size 
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   622
            and:[(aString endsWith:(Character cr)) not]) ifTrue:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   623
                "/ the last one.
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   624
                self show:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   625
            ] ifFalse:[
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   626
                self showCR:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   627
            ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   628
        ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   629
        ^ self.
308
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   630
    ].
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   631
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   632
    access critical:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   633
        outstandingLine size > 0 ifTrue:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   634
            outstandingLine := outstandingLine , aString
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   635
        ] ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   636
            outstandingLine := aString
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   637
        ].
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   638
        collecting ifTrue:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   639
            flushPending ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   640
                self installDelayedUpdate
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   641
            ] ifTrue:[
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   642
                outstandingLines size > collectSize ifTrue:[
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   643
                    self endEntry
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
   644
                ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   645
            ]
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   646
        ] ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   647
            self endEntry
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
   648
        ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   649
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   650
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   651
    "Modified: / 10.6.1998 / 19:34:25 / cg"
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   652
!
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   653
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   654
showCR:anObject
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   655
    "insert the argument aString at current cursor position,
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   656
     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
   657
     followed by a #cr."
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   658
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   659
    |aString lines|
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   660
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   661
    aString := anObject printString.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   662
    aString size == 0 ifTrue:[
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   663
        self cr.
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   664
        ^ self.
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   665
    ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   666
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   667
    (aString includesAny:(String with:(Character cr) with:(Character return))) ifTrue:[
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   668
        lines := aString asStringCollection.
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
   669
        lines do:[:line|
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   670
            (line endsWith:Character return) ifTrue:[
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   671
                self showCR:(line copyWithoutLast:1).
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   672
            ] ifFalse:[
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   673
                self showCR:line
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   674
            ]
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   675
        ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   676
        ^ self.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   677
    ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   678
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   679
    access critical:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   680
        outstandingLine size > 0 ifTrue:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   681
            outstandingLine := outstandingLine , aString
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   682
        ] ifFalse:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   683
            outstandingLine := aString
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   684
        ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   685
        collecting ifTrue:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   686
            outstandingLines isNil ifTrue:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   687
                outstandingLines := OrderedCollection with:outstandingLine
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   688
            ] ifFalse:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   689
                outstandingLines add:outstandingLine.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   690
            ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   691
            outstandingLine := ''.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   692
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   693
            flushPending ifFalse:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   694
                self installDelayedUpdate
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   695
            ] ifTrue:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   696
                outstandingLines size > collectSize ifTrue:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   697
                    self endEntry
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   698
                ]
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   699
            ]
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   700
        ] ifFalse:[
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   701
            self endEntry.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   702
            self cursorReturn.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   703
            self checkLineLimit.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   704
            self cursorToEnd.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   705
        ]
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   706
    ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   707
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   708
    "Created: / 28.7.1998 / 00:31:46 / cg"
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
   709
    "Modified: / 28.7.1998 / 00:34:58 / cg"
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   710
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   711
2746
e7a2aa5e1b92 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
   712
!TextCollector methodsFor:'stream messages-emphasis'!
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   713
2539
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   714
bgColor:aColor
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   715
    currentEmphasis := #backgroundColor->aColor
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   716
!
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
   717
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   718
bold
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   719
    currentEmphasis := #bold
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   720
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   721
    "Modified: / 26.3.1999 / 14:28:58 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   722
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   723
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   724
color:aColor
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   725
    currentEmphasis := #color->aColor
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   726
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   727
    "Modified: / 26.3.1999 / 14:29:21 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   728
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   729
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   730
italic
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   731
    currentEmphasis := #italic
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   732
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   733
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   734
normal
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   735
    currentEmphasis := nil
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   736
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   737
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   738
reverse
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   739
    currentEmphasis := Array with:#color->bgColor
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   740
                             with:#backgroundColor->fgColor.
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   741
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   742
    "Created: / 20.6.1998 / 20:10:45 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   743
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   744
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   745
underline
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   746
    currentEmphasis := #underline
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   747
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   748
    "Created: / 26.3.1999 / 14:27:07 / cg"
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   749
! !
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
   750
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   751
!TextCollector methodsFor:'transcript specials'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   752
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   753
beTranscript
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   754
    "make the receiver be the systemTranscript; this one
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   755
     is accessable via the global Transcript and gets relevant
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   756
     system messages from various places."
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   757
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   758
    |fg bg cFg cBg|
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   759
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   760
    Smalltalk at:#Transcript put:self.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   761
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   762
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   763
     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
   764
    "
1421
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
   765
    self destroyAction:[
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
   766
        self == (Smalltalk at:#Transcript) ifTrue:[
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
   767
            Smalltalk at:#Transcript put:Stderr
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
   768
        ]
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
   769
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   770
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   771
    "/ user may prefer a special color for this one;
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   772
    "/ look into the style definitions ...
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   773
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   774
    fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   775
    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
   776
    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
   777
    self viewBackground:bg.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   778
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   779
    cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   780
    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
   781
    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
   782
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   783
    "self lineLimit:1000. " "or whatever you think makes sense"
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   784
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
   785
    "Modified: / 2.11.1997 / 22:34:47 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   786
! !
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   787
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   788
!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
   789
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   790
version
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
   791
    ^ '$Header: /cvs/stx/stx/libwidg/TextCollector.st,v 1.80 2003-09-18 14:15:08 cg Exp $'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   792
! !
2632
80c3c7c5cc7a endEntry
penk
parents: 2613
diff changeset
   793
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   794
TextCollector initialize!