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