author | Claus Gittinger <cg@exept.de> |
Fri, 13 Feb 2004 14:42:46 +0100 | |
changeset 2878 | 8e3fd436ed0b |
parent 2875 | b9e9728d8245 |
child 2882 | 42dae296546f |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
||
77 | 13 |
|
14 |
||
2275 | 15 |
"{ Package: 'stx:libwidg' }" |
16 |
||
77 | 17 |
DialogBox subclass:#FontPanel |
2878 | 18 |
instanceVariableNames:'previewField listOfEncodings familyList faceList sizeList |
19 |
revertButton currentFamily currentFace currentStyle |
|
20 |
currentFaceAndStyle currentSize currentEncoding selectedFont |
|
21 |
nameLabel encodingFilter encodingLabel filter encoding' |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
22 |
classVariableNames:'' |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
23 |
poolDictionaries:'' |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
24 |
category:'Views-DialogBoxes' |
0 | 25 |
! |
26 |
||
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
27 |
!FontPanel class methodsFor:'documentation'! |
77 | 28 |
|
197 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
||
42 |
||
77 | 43 |
! |
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
this class implements a font chooser. |
|
48 |
||
2826 | 49 |
Notice: |
50 |
this is a very old dialog; |
|
51 |
it was written before the UI-framework was available and is completely |
|
52 |
setup manually (initialize method). |
|
53 |
Therefore, it desperately asks to be rewritten using the UIPainter... |
|
54 |
||
595 | 55 |
[author:] |
56 |
Claus Gittinger |
|
57 |
||
58 |
[see also:] |
|
59 |
Font FontDescription |
|
60 |
View Dialog |
|
61 |
" |
|
62 |
! |
|
63 |
||
64 |
examples |
|
65 |
" |
|
66 |
very simple: |
|
67 |
[exBegin] |
|
68 |
|font| |
|
69 |
||
70 |
font := FontPanel fontFromUser. |
|
655 | 71 |
Transcript showCR:font |
595 | 72 |
[exEnd] |
73 |
||
74 |
||
75 |
with initial font: |
|
76 |
[exBegin] |
|
77 |
|font| |
|
78 |
||
79 |
font := FontPanel |
|
80 |
fontFromUserInitial:(Font |
|
81 |
family:'courier' |
|
82 |
size:12). |
|
655 | 83 |
Transcript showCR:font |
595 | 84 |
[exEnd] |
85 |
||
86 |
||
87 |
with initial font & title: |
|
88 |
[exBegin] |
|
89 |
|font| |
|
90 |
||
91 |
font := FontPanel |
|
92 |
fontFromUserInitial:(Font |
|
93 |
family:'courier' |
|
94 |
size:12) |
|
95 |
title:'select a fooBar font'. |
|
655 | 96 |
Transcript showCR:font |
595 | 97 |
[exEnd] |
98 |
||
99 |
||
100 |
full setup; setting a filter to only present iso fonts |
|
101 |
and callBack action: |
|
102 |
[exBegin] |
|
0 | 103 |
|
585 | 104 |
|panel| |
77 | 105 |
|
585 | 106 |
panel := FontPanel new. |
595 | 107 |
panel label:'hi there - which iso font ?'. |
108 |
panel filter:[:fd | fd encoding notNil |
|
109 |
and:[fd encoding startsWith:'iso']]. |
|
110 |
panel action:[:family :face :style :size | |
|
655 | 111 |
Transcript showCR:'family:' , family. |
112 |
Transcript showCR:'face:' , face. |
|
113 |
Transcript showCR:'style:' , style. |
|
114 |
Transcript showCR:'size:' , size printString. |
|
595 | 115 |
]. |
116 |
panel open |
|
117 |
[exEnd] |
|
77 | 118 |
" |
119 |
! ! |
|
0 | 120 |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
121 |
!FontPanel class methodsFor:'defaults'! |
0 | 122 |
|
197 | 123 |
defaultExtent |
571 | 124 |
"return the default extent of my instances. |
125 |
The value returned here is usually ignored, and |
|
126 |
the value from preferredExtent taken instead." |
|
127 |
||
2842 | 128 |
^ (Screen current pixelPerMillimeter * (150 @ 100)) rounded |
571 | 129 |
|
130 |
"Modified: 22.4.1996 / 23:36:19 / cg" |
|
197 | 131 |
! |
132 |
||
2860 | 133 |
defaultJIS0201SampleString |
134 |
"return the sample jis preview text" |
|
135 |
||
136 |
^ ('The quick brown fox |
|
137 |
jumps over the lazy dog |
|
138 |
||
139 |
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|
140 |
abcdefghijklmnopqrstuvwxyz |
|
141 |
1234567890 |
|
142 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
143 |
||
144 |
') |
|
145 |
! |
|
146 |
||
382 | 147 |
defaultJISSampleString |
595 | 148 |
"return the sample jis preview text" |
149 |
||
382 | 150 |
^ ('The quick brown fox |
151 |
jumps over the lazy dog |
|
2860 | 152 |
|
153 |
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|
154 |
abcdefghijklmnopqrstuvwxyz |
|
382 | 155 |
1234567890 |
156 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
157 |
|
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
158 |
\e$B$$$i$C$7$c$$$^$;\e(J \e$B@$4V\e(J |
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
159 |
' withEscapes decodeFrom:#jis7) |
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
160 |
|
595 | 161 |
"Modified: 29.4.1996 / 09:46:11 / cg" |
382 | 162 |
! |
163 |
||
2847 | 164 |
defaultLatin1SampleString |
165 |
"return the sample latin1 preview text" |
|
166 |
||
167 |
|t| |
|
168 |
||
169 |
Smalltalk language == #de ifTrue:[ |
|
170 |
t := 'Franz jagt im komplett verwahrlosten Taxi |
|
171 |
quer durch Bayern'. |
|
172 |
] ifFalse:[ |
|
173 |
t := 'The quick brown fox |
|
174 |
jumps over the lazy dog'. |
|
175 |
]. |
|
176 |
t := t , ' |
|
2860 | 177 |
|
178 |
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|
179 |
abcdefghijklmnopqrstuvwxyz |
|
2847 | 180 |
1234567890 |
181 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
182 |
' , |
|
183 |
(Character value:16rE4) asString , "/ umlaut a |
|
184 |
(Character value:16rF6) asString , "/ umlaut o |
|
185 |
(Character value:16rFC) asString , "/ umlaut u |
|
186 |
(Character value:16rC4) asString , "/ umlaut A |
|
187 |
(Character value:16rD6) asString , "/ umlaut O |
|
188 |
(Character value:16rDC) asString , "/ umlaut U |
|
189 |
(Character value:16rDF) asString , "/ sz |
|
190 |
(Character value:233) asString , "/ e-degu |
|
191 |
(Character value:232) asString , "/ e-grave |
|
192 |
(Character value:234) asString , "/ e-circonflex |
|
193 |
(Character value:197) asString , "/ A |
|
2851 | 194 |
(Character value:169) asString , "/ copyright |
195 |
(Character value:164) asString. "/ euro |
|
2847 | 196 |
^ t |
197 |
||
198 |
"Modified: 29.4.1996 / 09:46:19 / cg" |
|
199 |
! |
|
200 |
||
201 |
defaultUnicodeSampleString |
|
202 |
"return the sample unicode preview text" |
|
595 | 203 |
|
2275 | 204 |
|t| |
205 |
||
2286 | 206 |
Smalltalk language == #de ifTrue:[ |
2275 | 207 |
t := 'Franz jagt im komplett verwahrlosten Taxi |
208 |
quer durch Bayern'. |
|
209 |
] ifFalse:[ |
|
210 |
t := 'The quick brown fox |
|
211 |
jumps over the lazy dog'. |
|
212 |
]. |
|
213 |
t := t , ' |
|
2860 | 214 |
|
215 |
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|
216 |
abcdefghijklmnopqrstuvwxyz |
|
110 | 217 |
1234567890 |
218 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
219 |
' , |
|
398 | 220 |
(Character value:16rE4) asString , "/ umlaut a |
221 |
(Character value:16rF6) asString , "/ umlaut o |
|
222 |
(Character value:16rFC) asString , "/ umlaut u |
|
223 |
(Character value:16rC4) asString , "/ umlaut A |
|
224 |
(Character value:16rD6) asString , "/ umlaut O |
|
225 |
(Character value:16rDC) asString , "/ umlaut U |
|
226 |
(Character value:16rDF) asString , "/ sz |
|
227 |
(Character value:233) asString , "/ e-degu |
|
228 |
(Character value:232) asString , "/ e-grave |
|
229 |
(Character value:234) asString , "/ e-circonflex |
|
230 |
(Character value:197) asString , "/ A |
|
2276 | 231 |
(Character value:169) asString. "/ copyright |
232 |
^ t |
|
398 | 233 |
|
595 | 234 |
"Modified: 29.4.1996 / 09:46:19 / cg" |
0 | 235 |
! ! |
236 |
||
2852 | 237 |
!FontPanel class methodsFor:'menu specs'! |
238 |
||
239 |
previewMenu |
|
240 |
"This resource specification was automatically generated |
|
241 |
by the MenuEditor of ST/X." |
|
242 |
||
243 |
"Do not manually edit this!! If it is corrupted, |
|
244 |
the MenuEditor may not be able to read the specification." |
|
245 |
||
246 |
" |
|
247 |
MenuEditor new openOnClass:FontPanel andSelector:#previewMenu |
|
248 |
(Menu new fromLiteralArrayEncoding:(FontPanel previewMenu)) startUp |
|
249 |
" |
|
250 |
||
251 |
<resource: #menu> |
|
252 |
||
253 |
^ |
|
254 |
#(Menu |
|
255 |
( |
|
256 |
(MenuItem |
|
257 |
label: 'Copy' |
|
258 |
itemValue: previewCopySelection |
|
259 |
translateLabel: true |
|
260 |
) |
|
261 |
(MenuItem |
|
262 |
label: '-' |
|
263 |
) |
|
264 |
(MenuItem |
|
265 |
label: 'Show Character Set' |
|
266 |
itemValue: previewShowCharacterSet |
|
267 |
translateLabel: true |
|
268 |
) |
|
2875 | 269 |
(MenuItem |
270 |
label: 'Show Character Set (Using xfd)' |
|
271 |
itemValue: previewShowCharacterSetUsingXFD |
|
272 |
translateLabel: true |
|
273 |
isVisible: false |
|
274 |
) |
|
2852 | 275 |
) |
276 |
nil |
|
277 |
nil |
|
278 |
) |
|
279 |
! ! |
|
280 |
||
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
281 |
!FontPanel class methodsFor:'startup'! |
0 | 282 |
|
283 |
fontFromUser |
|
77 | 284 |
"open a fontPanel and return the selected font, or nil |
285 |
if abort is pressed" |
|
286 |
||
410 | 287 |
^ self fontFromUserInitial:nil |
288 |
||
289 |
" |
|
290 |
FontPanel fontFromUser |
|
291 |
" |
|
292 |
||
293 |
"Modified: 27.2.1996 / 00:51:59 / cg" |
|
294 |
! |
|
295 |
||
296 |
fontFromUserInitial:aFont |
|
595 | 297 |
"open a fontPanel showing aFont initially, |
298 |
and return the selected font, or nil if abort is pressed" |
|
410 | 299 |
|
413 | 300 |
^ self fontFromUserInitial:aFont title:nil |
301 |
||
302 |
" |
|
303 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) |
|
304 |
" |
|
305 |
||
306 |
"Created: 27.2.1996 / 00:51:44 / cg" |
|
595 | 307 |
"Modified: 29.4.1996 / 09:45:52 / cg" |
413 | 308 |
! |
309 |
||
310 |
fontFromUserInitial:aFont title:someTitle |
|
595 | 311 |
"open a fontPanel with title and return the selected font, |
312 |
or nil if abort is pressed" |
|
413 | 313 |
|
415 | 314 |
^ self fontFromUserInitial:aFont title:someTitle filter:nil |
315 |
||
316 |
" |
|
317 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font' |
|
318 |
" |
|
319 |
||
320 |
"Created: 27.2.1996 / 00:59:46 / cg" |
|
595 | 321 |
"Modified: 29.4.1996 / 09:45:34 / cg" |
415 | 322 |
! |
323 |
||
2849 | 324 |
fontFromUserInitial:initialFont title:someTitle filter:aFilterBlock |
595 | 325 |
"open a fontPanel with title and font-filter |
326 |
and return the selected font, or nil if abort is pressed" |
|
415 | 327 |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
328 |
|fontPanel selectedFont| |
77 | 329 |
|
0 | 330 |
fontPanel := FontPanel new. |
415 | 331 |
fontPanel filter:aFilterBlock. |
413 | 332 |
someTitle notNil ifTrue:[ |
333 |
fontPanel label:someTitle |
|
334 |
]. |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
335 |
fontPanel action:[:aFontDescription | selectedFont := aFontDescription]. |
2849 | 336 |
initialFont notNil ifTrue:[ |
337 |
fontPanel initialFont:initialFont. |
|
410 | 338 |
]. |
339 |
||
0 | 340 |
fontPanel showAtPointer. |
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
341 |
fontPanel destroy. |
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
342 |
^ selectedFont |
0 | 343 |
|
77 | 344 |
" |
413 | 345 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font' |
77 | 346 |
" |
410 | 347 |
|
413 | 348 |
"Created: 27.2.1996 / 00:59:46 / cg" |
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
349 |
"Modified: 10.4.1997 / 09:53:03 / cg" |
0 | 350 |
! ! |
351 |
||
352 |
!FontPanel methodsFor:'accessing'! |
|
353 |
||
595 | 354 |
action:aFourArgBlock |
355 |
"set the action to be evaluated on ok. |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
356 |
The block will be evaluated with family, face, style, size and encoding." |
595 | 357 |
|
358 |
okAction := aFourArgBlock |
|
359 |
||
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
360 |
"Modified: 10.4.1997 / 09:49:58 / cg" |
197 | 361 |
! |
362 |
||
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
363 |
encoding:aPattern |
595 | 364 |
"set the encoding goal" |
365 |
||
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
366 |
encoding := aPattern. |
2843 | 367 |
encodingFilter contents:encoding. |
368 |
||
369 |
self encodingFilterSelected:encoding. |
|
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
370 |
shown ifTrue:[ |
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
371 |
self updateFamilyList |
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
372 |
]. |
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
373 |
|
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
374 |
"Created: 29.2.1996 / 04:05:31 / cg" |
595 | 375 |
"Modified: 29.4.1996 / 09:40:18 / cg" |
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
376 |
! |
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
377 |
|
415 | 378 |
filter:aOneArgBlock |
595 | 379 |
"set a filter; if non-nil, only fonts for which the filterBlock |
380 |
returns true will be offered" |
|
381 |
||
415 | 382 |
filter := aOneArgBlock. |
2826 | 383 |
familyList list:nil. |
415 | 384 |
shown ifTrue:[ |
385 |
self updateFamilyList |
|
386 |
]. |
|
387 |
||
388 |
"Created: 27.2.1996 / 01:40:08 / cg" |
|
595 | 389 |
"Modified: 29.4.1996 / 09:40:49 / cg" |
415 | 390 |
! |
391 |
||
0 | 392 |
initialFont:aFont |
128 | 393 |
"set the font to be selected initially" |
0 | 394 |
|
2849 | 395 |
|encoding| |
396 |
||
128 | 397 |
selectedFont := aFont. |
2849 | 398 |
encoding := aFont encoding. |
399 |
"/ self halt. |
|
400 |
encodingFilter contents:encoding. |
|
401 |
self encodingFilterSelected:encoding. |
|
382 | 402 |
self showSelectedFont. |
403 |
self showPreview |
|
404 |
||
405 |
"Modified: 23.2.1996 / 00:51:32 / cg" |
|
101 | 406 |
! ! |
407 |
||
77 | 408 |
!FontPanel methodsFor:'initialization'! |
409 |
||
410 |
initialize |
|
382 | 411 |
|familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3 |
2847 | 412 |
mm fH eH l box showFontNameLabel| |
77 | 413 |
|
414 |
super initialize. |
|
415 |
||
2847 | 416 |
showFontNameLabel := device platformName ~= 'WIN32'. |
417 |
||
382 | 418 |
mm := ViewSpacing. |
419 |
||
1763 | 420 |
self addAbortAndOkButtons. |
77 | 421 |
|
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
422 |
panel := View origin:0.0@0.0 corner:1.0@1.0 in:self. |
2847 | 423 |
panel bottomInset:(buttonPanel preferredExtent y |
424 |
+ (mm*3) |
|
425 |
+ (showFontNameLabel ifTrue:24 ifFalse:0) ). |
|
77 | 426 |
|
150 | 427 |
label := resources string:'Font dialog'. |
77 | 428 |
|
2842 | 429 |
box := HorizontalPanelView in:panel. |
430 |
box horizontalLayout:#leftFit. |
|
431 |
box origin:0.0@1.0 corner:0.6@1.0. |
|
432 |
||
433 |
l := Label label:(resources string:'Encoding:') in:box. |
|
434 |
l borderWidth:0. |
|
435 |
l adjust:#left. |
|
436 |
||
437 |
encodingFilter := ComboBoxView in:box. |
|
2826 | 438 |
encodingFilter level:-1. |
439 |
encodingFilter contents:'*'. |
|
2842 | 440 |
encodingFilter list:(self listOfEncodingsInFilterCombo). |
2826 | 441 |
encodingFilter action:[:pattern | self encodingFilterSelected:pattern]. |
442 |
encodingFilter immediateAccept:true. |
|
2842 | 443 |
encodingFilter font:l font. |
444 |
encodingFilter editor font:l font. |
|
445 |
||
446 |
eH := encodingFilter preferredExtent y. |
|
447 |
box topInset:(eH negated-1); horizontalInset:mm. |
|
448 |
||
2826 | 449 |
"/ encodingFilter acceptOnReturn:true. |
450 |
"/ encodingFilter acceptOnTab:true. |
|
451 |
"/ encodingFilter acceptOnLeave:true. |
|
452 |
"/ encodingFilter acceptOnLostFocus:true. |
|
453 |
"/ encodingFilter acceptOnPointerLeave:true. |
|
454 |
||
382 | 455 |
encodingLabel := Label label:' ' in:panel. |
2842 | 456 |
"/ eH := encodingLabel preferredExtent y. |
457 |
encodingLabel origin:0.6@1.0 corner:1.0@1.0. |
|
382 | 458 |
encodingLabel topInset:(eH negated); horizontalInset:mm. |
2842 | 459 |
encodingLabel level:0; adjust:#left. |
460 |
encodingLabel adjust:#right. |
|
382 | 461 |
|
2847 | 462 |
showFontNameLabel ifTrue:[ |
463 |
nameLabel := Label label:'' in:self. |
|
464 |
nameLabel origin:0.0@1.0 corner:1.0@1.0. |
|
465 |
nameLabel bottomInset:(buttonPanel preferredExtent y + (mm*2)). |
|
466 |
nameLabel topInset:(buttonPanel preferredExtent y + (mm*2) + 24) negated; horizontalInset:mm. |
|
467 |
nameLabel level:0; adjust:#left. |
|
468 |
nameLabel font:(FontDescription family:'helvetica' face:'medium' style:'roman' size:9). |
|
469 |
]. |
|
382 | 470 |
|
2842 | 471 |
previewField := HVScrollableView for:TextView in:panel. |
472 |
previewField origin:0.0@0.0 corner:1.0@0.4. |
|
473 |
previewField autoHideScrollBars:true. |
|
474 |
previewField := previewField scrolledView. |
|
382 | 475 |
previewField inset:mm. |
77 | 476 |
|
477 |
self is3D ifTrue:[ |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
478 |
previewField level:-1. |
77 | 479 |
] ifFalse:[ |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
480 |
previewField borderWidth:1. |
77 | 481 |
]. |
482 |
||
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
483 |
fontBrowserView := View origin:0.0@0.4 corner:1.0@1.0 in:panel. |
382 | 484 |
fontBrowserView bottomInset:(eH + mm). |
77 | 485 |
|
486 |
v1 := View origin:0.0@0.0 corner:0.4@1.0 in:fontBrowserView. |
|
487 |
||
2842 | 488 |
familyLabel := Label label:(resources string:'Family') in:v1. |
77 | 489 |
familyLabel borderWidth:0. |
490 |
familyLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil). |
|
382 | 491 |
fH := familyLabel preferredExtent y. |
77 | 492 |
|
493 |
familyList := ScrollableView for:SelectionInListView in:v1. |
|
382 | 494 |
familyList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
495 |
familyList inset:mm. |
|
496 |
familyList topInset:fH. |
|
497 |
||
128 | 498 |
familyList := familyList scrolledView. |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
499 |
self makeTabable:familyList. |
77 | 500 |
|
501 |
v2 := View origin:0.4@0.0 corner:0.8@1.0 |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
502 |
in:fontBrowserView. |
77 | 503 |
|
2842 | 504 |
faceLabel := Label label:(resources string:'Typeface') in:v2. |
77 | 505 |
faceLabel borderWidth:0. |
506 |
faceLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil). |
|
507 |
||
508 |
faceList := ScrollableView for:SelectionInListView in:v2. |
|
382 | 509 |
faceList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
510 |
faceList inset:mm. |
|
511 |
faceList topInset:fH. |
|
128 | 512 |
faceList := faceList scrolledView. |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
513 |
self makeTabable:faceList. |
77 | 514 |
|
2842 | 515 |
v3 := View origin:0.8@0.0 corner:1.0@1.0 in:fontBrowserView. |
77 | 516 |
|
2842 | 517 |
sizeLabel := Label label:(resources string:'Size') in:v3. |
77 | 518 |
sizeLabel borderWidth:0. |
519 |
sizeLabel origin:(0.0 @ 0.0)extent:(1.0 @ nil). |
|
520 |
||
521 |
sizeList := ScrollableView for:SelectionInListView in:v3. |
|
382 | 522 |
sizeList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
523 |
sizeList inset:mm. |
|
524 |
sizeList topInset:fH. |
|
128 | 525 |
sizeList := sizeList scrolledView. |
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
526 |
self makeTabable:sizeList. |
77 | 527 |
|
528 |
familyList action:[:lineNr | self familySelected:(familyList selectionValue)]. |
|
529 |
faceList action:[:lineNr | self faceSelected:(faceList selectionValue)]. |
|
530 |
sizeList action:[:lineNr | self sizeSelected:(sizeList selectionValue)]. |
|
531 |
||
2852 | 532 |
previewField menuHolder:self previewMenu. |
533 |
||
77 | 534 |
" |
535 |
FontPanel new showAtPointer |
|
536 |
" |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
537 |
|
740
2d5cb01c7e11
no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
538 |
"Modified: 31.5.1996 / 22:01:45 / cg" |
77 | 539 |
! |
540 |
||
2842 | 541 |
listOfEncodingsInFilterCombo |
2878 | 542 |
|availableEncodings listPresentedToUser| |
2842 | 543 |
|
2878 | 544 |
listOfEncodings := OrderedCollection new. |
2849 | 545 |
device platformName = 'WIN32' ifTrue:[ |
2878 | 546 |
listOfEncodings |
2849 | 547 |
addAll: |
548 |
#( |
|
549 |
'*' |
|
550 |
'ANSI' |
|
551 |
nil |
|
552 |
). |
|
553 |
] ifFalse:[ |
|
2878 | 554 |
listOfEncodings |
2849 | 555 |
addAll: |
556 |
#( |
|
557 |
'*' |
|
558 |
'iso8859*' |
|
559 |
'iso10646-1' |
|
560 |
'jis*' |
|
561 |
nil |
|
562 |
). |
|
563 |
]. |
|
2842 | 564 |
|
565 |
availableEncodings := Set new. |
|
2845 | 566 |
device listOfAvailableFonts do:[:f | availableEncodings add:(f encoding ? '?')]. |
2842 | 567 |
availableEncodings := availableEncodings asSortedCollection. |
2878 | 568 |
listOfEncodings addAll:availableEncodings. |
569 |
||
570 |
listPresentedToUser := listOfEncodings collect:[:enc | |
|
571 |
|encoder userFriendlyName| |
|
572 |
||
573 |
enc notNil ifTrue:[ |
|
574 |
encoder := CharacterEncoder unicodeEncoderFor:enc ifAbsent:nil. |
|
575 |
encoder notNil ifTrue:[ |
|
576 |
userFriendlyName := encoder class userFriendlyNameOfEncoding. |
|
577 |
]. |
|
578 |
]. |
|
579 |
(userFriendlyName notNil and:[userFriendlyName ~= enc]) ifTrue:[ |
|
580 |
enc , ' (' , userFriendlyName , ')' |
|
581 |
] ifFalse:[ |
|
582 |
enc |
|
583 |
] |
|
584 |
]. |
|
585 |
^ listPresentedToUser. |
|
2842 | 586 |
! |
587 |
||
1277 | 588 |
postRealize |
197 | 589 |
"kludge for sco - xlsfont fails sometimes - try again here" |
590 |
||
415 | 591 |
self updateFamilyList. |
1277 | 592 |
super postRealize |
415 | 593 |
|
594 |
"Modified: 27.2.1996 / 01:40:47 / cg" |
|
1277 | 595 |
"Created: 24.7.1997 / 18:12:42 / cg" |
2852 | 596 |
! |
597 |
||
598 |
previewMenu |
|
599 |
<resource: #programMenu > |
|
600 |
||
601 |
|menu| |
|
602 |
||
603 |
menu := Menu new fromLiteralArrayEncoding:self class previewMenu. |
|
604 |
menu findGuiResourcesIn:self. |
|
605 |
menu receiver:self. |
|
2875 | 606 |
|
607 |
OperatingSystem isUNIXlike ifTrue:[ |
|
608 |
(menu menuItemWithValue:#previewShowCharacterSetUsingXFD) isVisible: true |
|
609 |
]. |
|
2852 | 610 |
^ menu |
77 | 611 |
! ! |
612 |
||
0 | 613 |
!FontPanel methodsFor:'private'! |
614 |
||
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
615 |
clearPreview |
595 | 616 |
"clear the preview subview" |
617 |
||
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
618 |
shown ifTrue:[ |
1297
f5ea02391a59
use #contents: instead of #clear
Claus Gittinger <cg@exept.de>
parents:
1284
diff
changeset
|
619 |
previewField contents:nil. |
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
620 |
encodingLabel label:''. |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
621 |
]. |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
622 |
|
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
623 |
"Created: 17.4.1996 / 15:19:16 / cg" |
1297
f5ea02391a59
use #contents: instead of #clear
Claus Gittinger <cg@exept.de>
parents:
1284
diff
changeset
|
624 |
"Modified: 11.8.1997 / 03:01:42 / cg" |
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
625 |
! |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
626 |
|
197 | 627 |
extractFaceAndStyleFrom:aString |
595 | 628 |
"given a string, extract currentFace and currentStyle" |
629 |
||
197 | 630 |
|index| |
631 |
||
632 |
index := aString indexOf:$-. |
|
633 |
(index ~~ 0) ifTrue:[ |
|
595 | 634 |
currentFaceAndStyle := aString. |
635 |
currentFace := aString copyTo:(index - 1). |
|
636 |
currentStyle := aString copyFrom:(index + 1) |
|
197 | 637 |
] |
638 |
||
595 | 639 |
"Modified: 29.4.1996 / 09:41:47 / cg" |
197 | 640 |
! |
641 |
||
642 |
showPreview |
|
595 | 643 |
"show the preview text" |
644 |
||
2843 | 645 |
|font deviceFont enc s allFonts fonts fontName| |
382 | 646 |
|
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
647 |
self clearPreview. |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
648 |
|
197 | 649 |
" |
650 |
show a wait cursor: for some fonts (kanji etc) the |
|
651 |
X-server needs quites some time to load the font |
|
652 |
" |
|
255 | 653 |
self withWaitCursorDo:[ |
2842 | 654 |
allFonts := device |
1257 | 655 |
fontsInFamily:(currentFamily ? '*') |
656 |
face:(currentFace ? '*') |
|
657 |
style:(currentStyle ? '*') |
|
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
658 |
filtering:filter. |
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
659 |
|
2848 | 660 |
fonts := allFonts select:[:f | f size = currentSize]. |
450 | 661 |
fonts notEmpty ifTrue:[ |
2843 | 662 |
font := fonts anElement. |
450 | 663 |
] ifFalse:[ |
2848 | 664 |
"/ mhmh: |
665 |
"/ size=0 is returned for scalable fonts. |
|
666 |
"/ Any size is possible. |
|
450 | 667 |
"/ |
2848 | 668 |
fonts := allFonts select:[:f | f size = 0]. |
450 | 669 |
fonts notEmpty ifTrue:[ |
2843 | 670 |
font := Font family:currentFamily |
450 | 671 |
face:currentFace |
672 |
style:currentStyle |
|
673 |
size:currentSize |
|
674 |
encoding:(fonts anElement encoding). |
|
675 |
] |
|
676 |
]. |
|
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
677 |
|
2843 | 678 |
font notNil ifTrue:[ |
2874 | 679 |
enc := font encoding. |
2875 | 680 |
enc isNil ifTrue:[enc := 'fontspecific']. |
434
22586d8221e1
dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents:
415
diff
changeset
|
681 |
|
2874 | 682 |
deviceFont := font onDevice:device. |
683 |
||
684 |
previewField font:deviceFont. |
|
685 |
previewField characterEncoding:enc. |
|
686 |
||
2287
b33ad40d7538
preview fixed when font is bad
Claus Gittinger <cg@exept.de>
parents:
2286
diff
changeset
|
687 |
encodingLabel label:enc. |
2843 | 688 |
currentEncoding := enc. |
689 |
fontName := deviceFont fullName. |
|
382 | 690 |
|
2842 | 691 |
(enc notNil and:[enc startsWith:'jis']) ifTrue:[ |
2860 | 692 |
(enc includesString:'0201') ifTrue:[ |
693 |
s := self class defaultJIS0201SampleString |
|
694 |
] ifFalse:[ |
|
695 |
s := self class defaultJISSampleString |
|
696 |
] |
|
2842 | 697 |
] ifFalse:[ |
2847 | 698 |
s := self class defaultLatin1SampleString. |
2842 | 699 |
]. |
700 |
previewField contents:s. |
|
382 | 701 |
] ifFalse:[ |
2842 | 702 |
previewField contents:nil. |
703 |
encodingLabel label:nil. |
|
2843 | 704 |
currentEncoding := nil. |
2842 | 705 |
fontName := nil. |
382 | 706 |
]. |
2842 | 707 |
nameLabel notNil ifTrue:[nameLabel label:fontName]. |
197 | 708 |
] |
255 | 709 |
|
1257 | 710 |
"Modified: 30.6.1997 / 17:26:22 / cg" |
197 | 711 |
! |
712 |
||
128 | 713 |
showSelectedFont |
2843 | 714 |
|fam face faceAndStyle style sz| |
128 | 715 |
|
716 |
fam := selectedFont family. |
|
2843 | 717 |
currentEncoding := selectedFont encoding. |
718 |
||
2842 | 719 |
self familySelected:fam. |
128 | 720 |
fam notNil ifTrue:[ |
2842 | 721 |
face := selectedFont face. |
722 |
(face notNil and:[(style := selectedFont style) notNil]) ifTrue:[ |
|
723 |
faceAndStyle := face , '-' , style. |
|
724 |
]. |
|
725 |
self faceSelected:faceAndStyle. |
|
726 |
faceAndStyle notNil ifTrue:[ |
|
727 |
sz := selectedFont size. |
|
728 |
self sizeSelected:sz. |
|
2843 | 729 |
|
2842 | 730 |
"/ sz notNil ifTrue:[ |
731 |
"/ enc := selectedFont encoding. |
|
732 |
"/ self encodingSelected:enc |
|
733 |
"/ ] |
|
734 |
] |
|
735 |
]. |
|
2826 | 736 |
! |
737 |
||
738 |
updateFamilyList |
|
739 |
"update the list of font families" |
|
740 |
||
741 |
|families| |
|
742 |
||
743 |
familyList list isNil ifTrue:[ |
|
744 |
families := device fontFamiliesFiltering:filter. |
|
745 |
families notNil ifTrue:[ |
|
746 |
families := families asOrderedCollection sort |
|
747 |
]. |
|
748 |
familyList list:families |
|
749 |
]. |
|
750 |
selectedFont notNil ifTrue:[ |
|
751 |
self showSelectedFont |
|
752 |
]. |
|
753 |
||
754 |
"Modified: 27.2.1996 / 01:39:42 / cg" |
|
755 |
"Created: 27.2.1996 / 01:40:37 / cg" |
|
197 | 756 |
! ! |
128 | 757 |
|
197 | 758 |
!FontPanel methodsFor:'queries'! |
0 | 759 |
|
197 | 760 |
preferredExtent |
595 | 761 |
"return the boxes preferredExtent" |
572 | 762 |
|
797 | 763 |
"/ If I have an explicit preferredExtent .. |
764 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
765 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
766 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
767 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
690
diff
changeset
|
768 |
|
2842 | 769 |
^ 450@350 |
572 | 770 |
|
797 | 771 |
"Modified: 19.7.1996 / 20:44:08 / cg" |
0 | 772 |
! ! |
77 | 773 |
|
774 |
!FontPanel methodsFor:'user interaction'! |
|
775 |
||
2826 | 776 |
encodingFilterSelected:anEncodingPattern |
777 |
"another encoding was selected; find available fonts and update lists" |
|
778 |
||
779 |
|pattern| |
|
780 |
||
2878 | 781 |
pattern := (anEncodingPattern upTo:$( ) withoutSeparators. |
782 |
||
783 |
pattern = '?' ifTrue:[ |
|
2845 | 784 |
pattern := '' |
785 |
] ifFalse:[ |
|
2878 | 786 |
pattern := (pattern isEmptyOrNil ifTrue:'*' ifFalse:pattern). |
2845 | 787 |
]. |
2826 | 788 |
self |
789 |
filter: |
|
790 |
[:f | |
|
791 |
|encoding| |
|
792 |
||
793 |
encoding := f encoding ? ''. |
|
794 |
pattern match:encoding |
|
795 |
]. |
|
796 |
! |
|
797 |
||
197 | 798 |
faceSelected:aFaceAndStyleName |
2826 | 799 |
"a fonts face was selected; find available sizes and update lists" |
595 | 800 |
|
2842 | 801 |
self faceSelected:aFaceAndStyleName showPreview:true |
802 |
! |
|
803 |
||
804 |
faceSelected:aFaceAndStyleName showPreview:showPreview |
|
805 |
"a fonts face was selected; find available sizes and update lists" |
|
806 |
||
197 | 807 |
|sizes| |
808 |
||
809 |
aFaceAndStyleName notNil ifTrue:[ |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
810 |
self extractFaceAndStyleFrom:aFaceAndStyleName. |
197 | 811 |
]. |
812 |
sizes := device |
|
1257 | 813 |
sizesInFamily:(currentFamily ? '*') |
814 |
face:(currentFace ? '*') |
|
815 |
style:(currentStyle ? '*') |
|
415 | 816 |
filtering:filter. |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
817 |
|
197 | 818 |
(sizes isNil or:[sizes isEmpty]) ifTrue:[ |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
819 |
sizeList list:nil. |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
820 |
currentSize := nil. |
2842 | 821 |
showPreview ifTrue:[ |
822 |
self showPreview. |
|
823 |
]. |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
824 |
^ self |
197 | 825 |
]. |
826 |
||
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
827 |
self clearPreview. |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
828 |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
829 |
sizes := (sizes asOrderedCollection sort) collect:[:entry | entry printString]. |
197 | 830 |
sizeList list:sizes. |
831 |
currentSize notNil ifTrue:[ |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
832 |
(sizes includes:(currentSize printString)) ifTrue:[ |
2170 | 833 |
sizeList setSelectElement:currentSize printString. |
2842 | 834 |
showPreview ifTrue:[ |
835 |
self showPreview |
|
836 |
] |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
837 |
] |
197 | 838 |
] |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
839 |
|
1257 | 840 |
"Modified: 30.6.1997 / 17:25:46 / cg" |
197 | 841 |
! |
842 |
||
77 | 843 |
familySelected:aFamilyName |
2826 | 844 |
"a fonts family was selected; find available faces and update lists" |
595 | 845 |
|
2842 | 846 |
self familySelected:aFamilyName showPreview:true |
847 |
! |
|
848 |
||
849 |
familySelected:aFamilyName showPreview:showPreview |
|
850 |
"a fonts family was selected; find available faces and update lists" |
|
851 |
||
77 | 852 |
|faces styles list| |
853 |
||
690 | 854 |
familyList setSelectElement:aFamilyName. |
77 | 855 |
|
856 |
currentFamily := aFamilyName. |
|
415 | 857 |
faces := device facesInFamily:aFamilyName filtering:filter. |
2353 | 858 |
(faces size = 0) ifTrue:[ |
415 | 859 |
currentFace := currentStyle := currentFaceAndStyle := nil. |
860 |
faceList list:nil. |
|
2842 | 861 |
self faceSelected:nil showPreview:showPreview. |
415 | 862 |
^ self. |
77 | 863 |
]. |
864 |
||
2353 | 865 |
list := SortedCollection new. |
77 | 866 |
faces do:[:aFace | |
415 | 867 |
styles := device stylesInFamily:aFamilyName face:aFace filtering:filter. |
868 |
styles do:[:aStyle | |
|
869 |
list add:(aFace , '-' , aStyle) |
|
870 |
] |
|
77 | 871 |
]. |
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
872 |
|
77 | 873 |
faceList list:list. |
874 |
currentFaceAndStyle notNil ifTrue:[ |
|
415 | 875 |
(list includes:currentFaceAndStyle) ifTrue:[ |
690 | 876 |
faceList setSelectElement:currentFaceAndStyle. |
2842 | 877 |
self faceSelected:currentFaceAndStyle showPreview:showPreview. |
415 | 878 |
^ self |
879 |
] |
|
77 | 880 |
]. |
2842 | 881 |
|
541
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
882 |
sizeList list:nil. |
76018ea821ca
clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents:
540
diff
changeset
|
883 |
self clearPreview. |
415 | 884 |
|
690 | 885 |
"Modified: 26.5.1996 / 15:04:29 / cg" |
77 | 886 |
! |
887 |
||
888 |
okPressed |
|
595 | 889 |
"ok was pressed; hide myself and evaluate the okAction, passing |
890 |
family, face, style and size as arguments" |
|
891 |
||
77 | 892 |
self hide. |
893 |
okAction notNil ifTrue:[ |
|
410 | 894 |
currentFamily notNil ifTrue:[ |
2842 | 895 |
okAction |
896 |
value:(FontDescription |
|
897 |
family:currentFamily |
|
898 |
face:currentFace |
|
899 |
style:currentStyle |
|
900 |
size:currentSize |
|
2843 | 901 |
encoding:(currentEncoding ? encoding)). |
410 | 902 |
] |
77 | 903 |
] |
410 | 904 |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
905 |
"Modified: 10.4.1997 / 09:51:31 / cg" |
77 | 906 |
! |
907 |
||
2852 | 908 |
previewCopySelection |
909 |
previewField copySelection. |
|
910 |
! |
|
911 |
||
912 |
previewShowCharacterSet |
|
913 |
CharacterSetView openOn:(previewField font) |
|
914 |
! |
|
915 |
||
2875 | 916 |
previewShowCharacterSetUsingXFD |
2878 | 917 |
[ |
918 |
OperatingSystem executeCommand:'xfd -fn ' , previewField font fullName. |
|
919 |
] fork. |
|
2875 | 920 |
! |
921 |
||
77 | 922 |
sizeSelected:aNumberOrString |
2826 | 923 |
"a size was selected; update preview" |
595 | 924 |
|
2842 | 925 |
self sizeSelected:aNumberOrString showPreview:true. |
926 |
! |
|
927 |
||
928 |
sizeSelected:aNumberOrString showPreview:showPreview |
|
929 |
"a size was selected; update preview" |
|
930 |
||
77 | 931 |
aNumberOrString isNumber ifTrue:[ |
595 | 932 |
currentSize := aNumberOrString |
77 | 933 |
] ifFalse:[ |
2826 | 934 |
currentSize := Number readFromString:aNumberOrString onError:nil |
77 | 935 |
]. |
2842 | 936 |
showPreview ifTrue:[self showPreview] |
595 | 937 |
|
938 |
"Modified: 29.4.1996 / 09:43:23 / cg" |
|
77 | 939 |
! ! |
197 | 940 |
|
1185
3b8bd5ea8d62
action block is evaluated with a fontDescription
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
941 |
!FontPanel class methodsFor:'documentation'! |
243 | 942 |
|
943 |
version |
|
2878 | 944 |
^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.65 2004-02-13 13:42:46 cg Exp $' |
243 | 945 |
! ! |