--- a/CharacterSetView.st Thu Feb 12 15:42:29 2004 +0100
+++ b/CharacterSetView.st Thu Feb 12 15:51:10 2004 +0100
@@ -20,7 +20,7 @@
openOn:aFont
|top panel v bNext bPrev bFirst bLast rangeLabel codePointLabel
- first last next prev enable update updateCodePoint|
+ first last next prev enable update updateCodePoint w h|
top := StandardSystemView new.
top label:(aFont printString).
@@ -119,10 +119,16 @@
rangeLabel := Label label:'RangeStart .. RangeStop' in:panel.
codePointLabel := Label label:'Click on glyph to see its codePoint.' in:panel.
+ codePointLabel foregroundColor:(Color blue).
+
update value.
v selectedCodePointHolder onChangeEvaluate:updateCodePoint.
+ w := v preferredExtent x max:(panel preferredExtent x).
+ h := v preferredExtent y + (panel preferredExtent y).
+ top extent:(w @ h).
+
top open.
^ v
@@ -156,7 +162,7 @@
!CharacterSetView methodsFor:'drawing'!
redraw
- |wCol hRow|
+ |wCol hRow dY|
wCol := width / 16.
hRow := height / 16.
@@ -175,13 +181,14 @@
self displayLineFromX:0 y:y toX:width y:y.
].
+ dY := (hRow - (font height)) // 2 + (font ascent).
0 to:15 do:[:row |
|y0 y rowBase|
rowBase := row * 16r10.
y := y0 := row * hRow.
- y := y + (hRow / 2).
+ y := y + dY.
y := y rounded asInteger.
0 to:15 do:[:col |
|x0 x codePoint s|
@@ -195,8 +202,9 @@
x := x rounded asInteger.
codePoint == self selectedCodePoint ifTrue:[
- self paint:(Color white) on:(Color red).
- self clearRectangle:((x0@y0 extent:wCol@hRow) insetBy:1).
+ self paint:(Color red).
+ self fillRectangle:((x0@y0 extent:wCol@hRow) insetBy:1).
+ self paint:(Color white).
self displayString:s x:x y:y.
self paint:(Color black).
] ifFalse:[
@@ -255,8 +263,20 @@
selectedCodePointHolder onChangeSend:#selectedCodePointChanged to:self.
! !
+!CharacterSetView methodsFor:'queries'!
+
+preferredExtent
+ preferredExtent notNil ifTrue:[
+ ^ preferredExtent
+ ].
+
+ ^ ((4 + font width + 4) * 16)
+ @
+ ((4 + font height + 4) * 16)
+! !
+
!CharacterSetView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.3 2004-02-12 14:42:29 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/CharacterSetView.st,v 1.4 2004-02-12 14:51:10 cg Exp $'
! !