--- a/FontPanel.st Thu Feb 22 21:43:54 1996 +0100
+++ b/FontPanel.st Fri Feb 23 03:21:23 1996 +0100
@@ -15,7 +15,7 @@
DialogBox subclass:#FontPanel
instanceVariableNames:'previewField familyList faceList sizeList revertButton
currentFamily currentFace currentStyle currentFaceAndStyle
- currentSize selectedFont'
+ currentSize selectedFont nameLabel encodingLabel'
classVariableNames:''
poolDictionaries:''
category:'Views-DialogBoxes'
@@ -64,7 +64,18 @@
^ (Screen current pixelPerMillimeter * (120 @ 100)) rounded
!
-defaultSampleString
+defaultJISSampleString
+ ^ ('The quick brown fox
+jumps over the lazy dog
+1234567890
+!!@#$%^&*(){}[]:"~;,./<>?
+' decodeFrom:#jis7) ,
+(Character value:16r2433) asString , "/ KO
+(Character value:16r246c) asString , "/ RE
+(Character value:16r244f) asString "/ HA
+!
+
+defaultRomanSampleString
^ 'The quick brown fox
jumps over the lazy dog
1234567890
@@ -112,7 +123,10 @@
"set the font to be selected initially"
selectedFont := aFont.
- self showSelectedFont
+ self showSelectedFont.
+ self showPreview
+
+ "Modified: 23.2.1996 / 00:51:32 / cg"
! !
!FontPanel methodsFor:'initialization'!
@@ -130,23 +144,37 @@
!
initialize
- |familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3|
+ |familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3
+ mm fH eH|
super initialize.
+ mm := ViewSpacing.
+
self addAbortButton.
self addOkButton.
panel := View origin:0.0@0.0 corner:1.0@1.0
in:self.
- panel bottomInset:(buttonPanel preferredExtent y + (ViewSpacing*3)).
+ panel bottomInset:(buttonPanel preferredExtent y + (mm*3)).
label := resources string:'Font dialog'.
+ encodingLabel := Label label:' ' in:panel.
+ eH := encodingLabel preferredExtent y.
+ encodingLabel origin:0.7@1.0 corner:1.0@1.0.
+ encodingLabel topInset:(eH negated); horizontalInset:mm.
+ encodingLabel level:-1; adjust:#left.
+
+"/ nameLabel := Label label:' ' in:panel.
+"/ nameLabel origin:0.0@1.0 corner:0.7@1.0.
+"/ nameLabel topInset:(eH negated); horizontalInset:mm.
+"/ nameLabel level:-1; adjust:#left.
+
previewField := TextView origin:0.0@0.0 corner:1.0@0.3 in:panel.
- previewField inset:ViewSpacing.
+ previewField inset:mm.
- previewField contents:self class defaultSampleString.
+"/ previewField contents:self class defaultSampleString.
self is3D ifTrue:[
previewField level:-1.
] ifFalse:[
@@ -154,19 +182,20 @@
].
fontBrowserView := View origin:0.0@0.3 corner:1.0@1.0 in:panel.
+ fontBrowserView bottomInset:(eH + mm).
v1 := View origin:0.0@0.0 corner:0.4@1.0 in:fontBrowserView.
familyLabel := Label label:'Family' in:v1.
familyLabel borderWidth:0.
familyLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil).
+ fH := familyLabel preferredExtent y.
familyList := ScrollableView for:SelectionInListView in:v1.
- familyList origin:(0.0
- @
- (familyLabel origin y + familyLabel height "+ ViewSpacing"))
- corner:(1.0 @ 1.0).
- familyList inset:ViewSpacing.
+ familyList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+ familyList inset:mm.
+ familyList topInset:fH.
+
familyList := familyList scrolledView.
v2 := View origin:0.4@0.0 corner:0.8@1.0
@@ -177,11 +206,9 @@
faceLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil).
faceList := ScrollableView for:SelectionInListView in:v2.
- faceList origin:(0.0
- @
- (faceLabel origin y + faceLabel height "+ ViewSpacing"))
- corner:(1.0 @ 1.0).
- faceList inset:ViewSpacing.
+ faceList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+ faceList inset:mm.
+ faceList topInset:fH.
faceList := faceList scrolledView.
v3 := View origin:0.8@0.0 corner:1.0@1.0
@@ -192,11 +219,9 @@
sizeLabel origin:(0.0 @ 0.0)extent:(1.0 @ nil).
sizeList := ScrollableView for:SelectionInListView in:v3.
- sizeList origin:(0.0
- @
- (sizeLabel origin y + sizeLabel height "+ ViewSpacing"))
- corner:(1.0 @ 1.0).
- sizeList inset:ViewSpacing.
+ sizeList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
+ sizeList inset:mm.
+ sizeList topInset:fH.
sizeList := sizeList scrolledView.
familyList action:[:lineNr | self familySelected:(familyList selectionValue)].
@@ -207,7 +232,7 @@
FontPanel new showAtPointer
"
- "Modified: 12.12.1995 / 17:36:06 / cg"
+ "Modified: 23.2.1996 / 02:57:38 / cg"
!
realize
@@ -243,6 +268,8 @@
!
showPreview
+ |f enc s|
+
shown ifTrue:[
previewField clear.
].
@@ -251,14 +278,24 @@
X-server needs quites some time to load the font
"
self withWaitCursorDo:[
- previewField font:(Font family:currentFamily
- face:currentFace
- style:currentStyle
- size:currentSize).
- previewField contents:self class defaultSampleString.
+ previewField font:(f := Font family:currentFamily
+ face:currentFace
+ style:currentStyle
+ size:currentSize).
+ enc := f encoding.
+"/ enc isNil ifTrue:[enc := 'ASCII ?'].
+ encodingLabel label:enc.
+ nameLabel notNil ifTrue:[nameLabel label:(f fullName)].
+
+ (enc notNil and:[enc startsWith:'JIS']) ifTrue:[
+ s := self class defaultJISSampleString
+ ] ifFalse:[
+ s := self class defaultRomanSampleString.
+ ].
+ previewField contents:s .
]
- "Modified: 14.12.1995 / 20:59:19 / cg"
+ "Modified: 23.2.1996 / 02:57:58 / cg"
!
showSelectedFont
@@ -373,5 +410,5 @@
!FontPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.18 1995-12-14 20:15:25 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.19 1996-02-23 02:21:23 cg Exp $'
! !