author | Claus Gittinger <cg@exept.de> |
Tue, 27 Feb 1996 02:11:51 +0100 | |
changeset 415 | 2184fe27349a |
parent 413 | 7474707a9e9b |
child 434 | 22586d8221e1 |
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 |
||
15 |
DialogBox subclass:#FontPanel |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
16 |
instanceVariableNames:'previewField familyList faceList sizeList revertButton |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
17 |
currentFamily currentFace currentStyle currentFaceAndStyle |
415 | 18 |
currentSize selectedFont nameLabel encodingLabel filter' |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
19 |
classVariableNames:'' |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
20 |
poolDictionaries:'' |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
21 |
category:'Views-DialogBoxes' |
0 | 22 |
! |
23 |
||
77 | 24 |
!FontPanel class methodsFor:'documentation'! |
25 |
||
197 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
77 | 40 |
! |
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
this class implements a font chooser. |
|
45 |
||
46 |
usage: |
|
0 | 47 |
|
77 | 48 |
|panel| |
49 |
||
50 |
panel := FontPanel new. |
|
51 |
panel action:[:aFont | Transcript showCR:'the font is' , aFont printString]. |
|
52 |
panel show |
|
53 |
||
54 |
or simply: |
|
55 |
||
56 |
font := FontPanel fontFromUser |
|
57 |
" |
|
58 |
||
59 |
! ! |
|
0 | 60 |
|
61 |
!FontPanel class methodsFor:'defaults'! |
|
62 |
||
197 | 63 |
defaultExtent |
64 |
^ (Screen current pixelPerMillimeter * (120 @ 100)) rounded |
|
65 |
! |
|
66 |
||
382 | 67 |
defaultJISSampleString |
68 |
^ ('The quick brown fox |
|
69 |
jumps over the lazy dog |
|
70 |
1234567890 |
|
71 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
72 |
|
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
73 |
\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
|
74 |
' withEscapes decodeFrom:#jis7) |
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
75 |
|
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
76 |
"Modified: 23.2.1996 / 23:33:37 / cg" |
382 | 77 |
! |
78 |
||
79 |
defaultRomanSampleString |
|
110 | 80 |
^ 'The quick brown fox |
81 |
jumps over the lazy dog |
|
82 |
1234567890 |
|
83 |
!!@#$%^&*(){}[]:"~;,./<>? |
|
84 |
' , |
|
398 | 85 |
(Character value:16rE4) asString , "/ umlaut a |
86 |
(Character value:16rF6) asString , "/ umlaut o |
|
87 |
(Character value:16rFC) asString , "/ umlaut u |
|
88 |
(Character value:16rC4) asString , "/ umlaut A |
|
89 |
(Character value:16rD6) asString , "/ umlaut O |
|
90 |
(Character value:16rDC) asString , "/ umlaut U |
|
91 |
(Character value:16rDF) asString , "/ sz |
|
92 |
(Character value:233) asString , "/ e-degu |
|
93 |
(Character value:232) asString , "/ e-grave |
|
94 |
(Character value:234) asString , "/ e-circonflex |
|
95 |
(Character value:197) asString , "/ A |
|
96 |
(Character value:169) asString "/ copyright |
|
97 |
||
98 |
"Modified: 24.2.1996 / 22:45:16 / cg" |
|
0 | 99 |
! ! |
100 |
||
101 |
!FontPanel class methodsFor:'startup'! |
|
102 |
||
103 |
fontFromUser |
|
77 | 104 |
"open a fontPanel and return the selected font, or nil |
105 |
if abort is pressed" |
|
106 |
||
410 | 107 |
^ self fontFromUserInitial:nil |
108 |
||
109 |
" |
|
110 |
FontPanel fontFromUser |
|
111 |
" |
|
112 |
||
113 |
"Modified: 27.2.1996 / 00:51:59 / cg" |
|
114 |
! |
|
115 |
||
116 |
fontFromUserInitial:aFont |
|
117 |
"open a fontPanel and return the selected font, or nil |
|
118 |
if abort is pressed" |
|
119 |
||
413 | 120 |
^ self fontFromUserInitial:aFont title:nil |
121 |
||
122 |
" |
|
123 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) |
|
124 |
" |
|
125 |
||
126 |
"Created: 27.2.1996 / 00:51:44 / cg" |
|
127 |
"Modified: 27.2.1996 / 01:00:03 / cg" |
|
128 |
! |
|
129 |
||
130 |
fontFromUserInitial:aFont title:someTitle |
|
131 |
"open a fontPanel and return the selected font, or nil |
|
132 |
if abort is pressed" |
|
133 |
||
415 | 134 |
^ self fontFromUserInitial:aFont title:someTitle filter:nil |
135 |
||
136 |
" |
|
137 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font' |
|
138 |
" |
|
139 |
||
140 |
"Created: 27.2.1996 / 00:59:46 / cg" |
|
141 |
"Modified: 27.2.1996 / 01:00:12 / cg" |
|
142 |
! |
|
143 |
||
144 |
fontFromUserInitial:aFont title:someTitle filter:aFilterBlock |
|
145 |
"open a fontPanel and return the selected font, or nil |
|
146 |
if abort is pressed" |
|
147 |
||
0 | 148 |
|fontPanel| |
77 | 149 |
|
0 | 150 |
fontPanel := FontPanel new. |
415 | 151 |
fontPanel filter:aFilterBlock. |
413 | 152 |
someTitle notNil ifTrue:[ |
153 |
fontPanel label:someTitle |
|
154 |
]. |
|
0 | 155 |
fontPanel action:[:family :face :style :size | |
410 | 156 |
^ (Font family:family |
157 |
face:face |
|
158 |
style:style |
|
159 |
size:size) |
|
0 | 160 |
]. |
410 | 161 |
aFont notNil ifTrue:[ |
162 |
fontPanel initialFont:aFont. |
|
163 |
]. |
|
164 |
||
0 | 165 |
fontPanel showAtPointer. |
166 |
^ nil |
|
167 |
||
77 | 168 |
" |
413 | 169 |
FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font' |
77 | 170 |
" |
410 | 171 |
|
413 | 172 |
"Created: 27.2.1996 / 00:59:46 / cg" |
173 |
"Modified: 27.2.1996 / 01:00:12 / cg" |
|
0 | 174 |
! ! |
175 |
||
176 |
!FontPanel methodsFor:'accessing'! |
|
177 |
||
197 | 178 |
action:aBlock |
179 |
okAction := aBlock |
|
180 |
! |
|
181 |
||
415 | 182 |
filter:aOneArgBlock |
183 |
filter := aOneArgBlock. |
|
184 |
shown ifTrue:[ |
|
185 |
self updateFamilyList |
|
186 |
]. |
|
187 |
||
188 |
"Created: 27.2.1996 / 01:40:08 / cg" |
|
189 |
"Modified: 27.2.1996 / 01:41:33 / cg" |
|
190 |
! |
|
191 |
||
0 | 192 |
initialFont:aFont |
128 | 193 |
"set the font to be selected initially" |
0 | 194 |
|
128 | 195 |
selectedFont := aFont. |
382 | 196 |
self showSelectedFont. |
197 |
self showPreview |
|
198 |
||
199 |
"Modified: 23.2.1996 / 00:51:32 / cg" |
|
101 | 200 |
! ! |
201 |
||
77 | 202 |
!FontPanel methodsFor:'initialization'! |
203 |
||
197 | 204 |
focusSequence |
205 |
|a| |
|
77 | 206 |
|
197 | 207 |
a := Array new:5. |
208 |
a at:1 put:familyList. |
|
209 |
a at:2 put:faceList. |
|
210 |
a at:3 put:sizeList. |
|
211 |
a at:4 put:abortButton. |
|
212 |
a at:5 put:okButton. |
|
213 |
^ a |
|
77 | 214 |
! |
215 |
||
216 |
initialize |
|
382 | 217 |
|familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3 |
218 |
mm fH eH| |
|
77 | 219 |
|
220 |
super initialize. |
|
221 |
||
382 | 222 |
mm := ViewSpacing. |
223 |
||
77 | 224 |
self addAbortButton. |
225 |
self addOkButton. |
|
226 |
||
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
227 |
panel := View origin:0.0@0.0 corner:1.0@1.0 in:self. |
382 | 228 |
panel bottomInset:(buttonPanel preferredExtent y + (mm*3)). |
77 | 229 |
|
150 | 230 |
label := resources string:'Font dialog'. |
77 | 231 |
|
382 | 232 |
encodingLabel := Label label:' ' in:panel. |
233 |
eH := encodingLabel preferredExtent y. |
|
234 |
encodingLabel origin:0.7@1.0 corner:1.0@1.0. |
|
235 |
encodingLabel topInset:(eH negated); horizontalInset:mm. |
|
236 |
encodingLabel level:-1; adjust:#left. |
|
237 |
||
238 |
"/ nameLabel := Label label:' ' in:panel. |
|
239 |
"/ nameLabel origin:0.0@1.0 corner:0.7@1.0. |
|
240 |
"/ nameLabel topInset:(eH negated); horizontalInset:mm. |
|
241 |
"/ nameLabel level:-1; adjust:#left. |
|
242 |
||
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
243 |
previewField := TextView origin:0.0@0.0 corner:1.0@0.4 in:panel. |
382 | 244 |
previewField inset:mm. |
77 | 245 |
|
382 | 246 |
"/ previewField contents:self class defaultSampleString. |
77 | 247 |
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
|
248 |
previewField level:-1. |
77 | 249 |
] ifFalse:[ |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
250 |
previewField borderWidth:1. |
77 | 251 |
]. |
252 |
||
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
253 |
fontBrowserView := View origin:0.0@0.4 corner:1.0@1.0 in:panel. |
382 | 254 |
fontBrowserView bottomInset:(eH + mm). |
77 | 255 |
|
256 |
v1 := View origin:0.0@0.0 corner:0.4@1.0 in:fontBrowserView. |
|
257 |
||
258 |
familyLabel := Label label:'Family' in:v1. |
|
259 |
familyLabel borderWidth:0. |
|
260 |
familyLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil). |
|
382 | 261 |
fH := familyLabel preferredExtent y. |
77 | 262 |
|
263 |
familyList := ScrollableView for:SelectionInListView in:v1. |
|
382 | 264 |
familyList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
265 |
familyList inset:mm. |
|
266 |
familyList topInset:fH. |
|
267 |
||
128 | 268 |
familyList := familyList scrolledView. |
77 | 269 |
|
270 |
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
|
271 |
in:fontBrowserView. |
77 | 272 |
|
273 |
faceLabel := Label label:'Typeface' in:v2. |
|
274 |
faceLabel borderWidth:0. |
|
275 |
faceLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil). |
|
276 |
||
277 |
faceList := ScrollableView for:SelectionInListView in:v2. |
|
382 | 278 |
faceList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
279 |
faceList inset:mm. |
|
280 |
faceList topInset:fH. |
|
128 | 281 |
faceList := faceList scrolledView. |
77 | 282 |
|
283 |
v3 := View origin:0.8@0.0 corner:1.0@1.0 |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
284 |
in:fontBrowserView. |
77 | 285 |
|
286 |
sizeLabel := Label label:'Size' in:v3. |
|
287 |
sizeLabel borderWidth:0. |
|
288 |
sizeLabel origin:(0.0 @ 0.0)extent:(1.0 @ nil). |
|
289 |
||
290 |
sizeList := ScrollableView for:SelectionInListView in:v3. |
|
382 | 291 |
sizeList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
292 |
sizeList inset:mm. |
|
293 |
sizeList topInset:fH. |
|
128 | 294 |
sizeList := sizeList scrolledView. |
77 | 295 |
|
296 |
familyList action:[:lineNr | self familySelected:(familyList selectionValue)]. |
|
297 |
faceList action:[:lineNr | self faceSelected:(faceList selectionValue)]. |
|
298 |
sizeList action:[:lineNr | self sizeSelected:(sizeList selectionValue)]. |
|
299 |
||
300 |
" |
|
301 |
FontPanel new showAtPointer |
|
302 |
" |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
303 |
|
390
1d54a9b41463
say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents:
382
diff
changeset
|
304 |
"Modified: 23.2.1996 / 23:36:01 / cg" |
77 | 305 |
! |
306 |
||
197 | 307 |
realize |
308 |
"kludge for sco - xlsfont fails sometimes - try again here" |
|
309 |
||
415 | 310 |
self updateFamilyList. |
311 |
super realize |
|
312 |
||
313 |
"Modified: 27.2.1996 / 01:40:47 / cg" |
|
314 |
! |
|
315 |
||
316 |
updateFamilyList |
|
317 |
"kludge for sco - xlsfont fails sometimes - try again here" |
|
318 |
||
197 | 319 |
|families| |
77 | 320 |
|
197 | 321 |
familyList list isNil ifTrue:[ |
415 | 322 |
families := device fontFamiliesFiltering:filter. |
323 |
families notNil ifTrue:[ |
|
324 |
families := families asOrderedCollection |
|
325 |
]. |
|
326 |
familyList list:families |
|
197 | 327 |
]. |
328 |
selectedFont notNil ifTrue:[ |
|
415 | 329 |
self showSelectedFont |
197 | 330 |
]. |
415 | 331 |
|
332 |
"Modified: 27.2.1996 / 01:39:42 / cg" |
|
333 |
"Created: 27.2.1996 / 01:40:37 / cg" |
|
77 | 334 |
! ! |
335 |
||
0 | 336 |
!FontPanel methodsFor:'private'! |
337 |
||
197 | 338 |
extractFaceAndStyleFrom:aString |
339 |
|index| |
|
340 |
||
341 |
index := aString indexOf:$-. |
|
342 |
(index ~~ 0) ifTrue:[ |
|
343 |
currentFaceAndStyle := aString. |
|
344 |
currentFace := aString copyTo:(index - 1). |
|
345 |
currentStyle := aString copyFrom:(index + 1) |
|
346 |
] |
|
347 |
||
348 |
! |
|
349 |
||
350 |
showPreview |
|
382 | 351 |
|f enc s| |
352 |
||
197 | 353 |
shown ifTrue:[ |
255 | 354 |
previewField clear. |
197 | 355 |
]. |
356 |
" |
|
357 |
show a wait cursor: for some fonts (kanji etc) the |
|
358 |
X-server needs quites some time to load the font |
|
359 |
" |
|
255 | 360 |
self withWaitCursorDo:[ |
382 | 361 |
previewField font:(f := Font family:currentFamily |
362 |
face:currentFace |
|
363 |
style:currentStyle |
|
364 |
size:currentSize). |
|
365 |
enc := f encoding. |
|
366 |
"/ enc isNil ifTrue:[enc := 'ASCII ?']. |
|
367 |
encodingLabel label:enc. |
|
368 |
nameLabel notNil ifTrue:[nameLabel label:(f fullName)]. |
|
369 |
||
399 | 370 |
(enc notNil and:[enc startsWith:'jis']) ifTrue:[ |
382 | 371 |
s := self class defaultJISSampleString |
372 |
] ifFalse:[ |
|
373 |
s := self class defaultRomanSampleString. |
|
374 |
]. |
|
375 |
previewField contents:s . |
|
197 | 376 |
] |
255 | 377 |
|
399 | 378 |
"Modified: 24.2.1996 / 23:47:03 / cg" |
197 | 379 |
! |
380 |
||
128 | 381 |
showSelectedFont |
382 |
|fam face style sz| |
|
383 |
||
384 |
fam := selectedFont family. |
|
385 |
fam notNil ifTrue:[ |
|
386 |
self familySelected:fam. |
|
387 |
face := selectedFont face. |
|
388 |
face notNil ifTrue:[ |
|
389 |
style := selectedFont style. |
|
390 |
style notNil ifTrue:[ |
|
391 |
self faceSelected:(face , '-' , style). |
|
392 |
sz := selectedFont size. |
|
393 |
sz notNil ifTrue:[ |
|
394 |
self sizeSelected:sz |
|
395 |
] |
|
396 |
] |
|
397 |
] |
|
398 |
] |
|
197 | 399 |
! ! |
128 | 400 |
|
197 | 401 |
!FontPanel methodsFor:'queries'! |
0 | 402 |
|
197 | 403 |
preferredExtent |
404 |
^ 400@350 |
|
0 | 405 |
! ! |
77 | 406 |
|
407 |
!FontPanel methodsFor:'user interaction'! |
|
408 |
||
197 | 409 |
faceSelected:aFaceAndStyleName |
410 |
|sizes| |
|
411 |
||
412 |
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
|
413 |
self extractFaceAndStyleFrom:aFaceAndStyleName. |
197 | 414 |
]. |
415 |
sizes := device |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
416 |
sizesInFamily:currentFamily |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
417 |
face:currentFace |
415 | 418 |
style:currentStyle |
419 |
filtering:filter. |
|
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
420 |
|
197 | 421 |
(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
|
422 |
sizeList list:nil. |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
423 |
currentSize := nil. |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
424 |
self showPreview. |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
425 |
^ self |
197 | 426 |
]. |
427 |
||
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
428 |
sizes := (sizes asOrderedCollection sort) collect:[:entry | entry printString]. |
197 | 429 |
sizeList list:sizes. |
430 |
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
|
431 |
(sizes includes:(currentSize printString)) ifTrue:[ |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
432 |
sizeList selectElement:currentSize. |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
433 |
self showPreview |
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
434 |
] |
197 | 435 |
] |
251
25f76efaa547
oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
436 |
|
415 | 437 |
"Modified: 27.2.1996 / 01:39:11 / cg" |
197 | 438 |
! |
439 |
||
77 | 440 |
familySelected:aFamilyName |
441 |
|faces styles list| |
|
442 |
||
443 |
familyList selectElement:aFamilyName. |
|
444 |
||
445 |
currentFamily := aFamilyName. |
|
415 | 446 |
faces := device facesInFamily:aFamilyName filtering:filter. |
77 | 447 |
(faces isNil or:[faces isEmpty]) ifTrue:[ |
415 | 448 |
currentFace := currentStyle := currentFaceAndStyle := nil. |
449 |
faceList list:nil. |
|
450 |
self faceSelected:nil. |
|
451 |
^ self. |
|
77 | 452 |
]. |
453 |
||
454 |
list := OrderedCollection new. |
|
455 |
faces do:[:aFace | |
|
415 | 456 |
styles := device stylesInFamily:aFamilyName face:aFace filtering:filter. |
457 |
styles do:[:aStyle | |
|
458 |
list add:(aFace , '-' , aStyle) |
|
459 |
] |
|
77 | 460 |
]. |
461 |
faceList list:list. |
|
462 |
currentFaceAndStyle notNil ifTrue:[ |
|
415 | 463 |
(list includes:currentFaceAndStyle) ifTrue:[ |
464 |
faceList selectElement:currentFaceAndStyle. |
|
465 |
self faceSelected:currentFaceAndStyle. |
|
466 |
^ self |
|
467 |
] |
|
77 | 468 |
]. |
469 |
sizeList list:nil |
|
415 | 470 |
|
471 |
"Modified: 27.2.1996 / 01:39:27 / cg" |
|
77 | 472 |
! |
473 |
||
474 |
okPressed |
|
475 |
self hide. |
|
476 |
okAction notNil ifTrue:[ |
|
410 | 477 |
currentFamily notNil ifTrue:[ |
478 |
okAction value:currentFamily |
|
479 |
value:currentFace |
|
480 |
value:currentStyle |
|
481 |
value:currentSize |
|
482 |
] |
|
77 | 483 |
] |
410 | 484 |
|
485 |
"Modified: 27.2.1996 / 00:50:19 / cg" |
|
77 | 486 |
! |
487 |
||
488 |
sizeSelected:aNumberOrString |
|
489 |
aNumberOrString isNumber ifTrue:[ |
|
490 |
currentSize := aNumberOrString |
|
491 |
] ifFalse:[ |
|
492 |
currentSize := Number readFromString:aNumberOrString |
|
493 |
]. |
|
494 |
self showPreview |
|
495 |
! ! |
|
197 | 496 |
|
243 | 497 |
!FontPanel class methodsFor:'documentation'! |
498 |
||
499 |
version |
|
415 | 500 |
^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.25 1996-02-27 01:11:51 cg Exp $' |
243 | 501 |
! ! |