--- a/FontPanel.st Mon Feb 16 14:11:57 2009 +0100
+++ b/FontPanel.st Tue Feb 17 17:46:38 2009 +0100
@@ -14,8 +14,9 @@
DialogBox subclass:#FontPanel
instanceVariableNames:'previewField listOfEncodings familyList faceList sizeList
revertButton currentFamily currentFace currentStyle
- currentFaceAndStyle currentSize currentEncoding selectedFont
- nameLabel encodingFilter encodingLabel filter encoding'
+ currentFaceAndStyle currentSize sizeUnit currentEncoding
+ selectedFont nameLabel encodingFilter encodingLabel filter
+ encoding sizeLabelHolder'
classVariableNames:''
poolDictionaries:''
category:'Views-DialogBoxes'
@@ -493,11 +494,12 @@
initialize
|familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3
- mm fH eH l box showFontNameLabel|
+ mm fH eH l box1 box2 showFontNameLabel pixelPointSwitch sep|
super initialize.
showFontNameLabel := device platformName ~= 'WIN32'.
+ sizeUnit := #'point'.
mm := ViewSpacing.
@@ -510,17 +512,23 @@
label := resources string:'Font dialog'.
- box := HorizontalPanelView in:panel.
- box horizontalLayout:#leftFit.
- box origin:0.0@1.0 corner:0.6@1.0.
+ box1 := HorizontalPanelView in:panel.
+ "/ box horizontalLayout:#leftFit.
+ box1 horizontalLayout:#left.
+ box1 origin:0.0@1.0 corner:0.8@1.0.
- l := Label label:(resources string:'Encoding:') in:box.
+ box2 := HorizontalPanelView in:panel.
+ "/ box horizontalLayout:#leftFit.
+ box2 horizontalLayout:#right.
+ box2 origin:0.8@1.0 corner:1.0@1.0.
+
+ l := Label label:(resources string:'Encoding:') in:box1.
l borderWidth:0.
l adjust:#left.
eH := 0.
- encodingFilter := ComboBoxView in:box.
+ encodingFilter := ComboBoxView in:box1.
"/ encodingFilter font:l font.
encodingFilter level:-1.
encodingFilter contents:'*'.
@@ -531,7 +539,7 @@
self showEncodingFilter ifTrue:[
eH := encodingFilter preferredHeight.
- box topInset:(eH negated-4); horizontalInset:mm.
+ box1 topInset:(eH negated-4); horizontalInset:mm.
] ifFalse:[
encodingFilter beInvisible
].
@@ -542,16 +550,35 @@
"/ encodingFilter acceptOnLostFocus:true.
"/ encodingFilter acceptOnPointerLeave:true.
- encodingLabel := Label label:' ' in:panel.
+ encodingLabel := Label label:' ' in:box1.
"/ eH := encodingLabel preferredExtent y.
- encodingLabel origin:0.6@1.0 corner:1.0@1.0.
- encodingLabel topInset:(eH negated); horizontalInset:mm.
+ "/ encodingLabel origin:0.6@1.0 corner:1.0@1.0.
+ "/ encodingLabel topInset:(eH negated); horizontalInset:mm.
encodingLabel level:0; adjust:#left.
encodingLabel adjust:#right.
self showEncodingFilter ifFalse:[
encodingLabel beInvisible
].
+ sep := View in:box1.
+ sep width:20 height:10.
+
+ pixelPointSwitch := ComboListView in:box2.
+ "/ encodingFilter font:l font.
+ pixelPointSwitch level:-1.
+ pixelPointSwitch contents:'point'.
+ pixelPointSwitch list:#(#'point' #'pixel').
+ pixelPointSwitch action:[:sizeUnit | self sizeUnitSelected:sizeUnit].
+ box2 topInset:(pixelPointSwitch preferredHeight negated-4); horizontalInset:mm.
+ "/ encodingFilter editor font:l font.
+
+ self showEncodingFilter ifTrue:[
+ eH := encodingFilter preferredHeight.
+ box1 topInset:(eH negated-4); horizontalInset:mm.
+ ] ifFalse:[
+ encodingFilter beInvisible
+ ].
+
showFontNameLabel ifTrue:[
nameLabel := Label label:'' in:self.
nameLabel origin:0.0@1.0 corner:1.0@1.0.
@@ -607,7 +634,9 @@
v3 := View origin:0.8@0.0 corner:1.0@1.0 in:fontBrowserView.
- sizeLabel := Label label:(resources string:'Size') in:v3.
+ sizeLabelHolder := (resources string:'Size') asValue.
+ sizeLabel := Label in:v3.
+ sizeLabel labelChannel:sizeLabelHolder.
sizeLabel borderWidth:0.
sizeLabel origin:(0.0 @ 0.0)extent:(1.0 @ nil).
@@ -1100,10 +1129,18 @@
showPreview ifTrue:[self showPreview]
"Modified: 29.4.1996 / 09:43:23 / cg"
+!
+
+sizeUnitSelected:unitSymbol
+ sizeUnit := unitSymbol.
+ sizeLabelHolder value:(resources
+ string:(sizeUnit == #pixel
+ ifTrue:'Size (px)'
+ ifFalse:'Size')).
! !
!FontPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.95 2009-02-05 15:34:33 sr Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.96 2009-02-17 16:46:38 cg Exp $'
! !