arcadia 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- 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
|
+
}
|