TextCollector.st
author sr
Tue, 11 Jun 2019 11:47:16 +0200
changeset 6604 89a0c07bbba9
parent 6598 90b1f72eeb96
child 6654 18c4d3d8b1ab
permissions -rw-r--r--
#BUGFIX by Stefan Reise fixed recursion when calling #showSelectedFont #updateFamilyList class: FontPanel added: #updateFamilyListAndDoShowSelectedFont: changed: #showSelectedFont #updateFamilyList
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
     1
"{ Encoding: utf8 }"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
5
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    14
"{ Package: 'stx:libwidg' }"
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
    15
5246
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
    16
"{ NameSpace: Smalltalk }"
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
EditTextView subclass:#TextCollector
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    19
	instanceVariableNames:'entryStream lineLimit destroyAction outstandingLines
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    20
		outstandingLine flushBlock flushPending inFlush collecting
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
    21
		timeDelay access currentEmphasis alwaysAppendAtEnd collectSize
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
    22
		autoRaise'
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
    23
	classVariableNames:'TranscriptQuerySignal DebugSendersOfMessagePattern
5455
e151df78df1e #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 5454
diff changeset
    24
		TraceSendersOfMessagePattern TimestampMessages DefaultLineLimit
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
    25
		DefaultTimeDelay DefaultCollectSize'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    26
	poolDictionaries:''
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
    27
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    28
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    29
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    30
!TextCollector class methodsFor:'documentation'!
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    31
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    32
copyright
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    33
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    34
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
    35
	      All Rights Reserved
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    36
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    37
 This software is furnished under a license and may be used
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    38
 only in accordance with the terms of that license and with the
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    40
 be provided or otherwise made available to, or used by, any
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    41
 other person.  No title to or ownership of the software is
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    42
 hereby transferred.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    43
"
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    44
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    45
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    46
documentation
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    47
"
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    48
    a view for editable text, which also understands some stream messages.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    49
    Instances of this view can take the place of a stream and display the 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    50
    received text.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    51
    Its main use in the system is the Transcript, but it can also be used for
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
    52
    things like trace-windows, errorLogs etc.
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    53
    It is also inherited by TerminalView, which especially uses the buffering and
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    54
    delayed output features for high performance output (compare to a windows console).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    56
    If collecting is turned on, a textcollector will not immediately display 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    57
    entered text, but wait for some short time (timeDelay) and collect incoming 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    58
    data - finally updating the whole chunk in one piece. 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    59
    This helps slow display devices, which would otherwise scroll a lot. 
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    60
    (on fast displays this is less of a problem).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    61
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    62
    The total number of lines kept is controlled by lineLimit, if more lines 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    63
    than this limit are added at the bottom, the textcollector will forget lines 
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
    64
    at the top. You can set linelimit to nil (i.e. no limit), but you may need a lot 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
    65
    of memory then ...
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    66
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    67
    [StyleSheet paramters (transcript only):]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    68
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    69
        transcriptForegroundColor       defaults to textForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    70
        transcriptBackgroundColor'      defaults to textBackgroundColor.
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    71
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    72
        transcriptCursorForegroundColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    73
        transcriptCursorBackgroundColor
77
565b052f5277 *** empty log message ***
claus
parents: 63
diff changeset
    74
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    75
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    76
        Claus Gittinger
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    77
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    78
    [see also:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    79
        CodeView EditTextView
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 553
diff changeset
    80
        ActorStream
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    81
"
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
    82
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
    84
!TextCollector class methodsFor:'instance creation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    85
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    86
initialize
5534
a4b0471717d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5486
diff changeset
    87
    TranscriptQuerySignal isNil ifTrue:[
a4b0471717d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5486
diff changeset
    88
        TranscriptQuerySignal := QuerySignal new.
a4b0471717d0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5486
diff changeset
    89
    ]
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    90
!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
    91
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    92
newTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    93
    "create and open a new transcript.
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
    94
     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
    95
     were two different views. It is no longer recommended."
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
    96
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    97
    ^ self newTranscript:#Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    98
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
    99
    "
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   100
     TextCollector newTranscript.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   101
     Transcript lineLimit:3000.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   102
    "
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   103
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   104
    "Modified: 17.2.1997 / 18:20:27 / cg"
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   105
!
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   106
5609
62adb914a9dd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   107
newTranscript:nameSymbol
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   108
    "create and open a new transcript, unless one already exists by that name.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   109
     The transcript is remembered in a global by that name.
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   110
     This is a leftOver method from times were the Launcher & Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   111
     were two different views. It is no longer recommended."
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   112
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   113
    |topView transcript defSz f v lines cols|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   114
5609
62adb914a9dd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   115
    transcript := Smalltalk at:nameSymbol.
4476
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   116
    (transcript isTextView and:[transcript isOpen and:[transcript device == Screen current]]) ifTrue:[
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   117
        "if there is already an open Transcript on the same device, 
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   118
         do not open an additional one.
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   119
         expecco StandardLibrary <= 2.0.0.3 checked for Transcript>>#isStream and
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   120
         tries to opens a new Transcript window for each new Transcribe with expecco >=2.4"
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   121
        ^ transcript.
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   122
    ].
9f306f7859b9 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4473
diff changeset
   123
5609
62adb914a9dd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   124
    topView := StandardSystemView label:nameSymbol "minExtent:(100 @ 100)".
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   125
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   126
    v := HVScrollableView for:self miniScrollerH:true miniScrollerV:false in:topView.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   127
    v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   128
    transcript := v scrolledView.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   129
    "transcript partialLines:false."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   130
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   131
    f := transcript font.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   132
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   133
    "
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   134
     should add the height of the frame & scrollbars to be exact ...
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   135
    "
1900
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   136
    defSz := self defaultTranscriptSize.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   137
    cols := defSz x.
d334ab9d32d5 removed minExtent - let topView decide.
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
   138
    lines := defSz y.
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   139
    topView extent:(((f widthOf:'x') * cols) @ (f height * lines)).
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   140
5609
62adb914a9dd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   141
    transcript beTranscript:nameSymbol.
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   142
80
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   143
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   144
     run it at a slightly higher prio, to allow for
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   145
     delayed buffered updates to be performed
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   146
    "
5a878a1eebf2 *** empty log message ***
claus
parents: 77
diff changeset
   147
    topView openWithPriority:(Processor userSchedulingPriority + 1).
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   148
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   149
    ^ transcript
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   150
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   151
    "
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   152
     TextCollector newTranscript:#T2.
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
   153
     T2 showCR:'Hello world'.
5908
8639f76963d4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5870
diff changeset
   154
     Smalltalk removeKey:#T2
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   155
    "
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   156
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
   157
    "Modified: 17.2.1997 / 18:20:27 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   158
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   159
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   160
!TextCollector class methodsFor:'Signal constants'!
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   161
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   162
transcriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   163
    ^ TranscriptQuerySignal
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   164
! !
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   165
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   166
!TextCollector class methodsFor:'debugging'!
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   167
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   168
debugSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   169
    ^ DebugSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   170
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   171
    "Created: / 02-02-2012 / 12:05:27 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   172
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   173
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   174
debugSendersOfMessagePattern:aGLOBMatchPattern
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   175
    "ever want to know, who sends a particular text-message to the transcript ?
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   176
     Call this with a match string and get a halt, when a matching text is sent to the transcript"
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   177
4654
a4c05a2b6c29 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4650
diff changeset
   178
    DebugSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   179
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   180
    "
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   181
     self debugSendersOfMessagePattern:'no such*'
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   182
     self debugSendersOfMessagePattern:'remove*'
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   183
     self debugSendersOfMessagePattern:nil.
4284
3e487b994a8b changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4233
diff changeset
   184
     self debugSendersOfMessagePattern:'*'.
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   185
    "
4233
ae8979201707 changed: #debugSendersOfMessagePattern:
Claus Gittinger <cg@exept.de>
parents: 4124
diff changeset
   186
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   187
    "Modified: / 02-02-2012 / 12:07:11 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   188
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   189
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   190
timestampMessages
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   191
    ^ TimestampMessages
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   192
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   193
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   194
timestampMessages:aBoolean
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   195
    "if true, all messages are shown with a timestamp in front"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   196
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   197
    TimestampMessages := aBoolean 
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   198
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   199
    "
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   200
     self timestampMessages:true
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   201
     self timestampMessages:false.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   202
    "
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   203
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   204
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   205
traceSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   206
    ^ TraceSendersOfMessagePattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   207
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   208
    "Created: / 02-02-2012 / 12:05:32 / cg"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   209
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   210
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   211
traceSendersOfMessagePattern:aGLOBMatchPattern
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   212
    "ever want to know, who sends a particular text-message to the transcript ?
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   213
     Call this with a match string and get a trace, when a matching text is sent to the transcript"
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   214
4654
a4c05a2b6c29 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4650
diff changeset
   215
    TraceSendersOfMessagePattern := aGLOBMatchPattern asNilIfEmpty
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   216
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   217
    "
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   218
     self traceSendersOfMessagePattern:'removed unreached*'
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   219
     self traceSendersOfMessagePattern:nil.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   220
     self traceSendersOfMessagePattern:'*'.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   221
    "
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   222
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   223
    "Created: / 02-02-2012 / 11:59:22 / cg"
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   224
! !
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   225
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   226
!TextCollector class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   227
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   228
defaultCollectSize
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   229
    "the number of lines buffered for delayed update.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   230
     At most this number of lines to be shown are buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   231
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   232
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   233
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   234
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   235
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   236
     See also defaultTimeDelay"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   237
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   238
    ^ DefaultCollectSize ? 1000
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   239
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   240
    "Modified: / 27.7.1998 / 16:14:51 / cg"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   241
!
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   242
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   243
defaultCollectSize:numberOfLines
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   244
    "the number of lines buffered for delayed update.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   245
     At most this number of lines to be shown are buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   246
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   247
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   248
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   249
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   250
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   251
     See also defaultTimeDelay"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   252
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   253
    DefaultCollectSize := numberOfLines
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   254
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   255
    "Modified: / 27.7.1998 / 16:14:51 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   256
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   257
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   258
defaultLineLimit
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   259
    "the number of lines remembered by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   260
     Only the last n lines are remembered and can be seen by scrolling.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   261
     Older lines are forgotten.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   262
     This limit can be changed by the userPreferences dialog"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   263
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   264
    ^ DefaultLineLimit ? 1000
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   265
!
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   266
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   267
defaultLineLimit:numberOfLines
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   268
    "the number of lines remembered by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   269
     Only the last n lines are remembered and can be seen by scrolling.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   270
     Older lines are forgotten.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   271
     This limit can be changed by the userPreferences dialog"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   272
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   273
    DefaultLineLimit := numberOfLines
59
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   274
!
450ce95a72a4 *** empty log message ***
claus
parents: 52
diff changeset
   275
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   276
defaultTimeDelay
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   277
    "the time in seconds to wait & collect by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   278
     At most this number of seconds incoming text is buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   279
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   280
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   281
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   282
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   283
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   284
     The value may be a float (eg. 0.5)
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   285
     See also defaultCollectSize"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   286
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   287
    ^ DefaultTimeDelay ? 0.5 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   288
!
36
641fe12489b2 prevent deadlock on access-semaphore in image-restart
claus
parents: 34
diff changeset
   289
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   290
defaultTimeDelay:seconds
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   291
    "the time in seconds to wait & collect by default.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   292
     At most this number of seconds incoming text is buffered (without redrawing),
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   293
     before a redraw is done. Thus, if a lot of output is generated fast,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   294
     the redrawing is performed in chunks. 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   295
     This has a significant effect on the performane, 
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   296
     as the view does not have to scroll and redraw for each
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   297
     individual line, but does junp-scrolling instead.
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   298
     The argument may be a float (eg. 0.5)
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   299
     See also defaultCollectSize"
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   300
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   301
    DefaultTimeDelay := seconds 
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   302
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   303
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   304
defaultTranscriptSize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   305
    "the number of cols/lines by which the Transcript should come up"
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   306
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   307
    ^ 70@11
110
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   308
! !
eb59f6e31e84 *** empty log message ***
claus
parents: 97
diff changeset
   309
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   310
!TextCollector methodsFor:'Compatibility-ST80'!
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   311
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   312
deselect
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   313
    self unselect
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   314
!
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   315
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   316
flush
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   317
    self endEntry.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   318
    super flush
1500
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   319
! !
dee7275372f1 checkin from browser
ca
parents: 1491
diff changeset
   320
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   321
!TextCollector methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   322
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   323
autoRaise
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   324
    ^ autoRaise ? false
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   325
!
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   326
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   327
autoRaise:something
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   328
    autoRaise := something.
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   329
!
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   330
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   331
collect:aBoolean
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   332
    "turn on/off collecting - if on, do not output immediately
15
0dbce35d3c69 *** empty log message ***
claus
parents: 7
diff changeset
   333
     but collect text and output en-bloque after some time delta"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   334
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
    collecting := aBoolean
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   336
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   337
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   338
collectSize:numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   339
    "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
   340
     the receiver will force update of the view, 
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   341
     whenever that many lines have been collected
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   342
     (or the updateTimeDelay interval has passed).
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   343
     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
   344
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   345
    collectSize := numberOfLines
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   346
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   347
    "Modified: / 27.7.1998 / 16:16:00 / cg"
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   348
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   349
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   350
destroyAction:aBlock
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   351
    "define the action to be performed when I get destroyed.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   352
     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
   353
     when closed. (see TextCollectorclass>>newTranscript)"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   354
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   355
    destroyAction := aBlock
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   356
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   357
5486
199af728fa7a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5455
diff changeset
   358
entryStream
6529
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   359
    "returns something which is a stream, sending its input to me"
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   360
    
5486
199af728fa7a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5455
diff changeset
   361
    ^ entryStream
6529
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   362
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   363
    "Modified (comment): / 19-02-2019 / 22:37:47 / Claus Gittinger"
5486
199af728fa7a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5455
diff changeset
   364
!
199af728fa7a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5455
diff changeset
   365
2103
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   366
lineLimit
5989
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   367
    "return the number of text-lines I am supposed to hold when collecting.
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   368
     Nil means: unlimited"
2103
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   369
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   370
    ^ lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   371
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   372
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   373
     Transcript lineLimit:5000
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   374
     Transcript lineLimit
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   375
    "
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   376
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   377
    "Modified: / 16.5.1998 / 01:33:52 / cg"
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   378
!
a37a42c39604 getter for lineLimit
Claus Gittinger <cg@exept.de>
parents: 2101
diff changeset
   379
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   380
lineLimit:aNumber
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   381
    "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
   382
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   383
    lineLimit := aNumber
1611
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   384
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   385
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   386
     Transcript lineLimit:5000
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   387
    "
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   388
779762acd916 comment
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
   389
    "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
   390
!
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   391
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   392
updateTimeDelay:seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   393
    "if collect is enabled, the receiver will update its view, 
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   394
     after that time delay (i.e. it collects output during that period),
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   395
     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
   396
     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
   397
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   398
    timeDelay := seconds
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   399
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   400
    "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
   401
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   402
3969
a914bce039b7 category of: #exposeX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
   403
!TextCollector methodsFor:'event handling'!
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   404
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   405
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
   406
    "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
   407
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   408
    super exposeX:x y:y width:w height:h.
4657
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
   409
    "/ self endEntry
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   410
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   411
2750
94531b6049a3 method category rename
Claus Gittinger <cg@exept.de>
parents: 2746
diff changeset
   412
!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
   413
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   414
destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   415
    "destroy this view"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   416
3201
ce84e272c6bb code cleanup
Claus Gittinger <cg@exept.de>
parents: 3119
diff changeset
   417
    destroyAction value.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   418
    super destroy
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   419
1714
706eb5f2bb46 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1711
diff changeset
   420
    "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
   421
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   422
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   423
initialize
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   424
    super initialize.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   425
2164
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   426
    scrollWhenUpdating := #endOfText.
ed46136cb2cf honor scrollWhenUpdating setting
Claus Gittinger <cg@exept.de>
parents: 2103
diff changeset
   427
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   428
    outstandingLines := nil.
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
   429
    alwaysAppendAtEnd := true.
1610
b05a3e405b33 allow change of collectSize and updateTimeDelay.
Claus Gittinger <cg@exept.de>
parents: 1598
diff changeset
   430
    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
   431
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   432
    flushPending := inFlush := false.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   433
    collecting := true.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   434
    timeDelay := self class defaultTimeDelay.
6189
9a6e0c57ca76 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 6172
diff changeset
   435
    access := RecursionLock 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
   436
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   437
    lineLimit := self class defaultLineLimit.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   438
    entryStream := ActorStream new.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   439
    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
   440
    entryStream nextPutAllBlock:[:something | self nextPutAll:something]
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   441
2086
95ec18a17198 give my access sema a name (for the semaphoreMonitor)
Claus Gittinger <cg@exept.de>
parents: 2025
diff changeset
   442
    "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
   443
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   444
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   445
mapped
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   446
    "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
   447
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   448
    super mapped.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   449
    self endEntry
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   450
!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   451
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   452
reinitialize
2259
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   453
    "reinit after a snapIn.
9fddc0e95293 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2164
diff changeset
   454
     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
   455
     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
   456
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   457
    flushPending := inFlush := false.
6189
9a6e0c57ca76 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 6172
diff changeset
   458
    access := RecursionLock 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
   459
    super reinitialize.
1467
5c09bb2dadef Add (dummy fore now) #beginEntry for ST80 compat.
Stefan Vogel <sv@exept.de>
parents: 1421
diff changeset
   460
6108
98afdf25b4e9 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 5989
diff changeset
   461
    "Modified: / 20-02-2017 / 21:29:13 / stefan"
2591
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   462
!
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   463
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   464
release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   465
    flushBlock notNil ifTrue:[
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   466
        Processor removeTimedBlock:flushBlock.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   467
        flushBlock := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   468
    ].
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   469
    outstandingLines := nil.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   470
    outstandingLine := ''.
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   471
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   472
    super release
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   473
e83dff4fd9a3 destroy - release
Claus Gittinger <cg@exept.de>
parents: 2539
diff changeset
   474
    "Modified: / 9.11.1998 / 21:18:17 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   475
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   476
5783
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   477
!TextCollector methodsFor:'menu - actions'!
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   478
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   479
doSetLineLimit
6595
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   480
    |nLines makeDefault newNLines|
5783
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   481
6595
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   482
    makeDefault := false.
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   483
    Dialog withOptoutOption:[makeDefault := true] labelled:'Make this the default for the future' do:[
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   484
        nLines := Dialog requestNumber:'Enter Line Limit:' initialAnswer:lineLimit.
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   485
    ].
5783
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   486
    nLines notNil ifTrue:[
6595
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   487
        newNLines := nLines asInteger max:100.
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   488
        self lineLimit:newNLines.
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   489
        makeDefault ifTrue:[
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   490
            self class defaultLineLimit:newNLines
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   491
        ].
5783
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   492
    ].
6595
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   493
8f1681b6d822 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6588
diff changeset
   494
    "Modified: / 06-06-2019 / 10:21:08 / Claus Gittinger"
5783
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   495
! !
21c8635cd779 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 5733
diff changeset
   496
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   497
!TextCollector methodsFor:'private'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   498
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   499
checkLineLimit
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   500
    "this method checks if the text has become too large (> lineLimit)
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   501
     and cuts off some lines at the top if so; it must be called whenever lines
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   502
     have been added to the bottom"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   503
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   504
    |nDel newCursorLine|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   505
6114
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   506
    list isEmptyOrNil ifTrue:[
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   507
        "no lines"
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   508
        ^ self.
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   509
    ].
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   510
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   511
    lineLimit notNil ifTrue:[
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   512
        (cursorLine > lineLimit) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   513
            nDel := list size - lineLimit.
4772
f1fb7b8ec64f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4687
diff changeset
   514
            self basicListRemoveFromIndex:1 toIndex:nDel.
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   515
            newCursorLine := cursorLine - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   516
            firstLineShown := firstLineShown - nDel.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   517
            (firstLineShown < 1) ifTrue:[
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   518
                newCursorLine := newCursorLine - firstLineShown + 1.
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   519
                firstLineShown := 1
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   520
            ].
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   521
            self setCursorLine:newCursorLine.
3320
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   522
            self contentsChanged.
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   523
            self invalidate.
2426
281067d406c7 eliminated direct write-access to cursorLine
Claus Gittinger <cg@exept.de>
parents: 2371
diff changeset
   524
        ]
3710
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   525
    ].
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   526
    self autoRaise ifTrue:[
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   527
        self topView 
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   528
            raise;
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   529
            "/ setForegroundWindow;
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   530
            yourself.
dcb4cc4118e1 autoraise feature
Claus Gittinger <cg@exept.de>
parents: 3320
diff changeset
   531
    ].
3320
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   532
a820e3101bb6 refresh when removing some lines after hitting linelimit
fm
parents: 3295
diff changeset
   533
    "Modified: / 26-07-2006 / 16:02:15 / fm"
6114
f1a6c00aa715 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 6112
diff changeset
   534
    "Modified: / 02-03-2017 / 12:02:03 / stefan"
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   535
!
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   536
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   537
installDelayedUpdate
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   538
    "arrange for collecting input for some time,
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   539
     and output all buffered strings at once after a while.
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   540
     This makes output to the transcript much faster on systems
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   541
     with poor scrolling performance (i.e. dumb vga cards ...)."
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   542
131
claus
parents: 130
diff changeset
   543
    |p|
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   544
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   545
    flushPending ifFalse:[
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   546
        inFlush ifFalse:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   547
            flushPending := true.
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   548
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   549
             we could run under a process, which dies in the meantime;
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   550
             therefore, we have to arrange for the transcript process to
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   551
             be interrupted and do the update.
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   552
            "
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   553
            windowGroup isNil ifTrue:[
4503
08d33a9017e2 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4476
diff changeset
   554
                p := Processor timeoutHandlerProcess
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   555
            ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   556
                p := windowGroup process
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   557
            ].
1221
0c2a4231fc9e Move #isSystemProcess from ProcessorScheduler to Process.
Stefan Vogel <sv@exept.de>
parents: 1109
diff changeset
   558
            (p isNil or:[p isSystemProcess]) ifTrue:[
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   559
                self endEntry
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   560
            ] ifFalse:[
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   561
                flushBlock isNil ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   562
                    flushBlock := [self delayedEndEntry].
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   563
                ].
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   564
                Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay.
3009
7eb1704fa5a6 Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents: 3006
diff changeset
   565
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   566
            p := nil.   "hack: avoid dangling references to p through the home context of flushBlock"
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   567
        ]
34
c4b386a8cc57 critical-lock; allows show:/showCr: from multiple processes
claus
parents: 22
diff changeset
   568
    ]
553
Claus Gittinger <cg@exept.de>
parents: 363
diff changeset
   569
1711
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   570
    "Modified: / 17.4.1997 / 13:03:15 / stefan"
b9d07088fe74 late assign of flushBlock
Claus Gittinger <cg@exept.de>
parents: 1617
diff changeset
   571
    "Modified: / 9.11.1998 / 14:34:07 / cg"
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   572
!
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   573
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   574
senderTraceString
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   575
    "generate a sender trace string."
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   576
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   577
    |con|
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   578
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   579
    "/ skip over intermediate contexts
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   580
"/    con := con sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   581
"/    con := thisContext sender sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   582
"/    [ con receiver == self ] whileTrue:[
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   583
"/        con := con sender
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   584
"/    ].     
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   585
    con := DebugView interestingContextFrom:thisContext sender sender.
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   586
    ^ con printString
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   587
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
   588
    "Created: / 02-02-2012 / 11:58:17 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   589
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   590
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   591
!TextCollector methodsFor:'queries'!
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   592
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   593
current
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   594
    "return the current (your screen's) transcript.
5301
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   595
     In multiDisplay applications, this need NOT be the main transcript,
3280021411a0 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5246
diff changeset
   596
     as each display may have its own transcript.
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   597
     But typically, this is the same as Transcript."
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   598
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   599
    |theTranscript app|
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   600
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   601
    theTranscript := TranscriptQuerySignal query.
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   602
    theTranscript isNil ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   603
        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
   604
        (app notNil and:[thisContext isRecursive not]) ifTrue:[
2278
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   605
            theTranscript := (app transcript ? Stderr).
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   606
        ] ifFalse:[
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   607
            theTranscript := Stderr.
790f43792165 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2259
diff changeset
   608
        ]
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   609
    ].
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
   610
    ^ theTranscript
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   611
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   612
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   613
     Transcript current flash
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   614
    "
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   615
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   616
    "Created: / 05-07-1996 / 14:14:34 / cg"
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   617
    "Modified (comment): / 29-08-2013 / 11:04:55 / cg"
4441
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   618
!
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   619
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   620
isStream
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   621
    "if I am the Transcript, I am used as a stream.
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   622
     See #displayOn:"
6529
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   623
    "If you need a real stream, use entryStream" 
4441
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   624
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   625
    ^ self == Transcript
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   626
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   627
    "
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   628
        Transcript isStream
fb138fb5cf04 #isStream answers true for Transcript
Stefan Vogel <sv@exept.de>
parents: 4428
diff changeset
   629
    "
6529
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   630
04bde4803d96 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6341
diff changeset
   631
    "Modified (comment): / 19-02-2019 / 22:38:17 / Claus Gittinger"
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   632
!
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   633
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   634
isTextCollector
6530
0f36967c3663 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6529
diff changeset
   635
    "true, iff this is a text collector emulating a stream"
0f36967c3663 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6529
diff changeset
   636
4687
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   637
    ^ true
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   638
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   639
    "
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   640
     Transcript isTextCollector
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   641
    "
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   642
2ab92c301044 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   643
    "Created: / 29-08-2013 / 11:32:46 / cg"
6530
0f36967c3663 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6529
diff changeset
   644
    "Modified (comment): / 19-02-2019 / 22:48:40 / Claus Gittinger"
5330
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   645
!
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   646
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   647
position
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   648
    "for compatibiliy with normal streams; return the column"
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   649
3f12e0166192 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5320
diff changeset
   650
    ^ cursorCol
5989
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   651
!
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   652
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   653
showLineLimitInMenu
684cbdafbb46 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5930
diff changeset
   654
    ^ true.
778
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   655
! !
3a8fabcf1872 added #current (for: Transcript current)
Claus Gittinger <cg@exept.de>
parents: 656
diff changeset
   656
2450
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   657
!TextCollector methodsFor:'scrolling'!
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   658
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   659
makeCursorVisible
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
   660
    (scrollLocked ? false) ifFalse:[
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   661
        access critical:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   662
            super makeCursorVisible
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   663
        ]
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   664
    ]
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   665
!
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   666
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   667
scrollLock:aBoolean
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   668
    aBoolean ifTrue:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   669
        scrollWhenUpdating := #endOfText.
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   670
    ] ifFalse:[
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   671
        scrollWhenUpdating := nil.
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   672
    ].
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
   673
    scrollLocked := aBoolean.
5136
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   674
!
cabf8c8c7daa class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5130
diff changeset
   675
2450
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   676
scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   677
    access critical:[
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   678
        super scrollTo:anOrigin redraw:doRedraw
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   679
    ]
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   680
! !
4330a66d0b46 lock while scrolling
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
   681
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   682
!TextCollector methodsFor:'stream messages'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   683
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   684
addLine:line
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   685
    "append a line to the outstanding lines buffer"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   686
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   687
    access critical:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   688
        outstandingLine size ~~ 0 ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   689
            outstandingLine := outstandingLine , line
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   690
        ] ifFalse:[
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   691
            (TimestampMessages == true and:[self == Transcript]) ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   692
                outstandingLine := Timestamp now printString,' ',line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   693
            ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   694
                outstandingLine := line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   695
            ]
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   696
        ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   697
        "/ self ~~ Transcript ifTrue:['xa' printCR].
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   698
        outstandingLines isNil ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   699
            outstandingLines := OrderedCollection with:outstandingLine
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   700
        ] ifFalse:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   701
            outstandingLines add:outstandingLine.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   702
        ].
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   703
        outstandingLine := ''.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   704
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   705
        collecting ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   706
            flushPending ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   707
                self installDelayedUpdate
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   708
            ] ifTrue:[
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   709
                outstandingLines size > collectSize ifTrue:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   710
                    self endEntry
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   711
                ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   712
            ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   713
        ] ifFalse:[
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   714
            self endEntry.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   715
            self cursorReturn.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   716
            self checkLineLimit.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   717
            self cursorToEnd.
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   718
        ]
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   719
    ].
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   720
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   721
    "Created: / 28.7.1998 / 00:31:46 / cg"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   722
    "Modified: / 28.7.1998 / 00:34:58 / cg"
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   723
!
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
   724
6558
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   725
binary:beBinaryBool
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   726
    "ExternalStream protocol compatibility"
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   727
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   728
    ^ false         "/ no-op, I am not in binary mode
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   729
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   730
    "Created: / 13-03-2019 / 19:12:48 / Stefan Vogel"
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   731
!
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   732
6560
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   733
bufferSizeForBulkCopy
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   734
    ^ 1024
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   735
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   736
    "Created: / 14-03-2019 / 00:21:49 / Claus Gittinger"
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   737
!
5f15089eb908 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6558
diff changeset
   738
6558
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   739
buffered:aBoolean
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   740
    "ignored here"
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   741
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   742
    ^ false     "/ pretend, that I am not buffered
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   743
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   744
    "Created: / 13-03-2019 / 18:30:29 / Stefan Vogel"
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   745
    "Modified: / 13-03-2019 / 19:34:41 / Stefan Vogel"
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   746
!
9eae61ec2215 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 6530
diff changeset
   747
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   748
cr
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   749
    "output a carriage return, finishing the current line"
135
claus
parents: 133
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
    access critical:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   752
        |line|
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   753
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   754
        collecting ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   755
            line := outstandingLine.
4645
1d10aaa9dc7b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
   756
            (TimestampMessages == true and:[self == Transcript]) ifTrue:[
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   757
                outstandingLine size == 0 ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   758
                    line := Timestamp now printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   759
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   760
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
   761
            "/ self ~~ Transcript ifTrue:['xc' printCR].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   762
            outstandingLines isNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   763
                outstandingLines := OrderedCollection with:line
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   764
            ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   765
                outstandingLines add:line.
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   766
            ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   767
            outstandingLine := ''.
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   768
            flushPending ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   769
                self installDelayedUpdate
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   770
            ]
834
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   771
        ] ifFalse:[
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   772
            self cursorReturn.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   773
            self checkLineLimit.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   774
            self cursorToEnd.
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   775
        ].
0da7c9923d1b prevent scheduler from being suspended
Claus Gittinger <cg@exept.de>
parents: 778
diff changeset
   776
    ].
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   777
!
135
claus
parents: 133
diff changeset
   778
4460
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   779
display:someObject
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   780
    "dolphin compatibility"
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   781
5246
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
   782
    "/ someObject printOn:self.
28887183d75f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5147
diff changeset
   783
    self nextPutAll: someObject asString.
4460
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   784
!
0e9e64b56b14 added: #display:
Stefan Vogel <sv@exept.de>
parents: 4441
diff changeset
   785
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   786
doesNotUnderstand:aMessage
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   787
    "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
   788
     on to the stream which will send the characters via nextPut:
3006
e8a68c8dc2d6 use #sendTo: to send messages
Stefan Vogel <sv@exept.de>
parents: 2928
diff changeset
   789
     This way, we understand all Stream messages - great isn't it!!"
e8a68c8dc2d6 use #sendTo: to send messages
Stefan Vogel <sv@exept.de>
parents: 2928
diff changeset
   790
3243
Claus Gittinger <cg@exept.de>
parents: 3205
diff changeset
   791
    ^ aMessage sendTo:entryStream
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
   792
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   793
4311
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   794
ensureCr
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   795
    "if the output position is not already at the beginning of a line,
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   796
     output a carriage return"
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   797
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   798
    |needCR|
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   799
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   800
    collecting ifTrue:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   801
        needCR := outstandingLine notEmptyOrNil
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   802
    ] ifFalse:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   803
        needCR := cursorCol > 0
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   804
    ].
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   805
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   806
    needCR ifTrue:[
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   807
        self cr.
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   808
    ].
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   809
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   810
    "Created: / 14-09-2011 / 09:01:03 / cg"
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   811
!
70485d4f05c5 added: #ensureCr
Claus Gittinger <cg@exept.de>
parents: 4284
diff changeset
   812
5025
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   813
format:formatSpec with:args
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   814
    "convenient formatted printing:
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   815
        %1..%9  - positional parameters from args-collection
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   816
        %(name) - named parameter from args-dictionary
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   817
        %%      - escape for %
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   818
        %<cr>   - cr (also tab, nl)"
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   819
5025
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   820
    ^ entryStream format:formatSpec with:args
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   821
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   822
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   823
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   824
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   825
            format:'[%1] Hello %2 World - this is %3%<cr>' 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   826
            with:{i . 'my' . 'nice'}
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   827
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   828
    "
5025
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   829
!
8db08f1414fb class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4965
diff changeset
   830
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   831
lineLength
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   832
    "to make a textCollector (somewhat) compatible with printer
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   833
     streams, support the lineLength query"
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   834
4918
8fec589c2230 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4772
diff changeset
   835
    ^ width // (gc font width)
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   836
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   837
    "Modified: 11.1.1997 / 14:42:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   838
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   839
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   840
nextPut:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   841
    "append somethings printString to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   842
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   843
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   844
    |txt|
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   845
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   846
    (something isCharacter) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   847
        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   848
            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   849
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   850
    ].
1504
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   851
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   852
    txt := something asString.
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   853
    currentEmphasis notNil ifTrue:[
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   854
        txt := txt emphasizeAllWith:currentEmphasis
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   855
    ].
3101f410e230 rudimentary support for (some) emphasis messages
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
   856
    self show:txt.
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   857
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   858
"/    flushPending ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   859
"/        self endEntry
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   860
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   861
"/    (something isMemberOf:Character) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   862
"/        ((something == Character cr) or:[something == Character nl]) ifTrue:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   863
"/            ^ self cr
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   864
"/        ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   865
"/        self insertCharAtCursor:something
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   866
"/    ] ifFalse:[
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   867
"/        self insertStringAtCursor:(something printString).
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   868
"/        self checkLineLimit
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   869
"/    ].
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   870
"/    device flush
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   871
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   872
    "Modified: 11.1.1997 / 14:43:05 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   873
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   874
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   875
nextPutAll:something
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   876
    "append all of something to my displayed text.
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   877
     This allows TextCollectors to be used Stream-wise"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   878
3958
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   879
    self show:(currentEmphasis notNil 
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   880
                ifTrue:[something emphasizeAllWith:currentEmphasis]
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   881
                ifFalse:[something])
656
2fb1c683d3f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 653
diff changeset
   882
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   883
    "Modified: 11.1.1997 / 14:43:26 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   884
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   885
5320
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   886
nextPutAll:count from:buffer startingAt:initialPosition
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   887
    "append count characters from buffer starting at initialPosition to my displayed text.
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   888
     This allows TextCollectors to be used Stream-wise"
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   889
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   890
    |stringToShow|
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   891
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   892
    stringToShow := buffer copyFrom:initialPosition to:initialPosition+count-1.
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   893
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   894
    self show:(currentEmphasis notNil 
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   895
                ifTrue:[stringToShow emphasizeAllWith:currentEmphasis]
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   896
                ifFalse:[stringToShow]).
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   897
    ^ count.
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   898
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   899
    "Modified: 11.1.1997 / 14:43:26 / cg"
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   900
!
d2421b362731 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 5303
diff changeset
   901
5603
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   902
printf:formatSpec
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   903
    "convenient C-style formatted printing.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   904
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   905
     see documentation in PrintfScanf >> format_printf"
5603
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   906
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   907
    ^ entryStream printf:formatSpec
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   908
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   909
    "
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   910
     1 to: 10 do:[:i |
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   911
        Transcript printf:'Hello World\n'
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   912
     ].
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   913
    "
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   914
!
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   915
6111
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   916
printf:formatSpec arguments:args
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   917
    "convenient C-style formatted printing with an arbitrary number of arguments.
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   918
     Same as printf:withAll:, for protocol completeness.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   919
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   920
     see documentation in PrintfScanf >> format_printf"
6111
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   921
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   922
    ^ entryStream printf:formatSpec withAll:args
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   923
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   924
    "
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   925
     1 to: 10 do:[:i |
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   926
        Transcript 
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   927
            printf:'[%d] Hello %s World - this is %s\n' 
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   928
            with:{i . 'my' . 'nice'}
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   929
     ].
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   930
    "
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   931
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   932
    "Created: / 23-02-2017 / 16:43:46 / cg"
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   933
!
8f59c48aa393 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6108
diff changeset
   934
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   935
printf:formatSpec with:arg1
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   936
    "convenient C-style formatted printing with 1 argument.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   937
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   938
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   939
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   940
    ^ entryStream printf:formatSpec with:arg1
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   941
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   942
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   943
     1 to: 10 do:[:i |
5603
04f026f65189 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5575
diff changeset
   944
        Transcript printf:'[%d] Hello World\n' with:i
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   945
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   946
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   947
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   948
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   949
printf:formatSpec with:arg1 with:arg2
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   950
    "convenient C-style formatted printing with 2 arguments.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   951
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   952
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   953
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   954
    ^ entryStream printf:formatSpec with:arg1 with:arg2
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   955
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   956
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   957
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   958
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   959
            printf:'[%d] Hello World\n' with:i
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   960
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   961
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   962
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   963
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   964
printf:formatSpec with:arg1 with:arg2 with:arg3
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   965
    "convenient C-style formatted printing with 3 arguments.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   966
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   967
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   968
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   969
    ^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   970
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   971
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   972
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   973
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   974
            printf:'[%d] Hello World\n' with:i
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   975
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   976
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   977
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   978
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   979
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   980
    "convenient C-style formatted printing.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   981
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   982
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   983
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   984
    ^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   985
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   986
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   987
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   988
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   989
            printf:'[%d] Hello World\n' with:i
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   990
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   991
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   992
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   993
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   994
printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   995
    "convenient C-style formatted printing.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   996
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
   997
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   998
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
   999
    ^ entryStream printf:formatSpec with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1000
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1001
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1002
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1003
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1004
            printf:'[%d] Hello World\n' with:i
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1005
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1006
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1007
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1008
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1009
printf:formatSpec withAll:args
6296
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
  1010
    "convenient C-style formatted printing with an arbitrary number of arguments.
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
  1011
     For smalltalk specific formats, 
7d5714c65387 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6219
diff changeset
  1012
     see documentation in PrintfScanf >> format_printf"
5569
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1013
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1014
    ^ entryStream printf:formatSpec withAll:args
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1015
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1016
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1017
     1 to: 10 do:[:i |
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1018
        Transcript 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1019
            printf:'[%d] Hello %s World - this is %s\n' 
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1020
            with:{i . 'my' . 'nice'}
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1021
     ].
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1022
    "
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1023
!
93970a44420f #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5534
diff changeset
  1024
5130
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1025
println
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1026
    "for those used to Java/Javascript, a compatibility message.
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1027
     Most useful inside expecco"
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1028
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1029
    self cr
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1030
!
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1031
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1032
println:anObject
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1033
    "for those used to Java/Javascript, a compatibility message.
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1034
     Most useful inside expecco"
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1035
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1036
    self showCR:anObject
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1037
!
2821ba480073 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5025
diff changeset
  1038
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1039
show:anObject
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1040
    "insert the argument aString at current cursor position"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1041
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1042
    |printString lines|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1043
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1044
    printString := anObject printString.
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1045
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1046
    (self == Transcript) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1047
        DebugSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1048
            (DebugSendersOfMessagePattern match:printString string) ifTrue:[
5733
e231929d9e70 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  1049
                "to disable this breakpoint in the future, evaluate:
e231929d9e70 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  1050
                     DebugSendersOfMessagePattern := nil
e231929d9e70 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  1051
                "
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1052
                self halt:('Transcript: text matches: "', printString,'"').
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1053
            ].
4122
fb942b02b048 changed:
Stefan Vogel <sv@exept.de>
parents: 4106
diff changeset
  1054
        ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1055
        TraceSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1056
            (TraceSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1057
                printString := self senderTraceString,': ',printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1058
            ].
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
  1059
        ].
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
  1060
    ].
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1061
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1062
    (printString includes:(Character cr)) ifTrue:[
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1063
        lines := printString asStringCollection.
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1064
        lines keysAndValuesDo:[:nr :line |
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
  1065
            (nr == lines size 
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1066
            and:[(printString endsWith:(Character cr)) not]) ifTrue:[
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1067
                "/ the last one.
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1068
                self show:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1069
            ] ifFalse:[
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1070
                self showCR:line
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1071
            ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1072
        ].
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1073
        ^ self.
308
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1074
    ].
b216a5efa2c8 handle show: with a string containing cr's
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
  1075
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1076
    access critical:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1077
        "/ self ~~ Transcript ifTrue:['xs' printCR].
3295
37cb2b5d579a Allow for readOnly TextCollectors
Stefan Vogel <sv@exept.de>
parents: 3248
diff changeset
  1078
        outstandingLine size ~~ 0 ifTrue:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1079
            outstandingLine := outstandingLine , printString
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1080
        ] ifFalse:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1081
            outstandingLine := printString
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1082
        ].
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1083
        collecting ifTrue:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1084
            flushPending ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1085
                self installDelayedUpdate
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1086
            ] ifTrue:[
1562
9b7557a81849 made the number of buffered lines an instVar.
Claus Gittinger <cg@exept.de>
parents: 1504
diff changeset
  1087
                outstandingLines size > collectSize ifTrue:[
1312
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1088
                    self endEntry
eaa44f7649f5 flush after some lines have been collected
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
  1089
                ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1090
            ]
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1091
        ] ifFalse:[
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1092
            self endEntry
653
fdab88d1205f showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  1093
        ]
1026
6068cf626646 non-collecting nextPut
Claus Gittinger <cg@exept.de>
parents: 928
diff changeset
  1094
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1095
4411
24a09ea995e2 changed: #show:
Claus Gittinger <cg@exept.de>
parents: 4410
diff changeset
  1096
    "Modified: / 24-03-2012 / 20:04:10 / cg"
4428
641c1d7198cf comment/format in: #show:
Claus Gittinger <cg@exept.de>
parents: 4411
diff changeset
  1097
    "Modified (format): / 02-06-2012 / 01:54:55 / cg"
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1098
    "Modified: / 29-05-2019 / 11:59:55 / Claus Gittinger"
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1099
!
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1100
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1101
showCR:anObject
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1102
    "insert the argument aString at current cursor position,
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1103
     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
  1104
     followed by a #cr."
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1105
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1106
    |printString lines crlf|
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1107
4647
6e4bec2140ab oops oops
Claus Gittinger <cg@exept.de>
parents: 4646
diff changeset
  1108
"/ self ~~ Transcript ifTrue:[ ^ self tshow:anObject].
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1109
    printString := anObject printString.
6112
14fe1826a075 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6111
diff changeset
  1110
    printString isEmptyOrNil ifTrue:[
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
  1111
        self cr.
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
  1112
        ^ self.
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1113
    ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1114
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1115
    self == Transcript ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1116
        DebugSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1117
            (DebugSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1118
                "/ to disable this right from inside the debugger, evaluate:
5454
7b8cb04385c6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5408
diff changeset
  1119
                "
7b8cb04385c6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5408
diff changeset
  1120
                 DebugSendersOfMessagePattern := nil
7b8cb04385c6 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5408
diff changeset
  1121
                "
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1122
                self halt:('Transcript: text matches: "', printString, '"').
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1123
            ].
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
  1124
        ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1125
        TraceSendersOfMessagePattern notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1126
            (TraceSendersOfMessagePattern match:printString string) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1127
                printString := self senderTraceString,': ',printString
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1128
            ].
4122
fb942b02b048 changed:
Stefan Vogel <sv@exept.de>
parents: 4106
diff changeset
  1129
        ].
4105
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1130
    ].
c2c3a96f8757 debug support: who sends a message
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1131
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1132
    crlf := String crlf.
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1133
    (printString includesAny:crlf) ifTrue:[
4045
0b461045f76a comment/format
Claus Gittinger <cg@exept.de>
parents: 3969
diff changeset
  1134
        lines := printString asStringCollection.
2689
ddaa98a64bd5 Fix #showCR: when displaying multi-line strings
Stefan Vogel <sv@exept.de>
parents: 2632
diff changeset
  1135
        lines do:[:line|
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1136
            |lineWithoutEOL|
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1137
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1138
            (line endsWith:Character nl) ifTrue:[
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1139
                (line endsWith:crlf) ifTrue:[
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1140
                    lineWithoutEOL := line copyButLast:2.
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1141
                ] ifFalse:[
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1142
                    lineWithoutEOL := line copyButLast:1.
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1143
                ]
2805
171183735212 handle returns in showCR:
Claus Gittinger <cg@exept.de>
parents: 2763
diff changeset
  1144
            ] ifFalse:[
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1145
                (line endsWith:Character return) ifTrue:[
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1146
                    lineWithoutEOL := line copyButLast:1.
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1147
                ] ifFalse:[
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1148
                    lineWithoutEOL := line
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1149
                ]
5302
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1150
            ].
cb9b58fe53e9 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5301
diff changeset
  1151
            self addLine:lineWithoutEOL.
1617
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1152
        ].
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1153
        ^ self.
9606db12cf1b added #showCR:
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  1154
    ].
4106
371ba6f672d0 added: #addLine:
Claus Gittinger <cg@exept.de>
parents: 4105
diff changeset
  1155
    self addLine:printString
4365
e366657e6120 class definition
Claus Gittinger <cg@exept.de>
parents: 4311
diff changeset
  1156
4410
e164f4c1fda4 changed: #showCR:
Claus Gittinger <cg@exept.de>
parents: 4365
diff changeset
  1157
    "Modified: / 24-03-2012 / 20:00:08 / cg"
6112
14fe1826a075 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6111
diff changeset
  1158
    "Modified: / 27-02-2017 / 15:22:47 / stefan"
4073
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1159
!
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1160
4473
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  1161
space
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  1162
    self show:' '
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  1163
!
10ba696ec238 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4460
diff changeset
  1164
4073
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1165
tab
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1166
    "append a tab-character to the stream.
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1167
     This is only allowed, if the receiver supports writing."
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1168
5b4cf996f5d6 added: #tab
Stefan Vogel <sv@exept.de>
parents: 4045
diff changeset
  1169
    self nextPut:(Character tab)
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1170
! !
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1171
2746
e7a2aa5e1b92 method category rename
Claus Gittinger <cg@exept.de>
parents: 2744
diff changeset
  1172
!TextCollector methodsFor:'stream messages-emphasis'!
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1173
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1174
bgColor:aColorOrNil
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1175
    "followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1176
     will be rendered with background color in aColorOrNil.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1177
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1178
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1179
    aColorOrNil isNil ifTrue:[
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1180
        currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1181
    ] ifFalse:[
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1182
        currentEmphasis := Text addEmphasis:(#backgroundColor->aColorOrNil) to:currentEmphasis
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1183
    ]
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1184
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1185
    "Modified (comment): / 29-05-2019 / 12:01:21 / Claus Gittinger"
2539
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1186
!
e90046b96ffe checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2520
diff changeset
  1187
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1188
bold
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1189
    "switch to bold
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1190
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1191
     will be rendered in a bold font.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1192
     Does not affect show/showCR"
3205
934860f51257 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
  1193
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1194
    currentEmphasis := Text addEmphasis:#bold to:currentEmphasis
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1195
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1196
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1197
     Transcript 
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1198
        nextPutAll:'hello';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1199
        bold;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1200
        nextPutAll:' world';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1201
        notBold;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1202
        nextPutLine:' again'
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1203
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1204
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1205
    "Modified (comment): / 29-05-2019 / 12:05:08 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1206
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1207
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1208
color:aColorOrNil
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1209
    "switch color
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1210
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1211
     will be rendered in aColorOrNil.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1212
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1213
    
6162
958615859654 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6114
diff changeset
  1214
    currentEmphasis := Text removeEmphasis:#color from:currentEmphasis.
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1215
    aColorOrNil notNil ifTrue:[
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1216
        currentEmphasis := Text addEmphasis:(#color->aColorOrNil) to:currentEmphasis
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1217
    ].
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1218
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1219
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1220
     Transcript 
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1221
        nextPutAll:'hello';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1222
        color:Color red;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1223
        nextPutAll:' world';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1224
        color:nil;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1225
        nextPutLine:' again'
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1226
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1227
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1228
     Transcript 
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1229
        showCR:('hello' allBold , ' world')
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1230
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1231
6162
958615859654 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6114
diff changeset
  1232
    "Modified: / 30-05-2017 / 09:37:26 / cg"
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1233
    "Modified (comment): / 29-05-2019 / 12:05:33 / Claus Gittinger"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1234
!
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1235
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1236
emphasis:anEmphasisCollectionOrNil
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1237
    "change emphasis
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1238
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1239
     will be rendered with anEmphasisCollectionOrNil.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1240
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1241
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1242
    currentEmphasis := anEmphasisCollectionOrNil
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1243
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1244
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1245
     Transcript 
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1246
        nextPutAll:'hello ';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1247
        emphasis:#( bold underline );
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1248
        nextPutAll:'world';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1249
        emphasis:nil;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1250
        nextPutLine:' again'
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1251
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1252
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1253
     Transcript 
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1254
        nextPutAll:'hello';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1255
        bold;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1256
        nextPutAll:' world';
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1257
        notBold;
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1258
        nextPutLine:' again'
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1259
    "
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1260
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1261
    "Created: / 29-05-2019 / 11:45:35 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1262
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1263
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1264
italic
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1265
    "switch to italic
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1266
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1267
     will be rendered in an italic font.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1268
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1269
6172
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1270
    currentEmphasis := Text addEmphasis:(Text italicEmphasis) to:currentEmphasis
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1271
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1272
    "Modified: / 20-06-2017 / 08:35:20 / cg"
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1273
    "Modified (comment): / 29-05-2019 / 12:03:02 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1274
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1275
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1276
normal
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1277
    "switch back to normal
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1278
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1279
     will be rendered in the default font without color"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1280
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1281
    currentEmphasis := nil
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1282
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1283
    "Modified (comment): / 29-05-2019 / 12:03:40 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1284
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1285
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1286
notBold
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1287
    "switch to non-bold
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1288
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1289
     will be rendered in a non-bold font.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1290
     Does not affect show/showCR"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1291
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1292
    currentEmphasis := Text removeEmphasis:#bold from:currentEmphasis
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1293
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1294
    "Modified (comment): / 29-05-2019 / 12:04:00 / Claus Gittinger"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1295
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1296
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1297
notItalic
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1298
    "switch to non-italic
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1299
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1300
     will be rendered in a non-italic font.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1301
     Does not affect show/showCR"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1302
6172
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1303
    currentEmphasis := Text removeEmphasis:(Text italicEmphasis) from:currentEmphasis
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1304
ab030afe50f8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6162
diff changeset
  1305
    "Modified: / 20-06-2017 / 08:35:26 / cg"
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1306
    "Modified (comment): / 29-05-2019 / 12:04:09 / Claus Gittinger"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1307
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1308
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1309
notReverse
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1310
    "switch back default colors"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1311
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1312
    currentEmphasis := Text removeEmphasis:#color from:currentEmphasis.
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1313
    currentEmphasis := Text removeEmphasis:#backgroundColor from:currentEmphasis.
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1314
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1315
    "Modified (comment): / 29-05-2019 / 11:42:52 / Claus Gittinger"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1316
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1317
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1318
notUnderline
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1319
    "switch to non-underline
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1320
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1321
     will be rendered without underline.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1322
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1323
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1324
    currentEmphasis := Text removeEmphasis:#underline from:currentEmphasis
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1325
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1326
    "Created: / 26-03-1999 / 14:27:07 / cg"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1327
    "Modified (comment): / 29-05-2019 / 12:04:32 / Claus Gittinger"
4659
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1328
!
0ac53ed3980b class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4658
diff changeset
  1329
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1330
reverse
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1331
    "switch to reverse
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1332
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1333
     will be rendered with reversed colors.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1334
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1335
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1336
    currentEmphasis := Text addEmphasis:(#color->bgColor) to:currentEmphasis.
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1337
    currentEmphasis := Text addEmphasis:(#backgroundColor->fgColor) to:currentEmphasis.
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1338
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1339
    "Modified (comment): / 29-05-2019 / 12:04:52 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1340
!
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1341
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1342
underline
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1343
    "switch to underline
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1344
     followup characters sent with stream messages (nextPut/nextPutAll)
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1345
     will be rendered with underline.
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1346
     Does not affect show/showCR"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1347
4658
e2a82c5376e1 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  1348
    currentEmphasis := Text addEmphasis:#underline to:currentEmphasis
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1349
6588
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1350
    "Created: / 26-03-1999 / 14:27:07 / cg"
fcc45baadcc3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6560
diff changeset
  1351
    "Modified (comment): / 29-05-2019 / 12:04:39 / Claus Gittinger"
1822
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1352
! !
9abf58839e67 added #color: and #underline
Claus Gittinger <cg@exept.de>
parents: 1714
diff changeset
  1353
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1354
!TextCollector methodsFor:'transcript specials'!
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1355
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1356
beTranscript
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1357
    "make the receiver be the systemTranscript; this one
5575
cbf04542c6a7 #DOCUMENTATION
mawalch
parents: 5569
diff changeset
  1358
     is accessible via the global Transcript and gets relevant
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1359
     system messages from various places."
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1360
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1361
    self beTranscript:#Transcript
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1362
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1363
    "Modified: / 2.11.1997 / 22:34:47 / cg"
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1364
!
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1365
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1366
beTranscript:name
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1367
    "make the receiver be the systemTranscript; this one
5575
cbf04542c6a7 #DOCUMENTATION
mawalch
parents: 5569
diff changeset
  1368
     is accessible via the global Transcript and gets relevant
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1369
     system messages from various places."
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1370
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1371
    |fg bg cFg cBg|
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1372
5908
8639f76963d4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5870
diff changeset
  1373
    self assert:((Smalltalk includesKey:name) not
8639f76963d4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5870
diff changeset
  1374
                or:[ (Smalltalk at:name) isBehavior not ]). 
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1375
    Smalltalk at:name put:self.
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1376
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1377
    "
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1378
     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
  1379
    "
1421
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1380
    self destroyAction:[
3852
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1381
        self == (Smalltalk at:name) ifTrue:[
8322d7c41f1c refactored newTranscript to allow for another transcript to be opened
Claus Gittinger <cg@exept.de>
parents: 3774
diff changeset
  1382
            Smalltalk at:name put:Stderr
1421
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1383
        ]
afef284eadc4 only reset Transcript to stdErr, if I really am the transcript.
ca
parents: 1389
diff changeset
  1384
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1385
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1386
    "/ user may prefer a special color for this one;
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1387
    "/ look into the style definitions ...
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1388
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1389
    fg := styleSheet colorAt:'transcript.foregroundColor' default:self foregroundColor.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1390
    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
  1391
    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
  1392
    self viewBackground:bg.
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1393
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1394
    cFg := styleSheet colorAt:'transcript.cursorForegroundColor' default:bg.
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1395
    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
  1396
    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
  1397
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1398
    "self lineLimit:1000. " "or whatever you think makes sense"
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1399
1389
82a672130741 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1312
diff changeset
  1400
    "Modified: / 2.11.1997 / 22:34:47 / cg"
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1401
!
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1402
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1403
beginEntry
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1404
    "noop for now, ST80 compatibility"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1405
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1406
    ^ self
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1407
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1408
    "Created: / 4.3.1998 / 11:08:14 / stefan"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1409
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1410
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1411
clear
3119
dcb3db1033e3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3009
diff changeset
  1412
    self endEntry.
2928
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1413
    self contents:nil.
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1414
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1415
    "
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1416
     Transcript clear
24991431c7e0 added #clear (to clear its contents)
Claus Gittinger <cg@exept.de>
parents: 2831
diff changeset
  1417
    "
3774
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1418
!
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1419
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1420
delayedEndEntry
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1421
    "flush collected output; displaying all that has been buffered so far"
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1422
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1423
    "/ self ~~ Transcript ifTrue:[ 'de0' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1424
    inFlush ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1425
        "/ self ~~ Transcript ifTrue:[ 'deX' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1426
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1427
    ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1428
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1429
    "/ self ~~ Transcript ifTrue:[ 'de1' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1430
    access owner == Processor activeProcess ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1431
        "/ self ~~ Transcript ifTrue:[ 'de2' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1432
        self installDelayedUpdate.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1433
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1434
    ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1435
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1436
    self endEntry
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1437
!
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1438
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1439
endEntry
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1440
    "flush collected output; displaying all that has been buffered so far"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1441
5644
b04b627860b9 device access
Claus Gittinger <cg@exept.de>
parents: 5609
diff changeset
  1442
    |nLines lines|
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1443
4965
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1444
    ((outstandingLines isEmptyOrNil) and:[outstandingLine isEmptyOrNil]) ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1445
        "/ self ~~ Transcript ifTrue:[ 'e- ' print. thisContext sender selector printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1446
        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1447
    ].
4965
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1448
    shown ifFalse:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1449
        "/ when iconified or not yet shown, keep
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1450
        "/ collecting. But not too much ...
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1451
        outstandingLines size < 300 ifTrue:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1452
            "/ self ~~ Transcript ifTrue:[ 'eC' printCR ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1453
            access critical:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1454
                flushPending ifFalse:[
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1455
                    self installDelayedUpdate.
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1456
                ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1457
            ].
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1458
            ^ self
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1459
        ]
cf490f1f21c6 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4963
diff changeset
  1460
    ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1461
4963
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1462
    (device isNil or:[device isOpen not or:[self drawableId isNil]]) ifTrue:[
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1463
        "on snapshot load, Transcript may not yet be re-created.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1464
         Write to Stderr then."
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1465
        Stderr notNil ifTrue:[
4963
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1466
            outstandingLines do:[:eachLine|
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1467
                eachLine printOn:Stderr.
360430ca651c class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4961
diff changeset
  1468
            ].
4961
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1469
            outstandingLines := nil.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1470
            outstandingLine notNil ifTrue:[
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1471
                outstandingLine printOn:Stderr.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1472
                outstandingLine := nil.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1473
            ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1474
            Stderr cr.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1475
        ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1476
        ^ self.
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1477
    ].
abf4754c7bed class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4918
diff changeset
  1478
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1479
    "/ self ~~ Transcript ifTrue:[ 'e ' print. 
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1480
    "/    thisContext fullPrintAll.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1481
    "/ ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1482
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1483
"/    access owner == Processor activeProcess ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1484
"/self ~~ Transcript ifTrue:[ 'eI' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1485
"/        self installDelayedUpdate.
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1486
"/        ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1487
"/    ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1488
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1489
    access critical:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1490
        collecting ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1491
            flushBlock notNil ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1492
                Processor removeTimedBlock:flushBlock.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1493
            ].
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1494
"/            flushPending ifFalse:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1495
"/self ~~ Transcript ifTrue:[ 'eP' printCR ].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1496
"/                ^ self
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1497
"/            ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1498
        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1499
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1500
        "/ self ~~ Transcript ifTrue:[ 'e1' printCR ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1501
        inFlush ifFalse:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1502
            "/ self ~~ Transcript ifTrue:[ 'e2' printCR ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1503
            inFlush := true.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1504
            [
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1505
                flushPending := false.
5147
b36c9ea52b1d class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5137
diff changeset
  1506
self withAutoIndent:false do:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1507
                "/ self ~~ Transcript ifTrue:[ 'e3 "' print. outstandingLine print. '" ' print. outstandingLine asByteArray hexPrintString print. ' ' printCR. 
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1508
                "/                             (outstandingLines ? #()) do:[:l | '"' print. l print. '" ' print. l asByteArray hexPrintString printCR ]].
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1509
                (nLines := outstandingLines size) ~~ 0 ifTrue:[
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1510
                    "/ self ~~ Transcript ifTrue:[ 'e4' printCR.].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1511
                    "insert the bunch of lines - if any"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1512
                    lines := outstandingLines.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1513
                    outstandingLines := nil.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1514
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1515
                    "/ self ~~ Transcript ifTrue:[ 'e5 ' print. nLines printCR.].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1516
                    (nLines ~~ 0) ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1517
                        self isInInsertMode ifTrue:[
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1518
                            "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1519
                            self insertLines:lines withCR:true.
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1520
                            "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e6a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1521
                        ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1522
                            self replaceLines:lines withCR:true
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1523
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1524
                        alwaysAppendAtEnd ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1525
                            self cursorToEnd.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1526
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1527
                        (cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1528
                            scrollLocked ifFalse:[
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1529
                                self withCursorOffDo:[
6341
0dc29699b648 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6296
diff changeset
  1530
                                    self scrollDownLines:nLines
5137
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1531
                                ]
fdd9ecc2f447 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5136
diff changeset
  1532
                            ].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1533
                        ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1534
                    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1535
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1536
4650
172ea61953c3 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4647
diff changeset
  1537
                "/ self ~~ Transcript ifTrue:[ (nLines > 1 and:[(lines second ? '') startsWith:'111']) ifTrue:['e7a' printCR.self halt.]].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1538
                "and the last partial line - if any"
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1539
                outstandingLine size ~~ 0 ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1540
                    self isInInsertMode ifTrue:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1541
                        self insertStringAtCursor:outstandingLine.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1542
                    ] ifFalse:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1543
                        self replaceStringAtCursor:outstandingLine.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1544
                    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1545
                    outstandingLine := ''.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1546
                ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1547
                self checkLineLimit.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1548
                "/ device flush.
5147
b36c9ea52b1d class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5137
diff changeset
  1549
].
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1550
            ] ensure:[
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1551
                inFlush := false.
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1552
            ]
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1553
        ].
4657
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1554
"/        flushPending ifTrue:[
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1555
"/            flushPending := false.
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1556
"/            self installDelayedUpdate
0a14c5312937 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4654
diff changeset
  1557
"/        ]
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1558
    ].
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1559
6341
0dc29699b648 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6296
diff changeset
  1560
    "Modified: / 09-11-1998 / 21:17:56 / cg"
0dc29699b648 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6296
diff changeset
  1561
    "Modified: / 13-06-2018 / 22:00:27 / Claus Gittinger"
4643
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1562
!
7760e44f8497 class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
  1563
3774
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1564
flash
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1565
    "make sure everything is visible, before flashing"
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1566
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1567
    self endEntry.
b5f2c82f4995 changed #flash
Claus Gittinger <cg@exept.de>
parents: 3710
diff changeset
  1568
    super flash.
5408
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1569
!
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1570
6219
d78391800b32 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6189
diff changeset
  1571
flash:messageOrNil withColor:flashColor
5408
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1572
    "make sure everything is visible, before flashing"
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1573
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1574
    self endEntry.
6219
d78391800b32 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6189
diff changeset
  1575
    super flash:messageOrNil withColor:flashColor.
d78391800b32 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6189
diff changeset
  1576
d78391800b32 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6189
diff changeset
  1577
    "Modified (format): / 21-10-2017 / 23:13:42 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1578
! !
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1579
928
d120ad0c0422 commentary
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
  1580
!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
  1581
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1582
version
5408
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1583
    ^ '$Header$'
3958
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1584
!
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1585
842f88c39406 changed: #nextPutAll:
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
  1586
version_CVS
5408
b10d1764865f class: TextCollector
Claus Gittinger <cg@exept.de>
parents: 5330
diff changeset
  1587
    ^ '$Header$'
363
d780a45df2d4 MVC operation: scroll to bottom when model changes the text.
Stefan Vogel <sv@exept.de>
parents: 308
diff changeset
  1588
! !
2632
80c3c7c5cc7a endEntry
penk
parents: 2613
diff changeset
  1589
4503
08d33a9017e2 class: TextCollector
Stefan Vogel <sv@exept.de>
parents: 4476
diff changeset
  1590
2025
0c9729befabc allow current transcript to be reassigned temporarily
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  1591
TextCollector initialize!