arcadia 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. data/README +126 -123
  2. data/arcadia.rb +770 -756
  3. data/base/a-contracts.rb +130 -93
  4. data/base/a-ext.rb +280 -280
  5. data/base/a-libs.rb +5 -11
  6. data/base/a-utils.rb +235 -44
  7. data/conf/arcadia.conf +20 -16
  8. data/conf/arcadia.init.rb +0 -0
  9. data/conf/arcadia.res.rb +74 -0
  10. data/ext/ae-complete-code/ae-complete-code.conf +0 -0
  11. data/ext/ae-complete-code/ae-complete-code.rb +80 -79
  12. data/ext/ae-debug/ae-debug.conf +0 -0
  13. data/ext/ae-debug/ae-debug.rb +2 -6
  14. data/ext/ae-debug/debug1.57.rb +0 -0
  15. data/ext/ae-doc-code/ae-doc-code.conf +15 -0
  16. data/ext/ae-doc-code/ae-doc-code.rb +289 -0
  17. data/ext/ae-editor/ae-editor.conf +17 -8
  18. data/ext/ae-editor/ae-editor.rb +738 -396
  19. data/ext/ae-event-log/ae-event-log.conf +0 -0
  20. data/ext/ae-event-log/ae-event-log.rb +0 -0
  21. data/ext/ae-file-history/ae-file-history.conf +2 -2
  22. data/ext/ae-file-history/ae-file-history.rb +286 -290
  23. data/ext/ae-inspector/ae-inspector.conf +0 -0
  24. data/ext/ae-inspector/ae-inspector.rb +0 -0
  25. data/ext/ae-output-event/ae-output-event.conf +2 -2
  26. data/ext/ae-output/ae-output.conf +2 -2
  27. data/ext/ae-output/ae-output.rb +173 -178
  28. data/ext/ae-palette/ae-palette.conf +0 -0
  29. data/ext/ae-palette/ae-palette.rb +0 -0
  30. data/ext/ae-shell/ae-shell.conf +0 -0
  31. data/ext/ae-shell/ae-shell.rb +54 -54
  32. data/lib/tk/al-tk.rb +3076 -3082
  33. data/lib/tk/al-tk.res.rb +0 -0
  34. data/lib/tk/al-tkarcadia.rb +0 -0
  35. data/lib/tk/al-tkcustom.rb +0 -0
  36. data/lib/tkext/al-bwidget.rb +0 -0
  37. data/lib/tkext/al-iwidgets.rb +0 -0
  38. data/lib/tkext/al-tile.rb +0 -0
  39. data/lib/tkext/al-tktable.rb +0 -0
  40. data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
  41. data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
  42. data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
  43. data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
  44. data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
  45. data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
  46. data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
  47. data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
  48. data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
  49. data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
  50. data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
  51. data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
  52. data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
  53. data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
  54. data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
  55. data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
  56. data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
  57. data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
  58. data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
  59. data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
  60. data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
  61. data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
  62. data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
  63. data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
  64. data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
  65. data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
  66. data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
  67. data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
  68. data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
  69. data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
  70. data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
  71. data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
  72. data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
  73. data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
  74. data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
  75. data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
  76. data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
  77. data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
  78. data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
  79. data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
  80. data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
  81. data/tcl/BWidget-1.8.0/README.txt +127 -0
  82. data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
  83. data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
  84. data/tcl/BWidget-1.8.0/button.tcl +324 -0
  85. data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
  86. data/tcl/BWidget-1.8.0/color.tcl +493 -0
  87. data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
  88. data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
  89. data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
  90. data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
  91. data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
  92. data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
  93. data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
  94. data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
  95. data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
  96. data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
  97. data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
  98. data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
  99. data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
  100. data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
  101. data/tcl/BWidget-1.8.0/entry.tcl +469 -0
  102. data/tcl/BWidget-1.8.0/font.tcl +566 -0
  103. data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
  104. data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
  105. data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
  106. data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
  107. data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
  108. data/tcl/BWidget-1.8.0/images/error.gif +0 -0
  109. data/tcl/BWidget-1.8.0/images/file.gif +0 -0
  110. data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
  111. data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
  112. data/tcl/BWidget-1.8.0/images/info.gif +0 -0
  113. data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
  114. data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
  115. data/tcl/BWidget-1.8.0/images/new.gif +0 -0
  116. data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
  117. data/tcl/BWidget-1.8.0/images/open.gif +0 -0
  118. data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
  119. data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
  120. data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
  121. data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
  122. data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
  123. data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
  124. data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
  125. data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
  126. data/tcl/BWidget-1.8.0/images/print.gif +0 -0
  127. data/tcl/BWidget-1.8.0/images/question.gif +0 -0
  128. data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
  129. data/tcl/BWidget-1.8.0/images/save.gif +0 -0
  130. data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
  131. data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
  132. data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
  133. data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
  134. data/tcl/BWidget-1.8.0/init.tcl +40 -0
  135. data/tcl/BWidget-1.8.0/label.tcl +271 -0
  136. data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
  137. data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
  138. data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
  139. data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
  140. data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
  141. data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
  142. data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
  143. data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
  144. data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
  145. data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
  146. data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
  147. data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
  148. data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
  149. data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
  150. data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
  151. data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
  152. data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
  153. data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
  154. data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
  155. data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
  156. data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
  157. data/tcl/BWidget-1.8.0/separator.tcl +75 -0
  158. data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
  159. data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
  160. data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
  161. data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
  162. data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
  163. data/tcl/BWidget-1.8.0/utils.tcl +645 -0
  164. data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
  165. data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
  166. data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
  167. metadata +141 -5
@@ -0,0 +1,566 @@
1
+ # ----------------------------------------------------------------------------
2
+ # font.tcl
3
+ # This file is part of Unifix BWidget Toolkit
4
+ # ----------------------------------------------------------------------------
5
+ # Index of commands:
6
+ # - SelectFont::create
7
+ # - SelectFont::configure
8
+ # - SelectFont::cget
9
+ # - SelectFont::_draw
10
+ # - SelectFont::_destroy
11
+ # - SelectFont::_modstyle
12
+ # - SelectFont::_update
13
+ # - SelectFont::_getfont
14
+ # - SelectFont::_init
15
+ # ----------------------------------------------------------------------------
16
+
17
+ namespace eval SelectFont {
18
+ Widget::define SelectFont font Dialog LabelFrame ScrolledWindow
19
+
20
+ Widget::declare SelectFont {
21
+ {-title String "Font selection" 0}
22
+ {-parent String "" 0}
23
+ {-background TkResource "" 0 frame}
24
+
25
+ {-type Enum dialog 0 {dialog toolbar}}
26
+ {-font TkResource "" 0 label}
27
+ {-initialcolor String "" 0}
28
+ {-families String "all" 1}
29
+ {-querysystem Boolean 1 0}
30
+ {-nosizes Boolean 0 1}
31
+ {-styles String "bold italic underline overstrike" 1}
32
+ {-command String "" 0}
33
+ {-sampletext String "Sample Text" 0}
34
+ {-bg Synonym -background}
35
+ }
36
+
37
+ variable _families
38
+ variable _styleOff
39
+ array set _styleOff [list bold normal italic roman]
40
+ variable _sizes {4 5 6 7 8 9 10 11 12 13 14 15 16 \
41
+ 17 18 19 20 21 22 23 24}
42
+
43
+ # Set up preset lists of fonts, so the user can avoid the painfully slow
44
+ # loadfont process if desired.
45
+ if { [string equal $::tcl_platform(platform) "windows"] } {
46
+ set presetVariable [list \
47
+ 7x14 \
48
+ Arial \
49
+ {Arial Narrow} \
50
+ {Lucida Sans} \
51
+ {MS Sans Serif} \
52
+ {MS Serif} \
53
+ {Times New Roman} \
54
+ ]
55
+ set presetFixed [list \
56
+ 6x13 \
57
+ {Courier New} \
58
+ FixedSys \
59
+ Terminal \
60
+ ]
61
+ set presetAll [list \
62
+ 6x13 \
63
+ 7x14 \
64
+ Arial \
65
+ {Arial Narrow} \
66
+ {Courier New} \
67
+ FixedSys \
68
+ {Lucida Sans} \
69
+ {MS Sans Serif} \
70
+ {MS Serif} \
71
+ Terminal \
72
+ {Times New Roman} \
73
+ ]
74
+ } else {
75
+ set presetVariable [list \
76
+ helvetica \
77
+ lucida \
78
+ lucidabright \
79
+ {times new roman} \
80
+ ]
81
+ set presetFixed [list \
82
+ courier \
83
+ fixed \
84
+ {lucida typewriter} \
85
+ screen \
86
+ serif \
87
+ terminal \
88
+ ]
89
+ set presetAll [list \
90
+ courier \
91
+ fixed \
92
+ helvetica \
93
+ lucida \
94
+ lucidabright \
95
+ {lucida typewriter} \
96
+ screen \
97
+ serif \
98
+ terminal \
99
+ {times new roman} \
100
+ ]
101
+ }
102
+ array set _families [list \
103
+ presetvariable $presetVariable \
104
+ presetfixed $presetFixed \
105
+ presetall $presetAll \
106
+ ]
107
+
108
+ variable _widget
109
+ }
110
+
111
+
112
+ # ----------------------------------------------------------------------------
113
+ # Command SelectFont::create
114
+ # ----------------------------------------------------------------------------
115
+ proc SelectFont::create { path args } {
116
+ variable _families
117
+ variable _sizes
118
+ variable $path
119
+ upvar 0 $path data
120
+
121
+ # Initialize the internal rep of the widget options
122
+ Widget::init SelectFont "$path#SelectFont" $args
123
+
124
+ if { [Widget::getoption "$path#SelectFont" -querysystem] } {
125
+ loadfont [Widget::getoption "$path#SelectFont" -families]
126
+ }
127
+
128
+ set bg [Widget::getoption "$path#SelectFont" -background]
129
+ set _styles [Widget::getoption "$path#SelectFont" -styles]
130
+ if { [Widget::getoption "$path#SelectFont" -type] == "dialog" } {
131
+ Dialog::create $path -modal local -anchor e -default 0 -cancel 1 \
132
+ -background $bg \
133
+ -title [Widget::getoption "$path#SelectFont" -title] \
134
+ -parent [Widget::getoption "$path#SelectFont" -parent]
135
+
136
+ set frame [Dialog::getframe $path]
137
+ set topf [frame $frame.topf -relief flat -borderwidth 0 -background $bg]
138
+
139
+ set labf1 [LabelFrame::create $topf.labf1 -text "Font" -name font \
140
+ -side top -anchor w -relief flat -background $bg]
141
+ set sw [ScrolledWindow::create [LabelFrame::getframe $labf1].sw \
142
+ -background $bg]
143
+ set lbf [listbox $sw.lb \
144
+ -height 5 -width 25 -exportselection false -selectmode browse]
145
+ ScrolledWindow::setwidget $sw $lbf
146
+ LabelFrame::configure $labf1 -focus $lbf
147
+ if { [Widget::getoption "$path#SelectFont" -querysystem] } {
148
+ set fam [Widget::getoption "$path#SelectFont" -families]
149
+ } else {
150
+ set fam "preset"
151
+ append fam [Widget::getoption "$path#SelectFont" -families]
152
+ }
153
+ eval [list $lbf insert end] $_families($fam)
154
+ set script "set [list SelectFont::${path}(family)] \[%W curselection\];\
155
+ SelectFont::_update [list $path]"
156
+ bind $lbf <ButtonRelease-1> $script
157
+ bind $lbf <space> $script
158
+ bind $lbf <1> [list focus %W]
159
+ bind $lbf <Up> $script
160
+ bind $lbf <Down> $script
161
+ pack $sw -fill both -expand yes
162
+
163
+ set labf2 [LabelFrame::create $topf.labf2 -text "Size" -name size \
164
+ -side top -anchor w -relief flat -background $bg]
165
+ set sw [ScrolledWindow::create [LabelFrame::getframe $labf2].sw \
166
+ -scrollbar vertical -background $bg]
167
+ set lbs [listbox $sw.lb \
168
+ -height 5 -width 6 -exportselection false -selectmode browse]
169
+ ScrolledWindow::setwidget $sw $lbs
170
+ LabelFrame::configure $labf2 -focus $lbs
171
+ eval [list $lbs insert end] $_sizes
172
+ set script "set [list SelectFont::${path}(size)] \[%W curselection\];\
173
+ SelectFont::_update [list $path]"
174
+ bind $lbs <ButtonRelease-1> $script
175
+ bind $lbs <space> $script
176
+ bind $lbs <1> [list focus %W]
177
+ bind $lbs <Up> $script
178
+ bind $lbs <Down> $script
179
+ pack $sw -fill both -expand yes
180
+
181
+ set labf3 [LabelFrame::create $topf.labf3 -text "Style" -name style \
182
+ -side top -anchor w -relief sunken -bd 1 -background $bg]
183
+ set subf [LabelFrame::getframe $labf3]
184
+ foreach st $_styles {
185
+ set name [lindex [BWidget::getname $st] 0]
186
+ if { $name == "" } {
187
+ set name [string toupper $name 0]
188
+ }
189
+ checkbutton $subf.$st -text $name \
190
+ -variable SelectFont::$path\($st\) \
191
+ -background $bg \
192
+ -command [list SelectFont::_update $path]
193
+ bind $subf.$st <Return> break
194
+ pack $subf.$st -anchor w
195
+ }
196
+ LabelFrame::configure $labf3 -focus $subf.[lindex $_styles 0]
197
+
198
+ pack $labf1 -side left -anchor n -fill both -expand yes
199
+ if { ![Widget::getoption "$path#SelectFont" -nosizes] } {
200
+ pack $labf2 -side left -anchor n -fill both -expand yes -padx 8
201
+ }
202
+ pack $labf3 -side left -anchor n -fill both -expand yes
203
+
204
+ set botf [frame $frame.botf -width 100 -height 50 \
205
+ -bg white -bd 0 -relief flat \
206
+ -highlightthickness 1 -takefocus 0 \
207
+ -highlightbackground black \
208
+ -highlightcolor black]
209
+
210
+ set lab [label $botf.label \
211
+ -background white -foreground black \
212
+ -borderwidth 0 -takefocus 0 -highlightthickness 0 \
213
+ -text [Widget::getoption "$path#SelectFont" -sampletext]]
214
+ place $lab -relx 0.5 -rely 0.5 -anchor c
215
+
216
+ pack $topf -pady 4 -fill both -expand yes
217
+
218
+ if { [Widget::getoption "$path#SelectFont" -initialcolor] != ""} {
219
+ set thecolor [Widget::getoption "$path#SelectFont" -initialcolor]
220
+ set colf [frame $frame.colf]
221
+
222
+ set frc [frame $colf.frame -width 50 -height 20 -bg $thecolor -bd 0 -relief flat\
223
+ -highlightthickness 1 -takefocus 0 \
224
+ -highlightbackground black \
225
+ -highlightcolor black]
226
+
227
+ set script "set [list SelectFont::${path}(fontcolor)] \[tk_chooseColor -parent $colf.button -initialcolor \[set [list SelectFont::${path}(fontcolor)]\]\];\
228
+ SelectFont::_update [list $path]"
229
+
230
+ set but [button $colf.button -command $script \
231
+ -text "Color..."]
232
+
233
+ $lab configure -foreground $thecolor
234
+ $frc configure -bg $thecolor
235
+
236
+ pack $but -side left
237
+ pack $frc -side left -padx 5
238
+
239
+ set data(frc) $frc
240
+ set data(fontcolor) $thecolor
241
+
242
+ pack $colf -pady 4 -fill x -expand true
243
+
244
+ } else {
245
+ set data(fontcolor) -1
246
+ }
247
+ pack $botf -pady 4 -fill x
248
+
249
+ Dialog::add $path -name ok
250
+ Dialog::add $path -name cancel
251
+
252
+ set data(label) $lab
253
+ set data(lbf) $lbf
254
+ set data(lbs) $lbs
255
+
256
+ _getfont $path
257
+
258
+ Widget::create SelectFont $path 0
259
+
260
+ return [_draw $path]
261
+ } else {
262
+ if { [Widget::getoption "$path#SelectFont" -querysystem] } {
263
+ set fams [Widget::getoption "$path#SelectFont" -families]
264
+ } else {
265
+ set fams "preset"
266
+ append fams [Widget::getoption "$path#SelectFont" -families]
267
+ }
268
+ if {[Widget::theme]} {
269
+ ttk::frame $path
270
+ set lbf [ttk::combobox $path.font \
271
+ -takefocus 0 -exportselection 0 \
272
+ -values $_families($fams) \
273
+ -textvariable SelectFont::${path}(family) \
274
+ -state readonly]
275
+ set lbs [ttk::combobox $path.size \
276
+ -takefocus 0 -exportselection 0 \
277
+ -width 4 \
278
+ -values $_sizes \
279
+ -textvariable SelectFont::${path}(size) \
280
+ -state readonly]
281
+ bind $lbf <<ComboboxSelected>> [list SelectFont::_update $path]
282
+ bind $lbs <<ComboboxSelected>> [list SelectFont::_update $path]
283
+ } else {
284
+ frame $path -background $bg
285
+ set lbf [ComboBox::create $path.font \
286
+ -highlightthickness 0 -takefocus 0 -background $bg \
287
+ -values $_families($fams) \
288
+ -textvariable SelectFont::$path\(family\) \
289
+ -editable 0 \
290
+ -modifycmd [list SelectFont::_update $path]]
291
+ set lbs [ComboBox::create $path.size \
292
+ -highlightthickness 0 -takefocus 0 -background $bg \
293
+ -width 4 \
294
+ -values $_sizes \
295
+ -textvariable SelectFont::$path\(size\) \
296
+ -editable 0 \
297
+ -modifycmd [list SelectFont::_update $path]]
298
+ }
299
+ bind $path <Destroy> [list SelectFont::_destroy $path]
300
+ pack $lbf -side left -anchor w
301
+ pack $lbs -side left -anchor w -padx 4
302
+ foreach st $_styles {
303
+ if {$::Widget::_theme} {
304
+ ttk::checkbutton $path.$st -takefocus 0 \
305
+ -style BWSlim.Toolbutton \
306
+ -image [Bitmap::get $st] \
307
+ -variable SelectFont::${path}($st) \
308
+ -command [list SelectFont::_update $path]
309
+ } else {
310
+ button $path.$st \
311
+ -highlightthickness 0 -takefocus 0 -padx 0 -pady 0 \
312
+ -background $bg \
313
+ -image [Bitmap::get $st] \
314
+ -command [list SelectFont::_modstyle $path $st]
315
+ }
316
+ pack $path.$st -side left -anchor w
317
+ }
318
+ set data(label) ""
319
+ set data(lbf) $lbf
320
+ set data(lbs) $lbs
321
+ _getfont $path
322
+
323
+ return [Widget::create SelectFont $path]
324
+ }
325
+
326
+ return $path
327
+ }
328
+
329
+
330
+ # ----------------------------------------------------------------------------
331
+ # Command SelectFont::configure
332
+ # ----------------------------------------------------------------------------
333
+ proc SelectFont::configure { path args } {
334
+ set _styles [Widget::getoption "$path#SelectFont" -styles]
335
+
336
+ set res [Widget::configure "$path#SelectFont" $args]
337
+
338
+ if { [Widget::hasChanged "$path#SelectFont" -font font] } {
339
+ _getfont $path
340
+ }
341
+ if { [Widget::hasChanged "$path#SelectFont" -background bg] } {
342
+ switch -- [Widget::getoption "$path#SelectFont" -type] {
343
+ dialog {
344
+ Dialog::configure $path -background $bg
345
+ set topf [Dialog::getframe $path].topf
346
+ $topf configure -background $bg
347
+ foreach labf {labf1 labf2} {
348
+ LabelFrame::configure $topf.$labf -background $bg
349
+ set subf [LabelFrame::getframe $topf.$labf]
350
+ ScrolledWindow::configure $subf.sw -background $bg
351
+ $subf.sw.lb configure -background $bg
352
+ }
353
+ LabelFrame::configure $topf.labf3 -background $bg
354
+ set subf [LabelFrame::getframe $topf.labf3]
355
+ foreach w [winfo children $subf] {
356
+ $w configure -background $bg
357
+ }
358
+ }
359
+ toolbar {
360
+ $path configure -background $bg
361
+ ComboBox::configure $path.font -background $bg
362
+ ComboBox::configure $path.size -background $bg
363
+ foreach st $_styles {
364
+ $path.$st configure -background $bg
365
+ }
366
+ }
367
+ }
368
+ }
369
+ return $res
370
+ }
371
+
372
+
373
+ # ----------------------------------------------------------------------------
374
+ # Command SelectFont::cget
375
+ # ----------------------------------------------------------------------------
376
+ proc SelectFont::cget { path option } {
377
+ return [Widget::cget "$path#SelectFont" $option]
378
+ }
379
+
380
+
381
+ # ----------------------------------------------------------------------------
382
+ # Command SelectFont::loadfont
383
+ # ----------------------------------------------------------------------------
384
+ proc SelectFont::loadfont {{which all}} {
385
+ variable _families
386
+
387
+ # initialize families
388
+ if {![info exists _families(all)]} {
389
+ set _families(all) [lsort -dictionary [font families]]
390
+ }
391
+ if {[regexp {fixed|variable} $which] \
392
+ && ![info exists _families($which)]} {
393
+ # initialize families
394
+ set _families(fixed) {}
395
+ set _families(variable) {}
396
+ foreach family $_families(all) {
397
+ if { [font metrics [list $family] -fixed] } {
398
+ lappend _families(fixed) $family
399
+ } else {
400
+ lappend _families(variable) $family
401
+ }
402
+ }
403
+ }
404
+ return
405
+ }
406
+
407
+
408
+ # ----------------------------------------------------------------------------
409
+ # Command SelectFont::_draw
410
+ # ----------------------------------------------------------------------------
411
+ proc SelectFont::_draw { path } {
412
+ variable $path
413
+ upvar 0 $path data
414
+
415
+ $data(lbf) selection clear 0 end
416
+ $data(lbf) selection set $data(family)
417
+ $data(lbf) activate $data(family)
418
+ $data(lbf) see $data(family)
419
+ $data(lbs) selection clear 0 end
420
+ $data(lbs) selection set $data(size)
421
+ $data(lbs) activate $data(size)
422
+ $data(lbs) see $data(size)
423
+ _update $path
424
+
425
+ if { [Dialog::draw $path] == 0 } {
426
+ set result [Widget::getoption "$path#SelectFont" -font]
427
+ set color $data(fontcolor)
428
+
429
+ if { $color == "" } {
430
+ set color #000000
431
+ }
432
+
433
+ } else {
434
+ set result ""
435
+ if {$data(fontcolor) == -1} {
436
+ set color -1
437
+ } else {
438
+ set color ""
439
+ }
440
+ }
441
+ unset data
442
+ Widget::destroy "$path#SelectFont"
443
+ destroy $path
444
+ if { $color != -1 } {
445
+ return [list $result $color]
446
+ } else {
447
+ return $result
448
+ }
449
+ }
450
+
451
+
452
+ # ----------------------------------------------------------------------------
453
+ # Command SelectFont::_modstyle
454
+ # ----------------------------------------------------------------------------
455
+ proc SelectFont::_modstyle { path style } {
456
+ variable $path
457
+ upvar 0 $path data
458
+
459
+ $path.$style configure -relief [expr {$data($style) ? "raised" : "sunken"}]
460
+ set data($style) [expr {!$data($style)}]
461
+ _update $path
462
+ }
463
+
464
+
465
+ # ----------------------------------------------------------------------------
466
+ # Command SelectFont::_update
467
+ # ----------------------------------------------------------------------------
468
+ proc SelectFont::_update { path } {
469
+ variable _families
470
+ variable _sizes
471
+ variable _styleOff
472
+ variable $path
473
+ upvar 0 $path data
474
+
475
+ set type [Widget::getoption "$path#SelectFont" -type]
476
+ set _styles [Widget::getoption "$path#SelectFont" -styles]
477
+ if { [Widget::getoption "$path#SelectFont" -querysystem] } {
478
+ set fams [Widget::getoption "$path#SelectFont" -families]
479
+ } else {
480
+ set fams "preset"
481
+ append fams [Widget::getoption "$path#SelectFont" -families]
482
+ }
483
+ if { $type == "dialog" } {
484
+ set curs [$path:cmd cget -cursor]
485
+ $path:cmd configure -cursor watch
486
+ }
487
+ if { [Widget::getoption "$path#SelectFont" -type] == "dialog" } {
488
+ set font [list [lindex $_families($fams) $data(family)] \
489
+ [lindex $_sizes $data(size)]]
490
+ } else {
491
+ set font [list $data(family) $data(size)]
492
+ }
493
+ foreach st $_styles {
494
+ if { $data($st) } {
495
+ lappend font $st
496
+ } elseif {[info exists _styleOff($st)]} {
497
+ # This adds the default bold/italic value to a font
498
+ #lappend font $_styleOff($st)
499
+ }
500
+ }
501
+ Widget::setoption "$path#SelectFont" -font $font
502
+ if { $type == "dialog" } {
503
+ $data(label) configure -font $font
504
+ $path:cmd configure -cursor $curs
505
+ if { ($data(fontcolor) != "") && ($data(fontcolor) != -1) } {
506
+ $data(label) configure -foreground $data(fontcolor)
507
+ $data(frc) configure -bg $data(fontcolor)
508
+ } elseif { $data(fontcolor) == "" } {
509
+ #If no color is selected, restore previous one
510
+ set data(fontcolor) [$data(label) cget -foreground]
511
+
512
+ }
513
+ } elseif { [set cmd [Widget::getoption "$path#SelectFont" -command]] != "" } {
514
+ uplevel \#0 $cmd
515
+ }
516
+ }
517
+
518
+
519
+ # ----------------------------------------------------------------------------
520
+ # Command SelectFont::_getfont
521
+ # ----------------------------------------------------------------------------
522
+ proc SelectFont::_getfont { path } {
523
+ variable _families
524
+ variable _sizes
525
+ variable $path
526
+ upvar 0 $path data
527
+
528
+ array set font [font actual [Widget::getoption "$path#SelectFont" -font]]
529
+ set data(bold) [expr {![string equal $font(-weight) "normal"]}]
530
+ set data(italic) [expr {![string equal $font(-slant) "roman"]}]
531
+ set data(underline) $font(-underline)
532
+ set data(overstrike) $font(-overstrike)
533
+ set _styles [Widget::getoption "$path#SelectFont" -styles]
534
+ if { [Widget::getoption "$path#SelectFont" -querysystem] } {
535
+ set fams [Widget::getoption "$path#SelectFont" -families]
536
+ } else {
537
+ set fams "preset"
538
+ append fams [Widget::getoption "$path#SelectFont" -families]
539
+ }
540
+ if { [Widget::getoption "$path#SelectFont" -type] == "dialog" } {
541
+ set idxf [lsearch $_families($fams) $font(-family)]
542
+ set idxs [lsearch $_sizes $font(-size)]
543
+ set data(family) [expr {$idxf >= 0 ? $idxf : 0}]
544
+ set data(size) [expr {$idxs >= 0 ? $idxs : 0}]
545
+ } else {
546
+ set data(family) $font(-family)
547
+ set data(size) $font(-size)
548
+ if {![Widget::theme]} {
549
+ foreach st $_styles {
550
+ $path.$st configure \
551
+ -relief [expr {$data($st) ? "sunken":"raised"}]
552
+ }
553
+ }
554
+ }
555
+ }
556
+
557
+
558
+ # ----------------------------------------------------------------------------
559
+ # Command SelectFont::_destroy
560
+ # ----------------------------------------------------------------------------
561
+ proc SelectFont::_destroy { path } {
562
+ variable $path
563
+ upvar 0 $path data
564
+ unset data
565
+ Widget::destroy "$path#SelectFont"
566
+ }