author | Claus Gittinger <cg@exept.de> |
Sun, 21 Jun 1998 04:48:45 +0200 | |
changeset 665 | 0c124fe4cb25 |
parent 664 | f2b5909cc67b |
child 666 | 1c1d4014849b |
permissions | -rw-r--r-- |
304 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
CharacterArray subclass:#Text |
|
15 |
instanceVariableNames:'string runs' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Collections-Text' |
|
19 |
! |
|
20 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
21 |
!Text class methodsFor:'documentation'! |
304 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1996 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
Texts add emphasis information to a string. |
|
343 | 41 |
Texts and strings should behave interchanchably to the outside |
42 |
world, except that texts keep per-character emphasis information. |
|
43 |
(strings return nil, when asked for an elements emphasis). |
|
44 |
Use #string, to get a texts underlying string without any emphasis |
|
45 |
information. |
|
304 | 46 |
|
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
47 |
Currently, the following attributes are supported: |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
48 |
#bold |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
49 |
#italic |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
50 |
#underline |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
51 |
#strikeout |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
52 |
(#color -> aColor) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
53 |
(#backgroundColor -> aColor) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
54 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
55 |
Attributes may be combined (pass an array of above) as emphasis. |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
56 |
See examples. |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
57 |
|
304 | 58 |
This class is not yet fully implemented - being constructed. |
59 |
||
60 |
[author:] |
|
61 |
Claus Gittinger |
|
62 |
||
63 |
[see also:] |
|
64 |
CharacterArray String RunArray |
|
65 |
" |
|
313 | 66 |
! |
67 |
||
68 |
examples |
|
69 |
" |
|
343 | 70 |
plain string (for comparison): |
313 | 71 |
[exBegin] |
72 |
Dialog |
|
73 |
warn:'hello' |
|
74 |
[exEnd] |
|
343 | 75 |
|
76 |
||
77 |
emphasized strings as dialog titles: |
|
313 | 78 |
[exBegin] |
79 |
Dialog |
|
80 |
warn:((Text string:'hello') allBold) |
|
81 |
[exEnd] |
|
82 |
[exBegin] |
|
83 |
Dialog |
|
84 |
warn:(Text string:'hello' emphasis:#italic) |
|
85 |
[exEnd] |
|
86 |
[exBegin] |
|
87 |
Dialog |
|
88 |
warn:(Text string:'hello' emphasis:#(bold underline)) |
|
89 |
[exEnd] |
|
90 |
[exBegin] |
|
91 |
Dialog |
|
92 |
warn:(Text string:'hello' |
|
93 |
emphasis:(Array with:#bold |
|
94 |
with:#strikeout |
|
95 |
with:(#color->Color red))) |
|
96 |
[exEnd] |
|
97 |
[exBegin] |
|
98 |
Dialog |
|
315 | 99 |
warn:(Text string:'hello' |
100 |
emphasis:(Array with:#bold |
|
101 |
with:#strikeout |
|
102 |
with:(#color->Color red) |
|
103 |
with:(#backgroundColor->Color yellow))) |
|
104 |
[exEnd] |
|
105 |
[exBegin] |
|
106 |
Dialog |
|
313 | 107 |
warn:(Text string:'hello' color:(Color red)) |
108 |
[exEnd] |
|
109 |
||
343 | 110 |
|
111 |
in an editTextView: |
|
112 |
[exBegin] |
|
113 |
|t v| |
|
114 |
||
115 |
t := 'The quick brown fox jumps over the lazy dog' asText. |
|
116 |
t emphasizeFrom:(t findString:'quick') count:5 with:#bold. |
|
117 |
t emphasizeFrom:(t findString:'brown') count:9 |
|
118 |
with:(Array with:#color->(Color name:'brown') |
|
119 |
with:#bold). |
|
120 |
t emphasizeFrom:(t findString:'lazy') count:4 |
|
121 |
with:(Array with:#color->(Color red) |
|
122 |
with:#italic). |
|
123 |
t emphasizeFrom:(t findString:'dog') count:3 with:#underline. |
|
124 |
||
125 |
v := HVScrollableView for:EditTextView. |
|
126 |
v contents:t. |
|
127 |
||
128 |
v width:450. |
|
129 |
v open. |
|
130 |
[exEnd] |
|
313 | 131 |
" |
304 | 132 |
! ! |
133 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
134 |
!Text class methodsFor:'initialization'! |
314 | 135 |
|
136 |
initialize |
|
137 |
"initialize the class" |
|
138 |
||
139 |
" |
|
140 |
consider this a kludge: |
|
141 |
I want to inherit behavior from CharacterArray, but not |
|
142 |
its implementation (indexed access). |
|
143 |
" |
|
144 |
||
145 |
self flags:(Behavior flagRegular) |
|
146 |
||
147 |
" |
|
148 |
Text initialize |
|
149 |
" |
|
150 |
||
151 |
"Modified: 12.5.1996 / 17:53:50 / cg" |
|
152 |
! ! |
|
153 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
154 |
!Text class methodsFor:'instance creation'! |
304 | 155 |
|
156 |
fromString:aString |
|
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
157 |
"create a Text instance, for the characters in aString, |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
158 |
without emphasis." |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
159 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
160 |
^ super new string:aString emphasis:nil |
304 | 161 |
|
162 |
" |
|
163 |
Text fromString:'hello' |
|
164 |
" |
|
165 |
||
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
166 |
"Modified: 12.5.1996 / 17:05:34 / cg" |
304 | 167 |
! |
168 |
||
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
169 |
new |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
170 |
"create a new empty Text instance. |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
171 |
Redefined for string-protocol compatibility" |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
172 |
|
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
173 |
^ super new string:(String new) emphasis:nil |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
174 |
|
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
175 |
"Text new" |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
176 |
|
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
177 |
"Modified: 12.5.1996 / 17:05:17 / cg" |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
178 |
"Modified: 31.12.1996 / 12:39:57 / stefan" |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
179 |
! |
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
180 |
|
307 | 181 |
new:size |
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
182 |
"create a new empty Text instance. |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
183 |
Redefined for string-protocol compatibility" |
307 | 184 |
|
185 |
^ self string:(String new:size) |
|
186 |
||
187 |
"Created: 12.5.1996 / 11:57:27 / cg" |
|
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
188 |
"Modified: 12.5.1996 / 17:05:17 / cg" |
307 | 189 |
! |
190 |
||
304 | 191 |
string:aString |
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
192 |
"create a Text instance, for the characters in aString, |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
193 |
without emphasis." |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
194 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
195 |
^ super new string:aString emphasis:nil |
304 | 196 |
|
197 |
" |
|
198 |
Text string:'hello' |
|
199 |
" |
|
200 |
||
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
201 |
"Modified: 12.5.1996 / 17:05:00 / cg" |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
202 |
! |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
203 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
204 |
string:aString color:aColor |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
205 |
"create a Text instance, for the characters in aString, |
345
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
206 |
which are colored as aColor (only the foregroundColor is affected). |
496 | 207 |
This is a shortCut for creating an emphasis of (#color->aColor)" |
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
208 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
209 |
^ super new string:aString emphasis:(#color->aColor) |
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
210 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
211 |
" |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
212 |
Dialog |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
213 |
information:(Text string:'hello' color:(Color red)) |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
214 |
" |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
215 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
216 |
"Created: 12.5.1996 / 17:03:20 / cg" |
496 | 217 |
"Modified: 27.2.1997 / 10:13:36 / cg" |
344
72fe9b7ae4b5
added #string:color:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
218 |
! |
72fe9b7ae4b5
added #string:color:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
343
diff
changeset
|
219 |
|
304 | 220 |
string:aString emphasis:attribute |
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
221 |
"create a Text instance, for the characters in aString, |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
222 |
which are emphasized as described by attribute." |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
223 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
224 |
^ super new string:aString emphasis:attribute |
304 | 225 |
|
226 |
" |
|
227 |
Text string:'hello' emphasis:#bold |
|
309
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
228 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
229 |
Dialog |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
230 |
information:(Text string:'hello' emphasis:#bold) |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
231 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
232 |
Dialog |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
233 |
information:(Text string:'hello' emphasis:#italic) |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
234 |
|
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
235 |
Dialog |
6458ec5cc033
added convenient #string:color: instance creation message
Claus Gittinger <cg@exept.de>
parents:
308
diff
changeset
|
236 |
information:(Text string:'hello' emphasis:#underline) |
310 | 237 |
|
238 |
Dialog |
|
239 |
information:(Text string:'hello' emphasis:#strikeout) |
|
304 | 240 |
" |
241 |
||
310 | 242 |
"Modified: 12.5.1996 / 17:16:03 / cg" |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
243 |
! |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
244 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
245 |
string:aString emphasisCollection:attributeCollection |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
246 |
"create a Text instance, for the characters in aString, |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
247 |
which are individually emphasized as described by attributeCollection." |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
248 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
249 |
^ super new string:aString emphasisCollection:attributeCollection |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
250 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
251 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
252 |
Text |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
253 |
string:'hello' |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
254 |
emphasisCollection:#(#bold #bold #italic #italic #italic) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
255 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
256 |
Dialog |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
257 |
information:(Text |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
258 |
string:'hello' |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
259 |
emphasisCollection:#(#bold #bold #italic #italic #(#underline italic))) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
260 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
261 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
262 |
"Created: 14.5.1996 / 14:02:18 / cg" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
263 |
"Modified: 14.5.1996 / 15:01:28 / cg" |
345
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
264 |
! |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
265 |
|
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
266 |
string:aString foregroundColor:fgColor backgroundColor:bgColor |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
267 |
"create a Text instance, for the characters in aString, |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
268 |
which are colored in fgColor on bgColor. |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
269 |
This is a shortCut for creating an emphasis of |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
270 |
#( #color->fgColor) (#backgroundColor->bgColor)" |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
271 |
|
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
272 |
^ super new |
345
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
273 |
string:aString |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
274 |
emphasis:(Array with:#color->fgColor |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
275 |
with:#backgroundColor->bgColor) |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
276 |
|
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
277 |
" |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
278 |
Dialog |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
279 |
information:(Text string:'hello' |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
280 |
foregroundColor:(Color red) |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
281 |
backgroundColor:(Color yellow)) |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
282 |
" |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
283 |
|
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
284 |
"Modified: 11.5.1996 / 14:21:01 / cg" |
062032f9e401
renamed to #string:foregroundColor:backgroundColor:
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
285 |
"Created: 16.5.1996 / 12:37:24 / cg" |
395 | 286 |
! |
287 |
||
288 |
string:aString runs:aRun |
|
289 |
"create a Text instance, for the characters in aString, |
|
290 |
which are individually emphasized as described by attributeCollection." |
|
291 |
||
466
a806fe2ac753
'Text new' noe returns an empty text instead of an invalid text
Stefan Vogel <sv@exept.de>
parents:
454
diff
changeset
|
292 |
^ super new string:aString emphasisCollection:aRun. |
304 | 293 |
! ! |
294 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
295 |
!Text class methodsFor:'emphasis helper'! |
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
296 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
297 |
addEmphasis:e1 to:e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
298 |
"merge two emphasis's into one" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
299 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
300 |
|ne| |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
301 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
302 |
e1 isNil ifTrue:[^ e2]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
303 |
e2 isNil ifTrue:[^ e1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
304 |
e1 == e2 ifTrue:[^ e1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
305 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
306 |
(e1 isSymbol |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
307 |
or:[e1 isAssociation]) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
308 |
(e2 isSymbol |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
309 |
or:[e2 isAssociation]) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
310 |
^ Array with:e1 with:e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
311 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
312 |
(e2 includes:e1) ifTrue:[^ e2]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
313 |
^ e2 copyWith:e1 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
314 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
315 |
(e2 isSymbol |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
316 |
or:[e2 isAssociation]) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
317 |
(e1 includes:e2) ifTrue:[^ e1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
318 |
^ e1 copyWith:e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
319 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
320 |
"/ ould use: |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
321 |
"/ ^ (e1 asSet addAll:e2; asArray) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
322 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
323 |
"/ but we do it manually, to preserve the |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
324 |
"/ order. (should create longer runs, while editing) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
325 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
326 |
ne := e1. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
327 |
e2 do:[:e | |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
328 |
(ne includes:e) ifFalse:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
329 |
ne := ne copyWith:e |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
330 |
] |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
331 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
332 |
^ ne. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
333 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
334 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
335 |
Text addEmphasis:#bold to:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
336 |
Text addEmphasis:#bold to:#italic |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
337 |
Text addEmphasis:#bold to:#(italic strikeout) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
338 |
Text addEmphasis:#italic to:#(italic strikeout) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
339 |
Text addEmphasis:#(italic strikeout) to:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
340 |
Text addEmphasis:#(italic strikeout) to:#italic |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
341 |
Text addEmphasis:#(italic strikeout) to:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
342 |
Text addEmphasis:(#color->Color red) to:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
343 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
344 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
345 |
"Modified: 14.5.1996 / 17:15:44 / cg" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
346 |
! |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
347 |
|
339 | 348 |
emphasis:e1 includes:e2 |
349 |
"return true, if e1 includes e2. |
|
350 |
e2 should be a single emphasis." |
|
351 |
||
352 |
e1 isNil ifTrue:[^ false]. |
|
353 |
e2 isNil ifTrue:[^ false]. |
|
354 |
e1 == e2 ifTrue:[^ true]. |
|
355 |
||
356 |
(e1 isSymbol |
|
357 |
or:[e1 isAssociation]) ifTrue:[ |
|
358 |
^ false |
|
359 |
]. |
|
360 |
(e2 isSymbol |
|
361 |
or:[e2 isAssociation]) ifTrue:[ |
|
362 |
^ (e1 includes:e2) |
|
363 |
]. |
|
364 |
^ false |
|
365 |
||
366 |
" |
|
367 |
Text emphasis:#bold includes:#bold |
|
368 |
Text emphasis:#bold includes:#ialic |
|
369 |
Text emphasis:#(italic strikeout) includes:#bold |
|
370 |
Text emphasis:#(italic strikeout) includes:#italic |
|
371 |
" |
|
372 |
||
373 |
"Modified: 14.5.1996 / 17:45:11 / cg" |
|
374 |
! |
|
375 |
||
407 | 376 |
extractEmphasis:key from:e |
377 |
"if key is included in the emphasis, e then return the key. |
|
378 |
Otherwise, if a n association with that key is included, return the value. |
|
379 |
Otherwise, return nil." |
|
380 |
||
381 |
e isNil ifTrue:[^ nil]. |
|
382 |
key == e ifTrue:[^ e]. |
|
383 |
"/ e isSymbol ifTrue:[^ nil]. |
|
384 |
||
385 |
e isAssociation ifTrue:[ |
|
386 |
e key == key ifTrue:[^ e value]. |
|
387 |
^ nil |
|
388 |
]. |
|
389 |
(e includes:key) ifTrue:[^ key]. |
|
390 |
e do:[:entry | |
|
391 |
entry isAssociation ifTrue:[ |
|
392 |
entry key == key ifTrue:[ |
|
393 |
^ entry value |
|
394 |
] |
|
395 |
] |
|
396 |
]. |
|
397 |
^ nil |
|
398 |
||
399 |
" |
|
400 |
Text extractEmphasis:#bold from:#bold |
|
401 |
Text extractEmphasis:#bold from:#italic |
|
402 |
Text extractEmphasis:#bold from:#(italic strikeout) |
|
403 |
Text extractEmphasis:#bold from:#(italic bold) |
|
404 |
Text extractEmphasis:#color from:(#color->Color red) |
|
405 |
Text extractEmphasis:#color from:(#foo->Color red) |
|
406 |
" |
|
407 |
||
408 |
"Modified: 14.5.1996 / 17:45:11 / cg" |
|
409 |
"Created: 11.7.1996 / 09:49:58 / cg" |
|
410 |
! |
|
411 |
||
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
412 |
removeEmphasis:e1 from:e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
413 |
"remove an emphasis; if it was not in e1, do nothing" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
414 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
415 |
|ne| |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
416 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
417 |
e1 isNil ifTrue:[^ nil]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
418 |
e2 isNil ifTrue:[^ e1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
419 |
e1 == e2 ifTrue:[^ nil]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
420 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
421 |
(e2 isSymbol |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
422 |
or:[e2 isAssociation]) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
423 |
(e1 includes:e2) ifTrue:[^ nil]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
424 |
^ e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
425 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
426 |
(e1 isSymbol |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
427 |
or:[e1 isAssociation]) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
428 |
(e2 includes:e1) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
429 |
ne := e2 copyWithout:e1. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
430 |
ne size == 1 ifTrue:[^ ne at:1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
431 |
ne size == 0 ifTrue:[^ nil]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
432 |
^ ne |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
433 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
434 |
^ e2 |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
435 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
436 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
437 |
"/ ould use: |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
438 |
"/ ^ (e2 asSet removeAll:e1; asArray) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
439 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
440 |
"/ but we do it manually, to preserve the |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
441 |
"/ order. (should create longer runs, while editing) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
442 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
443 |
ne := e2. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
444 |
e1 do:[:e | |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
445 |
(ne includes:e) ifTrue:[ |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
446 |
ne := ne copyWithout:e |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
447 |
] |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
448 |
]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
449 |
ne size == 1 ifTrue:[^ ne at:1]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
450 |
ne size == 0 ifTrue:[^ nil]. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
451 |
^ ne. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
452 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
453 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
454 |
Text removeEmphasis:#bold from:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
455 |
Text removeEmphasis:#bold from:#italic |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
456 |
Text removeEmphasis:#bold from:#(italic strikeout) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
457 |
Text removeEmphasis:#italic from:#(italic strikeout) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
458 |
Text removeEmphasis:#(italic strikeout) from:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
459 |
Text removeEmphasis:#(italic strikeout) from:#italic |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
460 |
Text removeEmphasis:#(italic strikeout) from:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
461 |
Text removeEmphasis:#(italic strikeout bold) from:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
462 |
Text removeEmphasis:#(italic strikeout bold underline) from:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
463 |
Text removeEmphasis:(#color->Color red) from:#(bold underline) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
464 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
465 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
466 |
"Modified: 14.5.1996 / 17:23:46 / cg" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
467 |
! ! |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
468 |
|
304 | 469 |
!Text methodsFor:'comparing'! |
470 |
||
471 |
= aStringOrText |
|
472 |
"compare the receiver and the argument, ignoring emphasis" |
|
473 |
||
384 | 474 |
aStringOrText isString ifFalse:[^ false]. |
304 | 475 |
^ string = aStringOrText string |
476 |
||
477 |
||
478 |
" |
|
479 |
'hello' asText = 'hello' |
|
480 |
'hello' asText = 'hello' asText |
|
481 |
'hello' asText allBold = 'hello' |
|
482 |
" |
|
483 |
||
384 | 484 |
"Modified: 4.6.1996 / 11:14:58 / cg" |
662 | 485 |
! |
486 |
||
487 |
hash |
|
488 |
"return a suitable hashcode (req'd since = is redefined)" |
|
489 |
||
490 |
^ string hash |
|
491 |
||
492 |
"Created: / 19.6.1998 / 04:15:57 / cg" |
|
304 | 493 |
! ! |
494 |
||
495 |
!Text methodsFor:'converting'! |
|
496 |
||
497 |
asText |
|
343 | 498 |
"return the receiver itself - it is already a text object" |
499 |
||
304 | 500 |
^ self |
501 |
||
502 |
"Created: 11.5.1996 / 14:08:36 / cg" |
|
343 | 503 |
"Modified: 16.5.1996 / 11:15:12 / cg" |
304 | 504 |
! |
505 |
||
506 |
at:characterIndex |
|
343 | 507 |
"return the plain character at characterIndex" |
508 |
||
304 | 509 |
^ string at:characterIndex |
510 |
||
511 |
"Created: 11.5.1996 / 14:25:41 / cg" |
|
343 | 512 |
"Modified: 16.5.1996 / 11:15:33 / cg" |
304 | 513 |
! |
514 |
||
515 |
at:characterIndex put:aCharacter |
|
343 | 516 |
"change the character at characterIndex to be aCharacter. |
517 |
The emphasis (if any) of that character remains unchanged." |
|
518 |
||
304 | 519 |
^ string at:characterIndex put:aCharacter |
520 |
||
521 |
"Created: 11.5.1996 / 14:25:49 / cg" |
|
343 | 522 |
"Modified: 16.5.1996 / 11:15:57 / cg" |
304 | 523 |
! ! |
524 |
||
525 |
!Text methodsFor:'copying'! |
|
526 |
||
527 |
, aStringOrText |
|
343 | 528 |
"concatenate the receivers characters with the arguments characters, |
529 |
and return string or text object containing those characters. |
|
530 |
If either the receiver or the argument contains emphasis information, |
|
531 |
a text object will be returned. Otherwise, a string (i.e. without emphasis) |
|
532 |
is returned." |
|
304 | 533 |
|
626 | 534 |
|newRuns| |
535 |
||
615 | 536 |
aStringOrText hasChangeOfEmphasis ifTrue:[ |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
537 |
^ self species new |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
538 |
string:(string , aStringOrText) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
539 |
emphasisCollection:(runs , aStringOrText emphasisCollection) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
540 |
]. |
615 | 541 |
runs notNil "self hasChangeOfEmphasis" ifTrue:[ |
626 | 542 |
newRuns := runs copyFrom:1 to:(runs size). |
543 |
||
408 | 544 |
^ self species new |
545 |
string:(string , aStringOrText) |
|
626 | 546 |
emphasisCollection:(newRuns add:nil withOccurrences:(aStringOrText size); yourself) |
408 | 547 |
]. |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
548 |
^ string , aStringOrText string |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
549 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
550 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
551 |
('hello' asText allBold) , ' world' |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
552 |
'hello' , (' world' asText allBold) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
553 |
'hello' , ' world' |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
554 |
('hello' asText allBold) , (' world' asText allBold) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
555 |
" |
304 | 556 |
|
626 | 557 |
"Modified: / 31.3.1998 / 16:34:04 / cg" |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
558 |
! |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
559 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
560 |
concatenateFromString:aString |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
561 |
"return the concatenation of aString and myself. |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
562 |
This may be a Text (if I have emphasis) or a string (if not)." |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
563 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
564 |
self hasChangeOfEmphasis ifTrue:[ |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
565 |
^ self species new |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
566 |
string:(aString , string) |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
567 |
emphasisCollection:((RunArray new:(aString size)) , runs). |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
568 |
]. |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
569 |
^ aString , string |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
570 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
571 |
"Modified: 14.5.1996 / 15:56:05 / cg" |
394 | 572 |
! |
573 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
574 |
copyFrom:start to:stop |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
575 |
"return the subcollection starting at index start, anInteger and ending |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
576 |
at stop, anInteger." |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
577 |
|
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
578 |
self hasChangeOfEmphasis ifTrue:[ |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
579 |
^ self species new |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
580 |
string:(string copyFrom:start to:stop) |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
581 |
emphasisCollection:(runs copyFrom:start to:stop). |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
582 |
]. |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
583 |
^ string copyFrom:start to:stop |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
584 |
|
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
585 |
"Modified: 14.5.1996 / 15:56:05 / cg" |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
586 |
"Created: 22.10.1996 / 21:01:16 / cg" |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
587 |
! |
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
588 |
|
394 | 589 |
postCopy |
590 |
string := string copy. |
|
591 |
runs := runs copy |
|
307 | 592 |
! ! |
593 |
||
594 |
!Text methodsFor:'displaying'! |
|
595 |
||
596 |
displayOn:aGC x:x0 y:y opaque:opaque |
|
597 |
"display the receiver on a GC" |
|
598 |
||
393 | 599 |
|savedFont savedPaint savedBgPaint font color boldFont italicFont boldItalicFont |
315 | 600 |
bgPaint |
664 | 601 |
bold italic underline strikeout reverse |
310 | 602 |
pos "{ Class: SmallInteger }" |
603 |
endPos "{ Class: SmallInteger }" |
|
410
3d42216e96b0
oops - x can be float in displayOn... in case of scaling in the GC
Claus Gittinger <cg@exept.de>
parents:
409
diff
changeset
|
604 |
x |
310 | 605 |
l "{ Class: SmallInteger }" |
360 | 606 |
yL k value device| |
307 | 607 |
|
608 |
savedFont := aGC basicFont. |
|
609 |
savedPaint := aGC paint. |
|
315 | 610 |
savedBgPaint := aGC backgroundPaint. |
307 | 611 |
|
612 |
pos := 1. |
|
613 |
x := x0. |
|
614 |
runs runsDo:[:len :emphasis | |
|
615 |
color := nil. |
|
664 | 616 |
bold := italic := underline := strikeout := reverse := false. |
315 | 617 |
bgPaint := savedBgPaint. |
307 | 618 |
|
619 |
emphasis isSymbol ifTrue:[ |
|
620 |
emphasis == #bold ifTrue:[bold := true] |
|
621 |
ifFalse:[emphasis == #italic ifTrue:[italic := true] |
|
622 |
ifFalse:[emphasis == #underline ifTrue:[underline := true] |
|
623 |
ifFalse:[emphasis == #strikeout ifTrue:[strikeout := true] |
|
664 | 624 |
ifFalse:[emphasis == #reverse ifTrue:[reverse := true] |
625 |
]]]] |
|
307 | 626 |
] ifFalse:[ |
627 |
(emphasis isMemberOf:Association) ifTrue:[ |
|
315 | 628 |
value := emphasis value. |
629 |
k := emphasis key. |
|
630 |
k == #color ifTrue:[ |
|
631 |
color := value |
|
632 |
] ifFalse:[k == #backgroundColor ifTrue:[ |
|
633 |
bgPaint := value |
|
634 |
]] |
|
307 | 635 |
] ifFalse:[ |
636 |
emphasis notNil ifTrue:[ |
|
637 |
emphasis do:[:entry | |
|
638 |
entry == #bold ifTrue:[bold := true] |
|
639 |
ifFalse:[entry == #italic ifTrue:[italic := true] |
|
640 |
ifFalse:[entry == #underline ifTrue:[underline := true] |
|
641 |
ifFalse:[entry == #strikeout ifTrue:[strikeout := true] |
|
664 | 642 |
ifFalse:[entry == #reverse ifTrue:[reverse := true] |
307 | 643 |
ifFalse:[ |
644 |
(entry isMemberOf:Association) ifTrue:[ |
|
315 | 645 |
value := entry value. |
646 |
k := entry key. |
|
647 |
k == #color ifTrue:[ |
|
648 |
color := value |
|
649 |
] ifFalse:[k == #backgroundColor ifTrue:[ |
|
650 |
bgPaint := value |
|
651 |
]] |
|
307 | 652 |
] |
664 | 653 |
]]]]] |
307 | 654 |
] |
655 |
] |
|
656 |
] |
|
657 |
]. |
|
658 |
||
360 | 659 |
device := aGC graphicsDevice. |
660 |
||
307 | 661 |
color isNil ifTrue:[ |
662 |
color := savedPaint. |
|
663 |
] ifFalse:[ |
|
360 | 664 |
color := color on:device. |
307 | 665 |
]. |
304 | 666 |
|
307 | 667 |
bold ifTrue:[ |
393 | 668 |
italic ifTrue:[ |
669 |
boldItalicFont isNil ifTrue:[ |
|
670 |
boldItalicFont := savedFont asBold asItalic on:device |
|
671 |
]. |
|
672 |
font := boldItalicFont. |
|
673 |
] ifFalse:[ |
|
674 |
boldFont isNil ifTrue:[ |
|
675 |
boldFont := savedFont asBold on:device |
|
676 |
]. |
|
677 |
font := boldFont. |
|
678 |
] |
|
307 | 679 |
] ifFalse:[ |
680 |
italic ifTrue:[ |
|
681 |
italicFont isNil ifTrue:[ |
|
360 | 682 |
italicFont := savedFont asItalic on:device |
307 | 683 |
]. |
684 |
font := italicFont. |
|
685 |
] ifFalse:[ |
|
686 |
font := savedFont |
|
687 |
] |
|
688 |
]. |
|
689 |
aGC basicFont:font. |
|
664 | 690 |
reverse ifTrue:[ |
691 |
aGC paint:bgPaint on:color |
|
692 |
] ifFalse:[ |
|
693 |
aGC paint:color on:bgPaint. |
|
694 |
]. |
|
310 | 695 |
endPos := pos + len - 1. |
307 | 696 |
opaque ifTrue:[ |
310 | 697 |
aGC displayOpaqueString:string from:pos to:endPos x:x y:y. |
307 | 698 |
] ifFalse:[ |
310 | 699 |
aGC displayString:string from:pos to:endPos x:x y:y. |
307 | 700 |
]. |
591
dfa5c6178f6d
care to use deviceFont in width-query
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
701 |
l := (aGC font on:aGC device) widthOf:string from:pos to:endPos. |
307 | 702 |
|
703 |
underline ifTrue:[ |
|
310 | 704 |
yL := y+1. |
705 |
aGC displayLineFromX:x y:yL toX:x+l-1 y:yL |
|
706 |
]. |
|
707 |
strikeout ifTrue:[ |
|
708 |
yL := y-(font ascent//2). |
|
709 |
aGC displayLineFromX:x y:yL toX:x+l-1 y:yL |
|
307 | 710 |
]. |
711 |
||
712 |
x := x + l. |
|
310 | 713 |
pos := endPos + 1 |
304 | 714 |
]. |
307 | 715 |
|
716 |
aGC basicFont:savedFont. |
|
316 | 717 |
aGC paint:savedPaint on:savedBgPaint. |
307 | 718 |
|
591
dfa5c6178f6d
care to use deviceFont in width-query
Claus Gittinger <cg@exept.de>
parents:
549
diff
changeset
|
719 |
"Created: / 12.5.1996 / 11:14:30 / cg" |
665 | 720 |
"Modified: / 21.6.1998 / 03:52:16 / cg" |
304 | 721 |
! ! |
722 |
||
723 |
!Text methodsFor:'emphasis'! |
|
724 |
||
725 |
allBold |
|
726 |
"make all characters bold" |
|
727 |
||
406 | 728 |
self emphasizeAllWith:#bold |
304 | 729 |
|
730 |
" |
|
731 |
(Text string:'hello') allBold |
|
732 |
" |
|
733 |
||
406 | 734 |
"Modified: 10.7.1996 / 12:07:51 / cg" |
304 | 735 |
! |
736 |
||
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
737 |
emphasis |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
738 |
"return the emphasis" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
739 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
740 |
^ runs |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
741 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
742 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
743 |
(Text string:'hello') allBold emphasis |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
744 |
'hello' emphasis |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
745 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
746 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
747 |
"Modified: 11.5.1996 / 14:22:31 / cg" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
748 |
"Created: 14.5.1996 / 13:59:03 / cg" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
749 |
! |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
750 |
|
304 | 751 |
emphasisAt:characterIndex |
752 |
"return the emphasis at some index" |
|
753 |
||
754 |
^ runs at:characterIndex |
|
755 |
||
756 |
" |
|
757 |
(Text string:'hello') allBold emphasisAt:2 |
|
758 |
" |
|
759 |
||
760 |
"Modified: 11.5.1996 / 14:22:31 / cg" |
|
761 |
! |
|
762 |
||
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
763 |
emphasisAt:characterIndex add:newEmphasis |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
764 |
"add to the emphasis at some index. return the receiver" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
765 |
|
626 | 766 |
|e prevE| |
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
767 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
768 |
e := runs at:characterIndex. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
769 |
e := self class addEmphasis:newEmphasis to:e. |
626 | 770 |
|
771 |
"/ if its equal to the previous emphasis, make it identical. |
|
772 |
||
773 |
characterIndex > 1 ifTrue:[ |
|
774 |
prevE := runs at:characterIndex-1. |
|
775 |
e = prevE ifTrue:[ |
|
776 |
e := prevE |
|
777 |
] |
|
778 |
]. |
|
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
779 |
runs at:characterIndex put:e |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
780 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
781 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
782 |
(Text string:'hello') allBold emphasisAt:2 add:#italic |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
783 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
784 |
|
626 | 785 |
"Created: / 14.5.1996 / 16:48:39 / cg" |
786 |
"Modified: / 31.3.1998 / 15:29:14 / cg" |
|
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
787 |
! |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
788 |
|
307 | 789 |
emphasisAt:characterIndex put:emphasis |
790 |
"change the emphasis at some index. return the receiver" |
|
791 |
||
626 | 792 |
|e prevE| |
793 |
||
794 |
e := emphasis. |
|
795 |
||
796 |
"/ if its equal to the previous emphasis, make it identical. |
|
797 |
||
798 |
characterIndex > 1 ifTrue:[ |
|
799 |
prevE := runs at:characterIndex-1. |
|
800 |
emphasis = prevE ifTrue:[ |
|
801 |
e := prevE |
|
802 |
] |
|
803 |
]. |
|
804 |
runs at:characterIndex put:e |
|
307 | 805 |
|
806 |
" |
|
807 |
(Text string:'hello') allBold emphasisAt:2 put:#italic |
|
808 |
" |
|
809 |
||
626 | 810 |
"Modified: / 31.3.1998 / 16:45:14 / cg" |
307 | 811 |
! |
812 |
||
336
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
813 |
emphasisAt:characterIndex remove:emphasisToRemove |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
814 |
"remove from the emphasis at some index. return the receiver" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
815 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
816 |
|e| |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
817 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
818 |
e := runs at:characterIndex. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
819 |
e := self class removeEmphasis:emphasisToRemove from:e. |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
820 |
runs at:characterIndex put:e |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
821 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
822 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
823 |
(Text string:'hello') |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
824 |
allBold emphasisAt:2 remove:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
825 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
826 |
(Text string:'hello' emphasis:#(bold italic)) |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
827 |
emphasisAt:2 remove:#bold |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
828 |
" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
829 |
|
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
830 |
"Created: 14.5.1996 / 16:48:39 / cg" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
831 |
"Modified: 14.5.1996 / 17:25:04 / cg" |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
832 |
! |
5fd5fcc38eaa
helpers to add/remove emphasis
Claus Gittinger <cg@exept.de>
parents:
335
diff
changeset
|
833 |
|
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
834 |
emphasisCollection |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
835 |
"return the emphasis" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
836 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
837 |
^ runs |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
838 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
839 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
840 |
(Text string:'hello') allBold emphasis |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
841 |
'hello' emphasis |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
842 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
843 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
844 |
"Created: 14.5.1996 / 13:59:03 / cg" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
845 |
"Modified: 14.5.1996 / 15:02:11 / cg" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
846 |
! |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
847 |
|
304 | 848 |
emphasizeAllWith:emphasis |
849 |
"change the emphasis of all characters" |
|
850 |
||
851 |
runs := RunArray new:(string size) withAll:emphasis |
|
852 |
||
853 |
" |
|
854 |
(Text string:'hello') allBold emphasizeAllWith:#italic |
|
855 |
" |
|
856 |
||
857 |
"Modified: 11.5.1996 / 14:22:52 / cg" |
|
858 |
! |
|
859 |
||
343 | 860 |
emphasizeFrom:start count:count with:emphasis |
861 |
"change the emphasis of a range of characters, given startIndex and count." |
|
862 |
||
863 |
self emphasizeFrom:start to:(start+count-1) with:emphasis |
|
864 |
||
865 |
" |
|
866 |
(Text string:'hello world') |
|
867 |
emphasizeFrom:1 count:5 with:#bold; |
|
868 |
emphasizeFrom:7 count:5 with:#italic |
|
869 |
" |
|
870 |
||
871 |
"Modified: 11.5.1996 / 14:30:02 / cg" |
|
872 |
"Created: 16.5.1996 / 10:52:27 / cg" |
|
873 |
! |
|
874 |
||
304 | 875 |
emphasizeFrom:start to:stop with:emphasis |
876 |
"change the emphasis of a range of characters" |
|
877 |
||
878 |
|newRuns| |
|
879 |
||
631 | 880 |
runs from:start to:stop put:emphasis. |
626 | 881 |
^ self. |
882 |
||
304 | 883 |
newRuns := RunArray new. |
884 |
||
885 |
"/ for now - a q&d hack |
|
886 |
1 to:start-1 do:[:i | |
|
887 |
newRuns add:(runs at:i). |
|
888 |
]. |
|
889 |
newRuns add:emphasis withOccurrences:(stop - start + 1). |
|
890 |
stop+1 to:string size do:[:i | |
|
891 |
newRuns add:(runs at:i) |
|
892 |
]. |
|
893 |
runs := newRuns |
|
894 |
||
895 |
" |
|
896 |
(Text string:'hello world') |
|
897 |
emphasizeFrom:1 to:5 with:#bold; |
|
898 |
emphasizeFrom:7 to:11 with:#italic |
|
899 |
" |
|
900 |
||
631 | 901 |
"Modified: / 7.4.1998 / 08:52:18 / cg" |
347 | 902 |
! |
903 |
||
904 |
emphasizeFrom:start with:emphasis |
|
905 |
"change the emphasis of some characters upTo the end" |
|
906 |
||
907 |
self emphasizeFrom:start to:(self size) with:emphasis |
|
908 |
||
909 |
" |
|
910 |
(Text string:'hello world') |
|
911 |
emphasizeFrom:1 count:5 with:#bold; |
|
912 |
emphasizeFrom:7 with:#italic |
|
913 |
" |
|
914 |
||
915 |
"Modified: 11.5.1996 / 14:30:02 / cg" |
|
916 |
"Created: 17.5.1996 / 15:15:32 / cg" |
|
661 | 917 |
! |
918 |
||
919 |
makeSelectorBoldIn:aClass |
|
920 |
"the receiver represents some source code for |
|
921 |
a method in aClass. |
|
922 |
Change myself to boldify the selector. |
|
923 |
Not yet implemented (could easily use the syntaxHighlighter |
|
924 |
for this ..." |
|
925 |
||
926 |
^ self |
|
927 |
||
928 |
"Created: / 19.6.1998 / 00:08:34 / cg" |
|
304 | 929 |
! ! |
930 |
||
931 |
!Text methodsFor:'printing & storing'! |
|
932 |
||
343 | 933 |
printOn:aStream |
934 |
"print the receivers characters (including emphasis) on |
|
409 | 935 |
aStream. |
936 |
Notice, that some streams simply ignore the emphasis |
|
937 |
(Transcript currently does)." |
|
343 | 938 |
|
409 | 939 |
|pos nextPos| |
407 | 940 |
|
941 |
pos := 1. |
|
343 | 942 |
|
407 | 943 |
runs runsDo:[:len :emphasis | |
409 | 944 |
nextPos := pos + len. |
407 | 945 |
|
946 |
aStream emphasis:emphasis. |
|
409 | 947 |
aStream nextPutAll:string startingAt:pos to:nextPos - 1. |
948 |
pos := nextPos |
|
343 | 949 |
]. |
304 | 950 |
|
343 | 951 |
" |
407 | 952 |
Transcript showCR:'hello world'. |
953 |
Transcript showCR:'hello world' asText allBold. |
|
954 |
Transcript showCR:('hello world' asText emphasizeAllWith:#italic). |
|
343 | 955 |
" |
304 | 956 |
|
409 | 957 |
"Modified: 12.7.1996 / 10:15:47 / cg" |
304 | 958 |
! |
959 |
||
960 |
storeOn:aStream |
|
343 | 961 |
"append a printed representation from which the receiver can be reconstructed |
962 |
to aStream." |
|
963 |
||
304 | 964 |
aStream nextPutAll:'(Text string:'. |
965 |
string storeOn:aStream. |
|
307 | 966 |
aStream nextPutAll:' runs:'. |
304 | 967 |
runs storeOn:aStream. |
968 |
aStream nextPutAll:')'. |
|
969 |
||
970 |
"Created: 11.5.1996 / 14:27:09 / cg" |
|
343 | 971 |
"Modified: 16.5.1996 / 11:23:32 / cg" |
304 | 972 |
! ! |
973 |
||
974 |
!Text methodsFor:'private accessing'! |
|
975 |
||
631 | 976 |
emphasisCollection:emphasisCollection |
977 |
"set the string and emphasis collection. |
|
978 |
The emphasis collection contains per-character information." |
|
979 |
||
980 |
runs := emphasisCollection |
|
981 |
||
982 |
"Created: / 7.4.1998 / 08:52:03 / cg" |
|
983 |
! |
|
984 |
||
304 | 985 |
string:aString emphasis:emphasis |
343 | 986 |
"set the string and emphasis. The emphasis is applied to all characters." |
987 |
||
428 | 988 |
string := aString string. |
989 |
runs := RunArray new:string size withAll:emphasis |
|
304 | 990 |
|
991 |
" |
|
992 |
|t| |
|
993 |
||
994 |
t := Text new string:'hello' emphasis:#bold. |
|
995 |
t emphasisAt:2. |
|
996 |
" |
|
997 |
||
343 | 998 |
"Modified: 16.5.1996 / 11:24:03 / cg" |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
999 |
! |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1000 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1001 |
string:aString emphasisCollection:emphasisCollection |
343 | 1002 |
"set the string and emphasis collection. |
1003 |
The emphasis collection contains per-character information." |
|
1004 |
||
428 | 1005 |
string := aString string. |
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1006 |
runs := emphasisCollection asRunArray |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1007 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1008 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1009 |
|t| |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1010 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1011 |
t := Text new string:'hello' emphasisCollection:(#bold #bold #bold #italic #italic). |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1012 |
t emphasisAt:2. |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1013 |
" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1014 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1015 |
"Created: 14.5.1996 / 14:03:29 / cg" |
343 | 1016 |
"Modified: 16.5.1996 / 11:24:21 / cg" |
304 | 1017 |
! ! |
1018 |
||
1019 |
!Text methodsFor:'queries'! |
|
1020 |
||
307 | 1021 |
bitsPerCharacter |
343 | 1022 |
"return the underlying strings bitsPerCharacter |
1023 |
(i.e. is it a regular String or a TwoByteString)" |
|
1024 |
||
307 | 1025 |
^ string bitsPerCharacter |
304 | 1026 |
|
307 | 1027 |
"Created: 12.5.1996 / 15:44:04 / cg" |
343 | 1028 |
"Modified: 16.5.1996 / 11:24:54 / cg" |
304 | 1029 |
! |
1030 |
||
1031 |
hasChangeOfEmphasis |
|
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1032 |
"return true, if the receiver contains non-empty emphasis information" |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1033 |
|
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1034 |
^ (runs notNil |
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1035 |
and:[(runs findFirst:[:e | e notNil]) ~~ 0]) |
304 | 1036 |
|
1037 |
"Created: 11.5.1996 / 14:03:19 / cg" |
|
335
4adf1b6b4063
concatenating mixed texts & strings
Claus Gittinger <cg@exept.de>
parents:
316
diff
changeset
|
1038 |
"Modified: 14.5.1996 / 15:51:01 / cg" |
304 | 1039 |
! |
1040 |
||
307 | 1041 |
heightOn:aGC |
1042 |
"return the number of device units, required on aGC's device" |
|
1043 |
||
621 | 1044 |
^ (aGC font onDevice:aGC device) heightOf:string |
307 | 1045 |
|
1046 |
"Created: 12.5.1996 / 11:02:03 / cg" |
|
1047 |
! |
|
1048 |
||
304 | 1049 |
indexOf:aCharacter startingAt:index |
343 | 1050 |
"search aCharacters index in the underlying string" |
1051 |
||
304 | 1052 |
^ string indexOf:aCharacter startingAt:index |
1053 |
||
1054 |
"Created: 11.5.1996 / 13:58:56 / cg" |
|
343 | 1055 |
"Modified: 16.5.1996 / 11:25:12 / cg" |
304 | 1056 |
! |
1057 |
||
307 | 1058 |
isText |
343 | 1059 |
"return true if this is a Text object - always true here" |
1060 |
||
307 | 1061 |
^ true |
1062 |
||
1063 |
"Created: 12.5.1996 / 10:56:24 / cg" |
|
343 | 1064 |
"Modified: 16.5.1996 / 11:25:29 / cg" |
307 | 1065 |
! |
1066 |
||
304 | 1067 |
occurrencesOf:aCharacter |
343 | 1068 |
"count & return the number of occurrences of aCharacter in the |
1069 |
underlying string" |
|
1070 |
||
304 | 1071 |
^ string occurrencesOf:aCharacter |
1072 |
||
1073 |
"Created: 11.5.1996 / 13:58:46 / cg" |
|
343 | 1074 |
"Modified: 16.5.1996 / 11:25:51 / cg" |
304 | 1075 |
! |
1076 |
||
1077 |
size |
|
343 | 1078 |
"return the number of characters in the underlying string" |
1079 |
||
304 | 1080 |
^ string size |
1081 |
||
1082 |
"Created: 11.5.1996 / 14:25:15 / cg" |
|
343 | 1083 |
"Modified: 16.5.1996 / 11:26:08 / cg" |
304 | 1084 |
! |
1085 |
||
1086 |
string |
|
343 | 1087 |
"return the receiver without any emphasis information |
1088 |
i.e. the underlying string." |
|
1089 |
||
304 | 1090 |
^ string |
1091 |
||
1092 |
"Created: 11.5.1996 / 13:58:38 / cg" |
|
343 | 1093 |
"Modified: 16.5.1996 / 11:26:30 / cg" |
307 | 1094 |
! |
1095 |
||
1096 |
widthOn:aGC |
|
1097 |
"return the number of device units, required on aGC's device" |
|
1098 |
||
450 | 1099 |
|savedFont boldFont italicFont bold italic pos f l device| |
307 | 1100 |
|
404
14cf34141532
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1101 |
device := aGC graphicsDevice. |
14cf34141532
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1102 |
|
14cf34141532
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1103 |
savedFont := aGC basicFont on:device. |
307 | 1104 |
|
1105 |
pos := 1. |
|
1106 |
l := 0. |
|
1107 |
runs runsDo:[:len :emphasis | |
|
1108 |
emphasis isSymbol ifTrue:[ |
|
1109 |
bold := emphasis == #bold. |
|
1110 |
italic := emphasis == #italic. |
|
1111 |
] ifFalse:[ |
|
308 | 1112 |
(emphasis isNil |
1113 |
or:[emphasis isMemberOf:Association]) ifTrue:[ |
|
307 | 1114 |
bold := italic := false |
1115 |
] ifFalse:[ |
|
1116 |
bold := emphasis includesIdentical:#bold. |
|
1117 |
italic := emphasis includesIdentical:#italic. |
|
1118 |
] |
|
1119 |
]. |
|
1120 |
||
1121 |
bold ifTrue:[ |
|
1122 |
boldFont isNil ifTrue:[ |
|
360 | 1123 |
boldFont := savedFont asBold on:device |
307 | 1124 |
]. |
1125 |
f := boldFont. |
|
1126 |
] ifFalse:[ |
|
1127 |
italic ifTrue:[ |
|
1128 |
italicFont isNil ifTrue:[ |
|
360 | 1129 |
italicFont := savedFont asItalic on:device |
307 | 1130 |
]. |
1131 |
f := italicFont |
|
1132 |
] ifFalse:[ |
|
1133 |
f := savedFont |
|
1134 |
] |
|
1135 |
]. |
|
621 | 1136 |
f := f onDevice:aGC device. |
307 | 1137 |
l := l + (f widthOf:string from:pos to:(pos + len - 1)). |
1138 |
pos := pos + len |
|
1139 |
]. |
|
1140 |
||
1141 |
^ l |
|
1142 |
||
404
14cf34141532
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1143 |
"Modified: 5.7.1996 / 17:54:58 / cg" |
307 | 1144 |
! ! |
1145 |
||
1146 |
!Text methodsFor:'replacing'! |
|
1147 |
||
1148 |
replaceFrom:start to:stop with:aCollection startingAt:startIndex |
|
343 | 1149 |
"replace a range of characters, from another string or text object. |
607 | 1150 |
The corresponding characters' emphasis information is also copied. |
1151 |
Return the receiver." |
|
343 | 1152 |
|
307 | 1153 |
|idx| |
1154 |
||
1155 |
aCollection isString ifTrue:[ |
|
1156 |
aCollection hasChangeOfEmphasis ifTrue:[ |
|
1157 |
string replaceFrom:start to:stop with:aCollection startingAt:startIndex. |
|
1158 |
idx := startIndex. |
|
1159 |
start to:stop do:[:col | |
|
1160 |
self emphasisAt:col put:(aCollection emphasisAt:idx). |
|
1161 |
idx := idx + 1. |
|
1162 |
]. |
|
1163 |
^ self. |
|
1164 |
] |
|
1165 |
]. |
|
1166 |
||
1167 |
string replaceFrom:start to:stop with:aCollection startingAt:startIndex. |
|
1168 |
self emphasizeFrom:start to:stop with:nil |
|
1169 |
||
1170 |
" |
|
1171 |
((Text string:'hello') allBold emphasisAt:2 put:#italic) |
|
1172 |
copyFrom:1 to:3 |
|
1173 |
" |
|
1174 |
||
607 | 1175 |
"Modified: / 28.1.1998 / 16:50:06 / cg" |
304 | 1176 |
! ! |
1177 |
||
454
ffc79ebcbb20
oops - copyFrom:to: clobbered the emphasis
Claus Gittinger <cg@exept.de>
parents:
450
diff
changeset
|
1178 |
!Text class methodsFor:'documentation'! |
304 | 1179 |
|
1180 |
version |
|
665 | 1181 |
^ '$Header: /cvs/stx/stx/libbasic2/Text.st,v 1.43 1998-06-21 02:48:45 cg Exp $' |
304 | 1182 |
! ! |
314 | 1183 |
Text initialize! |