FontPanel.st
author Claus Gittinger <cg@exept.de>
Wed, 12 Jun 1996 14:57:41 +0200
changeset 762 832730063164
parent 740 2d5cb01c7e11
child 797 2f9cd56f48ee
permissions -rw-r--r--
checkin from browser
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
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    15
DialogBox subclass:#FontPanel
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    16
	instanceVariableNames:'previewField familyList faceList sizeList revertButton
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    17
		currentFamily currentFace currentStyle currentFaceAndStyle
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
    18
		currentSize selectedFont nameLabel 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
    19
	classVariableNames:''
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    20
	poolDictionaries:''
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    21
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    24
!FontPanel class methodsFor:'documentation'!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    25
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    26
copyright
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    27
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    28
 COPYRIGHT (c) 1991 by Claus Gittinger
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    29
	      All Rights Reserved
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
 This software is furnished under a license and may be used
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    32
 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
    33
 inclusion of the above copyright notice.   This software may not
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    34
 be provided or otherwise made available to, or used by, any
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    35
 other person.  No title to or ownership of the software is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    36
 hereby transferred.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    37
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    38
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    39
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    40
!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    41
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    42
documentation
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    43
"
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    44
    this class implements a font chooser.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    45
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    46
    [author:]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    47
        Claus Gittinger
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    48
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    49
    [see also:]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    50
        Font FontDescription
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    51
        View Dialog
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    52
"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    53
!
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    54
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    55
examples
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    56
"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    57
    very simple:
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    58
                                                                        [exBegin]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    59
        |font|
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    60
        
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    61
        font := FontPanel fontFromUser.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
    62
        Transcript showCR:font
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    63
                                                                        [exEnd]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    64
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    65
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    66
    with initial font:
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 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    71
                    fontFromUserInitial:(Font 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    72
                                            family:'courier'
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    73
                                            size:12).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
    74
        Transcript showCR:font
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    75
                                                                        [exEnd]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    76
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    77
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    78
    with initial font & title:
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    79
                                                                        [exBegin]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    80
        |font|
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    81
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    82
        font := FontPanel 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    83
                    fontFromUserInitial:(Font 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    84
                                            family:'courier'
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    85
                                            size:12)
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    86
                                  title:'select a fooBar font'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
    87
        Transcript showCR:font
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    88
                                                                        [exEnd]
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    89
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    90
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    91
    full setup; setting a filter to only present iso fonts
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    92
    and callBack action:
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
                                                                        [exBegin]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    94
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    95
        |panel|
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
    96
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    97
        panel := FontPanel new.
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    98
        panel label:'hi there - which iso font ?'.
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    99
        panel filter:[:fd | fd encoding notNil
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   100
                            and:[fd encoding startsWith:'iso']].
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   101
        panel action:[:family :face :style :size | 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
   102
                        Transcript showCR:'family:' , family.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
   103
                        Transcript showCR:'face:' , face.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
   104
                        Transcript showCR:'style:' , style.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 595
diff changeset
   105
                        Transcript showCR:'size:' , size printString.
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   106
                     ].
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   107
        panel open
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   108
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   109
"
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   110
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   111
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   112
!FontPanel class methodsFor:'defaults'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   113
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   114
defaultExtent
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   115
    "return the default extent of my instances.
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   116
     The value returned here is usually ignored, and
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   117
     the value from preferredExtent taken instead."
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   118
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   119
    ^ (Screen current pixelPerMillimeter * (120 @ 100)) rounded
571
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   120
ddc5d56bd636 commentary
Claus Gittinger <cg@exept.de>
parents: 541
diff changeset
   121
    "Modified: 22.4.1996 / 23:36:19 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   122
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   123
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   124
defaultJISSampleString
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   125
    "return the sample jis preview text"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   126
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   127
    ^ ('The quick brown fox
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   128
jumps over the lazy dog
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   129
1234567890
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   130
!!@#$%^&*(){}[]:"~;,./<>?
390
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   131
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   132
\e$B$$$i$C$7$c$$$^$;\e(J \e$B@$4V\e(J
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   133
' withEscapes decodeFrom:#jis7)
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   134
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   135
    "Modified: 29.4.1996 / 09:46:11 / cg"
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   136
!
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   137
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   138
defaultRomanSampleString
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   139
    "return the sample roman preview text"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   140
110
eb59f6e31e84 *** empty log message ***
claus
parents: 101
diff changeset
   141
    ^ 'The quick brown fox
eb59f6e31e84 *** empty log message ***
claus
parents: 101
diff changeset
   142
jumps over the lazy dog
eb59f6e31e84 *** empty log message ***
claus
parents: 101
diff changeset
   143
1234567890
eb59f6e31e84 *** empty log message ***
claus
parents: 101
diff changeset
   144
!!@#$%^&*(){}[]:"~;,./<>?
eb59f6e31e84 *** empty log message ***
claus
parents: 101
diff changeset
   145
' , 
398
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   146
(Character value:16rE4) asString ,    "/ umlaut a
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   147
(Character value:16rF6) asString ,    "/ umlaut o
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   148
(Character value:16rFC) asString ,    "/ umlaut u
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   149
(Character value:16rC4) asString ,    "/ umlaut A
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   150
(Character value:16rD6) asString ,    "/ umlaut O
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   151
(Character value:16rDC) asString ,    "/ umlaut U
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   152
(Character value:16rDF) asString ,    "/ sz
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   153
(Character value:233) asString ,      "/ e-degu
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   154
(Character value:232) asString ,      "/ e-grave
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   155
(Character value:234) asString ,      "/ e-circonflex
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   156
(Character value:197) asString ,      "/ A
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   157
(Character value:169) asString        "/ copyright
6f10715fef28 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 390
diff changeset
   158
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   159
    "Modified: 29.4.1996 / 09:46:19 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   160
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   161
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   162
!FontPanel class methodsFor:'startup'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   163
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   164
fontFromUser
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   165
    "open a fontPanel and return the selected font, or nil
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   166
     if abort is pressed"
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   167
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   168
    ^ self fontFromUserInitial:nil
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   169
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   170
    "
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   171
     FontPanel fontFromUser
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   172
    "
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   173
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   174
    "Modified: 27.2.1996 / 00:51:59 / cg"
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   175
!
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   176
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   177
fontFromUserInitial:aFont
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   178
    "open a fontPanel showing aFont initially,
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   179
     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
   180
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   181
    ^ self fontFromUserInitial:aFont title:nil
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   182
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   183
    "
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   184
     FontPanel fontFromUserInitial:(Font family:'courier' size:12)
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   185
    "
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   186
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   187
    "Created: 27.2.1996 / 00:51:44 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   188
    "Modified: 29.4.1996 / 09:45:52 / cg"
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   189
!
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   190
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   191
fontFromUserInitial:aFont title:someTitle
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   192
    "open a fontPanel with title and return the selected font, 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   193
     or nil if abort is pressed"
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   194
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   195
    ^ self fontFromUserInitial:aFont title:someTitle filter:nil
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   196
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   197
    "
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   198
     FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   199
    "
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   200
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   201
    "Created: 27.2.1996 / 00:59:46 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   202
    "Modified: 29.4.1996 / 09:45:34 / cg"
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   203
!
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   204
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   205
fontFromUserInitial:aFont title:someTitle filter:aFilterBlock
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   206
    "open a fontPanel with title and font-filter
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   207
     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
   208
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   209
    |fontPanel|
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   210
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   211
    fontPanel := FontPanel new.
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   212
    fontPanel filter:aFilterBlock.
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   213
    someTitle notNil ifTrue:[
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   214
        fontPanel label:someTitle
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   215
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   216
    fontPanel action:[:family :face :style :size |
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   217
        ^ (Font family:family
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   218
                  face:face
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   219
                  style:style
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   220
                   size:size)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   221
    ].
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   222
    aFont notNil ifTrue:[
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   223
        fontPanel initialFont:aFont.
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   224
    ].
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   225
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   226
    fontPanel showAtPointer.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   227
    ^ nil
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   228
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   229
    "
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   230
     FontPanel fontFromUserInitial:(Font family:'courier' size:12) title:'select some font'
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   231
    "
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   232
413
7474707a9e9b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
   233
    "Created: 27.2.1996 / 00:59:46 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   234
    "Modified: 29.4.1996 / 09:45:23 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   235
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   236
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   237
!FontPanel methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   238
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   239
action:aFourArgBlock
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   240
    "set the action to be evaluated on ok.
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   241
     The block will be evaluated with family, face, style and size."
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   242
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   243
    okAction := aFourArgBlock
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   244
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   245
    "Modified: 29.4.1996 / 09:44:35 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   246
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   247
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   248
encoding:aPattern
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   249
    "set the encoding goal"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   250
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   251
    encoding := aPattern.
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   252
    shown ifTrue:[
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   253
        self updateFamilyList
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   254
    ].
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   255
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   256
    "Created: 29.2.1996 / 04:05:31 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   257
    "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
   258
!
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   259
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   260
filter:aOneArgBlock
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   261
    "set a filter; if non-nil, only fonts for which the filterBlock
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   262
     returns true will be offered"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   263
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   264
    filter := aOneArgBlock.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   265
    shown ifTrue:[
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   266
        self updateFamilyList
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   267
    ].
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   268
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   269
    "Created: 27.2.1996 / 01:40:08 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   270
    "Modified: 29.4.1996 / 09:40:49 / cg"
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   271
!
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   272
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   273
initialFont:aFont
128
claus
parents: 110
diff changeset
   274
    "set the font to be selected initially"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   275
128
claus
parents: 110
diff changeset
   276
    selectedFont := aFont.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   277
    self showSelectedFont.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   278
    self showPreview
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   279
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   280
    "Modified: 23.2.1996 / 00:51:32 / cg"
101
88e7faeda854 *** empty log message ***
claus
parents: 77
diff changeset
   281
! !
88e7faeda854 *** empty log message ***
claus
parents: 77
diff changeset
   282
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   283
!FontPanel methodsFor:'initialization'!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   284
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   285
initialize
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   286
    |familyLabel faceLabel sizeLabel panel fontBrowserView v1 v2 v3
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   287
     mm fH eH|
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   288
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   289
    super initialize.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   290
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   291
    mm := ViewSpacing.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   292
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   293
    self addAbortButton.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   294
    self addOkButton.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   295
390
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   296
    panel := View origin:0.0@0.0 corner:1.0@1.0 in:self.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   297
    panel bottomInset:(buttonPanel preferredExtent y + (mm*3)).
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   298
150
claus
parents: 131
diff changeset
   299
    label := resources string:'Font dialog'.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   300
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   301
    encodingLabel := Label label:' ' in:panel.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   302
    eH := encodingLabel preferredExtent y.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   303
    encodingLabel origin:0.7@1.0 corner:1.0@1.0.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   304
    encodingLabel topInset:(eH negated); horizontalInset:mm.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   305
    encodingLabel level:-1; adjust:#left.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   306
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   307
"/    nameLabel := Label label:' ' in:panel.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   308
"/    nameLabel origin:0.0@1.0 corner:0.7@1.0.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   309
"/    nameLabel topInset:(eH negated); horizontalInset:mm.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   310
"/    nameLabel level:-1; adjust:#left.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   311
390
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   312
    previewField := TextView origin:0.0@0.0 corner:1.0@0.4 in:panel.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   313
    previewField inset:mm.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   314
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   315
"/    previewField contents:self class defaultSampleString.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   316
    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
   317
        previewField level:-1.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   318
    ] ifFalse:[
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   319
        previewField borderWidth:1.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   320
    ].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   321
390
1d54a9b41463 say Hello world in JIS font ;-)
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   322
    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
   323
    fontBrowserView bottomInset:(eH + mm).
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   324
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   325
    v1 := View origin:0.0@0.0 corner:0.4@1.0 in:fontBrowserView.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   326
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   327
    familyLabel := Label label:'Family' in:v1.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   328
    familyLabel borderWidth:0.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   329
    familyLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil).
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   330
    fH := familyLabel preferredExtent y.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   331
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   332
    familyList := ScrollableView for:SelectionInListView in:v1.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   333
    familyList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   334
    familyList inset:mm.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   335
    familyList topInset:fH.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   336
128
claus
parents: 110
diff changeset
   337
    familyList := familyList scrolledView.
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   338
    self makeTabable:familyList.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   339
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   340
    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
   341
                   in:fontBrowserView.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   342
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   343
    faceLabel := Label label:'Typeface' in:v2.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   344
    faceLabel borderWidth:0.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   345
    faceLabel origin:(0.0 @ 0.0) extent:(1.0 @ nil).
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   346
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   347
    faceList := ScrollableView for:SelectionInListView in:v2.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   348
    faceList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   349
    faceList inset:mm.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   350
    faceList topInset:fH.
128
claus
parents: 110
diff changeset
   351
    faceList := faceList scrolledView.
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   352
    self makeTabable:faceList.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   353
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   354
    v3 := View origin:0.8@0.0 corner:1.0@1.0
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   355
                   in:fontBrowserView.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   356
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   357
    sizeLabel := Label label:'Size' in:v3.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   358
    sizeLabel borderWidth:0.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   359
    sizeLabel origin:(0.0 @ 0.0)extent:(1.0 @ nil).
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   360
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   361
    sizeList := ScrollableView for:SelectionInListView in:v3.
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   362
    sizeList origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   363
    sizeList inset:mm.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   364
    sizeList topInset:fH.
128
claus
parents: 110
diff changeset
   365
    sizeList := sizeList scrolledView.
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   366
    self makeTabable:sizeList.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   367
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   368
    familyList action:[:lineNr | self familySelected:(familyList selectionValue)].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   369
    faceList action:[:lineNr | self faceSelected:(faceList selectionValue)].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   370
    sizeList action:[:lineNr | self sizeSelected:(sizeList selectionValue)].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   371
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   372
    "
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   373
     FontPanel new showAtPointer
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   374
    "
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   375
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   376
    "Modified: 31.5.1996 / 22:01:45 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   377
!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   378
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   379
realize
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   380
    "kludge for sco - xlsfont fails sometimes - try again here"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   381
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   382
    self updateFamilyList.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   383
    super realize
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   384
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   385
    "Modified: 27.2.1996 / 01:40:47 / cg"
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   386
!
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   387
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   388
updateFamilyList 
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   389
    "kludge for sco - xlsfont fails sometimes - try again here"
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   390
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   391
    |families|
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   392
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   393
    familyList list isNil ifTrue:[
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   394
        families := device fontFamiliesFiltering:filter.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   395
        families notNil ifTrue:[
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   396
            families := families asOrderedCollection
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   397
        ].
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   398
        familyList list:families
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   399
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   400
    selectedFont notNil ifTrue:[
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   401
        self showSelectedFont
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   402
    ].
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   403
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   404
    "Modified: 27.2.1996 / 01:39:42 / cg"
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   405
    "Created: 27.2.1996 / 01:40:37 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   406
! !
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   407
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   408
!FontPanel methodsFor:'private'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   409
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   410
clearPreview
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   411
    "clear the preview subview"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   412
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   413
    shown ifTrue:[
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   414
        previewField clear.
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   415
        encodingLabel label:''.
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   416
    ].
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   417
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   418
    "Created: 17.4.1996 / 15:19:16 / cg"
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   419
    "Modified: 29.4.1996 / 09:41:27 / cg"
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   420
!
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   421
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   422
extractFaceAndStyleFrom:aString
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   423
    "given a string, extract currentFace and currentStyle"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   424
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   425
    |index|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   426
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   427
    index := aString indexOf:$-.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   428
    (index ~~ 0) ifTrue:[
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   429
        currentFaceAndStyle := aString.
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   430
        currentFace := aString copyTo:(index - 1).
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   431
        currentStyle := aString copyFrom:(index + 1)
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   432
    ]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   433
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   434
    "Modified: 29.4.1996 / 09:41:47 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   435
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   436
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   437
showPreview
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   438
    "show the preview text"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   439
450
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   440
    |f enc s all fonts scalable|
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   441
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   442
    self clearPreview.
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   443
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   444
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   445
     show a wait cursor: for some fonts (kanji etc) the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   446
     X-server needs quites some time to load the font
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   447
    "
255
fdd8ed7f896c use withWaitCursorDo:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   448
    self withWaitCursorDo:[
450
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   449
        all := fonts := device 
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   450
                    fontsInFamily:currentFamily 
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   451
                    face:currentFace 
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   452
                    style:currentStyle
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   453
                    filtering:filter.
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   454
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   455
        fonts := fonts select:[:f | f size == currentSize].
450
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   456
        fonts notEmpty ifTrue:[
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   457
            f := fonts anElement.
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   458
        ] ifFalse:[
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   459
            "/ mhmh
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   460
            "/ X returns size0 for scalable fonts. Any size is possible.
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   461
            "/
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   462
450
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   463
            fonts := all select:[:f | f size == 0].
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   464
            fonts notEmpty ifTrue:[
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   465
                f := Font family:currentFamily 
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   466
                          face:currentFace 
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   467
                          style:currentStyle
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   468
                          size:currentSize      
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   469
                          encoding:(fonts anElement encoding).
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   470
            ] ifFalse:[
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   471
                ^ self
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   472
            ]    
71af90725928 oops - scalable fonts failed
Claus Gittinger <cg@exept.de>
parents: 434
diff changeset
   473
        ].
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   474
540
2b42317ed02e encoding-extraction fixed
Claus Gittinger <cg@exept.de>
parents: 450
diff changeset
   475
        f := f on:device.
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   476
        previewField font:f.
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   477
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   478
        enc := f encoding.
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   479
        enc isNil ifTrue:[enc := 'ascii ?'].
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   480
        encodingLabel label:enc.
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   481
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   482
        nameLabel notNil ifTrue:[nameLabel label:(f fullName)].
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   483
399
13bab2f25c1e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 398
diff changeset
   484
        (enc notNil and:[enc startsWith:'jis']) ifTrue:[
382
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   485
            s := self class defaultJISSampleString
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   486
        ] ifFalse:[
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   487
            s := self class defaultRomanSampleString.
567ea344ab9d show fonts encoding
Claus Gittinger <cg@exept.de>
parents: 255
diff changeset
   488
        ].
434
22586d8221e1 dont get confused by same-name but different encoding
Claus Gittinger <cg@exept.de>
parents: 415
diff changeset
   489
        previewField contents:s.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   490
    ]
255
fdd8ed7f896c use withWaitCursorDo:
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   491
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   492
    "Modified: 29.4.1996 / 09:42:01 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   493
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   494
128
claus
parents: 110
diff changeset
   495
showSelectedFont
claus
parents: 110
diff changeset
   496
    |fam face style sz|
claus
parents: 110
diff changeset
   497
claus
parents: 110
diff changeset
   498
    fam := selectedFont family.
claus
parents: 110
diff changeset
   499
    fam notNil ifTrue:[
claus
parents: 110
diff changeset
   500
	self familySelected:fam.
claus
parents: 110
diff changeset
   501
	face := selectedFont face.
claus
parents: 110
diff changeset
   502
	face notNil ifTrue:[
claus
parents: 110
diff changeset
   503
	    style := selectedFont style.
claus
parents: 110
diff changeset
   504
	    style notNil ifTrue:[
claus
parents: 110
diff changeset
   505
		self faceSelected:(face , '-' , style).
claus
parents: 110
diff changeset
   506
		sz := selectedFont size.
claus
parents: 110
diff changeset
   507
		sz notNil ifTrue:[
claus
parents: 110
diff changeset
   508
		    self sizeSelected:sz 
claus
parents: 110
diff changeset
   509
		]
claus
parents: 110
diff changeset
   510
	    ]
claus
parents: 110
diff changeset
   511
	]
claus
parents: 110
diff changeset
   512
    ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   513
! !
128
claus
parents: 110
diff changeset
   514
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   515
!FontPanel methodsFor:'queries'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   516
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   517
preferredExtent
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   518
    "return the boxes preferredExtent"
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   519
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   520
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   521
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   522
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   523
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   524
    ^ 400@350
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   525
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   526
    "Modified: 29.5.1996 / 12:12:47 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   527
! !
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   528
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   529
!FontPanel methodsFor:'user interaction'!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   530
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   531
faceSelected:aFaceAndStyleName
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   532
    "a fonts face was seleted; find available sizes and update lists"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   533
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   534
    |sizes|
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   535
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   536
    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
   537
        self extractFaceAndStyleFrom:aFaceAndStyleName.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   538
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   539
    sizes := device 
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   540
                 sizesInFamily:currentFamily 
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   541
                 face:currentFace 
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   542
                 style:currentStyle
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   543
                 filtering:filter.
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   544
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   545
    (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
   546
        sizeList list:nil.
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   547
        currentSize := nil.
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   548
        self showPreview.
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   549
        ^ self
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   550
    ].
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   551
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   552
    self clearPreview.
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   553
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   554
    sizes := (sizes asOrderedCollection sort) collect:[:entry | entry printString].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   555
    sizeList list:sizes.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   556
    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
   557
        (sizes includes:(currentSize printString)) ifTrue:[
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   558
            sizeList setSelectElement:currentSize.
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   559
            self showPreview
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   560
        ]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   561
    ]
251
25f76efaa547 oops - dont pass a collection of numbers to the size-view
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   562
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   563
    "Modified: 26.5.1996 / 15:03:24 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   564
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   565
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   566
familySelected:aFamilyName
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   567
    "a fonts family was seleted; find available faces and update lists"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   568
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   569
    |faces styles list|
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   570
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   571
    familyList setSelectElement:aFamilyName.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   572
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   573
    currentFamily := aFamilyName.
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   574
    faces := device facesInFamily:aFamilyName filtering:filter.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   575
    (faces isNil or:[faces isEmpty]) ifTrue:[
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   576
        currentFace := currentStyle := currentFaceAndStyle := nil.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   577
        faceList list:nil.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   578
        self faceSelected:nil.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   579
        ^ self.
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   580
    ].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   581
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   582
    list := OrderedCollection new.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   583
    faces do:[:aFace |
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   584
        styles := device stylesInFamily:aFamilyName face:aFace filtering:filter.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   585
        styles do:[:aStyle |
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   586
            list add:(aFace , '-' , aStyle)
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   587
        ]
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   588
    ].
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   589
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   590
    faceList list:list.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   591
    currentFaceAndStyle notNil ifTrue:[
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   592
        (list includes:currentFaceAndStyle) ifTrue:[
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   593
            faceList setSelectElement:currentFaceAndStyle.
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   594
            self faceSelected:currentFaceAndStyle.
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   595
            ^ self
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   596
        ]
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   597
    ].
541
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   598
    sizeList list:nil.
76018ea821ca clear preview & encoding when no font is shown
Claus Gittinger <cg@exept.de>
parents: 540
diff changeset
   599
    self clearPreview.
415
2184fe27349a added filter option
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   600
690
d579f684aa7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   601
    "Modified: 26.5.1996 / 15:04:29 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   602
!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   603
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   604
okPressed
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   605
    "ok was pressed; hide myself and evaluate the okAction, passing
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   606
     family, face, style and size as arguments"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   607
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   608
    self hide.
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   609
    okAction notNil ifTrue:[
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   610
        currentFamily notNil ifTrue:[
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   611
            okAction 
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   612
                 value:currentFamily
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   613
                 value:currentFace
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   614
                 value:currentStyle
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   615
                 value:currentSize
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   616
        ]
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   617
    ]
410
d3fb280141e4 new startup message
Claus Gittinger <cg@exept.de>
parents: 399
diff changeset
   618
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   619
    "Modified: 29.4.1996 / 09:44:08 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   620
!
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   621
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   622
sizeSelected:aNumberOrString
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   623
    "a size was seleted; update preview"
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   624
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   625
    aNumberOrString isNumber ifTrue:[
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   626
        currentSize := aNumberOrString
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   627
    ] ifFalse:[
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   628
        currentSize := Number readFromString:aNumberOrString
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   629
    ].
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   630
    self showPreview
595
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   631
31cdbedb303d documentation
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   632
    "Modified: 29.4.1996 / 09:43:23 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 59
diff changeset
   633
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   634
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   635
!FontPanel class methodsFor:'documentation'!
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   636
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   637
version
740
2d5cb01c7e11 no need for focusSequence - DialogBox does it
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   638
    ^ '$Header: /cvs/stx/stx/libwidg/FontPanel.st,v 1.37 1996-05-31 20:18:25 cg Exp $'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   639
! !