Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +3 -0
- evalkit_llava/lib/libreadline.so +3 -0
- evalkit_llava/lib/python3.10/lib-dynload/_lzma.cpython-310-x86_64-linux-gnu.so +3 -0
- evalkit_llava/lib/python3.10/lib-dynload/array.cpython-310-x86_64-linux-gnu.so +3 -0
- evalkit_llava/lib/python3.10/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip +3 -0
- evalkit_llava/lib/tk8.6/button.tcl +782 -0
- evalkit_llava/lib/tk8.6/choosedir.tcl +310 -0
- evalkit_llava/lib/tk8.6/console.tcl +1154 -0
- evalkit_llava/lib/tk8.6/demos/README +44 -0
- evalkit_llava/lib/tk8.6/demos/anilabel.tcl +160 -0
- evalkit_llava/lib/tk8.6/demos/bind.tcl +78 -0
- evalkit_llava/lib/tk8.6/demos/browse +66 -0
- evalkit_llava/lib/tk8.6/demos/button.tcl +47 -0
- evalkit_llava/lib/tk8.6/demos/check.tcl +71 -0
- evalkit_llava/lib/tk8.6/demos/clrpick.tcl +54 -0
- evalkit_llava/lib/tk8.6/demos/dialog2.tcl +18 -0
- evalkit_llava/lib/tk8.6/demos/en.msg +97 -0
- evalkit_llava/lib/tk8.6/demos/entry1.tcl +34 -0
- evalkit_llava/lib/tk8.6/demos/entry2.tcl +46 -0
- evalkit_llava/lib/tk8.6/demos/filebox.tcl +81 -0
- evalkit_llava/lib/tk8.6/demos/floor.tcl +1372 -0
- evalkit_llava/lib/tk8.6/demos/form.tcl +38 -0
- evalkit_llava/lib/tk8.6/demos/goldberg.tcl +1834 -0
- evalkit_llava/lib/tk8.6/demos/icon.tcl +51 -0
- evalkit_llava/lib/tk8.6/demos/image1.tcl +35 -0
- evalkit_llava/lib/tk8.6/demos/knightstour.tcl +268 -0
- evalkit_llava/lib/tk8.6/demos/license.terms +40 -0
- evalkit_llava/lib/tk8.6/demos/menu.tcl +177 -0
- evalkit_llava/lib/tk8.6/demos/menubu.tcl +87 -0
- evalkit_llava/lib/tk8.6/demos/paned1.tcl +32 -0
- evalkit_llava/lib/tk8.6/demos/paned2.tcl +74 -0
- evalkit_llava/lib/tk8.6/demos/radio.tcl +66 -0
- evalkit_llava/lib/tk8.6/demos/ruler.tcl +175 -0
- evalkit_llava/lib/tk8.6/demos/sayings.tcl +44 -0
- evalkit_llava/lib/tk8.6/demos/spin.tcl +53 -0
- evalkit_llava/lib/tk8.6/demos/states.tcl +54 -0
- evalkit_llava/lib/tk8.6/demos/textpeer.tcl +62 -0
- evalkit_llava/lib/tk8.6/demos/tree.tcl +89 -0
- evalkit_llava/lib/tk8.6/demos/ttknote.tcl +57 -0
- evalkit_llava/lib/tk8.6/demos/ttkpane.tcl +112 -0
- evalkit_llava/lib/tk8.6/demos/ttkprogress.tcl +46 -0
- evalkit_llava/lib/tk8.6/demos/unicodeout.tcl +145 -0
- evalkit_llava/lib/tk8.6/demos/vscale.tcl +46 -0
- evalkit_llava/lib/tk8.6/demos/widget +734 -0
- evalkit_llava/lib/tk8.6/dialog.tcl +175 -0
- evalkit_llava/lib/tk8.6/entry.tcl +699 -0
- evalkit_llava/lib/tk8.6/fontchooser.tcl +515 -0
- evalkit_llava/lib/tk8.6/iconlist.tcl +715 -0
- evalkit_llava/lib/tk8.6/mkpsenc.tcl +1488 -0
- evalkit_llava/lib/tk8.6/palette.tcl +244 -0
.gitattributes
CHANGED
|
@@ -118,3 +118,6 @@ evalkit_llava/lib/libreadline.so.8 filter=lfs diff=lfs merge=lfs -text
|
|
| 118 |
evalkit_llava/lib/libtinfow.so.6.4 filter=lfs diff=lfs merge=lfs -text
|
| 119 |
evalkit_llava/lib/libncursesw.so filter=lfs diff=lfs merge=lfs -text
|
| 120 |
evalkit_llava/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
evalkit_llava/lib/libtinfow.so.6.4 filter=lfs diff=lfs merge=lfs -text
|
| 119 |
evalkit_llava/lib/libncursesw.so filter=lfs diff=lfs merge=lfs -text
|
| 120 |
evalkit_llava/lib/python3.10/site-packages/setuptools/_vendor/more_itertools/__pycache__/more.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 121 |
+
evalkit_llava/lib/python3.10/lib-dynload/_lzma.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 122 |
+
evalkit_llava/lib/libreadline.so filter=lfs diff=lfs merge=lfs -text
|
| 123 |
+
evalkit_llava/lib/python3.10/lib-dynload/array.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
evalkit_llava/lib/libreadline.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b6a9d66a73115c872272bb479c8f29df1bf7d9b16e5913e083d64b7753ce1c6
|
| 3 |
+
size 411464
|
evalkit_llava/lib/python3.10/lib-dynload/_lzma.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ebfdcab2537ab089e99839348e41c28e8ce2b63d58d095f94c9f80a753748b0b
|
| 3 |
+
size 145376
|
evalkit_llava/lib/python3.10/lib-dynload/array.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12e45ee9da9d37cf82992df35fed43551d3f6990306c9cc7652b776334253b6f
|
| 3 |
+
size 231120
|
evalkit_llava/lib/python3.10/site-packages/pkg_resources/tests/data/my-test-package-zip/my-test-package.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-l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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# button.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file defines the default bindings for Tk label, button,
|
| 4 |
+
# checkbutton, and radiobutton widgets and provides procedures
|
| 5 |
+
# that help in implementing those bindings.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 1992-1994 The Regents of the University of California.
|
| 8 |
+
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
|
| 9 |
+
# Copyright (c) 2002 ActiveState Corporation.
|
| 10 |
+
#
|
| 11 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 12 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
#-------------------------------------------------------------------------
|
| 16 |
+
# The code below creates the default class bindings for buttons.
|
| 17 |
+
#-------------------------------------------------------------------------
|
| 18 |
+
|
| 19 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 20 |
+
|
| 21 |
+
bind Radiobutton <Enter> {
|
| 22 |
+
tk::ButtonEnter %W
|
| 23 |
+
}
|
| 24 |
+
bind Radiobutton <1> {
|
| 25 |
+
tk::ButtonDown %W
|
| 26 |
+
}
|
| 27 |
+
bind Radiobutton <ButtonRelease-1> {
|
| 28 |
+
tk::ButtonUp %W
|
| 29 |
+
}
|
| 30 |
+
bind Checkbutton <Enter> {
|
| 31 |
+
tk::ButtonEnter %W
|
| 32 |
+
}
|
| 33 |
+
bind Checkbutton <1> {
|
| 34 |
+
tk::ButtonDown %W
|
| 35 |
+
}
|
| 36 |
+
bind Checkbutton <ButtonRelease-1> {
|
| 37 |
+
tk::ButtonUp %W
|
| 38 |
+
}
|
| 39 |
+
bind Checkbutton <Leave> {
|
| 40 |
+
tk::ButtonLeave %W
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
if {"win32" eq [tk windowingsystem]} {
|
| 44 |
+
bind Checkbutton <equal> {
|
| 45 |
+
tk::CheckRadioInvoke %W select
|
| 46 |
+
}
|
| 47 |
+
bind Checkbutton <plus> {
|
| 48 |
+
tk::CheckRadioInvoke %W select
|
| 49 |
+
}
|
| 50 |
+
bind Checkbutton <minus> {
|
| 51 |
+
tk::CheckRadioInvoke %W deselect
|
| 52 |
+
}
|
| 53 |
+
bind Checkbutton <1> {
|
| 54 |
+
tk::CheckRadioDown %W
|
| 55 |
+
}
|
| 56 |
+
bind Checkbutton <ButtonRelease-1> {
|
| 57 |
+
tk::ButtonUp %W
|
| 58 |
+
}
|
| 59 |
+
bind Checkbutton <Enter> {
|
| 60 |
+
tk::CheckRadioEnter %W
|
| 61 |
+
}
|
| 62 |
+
bind Checkbutton <Leave> {
|
| 63 |
+
tk::ButtonLeave %W
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
bind Radiobutton <1> {
|
| 67 |
+
tk::CheckRadioDown %W
|
| 68 |
+
}
|
| 69 |
+
bind Radiobutton <ButtonRelease-1> {
|
| 70 |
+
tk::ButtonUp %W
|
| 71 |
+
}
|
| 72 |
+
bind Radiobutton <Enter> {
|
| 73 |
+
tk::CheckRadioEnter %W
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
if {"x11" eq [tk windowingsystem]} {
|
| 77 |
+
bind Checkbutton <Return> {
|
| 78 |
+
if {!$tk_strictMotif} {
|
| 79 |
+
tk::CheckInvoke %W
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
bind Radiobutton <Return> {
|
| 83 |
+
if {!$tk_strictMotif} {
|
| 84 |
+
tk::CheckRadioInvoke %W
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
bind Checkbutton <1> {
|
| 88 |
+
tk::CheckInvoke %W
|
| 89 |
+
}
|
| 90 |
+
bind Radiobutton <1> {
|
| 91 |
+
tk::CheckRadioInvoke %W
|
| 92 |
+
}
|
| 93 |
+
bind Checkbutton <Enter> {
|
| 94 |
+
tk::CheckEnter %W
|
| 95 |
+
}
|
| 96 |
+
bind Radiobutton <Enter> {
|
| 97 |
+
tk::ButtonEnter %W
|
| 98 |
+
}
|
| 99 |
+
bind Checkbutton <Leave> {
|
| 100 |
+
tk::CheckLeave %W
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
bind Button <space> {
|
| 105 |
+
tk::ButtonInvoke %W
|
| 106 |
+
}
|
| 107 |
+
bind Checkbutton <space> {
|
| 108 |
+
tk::CheckRadioInvoke %W
|
| 109 |
+
}
|
| 110 |
+
bind Radiobutton <space> {
|
| 111 |
+
tk::CheckRadioInvoke %W
|
| 112 |
+
}
|
| 113 |
+
bind Button <<Invoke>> {
|
| 114 |
+
tk::ButtonInvoke %W
|
| 115 |
+
}
|
| 116 |
+
bind Checkbutton <<Invoke>> {
|
| 117 |
+
tk::CheckRadioInvoke %W
|
| 118 |
+
}
|
| 119 |
+
bind Radiobutton <<Invoke>> {
|
| 120 |
+
tk::CheckRadioInvoke %W
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
bind Button <FocusIn> {}
|
| 124 |
+
bind Button <Enter> {
|
| 125 |
+
tk::ButtonEnter %W
|
| 126 |
+
}
|
| 127 |
+
bind Button <Leave> {
|
| 128 |
+
tk::ButtonLeave %W
|
| 129 |
+
}
|
| 130 |
+
bind Button <1> {
|
| 131 |
+
tk::ButtonDown %W
|
| 132 |
+
}
|
| 133 |
+
bind Button <ButtonRelease-1> {
|
| 134 |
+
tk::ButtonUp %W
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
bind Checkbutton <FocusIn> {}
|
| 138 |
+
|
| 139 |
+
bind Radiobutton <FocusIn> {}
|
| 140 |
+
bind Radiobutton <Leave> {
|
| 141 |
+
tk::ButtonLeave %W
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
if {"win32" eq [tk windowingsystem]} {
|
| 145 |
+
|
| 146 |
+
#########################
|
| 147 |
+
# Windows implementation
|
| 148 |
+
#########################
|
| 149 |
+
|
| 150 |
+
# ::tk::ButtonEnter --
|
| 151 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 152 |
+
# button widget. It records the button we're in and changes the
|
| 153 |
+
# state of the button to active unless the button is disabled.
|
| 154 |
+
#
|
| 155 |
+
# Arguments:
|
| 156 |
+
# w - The name of the widget.
|
| 157 |
+
|
| 158 |
+
proc ::tk::ButtonEnter w {
|
| 159 |
+
variable ::tk::Priv
|
| 160 |
+
if {[$w cget -state] ne "disabled"} {
|
| 161 |
+
|
| 162 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 163 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 164 |
+
|
| 165 |
+
set Priv($w,relief) [$w cget -relief]
|
| 166 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 167 |
+
$w configure -relief sunken -state active
|
| 168 |
+
set Priv($w,prelief) sunken
|
| 169 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 170 |
+
$w configure -relief $over
|
| 171 |
+
set Priv($w,prelief) $over
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
set Priv(window) $w
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
# ::tk::ButtonLeave --
|
| 178 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 179 |
+
# button widget. It changes the state of the button back to inactive.
|
| 180 |
+
# Restore any modified relief too.
|
| 181 |
+
#
|
| 182 |
+
# Arguments:
|
| 183 |
+
# w - The name of the widget.
|
| 184 |
+
|
| 185 |
+
proc ::tk::ButtonLeave w {
|
| 186 |
+
variable ::tk::Priv
|
| 187 |
+
if {[$w cget -state] ne "disabled"} {
|
| 188 |
+
$w configure -state normal
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
# Restore the original button relief if it was changed by Tk.
|
| 192 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 193 |
+
|
| 194 |
+
if {[info exists Priv($w,relief)]} {
|
| 195 |
+
if {[info exists Priv($w,prelief)] && \
|
| 196 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 197 |
+
$w configure -relief $Priv($w,relief)
|
| 198 |
+
}
|
| 199 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
set Priv(window) ""
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
# ::tk::ButtonDown --
|
| 206 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 207 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 208 |
+
# saves the button's relief so it can be restored later, and changes
|
| 209 |
+
# the relief to sunken.
|
| 210 |
+
#
|
| 211 |
+
# Arguments:
|
| 212 |
+
# w - The name of the widget.
|
| 213 |
+
|
| 214 |
+
proc ::tk::ButtonDown w {
|
| 215 |
+
variable ::tk::Priv
|
| 216 |
+
|
| 217 |
+
# Only save the button's relief if it does not yet exist. If there
|
| 218 |
+
# is an overrelief setting, Priv($w,relief) will already have been set,
|
| 219 |
+
# and the current value of the -relief option will be incorrect.
|
| 220 |
+
|
| 221 |
+
if {![info exists Priv($w,relief)]} {
|
| 222 |
+
set Priv($w,relief) [$w cget -relief]
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
if {[$w cget -state] ne "disabled"} {
|
| 226 |
+
set Priv(buttonWindow) $w
|
| 227 |
+
$w configure -relief sunken -state active
|
| 228 |
+
set Priv($w,prelief) sunken
|
| 229 |
+
|
| 230 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 231 |
+
after cancel $Priv(afterId)
|
| 232 |
+
set delay [$w cget -repeatdelay]
|
| 233 |
+
set Priv(repeated) 0
|
| 234 |
+
if {$delay > 0} {
|
| 235 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
# ::tk::ButtonUp --
|
| 241 |
+
# The procedure below is invoked when the mouse button is released
|
| 242 |
+
# in a button widget. It restores the button's relief and invokes
|
| 243 |
+
# the command as long as the mouse hasn't left the button.
|
| 244 |
+
#
|
| 245 |
+
# Arguments:
|
| 246 |
+
# w - The name of the widget.
|
| 247 |
+
|
| 248 |
+
proc ::tk::ButtonUp w {
|
| 249 |
+
variable ::tk::Priv
|
| 250 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 251 |
+
set Priv(buttonWindow) ""
|
| 252 |
+
|
| 253 |
+
# Restore the button's relief if it was cached.
|
| 254 |
+
|
| 255 |
+
if {[info exists Priv($w,relief)]} {
|
| 256 |
+
if {[info exists Priv($w,prelief)] && \
|
| 257 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 258 |
+
$w configure -relief $Priv($w,relief)
|
| 259 |
+
}
|
| 260 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
# Clean up the after event from the auto-repeater
|
| 264 |
+
after cancel $Priv(afterId)
|
| 265 |
+
|
| 266 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 267 |
+
$w configure -state normal
|
| 268 |
+
|
| 269 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 270 |
+
# auto-repeater functionality
|
| 271 |
+
if { $Priv(repeated) == 0 } {
|
| 272 |
+
uplevel #0 [list $w invoke]
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
# ::tk::CheckRadioEnter --
|
| 279 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 280 |
+
# checkbutton or radiobutton widget. It records the button we're in
|
| 281 |
+
# and changes the state of the button to active unless the button is
|
| 282 |
+
# disabled.
|
| 283 |
+
#
|
| 284 |
+
# Arguments:
|
| 285 |
+
# w - The name of the widget.
|
| 286 |
+
|
| 287 |
+
proc ::tk::CheckRadioEnter w {
|
| 288 |
+
variable ::tk::Priv
|
| 289 |
+
if {[$w cget -state] ne "disabled"} {
|
| 290 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 291 |
+
$w configure -state active
|
| 292 |
+
}
|
| 293 |
+
if {[set over [$w cget -overrelief]] ne ""} {
|
| 294 |
+
set Priv($w,relief) [$w cget -relief]
|
| 295 |
+
set Priv($w,prelief) $over
|
| 296 |
+
$w configure -relief $over
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
set Priv(window) $w
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
# ::tk::CheckRadioDown --
|
| 303 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 304 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 305 |
+
# saves the button's relief so it can be restored later, and changes
|
| 306 |
+
# the relief to sunken.
|
| 307 |
+
#
|
| 308 |
+
# Arguments:
|
| 309 |
+
# w - The name of the widget.
|
| 310 |
+
|
| 311 |
+
proc ::tk::CheckRadioDown w {
|
| 312 |
+
variable ::tk::Priv
|
| 313 |
+
if {![info exists Priv($w,relief)]} {
|
| 314 |
+
set Priv($w,relief) [$w cget -relief]
|
| 315 |
+
}
|
| 316 |
+
if {[$w cget -state] ne "disabled"} {
|
| 317 |
+
set Priv(buttonWindow) $w
|
| 318 |
+
set Priv(repeated) 0
|
| 319 |
+
$w configure -state active
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
if {"x11" eq [tk windowingsystem]} {
|
| 326 |
+
|
| 327 |
+
#####################
|
| 328 |
+
# Unix implementation
|
| 329 |
+
#####################
|
| 330 |
+
|
| 331 |
+
# ::tk::ButtonEnter --
|
| 332 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 333 |
+
# button widget. It records the button we're in and changes the
|
| 334 |
+
# state of the button to active unless the button is disabled.
|
| 335 |
+
#
|
| 336 |
+
# Arguments:
|
| 337 |
+
# w - The name of the widget.
|
| 338 |
+
|
| 339 |
+
proc ::tk::ButtonEnter {w} {
|
| 340 |
+
variable ::tk::Priv
|
| 341 |
+
if {[$w cget -state] ne "disabled"} {
|
| 342 |
+
# On unix the state is active just with mouse-over
|
| 343 |
+
$w configure -state active
|
| 344 |
+
|
| 345 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 346 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 347 |
+
|
| 348 |
+
set Priv($w,relief) [$w cget -relief]
|
| 349 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 350 |
+
$w configure -relief sunken
|
| 351 |
+
set Priv($w,prelief) sunken
|
| 352 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 353 |
+
$w configure -relief $over
|
| 354 |
+
set Priv($w,prelief) $over
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
set Priv(window) $w
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
# ::tk::ButtonLeave --
|
| 361 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 362 |
+
# button widget. It changes the state of the button back to inactive.
|
| 363 |
+
# Restore any modified relief too.
|
| 364 |
+
#
|
| 365 |
+
# Arguments:
|
| 366 |
+
# w - The name of the widget.
|
| 367 |
+
|
| 368 |
+
proc ::tk::ButtonLeave w {
|
| 369 |
+
variable ::tk::Priv
|
| 370 |
+
if {[$w cget -state] ne "disabled"} {
|
| 371 |
+
$w configure -state normal
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
# Restore the original button relief if it was changed by Tk.
|
| 375 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 376 |
+
|
| 377 |
+
if {[info exists Priv($w,relief)]} {
|
| 378 |
+
if {[info exists Priv($w,prelief)] && \
|
| 379 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 380 |
+
$w configure -relief $Priv($w,relief)
|
| 381 |
+
}
|
| 382 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
set Priv(window) ""
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
# ::tk::ButtonDown --
|
| 389 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 390 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 391 |
+
# saves the button's relief so it can be restored later, and changes
|
| 392 |
+
# the relief to sunken.
|
| 393 |
+
#
|
| 394 |
+
# Arguments:
|
| 395 |
+
# w - The name of the widget.
|
| 396 |
+
|
| 397 |
+
proc ::tk::ButtonDown w {
|
| 398 |
+
variable ::tk::Priv
|
| 399 |
+
|
| 400 |
+
# Only save the button's relief if it does not yet exist. If there
|
| 401 |
+
# is an overrelief setting, Priv($w,relief) will already have been set,
|
| 402 |
+
# and the current value of the -relief option will be incorrect.
|
| 403 |
+
|
| 404 |
+
if {![info exists Priv($w,relief)]} {
|
| 405 |
+
set Priv($w,relief) [$w cget -relief]
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
if {[$w cget -state] ne "disabled"} {
|
| 409 |
+
set Priv(buttonWindow) $w
|
| 410 |
+
$w configure -relief sunken
|
| 411 |
+
set Priv($w,prelief) sunken
|
| 412 |
+
|
| 413 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 414 |
+
after cancel $Priv(afterId)
|
| 415 |
+
set delay [$w cget -repeatdelay]
|
| 416 |
+
set Priv(repeated) 0
|
| 417 |
+
if {$delay > 0} {
|
| 418 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 419 |
+
}
|
| 420 |
+
}
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
# ::tk::ButtonUp --
|
| 424 |
+
# The procedure below is invoked when the mouse button is released
|
| 425 |
+
# in a button widget. It restores the button's relief and invokes
|
| 426 |
+
# the command as long as the mouse hasn't left the button.
|
| 427 |
+
#
|
| 428 |
+
# Arguments:
|
| 429 |
+
# w - The name of the widget.
|
| 430 |
+
|
| 431 |
+
proc ::tk::ButtonUp w {
|
| 432 |
+
variable ::tk::Priv
|
| 433 |
+
if {$w eq $Priv(buttonWindow)} {
|
| 434 |
+
set Priv(buttonWindow) ""
|
| 435 |
+
|
| 436 |
+
# Restore the button's relief if it was cached.
|
| 437 |
+
|
| 438 |
+
if {[info exists Priv($w,relief)]} {
|
| 439 |
+
if {[info exists Priv($w,prelief)] && \
|
| 440 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 441 |
+
$w configure -relief $Priv($w,relief)
|
| 442 |
+
}
|
| 443 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
# Clean up the after event from the auto-repeater
|
| 447 |
+
after cancel $Priv(afterId)
|
| 448 |
+
|
| 449 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 450 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 451 |
+
# auto-repeater functionality
|
| 452 |
+
if { $Priv(repeated) == 0 } {
|
| 453 |
+
uplevel #0 [list $w invoke]
|
| 454 |
+
}
|
| 455 |
+
}
|
| 456 |
+
}
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
}
|
| 460 |
+
|
| 461 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 462 |
+
|
| 463 |
+
####################
|
| 464 |
+
# Mac implementation
|
| 465 |
+
####################
|
| 466 |
+
|
| 467 |
+
# ::tk::ButtonEnter --
|
| 468 |
+
# The procedure below is invoked when the mouse pointer enters a
|
| 469 |
+
# button widget. It records the button we're in and changes the
|
| 470 |
+
# state of the button to active unless the button is disabled.
|
| 471 |
+
#
|
| 472 |
+
# Arguments:
|
| 473 |
+
# w - The name of the widget.
|
| 474 |
+
|
| 475 |
+
proc ::tk::ButtonEnter {w} {
|
| 476 |
+
variable ::tk::Priv
|
| 477 |
+
if {[$w cget -state] ne "disabled"} {
|
| 478 |
+
|
| 479 |
+
# If there's an -overrelief value, set the relief to that.
|
| 480 |
+
|
| 481 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 482 |
+
$w configure -state active
|
| 483 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 484 |
+
set Priv($w,relief) [$w cget -relief]
|
| 485 |
+
set Priv($w,prelief) $over
|
| 486 |
+
$w configure -relief $over
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
set Priv(window) $w
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
# ::tk::ButtonLeave --
|
| 493 |
+
# The procedure below is invoked when the mouse pointer leaves a
|
| 494 |
+
# button widget. It changes the state of the button back to
|
| 495 |
+
# inactive. If we're leaving the button window with a mouse button
|
| 496 |
+
# pressed (Priv(buttonWindow) == $w), restore the relief of the
|
| 497 |
+
# button too.
|
| 498 |
+
#
|
| 499 |
+
# Arguments:
|
| 500 |
+
# w - The name of the widget.
|
| 501 |
+
|
| 502 |
+
proc ::tk::ButtonLeave w {
|
| 503 |
+
variable ::tk::Priv
|
| 504 |
+
if {$w eq $Priv(buttonWindow)} {
|
| 505 |
+
$w configure -state normal
|
| 506 |
+
}
|
| 507 |
+
|
| 508 |
+
# Restore the original button relief if it was changed by Tk.
|
| 509 |
+
# That is signaled by the existence of Priv($w,prelief).
|
| 510 |
+
|
| 511 |
+
if {[info exists Priv($w,relief)]} {
|
| 512 |
+
if {[info exists Priv($w,prelief)] && \
|
| 513 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 514 |
+
$w configure -relief $Priv($w,relief)
|
| 515 |
+
}
|
| 516 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
set Priv(window) ""
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
# ::tk::ButtonDown --
|
| 523 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 524 |
+
# a button widget. It records the fact that the mouse is in the button,
|
| 525 |
+
# saves the button's relief so it can be restored later, and changes
|
| 526 |
+
# the relief to sunken.
|
| 527 |
+
#
|
| 528 |
+
# Arguments:
|
| 529 |
+
# w - The name of the widget.
|
| 530 |
+
|
| 531 |
+
proc ::tk::ButtonDown w {
|
| 532 |
+
variable ::tk::Priv
|
| 533 |
+
|
| 534 |
+
if {[$w cget -state] ne "disabled"} {
|
| 535 |
+
set Priv(buttonWindow) $w
|
| 536 |
+
$w configure -state active
|
| 537 |
+
|
| 538 |
+
# If this button has a repeatdelay set up, get it going with an after
|
| 539 |
+
after cancel $Priv(afterId)
|
| 540 |
+
set Priv(repeated) 0
|
| 541 |
+
if { ![catch {$w cget -repeatdelay} delay] } {
|
| 542 |
+
if {$delay > 0} {
|
| 543 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 544 |
+
}
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
# ::tk::ButtonUp --
|
| 550 |
+
# The procedure below is invoked when the mouse button is released
|
| 551 |
+
# in a button widget. It restores the button's relief and invokes
|
| 552 |
+
# the command as long as the mouse hasn't left the button.
|
| 553 |
+
#
|
| 554 |
+
# Arguments:
|
| 555 |
+
# w - The name of the widget.
|
| 556 |
+
|
| 557 |
+
proc ::tk::ButtonUp w {
|
| 558 |
+
variable ::tk::Priv
|
| 559 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 560 |
+
set Priv(buttonWindow) ""
|
| 561 |
+
$w configure -state normal
|
| 562 |
+
|
| 563 |
+
# Restore the button's relief if it was cached.
|
| 564 |
+
|
| 565 |
+
if {[info exists Priv($w,relief)]} {
|
| 566 |
+
if {[info exists Priv($w,prelief)] && \
|
| 567 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 568 |
+
$w configure -relief $Priv($w,relief)
|
| 569 |
+
}
|
| 570 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
# Clean up the after event from the auto-repeater
|
| 574 |
+
after cancel $Priv(afterId)
|
| 575 |
+
|
| 576 |
+
if {$Priv(window) eq $w && [$w cget -state] ne "disabled"} {
|
| 577 |
+
# Only invoke the command if it wasn't already invoked by the
|
| 578 |
+
# auto-repeater functionality
|
| 579 |
+
if { $Priv(repeated) == 0 } {
|
| 580 |
+
uplevel #0 [list $w invoke]
|
| 581 |
+
}
|
| 582 |
+
}
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
|
| 586 |
+
}
|
| 587 |
+
|
| 588 |
+
##################
|
| 589 |
+
# Shared routines
|
| 590 |
+
##################
|
| 591 |
+
|
| 592 |
+
# ::tk::ButtonInvoke --
|
| 593 |
+
# The procedure below is called when a button is invoked through
|
| 594 |
+
# the keyboard. It simulate a press of the button via the mouse.
|
| 595 |
+
#
|
| 596 |
+
# Arguments:
|
| 597 |
+
# w - The name of the widget.
|
| 598 |
+
|
| 599 |
+
proc ::tk::ButtonInvoke w {
|
| 600 |
+
if {[winfo exists $w] && [$w cget -state] ne "disabled"} {
|
| 601 |
+
set oldRelief [$w cget -relief]
|
| 602 |
+
set oldState [$w cget -state]
|
| 603 |
+
$w configure -state active -relief sunken
|
| 604 |
+
after 100 [list ::tk::ButtonInvokeEnd $w $oldState $oldRelief]
|
| 605 |
+
}
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
# ::tk::ButtonInvokeEnd --
|
| 609 |
+
# The procedure below is called after a button is invoked through
|
| 610 |
+
# the keyboard. It simulate a release of the button via the mouse.
|
| 611 |
+
#
|
| 612 |
+
# Arguments:
|
| 613 |
+
# w - The name of the widget.
|
| 614 |
+
# oldState - Old state to be set back.
|
| 615 |
+
# oldRelief - Old relief to be set back.
|
| 616 |
+
|
| 617 |
+
proc ::tk::ButtonInvokeEnd {w oldState oldRelief} {
|
| 618 |
+
if {[winfo exists $w]} {
|
| 619 |
+
$w configure -state $oldState -relief $oldRelief
|
| 620 |
+
uplevel #0 [list $w invoke]
|
| 621 |
+
}
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
# ::tk::ButtonAutoInvoke --
|
| 625 |
+
#
|
| 626 |
+
# Invoke an auto-repeating button, and set it up to continue to repeat.
|
| 627 |
+
#
|
| 628 |
+
# Arguments:
|
| 629 |
+
# w button to invoke.
|
| 630 |
+
#
|
| 631 |
+
# Results:
|
| 632 |
+
# None.
|
| 633 |
+
#
|
| 634 |
+
# Side effects:
|
| 635 |
+
# May create an after event to call ::tk::ButtonAutoInvoke.
|
| 636 |
+
|
| 637 |
+
proc ::tk::ButtonAutoInvoke {w} {
|
| 638 |
+
variable ::tk::Priv
|
| 639 |
+
after cancel $Priv(afterId)
|
| 640 |
+
set delay [$w cget -repeatinterval]
|
| 641 |
+
if {$Priv(window) eq $w} {
|
| 642 |
+
incr Priv(repeated)
|
| 643 |
+
uplevel #0 [list $w invoke]
|
| 644 |
+
}
|
| 645 |
+
if {$delay > 0} {
|
| 646 |
+
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
|
| 647 |
+
}
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
# ::tk::CheckRadioInvoke --
|
| 651 |
+
# The procedure below is invoked when the mouse button is pressed in
|
| 652 |
+
# a checkbutton or radiobutton widget, or when the widget is invoked
|
| 653 |
+
# through the keyboard. It invokes the widget if it
|
| 654 |
+
# isn't disabled.
|
| 655 |
+
#
|
| 656 |
+
# Arguments:
|
| 657 |
+
# w - The name of the widget.
|
| 658 |
+
# cmd - The subcommand to invoke (one of invoke, select, or deselect).
|
| 659 |
+
|
| 660 |
+
proc ::tk::CheckRadioInvoke {w {cmd invoke}} {
|
| 661 |
+
if {[$w cget -state] ne "disabled"} {
|
| 662 |
+
uplevel #0 [list $w $cmd]
|
| 663 |
+
}
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
# Special versions of the handlers for checkbuttons on Unix that do the magic
|
| 667 |
+
# to make things work right when the checkbutton indicator is hidden;
|
| 668 |
+
# radiobuttons don't need this complexity.
|
| 669 |
+
|
| 670 |
+
# ::tk::CheckInvoke --
|
| 671 |
+
# The procedure below invokes the checkbutton, like ButtonInvoke, but handles
|
| 672 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 673 |
+
#
|
| 674 |
+
# Arguments:
|
| 675 |
+
# w - The name of the widget.
|
| 676 |
+
|
| 677 |
+
proc ::tk::CheckInvoke {w} {
|
| 678 |
+
variable ::tk::Priv
|
| 679 |
+
if {[$w cget -state] ne "disabled"} {
|
| 680 |
+
# Additional logic to switch the "selected" colors around if necessary
|
| 681 |
+
# (when we're indicator-less).
|
| 682 |
+
|
| 683 |
+
if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
|
| 684 |
+
if {[$w cget -selectcolor] eq $Priv($w,aselectcolor)} {
|
| 685 |
+
$w configure -selectcolor $Priv($w,selectcolor)
|
| 686 |
+
} else {
|
| 687 |
+
$w configure -selectcolor $Priv($w,aselectcolor)
|
| 688 |
+
}
|
| 689 |
+
}
|
| 690 |
+
uplevel #0 [list $w invoke]
|
| 691 |
+
}
|
| 692 |
+
}
|
| 693 |
+
|
| 694 |
+
# ::tk::CheckEnter --
|
| 695 |
+
# The procedure below enters the checkbutton, like ButtonEnter, but handles
|
| 696 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 697 |
+
#
|
| 698 |
+
# Arguments:
|
| 699 |
+
# w - The name of the widget.
|
| 700 |
+
|
| 701 |
+
proc ::tk::CheckEnter {w} {
|
| 702 |
+
variable ::tk::Priv
|
| 703 |
+
if {[$w cget -state] ne "disabled"} {
|
| 704 |
+
# On unix the state is active just with mouse-over
|
| 705 |
+
$w configure -state active
|
| 706 |
+
|
| 707 |
+
# If the mouse button is down, set the relief to sunken on entry.
|
| 708 |
+
# Overwise, if there's an -overrelief value, set the relief to that.
|
| 709 |
+
|
| 710 |
+
set Priv($w,relief) [$w cget -relief]
|
| 711 |
+
if {$Priv(buttonWindow) eq $w} {
|
| 712 |
+
$w configure -relief sunken
|
| 713 |
+
set Priv($w,prelief) sunken
|
| 714 |
+
} elseif {[set over [$w cget -overrelief]] ne ""} {
|
| 715 |
+
$w configure -relief $over
|
| 716 |
+
set Priv($w,prelief) $over
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
# Compute what the "selected and active" color should be.
|
| 720 |
+
|
| 721 |
+
if {![$w cget -indicatoron] && [$w cget -selectcolor] ne ""} {
|
| 722 |
+
set Priv($w,selectcolor) [$w cget -selectcolor]
|
| 723 |
+
lassign [winfo rgb $w [$w cget -selectcolor]] r1 g1 b1
|
| 724 |
+
lassign [winfo rgb $w [$w cget -activebackground]] r2 g2 b2
|
| 725 |
+
set Priv($w,aselectcolor) \
|
| 726 |
+
[format "#%04x%04x%04x" [expr {($r1+$r2)/2}] \
|
| 727 |
+
[expr {($g1+$g2)/2}] [expr {($b1+$b2)/2}]]
|
| 728 |
+
# use uplevel to work with other var resolvers
|
| 729 |
+
if {[uplevel #0 [list set [$w cget -variable]]]
|
| 730 |
+
eq [$w cget -onvalue]} {
|
| 731 |
+
$w configure -selectcolor $Priv($w,aselectcolor)
|
| 732 |
+
}
|
| 733 |
+
}
|
| 734 |
+
}
|
| 735 |
+
set Priv(window) $w
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
# ::tk::CheckLeave --
|
| 739 |
+
# The procedure below leaves the checkbutton, like ButtonLeave, but handles
|
| 740 |
+
# what to do when the checkbutton indicator is missing. Only used on Unix.
|
| 741 |
+
#
|
| 742 |
+
# Arguments:
|
| 743 |
+
# w - The name of the widget.
|
| 744 |
+
|
| 745 |
+
proc ::tk::CheckLeave {w} {
|
| 746 |
+
variable ::tk::Priv
|
| 747 |
+
if {[$w cget -state] ne "disabled"} {
|
| 748 |
+
$w configure -state normal
|
| 749 |
+
}
|
| 750 |
+
|
| 751 |
+
# Restore the original button "selected" color; but only if the user
|
| 752 |
+
# has not changed it in the meantime.
|
| 753 |
+
|
| 754 |
+
if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} {
|
| 755 |
+
if {[$w cget -selectcolor] eq $Priv($w,selectcolor)
|
| 756 |
+
|| ([info exist Priv($w,aselectcolor)] &&
|
| 757 |
+
[$w cget -selectcolor] eq $Priv($w,aselectcolor))} {
|
| 758 |
+
$w configure -selectcolor $Priv($w,selectcolor)
|
| 759 |
+
}
|
| 760 |
+
}
|
| 761 |
+
unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor)
|
| 762 |
+
|
| 763 |
+
# Restore the original button relief if it was changed by Tk. That is
|
| 764 |
+
# signaled by the existence of Priv($w,prelief).
|
| 765 |
+
|
| 766 |
+
if {[info exists Priv($w,relief)]} {
|
| 767 |
+
if {[info exists Priv($w,prelief)] && \
|
| 768 |
+
$Priv($w,prelief) eq [$w cget -relief]} {
|
| 769 |
+
$w configure -relief $Priv($w,relief)
|
| 770 |
+
}
|
| 771 |
+
unset -nocomplain Priv($w,relief) Priv($w,prelief)
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
set Priv(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edir.tcl --
|
| 2 |
+
#
|
| 3 |
+
# Choose directory dialog implementation for Unix/Mac.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) 1998-2000 by Scriptics Corporation.
|
| 6 |
+
# All rights reserved.
|
| 7 |
+
|
| 8 |
+
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
|
| 9 |
+
namespace eval ::tk::dialog {}
|
| 10 |
+
namespace eval ::tk::dialog::file {}
|
| 11 |
+
|
| 12 |
+
# Make the chooseDir namespace inside the dialog namespace
|
| 13 |
+
namespace eval ::tk::dialog::file::chooseDir {
|
| 14 |
+
namespace import -force ::tk::msgcat::*
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
# ::tk::dialog::file::chooseDir:: --
|
| 18 |
+
#
|
| 19 |
+
# Implements the TK directory selection dialog.
|
| 20 |
+
#
|
| 21 |
+
# Arguments:
|
| 22 |
+
# args Options parsed by the procedure.
|
| 23 |
+
#
|
| 24 |
+
proc ::tk::dialog::file::chooseDir:: {args} {
|
| 25 |
+
variable ::tk::Priv
|
| 26 |
+
set dataName __tk_choosedir
|
| 27 |
+
upvar ::tk::dialog::file::$dataName data
|
| 28 |
+
Config $dataName $args
|
| 29 |
+
|
| 30 |
+
if {$data(-parent) eq "."} {
|
| 31 |
+
set w .$dataName
|
| 32 |
+
} else {
|
| 33 |
+
set w $data(-parent).$dataName
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# (re)create the dialog box if necessary
|
| 37 |
+
#
|
| 38 |
+
if {![winfo exists $w]} {
|
| 39 |
+
::tk::dialog::file::Create $w TkChooseDir
|
| 40 |
+
} elseif {[winfo class $w] ne "TkChooseDir"} {
|
| 41 |
+
destroy $w
|
| 42 |
+
::tk::dialog::file::Create $w TkChooseDir
|
| 43 |
+
} else {
|
| 44 |
+
set data(dirMenuBtn) $w.contents.f1.menu
|
| 45 |
+
set data(dirMenu) $w.contents.f1.menu.menu
|
| 46 |
+
set data(upBtn) $w.contents.f1.up
|
| 47 |
+
set data(icons) $w.contents.icons
|
| 48 |
+
set data(ent) $w.contents.f2.ent
|
| 49 |
+
set data(okBtn) $w.contents.f2.ok
|
| 50 |
+
set data(cancelBtn) $w.contents.f2.cancel
|
| 51 |
+
set data(hiddenBtn) $w.contents.f2.hidden
|
| 52 |
+
}
|
| 53 |
+
if {$::tk::dialog::file::showHiddenBtn} {
|
| 54 |
+
$data(hiddenBtn) configure -state normal
|
| 55 |
+
grid $data(hiddenBtn)
|
| 56 |
+
} else {
|
| 57 |
+
$data(hiddenBtn) configure -state disabled
|
| 58 |
+
grid remove $data(hiddenBtn)
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
# When using -mustexist, manage the OK button state for validity
|
| 62 |
+
$data(okBtn) configure -state normal
|
| 63 |
+
if {$data(-mustexist)} {
|
| 64 |
+
$data(ent) configure -validate key \
|
| 65 |
+
-validatecommand [list ::tk::dialog::file::chooseDir::IsOK? $w %P]
|
| 66 |
+
} else {
|
| 67 |
+
$data(ent) configure -validate none
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
# Dialog boxes should be transient with respect to their parent,
|
| 71 |
+
# so that they will always stay on top of their parent window. However,
|
| 72 |
+
# some window managers will create the window as withdrawn if the parent
|
| 73 |
+
# window is withdrawn or iconified. Combined with the grab we put on the
|
| 74 |
+
# window, this can hang the entire application. Therefore we only make
|
| 75 |
+
# the dialog transient if the parent is viewable.
|
| 76 |
+
|
| 77 |
+
if {[winfo viewable [winfo toplevel $data(-parent)]] } {
|
| 78 |
+
wm transient $w $data(-parent)
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
trace add variable data(selectPath) write \
|
| 82 |
+
[list ::tk::dialog::file::SetPath $w]
|
| 83 |
+
$data(dirMenuBtn) configure \
|
| 84 |
+
-textvariable ::tk::dialog::file::${dataName}(selectPath)
|
| 85 |
+
|
| 86 |
+
set data(filter) "*"
|
| 87 |
+
set data(previousEntryText) ""
|
| 88 |
+
::tk::dialog::file::UpdateWhenIdle $w
|
| 89 |
+
|
| 90 |
+
# Withdraw the window, then update all the geometry information
|
| 91 |
+
# so we know how big it wants to be, then center the window in the
|
| 92 |
+
# display (Motif style) and de-iconify it.
|
| 93 |
+
|
| 94 |
+
::tk::PlaceWindow $w widget $data(-parent)
|
| 95 |
+
wm title $w $data(-title)
|
| 96 |
+
|
| 97 |
+
# Set a grab and claim the focus too.
|
| 98 |
+
|
| 99 |
+
::tk::SetFocusGrab $w $data(ent)
|
| 100 |
+
$data(ent) delete 0 end
|
| 101 |
+
$data(ent) insert 0 $data(selectPath)
|
| 102 |
+
$data(ent) selection range 0 end
|
| 103 |
+
$data(ent) icursor end
|
| 104 |
+
|
| 105 |
+
# Wait for the user to respond, then restore the focus and
|
| 106 |
+
# return the index of the selected button. Restore the focus
|
| 107 |
+
# before deleting the window, since otherwise the window manager
|
| 108 |
+
# may take the focus away so we can't redirect it. Finally,
|
| 109 |
+
# restore any grab that was in effect.
|
| 110 |
+
|
| 111 |
+
vwait ::tk::Priv(selectFilePath)
|
| 112 |
+
|
| 113 |
+
::tk::RestoreFocusGrab $w $data(ent) withdraw
|
| 114 |
+
|
| 115 |
+
# Cleanup traces on selectPath variable
|
| 116 |
+
#
|
| 117 |
+
|
| 118 |
+
foreach trace [trace info variable data(selectPath)] {
|
| 119 |
+
trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
|
| 120 |
+
}
|
| 121 |
+
if {[winfo exists $data(dirMenuBtn)]} {
|
| 122 |
+
$data(dirMenuBtn) configure -textvariable {}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
# Return value to user
|
| 126 |
+
#
|
| 127 |
+
|
| 128 |
+
return $Priv(selectFilePath)
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
# ::tk::dialog::file::chooseDir::Config --
|
| 132 |
+
#
|
| 133 |
+
# Configures the Tk choosedir dialog according to the argument list
|
| 134 |
+
#
|
| 135 |
+
proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
|
| 136 |
+
upvar ::tk::dialog::file::$dataName data
|
| 137 |
+
|
| 138 |
+
# 0: Delete all variable that were set on data(selectPath) the
|
| 139 |
+
# last time the file dialog is used. The traces may cause troubles
|
| 140 |
+
# if the dialog is now used with a different -parent option.
|
| 141 |
+
#
|
| 142 |
+
foreach trace [trace info variable data(selectPath)] {
|
| 143 |
+
trace remove variable data(selectPath) [lindex $trace 0] [lindex $trace 1]
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
# 1: the configuration specs
|
| 147 |
+
#
|
| 148 |
+
set specs {
|
| 149 |
+
{-mustexist "" "" 0}
|
| 150 |
+
{-initialdir "" "" ""}
|
| 151 |
+
{-parent "" "" "."}
|
| 152 |
+
{-title "" "" ""}
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
# 2: default values depending on the type of the dialog
|
| 156 |
+
#
|
| 157 |
+
if {![info exists data(selectPath)]} {
|
| 158 |
+
# first time the dialog has been popped up
|
| 159 |
+
set data(selectPath) [pwd]
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
# 3: parse the arguments
|
| 163 |
+
#
|
| 164 |
+
tclParseConfigSpec ::tk::dialog::file::$dataName $specs "" $argList
|
| 165 |
+
|
| 166 |
+
if {$data(-title) eq ""} {
|
| 167 |
+
set data(-title) "[mc "Choose Directory"]"
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
# Stub out the -multiple value for the dialog; it doesn't make sense for
|
| 171 |
+
# choose directory dialogs, but we have to have something there because we
|
| 172 |
+
# share so much code with the file dialogs.
|
| 173 |
+
set data(-multiple) 0
|
| 174 |
+
|
| 175 |
+
# 4: set the default directory and selection according to the -initial
|
| 176 |
+
# settings
|
| 177 |
+
#
|
| 178 |
+
if {$data(-initialdir) ne ""} {
|
| 179 |
+
# Ensure that initialdir is an absolute path name.
|
| 180 |
+
if {[file isdirectory $data(-initialdir)]} {
|
| 181 |
+
set old [pwd]
|
| 182 |
+
cd $data(-initialdir)
|
| 183 |
+
set data(selectPath) [pwd]
|
| 184 |
+
cd $old
|
| 185 |
+
} else {
|
| 186 |
+
set data(selectPath) [pwd]
|
| 187 |
+
}
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
if {![winfo exists $data(-parent)]} {
|
| 191 |
+
return -code error -errorcode [list TK LOOKUP WINDOW $data(-parent)] \
|
| 192 |
+
"bad window path name \"$data(-parent)\""
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
# Gets called when user presses Return in the "Selection" entry or presses OK.
|
| 197 |
+
#
|
| 198 |
+
proc ::tk::dialog::file::chooseDir::OkCmd {w} {
|
| 199 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 200 |
+
|
| 201 |
+
# This is the brains behind selecting non-existant directories. Here's
|
| 202 |
+
# the flowchart:
|
| 203 |
+
# 1. If the icon list has a selection, join it with the current dir,
|
| 204 |
+
# and return that value.
|
| 205 |
+
# 1a. If the icon list does not have a selection ...
|
| 206 |
+
# 2. If the entry is empty, do nothing.
|
| 207 |
+
# 3. If the entry contains an invalid directory, then...
|
| 208 |
+
# 3a. If the value is the same as last time through here, end dialog.
|
| 209 |
+
# 3b. If the value is different than last time, save it and return.
|
| 210 |
+
# 4. If entry contains a valid directory, then...
|
| 211 |
+
# 4a. If the value is the same as the current directory, end dialog.
|
| 212 |
+
# 4b. If the value is different from the current directory, change to
|
| 213 |
+
# that directory.
|
| 214 |
+
|
| 215 |
+
set selection [$data(icons) selection get]
|
| 216 |
+
if {[llength $selection] != 0} {
|
| 217 |
+
set iconText [$data(icons) get [lindex $selection 0]]
|
| 218 |
+
set iconText [file join $data(selectPath) $iconText]
|
| 219 |
+
Done $w $iconText
|
| 220 |
+
} else {
|
| 221 |
+
set text [$data(ent) get]
|
| 222 |
+
if {$text eq ""} {
|
| 223 |
+
return
|
| 224 |
+
}
|
| 225 |
+
set text [file join {*}[file split [string trim $text]]]
|
| 226 |
+
if {![file exists $text] || ![file isdirectory $text]} {
|
| 227 |
+
# Entry contains an invalid directory. If it's the same as the
|
| 228 |
+
# last time they came through here, reset the saved value and end
|
| 229 |
+
# the dialog. Otherwise, save the value (so we can do this test
|
| 230 |
+
# next time).
|
| 231 |
+
if {$text eq $data(previousEntryText)} {
|
| 232 |
+
set data(previousEntryText) ""
|
| 233 |
+
Done $w $text
|
| 234 |
+
} else {
|
| 235 |
+
set data(previousEntryText) $text
|
| 236 |
+
}
|
| 237 |
+
} else {
|
| 238 |
+
# Entry contains a valid directory. If it is the same as the
|
| 239 |
+
# current directory, end the dialog. Otherwise, change to that
|
| 240 |
+
# directory.
|
| 241 |
+
if {$text eq $data(selectPath)} {
|
| 242 |
+
Done $w $text
|
| 243 |
+
} else {
|
| 244 |
+
set data(selectPath) $text
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
}
|
| 248 |
+
return
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
# Change state of OK button to match -mustexist correctness of entry
|
| 252 |
+
#
|
| 253 |
+
proc ::tk::dialog::file::chooseDir::IsOK? {w text} {
|
| 254 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 255 |
+
|
| 256 |
+
set ok [file isdirectory $text]
|
| 257 |
+
$data(okBtn) configure -state [expr {$ok ? "normal" : "disabled"}]
|
| 258 |
+
|
| 259 |
+
# always return 1
|
| 260 |
+
return 1
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
proc ::tk::dialog::file::chooseDir::DblClick {w} {
|
| 264 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 265 |
+
set selection [$data(icons) selection get]
|
| 266 |
+
if {[llength $selection] != 0} {
|
| 267 |
+
set filenameFragment [$data(icons) get [lindex $selection 0]]
|
| 268 |
+
set file $data(selectPath)
|
| 269 |
+
if {[file isdirectory $file]} {
|
| 270 |
+
::tk::dialog::file::ListInvoke $w [list $filenameFragment]
|
| 271 |
+
return
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
# Gets called when user browses the IconList widget (dragging mouse, arrow
|
| 277 |
+
# keys, etc)
|
| 278 |
+
#
|
| 279 |
+
proc ::tk::dialog::file::chooseDir::ListBrowse {w text} {
|
| 280 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 281 |
+
|
| 282 |
+
if {$text eq ""} {
|
| 283 |
+
return
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
set file [::tk::dialog::file::JoinFile $data(selectPath) $text]
|
| 287 |
+
$data(ent) delete 0 end
|
| 288 |
+
$data(ent) insert 0 $file
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
# ::tk::dialog::file::chooseDir::Done --
|
| 292 |
+
#
|
| 293 |
+
# Gets called when user has input a valid filename. Pops up a
|
| 294 |
+
# dialog box to confirm selection when necessary. Sets the
|
| 295 |
+
# Priv(selectFilePath) variable, which will break the "vwait"
|
| 296 |
+
# loop in tk_chooseDirectory and return the selected filename to the
|
| 297 |
+
# script that calls tk_getOpenFile or tk_getSaveFile
|
| 298 |
+
#
|
| 299 |
+
proc ::tk::dialog::file::chooseDir::Done {w {selectFilePath ""}} {
|
| 300 |
+
upvar ::tk::dialog::file::[winfo name $w] data
|
| 301 |
+
variable ::tk::Priv
|
| 302 |
+
|
| 303 |
+
if {$selectFilePath eq ""} {
|
| 304 |
+
set selectFilePath $data(selectPath)
|
| 305 |
+
}
|
| 306 |
+
if {$data(-mustexist) && ![file isdirectory $selectFilePath]} {
|
| 307 |
+
return
|
| 308 |
+
}
|
| 309 |
+
set Priv(selectFilePath) $selectFilePath
|
| 310 |
+
}
|
evalkit_llava/lib/tk8.6/console.tcl
ADDED
|
@@ -0,0 +1,1154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# console.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This code constructs the console window for an application. It
|
| 4 |
+
# can be used by non-unix systems that do not have built-in support
|
| 5 |
+
# for shells.
|
| 6 |
+
#
|
| 7 |
+
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
|
| 8 |
+
# Copyright (c) 1998-2000 Ajuba Solutions.
|
| 9 |
+
# Copyright (c) 2007-2008 Daniel A. Steffen <das@users.sourceforge.net>
|
| 10 |
+
#
|
| 11 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 12 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 13 |
+
#
|
| 14 |
+
|
| 15 |
+
# TODO: history - remember partially written command
|
| 16 |
+
|
| 17 |
+
namespace eval ::tk::console {
|
| 18 |
+
variable blinkTime 500 ; # msecs to blink braced range for
|
| 19 |
+
variable blinkRange 1 ; # enable blinking of the entire braced range
|
| 20 |
+
variable magicKeys 1 ; # enable brace matching and proc/var recognition
|
| 21 |
+
variable maxLines 600 ; # maximum # of lines buffered in console
|
| 22 |
+
variable showMatches 1 ; # show multiple expand matches
|
| 23 |
+
variable useFontchooser [llength [info command ::tk::fontchooser]]
|
| 24 |
+
variable inPlugin [info exists embed_args]
|
| 25 |
+
variable defaultPrompt ; # default prompt if tcl_prompt1 isn't used
|
| 26 |
+
|
| 27 |
+
if {$inPlugin} {
|
| 28 |
+
set defaultPrompt {subst {[history nextid] % }}
|
| 29 |
+
} else {
|
| 30 |
+
set defaultPrompt {subst {([file tail [pwd]]) [history nextid] % }}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
# simple compat function for tkcon code added for this console
|
| 35 |
+
interp alias {} EvalAttached {} consoleinterp eval
|
| 36 |
+
|
| 37 |
+
# ::tk::ConsoleInit --
|
| 38 |
+
# This procedure constructs and configures the console windows.
|
| 39 |
+
#
|
| 40 |
+
# Arguments:
|
| 41 |
+
# None.
|
| 42 |
+
|
| 43 |
+
proc ::tk::ConsoleInit {} {
|
| 44 |
+
if {![consoleinterp eval {set tcl_interactive}]} {
|
| 45 |
+
wm withdraw .
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 49 |
+
set mod "Cmd"
|
| 50 |
+
} else {
|
| 51 |
+
set mod "Ctrl"
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if {[catch {menu .menubar} err]} {
|
| 55 |
+
bgerror "INIT: $err"
|
| 56 |
+
}
|
| 57 |
+
AmpMenuArgs .menubar add cascade -label [mc &File] -menu .menubar.file
|
| 58 |
+
AmpMenuArgs .menubar add cascade -label [mc &Edit] -menu .menubar.edit
|
| 59 |
+
|
| 60 |
+
menu .menubar.file -tearoff 0
|
| 61 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Source..."] \
|
| 62 |
+
-command {tk::ConsoleSource}
|
| 63 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Hide Console"] \
|
| 64 |
+
-command {wm withdraw .}
|
| 65 |
+
AmpMenuArgs .menubar.file add command -label [mc "&Clear Console"] \
|
| 66 |
+
-command {.console delete 1.0 "promptEnd linestart"}
|
| 67 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 68 |
+
AmpMenuArgs .menubar.file add command -label [mc E&xit] -command {exit}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
menu .menubar.edit -tearoff 0
|
| 72 |
+
AmpMenuArgs .menubar.edit add command -label [mc Cu&t] -accel "$mod+X"\
|
| 73 |
+
-command {event generate .console <<Cut>>}
|
| 74 |
+
AmpMenuArgs .menubar.edit add command -label [mc &Copy] -accel "$mod+C"\
|
| 75 |
+
-command {event generate .console <<Copy>>}
|
| 76 |
+
AmpMenuArgs .menubar.edit add command -label [mc P&aste] -accel "$mod+V"\
|
| 77 |
+
-command {event generate .console <<Paste>>}
|
| 78 |
+
|
| 79 |
+
if {[tk windowingsystem] ne "win32"} {
|
| 80 |
+
AmpMenuArgs .menubar.edit add command -label [mc Cl&ear] \
|
| 81 |
+
-command {event generate .console <<Clear>>}
|
| 82 |
+
} else {
|
| 83 |
+
AmpMenuArgs .menubar.edit add command -label [mc &Delete] \
|
| 84 |
+
-command {event generate .console <<Clear>>} -accel "Del"
|
| 85 |
+
|
| 86 |
+
AmpMenuArgs .menubar add cascade -label [mc &Help] -menu .menubar.help
|
| 87 |
+
menu .menubar.help -tearoff 0
|
| 88 |
+
AmpMenuArgs .menubar.help add command -label [mc &About...] \
|
| 89 |
+
-command tk::ConsoleAbout
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
AmpMenuArgs .menubar.edit add separator
|
| 93 |
+
if {$::tk::console::useFontchooser} {
|
| 94 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 95 |
+
.menubar.edit add command -label tk_choose_font_marker
|
| 96 |
+
set index [.menubar.edit index tk_choose_font_marker]
|
| 97 |
+
.menubar.edit entryconfigure $index \
|
| 98 |
+
-label [mc "Show Fonts"]\
|
| 99 |
+
-accelerator "$mod-T"\
|
| 100 |
+
-command [list ::tk::console::FontchooserToggle]
|
| 101 |
+
bind Console <<TkFontchooserVisibility>> \
|
| 102 |
+
[list ::tk::console::FontchooserVisibility $index]
|
| 103 |
+
::tk::console::FontchooserVisibility $index
|
| 104 |
+
} else {
|
| 105 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Font..."] \
|
| 106 |
+
-command [list ::tk::console::FontchooserToggle]
|
| 107 |
+
}
|
| 108 |
+
bind Console <FocusIn> [list ::tk::console::FontchooserFocus %W 1]
|
| 109 |
+
bind Console <FocusOut> [list ::tk::console::FontchooserFocus %W 0]
|
| 110 |
+
}
|
| 111 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Increase Font Size"] \
|
| 112 |
+
-accel "$mod++" -command {event generate .console <<Console_FontSizeIncr>>}
|
| 113 |
+
AmpMenuArgs .menubar.edit add command -label [mc "&Decrease Font Size"] \
|
| 114 |
+
-accel "$mod+-" -command {event generate .console <<Console_FontSizeDecr>>}
|
| 115 |
+
AmpMenuArgs .menubar.edit add command -label [mc "Fit To Screen Width"] \
|
| 116 |
+
-command {event generate .console <<Console_FitScreenWidth>>}
|
| 117 |
+
|
| 118 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 119 |
+
.menubar add cascade -label [mc Window] -menu [menu .menubar.window]
|
| 120 |
+
.menubar add cascade -label [mc Help] -menu [menu .menubar.help]
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
. configure -menu .menubar
|
| 124 |
+
|
| 125 |
+
# See if we can find a better font than the TkFixedFont
|
| 126 |
+
catch {font create TkConsoleFont {*}[font configure TkFixedFont]}
|
| 127 |
+
set families [font families]
|
| 128 |
+
switch -exact -- [tk windowingsystem] {
|
| 129 |
+
aqua { set preferred {Monaco 10} }
|
| 130 |
+
win32 { set preferred {ProFontWindows 8 Consolas 8} }
|
| 131 |
+
default { set preferred {} }
|
| 132 |
+
}
|
| 133 |
+
foreach {family size} $preferred {
|
| 134 |
+
if {$family in $families} {
|
| 135 |
+
font configure TkConsoleFont -family $family -size $size
|
| 136 |
+
break
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
# Provide the right border for the text widget (platform dependent).
|
| 141 |
+
::ttk::style layout ConsoleFrame {
|
| 142 |
+
Entry.field -sticky news -border 1 -children {
|
| 143 |
+
ConsoleFrame.padding -sticky news
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
::ttk::frame .consoleframe -style ConsoleFrame
|
| 147 |
+
|
| 148 |
+
set con [text .console -yscrollcommand [list .sb set] -setgrid true \
|
| 149 |
+
-borderwidth 0 -highlightthickness 0 -font TkConsoleFont]
|
| 150 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 151 |
+
scrollbar .sb -command [list $con yview]
|
| 152 |
+
} else {
|
| 153 |
+
::ttk::scrollbar .sb -command [list $con yview]
|
| 154 |
+
}
|
| 155 |
+
pack .sb -in .consoleframe -fill both -side right -padx 1 -pady 1
|
| 156 |
+
pack $con -in .consoleframe -fill both -expand 1 -side left -padx 1 -pady 1
|
| 157 |
+
pack .consoleframe -fill both -expand 1 -side left
|
| 158 |
+
|
| 159 |
+
ConsoleBind $con
|
| 160 |
+
|
| 161 |
+
$con tag configure stderr -foreground red
|
| 162 |
+
$con tag configure stdin -foreground blue
|
| 163 |
+
$con tag configure prompt -foreground \#8F4433
|
| 164 |
+
$con tag configure proc -foreground \#008800
|
| 165 |
+
$con tag configure var -background \#FFC0D0
|
| 166 |
+
$con tag raise sel
|
| 167 |
+
$con tag configure blink -background \#FFFF00
|
| 168 |
+
$con tag configure find -background \#FFFF00
|
| 169 |
+
|
| 170 |
+
focus $con
|
| 171 |
+
|
| 172 |
+
# Avoid listing this console in [winfo interps]
|
| 173 |
+
if {[info command ::send] eq "::send"} {rename ::send {}}
|
| 174 |
+
|
| 175 |
+
wm protocol . WM_DELETE_WINDOW { wm withdraw . }
|
| 176 |
+
wm title . [mc "Console"]
|
| 177 |
+
flush stdout
|
| 178 |
+
$con mark set output [$con index "end - 1 char"]
|
| 179 |
+
tk::TextSetCursor $con end
|
| 180 |
+
$con mark set promptEnd insert
|
| 181 |
+
$con mark gravity promptEnd left
|
| 182 |
+
|
| 183 |
+
# A variant of ConsolePrompt to avoid a 'puts' call
|
| 184 |
+
set w $con
|
| 185 |
+
set temp [$w index "end - 1 char"]
|
| 186 |
+
$w mark set output end
|
| 187 |
+
if {![consoleinterp eval "info exists tcl_prompt1"]} {
|
| 188 |
+
set string [EvalAttached $::tk::console::defaultPrompt]
|
| 189 |
+
$w insert output $string stdout
|
| 190 |
+
}
|
| 191 |
+
$w mark set output $temp
|
| 192 |
+
::tk::TextSetCursor $w end
|
| 193 |
+
$w mark set promptEnd insert
|
| 194 |
+
$w mark gravity promptEnd left
|
| 195 |
+
|
| 196 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 197 |
+
# Subtle work-around to erase the '% ' that tclMain.c prints out
|
| 198 |
+
after idle [subst -nocommand {
|
| 199 |
+
if {[$con get 1.0 output] eq "% "} { $con delete 1.0 output }
|
| 200 |
+
}]
|
| 201 |
+
}
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
# ::tk::ConsoleSource --
|
| 205 |
+
#
|
| 206 |
+
# Prompts the user for a file to source in the main interpreter.
|
| 207 |
+
#
|
| 208 |
+
# Arguments:
|
| 209 |
+
# None.
|
| 210 |
+
|
| 211 |
+
proc ::tk::ConsoleSource {} {
|
| 212 |
+
set filename [tk_getOpenFile -defaultextension .tcl -parent . \
|
| 213 |
+
-title [mc "Select a file to source"] \
|
| 214 |
+
-filetypes [list \
|
| 215 |
+
[list [mc "Tcl Scripts"] .tcl] \
|
| 216 |
+
[list [mc "All Files"] *]]]
|
| 217 |
+
if {$filename ne ""} {
|
| 218 |
+
set cmd [list source $filename]
|
| 219 |
+
if {[catch {consoleinterp eval $cmd} result]} {
|
| 220 |
+
ConsoleOutput stderr "$result\n"
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
# ::tk::ConsoleInvoke --
|
| 226 |
+
# Processes the command line input. If the command is complete it
|
| 227 |
+
# is evaled in the main interpreter. Otherwise, the continuation
|
| 228 |
+
# prompt is added and more input may be added.
|
| 229 |
+
#
|
| 230 |
+
# Arguments:
|
| 231 |
+
# None.
|
| 232 |
+
|
| 233 |
+
proc ::tk::ConsoleInvoke {args} {
|
| 234 |
+
set ranges [.console tag ranges input]
|
| 235 |
+
set cmd ""
|
| 236 |
+
if {[llength $ranges]} {
|
| 237 |
+
set pos 0
|
| 238 |
+
while {[lindex $ranges $pos] ne ""} {
|
| 239 |
+
set start [lindex $ranges $pos]
|
| 240 |
+
set end [lindex $ranges [incr pos]]
|
| 241 |
+
append cmd [.console get $start $end]
|
| 242 |
+
incr pos
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
if {$cmd eq ""} {
|
| 246 |
+
ConsolePrompt
|
| 247 |
+
} elseif {[info complete $cmd]} {
|
| 248 |
+
.console mark set output end
|
| 249 |
+
.console tag delete input
|
| 250 |
+
set result [consoleinterp record $cmd]
|
| 251 |
+
if {$result ne ""} {
|
| 252 |
+
puts $result
|
| 253 |
+
}
|
| 254 |
+
ConsoleHistory reset
|
| 255 |
+
ConsolePrompt
|
| 256 |
+
} else {
|
| 257 |
+
ConsolePrompt partial
|
| 258 |
+
}
|
| 259 |
+
.console yview -pickplace insert
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
# ::tk::ConsoleHistory --
|
| 263 |
+
# This procedure implements command line history for the
|
| 264 |
+
# console. In general is evals the history command in the
|
| 265 |
+
# main interpreter to obtain the history. The variable
|
| 266 |
+
# ::tk::HistNum is used to store the current location in the history.
|
| 267 |
+
#
|
| 268 |
+
# Arguments:
|
| 269 |
+
# cmd - Which action to take: prev, next, reset.
|
| 270 |
+
|
| 271 |
+
set ::tk::HistNum 1
|
| 272 |
+
proc ::tk::ConsoleHistory {cmd} {
|
| 273 |
+
variable HistNum
|
| 274 |
+
|
| 275 |
+
switch $cmd {
|
| 276 |
+
prev {
|
| 277 |
+
incr HistNum -1
|
| 278 |
+
if {$HistNum == 0} {
|
| 279 |
+
set cmd {history event [expr {[history nextid] -1}]}
|
| 280 |
+
} else {
|
| 281 |
+
set cmd "history event $HistNum"
|
| 282 |
+
}
|
| 283 |
+
if {[catch {consoleinterp eval $cmd} cmd]} {
|
| 284 |
+
incr HistNum
|
| 285 |
+
return
|
| 286 |
+
}
|
| 287 |
+
.console delete promptEnd end
|
| 288 |
+
.console insert promptEnd $cmd {input stdin}
|
| 289 |
+
.console see end
|
| 290 |
+
}
|
| 291 |
+
next {
|
| 292 |
+
incr HistNum
|
| 293 |
+
if {$HistNum == 0} {
|
| 294 |
+
set cmd {history event [expr {[history nextid] -1}]}
|
| 295 |
+
} elseif {$HistNum > 0} {
|
| 296 |
+
set cmd ""
|
| 297 |
+
set HistNum 1
|
| 298 |
+
} else {
|
| 299 |
+
set cmd "history event $HistNum"
|
| 300 |
+
}
|
| 301 |
+
if {$cmd ne ""} {
|
| 302 |
+
catch {consoleinterp eval $cmd} cmd
|
| 303 |
+
}
|
| 304 |
+
.console delete promptEnd end
|
| 305 |
+
.console insert promptEnd $cmd {input stdin}
|
| 306 |
+
.console see end
|
| 307 |
+
}
|
| 308 |
+
reset {
|
| 309 |
+
set HistNum 1
|
| 310 |
+
}
|
| 311 |
+
}
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
# ::tk::ConsolePrompt --
|
| 315 |
+
# This procedure draws the prompt. If tcl_prompt1 or tcl_prompt2
|
| 316 |
+
# exists in the main interpreter it will be called to generate the
|
| 317 |
+
# prompt. Otherwise, a hard coded default prompt is printed.
|
| 318 |
+
#
|
| 319 |
+
# Arguments:
|
| 320 |
+
# partial - Flag to specify which prompt to print.
|
| 321 |
+
|
| 322 |
+
proc ::tk::ConsolePrompt {{partial normal}} {
|
| 323 |
+
set w .console
|
| 324 |
+
if {$partial eq "normal"} {
|
| 325 |
+
set temp [$w index "end - 1 char"]
|
| 326 |
+
$w mark set output end
|
| 327 |
+
if {[consoleinterp eval "info exists tcl_prompt1"]} {
|
| 328 |
+
consoleinterp eval "eval \[set tcl_prompt1\]"
|
| 329 |
+
} else {
|
| 330 |
+
puts -nonewline [EvalAttached $::tk::console::defaultPrompt]
|
| 331 |
+
}
|
| 332 |
+
} else {
|
| 333 |
+
set temp [$w index output]
|
| 334 |
+
$w mark set output end
|
| 335 |
+
if {[consoleinterp eval "info exists tcl_prompt2"]} {
|
| 336 |
+
consoleinterp eval "eval \[set tcl_prompt2\]"
|
| 337 |
+
} else {
|
| 338 |
+
puts -nonewline "> "
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
flush stdout
|
| 342 |
+
$w mark set output $temp
|
| 343 |
+
::tk::TextSetCursor $w end
|
| 344 |
+
$w mark set promptEnd insert
|
| 345 |
+
$w mark gravity promptEnd left
|
| 346 |
+
::tk::console::ConstrainBuffer $w $::tk::console::maxLines
|
| 347 |
+
$w see end
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
# Copy selected text from the console
|
| 351 |
+
proc ::tk::console::Copy {w} {
|
| 352 |
+
if {![catch {set data [$w get sel.first sel.last]}]} {
|
| 353 |
+
clipboard clear -displayof $w
|
| 354 |
+
clipboard append -displayof $w $data
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
# Copies selected text. If the selection is within the current active edit
|
| 358 |
+
# region then it will be cut, if not it is only copied.
|
| 359 |
+
proc ::tk::console::Cut {w} {
|
| 360 |
+
if {![catch {set data [$w get sel.first sel.last]}]} {
|
| 361 |
+
clipboard clear -displayof $w
|
| 362 |
+
clipboard append -displayof $w $data
|
| 363 |
+
if {[$w compare sel.first >= output]} {
|
| 364 |
+
$w delete sel.first sel.last
|
| 365 |
+
}
|
| 366 |
+
}
|
| 367 |
+
}
|
| 368 |
+
# Paste text from the clipboard
|
| 369 |
+
proc ::tk::console::Paste {w} {
|
| 370 |
+
catch {
|
| 371 |
+
set clip [::tk::GetSelection $w CLIPBOARD]
|
| 372 |
+
set list [split $clip \n\r]
|
| 373 |
+
tk::ConsoleInsert $w [lindex $list 0]
|
| 374 |
+
foreach x [lrange $list 1 end] {
|
| 375 |
+
$w mark set insert {end - 1c}
|
| 376 |
+
tk::ConsoleInsert $w "\n"
|
| 377 |
+
tk::ConsoleInvoke
|
| 378 |
+
tk::ConsoleInsert $w $x
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
# Fit TkConsoleFont to window width
|
| 384 |
+
proc ::tk::console::FitScreenWidth {w} {
|
| 385 |
+
set width [winfo screenwidth $w]
|
| 386 |
+
set cwidth [$w cget -width]
|
| 387 |
+
set s -50
|
| 388 |
+
set fit 0
|
| 389 |
+
array set fi [font configure TkConsoleFont]
|
| 390 |
+
while {$s < 0} {
|
| 391 |
+
set fi(-size) $s
|
| 392 |
+
set f [font create {*}[array get fi]]
|
| 393 |
+
set c [font measure $f "eM"]
|
| 394 |
+
font delete $f
|
| 395 |
+
if {$c * $cwidth < 1.667 * $width} {
|
| 396 |
+
font configure TkConsoleFont -size $s
|
| 397 |
+
break
|
| 398 |
+
}
|
| 399 |
+
incr s 2
|
| 400 |
+
}
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
# ::tk::ConsoleBind --
|
| 404 |
+
# This procedure first ensures that the default bindings for the Text
|
| 405 |
+
# class have been defined. Then certain bindings are overridden for
|
| 406 |
+
# the class.
|
| 407 |
+
#
|
| 408 |
+
# Arguments:
|
| 409 |
+
# None.
|
| 410 |
+
|
| 411 |
+
proc ::tk::ConsoleBind {w} {
|
| 412 |
+
bindtags $w [list $w Console PostConsole [winfo toplevel $w] all]
|
| 413 |
+
|
| 414 |
+
## Get all Text bindings into Console
|
| 415 |
+
foreach ev [bind Text] {
|
| 416 |
+
bind Console $ev [bind Text $ev]
|
| 417 |
+
}
|
| 418 |
+
## We really didn't want the newline insertion...
|
| 419 |
+
bind Console <Control-o> {}
|
| 420 |
+
## ...or any Control-v binding (would block <<Paste>>)
|
| 421 |
+
bind Console <Control-v> {}
|
| 422 |
+
|
| 423 |
+
# For the moment, transpose isn't enabled until the console
|
| 424 |
+
# gets and overhaul of how it handles input -- hobbs
|
| 425 |
+
bind Console <Control-t> {}
|
| 426 |
+
|
| 427 |
+
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
| 428 |
+
# Otherwise, if a widget binding for one of these is defined, the
|
| 429 |
+
# <Keypress> class binding will also fire and insert the character
|
| 430 |
+
# which is wrong.
|
| 431 |
+
|
| 432 |
+
bind Console <Alt-Key> {# nothing }
|
| 433 |
+
bind Console <Meta-Key> {# nothing}
|
| 434 |
+
bind Console <Control-Key> {# nothing}
|
| 435 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 436 |
+
bind Console <Command-Key> {# nothing}
|
| 437 |
+
bind Console <Mod4-Key> {# nothing}
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
foreach {ev key} {
|
| 441 |
+
<<Console_NextImmediate>> <Control-n>
|
| 442 |
+
<<Console_PrevImmediate>> <Control-p>
|
| 443 |
+
<<Console_PrevSearch>> <Control-r>
|
| 444 |
+
<<Console_NextSearch>> <Control-s>
|
| 445 |
+
|
| 446 |
+
<<Console_Expand>> <Tab>
|
| 447 |
+
<<Console_Expand>> <Escape>
|
| 448 |
+
<<Console_ExpandFile>> <Control-Shift-F>
|
| 449 |
+
<<Console_ExpandProc>> <Control-Shift-P>
|
| 450 |
+
<<Console_ExpandVar>> <Control-Shift-V>
|
| 451 |
+
<<Console_Tab>> <Control-i>
|
| 452 |
+
<<Console_Tab>> <Meta-i>
|
| 453 |
+
<<Console_Eval>> <Return>
|
| 454 |
+
<<Console_Eval>> <KP_Enter>
|
| 455 |
+
|
| 456 |
+
<<Console_Clear>> <Control-l>
|
| 457 |
+
<<Console_KillLine>> <Control-k>
|
| 458 |
+
<<Console_Transpose>> <Control-t>
|
| 459 |
+
<<Console_ClearLine>> <Control-u>
|
| 460 |
+
<<Console_SaveCommand>> <Control-z>
|
| 461 |
+
<<Console_FontSizeIncr>> <Control-plus>
|
| 462 |
+
<<Console_FontSizeDecr>> <Control-minus>
|
| 463 |
+
} {
|
| 464 |
+
event add $ev $key
|
| 465 |
+
bind Console $key {}
|
| 466 |
+
}
|
| 467 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 468 |
+
foreach {ev key} {
|
| 469 |
+
<<Console_FontSizeIncr>> <Command-plus>
|
| 470 |
+
<<Console_FontSizeDecr>> <Command-minus>
|
| 471 |
+
} {
|
| 472 |
+
event add $ev $key
|
| 473 |
+
bind Console $key {}
|
| 474 |
+
}
|
| 475 |
+
if {$::tk::console::useFontchooser} {
|
| 476 |
+
bind Console <Command-t> [list ::tk::console::FontchooserToggle]
|
| 477 |
+
}
|
| 478 |
+
}
|
| 479 |
+
bind Console <<Console_Expand>> {
|
| 480 |
+
if {[%W compare insert > promptEnd]} {
|
| 481 |
+
::tk::console::Expand %W
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
bind Console <<Console_ExpandFile>> {
|
| 485 |
+
if {[%W compare insert > promptEnd]} {
|
| 486 |
+
::tk::console::Expand %W path
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
bind Console <<Console_ExpandProc>> {
|
| 490 |
+
if {[%W compare insert > promptEnd]} {
|
| 491 |
+
::tk::console::Expand %W proc
|
| 492 |
+
}
|
| 493 |
+
}
|
| 494 |
+
bind Console <<Console_ExpandVar>> {
|
| 495 |
+
if {[%W compare insert > promptEnd]} {
|
| 496 |
+
::tk::console::Expand %W var
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
bind Console <<Console_Eval>> {
|
| 500 |
+
%W mark set insert {end - 1c}
|
| 501 |
+
tk::ConsoleInsert %W "\n"
|
| 502 |
+
tk::ConsoleInvoke
|
| 503 |
+
break
|
| 504 |
+
}
|
| 505 |
+
bind Console <Delete> {
|
| 506 |
+
if {{} ne [%W tag nextrange sel 1.0 end] \
|
| 507 |
+
&& [%W compare sel.first >= promptEnd]} {
|
| 508 |
+
%W delete sel.first sel.last
|
| 509 |
+
} elseif {[%W compare insert >= promptEnd]} {
|
| 510 |
+
%W delete insert
|
| 511 |
+
%W see insert
|
| 512 |
+
}
|
| 513 |
+
}
|
| 514 |
+
bind Console <BackSpace> {
|
| 515 |
+
if {{} ne [%W tag nextrange sel 1.0 end] \
|
| 516 |
+
&& [%W compare sel.first >= promptEnd]} {
|
| 517 |
+
%W delete sel.first sel.last
|
| 518 |
+
} elseif {[%W compare insert != 1.0] && \
|
| 519 |
+
[%W compare insert > promptEnd]} {
|
| 520 |
+
%W delete insert-1c
|
| 521 |
+
%W see insert
|
| 522 |
+
}
|
| 523 |
+
}
|
| 524 |
+
bind Console <Control-h> [bind Console <BackSpace>]
|
| 525 |
+
|
| 526 |
+
bind Console <<LineStart>> {
|
| 527 |
+
if {[%W compare insert < promptEnd]} {
|
| 528 |
+
tk::TextSetCursor %W {insert linestart}
|
| 529 |
+
} else {
|
| 530 |
+
tk::TextSetCursor %W promptEnd
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
bind Console <<LineEnd>> {
|
| 534 |
+
tk::TextSetCursor %W {insert lineend}
|
| 535 |
+
}
|
| 536 |
+
bind Console <Control-d> {
|
| 537 |
+
if {[%W compare insert < promptEnd]} {
|
| 538 |
+
break
|
| 539 |
+
}
|
| 540 |
+
%W delete insert
|
| 541 |
+
}
|
| 542 |
+
bind Console <<Console_KillLine>> {
|
| 543 |
+
if {[%W compare insert < promptEnd]} {
|
| 544 |
+
break
|
| 545 |
+
}
|
| 546 |
+
if {[%W compare insert == {insert lineend}]} {
|
| 547 |
+
%W delete insert
|
| 548 |
+
} else {
|
| 549 |
+
%W delete insert {insert lineend}
|
| 550 |
+
}
|
| 551 |
+
}
|
| 552 |
+
bind Console <<Console_Clear>> {
|
| 553 |
+
## Clear console display
|
| 554 |
+
%W delete 1.0 "promptEnd linestart"
|
| 555 |
+
}
|
| 556 |
+
bind Console <<Console_ClearLine>> {
|
| 557 |
+
## Clear command line (Unix shell staple)
|
| 558 |
+
%W delete promptEnd end
|
| 559 |
+
}
|
| 560 |
+
bind Console <Meta-d> {
|
| 561 |
+
if {[%W compare insert >= promptEnd]} {
|
| 562 |
+
%W delete insert {insert wordend}
|
| 563 |
+
}
|
| 564 |
+
}
|
| 565 |
+
bind Console <Meta-BackSpace> {
|
| 566 |
+
if {[%W compare {insert -1c wordstart} >= promptEnd]} {
|
| 567 |
+
%W delete {insert -1c wordstart} insert
|
| 568 |
+
}
|
| 569 |
+
}
|
| 570 |
+
bind Console <Meta-d> {
|
| 571 |
+
if {[%W compare insert >= promptEnd]} {
|
| 572 |
+
%W delete insert {insert wordend}
|
| 573 |
+
}
|
| 574 |
+
}
|
| 575 |
+
bind Console <Meta-BackSpace> {
|
| 576 |
+
if {[%W compare {insert -1c wordstart} >= promptEnd]} {
|
| 577 |
+
%W delete {insert -1c wordstart} insert
|
| 578 |
+
}
|
| 579 |
+
}
|
| 580 |
+
bind Console <Meta-Delete> {
|
| 581 |
+
if {[%W compare insert >= promptEnd]} {
|
| 582 |
+
%W delete insert {insert wordend}
|
| 583 |
+
}
|
| 584 |
+
}
|
| 585 |
+
bind Console <<PrevLine>> {
|
| 586 |
+
tk::ConsoleHistory prev
|
| 587 |
+
}
|
| 588 |
+
bind Console <<NextLine>> {
|
| 589 |
+
tk::ConsoleHistory next
|
| 590 |
+
}
|
| 591 |
+
bind Console <Insert> {
|
| 592 |
+
catch {tk::ConsoleInsert %W [::tk::GetSelection %W PRIMARY]}
|
| 593 |
+
}
|
| 594 |
+
bind Console <Key> {
|
| 595 |
+
tk::ConsoleInsert %W %A
|
| 596 |
+
}
|
| 597 |
+
bind Console <F9> {
|
| 598 |
+
destroy {*}[winfo children .]
|
| 599 |
+
source -encoding utf-8 [file join $tk_library console.tcl]
|
| 600 |
+
}
|
| 601 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 602 |
+
bind Console <Command-q> {
|
| 603 |
+
exit
|
| 604 |
+
}
|
| 605 |
+
}
|
| 606 |
+
bind Console <<Cut>> { ::tk::console::Cut %W }
|
| 607 |
+
bind Console <<Copy>> { ::tk::console::Copy %W }
|
| 608 |
+
bind Console <<Paste>> { ::tk::console::Paste %W }
|
| 609 |
+
|
| 610 |
+
bind Console <<Console_FontSizeIncr>> {
|
| 611 |
+
set size [font configure TkConsoleFont -size]
|
| 612 |
+
if {$size < 0} {set sign -1} else {set sign 1}
|
| 613 |
+
set size [expr {(abs($size) + 1) * $sign}]
|
| 614 |
+
font configure TkConsoleFont -size $size
|
| 615 |
+
if {$::tk::console::useFontchooser} {
|
| 616 |
+
tk fontchooser configure -font TkConsoleFont
|
| 617 |
+
}
|
| 618 |
+
}
|
| 619 |
+
bind Console <<Console_FontSizeDecr>> {
|
| 620 |
+
set size [font configure TkConsoleFont -size]
|
| 621 |
+
if {abs($size) < 2} { return }
|
| 622 |
+
if {$size < 0} {set sign -1} else {set sign 1}
|
| 623 |
+
set size [expr {(abs($size) - 1) * $sign}]
|
| 624 |
+
font configure TkConsoleFont -size $size
|
| 625 |
+
if {$::tk::console::useFontchooser} {
|
| 626 |
+
tk fontchooser configure -font TkConsoleFont
|
| 627 |
+
}
|
| 628 |
+
}
|
| 629 |
+
bind Console <<Console_FitScreenWidth>> {
|
| 630 |
+
::tk::console::FitScreenWidth %W
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
##
|
| 634 |
+
## Bindings for doing special things based on certain keys
|
| 635 |
+
##
|
| 636 |
+
bind PostConsole <parenright> {
|
| 637 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 638 |
+
::tk::console::MatchPair %W \( \) promptEnd
|
| 639 |
+
}
|
| 640 |
+
}
|
| 641 |
+
bind PostConsole <bracketright> {
|
| 642 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 643 |
+
::tk::console::MatchPair %W \[ \] promptEnd
|
| 644 |
+
}
|
| 645 |
+
}
|
| 646 |
+
bind PostConsole <braceright> {
|
| 647 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 648 |
+
::tk::console::MatchPair %W \{ \} promptEnd
|
| 649 |
+
}
|
| 650 |
+
}
|
| 651 |
+
bind PostConsole <quotedbl> {
|
| 652 |
+
if {"\\" ne [%W get insert-2c]} {
|
| 653 |
+
::tk::console::MatchQuote %W promptEnd
|
| 654 |
+
}
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
bind PostConsole <Key> {
|
| 658 |
+
if {"%A" ne ""} {
|
| 659 |
+
::tk::console::TagProc %W
|
| 660 |
+
}
|
| 661 |
+
}
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
# ::tk::ConsoleInsert --
|
| 665 |
+
# Insert a string into a text at the point of the insertion cursor.
|
| 666 |
+
# If there is a selection in the text, and it covers the point of the
|
| 667 |
+
# insertion cursor, then delete the selection before inserting. Insertion
|
| 668 |
+
# is restricted to the prompt area.
|
| 669 |
+
#
|
| 670 |
+
# Arguments:
|
| 671 |
+
# w - The text window in which to insert the string
|
| 672 |
+
# s - The string to insert (usually just a single character)
|
| 673 |
+
|
| 674 |
+
proc ::tk::ConsoleInsert {w s} {
|
| 675 |
+
if {$s eq ""} {
|
| 676 |
+
return
|
| 677 |
+
}
|
| 678 |
+
catch {
|
| 679 |
+
if {[$w compare sel.first <= insert] \
|
| 680 |
+
&& [$w compare sel.last >= insert]} {
|
| 681 |
+
$w tag remove sel sel.first promptEnd
|
| 682 |
+
$w delete sel.first sel.last
|
| 683 |
+
}
|
| 684 |
+
}
|
| 685 |
+
if {[$w compare insert < promptEnd]} {
|
| 686 |
+
$w mark set insert end
|
| 687 |
+
}
|
| 688 |
+
$w insert insert $s {input stdin}
|
| 689 |
+
$w see insert
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
# ::tk::ConsoleOutput --
|
| 693 |
+
#
|
| 694 |
+
# This routine is called directly by ConsolePutsCmd to cause a string
|
| 695 |
+
# to be displayed in the console.
|
| 696 |
+
#
|
| 697 |
+
# Arguments:
|
| 698 |
+
# dest - The output tag to be used: either "stderr" or "stdout".
|
| 699 |
+
# string - The string to be displayed.
|
| 700 |
+
|
| 701 |
+
proc ::tk::ConsoleOutput {dest string} {
|
| 702 |
+
set w .console
|
| 703 |
+
$w insert output $string $dest
|
| 704 |
+
::tk::console::ConstrainBuffer $w $::tk::console::maxLines
|
| 705 |
+
$w see insert
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
# ::tk::ConsoleExit --
|
| 709 |
+
#
|
| 710 |
+
# This routine is called by ConsoleEventProc when the main window of
|
| 711 |
+
# the application is destroyed. Don't call exit - that probably already
|
| 712 |
+
# happened. Just delete our window.
|
| 713 |
+
#
|
| 714 |
+
# Arguments:
|
| 715 |
+
# None.
|
| 716 |
+
|
| 717 |
+
proc ::tk::ConsoleExit {} {
|
| 718 |
+
destroy .
|
| 719 |
+
}
|
| 720 |
+
|
| 721 |
+
# ::tk::ConsoleAbout --
|
| 722 |
+
#
|
| 723 |
+
# This routine displays an About box to show Tcl/Tk version info.
|
| 724 |
+
#
|
| 725 |
+
# Arguments:
|
| 726 |
+
# None.
|
| 727 |
+
|
| 728 |
+
proc ::tk::ConsoleAbout {} {
|
| 729 |
+
tk_messageBox -type ok -message "[mc {Tcl for Windows}]
|
| 730 |
+
|
| 731 |
+
Tcl $::tcl_patchLevel
|
| 732 |
+
Tk $::tk_patchLevel"
|
| 733 |
+
}
|
| 734 |
+
|
| 735 |
+
# ::tk::console::Fontchooser* --
|
| 736 |
+
# Let the user select the console font (TIP 324).
|
| 737 |
+
|
| 738 |
+
proc ::tk::console::FontchooserToggle {} {
|
| 739 |
+
if {[tk fontchooser configure -visible]} {
|
| 740 |
+
tk fontchooser hide
|
| 741 |
+
} else {
|
| 742 |
+
tk fontchooser show
|
| 743 |
+
}
|
| 744 |
+
}
|
| 745 |
+
proc ::tk::console::FontchooserVisibility {index} {
|
| 746 |
+
if {[tk fontchooser configure -visible]} {
|
| 747 |
+
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Hide Fonts"]
|
| 748 |
+
} else {
|
| 749 |
+
.menubar.edit entryconfigure $index -label [::tk::msgcat::mc "Show Fonts"]
|
| 750 |
+
}
|
| 751 |
+
}
|
| 752 |
+
proc ::tk::console::FontchooserFocus {w isFocusIn} {
|
| 753 |
+
if {$isFocusIn} {
|
| 754 |
+
tk fontchooser configure -parent $w -font TkConsoleFont \
|
| 755 |
+
-command [namespace code [list FontchooserApply]]
|
| 756 |
+
} else {
|
| 757 |
+
tk fontchooser configure -parent $w -font {} -command {}
|
| 758 |
+
}
|
| 759 |
+
}
|
| 760 |
+
proc ::tk::console::FontchooserApply {font args} {
|
| 761 |
+
catch {font configure TkConsoleFont {*}[font actual $font]}
|
| 762 |
+
}
|
| 763 |
+
|
| 764 |
+
# ::tk::console::TagProc --
|
| 765 |
+
#
|
| 766 |
+
# Tags a procedure in the console if it's recognized
|
| 767 |
+
# This procedure is not perfect. However, making it perfect wastes
|
| 768 |
+
# too much CPU time...
|
| 769 |
+
#
|
| 770 |
+
# Arguments:
|
| 771 |
+
# w - console text widget
|
| 772 |
+
|
| 773 |
+
proc ::tk::console::TagProc w {
|
| 774 |
+
if {!$::tk::console::magicKeys} {
|
| 775 |
+
return
|
| 776 |
+
}
|
| 777 |
+
set exp "\[^\\\\\]\[\[ \t\n\r\;{}\"\$\]"
|
| 778 |
+
set i [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
|
| 779 |
+
if {$i eq ""} {
|
| 780 |
+
set i promptEnd
|
| 781 |
+
} else {
|
| 782 |
+
append i +2c
|
| 783 |
+
}
|
| 784 |
+
regsub -all "\[\[\\\\\\?\\*\]" [$w get $i "insert-1c wordend"] {\\\0} c
|
| 785 |
+
if {[llength [EvalAttached [list info commands $c]]]} {
|
| 786 |
+
$w tag add proc $i "insert-1c wordend"
|
| 787 |
+
} else {
|
| 788 |
+
$w tag remove proc $i "insert-1c wordend"
|
| 789 |
+
}
|
| 790 |
+
if {[llength [EvalAttached [list info vars $c]]]} {
|
| 791 |
+
$w tag add var $i "insert-1c wordend"
|
| 792 |
+
} else {
|
| 793 |
+
$w tag remove var $i "insert-1c wordend"
|
| 794 |
+
}
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
# ::tk::console::MatchPair --
|
| 798 |
+
#
|
| 799 |
+
# Blinks a matching pair of characters
|
| 800 |
+
# c2 is assumed to be at the text index 'insert'.
|
| 801 |
+
# This proc is really loopy and took me an hour to figure out given
|
| 802 |
+
# all possible combinations with escaping except for escaped \'s.
|
| 803 |
+
# It doesn't take into account possible commenting... Oh well. If
|
| 804 |
+
# anyone has something better, I'd like to see/use it. This is really
|
| 805 |
+
# only efficient for small contexts.
|
| 806 |
+
#
|
| 807 |
+
# Arguments:
|
| 808 |
+
# w - console text widget
|
| 809 |
+
# c1 - first char of pair
|
| 810 |
+
# c2 - second char of pair
|
| 811 |
+
#
|
| 812 |
+
# Calls: ::tk::console::Blink
|
| 813 |
+
|
| 814 |
+
proc ::tk::console::MatchPair {w c1 c2 {lim 1.0}} {
|
| 815 |
+
if {!$::tk::console::magicKeys} {
|
| 816 |
+
return
|
| 817 |
+
}
|
| 818 |
+
if {{} ne [set ix [$w search -back $c1 insert $lim]]} {
|
| 819 |
+
while {
|
| 820 |
+
[string match {\\} [$w get $ix-1c]] &&
|
| 821 |
+
[set ix [$w search -back $c1 $ix-1c $lim]] ne {}
|
| 822 |
+
} {}
|
| 823 |
+
set i1 insert-1c
|
| 824 |
+
while {$ix ne {}} {
|
| 825 |
+
set i0 $ix
|
| 826 |
+
set j 0
|
| 827 |
+
while {[set i0 [$w search $c2 $i0 $i1]] ne {}} {
|
| 828 |
+
append i0 +1c
|
| 829 |
+
if {[string match {\\} [$w get $i0-2c]]} {
|
| 830 |
+
continue
|
| 831 |
+
}
|
| 832 |
+
incr j
|
| 833 |
+
}
|
| 834 |
+
if {!$j} {
|
| 835 |
+
break
|
| 836 |
+
}
|
| 837 |
+
set i1 $ix
|
| 838 |
+
while {$j && [set ix [$w search -back $c1 $ix $lim]] ne {}} {
|
| 839 |
+
if {[string match {\\} [$w get $ix-1c]]} {
|
| 840 |
+
continue
|
| 841 |
+
}
|
| 842 |
+
incr j -1
|
| 843 |
+
}
|
| 844 |
+
}
|
| 845 |
+
if {[string match {} $ix]} {
|
| 846 |
+
set ix [$w index $lim]
|
| 847 |
+
}
|
| 848 |
+
} else {
|
| 849 |
+
set ix [$w index $lim]
|
| 850 |
+
}
|
| 851 |
+
if {$::tk::console::blinkRange} {
|
| 852 |
+
Blink $w $ix [$w index insert]
|
| 853 |
+
} else {
|
| 854 |
+
Blink $w $ix $ix+1c [$w index insert-1c] [$w index insert]
|
| 855 |
+
}
|
| 856 |
+
}
|
| 857 |
+
|
| 858 |
+
# ::tk::console::MatchQuote --
|
| 859 |
+
#
|
| 860 |
+
# Blinks between matching quotes.
|
| 861 |
+
# Blinks just the quote if it's unmatched, otherwise blinks quoted string
|
| 862 |
+
# The quote to match is assumed to be at the text index 'insert'.
|
| 863 |
+
#
|
| 864 |
+
# Arguments:
|
| 865 |
+
# w - console text widget
|
| 866 |
+
#
|
| 867 |
+
# Calls: ::tk::console::Blink
|
| 868 |
+
|
| 869 |
+
proc ::tk::console::MatchQuote {w {lim 1.0}} {
|
| 870 |
+
if {!$::tk::console::magicKeys} {
|
| 871 |
+
return
|
| 872 |
+
}
|
| 873 |
+
set i insert-1c
|
| 874 |
+
set j 0
|
| 875 |
+
while {[set i [$w search -back \" $i $lim]] ne {}} {
|
| 876 |
+
if {[string match {\\} [$w get $i-1c]]} {
|
| 877 |
+
continue
|
| 878 |
+
}
|
| 879 |
+
if {!$j} {
|
| 880 |
+
set i0 $i
|
| 881 |
+
}
|
| 882 |
+
incr j
|
| 883 |
+
}
|
| 884 |
+
if {$j&1} {
|
| 885 |
+
if {$::tk::console::blinkRange} {
|
| 886 |
+
Blink $w $i0 [$w index insert]
|
| 887 |
+
} else {
|
| 888 |
+
Blink $w $i0 $i0+1c [$w index insert-1c] [$w index insert]
|
| 889 |
+
}
|
| 890 |
+
} else {
|
| 891 |
+
Blink $w [$w index insert-1c] [$w index insert]
|
| 892 |
+
}
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
# ::tk::console::Blink --
|
| 896 |
+
#
|
| 897 |
+
# Blinks between n index pairs for a specified duration.
|
| 898 |
+
#
|
| 899 |
+
# Arguments:
|
| 900 |
+
# w - console text widget
|
| 901 |
+
# i1 - start index to blink region
|
| 902 |
+
# i2 - end index of blink region
|
| 903 |
+
# dur - duration in usecs to blink for
|
| 904 |
+
#
|
| 905 |
+
# Outputs:
|
| 906 |
+
# blinks selected characters in $w
|
| 907 |
+
|
| 908 |
+
proc ::tk::console::Blink {w args} {
|
| 909 |
+
eval [list $w tag add blink] $args
|
| 910 |
+
after $::tk::console::blinkTime [list $w] tag remove blink $args
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
# ::tk::console::ConstrainBuffer --
|
| 914 |
+
#
|
| 915 |
+
# This limits the amount of data in the text widget
|
| 916 |
+
# Called by Prompt and ConsoleOutput
|
| 917 |
+
#
|
| 918 |
+
# Arguments:
|
| 919 |
+
# w - console text widget
|
| 920 |
+
# size - # of lines to constrain to
|
| 921 |
+
#
|
| 922 |
+
# Outputs:
|
| 923 |
+
# may delete data in console widget
|
| 924 |
+
|
| 925 |
+
proc ::tk::console::ConstrainBuffer {w size} {
|
| 926 |
+
if {[$w index end] > $size} {
|
| 927 |
+
$w delete 1.0 [expr {int([$w index end])-$size}].0
|
| 928 |
+
}
|
| 929 |
+
}
|
| 930 |
+
|
| 931 |
+
# ::tk::console::Expand --
|
| 932 |
+
#
|
| 933 |
+
# Arguments:
|
| 934 |
+
# ARGS: w - text widget in which to expand str
|
| 935 |
+
# type - type of expansion (path / proc / variable)
|
| 936 |
+
#
|
| 937 |
+
# Calls: ::tk::console::Expand(Pathname|Procname|Variable)
|
| 938 |
+
#
|
| 939 |
+
# Outputs: The string to match is expanded to the longest possible match.
|
| 940 |
+
# If ::tk::console::showMatches is non-zero and the longest match
|
| 941 |
+
# equaled the string to expand, then all possible matches are
|
| 942 |
+
# output to stdout. Triggers bell if no matches are found.
|
| 943 |
+
#
|
| 944 |
+
# Returns: number of matches found
|
| 945 |
+
|
| 946 |
+
proc ::tk::console::Expand {w {type ""}} {
|
| 947 |
+
set exp "\[^\\\\\]\[\[ \t\n\r\\\{\"\\\\\$\]"
|
| 948 |
+
set tmp [$w search -backwards -regexp $exp insert-1c promptEnd-1c]
|
| 949 |
+
if {$tmp eq ""} {
|
| 950 |
+
set tmp promptEnd
|
| 951 |
+
} else {
|
| 952 |
+
append tmp +2c
|
| 953 |
+
}
|
| 954 |
+
if {[$w compare $tmp >= insert]} {
|
| 955 |
+
return
|
| 956 |
+
}
|
| 957 |
+
set str [$w get $tmp insert]
|
| 958 |
+
switch -glob $type {
|
| 959 |
+
path* {
|
| 960 |
+
set res [ExpandPathname $str]
|
| 961 |
+
}
|
| 962 |
+
proc* {
|
| 963 |
+
set res [ExpandProcname $str]
|
| 964 |
+
}
|
| 965 |
+
var* {
|
| 966 |
+
set res [ExpandVariable $str]
|
| 967 |
+
}
|
| 968 |
+
default {
|
| 969 |
+
set res {}
|
| 970 |
+
foreach t {Pathname Procname Variable} {
|
| 971 |
+
if {![catch {Expand$t $str} res] && ($res ne "")} {
|
| 972 |
+
break
|
| 973 |
+
}
|
| 974 |
+
}
|
| 975 |
+
}
|
| 976 |
+
}
|
| 977 |
+
set len [llength $res]
|
| 978 |
+
if {$len} {
|
| 979 |
+
set repl [lindex $res 0]
|
| 980 |
+
$w delete $tmp insert
|
| 981 |
+
$w insert $tmp $repl {input stdin}
|
| 982 |
+
if {($len > 1) && ($::tk::console::showMatches) && ($repl eq $str)} {
|
| 983 |
+
puts stdout [lsort [lreplace $res 0 0]]
|
| 984 |
+
}
|
| 985 |
+
} else {
|
| 986 |
+
bell
|
| 987 |
+
}
|
| 988 |
+
return [incr len -1]
|
| 989 |
+
}
|
| 990 |
+
|
| 991 |
+
# ::tk::console::ExpandPathname --
|
| 992 |
+
#
|
| 993 |
+
# Expand a file pathname based on $str
|
| 994 |
+
# This is based on UNIX file name conventions
|
| 995 |
+
#
|
| 996 |
+
# Arguments:
|
| 997 |
+
# str - partial file pathname to expand
|
| 998 |
+
#
|
| 999 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1000 |
+
#
|
| 1001 |
+
# Returns: list containing longest unique match followed by all the
|
| 1002 |
+
# possible further matches
|
| 1003 |
+
|
| 1004 |
+
proc ::tk::console::ExpandPathname str {
|
| 1005 |
+
set pwd [EvalAttached pwd]
|
| 1006 |
+
if {[catch {EvalAttached [list cd [file dirname $str]]} err opt]} {
|
| 1007 |
+
return -options $opt $err
|
| 1008 |
+
}
|
| 1009 |
+
set dir [file tail $str]
|
| 1010 |
+
## Check to see if it was known to be a directory and keep the trailing
|
| 1011 |
+
## slash if so (file tail cuts it off)
|
| 1012 |
+
if {[string match */ $str]} {
|
| 1013 |
+
append dir /
|
| 1014 |
+
}
|
| 1015 |
+
if {[catch {lsort [EvalAttached [list glob $dir*]]} m]} {
|
| 1016 |
+
set match {}
|
| 1017 |
+
} else {
|
| 1018 |
+
if {[llength $m] > 1} {
|
| 1019 |
+
if { $::tcl_platform(platform) eq "windows" } {
|
| 1020 |
+
## Windows is screwy because it's case insensitive
|
| 1021 |
+
set tmp [ExpandBestMatch [string tolower $m] \
|
| 1022 |
+
[string tolower $dir]]
|
| 1023 |
+
## Don't change case if we haven't changed the word
|
| 1024 |
+
if {[string length $dir]==[string length $tmp]} {
|
| 1025 |
+
set tmp $dir
|
| 1026 |
+
}
|
| 1027 |
+
} else {
|
| 1028 |
+
set tmp [ExpandBestMatch $m $dir]
|
| 1029 |
+
}
|
| 1030 |
+
if {[string match ?*/* $str]} {
|
| 1031 |
+
set tmp [file dirname $str]/$tmp
|
| 1032 |
+
} elseif {[string match /* $str]} {
|
| 1033 |
+
set tmp /$tmp
|
| 1034 |
+
}
|
| 1035 |
+
regsub -all { } $tmp {\\ } tmp
|
| 1036 |
+
set match [linsert $m 0 $tmp]
|
| 1037 |
+
} else {
|
| 1038 |
+
## This may look goofy, but it handles spaces in path names
|
| 1039 |
+
eval append match $m
|
| 1040 |
+
if {[file isdir $match]} {
|
| 1041 |
+
append match /
|
| 1042 |
+
}
|
| 1043 |
+
if {[string match ?*/* $str]} {
|
| 1044 |
+
set match [file dirname $str]/$match
|
| 1045 |
+
} elseif {[string match /* $str]} {
|
| 1046 |
+
set match /$match
|
| 1047 |
+
}
|
| 1048 |
+
regsub -all { } $match {\\ } match
|
| 1049 |
+
## Why is this one needed and the ones below aren't!!
|
| 1050 |
+
set match [list $match]
|
| 1051 |
+
}
|
| 1052 |
+
}
|
| 1053 |
+
EvalAttached [list cd $pwd]
|
| 1054 |
+
return $match
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
# ::tk::console::ExpandProcname --
|
| 1058 |
+
#
|
| 1059 |
+
# Expand a tcl proc name based on $str
|
| 1060 |
+
#
|
| 1061 |
+
# Arguments:
|
| 1062 |
+
# str - partial proc name to expand
|
| 1063 |
+
#
|
| 1064 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1065 |
+
#
|
| 1066 |
+
# Returns: list containing longest unique match followed by all the
|
| 1067 |
+
# possible further matches
|
| 1068 |
+
|
| 1069 |
+
proc ::tk::console::ExpandProcname str {
|
| 1070 |
+
set match [EvalAttached [list info commands $str*]]
|
| 1071 |
+
if {[llength $match] == 0} {
|
| 1072 |
+
set ns [EvalAttached \
|
| 1073 |
+
"namespace children \[namespace current\] [list $str*]"]
|
| 1074 |
+
if {[llength $ns]==1} {
|
| 1075 |
+
set match [EvalAttached [list info commands ${ns}::*]]
|
| 1076 |
+
} else {
|
| 1077 |
+
set match $ns
|
| 1078 |
+
}
|
| 1079 |
+
}
|
| 1080 |
+
if {[llength $match] > 1} {
|
| 1081 |
+
regsub -all { } [ExpandBestMatch $match $str] {\\ } str
|
| 1082 |
+
set match [linsert $match 0 $str]
|
| 1083 |
+
} else {
|
| 1084 |
+
regsub -all { } $match {\\ } match
|
| 1085 |
+
}
|
| 1086 |
+
return $match
|
| 1087 |
+
}
|
| 1088 |
+
|
| 1089 |
+
# ::tk::console::ExpandVariable --
|
| 1090 |
+
#
|
| 1091 |
+
# Expand a tcl variable name based on $str
|
| 1092 |
+
#
|
| 1093 |
+
# Arguments:
|
| 1094 |
+
# str - partial tcl var name to expand
|
| 1095 |
+
#
|
| 1096 |
+
# Calls: ::tk::console::ExpandBestMatch
|
| 1097 |
+
#
|
| 1098 |
+
# Returns: list containing longest unique match followed by all the
|
| 1099 |
+
# possible further matches
|
| 1100 |
+
|
| 1101 |
+
proc ::tk::console::ExpandVariable str {
|
| 1102 |
+
if {[regexp {([^\(]*)\((.*)} $str -> ary str]} {
|
| 1103 |
+
## Looks like they're trying to expand an array.
|
| 1104 |
+
set match [EvalAttached [list array names $ary $str*]]
|
| 1105 |
+
if {[llength $match] > 1} {
|
| 1106 |
+
set vars $ary\([ExpandBestMatch $match $str]
|
| 1107 |
+
foreach var $match {
|
| 1108 |
+
lappend vars $ary\($var\)
|
| 1109 |
+
}
|
| 1110 |
+
return $vars
|
| 1111 |
+
} elseif {[llength $match] == 1} {
|
| 1112 |
+
set match $ary\($match\)
|
| 1113 |
+
}
|
| 1114 |
+
## Space transformation avoided for array names.
|
| 1115 |
+
} else {
|
| 1116 |
+
set match [EvalAttached [list info vars $str*]]
|
| 1117 |
+
if {[llength $match] > 1} {
|
| 1118 |
+
regsub -all { } [ExpandBestMatch $match $str] {\\ } str
|
| 1119 |
+
set match [linsert $match 0 $str]
|
| 1120 |
+
} else {
|
| 1121 |
+
regsub -all { } $match {\\ } match
|
| 1122 |
+
}
|
| 1123 |
+
}
|
| 1124 |
+
return $match
|
| 1125 |
+
}
|
| 1126 |
+
|
| 1127 |
+
# ::tk::console::ExpandBestMatch --
|
| 1128 |
+
#
|
| 1129 |
+
# Finds the best unique match in a list of names.
|
| 1130 |
+
# The extra $e in this argument allows us to limit the innermost loop a little
|
| 1131 |
+
# further. This improves speed as $l becomes large or $e becomes long.
|
| 1132 |
+
#
|
| 1133 |
+
# Arguments:
|
| 1134 |
+
# l - list to find best unique match in
|
| 1135 |
+
# e - currently best known unique match
|
| 1136 |
+
#
|
| 1137 |
+
# Returns: longest unique match in the list
|
| 1138 |
+
|
| 1139 |
+
proc ::tk::console::ExpandBestMatch {l {e {}}} {
|
| 1140 |
+
set ec [lindex $l 0]
|
| 1141 |
+
if {[llength $l]>1} {
|
| 1142 |
+
set e [expr {[string length $e] - 1}]
|
| 1143 |
+
set ei [expr {[string length $ec] - 1}]
|
| 1144 |
+
foreach l $l {
|
| 1145 |
+
while {$ei>=$e && [string first $ec $l]} {
|
| 1146 |
+
set ec [string range $ec 0 [incr ei -1]]
|
| 1147 |
+
}
|
| 1148 |
+
}
|
| 1149 |
+
}
|
| 1150 |
+
return $ec
|
| 1151 |
+
}
|
| 1152 |
+
|
| 1153 |
+
# now initialize the console
|
| 1154 |
+
::tk::ConsoleInit
|
evalkit_llava/lib/tk8.6/demos/README
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This directory contains a collection of programs to demonstrate
|
| 2 |
+
the features of the Tk toolkit. The programs are all scripts for
|
| 3 |
+
"wish", a windowing shell. If wish has been installed on your path
|
| 4 |
+
then you can invoke any of the programs in this directory just
|
| 5 |
+
by typing its file name to your command shell under Unix. Otherwise
|
| 6 |
+
invoke wish with the file as its first argument, e.g., "wish hello".
|
| 7 |
+
The rest of this file contains a brief description of each program.
|
| 8 |
+
Files with names ending in ".tcl" are procedure packages used by one
|
| 9 |
+
or more of the demo programs; they can't be used as programs by
|
| 10 |
+
themselves so they aren't described below.
|
| 11 |
+
|
| 12 |
+
hello - Creates a single button; if you click on it, a message
|
| 13 |
+
is typed and the application terminates.
|
| 14 |
+
|
| 15 |
+
widget - Contains a collection of demonstrations of the widgets
|
| 16 |
+
currently available in the Tk library. Most of the .tcl
|
| 17 |
+
files are scripts for individual demos available through
|
| 18 |
+
the "widget" program.
|
| 19 |
+
|
| 20 |
+
ixset - A simple Tk-based wrapper for the "xset" program, which
|
| 21 |
+
allows you to interactively query and set various X options
|
| 22 |
+
such as mouse acceleration and bell volume. Thanks to
|
| 23 |
+
Pierre David for contributing this example.
|
| 24 |
+
|
| 25 |
+
rolodex - A mock-up of a simple rolodex application. It has much of
|
| 26 |
+
the user interface for such an application but no back-end
|
| 27 |
+
database. This program was written in response to Tom
|
| 28 |
+
LaStrange's toolkit benchmark challenge.
|
| 29 |
+
|
| 30 |
+
tcolor - A color editor. Allows you to edit colors in several
|
| 31 |
+
different ways, and will also perform automatic updates
|
| 32 |
+
using "send".
|
| 33 |
+
|
| 34 |
+
rmt - Allows you to "hook-up" remotely to any Tk application
|
| 35 |
+
on the display. Select an application with the menu,
|
| 36 |
+
then just type commands: they'll go to that application.
|
| 37 |
+
|
| 38 |
+
timer - Displays a seconds timer with start and stop buttons.
|
| 39 |
+
Control-c and control-q cause it to exit.
|
| 40 |
+
|
| 41 |
+
browse - A simple directory browser. Invoke it with and argument
|
| 42 |
+
giving the name of the directory you'd like to browse.
|
| 43 |
+
Double-click on files or subdirectories to browse them.
|
| 44 |
+
Control-c and control-q cause the program to exit.
|
evalkit_llava/lib/tk8.6/demos/anilabel.tcl
ADDED
|
@@ -0,0 +1,160 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evel window containing
|
| 4 |
+
# several animated label widgets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .anilabel
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Animated Label Demonstration"
|
| 16 |
+
wm iconname $w "anilabel"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "Four animated labels are displayed below; each of the labels on the left is animated by making the text message inside it appear to scroll, and the label on the right is animated by animating the image that it displays."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
# Ensure that this this is an array
|
| 27 |
+
array set animationCallbacks {}
|
| 28 |
+
|
| 29 |
+
## This callback is the core of how to do animation in Tcl/Tk; all
|
| 30 |
+
## animations work in basically the same way, with a procedure that
|
| 31 |
+
## uses the [after] command to reschedule itself at some point in the
|
| 32 |
+
## future. Of course, the details of how to update the state will vary
|
| 33 |
+
## according to what is being animated.
|
| 34 |
+
proc RotateLabelText {w interval} {
|
| 35 |
+
global animationCallbacks
|
| 36 |
+
|
| 37 |
+
# Schedule the calling of this procedure again in the future
|
| 38 |
+
set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
|
| 39 |
+
|
| 40 |
+
# We do marquee-like scrolling text by chopping characters off the
|
| 41 |
+
# front of the text and sticking them on the end.
|
| 42 |
+
set text [$w cget -text]
|
| 43 |
+
set newText [string range $text 1 end][string index $text 0]
|
| 44 |
+
$w configure -text $newText
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
## A helper procedure to start the animation happening.
|
| 48 |
+
proc animateLabelText {w text interval} {
|
| 49 |
+
global animationCallbacks
|
| 50 |
+
|
| 51 |
+
# Install the text into the widget
|
| 52 |
+
$w configure -text $text
|
| 53 |
+
|
| 54 |
+
# Schedule the start of the animation loop
|
| 55 |
+
set animationCallbacks($w) [after $interval RotateLabelText $w $interval]
|
| 56 |
+
|
| 57 |
+
# Make sure that the animation stops and is cleaned up after itself
|
| 58 |
+
# when the animated label is destroyed. Note that at this point we
|
| 59 |
+
# cannot manipulate the widget itself, as that has already died.
|
| 60 |
+
bind $w <Destroy> {
|
| 61 |
+
after cancel $animationCallbacks(%W)
|
| 62 |
+
unset animationCallbacks(%W)
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
## Next, a similar pair of procedures to animate a GIF loaded into a
|
| 67 |
+
## photo image.
|
| 68 |
+
proc SelectNextImageFrame {w interval} {
|
| 69 |
+
global animationCallbacks
|
| 70 |
+
set animationCallbacks($w) \
|
| 71 |
+
[after $interval SelectNextImageFrame $w $interval]
|
| 72 |
+
set image [$w cget -image]
|
| 73 |
+
|
| 74 |
+
# The easy way to animate a GIF!
|
| 75 |
+
set idx -1
|
| 76 |
+
scan [$image cget -format] "GIF -index %d" idx
|
| 77 |
+
if {[catch {
|
| 78 |
+
# Note that we get an error if the index is out of range
|
| 79 |
+
$image configure -format "GIF -index [incr idx]"
|
| 80 |
+
}]} then {
|
| 81 |
+
$image configure -format "GIF -index 0"
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
proc animateLabelImage {w imageData interval} {
|
| 85 |
+
global animationCallbacks
|
| 86 |
+
|
| 87 |
+
# Create a multi-frame GIF from base-64-encoded data
|
| 88 |
+
set image [image create photo -format GIF -data $imageData]
|
| 89 |
+
|
| 90 |
+
# Install the image into the widget
|
| 91 |
+
$w configure -image $image
|
| 92 |
+
|
| 93 |
+
# Schedule the start of the animation loop
|
| 94 |
+
set animationCallbacks($w) \
|
| 95 |
+
[after $interval SelectNextImageFrame $w $interval]
|
| 96 |
+
|
| 97 |
+
# Make sure that the animation stops and is cleaned up after itself
|
| 98 |
+
# when the animated label is destroyed. Note that at this point we
|
| 99 |
+
# cannot manipulate the widget itself, as that has already died.
|
| 100 |
+
# Also note that this script is in double-quotes; this is always OK
|
| 101 |
+
# because image names are chosen automatically to be simple words.
|
| 102 |
+
bind $w <Destroy> "
|
| 103 |
+
after cancel \$animationCallbacks(%W)
|
| 104 |
+
unset animationCallbacks(%W)
|
| 105 |
+
rename $image {}
|
| 106 |
+
"
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
# Make some widgets to contain the animations
|
| 110 |
+
labelframe $w.left -text "Scrolling Texts"
|
| 111 |
+
labelframe $w.right -text "GIF Image"
|
| 112 |
+
pack $w.left $w.right -side left -padx 10 -pady 10 -expand yes
|
| 113 |
+
|
| 114 |
+
# This method of scrolling text looks far better with a fixed-width font
|
| 115 |
+
label $w.left.l1 -bd 4 -relief ridge -font fixedFont
|
| 116 |
+
label $w.left.l2 -bd 4 -relief groove -font fixedFont
|
| 117 |
+
label $w.left.l3 -bd 4 -relief flat -font fixedFont -width 18
|
| 118 |
+
pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -padx 10 -pady 10 -anchor w
|
| 119 |
+
# Don't need to do very much with this label except turn off the border
|
| 120 |
+
label $w.right.l -bd 0
|
| 121 |
+
pack $w.right.l -side top -expand yes -padx 10 -pady 10
|
| 122 |
+
|
| 123 |
+
# This is a base-64-encoded animated GIF file.
|
| 124 |
+
set tclPoweredData {
|
| 125 |
+
R0lGODlhKgBAAPQAAP//////zP//AP/MzP/Mmf/MAP+Zmf+ZZv+ZAMz//8zM
|
| 126 |
+
zMyZmcyZZsxmZsxmAMwzAJnMzJmZzJmZmZlmmZlmZplmM5kzM2aZzGZmzGZm
|
| 127 |
+
mWZmZmYzZmYzMzNmzDMzZgAzmSH+IE1hZGUgd2l0aCBHSU1QIGJ5IExARGVt
|
| 128 |
+
YWlsbHkuY29tACH5BAVkAAEALAAAAAAqAEAAAAX+YCCOZ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BAUeAAAALAUA
|
| 144 |
+
LgAFAAUAAAUM4CeKz/OV5YmqaRkCACH5BAUeAAEALAUALgAKAAUAAAUUICCK
|
| 145 |
+
z/OdJVCaa7p+7aOWcDvTZwgAIfkEBR4AAQAsCwAuAAkABQAABRPgA4zP95zA
|
| 146 |
+
eZqoWqqpyqLkZ38hACH5BAUKAAEALAcALgANAA4AAAU7ICA+jwiUJEqeKau+
|
| 147 |
+
r+vGaTmac63v/GP9HM7GQyx+jsgkkoRUHJ3Qx0cK/VQVTKtWwbVKn9suNunc
|
| 148 |
+
WkMAIfkEBQoAAAAsBwA3AAcABQAABRGgIHzk842j+Yjlt5KuO8JmCAAh+QQF
|
| 149 |
+
CgAAACwLADcABwAFAAAFEeAnfN9TjqP5oOWziq05lmUIACH5BAUKAAAALA8A
|
| 150 |
+
NwAHAAUAAAUPoPCJTymS3yiQj4qOcPmEACH5BAUKAAAALBMANwAHAAUAAAUR
|
| 151 |
+
oCB+z/MJX2o+I2miKimiawgAIfkEBQoAAAAsFwA3AAcABQAABRGgIHzfY47j
|
| 152 |
+
Q4qk+aHl+pZmCAAh+QQFCgAAACwbADcABwAFAAAFEaAgfs/zCV9qPiNJouo7
|
| 153 |
+
ll8IACH5BAUKAAAALB8ANwADAAUAAAUIoCB8o0iWZggAOw==
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
# Finally, set up the text scrolling animation
|
| 157 |
+
animateLabelText $w.left.l1 "* Slow Animation *" 300
|
| 158 |
+
animateLabelText $w.left.l2 "* Fast Animation *" 80
|
| 159 |
+
animateLabelText $w.left.l3 "This is a longer scrolling text in a widget that will not show the whole message at once. " 150
|
| 160 |
+
animateLabelImage $w.right.l $tclPoweredData 100
|
evalkit_llava/lib/tk8.6/demos/bind.tcl
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# bind.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a text widget with bindings set
|
| 4 |
+
# up for hypertext-like effects.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .bind
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Text Demonstration - Tag Bindings"
|
| 16 |
+
wm iconname $w "bind"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
## See Code / Dismiss buttons
|
| 20 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 21 |
+
pack $btns -side bottom -fill x
|
| 22 |
+
|
| 23 |
+
text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
|
| 24 |
+
-width 60 -height 24 -font $font -wrap word
|
| 25 |
+
ttk::scrollbar $w.scroll -command "$w.text yview"
|
| 26 |
+
pack $w.scroll -side right -fill y
|
| 27 |
+
pack $w.text -expand yes -fill both
|
| 28 |
+
|
| 29 |
+
# Set up display styles.
|
| 30 |
+
|
| 31 |
+
if {[winfo depth $w] > 1} {
|
| 32 |
+
set bold "-background #43ce80 -relief raised -borderwidth 1"
|
| 33 |
+
set normal "-background {} -relief flat"
|
| 34 |
+
} else {
|
| 35 |
+
set bold "-foreground white -background black"
|
| 36 |
+
set normal "-foreground {} -background {}"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Add text to widget.
|
| 40 |
+
|
| 41 |
+
$w.text insert 0.0 {\
|
| 42 |
+
The same tag mechanism that controls display styles in text widgets can also be used to associate Tcl commands with regions of text, so that mouse or keyboard actions on the text cause particular Tcl commands to be invoked. For example, in the text below the descriptions of the canvas demonstrations have been tagged. When you move the mouse over a demo description the description lights up, and when you press button 1 over a description then that particular demonstration is invoked.
|
| 43 |
+
|
| 44 |
+
}
|
| 45 |
+
$w.text insert end \
|
| 46 |
+
{1. Samples of all the different types of items that can be created in canvas widgets.} d1
|
| 47 |
+
$w.text insert end \n\n
|
| 48 |
+
$w.text insert end \
|
| 49 |
+
{2. A simple two-dimensional plot that allows you to adjust the positions of the data points.} d2
|
| 50 |
+
$w.text insert end \n\n
|
| 51 |
+
$w.text insert end \
|
| 52 |
+
{3. Anchoring and justification modes for text items.} d3
|
| 53 |
+
$w.text insert end \n\n
|
| 54 |
+
$w.text insert end \
|
| 55 |
+
{4. An editor for arrow-head shapes for line items.} d4
|
| 56 |
+
$w.text insert end \n\n
|
| 57 |
+
$w.text insert end \
|
| 58 |
+
{5. A ruler with facilities for editing tab stops.} d5
|
| 59 |
+
$w.text insert end \n\n
|
| 60 |
+
$w.text insert end \
|
| 61 |
+
{6. A grid that demonstrates how canvases can be scrolled.} d6
|
| 62 |
+
|
| 63 |
+
# Create bindings for tags.
|
| 64 |
+
|
| 65 |
+
foreach tag {d1 d2 d3 d4 d5 d6} {
|
| 66 |
+
$w.text tag bind $tag <Enter> "$w.text tag configure $tag $bold"
|
| 67 |
+
$w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
|
| 68 |
+
}
|
| 69 |
+
# Main widget program sets variable tk_demoDirectory
|
| 70 |
+
$w.text tag bind d1 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
|
| 71 |
+
$w.text tag bind d2 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
|
| 72 |
+
$w.text tag bind d3 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
|
| 73 |
+
$w.text tag bind d4 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
|
| 74 |
+
$w.text tag bind d5 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
|
| 75 |
+
$w.text tag bind d6 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
|
| 76 |
+
|
| 77 |
+
$w.text mark set insert 0.0
|
| 78 |
+
$w.text configure -state disabled
|
evalkit_llava/lib/tk8.6/demos/browse
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# the next line restarts using wish \
|
| 3 |
+
exec wish8.6 "$0" ${1+"$@"}
|
| 4 |
+
|
| 5 |
+
# browse --
|
| 6 |
+
# This script generates a directory browser, which lists the working
|
| 7 |
+
# directory and allows you to open files or subdirectories by
|
| 8 |
+
# double-clicking.
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
# Create a scrollbar on the right side of the main window and a listbox
|
| 13 |
+
# on the left side.
|
| 14 |
+
|
| 15 |
+
scrollbar .scroll -command ".list yview"
|
| 16 |
+
pack .scroll -side right -fill y
|
| 17 |
+
listbox .list -yscroll ".scroll set" -relief sunken -width 20 -height 20 \
|
| 18 |
+
-setgrid yes
|
| 19 |
+
pack .list -side left -fill both -expand yes
|
| 20 |
+
wm minsize . 1 1
|
| 21 |
+
|
| 22 |
+
# The procedure below is invoked to open a browser on a given file; if the
|
| 23 |
+
# file is a directory then another instance of this program is invoked; if
|
| 24 |
+
# the file is a regular file then the Mx editor is invoked to display
|
| 25 |
+
# the file.
|
| 26 |
+
|
| 27 |
+
set browseScript [file join [pwd] $argv0]
|
| 28 |
+
proc browse {dir file} {
|
| 29 |
+
global env browseScript
|
| 30 |
+
if {[string compare $dir "."] != 0} {set file $dir/$file}
|
| 31 |
+
switch [file type $file] {
|
| 32 |
+
directory {
|
| 33 |
+
exec [info nameofexecutable] $browseScript $file &
|
| 34 |
+
}
|
| 35 |
+
file {
|
| 36 |
+
if {[info exists env(EDITOR)]} {
|
| 37 |
+
eval exec $env(EDITOR) $file &
|
| 38 |
+
} else {
|
| 39 |
+
exec xedit $file &
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
default {
|
| 43 |
+
puts stdout "\"$file\" isn't a directory or regular file"
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
# Fill the listbox with a list of all the files in the directory.
|
| 49 |
+
|
| 50 |
+
if {$argc>0} {set dir [lindex $argv 0]} else {set dir "."}
|
| 51 |
+
foreach i [lsort [glob * .* *.*]] {
|
| 52 |
+
if {[file type $i] eq "directory"} {
|
| 53 |
+
# Safe to do since it is still a directory.
|
| 54 |
+
append i /
|
| 55 |
+
}
|
| 56 |
+
.list insert end $i
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
# Set up bindings for the browser.
|
| 60 |
+
|
| 61 |
+
bind all <Control-c> {destroy .}
|
| 62 |
+
bind .list <Double-Button-1> {foreach i [selection get] {browse $dir $i}}
|
| 63 |
+
|
| 64 |
+
# Local Variables:
|
| 65 |
+
# mode: tcl
|
| 66 |
+
# End:
|
evalkit_llava/lib/tk8.6/demos/button.tcl
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# button.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# several button widgets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .button
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Button Demonstration"
|
| 16 |
+
wm iconname $w "button"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "If you click on any of the four buttons below, the background of the button area will change to the color indicated in the button. You can press Tab to move among the buttons, then press Space to invoke the current button."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
pack [addSeeDismiss $w.buttons $w] -side bottom -fill x
|
| 24 |
+
|
| 25 |
+
proc colorrefresh {w col} {
|
| 26 |
+
$w configure -bg $col
|
| 27 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 28 |
+
# set highlightbackground of all buttons in $w
|
| 29 |
+
set l [list $w]
|
| 30 |
+
while {[llength $l]} {
|
| 31 |
+
set l [concat [lassign $l b] [winfo children $b]]
|
| 32 |
+
if {[winfo class $b] eq "Button"} {
|
| 33 |
+
$b configure -highlightbackground $col
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
button $w.b1 -text "Peach Puff" -width 10 \
|
| 40 |
+
-command [list colorrefresh $w PeachPuff1]
|
| 41 |
+
button $w.b2 -text "Light Blue" -width 10 \
|
| 42 |
+
-command [list colorrefresh $w LightBlue1]
|
| 43 |
+
button $w.b3 -text "Sea Green" -width 10 \
|
| 44 |
+
-command [list colorrefresh $w SeaGreen2]
|
| 45 |
+
button $w.b4 -text "Yellow" -width 10 \
|
| 46 |
+
-command [list colorrefresh $w Yellow1]
|
| 47 |
+
pack $w.b1 $w.b2 $w.b3 $w.b4 -side top -expand yes -pady 2
|
evalkit_llava/lib/tk8.6/demos/check.tcl
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# check.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# several checkbuttons.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .check
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Checkbutton Demonstration"
|
| 16 |
+
wm iconname $w "check"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "Four checkbuttons are displayed below. If you click on a button, it will toggle the button's selection state and set a Tcl variable to a value indicating the state of the checkbutton. The first button also follows the state of the other three. If only some of the three are checked, the first button will display the tri-state mode. Click the \"See Variables\" button to see the current values of the variables."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w [list safety wipers brakes sober]]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
checkbutton $w.b0 -text "Safety Check" -variable safety -relief flat \
|
| 27 |
+
-onvalue "all" \
|
| 28 |
+
-offvalue "none" \
|
| 29 |
+
-tristatevalue "partial"
|
| 30 |
+
checkbutton $w.b1 -text "Wipers OK" -variable wipers -relief flat
|
| 31 |
+
checkbutton $w.b2 -text "Brakes OK" -variable brakes -relief flat
|
| 32 |
+
checkbutton $w.b3 -text "Driver Sober" -variable sober -relief flat
|
| 33 |
+
pack $w.b0 -side top -pady 2 -anchor w
|
| 34 |
+
pack $w.b1 $w.b2 $w.b3 -side top -pady 2 -anchor w -padx 15
|
| 35 |
+
|
| 36 |
+
## This code makes $w.b0 function as a tri-state button; it's not
|
| 37 |
+
## needed at all for just straight yes/no buttons.
|
| 38 |
+
|
| 39 |
+
set in_check 0
|
| 40 |
+
proc tristate_check {n1 n2 op} {
|
| 41 |
+
global safety wipers brakes sober in_check
|
| 42 |
+
if {$in_check} {
|
| 43 |
+
return
|
| 44 |
+
}
|
| 45 |
+
set in_check 1
|
| 46 |
+
if {$n1 eq "safety"} {
|
| 47 |
+
if {$safety eq "none"} {
|
| 48 |
+
set wipers 0
|
| 49 |
+
set brakes 0
|
| 50 |
+
set sober 0
|
| 51 |
+
} elseif {$safety eq "all"} {
|
| 52 |
+
set wipers 1
|
| 53 |
+
set brakes 1
|
| 54 |
+
set sober 1
|
| 55 |
+
}
|
| 56 |
+
} else {
|
| 57 |
+
if {$wipers == 1 && $brakes == 1 && $sober == 1} {
|
| 58 |
+
set safety all
|
| 59 |
+
} elseif {$wipers == 1 || $brakes == 1 || $sober == 1} {
|
| 60 |
+
set safety partial
|
| 61 |
+
} else {
|
| 62 |
+
set safety none
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
set in_check 0
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
trace add variable wipers write tristate_check
|
| 69 |
+
trace add variable brakes write tristate_check
|
| 70 |
+
trace add variable sober write tristate_check
|
| 71 |
+
trace add variable safety write tristate_check
|
evalkit_llava/lib/tk8.6/demos/clrpick.tcl
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# clrpick.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script prompts the user to select a color.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .clrpick
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Color Selection Dialog"
|
| 15 |
+
wm iconname $w "colors"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "Press the buttons below to choose the foreground and background colors for the widgets in this window."
|
| 19 |
+
pack $w.msg -side top
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss buttons
|
| 22 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 23 |
+
pack $btns -side bottom -fill x
|
| 24 |
+
|
| 25 |
+
button $w.back -text "Set background color ..." \
|
| 26 |
+
-command \
|
| 27 |
+
"setColor $w $w.back background {-background -highlightbackground}"
|
| 28 |
+
button $w.fore -text "Set foreground color ..." \
|
| 29 |
+
-command \
|
| 30 |
+
"setColor $w $w.back foreground -foreground"
|
| 31 |
+
|
| 32 |
+
pack $w.back $w.fore -side top -anchor c -pady 2m
|
| 33 |
+
|
| 34 |
+
proc setColor {w button name options} {
|
| 35 |
+
grab $w
|
| 36 |
+
set initialColor [$button cget -$name]
|
| 37 |
+
set color [tk_chooseColor -title "Choose a $name color" -parent $w \
|
| 38 |
+
-initialcolor $initialColor]
|
| 39 |
+
if {[string compare $color ""]} {
|
| 40 |
+
setColor_helper $w $options $color
|
| 41 |
+
}
|
| 42 |
+
grab release $w
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
proc setColor_helper {w options color} {
|
| 46 |
+
foreach option $options {
|
| 47 |
+
catch {
|
| 48 |
+
$w config $option $color
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
foreach child [winfo children $w] {
|
| 52 |
+
setColor_helper $child $options $color
|
| 53 |
+
}
|
| 54 |
+
}
|
evalkit_llava/lib/tk8.6/demos/dialog2.tcl
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dialog2.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a dialog box with a global grab.
|
| 4 |
+
|
| 5 |
+
after idle {
|
| 6 |
+
.dialog2.msg configure -wraplength 4i
|
| 7 |
+
}
|
| 8 |
+
after 100 {
|
| 9 |
+
grab -global .dialog2
|
| 10 |
+
}
|
| 11 |
+
set i [tk_dialog .dialog2 "Dialog with global grab" {This dialog box uses a global grab. If you are using an X11 window manager you will be prevented from interacting with anything on your display until you invoke one of the buttons below. This is almost always a bad idea; don't use global grabs with X11 unless you're truly desperate. On macOS systems you will not be able to interact with any window belonging to this process, but interaction with other macOS Applications will still be possible.}\
|
| 12 |
+
warning 0 OK Cancel {Show Code}]
|
| 13 |
+
|
| 14 |
+
switch $i {
|
| 15 |
+
0 {puts "You pressed OK"}
|
| 16 |
+
1 {puts "You pressed Cancel"}
|
| 17 |
+
2 {showCode .dialog2}
|
| 18 |
+
}
|
evalkit_llava/lib/tk8.6/demos/en.msg
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
::msgcat::mcset en "Widget Demonstration"
|
| 2 |
+
::msgcat::mcset en "tkWidgetDemo"
|
| 3 |
+
::msgcat::mcset en "&File"
|
| 4 |
+
::msgcat::mcset en "About..."
|
| 5 |
+
::msgcat::mcset en "&About..."
|
| 6 |
+
::msgcat::mcset en "<F1>"
|
| 7 |
+
::msgcat::mcset en "&Quit"
|
| 8 |
+
::msgcat::mcset en "Meta+Q" ;# Displayed hotkey
|
| 9 |
+
::msgcat::mcset en "Meta-q" ;# Actual binding sequence
|
| 10 |
+
::msgcat::mcset en "Ctrl+Q" ;# Displayed hotkey
|
| 11 |
+
::msgcat::mcset en "Control-q" ;# Actual binding sequence
|
| 12 |
+
::msgcat::mcset en "Variable values"
|
| 13 |
+
::msgcat::mcset en "Variable values:"
|
| 14 |
+
::msgcat::mcset en "OK"
|
| 15 |
+
::msgcat::mcset en "Run the \"%s\" sample program"
|
| 16 |
+
::msgcat::mcset en "Dismiss"
|
| 17 |
+
::msgcat::mcset en "Rerun Demo"
|
| 18 |
+
::msgcat::mcset en "Demo code: %s"
|
| 19 |
+
::msgcat::mcset en "About Widget Demo"
|
| 20 |
+
::msgcat::mcset en "Tk widget demonstration application"
|
| 21 |
+
::msgcat::mcset en "Copyright © %s"
|
| 22 |
+
::msgcat::mcset en "
|
| 23 |
+
@@title
|
| 24 |
+
Tk Widget Demonstrations
|
| 25 |
+
@@newline
|
| 26 |
+
@@normal
|
| 27 |
+
@@newline
|
| 28 |
+
|
| 29 |
+
This application provides a front end for several short scripts
|
| 30 |
+
that demonstrate what you can do with Tk widgets. Each of the
|
| 31 |
+
numbered lines below describes a demonstration; you can click on
|
| 32 |
+
it to invoke the demonstration. Once the demonstration window
|
| 33 |
+
appears, you can click the
|
| 34 |
+
@@bold
|
| 35 |
+
See Code
|
| 36 |
+
@@normal
|
| 37 |
+
button to see the Tcl/Tk code that created the demonstration. If
|
| 38 |
+
you wish, you can edit the code and click the
|
| 39 |
+
@@bold
|
| 40 |
+
Rerun Demo
|
| 41 |
+
@@normal
|
| 42 |
+
button in the code window to reinvoke the demonstration with the
|
| 43 |
+
modified code.
|
| 44 |
+
@@newline
|
| 45 |
+
"
|
| 46 |
+
::msgcat::mcset en "Labels, buttons, checkbuttons, and radiobuttons"
|
| 47 |
+
::msgcat::mcset en "Labels (text and bitmaps)"
|
| 48 |
+
::msgcat::mcset en "Labels and UNICODE text"
|
| 49 |
+
::msgcat::mcset en "Buttons"
|
| 50 |
+
::msgcat::mcset en "Check-buttons (select any of a group)"
|
| 51 |
+
::msgcat::mcset en "Radio-buttons (select one of a group)"
|
| 52 |
+
::msgcat::mcset en "A 15-puzzle game made out of buttons"
|
| 53 |
+
::msgcat::mcset en "Iconic buttons that use bitmaps"
|
| 54 |
+
::msgcat::mcset en "Two labels displaying images"
|
| 55 |
+
::msgcat::mcset en "A simple user interface for viewing images"
|
| 56 |
+
::msgcat::mcset en "Labelled frames"
|
| 57 |
+
::msgcat::mcset en "Listboxes"
|
| 58 |
+
::msgcat::mcset en "The 50 states"
|
| 59 |
+
::msgcat::mcset en "Colors: change the color scheme for the application"
|
| 60 |
+
::msgcat::mcset en "A collection of famous and infamous sayings"
|
| 61 |
+
::msgcat::mcset en "Entries and Spin-boxes"
|
| 62 |
+
::msgcat::mcset en "Entries without scrollbars"
|
| 63 |
+
::msgcat::mcset en "Entries with scrollbars"
|
| 64 |
+
::msgcat::mcset en "Validated entries and password fields"
|
| 65 |
+
::msgcat::mcset en "Spin-boxes"
|
| 66 |
+
::msgcat::mcset en "Simple Rolodex-like form"
|
| 67 |
+
::msgcat::mcset en "Text"
|
| 68 |
+
::msgcat::mcset en "Basic editable text"
|
| 69 |
+
::msgcat::mcset en "Text display styles"
|
| 70 |
+
::msgcat::mcset en "Hypertext (tag bindings)"
|
| 71 |
+
::msgcat::mcset en "A text widget with embedded windows"
|
| 72 |
+
::msgcat::mcset en "A search tool built with a text widget"
|
| 73 |
+
::msgcat::mcset en "Canvases"
|
| 74 |
+
::msgcat::mcset en "The canvas item types"
|
| 75 |
+
::msgcat::mcset en "A simple 2-D plot"
|
| 76 |
+
::msgcat::mcset en "Text items in canvases"
|
| 77 |
+
::msgcat::mcset en "An editor for arrowheads on canvas lines"
|
| 78 |
+
::msgcat::mcset en "A ruler with adjustable tab stops"
|
| 79 |
+
::msgcat::mcset en "A building floor plan"
|
| 80 |
+
::msgcat::mcset en "A simple scrollable canvas"
|
| 81 |
+
::msgcat::mcset en "Scales"
|
| 82 |
+
::msgcat::mcset en "Horizontal scale"
|
| 83 |
+
::msgcat::mcset en "Vertical scale"
|
| 84 |
+
::msgcat::mcset en "Paned Windows"
|
| 85 |
+
::msgcat::mcset en "Horizontal paned window"
|
| 86 |
+
::msgcat::mcset en "Vertical paned window"
|
| 87 |
+
::msgcat::mcset en "Menus"
|
| 88 |
+
::msgcat::mcset en "Menus and cascades (sub-menus)"
|
| 89 |
+
::msgcat::mcset en "Menu-buttons"
|
| 90 |
+
::msgcat::mcset en "Common Dialogs"
|
| 91 |
+
::msgcat::mcset en "Message boxes"
|
| 92 |
+
::msgcat::mcset en "File selection dialog"
|
| 93 |
+
::msgcat::mcset en "Color picker"
|
| 94 |
+
::msgcat::mcset en "Miscellaneous"
|
| 95 |
+
::msgcat::mcset en "The built-in bitmaps"
|
| 96 |
+
::msgcat::mcset en "A dialog box with a local grab"
|
| 97 |
+
::msgcat::mcset en "A dialog box with a global grab"
|
evalkit_llava/lib/tk8.6/demos/entry1.tcl
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# entry1.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates several entry widgets without
|
| 4 |
+
# scrollbars.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .entry1
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Entry Demonstration (no scrollbars)"
|
| 16 |
+
wm iconname $w "entry1"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse the middle mouse button pressed."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
entry $w.e1
|
| 27 |
+
entry $w.e2
|
| 28 |
+
entry $w.e3
|
| 29 |
+
pack $w.e1 $w.e2 $w.e3 -side top -pady 5 -padx 10 -fill x
|
| 30 |
+
|
| 31 |
+
$w.e1 insert 0 "Initial value"
|
| 32 |
+
$w.e2 insert end "This entry contains a long value, much too long "
|
| 33 |
+
$w.e2 insert end "to fit in the window at one time, so long in fact "
|
| 34 |
+
$w.e2 insert end "that you'll have to scan or scroll to see the end."
|
evalkit_llava/lib/tk8.6/demos/entry2.tcl
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# entry2.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script is the same as the entry1.tcl script
|
| 4 |
+
# except that it creates scrollbars for the entries.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .entry2
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Entry Demonstration (with scrollbars)"
|
| 16 |
+
wm iconname $w "entry2"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries with the scrollbars, or by dragging with the middle mouse button pressed."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
frame $w.frame -borderwidth 10
|
| 27 |
+
pack $w.frame -side top -fill x -expand 1
|
| 28 |
+
|
| 29 |
+
entry $w.frame.e1 -xscrollcommand "$w.frame.s1 set"
|
| 30 |
+
ttk::scrollbar $w.frame.s1 -orient horizontal -command \
|
| 31 |
+
"$w.frame.e1 xview"
|
| 32 |
+
frame $w.frame.spacer1 -width 20 -height 10
|
| 33 |
+
entry $w.frame.e2 -xscrollcommand "$w.frame.s2 set"
|
| 34 |
+
ttk::scrollbar $w.frame.s2 -orient horizontal -command \
|
| 35 |
+
"$w.frame.e2 xview"
|
| 36 |
+
frame $w.frame.spacer2 -width 20 -height 10
|
| 37 |
+
entry $w.frame.e3 -xscrollcommand "$w.frame.s3 set"
|
| 38 |
+
ttk::scrollbar $w.frame.s3 -orient horizontal -command \
|
| 39 |
+
"$w.frame.e3 xview"
|
| 40 |
+
pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \
|
| 41 |
+
$w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x
|
| 42 |
+
|
| 43 |
+
$w.frame.e1 insert 0 "Initial value"
|
| 44 |
+
$w.frame.e2 insert end "This entry contains a long value, much too long "
|
| 45 |
+
$w.frame.e2 insert end "to fit in the window at one time, so long in fact "
|
| 46 |
+
$w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
|
evalkit_llava/lib/tk8.6/demos/filebox.tcl
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# filebox.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script prompts the user to select a file.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .filebox
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "File Selection Dialogs"
|
| 15 |
+
wm iconname $w "filebox"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
ttk::frame $w._bg
|
| 19 |
+
place $w._bg -x 0 -y 0 -relwidth 1 -relheight 1
|
| 20 |
+
|
| 21 |
+
ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Enter a file name in the entry box or click on the \"Browse\" buttons to select a file name using the file selection dialog."
|
| 22 |
+
pack $w.msg -side top
|
| 23 |
+
|
| 24 |
+
## See Code / Dismiss buttons
|
| 25 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 26 |
+
pack $btns -side bottom -fill x
|
| 27 |
+
|
| 28 |
+
foreach i {open save} {
|
| 29 |
+
set f [ttk::frame $w.$i]
|
| 30 |
+
ttk::label $f.lab -text "Select a file to $i: " -anchor e
|
| 31 |
+
ttk::entry $f.ent -width 20
|
| 32 |
+
ttk::button $f.but -text "Browse ..." -command "fileDialog $w $f.ent $i"
|
| 33 |
+
pack $f.lab -side left
|
| 34 |
+
pack $f.ent -side left -expand yes -fill x
|
| 35 |
+
pack $f.but -side left
|
| 36 |
+
pack $f -fill x -padx 1c -pady 3
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
if {[tk windowingsystem] eq "x11"} {
|
| 40 |
+
ttk::checkbutton $w.strict -text "Use Motif Style Dialog" \
|
| 41 |
+
-variable tk_strictMotif -onvalue 1 -offvalue 0
|
| 42 |
+
pack $w.strict -anchor c
|
| 43 |
+
|
| 44 |
+
# This binding ensures that we don't run the rest of the demos
|
| 45 |
+
# with motif style interactions
|
| 46 |
+
bind $w.strict <Destroy> {set tk_strictMotif 0}
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
proc fileDialog {w ent operation} {
|
| 50 |
+
# Type names Extension(s) Mac File Type(s)
|
| 51 |
+
#
|
| 52 |
+
#---------------------------------------------------------
|
| 53 |
+
set types {
|
| 54 |
+
{"Text files" {.txt .doc} }
|
| 55 |
+
{"Text files" {} TEXT}
|
| 56 |
+
{"Tcl Scripts" {.tcl} TEXT}
|
| 57 |
+
{"C Source Files" {.c .h} }
|
| 58 |
+
{"All Source Files" {.tcl .c .h} }
|
| 59 |
+
{"Image Files" {.gif} }
|
| 60 |
+
{"Image Files" {.jpeg .jpg} }
|
| 61 |
+
{"Image Files" "" {GIFF JPEG}}
|
| 62 |
+
{"All files" *}
|
| 63 |
+
}
|
| 64 |
+
if {$operation == "open"} {
|
| 65 |
+
global selected_type
|
| 66 |
+
if {![info exists selected_type]} {
|
| 67 |
+
set selected_type "Tcl Scripts"
|
| 68 |
+
}
|
| 69 |
+
set file [tk_getOpenFile -filetypes $types -parent $w \
|
| 70 |
+
-typevariable selected_type]
|
| 71 |
+
puts "You selected filetype \"$selected_type\""
|
| 72 |
+
} else {
|
| 73 |
+
set file [tk_getSaveFile -filetypes $types -parent $w \
|
| 74 |
+
-initialfile Untitled -defaultextension .txt]
|
| 75 |
+
}
|
| 76 |
+
if {[string compare $file ""]} {
|
| 77 |
+
$ent delete 0 end
|
| 78 |
+
$ent insert 0 $file
|
| 79 |
+
$ent xview end
|
| 80 |
+
}
|
| 81 |
+
}
|
evalkit_llava/lib/tk8.6/demos/floor.tcl
ADDED
|
@@ -0,0 +1,1372 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# floor.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a canvas widet that displays the
|
| 4 |
+
# floorplan for DEC's Western Research Laboratory.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
# floorDisplay --
|
| 13 |
+
# Recreate the floorplan display in the canvas given by "w". The
|
| 14 |
+
# floor given by "active" is displayed on top with its office structure
|
| 15 |
+
# visible.
|
| 16 |
+
#
|
| 17 |
+
# Arguments:
|
| 18 |
+
# w - Name of the canvas window.
|
| 19 |
+
# active - Number of active floor (1, 2, or 3).
|
| 20 |
+
|
| 21 |
+
proc floorDisplay {w active} {
|
| 22 |
+
global floorLabels floorItems colors activeFloor
|
| 23 |
+
|
| 24 |
+
if {$activeFloor == $active} {
|
| 25 |
+
return
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
$w delete all
|
| 29 |
+
set activeFloor $active
|
| 30 |
+
|
| 31 |
+
# First go through the three floors, displaying the backgrounds for
|
| 32 |
+
# each floor.
|
| 33 |
+
|
| 34 |
+
bg1 $w $colors(bg1) $colors(outline1)
|
| 35 |
+
bg2 $w $colors(bg2) $colors(outline2)
|
| 36 |
+
bg3 $w $colors(bg3) $colors(outline3)
|
| 37 |
+
|
| 38 |
+
# Raise the background for the active floor so that it's on top.
|
| 39 |
+
|
| 40 |
+
$w raise floor$active
|
| 41 |
+
|
| 42 |
+
# Create a dummy item just to mark this point in the display list,
|
| 43 |
+
# so we can insert highlights here.
|
| 44 |
+
|
| 45 |
+
$w create rect 0 100 1 101 -fill {} -outline {} -tags marker
|
| 46 |
+
|
| 47 |
+
# Add the walls and labels for the active floor, along with
|
| 48 |
+
# transparent polygons that define the rooms on the floor.
|
| 49 |
+
# Make sure that the room polygons are on top.
|
| 50 |
+
|
| 51 |
+
catch {unset floorLabels}
|
| 52 |
+
catch {unset floorItems}
|
| 53 |
+
fg$active $w $colors(offices)
|
| 54 |
+
$w raise room
|
| 55 |
+
|
| 56 |
+
# Offset the floors diagonally from each other.
|
| 57 |
+
|
| 58 |
+
$w move floor1 2c 2c
|
| 59 |
+
$w move floor2 1c 1c
|
| 60 |
+
|
| 61 |
+
# Create items for the room entry and its label.
|
| 62 |
+
|
| 63 |
+
$w create window 600 100 -anchor w -window $w.entry
|
| 64 |
+
$w create text 600 100 -anchor e -text "Room: "
|
| 65 |
+
|
| 66 |
+
$w config -scrollregion [$w bbox all]
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
# newRoom --
|
| 70 |
+
# This procedure is invoked whenever the mouse enters a room
|
| 71 |
+
# in the floorplan. It changes tags so that the current room is
|
| 72 |
+
# highlighted.
|
| 73 |
+
#
|
| 74 |
+
# Arguments:
|
| 75 |
+
# w - The name of the canvas window.
|
| 76 |
+
|
| 77 |
+
proc newRoom w {
|
| 78 |
+
global currentRoom floorLabels
|
| 79 |
+
|
| 80 |
+
set id [$w find withtag current]
|
| 81 |
+
if {$id != ""} {
|
| 82 |
+
set currentRoom $floorLabels($id)
|
| 83 |
+
}
|
| 84 |
+
update idletasks
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
# roomChanged --
|
| 88 |
+
# This procedure is invoked whenever the currentRoom variable changes.
|
| 89 |
+
# It highlights the current room and unhighlights any previous room.
|
| 90 |
+
#
|
| 91 |
+
# Arguments:
|
| 92 |
+
# w - The canvas window displaying the floorplan.
|
| 93 |
+
# args - Not used.
|
| 94 |
+
|
| 95 |
+
proc roomChanged {w args} {
|
| 96 |
+
global currentRoom floorItems colors
|
| 97 |
+
$w delete highlight
|
| 98 |
+
if {[catch {set item $floorItems($currentRoom)}]} {
|
| 99 |
+
return
|
| 100 |
+
}
|
| 101 |
+
set new [eval \
|
| 102 |
+
"$w create polygon [$w coords $item] -fill $colors(active) \
|
| 103 |
+
-outline {} -tags highlight"]
|
| 104 |
+
$w raise $new marker
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
# bg1 --
|
| 108 |
+
# This procedure represents part of the floorplan database. When
|
| 109 |
+
# invoked, it instantiates the background information for the first
|
| 110 |
+
# floor.
|
| 111 |
+
#
|
| 112 |
+
# Arguments:
|
| 113 |
+
# w - The canvas window.
|
| 114 |
+
# fill - Fill color to use for the floor's background.
|
| 115 |
+
# outline - Color to use for the floor's outline.
|
| 116 |
+
|
| 117 |
+
proc bg1 {w fill outline} {
|
| 118 |
+
$w create polygon 347 80 349 82 351 84 353 85 363 92 375 99 386 104 \
|
| 119 |
+
386 129 398 129 398 162 484 162 484 129 559 129 559 133 725 \
|
| 120 |
+
133 725 129 802 129 802 389 644 389 644 391 559 391 559 327 \
|
| 121 |
+
508 327 508 311 484 311 484 278 395 278 395 288 400 288 404 \
|
| 122 |
+
288 409 290 413 292 418 297 421 302 422 309 421 318 417 325 \
|
| 123 |
+
411 330 405 332 397 333 344 333 340 334 336 336 335 338 332 \
|
| 124 |
+
342 331 347 332 351 334 354 336 357 341 359 340 360 335 363 \
|
| 125 |
+
331 365 326 366 304 366 304 355 258 355 258 387 60 387 60 391 \
|
| 126 |
+
0 391 0 337 3 337 3 114 8 114 8 25 30 25 30 5 93 5 98 5 104 7 \
|
| 127 |
+
110 10 116 16 119 20 122 28 123 32 123 68 220 68 220 34 221 \
|
| 128 |
+
22 223 17 227 13 231 8 236 4 242 2 246 0 260 0 283 1 300 5 \
|
| 129 |
+
321 14 335 22 348 25 365 29 363 39 358 48 352 56 337 70 \
|
| 130 |
+
344 76 347 80 \
|
| 131 |
+
-tags {floor1 bg} -fill $fill -outline {}
|
| 132 |
+
$w create line 386 129 398 129 -fill $outline -tags {floor1 bg}
|
| 133 |
+
$w create line 258 355 258 387 -fill $outline -tags {floor1 bg}
|
| 134 |
+
$w create line 60 387 60 391 -fill $outline -tags {floor1 bg}
|
| 135 |
+
$w create line 0 337 0 391 -fill $outline -tags {floor1 bg}
|
| 136 |
+
$w create line 60 391 0 391 -fill $outline -tags {floor1 bg}
|
| 137 |
+
$w create line 3 114 3 337 -fill $outline -tags {floor1 bg}
|
| 138 |
+
$w create line 258 387 60 387 -fill $outline -tags {floor1 bg}
|
| 139 |
+
$w create line 484 162 398 162 -fill $outline -tags {floor1 bg}
|
| 140 |
+
$w create line 398 162 398 129 -fill $outline -tags {floor1 bg}
|
| 141 |
+
$w create line 484 278 484 311 -fill $outline -tags {floor1 bg}
|
| 142 |
+
$w create line 484 311 508 311 -fill $outline -tags {floor1 bg}
|
| 143 |
+
$w create line 508 327 508 311 -fill $outline -tags {floor1 bg}
|
| 144 |
+
$w create line 559 327 508 327 -fill $outline -tags {floor1 bg}
|
| 145 |
+
$w create line 644 391 559 391 -fill $outline -tags {floor1 bg}
|
| 146 |
+
$w create line 644 389 644 391 -fill $outline -tags {floor1 bg}
|
| 147 |
+
$w create line 559 129 484 129 -fill $outline -tags {floor1 bg}
|
| 148 |
+
$w create line 484 162 484 129 -fill $outline -tags {floor1 bg}
|
| 149 |
+
$w create line 725 133 559 133 -fill $outline -tags {floor1 bg}
|
| 150 |
+
$w create line 559 129 559 133 -fill $outline -tags {floor1 bg}
|
| 151 |
+
$w create line 725 129 802 129 -fill $outline -tags {floor1 bg}
|
| 152 |
+
$w create line 802 389 802 129 -fill $outline -tags {floor1 bg}
|
| 153 |
+
$w create line 3 337 0 337 -fill $outline -tags {floor1 bg}
|
| 154 |
+
$w create line 559 391 559 327 -fill $outline -tags {floor1 bg}
|
| 155 |
+
$w create line 802 389 644 389 -fill $outline -tags {floor1 bg}
|
| 156 |
+
$w create line 725 133 725 129 -fill $outline -tags {floor1 bg}
|
| 157 |
+
$w create line 8 25 8 114 -fill $outline -tags {floor1 bg}
|
| 158 |
+
$w create line 8 114 3 114 -fill $outline -tags {floor1 bg}
|
| 159 |
+
$w create line 30 25 8 25 -fill $outline -tags {floor1 bg}
|
| 160 |
+
$w create line 484 278 395 278 -fill $outline -tags {floor1 bg}
|
| 161 |
+
$w create line 30 25 30 5 -fill $outline -tags {floor1 bg}
|
| 162 |
+
$w create line 93 5 30 5 -fill $outline -tags {floor1 bg}
|
| 163 |
+
$w create line 98 5 93 5 -fill $outline -tags {floor1 bg}
|
| 164 |
+
$w create line 104 7 98 5 -fill $outline -tags {floor1 bg}
|
| 165 |
+
$w create line 110 10 104 7 -fill $outline -tags {floor1 bg}
|
| 166 |
+
$w create line 116 16 110 10 -fill $outline -tags {floor1 bg}
|
| 167 |
+
$w create line 119 20 116 16 -fill $outline -tags {floor1 bg}
|
| 168 |
+
$w create line 122 28 119 20 -fill $outline -tags {floor1 bg}
|
| 169 |
+
$w create line 123 32 122 28 -fill $outline -tags {floor1 bg}
|
| 170 |
+
$w create line 123 68 123 32 -fill $outline -tags {floor1 bg}
|
| 171 |
+
$w create line 220 68 123 68 -fill $outline -tags {floor1 bg}
|
| 172 |
+
$w create line 386 129 386 104 -fill $outline -tags {floor1 bg}
|
| 173 |
+
$w create line 386 104 375 99 -fill $outline -tags {floor1 bg}
|
| 174 |
+
$w create line 375 99 363 92 -fill $outline -tags {floor1 bg}
|
| 175 |
+
$w create line 353 85 363 92 -fill $outline -tags {floor1 bg}
|
| 176 |
+
$w create line 220 68 220 34 -fill $outline -tags {floor1 bg}
|
| 177 |
+
$w create line 337 70 352 56 -fill $outline -tags {floor1 bg}
|
| 178 |
+
$w create line 352 56 358 48 -fill $outline -tags {floor1 bg}
|
| 179 |
+
$w create line 358 48 363 39 -fill $outline -tags {floor1 bg}
|
| 180 |
+
$w create line 363 39 365 29 -fill $outline -tags {floor1 bg}
|
| 181 |
+
$w create line 365 29 348 25 -fill $outline -tags {floor1 bg}
|
| 182 |
+
$w create line 348 25 335 22 -fill $outline -tags {floor1 bg}
|
| 183 |
+
$w create line 335 22 321 14 -fill $outline -tags {floor1 bg}
|
| 184 |
+
$w create line 321 14 300 5 -fill $outline -tags {floor1 bg}
|
| 185 |
+
$w create line 300 5 283 1 -fill $outline -tags {floor1 bg}
|
| 186 |
+
$w create line 283 1 260 0 -fill $outline -tags {floor1 bg}
|
| 187 |
+
$w create line 260 0 246 0 -fill $outline -tags {floor1 bg}
|
| 188 |
+
$w create line 246 0 242 2 -fill $outline -tags {floor1 bg}
|
| 189 |
+
$w create line 242 2 236 4 -fill $outline -tags {floor1 bg}
|
| 190 |
+
$w create line 236 4 231 8 -fill $outline -tags {floor1 bg}
|
| 191 |
+
$w create line 231 8 227 13 -fill $outline -tags {floor1 bg}
|
| 192 |
+
$w create line 223 17 227 13 -fill $outline -tags {floor1 bg}
|
| 193 |
+
$w create line 221 22 223 17 -fill $outline -tags {floor1 bg}
|
| 194 |
+
$w create line 220 34 221 22 -fill $outline -tags {floor1 bg}
|
| 195 |
+
$w create line 340 360 335 363 -fill $outline -tags {floor1 bg}
|
| 196 |
+
$w create line 335 363 331 365 -fill $outline -tags {floor1 bg}
|
| 197 |
+
$w create line 331 365 326 366 -fill $outline -tags {floor1 bg}
|
| 198 |
+
$w create line 326 366 304 366 -fill $outline -tags {floor1 bg}
|
| 199 |
+
$w create line 304 355 304 366 -fill $outline -tags {floor1 bg}
|
| 200 |
+
$w create line 395 288 400 288 -fill $outline -tags {floor1 bg}
|
| 201 |
+
$w create line 404 288 400 288 -fill $outline -tags {floor1 bg}
|
| 202 |
+
$w create line 409 290 404 288 -fill $outline -tags {floor1 bg}
|
| 203 |
+
$w create line 413 292 409 290 -fill $outline -tags {floor1 bg}
|
| 204 |
+
$w create line 418 297 413 292 -fill $outline -tags {floor1 bg}
|
| 205 |
+
$w create line 421 302 418 297 -fill $outline -tags {floor1 bg}
|
| 206 |
+
$w create line 422 309 421 302 -fill $outline -tags {floor1 bg}
|
| 207 |
+
$w create line 421 318 422 309 -fill $outline -tags {floor1 bg}
|
| 208 |
+
$w create line 421 318 417 325 -fill $outline -tags {floor1 bg}
|
| 209 |
+
$w create line 417 325 411 330 -fill $outline -tags {floor1 bg}
|
| 210 |
+
$w create line 411 330 405 332 -fill $outline -tags {floor1 bg}
|
| 211 |
+
$w create line 405 332 397 333 -fill $outline -tags {floor1 bg}
|
| 212 |
+
$w create line 397 333 344 333 -fill $outline -tags {floor1 bg}
|
| 213 |
+
$w create line 344 333 340 334 -fill $outline -tags {floor1 bg}
|
| 214 |
+
$w create line 340 334 336 336 -fill $outline -tags {floor1 bg}
|
| 215 |
+
$w create line 336 336 335 338 -fill $outline -tags {floor1 bg}
|
| 216 |
+
$w create line 335 338 332 342 -fill $outline -tags {floor1 bg}
|
| 217 |
+
$w create line 331 347 332 342 -fill $outline -tags {floor1 bg}
|
| 218 |
+
$w create line 332 351 331 347 -fill $outline -tags {floor1 bg}
|
| 219 |
+
$w create line 334 354 332 351 -fill $outline -tags {floor1 bg}
|
| 220 |
+
$w create line 336 357 334 354 -fill $outline -tags {floor1 bg}
|
| 221 |
+
$w create line 341 359 336 357 -fill $outline -tags {floor1 bg}
|
| 222 |
+
$w create line 341 359 340 360 -fill $outline -tags {floor1 bg}
|
| 223 |
+
$w create line 395 288 395 278 -fill $outline -tags {floor1 bg}
|
| 224 |
+
$w create line 304 355 258 355 -fill $outline -tags {floor1 bg}
|
| 225 |
+
$w create line 347 80 344 76 -fill $outline -tags {floor1 bg}
|
| 226 |
+
$w create line 344 76 337 70 -fill $outline -tags {floor1 bg}
|
| 227 |
+
$w create line 349 82 347 80 -fill $outline -tags {floor1 bg}
|
| 228 |
+
$w create line 351 84 349 82 -fill $outline -tags {floor1 bg}
|
| 229 |
+
$w create line 353 85 351 84 -fill $outline -tags {floor1 bg}
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
# bg2 --
|
| 233 |
+
# This procedure represents part of the floorplan database. When
|
| 234 |
+
# invoked, it instantiates the background information for the second
|
| 235 |
+
# floor.
|
| 236 |
+
#
|
| 237 |
+
# Arguments:
|
| 238 |
+
# w - The canvas window.
|
| 239 |
+
# fill - Fill color to use for the floor's background.
|
| 240 |
+
# outline - Color to use for the floor's outline.
|
| 241 |
+
|
| 242 |
+
proc bg2 {w fill outline} {
|
| 243 |
+
$w create polygon 559 129 484 129 484 162 398 162 398 129 315 129 \
|
| 244 |
+
315 133 176 133 176 129 96 129 96 133 3 133 3 339 0 339 0 391 \
|
| 245 |
+
60 391 60 387 258 387 258 329 350 329 350 311 395 311 395 280 \
|
| 246 |
+
484 280 484 311 508 311 508 327 558 327 558 391 644 391 644 \
|
| 247 |
+
367 802 367 802 129 725 129 725 133 559 133 559 129 \
|
| 248 |
+
-tags {floor2 bg} -fill $fill -outline {}
|
| 249 |
+
$w create line 350 311 350 329 -fill $outline -tags {floor2 bg}
|
| 250 |
+
$w create line 398 129 398 162 -fill $outline -tags {floor2 bg}
|
| 251 |
+
$w create line 802 367 802 129 -fill $outline -tags {floor2 bg}
|
| 252 |
+
$w create line 802 129 725 129 -fill $outline -tags {floor2 bg}
|
| 253 |
+
$w create line 725 133 725 129 -fill $outline -tags {floor2 bg}
|
| 254 |
+
$w create line 559 129 559 133 -fill $outline -tags {floor2 bg}
|
| 255 |
+
$w create line 559 133 725 133 -fill $outline -tags {floor2 bg}
|
| 256 |
+
$w create line 484 162 484 129 -fill $outline -tags {floor2 bg}
|
| 257 |
+
$w create line 559 129 484 129 -fill $outline -tags {floor2 bg}
|
| 258 |
+
$w create line 802 367 644 367 -fill $outline -tags {floor2 bg}
|
| 259 |
+
$w create line 644 367 644 391 -fill $outline -tags {floor2 bg}
|
| 260 |
+
$w create line 644 391 558 391 -fill $outline -tags {floor2 bg}
|
| 261 |
+
$w create line 558 327 558 391 -fill $outline -tags {floor2 bg}
|
| 262 |
+
$w create line 558 327 508 327 -fill $outline -tags {floor2 bg}
|
| 263 |
+
$w create line 508 327 508 311 -fill $outline -tags {floor2 bg}
|
| 264 |
+
$w create line 484 311 508 311 -fill $outline -tags {floor2 bg}
|
| 265 |
+
$w create line 484 280 484 311 -fill $outline -tags {floor2 bg}
|
| 266 |
+
$w create line 398 162 484 162 -fill $outline -tags {floor2 bg}
|
| 267 |
+
$w create line 484 280 395 280 -fill $outline -tags {floor2 bg}
|
| 268 |
+
$w create line 395 280 395 311 -fill $outline -tags {floor2 bg}
|
| 269 |
+
$w create line 258 387 60 387 -fill $outline -tags {floor2 bg}
|
| 270 |
+
$w create line 3 133 3 339 -fill $outline -tags {floor2 bg}
|
| 271 |
+
$w create line 3 339 0 339 -fill $outline -tags {floor2 bg}
|
| 272 |
+
$w create line 60 391 0 391 -fill $outline -tags {floor2 bg}
|
| 273 |
+
$w create line 0 339 0 391 -fill $outline -tags {floor2 bg}
|
| 274 |
+
$w create line 60 387 60 391 -fill $outline -tags {floor2 bg}
|
| 275 |
+
$w create line 258 329 258 387 -fill $outline -tags {floor2 bg}
|
| 276 |
+
$w create line 350 329 258 329 -fill $outline -tags {floor2 bg}
|
| 277 |
+
$w create line 395 311 350 311 -fill $outline -tags {floor2 bg}
|
| 278 |
+
$w create line 398 129 315 129 -fill $outline -tags {floor2 bg}
|
| 279 |
+
$w create line 176 133 315 133 -fill $outline -tags {floor2 bg}
|
| 280 |
+
$w create line 176 129 96 129 -fill $outline -tags {floor2 bg}
|
| 281 |
+
$w create line 3 133 96 133 -fill $outline -tags {floor2 bg}
|
| 282 |
+
$w create line 315 133 315 129 -fill $outline -tags {floor2 bg}
|
| 283 |
+
$w create line 176 133 176 129 -fill $outline -tags {floor2 bg}
|
| 284 |
+
$w create line 96 133 96 129 -fill $outline -tags {floor2 bg}
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
# bg3 --
|
| 288 |
+
# This procedure represents part of the floorplan database. When
|
| 289 |
+
# invoked, it instantiates the background information for the third
|
| 290 |
+
# floor.
|
| 291 |
+
#
|
| 292 |
+
# Arguments:
|
| 293 |
+
# w - The canvas window.
|
| 294 |
+
# fill - Fill color to use for the floor's background.
|
| 295 |
+
# outline - Color to use for the floor's outline.
|
| 296 |
+
|
| 297 |
+
proc bg3 {w fill outline} {
|
| 298 |
+
$w create polygon 159 300 107 300 107 248 159 248 159 129 96 129 96 \
|
| 299 |
+
133 21 133 21 331 0 331 0 391 60 391 60 370 159 370 159 300 \
|
| 300 |
+
-tags {floor3 bg} -fill $fill -outline {}
|
| 301 |
+
$w create polygon 258 370 258 329 350 329 350 311 399 311 399 129 \
|
| 302 |
+
315 129 315 133 176 133 176 129 159 129 159 370 258 370 \
|
| 303 |
+
-tags {floor3 bg} -fill $fill -outline {}
|
| 304 |
+
$w create line 96 133 96 129 -fill $outline -tags {floor3 bg}
|
| 305 |
+
$w create line 176 129 96 129 -fill $outline -tags {floor3 bg}
|
| 306 |
+
$w create line 176 129 176 133 -fill $outline -tags {floor3 bg}
|
| 307 |
+
$w create line 315 133 176 133 -fill $outline -tags {floor3 bg}
|
| 308 |
+
$w create line 315 133 315 129 -fill $outline -tags {floor3 bg}
|
| 309 |
+
$w create line 399 129 315 129 -fill $outline -tags {floor3 bg}
|
| 310 |
+
$w create line 399 311 399 129 -fill $outline -tags {floor3 bg}
|
| 311 |
+
$w create line 399 311 350 311 -fill $outline -tags {floor3 bg}
|
| 312 |
+
$w create line 350 329 350 311 -fill $outline -tags {floor3 bg}
|
| 313 |
+
$w create line 350 329 258 329 -fill $outline -tags {floor3 bg}
|
| 314 |
+
$w create line 258 370 258 329 -fill $outline -tags {floor3 bg}
|
| 315 |
+
$w create line 60 370 258 370 -fill $outline -tags {floor3 bg}
|
| 316 |
+
$w create line 60 370 60 391 -fill $outline -tags {floor3 bg}
|
| 317 |
+
$w create line 60 391 0 391 -fill $outline -tags {floor3 bg}
|
| 318 |
+
$w create line 0 391 0 331 -fill $outline -tags {floor3 bg}
|
| 319 |
+
$w create line 21 331 0 331 -fill $outline -tags {floor3 bg}
|
| 320 |
+
$w create line 21 331 21 133 -fill $outline -tags {floor3 bg}
|
| 321 |
+
$w create line 96 133 21 133 -fill $outline -tags {floor3 bg}
|
| 322 |
+
$w create line 107 300 159 300 159 248 107 248 107 300 \
|
| 323 |
+
-fill $outline -tags {floor3 bg}
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
# fg1 --
|
| 327 |
+
# This procedure represents part of the floorplan database. When
|
| 328 |
+
# invoked, it instantiates the foreground information for the first
|
| 329 |
+
# floor (office outlines and numbers).
|
| 330 |
+
#
|
| 331 |
+
# Arguments:
|
| 332 |
+
# w - The canvas window.
|
| 333 |
+
# color - Color to use for drawing foreground information.
|
| 334 |
+
|
| 335 |
+
proc fg1 {w color} {
|
| 336 |
+
global floorLabels floorItems
|
| 337 |
+
set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor1 room}]
|
| 338 |
+
set floorLabels($i) 101
|
| 339 |
+
set {floorItems(101)} $i
|
| 340 |
+
$w create text 358 209 -text 101 -fill $color -anchor c -tags {floor1 label}
|
| 341 |
+
set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor1 room}]
|
| 342 |
+
set floorLabels($i) {Pub Lift1}
|
| 343 |
+
set {floorItems(Pub Lift1)} $i
|
| 344 |
+
$w create text 323 223 -text {Pub Lift1} -fill $color -anchor c -tags {floor1 label}
|
| 345 |
+
set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor1 room}]
|
| 346 |
+
set floorLabels($i) {Priv Lift1}
|
| 347 |
+
set {floorItems(Priv Lift1)} $i
|
| 348 |
+
$w create text 323 188 -text {Priv Lift1} -fill $color -anchor c -tags {floor1 label}
|
| 349 |
+
set i [$w create polygon 42 389 42 337 1 337 1 389 -fill {} -outline {} -tags {floor1 room}]
|
| 350 |
+
set floorLabels($i) 110
|
| 351 |
+
set {floorItems(110)} $i
|
| 352 |
+
$w create text 21.5 363 -text 110 -fill $color -anchor c -tags {floor1 label}
|
| 353 |
+
set i [$w create polygon 59 389 59 385 90 385 90 337 44 337 44 389 -fill {} -outline {} -tags {floor1 room}]
|
| 354 |
+
set floorLabels($i) 109
|
| 355 |
+
set {floorItems(109)} $i
|
| 356 |
+
$w create text 67 363 -text 109 -fill $color -anchor c -tags {floor1 label}
|
| 357 |
+
set i [$w create polygon 51 300 51 253 6 253 6 300 -fill {} -outline {} -tags {floor1 room}]
|
| 358 |
+
set floorLabels($i) 111
|
| 359 |
+
set {floorItems(111)} $i
|
| 360 |
+
$w create text 28.5 276.5 -text 111 -fill $color -anchor c -tags {floor1 label}
|
| 361 |
+
set i [$w create polygon 98 248 98 309 79 309 79 248 -fill {} -outline {} -tags {floor1 room}]
|
| 362 |
+
set floorLabels($i) 117B
|
| 363 |
+
set {floorItems(117B)} $i
|
| 364 |
+
$w create text 88.5 278.5 -text 117B -fill $color -anchor c -tags {floor1 label}
|
| 365 |
+
set i [$w create polygon 51 251 51 204 6 204 6 251 -fill {} -outline {} -tags {floor1 room}]
|
| 366 |
+
set floorLabels($i) 112
|
| 367 |
+
set {floorItems(112)} $i
|
| 368 |
+
$w create text 28.5 227.5 -text 112 -fill $color -anchor c -tags {floor1 label}
|
| 369 |
+
set i [$w create polygon 6 156 51 156 51 203 6 203 -fill {} -outline {} -tags {floor1 room}]
|
| 370 |
+
set floorLabels($i) 113
|
| 371 |
+
set {floorItems(113)} $i
|
| 372 |
+
$w create text 28.5 179.5 -text 113 -fill $color -anchor c -tags {floor1 label}
|
| 373 |
+
set i [$w create polygon 85 169 79 169 79 192 85 192 -fill {} -outline {} -tags {floor1 room}]
|
| 374 |
+
set floorLabels($i) 117A
|
| 375 |
+
set {floorItems(117A)} $i
|
| 376 |
+
$w create text 82 180.5 -text 117A -fill $color -anchor c -tags {floor1 label}
|
| 377 |
+
set i [$w create polygon 77 302 77 168 53 168 53 302 -fill {} -outline {} -tags {floor1 room}]
|
| 378 |
+
set floorLabels($i) 117
|
| 379 |
+
set {floorItems(117)} $i
|
| 380 |
+
$w create text 65 235 -text 117 -fill $color -anchor c -tags {floor1 label}
|
| 381 |
+
set i [$w create polygon 51 155 51 115 6 115 6 155 -fill {} -outline {} -tags {floor1 room}]
|
| 382 |
+
set floorLabels($i) 114
|
| 383 |
+
set {floorItems(114)} $i
|
| 384 |
+
$w create text 28.5 135 -text 114 -fill $color -anchor c -tags {floor1 label}
|
| 385 |
+
set i [$w create polygon 95 115 53 115 53 168 95 168 -fill {} -outline {} -tags {floor1 room}]
|
| 386 |
+
set floorLabels($i) 115
|
| 387 |
+
set {floorItems(115)} $i
|
| 388 |
+
$w create text 74 141.5 -text 115 -fill $color -anchor c -tags {floor1 label}
|
| 389 |
+
set i [$w create polygon 87 113 87 27 10 27 10 113 -fill {} -outline {} -tags {floor1 room}]
|
| 390 |
+
set floorLabels($i) 116
|
| 391 |
+
set {floorItems(116)} $i
|
| 392 |
+
$w create text 48.5 70 -text 116 -fill $color -anchor c -tags {floor1 label}
|
| 393 |
+
set i [$w create polygon 89 91 128 91 128 113 89 113 -fill {} -outline {} -tags {floor1 room}]
|
| 394 |
+
set floorLabels($i) 118
|
| 395 |
+
set {floorItems(118)} $i
|
| 396 |
+
$w create text 108.5 102 -text 118 -fill $color -anchor c -tags {floor1 label}
|
| 397 |
+
set i [$w create polygon 178 128 178 132 216 132 216 91 163 91 163 112 149 112 149 128 -fill {} -outline {} -tags {floor1 room}]
|
| 398 |
+
set floorLabels($i) 120
|
| 399 |
+
set {floorItems(120)} $i
|
| 400 |
+
$w create text 189.5 111.5 -text 120 -fill $color -anchor c -tags {floor1 label}
|
| 401 |
+
set i [$w create polygon 79 193 87 193 87 169 136 169 136 192 156 192 156 169 175 169 175 246 79 246 -fill {} -outline {} -tags {floor1 room}]
|
| 402 |
+
set floorLabels($i) 122
|
| 403 |
+
set {floorItems(122)} $i
|
| 404 |
+
$w create text 131 207.5 -text 122 -fill $color -anchor c -tags {floor1 label}
|
| 405 |
+
set i [$w create polygon 138 169 154 169 154 191 138 191 -fill {} -outline {} -tags {floor1 room}]
|
| 406 |
+
set floorLabels($i) 121
|
| 407 |
+
set {floorItems(121)} $i
|
| 408 |
+
$w create text 146 180 -text 121 -fill $color -anchor c -tags {floor1 label}
|
| 409 |
+
set i [$w create polygon 99 300 126 300 126 309 99 309 -fill {} -outline {} -tags {floor1 room}]
|
| 410 |
+
set floorLabels($i) 106A
|
| 411 |
+
set {floorItems(106A)} $i
|
| 412 |
+
$w create text 112.5 304.5 -text 106A -fill $color -anchor c -tags {floor1 label}
|
| 413 |
+
set i [$w create polygon 128 299 128 309 150 309 150 248 99 248 99 299 -fill {} -outline {} -tags {floor1 room}]
|
| 414 |
+
set floorLabels($i) 105
|
| 415 |
+
set {floorItems(105)} $i
|
| 416 |
+
$w create text 124.5 278.5 -text 105 -fill $color -anchor c -tags {floor1 label}
|
| 417 |
+
set i [$w create polygon 174 309 174 300 152 300 152 309 -fill {} -outline {} -tags {floor1 room}]
|
| 418 |
+
set floorLabels($i) 106B
|
| 419 |
+
set {floorItems(106B)} $i
|
| 420 |
+
$w create text 163 304.5 -text 106B -fill $color -anchor c -tags {floor1 label}
|
| 421 |
+
set i [$w create polygon 176 299 176 309 216 309 216 248 152 248 152 299 -fill {} -outline {} -tags {floor1 room}]
|
| 422 |
+
set floorLabels($i) 104
|
| 423 |
+
set {floorItems(104)} $i
|
| 424 |
+
$w create text 184 278.5 -text 104 -fill $color -anchor c -tags {floor1 label}
|
| 425 |
+
set i [$w create polygon 138 385 138 337 91 337 91 385 -fill {} -outline {} -tags {floor1 room}]
|
| 426 |
+
set floorLabels($i) 108
|
| 427 |
+
set {floorItems(108)} $i
|
| 428 |
+
$w create text 114.5 361 -text 108 -fill $color -anchor c -tags {floor1 label}
|
| 429 |
+
set i [$w create polygon 256 337 140 337 140 385 256 385 -fill {} -outline {} -tags {floor1 room}]
|
| 430 |
+
set floorLabels($i) 107
|
| 431 |
+
set {floorItems(107)} $i
|
| 432 |
+
$w create text 198 361 -text 107 -fill $color -anchor c -tags {floor1 label}
|
| 433 |
+
set i [$w create polygon 300 353 300 329 260 329 260 353 -fill {} -outline {} -tags {floor1 room}]
|
| 434 |
+
set floorLabels($i) Smoking
|
| 435 |
+
set {floorItems(Smoking)} $i
|
| 436 |
+
$w create text 280 341 -text Smoking -fill $color -anchor c -tags {floor1 label}
|
| 437 |
+
set i [$w create polygon 314 135 314 170 306 170 306 246 177 246 177 135 -fill {} -outline {} -tags {floor1 room}]
|
| 438 |
+
set floorLabels($i) 123
|
| 439 |
+
set {floorItems(123)} $i
|
| 440 |
+
$w create text 245.5 190.5 -text 123 -fill $color -anchor c -tags {floor1 label}
|
| 441 |
+
set i [$w create polygon 217 248 301 248 301 326 257 326 257 310 217 310 -fill {} -outline {} -tags {floor1 room}]
|
| 442 |
+
set floorLabels($i) 103
|
| 443 |
+
set {floorItems(103)} $i
|
| 444 |
+
$w create text 259 287 -text 103 -fill $color -anchor c -tags {floor1 label}
|
| 445 |
+
set i [$w create polygon 396 188 377 188 377 169 316 169 316 131 396 131 -fill {} -outline {} -tags {floor1 room}]
|
| 446 |
+
set floorLabels($i) 124
|
| 447 |
+
set {floorItems(124)} $i
|
| 448 |
+
$w create text 356 150 -text 124 -fill $color -anchor c -tags {floor1 label}
|
| 449 |
+
set i [$w create polygon 397 226 407 226 407 189 377 189 377 246 397 246 -fill {} -outline {} -tags {floor1 room}]
|
| 450 |
+
set floorLabels($i) 125
|
| 451 |
+
set {floorItems(125)} $i
|
| 452 |
+
$w create text 392 217.5 -text 125 -fill $color -anchor c -tags {floor1 label}
|
| 453 |
+
set i [$w create polygon 399 187 409 187 409 207 474 207 474 164 399 164 -fill {} -outline {} -tags {floor1 room}]
|
| 454 |
+
set floorLabels($i) 126
|
| 455 |
+
set {floorItems(126)} $i
|
| 456 |
+
$w create text 436.5 185.5 -text 126 -fill $color -anchor c -tags {floor1 label}
|
| 457 |
+
set i [$w create polygon 409 209 409 229 399 229 399 253 486 253 486 239 474 239 474 209 -fill {} -outline {} -tags {floor1 room}]
|
| 458 |
+
set floorLabels($i) 127
|
| 459 |
+
set {floorItems(127)} $i
|
| 460 |
+
$w create text 436.5 231 -text 127 -fill $color -anchor c -tags {floor1 label}
|
| 461 |
+
set i [$w create polygon 501 164 501 174 495 174 495 188 490 188 490 204 476 204 476 164 -fill {} -outline {} -tags {floor1 room}]
|
| 462 |
+
set floorLabels($i) MShower
|
| 463 |
+
set {floorItems(MShower)} $i
|
| 464 |
+
$w create text 488.5 184 -text MShower -fill $color -anchor c -tags {floor1 label}
|
| 465 |
+
set i [$w create polygon 497 176 513 176 513 204 492 204 492 190 497 190 -fill {} -outline {} -tags {floor1 room}]
|
| 466 |
+
set floorLabels($i) Closet
|
| 467 |
+
set {floorItems(Closet)} $i
|
| 468 |
+
$w create text 502.5 190 -text Closet -fill $color -anchor c -tags {floor1 label}
|
| 469 |
+
set i [$w create polygon 476 237 476 206 513 206 513 254 488 254 488 237 -fill {} -outline {} -tags {floor1 room}]
|
| 470 |
+
set floorLabels($i) WShower
|
| 471 |
+
set {floorItems(WShower)} $i
|
| 472 |
+
$w create text 494.5 230 -text WShower -fill $color -anchor c -tags {floor1 label}
|
| 473 |
+
set i [$w create polygon 486 131 558 131 558 135 724 135 724 166 697 166 697 275 553 275 531 254 515 254 515 174 503 174 503 161 486 161 -fill {} -outline {} -tags {floor1 room}]
|
| 474 |
+
set floorLabels($i) 130
|
| 475 |
+
set {floorItems(130)} $i
|
| 476 |
+
$w create text 638.5 205 -text 130 -fill $color -anchor c -tags {floor1 label}
|
| 477 |
+
set i [$w create polygon 308 242 339 242 339 248 342 248 342 246 397 246 397 276 393 276 393 309 300 309 300 248 308 248 -fill {} -outline {} -tags {floor1 room}]
|
| 478 |
+
set floorLabels($i) 102
|
| 479 |
+
set {floorItems(102)} $i
|
| 480 |
+
$w create text 367.5 278.5 -text 102 -fill $color -anchor c -tags {floor1 label}
|
| 481 |
+
set i [$w create polygon 397 255 486 255 486 276 397 276 -fill {} -outline {} -tags {floor1 room}]
|
| 482 |
+
set floorLabels($i) 128
|
| 483 |
+
set {floorItems(128)} $i
|
| 484 |
+
$w create text 441.5 265.5 -text 128 -fill $color -anchor c -tags {floor1 label}
|
| 485 |
+
set i [$w create polygon 510 309 486 309 486 255 530 255 552 277 561 277 561 325 510 325 -fill {} -outline {} -tags {floor1 room}]
|
| 486 |
+
set floorLabels($i) 129
|
| 487 |
+
set {floorItems(129)} $i
|
| 488 |
+
$w create text 535.5 293 -text 129 -fill $color -anchor c -tags {floor1 label}
|
| 489 |
+
set i [$w create polygon 696 281 740 281 740 387 642 387 642 389 561 389 561 277 696 277 -fill {} -outline {} -tags {floor1 room}]
|
| 490 |
+
set floorLabels($i) 133
|
| 491 |
+
set {floorItems(133)} $i
|
| 492 |
+
$w create text 628.5 335 -text 133 -fill $color -anchor c -tags {floor1 label}
|
| 493 |
+
set i [$w create polygon 742 387 742 281 800 281 800 387 -fill {} -outline {} -tags {floor1 room}]
|
| 494 |
+
set floorLabels($i) 132
|
| 495 |
+
set {floorItems(132)} $i
|
| 496 |
+
$w create text 771 334 -text 132 -fill $color -anchor c -tags {floor1 label}
|
| 497 |
+
set i [$w create polygon 800 168 800 280 699 280 699 168 -fill {} -outline {} -tags {floor1 room}]
|
| 498 |
+
set floorLabels($i) 134
|
| 499 |
+
set {floorItems(134)} $i
|
| 500 |
+
$w create text 749.5 224 -text 134 -fill $color -anchor c -tags {floor1 label}
|
| 501 |
+
set i [$w create polygon 726 131 726 166 800 166 800 131 -fill {} -outline {} -tags {floor1 room}]
|
| 502 |
+
set floorLabels($i) 135
|
| 503 |
+
set {floorItems(135)} $i
|
| 504 |
+
$w create text 763 148.5 -text 135 -fill $color -anchor c -tags {floor1 label}
|
| 505 |
+
set i [$w create polygon 340 360 335 363 331 365 326 366 304 366 304 312 396 312 396 288 400 288 404 288 409 290 413 292 418 297 421 302 422 309 421 318 417 325 411 330 405 332 397 333 344 333 340 334 336 336 335 338 332 342 331 347 332 351 334 354 336 357 341 359 -fill {} -outline {} -tags {floor1 room}]
|
| 506 |
+
set floorLabels($i) {Ramona Stair}
|
| 507 |
+
set {floorItems(Ramona Stair)} $i
|
| 508 |
+
$w create text 368 323 -text {Ramona Stair} -fill $color -anchor c -tags {floor1 label}
|
| 509 |
+
set i [$w create polygon 30 23 30 5 93 5 98 5 104 7 110 10 116 16 119 20 122 28 123 32 123 68 220 68 220 87 90 87 90 23 -fill {} -outline {} -tags {floor1 room}]
|
| 510 |
+
set floorLabels($i) {University Stair}
|
| 511 |
+
set {floorItems(University Stair)} $i
|
| 512 |
+
$w create text 155 77.5 -text {University Stair} -fill $color -anchor c -tags {floor1 label}
|
| 513 |
+
set i [$w create polygon 282 37 295 40 312 49 323 56 337 70 352 56 358 48 363 39 365 29 348 25 335 22 321 14 300 5 283 1 260 0 246 0 242 2 236 4 231 8 227 13 223 17 221 22 220 34 260 34 -fill {} -outline {} -tags {floor1 room}]
|
| 514 |
+
set floorLabels($i) {Plaza Stair}
|
| 515 |
+
set {floorItems(Plaza Stair)} $i
|
| 516 |
+
$w create text 317.5 28.5 -text {Plaza Stair} -fill $color -anchor c -tags {floor1 label}
|
| 517 |
+
set i [$w create polygon 220 34 260 34 282 37 295 40 312 49 323 56 337 70 350 83 365 94 377 100 386 104 386 128 220 128 -fill {} -outline {} -tags {floor1 room}]
|
| 518 |
+
set floorLabels($i) {Plaza Deck}
|
| 519 |
+
set {floorItems(Plaza Deck)} $i
|
| 520 |
+
$w create text 303 81 -text {Plaza Deck} -fill $color -anchor c -tags {floor1 label}
|
| 521 |
+
set i [$w create polygon 257 336 77 336 6 336 6 301 77 301 77 310 257 310 -fill {} -outline {} -tags {floor1 room}]
|
| 522 |
+
set floorLabels($i) 106
|
| 523 |
+
set {floorItems(106)} $i
|
| 524 |
+
$w create text 131.5 318.5 -text 106 -fill $color -anchor c -tags {floor1 label}
|
| 525 |
+
set i [$w create polygon 146 110 162 110 162 91 130 91 130 115 95 115 95 128 114 128 114 151 157 151 157 153 112 153 112 130 97 130 97 168 175 168 175 131 146 131 -fill {} -outline {} -tags {floor1 room}]
|
| 526 |
+
set floorLabels($i) 119
|
| 527 |
+
set {floorItems(119)} $i
|
| 528 |
+
$w create text 143.5 133 -text 119 -fill $color -anchor c -tags {floor1 label}
|
| 529 |
+
$w create line 155 191 155 189 -fill $color -tags {floor1 wall}
|
| 530 |
+
$w create line 155 177 155 169 -fill $color -tags {floor1 wall}
|
| 531 |
+
$w create line 96 129 96 169 -fill $color -tags {floor1 wall}
|
| 532 |
+
$w create line 78 169 176 169 -fill $color -tags {floor1 wall}
|
| 533 |
+
$w create line 176 247 176 129 -fill $color -tags {floor1 wall}
|
| 534 |
+
$w create line 340 206 307 206 -fill $color -tags {floor1 wall}
|
| 535 |
+
$w create line 340 187 340 170 -fill $color -tags {floor1 wall}
|
| 536 |
+
$w create line 340 210 340 201 -fill $color -tags {floor1 wall}
|
| 537 |
+
$w create line 340 247 340 224 -fill $color -tags {floor1 wall}
|
| 538 |
+
$w create line 340 241 307 241 -fill $color -tags {floor1 wall}
|
| 539 |
+
$w create line 376 246 376 170 -fill $color -tags {floor1 wall}
|
| 540 |
+
$w create line 307 247 307 170 -fill $color -tags {floor1 wall}
|
| 541 |
+
$w create line 376 170 307 170 -fill $color -tags {floor1 wall}
|
| 542 |
+
$w create line 315 129 315 170 -fill $color -tags {floor1 wall}
|
| 543 |
+
$w create line 147 129 176 129 -fill $color -tags {floor1 wall}
|
| 544 |
+
$w create line 202 133 176 133 -fill $color -tags {floor1 wall}
|
| 545 |
+
$w create line 398 129 315 129 -fill $color -tags {floor1 wall}
|
| 546 |
+
$w create line 258 352 258 387 -fill $color -tags {floor1 wall}
|
| 547 |
+
$w create line 60 387 60 391 -fill $color -tags {floor1 wall}
|
| 548 |
+
$w create line 0 337 0 391 -fill $color -tags {floor1 wall}
|
| 549 |
+
$w create line 60 391 0 391 -fill $color -tags {floor1 wall}
|
| 550 |
+
$w create line 3 114 3 337 -fill $color -tags {floor1 wall}
|
| 551 |
+
$w create line 258 387 60 387 -fill $color -tags {floor1 wall}
|
| 552 |
+
$w create line 52 237 52 273 -fill $color -tags {floor1 wall}
|
| 553 |
+
$w create line 52 189 52 225 -fill $color -tags {floor1 wall}
|
| 554 |
+
$w create line 52 140 52 177 -fill $color -tags {floor1 wall}
|
| 555 |
+
$w create line 395 306 395 311 -fill $color -tags {floor1 wall}
|
| 556 |
+
$w create line 531 254 398 254 -fill $color -tags {floor1 wall}
|
| 557 |
+
$w create line 475 178 475 238 -fill $color -tags {floor1 wall}
|
| 558 |
+
$w create line 502 162 398 162 -fill $color -tags {floor1 wall}
|
| 559 |
+
$w create line 398 129 398 188 -fill $color -tags {floor1 wall}
|
| 560 |
+
$w create line 383 188 376 188 -fill $color -tags {floor1 wall}
|
| 561 |
+
$w create line 408 188 408 194 -fill $color -tags {floor1 wall}
|
| 562 |
+
$w create line 398 227 398 254 -fill $color -tags {floor1 wall}
|
| 563 |
+
$w create line 408 227 398 227 -fill $color -tags {floor1 wall}
|
| 564 |
+
$w create line 408 222 408 227 -fill $color -tags {floor1 wall}
|
| 565 |
+
$w create line 408 206 408 210 -fill $color -tags {floor1 wall}
|
| 566 |
+
$w create line 408 208 475 208 -fill $color -tags {floor1 wall}
|
| 567 |
+
$w create line 484 278 484 311 -fill $color -tags {floor1 wall}
|
| 568 |
+
$w create line 484 311 508 311 -fill $color -tags {floor1 wall}
|
| 569 |
+
$w create line 508 327 508 311 -fill $color -tags {floor1 wall}
|
| 570 |
+
$w create line 559 327 508 327 -fill $color -tags {floor1 wall}
|
| 571 |
+
$w create line 644 391 559 391 -fill $color -tags {floor1 wall}
|
| 572 |
+
$w create line 644 389 644 391 -fill $color -tags {floor1 wall}
|
| 573 |
+
$w create line 514 205 475 205 -fill $color -tags {floor1 wall}
|
| 574 |
+
$w create line 496 189 496 187 -fill $color -tags {floor1 wall}
|
| 575 |
+
$w create line 559 129 484 129 -fill $color -tags {floor1 wall}
|
| 576 |
+
$w create line 484 162 484 129 -fill $color -tags {floor1 wall}
|
| 577 |
+
$w create line 725 133 559 133 -fill $color -tags {floor1 wall}
|
| 578 |
+
$w create line 559 129 559 133 -fill $color -tags {floor1 wall}
|
| 579 |
+
$w create line 725 149 725 167 -fill $color -tags {floor1 wall}
|
| 580 |
+
$w create line 725 129 802 129 -fill $color -tags {floor1 wall}
|
| 581 |
+
$w create line 802 389 802 129 -fill $color -tags {floor1 wall}
|
| 582 |
+
$w create line 739 167 802 167 -fill $color -tags {floor1 wall}
|
| 583 |
+
$w create line 396 188 408 188 -fill $color -tags {floor1 wall}
|
| 584 |
+
$w create line 0 337 9 337 -fill $color -tags {floor1 wall}
|
| 585 |
+
$w create line 58 337 21 337 -fill $color -tags {floor1 wall}
|
| 586 |
+
$w create line 43 391 43 337 -fill $color -tags {floor1 wall}
|
| 587 |
+
$w create line 105 337 75 337 -fill $color -tags {floor1 wall}
|
| 588 |
+
$w create line 91 387 91 337 -fill $color -tags {floor1 wall}
|
| 589 |
+
$w create line 154 337 117 337 -fill $color -tags {floor1 wall}
|
| 590 |
+
$w create line 139 387 139 337 -fill $color -tags {floor1 wall}
|
| 591 |
+
$w create line 227 337 166 337 -fill $color -tags {floor1 wall}
|
| 592 |
+
$w create line 258 337 251 337 -fill $color -tags {floor1 wall}
|
| 593 |
+
$w create line 258 328 302 328 -fill $color -tags {floor1 wall}
|
| 594 |
+
$w create line 302 355 302 311 -fill $color -tags {floor1 wall}
|
| 595 |
+
$w create line 395 311 302 311 -fill $color -tags {floor1 wall}
|
| 596 |
+
$w create line 484 278 395 278 -fill $color -tags {floor1 wall}
|
| 597 |
+
$w create line 395 294 395 278 -fill $color -tags {floor1 wall}
|
| 598 |
+
$w create line 473 278 473 275 -fill $color -tags {floor1 wall}
|
| 599 |
+
$w create line 473 256 473 254 -fill $color -tags {floor1 wall}
|
| 600 |
+
$w create line 533 257 531 254 -fill $color -tags {floor1 wall}
|
| 601 |
+
$w create line 553 276 551 274 -fill $color -tags {floor1 wall}
|
| 602 |
+
$w create line 698 276 553 276 -fill $color -tags {floor1 wall}
|
| 603 |
+
$w create line 559 391 559 327 -fill $color -tags {floor1 wall}
|
| 604 |
+
$w create line 802 389 644 389 -fill $color -tags {floor1 wall}
|
| 605 |
+
$w create line 741 314 741 389 -fill $color -tags {floor1 wall}
|
| 606 |
+
$w create line 698 280 698 167 -fill $color -tags {floor1 wall}
|
| 607 |
+
$w create line 707 280 698 280 -fill $color -tags {floor1 wall}
|
| 608 |
+
$w create line 802 280 731 280 -fill $color -tags {floor1 wall}
|
| 609 |
+
$w create line 741 280 741 302 -fill $color -tags {floor1 wall}
|
| 610 |
+
$w create line 698 167 727 167 -fill $color -tags {floor1 wall}
|
| 611 |
+
$w create line 725 137 725 129 -fill $color -tags {floor1 wall}
|
| 612 |
+
$w create line 514 254 514 175 -fill $color -tags {floor1 wall}
|
| 613 |
+
$w create line 496 175 514 175 -fill $color -tags {floor1 wall}
|
| 614 |
+
$w create line 502 175 502 162 -fill $color -tags {floor1 wall}
|
| 615 |
+
$w create line 475 166 475 162 -fill $color -tags {floor1 wall}
|
| 616 |
+
$w create line 496 176 496 175 -fill $color -tags {floor1 wall}
|
| 617 |
+
$w create line 491 189 496 189 -fill $color -tags {floor1 wall}
|
| 618 |
+
$w create line 491 205 491 189 -fill $color -tags {floor1 wall}
|
| 619 |
+
$w create line 487 238 475 238 -fill $color -tags {floor1 wall}
|
| 620 |
+
$w create line 487 240 487 238 -fill $color -tags {floor1 wall}
|
| 621 |
+
$w create line 487 252 487 254 -fill $color -tags {floor1 wall}
|
| 622 |
+
$w create line 315 133 304 133 -fill $color -tags {floor1 wall}
|
| 623 |
+
$w create line 256 133 280 133 -fill $color -tags {floor1 wall}
|
| 624 |
+
$w create line 78 247 270 247 -fill $color -tags {floor1 wall}
|
| 625 |
+
$w create line 307 247 294 247 -fill $color -tags {floor1 wall}
|
| 626 |
+
$w create line 214 133 232 133 -fill $color -tags {floor1 wall}
|
| 627 |
+
$w create line 217 247 217 266 -fill $color -tags {floor1 wall}
|
| 628 |
+
$w create line 217 309 217 291 -fill $color -tags {floor1 wall}
|
| 629 |
+
$w create line 217 309 172 309 -fill $color -tags {floor1 wall}
|
| 630 |
+
$w create line 154 309 148 309 -fill $color -tags {floor1 wall}
|
| 631 |
+
$w create line 175 300 175 309 -fill $color -tags {floor1 wall}
|
| 632 |
+
$w create line 151 300 175 300 -fill $color -tags {floor1 wall}
|
| 633 |
+
$w create line 151 247 151 309 -fill $color -tags {floor1 wall}
|
| 634 |
+
$w create line 78 237 78 265 -fill $color -tags {floor1 wall}
|
| 635 |
+
$w create line 78 286 78 309 -fill $color -tags {floor1 wall}
|
| 636 |
+
$w create line 106 309 78 309 -fill $color -tags {floor1 wall}
|
| 637 |
+
$w create line 130 309 125 309 -fill $color -tags {floor1 wall}
|
| 638 |
+
$w create line 99 309 99 247 -fill $color -tags {floor1 wall}
|
| 639 |
+
$w create line 127 299 99 299 -fill $color -tags {floor1 wall}
|
| 640 |
+
$w create line 127 309 127 299 -fill $color -tags {floor1 wall}
|
| 641 |
+
$w create line 155 191 137 191 -fill $color -tags {floor1 wall}
|
| 642 |
+
$w create line 137 169 137 191 -fill $color -tags {floor1 wall}
|
| 643 |
+
$w create line 78 171 78 169 -fill $color -tags {floor1 wall}
|
| 644 |
+
$w create line 78 190 78 218 -fill $color -tags {floor1 wall}
|
| 645 |
+
$w create line 86 192 86 169 -fill $color -tags {floor1 wall}
|
| 646 |
+
$w create line 86 192 78 192 -fill $color -tags {floor1 wall}
|
| 647 |
+
$w create line 52 301 3 301 -fill $color -tags {floor1 wall}
|
| 648 |
+
$w create line 52 286 52 301 -fill $color -tags {floor1 wall}
|
| 649 |
+
$w create line 52 252 3 252 -fill $color -tags {floor1 wall}
|
| 650 |
+
$w create line 52 203 3 203 -fill $color -tags {floor1 wall}
|
| 651 |
+
$w create line 3 156 52 156 -fill $color -tags {floor1 wall}
|
| 652 |
+
$w create line 8 25 8 114 -fill $color -tags {floor1 wall}
|
| 653 |
+
$w create line 63 114 3 114 -fill $color -tags {floor1 wall}
|
| 654 |
+
$w create line 75 114 97 114 -fill $color -tags {floor1 wall}
|
| 655 |
+
$w create line 108 114 129 114 -fill $color -tags {floor1 wall}
|
| 656 |
+
$w create line 129 114 129 89 -fill $color -tags {floor1 wall}
|
| 657 |
+
$w create line 52 114 52 128 -fill $color -tags {floor1 wall}
|
| 658 |
+
$w create line 132 89 88 89 -fill $color -tags {floor1 wall}
|
| 659 |
+
$w create line 88 25 88 89 -fill $color -tags {floor1 wall}
|
| 660 |
+
$w create line 88 114 88 89 -fill $color -tags {floor1 wall}
|
| 661 |
+
$w create line 218 89 144 89 -fill $color -tags {floor1 wall}
|
| 662 |
+
$w create line 147 111 147 129 -fill $color -tags {floor1 wall}
|
| 663 |
+
$w create line 162 111 147 111 -fill $color -tags {floor1 wall}
|
| 664 |
+
$w create line 162 109 162 111 -fill $color -tags {floor1 wall}
|
| 665 |
+
$w create line 162 96 162 89 -fill $color -tags {floor1 wall}
|
| 666 |
+
$w create line 218 89 218 94 -fill $color -tags {floor1 wall}
|
| 667 |
+
$w create line 218 89 218 119 -fill $color -tags {floor1 wall}
|
| 668 |
+
$w create line 8 25 88 25 -fill $color -tags {floor1 wall}
|
| 669 |
+
$w create line 258 337 258 328 -fill $color -tags {floor1 wall}
|
| 670 |
+
$w create line 113 129 96 129 -fill $color -tags {floor1 wall}
|
| 671 |
+
$w create line 302 355 258 355 -fill $color -tags {floor1 wall}
|
| 672 |
+
$w create line 386 104 386 129 -fill $color -tags {floor1 wall}
|
| 673 |
+
$w create line 377 100 386 104 -fill $color -tags {floor1 wall}
|
| 674 |
+
$w create line 365 94 377 100 -fill $color -tags {floor1 wall}
|
| 675 |
+
$w create line 350 83 365 94 -fill $color -tags {floor1 wall}
|
| 676 |
+
$w create line 337 70 350 83 -fill $color -tags {floor1 wall}
|
| 677 |
+
$w create line 337 70 323 56 -fill $color -tags {floor1 wall}
|
| 678 |
+
$w create line 312 49 323 56 -fill $color -tags {floor1 wall}
|
| 679 |
+
$w create line 295 40 312 49 -fill $color -tags {floor1 wall}
|
| 680 |
+
$w create line 282 37 295 40 -fill $color -tags {floor1 wall}
|
| 681 |
+
$w create line 260 34 282 37 -fill $color -tags {floor1 wall}
|
| 682 |
+
$w create line 253 34 260 34 -fill $color -tags {floor1 wall}
|
| 683 |
+
$w create line 386 128 386 104 -fill $color -tags {floor1 wall}
|
| 684 |
+
$w create line 113 152 156 152 -fill $color -tags {floor1 wall}
|
| 685 |
+
$w create line 113 152 156 152 -fill $color -tags {floor1 wall}
|
| 686 |
+
$w create line 113 152 113 129 -fill $color -tags {floor1 wall}
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
# fg2 --
|
| 690 |
+
# This procedure represents part of the floorplan database. When
|
| 691 |
+
# invoked, it instantiates the foreground information for the second
|
| 692 |
+
# floor (office outlines and numbers).
|
| 693 |
+
#
|
| 694 |
+
# Arguments:
|
| 695 |
+
# w - The canvas window.
|
| 696 |
+
# color - Color to use for drawing foreground information.
|
| 697 |
+
|
| 698 |
+
proc fg2 {w color} {
|
| 699 |
+
global floorLabels floorItems
|
| 700 |
+
set i [$w create polygon 748 188 755 188 755 205 758 205 758 222 800 222 800 168 748 168 -fill {} -outline {} -tags {floor2 room}]
|
| 701 |
+
set floorLabels($i) 238
|
| 702 |
+
set {floorItems(238)} $i
|
| 703 |
+
$w create text 774 195 -text 238 -fill $color -anchor c -tags {floor2 label}
|
| 704 |
+
set i [$w create polygon 726 188 746 188 746 166 800 166 800 131 726 131 -fill {} -outline {} -tags {floor2 room}]
|
| 705 |
+
set floorLabels($i) 237
|
| 706 |
+
set {floorItems(237)} $i
|
| 707 |
+
$w create text 763 148.5 -text 237 -fill $color -anchor c -tags {floor2 label}
|
| 708 |
+
set i [$w create polygon 497 187 497 204 559 204 559 324 641 324 643 324 643 291 641 291 641 205 696 205 696 291 694 291 694 314 715 314 715 291 715 205 755 205 755 190 724 190 724 187 -fill {} -outline {} -tags {floor2 room}]
|
| 709 |
+
set floorLabels($i) 246
|
| 710 |
+
set {floorItems(246)} $i
|
| 711 |
+
$w create text 600 264 -text 246 -fill $color -anchor c -tags {floor2 label}
|
| 712 |
+
set i [$w create polygon 694 279 643 279 643 314 694 314 -fill {} -outline {} -tags {floor2 room}]
|
| 713 |
+
set floorLabels($i) 247
|
| 714 |
+
set {floorItems(247)} $i
|
| 715 |
+
$w create text 668.5 296.5 -text 247 -fill $color -anchor c -tags {floor2 label}
|
| 716 |
+
set i [$w create polygon 232 250 308 250 308 242 339 242 339 246 397 246 397 255 476 255 476 250 482 250 559 250 559 274 482 274 482 278 396 278 396 274 232 274 -fill {} -outline {} -tags {floor2 room}]
|
| 717 |
+
set floorLabels($i) 202
|
| 718 |
+
set {floorItems(202)} $i
|
| 719 |
+
$w create text 285.5 260 -text 202 -fill $color -anchor c -tags {floor2 label}
|
| 720 |
+
set i [$w create polygon 53 228 53 338 176 338 233 338 233 196 306 196 306 180 175 180 175 169 156 169 156 196 176 196 176 228 -fill {} -outline {} -tags {floor2 room}]
|
| 721 |
+
set floorLabels($i) 206
|
| 722 |
+
set {floorItems(206)} $i
|
| 723 |
+
$w create text 143 267 -text 206 -fill $color -anchor c -tags {floor2 label}
|
| 724 |
+
set i [$w create polygon 51 277 6 277 6 338 51 338 -fill {} -outline {} -tags {floor2 room}]
|
| 725 |
+
set floorLabels($i) 212
|
| 726 |
+
set {floorItems(212)} $i
|
| 727 |
+
$w create text 28.5 307.5 -text 212 -fill $color -anchor c -tags {floor2 label}
|
| 728 |
+
set i [$w create polygon 557 276 486 276 486 309 510 309 510 325 557 325 -fill {} -outline {} -tags {floor2 room}]
|
| 729 |
+
set floorLabels($i) 245
|
| 730 |
+
set {floorItems(245)} $i
|
| 731 |
+
$w create text 521.5 300.5 -text 245 -fill $color -anchor c -tags {floor2 label}
|
| 732 |
+
set i [$w create polygon 560 389 599 389 599 326 560 326 -fill {} -outline {} -tags {floor2 room}]
|
| 733 |
+
set floorLabels($i) 244
|
| 734 |
+
set {floorItems(244)} $i
|
| 735 |
+
$w create text 579.5 357.5 -text 244 -fill $color -anchor c -tags {floor2 label}
|
| 736 |
+
set i [$w create polygon 601 389 601 326 643 326 643 389 -fill {} -outline {} -tags {floor2 room}]
|
| 737 |
+
set floorLabels($i) 243
|
| 738 |
+
set {floorItems(243)} $i
|
| 739 |
+
$w create text 622 357.5 -text 243 -fill $color -anchor c -tags {floor2 label}
|
| 740 |
+
set i [$w create polygon 688 316 645 316 645 365 688 365 -fill {} -outline {} -tags {floor2 room}]
|
| 741 |
+
set floorLabels($i) 242
|
| 742 |
+
set {floorItems(242)} $i
|
| 743 |
+
$w create text 666.5 340.5 -text 242 -fill $color -anchor c -tags {floor2 label}
|
| 744 |
+
set i [$w create polygon 802 367 759 367 759 226 802 226 -fill {} -outline {} -tags {floor2 room}]
|
| 745 |
+
set floorLabels($i) {Barbecue Deck}
|
| 746 |
+
set {floorItems(Barbecue Deck)} $i
|
| 747 |
+
$w create text 780.5 296.5 -text {Barbecue Deck} -fill $color -anchor c -tags {floor2 label}
|
| 748 |
+
set i [$w create polygon 755 262 755 314 717 314 717 262 -fill {} -outline {} -tags {floor2 room}]
|
| 749 |
+
set floorLabels($i) 240
|
| 750 |
+
set {floorItems(240)} $i
|
| 751 |
+
$w create text 736 288 -text 240 -fill $color -anchor c -tags {floor2 label}
|
| 752 |
+
set i [$w create polygon 755 316 689 316 689 365 755 365 -fill {} -outline {} -tags {floor2 room}]
|
| 753 |
+
set floorLabels($i) 241
|
| 754 |
+
set {floorItems(241)} $i
|
| 755 |
+
$w create text 722 340.5 -text 241 -fill $color -anchor c -tags {floor2 label}
|
| 756 |
+
set i [$w create polygon 755 206 717 206 717 261 755 261 -fill {} -outline {} -tags {floor2 room}]
|
| 757 |
+
set floorLabels($i) 239
|
| 758 |
+
set {floorItems(239)} $i
|
| 759 |
+
$w create text 736 233.5 -text 239 -fill $color -anchor c -tags {floor2 label}
|
| 760 |
+
set i [$w create polygon 695 277 643 277 643 206 695 206 -fill {} -outline {} -tags {floor2 room}]
|
| 761 |
+
set floorLabels($i) 248
|
| 762 |
+
set {floorItems(248)} $i
|
| 763 |
+
$w create text 669 241.5 -text 248 -fill $color -anchor c -tags {floor2 label}
|
| 764 |
+
set i [$w create polygon 676 135 676 185 724 185 724 135 -fill {} -outline {} -tags {floor2 room}]
|
| 765 |
+
set floorLabels($i) 236
|
| 766 |
+
set {floorItems(236)} $i
|
| 767 |
+
$w create text 700 160 -text 236 -fill $color -anchor c -tags {floor2 label}
|
| 768 |
+
set i [$w create polygon 675 135 635 135 635 145 628 145 628 185 675 185 -fill {} -outline {} -tags {floor2 room}]
|
| 769 |
+
set floorLabels($i) 235
|
| 770 |
+
set {floorItems(235)} $i
|
| 771 |
+
$w create text 651.5 160 -text 235 -fill $color -anchor c -tags {floor2 label}
|
| 772 |
+
set i [$w create polygon 626 143 633 143 633 135 572 135 572 143 579 143 579 185 626 185 -fill {} -outline {} -tags {floor2 room}]
|
| 773 |
+
set floorLabels($i) 234
|
| 774 |
+
set {floorItems(234)} $i
|
| 775 |
+
$w create text 606 160 -text 234 -fill $color -anchor c -tags {floor2 label}
|
| 776 |
+
set i [$w create polygon 557 135 571 135 571 145 578 145 578 185 527 185 527 131 557 131 -fill {} -outline {} -tags {floor2 room}]
|
| 777 |
+
set floorLabels($i) 233
|
| 778 |
+
set {floorItems(233)} $i
|
| 779 |
+
$w create text 552.5 158 -text 233 -fill $color -anchor c -tags {floor2 label}
|
| 780 |
+
set i [$w create polygon 476 249 557 249 557 205 476 205 -fill {} -outline {} -tags {floor2 room}]
|
| 781 |
+
set floorLabels($i) 230
|
| 782 |
+
set {floorItems(230)} $i
|
| 783 |
+
$w create text 516.5 227 -text 230 -fill $color -anchor c -tags {floor2 label}
|
| 784 |
+
set i [$w create polygon 476 164 486 164 486 131 525 131 525 185 476 185 -fill {} -outline {} -tags {floor2 room}]
|
| 785 |
+
set floorLabels($i) 232
|
| 786 |
+
set {floorItems(232)} $i
|
| 787 |
+
$w create text 500.5 158 -text 232 -fill $color -anchor c -tags {floor2 label}
|
| 788 |
+
set i [$w create polygon 476 186 495 186 495 204 476 204 -fill {} -outline {} -tags {floor2 room}]
|
| 789 |
+
set floorLabels($i) 229
|
| 790 |
+
set {floorItems(229)} $i
|
| 791 |
+
$w create text 485.5 195 -text 229 -fill $color -anchor c -tags {floor2 label}
|
| 792 |
+
set i [$w create polygon 474 207 409 207 409 187 399 187 399 164 474 164 -fill {} -outline {} -tags {floor2 room}]
|
| 793 |
+
set floorLabels($i) 227
|
| 794 |
+
set {floorItems(227)} $i
|
| 795 |
+
$w create text 436.5 185.5 -text 227 -fill $color -anchor c -tags {floor2 label}
|
| 796 |
+
set i [$w create polygon 399 228 399 253 474 253 474 209 409 209 409 228 -fill {} -outline {} -tags {floor2 room}]
|
| 797 |
+
set floorLabels($i) 228
|
| 798 |
+
set {floorItems(228)} $i
|
| 799 |
+
$w create text 436.5 231 -text 228 -fill $color -anchor c -tags {floor2 label}
|
| 800 |
+
set i [$w create polygon 397 246 397 226 407 226 407 189 377 189 377 246 -fill {} -outline {} -tags {floor2 room}]
|
| 801 |
+
set floorLabels($i) 226
|
| 802 |
+
set {floorItems(226)} $i
|
| 803 |
+
$w create text 392 217.5 -text 226 -fill $color -anchor c -tags {floor2 label}
|
| 804 |
+
set i [$w create polygon 377 169 316 169 316 131 397 131 397 188 377 188 -fill {} -outline {} -tags {floor2 room}]
|
| 805 |
+
set floorLabels($i) 225
|
| 806 |
+
set {floorItems(225)} $i
|
| 807 |
+
$w create text 356.5 150 -text 225 -fill $color -anchor c -tags {floor2 label}
|
| 808 |
+
set i [$w create polygon 234 198 306 198 306 249 234 249 -fill {} -outline {} -tags {floor2 room}]
|
| 809 |
+
set floorLabels($i) 224
|
| 810 |
+
set {floorItems(224)} $i
|
| 811 |
+
$w create text 270 223.5 -text 224 -fill $color -anchor c -tags {floor2 label}
|
| 812 |
+
set i [$w create polygon 270 179 306 179 306 170 314 170 314 135 270 135 -fill {} -outline {} -tags {floor2 room}]
|
| 813 |
+
set floorLabels($i) 223
|
| 814 |
+
set {floorItems(223)} $i
|
| 815 |
+
$w create text 292 157 -text 223 -fill $color -anchor c -tags {floor2 label}
|
| 816 |
+
set i [$w create polygon 268 179 221 179 221 135 268 135 -fill {} -outline {} -tags {floor2 room}]
|
| 817 |
+
set floorLabels($i) 222
|
| 818 |
+
set {floorItems(222)} $i
|
| 819 |
+
$w create text 244.5 157 -text 222 -fill $color -anchor c -tags {floor2 label}
|
| 820 |
+
set i [$w create polygon 177 179 219 179 219 135 177 135 -fill {} -outline {} -tags {floor2 room}]
|
| 821 |
+
set floorLabels($i) 221
|
| 822 |
+
set {floorItems(221)} $i
|
| 823 |
+
$w create text 198 157 -text 221 -fill $color -anchor c -tags {floor2 label}
|
| 824 |
+
set i [$w create polygon 299 327 349 327 349 284 341 284 341 276 299 276 -fill {} -outline {} -tags {floor2 room}]
|
| 825 |
+
set floorLabels($i) 204
|
| 826 |
+
set {floorItems(204)} $i
|
| 827 |
+
$w create text 324 301.5 -text 204 -fill $color -anchor c -tags {floor2 label}
|
| 828 |
+
set i [$w create polygon 234 276 297 276 297 327 257 327 257 338 234 338 -fill {} -outline {} -tags {floor2 room}]
|
| 829 |
+
set floorLabels($i) 205
|
| 830 |
+
set {floorItems(205)} $i
|
| 831 |
+
$w create text 265.5 307 -text 205 -fill $color -anchor c -tags {floor2 label}
|
| 832 |
+
set i [$w create polygon 256 385 256 340 212 340 212 385 -fill {} -outline {} -tags {floor2 room}]
|
| 833 |
+
set floorLabels($i) 207
|
| 834 |
+
set {floorItems(207)} $i
|
| 835 |
+
$w create text 234 362.5 -text 207 -fill $color -anchor c -tags {floor2 label}
|
| 836 |
+
set i [$w create polygon 210 340 164 340 164 385 210 385 -fill {} -outline {} -tags {floor2 room}]
|
| 837 |
+
set floorLabels($i) 208
|
| 838 |
+
set {floorItems(208)} $i
|
| 839 |
+
$w create text 187 362.5 -text 208 -fill $color -anchor c -tags {floor2 label}
|
| 840 |
+
set i [$w create polygon 115 340 162 340 162 385 115 385 -fill {} -outline {} -tags {floor2 room}]
|
| 841 |
+
set floorLabels($i) 209
|
| 842 |
+
set {floorItems(209)} $i
|
| 843 |
+
$w create text 138.5 362.5 -text 209 -fill $color -anchor c -tags {floor2 label}
|
| 844 |
+
set i [$w create polygon 89 228 89 156 53 156 53 228 -fill {} -outline {} -tags {floor2 room}]
|
| 845 |
+
set floorLabels($i) 217
|
| 846 |
+
set {floorItems(217)} $i
|
| 847 |
+
$w create text 71 192 -text 217 -fill $color -anchor c -tags {floor2 label}
|
| 848 |
+
set i [$w create polygon 89 169 97 169 97 190 89 190 -fill {} -outline {} -tags {floor2 room}]
|
| 849 |
+
set floorLabels($i) 217A
|
| 850 |
+
set {floorItems(217A)} $i
|
| 851 |
+
$w create text 93 179.5 -text 217A -fill $color -anchor c -tags {floor2 label}
|
| 852 |
+
set i [$w create polygon 89 156 89 168 95 168 95 135 53 135 53 156 -fill {} -outline {} -tags {floor2 room}]
|
| 853 |
+
set floorLabels($i) 216
|
| 854 |
+
set {floorItems(216)} $i
|
| 855 |
+
$w create text 71 145.5 -text 216 -fill $color -anchor c -tags {floor2 label}
|
| 856 |
+
set i [$w create polygon 51 179 51 135 6 135 6 179 -fill {} -outline {} -tags {floor2 room}]
|
| 857 |
+
set floorLabels($i) 215
|
| 858 |
+
set {floorItems(215)} $i
|
| 859 |
+
$w create text 28.5 157 -text 215 -fill $color -anchor c -tags {floor2 label}
|
| 860 |
+
set i [$w create polygon 51 227 6 227 6 180 51 180 -fill {} -outline {} -tags {floor2 room}]
|
| 861 |
+
set floorLabels($i) 214
|
| 862 |
+
set {floorItems(214)} $i
|
| 863 |
+
$w create text 28.5 203.5 -text 214 -fill $color -anchor c -tags {floor2 label}
|
| 864 |
+
set i [$w create polygon 51 275 6 275 6 229 51 229 -fill {} -outline {} -tags {floor2 room}]
|
| 865 |
+
set floorLabels($i) 213
|
| 866 |
+
set {floorItems(213)} $i
|
| 867 |
+
$w create text 28.5 252 -text 213 -fill $color -anchor c -tags {floor2 label}
|
| 868 |
+
set i [$w create polygon 114 340 67 340 67 385 114 385 -fill {} -outline {} -tags {floor2 room}]
|
| 869 |
+
set floorLabels($i) 210
|
| 870 |
+
set {floorItems(210)} $i
|
| 871 |
+
$w create text 90.5 362.5 -text 210 -fill $color -anchor c -tags {floor2 label}
|
| 872 |
+
set i [$w create polygon 59 389 59 385 65 385 65 340 1 340 1 389 -fill {} -outline {} -tags {floor2 room}]
|
| 873 |
+
set floorLabels($i) 211
|
| 874 |
+
set {floorItems(211)} $i
|
| 875 |
+
$w create text 33 364.5 -text 211 -fill $color -anchor c -tags {floor2 label}
|
| 876 |
+
set i [$w create polygon 393 309 350 309 350 282 342 282 342 276 393 276 -fill {} -outline {} -tags {floor2 room}]
|
| 877 |
+
set floorLabels($i) 203
|
| 878 |
+
set {floorItems(203)} $i
|
| 879 |
+
$w create text 367.5 292.5 -text 203 -fill $color -anchor c -tags {floor2 label}
|
| 880 |
+
set i [$w create polygon 99 191 91 191 91 226 174 226 174 198 154 198 154 192 109 192 109 169 99 169 -fill {} -outline {} -tags {floor2 room}]
|
| 881 |
+
set floorLabels($i) 220
|
| 882 |
+
set {floorItems(220)} $i
|
| 883 |
+
$w create text 132.5 208.5 -text 220 -fill $color -anchor c -tags {floor2 label}
|
| 884 |
+
set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor2 room}]
|
| 885 |
+
set floorLabels($i) {Priv Lift2}
|
| 886 |
+
set {floorItems(Priv Lift2)} $i
|
| 887 |
+
$w create text 323 188 -text {Priv Lift2} -fill $color -anchor c -tags {floor2 label}
|
| 888 |
+
set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor2 room}]
|
| 889 |
+
set floorLabels($i) {Pub Lift 2}
|
| 890 |
+
set {floorItems(Pub Lift 2)} $i
|
| 891 |
+
$w create text 323 223 -text {Pub Lift 2} -fill $color -anchor c -tags {floor2 label}
|
| 892 |
+
set i [$w create polygon 175 168 97 168 97 131 175 131 -fill {} -outline {} -tags {floor2 room}]
|
| 893 |
+
set floorLabels($i) 218
|
| 894 |
+
set {floorItems(218)} $i
|
| 895 |
+
$w create text 136 149.5 -text 218 -fill $color -anchor c -tags {floor2 label}
|
| 896 |
+
set i [$w create polygon 154 191 111 191 111 169 154 169 -fill {} -outline {} -tags {floor2 room}]
|
| 897 |
+
set floorLabels($i) 219
|
| 898 |
+
set {floorItems(219)} $i
|
| 899 |
+
$w create text 132.5 180 -text 219 -fill $color -anchor c -tags {floor2 label}
|
| 900 |
+
set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor2 room}]
|
| 901 |
+
set floorLabels($i) 201
|
| 902 |
+
set {floorItems(201)} $i
|
| 903 |
+
$w create text 358 209 -text 201 -fill $color -anchor c -tags {floor2 label}
|
| 904 |
+
$w create line 641 186 678 186 -fill $color -tags {floor2 wall}
|
| 905 |
+
$w create line 757 350 757 367 -fill $color -tags {floor2 wall}
|
| 906 |
+
$w create line 634 133 634 144 -fill $color -tags {floor2 wall}
|
| 907 |
+
$w create line 634 144 627 144 -fill $color -tags {floor2 wall}
|
| 908 |
+
$w create line 572 133 572 144 -fill $color -tags {floor2 wall}
|
| 909 |
+
$w create line 572 144 579 144 -fill $color -tags {floor2 wall}
|
| 910 |
+
$w create line 398 129 398 162 -fill $color -tags {floor2 wall}
|
| 911 |
+
$w create line 174 197 175 197 -fill $color -tags {floor2 wall}
|
| 912 |
+
$w create line 175 197 175 227 -fill $color -tags {floor2 wall}
|
| 913 |
+
$w create line 757 206 757 221 -fill $color -tags {floor2 wall}
|
| 914 |
+
$w create line 396 188 408 188 -fill $color -tags {floor2 wall}
|
| 915 |
+
$w create line 727 189 725 189 -fill $color -tags {floor2 wall}
|
| 916 |
+
$w create line 747 167 802 167 -fill $color -tags {floor2 wall}
|
| 917 |
+
$w create line 747 167 747 189 -fill $color -tags {floor2 wall}
|
| 918 |
+
$w create line 755 189 739 189 -fill $color -tags {floor2 wall}
|
| 919 |
+
$w create line 769 224 757 224 -fill $color -tags {floor2 wall}
|
| 920 |
+
$w create line 802 224 802 129 -fill $color -tags {floor2 wall}
|
| 921 |
+
$w create line 802 129 725 129 -fill $color -tags {floor2 wall}
|
| 922 |
+
$w create line 725 189 725 129 -fill $color -tags {floor2 wall}
|
| 923 |
+
$w create line 725 186 690 186 -fill $color -tags {floor2 wall}
|
| 924 |
+
$w create line 676 133 676 186 -fill $color -tags {floor2 wall}
|
| 925 |
+
$w create line 627 144 627 186 -fill $color -tags {floor2 wall}
|
| 926 |
+
$w create line 629 186 593 186 -fill $color -tags {floor2 wall}
|
| 927 |
+
$w create line 579 144 579 186 -fill $color -tags {floor2 wall}
|
| 928 |
+
$w create line 559 129 559 133 -fill $color -tags {floor2 wall}
|
| 929 |
+
$w create line 725 133 559 133 -fill $color -tags {floor2 wall}
|
| 930 |
+
$w create line 484 162 484 129 -fill $color -tags {floor2 wall}
|
| 931 |
+
$w create line 559 129 484 129 -fill $color -tags {floor2 wall}
|
| 932 |
+
$w create line 526 129 526 186 -fill $color -tags {floor2 wall}
|
| 933 |
+
$w create line 540 186 581 186 -fill $color -tags {floor2 wall}
|
| 934 |
+
$w create line 528 186 523 186 -fill $color -tags {floor2 wall}
|
| 935 |
+
$w create line 511 186 475 186 -fill $color -tags {floor2 wall}
|
| 936 |
+
$w create line 496 190 496 186 -fill $color -tags {floor2 wall}
|
| 937 |
+
$w create line 496 205 496 202 -fill $color -tags {floor2 wall}
|
| 938 |
+
$w create line 475 205 527 205 -fill $color -tags {floor2 wall}
|
| 939 |
+
$w create line 558 205 539 205 -fill $color -tags {floor2 wall}
|
| 940 |
+
$w create line 558 205 558 249 -fill $color -tags {floor2 wall}
|
| 941 |
+
$w create line 558 249 475 249 -fill $color -tags {floor2 wall}
|
| 942 |
+
$w create line 662 206 642 206 -fill $color -tags {floor2 wall}
|
| 943 |
+
$w create line 695 206 675 206 -fill $color -tags {floor2 wall}
|
| 944 |
+
$w create line 695 278 642 278 -fill $color -tags {floor2 wall}
|
| 945 |
+
$w create line 642 291 642 206 -fill $color -tags {floor2 wall}
|
| 946 |
+
$w create line 695 291 695 206 -fill $color -tags {floor2 wall}
|
| 947 |
+
$w create line 716 208 716 206 -fill $color -tags {floor2 wall}
|
| 948 |
+
$w create line 757 206 716 206 -fill $color -tags {floor2 wall}
|
| 949 |
+
$w create line 757 221 757 224 -fill $color -tags {floor2 wall}
|
| 950 |
+
$w create line 793 224 802 224 -fill $color -tags {floor2 wall}
|
| 951 |
+
$w create line 757 262 716 262 -fill $color -tags {floor2 wall}
|
| 952 |
+
$w create line 716 220 716 264 -fill $color -tags {floor2 wall}
|
| 953 |
+
$w create line 716 315 716 276 -fill $color -tags {floor2 wall}
|
| 954 |
+
$w create line 757 315 703 315 -fill $color -tags {floor2 wall}
|
| 955 |
+
$w create line 757 325 757 224 -fill $color -tags {floor2 wall}
|
| 956 |
+
$w create line 757 367 644 367 -fill $color -tags {floor2 wall}
|
| 957 |
+
$w create line 689 367 689 315 -fill $color -tags {floor2 wall}
|
| 958 |
+
$w create line 647 315 644 315 -fill $color -tags {floor2 wall}
|
| 959 |
+
$w create line 659 315 691 315 -fill $color -tags {floor2 wall}
|
| 960 |
+
$w create line 600 325 600 391 -fill $color -tags {floor2 wall}
|
| 961 |
+
$w create line 627 325 644 325 -fill $color -tags {floor2 wall}
|
| 962 |
+
$w create line 644 391 644 315 -fill $color -tags {floor2 wall}
|
| 963 |
+
$w create line 615 325 575 325 -fill $color -tags {floor2 wall}
|
| 964 |
+
$w create line 644 391 558 391 -fill $color -tags {floor2 wall}
|
| 965 |
+
$w create line 563 325 558 325 -fill $color -tags {floor2 wall}
|
| 966 |
+
$w create line 558 391 558 314 -fill $color -tags {floor2 wall}
|
| 967 |
+
$w create line 558 327 508 327 -fill $color -tags {floor2 wall}
|
| 968 |
+
$w create line 558 275 484 275 -fill $color -tags {floor2 wall}
|
| 969 |
+
$w create line 558 302 558 275 -fill $color -tags {floor2 wall}
|
| 970 |
+
$w create line 508 327 508 311 -fill $color -tags {floor2 wall}
|
| 971 |
+
$w create line 484 311 508 311 -fill $color -tags {floor2 wall}
|
| 972 |
+
$w create line 484 275 484 311 -fill $color -tags {floor2 wall}
|
| 973 |
+
$w create line 475 208 408 208 -fill $color -tags {floor2 wall}
|
| 974 |
+
$w create line 408 206 408 210 -fill $color -tags {floor2 wall}
|
| 975 |
+
$w create line 408 222 408 227 -fill $color -tags {floor2 wall}
|
| 976 |
+
$w create line 408 227 398 227 -fill $color -tags {floor2 wall}
|
| 977 |
+
$w create line 398 227 398 254 -fill $color -tags {floor2 wall}
|
| 978 |
+
$w create line 408 188 408 194 -fill $color -tags {floor2 wall}
|
| 979 |
+
$w create line 383 188 376 188 -fill $color -tags {floor2 wall}
|
| 980 |
+
$w create line 398 188 398 162 -fill $color -tags {floor2 wall}
|
| 981 |
+
$w create line 398 162 484 162 -fill $color -tags {floor2 wall}
|
| 982 |
+
$w create line 475 162 475 254 -fill $color -tags {floor2 wall}
|
| 983 |
+
$w create line 398 254 475 254 -fill $color -tags {floor2 wall}
|
| 984 |
+
$w create line 484 280 395 280 -fill $color -tags {floor2 wall}
|
| 985 |
+
$w create line 395 311 395 275 -fill $color -tags {floor2 wall}
|
| 986 |
+
$w create line 307 197 293 197 -fill $color -tags {floor2 wall}
|
| 987 |
+
$w create line 278 197 233 197 -fill $color -tags {floor2 wall}
|
| 988 |
+
$w create line 233 197 233 249 -fill $color -tags {floor2 wall}
|
| 989 |
+
$w create line 307 179 284 179 -fill $color -tags {floor2 wall}
|
| 990 |
+
$w create line 233 249 278 249 -fill $color -tags {floor2 wall}
|
| 991 |
+
$w create line 269 179 269 133 -fill $color -tags {floor2 wall}
|
| 992 |
+
$w create line 220 179 220 133 -fill $color -tags {floor2 wall}
|
| 993 |
+
$w create line 155 191 110 191 -fill $color -tags {floor2 wall}
|
| 994 |
+
$w create line 90 190 98 190 -fill $color -tags {floor2 wall}
|
| 995 |
+
$w create line 98 169 98 190 -fill $color -tags {floor2 wall}
|
| 996 |
+
$w create line 52 133 52 165 -fill $color -tags {floor2 wall}
|
| 997 |
+
$w create line 52 214 52 177 -fill $color -tags {floor2 wall}
|
| 998 |
+
$w create line 52 226 52 262 -fill $color -tags {floor2 wall}
|
| 999 |
+
$w create line 52 274 52 276 -fill $color -tags {floor2 wall}
|
| 1000 |
+
$w create line 234 275 234 339 -fill $color -tags {floor2 wall}
|
| 1001 |
+
$w create line 226 339 258 339 -fill $color -tags {floor2 wall}
|
| 1002 |
+
$w create line 211 387 211 339 -fill $color -tags {floor2 wall}
|
| 1003 |
+
$w create line 214 339 177 339 -fill $color -tags {floor2 wall}
|
| 1004 |
+
$w create line 258 387 60 387 -fill $color -tags {floor2 wall}
|
| 1005 |
+
$w create line 3 133 3 339 -fill $color -tags {floor2 wall}
|
| 1006 |
+
$w create line 165 339 129 339 -fill $color -tags {floor2 wall}
|
| 1007 |
+
$w create line 117 339 80 339 -fill $color -tags {floor2 wall}
|
| 1008 |
+
$w create line 68 339 59 339 -fill $color -tags {floor2 wall}
|
| 1009 |
+
$w create line 0 339 46 339 -fill $color -tags {floor2 wall}
|
| 1010 |
+
$w create line 60 391 0 391 -fill $color -tags {floor2 wall}
|
| 1011 |
+
$w create line 0 339 0 391 -fill $color -tags {floor2 wall}
|
| 1012 |
+
$w create line 60 387 60 391 -fill $color -tags {floor2 wall}
|
| 1013 |
+
$w create line 258 329 258 387 -fill $color -tags {floor2 wall}
|
| 1014 |
+
$w create line 350 329 258 329 -fill $color -tags {floor2 wall}
|
| 1015 |
+
$w create line 395 311 350 311 -fill $color -tags {floor2 wall}
|
| 1016 |
+
$w create line 398 129 315 129 -fill $color -tags {floor2 wall}
|
| 1017 |
+
$w create line 176 133 315 133 -fill $color -tags {floor2 wall}
|
| 1018 |
+
$w create line 176 129 96 129 -fill $color -tags {floor2 wall}
|
| 1019 |
+
$w create line 3 133 96 133 -fill $color -tags {floor2 wall}
|
| 1020 |
+
$w create line 66 387 66 339 -fill $color -tags {floor2 wall}
|
| 1021 |
+
$w create line 115 387 115 339 -fill $color -tags {floor2 wall}
|
| 1022 |
+
$w create line 163 387 163 339 -fill $color -tags {floor2 wall}
|
| 1023 |
+
$w create line 234 275 276 275 -fill $color -tags {floor2 wall}
|
| 1024 |
+
$w create line 288 275 309 275 -fill $color -tags {floor2 wall}
|
| 1025 |
+
$w create line 298 275 298 329 -fill $color -tags {floor2 wall}
|
| 1026 |
+
$w create line 341 283 350 283 -fill $color -tags {floor2 wall}
|
| 1027 |
+
$w create line 321 275 341 275 -fill $color -tags {floor2 wall}
|
| 1028 |
+
$w create line 375 275 395 275 -fill $color -tags {floor2 wall}
|
| 1029 |
+
$w create line 315 129 315 170 -fill $color -tags {floor2 wall}
|
| 1030 |
+
$w create line 376 170 307 170 -fill $color -tags {floor2 wall}
|
| 1031 |
+
$w create line 307 250 307 170 -fill $color -tags {floor2 wall}
|
| 1032 |
+
$w create line 376 245 376 170 -fill $color -tags {floor2 wall}
|
| 1033 |
+
$w create line 340 241 307 241 -fill $color -tags {floor2 wall}
|
| 1034 |
+
$w create line 340 245 340 224 -fill $color -tags {floor2 wall}
|
| 1035 |
+
$w create line 340 210 340 201 -fill $color -tags {floor2 wall}
|
| 1036 |
+
$w create line 340 187 340 170 -fill $color -tags {floor2 wall}
|
| 1037 |
+
$w create line 340 206 307 206 -fill $color -tags {floor2 wall}
|
| 1038 |
+
$w create line 293 250 307 250 -fill $color -tags {floor2 wall}
|
| 1039 |
+
$w create line 271 179 238 179 -fill $color -tags {floor2 wall}
|
| 1040 |
+
$w create line 226 179 195 179 -fill $color -tags {floor2 wall}
|
| 1041 |
+
$w create line 176 129 176 179 -fill $color -tags {floor2 wall}
|
| 1042 |
+
$w create line 182 179 176 179 -fill $color -tags {floor2 wall}
|
| 1043 |
+
$w create line 174 169 176 169 -fill $color -tags {floor2 wall}
|
| 1044 |
+
$w create line 162 169 90 169 -fill $color -tags {floor2 wall}
|
| 1045 |
+
$w create line 96 169 96 129 -fill $color -tags {floor2 wall}
|
| 1046 |
+
$w create line 175 227 90 227 -fill $color -tags {floor2 wall}
|
| 1047 |
+
$w create line 90 190 90 227 -fill $color -tags {floor2 wall}
|
| 1048 |
+
$w create line 52 179 3 179 -fill $color -tags {floor2 wall}
|
| 1049 |
+
$w create line 52 228 3 228 -fill $color -tags {floor2 wall}
|
| 1050 |
+
$w create line 52 276 3 276 -fill $color -tags {floor2 wall}
|
| 1051 |
+
$w create line 155 177 155 169 -fill $color -tags {floor2 wall}
|
| 1052 |
+
$w create line 110 191 110 169 -fill $color -tags {floor2 wall}
|
| 1053 |
+
$w create line 155 189 155 197 -fill $color -tags {floor2 wall}
|
| 1054 |
+
$w create line 350 283 350 329 -fill $color -tags {floor2 wall}
|
| 1055 |
+
$w create line 162 197 155 197 -fill $color -tags {floor2 wall}
|
| 1056 |
+
$w create line 341 275 341 283 -fill $color -tags {floor2 wall}
|
| 1057 |
+
}
|
| 1058 |
+
|
| 1059 |
+
# fg3 --
|
| 1060 |
+
# This procedure represents part of the floorplan database. When
|
| 1061 |
+
# invoked, it instantiates the foreground information for the third
|
| 1062 |
+
# floor (office outlines and numbers).
|
| 1063 |
+
#
|
| 1064 |
+
# Arguments:
|
| 1065 |
+
# w - The canvas window.
|
| 1066 |
+
# color - Color to use for drawing foreground information.
|
| 1067 |
+
|
| 1068 |
+
proc fg3 {w color} {
|
| 1069 |
+
global floorLabels floorItems
|
| 1070 |
+
set i [$w create polygon 89 228 89 180 70 180 70 228 -fill {} -outline {} -tags {floor3 room}]
|
| 1071 |
+
set floorLabels($i) 316
|
| 1072 |
+
set {floorItems(316)} $i
|
| 1073 |
+
$w create text 79.5 204 -text 316 -fill $color -anchor c -tags {floor3 label}
|
| 1074 |
+
set i [$w create polygon 115 368 162 368 162 323 115 323 -fill {} -outline {} -tags {floor3 room}]
|
| 1075 |
+
set floorLabels($i) 309
|
| 1076 |
+
set {floorItems(309)} $i
|
| 1077 |
+
$w create text 138.5 345.5 -text 309 -fill $color -anchor c -tags {floor3 label}
|
| 1078 |
+
set i [$w create polygon 164 323 164 368 211 368 211 323 -fill {} -outline {} -tags {floor3 room}]
|
| 1079 |
+
set floorLabels($i) 308
|
| 1080 |
+
set {floorItems(308)} $i
|
| 1081 |
+
$w create text 187.5 345.5 -text 308 -fill $color -anchor c -tags {floor3 label}
|
| 1082 |
+
set i [$w create polygon 256 368 212 368 212 323 256 323 -fill {} -outline {} -tags {floor3 room}]
|
| 1083 |
+
set floorLabels($i) 307
|
| 1084 |
+
set {floorItems(307)} $i
|
| 1085 |
+
$w create text 234 345.5 -text 307 -fill $color -anchor c -tags {floor3 label}
|
| 1086 |
+
set i [$w create polygon 244 276 297 276 297 327 260 327 260 321 244 321 -fill {} -outline {} -tags {floor3 room}]
|
| 1087 |
+
set floorLabels($i) 305
|
| 1088 |
+
set {floorItems(305)} $i
|
| 1089 |
+
$w create text 270.5 301.5 -text 305 -fill $color -anchor c -tags {floor3 label}
|
| 1090 |
+
set i [$w create polygon 251 219 251 203 244 203 244 219 -fill {} -outline {} -tags {floor3 room}]
|
| 1091 |
+
set floorLabels($i) 324B
|
| 1092 |
+
set {floorItems(324B)} $i
|
| 1093 |
+
$w create text 247.5 211 -text 324B -fill $color -anchor c -tags {floor3 label}
|
| 1094 |
+
set i [$w create polygon 251 249 244 249 244 232 251 232 -fill {} -outline {} -tags {floor3 room}]
|
| 1095 |
+
set floorLabels($i) 324A
|
| 1096 |
+
set {floorItems(324A)} $i
|
| 1097 |
+
$w create text 247.5 240.5 -text 324A -fill $color -anchor c -tags {floor3 label}
|
| 1098 |
+
set i [$w create polygon 223 135 223 179 177 179 177 135 -fill {} -outline {} -tags {floor3 room}]
|
| 1099 |
+
set floorLabels($i) 320
|
| 1100 |
+
set {floorItems(320)} $i
|
| 1101 |
+
$w create text 200 157 -text 320 -fill $color -anchor c -tags {floor3 label}
|
| 1102 |
+
set i [$w create polygon 114 368 114 323 67 323 67 368 -fill {} -outline {} -tags {floor3 room}]
|
| 1103 |
+
set floorLabels($i) 310
|
| 1104 |
+
set {floorItems(310)} $i
|
| 1105 |
+
$w create text 90.5 345.5 -text 310 -fill $color -anchor c -tags {floor3 label}
|
| 1106 |
+
set i [$w create polygon 23 277 23 321 68 321 68 277 -fill {} -outline {} -tags {floor3 room}]
|
| 1107 |
+
set floorLabels($i) 312
|
| 1108 |
+
set {floorItems(312)} $i
|
| 1109 |
+
$w create text 45.5 299 -text 312 -fill $color -anchor c -tags {floor3 label}
|
| 1110 |
+
set i [$w create polygon 23 229 68 229 68 275 23 275 -fill {} -outline {} -tags {floor3 room}]
|
| 1111 |
+
set floorLabels($i) 313
|
| 1112 |
+
set {floorItems(313)} $i
|
| 1113 |
+
$w create text 45.5 252 -text 313 -fill $color -anchor c -tags {floor3 label}
|
| 1114 |
+
set i [$w create polygon 68 227 23 227 23 180 68 180 -fill {} -outline {} -tags {floor3 room}]
|
| 1115 |
+
set floorLabels($i) 314
|
| 1116 |
+
set {floorItems(314)} $i
|
| 1117 |
+
$w create text 45.5 203.5 -text 314 -fill $color -anchor c -tags {floor3 label}
|
| 1118 |
+
set i [$w create polygon 95 179 95 135 23 135 23 179 -fill {} -outline {} -tags {floor3 room}]
|
| 1119 |
+
set floorLabels($i) 315
|
| 1120 |
+
set {floorItems(315)} $i
|
| 1121 |
+
$w create text 59 157 -text 315 -fill $color -anchor c -tags {floor3 label}
|
| 1122 |
+
set i [$w create polygon 99 226 99 204 91 204 91 226 -fill {} -outline {} -tags {floor3 room}]
|
| 1123 |
+
set floorLabels($i) 316B
|
| 1124 |
+
set {floorItems(316B)} $i
|
| 1125 |
+
$w create text 95 215 -text 316B -fill $color -anchor c -tags {floor3 label}
|
| 1126 |
+
set i [$w create polygon 91 202 99 202 99 180 91 180 -fill {} -outline {} -tags {floor3 room}]
|
| 1127 |
+
set floorLabels($i) 316A
|
| 1128 |
+
set {floorItems(316A)} $i
|
| 1129 |
+
$w create text 95 191 -text 316A -fill $color -anchor c -tags {floor3 label}
|
| 1130 |
+
set i [$w create polygon 97 169 109 169 109 192 154 192 154 198 174 198 174 226 101 226 101 179 97 179 -fill {} -outline {} -tags {floor3 room}]
|
| 1131 |
+
set floorLabels($i) 319
|
| 1132 |
+
set {floorItems(319)} $i
|
| 1133 |
+
$w create text 141.5 209 -text 319 -fill $color -anchor c -tags {floor3 label}
|
| 1134 |
+
set i [$w create polygon 65 368 58 368 58 389 1 389 1 333 23 333 23 323 65 323 -fill {} -outline {} -tags {floor3 room}]
|
| 1135 |
+
set floorLabels($i) 311
|
| 1136 |
+
set {floorItems(311)} $i
|
| 1137 |
+
$w create text 29.5 361 -text 311 -fill $color -anchor c -tags {floor3 label}
|
| 1138 |
+
set i [$w create polygon 154 191 111 191 111 169 154 169 -fill {} -outline {} -tags {floor3 room}]
|
| 1139 |
+
set floorLabels($i) 318
|
| 1140 |
+
set {floorItems(318)} $i
|
| 1141 |
+
$w create text 132.5 180 -text 318 -fill $color -anchor c -tags {floor3 label}
|
| 1142 |
+
set i [$w create polygon 175 168 97 168 97 131 175 131 -fill {} -outline {} -tags {floor3 room}]
|
| 1143 |
+
set floorLabels($i) 317
|
| 1144 |
+
set {floorItems(317)} $i
|
| 1145 |
+
$w create text 136 149.5 -text 317 -fill $color -anchor c -tags {floor3 label}
|
| 1146 |
+
set i [$w create polygon 274 194 274 221 306 221 306 194 -fill {} -outline {} -tags {floor3 room}]
|
| 1147 |
+
set floorLabels($i) 323
|
| 1148 |
+
set {floorItems(323)} $i
|
| 1149 |
+
$w create text 290 207.5 -text 323 -fill $color -anchor c -tags {floor3 label}
|
| 1150 |
+
set i [$w create polygon 306 222 274 222 274 249 306 249 -fill {} -outline {} -tags {floor3 room}]
|
| 1151 |
+
set floorLabels($i) 325
|
| 1152 |
+
set {floorItems(325)} $i
|
| 1153 |
+
$w create text 290 235.5 -text 325 -fill $color -anchor c -tags {floor3 label}
|
| 1154 |
+
set i [$w create polygon 263 179 224 179 224 135 263 135 -fill {} -outline {} -tags {floor3 room}]
|
| 1155 |
+
set floorLabels($i) 321
|
| 1156 |
+
set {floorItems(321)} $i
|
| 1157 |
+
$w create text 243.5 157 -text 321 -fill $color -anchor c -tags {floor3 label}
|
| 1158 |
+
set i [$w create polygon 314 169 306 169 306 192 273 192 264 181 264 135 314 135 -fill {} -outline {} -tags {floor3 room}]
|
| 1159 |
+
set floorLabels($i) 322
|
| 1160 |
+
set {floorItems(322)} $i
|
| 1161 |
+
$w create text 293.5 163.5 -text 322 -fill $color -anchor c -tags {floor3 label}
|
| 1162 |
+
set i [$w create polygon 307 240 339 240 339 206 307 206 -fill {} -outline {} -tags {floor3 room}]
|
| 1163 |
+
set floorLabels($i) {Pub Lift3}
|
| 1164 |
+
set {floorItems(Pub Lift3)} $i
|
| 1165 |
+
$w create text 323 223 -text {Pub Lift3} -fill $color -anchor c -tags {floor3 label}
|
| 1166 |
+
set i [$w create polygon 339 205 307 205 307 171 339 171 -fill {} -outline {} -tags {floor3 room}]
|
| 1167 |
+
set floorLabels($i) {Priv Lift3}
|
| 1168 |
+
set {floorItems(Priv Lift3)} $i
|
| 1169 |
+
$w create text 323 188 -text {Priv Lift3} -fill $color -anchor c -tags {floor3 label}
|
| 1170 |
+
set i [$w create polygon 350 284 376 284 376 276 397 276 397 309 350 309 -fill {} -outline {} -tags {floor3 room}]
|
| 1171 |
+
set floorLabels($i) 303
|
| 1172 |
+
set {floorItems(303)} $i
|
| 1173 |
+
$w create text 373.5 292.5 -text 303 -fill $color -anchor c -tags {floor3 label}
|
| 1174 |
+
set i [$w create polygon 272 203 272 249 252 249 252 230 244 230 244 221 252 221 252 203 -fill {} -outline {} -tags {floor3 room}]
|
| 1175 |
+
set floorLabels($i) 324
|
| 1176 |
+
set {floorItems(324)} $i
|
| 1177 |
+
$w create text 262 226 -text 324 -fill $color -anchor c -tags {floor3 label}
|
| 1178 |
+
set i [$w create polygon 299 276 299 327 349 327 349 284 341 284 341 276 -fill {} -outline {} -tags {floor3 room}]
|
| 1179 |
+
set floorLabels($i) 304
|
| 1180 |
+
set {floorItems(304)} $i
|
| 1181 |
+
$w create text 324 301.5 -text 304 -fill $color -anchor c -tags {floor3 label}
|
| 1182 |
+
set i [$w create polygon 375 246 375 172 341 172 341 246 -fill {} -outline {} -tags {floor3 room}]
|
| 1183 |
+
set floorLabels($i) 301
|
| 1184 |
+
set {floorItems(301)} $i
|
| 1185 |
+
$w create text 358 209 -text 301 -fill $color -anchor c -tags {floor3 label}
|
| 1186 |
+
set i [$w create polygon 397 246 377 246 377 185 397 185 -fill {} -outline {} -tags {floor3 room}]
|
| 1187 |
+
set floorLabels($i) 327
|
| 1188 |
+
set {floorItems(327)} $i
|
| 1189 |
+
$w create text 387 215.5 -text 327 -fill $color -anchor c -tags {floor3 label}
|
| 1190 |
+
set i [$w create polygon 316 131 316 169 377 169 377 185 397 185 397 131 -fill {} -outline {} -tags {floor3 room}]
|
| 1191 |
+
set floorLabels($i) 326
|
| 1192 |
+
set {floorItems(326)} $i
|
| 1193 |
+
$w create text 356.5 150 -text 326 -fill $color -anchor c -tags {floor3 label}
|
| 1194 |
+
set i [$w create polygon 308 251 242 251 242 274 342 274 342 282 375 282 375 274 397 274 397 248 339 248 339 242 308 242 -fill {} -outline {} -tags {floor3 room}]
|
| 1195 |
+
set floorLabels($i) 302
|
| 1196 |
+
set {floorItems(302)} $i
|
| 1197 |
+
$w create text 319.5 261 -text 302 -fill $color -anchor c -tags {floor3 label}
|
| 1198 |
+
set i [$w create polygon 70 321 242 321 242 200 259 200 259 203 272 203 272 193 263 180 242 180 175 180 175 169 156 169 156 196 177 196 177 228 107 228 70 228 70 275 107 275 107 248 160 248 160 301 107 301 107 275 70 275 -fill {} -outline {} -tags {floor3 room}]
|
| 1199 |
+
set floorLabels($i) 306
|
| 1200 |
+
set {floorItems(306)} $i
|
| 1201 |
+
$w create text 200.5 284.5 -text 306 -fill $color -anchor c -tags {floor3 label}
|
| 1202 |
+
$w create line 341 275 341 283 -fill $color -tags {floor3 wall}
|
| 1203 |
+
$w create line 162 197 155 197 -fill $color -tags {floor3 wall}
|
| 1204 |
+
$w create line 396 247 399 247 -fill $color -tags {floor3 wall}
|
| 1205 |
+
$w create line 399 129 399 311 -fill $color -tags {floor3 wall}
|
| 1206 |
+
$w create line 258 202 243 202 -fill $color -tags {floor3 wall}
|
| 1207 |
+
$w create line 350 283 350 329 -fill $color -tags {floor3 wall}
|
| 1208 |
+
$w create line 251 231 243 231 -fill $color -tags {floor3 wall}
|
| 1209 |
+
$w create line 243 220 251 220 -fill $color -tags {floor3 wall}
|
| 1210 |
+
$w create line 243 250 243 202 -fill $color -tags {floor3 wall}
|
| 1211 |
+
$w create line 155 197 155 190 -fill $color -tags {floor3 wall}
|
| 1212 |
+
$w create line 110 192 110 169 -fill $color -tags {floor3 wall}
|
| 1213 |
+
$w create line 155 192 110 192 -fill $color -tags {floor3 wall}
|
| 1214 |
+
$w create line 155 177 155 169 -fill $color -tags {floor3 wall}
|
| 1215 |
+
$w create line 176 197 176 227 -fill $color -tags {floor3 wall}
|
| 1216 |
+
$w create line 69 280 69 274 -fill $color -tags {floor3 wall}
|
| 1217 |
+
$w create line 21 276 69 276 -fill $color -tags {floor3 wall}
|
| 1218 |
+
$w create line 69 262 69 226 -fill $color -tags {floor3 wall}
|
| 1219 |
+
$w create line 21 228 69 228 -fill $color -tags {floor3 wall}
|
| 1220 |
+
$w create line 21 179 75 179 -fill $color -tags {floor3 wall}
|
| 1221 |
+
$w create line 69 179 69 214 -fill $color -tags {floor3 wall}
|
| 1222 |
+
$w create line 90 220 90 227 -fill $color -tags {floor3 wall}
|
| 1223 |
+
$w create line 90 204 90 202 -fill $color -tags {floor3 wall}
|
| 1224 |
+
$w create line 90 203 100 203 -fill $color -tags {floor3 wall}
|
| 1225 |
+
$w create line 90 187 90 179 -fill $color -tags {floor3 wall}
|
| 1226 |
+
$w create line 90 227 176 227 -fill $color -tags {floor3 wall}
|
| 1227 |
+
$w create line 100 179 100 227 -fill $color -tags {floor3 wall}
|
| 1228 |
+
$w create line 100 179 87 179 -fill $color -tags {floor3 wall}
|
| 1229 |
+
$w create line 96 179 96 129 -fill $color -tags {floor3 wall}
|
| 1230 |
+
$w create line 162 169 96 169 -fill $color -tags {floor3 wall}
|
| 1231 |
+
$w create line 173 169 176 169 -fill $color -tags {floor3 wall}
|
| 1232 |
+
$w create line 182 179 176 179 -fill $color -tags {floor3 wall}
|
| 1233 |
+
$w create line 176 129 176 179 -fill $color -tags {floor3 wall}
|
| 1234 |
+
$w create line 195 179 226 179 -fill $color -tags {floor3 wall}
|
| 1235 |
+
$w create line 224 133 224 179 -fill $color -tags {floor3 wall}
|
| 1236 |
+
$w create line 264 179 264 133 -fill $color -tags {floor3 wall}
|
| 1237 |
+
$w create line 238 179 264 179 -fill $color -tags {floor3 wall}
|
| 1238 |
+
$w create line 273 207 273 193 -fill $color -tags {floor3 wall}
|
| 1239 |
+
$w create line 273 235 273 250 -fill $color -tags {floor3 wall}
|
| 1240 |
+
$w create line 273 224 273 219 -fill $color -tags {floor3 wall}
|
| 1241 |
+
$w create line 273 193 307 193 -fill $color -tags {floor3 wall}
|
| 1242 |
+
$w create line 273 222 307 222 -fill $color -tags {floor3 wall}
|
| 1243 |
+
$w create line 273 250 307 250 -fill $color -tags {floor3 wall}
|
| 1244 |
+
$w create line 384 247 376 247 -fill $color -tags {floor3 wall}
|
| 1245 |
+
$w create line 340 206 307 206 -fill $color -tags {floor3 wall}
|
| 1246 |
+
$w create line 340 187 340 170 -fill $color -tags {floor3 wall}
|
| 1247 |
+
$w create line 340 210 340 201 -fill $color -tags {floor3 wall}
|
| 1248 |
+
$w create line 340 247 340 224 -fill $color -tags {floor3 wall}
|
| 1249 |
+
$w create line 340 241 307 241 -fill $color -tags {floor3 wall}
|
| 1250 |
+
$w create line 376 247 376 170 -fill $color -tags {floor3 wall}
|
| 1251 |
+
$w create line 307 250 307 170 -fill $color -tags {floor3 wall}
|
| 1252 |
+
$w create line 376 170 307 170 -fill $color -tags {floor3 wall}
|
| 1253 |
+
$w create line 315 129 315 170 -fill $color -tags {floor3 wall}
|
| 1254 |
+
$w create line 376 283 366 283 -fill $color -tags {floor3 wall}
|
| 1255 |
+
$w create line 376 283 376 275 -fill $color -tags {floor3 wall}
|
| 1256 |
+
$w create line 399 275 376 275 -fill $color -tags {floor3 wall}
|
| 1257 |
+
$w create line 341 275 320 275 -fill $color -tags {floor3 wall}
|
| 1258 |
+
$w create line 341 283 350 283 -fill $color -tags {floor3 wall}
|
| 1259 |
+
$w create line 298 275 298 329 -fill $color -tags {floor3 wall}
|
| 1260 |
+
$w create line 308 275 298 275 -fill $color -tags {floor3 wall}
|
| 1261 |
+
$w create line 243 322 243 275 -fill $color -tags {floor3 wall}
|
| 1262 |
+
$w create line 243 275 284 275 -fill $color -tags {floor3 wall}
|
| 1263 |
+
$w create line 258 322 226 322 -fill $color -tags {floor3 wall}
|
| 1264 |
+
$w create line 212 370 212 322 -fill $color -tags {floor3 wall}
|
| 1265 |
+
$w create line 214 322 177 322 -fill $color -tags {floor3 wall}
|
| 1266 |
+
$w create line 163 370 163 322 -fill $color -tags {floor3 wall}
|
| 1267 |
+
$w create line 165 322 129 322 -fill $color -tags {floor3 wall}
|
| 1268 |
+
$w create line 84 322 117 322 -fill $color -tags {floor3 wall}
|
| 1269 |
+
$w create line 71 322 64 322 -fill $color -tags {floor3 wall}
|
| 1270 |
+
$w create line 115 322 115 370 -fill $color -tags {floor3 wall}
|
| 1271 |
+
$w create line 66 322 66 370 -fill $color -tags {floor3 wall}
|
| 1272 |
+
$w create line 52 322 21 322 -fill $color -tags {floor3 wall}
|
| 1273 |
+
$w create line 21 331 0 331 -fill $color -tags {floor3 wall}
|
| 1274 |
+
$w create line 21 331 21 133 -fill $color -tags {floor3 wall}
|
| 1275 |
+
$w create line 96 133 21 133 -fill $color -tags {floor3 wall}
|
| 1276 |
+
$w create line 176 129 96 129 -fill $color -tags {floor3 wall}
|
| 1277 |
+
$w create line 315 133 176 133 -fill $color -tags {floor3 wall}
|
| 1278 |
+
$w create line 315 129 399 129 -fill $color -tags {floor3 wall}
|
| 1279 |
+
$w create line 399 311 350 311 -fill $color -tags {floor3 wall}
|
| 1280 |
+
$w create line 350 329 258 329 -fill $color -tags {floor3 wall}
|
| 1281 |
+
$w create line 258 322 258 370 -fill $color -tags {floor3 wall}
|
| 1282 |
+
$w create line 60 370 258 370 -fill $color -tags {floor3 wall}
|
| 1283 |
+
$w create line 60 370 60 391 -fill $color -tags {floor3 wall}
|
| 1284 |
+
$w create line 0 391 0 331 -fill $color -tags {floor3 wall}
|
| 1285 |
+
$w create line 60 391 0 391 -fill $color -tags {floor3 wall}
|
| 1286 |
+
$w create line 307 250 307 242 -fill $color -tags {floor3 wall}
|
| 1287 |
+
$w create line 273 250 307 250 -fill $color -tags {floor3 wall}
|
| 1288 |
+
$w create line 258 250 243 250 -fill $color -tags {floor3 wall}
|
| 1289 |
+
}
|
| 1290 |
+
|
| 1291 |
+
# Below is the "main program" that creates the floorplan demonstration.
|
| 1292 |
+
|
| 1293 |
+
set w .floor
|
| 1294 |
+
global c currentRoom colors activeFloor
|
| 1295 |
+
catch {destroy $w}
|
| 1296 |
+
toplevel $w
|
| 1297 |
+
wm title $w "Floorplan Canvas Demonstration"
|
| 1298 |
+
wm iconname $w "Floorplan"
|
| 1299 |
+
wm geometry $w +20+20
|
| 1300 |
+
wm minsize $w 100 100
|
| 1301 |
+
|
| 1302 |
+
label $w.msg -font $font -wraplength 8i -justify left -text "This window contains a canvas widget showing the floorplan of Digital Equipment Corporation's Western Research Laboratory. It has three levels. At any given time one of the levels is active, meaning that you can see its room structure. To activate a level, click the left mouse button anywhere on it. As the mouse moves over the active level, the room under the mouse lights up and its room number appears in the \"Room:\" entry. You can also type a room number in the entry and the room will light up."
|
| 1303 |
+
pack $w.msg -side top
|
| 1304 |
+
|
| 1305 |
+
## See Code / Dismiss buttons
|
| 1306 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 1307 |
+
pack $btns -side bottom -fill x
|
| 1308 |
+
|
| 1309 |
+
set f [frame $w.frame]
|
| 1310 |
+
pack $f -side top -fill both -expand yes
|
| 1311 |
+
set h [ttk::scrollbar $f.hscroll -orient horizontal]
|
| 1312 |
+
set v [ttk::scrollbar $f.vscroll -orient vertical]
|
| 1313 |
+
set f1 [frame $f.f1 -borderwidth 2 -relief sunken]
|
| 1314 |
+
set c [canvas $f1.c -width 900 -height 500 -highlightthickness 0 \
|
| 1315 |
+
-xscrollcommand [list $h set] \
|
| 1316 |
+
-yscrollcommand [list $v set]]
|
| 1317 |
+
pack $c -expand yes -fill both
|
| 1318 |
+
grid $f1 -padx 1 -pady 1 -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
|
| 1319 |
+
grid $v -padx 1 -pady 1 -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
|
| 1320 |
+
grid $h -padx 1 -pady 1 -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
|
| 1321 |
+
grid rowconfig $f 0 -weight 1 -minsize 0
|
| 1322 |
+
grid columnconfig $f 0 -weight 1 -minsize 0
|
| 1323 |
+
pack $f -expand yes -fill both -padx 1 -pady 1
|
| 1324 |
+
|
| 1325 |
+
$v configure -command [list $c yview]
|
| 1326 |
+
$h configure -command [list $c xview]
|
| 1327 |
+
|
| 1328 |
+
# Create an entry for displaying and typing in current room.
|
| 1329 |
+
|
| 1330 |
+
entry $c.entry -width 10 -textvariable currentRoom
|
| 1331 |
+
|
| 1332 |
+
# Choose colors, then fill in the floorplan.
|
| 1333 |
+
|
| 1334 |
+
if {[winfo depth $c] > 1} {
|
| 1335 |
+
set colors(bg1) #a9c1da
|
| 1336 |
+
set colors(outline1) #77889a
|
| 1337 |
+
set colors(bg2) #9ab0c6
|
| 1338 |
+
set colors(outline2) #687786
|
| 1339 |
+
set colors(bg3) #8ba0b3
|
| 1340 |
+
set colors(outline3) #596673
|
| 1341 |
+
set colors(offices) Black
|
| 1342 |
+
set colors(active) #c4d1df
|
| 1343 |
+
} else {
|
| 1344 |
+
set colors(bg1) white
|
| 1345 |
+
set colors(outline1) black
|
| 1346 |
+
set colors(bg2) white
|
| 1347 |
+
set colors(outline2) black
|
| 1348 |
+
set colors(bg3) white
|
| 1349 |
+
set colors(outline3) black
|
| 1350 |
+
set colors(offices) Black
|
| 1351 |
+
set colors(active) black
|
| 1352 |
+
}
|
| 1353 |
+
set activeFloor ""
|
| 1354 |
+
floorDisplay $c 3
|
| 1355 |
+
|
| 1356 |
+
# Set up event bindings for canvas:
|
| 1357 |
+
|
| 1358 |
+
$c bind floor1 <Button-1> "floorDisplay $c 1"
|
| 1359 |
+
$c bind floor2 <Button-1> "floorDisplay $c 2"
|
| 1360 |
+
$c bind floor3 <Button-1> "floorDisplay $c 3"
|
| 1361 |
+
$c bind room <Enter> "newRoom $c"
|
| 1362 |
+
$c bind room <Leave> {set currentRoom ""}
|
| 1363 |
+
if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
|
| 1364 |
+
bind $c <Button-3> "$c scan mark %x %y"
|
| 1365 |
+
bind $c <B3-Motion> "$c scan dragto %x %y"
|
| 1366 |
+
} else {
|
| 1367 |
+
bind $c <Button-2> "$c scan mark %x %y"
|
| 1368 |
+
bind $c <B2-Motion> "$c scan dragto %x %y"
|
| 1369 |
+
}
|
| 1370 |
+
bind $c <Destroy> "unset currentRoom"
|
| 1371 |
+
set currentRoom ""
|
| 1372 |
+
trace add variable currentRoom write "roomChanged $c"
|
evalkit_llava/lib/tk8.6/demos/form.tcl
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# form.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a simple form with a bunch
|
| 4 |
+
# of entry widgets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .form
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Form Demonstration"
|
| 16 |
+
wm iconname $w "form"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "This window contains a simple form where you can type in the various entries and use tabs to move circularly between the entries."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
foreach i {f1 f2 f3 f4 f5} {
|
| 27 |
+
frame $w.$i -bd 2
|
| 28 |
+
entry $w.$i.entry -relief sunken -width 40
|
| 29 |
+
label $w.$i.label
|
| 30 |
+
pack $w.$i.entry -side right
|
| 31 |
+
pack $w.$i.label -side left
|
| 32 |
+
}
|
| 33 |
+
$w.f1.label config -text Name:
|
| 34 |
+
$w.f2.label config -text Address:
|
| 35 |
+
$w.f5.label config -text Phone:
|
| 36 |
+
pack $w.msg $w.f1 $w.f2 $w.f3 $w.f4 $w.f5 -side top -fill x
|
| 37 |
+
bind $w <Return> "destroy $w"
|
| 38 |
+
focus $w.f1.entry
|
evalkit_llava/lib/tk8.6/demos/goldberg.tcl
ADDED
|
@@ -0,0 +1,1834 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##+#################################################################
|
| 2 |
+
#
|
| 3 |
+
# TkGoldberg.tcl
|
| 4 |
+
# by Keith Vetter, March 13, 2003
|
| 5 |
+
#
|
| 6 |
+
# "Man will always find a difficult means to perform a simple task"
|
| 7 |
+
# Rube Goldberg
|
| 8 |
+
#
|
| 9 |
+
# Reproduced here with permission.
|
| 10 |
+
#
|
| 11 |
+
##+#################################################################
|
| 12 |
+
#
|
| 13 |
+
# Keith Vetter 2003-03-21: this started out as a simple little program
|
| 14 |
+
# but was so much fun that it grew and grew. So I apologize about the
|
| 15 |
+
# size but I just couldn't resist sharing it.
|
| 16 |
+
#
|
| 17 |
+
# This is a whizzlet that does a Rube Goldberg type animation, the
|
| 18 |
+
# design of which comes from an New Years e-card from IncrediMail.
|
| 19 |
+
# That version had nice sound effects which I eschewed. On the other
|
| 20 |
+
# hand, that version was in black and white (actually dark blue and
|
| 21 |
+
# light blue) and this one is fully colorized.
|
| 22 |
+
#
|
| 23 |
+
# One thing I learned from this project is that drawing filled complex
|
| 24 |
+
# objects on a canvas is really hard. More often than not I had to
|
| 25 |
+
# draw each item twice--once with the desired fill color but no
|
| 26 |
+
# outline, and once with no fill but with the outline. Another trick
|
| 27 |
+
# is erasing by drawing with the background color. Having a flood fill
|
| 28 |
+
# command would have been extremely helpful.
|
| 29 |
+
#
|
| 30 |
+
# Two wiki pages were extremely helpful: Drawing rounded rectangles
|
| 31 |
+
# which I generalized into Drawing rounded polygons, and regular
|
| 32 |
+
# polygons which allowed me to convert ovals and arcs into polygons
|
| 33 |
+
# which could then be rotated (see Canvas Rotation). I also wrote
|
| 34 |
+
# Named Colors to aid in the color selection.
|
| 35 |
+
#
|
| 36 |
+
# I could comment on the code, but it's just 26 state machines with
|
| 37 |
+
# lots of canvas create and move calls.
|
| 38 |
+
|
| 39 |
+
if {![info exists widgetDemo]} {
|
| 40 |
+
error "This script should be run from the \"widget\" demo."
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
package require Tk
|
| 44 |
+
|
| 45 |
+
set w .goldberg
|
| 46 |
+
catch {destroy $w}
|
| 47 |
+
toplevel $w
|
| 48 |
+
wm title $w "Tk Goldberg (demonstration)"
|
| 49 |
+
wm iconname $w "goldberg"
|
| 50 |
+
wm resizable $w 0 0
|
| 51 |
+
#positionWindow $w
|
| 52 |
+
|
| 53 |
+
label $w.msg -font {Arial 10} -wraplength 4i -justify left -text "This is a\
|
| 54 |
+
demonstration of just how complex you can make your animations\
|
| 55 |
+
become. Click the ball to start things moving!\n\n\"Man will always\
|
| 56 |
+
find a difficult means to perform a simple task\"\n - Rube Goldberg"
|
| 57 |
+
pack $w.msg -side top
|
| 58 |
+
|
| 59 |
+
###--- End of Boilerplate ---###
|
| 60 |
+
|
| 61 |
+
# Ensure that this this is an array
|
| 62 |
+
array set animationCallbacks {}
|
| 63 |
+
bind $w <Destroy> {
|
| 64 |
+
if {"%W" eq [winfo toplevel %W]} {
|
| 65 |
+
unset S C speed
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
set S(title) "Tk Goldberg"
|
| 70 |
+
set S(speed) 5
|
| 71 |
+
set S(cnt) 0
|
| 72 |
+
set S(message) "\\nWelcome\\nto\\nTcl/Tk"
|
| 73 |
+
array set speed {1 10 2 20 3 50 4 80 5 100 6 150 7 200 8 300 9 400 10 500}
|
| 74 |
+
|
| 75 |
+
set MSTART 0; set MGO 1; set MPAUSE 2; set MSSTEP 3; set MBSTEP 4; set MDONE 5
|
| 76 |
+
set S(mode) $::MSTART
|
| 77 |
+
|
| 78 |
+
# Colors for everything
|
| 79 |
+
set C(fg) black
|
| 80 |
+
set C(bg) cornflowerblue
|
| 81 |
+
|
| 82 |
+
set C(0) white; set C(1a) darkgreen; set C(1b) yellow
|
| 83 |
+
set C(2) red; set C(3a) green; set C(3b) darkblue
|
| 84 |
+
set C(4) $C(fg); set C(5a) brown; set C(5b) white
|
| 85 |
+
set C(6) magenta; set C(7) green; set C(8) $C(fg)
|
| 86 |
+
set C(9) blue4; set C(10a) white; set C(10b) cyan
|
| 87 |
+
set C(11a) yellow; set C(11b) mediumblue; set C(12) tan2
|
| 88 |
+
set C(13a) yellow; set C(13b) red; set C(14) white
|
| 89 |
+
set C(15a) green; set C(15b) yellow; set C(16) gray65
|
| 90 |
+
set C(17) \#A65353; set C(18) $C(fg); set C(19) gray50
|
| 91 |
+
set C(20) cyan; set C(21) gray65; set C(22) $C(20)
|
| 92 |
+
set C(23a) blue; set C(23b) red; set C(23c) yellow
|
| 93 |
+
set C(24a) red; set C(24b) white;
|
| 94 |
+
set C(24c) black; set C(26) $C(0);
|
| 95 |
+
|
| 96 |
+
proc DoDisplay {w} {
|
| 97 |
+
global S C
|
| 98 |
+
|
| 99 |
+
ttk::frame $w.ctrl -relief ridge -borderwidth 2 -padding 5
|
| 100 |
+
pack [frame $w.screen -bd 2 -relief raised] \
|
| 101 |
+
-side left -fill both -expand 1
|
| 102 |
+
|
| 103 |
+
canvas $w.c -width 860 -height 730 -bg $C(bg) -highlightthickness 0
|
| 104 |
+
$w.c config -scrollregion {0 0 1000 1000} ;# Kludge: move everything up
|
| 105 |
+
$w.c yview moveto .05
|
| 106 |
+
pack $w.c -in $w.screen -side top -fill both -expand 1
|
| 107 |
+
|
| 108 |
+
bind $w.c <Button-3> [list $w.pause invoke]
|
| 109 |
+
bind $w.c <Destroy> {
|
| 110 |
+
after cancel $animationCallbacks(goldberg)
|
| 111 |
+
unset animationCallbacks(goldberg)
|
| 112 |
+
}
|
| 113 |
+
DoCtrlFrame $w
|
| 114 |
+
DoDetailFrame $w
|
| 115 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 116 |
+
ttk::button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2
|
| 117 |
+
} else {
|
| 118 |
+
button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
|
| 119 |
+
}
|
| 120 |
+
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
|
| 121 |
+
update
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
proc DoCtrlFrame {w} {
|
| 125 |
+
global S
|
| 126 |
+
ttk::button $w.start -text "Start" -command [list DoButton $w 0]
|
| 127 |
+
ttk::checkbutton $w.pause -text "Pause" -command [list DoButton $w 1] \
|
| 128 |
+
-variable S(pause)
|
| 129 |
+
ttk::button $w.step -text "Single Step" -command [list DoButton $w 2]
|
| 130 |
+
ttk::button $w.bstep -text "Big Step" -command [list DoButton $w 4]
|
| 131 |
+
ttk::button $w.reset -text "Reset" -command [list DoButton $w 3]
|
| 132 |
+
ttk::labelframe $w.details
|
| 133 |
+
raise $w.details
|
| 134 |
+
set S(details) 0
|
| 135 |
+
ttk::checkbutton $w.details.cb -text "Details" -variable S(details)
|
| 136 |
+
ttk::labelframe $w.message -text "Message"
|
| 137 |
+
ttk::entry $w.message.e -textvariable S(message) -justify center
|
| 138 |
+
ttk::labelframe $w.speed -text "Speed: 0"
|
| 139 |
+
ttk::scale $w.speed.scale -orient horizontal -from 1 -to 10 -variable S(speed)
|
| 140 |
+
ttk::button $w.about -text About -command [list About $w]
|
| 141 |
+
|
| 142 |
+
grid $w.start -in $w.ctrl -row 0 -sticky ew
|
| 143 |
+
grid rowconfigure $w.ctrl 1 -minsize 10
|
| 144 |
+
grid $w.pause -in $w.ctrl -row 2 -sticky ew
|
| 145 |
+
grid $w.step -in $w.ctrl -sticky ew -pady 2
|
| 146 |
+
grid $w.bstep -in $w.ctrl -sticky ew
|
| 147 |
+
grid $w.reset -in $w.ctrl -sticky ew -pady 2
|
| 148 |
+
grid rowconfigure $w.ctrl 10 -minsize 18
|
| 149 |
+
grid $w.details -in $w.ctrl -row 11 -sticky ew
|
| 150 |
+
grid rowconfigure $w.ctrl 11 -minsize 20
|
| 151 |
+
$w.details configure -labelwidget $w.details.cb
|
| 152 |
+
grid [ttk::frame $w.details.b -height 1] ;# Work around minor bug
|
| 153 |
+
raise $w.details
|
| 154 |
+
raise $w.details.cb
|
| 155 |
+
grid rowconfigure $w.ctrl 50 -weight 1
|
| 156 |
+
trace add variable ::S(mode) write [list ActiveGUI $w]
|
| 157 |
+
trace add variable ::S(details) write [list ActiveGUI $w]
|
| 158 |
+
trace add variable ::S(speed) write [list ActiveGUI $w]
|
| 159 |
+
|
| 160 |
+
grid $w.message -in $w.ctrl -row 98 -sticky ew -pady 5
|
| 161 |
+
grid $w.message.e -sticky nsew
|
| 162 |
+
grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 5}
|
| 163 |
+
pack $w.speed.scale -fill both -expand 1
|
| 164 |
+
grid $w.about -in $w.ctrl -row 100 -sticky ew
|
| 165 |
+
bind $w.reset <Button-3> {set S(mode) -1} ;# Debugging
|
| 166 |
+
|
| 167 |
+
## See Code / Dismiss buttons hack!
|
| 168 |
+
set btns [addSeeDismiss $w.ctrl.buttons $w]
|
| 169 |
+
grid [ttk::separator $w.ctrl.sep] -sticky ew -pady 4
|
| 170 |
+
set i 0
|
| 171 |
+
foreach b [winfo children $btns] {
|
| 172 |
+
if {[winfo class $b] eq "TButton"} {
|
| 173 |
+
grid [set b2 [ttk::button $w.ctrl.b[incr i]]] -sticky ew
|
| 174 |
+
foreach b3 [$b configure] {
|
| 175 |
+
set b3 [lindex $b3 0]
|
| 176 |
+
# Some options are read-only; ignore those errors
|
| 177 |
+
catch {$b2 configure $b3 [$b cget $b3]}
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
destroy $btns
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
proc DoDetailFrame {w} {
|
| 185 |
+
set w2 $w.details.f
|
| 186 |
+
ttk::frame $w2
|
| 187 |
+
|
| 188 |
+
ttk::label $w2.l -textvariable S(cnt) -background white
|
| 189 |
+
grid $w2.l - - - -sticky ew -row 0
|
| 190 |
+
for {set i 1} {1} {incr i} {
|
| 191 |
+
if {[info procs "Move$i"] eq ""} break
|
| 192 |
+
ttk::label $w2.l$i -text $i -anchor e -width 2 -background white
|
| 193 |
+
ttk::label $w2.ll$i -textvariable STEP($i) -width 5 -background white
|
| 194 |
+
set row [expr {($i + 1) / 2}]
|
| 195 |
+
set col [expr {(($i + 1) & 1) * 2}]
|
| 196 |
+
grid $w2.l$i -sticky ew -row $row -column $col
|
| 197 |
+
grid $w2.ll$i -sticky ew -row $row -column [incr col]
|
| 198 |
+
}
|
| 199 |
+
grid columnconfigure $w2 1 -weight 1
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
# Map or unmap the ctrl window
|
| 203 |
+
proc ShowCtrl {w} {
|
| 204 |
+
if {[winfo ismapped $w.ctrl]} {
|
| 205 |
+
pack forget $w.ctrl
|
| 206 |
+
$w.show config -text "\xbb"
|
| 207 |
+
} else {
|
| 208 |
+
pack $w.ctrl -side right -fill both -ipady 5
|
| 209 |
+
$w.show config -text "\xab"
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
proc DrawAll {w} {
|
| 214 |
+
ResetStep
|
| 215 |
+
$w.c delete all
|
| 216 |
+
for {set i 0} {1} {incr i} {
|
| 217 |
+
set p "Draw$i"
|
| 218 |
+
if {[info procs $p] eq ""} break
|
| 219 |
+
$p $w
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
proc ActiveGUI {w var1 var2 op} {
|
| 224 |
+
global S MGO MSTART MDONE
|
| 225 |
+
array set z {0 disabled 1 normal}
|
| 226 |
+
|
| 227 |
+
set m $S(mode)
|
| 228 |
+
set S(pause) [expr {$m == 2}]
|
| 229 |
+
$w.start config -state $z([expr {$m != $MGO}])
|
| 230 |
+
$w.pause config -state $z([expr {$m != $MSTART && $m != $MDONE}])
|
| 231 |
+
$w.step config -state $z([expr {$m != $MGO && $m != $MDONE}])
|
| 232 |
+
$w.bstep config -state $z([expr {$m != $MGO && $m != $MDONE}])
|
| 233 |
+
$w.reset config -state $z([expr {$m != $MSTART}])
|
| 234 |
+
|
| 235 |
+
if {$S(details)} {
|
| 236 |
+
grid $w.details.f -sticky ew
|
| 237 |
+
} else {
|
| 238 |
+
grid forget $w.details.f
|
| 239 |
+
}
|
| 240 |
+
set S(speed) [expr {round($S(speed))}]
|
| 241 |
+
$w.speed config -text "Speed: $S(speed)"
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
proc Start {} {
|
| 245 |
+
global S MGO
|
| 246 |
+
set S(mode) $MGO
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
proc DoButton {w what} {
|
| 250 |
+
global S MDONE MGO MSSTEP MBSTEP MPAUSE
|
| 251 |
+
|
| 252 |
+
if {$what == 0} { ;# Start
|
| 253 |
+
if {$S(mode) == $MDONE} {
|
| 254 |
+
Reset $w
|
| 255 |
+
}
|
| 256 |
+
set S(mode) $MGO
|
| 257 |
+
} elseif {$what == 1} { ;# Pause
|
| 258 |
+
set S(mode) [expr {$S(pause) ? $MPAUSE : $MGO}]
|
| 259 |
+
} elseif {$what == 2} { ;# Step
|
| 260 |
+
set S(mode) $MSSTEP
|
| 261 |
+
} elseif {$what == 3} { ;# Reset
|
| 262 |
+
Reset $w
|
| 263 |
+
} elseif {$what == 4} { ;# Big step
|
| 264 |
+
set S(mode) $MBSTEP
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
proc Go {w {who {}}} {
|
| 269 |
+
global S speed animationCallbacks MGO MPAUSE MSSTEP MBSTEP
|
| 270 |
+
|
| 271 |
+
set now [clock clicks -milliseconds]
|
| 272 |
+
catch {after cancel $animationCallbacks(goldberg)}
|
| 273 |
+
if {$who ne ""} { ;# Start here for debugging
|
| 274 |
+
set S(active) $who
|
| 275 |
+
set S(mode) $MGO
|
| 276 |
+
}
|
| 277 |
+
if {$S(mode) == -1} return ;# Debugging
|
| 278 |
+
set n 0
|
| 279 |
+
if {$S(mode) != $MPAUSE} { ;# Not paused
|
| 280 |
+
set n [NextStep $w] ;# Do the next move
|
| 281 |
+
}
|
| 282 |
+
if {$S(mode) == $MSSTEP} { ;# Single step
|
| 283 |
+
set S(mode) $MPAUSE
|
| 284 |
+
}
|
| 285 |
+
if {$S(mode) == $MBSTEP && $n} { ;# Big step
|
| 286 |
+
set S(mode) $MSSTEP
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
set elapsed [expr {[clock click -milliseconds] - $now}]
|
| 290 |
+
set delay [expr {$speed($S(speed)) - $elapsed}]
|
| 291 |
+
if {$delay <= 0} {
|
| 292 |
+
set delay 1
|
| 293 |
+
}
|
| 294 |
+
set animationCallbacks(goldberg) [after $delay [list Go $w]]
|
| 295 |
+
}
|
| 296 |
+
|
| 297 |
+
# NextStep: drives the next step of the animation
|
| 298 |
+
proc NextStep {w} {
|
| 299 |
+
global S MSTART MDONE
|
| 300 |
+
set rval 0 ;# Return value
|
| 301 |
+
|
| 302 |
+
if {$S(mode) != $MSTART && $S(mode) != $MDONE} {
|
| 303 |
+
incr S(cnt)
|
| 304 |
+
}
|
| 305 |
+
set alive {}
|
| 306 |
+
foreach {who} $S(active) {
|
| 307 |
+
set n ["Move$who" $w]
|
| 308 |
+
if {$n & 1} { ;# This guy still alive
|
| 309 |
+
lappend alive $who
|
| 310 |
+
}
|
| 311 |
+
if {$n & 2} { ;# Next guy is active
|
| 312 |
+
lappend alive [expr {$who + 1}]
|
| 313 |
+
set rval 1
|
| 314 |
+
}
|
| 315 |
+
if {$n & 4} { ;# End of puzzle flag
|
| 316 |
+
set S(mode) $MDONE ;# Done mode
|
| 317 |
+
set S(active) {} ;# No more animation
|
| 318 |
+
return 1
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
set S(active) $alive
|
| 322 |
+
return $rval
|
| 323 |
+
}
|
| 324 |
+
proc About {w} {
|
| 325 |
+
set msg "$::S(title)\nby Keith Vetter, March 2003\n(Reproduced by kind\
|
| 326 |
+
permission of the author)\n\n\"Man will always find a difficult\
|
| 327 |
+
means to perform a simple task.\"\nRube Goldberg"
|
| 328 |
+
tk_messageBox -parent $w -message $msg -title About
|
| 329 |
+
}
|
| 330 |
+
################################################################
|
| 331 |
+
#
|
| 332 |
+
# All the drawing and moving routines
|
| 333 |
+
#
|
| 334 |
+
|
| 335 |
+
# START HERE! banner
|
| 336 |
+
proc Draw0 {w} {
|
| 337 |
+
set color $::C(0)
|
| 338 |
+
set xy {579 119}
|
| 339 |
+
$w.c create text $xy -text "START HERE!" -fill $color -anchor w \
|
| 340 |
+
-tag I0 -font {{Times Roman} 12 italic bold}
|
| 341 |
+
set xy {719 119 763 119}
|
| 342 |
+
$w.c create line $xy -tag I0 -fill $color -width 5 -arrow last \
|
| 343 |
+
-arrowshape {18 18 5}
|
| 344 |
+
$w.c bind I0 <Button-1> Start
|
| 345 |
+
}
|
| 346 |
+
proc Move0 {w {step {}}} {
|
| 347 |
+
set step [GetStep 0 $step]
|
| 348 |
+
|
| 349 |
+
if {$::S(mode) > $::MSTART} { ;# Start the ball rolling
|
| 350 |
+
MoveAbs $w I0 {-100 -100} ;# Hide the banner
|
| 351 |
+
return 2
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
set pos {
|
| 355 |
+
{673 119} {678 119} {683 119} {688 119}
|
| 356 |
+
{693 119} {688 119} {683 119} {678 119}
|
| 357 |
+
}
|
| 358 |
+
set step [expr {$step % [llength $pos]}]
|
| 359 |
+
MoveAbs $w I0 [lindex $pos $step]
|
| 360 |
+
return 1
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
# Dropping ball
|
| 364 |
+
proc Draw1 {w} {
|
| 365 |
+
set color $::C(1a)
|
| 366 |
+
set color2 $::C(1b)
|
| 367 |
+
set xy {844 133 800 133 800 346 820 346 820 168 844 168 844 133}
|
| 368 |
+
$w.c create poly $xy -width 3 -fill $color -outline {}
|
| 369 |
+
set xy {771 133 685 133 685 168 751 168 751 346 771 346 771 133}
|
| 370 |
+
$w.c create poly $xy -width 3 -fill $color -outline {}
|
| 371 |
+
|
| 372 |
+
set xy [box 812 122 9]
|
| 373 |
+
$w.c create oval $xy -tag I1 -fill $color2 -outline {}
|
| 374 |
+
$w.c bind I1 <Button-1> Start
|
| 375 |
+
}
|
| 376 |
+
proc Move1 {w {step {}}} {
|
| 377 |
+
set step [GetStep 1 $step]
|
| 378 |
+
set pos {
|
| 379 |
+
{807 122} {802 122} {797 123} {793 124} {789 129} {785 153}
|
| 380 |
+
{785 203} {785 278 x} {785 367} {810 392} {816 438} {821 503}
|
| 381 |
+
{824 585 y} {838 587} {848 593} {857 601} {-100 -100}
|
| 382 |
+
}
|
| 383 |
+
if {$step >= [llength $pos]} {
|
| 384 |
+
return 0
|
| 385 |
+
}
|
| 386 |
+
set where [lindex $pos $step]
|
| 387 |
+
MoveAbs $w I1 $where
|
| 388 |
+
|
| 389 |
+
if {[lindex $where 2] eq "y"} {
|
| 390 |
+
Move15a $w
|
| 391 |
+
}
|
| 392 |
+
if {[lindex $where 2] eq "x"} {
|
| 393 |
+
return 3
|
| 394 |
+
}
|
| 395 |
+
return 1
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
# Lighting the match
|
| 399 |
+
proc Draw2 {w} {
|
| 400 |
+
set color red
|
| 401 |
+
set color $::C(2)
|
| 402 |
+
set xy {750 369 740 392 760 392} ;# Fulcrum
|
| 403 |
+
$w.c create poly $xy -fill $::C(fg) -outline $::C(fg)
|
| 404 |
+
set xy {628 335 660 383} ;# Strike box
|
| 405 |
+
$w.c create rect $xy -fill {} -outline $::C(fg)
|
| 406 |
+
for {set y 0} {$y < 3} {incr y} {
|
| 407 |
+
set yy [expr {335+$y*16}]
|
| 408 |
+
$w.c create bitmap 628 $yy -bitmap gray25 -anchor nw \
|
| 409 |
+
-foreground $::C(fg)
|
| 410 |
+
$w.c create bitmap 644 $yy -bitmap gray25 -anchor nw \
|
| 411 |
+
-foreground $::C(fg)
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
set xy {702 366 798 366} ;# Lever
|
| 415 |
+
$w.c create line $xy -fill $::C(fg) -width 6 -tag I2_0
|
| 416 |
+
set xy {712 363 712 355} ;# R strap
|
| 417 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I2_1
|
| 418 |
+
set xy {705 363 705 355} ;# L strap
|
| 419 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I2_2
|
| 420 |
+
set xy {679 356 679 360 717 360 717 356 679 356} ;# Match stick
|
| 421 |
+
$w.c create line $xy -fill $::C(fg) -tag I2_3
|
| 422 |
+
|
| 423 |
+
#set xy {662 352 680 365} ;# Match head
|
| 424 |
+
set xy {
|
| 425 |
+
671 352 677.4 353.9 680 358.5 677.4 363.1 671 365 664.6 363.1
|
| 426 |
+
662 358.5 664.6 353.9
|
| 427 |
+
}
|
| 428 |
+
$w.c create poly $xy -fill $color -outline $color -tag I2_4
|
| 429 |
+
}
|
| 430 |
+
proc Move2 {w {step {}}} {
|
| 431 |
+
set step [GetStep 2 $step]
|
| 432 |
+
|
| 433 |
+
set stages {0 0 1 2 0 2 1 0 1 2 0 2 1}
|
| 434 |
+
set xy(0) {
|
| 435 |
+
686 333 692 323 682 316 674 309 671 295 668 307 662 318 662 328
|
| 436 |
+
671 336
|
| 437 |
+
}
|
| 438 |
+
set xy(1) {687 331 698 322 703 295 680 320 668 297 663 311 661 327 671 335}
|
| 439 |
+
set xy(2) {
|
| 440 |
+
686 331 704 322 688 300 678 283 678 283 674 298 666 309 660 324
|
| 441 |
+
672 336
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
if {$step >= [llength $stages]} {
|
| 445 |
+
$w.c delete I2
|
| 446 |
+
return 0
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
if {$step == 0} { ;# Rotate the match
|
| 450 |
+
set beta 20
|
| 451 |
+
lassign [Anchor $w I2_0 s] Ox Oy ;# Where to pivot
|
| 452 |
+
for {set i 0} {[$w.c find withtag I2_$i] ne ""} {incr i} {
|
| 453 |
+
RotateItem $w I2_$i $Ox $Oy $beta
|
| 454 |
+
}
|
| 455 |
+
$w.c create poly -tag I2 -smooth 1 -fill $::C(2) ;# For the flame
|
| 456 |
+
return 1
|
| 457 |
+
}
|
| 458 |
+
$w.c coords I2 $xy([lindex $stages $step])
|
| 459 |
+
return [expr {$step == 7 ? 3 : 1}]
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
# Weight and pulleys
|
| 463 |
+
proc Draw3 {w} {
|
| 464 |
+
set color $::C(3a)
|
| 465 |
+
set color2 $::C(3b)
|
| 466 |
+
|
| 467 |
+
set xy {602 296 577 174 518 174}
|
| 468 |
+
foreach {x y} $xy { ;# 3 Pulleys
|
| 469 |
+
$w.c create oval [box $x $y 13] -fill $color -outline $::C(fg) \
|
| 470 |
+
-width 3
|
| 471 |
+
$w.c create oval [box $x $y 2] -fill $::C(fg) -outline $::C(fg)
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
set xy {750 309 670 309} ;# Wall to flame
|
| 475 |
+
$w.c create line $xy -tag I3_s -width 3 -fill $::C(fg) -smooth 1
|
| 476 |
+
set xy {670 309 650 309} ;# Flame to pulley 1
|
| 477 |
+
$w.c create line $xy -tag I3_0 -width 3 -fill $::C(fg)
|
| 478 |
+
set xy {650 309 600 309} ;# Flame to pulley 1
|
| 479 |
+
$w.c create line $xy -tag I3_1 -width 3 -fill $::C(fg)
|
| 480 |
+
set xy {589 296 589 235} ;# Pulley 1 half way to 2
|
| 481 |
+
$w.c create line $xy -tag I3_2 -width 3 -fill $::C(fg)
|
| 482 |
+
set xy {589 235 589 174} ;# Pulley 1 other half to 2
|
| 483 |
+
$w.c create line $xy -width 3 -fill $::C(fg)
|
| 484 |
+
set xy {577 161 518 161} ;# Across the top
|
| 485 |
+
$w.c create line $xy -width 3 -fill $::C(fg)
|
| 486 |
+
set xy {505 174 505 205} ;# Down to weight
|
| 487 |
+
$w.c create line $xy -tag I3_w -width 3 -fill $::C(fg)
|
| 488 |
+
|
| 489 |
+
# Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
|
| 490 |
+
set xy {515 207 495 207}
|
| 491 |
+
foreach {x1 y1 x2 y2} $xy {
|
| 492 |
+
$w.c create oval [box $x1 $y1 6] -tag I3_ -fill $color2 \
|
| 493 |
+
-outline $color2
|
| 494 |
+
$w.c create oval [box $x2 $y2 6] -tag I3_ -fill $color2 \
|
| 495 |
+
-outline $color2
|
| 496 |
+
incr y1 -6; incr y2 6
|
| 497 |
+
$w.c create rect $x1 $y1 $x2 $y2 -tag I3_ -fill $color2 \
|
| 498 |
+
-outline $color2
|
| 499 |
+
}
|
| 500 |
+
set xy {492 220 518 263}
|
| 501 |
+
set xy [RoundRect $w $xy 15]
|
| 502 |
+
$w.c create poly $xy -smooth 1 -tag I3_ -fill $color2 -outline $color2
|
| 503 |
+
set xy {500 217 511 217}
|
| 504 |
+
$w.c create line $xy -tag I3_ -fill $color2 -width 10
|
| 505 |
+
|
| 506 |
+
set xy {502 393 522 393 522 465} ;# Bottom weight target
|
| 507 |
+
$w.c create line $xy -tag I3__ -fill $::C(fg) -join miter -width 10
|
| 508 |
+
}
|
| 509 |
+
proc Move3 {w {step {}}} {
|
| 510 |
+
set step [GetStep 3 $step]
|
| 511 |
+
|
| 512 |
+
set pos {{505 247} {505 297} {505 386.5} {505 386.5}}
|
| 513 |
+
set rope(0) {750 309 729 301 711 324 690 300}
|
| 514 |
+
set rope(1) {750 309 737 292 736 335 717 315 712 320}
|
| 515 |
+
set rope(2) {750 309 737 309 740 343 736 351 725 340}
|
| 516 |
+
set rope(3) {750 309 738 321 746 345 742 356}
|
| 517 |
+
|
| 518 |
+
if {$step >= [llength $pos]} {
|
| 519 |
+
return 0
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
$w.c delete "I3_$step" ;# Delete part of the rope
|
| 523 |
+
MoveAbs $w I3_ [lindex $pos $step] ;# Move weight down
|
| 524 |
+
$w.c coords I3_s $rope($step) ;# Flapping rope end
|
| 525 |
+
$w.c coords I3_w [concat 505 174 [lindex $pos $step]]
|
| 526 |
+
if {$step == 2} {
|
| 527 |
+
$w.c move I3__ 0 30
|
| 528 |
+
return 2
|
| 529 |
+
}
|
| 530 |
+
return 1
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
# Cage and door
|
| 534 |
+
proc Draw4 {w} {
|
| 535 |
+
set color $::C(4)
|
| 536 |
+
lassign {527 356 611 464} x0 y0 x1 y1
|
| 537 |
+
|
| 538 |
+
for {set y $y0} {$y <= $y1} {incr y 12} { ;# Horizontal bars
|
| 539 |
+
$w.c create line $x0 $y $x1 $y -fill $color -width 1
|
| 540 |
+
}
|
| 541 |
+
for {set x $x0} {$x <= $x1} {incr x 12} { ;# Vertical bars
|
| 542 |
+
$w.c create line $x $y0 $x $y1 -fill $color -width 1
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
set xy {518 464 518 428} ;# Swing gate
|
| 546 |
+
$w.c create line $xy -tag I4 -fill $color -width 3
|
| 547 |
+
}
|
| 548 |
+
proc Move4 {w {step {}}} {
|
| 549 |
+
set step [GetStep 4 $step]
|
| 550 |
+
|
| 551 |
+
set angles {-10 -20 -30 -30}
|
| 552 |
+
if {$step >= [llength $angles]} {
|
| 553 |
+
return 0
|
| 554 |
+
}
|
| 555 |
+
RotateItem $w I4 518 464 [lindex $angles $step]
|
| 556 |
+
$w.c raise I4
|
| 557 |
+
return [expr {$step == 3 ? 3 : 1}]
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
# Mouse
|
| 561 |
+
proc Draw5 {w} {
|
| 562 |
+
set color $::C(5a)
|
| 563 |
+
set color2 $::C(5b)
|
| 564 |
+
set xy {377 248 410 248 410 465 518 465} ;# Mouse course
|
| 565 |
+
lappend xy 518 428 451 428 451 212 377 212
|
| 566 |
+
$w.c create poly $xy -fill $color2 -outline $::C(fg) -width 3
|
| 567 |
+
|
| 568 |
+
set xy {
|
| 569 |
+
534.5 445.5 541 440 552 436 560 436 569 440 574 446 575 452 574 454
|
| 570 |
+
566 456 554 456 545 456 537 454 530 452
|
| 571 |
+
}
|
| 572 |
+
$w.c create poly $xy -tag {I5 I5_0} -fill $color
|
| 573 |
+
set xy {573 452 592 458 601 460 613 456} ;# Tail
|
| 574 |
+
$w.c create line $xy -tag {I5 I5_1} -fill $color -smooth 1 -width 3
|
| 575 |
+
set xy [box 540 446 2] ;# Eye
|
| 576 |
+
set xy {540 444 541 445 541 447 540 448 538 447 538 445}
|
| 577 |
+
#.c create oval $xy -tag {I5 I5_2} -fill $::C(bg) -outline {}
|
| 578 |
+
$w.c create poly $xy -tag {I5 I5_2} -fill $::C(bg) -outline {} -smooth 1
|
| 579 |
+
set xy {538 454 535 461} ;# Front leg
|
| 580 |
+
$w.c create line $xy -tag {I5 I5_3} -fill $color -width 2
|
| 581 |
+
set xy {566 455 569 462} ;# Back leg
|
| 582 |
+
$w.c create line $xy -tag {I5 I5_4} -fill $color -width 2
|
| 583 |
+
set xy {544 455 545 460} ;# 2nd front leg
|
| 584 |
+
$w.c create line $xy -tag {I5 I5_5} -fill $color -width 2
|
| 585 |
+
set xy {560 455 558 460} ;# 2nd back leg
|
| 586 |
+
$w.c create line $xy -tag {I5 I5_6} -fill $color -width 2
|
| 587 |
+
}
|
| 588 |
+
proc Move5 {w {step {}}} {
|
| 589 |
+
set step [GetStep 5 $step]
|
| 590 |
+
|
| 591 |
+
set pos {
|
| 592 |
+
{553 452} {533 452} {513 452} {493 452} {473 452}
|
| 593 |
+
{463 442 30} {445.5 441.5 30} {425.5 434.5 30} {422 414} {422 394}
|
| 594 |
+
{422 374} {422 354} {422 334} {422 314} {422 294}
|
| 595 |
+
{422 274 -30} {422 260.5 -30 x} {422.5 248.5 -28} {425 237}
|
| 596 |
+
}
|
| 597 |
+
if {$step >= [llength $pos]} {
|
| 598 |
+
return 0
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
lassign [lindex $pos $step] x y beta next
|
| 602 |
+
MoveAbs $w I5 [list $x $y]
|
| 603 |
+
if {$beta ne ""} {
|
| 604 |
+
lassign [Centroid $w I5_0] Ox Oy
|
| 605 |
+
foreach id {0 1 2 3 4 5 6} {
|
| 606 |
+
RotateItem $w I5_$id $Ox $Oy $beta
|
| 607 |
+
}
|
| 608 |
+
}
|
| 609 |
+
if {$next eq "x"} {
|
| 610 |
+
return 3
|
| 611 |
+
}
|
| 612 |
+
return 1
|
| 613 |
+
}
|
| 614 |
+
|
| 615 |
+
# Dropping gumballs
|
| 616 |
+
array set XY6 {
|
| 617 |
+
-1 {366 207} -2 {349 204} -3 {359 193} -4 {375 192} -5 {340 190}
|
| 618 |
+
-6 {349 177} -7 {366 177} -8 {380 176} -9 {332 172} -10 {342 161}
|
| 619 |
+
-11 {357 164} -12 {372 163} -13 {381 149} -14 {364 151} -15 {349 146}
|
| 620 |
+
-16 {333 148} 0 {357 219}
|
| 621 |
+
1 {359 261} 2 {359 291} 3 {359 318} 4 {361 324} 5 {365 329} 6 {367 334}
|
| 622 |
+
7 {367 340} 8 {366 346} 9 {364 350} 10 {361 355} 11 {359 370} 12 {359 391}
|
| 623 |
+
13,0 {360 456} 13,1 {376 456} 13,2 {346 456} 13,3 {330 456}
|
| 624 |
+
13,4 {353 444} 13,5 {368 443} 13,6 {339 442} 13,7 {359 431}
|
| 625 |
+
13,8 {380 437} 13,9 {345 428} 13,10 {328 434} 13,11 {373 424}
|
| 626 |
+
13,12 {331 420} 13,13 {360 417} 13,14 {345 412} 13,15 {376 410}
|
| 627 |
+
13,16 {360 403}
|
| 628 |
+
}
|
| 629 |
+
proc Draw6 {w} {
|
| 630 |
+
set color $::C(6)
|
| 631 |
+
set xy {324 130 391 204} ;# Ball holder
|
| 632 |
+
set xy [RoundRect $w $xy 10]
|
| 633 |
+
$w.c create poly $xy -smooth 1 -outline $::C(fg) -width 3 -fill $color
|
| 634 |
+
set xy {339 204 376 253} ;# Below the ball holder
|
| 635 |
+
$w.c create rect $xy -fill {} -outline $::C(fg) -width 3 -fill $color \
|
| 636 |
+
-tag I6c
|
| 637 |
+
set xy [box 346 339 28]
|
| 638 |
+
$w.c create oval $xy -fill $color -outline {} ;# Rotor
|
| 639 |
+
$w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
|
| 640 |
+
-start 80 -extent 205
|
| 641 |
+
$w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
|
| 642 |
+
-start -41 -extent 85
|
| 643 |
+
|
| 644 |
+
set xy [box 346 339 15] ;# Center of rotor
|
| 645 |
+
$w.c create oval $xy -outline $::C(fg) -fill $::C(fg) -tag I6m
|
| 646 |
+
set xy {352 312 352 254 368 254 368 322} ;# Top drop to rotor
|
| 647 |
+
$w.c create poly $xy -fill $color -outline {}
|
| 648 |
+
$w.c create line $xy -fill $::C(fg) -width 2
|
| 649 |
+
|
| 650 |
+
set xy {353 240 367 300} ;# Poke bottom hole
|
| 651 |
+
$w.c create rect $xy -fill $color -outline {}
|
| 652 |
+
set xy {341 190 375 210} ;# Poke another hole
|
| 653 |
+
$w.c create rect $xy -fill $color -outline {}
|
| 654 |
+
|
| 655 |
+
set xy {368 356 368 403 389 403 389 464 320 464 320 403 352 403 352 366}
|
| 656 |
+
$w.c create poly $xy -fill $color -outline {} -width 2 ;# Below rotor
|
| 657 |
+
$w.c create line $xy -fill $::C(fg) -width 2
|
| 658 |
+
set xy [box 275 342 7] ;# On/off rotor
|
| 659 |
+
$w.c create oval $xy -outline $::C(fg) -fill $::C(fg)
|
| 660 |
+
set xy {276 334 342 325} ;# Fan belt top
|
| 661 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 662 |
+
set xy {276 349 342 353} ;# Fan belt bottom
|
| 663 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 664 |
+
|
| 665 |
+
set xy {337 212 337 247} ;# What the mouse pushes
|
| 666 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
|
| 667 |
+
set xy {392 212 392 247}
|
| 668 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
|
| 669 |
+
set xy {337 230 392 230}
|
| 670 |
+
$w.c create line $xy -fill $::C(fg) -width 7 -tag I6_
|
| 671 |
+
|
| 672 |
+
set who -1 ;# All the balls
|
| 673 |
+
set colors {red cyan orange green blue darkblue}
|
| 674 |
+
lappend colors {*}$colors {*}$colors
|
| 675 |
+
|
| 676 |
+
for {set i 0} {$i < 17} {incr i} {
|
| 677 |
+
set loc [expr {-1 * $i}]
|
| 678 |
+
set color [lindex $colors $i]
|
| 679 |
+
$w.c create oval [box {*}$::XY6($loc) 5] -fill $color \
|
| 680 |
+
-outline $color -tag I6_b$i
|
| 681 |
+
}
|
| 682 |
+
Draw6a $w 12 ;# The wheel
|
| 683 |
+
}
|
| 684 |
+
proc Draw6a {w beta} {
|
| 685 |
+
$w.c delete I6_0
|
| 686 |
+
lassign {346 339} Ox Oy
|
| 687 |
+
for {set i 0} {$i < 4} {incr i} {
|
| 688 |
+
set b [expr {$beta + $i * 45}]
|
| 689 |
+
lassign [RotateC 28 0 0 0 $b] x y
|
| 690 |
+
set xy [list [expr {$Ox+$x}] [expr {$Oy+$y}] \
|
| 691 |
+
[expr {$Ox-$x}] [expr {$Oy-$y}]]
|
| 692 |
+
$w.c create line $xy -tag I6_0 -fill $::C(fg) -width 2
|
| 693 |
+
}
|
| 694 |
+
}
|
| 695 |
+
proc Move6 {w {step {}}} {
|
| 696 |
+
set step [GetStep 6 $step]
|
| 697 |
+
if {$step > 62} {
|
| 698 |
+
return 0
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
if {$step < 2} { ;# Open gate for balls to drop
|
| 702 |
+
$w.c move I6_ -7 0
|
| 703 |
+
if {$step == 1} { ;# Poke a hole
|
| 704 |
+
set xy {348 226 365 240}
|
| 705 |
+
$w.c create rect $xy -fill [$w.c itemcget I6c -fill] -outline {}
|
| 706 |
+
}
|
| 707 |
+
return 1
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
set s [expr {$step - 1}] ;# Do the gumball drop dance
|
| 711 |
+
for {set i 0} {$i <= int(($s-1) / 3)} {incr i} {
|
| 712 |
+
set tag "I6_b$i"
|
| 713 |
+
if {[$w.c find withtag $tag] eq ""} break
|
| 714 |
+
set loc [expr {$s - 3 * $i}]
|
| 715 |
+
|
| 716 |
+
if {[info exists ::XY6($loc,$i)]} {
|
| 717 |
+
MoveAbs $w $tag $::XY6($loc,$i)
|
| 718 |
+
} elseif {[info exists ::XY6($loc)]} {
|
| 719 |
+
MoveAbs $w $tag $::XY6($loc)
|
| 720 |
+
}
|
| 721 |
+
}
|
| 722 |
+
if {($s % 3) == 1} {
|
| 723 |
+
set first [expr {($s + 2) / 3}]
|
| 724 |
+
for {set i $first} {1} {incr i} {
|
| 725 |
+
set tag "I6_b$i"
|
| 726 |
+
if {[$w.c find withtag $tag] eq ""} break
|
| 727 |
+
set loc [expr {$first - $i}]
|
| 728 |
+
MoveAbs $w $tag $::XY6($loc)
|
| 729 |
+
}
|
| 730 |
+
}
|
| 731 |
+
if {$s >= 3} { ;# Rotate the motor
|
| 732 |
+
set idx [expr {$s % 3}]
|
| 733 |
+
#Draw6a $w [lindex {12 35 64} $idx]
|
| 734 |
+
Draw6a $w [expr {12 + $s * 15}]
|
| 735 |
+
}
|
| 736 |
+
return [expr {$s == 3 ? 3 : 1}]
|
| 737 |
+
}
|
| 738 |
+
|
| 739 |
+
# On/off switch
|
| 740 |
+
proc Draw7 {w} {
|
| 741 |
+
set color $::C(7)
|
| 742 |
+
set xy {198 306 277 374} ;# Box
|
| 743 |
+
$w.c create rect $xy -outline $::C(fg) -width 2 -fill $color -tag I7z
|
| 744 |
+
$w.c lower I7z
|
| 745 |
+
set xy {275 343 230 349}
|
| 746 |
+
$w.c create line $xy -tag I7 -fill $::C(fg) -arrow last \
|
| 747 |
+
-arrowshape {23 23 8} -width 6
|
| 748 |
+
set xy {225 324} ;# On button
|
| 749 |
+
$w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
|
| 750 |
+
set xy {218 323} ;# On text
|
| 751 |
+
set font {{Times Roman} 8}
|
| 752 |
+
$w.c create text $xy -text "on" -anchor e -fill $::C(fg) -font $font
|
| 753 |
+
set xy {225 350} ;# Off button
|
| 754 |
+
$w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
|
| 755 |
+
set xy {218 349} ;# Off button
|
| 756 |
+
$w.c create text $xy -text "off" -anchor e -fill $::C(fg) -font $font
|
| 757 |
+
}
|
| 758 |
+
proc Move7 {w {step {}}} {
|
| 759 |
+
set step [GetStep 7 $step]
|
| 760 |
+
set numsteps 30
|
| 761 |
+
if {$step > $numsteps} {
|
| 762 |
+
return 0
|
| 763 |
+
}
|
| 764 |
+
set beta [expr {30.0 / $numsteps}]
|
| 765 |
+
RotateItem $w I7 275 343 $beta
|
| 766 |
+
|
| 767 |
+
return [expr {$step == $numsteps ? 3 : 1}]
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
# Electricity to the fan
|
| 771 |
+
proc Draw8 {w} {
|
| 772 |
+
Sine $w 271 248 271 306 5 8 -tag I8_s -fill $::C(8) -width 3
|
| 773 |
+
}
|
| 774 |
+
proc Move8 {w {step {}}} {
|
| 775 |
+
set step [GetStep 8 $step]
|
| 776 |
+
|
| 777 |
+
if {$step > 3} {
|
| 778 |
+
return 0
|
| 779 |
+
}
|
| 780 |
+
if {$step == 0} {
|
| 781 |
+
Sparkle $w [Anchor $w I8_s s] I8
|
| 782 |
+
return 1
|
| 783 |
+
|
| 784 |
+
} elseif {$step == 1} {
|
| 785 |
+
MoveAbs $w I8 [Anchor $w I8_s c]
|
| 786 |
+
} elseif {$step == 2} {
|
| 787 |
+
MoveAbs $w I8 [Anchor $w I8_s n]
|
| 788 |
+
} else {
|
| 789 |
+
$w.c delete I8
|
| 790 |
+
}
|
| 791 |
+
return [expr {$step == 2 ? 3 : 1}]
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
# Fan
|
| 795 |
+
proc Draw9 {w} {
|
| 796 |
+
set color $::C(9)
|
| 797 |
+
set xy {266 194 310 220}
|
| 798 |
+
$w.c create oval $xy -outline $color -fill $color
|
| 799 |
+
set xy {280 209 296 248}
|
| 800 |
+
$w.c create oval $xy -outline $color -fill $color
|
| 801 |
+
set xy {288 249 252 249 260 240 280 234 296 234 316 240 324 249 288 249}
|
| 802 |
+
$w.c create poly $xy -fill $color -smooth 1
|
| 803 |
+
|
| 804 |
+
set xy {248 205 265 214 264 205 265 196} ;# Spinner
|
| 805 |
+
$w.c create poly $xy -fill $color
|
| 806 |
+
|
| 807 |
+
set xy {255 206 265 234} ;# Fan blades
|
| 808 |
+
$w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
|
| 809 |
+
set xy {255 176 265 204}
|
| 810 |
+
$w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
|
| 811 |
+
set xy {255 206 265 220}
|
| 812 |
+
$w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
|
| 813 |
+
set xy {255 190 265 204}
|
| 814 |
+
$w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
|
| 815 |
+
}
|
| 816 |
+
proc Move9 {w {step {}}} {
|
| 817 |
+
set step [GetStep 9 $step]
|
| 818 |
+
|
| 819 |
+
if {$step & 1} {
|
| 820 |
+
$w.c itemconfig I9_0 -width 4
|
| 821 |
+
$w.c itemconfig I9_1 -width 1
|
| 822 |
+
$w.c lower I9_1 I9_0
|
| 823 |
+
} else {
|
| 824 |
+
$w.c itemconfig I9_0 -width 1
|
| 825 |
+
$w.c itemconfig I9_1 -width 4
|
| 826 |
+
$w.c lower I9_0 I9_1
|
| 827 |
+
}
|
| 828 |
+
if {$step == 0} {
|
| 829 |
+
return 3
|
| 830 |
+
}
|
| 831 |
+
return 1
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
# Boat
|
| 835 |
+
proc Draw10 {w} {
|
| 836 |
+
set color $::C(10a)
|
| 837 |
+
set color2 $::C(10b)
|
| 838 |
+
set xy {191 230 233 230 233 178 191 178} ;# Sail
|
| 839 |
+
$w.c create poly $xy -fill $color -width 3 -outline $::C(fg) -tag I10
|
| 840 |
+
set xy [box 209 204 31] ;# Front
|
| 841 |
+
$w.c create arc $xy -outline {} -fill $color -style pie \
|
| 842 |
+
-start 120 -extent 120 -tag I10
|
| 843 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
|
| 844 |
+
-start 120 -extent 120 -tag I10
|
| 845 |
+
set xy [box 249 204 31] ;# Back
|
| 846 |
+
$w.c create arc $xy -outline {} -fill $::C(bg) -width 3 -style pie \
|
| 847 |
+
-start 120 -extent 120 -tag I10
|
| 848 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
|
| 849 |
+
-start 120 -extent 120 -tag I10
|
| 850 |
+
|
| 851 |
+
set xy {200 171 200 249} ;# Mast
|
| 852 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I10
|
| 853 |
+
set xy {159 234 182 234} ;# Bow sprit
|
| 854 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I10
|
| 855 |
+
set xy {180 234 180 251 220 251} ;# Hull
|
| 856 |
+
$w.c create line $xy -fill $::C(fg) -width 6 -tag I10
|
| 857 |
+
|
| 858 |
+
set xy {92 255 221 255} ;# Waves
|
| 859 |
+
Sine $w {*}$xy 2 25 -fill $color2 -width 1 -tag I10w
|
| 860 |
+
|
| 861 |
+
set xy [lrange [$w.c coords I10w] 4 end-4] ;# Water
|
| 862 |
+
set xy [concat $xy 222 266 222 277 99 277]
|
| 863 |
+
$w.c create poly $xy -fill $color2 -outline $color2
|
| 864 |
+
set xy {222 266 222 277 97 277 97 266} ;# Water bottom
|
| 865 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 866 |
+
|
| 867 |
+
set xy [box 239 262 17]
|
| 868 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
|
| 869 |
+
-start 95 -extent 103
|
| 870 |
+
set xy [box 76 266 21]
|
| 871 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 190
|
| 872 |
+
}
|
| 873 |
+
proc Move10 {w {step {}}} {
|
| 874 |
+
set step [GetStep 10 $step]
|
| 875 |
+
set pos {
|
| 876 |
+
{195 212} {193 212} {190 212} {186 212} {181 212} {176 212}
|
| 877 |
+
{171 212} {166 212} {161 212} {156 212} {151 212} {147 212} {142 212}
|
| 878 |
+
{137 212} {132 212 x} {127 212} {121 212} {116 212} {111 212}
|
| 879 |
+
}
|
| 880 |
+
|
| 881 |
+
if {$step >= [llength $pos]} {
|
| 882 |
+
return 0
|
| 883 |
+
}
|
| 884 |
+
set where [lindex $pos $step]
|
| 885 |
+
MoveAbs $w I10 $where
|
| 886 |
+
|
| 887 |
+
if {[lindex $where 2] eq "x"} {
|
| 888 |
+
return 3
|
| 889 |
+
}
|
| 890 |
+
return 1
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
# 2nd ball drop
|
| 894 |
+
proc Draw11 {w} {
|
| 895 |
+
set color $::C(11a)
|
| 896 |
+
set color2 $::C(11b)
|
| 897 |
+
set xy {23 264 55 591} ;# Color the down tube
|
| 898 |
+
$w.c create rect $xy -fill $color -outline {}
|
| 899 |
+
set xy [box 71 460 48] ;# Color the outer loop
|
| 900 |
+
$w.c create oval $xy -fill $color -outline {}
|
| 901 |
+
|
| 902 |
+
set xy {55 264 55 458} ;# Top right side
|
| 903 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 904 |
+
set xy {55 504 55 591} ;# Bottom right side
|
| 905 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 906 |
+
set xy [box 71 460 48] ;# Outer loop
|
| 907 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
|
| 908 |
+
-start 110 -extent -290 -tag I11i
|
| 909 |
+
set xy [box 71 460 16] ;# Inner loop
|
| 910 |
+
$w.c create oval $xy -outline $::C(fg) -fill {} -width 3 -tag I11i
|
| 911 |
+
$w.c create oval $xy -outline $::C(fg) -fill $::C(bg) -width 3
|
| 912 |
+
|
| 913 |
+
set xy {23 264 23 591} ;# Left side
|
| 914 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 915 |
+
set xy [box 1 266 23] ;# Top left curve
|
| 916 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 90
|
| 917 |
+
|
| 918 |
+
set xy [box 75 235 9] ;# The ball
|
| 919 |
+
$w.c create oval $xy -fill $color2 -outline {} -width 3 -tag I11
|
| 920 |
+
}
|
| 921 |
+
proc Move11 {w {step {}}} {
|
| 922 |
+
set step [GetStep 11 $step]
|
| 923 |
+
set pos {
|
| 924 |
+
{75 235} {70 235} {65 237} {56 240} {46 247} {38 266} {38 296}
|
| 925 |
+
{38 333} {38 399} {38 475} {74 496} {105 472} {100 437} {65 423}
|
| 926 |
+
{-100 -100} {38 505} {38 527 x} {38 591}
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
if {$step >= [llength $pos]} {
|
| 930 |
+
return 0
|
| 931 |
+
}
|
| 932 |
+
set where [lindex $pos $step]
|
| 933 |
+
MoveAbs $w I11 $where
|
| 934 |
+
if {[lindex $where 2] eq "x"} {
|
| 935 |
+
return 3
|
| 936 |
+
}
|
| 937 |
+
return 1
|
| 938 |
+
}
|
| 939 |
+
|
| 940 |
+
# Hand
|
| 941 |
+
proc Draw12 {w} {
|
| 942 |
+
set xy {20 637 20 617 20 610 20 590 40 590 40 590 60 590 60 610 60 610}
|
| 943 |
+
lappend xy 60 610 65 620 60 631 ;# Thumb
|
| 944 |
+
lappend xy 60 631 60 637 60 662 60 669 52 669 56 669 50 669 50 662 50 637
|
| 945 |
+
|
| 946 |
+
set y0 637 ;# Bumps for fingers
|
| 947 |
+
set y1 645
|
| 948 |
+
for {set x 50} {$x > 20} {incr x -10} {
|
| 949 |
+
set x1 [expr {$x - 5}]
|
| 950 |
+
set x2 [expr {$x - 10}]
|
| 951 |
+
lappend xy $x $y0 $x1 $y1 $x2 $y0
|
| 952 |
+
}
|
| 953 |
+
$w.c create poly $xy -fill $::C(12) -outline $::C(fg) -smooth 1 -tag I12 \
|
| 954 |
+
-width 3
|
| 955 |
+
}
|
| 956 |
+
proc Move12 {w {step {}}} {
|
| 957 |
+
set step [GetStep 12 $step]
|
| 958 |
+
set pos {{42.5 641 x}}
|
| 959 |
+
if {$step >= [llength $pos]} {
|
| 960 |
+
return 0
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
set where [lindex $pos $step]
|
| 964 |
+
MoveAbs $w I12 $where
|
| 965 |
+
if {[lindex $where 2] eq "x"} {
|
| 966 |
+
return 3
|
| 967 |
+
}
|
| 968 |
+
return 1
|
| 969 |
+
}
|
| 970 |
+
|
| 971 |
+
# Fax
|
| 972 |
+
proc Draw13 {w} {
|
| 973 |
+
set color $::C(13a)
|
| 974 |
+
set xy {86 663 149 663 149 704 50 704 50 681 64 681 86 671}
|
| 975 |
+
set xy2 {784 663 721 663 721 704 820 704 820 681 806 681 784 671}
|
| 976 |
+
set radii {2 9 9 8 5 5 2}
|
| 977 |
+
|
| 978 |
+
RoundPoly $w.c $xy $radii -width 3 -outline $::C(fg) -fill $color
|
| 979 |
+
RoundPoly $w.c $xy2 $radii -width 3 -outline $::C(fg) -fill $color
|
| 980 |
+
|
| 981 |
+
set xy {56 677}
|
| 982 |
+
$w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
|
| 983 |
+
-tag I13
|
| 984 |
+
set xy {809 677}
|
| 985 |
+
$w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
|
| 986 |
+
-tag I13R
|
| 987 |
+
|
| 988 |
+
set xy {112 687} ;# Label
|
| 989 |
+
$w.c create text $xy -text "FAX" -fill $::C(fg) \
|
| 990 |
+
-font {{Times Roman} 12 bold}
|
| 991 |
+
set xy {762 687}
|
| 992 |
+
$w.c create text $xy -text "FAX" -fill $::C(fg) \
|
| 993 |
+
-font {{Times Roman} 12 bold}
|
| 994 |
+
|
| 995 |
+
set xy {138 663 148 636 178 636} ;# Paper guide
|
| 996 |
+
$w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
|
| 997 |
+
set xy {732 663 722 636 692 636}
|
| 998 |
+
$w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
|
| 999 |
+
|
| 1000 |
+
Sine $w 149 688 720 688 5 15 -tag I13_s -fill $::C(fg) -width 3
|
| 1001 |
+
}
|
| 1002 |
+
proc Move13 {w {step {}}} {
|
| 1003 |
+
set step [GetStep 13 $step]
|
| 1004 |
+
set numsteps 7
|
| 1005 |
+
|
| 1006 |
+
if {$step == $numsteps+2} {
|
| 1007 |
+
MoveAbs $w I13_star {-100 -100}
|
| 1008 |
+
$w.c itemconfig I13R -fill $::C(13b) -width 2
|
| 1009 |
+
return 2
|
| 1010 |
+
}
|
| 1011 |
+
if {$step == 0} { ;# Button down
|
| 1012 |
+
$w.c delete I13
|
| 1013 |
+
Sparkle $w {-100 -100} I13_star ;# Create off screen
|
| 1014 |
+
return 1
|
| 1015 |
+
}
|
| 1016 |
+
lassign [Anchor $w I13_s w] x0 y0
|
| 1017 |
+
lassign [Anchor $w I13_s e] x1 y1
|
| 1018 |
+
set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}]
|
| 1019 |
+
MoveAbs $w I13_star [list $x $y0]
|
| 1020 |
+
return 1
|
| 1021 |
+
}
|
| 1022 |
+
|
| 1023 |
+
# Paper in fax
|
| 1024 |
+
proc Draw14 {w} {
|
| 1025 |
+
set color $::C(14)
|
| 1026 |
+
set xy {102 661 113 632 130 618} ;# Left paper edge
|
| 1027 |
+
$w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_0
|
| 1028 |
+
set xy {148 629 125 640 124 662} ;# Right paper edge
|
| 1029 |
+
$w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_1
|
| 1030 |
+
Draw14a $w L
|
| 1031 |
+
|
| 1032 |
+
set xy {
|
| 1033 |
+
768.0 662.5 767.991316225 662.433786215 767.926187912 662.396880171
|
| 1034 |
+
}
|
| 1035 |
+
$w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_0
|
| 1036 |
+
$w.c lower I14R_0
|
| 1037 |
+
# NB. these numbers are VERY sensitive, you must start with final size
|
| 1038 |
+
# and shrink down to get the values
|
| 1039 |
+
set xy {
|
| 1040 |
+
745.947897349 662.428358855 745.997829056 662.452239237 746.0 662.5
|
| 1041 |
+
}
|
| 1042 |
+
$w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_1
|
| 1043 |
+
$w.c lower I14R_1
|
| 1044 |
+
}
|
| 1045 |
+
proc Draw14a {w side} {
|
| 1046 |
+
set color $::C(14)
|
| 1047 |
+
set xy [$w.c coords I14${side}_0]
|
| 1048 |
+
set xy2 [$w.c coords I14${side}_1]
|
| 1049 |
+
lassign $xy x0 y0 x1 y1 x2 y2
|
| 1050 |
+
lassign $xy2 x3 y3 x4 y4 x5 y5
|
| 1051 |
+
set zz [concat \
|
| 1052 |
+
$x0 $y0 $x0 $y0 $xy $x2 $y2 $x2 $y2 \
|
| 1053 |
+
$x3 $y3 $x3 $y3 $xy2 $x5 $y5 $x5 $y5]
|
| 1054 |
+
$w.c delete I14$side
|
| 1055 |
+
$w.c create poly $zz -tag I14$side -smooth 1 -fill $color -outline $color \
|
| 1056 |
+
-width 3
|
| 1057 |
+
$w.c lower I14$side
|
| 1058 |
+
}
|
| 1059 |
+
proc Move14 {w {step {}}} {
|
| 1060 |
+
set step [GetStep 14 $step]
|
| 1061 |
+
|
| 1062 |
+
# Paper going down
|
| 1063 |
+
set sc [expr {.9 - .05*$step}]
|
| 1064 |
+
if {$sc < .3} {
|
| 1065 |
+
$w.c delete I14L
|
| 1066 |
+
return 0
|
| 1067 |
+
}
|
| 1068 |
+
|
| 1069 |
+
lassign [$w.c coords I14L_0] Ox Oy
|
| 1070 |
+
$w.c scale I14L_0 $Ox $Oy $sc $sc
|
| 1071 |
+
lassign [lrange [$w.c coords I14L_1] end-1 end] Ox Oy
|
| 1072 |
+
$w.c scale I14L_1 $Ox $Oy $sc $sc
|
| 1073 |
+
Draw14a $w L
|
| 1074 |
+
|
| 1075 |
+
# Paper going up
|
| 1076 |
+
set sc [expr {.35 + .05*$step}]
|
| 1077 |
+
set sc [expr {1 / $sc}]
|
| 1078 |
+
|
| 1079 |
+
lassign [$w.c coords I14R_0] Ox Oy
|
| 1080 |
+
$w.c scale I14R_0 $Ox $Oy $sc $sc
|
| 1081 |
+
lassign [lrange [$w.c coords I14R_1] end-1 end] Ox Oy
|
| 1082 |
+
$w.c scale I14R_1 $Ox $Oy $sc $sc
|
| 1083 |
+
Draw14a $w R
|
| 1084 |
+
|
| 1085 |
+
return [expr {$step == 10 ? 3 : 1}]
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
# Light beam
|
| 1089 |
+
proc Draw15 {w} {
|
| 1090 |
+
set color $::C(15a)
|
| 1091 |
+
set xy {824 599 824 585 820 585 829 585}
|
| 1092 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I15a
|
| 1093 |
+
set xy {789 599 836 643}
|
| 1094 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 3
|
| 1095 |
+
set xy {778 610 788 632}
|
| 1096 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 3
|
| 1097 |
+
set xy {766 617 776 625}
|
| 1098 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 3
|
| 1099 |
+
|
| 1100 |
+
set xy {633 600 681 640}
|
| 1101 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 3
|
| 1102 |
+
set xy {635 567 657 599}
|
| 1103 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 2
|
| 1104 |
+
set xy {765 557 784 583}
|
| 1105 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 2
|
| 1106 |
+
|
| 1107 |
+
Sine $w 658 580 765 580 3 15 -tag I15_s -fill $::C(fg) -width 3
|
| 1108 |
+
}
|
| 1109 |
+
proc Move15a {w} {
|
| 1110 |
+
set color $::C(15b)
|
| 1111 |
+
$w.c scale I15a 824 599 1 .3 ;# Button down
|
| 1112 |
+
set xy {765 621 681 621}
|
| 1113 |
+
$w.c create line $xy -dash "-" -width 3 -fill $color -tag I15
|
| 1114 |
+
}
|
| 1115 |
+
proc Move15 {w {step {}}} {
|
| 1116 |
+
set step [GetStep 15 $step]
|
| 1117 |
+
set numsteps 6
|
| 1118 |
+
|
| 1119 |
+
if {$step == $numsteps+2} {
|
| 1120 |
+
MoveAbs $w I15_star {-100 -100}
|
| 1121 |
+
return 2
|
| 1122 |
+
}
|
| 1123 |
+
if {$step == 0} { ;# Break the light beam
|
| 1124 |
+
Sparkle $w {-100 -100} I15_star
|
| 1125 |
+
set xy {765 621 745 621}
|
| 1126 |
+
$w.c coords I15 $xy
|
| 1127 |
+
return 1
|
| 1128 |
+
}
|
| 1129 |
+
lassign [Anchor $w I15_s w] x0 y0
|
| 1130 |
+
lassign [Anchor $w I15_s e] x1 y1
|
| 1131 |
+
set x [expr {$x0 + ($x1-$x0) * ($step - 1) / double($numsteps)}]
|
| 1132 |
+
MoveAbs $w I15_star [list $x $y0]
|
| 1133 |
+
return 1
|
| 1134 |
+
}
|
| 1135 |
+
|
| 1136 |
+
# Bell
|
| 1137 |
+
proc Draw16 {w} {
|
| 1138 |
+
set color $::C(16)
|
| 1139 |
+
set xy {722 485 791 556}
|
| 1140 |
+
$w.c create rect $xy -fill {} -outline $::C(fg) -width 3
|
| 1141 |
+
set xy [box 752 515 25] ;# Bell
|
| 1142 |
+
$w.c create oval $xy -fill $color -outline black -tag I16b -width 2
|
| 1143 |
+
set xy [box 752 515 5] ;# Bell button
|
| 1144 |
+
$w.c create oval $xy -fill black -outline black -tag I16b
|
| 1145 |
+
|
| 1146 |
+
set xy {784 523 764 549} ;# Clapper
|
| 1147 |
+
$w.c create line $xy -width 3 -tag I16c -fill $::C(fg)
|
| 1148 |
+
set xy [box 784 523 4]
|
| 1149 |
+
$w.c create oval $xy -fill $::C(fg) -outline $::C(fg) -tag I16d
|
| 1150 |
+
}
|
| 1151 |
+
proc Move16 {w {step {}}} {
|
| 1152 |
+
set step [GetStep 16 $step]
|
| 1153 |
+
|
| 1154 |
+
# Note: we never stop
|
| 1155 |
+
lassign {760 553} Ox Oy
|
| 1156 |
+
if {$step & 1} {
|
| 1157 |
+
set beta 12
|
| 1158 |
+
$w.c move I16b 3 0
|
| 1159 |
+
} else {
|
| 1160 |
+
set beta -12
|
| 1161 |
+
$w.c move I16b -3 0
|
| 1162 |
+
}
|
| 1163 |
+
RotateItem $w I16c $Ox $Oy $beta
|
| 1164 |
+
RotateItem $w I16d $Ox $Oy $beta
|
| 1165 |
+
|
| 1166 |
+
return [expr {$step == 1 ? 3 : 1}]
|
| 1167 |
+
}
|
| 1168 |
+
|
| 1169 |
+
# Cat
|
| 1170 |
+
proc Draw17 {w} {
|
| 1171 |
+
set color $::C(17)
|
| 1172 |
+
|
| 1173 |
+
set xy {584 556 722 556}
|
| 1174 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 1175 |
+
set xy {584 485 722 485}
|
| 1176 |
+
$w.c create line $xy -fill $::C(fg) -width 3
|
| 1177 |
+
|
| 1178 |
+
set xy {664 523 717 549} ;# Body
|
| 1179 |
+
$w.c create arc $xy -outline $::C(fg) -fill $color -width 3 \
|
| 1180 |
+
-style chord -start 128 -extent -260 -tag I17
|
| 1181 |
+
|
| 1182 |
+
set xy {709 554 690 543} ;# Paw
|
| 1183 |
+
$w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
|
| 1184 |
+
set xy {657 544 676 555}
|
| 1185 |
+
$w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
|
| 1186 |
+
|
| 1187 |
+
set xy [box 660 535 15] ;# Lower face
|
| 1188 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
|
| 1189 |
+
-start 150 -extent 240 -tag I17_
|
| 1190 |
+
$w.c create arc $xy -outline {} -fill $color -width 1 -style chord \
|
| 1191 |
+
-start 150 -extent 240 -tag I17_
|
| 1192 |
+
set xy {674 529 670 513 662 521 658 521 650 513 647 529} ;# Ears
|
| 1193 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1194 |
+
$w.c create poly $xy -fill $color -outline {} -width 1 -tag {I17_ I17_c}
|
| 1195 |
+
set xy {652 542 628 539} ;# Whiskers
|
| 1196 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1197 |
+
set xy {652 543 632 545}
|
| 1198 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1199 |
+
set xy {652 546 632 552}
|
| 1200 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1201 |
+
|
| 1202 |
+
set xy {668 543 687 538}
|
| 1203 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
|
| 1204 |
+
set xy {668 544 688 546}
|
| 1205 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
|
| 1206 |
+
set xy {668 547 688 553}
|
| 1207 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
|
| 1208 |
+
|
| 1209 |
+
set xy {649 530 654 538 659 530} ;# Left eye
|
| 1210 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
|
| 1211 |
+
set xy {671 530 666 538 661 530} ;# Right eye
|
| 1212 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
|
| 1213 |
+
set xy {655 543 660 551 665 543} ;# Mouth
|
| 1214 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
|
| 1215 |
+
}
|
| 1216 |
+
proc Move17 {w {step {}}} {
|
| 1217 |
+
set step [GetStep 17 $step]
|
| 1218 |
+
|
| 1219 |
+
if {$step == 0} {
|
| 1220 |
+
$w.c delete I17 ;# Delete most of the cat
|
| 1221 |
+
set xy {655 543 660 535 665 543} ;# Mouth
|
| 1222 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
|
| 1223 |
+
set xy [box 654 530 4] ;# Left eye
|
| 1224 |
+
$w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
|
| 1225 |
+
set xy [box 666 530 4] ;# Right eye
|
| 1226 |
+
$w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
|
| 1227 |
+
|
| 1228 |
+
$w.c move I17_ 0 -20 ;# Move face up
|
| 1229 |
+
set xy {652 528 652 554} ;# Front leg
|
| 1230 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1231 |
+
set xy {670 528 670 554} ;# 2nd front leg
|
| 1232 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1233 |
+
|
| 1234 |
+
set xy {
|
| 1235 |
+
675 506 694 489 715 513 715 513 715 513 716 525 716 525 716 525
|
| 1236 |
+
706 530 695 530 679 535 668 527 668 527 668 527 675 522 676 517
|
| 1237 |
+
677 512
|
| 1238 |
+
} ;# Body
|
| 1239 |
+
$w.c create poly $xy -fill [$w.c itemcget I17_c -fill] \
|
| 1240 |
+
-outline $::C(fg) -width 3 -smooth 1 -tag I17_
|
| 1241 |
+
set xy {716 514 716 554} ;# Back leg
|
| 1242 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1243 |
+
set xy {694 532 694 554} ;# 2nd back leg
|
| 1244 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
|
| 1245 |
+
set xy {715 514 718 506 719 495 716 488};# Tail
|
| 1246 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
|
| 1247 |
+
|
| 1248 |
+
$w.c raise I17w ;# Make whiskers visible
|
| 1249 |
+
$w.c move I17_ -5 0 ;# Move away from wall a bit
|
| 1250 |
+
return 2
|
| 1251 |
+
}
|
| 1252 |
+
return 0
|
| 1253 |
+
}
|
| 1254 |
+
|
| 1255 |
+
# Sling shot
|
| 1256 |
+
proc Draw18 {w} {
|
| 1257 |
+
set color $::C(18)
|
| 1258 |
+
set xy {721 506 627 506} ;# Sling hold
|
| 1259 |
+
$w.c create line $xy -width 4 -fill $::C(fg) -tag I18
|
| 1260 |
+
|
| 1261 |
+
set xy {607 500 628 513} ;# Sling rock
|
| 1262 |
+
$w.c create oval $xy -fill $color -outline {} -tag I18a
|
| 1263 |
+
|
| 1264 |
+
set xy {526 513 606 507 494 502} ;# Sling band
|
| 1265 |
+
$w.c create line $xy -fill $::C(fg) -width 4 -tag I18b
|
| 1266 |
+
set xy { 485 490 510 540 510 575 510 540 535 491 } ;# Sling
|
| 1267 |
+
$w.c create line $xy -fill $::C(fg) -width 6
|
| 1268 |
+
}
|
| 1269 |
+
proc Move18 {w {step {}}} {
|
| 1270 |
+
set step [GetStep 18 $step]
|
| 1271 |
+
|
| 1272 |
+
set pos {
|
| 1273 |
+
{587 506} {537 506} {466 506} {376 506} {266 506 x} {136 506}
|
| 1274 |
+
{16 506} {-100 -100}
|
| 1275 |
+
}
|
| 1276 |
+
|
| 1277 |
+
set b(0) {490 502 719 507 524 512} ;# Band collapsing
|
| 1278 |
+
set b(1) {
|
| 1279 |
+
491 503 524 557 563 505 559 496 546 506 551 525 553 536 538 534
|
| 1280 |
+
532 519 529 499
|
| 1281 |
+
}
|
| 1282 |
+
set b(2) {491 503 508 563 542 533 551 526 561 539 549 550 530 500}
|
| 1283 |
+
set b(3) {491 503 508 563 530 554 541 562 525 568 519 544 530 501}
|
| 1284 |
+
|
| 1285 |
+
if {$step >= [llength $pos]} {
|
| 1286 |
+
return 0
|
| 1287 |
+
}
|
| 1288 |
+
|
| 1289 |
+
if {$step == 0} {
|
| 1290 |
+
$w.c delete I18
|
| 1291 |
+
$w.c itemconfig I18b -smooth 1
|
| 1292 |
+
}
|
| 1293 |
+
if {[info exists b($step)]} {
|
| 1294 |
+
$w.c coords I18b $b($step)
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
set where [lindex $pos $step]
|
| 1298 |
+
MoveAbs $w I18a $where
|
| 1299 |
+
if {[lindex $where 2] eq "x"} {
|
| 1300 |
+
return 3
|
| 1301 |
+
}
|
| 1302 |
+
return 1
|
| 1303 |
+
}
|
| 1304 |
+
|
| 1305 |
+
# Water pipe
|
| 1306 |
+
proc Draw19 {w} {
|
| 1307 |
+
set color $::C(19)
|
| 1308 |
+
set xx {249 181 155 118 86 55 22 0}
|
| 1309 |
+
foreach {x1 x2} $xx {
|
| 1310 |
+
$w.c create rect $x1 453 $x2 467 -fill $color -outline {} -tag I19
|
| 1311 |
+
$w.c create line $x1 453 $x2 453 -fill $::C(fg) -width 1;# Pipe top
|
| 1312 |
+
$w.c create line $x1 467 $x2 467 -fill $::C(fg) -width 1;# Pipe bottom
|
| 1313 |
+
}
|
| 1314 |
+
$w.c raise I11i
|
| 1315 |
+
|
| 1316 |
+
set xy [box 168 460 16] ;# Bulge by the joint
|
| 1317 |
+
$w.c create oval $xy -fill $color -outline {}
|
| 1318 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
|
| 1319 |
+
-start 21 -extent 136
|
| 1320 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
|
| 1321 |
+
-start -21 -extent -130
|
| 1322 |
+
|
| 1323 |
+
set xy {249 447 255 473} ;# First joint 26x6
|
| 1324 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1325 |
+
|
| 1326 |
+
set xy [box 257 433 34] ;# Bend up
|
| 1327 |
+
$w.c create arc $xy -outline {} -fill $color -width 1 \
|
| 1328 |
+
-style pie -start 0 -extent -91
|
| 1329 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1330 |
+
-style arc -start 0 -extent -90
|
| 1331 |
+
set xy [box 257 433 20]
|
| 1332 |
+
$w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
|
| 1333 |
+
-style pie -start 0 -extent -92
|
| 1334 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1335 |
+
-style arc -start 0 -extent -90
|
| 1336 |
+
set xy [box 257 421 34] ;# Bend left
|
| 1337 |
+
$w.c create arc $xy -outline {} -fill $color -width 1 \
|
| 1338 |
+
-style pie -start 1 -extent 91
|
| 1339 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1340 |
+
-style arc -start 0 -extent 90
|
| 1341 |
+
set xy [box 257 421 20]
|
| 1342 |
+
$w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
|
| 1343 |
+
-style pie -start 0 -extent 90
|
| 1344 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1345 |
+
-style arc -start 0 -extent 90
|
| 1346 |
+
set xy [box 243 421 34] ;# Bend down
|
| 1347 |
+
$w.c create arc $xy -outline {} -fill $color -width 1 \
|
| 1348 |
+
-style pie -start 90 -extent 90
|
| 1349 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1350 |
+
-style arc -start 90 -extent 90
|
| 1351 |
+
set xy [box 243 421 20]
|
| 1352 |
+
$w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
|
| 1353 |
+
-style pie -start 90 -extent 90
|
| 1354 |
+
$w.c create arc $xy -outline $::C(fg) -width 1 \
|
| 1355 |
+
-style arc -start 90 -extent 90
|
| 1356 |
+
|
| 1357 |
+
set xy {270 427 296 433} ;# 2nd joint bottom
|
| 1358 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1359 |
+
set xy {270 421 296 427} ;# 2nd joint top
|
| 1360 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1361 |
+
set xy {249 382 255 408} ;# Third joint right
|
| 1362 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1363 |
+
set xy {243 382 249 408} ;# Third joint left
|
| 1364 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1365 |
+
set xy {203 420 229 426} ;# Last joint
|
| 1366 |
+
$w.c create rect $xy -fill $color -outline $::C(fg) -width 1
|
| 1367 |
+
|
| 1368 |
+
set xy [box 168 460 6] ;# Handle joint
|
| 1369 |
+
$w.c create oval $xy -fill $::C(fg) -outline {} -tag I19a
|
| 1370 |
+
set xy {168 460 168 512} ;# Handle bar
|
| 1371 |
+
$w.c create line $xy -fill $::C(fg) -width 5 -tag I19b
|
| 1372 |
+
}
|
| 1373 |
+
proc Move19 {w {step {}}} {
|
| 1374 |
+
set step [GetStep 19 $step]
|
| 1375 |
+
|
| 1376 |
+
set angles {30 30 30}
|
| 1377 |
+
if {$step == [llength $angles]} {
|
| 1378 |
+
return 2
|
| 1379 |
+
}
|
| 1380 |
+
|
| 1381 |
+
RotateItem $w I19b {*}[Centroid $w I19a] [lindex $angles $step]
|
| 1382 |
+
return 1
|
| 1383 |
+
}
|
| 1384 |
+
|
| 1385 |
+
# Water pouring
|
| 1386 |
+
proc Draw20 {w} {
|
| 1387 |
+
}
|
| 1388 |
+
proc Move20 {w {step {}}} {
|
| 1389 |
+
set step [GetStep 20 $step]
|
| 1390 |
+
|
| 1391 |
+
set pos {451 462 473 484 496 504 513 523 532}
|
| 1392 |
+
set freq {20 40 40 40 40 40 40 40 40}
|
| 1393 |
+
set pos {
|
| 1394 |
+
{451 20} {462 40} {473 40} {484 40} {496 40} {504 40} {513 40}
|
| 1395 |
+
{523 40} {532 40 x}
|
| 1396 |
+
}
|
| 1397 |
+
if {$step >= [llength $pos]} {
|
| 1398 |
+
return 0
|
| 1399 |
+
}
|
| 1400 |
+
|
| 1401 |
+
$w.c delete I20
|
| 1402 |
+
set where [lindex $pos $step]
|
| 1403 |
+
lassign $where y f
|
| 1404 |
+
H2O $w $y $f
|
| 1405 |
+
if {[lindex $where 2] eq "x"} {
|
| 1406 |
+
return 3
|
| 1407 |
+
}
|
| 1408 |
+
return 1
|
| 1409 |
+
}
|
| 1410 |
+
proc H2O {w y f} {
|
| 1411 |
+
set color $::C(20)
|
| 1412 |
+
$w.c delete I20
|
| 1413 |
+
|
| 1414 |
+
Sine $w 208 428 208 $y 4 $f -tag {I20 I20s} -width 3 -fill $color \
|
| 1415 |
+
-smooth 1
|
| 1416 |
+
$w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
|
| 1417 |
+
-tag {I20 I20a}
|
| 1418 |
+
$w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
|
| 1419 |
+
-tag {I20 I20b}
|
| 1420 |
+
$w.c move I20a 8 0
|
| 1421 |
+
$w.c move I20b 16 0
|
| 1422 |
+
}
|
| 1423 |
+
|
| 1424 |
+
# Bucket
|
| 1425 |
+
proc Draw21 {w} {
|
| 1426 |
+
set color $::C(21)
|
| 1427 |
+
set xy {217 451 244 490} ;# Right handle
|
| 1428 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
|
| 1429 |
+
set xy {201 467 182 490} ;# Left handle
|
| 1430 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
|
| 1431 |
+
|
| 1432 |
+
set xy {245 490 237 535} ;# Right side
|
| 1433 |
+
set xy2 {189 535 181 490} ;# Left side
|
| 1434 |
+
$w.c create poly [concat $xy $xy2] -fill $color -outline {} \
|
| 1435 |
+
-tag {I21 I21f}
|
| 1436 |
+
$w.c create line $xy -fill $::C(fg) -width 2 -tag I21
|
| 1437 |
+
$w.c create line $xy2 -fill $::C(fg) -width 2 -tag I21
|
| 1438 |
+
|
| 1439 |
+
set xy {182 486 244 498} ;# Top
|
| 1440 |
+
$w.c create oval $xy -fill $color -outline {} -width 2 -tag {I21 I21f}
|
| 1441 |
+
$w.c create oval $xy -fill {} -outline $::C(fg) -width 2 -tag {I21 I21t}
|
| 1442 |
+
set xy {189 532 237 540} ;# Bottom
|
| 1443 |
+
$w.c create oval $xy -fill $color -outline $::C(fg) -width 2 \
|
| 1444 |
+
-tag {I21 I21b}
|
| 1445 |
+
}
|
| 1446 |
+
proc Move21 {w {step {}}} {
|
| 1447 |
+
set step [GetStep 21 $step]
|
| 1448 |
+
|
| 1449 |
+
set numsteps 30
|
| 1450 |
+
if {$step >= $numsteps} {
|
| 1451 |
+
return 0
|
| 1452 |
+
}
|
| 1453 |
+
|
| 1454 |
+
lassign [$w.c coords I21b] x1 y1 x2 y2
|
| 1455 |
+
#lassign [$w.c coords I21t] X1 Y1 X2 Y2
|
| 1456 |
+
lassign {183 492 243 504} X1 Y1 X2 Y2
|
| 1457 |
+
|
| 1458 |
+
set f [expr {$step / double($numsteps)}]
|
| 1459 |
+
set y2 [expr {$y2 - 3}]
|
| 1460 |
+
set xx1 [expr {$x1 + ($X1 - $x1) * $f}]
|
| 1461 |
+
set yy1 [expr {$y1 + ($Y1 - $y1) * $f}]
|
| 1462 |
+
set xx2 [expr {$x2 + ($X2 - $x2) * $f}]
|
| 1463 |
+
set yy2 [expr {$y2 + ($Y2 - $y2) * $f}]
|
| 1464 |
+
#H2O $w $yy1 40
|
| 1465 |
+
|
| 1466 |
+
$w.c itemconfig I21b -fill $::C(20)
|
| 1467 |
+
$w.c delete I21w
|
| 1468 |
+
$w.c create poly $x2 $y2 $x1 $y1 $xx1 $yy1 $xx2 $yy1 -tag {I21 I21w} \
|
| 1469 |
+
-outline {} -fill $::C(20)
|
| 1470 |
+
$w.c lower I21w I21
|
| 1471 |
+
$w.c raise I21b
|
| 1472 |
+
$w.c lower I21f
|
| 1473 |
+
|
| 1474 |
+
return [expr {$step == $numsteps-1 ? 3 : 1}]
|
| 1475 |
+
}
|
| 1476 |
+
|
| 1477 |
+
# Bucket drop
|
| 1478 |
+
proc Draw22 {w} {
|
| 1479 |
+
}
|
| 1480 |
+
proc Move22 {w {step {}}} {
|
| 1481 |
+
set step [GetStep 22 $step]
|
| 1482 |
+
set pos {{213 513} {213 523} {213 543 x} {213 583} {213 593}}
|
| 1483 |
+
|
| 1484 |
+
if {$step == 0} {$w.c itemconfig I21f -fill $::C(22)}
|
| 1485 |
+
if {$step >= [llength $pos]} {
|
| 1486 |
+
return 0
|
| 1487 |
+
}
|
| 1488 |
+
set where [lindex $pos $step]
|
| 1489 |
+
MoveAbs $w I21 $where
|
| 1490 |
+
H2O $w [lindex $where 1] 40
|
| 1491 |
+
$w.c delete I21_a ;# Delete handles
|
| 1492 |
+
|
| 1493 |
+
if {[lindex $where 2] eq "x"} {
|
| 1494 |
+
return 3
|
| 1495 |
+
}
|
| 1496 |
+
return 1
|
| 1497 |
+
}
|
| 1498 |
+
|
| 1499 |
+
# Blow dart
|
| 1500 |
+
proc Draw23 {w} {
|
| 1501 |
+
set color $::C(23a)
|
| 1502 |
+
set color2 $::C(23b)
|
| 1503 |
+
set color3 $::C(23c)
|
| 1504 |
+
|
| 1505 |
+
set xy {185 623 253 650} ;# Block
|
| 1506 |
+
$w.c create rect $xy -fill black -outline $::C(fg) -width 2 -tag I23a
|
| 1507 |
+
set xy {187 592 241 623} ;# Balloon
|
| 1508 |
+
$w.c create oval $xy -outline {} -fill $color -tag I23b
|
| 1509 |
+
$w.c create arc $xy -outline $::C(fg) -width 3 -tag I23b \
|
| 1510 |
+
-style arc -start 12 -extent 336
|
| 1511 |
+
set xy {239 604 258 589 258 625 239 610} ;# Balloon nozzle
|
| 1512 |
+
$w.c create poly $xy -outline {} -fill $color -tag I23b
|
| 1513 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I23b
|
| 1514 |
+
|
| 1515 |
+
set xy {285 611 250 603} ;# Dart body
|
| 1516 |
+
$w.c create oval $xy -fill $color2 -outline $::C(fg) -width 3 -tag I23d
|
| 1517 |
+
set xy {249 596 249 618 264 607 249 596} ;# Dart tail
|
| 1518 |
+
$w.c create poly $xy -fill $color3 -outline $::C(fg) -width 3 -tag I23d
|
| 1519 |
+
set xy {249 607 268 607} ;# Dart detail
|
| 1520 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
|
| 1521 |
+
set xy {285 607 305 607} ;# Dart needle
|
| 1522 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
|
| 1523 |
+
}
|
| 1524 |
+
proc Move23 {w {step {}}} {
|
| 1525 |
+
set step [GetStep 23 $step]
|
| 1526 |
+
|
| 1527 |
+
set pos {
|
| 1528 |
+
{277 607} {287 607} {307 607 x} {347 607} {407 607} {487 607}
|
| 1529 |
+
{587 607} {687 607} {787 607} {-100 -100}
|
| 1530 |
+
}
|
| 1531 |
+
|
| 1532 |
+
if {$step >= [llength $pos]} {
|
| 1533 |
+
return 0
|
| 1534 |
+
}
|
| 1535 |
+
if {$step <= 1} {
|
| 1536 |
+
$w.c scale I23b {*}[Anchor $w I23a n] .9 .5
|
| 1537 |
+
}
|
| 1538 |
+
set where [lindex $pos $step]
|
| 1539 |
+
MoveAbs $w I23d $where
|
| 1540 |
+
|
| 1541 |
+
if {[lindex $where 2] eq "x"} {
|
| 1542 |
+
return 3
|
| 1543 |
+
}
|
| 1544 |
+
return 1
|
| 1545 |
+
}
|
| 1546 |
+
|
| 1547 |
+
# Balloon
|
| 1548 |
+
proc Draw24 {w} {
|
| 1549 |
+
set color $::C(24a)
|
| 1550 |
+
set xy {366 518 462 665} ;# Balloon
|
| 1551 |
+
$w.c create oval $xy -fill $color -outline $::C(fg) -width 3 -tag I24
|
| 1552 |
+
set xy {414 666 414 729} ;# String
|
| 1553 |
+
$w.c create line $xy -fill $::C(fg) -width 3 -tag I24
|
| 1554 |
+
set xy {410 666 404 673 422 673 418 666} ;# Nozzle
|
| 1555 |
+
$w.c create poly $xy -fill $color -outline $::C(fg) -width 3 -tag I24
|
| 1556 |
+
|
| 1557 |
+
set xy {387 567 390 549 404 542} ;# Reflections
|
| 1558 |
+
$w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
|
| 1559 |
+
set xy {395 568 399 554 413 547}
|
| 1560 |
+
$w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
|
| 1561 |
+
set xy {403 570 396 555 381 553}
|
| 1562 |
+
$w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
|
| 1563 |
+
set xy {408 564 402 547 386 545}
|
| 1564 |
+
$w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
|
| 1565 |
+
}
|
| 1566 |
+
proc Move24 {w {step {}}} {
|
| 1567 |
+
global S
|
| 1568 |
+
set step [GetStep 24 $step]
|
| 1569 |
+
|
| 1570 |
+
if {$step > 4} {
|
| 1571 |
+
return 0
|
| 1572 |
+
} elseif {$step == 4} {
|
| 1573 |
+
return 2
|
| 1574 |
+
}
|
| 1575 |
+
|
| 1576 |
+
if {$step == 0} {
|
| 1577 |
+
$w.c delete I24 ;# Exploding balloon
|
| 1578 |
+
set xy {
|
| 1579 |
+
347 465 361 557 271 503 272 503 342 574 259 594 259 593 362 626
|
| 1580 |
+
320 737 320 740 398 691 436 738 436 739 476 679 528 701 527 702
|
| 1581 |
+
494 627 548 613 548 613 480 574 577 473 577 473 474 538 445 508
|
| 1582 |
+
431 441 431 440 400 502 347 465 347 465
|
| 1583 |
+
}
|
| 1584 |
+
$w.c create poly $xy -tag I24 -fill $::C(24b) -outline $::C(24a) \
|
| 1585 |
+
-width 10 -smooth 1
|
| 1586 |
+
set msg [subst $S(message)]
|
| 1587 |
+
$w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \
|
| 1588 |
+
-fill $::C(24c) \
|
| 1589 |
+
-justify center -font {{Times Roman} 18 bold}
|
| 1590 |
+
return 1
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
$w.c itemconfig I24t -font [list {Times Roman} [expr {18 + 6*$step}] bold]
|
| 1594 |
+
$w.c move I24 0 -60
|
| 1595 |
+
$w.c scale I24 {*}[Centroid $w I24] 1.25 1.25
|
| 1596 |
+
return 1
|
| 1597 |
+
}
|
| 1598 |
+
|
| 1599 |
+
# Displaying the message
|
| 1600 |
+
proc Move25 {w {step {}}} {
|
| 1601 |
+
global S
|
| 1602 |
+
set step [GetStep 25 $step]
|
| 1603 |
+
if {$step == 0} {
|
| 1604 |
+
set ::XY(25) [clock clicks -milliseconds]
|
| 1605 |
+
return 1
|
| 1606 |
+
}
|
| 1607 |
+
set elapsed [expr {[clock clicks -milliseconds] - $::XY(25)}]
|
| 1608 |
+
if {$elapsed < 5000} {
|
| 1609 |
+
return 1
|
| 1610 |
+
}
|
| 1611 |
+
return 2
|
| 1612 |
+
}
|
| 1613 |
+
|
| 1614 |
+
# Collapsing balloon
|
| 1615 |
+
proc Move26 {w {step {}}} {
|
| 1616 |
+
global S
|
| 1617 |
+
set step [GetStep 26 $step]
|
| 1618 |
+
|
| 1619 |
+
if {$step >= 3} {
|
| 1620 |
+
$w.c delete I24 I26
|
| 1621 |
+
$w.c create text 430 755 -anchor s -tag I26 \
|
| 1622 |
+
-fill $::C(26) \
|
| 1623 |
+
-text "click to continue" -font {{Times Roman} 24 bold}
|
| 1624 |
+
bind $w.c <Button-1> [list Reset $w]
|
| 1625 |
+
return 4
|
| 1626 |
+
}
|
| 1627 |
+
|
| 1628 |
+
$w.c scale I24 {*}[Centroid $w I24] .8 .8
|
| 1629 |
+
$w.c move I24 0 60
|
| 1630 |
+
$w.c itemconfig I24t -font [list {Times Roman} [expr {30 - 6*$step}] bold]
|
| 1631 |
+
return 1
|
| 1632 |
+
}
|
| 1633 |
+
|
| 1634 |
+
################################################################
|
| 1635 |
+
#
|
| 1636 |
+
# Helper functions
|
| 1637 |
+
#
|
| 1638 |
+
|
| 1639 |
+
proc box {x y r} {
|
| 1640 |
+
return [list [expr {$x-$r}] [expr {$y-$r}] [expr {$x+$r}] [expr {$y+$r}]]
|
| 1641 |
+
}
|
| 1642 |
+
|
| 1643 |
+
proc MoveAbs {w item xy} {
|
| 1644 |
+
lassign $xy x y
|
| 1645 |
+
lassign [Centroid $w $item] Ox Oy
|
| 1646 |
+
set dx [expr {$x - $Ox}]
|
| 1647 |
+
set dy [expr {$y - $Oy}]
|
| 1648 |
+
$w.c move $item $dx $dy
|
| 1649 |
+
}
|
| 1650 |
+
|
| 1651 |
+
proc RotateItem {w item Ox Oy beta} {
|
| 1652 |
+
set xy [$w.c coords $item]
|
| 1653 |
+
set xy2 {}
|
| 1654 |
+
foreach {x y} $xy {
|
| 1655 |
+
lappend xy2 {*}[RotateC $x $y $Ox $Oy $beta]
|
| 1656 |
+
}
|
| 1657 |
+
$w.c coords $item $xy2
|
| 1658 |
+
}
|
| 1659 |
+
|
| 1660 |
+
proc RotateC {x y Ox Oy beta} {
|
| 1661 |
+
# rotates vector (Ox,Oy)->(x,y) by beta degrees clockwise
|
| 1662 |
+
|
| 1663 |
+
set x [expr {$x - $Ox}] ;# Shift to origin
|
| 1664 |
+
set y [expr {$y - $Oy}]
|
| 1665 |
+
|
| 1666 |
+
set beta [expr {$beta * atan(1) * 4 / 180.0}] ;# Radians
|
| 1667 |
+
set xx [expr {$x * cos($beta) - $y * sin($beta)}] ;# Rotate
|
| 1668 |
+
set yy [expr {$x * sin($beta) + $y * cos($beta)}]
|
| 1669 |
+
|
| 1670 |
+
set xx [expr {$xx + $Ox}] ;# Shift back
|
| 1671 |
+
set yy [expr {$yy + $Oy}]
|
| 1672 |
+
|
| 1673 |
+
return [list $xx $yy]
|
| 1674 |
+
}
|
| 1675 |
+
|
| 1676 |
+
proc Reset {w} {
|
| 1677 |
+
global S
|
| 1678 |
+
DrawAll $w
|
| 1679 |
+
bind $w.c <Button-1> {}
|
| 1680 |
+
set S(mode) $::MSTART
|
| 1681 |
+
set S(active) 0
|
| 1682 |
+
}
|
| 1683 |
+
|
| 1684 |
+
# Each Move## keeps its state info in STEP, this retrieves and increments it
|
| 1685 |
+
proc GetStep {who step} {
|
| 1686 |
+
global STEP
|
| 1687 |
+
if {$step ne ""} {
|
| 1688 |
+
set STEP($who) $step
|
| 1689 |
+
} elseif {![info exists STEP($who)] || $STEP($who) eq ""} {
|
| 1690 |
+
set STEP($who) 0
|
| 1691 |
+
} else {
|
| 1692 |
+
incr STEP($who)
|
| 1693 |
+
}
|
| 1694 |
+
return $STEP($who)
|
| 1695 |
+
}
|
| 1696 |
+
|
| 1697 |
+
proc ResetStep {} {
|
| 1698 |
+
global STEP
|
| 1699 |
+
set ::S(cnt) 0
|
| 1700 |
+
foreach a [array names STEP] {
|
| 1701 |
+
set STEP($a) ""
|
| 1702 |
+
}
|
| 1703 |
+
}
|
| 1704 |
+
|
| 1705 |
+
proc Sine {w x0 y0 x1 y1 amp freq args} {
|
| 1706 |
+
set PI [expr {4 * atan(1)}]
|
| 1707 |
+
set step 2
|
| 1708 |
+
set xy {}
|
| 1709 |
+
if {$y0 == $y1} { ;# Horizontal
|
| 1710 |
+
for {set x $x0} {$x <= $x1} {incr x $step} {
|
| 1711 |
+
set beta [expr {($x - $x0) * 2 * $PI / $freq}]
|
| 1712 |
+
set y [expr {$y0 + $amp * sin($beta)}]
|
| 1713 |
+
lappend xy $x $y
|
| 1714 |
+
}
|
| 1715 |
+
} else {
|
| 1716 |
+
for {set y $y0} {$y <= $y1} {incr y $step} {
|
| 1717 |
+
set beta [expr {($y - $y0) * 2 * $PI / $freq}]
|
| 1718 |
+
set x [expr {$x0 + $amp * sin($beta)}]
|
| 1719 |
+
lappend xy $x $y
|
| 1720 |
+
}
|
| 1721 |
+
}
|
| 1722 |
+
return [$w.c create line $xy {*}$args]
|
| 1723 |
+
}
|
| 1724 |
+
|
| 1725 |
+
proc RoundRect {w xy radius args} {
|
| 1726 |
+
lassign $xy x0 y0 x3 y3
|
| 1727 |
+
set r [winfo pixels $w.c $radius]
|
| 1728 |
+
set d [expr {2 * $r}]
|
| 1729 |
+
|
| 1730 |
+
# Make sure that the radius of the curve is less than 3/8 size of the box!
|
| 1731 |
+
set maxr 0.75
|
| 1732 |
+
if {$d > $maxr * ($x3 - $x0)} {
|
| 1733 |
+
set d [expr {$maxr * ($x3 - $x0)}]
|
| 1734 |
+
}
|
| 1735 |
+
if {$d > $maxr * ($y3 - $y0)} {
|
| 1736 |
+
set d [expr {$maxr * ($y3 - $y0)}]
|
| 1737 |
+
}
|
| 1738 |
+
|
| 1739 |
+
set x1 [expr { $x0 + $d }]
|
| 1740 |
+
set x2 [expr { $x3 - $d }]
|
| 1741 |
+
set y1 [expr { $y0 + $d }]
|
| 1742 |
+
set y2 [expr { $y3 - $d }]
|
| 1743 |
+
|
| 1744 |
+
set xy [list $x0 $y0 $x1 $y0 $x2 $y0 $x3 $y0 $x3 $y1 $x3 $y2]
|
| 1745 |
+
lappend xy $x3 $y3 $x2 $y3 $x1 $y3 $x0 $y3 $x0 $y2 $x0 $y1
|
| 1746 |
+
return $xy
|
| 1747 |
+
}
|
| 1748 |
+
|
| 1749 |
+
proc RoundPoly {canv xy radii args} {
|
| 1750 |
+
set lenXY [llength $xy]
|
| 1751 |
+
set lenR [llength $radii]
|
| 1752 |
+
if {$lenXY != 2*$lenR} {
|
| 1753 |
+
error "wrong number of vertices and radii"
|
| 1754 |
+
}
|
| 1755 |
+
|
| 1756 |
+
set knots {}
|
| 1757 |
+
lassign [lrange $xy end-1 end] x0 y0
|
| 1758 |
+
lassign $xy x1 y1
|
| 1759 |
+
lappend xy {*}[lrange $xy 0 1]
|
| 1760 |
+
|
| 1761 |
+
for {set i 0} {$i < $lenXY} {incr i 2} {
|
| 1762 |
+
set radius [lindex $radii [expr {$i/2}]]
|
| 1763 |
+
set r [winfo pixels $canv $radius]
|
| 1764 |
+
|
| 1765 |
+
lassign [lrange $xy [expr {$i + 2}] [expr {$i + 3}]] x2 y2
|
| 1766 |
+
set z [_RoundPoly2 $x0 $y0 $x1 $y1 $x2 $y2 $r]
|
| 1767 |
+
lappend knots {*}$z
|
| 1768 |
+
|
| 1769 |
+
lassign [list $x1 $y1] x0 y0
|
| 1770 |
+
lassign [list $x2 $y2] x1 y1
|
| 1771 |
+
}
|
| 1772 |
+
set n [$canv create polygon $knots -smooth 1 {*}$args]
|
| 1773 |
+
return $n
|
| 1774 |
+
}
|
| 1775 |
+
|
| 1776 |
+
proc _RoundPoly2 {x0 y0 x1 y1 x2 y2 radius} {
|
| 1777 |
+
set d [expr {2 * $radius}]
|
| 1778 |
+
set maxr 0.75
|
| 1779 |
+
|
| 1780 |
+
set v1x [expr {$x0 - $x1}]
|
| 1781 |
+
set v1y [expr {$y0 - $y1}]
|
| 1782 |
+
set v2x [expr {$x2 - $x1}]
|
| 1783 |
+
set v2y [expr {$y2 - $y1}]
|
| 1784 |
+
|
| 1785 |
+
set vlen1 [expr {sqrt($v1x*$v1x + $v1y*$v1y)}]
|
| 1786 |
+
set vlen2 [expr {sqrt($v2x*$v2x + $v2y*$v2y)}]
|
| 1787 |
+
if {$d > $maxr * $vlen1} {
|
| 1788 |
+
set d [expr {$maxr * $vlen1}]
|
| 1789 |
+
}
|
| 1790 |
+
if {$d > $maxr * $vlen2} {
|
| 1791 |
+
set d [expr {$maxr * $vlen2}]
|
| 1792 |
+
}
|
| 1793 |
+
|
| 1794 |
+
lappend xy [expr {$x1 + $d * $v1x/$vlen1}] [expr {$y1 + $d * $v1y/$vlen1}]
|
| 1795 |
+
lappend xy $x1 $y1
|
| 1796 |
+
lappend xy [expr {$x1 + $d * $v2x/$vlen2}] [expr {$y1 + $d * $v2y/$vlen2}]
|
| 1797 |
+
|
| 1798 |
+
return $xy
|
| 1799 |
+
}
|
| 1800 |
+
|
| 1801 |
+
proc Sparkle {w Oxy tag} {
|
| 1802 |
+
set xy {299 283 298 302 295 314 271 331 239 310 242 292 256 274 281 273}
|
| 1803 |
+
foreach {x y} $xy {
|
| 1804 |
+
$w.c create line 271 304 $x $y -fill white -width 3 -tag $tag
|
| 1805 |
+
}
|
| 1806 |
+
MoveAbs $w $tag $Oxy
|
| 1807 |
+
}
|
| 1808 |
+
|
| 1809 |
+
proc Centroid {w item} {
|
| 1810 |
+
return [Anchor $w $item c]
|
| 1811 |
+
}
|
| 1812 |
+
|
| 1813 |
+
proc Anchor {w item where} {
|
| 1814 |
+
lassign [$w.c bbox $item] x1 y1 x2 y2
|
| 1815 |
+
if {[string match *n* $where]} {
|
| 1816 |
+
set y $y1
|
| 1817 |
+
} elseif {[string match *s* $where]} {
|
| 1818 |
+
set y $y2
|
| 1819 |
+
} else {
|
| 1820 |
+
set y [expr {($y1 + $y2) / 2.0}]
|
| 1821 |
+
}
|
| 1822 |
+
if {[string match *w* $where]} {
|
| 1823 |
+
set x $x1
|
| 1824 |
+
} elseif {[string match *e* $where]} {
|
| 1825 |
+
set x $x2
|
| 1826 |
+
} else {
|
| 1827 |
+
set x [expr {($x1 + $x2) / 2.0}]
|
| 1828 |
+
}
|
| 1829 |
+
return [list $x $y]
|
| 1830 |
+
}
|
| 1831 |
+
|
| 1832 |
+
DoDisplay $w
|
| 1833 |
+
Reset $w
|
| 1834 |
+
Go $w ;# Start everything going
|
evalkit_llava/lib/tk8.6/demos/icon.tcl
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# icon.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# buttons that display bitmaps instead of text.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .icon
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Iconic Button Demonstration"
|
| 16 |
+
wm iconname $w "icon"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "This window shows three ways of using bitmaps or images in radiobuttons and checkbuttons. On the left are two radiobuttons, each of which displays a bitmap and an indicator. In the middle is a checkbutton that displays a different image depending on whether it is selected or not. On the right is a checkbutton that displays a single bitmap but changes its background color to indicate whether or not it is selected."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
# Main widget program sets variable tk_demoDirectory
|
| 27 |
+
image create bitmap flagup \
|
| 28 |
+
-file [file join $tk_demoDirectory images flagup.xbm] \
|
| 29 |
+
-maskfile [file join $tk_demoDirectory images flagup.xbm]
|
| 30 |
+
image create bitmap flagdown \
|
| 31 |
+
-file [file join $tk_demoDirectory images flagdown.xbm] \
|
| 32 |
+
-maskfile [file join $tk_demoDirectory images flagdown.xbm]
|
| 33 |
+
frame $w.frame -borderwidth 10
|
| 34 |
+
pack $w.frame -side top
|
| 35 |
+
|
| 36 |
+
checkbutton $w.frame.b1 -image flagdown -selectimage flagup \
|
| 37 |
+
-indicatoron 0
|
| 38 |
+
$w.frame.b1 configure -selectcolor [$w.frame.b1 cget -background]
|
| 39 |
+
checkbutton $w.frame.b2 \
|
| 40 |
+
-bitmap @[file join $tk_demoDirectory images letters.xbm] \
|
| 41 |
+
-indicatoron 0 -selectcolor SeaGreen1
|
| 42 |
+
frame $w.frame.left
|
| 43 |
+
pack $w.frame.left $w.frame.b1 $w.frame.b2 -side left -expand yes -padx 5m
|
| 44 |
+
|
| 45 |
+
radiobutton $w.frame.left.b3 \
|
| 46 |
+
-bitmap @[file join $tk_demoDirectory images letters.xbm] \
|
| 47 |
+
-variable letters -value full
|
| 48 |
+
radiobutton $w.frame.left.b4 \
|
| 49 |
+
-bitmap @[file join $tk_demoDirectory images noletter.xbm] \
|
| 50 |
+
-variable letters -value empty
|
| 51 |
+
pack $w.frame.left.b3 $w.frame.left.b4 -side top -expand yes
|
evalkit_llava/lib/tk8.6/demos/image1.tcl
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# image1.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script displays two image widgets.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .image1
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Image Demonstration #1"
|
| 15 |
+
wm iconname $w "Image1"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration displays two images, each in a separate label widget."
|
| 19 |
+
pack $w.msg -side top
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss buttons
|
| 22 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 23 |
+
pack $btns -side bottom -fill x
|
| 24 |
+
|
| 25 |
+
# Main widget program sets variable tk_demoDirectory
|
| 26 |
+
catch {image delete image1a}
|
| 27 |
+
image create photo image1a -file [file join $tk_demoDirectory images earth.gif]
|
| 28 |
+
label $w.l1 -image image1a -bd 1 -relief sunken
|
| 29 |
+
|
| 30 |
+
catch {image delete image1b}
|
| 31 |
+
image create photo image1b \
|
| 32 |
+
-file [file join $tk_demoDirectory images earthris.gif]
|
| 33 |
+
label $w.l2 -image image1b -bd 1 -relief sunken
|
| 34 |
+
|
| 35 |
+
pack $w.l1 $w.l2 -side top -padx .5m -pady .5m
|
evalkit_llava/lib/tk8.6/demos/knightstour.tcl
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
|
| 2 |
+
#
|
| 3 |
+
# Calculate a Knight's tour of a chessboard.
|
| 4 |
+
#
|
| 5 |
+
# This uses Warnsdorff's rule to calculate the next square each
|
| 6 |
+
# time. This specifies that the next square should be the one that
|
| 7 |
+
# has the least number of available moves.
|
| 8 |
+
#
|
| 9 |
+
# Using this rule it is possible to get to a position where
|
| 10 |
+
# there are no squares available to move into. In this implementation
|
| 11 |
+
# this occurs when the starting square is d6.
|
| 12 |
+
#
|
| 13 |
+
# To solve this fault an enhancement to the rule is that if we
|
| 14 |
+
# have a choice of squares with an equal score, we should choose
|
| 15 |
+
# the one nearest the edge of the board.
|
| 16 |
+
#
|
| 17 |
+
# If the call to the Edgemost function is commented out you can see
|
| 18 |
+
# this occur.
|
| 19 |
+
#
|
| 20 |
+
# You can drag the knight to a specific square to start if you wish.
|
| 21 |
+
# If you let it repeat then it will choose random start positions
|
| 22 |
+
# for each new tour.
|
| 23 |
+
|
| 24 |
+
package require Tk
|
| 25 |
+
|
| 26 |
+
# Return a list of accessible squares from a given square
|
| 27 |
+
proc ValidMoves {square} {
|
| 28 |
+
set moves {}
|
| 29 |
+
foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
|
| 30 |
+
set col [expr {($square % 8) + [lindex $pair 0]}]
|
| 31 |
+
set row [expr {($square / 8) + [lindex $pair 1]}]
|
| 32 |
+
if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
|
| 33 |
+
lappend moves [expr {$row * 8 + $col}]
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
return $moves
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
# Return the number of available moves for this square
|
| 40 |
+
proc CheckSquare {square} {
|
| 41 |
+
variable visited
|
| 42 |
+
set moves 0
|
| 43 |
+
foreach test [ValidMoves $square] {
|
| 44 |
+
if {[lsearch -exact -integer $visited $test] < 0} {
|
| 45 |
+
incr moves
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
return $moves
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
# Select the next square to move to. Returns -1 if there are no available
|
| 52 |
+
# squares remaining that we can move to.
|
| 53 |
+
proc Next {square} {
|
| 54 |
+
variable visited
|
| 55 |
+
set minimum 9
|
| 56 |
+
set nextSquare -1
|
| 57 |
+
foreach testSquare [ValidMoves $square] {
|
| 58 |
+
if {[lsearch -exact -integer $visited $testSquare] < 0} {
|
| 59 |
+
set count [CheckSquare $testSquare]
|
| 60 |
+
if {$count < $minimum} {
|
| 61 |
+
set minimum $count
|
| 62 |
+
set nextSquare $testSquare
|
| 63 |
+
} elseif {$count == $minimum} {
|
| 64 |
+
# to remove the enhancement to Warnsdorff's rule
|
| 65 |
+
# remove the next line:
|
| 66 |
+
set nextSquare [Edgemost $nextSquare $testSquare]
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
return $nextSquare
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
# Select the square nearest the edge of the board
|
| 74 |
+
proc Edgemost {a b} {
|
| 75 |
+
set colA [expr {3-int(abs(3.5-($a%8)))}]
|
| 76 |
+
set colB [expr {3-int(abs(3.5-($b%8)))}]
|
| 77 |
+
set rowA [expr {3-int(abs(3.5-($a/8)))}]
|
| 78 |
+
set rowB [expr {3-int(abs(3.5-($b/8)))}]
|
| 79 |
+
return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}]
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
# Display a square number as a standard chess square notation.
|
| 83 |
+
proc N {square} {
|
| 84 |
+
return [format %c%d [expr {97 + $square % 8}] \
|
| 85 |
+
[expr {$square / 8 + 1}]]
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
# Perform a Knight's move and schedule the next move.
|
| 89 |
+
proc MovePiece {dlg last square} {
|
| 90 |
+
variable visited
|
| 91 |
+
variable delay
|
| 92 |
+
variable continuous
|
| 93 |
+
$dlg.f.txt insert end "[llength $visited]. [N $last] .. [N $square]\n" {}
|
| 94 |
+
$dlg.f.txt see end
|
| 95 |
+
$dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black
|
| 96 |
+
$dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red
|
| 97 |
+
$dlg.f.c moveto knight {*}[lrange [$dlg.f.c coords [expr {1+$square}]] 0 1]
|
| 98 |
+
lappend visited $square
|
| 99 |
+
set next [Next $square]
|
| 100 |
+
if {$next ne -1} {
|
| 101 |
+
variable aid [after $delay [list MovePiece $dlg $square $next]]
|
| 102 |
+
} else {
|
| 103 |
+
$dlg.tf.b1 configure -state normal
|
| 104 |
+
if {[llength $visited] == 64} {
|
| 105 |
+
variable initial
|
| 106 |
+
if {$initial == $square} {
|
| 107 |
+
$dlg.f.txt insert end "Closed tour!"
|
| 108 |
+
} else {
|
| 109 |
+
$dlg.f.txt insert end "Success\n" {}
|
| 110 |
+
if {$continuous} {
|
| 111 |
+
after [expr {$delay * 2}] [namespace code \
|
| 112 |
+
[list Tour $dlg [expr {int(rand() * 64)}]]]
|
| 113 |
+
}
|
| 114 |
+
}
|
| 115 |
+
} else {
|
| 116 |
+
$dlg.f.txt insert end "FAILED!\n" {}
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
# Begin a new tour of the board given a random start position
|
| 122 |
+
proc Tour {dlg {square {}}} {
|
| 123 |
+
variable visited {}
|
| 124 |
+
$dlg.f.txt delete 1.0 end
|
| 125 |
+
$dlg.tf.b1 configure -state disabled
|
| 126 |
+
for {set n 0} {$n < 64} {incr n} {
|
| 127 |
+
$dlg.f.c itemconfigure $n -state disabled -outline black
|
| 128 |
+
}
|
| 129 |
+
if {$square eq {}} {
|
| 130 |
+
set coords [lrange [$dlg.f.c coords knight] 0 1]
|
| 131 |
+
set square [expr {[$dlg.f.c find closest {*}$coords 0 65]-1}]
|
| 132 |
+
}
|
| 133 |
+
variable initial $square
|
| 134 |
+
after idle [list MovePiece $dlg $initial $initial]
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
proc Stop {} {
|
| 138 |
+
variable aid
|
| 139 |
+
catch {after cancel $aid}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
proc Exit {dlg} {
|
| 143 |
+
Stop
|
| 144 |
+
destroy $dlg
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
proc SetDelay {new} {
|
| 148 |
+
variable delay [expr {int($new)}]
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
proc DragStart {w x y} {
|
| 152 |
+
$w dtag selected
|
| 153 |
+
$w addtag selected withtag current
|
| 154 |
+
variable dragging [list $x $y]
|
| 155 |
+
}
|
| 156 |
+
proc DragMotion {w x y} {
|
| 157 |
+
variable dragging
|
| 158 |
+
if {[info exists dragging]} {
|
| 159 |
+
$w move selected [expr {$x - [lindex $dragging 0]}] \
|
| 160 |
+
[expr {$y - [lindex $dragging 1]}]
|
| 161 |
+
variable dragging [list $x $y]
|
| 162 |
+
}
|
| 163 |
+
}
|
| 164 |
+
proc DragEnd {w x y} {
|
| 165 |
+
set square [$w find closest $x $y 0 65]
|
| 166 |
+
$w moveto selected {*}[lrange [$w coords $square] 0 1]
|
| 167 |
+
$w dtag selected
|
| 168 |
+
variable dragging ; unset dragging
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
proc CreateGUI {} {
|
| 172 |
+
catch {destroy .knightstour}
|
| 173 |
+
set dlg [toplevel .knightstour]
|
| 174 |
+
wm title $dlg "Knights tour"
|
| 175 |
+
wm withdraw $dlg
|
| 176 |
+
set f [ttk::frame $dlg.f]
|
| 177 |
+
set c [canvas $f.c -width 240 -height 240]
|
| 178 |
+
text $f.txt -width 10 -height 1 \
|
| 179 |
+
-yscrollcommand [list $f.vs set] -font {Arial 8}
|
| 180 |
+
ttk::scrollbar $f.vs -command [list $f.txt yview]
|
| 181 |
+
|
| 182 |
+
variable delay 600
|
| 183 |
+
variable continuous 0
|
| 184 |
+
ttk::frame $dlg.tf
|
| 185 |
+
ttk::label $dlg.tf.ls -text Speed
|
| 186 |
+
ttk::scale $dlg.tf.sc -from 8 -to 2000 -command [list SetDelay] \
|
| 187 |
+
-variable [namespace which -variable delay]
|
| 188 |
+
ttk::checkbutton $dlg.tf.cc -text Repeat \
|
| 189 |
+
-variable [namespace which -variable continuous]
|
| 190 |
+
ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
|
| 191 |
+
ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
|
| 192 |
+
set square 0
|
| 193 |
+
for {set row 7} {$row >= 0} {incr row -1} {
|
| 194 |
+
for {set col 0} {$col < 8} {incr col} {
|
| 195 |
+
if {(($col & 1) ^ ($row & 1))} {
|
| 196 |
+
set fill tan3 ; set dfill tan4
|
| 197 |
+
} else {
|
| 198 |
+
set fill bisque ; set dfill bisque3
|
| 199 |
+
}
|
| 200 |
+
set coords [list [expr {$col * 30 + 4}] [expr {$row * 30 + 4}] \
|
| 201 |
+
[expr {$col * 30 + 30}] [expr {$row * 30 + 30}]]
|
| 202 |
+
$c create rectangle $coords -fill $fill -disabledfill $dfill \
|
| 203 |
+
-width 2 -state disabled -outline black
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
if {[tk windowingsystem] ne "x11"} {
|
| 207 |
+
catch {eval font create KnightFont -size -24}
|
| 208 |
+
$c create text 0 0 -font KnightFont -text "\u265e" \
|
| 209 |
+
-anchor nw -tags knight -fill black -activefill "#600000"
|
| 210 |
+
} else {
|
| 211 |
+
# On X11 we cannot reliably tell if the \u265e glyph is available
|
| 212 |
+
# so just use a polygon
|
| 213 |
+
set pts {
|
| 214 |
+
2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16
|
| 215 |
+
2 17 4 14 5 15 3 17 5 17 9 14 10 15 5 21
|
| 216 |
+
}
|
| 217 |
+
$c create polygon $pts -tag knight -offset 8 \
|
| 218 |
+
-fill black -activefill "#600000"
|
| 219 |
+
}
|
| 220 |
+
$c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
|
| 221 |
+
$c bind knight <Button-1> [namespace code [list DragStart %W %x %y]]
|
| 222 |
+
$c bind knight <Motion> [namespace code [list DragMotion %W %x %y]]
|
| 223 |
+
$c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]]
|
| 224 |
+
|
| 225 |
+
grid $c $f.txt $f.vs -sticky news
|
| 226 |
+
grid rowconfigure $f 0 -weight 1
|
| 227 |
+
grid columnconfigure $f 1 -weight 1
|
| 228 |
+
|
| 229 |
+
grid $f - - - - - -sticky news
|
| 230 |
+
set things [list $dlg.tf.ls $dlg.tf.sc $dlg.tf.cc $dlg.tf.b1]
|
| 231 |
+
if {![info exists ::widgetDemo]} {
|
| 232 |
+
lappend things $dlg.tf.b2
|
| 233 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 234 |
+
set things [linsert $things 0 [ttk::sizegrip $dlg.tf.sg]]
|
| 235 |
+
}
|
| 236 |
+
}
|
| 237 |
+
pack {*}$things -side right
|
| 238 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 239 |
+
pack configure {*}$things -padx {4 4} -pady {12 12}
|
| 240 |
+
pack configure [lindex $things 0] -padx {4 24}
|
| 241 |
+
pack configure [lindex $things end] -padx {16 4}
|
| 242 |
+
}
|
| 243 |
+
grid $dlg.tf - - - - - -sticky ew
|
| 244 |
+
if {[info exists ::widgetDemo]} {
|
| 245 |
+
grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
grid rowconfigure $dlg 0 -weight 1
|
| 249 |
+
grid columnconfigure $dlg 0 -weight 1
|
| 250 |
+
|
| 251 |
+
bind $dlg <Control-F2> {console show}
|
| 252 |
+
bind $dlg <Return> [list $dlg.tf.b1 invoke]
|
| 253 |
+
bind $dlg <Escape> [list $dlg.tf.b2 invoke]
|
| 254 |
+
bind $dlg <Destroy> [namespace code [list Stop]]
|
| 255 |
+
wm protocol $dlg WM_DELETE_WINDOW [namespace code [list Exit $dlg]]
|
| 256 |
+
|
| 257 |
+
wm deiconify $dlg
|
| 258 |
+
tkwait window $dlg
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
if {![winfo exists .knightstour]} {
|
| 262 |
+
if {![info exists widgetDemo]} { wm withdraw . }
|
| 263 |
+
set r [catch [linsert $argv 0 CreateGUI] err]
|
| 264 |
+
if {$r} {
|
| 265 |
+
tk_messageBox -icon error -title "Error" -message $err
|
| 266 |
+
}
|
| 267 |
+
if {![info exists widgetDemo]} { exit $r }
|
| 268 |
+
}
|
evalkit_llava/lib/tk8.6/demos/license.terms
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This software is copyrighted by the Regents of the University of
|
| 2 |
+
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
|
| 3 |
+
Corporation, Apple Inc. and other parties. The following terms apply to
|
| 4 |
+
all files associated with the software unless explicitly disclaimed in
|
| 5 |
+
individual files.
|
| 6 |
+
|
| 7 |
+
The authors hereby grant permission to use, copy, modify, distribute,
|
| 8 |
+
and license this software and its documentation for any purpose, provided
|
| 9 |
+
that existing copyright notices are retained in all copies and that this
|
| 10 |
+
notice is included verbatim in any distributions. No written agreement,
|
| 11 |
+
license, or royalty fee is required for any of the authorized uses.
|
| 12 |
+
Modifications to this software may be copyrighted by their authors
|
| 13 |
+
and need not follow the licensing terms described here, provided that
|
| 14 |
+
the new terms are clearly indicated on the first page of each file where
|
| 15 |
+
they apply.
|
| 16 |
+
|
| 17 |
+
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
| 18 |
+
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
| 19 |
+
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
| 20 |
+
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
| 21 |
+
POSSIBILITY OF SUCH DAMAGE.
|
| 22 |
+
|
| 23 |
+
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
| 24 |
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
| 26 |
+
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
| 27 |
+
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
| 28 |
+
MODIFICATIONS.
|
| 29 |
+
|
| 30 |
+
GOVERNMENT USE: If you are acquiring this software on behalf of the
|
| 31 |
+
U.S. government, the Government shall have only "Restricted Rights"
|
| 32 |
+
in the software and related documentation as defined in the Federal
|
| 33 |
+
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
|
| 34 |
+
are acquiring the software on behalf of the Department of Defense, the
|
| 35 |
+
software shall be classified as "Commercial Computer Software" and the
|
| 36 |
+
Government shall have only "Restricted Rights" as defined in Clause
|
| 37 |
+
252.227-7013 (b) (3) of DFARs. Notwithstanding the foregoing, the
|
| 38 |
+
authors grant the U.S. Government and others acting in its behalf
|
| 39 |
+
permission to use and distribute the software in accordance with the
|
| 40 |
+
terms specified in this license.
|
evalkit_llava/lib/tk8.6/demos/menu.tcl
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# menu.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a window with a bunch of menus
|
| 4 |
+
# and cascaded menus using menubars.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .menu
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Menu Demonstration"
|
| 16 |
+
wm iconname $w "menu"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left
|
| 20 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 21 |
+
$w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
|
| 22 |
+
} else {
|
| 23 |
+
$w.msg configure -text "This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu."
|
| 24 |
+
}
|
| 25 |
+
pack $w.msg -side top
|
| 26 |
+
|
| 27 |
+
set menustatus " "
|
| 28 |
+
frame $w.statusBar
|
| 29 |
+
label $w.statusBar.label -textvariable menustatus -relief sunken -bd 1 -font "Helvetica 10" -anchor w
|
| 30 |
+
pack $w.statusBar.label -side left -padx 2 -expand yes -fill both
|
| 31 |
+
pack $w.statusBar -side bottom -fill x -pady 2
|
| 32 |
+
|
| 33 |
+
## See Code / Dismiss buttons
|
| 34 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 35 |
+
pack $btns -side bottom -fill x
|
| 36 |
+
|
| 37 |
+
menu $w.menu -tearoff 0
|
| 38 |
+
|
| 39 |
+
set m $w.menu.file
|
| 40 |
+
menu $m -tearoff 0
|
| 41 |
+
$w.menu add cascade -label "File" -menu $m -underline 0
|
| 42 |
+
$m add command -label "Open..." -command {error "this is just a demo: no action has been defined for the \"Open...\" entry"}
|
| 43 |
+
$m add command -label "New" -command {error "this is just a demo: no action has been defined for the \"New\" entry"}
|
| 44 |
+
$m add command -label "Save" -command {error "this is just a demo: no action has been defined for the \"Save\" entry"}
|
| 45 |
+
$m add command -label "Save As..." -command {error "this is just a demo: no action has been defined for the \"Save As...\" entry"}
|
| 46 |
+
$m add separator
|
| 47 |
+
$m add command -label "Print Setup..." -command {error "this is just a demo: no action has been defined for the \"Print Setup...\" entry"}
|
| 48 |
+
$m add command -label "Print..." -command {error "this is just a demo: no action has been defined for the \"Print...\" entry"}
|
| 49 |
+
$m add separator
|
| 50 |
+
$m add command -label "Dismiss Menus Demo" -command "destroy $w"
|
| 51 |
+
|
| 52 |
+
set m $w.menu.basic
|
| 53 |
+
$w.menu add cascade -label "Basic" -menu $m -underline 0
|
| 54 |
+
menu $m -tearoff 0
|
| 55 |
+
$m add command -label "Long entry that does nothing"
|
| 56 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 57 |
+
set modifier Command
|
| 58 |
+
} elseif {[tk windowingsystem] eq "win32"} {
|
| 59 |
+
set modifier Control
|
| 60 |
+
} else {
|
| 61 |
+
set modifier Meta
|
| 62 |
+
}
|
| 63 |
+
foreach i {A B C D E F} {
|
| 64 |
+
$m add command -label "Print letter \"$i\"" -underline 14 \
|
| 65 |
+
-accelerator $modifier+$i -command "puts $i"
|
| 66 |
+
bind $w <$modifier-[string tolower $i]> "puts $i"
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
set m $w.menu.cascade
|
| 70 |
+
$w.menu add cascade -label "Cascades" -menu $m -underline 0
|
| 71 |
+
menu $m -tearoff 0
|
| 72 |
+
$m add command -label "Print hello" \
|
| 73 |
+
-command {puts stdout "Hello"} -accelerator $modifier+H -underline 6
|
| 74 |
+
bind $w <$modifier-h> {puts stdout "Hello"}
|
| 75 |
+
$m add command -label "Print goodbye" -command {\
|
| 76 |
+
puts stdout "Goodbye"} -accelerator $modifier+G -underline 6
|
| 77 |
+
bind $w <$modifier-g> {puts stdout "Goodbye"}
|
| 78 |
+
$m add cascade -label "Check buttons" \
|
| 79 |
+
-menu $w.menu.cascade.check -underline 0
|
| 80 |
+
$m add cascade -label "Radio buttons" \
|
| 81 |
+
-menu $w.menu.cascade.radio -underline 0
|
| 82 |
+
|
| 83 |
+
set m $w.menu.cascade.check
|
| 84 |
+
menu $m -tearoff 0
|
| 85 |
+
$m add check -label "Oil checked" -variable oil
|
| 86 |
+
$m add check -label "Transmission checked" -variable trans
|
| 87 |
+
$m add check -label "Brakes checked" -variable brakes
|
| 88 |
+
$m add check -label "Lights checked" -variable lights
|
| 89 |
+
$m add separator
|
| 90 |
+
$m add command -label "Show current values" \
|
| 91 |
+
-command "showVars $w.menu.cascade.dialog oil trans brakes lights"
|
| 92 |
+
$m invoke 1
|
| 93 |
+
$m invoke 3
|
| 94 |
+
|
| 95 |
+
set m $w.menu.cascade.radio
|
| 96 |
+
menu $m -tearoff 0
|
| 97 |
+
$m add radio -label "10 point" -variable pointSize -value 10
|
| 98 |
+
$m add radio -label "14 point" -variable pointSize -value 14
|
| 99 |
+
$m add radio -label "18 point" -variable pointSize -value 18
|
| 100 |
+
$m add radio -label "24 point" -variable pointSize -value 24
|
| 101 |
+
$m add radio -label "32 point" -variable pointSize -value 32
|
| 102 |
+
$m add sep
|
| 103 |
+
$m add radio -label "Roman" -variable style -value roman
|
| 104 |
+
$m add radio -label "Bold" -variable style -value bold
|
| 105 |
+
$m add radio -label "Italic" -variable style -value italic
|
| 106 |
+
$m add sep
|
| 107 |
+
$m add command -label "Show current values" \
|
| 108 |
+
-command "showVars $w.menu.cascade.dialog pointSize style"
|
| 109 |
+
$m invoke 1
|
| 110 |
+
$m invoke 7
|
| 111 |
+
|
| 112 |
+
set m $w.menu.icon
|
| 113 |
+
$w.menu add cascade -label "Icons" -menu $m -underline 0
|
| 114 |
+
menu $m -tearoff 0
|
| 115 |
+
# Main widget program sets variable tk_demoDirectory
|
| 116 |
+
image create photo lilearth -file [file join $tk_demoDirectory \
|
| 117 |
+
images earthmenu.png]
|
| 118 |
+
$m add command -image lilearth \
|
| 119 |
+
-hidemargin 1 -command [list \
|
| 120 |
+
tk_dialog $w.pattern {Bitmap Menu Entry} \
|
| 121 |
+
"The menu entry you invoked displays a photoimage rather than\
|
| 122 |
+
a text string. Other than this, it is just like any other\
|
| 123 |
+
menu entry." {} 0 OK ]
|
| 124 |
+
foreach i {info questhead error} {
|
| 125 |
+
$m add command -bitmap $i -hidemargin 1 -command [list \
|
| 126 |
+
puts "You invoked the $i bitmap" ]
|
| 127 |
+
}
|
| 128 |
+
$m entryconfigure 2 -columnbreak 1
|
| 129 |
+
|
| 130 |
+
set m $w.menu.more
|
| 131 |
+
$w.menu add cascade -label "More" -menu $m -underline 0
|
| 132 |
+
menu $m -tearoff 0
|
| 133 |
+
foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Make life meaningful}} {
|
| 134 |
+
$m add command -label $i -command [list puts "You invoked \"$i\""]
|
| 135 |
+
}
|
| 136 |
+
set emojiLabel [encoding convertfrom utf-8 "\xF0\x9F\x98\x8D Make friends"]
|
| 137 |
+
$m add command -label $emojiLabel -command [list puts "Menu labels can include non-BMP characters."]
|
| 138 |
+
$m entryconfigure "Does almost nothing" -bitmap questhead -compound left \
|
| 139 |
+
-command [list \
|
| 140 |
+
tk_dialog $w.compound {Compound Menu Entry} \
|
| 141 |
+
"The menu entry you invoked displays both a bitmap and a\
|
| 142 |
+
text string. Other than this, it is just like any other\
|
| 143 |
+
menu entry." {} 0 OK ]
|
| 144 |
+
|
| 145 |
+
set m $w.menu.colors
|
| 146 |
+
$w.menu add cascade -label "Colors" -menu $m -underline 1
|
| 147 |
+
menu $m -tearoff 1
|
| 148 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 149 |
+
# Aqua ignores the -background and -foreground options, but a compound
|
| 150 |
+
# button can be used for selecting colors.
|
| 151 |
+
foreach i {red orange yellow green blue} {
|
| 152 |
+
image create photo image_$i -height 16 -width 16
|
| 153 |
+
image_$i put black -to 0 0 16 1
|
| 154 |
+
image_$i put black -to 0 1 1 16
|
| 155 |
+
image_$i put black -to 0 15 16 16
|
| 156 |
+
image_$i put black -to 15 1 16 16
|
| 157 |
+
image_$i put $i -to 1 1 15 15
|
| 158 |
+
$m add command -label $i -image image_$i -compound left -command [list \
|
| 159 |
+
puts "You invoked \"$i\"" ]
|
| 160 |
+
}
|
| 161 |
+
} else {
|
| 162 |
+
foreach i {red orange yellow green blue} {
|
| 163 |
+
$m add command -label $i -background $i -command [list \
|
| 164 |
+
puts "You invoked \"$i\"" ]
|
| 165 |
+
}
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
$w configure -menu $w.menu
|
| 169 |
+
|
| 170 |
+
bind Menu <<MenuSelect>> {
|
| 171 |
+
global $menustatus
|
| 172 |
+
if {[catch {%W entrycget active -label} label]} {
|
| 173 |
+
set label " "
|
| 174 |
+
}
|
| 175 |
+
set menustatus $label
|
| 176 |
+
update idletasks
|
| 177 |
+
}
|
evalkit_llava/lib/tk8.6/demos/menubu.tcl
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# menubu.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a window with a bunch of menus
|
| 4 |
+
# and cascaded menus using menubuttons.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .menubu
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Menu Button Demonstration"
|
| 16 |
+
wm iconname $w "menubutton"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
frame $w.body
|
| 20 |
+
pack $w.body -expand 1 -fill both
|
| 21 |
+
|
| 22 |
+
menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised
|
| 23 |
+
menu $w.body.below.m -tearoff 0
|
| 24 |
+
$w.body.below.m add command -label "Below menu: first item" -command "puts \"You have selected the first item from the Below menu.\""
|
| 25 |
+
$w.body.below.m add command -label "Below menu: second item" -command "puts \"You have selected the second item from the Below menu.\""
|
| 26 |
+
grid $w.body.below -row 0 -column 1 -sticky n
|
| 27 |
+
menubutton $w.body.right -text "Right" -underline 0 -direction right -menu $w.body.right.m -relief raised
|
| 28 |
+
menu $w.body.right.m -tearoff 0
|
| 29 |
+
$w.body.right.m add command -label "Right menu: first item" -command "puts \"You have selected the first item from the Right menu.\""
|
| 30 |
+
$w.body.right.m add command -label "Right menu: second item" -command "puts \"You have selected the second item from the Right menu.\""
|
| 31 |
+
frame $w.body.center
|
| 32 |
+
menubutton $w.body.left -text "Left" -underline 0 -direction left -menu $w.body.left.m -relief raised
|
| 33 |
+
menu $w.body.left.m -tearoff 0
|
| 34 |
+
$w.body.left.m add command -label "Left menu: first item" -command "puts \"You have selected the first item from the Left menu.\""
|
| 35 |
+
$w.body.left.m add command -label "Left menu: second item" -command "puts \"You have selected the second item from the Left menu.\""
|
| 36 |
+
grid $w.body.right -row 1 -column 0 -sticky w
|
| 37 |
+
grid $w.body.center -row 1 -column 1 -sticky news
|
| 38 |
+
grid $w.body.left -row 1 -column 2 -sticky e
|
| 39 |
+
menubutton $w.body.above -text "Above" -underline 0 -direction above -menu $w.body.above.m -relief raised
|
| 40 |
+
menu $w.body.above.m -tearoff 0
|
| 41 |
+
$w.body.above.m add command -label "Above menu: first item" -command "puts \"You have selected the first item from the Above menu.\""
|
| 42 |
+
$w.body.above.m add command -label "Above menu: second item" -command "puts \"You have selected the second item from the Above menu.\""
|
| 43 |
+
grid $w.body.above -row 2 -column 1 -sticky s
|
| 44 |
+
|
| 45 |
+
## See Code / Dismiss buttons
|
| 46 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 47 |
+
pack $btns -side bottom -fill x
|
| 48 |
+
|
| 49 |
+
set body $w.body.center
|
| 50 |
+
label $body.label -wraplength 300 -font "Helvetica 14" -justify left -text "This is a demonstration of menubuttons. The \"Below\" menubutton pops its menu below the button; the \"Right\" button pops to the right, etc. There are two option menus directly below this text; one is just a standard menu and the other is a 16-color palette."
|
| 51 |
+
pack $body.label -side top -padx 25 -pady 25
|
| 52 |
+
frame $body.buttons
|
| 53 |
+
pack $body.buttons -padx 25 -pady 25
|
| 54 |
+
tk_optionMenu $body.buttons.options menubuttonoptions one two three
|
| 55 |
+
pack $body.buttons.options -side left -padx 25 -pady 25
|
| 56 |
+
set m [tk_optionMenu $body.buttons.colors paletteColor Black red4 DarkGreen NavyBlue gray75 Red Green Blue gray50 Yellow Cyan Magenta White Brown DarkSeaGreen DarkViolet]
|
| 57 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 58 |
+
set topBorderColor Black
|
| 59 |
+
set bottomBorderColor Black
|
| 60 |
+
} else {
|
| 61 |
+
set topBorderColor gray50
|
| 62 |
+
set bottomBorderColor gray75
|
| 63 |
+
}
|
| 64 |
+
for {set i 0} {$i <= [$m index last]} {incr i} {
|
| 65 |
+
set name [$m entrycget $i -label]
|
| 66 |
+
image create photo image_$name -height 16 -width 16
|
| 67 |
+
image_$name put $topBorderColor -to 0 0 16 1
|
| 68 |
+
image_$name put $topBorderColor -to 0 1 1 16
|
| 69 |
+
image_$name put $bottomBorderColor -to 0 15 16 16
|
| 70 |
+
image_$name put $bottomBorderColor -to 15 1 16 16
|
| 71 |
+
image_$name put $name -to 1 1 15 15
|
| 72 |
+
|
| 73 |
+
image create photo image_${name}_s -height 16 -width 16
|
| 74 |
+
image_${name}_s put Black -to 0 0 16 2
|
| 75 |
+
image_${name}_s put Black -to 0 2 2 16
|
| 76 |
+
image_${name}_s put Black -to 2 14 16 16
|
| 77 |
+
image_${name}_s put Black -to 14 2 16 14
|
| 78 |
+
image_${name}_s put $name -to 2 2 14 14
|
| 79 |
+
|
| 80 |
+
$m entryconfigure $i -image image_$name -selectimage image_${name}_s -hidemargin 1
|
| 81 |
+
}
|
| 82 |
+
$m configure -tearoff 1
|
| 83 |
+
foreach i {Black gray75 gray50 White} {
|
| 84 |
+
$m entryconfigure $i -columnbreak 1
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
pack $body.buttons.colors -side left -padx 25 -pady 25
|
evalkit_llava/lib/tk8.6/demos/paned1.tcl
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# paned1.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# a paned window that separates two windows horizontally.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .paned1
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Horizontal Paned Window Demonstration"
|
| 16 |
+
wm iconname $w "paned1"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two coloured windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
panedwindow $w.pane
|
| 27 |
+
pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m
|
| 28 |
+
|
| 29 |
+
label $w.pane.left -text "This is the\nleft side" -fg black -bg yellow
|
| 30 |
+
label $w.pane.right -text "This is the\nright side" -fg black -bg cyan
|
| 31 |
+
|
| 32 |
+
$w.pane add $w.pane.left $w.pane.right
|
evalkit_llava/lib/tk8.6/demos/paned2.tcl
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# paned2.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# a paned window that separates two windows vertically.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .paned2
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Vertical Paned Window Demonstration"
|
| 16 |
+
wm iconname $w "paned2"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "The sash between the two scrolled windows below can be used to divide the area between them. Use the left mouse button to resize without redrawing by just moving the sash, and use the middle mouse button to resize opaquely (always redrawing the windows in each position.)"
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
## See Code / Dismiss buttons
|
| 23 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 24 |
+
pack $btns -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
# Create the pane itself
|
| 27 |
+
panedwindow $w.pane -orient vertical
|
| 28 |
+
pack $w.pane -side top -expand yes -fill both -pady 2 -padx 2m
|
| 29 |
+
|
| 30 |
+
# The top window is a listbox with scrollbar
|
| 31 |
+
set paneList {
|
| 32 |
+
{List of Tk Widgets}
|
| 33 |
+
button
|
| 34 |
+
canvas
|
| 35 |
+
checkbutton
|
| 36 |
+
entry
|
| 37 |
+
frame
|
| 38 |
+
label
|
| 39 |
+
labelframe
|
| 40 |
+
listbox
|
| 41 |
+
menu
|
| 42 |
+
menubutton
|
| 43 |
+
message
|
| 44 |
+
panedwindow
|
| 45 |
+
radiobutton
|
| 46 |
+
scale
|
| 47 |
+
scrollbar
|
| 48 |
+
spinbox
|
| 49 |
+
text
|
| 50 |
+
toplevel
|
| 51 |
+
}
|
| 52 |
+
set f [frame $w.pane.top]
|
| 53 |
+
listbox $f.list -listvariable paneList -yscrollcommand "$f.scr set"
|
| 54 |
+
# Invert the first item to highlight it
|
| 55 |
+
$f.list itemconfigure 0 \
|
| 56 |
+
-background [$f.list cget -fg] -foreground [$f.list cget -bg]
|
| 57 |
+
ttk::scrollbar $f.scr -orient vertical -command "$f.list yview"
|
| 58 |
+
pack $f.scr -side right -fill y
|
| 59 |
+
pack $f.list -fill both -expand 1
|
| 60 |
+
|
| 61 |
+
# The bottom window is a text widget with scrollbar
|
| 62 |
+
set f [frame $w.pane.bottom]
|
| 63 |
+
text $f.text -xscrollcommand "$f.xscr set" -yscrollcommand "$f.yscr set" \
|
| 64 |
+
-width 30 -height 8 -wrap none
|
| 65 |
+
ttk::scrollbar $f.xscr -orient horizontal -command "$f.text xview"
|
| 66 |
+
ttk::scrollbar $f.yscr -orient vertical -command "$f.text yview"
|
| 67 |
+
grid $f.text $f.yscr -sticky nsew
|
| 68 |
+
grid $f.xscr -sticky nsew
|
| 69 |
+
grid columnconfigure $f 0 -weight 1
|
| 70 |
+
grid rowconfigure $f 0 -weight 1
|
| 71 |
+
$f.text insert 1.0 "This is just a normal text widget"
|
| 72 |
+
|
| 73 |
+
# Now add our contents to the paned window
|
| 74 |
+
$w.pane add $w.pane.top $w.pane.bottom
|
evalkit_llava/lib/tk8.6/demos/radio.tcl
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# radio.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing
|
| 4 |
+
# several radiobutton widgets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .radio
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Radiobutton Demonstration"
|
| 16 |
+
wm iconname $w "radio"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "Three groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Tcl variable is associated with each group to indicate which of the group's buttons is selected. When the 'Tristate' button is pressed, the radio buttons will display the tri-state mode. Selecting any radio button will return the buttons to their respective on/off state. Click the \"See Variables\" button to see the current values of the variables."
|
| 19 |
+
grid $w.msg -row 0 -column 0 -columnspan 3 -sticky nsew
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss buttons
|
| 22 |
+
set btns [addSeeDismiss $w.buttons $w [list size color align]]
|
| 23 |
+
grid $btns -row 3 -column 0 -columnspan 3 -sticky ew
|
| 24 |
+
|
| 25 |
+
labelframe $w.left -pady 2 -text "Point Size" -padx 2
|
| 26 |
+
labelframe $w.mid -pady 2 -text "Color" -padx 2
|
| 27 |
+
labelframe $w.right -pady 2 -text "Alignment" -padx 2
|
| 28 |
+
button $w.tristate -text Tristate -command "set size multi; set color multi" \
|
| 29 |
+
-pady 2 -padx 2
|
| 30 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 31 |
+
$w.tristate configure -padx 10
|
| 32 |
+
}
|
| 33 |
+
grid $w.left -column 0 -row 1 -pady .5c -padx .5c -rowspan 2
|
| 34 |
+
grid $w.mid -column 1 -row 1 -pady .5c -padx .5c -rowspan 2
|
| 35 |
+
grid $w.right -column 2 -row 1 -pady .5c -padx .5c
|
| 36 |
+
grid $w.tristate -column 2 -row 2 -pady .5c -padx .5c
|
| 37 |
+
|
| 38 |
+
foreach i {10 12 14 18 24} {
|
| 39 |
+
radiobutton $w.left.b$i -text "Point Size $i" -variable size \
|
| 40 |
+
-relief flat -value $i -tristatevalue "multi"
|
| 41 |
+
pack $w.left.b$i -side top -pady 2 -anchor w -fill x
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
foreach c {Red Green Blue Yellow Orange Purple} {
|
| 45 |
+
set lower [string tolower $c]
|
| 46 |
+
radiobutton $w.mid.$lower -text $c -variable color \
|
| 47 |
+
-relief flat -value $lower -anchor w \
|
| 48 |
+
-command "$w.mid configure -fg \$color" \
|
| 49 |
+
-tristatevalue "multi"
|
| 50 |
+
pack $w.mid.$lower -side top -pady 2 -fill x
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
label $w.right.l -text "Label" -bitmap questhead -compound left
|
| 55 |
+
$w.right.l configure -width [winfo reqwidth $w.right.l] -compound top
|
| 56 |
+
$w.right.l configure -height [winfo reqheight $w.right.l]
|
| 57 |
+
foreach a {Top Left Right Bottom} {
|
| 58 |
+
set lower [string tolower $a]
|
| 59 |
+
radiobutton $w.right.$lower -text $a -variable align \
|
| 60 |
+
-relief flat -value $lower -indicatoron 0 -width 7 \
|
| 61 |
+
-command "$w.right.l configure -compound \$align"
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
grid x $w.right.top
|
| 65 |
+
grid $w.right.left $w.right.l $w.right.right
|
| 66 |
+
grid x $w.right.bottom
|
evalkit_llava/lib/tk8.6/demos/ruler.tcl
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ruler.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a canvas widget that displays a ruler
|
| 4 |
+
# with tab stops that can be set, moved, and deleted.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
# rulerMkTab --
|
| 13 |
+
# This procedure creates a new triangular polygon in a canvas to
|
| 14 |
+
# represent a tab stop.
|
| 15 |
+
#
|
| 16 |
+
# Arguments:
|
| 17 |
+
# c - The canvas window.
|
| 18 |
+
# x, y - Coordinates at which to create the tab stop.
|
| 19 |
+
|
| 20 |
+
proc rulerMkTab {c x y} {
|
| 21 |
+
upvar #0 demo_rulerInfo v
|
| 22 |
+
set newTab [$c create polygon $x $y \
|
| 23 |
+
[expr {$x+$v(size)}] [expr {$y+$v(size)}] \
|
| 24 |
+
[expr {$x-$v(size)}] [expr {$y+$v(size)}]]
|
| 25 |
+
set fill [$c itemcget $newTab -outline]
|
| 26 |
+
$c itemconfigure $newTab -fill $fill -outline {}
|
| 27 |
+
set v(normalStyle) "-fill $fill"
|
| 28 |
+
return $newTab
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
set w .ruler
|
| 32 |
+
catch {destroy $w}
|
| 33 |
+
toplevel $w
|
| 34 |
+
wm title $w "Ruler Demonstration"
|
| 35 |
+
wm iconname $w "ruler"
|
| 36 |
+
positionWindow $w
|
| 37 |
+
set c $w.c
|
| 38 |
+
|
| 39 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button."
|
| 40 |
+
pack $w.msg -side top
|
| 41 |
+
|
| 42 |
+
## See Code / Dismiss buttons
|
| 43 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 44 |
+
pack $btns -side bottom -fill x
|
| 45 |
+
|
| 46 |
+
canvas $c -width 14.8c -height 2.5c
|
| 47 |
+
pack $w.c -side top -fill x
|
| 48 |
+
|
| 49 |
+
set demo_rulerInfo(grid) .25c
|
| 50 |
+
set demo_rulerInfo(left) [winfo fpixels $c 1c]
|
| 51 |
+
set demo_rulerInfo(right) [winfo fpixels $c 13c]
|
| 52 |
+
set demo_rulerInfo(top) [winfo fpixels $c 1c]
|
| 53 |
+
set demo_rulerInfo(bottom) [winfo fpixels $c 1.5c]
|
| 54 |
+
set demo_rulerInfo(size) [winfo fpixels $c .2c]
|
| 55 |
+
# Main widget program sets variable tk_demoDirectory
|
| 56 |
+
if {[winfo depth $c] > 1} {
|
| 57 |
+
set demo_rulerInfo(activeStyle) "-fill red -stipple {}"
|
| 58 |
+
set demo_rulerInfo(deleteStyle) [list -fill red \
|
| 59 |
+
-stipple @[file join $tk_demoDirectory images gray25.xbm]]
|
| 60 |
+
} else {
|
| 61 |
+
set demo_rulerInfo(activeStyle) "-fill black -stipple {}"
|
| 62 |
+
set demo_rulerInfo(deleteStyle) [list -fill black \
|
| 63 |
+
-stipple @[file join $tk_demoDirectory images gray25.xbm]]
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
$c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1
|
| 67 |
+
for {set i 0} {$i < 12} {incr i} {
|
| 68 |
+
set x [expr {$i+1}]
|
| 69 |
+
$c create line ${x}c 1c ${x}c 0.6c -width 1
|
| 70 |
+
$c create line $x.25c 1c $x.25c 0.8c -width 1
|
| 71 |
+
$c create line $x.5c 1c $x.5c 0.7c -width 1
|
| 72 |
+
$c create line $x.75c 1c $x.75c 0.8c -width 1
|
| 73 |
+
$c create text $x.15c .75c -text $i -anchor sw
|
| 74 |
+
}
|
| 75 |
+
$c addtag well withtag [$c create rect 13.2c 1c 13.8c 0.5c \
|
| 76 |
+
-fill [lindex [$c config -bg] 4]]
|
| 77 |
+
$c addtag well withtag [rulerMkTab $c [winfo pixels $c 13.5c] \
|
| 78 |
+
[winfo pixels $c .65c]]
|
| 79 |
+
|
| 80 |
+
$c bind well <Button-1> "rulerNewTab $c %x %y"
|
| 81 |
+
$c bind tab <Button-1> "rulerSelectTab $c %x %y"
|
| 82 |
+
bind $c <B1-Motion> "rulerMoveTab $c %x %y"
|
| 83 |
+
bind $c <ButtonRelease-1> "rulerReleaseTab $c"
|
| 84 |
+
|
| 85 |
+
# rulerNewTab --
|
| 86 |
+
# Does all the work of creating a tab stop, including creating the
|
| 87 |
+
# triangle object and adding tags to it to give it tab behavior.
|
| 88 |
+
#
|
| 89 |
+
# Arguments:
|
| 90 |
+
# c - The canvas window.
|
| 91 |
+
# x, y - The coordinates of the tab stop.
|
| 92 |
+
|
| 93 |
+
proc rulerNewTab {c x y} {
|
| 94 |
+
upvar #0 demo_rulerInfo v
|
| 95 |
+
$c addtag active withtag [rulerMkTab $c $x $y]
|
| 96 |
+
$c addtag tab withtag active
|
| 97 |
+
set v(x) $x
|
| 98 |
+
set v(y) $y
|
| 99 |
+
rulerMoveTab $c $x $y
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
# rulerSelectTab --
|
| 103 |
+
# This procedure is invoked when mouse button 1 is pressed over
|
| 104 |
+
# a tab. It remembers information about the tab so that it can
|
| 105 |
+
# be dragged interactively.
|
| 106 |
+
#
|
| 107 |
+
# Arguments:
|
| 108 |
+
# c - The canvas widget.
|
| 109 |
+
# x, y - The coordinates of the mouse (identifies the point by
|
| 110 |
+
# which the tab was picked up for dragging).
|
| 111 |
+
|
| 112 |
+
proc rulerSelectTab {c x y} {
|
| 113 |
+
upvar #0 demo_rulerInfo v
|
| 114 |
+
set v(x) [$c canvasx $x $v(grid)]
|
| 115 |
+
set v(y) [expr {$v(top)+2}]
|
| 116 |
+
$c addtag active withtag current
|
| 117 |
+
eval "$c itemconf active $v(activeStyle)"
|
| 118 |
+
$c raise active
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
# rulerMoveTab --
|
| 122 |
+
# This procedure is invoked during mouse motion events to drag a tab.
|
| 123 |
+
# It adjusts the position of the tab, and changes its appearance if
|
| 124 |
+
# it is about to be dragged out of the ruler.
|
| 125 |
+
#
|
| 126 |
+
# Arguments:
|
| 127 |
+
# c - The canvas widget.
|
| 128 |
+
# x, y - The coordinates of the mouse.
|
| 129 |
+
|
| 130 |
+
proc rulerMoveTab {c x y} {
|
| 131 |
+
upvar #0 demo_rulerInfo v
|
| 132 |
+
if {[$c find withtag active] == ""} {
|
| 133 |
+
return
|
| 134 |
+
}
|
| 135 |
+
set cx [$c canvasx $x $v(grid)]
|
| 136 |
+
set cy [$c canvasy $y]
|
| 137 |
+
if {$cx < $v(left)} {
|
| 138 |
+
set cx $v(left)
|
| 139 |
+
}
|
| 140 |
+
if {$cx > $v(right)} {
|
| 141 |
+
set cx $v(right)
|
| 142 |
+
}
|
| 143 |
+
if {($cy >= $v(top)) && ($cy <= $v(bottom))} {
|
| 144 |
+
set cy [expr {$v(top)+2}]
|
| 145 |
+
eval "$c itemconf active $v(activeStyle)"
|
| 146 |
+
} else {
|
| 147 |
+
set cy [expr {$cy-$v(size)-2}]
|
| 148 |
+
eval "$c itemconf active $v(deleteStyle)"
|
| 149 |
+
}
|
| 150 |
+
$c move active [expr {$cx-$v(x)}] [expr {$cy-$v(y)}]
|
| 151 |
+
set v(x) $cx
|
| 152 |
+
set v(y) $cy
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
# rulerReleaseTab --
|
| 156 |
+
# This procedure is invoked during button release events that end
|
| 157 |
+
# a tab drag operation. It deselects the tab and deletes the tab if
|
| 158 |
+
# it was dragged out of the ruler.
|
| 159 |
+
#
|
| 160 |
+
# Arguments:
|
| 161 |
+
# c - The canvas widget.
|
| 162 |
+
# x, y - The coordinates of the mouse.
|
| 163 |
+
|
| 164 |
+
proc rulerReleaseTab c {
|
| 165 |
+
upvar #0 demo_rulerInfo v
|
| 166 |
+
if {[$c find withtag active] == {}} {
|
| 167 |
+
return
|
| 168 |
+
}
|
| 169 |
+
if {$v(y) != $v(top)+2} {
|
| 170 |
+
$c delete active
|
| 171 |
+
} else {
|
| 172 |
+
eval "$c itemconf active $v(normalStyle)"
|
| 173 |
+
$c dtag active
|
| 174 |
+
}
|
| 175 |
+
}
|
evalkit_llava/lib/tk8.6/demos/sayings.tcl
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# sayings.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a listbox that can be scrolled
|
| 4 |
+
# both horizontally and vertically. It displays a collection of
|
| 5 |
+
# well-known sayings.
|
| 6 |
+
|
| 7 |
+
if {![info exists widgetDemo]} {
|
| 8 |
+
error "This script should be run from the \"widget\" demo."
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
package require Tk
|
| 12 |
+
|
| 13 |
+
set w .sayings
|
| 14 |
+
catch {destroy $w}
|
| 15 |
+
toplevel $w
|
| 16 |
+
wm title $w "Listbox Demonstration (well-known sayings)"
|
| 17 |
+
wm iconname $w "sayings"
|
| 18 |
+
positionWindow $w
|
| 19 |
+
|
| 20 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "The listbox below contains a collection of well-known sayings. You can scan the list using either of the scrollbars or by dragging in the listbox window with button 2 pressed."
|
| 21 |
+
pack $w.msg -side top
|
| 22 |
+
|
| 23 |
+
## See Code / Dismiss buttons
|
| 24 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 25 |
+
pack $btns -side bottom -fill x
|
| 26 |
+
|
| 27 |
+
frame $w.frame -borderwidth 10
|
| 28 |
+
pack $w.frame -side top -expand yes -fill both -padx 1c
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
ttk::scrollbar $w.frame.yscroll -command "$w.frame.list yview"
|
| 32 |
+
ttk::scrollbar $w.frame.xscroll -orient horizontal \
|
| 33 |
+
-command "$w.frame.list xview"
|
| 34 |
+
listbox $w.frame.list -width 20 -height 10 -setgrid 1 \
|
| 35 |
+
-yscroll "$w.frame.yscroll set" -xscroll "$w.frame.xscroll set"
|
| 36 |
+
|
| 37 |
+
grid $w.frame.list -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
|
| 38 |
+
grid $w.frame.yscroll -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news
|
| 39 |
+
grid $w.frame.xscroll -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news
|
| 40 |
+
grid rowconfig $w.frame 0 -weight 1 -minsize 0
|
| 41 |
+
grid columnconfig $w.frame 0 -weight 1 -minsize 0
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
$w.frame.list insert 0 "Don't speculate, measure" "Waste not, want not" "Early to bed and early to rise makes a man healthy, wealthy, and wise" "Ask not what your country can do for you, ask what you can do for your country" "I shall return" "NOT" "A picture is worth a thousand words" "User interfaces are hard to build" "Thou shalt not steal" "A penny for your thoughts" "Fool me once, shame on you; fool me twice, shame on me" "Every cloud has a silver lining" "Where there's smoke there's fire" "It takes one to know one" "Curiosity killed the cat" "Take this job and shove it" "Up a creek without a paddle" "I'm mad as hell and I'm not going to take it any more" "An apple a day keeps the doctor away" "Don't look a gift horse in the mouth" "Measure twice, cut once"
|
evalkit_llava/lib/tk8.6/demos/spin.tcl
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# spin.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates several spinbox widgets.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .spin
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Spinbox Demonstration"
|
| 15 |
+
wm iconname $w "spin"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
label $w.msg -font $font -wraplength 5i -justify left -text "Three different\
|
| 19 |
+
spin-boxes are displayed below. You can add characters by pointing,\
|
| 20 |
+
clicking and typing. The normal Motif editing characters are\
|
| 21 |
+
supported, along with many Emacs bindings. For example, Backspace\
|
| 22 |
+
and Control-h delete the character to the left of the insertion\
|
| 23 |
+
cursor and Delete and Control-d delete the chararacter to the right\
|
| 24 |
+
of the insertion cursor. For values that are too large to fit in the\
|
| 25 |
+
window all at once, you can scan through the value by dragging with\
|
| 26 |
+
mouse button2 pressed. Note that the first spin-box will only permit\
|
| 27 |
+
you to type in integers, and the third selects from a list of\
|
| 28 |
+
Australian cities."
|
| 29 |
+
pack $w.msg -side top
|
| 30 |
+
|
| 31 |
+
## See Code / Dismiss buttons
|
| 32 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 33 |
+
pack $btns -side bottom -fill x
|
| 34 |
+
|
| 35 |
+
set australianCities {
|
| 36 |
+
Canberra Sydney Melbourne Perth Adelaide Brisbane
|
| 37 |
+
Hobart Darwin "Alice Springs"
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
spinbox $w.s1 -from 1 -to 10 -width 10 -validate key \
|
| 41 |
+
-vcmd {string is integer %P}
|
| 42 |
+
spinbox $w.s2 -from 0 -to 3 -increment .5 -format %05.2f -width 10
|
| 43 |
+
spinbox $w.s3 -values $australianCities -width 10
|
| 44 |
+
|
| 45 |
+
#entry $w.e1
|
| 46 |
+
#entry $w.e2
|
| 47 |
+
#entry $w.e3
|
| 48 |
+
pack $w.s1 $w.s2 $w.s3 -side top -pady 5 -padx 10 ;#-fill x
|
| 49 |
+
|
| 50 |
+
#$w.e1 insert 0 "Initial value"
|
| 51 |
+
#$w.e2 insert end "This entry contains a long value, much too long "
|
| 52 |
+
#$w.e2 insert end "to fit in the window at one time, so long in fact "
|
| 53 |
+
#$w.e2 insert end "that you'll have to scan or scroll to see the end."
|
evalkit_llava/lib/tk8.6/demos/states.tcl
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# states.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a listbox widget that displays
|
| 4 |
+
# the names of the 50 states in the United States of America.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .states
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Listbox Demonstration (50 states)"
|
| 16 |
+
wm iconname $w "states"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing the 50 states is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by scanning. To scan, press button 2 in the widget and drag up or down."
|
| 20 |
+
pack $w.msg -side top
|
| 21 |
+
|
| 22 |
+
labelframe $w.justif -text Justification
|
| 23 |
+
foreach c {Left Center Right} {
|
| 24 |
+
set lower [string tolower $c]
|
| 25 |
+
radiobutton $w.justif.$lower -text $c -variable just \
|
| 26 |
+
-relief flat -value $lower -anchor w \
|
| 27 |
+
-command "$w.frame.list configure -justify \$just" \
|
| 28 |
+
-tristatevalue "multi"
|
| 29 |
+
pack $w.justif.$lower -side left -pady 2 -fill x
|
| 30 |
+
}
|
| 31 |
+
pack $w.justif
|
| 32 |
+
|
| 33 |
+
## See Code / Dismiss buttons
|
| 34 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 35 |
+
pack $btns -side bottom -fill x
|
| 36 |
+
|
| 37 |
+
frame $w.frame -borderwidth .5c
|
| 38 |
+
pack $w.frame -side top -expand yes -fill y
|
| 39 |
+
|
| 40 |
+
ttk::scrollbar $w.frame.scroll -command "$w.frame.list yview"
|
| 41 |
+
listbox $w.frame.list -yscroll "$w.frame.scroll set" -setgrid 1 -height 12
|
| 42 |
+
pack $w.frame.scroll -side right -fill y
|
| 43 |
+
pack $w.frame.list -side left -expand 1 -fill both
|
| 44 |
+
|
| 45 |
+
$w.frame.list insert 0 Alabama Alaska Arizona Arkansas California \
|
| 46 |
+
Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois \
|
| 47 |
+
Indiana Iowa Kansas Kentucky Louisiana Maine Maryland \
|
| 48 |
+
Massachusetts Michigan Minnesota Mississippi Missouri \
|
| 49 |
+
Montana Nebraska Nevada "New Hampshire" "New Jersey" "New Mexico" \
|
| 50 |
+
"New York" "North Carolina" "North Dakota" \
|
| 51 |
+
Ohio Oklahoma Oregon Pennsylvania "Rhode Island" \
|
| 52 |
+
"South Carolina" "South Dakota" \
|
| 53 |
+
Tennessee Texas Utah Vermont Virginia Washington \
|
| 54 |
+
"West Virginia" Wisconsin Wyoming
|
evalkit_llava/lib/tk8.6/demos/textpeer.tcl
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# textpeer.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a pair of text widgets that can edit a
|
| 4 |
+
# single logical buffer. This is particularly useful when editing related text
|
| 5 |
+
# in two (or more) parts of the same file.
|
| 6 |
+
|
| 7 |
+
if {![info exists widgetDemo]} {
|
| 8 |
+
error "This script should be run from the \"widget\" demo."
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
package require Tk
|
| 12 |
+
|
| 13 |
+
set w .textpeer
|
| 14 |
+
catch {destroy $w}
|
| 15 |
+
toplevel $w
|
| 16 |
+
wm title $w "Text Widget Peering Demonstration"
|
| 17 |
+
wm iconname $w "textpeer"
|
| 18 |
+
positionWindow $w
|
| 19 |
+
|
| 20 |
+
set count 0
|
| 21 |
+
|
| 22 |
+
## Define a widget that we peer from; it won't ever actually be shown though
|
| 23 |
+
set first [text $w.text[incr count]]
|
| 24 |
+
$first insert end "This is a coupled pair of text widgets; they are peers to "
|
| 25 |
+
$first insert end "each other. They have the same underlying data model, but "
|
| 26 |
+
$first insert end "can show different locations, have different current edit "
|
| 27 |
+
$first insert end "locations, and have different selections. You can also "
|
| 28 |
+
$first insert end "create additional peers of any of these text widgets using "
|
| 29 |
+
$first insert end "the Make Peer button beside the text widget to clone, and "
|
| 30 |
+
$first insert end "delete a particular peer widget using the Delete Peer "
|
| 31 |
+
$first insert end "button."
|
| 32 |
+
|
| 33 |
+
## Procedures to make and kill clones; most of this is just so that the demo
|
| 34 |
+
## looks nice...
|
| 35 |
+
proc makeClone {w parent} {
|
| 36 |
+
global count
|
| 37 |
+
set t [$parent peer create $w.text[incr count] -yscroll "$w.sb$count set"\
|
| 38 |
+
-height 10 -wrap word]
|
| 39 |
+
set sb [ttk::scrollbar $w.sb$count -command "$t yview" -orient vertical]
|
| 40 |
+
set b1 [button $w.clone$count -command "makeClone $w $t" \
|
| 41 |
+
-text "Make Peer"]
|
| 42 |
+
set b2 [button $w.kill$count -command "killClone $w $count" \
|
| 43 |
+
-text "Delete Peer"]
|
| 44 |
+
set row [expr {$count * 2}]
|
| 45 |
+
grid $t $sb $b1 -sticky nsew -row $row
|
| 46 |
+
grid ^ ^ $b2 -row [incr row]
|
| 47 |
+
grid configure $b1 $b2 -sticky new
|
| 48 |
+
grid rowconfigure $w $b2 -weight 1
|
| 49 |
+
}
|
| 50 |
+
proc killClone {w count} {
|
| 51 |
+
destroy $w.text$count $w.sb$count
|
| 52 |
+
destroy $w.clone$count $w.kill$count
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
## Now set up the GUI
|
| 56 |
+
makeClone $w $first
|
| 57 |
+
makeClone $w $first
|
| 58 |
+
destroy $first
|
| 59 |
+
|
| 60 |
+
## See Code / Dismiss buttons
|
| 61 |
+
grid [addSeeDismiss $w.buttons $w] - - -sticky ew -row 5000
|
| 62 |
+
grid columnconfigure $w 0 -weight 1
|
evalkit_llava/lib/tk8.6/demos/tree.tcl
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# tree.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing a Ttk
|
| 4 |
+
# tree widget.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .tree
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Directory Browser"
|
| 16 |
+
wm iconname $w "tree"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
## Explanatory text
|
| 20 |
+
ttk::label $w.msg -font $font -wraplength 4i -justify left -anchor n -padding {10 2 10 6} -text "Ttk is the new Tk themed widget set. One of the widgets it includes is a tree widget, which allows the user to browse a hierarchical data-set such as a filesystem. The tree widget not only allows for the tree part itself, but it also supports an arbitrary number of additional columns which can show additional data (in this case, the size of the files found in your filesystem). You can also change the width of the columns by dragging the boundary between them."
|
| 21 |
+
pack $w.msg -fill x
|
| 22 |
+
|
| 23 |
+
## See Code / Dismiss
|
| 24 |
+
pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
|
| 25 |
+
|
| 26 |
+
## Code to populate the roots of the tree (can be more than one on Windows)
|
| 27 |
+
proc populateRoots {tree} {
|
| 28 |
+
foreach dir [lsort -dictionary [file volumes]] {
|
| 29 |
+
populateTree $tree [$tree insert {} end -text $dir \
|
| 30 |
+
-values [list $dir directory]]
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
## Code to populate a node of the tree
|
| 35 |
+
proc populateTree {tree node} {
|
| 36 |
+
if {[$tree set $node type] ne "directory"} {
|
| 37 |
+
return
|
| 38 |
+
}
|
| 39 |
+
set path [$tree set $node fullpath]
|
| 40 |
+
$tree delete [$tree children $node]
|
| 41 |
+
foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] {
|
| 42 |
+
set f [file normalize $f]
|
| 43 |
+
set type [file type $f]
|
| 44 |
+
set id [$tree insert $node end -text [file tail $f] \
|
| 45 |
+
-values [list $f $type]]
|
| 46 |
+
|
| 47 |
+
if {$type eq "directory"} {
|
| 48 |
+
## Make it so that this node is openable
|
| 49 |
+
$tree insert $id 0 -text dummy ;# a dummy
|
| 50 |
+
$tree item $id -text [file tail $f]/
|
| 51 |
+
|
| 52 |
+
} elseif {$type eq "file"} {
|
| 53 |
+
set size [file size $f]
|
| 54 |
+
## Format the file size nicely
|
| 55 |
+
if {$size >= 1024*1024*1024} {
|
| 56 |
+
set size [format %.1f\ GB [expr {$size/1024/1024/1024.}]]
|
| 57 |
+
} elseif {$size >= 1024*1024} {
|
| 58 |
+
set size [format %.1f\ MB [expr {$size/1024/1024.}]]
|
| 59 |
+
} elseif {$size >= 1024} {
|
| 60 |
+
set size [format %.1f\ kB [expr {$size/1024.}]]
|
| 61 |
+
} else {
|
| 62 |
+
append size " bytes"
|
| 63 |
+
}
|
| 64 |
+
$tree set $id size $size
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
# Stop this code from rerunning on the current node
|
| 69 |
+
$tree set $node type processedDirectory
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
## Create the tree and set it up
|
| 73 |
+
ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \
|
| 74 |
+
-yscroll "$w.vsb set" -xscroll "$w.hsb set"
|
| 75 |
+
ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
|
| 76 |
+
ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
|
| 77 |
+
$w.tree heading \#0 -text "Directory Structure"
|
| 78 |
+
$w.tree heading size -text "File Size"
|
| 79 |
+
$w.tree column size -width 70
|
| 80 |
+
populateRoots $w.tree
|
| 81 |
+
bind $w.tree <<TreeviewOpen>> {populateTree %W [%W focus]}
|
| 82 |
+
|
| 83 |
+
## Arrange the tree and its scrollbars in the toplevel
|
| 84 |
+
lower [ttk::frame $w.dummy]
|
| 85 |
+
pack $w.dummy -fill both -expand 1
|
| 86 |
+
grid $w.tree $w.vsb -sticky nsew -in $w.dummy
|
| 87 |
+
grid $w.hsb -sticky nsew -in $w.dummy
|
| 88 |
+
grid columnconfigure $w.dummy 0 -weight 1
|
| 89 |
+
grid rowconfigure $w.dummy 0 -weight 1
|
evalkit_llava/lib/tk8.6/demos/ttknote.tcl
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ttknote.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a toplevel window containing a Ttk
|
| 4 |
+
# notebook widget.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .ttknote
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Ttk Notebook Widget"
|
| 16 |
+
wm iconname $w "ttknote"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
## See Code / Dismiss
|
| 20 |
+
pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
|
| 21 |
+
|
| 22 |
+
ttk::frame $w.f
|
| 23 |
+
pack $w.f -fill both -expand 1
|
| 24 |
+
set w $w.f
|
| 25 |
+
|
| 26 |
+
## Make the notebook and set up Ctrl+Tab traversal
|
| 27 |
+
ttk::notebook $w.note
|
| 28 |
+
pack $w.note -fill both -expand 1 -padx 2 -pady 3
|
| 29 |
+
ttk::notebook::enableTraversal $w.note
|
| 30 |
+
|
| 31 |
+
## Popuplate the first pane
|
| 32 |
+
ttk::frame $w.note.msg
|
| 33 |
+
ttk::label $w.note.msg.m -font $font -wraplength 4i -justify left -anchor n -text "Ttk is the new Tk themed widget set. One of the widgets it includes is the notebook widget, which provides a set of tabs that allow the selection of a group of panels, each with distinct content. They are a feature of many modern user interfaces. Not only can the tabs be selected with the mouse, but they can also be switched between using Ctrl+Tab when the notebook page heading itself is selected. Note that the second tab is disabled, and cannot be selected."
|
| 34 |
+
ttk::button $w.note.msg.b -text "Neat!" -underline 0 -command {
|
| 35 |
+
set neat "Yeah, I know..."
|
| 36 |
+
after 500 {set neat {}}
|
| 37 |
+
}
|
| 38 |
+
bind $w <Alt-n> "focus $w.note.msg.b; $w.note.msg.b invoke"
|
| 39 |
+
ttk::label $w.note.msg.l -textvariable neat
|
| 40 |
+
$w.note add $w.note.msg -text "Description" -underline 0 -padding 2
|
| 41 |
+
grid $w.note.msg.m - -sticky new -pady 2
|
| 42 |
+
grid $w.note.msg.b $w.note.msg.l -pady {2 4}
|
| 43 |
+
grid rowconfigure $w.note.msg 1 -weight 1
|
| 44 |
+
grid columnconfigure $w.note.msg {0 1} -weight 1 -uniform 1
|
| 45 |
+
|
| 46 |
+
## Populate the second pane. Note that the content doesn't really matter
|
| 47 |
+
ttk::frame $w.note.disabled
|
| 48 |
+
$w.note add $w.note.disabled -text "Disabled" -state disabled
|
| 49 |
+
|
| 50 |
+
## Popuplate the third pane
|
| 51 |
+
ttk::frame $w.note.editor
|
| 52 |
+
$w.note add $w.note.editor -text "Text Editor" -underline 0
|
| 53 |
+
text $w.note.editor.t -width 40 -height 10 -wrap char \
|
| 54 |
+
-yscroll "$w.note.editor.s set"
|
| 55 |
+
ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
|
| 56 |
+
pack $w.note.editor.s -side right -fill y -padx {0 2} -pady 2
|
| 57 |
+
pack $w.note.editor.t -fill both -expand 1 -pady 2 -padx {2 0}
|
evalkit_llava/lib/tk8.6/demos/ttkpane.tcl
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ttkpane.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates a Ttk pane with some content.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .ttkpane
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Themed Nested Panes"
|
| 15 |
+
wm iconname $w "ttkpane"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
ttk::label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows off a nested set of themed paned windows. Their sizes can be changed by grabbing the area between each contained pane and dragging the divider."
|
| 19 |
+
pack $w.msg [ttk::separator $w.msgSep] -side top -fill x
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss
|
| 22 |
+
pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
|
| 23 |
+
|
| 24 |
+
ttk::frame $w.f
|
| 25 |
+
pack $w.f -fill both -expand 1
|
| 26 |
+
set w $w.f
|
| 27 |
+
ttk::panedwindow $w.outer -orient horizontal
|
| 28 |
+
$w.outer add [ttk::panedwindow $w.outer.inLeft -orient vertical]
|
| 29 |
+
$w.outer add [ttk::panedwindow $w.outer.inRight -orient vertical]
|
| 30 |
+
$w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.top -text Button]
|
| 31 |
+
$w.outer.inLeft add [ttk::labelframe $w.outer.inLeft.bot -text Clocks]
|
| 32 |
+
$w.outer.inRight add [ttk::labelframe $w.outer.inRight.top -text Progress]
|
| 33 |
+
$w.outer.inRight add [ttk::labelframe $w.outer.inRight.bot -text Text]
|
| 34 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 35 |
+
foreach i [list inLeft.top inLeft.bot inRight.top inRight.bot] {
|
| 36 |
+
$w.outer.$i configure -padding 3
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
# Fill the button pane
|
| 41 |
+
ttk::button $w.outer.inLeft.top.b -text "Press Me" -command {
|
| 42 |
+
tk_messageBox -type ok -icon info -message "Ouch!" -detail "That hurt..." \
|
| 43 |
+
-parent .ttkpane -title "Button Pressed"
|
| 44 |
+
}
|
| 45 |
+
pack $w.outer.inLeft.top.b -padx 2 -pady 5
|
| 46 |
+
|
| 47 |
+
# Fill the clocks pane
|
| 48 |
+
set i 0
|
| 49 |
+
proc every {delay script} {
|
| 50 |
+
uplevel #0 $script
|
| 51 |
+
after $delay [list every $delay $script]
|
| 52 |
+
}
|
| 53 |
+
set testzones {
|
| 54 |
+
:Europe/Berlin
|
| 55 |
+
:America/Argentina/Buenos_Aires
|
| 56 |
+
:Africa/Johannesburg
|
| 57 |
+
:Europe/London
|
| 58 |
+
:America/Los_Angeles
|
| 59 |
+
:Europe/Moscow
|
| 60 |
+
:America/New_York
|
| 61 |
+
:Asia/Singapore
|
| 62 |
+
:Australia/Sydney
|
| 63 |
+
:Asia/Tokyo
|
| 64 |
+
}
|
| 65 |
+
# Force a pre-load of all the timezones needed; otherwise can end up
|
| 66 |
+
# poor-looking synch problems!
|
| 67 |
+
set zones {}
|
| 68 |
+
foreach zone $testzones {
|
| 69 |
+
if {![catch {clock format 0 -timezone $zone}]} {
|
| 70 |
+
lappend zones $zone
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
if {[llength $zones] < 2} { lappend zones -0200 :GMT :UTC +0200 }
|
| 74 |
+
foreach zone $zones {
|
| 75 |
+
set city [string map {_ " "} [regexp -inline {[^/]+$} $zone]]
|
| 76 |
+
if {$i} {
|
| 77 |
+
pack [ttk::separator $w.outer.inLeft.bot.s$i] -fill x
|
| 78 |
+
}
|
| 79 |
+
ttk::label $w.outer.inLeft.bot.l$i -text $city -anchor w
|
| 80 |
+
ttk::label $w.outer.inLeft.bot.t$i -textvariable time($zone) -anchor w
|
| 81 |
+
pack $w.outer.inLeft.bot.l$i $w.outer.inLeft.bot.t$i -fill x
|
| 82 |
+
every 1000 "set time($zone) \[clock format \[clock seconds\] -timezone $zone -format %T\]"
|
| 83 |
+
incr i
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
# Fill the progress pane
|
| 87 |
+
ttk::progressbar $w.outer.inRight.top.progress -mode indeterminate
|
| 88 |
+
pack $w.outer.inRight.top.progress -fill both -expand 1
|
| 89 |
+
$w.outer.inRight.top.progress start
|
| 90 |
+
|
| 91 |
+
# Fill the text pane
|
| 92 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 93 |
+
# The trick with the ttk::frame makes the text widget look like it fits with
|
| 94 |
+
# the current Ttk theme despite not being a themed widget itself. It is done
|
| 95 |
+
# by styling the frame like an entry, turning off the border in the text
|
| 96 |
+
# widget, and putting the text widget in the frame with enough space to allow
|
| 97 |
+
# the surrounding border to show through (2 pixels seems to be enough).
|
| 98 |
+
ttk::frame $w.outer.inRight.bot.f -style TEntry
|
| 99 |
+
text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0
|
| 100 |
+
pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2
|
| 101 |
+
ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview"
|
| 102 |
+
pack $w.sb -side right -fill y -in $w.outer.inRight.bot
|
| 103 |
+
pack $w.outer.inRight.bot.f -fill both -expand 1
|
| 104 |
+
pack $w.outer -fill both -expand 1
|
| 105 |
+
} else {
|
| 106 |
+
text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0
|
| 107 |
+
ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview"
|
| 108 |
+
pack $w.sb -side right -fill y -in $w.outer.inRight.bot
|
| 109 |
+
pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot
|
| 110 |
+
pack $w.outer -fill both -expand 1 -padx 10 -pady {6 10}
|
| 111 |
+
}
|
| 112 |
+
|
evalkit_llava/lib/tk8.6/demos/ttkprogress.tcl
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ttkprogress.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script creates several progress bar widgets.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .ttkprogress
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Progress Bar Demonstration"
|
| 15 |
+
wm iconname $w "ttkprogress"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
|
| 19 |
+
pack $w.msg -side top -fill x
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss buttons
|
| 22 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 23 |
+
pack $btns -side bottom -fill x
|
| 24 |
+
|
| 25 |
+
ttk::frame $w.f
|
| 26 |
+
pack $w.f -fill both -expand 1
|
| 27 |
+
set w $w.f
|
| 28 |
+
|
| 29 |
+
proc doBars {op args} {
|
| 30 |
+
foreach w $args {
|
| 31 |
+
$w $op
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
ttk::progressbar $w.p1 -mode determinate
|
| 35 |
+
ttk::progressbar $w.p2 -mode indeterminate
|
| 36 |
+
ttk::button $w.start -text "Start Progress" -command [list \
|
| 37 |
+
doBars start $w.p1 $w.p2]
|
| 38 |
+
ttk::button $w.stop -text "Stop Progress" -command [list \
|
| 39 |
+
doBars stop $w.p1 $w.p2]
|
| 40 |
+
|
| 41 |
+
grid $w.p1 - -pady 5 -padx 10
|
| 42 |
+
grid $w.p2 - -pady 5 -padx 10
|
| 43 |
+
grid $w.start $w.stop -padx 10 -pady 5
|
| 44 |
+
grid configure $w.start -sticky e
|
| 45 |
+
grid configure $w.stop -sticky w
|
| 46 |
+
grid columnconfigure $w all -weight 1
|
evalkit_llava/lib/tk8.6/demos/unicodeout.tcl
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# unicodeout.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script shows how you can produce output (in label
|
| 4 |
+
# widgets) using many different alphabets.
|
| 5 |
+
|
| 6 |
+
if {![info exists widgetDemo]} {
|
| 7 |
+
error "This script should be run from the \"widget\" demo."
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
package require Tk
|
| 11 |
+
|
| 12 |
+
set w .unicodeout
|
| 13 |
+
catch {destroy $w}
|
| 14 |
+
toplevel $w
|
| 15 |
+
wm title $w "Unicode Label Demonstration"
|
| 16 |
+
wm iconname $w "unicodeout"
|
| 17 |
+
positionWindow $w
|
| 18 |
+
|
| 19 |
+
label $w.msg -font $font -wraplength 4i -anchor w -justify left \
|
| 20 |
+
-text "This is a sample of Tk's support for languages that use\
|
| 21 |
+
non-Western character sets. However, what you will actually see\
|
| 22 |
+
below depends largely on what character sets you have installed,\
|
| 23 |
+
and what you see for characters that are not present varies greatly\
|
| 24 |
+
between platforms as well. The strings are written in Tcl using\
|
| 25 |
+
UNICODE characters using the \\uXXXX escape so as to do so in a\
|
| 26 |
+
portable fashion."
|
| 27 |
+
pack $w.msg -side top
|
| 28 |
+
|
| 29 |
+
## See Code / Dismiss buttons
|
| 30 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 31 |
+
pack $btns -side bottom -fill x
|
| 32 |
+
|
| 33 |
+
## The frame that will contain the sample texts.
|
| 34 |
+
pack [frame $w.f] -side bottom -expand 1 -fill both -padx 2m -pady 1m
|
| 35 |
+
grid columnconfigure $w.f 1 -weight 1
|
| 36 |
+
set i 0
|
| 37 |
+
proc addSample {w language args} {
|
| 38 |
+
global font i
|
| 39 |
+
set sample [join $args ""]
|
| 40 |
+
set j [incr i]
|
| 41 |
+
label $w.f.l$j -font $font -text "${language}:" -anchor nw -pady 0
|
| 42 |
+
label $w.f.s$j -font $font -text $sample -anchor nw -width 30 -pady 0
|
| 43 |
+
grid $w.f.l$j $w.f.s$j -sticky ew -pady 0
|
| 44 |
+
grid configure $w.f.l$j -padx 1m
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
## A helper procedure that determines what form to use to express languages
|
| 48 |
+
## that have complex rendering rules...
|
| 49 |
+
proc usePresentationFormsFor {language} {
|
| 50 |
+
switch [tk windowingsystem] {
|
| 51 |
+
aqua {
|
| 52 |
+
# OSX wants natural character order; the renderer knows how to
|
| 53 |
+
# compose things for display for all languages.
|
| 54 |
+
return false
|
| 55 |
+
}
|
| 56 |
+
x11 {
|
| 57 |
+
# The X11 font renderers that Tk supports all know nothing about
|
| 58 |
+
# composing characters, so we need to use presentation forms.
|
| 59 |
+
return true
|
| 60 |
+
}
|
| 61 |
+
win32 {
|
| 62 |
+
# On Windows, we need to determine whether the font system will
|
| 63 |
+
# render right-to-left text. This varies by language!
|
| 64 |
+
try {
|
| 65 |
+
package require registry
|
| 66 |
+
set rkey [join {
|
| 67 |
+
HKEY_LOCAL_MACHINE
|
| 68 |
+
SOFTWARE
|
| 69 |
+
Microsoft
|
| 70 |
+
{Windows NT}
|
| 71 |
+
CurrentVersion
|
| 72 |
+
LanguagePack
|
| 73 |
+
} \\]
|
| 74 |
+
return [expr {
|
| 75 |
+
[string toupper $language] ni [registry values $rkey]
|
| 76 |
+
}]
|
| 77 |
+
} trap error {} {
|
| 78 |
+
# Cannot work it out, so use presentation forms.
|
| 79 |
+
return true
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
default {
|
| 83 |
+
# Default to using presentation forms.
|
| 84 |
+
return true
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
## Processing when some characters are not currently cached by the display
|
| 90 |
+
## engine might take a while, so make sure we're displaying something in the
|
| 91 |
+
## meantime...
|
| 92 |
+
pack [label $w.wait -text "Please wait while loading fonts..." \
|
| 93 |
+
-font {Helvetica 12 italic}]
|
| 94 |
+
set oldCursor [$w cget -cursor]
|
| 95 |
+
$w conf -cursor watch
|
| 96 |
+
update
|
| 97 |
+
|
| 98 |
+
## Add the samples...
|
| 99 |
+
if {[usePresentationFormsFor Arabic]} {
|
| 100 |
+
# Using presentation forms (pre-layouted)
|
| 101 |
+
addSample $w Arabic \
|
| 102 |
+
"\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
|
| 103 |
+
"\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
|
| 104 |
+
} else {
|
| 105 |
+
# Using standard text characters
|
| 106 |
+
addSample $w Arabic \
|
| 107 |
+
"\u0627\u0644\u0643\u0644\u0645\u0629 " \
|
| 108 |
+
"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
|
| 109 |
+
}
|
| 110 |
+
addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
|
| 111 |
+
addSample $w "Simpl. Chinese" "\u6C49\u8BED"
|
| 112 |
+
addSample $w French "Langue fran\xE7aise"
|
| 113 |
+
addSample $w Greek \
|
| 114 |
+
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
|
| 115 |
+
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
|
| 116 |
+
if {[usePresentationFormsFor Hebrew]} {
|
| 117 |
+
# Visual order (pre-layouted)
|
| 118 |
+
addSample $w Hebrew \
|
| 119 |
+
"\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
|
| 120 |
+
} else {
|
| 121 |
+
# Standard logical order
|
| 122 |
+
addSample $w Hebrew \
|
| 123 |
+
"\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
|
| 124 |
+
}
|
| 125 |
+
addSample $w Hindi \
|
| 126 |
+
"\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E"
|
| 127 |
+
addSample $w Icelandic "\xCDslenska"
|
| 128 |
+
addSample $w Japanese \
|
| 129 |
+
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
|
| 130 |
+
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
|
| 131 |
+
addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
|
| 132 |
+
addSample $w Russian \
|
| 133 |
+
"\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
|
| 134 |
+
if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} {
|
| 135 |
+
if {[package vsatisfies [package provide Tcl] 8.7-]} {
|
| 136 |
+
addSample $w Emoji "😀💩👍🇳🇱"
|
| 137 |
+
} else {
|
| 138 |
+
addSample $w Emoji \
|
| 139 |
+
"\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
## We're done processing, so change things back to normal running...
|
| 144 |
+
destroy $w.wait
|
| 145 |
+
$w conf -cursor $oldCursor
|
evalkit_llava/lib/tk8.6/demos/vscale.tcl
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# vscale.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This demonstration script shows an example with a vertical scale.
|
| 4 |
+
|
| 5 |
+
if {![info exists widgetDemo]} {
|
| 6 |
+
error "This script should be run from the \"widget\" demo."
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
package require Tk
|
| 10 |
+
|
| 11 |
+
set w .vscale
|
| 12 |
+
catch {destroy $w}
|
| 13 |
+
toplevel $w
|
| 14 |
+
wm title $w "Vertical Scale Demonstration"
|
| 15 |
+
wm iconname $w "vscale"
|
| 16 |
+
positionWindow $w
|
| 17 |
+
|
| 18 |
+
label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a vertical scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the size of the arrow."
|
| 19 |
+
pack $w.msg -side top -padx .5c
|
| 20 |
+
|
| 21 |
+
## See Code / Dismiss buttons
|
| 22 |
+
set btns [addSeeDismiss $w.buttons $w]
|
| 23 |
+
pack $btns -side bottom -fill x
|
| 24 |
+
|
| 25 |
+
frame $w.frame -borderwidth 10
|
| 26 |
+
pack $w.frame
|
| 27 |
+
|
| 28 |
+
scale $w.frame.scale -orient vertical -length 284 -from 0 -to 250 \
|
| 29 |
+
-command "setHeight $w.frame.canvas" -tickinterval 50
|
| 30 |
+
canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
|
| 31 |
+
$w.frame.canvas create polygon 0 0 1 1 2 2 -fill SeaGreen3 -tags poly
|
| 32 |
+
$w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
|
| 33 |
+
frame $w.frame.right -borderwidth 15
|
| 34 |
+
pack $w.frame.scale -side left -anchor ne
|
| 35 |
+
pack $w.frame.canvas -side left -anchor nw -fill y
|
| 36 |
+
$w.frame.scale set 75
|
| 37 |
+
|
| 38 |
+
proc setHeight {w height} {
|
| 39 |
+
incr height 21
|
| 40 |
+
set y2 [expr {$height - 30}]
|
| 41 |
+
if {$y2 < 21} {
|
| 42 |
+
set y2 21
|
| 43 |
+
}
|
| 44 |
+
$w coords poly 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
|
| 45 |
+
$w coords line 15 20 35 20 35 $y2 45 $y2 25 $height 5 $y2 15 $y2 15 20
|
| 46 |
+
}
|
evalkit_llava/lib/tk8.6/demos/widget
ADDED
|
@@ -0,0 +1,734 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# the next line restarts using wish \
|
| 3 |
+
exec wish8.6 "$0" ${1+"$@"}
|
| 4 |
+
|
| 5 |
+
# widget --
|
| 6 |
+
# This script demonstrates the various widgets provided by Tk, along with many
|
| 7 |
+
# of the features of the Tk toolkit. This file only contains code to generate
|
| 8 |
+
# the main window for the application, which invokes individual
|
| 9 |
+
# demonstrations. The code for the actual demonstrations is contained in
|
| 10 |
+
# separate ".tcl" files is this directory, which are sourced by this script as
|
| 11 |
+
# needed.
|
| 12 |
+
|
| 13 |
+
package require Tk 8.5
|
| 14 |
+
package require msgcat
|
| 15 |
+
|
| 16 |
+
destroy {*}[winfo children .]
|
| 17 |
+
set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
|
| 18 |
+
::msgcat::mcload $tk_demoDirectory
|
| 19 |
+
namespace import ::msgcat::mc
|
| 20 |
+
wm title . [mc "Widget Demonstration"]
|
| 21 |
+
if {[tk windowingsystem] eq "x11"} {
|
| 22 |
+
# This won't work everywhere, but there's no other way in core Tk at the
|
| 23 |
+
# moment to display a coloured icon.
|
| 24 |
+
image create photo TclPowered \
|
| 25 |
+
-file [file join $tk_library images logo64.gif]
|
| 26 |
+
wm iconwindow . [toplevel ._iconWindow]
|
| 27 |
+
pack [label ._iconWindow.i -image TclPowered]
|
| 28 |
+
wm iconname . [mc "tkWidgetDemo"]
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
if {"defaultFont" ni [font names]} {
|
| 32 |
+
# TIP #145 defines some standard named fonts
|
| 33 |
+
if {"TkDefaultFont" in [font names] && "TkFixedFont" in [font names]} {
|
| 34 |
+
# FIX ME: the following technique of cloning the font to copy it works
|
| 35 |
+
# fine but means that if the system font is changed by Tk
|
| 36 |
+
# cannot update the copied font. font alias might be useful
|
| 37 |
+
# here -- or fix the app to use TkDefaultFont etc.
|
| 38 |
+
font create mainFont {*}[font configure TkDefaultFont]
|
| 39 |
+
font create fixedFont {*}[font configure TkFixedFont]
|
| 40 |
+
font create boldFont {*}[font configure TkDefaultFont] -weight bold
|
| 41 |
+
font create titleFont {*}[font configure TkDefaultFont] -weight bold
|
| 42 |
+
font create statusFont {*}[font configure TkDefaultFont]
|
| 43 |
+
font create varsFont {*}[font configure TkDefaultFont]
|
| 44 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 45 |
+
font configure titleFont -size 17
|
| 46 |
+
}
|
| 47 |
+
} else {
|
| 48 |
+
font create mainFont -family Helvetica -size 12
|
| 49 |
+
font create fixedFont -family Courier -size 10
|
| 50 |
+
font create boldFont -family Helvetica -size 12 -weight bold
|
| 51 |
+
font create titleFont -family Helvetica -size 18 -weight bold
|
| 52 |
+
font create statusFont -family Helvetica -size 10
|
| 53 |
+
font create varsFont -family Helvetica -size 14
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
set widgetDemo 1
|
| 58 |
+
set font mainFont
|
| 59 |
+
|
| 60 |
+
image create photo ::img::refresh -format GIF -data {
|
| 61 |
+
R0lGODlhEAAQAJEDAP///wAAACpnKv///yH5BAEAAAMALAAAAAAQABAAAAI63IKp
|
| 62 |
+
xgcPH2ouwgBCw1HIxHCQ4F3hSJKmwZXqWrmWxj7lKJ2dndcon9EBUq+gz3brVXAR
|
| 63 |
+
2tICU0gXBQA7
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
image create photo ::img::view -format GIF -data {
|
| 67 |
+
R0lGODlhEAAQAKIHAP///wwMDAAAAMDAwNnZ2SYmJmZmZv///yH5BAEAAAcALAAA
|
| 68 |
+
AAAQABAAAANMKLos90+ASamDRxJCgw9YVnlDOXiQBgRDBRgHKE6sW8QR3doPKK27
|
| 69 |
+
yg33q/GIOhdg6OsEJzeZykiBSUcs06e56Xx6np8ScIkFGuhQAgA7
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
image create photo ::img::delete -format GIF -data {
|
| 73 |
+
R0lGODlhEAAQAIABAIQAAP///yH5BAEAAAEALAAAAAAQABAAAAIjjI+pmwAc3HGy
|
| 74 |
+
PUSvqYpuvWQg40FfSVacBa5nN6JYDI3mzRQAOw==
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
image create photo ::img::print -format GIF -data {
|
| 78 |
+
R0lGODlhEAAQALMKAAAAAP///52VunNkl8C82Yl+qldBgq+pyrOzs1fYAP///wAA
|
| 79 |
+
AAAAAAAAAAAAAAAAACH5BAEAAAoALAAAAAAQABAAAARGUMlJKwU4AztB+ODGeUiJ
|
| 80 |
+
fGLlgeEYmGWQXmx7aXgmAUTv/74N4EAsGhOJg1DAbDqbwoJ0Sp0KB9isNis0eL/g
|
| 81 |
+
ryhH5pgnEQA7
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
# Note that this is run through the message catalog! This is because this is
|
| 85 |
+
# actually an image of a word.
|
| 86 |
+
image create photo ::img::new -format PNG -data [mc {
|
| 87 |
+
iVBORw0KGgoAAAANSUhEUgAAAB4AAAAOCAYAAAA45qw5AAACMElEQVR4AeVTAwxd
|
| 88 |
+
QRCc2tZHGtQ2w9q2bdsOa9u2bUW1bdt2Z372JZe6DapJLqtb3h7+T8yKi5j4CsYD
|
| 89 |
+
EUQXxETclT7kWOlH2VV+tFkdQHPSwksSISF+BauCqL0qgOcMWgGfgEkaMsHxqUBk
|
| 90 |
+
3plE/sOnh/qDPAPJH/CKFBivGHWzFwBRnHhlqbu1Mh6CoFNnC/JshQ9p4YC2lrKt
|
| 91 |
+
DCAV+THiVejyhMjAbrNSrroiEfKR9g7ZfCgOog8QfnUQV62wAk68ndQ9ZbyoWO1H
|
| 92 |
+
Y6eDY1LCQL6a9ApOp9Hi1T0+gQq2JKMlky/oTKQliKWxEZvyG575kpW4pl1aZnQK
|
| 93 |
+
CLOVt45Lkp8uXp2SL8KO6uitNTZLdpK6s+I/eZbhpmsmWeOGOVQNKYLITzpKPAO3
|
| 94 |
+
tY7LSNZ7ccSLxX9y3uuOxRkg3dKESMoCHvL+GRVCutXsB3guLgDCeXOv4iWWkvwG
|
| 95 |
+
BaS+PmlpK6SI9ApI2oC2UtrwZQEkhkH+NtolVlQXJl1I+QltuU3XEc721bIRFpa8
|
| 96 |
+
IA5iqTo6vNNWmkNBLQbPeXwF2g17Q94nTQAfY3YzeY+WSu8MDzQ2kpELUhSGJUHE
|
| 97 |
+
0zeR3rY1L+Xl5G/re+jbiK6KhThwwInsts1fbMUUcpZszKeVtggZEiGdZDe5AtHh
|
| 98 |
+
7vL4CGiRvvKPS8FAvq9Nr4ZkFadR2y6kggu1z4vlyIbBp6BugQ8JLEg4bTkD9eMZ
|
| 99 |
+
QZ8hpJ3VvTtuvbWrY/ElvP/9R+Aj3603+iE3fkEAAAAASUVORK5CYII=
|
| 100 |
+
}]
|
| 101 |
+
|
| 102 |
+
#----------------------------------------------------------------
|
| 103 |
+
# The code below creates the main window, consisting of a menu bar and a text
|
| 104 |
+
# widget that explains how to use the program, plus lists all of the demos as
|
| 105 |
+
# hypertext items.
|
| 106 |
+
#----------------------------------------------------------------
|
| 107 |
+
|
| 108 |
+
menu .menuBar -tearoff 0
|
| 109 |
+
|
| 110 |
+
# On Aqua, just use the default menu.
|
| 111 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 112 |
+
# This is a tk-internal procedure to make i18n easier
|
| 113 |
+
::tk::AmpMenuArgs .menuBar add cascade -label [mc "&File"] \
|
| 114 |
+
-menu .menuBar.file
|
| 115 |
+
menu .menuBar.file -tearoff 0
|
| 116 |
+
::tk::AmpMenuArgs .menuBar.file add command -label [mc "&About..."] \
|
| 117 |
+
-command {tkAboutDialog} -accelerator [mc "<F1>"]
|
| 118 |
+
bind . <F1> {tkAboutDialog}
|
| 119 |
+
.menuBar.file add sep
|
| 120 |
+
if {[string match win* [tk windowingsystem]]} {
|
| 121 |
+
# Windows doesn't usually have a Meta key
|
| 122 |
+
::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
|
| 123 |
+
-command {exit} -accelerator [mc "Ctrl+Q"]
|
| 124 |
+
bind . <[mc "Control-q"]> {exit}
|
| 125 |
+
} else {
|
| 126 |
+
::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \
|
| 127 |
+
-command {exit} -accelerator [mc "Meta-Q"]
|
| 128 |
+
bind . <[mc "Meta-q"]> {exit}
|
| 129 |
+
}
|
| 130 |
+
. configure -menu .menuBar
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
ttk::frame .statusBar
|
| 134 |
+
ttk::label .statusBar.lab -text " " -anchor w
|
| 135 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 136 |
+
ttk::separator .statusBar.sep
|
| 137 |
+
pack .statusBar.sep -side top -expand yes -fill x -pady 0
|
| 138 |
+
}
|
| 139 |
+
pack .statusBar.lab -side left -padx 2 -expand yes -fill both
|
| 140 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 141 |
+
ttk::sizegrip .statusBar.foo
|
| 142 |
+
pack .statusBar.foo -side left -padx 2
|
| 143 |
+
}
|
| 144 |
+
pack .statusBar -side bottom -fill x -pady 2
|
| 145 |
+
|
| 146 |
+
set textheight 30
|
| 147 |
+
catch {
|
| 148 |
+
set textheight [expr {
|
| 149 |
+
([winfo screenheight .] * 0.7) /
|
| 150 |
+
[font metrics mainFont -displayof . -linespace]
|
| 151 |
+
}]
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
ttk::frame .textFrame
|
| 155 |
+
ttk::scrollbar .s -orient vertical -command {.t yview} -takefocus 1
|
| 156 |
+
pack .s -in .textFrame -side right -fill y
|
| 157 |
+
text .t -yscrollcommand {.s set} -wrap word -width 70 -height $textheight \
|
| 158 |
+
-font mainFont -setgrid 1 -highlightthickness 0 \
|
| 159 |
+
-padx 4 -pady 2 -takefocus 0
|
| 160 |
+
pack .t -in .textFrame -expand y -fill both -padx 1
|
| 161 |
+
pack .textFrame -expand yes -fill both
|
| 162 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 163 |
+
pack configure .statusBar.lab -padx {10 18} -pady {4 6}
|
| 164 |
+
pack configure .statusBar -pady 0
|
| 165 |
+
.t configure -padx 10 -pady 0
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
# Create a bunch of tags to use in the text widget, such as those for section
|
| 169 |
+
# titles and demo descriptions. Also define the bindings for tags.
|
| 170 |
+
|
| 171 |
+
.t tag configure title -font titleFont
|
| 172 |
+
.t tag configure subtitle -font titleFont
|
| 173 |
+
.t tag configure bold -font boldFont
|
| 174 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 175 |
+
.t tag configure title -spacing1 8
|
| 176 |
+
.t tag configure subtitle -spacing3 3
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
# We put some "space" characters to the left and right of each demo
|
| 180 |
+
# description so that the descriptions are highlighted only when the mouse
|
| 181 |
+
# cursor is right over them (but not when the cursor is to their left or
|
| 182 |
+
# right).
|
| 183 |
+
#
|
| 184 |
+
.t tag configure demospace -lmargin1 1c -lmargin2 1c
|
| 185 |
+
|
| 186 |
+
if {[winfo depth .] == 1} {
|
| 187 |
+
.t tag configure demo -lmargin1 1c -lmargin2 1c \
|
| 188 |
+
-underline 1
|
| 189 |
+
.t tag configure visited -lmargin1 1c -lmargin2 1c \
|
| 190 |
+
-underline 1
|
| 191 |
+
.t tag configure hot -background black -foreground white
|
| 192 |
+
} else {
|
| 193 |
+
.t tag configure demo -lmargin1 1c -lmargin2 1c \
|
| 194 |
+
-foreground blue -underline 1
|
| 195 |
+
.t tag configure visited -lmargin1 1c -lmargin2 1c \
|
| 196 |
+
-foreground #303080 -underline 1
|
| 197 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 198 |
+
.t tag configure demo -foreground systemLinkColor
|
| 199 |
+
.t tag configure visited -foreground purple
|
| 200 |
+
}
|
| 201 |
+
.t tag configure hot -foreground red -underline 1
|
| 202 |
+
}
|
| 203 |
+
.t tag bind demo <ButtonRelease-1> {
|
| 204 |
+
invoke [.t index {@%x,%y}]
|
| 205 |
+
}
|
| 206 |
+
set lastLine ""
|
| 207 |
+
.t tag bind demo <Enter> {
|
| 208 |
+
set lastLine [.t index {@%x,%y linestart}]
|
| 209 |
+
.t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
|
| 210 |
+
.t config -cursor [::ttk::cursor link]
|
| 211 |
+
showStatus [.t index {@%x,%y}]
|
| 212 |
+
}
|
| 213 |
+
.t tag bind demo <Leave> {
|
| 214 |
+
.t tag remove hot 1.0 end
|
| 215 |
+
.t config -cursor [::ttk::cursor text]
|
| 216 |
+
.statusBar.lab config -text ""
|
| 217 |
+
}
|
| 218 |
+
.t tag bind demo <Motion> {
|
| 219 |
+
set newLine [.t index {@%x,%y linestart}]
|
| 220 |
+
if {$newLine ne $lastLine} {
|
| 221 |
+
.t tag remove hot 1.0 end
|
| 222 |
+
set lastLine $newLine
|
| 223 |
+
|
| 224 |
+
set tags [.t tag names {@%x,%y}]
|
| 225 |
+
set i [lsearch -glob $tags demo-*]
|
| 226 |
+
if {$i >= 0} {
|
| 227 |
+
.t tag add hot "$lastLine +1 chars" "$lastLine lineend -1 chars"
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
showStatus [.t index {@%x,%y}]
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
##############################################################################
|
| 234 |
+
# Create the text for the text widget.
|
| 235 |
+
|
| 236 |
+
# addFormattedText --
|
| 237 |
+
#
|
| 238 |
+
# Add formatted text (but not hypertext) to the text widget after first
|
| 239 |
+
# passing it through the message catalog to allow for localization.
|
| 240 |
+
# Lines starting with @@ are formatting directives (insert title, insert
|
| 241 |
+
# demo hyperlink, begin newline, or change style) and all other lines
|
| 242 |
+
# are literal strings to be inserted. Substitutions are performed,
|
| 243 |
+
# allowing processing pieces through the message catalog. Blank lines
|
| 244 |
+
# are ignored.
|
| 245 |
+
#
|
| 246 |
+
proc addFormattedText {formattedText} {
|
| 247 |
+
set style normal
|
| 248 |
+
set isNL 1
|
| 249 |
+
set demoCount 0
|
| 250 |
+
set new 0
|
| 251 |
+
foreach line [split $formattedText \n] {
|
| 252 |
+
set line [string trim $line]
|
| 253 |
+
if {$line eq ""} {
|
| 254 |
+
continue
|
| 255 |
+
}
|
| 256 |
+
if {[string match @@* $line]} {
|
| 257 |
+
set data [string range $line 2 end]
|
| 258 |
+
set key [lindex $data 0]
|
| 259 |
+
set values [lrange $data 1 end]
|
| 260 |
+
switch -exact -- $key {
|
| 261 |
+
title {
|
| 262 |
+
.t insert end [mc $values]\n title \n normal
|
| 263 |
+
}
|
| 264 |
+
newline {
|
| 265 |
+
.t insert end \n $style
|
| 266 |
+
set isNL 1
|
| 267 |
+
}
|
| 268 |
+
subtitle {
|
| 269 |
+
.t insert end "\n" {} [mc $values] subtitle \
|
| 270 |
+
" \n " demospace
|
| 271 |
+
set demoCount 0
|
| 272 |
+
}
|
| 273 |
+
demo {
|
| 274 |
+
set description [lassign $values name]
|
| 275 |
+
.t insert end "[incr demoCount]. [mc $description]" \
|
| 276 |
+
[list demo demo-$name]
|
| 277 |
+
if {$new} {
|
| 278 |
+
.t image create end -image ::img::new -padx 5
|
| 279 |
+
set new 0
|
| 280 |
+
}
|
| 281 |
+
.t insert end " \n " demospace
|
| 282 |
+
}
|
| 283 |
+
new {
|
| 284 |
+
set new 1
|
| 285 |
+
}
|
| 286 |
+
default {
|
| 287 |
+
set style $key
|
| 288 |
+
}
|
| 289 |
+
}
|
| 290 |
+
continue
|
| 291 |
+
}
|
| 292 |
+
if {!$isNL} {
|
| 293 |
+
.t insert end " " $style
|
| 294 |
+
}
|
| 295 |
+
set isNL 0
|
| 296 |
+
.t insert end [mc $line] $style
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
addFormattedText {
|
| 301 |
+
@@title Tk Widget Demonstrations
|
| 302 |
+
|
| 303 |
+
This application provides a front end for several short scripts
|
| 304 |
+
that demonstrate what you can do with Tk widgets. Each of the
|
| 305 |
+
numbered lines below describes a demonstration; you can click on
|
| 306 |
+
it to invoke the demonstration. Once the demonstration window
|
| 307 |
+
appears, you can click the
|
| 308 |
+
@@bold
|
| 309 |
+
See Code
|
| 310 |
+
@@normal
|
| 311 |
+
button to see the Tcl/Tk code that created the demonstration. If
|
| 312 |
+
you wish, you can edit the code and click the
|
| 313 |
+
@@bold
|
| 314 |
+
Rerun Demo
|
| 315 |
+
@@normal
|
| 316 |
+
button in the code window to reinvoke the demonstration with the
|
| 317 |
+
modified code.
|
| 318 |
+
@@newline
|
| 319 |
+
|
| 320 |
+
@@subtitle Labels, buttons, checkbuttons, and radiobuttons
|
| 321 |
+
@@demo label Labels (text and bitmaps)
|
| 322 |
+
@@demo unicodeout Labels and UNICODE text
|
| 323 |
+
@@demo button Buttons
|
| 324 |
+
@@demo check Check-buttons (select any of a group)
|
| 325 |
+
@@demo radio Radio-buttons (select one of a group)
|
| 326 |
+
@@demo puzzle A 15-puzzle game made out of buttons
|
| 327 |
+
@@demo icon Iconic buttons that use bitmaps
|
| 328 |
+
@@demo image1 Two labels displaying images
|
| 329 |
+
@@demo image2 A simple user interface for viewing images
|
| 330 |
+
@@demo labelframe Labelled frames
|
| 331 |
+
@@demo ttkbut The simple Themed Tk widgets
|
| 332 |
+
|
| 333 |
+
@@subtitle Listboxes and Trees
|
| 334 |
+
@@demo states The 50 states
|
| 335 |
+
@@demo colors Colors: change the color scheme for the application
|
| 336 |
+
@@demo sayings A collection of famous and infamous sayings
|
| 337 |
+
@@demo mclist A multi-column list of countries
|
| 338 |
+
@@demo tree A directory browser tree
|
| 339 |
+
|
| 340 |
+
@@subtitle Entries, Spin-boxes and Combo-boxes
|
| 341 |
+
@@demo entry1 Entries without scrollbars
|
| 342 |
+
@@demo entry2 Entries with scrollbars
|
| 343 |
+
@@demo entry3 Validated entries and password fields
|
| 344 |
+
@@demo spin Spin-boxes
|
| 345 |
+
@@demo combo Combo-boxes
|
| 346 |
+
@@demo form Simple Rolodex-like form
|
| 347 |
+
|
| 348 |
+
@@subtitle Text
|
| 349 |
+
@@demo text Basic editable text
|
| 350 |
+
@@demo style Text display styles
|
| 351 |
+
@@demo bind Hypertext (tag bindings)
|
| 352 |
+
@@demo twind A text widget with embedded windows and other features
|
| 353 |
+
@@demo search A search tool built with a text widget
|
| 354 |
+
@@demo textpeer Peering text widgets
|
| 355 |
+
|
| 356 |
+
@@subtitle Canvases
|
| 357 |
+
@@demo items The canvas item types
|
| 358 |
+
@@demo plot A simple 2-D plot
|
| 359 |
+
@@demo ctext Text items in canvases
|
| 360 |
+
@@demo arrow An editor for arrowheads on canvas lines
|
| 361 |
+
@@demo ruler A ruler with adjustable tab stops
|
| 362 |
+
@@demo floor A building floor plan
|
| 363 |
+
@@demo cscroll A simple scrollable canvas
|
| 364 |
+
@@demo knightstour A Knight's tour of the chess board
|
| 365 |
+
|
| 366 |
+
@@subtitle Scales and Progress Bars
|
| 367 |
+
@@demo hscale Horizontal scale
|
| 368 |
+
@@demo vscale Vertical scale
|
| 369 |
+
@@new
|
| 370 |
+
@@demo ttkscale Themed scale linked to a label with traces
|
| 371 |
+
@@demo ttkprogress Progress bar
|
| 372 |
+
|
| 373 |
+
@@subtitle Paned Windows and Notebooks
|
| 374 |
+
@@demo paned1 Horizontal paned window
|
| 375 |
+
@@demo paned2 Vertical paned window
|
| 376 |
+
@@demo ttkpane Themed nested panes
|
| 377 |
+
@@demo ttknote Notebook widget
|
| 378 |
+
|
| 379 |
+
@@subtitle Menus and Toolbars
|
| 380 |
+
@@demo menu Menus and cascades (sub-menus)
|
| 381 |
+
@@demo menubu Menu-buttons
|
| 382 |
+
@@demo ttkmenu Themed menu buttons
|
| 383 |
+
@@demo toolbar Themed toolbar
|
| 384 |
+
|
| 385 |
+
@@subtitle Common Dialogs
|
| 386 |
+
@@demo msgbox Message boxes
|
| 387 |
+
@@demo filebox File selection dialog
|
| 388 |
+
@@demo clrpick Color picker
|
| 389 |
+
@@demo fontchoose Font selection dialog
|
| 390 |
+
|
| 391 |
+
@@subtitle Animation
|
| 392 |
+
@@demo anilabel Animated labels
|
| 393 |
+
@@demo aniwave Animated wave
|
| 394 |
+
@@demo pendulum Pendulum simulation
|
| 395 |
+
@@demo goldberg A celebration of Rube Goldberg
|
| 396 |
+
|
| 397 |
+
@@subtitle Miscellaneous
|
| 398 |
+
@@demo bitmap The built-in bitmaps
|
| 399 |
+
@@demo dialog1 A dialog box with a local grab
|
| 400 |
+
@@demo dialog2 A dialog box with a global grab
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
##############################################################################
|
| 404 |
+
|
| 405 |
+
.t configure -state disabled
|
| 406 |
+
focus .s
|
| 407 |
+
|
| 408 |
+
# addSeeDismiss --
|
| 409 |
+
# Add "See Code" and "Dismiss" button frame, with optional "See Vars"
|
| 410 |
+
#
|
| 411 |
+
# Arguments:
|
| 412 |
+
# w - The name of the frame to use.
|
| 413 |
+
|
| 414 |
+
proc addSeeDismiss {w show {vars {}} {extra {}}} {
|
| 415 |
+
## See Code / Dismiss buttons
|
| 416 |
+
ttk::frame $w
|
| 417 |
+
ttk::separator $w.sep
|
| 418 |
+
#ttk::frame $w.sep -height 2 -relief sunken
|
| 419 |
+
grid $w.sep -columnspan 4 -row 0 -sticky ew -pady 2
|
| 420 |
+
ttk::button $w.dismiss -text [mc "Dismiss"] \
|
| 421 |
+
-image ::img::delete -compound left \
|
| 422 |
+
-command [list destroy [winfo toplevel $w]]
|
| 423 |
+
ttk::button $w.code -text [mc "See Code"] \
|
| 424 |
+
-image ::img::view -compound left \
|
| 425 |
+
-command [list showCode $show]
|
| 426 |
+
set buttons [list x $w.code $w.dismiss]
|
| 427 |
+
if {[llength $vars]} {
|
| 428 |
+
ttk::button $w.vars -text [mc "See Variables"] \
|
| 429 |
+
-image ::img::view -compound left \
|
| 430 |
+
-command [concat [list showVars $w.dialog] $vars]
|
| 431 |
+
set buttons [linsert $buttons 1 $w.vars]
|
| 432 |
+
}
|
| 433 |
+
if {$extra ne ""} {
|
| 434 |
+
set buttons [linsert $buttons 1 [uplevel 1 $extra]]
|
| 435 |
+
}
|
| 436 |
+
grid {*}$buttons -padx 4 -pady 4
|
| 437 |
+
grid columnconfigure $w 0 -weight 1
|
| 438 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 439 |
+
foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
|
| 440 |
+
grid configure $w.sep -pady 0
|
| 441 |
+
grid configure {*}$buttons -pady {10 12}
|
| 442 |
+
grid configure [lindex $buttons 1] -padx {16 4}
|
| 443 |
+
grid configure [lindex $buttons end] -padx {4 18}
|
| 444 |
+
}
|
| 445 |
+
return $w
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
# positionWindow --
|
| 449 |
+
# This procedure is invoked by most of the demos to position a new demo
|
| 450 |
+
# window.
|
| 451 |
+
#
|
| 452 |
+
# Arguments:
|
| 453 |
+
# w - The name of the window to position.
|
| 454 |
+
|
| 455 |
+
proc positionWindow w {
|
| 456 |
+
wm geometry $w +300+300
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
# showVars --
|
| 460 |
+
# Displays the values of one or more variables in a window, and updates the
|
| 461 |
+
# display whenever any of the variables changes.
|
| 462 |
+
#
|
| 463 |
+
# Arguments:
|
| 464 |
+
# w - Name of new window to create for display.
|
| 465 |
+
# args - Any number of names of variables.
|
| 466 |
+
|
| 467 |
+
proc showVars {w args} {
|
| 468 |
+
catch {destroy $w}
|
| 469 |
+
toplevel $w
|
| 470 |
+
if {[tk windowingsystem] eq "x11"} {wm attributes $w -type dialog}
|
| 471 |
+
wm title $w [mc "Variable values"]
|
| 472 |
+
|
| 473 |
+
set b [ttk::frame $w.frame]
|
| 474 |
+
grid $b -sticky news
|
| 475 |
+
set f [ttk::labelframe $b.title -text [mc "Variable values:"]]
|
| 476 |
+
foreach var $args {
|
| 477 |
+
ttk::label $f.n$var -text "$var:" -anchor w
|
| 478 |
+
ttk::label $f.v$var -textvariable $var -anchor w
|
| 479 |
+
grid $f.n$var $f.v$var -padx 2 -pady 2 -sticky w
|
| 480 |
+
}
|
| 481 |
+
ttk::button $b.ok -text [mc "OK"] \
|
| 482 |
+
-command [list destroy $w] -default active
|
| 483 |
+
bind $w <Return> [list $b.ok invoke]
|
| 484 |
+
bind $w <Escape> [list $b.ok invoke]
|
| 485 |
+
|
| 486 |
+
grid $f -sticky news -padx 4
|
| 487 |
+
grid $b.ok -sticky e -padx 4 -pady {6 4}
|
| 488 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 489 |
+
$b.ok configure -takefocus 0
|
| 490 |
+
grid configure $b.ok -pady {10 12} -padx {16 18}
|
| 491 |
+
grid configure $f -padx 10 -pady {10 0}
|
| 492 |
+
}
|
| 493 |
+
grid columnconfig $f 1 -weight 1
|
| 494 |
+
grid rowconfigure $f 100 -weight 1
|
| 495 |
+
grid columnconfig $b 0 -weight 1
|
| 496 |
+
grid rowconfigure $b 0 -weight 1
|
| 497 |
+
grid columnconfig $w 0 -weight 1
|
| 498 |
+
grid rowconfigure $w 0 -weight 1
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
# invoke --
|
| 502 |
+
# This procedure is called when the user clicks on a demo description. It is
|
| 503 |
+
# responsible for invoking the demonstration.
|
| 504 |
+
#
|
| 505 |
+
# Arguments:
|
| 506 |
+
# index - The index of the character that the user clicked on.
|
| 507 |
+
|
| 508 |
+
proc invoke index {
|
| 509 |
+
global tk_demoDirectory
|
| 510 |
+
set tags [.t tag names $index]
|
| 511 |
+
set i [lsearch -glob $tags demo-*]
|
| 512 |
+
if {$i < 0} {
|
| 513 |
+
return
|
| 514 |
+
}
|
| 515 |
+
set cursor [.t cget -cursor]
|
| 516 |
+
.t configure -cursor [::ttk::cursor busy]
|
| 517 |
+
update
|
| 518 |
+
set demo [string range [lindex $tags $i] 5 end]
|
| 519 |
+
uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]]
|
| 520 |
+
update
|
| 521 |
+
.t configure -cursor $cursor
|
| 522 |
+
|
| 523 |
+
.t tag add visited "$index linestart +1 chars" "$index lineend -1 chars"
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
# showStatus --
|
| 527 |
+
#
|
| 528 |
+
# Show the name of the demo program in the status bar. This procedure is
|
| 529 |
+
# called when the user moves the cursor over a demo description.
|
| 530 |
+
#
|
| 531 |
+
proc showStatus index {
|
| 532 |
+
set tags [.t tag names $index]
|
| 533 |
+
set i [lsearch -glob $tags demo-*]
|
| 534 |
+
set cursor [.t cget -cursor]
|
| 535 |
+
if {$i < 0} {
|
| 536 |
+
.statusBar.lab config -text " "
|
| 537 |
+
set newcursor [::ttk::cursor text]
|
| 538 |
+
} else {
|
| 539 |
+
set demo [string range [lindex $tags $i] 5 end]
|
| 540 |
+
.statusBar.lab config -text [mc "Run the \"%s\" sample program" $demo]
|
| 541 |
+
set newcursor [::ttk::cursor link]
|
| 542 |
+
}
|
| 543 |
+
if {$cursor ne $newcursor} {
|
| 544 |
+
.t config -cursor $newcursor
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
# evalShowCode --
|
| 549 |
+
#
|
| 550 |
+
# Arguments:
|
| 551 |
+
# w - Name of text widget containing code to eval
|
| 552 |
+
|
| 553 |
+
proc evalShowCode {w} {
|
| 554 |
+
set code [$w get 1.0 end-1c]
|
| 555 |
+
uplevel #0 $code
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
# showCode --
|
| 559 |
+
# This procedure creates a toplevel window that displays the code for a
|
| 560 |
+
# demonstration and allows it to be edited and reinvoked.
|
| 561 |
+
#
|
| 562 |
+
# Arguments:
|
| 563 |
+
# w - The name of the demonstration's window, which can be used to
|
| 564 |
+
# derive the name of the file containing its code.
|
| 565 |
+
|
| 566 |
+
proc showCode w {
|
| 567 |
+
global tk_demoDirectory
|
| 568 |
+
set file [string range $w 1 end].tcl
|
| 569 |
+
set top .code
|
| 570 |
+
if {![winfo exists $top]} {
|
| 571 |
+
toplevel $top
|
| 572 |
+
if {[tk windowingsystem] eq "x11"} {wm attributes $top -type dialog}
|
| 573 |
+
|
| 574 |
+
set t [frame $top.f]
|
| 575 |
+
set text [text $t.text -font fixedFont -height 24 -wrap word \
|
| 576 |
+
-xscrollcommand [list $t.xscroll set] \
|
| 577 |
+
-yscrollcommand [list $t.yscroll set] \
|
| 578 |
+
-setgrid 1 -highlightthickness 0 -pady 2 -padx 3]
|
| 579 |
+
ttk::scrollbar $t.xscroll -command [list $t.text xview] \
|
| 580 |
+
-orient horizontal
|
| 581 |
+
ttk::scrollbar $t.yscroll -command [list $t.text yview] \
|
| 582 |
+
-orient vertical
|
| 583 |
+
|
| 584 |
+
grid $t.text $t.yscroll -sticky news
|
| 585 |
+
#grid $t.xscroll
|
| 586 |
+
grid rowconfigure $t 0 -weight 1
|
| 587 |
+
grid columnconfig $t 0 -weight 1
|
| 588 |
+
|
| 589 |
+
set btns [ttk::frame $top.btns]
|
| 590 |
+
ttk::separator $btns.sep
|
| 591 |
+
grid $btns.sep -columnspan 4 -row 0 -sticky ew -pady 2
|
| 592 |
+
ttk::button $btns.dismiss -text [mc "Dismiss"] \
|
| 593 |
+
-default active -command [list destroy $top] \
|
| 594 |
+
-image ::img::delete -compound left
|
| 595 |
+
ttk::button $btns.print -text [mc "Print Code"] \
|
| 596 |
+
-command [list printCode $text $file] \
|
| 597 |
+
-image ::img::print -compound left
|
| 598 |
+
ttk::button $btns.rerun -text [mc "Rerun Demo"] \
|
| 599 |
+
-command [list evalShowCode $text] \
|
| 600 |
+
-image ::img::refresh -compound left
|
| 601 |
+
set buttons [list x $btns.rerun $btns.print $btns.dismiss]
|
| 602 |
+
grid {*}$buttons -padx 4 -pady 4
|
| 603 |
+
grid columnconfigure $btns 0 -weight 1
|
| 604 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 605 |
+
foreach b [lrange $buttons 1 end] {$b configure -takefocus 0}
|
| 606 |
+
grid configure $btns.sep -pady 0
|
| 607 |
+
grid configure {*}$buttons -pady {10 12}
|
| 608 |
+
grid configure [lindex $buttons 1] -padx {16 4}
|
| 609 |
+
grid configure [lindex $buttons end] -padx {4 18}
|
| 610 |
+
}
|
| 611 |
+
grid $t -sticky news
|
| 612 |
+
grid $btns -sticky ew
|
| 613 |
+
grid rowconfigure $top 0 -weight 1
|
| 614 |
+
grid columnconfig $top 0 -weight 1
|
| 615 |
+
|
| 616 |
+
bind $top <Return> {
|
| 617 |
+
if {[winfo class %W] ne "Text"} { .code.btns.dismiss invoke }
|
| 618 |
+
}
|
| 619 |
+
bind $top <Escape> [bind $top <Return>]
|
| 620 |
+
} else {
|
| 621 |
+
wm deiconify $top
|
| 622 |
+
raise $top
|
| 623 |
+
}
|
| 624 |
+
wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
|
| 625 |
+
wm iconname $top $file
|
| 626 |
+
set id [open [file join $tk_demoDirectory $file]]
|
| 627 |
+
fconfigure $id -encoding utf-8 -eofchar "\032 {}"
|
| 628 |
+
$top.f.text delete 1.0 end
|
| 629 |
+
$top.f.text insert 1.0 [read $id]
|
| 630 |
+
$top.f.text mark set insert 1.0
|
| 631 |
+
close $id
|
| 632 |
+
}
|
| 633 |
+
|
| 634 |
+
# printCode --
|
| 635 |
+
# Prints the source code currently displayed in the See Code dialog. Much
|
| 636 |
+
# thanks to Arjen Markus for this.
|
| 637 |
+
#
|
| 638 |
+
# Arguments:
|
| 639 |
+
# w - Name of text widget containing code to print
|
| 640 |
+
# file - Name of the original file (implicitly for title)
|
| 641 |
+
|
| 642 |
+
proc printCode {w file} {
|
| 643 |
+
set code [$w get 1.0 end-1c]
|
| 644 |
+
|
| 645 |
+
set dir "."
|
| 646 |
+
if {[info exists ::env(HOME)]} {
|
| 647 |
+
set dir "$::env(HOME)"
|
| 648 |
+
}
|
| 649 |
+
if {[info exists ::env(TMP)]} {
|
| 650 |
+
set dir $::env(TMP)
|
| 651 |
+
}
|
| 652 |
+
if {[info exists ::env(TEMP)]} {
|
| 653 |
+
set dir $::env(TEMP)
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
set filename [file join $dir "tkdemo-$file"]
|
| 657 |
+
set outfile [open $filename "w"]
|
| 658 |
+
puts $outfile $code
|
| 659 |
+
close $outfile
|
| 660 |
+
|
| 661 |
+
switch -- $::tcl_platform(platform) {
|
| 662 |
+
unix {
|
| 663 |
+
if {[catch {exec lp -c $filename} msg]} {
|
| 664 |
+
tk_messageBox -title "Print spooling failure" \
|
| 665 |
+
-message "Print spooling probably failed: $msg"
|
| 666 |
+
}
|
| 667 |
+
}
|
| 668 |
+
windows {
|
| 669 |
+
if {[catch {PrintTextWin32 $filename} msg]} {
|
| 670 |
+
tk_messageBox -title "Print spooling failure" \
|
| 671 |
+
-message "Print spooling probably failed: $msg"
|
| 672 |
+
}
|
| 673 |
+
}
|
| 674 |
+
default {
|
| 675 |
+
tk_messageBox -title "Operation not Implemented" \
|
| 676 |
+
-message "Wow! Unknown platform: $::tcl_platform(platform)"
|
| 677 |
+
}
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
#
|
| 681 |
+
# Be careful to throw away the temporary file in a gentle manner ...
|
| 682 |
+
#
|
| 683 |
+
if {[file exists $filename]} {
|
| 684 |
+
catch {file delete $filename}
|
| 685 |
+
}
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
# PrintTextWin32 --
|
| 689 |
+
# Print a file under Windows using all the "intelligence" necessary
|
| 690 |
+
#
|
| 691 |
+
# Arguments:
|
| 692 |
+
# filename - Name of the file
|
| 693 |
+
#
|
| 694 |
+
# Note:
|
| 695 |
+
# Taken from the Wiki page by Keith Vetter, "Printing text files under
|
| 696 |
+
# Windows".
|
| 697 |
+
# Note:
|
| 698 |
+
# Do not execute the command in the background: that way we can dispose of the
|
| 699 |
+
# file smoothly.
|
| 700 |
+
#
|
| 701 |
+
proc PrintTextWin32 {filename} {
|
| 702 |
+
package require registry
|
| 703 |
+
set app [auto_execok notepad.exe]
|
| 704 |
+
set pcmd "$app /p %1"
|
| 705 |
+
catch {
|
| 706 |
+
set app [registry get {HKEY_CLASSES_ROOT\.txt} {}]
|
| 707 |
+
set pcmd [registry get \
|
| 708 |
+
{HKEY_CLASSES_ROOT\\$app\\shell\\print\\command} {}]
|
| 709 |
+
}
|
| 710 |
+
|
| 711 |
+
regsub -all {%1} $pcmd $filename pcmd
|
| 712 |
+
puts $pcmd
|
| 713 |
+
|
| 714 |
+
regsub -all {\\} $pcmd {\\\\} pcmd
|
| 715 |
+
set command "[auto_execok start] /min $pcmd"
|
| 716 |
+
eval exec $command
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
# tkAboutDialog --
|
| 720 |
+
#
|
| 721 |
+
# Pops up a message box with an "about" message
|
| 722 |
+
#
|
| 723 |
+
proc tkAboutDialog {} {
|
| 724 |
+
tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
|
| 725 |
+
-message [mc "Tk widget demonstration application"] -detail \
|
| 726 |
+
"[mc "Copyright \xA9 %s" {1996-1997 Sun Microsystems, Inc.}]
|
| 727 |
+
[mc "Copyright \xA9 %s" {1997-2000 Ajuba Solutions, Inc.}]
|
| 728 |
+
[mc "Copyright \xA9 %s" {2001-2009 Donal K. Fellows}]
|
| 729 |
+
[mc "Copyright \xA9 %s" {2002-2007 Daniel A. Steffen}]"
|
| 730 |
+
}
|
| 731 |
+
|
| 732 |
+
# Local Variables:
|
| 733 |
+
# mode: tcl
|
| 734 |
+
# End:
|
evalkit_llava/lib/tk8.6/dialog.tcl
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# dialog.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file defines the procedure tk_dialog, which creates a dialog
|
| 4 |
+
# box containing a bitmap, a message, and one or more buttons.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1992-1993 The Regents of the University of California.
|
| 7 |
+
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
| 8 |
+
#
|
| 9 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 10 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 11 |
+
#
|
| 12 |
+
|
| 13 |
+
#
|
| 14 |
+
# ::tk_dialog:
|
| 15 |
+
#
|
| 16 |
+
# This procedure displays a dialog box, waits for a button in the dialog
|
| 17 |
+
# to be invoked, then returns the index of the selected button. If the
|
| 18 |
+
# dialog somehow gets destroyed, -1 is returned.
|
| 19 |
+
#
|
| 20 |
+
# Arguments:
|
| 21 |
+
# w - Window to use for dialog top-level.
|
| 22 |
+
# title - Title to display in dialog's decorative frame.
|
| 23 |
+
# text - Message to display in dialog.
|
| 24 |
+
# bitmap - Bitmap to display in dialog (empty string means none).
|
| 25 |
+
# default - Index of button that is to display the default ring
|
| 26 |
+
# (-1 means none).
|
| 27 |
+
# args - One or more strings to display in buttons across the
|
| 28 |
+
# bottom of the dialog box.
|
| 29 |
+
|
| 30 |
+
proc ::tk_dialog {w title text bitmap default args} {
|
| 31 |
+
variable ::tk::Priv
|
| 32 |
+
|
| 33 |
+
# Check that $default was properly given
|
| 34 |
+
if {[string is integer -strict $default]} {
|
| 35 |
+
if {$default >= [llength $args]} {
|
| 36 |
+
return -code error -errorcode {TK DIALOG BAD_DEFAULT} \
|
| 37 |
+
"default button index greater than number of buttons\
|
| 38 |
+
specified for tk_dialog"
|
| 39 |
+
}
|
| 40 |
+
} elseif {"" eq $default} {
|
| 41 |
+
set default -1
|
| 42 |
+
} else {
|
| 43 |
+
set default [lsearch -exact $args $default]
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
set windowingsystem [tk windowingsystem]
|
| 47 |
+
|
| 48 |
+
# 1. Create the top-level window and divide it into top
|
| 49 |
+
# and bottom parts.
|
| 50 |
+
|
| 51 |
+
destroy $w
|
| 52 |
+
toplevel $w -class Dialog
|
| 53 |
+
wm title $w $title
|
| 54 |
+
wm iconname $w Dialog
|
| 55 |
+
wm protocol $w WM_DELETE_WINDOW { }
|
| 56 |
+
|
| 57 |
+
# Dialog boxes should be transient with respect to their parent,
|
| 58 |
+
# so that they will always stay on top of their parent window. However,
|
| 59 |
+
# some window managers will create the window as withdrawn if the parent
|
| 60 |
+
# window is withdrawn or iconified. Combined with the grab we put on the
|
| 61 |
+
# window, this can hang the entire application. Therefore we only make
|
| 62 |
+
# the dialog transient if the parent is viewable.
|
| 63 |
+
#
|
| 64 |
+
if {[winfo viewable [winfo toplevel [winfo parent $w]]] } {
|
| 65 |
+
wm transient $w [winfo toplevel [winfo parent $w]]
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
if {$windowingsystem eq "aqua"} {
|
| 69 |
+
::tk::unsupported::MacWindowStyle style $w moveableModal {}
|
| 70 |
+
} elseif {$windowingsystem eq "x11"} {
|
| 71 |
+
wm attributes $w -type dialog
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
frame $w.bot
|
| 75 |
+
frame $w.top
|
| 76 |
+
if {$windowingsystem eq "x11"} {
|
| 77 |
+
$w.bot configure -relief raised -bd 1
|
| 78 |
+
$w.top configure -relief raised -bd 1
|
| 79 |
+
}
|
| 80 |
+
pack $w.bot -side bottom -fill both
|
| 81 |
+
pack $w.top -side top -fill both -expand 1
|
| 82 |
+
grid anchor $w.bot center
|
| 83 |
+
|
| 84 |
+
# 2. Fill the top part with bitmap and message (use the option
|
| 85 |
+
# database for -wraplength and -font so that they can be
|
| 86 |
+
# overridden by the caller).
|
| 87 |
+
|
| 88 |
+
option add *Dialog.msg.wrapLength 3i widgetDefault
|
| 89 |
+
option add *Dialog.msg.font TkCaptionFont widgetDefault
|
| 90 |
+
|
| 91 |
+
label $w.msg -justify left -text $text
|
| 92 |
+
pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
|
| 93 |
+
if {$bitmap ne ""} {
|
| 94 |
+
if {$windowingsystem eq "aqua" && $bitmap eq "error"} {
|
| 95 |
+
set bitmap "stop"
|
| 96 |
+
}
|
| 97 |
+
label $w.bitmap -bitmap $bitmap
|
| 98 |
+
pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
# 3. Create a row of buttons at the bottom of the dialog.
|
| 102 |
+
|
| 103 |
+
set i 0
|
| 104 |
+
foreach but $args {
|
| 105 |
+
button $w.button$i -text $but -command [list set ::tk::Priv(button) $i]
|
| 106 |
+
if {$i == $default} {
|
| 107 |
+
$w.button$i configure -default active
|
| 108 |
+
} else {
|
| 109 |
+
$w.button$i configure -default normal
|
| 110 |
+
}
|
| 111 |
+
grid $w.button$i -in $w.bot -column $i -row 0 -sticky ew \
|
| 112 |
+
-padx 10 -pady 4
|
| 113 |
+
grid columnconfigure $w.bot $i
|
| 114 |
+
# We boost the size of some Mac buttons for l&f
|
| 115 |
+
if {$windowingsystem eq "aqua"} {
|
| 116 |
+
set tmp [string tolower $but]
|
| 117 |
+
if {$tmp eq "ok" || $tmp eq "cancel"} {
|
| 118 |
+
grid columnconfigure $w.bot $i -minsize 90
|
| 119 |
+
}
|
| 120 |
+
grid configure $w.button$i -pady 7
|
| 121 |
+
}
|
| 122 |
+
incr i
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
# 4. Create a binding for <Return> on the dialog if there is a
|
| 126 |
+
# default button.
|
| 127 |
+
# Convention also dictates that if the keyboard focus moves among the
|
| 128 |
+
# the buttons that the <Return> binding affects the button with the focus.
|
| 129 |
+
|
| 130 |
+
if {$default >= 0} {
|
| 131 |
+
bind $w <Return> [list $w.button$default invoke]
|
| 132 |
+
}
|
| 133 |
+
bind $w <<PrevWindow>> [list bind $w <Return> {[tk_focusPrev %W] invoke}]
|
| 134 |
+
bind $w <<NextWindow>> [list bind $w <Return> {[tk_focusNext %W] invoke}]
|
| 135 |
+
|
| 136 |
+
# 5. Create a <Destroy> binding for the window that sets the
|
| 137 |
+
# button variable to -1; this is needed in case something happens
|
| 138 |
+
# that destroys the window, such as its parent window being destroyed.
|
| 139 |
+
|
| 140 |
+
bind $w <Destroy> {set ::tk::Priv(button) -1}
|
| 141 |
+
|
| 142 |
+
# 6. Withdraw the window, then update all the geometry information
|
| 143 |
+
# so we know how big it wants to be, then center the window in the
|
| 144 |
+
# display (Motif style) and de-iconify it.
|
| 145 |
+
|
| 146 |
+
::tk::PlaceWindow $w
|
| 147 |
+
tkwait visibility $w
|
| 148 |
+
|
| 149 |
+
# 7. Set a grab and claim the focus too.
|
| 150 |
+
|
| 151 |
+
if {$default >= 0} {
|
| 152 |
+
set focus $w.button$default
|
| 153 |
+
} else {
|
| 154 |
+
set focus $w
|
| 155 |
+
}
|
| 156 |
+
tk::SetFocusGrab $w $focus
|
| 157 |
+
|
| 158 |
+
# 8. Wait for the user to respond, then restore the focus and
|
| 159 |
+
# return the index of the selected button. Restore the focus
|
| 160 |
+
# before deleting the window, since otherwise the window manager
|
| 161 |
+
# may take the focus away so we can't redirect it. Finally,
|
| 162 |
+
# restore any grab that was in effect.
|
| 163 |
+
|
| 164 |
+
vwait ::tk::Priv(button)
|
| 165 |
+
|
| 166 |
+
catch {
|
| 167 |
+
# It's possible that the window has already been destroyed,
|
| 168 |
+
# hence this "catch". Delete the Destroy handler so that
|
| 169 |
+
# Priv(button) doesn't get reset by it.
|
| 170 |
+
|
| 171 |
+
bind $w <Destroy> {}
|
| 172 |
+
}
|
| 173 |
+
tk::RestoreFocusGrab $w $focus
|
| 174 |
+
return $Priv(button)
|
| 175 |
+
}
|
evalkit_llava/lib/tk8.6/entry.tcl
ADDED
|
@@ -0,0 +1,699 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# entry.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file defines the default bindings for Tk entry widgets and provides
|
| 4 |
+
# procedures that help in implementing those bindings.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1992-1994 The Regents of the University of California.
|
| 7 |
+
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
| 8 |
+
#
|
| 9 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 10 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 11 |
+
#
|
| 12 |
+
|
| 13 |
+
#-------------------------------------------------------------------------
|
| 14 |
+
# Elements of tk::Priv that are used in this file:
|
| 15 |
+
#
|
| 16 |
+
# afterId - If non-null, it means that auto-scanning is underway
|
| 17 |
+
# and it gives the "after" id for the next auto-scan
|
| 18 |
+
# command to be executed.
|
| 19 |
+
# mouseMoved - Non-zero means the mouse has moved a significant
|
| 20 |
+
# amount since the button went down (so, for example,
|
| 21 |
+
# start dragging out a selection).
|
| 22 |
+
# pressX - X-coordinate at which the mouse button was pressed.
|
| 23 |
+
# selectMode - The style of selection currently underway:
|
| 24 |
+
# char, word, or line.
|
| 25 |
+
# x, y - Last known mouse coordinates for scanning
|
| 26 |
+
# and auto-scanning.
|
| 27 |
+
# data - Used for Cut and Copy
|
| 28 |
+
#-------------------------------------------------------------------------
|
| 29 |
+
|
| 30 |
+
#-------------------------------------------------------------------------
|
| 31 |
+
# The code below creates the default class bindings for entries.
|
| 32 |
+
#-------------------------------------------------------------------------
|
| 33 |
+
bind Entry <<Cut>> {
|
| 34 |
+
if {![catch {tk::EntryGetSelection %W} tk::Priv(data)]} {
|
| 35 |
+
clipboard clear -displayof %W
|
| 36 |
+
clipboard append -displayof %W $tk::Priv(data)
|
| 37 |
+
%W delete sel.first sel.last
|
| 38 |
+
unset tk::Priv(data)
|
| 39 |
+
}
|
| 40 |
+
}
|
| 41 |
+
bind Entry <<Copy>> {
|
| 42 |
+
if {![catch {tk::EntryGetSelection %W} tk::Priv(data)]} {
|
| 43 |
+
clipboard clear -displayof %W
|
| 44 |
+
clipboard append -displayof %W $tk::Priv(data)
|
| 45 |
+
unset tk::Priv(data)
|
| 46 |
+
}
|
| 47 |
+
}
|
| 48 |
+
bind Entry <<Paste>> {
|
| 49 |
+
catch {
|
| 50 |
+
if {[tk windowingsystem] ne "x11"} {
|
| 51 |
+
catch {
|
| 52 |
+
%W delete sel.first sel.last
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
%W insert insert [::tk::GetSelection %W CLIPBOARD]
|
| 56 |
+
tk::EntrySeeInsert %W
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
bind Entry <<Clear>> {
|
| 60 |
+
# ignore if there is no selection
|
| 61 |
+
catch {%W delete sel.first sel.last}
|
| 62 |
+
}
|
| 63 |
+
bind Entry <<PasteSelection>> {
|
| 64 |
+
if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)]
|
| 65 |
+
|| !$tk::Priv(mouseMoved)} {
|
| 66 |
+
tk::EntryPaste %W %x
|
| 67 |
+
}
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
bind Entry <<TraverseIn>> {
|
| 71 |
+
%W selection range 0 end
|
| 72 |
+
%W icursor end
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
# Standard Motif bindings:
|
| 76 |
+
|
| 77 |
+
bind Entry <Button-1> {
|
| 78 |
+
tk::EntryButton1 %W %x
|
| 79 |
+
%W selection clear
|
| 80 |
+
}
|
| 81 |
+
bind Entry <B1-Motion> {
|
| 82 |
+
set tk::Priv(x) %x
|
| 83 |
+
tk::EntryMouseSelect %W %x
|
| 84 |
+
}
|
| 85 |
+
bind Entry <Double-Button-1> {
|
| 86 |
+
set tk::Priv(selectMode) word
|
| 87 |
+
tk::EntryMouseSelect %W %x
|
| 88 |
+
catch {%W icursor sel.last}
|
| 89 |
+
}
|
| 90 |
+
bind Entry <Triple-Button-1> {
|
| 91 |
+
set tk::Priv(selectMode) line
|
| 92 |
+
tk::EntryMouseSelect %W %x
|
| 93 |
+
catch {%W icursor sel.last}
|
| 94 |
+
}
|
| 95 |
+
bind Entry <Shift-Button-1> {
|
| 96 |
+
set tk::Priv(selectMode) char
|
| 97 |
+
%W selection adjust @%x
|
| 98 |
+
}
|
| 99 |
+
bind Entry <Double-Shift-Button-1> {
|
| 100 |
+
set tk::Priv(selectMode) word
|
| 101 |
+
tk::EntryMouseSelect %W %x
|
| 102 |
+
}
|
| 103 |
+
bind Entry <Triple-Shift-Button-1> {
|
| 104 |
+
set tk::Priv(selectMode) line
|
| 105 |
+
tk::EntryMouseSelect %W %x
|
| 106 |
+
}
|
| 107 |
+
bind Entry <B1-Leave> {
|
| 108 |
+
set tk::Priv(x) %x
|
| 109 |
+
tk::EntryAutoScan %W
|
| 110 |
+
}
|
| 111 |
+
bind Entry <B1-Enter> {
|
| 112 |
+
tk::CancelRepeat
|
| 113 |
+
}
|
| 114 |
+
bind Entry <ButtonRelease-1> {
|
| 115 |
+
tk::CancelRepeat
|
| 116 |
+
}
|
| 117 |
+
bind Entry <Control-Button-1> {
|
| 118 |
+
%W icursor @%x
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
bind Entry <<PrevChar>> {
|
| 122 |
+
tk::EntrySetCursor %W [expr {[%W index insert]-1}]
|
| 123 |
+
}
|
| 124 |
+
bind Entry <<NextChar>> {
|
| 125 |
+
tk::EntrySetCursor %W [expr {[%W index insert]+1}]
|
| 126 |
+
}
|
| 127 |
+
bind Entry <<SelectPrevChar>> {
|
| 128 |
+
tk::EntryKeySelect %W [expr {[%W index insert]-1}]
|
| 129 |
+
tk::EntrySeeInsert %W
|
| 130 |
+
}
|
| 131 |
+
bind Entry <<SelectNextChar>> {
|
| 132 |
+
tk::EntryKeySelect %W [expr {[%W index insert]+1}]
|
| 133 |
+
tk::EntrySeeInsert %W
|
| 134 |
+
}
|
| 135 |
+
bind Entry <<PrevWord>> {
|
| 136 |
+
tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
|
| 137 |
+
}
|
| 138 |
+
bind Entry <<NextWord>> {
|
| 139 |
+
tk::EntrySetCursor %W [tk::EntryNextWord %W insert]
|
| 140 |
+
}
|
| 141 |
+
bind Entry <<SelectPrevWord>> {
|
| 142 |
+
tk::EntryKeySelect %W [tk::EntryPreviousWord %W insert]
|
| 143 |
+
tk::EntrySeeInsert %W
|
| 144 |
+
}
|
| 145 |
+
bind Entry <<SelectNextWord>> {
|
| 146 |
+
tk::EntryKeySelect %W [tk::EntryNextWord %W insert]
|
| 147 |
+
tk::EntrySeeInsert %W
|
| 148 |
+
}
|
| 149 |
+
bind Entry <<LineStart>> {
|
| 150 |
+
tk::EntrySetCursor %W 0
|
| 151 |
+
}
|
| 152 |
+
bind Entry <<SelectLineStart>> {
|
| 153 |
+
tk::EntryKeySelect %W 0
|
| 154 |
+
tk::EntrySeeInsert %W
|
| 155 |
+
}
|
| 156 |
+
bind Entry <<LineEnd>> {
|
| 157 |
+
tk::EntrySetCursor %W end
|
| 158 |
+
}
|
| 159 |
+
bind Entry <<SelectLineEnd>> {
|
| 160 |
+
tk::EntryKeySelect %W end
|
| 161 |
+
tk::EntrySeeInsert %W
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
bind Entry <Delete> {
|
| 165 |
+
if {[%W selection present]} {
|
| 166 |
+
%W delete sel.first sel.last
|
| 167 |
+
} else {
|
| 168 |
+
%W delete insert
|
| 169 |
+
}
|
| 170 |
+
}
|
| 171 |
+
bind Entry <BackSpace> {
|
| 172 |
+
tk::EntryBackspace %W
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
bind Entry <Control-space> {
|
| 176 |
+
%W selection from insert
|
| 177 |
+
}
|
| 178 |
+
bind Entry <Select> {
|
| 179 |
+
%W selection from insert
|
| 180 |
+
}
|
| 181 |
+
bind Entry <Control-Shift-space> {
|
| 182 |
+
%W selection adjust insert
|
| 183 |
+
}
|
| 184 |
+
bind Entry <Shift-Select> {
|
| 185 |
+
%W selection adjust insert
|
| 186 |
+
}
|
| 187 |
+
bind Entry <<SelectAll>> {
|
| 188 |
+
%W selection range 0 end
|
| 189 |
+
}
|
| 190 |
+
bind Entry <<SelectNone>> {
|
| 191 |
+
%W selection clear
|
| 192 |
+
}
|
| 193 |
+
bind Entry <Key> {
|
| 194 |
+
tk::CancelRepeat
|
| 195 |
+
tk::EntryInsert %W %A
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
| 199 |
+
# Otherwise, if a widget binding for one of these is defined, the
|
| 200 |
+
# <Key> class binding will also fire and insert the character,
|
| 201 |
+
# which is wrong. Ditto for Escape, Return, and Tab.
|
| 202 |
+
|
| 203 |
+
bind Entry <Alt-Key> {# nothing}
|
| 204 |
+
bind Entry <Meta-Key> {# nothing}
|
| 205 |
+
bind Entry <Control-Key> {# nothing}
|
| 206 |
+
bind Entry <Escape> {# nothing}
|
| 207 |
+
bind Entry <Return> {# nothing}
|
| 208 |
+
bind Entry <KP_Enter> {# nothing}
|
| 209 |
+
bind Entry <Tab> {# nothing}
|
| 210 |
+
bind Entry <Prior> {# nothing}
|
| 211 |
+
bind Entry <Next> {# nothing}
|
| 212 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 213 |
+
bind Entry <Command-Key> {# nothing}
|
| 214 |
+
bind Entry <Mod4-Key> {# nothing}
|
| 215 |
+
}
|
| 216 |
+
# Tk-on-Cocoa generates characters for these two keys. [Bug 2971663]
|
| 217 |
+
bind Entry <<NextLine>> {# nothing}
|
| 218 |
+
bind Entry <<PrevLine>> {# nothing}
|
| 219 |
+
|
| 220 |
+
# On Windows, paste is done using Shift-Insert. Shift-Insert already
|
| 221 |
+
# generates the <<Paste>> event, so we don't need to do anything here.
|
| 222 |
+
if {[tk windowingsystem] ne "win32"} {
|
| 223 |
+
bind Entry <Insert> {
|
| 224 |
+
catch {tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]}
|
| 225 |
+
}
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
# Additional emacs-like bindings:
|
| 229 |
+
|
| 230 |
+
bind Entry <Control-d> {
|
| 231 |
+
if {!$tk_strictMotif} {
|
| 232 |
+
%W delete insert
|
| 233 |
+
}
|
| 234 |
+
}
|
| 235 |
+
bind Entry <Control-h> {
|
| 236 |
+
if {!$tk_strictMotif} {
|
| 237 |
+
tk::EntryBackspace %W
|
| 238 |
+
}
|
| 239 |
+
}
|
| 240 |
+
bind Entry <Control-k> {
|
| 241 |
+
if {!$tk_strictMotif} {
|
| 242 |
+
%W delete insert end
|
| 243 |
+
}
|
| 244 |
+
}
|
| 245 |
+
bind Entry <Control-t> {
|
| 246 |
+
if {!$tk_strictMotif} {
|
| 247 |
+
tk::EntryTranspose %W
|
| 248 |
+
}
|
| 249 |
+
}
|
| 250 |
+
bind Entry <Meta-b> {
|
| 251 |
+
if {!$tk_strictMotif} {
|
| 252 |
+
tk::EntrySetCursor %W [tk::EntryPreviousWord %W insert]
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
bind Entry <Meta-d> {
|
| 256 |
+
if {!$tk_strictMotif} {
|
| 257 |
+
%W delete insert [tk::EntryNextWord %W insert]
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
bind Entry <Meta-f> {
|
| 261 |
+
if {!$tk_strictMotif} {
|
| 262 |
+
tk::EntrySetCursor %W [tk::EntryNextWord %W insert]
|
| 263 |
+
}
|
| 264 |
+
}
|
| 265 |
+
bind Entry <Meta-BackSpace> {
|
| 266 |
+
if {!$tk_strictMotif} {
|
| 267 |
+
%W delete [tk::EntryPreviousWord %W insert] insert
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
bind Entry <Meta-Delete> {
|
| 271 |
+
if {!$tk_strictMotif} {
|
| 272 |
+
%W delete [tk::EntryPreviousWord %W insert] insert
|
| 273 |
+
}
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
# Bindings for IME text input and accents.
|
| 277 |
+
|
| 278 |
+
bind Entry <<TkStartIMEMarkedText>> {
|
| 279 |
+
dict set ::tk::Priv(IMETextMark) "%W" [%W index insert]
|
| 280 |
+
}
|
| 281 |
+
bind Entry <<TkEndIMEMarkedText>> {
|
| 282 |
+
if {[catch {dict get $::tk::Priv(IMETextMark) "%W"} mark]} {
|
| 283 |
+
bell
|
| 284 |
+
} else {
|
| 285 |
+
%W selection range $mark insert
|
| 286 |
+
}
|
| 287 |
+
}
|
| 288 |
+
bind Entry <<TkClearIMEMarkedText>> {
|
| 289 |
+
%W delete [dict get $::tk::Priv(IMETextMark) "%W"] [%W index insert]
|
| 290 |
+
}
|
| 291 |
+
bind Entry <<TkAccentBackspace>> {
|
| 292 |
+
tk::EntryBackspace %W
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
# A few additional bindings of my own.
|
| 296 |
+
|
| 297 |
+
if {[tk windowingsystem] ne "aqua"} {
|
| 298 |
+
bind Entry <Button-2> {
|
| 299 |
+
if {!$tk_strictMotif} {
|
| 300 |
+
::tk::EntryScanMark %W %x
|
| 301 |
+
}
|
| 302 |
+
}
|
| 303 |
+
bind Entry <B2-Motion> {
|
| 304 |
+
if {!$tk_strictMotif} {
|
| 305 |
+
::tk::EntryScanDrag %W %x
|
| 306 |
+
}
|
| 307 |
+
}
|
| 308 |
+
} else {
|
| 309 |
+
bind Entry <Button-3> {
|
| 310 |
+
if {!$tk_strictMotif} {
|
| 311 |
+
::tk::EntryScanMark %W %x
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
bind Entry <B3-Motion> {
|
| 315 |
+
if {!$tk_strictMotif} {
|
| 316 |
+
::tk::EntryScanDrag %W %x
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
# ::tk::EntryClosestGap --
|
| 322 |
+
# Given x and y coordinates, this procedure finds the closest boundary
|
| 323 |
+
# between characters to the given coordinates and returns the index
|
| 324 |
+
# of the character just after the boundary.
|
| 325 |
+
#
|
| 326 |
+
# Arguments:
|
| 327 |
+
# w - The entry window.
|
| 328 |
+
# x - X-coordinate within the window.
|
| 329 |
+
|
| 330 |
+
proc ::tk::EntryClosestGap {w x} {
|
| 331 |
+
set pos [$w index @$x]
|
| 332 |
+
set bbox [$w bbox $pos]
|
| 333 |
+
if {($x - [lindex $bbox 0]) < ([lindex $bbox 2]/2)} {
|
| 334 |
+
return $pos
|
| 335 |
+
}
|
| 336 |
+
incr pos
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
# ::tk::EntryButton1 --
|
| 340 |
+
# This procedure is invoked to handle button-1 presses in entry
|
| 341 |
+
# widgets. It moves the insertion cursor, sets the selection anchor,
|
| 342 |
+
# and claims the input focus.
|
| 343 |
+
#
|
| 344 |
+
# Arguments:
|
| 345 |
+
# w - The entry window in which the button was pressed.
|
| 346 |
+
# x - The x-coordinate of the button press.
|
| 347 |
+
|
| 348 |
+
proc ::tk::EntryButton1 {w x} {
|
| 349 |
+
variable ::tk::Priv
|
| 350 |
+
|
| 351 |
+
set Priv(selectMode) char
|
| 352 |
+
set Priv(mouseMoved) 0
|
| 353 |
+
set Priv(pressX) $x
|
| 354 |
+
$w icursor [EntryClosestGap $w $x]
|
| 355 |
+
$w selection from insert
|
| 356 |
+
if {"disabled" ne [$w cget -state]} {
|
| 357 |
+
focus $w
|
| 358 |
+
}
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
# ::tk::EntryMouseSelect --
|
| 362 |
+
# This procedure is invoked when dragging out a selection with
|
| 363 |
+
# the mouse. Depending on the selection mode (character, word,
|
| 364 |
+
# line) it selects in different-sized units. This procedure
|
| 365 |
+
# ignores mouse motions initially until the mouse has moved from
|
| 366 |
+
# one character to another or until there have been multiple clicks.
|
| 367 |
+
#
|
| 368 |
+
# Arguments:
|
| 369 |
+
# w - The entry window in which the button was pressed.
|
| 370 |
+
# x - The x-coordinate of the mouse.
|
| 371 |
+
|
| 372 |
+
proc ::tk::EntryMouseSelect {w x} {
|
| 373 |
+
variable ::tk::Priv
|
| 374 |
+
|
| 375 |
+
set cur [EntryClosestGap $w $x]
|
| 376 |
+
set anchor [$w index anchor]
|
| 377 |
+
if {($cur != $anchor) || (abs($Priv(pressX) - $x) >= 3)} {
|
| 378 |
+
set Priv(mouseMoved) 1
|
| 379 |
+
}
|
| 380 |
+
switch $Priv(selectMode) {
|
| 381 |
+
char {
|
| 382 |
+
if {$Priv(mouseMoved)} {
|
| 383 |
+
if {$cur < $anchor} {
|
| 384 |
+
$w selection range $cur $anchor
|
| 385 |
+
} elseif {$cur > $anchor} {
|
| 386 |
+
$w selection range $anchor $cur
|
| 387 |
+
} else {
|
| 388 |
+
$w selection clear
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
}
|
| 392 |
+
word {
|
| 393 |
+
if {$cur < $anchor} {
|
| 394 |
+
set before [tcl_wordBreakBefore [$w get] $cur]
|
| 395 |
+
set after [tcl_wordBreakAfter [$w get] $anchor-1]
|
| 396 |
+
} elseif {$cur > $anchor} {
|
| 397 |
+
set before [tcl_wordBreakBefore [$w get] $anchor]
|
| 398 |
+
set after [tcl_wordBreakAfter [$w get] $cur-1]
|
| 399 |
+
} else {
|
| 400 |
+
if {[$w index @$Priv(pressX)] < $anchor} {
|
| 401 |
+
incr anchor -1
|
| 402 |
+
}
|
| 403 |
+
set before [tcl_wordBreakBefore [$w get] $anchor]
|
| 404 |
+
set after [tcl_wordBreakAfter [$w get] $anchor]
|
| 405 |
+
}
|
| 406 |
+
if {$before < 0} {
|
| 407 |
+
set before 0
|
| 408 |
+
}
|
| 409 |
+
if {$after < 0} {
|
| 410 |
+
set after end
|
| 411 |
+
}
|
| 412 |
+
$w selection range $before $after
|
| 413 |
+
}
|
| 414 |
+
line {
|
| 415 |
+
$w selection range 0 end
|
| 416 |
+
}
|
| 417 |
+
}
|
| 418 |
+
if {$Priv(mouseMoved)} {
|
| 419 |
+
$w icursor $cur
|
| 420 |
+
}
|
| 421 |
+
update idletasks
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
# ::tk::EntryPaste --
|
| 425 |
+
# This procedure sets the insertion cursor to the current mouse position,
|
| 426 |
+
# pastes the selection there, and sets the focus to the window.
|
| 427 |
+
#
|
| 428 |
+
# Arguments:
|
| 429 |
+
# w - The entry window.
|
| 430 |
+
# x - X position of the mouse.
|
| 431 |
+
|
| 432 |
+
proc ::tk::EntryPaste {w x} {
|
| 433 |
+
$w icursor [EntryClosestGap $w $x]
|
| 434 |
+
catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
|
| 435 |
+
if {"disabled" ne [$w cget -state]} {
|
| 436 |
+
focus $w
|
| 437 |
+
}
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
# ::tk::EntryAutoScan --
|
| 441 |
+
# This procedure is invoked when the mouse leaves an entry window
|
| 442 |
+
# with button 1 down. It scrolls the window left or right,
|
| 443 |
+
# depending on where the mouse is, and reschedules itself as an
|
| 444 |
+
# "after" command so that the window continues to scroll until the
|
| 445 |
+
# mouse moves back into the window or the mouse button is released.
|
| 446 |
+
#
|
| 447 |
+
# Arguments:
|
| 448 |
+
# w - The entry window.
|
| 449 |
+
|
| 450 |
+
proc ::tk::EntryAutoScan {w} {
|
| 451 |
+
variable ::tk::Priv
|
| 452 |
+
set x $Priv(x)
|
| 453 |
+
if {![winfo exists $w]} {
|
| 454 |
+
return
|
| 455 |
+
}
|
| 456 |
+
if {$x >= [winfo width $w]} {
|
| 457 |
+
$w xview scroll 2 units
|
| 458 |
+
EntryMouseSelect $w $x
|
| 459 |
+
} elseif {$x < 0} {
|
| 460 |
+
$w xview scroll -2 units
|
| 461 |
+
EntryMouseSelect $w $x
|
| 462 |
+
}
|
| 463 |
+
set Priv(afterId) [after 50 [list tk::EntryAutoScan $w]]
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
# ::tk::EntryKeySelect --
|
| 467 |
+
# This procedure is invoked when stroking out selections using the
|
| 468 |
+
# keyboard. It moves the cursor to a new position, then extends
|
| 469 |
+
# the selection to that position.
|
| 470 |
+
#
|
| 471 |
+
# Arguments:
|
| 472 |
+
# w - The entry window.
|
| 473 |
+
# new - A new position for the insertion cursor (the cursor hasn't
|
| 474 |
+
# actually been moved to this position yet).
|
| 475 |
+
|
| 476 |
+
proc ::tk::EntryKeySelect {w new} {
|
| 477 |
+
if {![$w selection present]} {
|
| 478 |
+
$w selection from insert
|
| 479 |
+
$w selection to $new
|
| 480 |
+
} else {
|
| 481 |
+
$w selection adjust $new
|
| 482 |
+
}
|
| 483 |
+
$w icursor $new
|
| 484 |
+
}
|
| 485 |
+
|
| 486 |
+
# ::tk::EntryInsert --
|
| 487 |
+
# Insert a string into an entry at the point of the insertion cursor.
|
| 488 |
+
# If there is a selection in the entry, and it covers the point of the
|
| 489 |
+
# insertion cursor, then delete the selection before inserting.
|
| 490 |
+
#
|
| 491 |
+
# Arguments:
|
| 492 |
+
# w - The entry window in which to insert the string
|
| 493 |
+
# s - The string to insert (usually just a single character)
|
| 494 |
+
|
| 495 |
+
proc ::tk::EntryInsert {w s} {
|
| 496 |
+
if {$s eq ""} {
|
| 497 |
+
return
|
| 498 |
+
}
|
| 499 |
+
catch {
|
| 500 |
+
set insert [$w index insert]
|
| 501 |
+
if {([$w index sel.first] <= $insert)
|
| 502 |
+
&& ([$w index sel.last] >= $insert)} {
|
| 503 |
+
$w delete sel.first sel.last
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
+
$w insert insert $s
|
| 507 |
+
EntrySeeInsert $w
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
# ::tk::EntryBackspace --
|
| 511 |
+
# Backspace over the character just before the insertion cursor.
|
| 512 |
+
# If backspacing would move the cursor off the left edge of the
|
| 513 |
+
# window, reposition the cursor at about the middle of the window.
|
| 514 |
+
#
|
| 515 |
+
# Arguments:
|
| 516 |
+
# w - The entry window in which to backspace.
|
| 517 |
+
|
| 518 |
+
proc ::tk::EntryBackspace w {
|
| 519 |
+
if {[$w selection present]} {
|
| 520 |
+
$w delete sel.first sel.last
|
| 521 |
+
} else {
|
| 522 |
+
set x [$w index insert]
|
| 523 |
+
if {$x > 0} {
|
| 524 |
+
$w delete [expr {$x-1}]
|
| 525 |
+
}
|
| 526 |
+
if {[$w index @0] >= [$w index insert]} {
|
| 527 |
+
set range [$w xview]
|
| 528 |
+
set left [lindex $range 0]
|
| 529 |
+
set right [lindex $range 1]
|
| 530 |
+
$w xview moveto [expr {$left - ($right - $left)/2.0}]
|
| 531 |
+
}
|
| 532 |
+
}
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
# ::tk::EntrySeeInsert --
|
| 536 |
+
# Make sure that the insertion cursor is visible in the entry window.
|
| 537 |
+
# If not, adjust the view so that it is.
|
| 538 |
+
#
|
| 539 |
+
# Arguments:
|
| 540 |
+
# w - The entry window.
|
| 541 |
+
|
| 542 |
+
proc ::tk::EntrySeeInsert w {
|
| 543 |
+
set c [$w index insert]
|
| 544 |
+
if {($c < [$w index @0]) || ($c > [$w index @[winfo width $w]])} {
|
| 545 |
+
$w xview $c
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
# ::tk::EntrySetCursor -
|
| 550 |
+
# Move the insertion cursor to a given position in an entry. Also
|
| 551 |
+
# clears the selection, if there is one in the entry, and makes sure
|
| 552 |
+
# that the insertion cursor is visible.
|
| 553 |
+
#
|
| 554 |
+
# Arguments:
|
| 555 |
+
# w - The entry window.
|
| 556 |
+
# pos - The desired new position for the cursor in the window.
|
| 557 |
+
|
| 558 |
+
proc ::tk::EntrySetCursor {w pos} {
|
| 559 |
+
$w icursor $pos
|
| 560 |
+
$w selection clear
|
| 561 |
+
EntrySeeInsert $w
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
# ::tk::EntryTranspose -
|
| 565 |
+
# This procedure implements the "transpose" function for entry widgets.
|
| 566 |
+
# It tranposes the characters on either side of the insertion cursor,
|
| 567 |
+
# unless the cursor is at the end of the line. In this case it
|
| 568 |
+
# transposes the two characters to the left of the cursor. In either
|
| 569 |
+
# case, the cursor ends up to the right of the transposed characters.
|
| 570 |
+
#
|
| 571 |
+
# Arguments:
|
| 572 |
+
# w - The entry window.
|
| 573 |
+
|
| 574 |
+
proc ::tk::EntryTranspose w {
|
| 575 |
+
set i [$w index insert]
|
| 576 |
+
if {$i < [$w index end]} {
|
| 577 |
+
incr i
|
| 578 |
+
}
|
| 579 |
+
if {$i < 2} {
|
| 580 |
+
return
|
| 581 |
+
}
|
| 582 |
+
set first [expr {$i-2}]
|
| 583 |
+
set data [$w get]
|
| 584 |
+
set new [string index $data $i-1][string index $data $first]
|
| 585 |
+
$w delete $first $i
|
| 586 |
+
$w insert insert $new
|
| 587 |
+
EntrySeeInsert $w
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
# ::tk::EntryNextWord --
|
| 591 |
+
# Returns the index of the next word position after a given position in the
|
| 592 |
+
# entry. The next word is platform dependent and may be either the next
|
| 593 |
+
# end-of-word position or the next start-of-word position after the next
|
| 594 |
+
# end-of-word position.
|
| 595 |
+
#
|
| 596 |
+
# Arguments:
|
| 597 |
+
# w - The entry window in which the cursor is to move.
|
| 598 |
+
# start - Position at which to start search.
|
| 599 |
+
|
| 600 |
+
if {[tk windowingsystem] eq "win32"} {
|
| 601 |
+
proc ::tk::EntryNextWord {w start} {
|
| 602 |
+
# the check on [winfo class] is because the spinbox also uses this proc
|
| 603 |
+
if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} {
|
| 604 |
+
return end
|
| 605 |
+
}
|
| 606 |
+
set pos [tcl_endOfWord [$w get] [$w index $start]]
|
| 607 |
+
if {$pos >= 0} {
|
| 608 |
+
set pos [tcl_startOfNextWord [$w get] $pos]
|
| 609 |
+
}
|
| 610 |
+
if {$pos < 0} {
|
| 611 |
+
return end
|
| 612 |
+
}
|
| 613 |
+
return $pos
|
| 614 |
+
}
|
| 615 |
+
} else {
|
| 616 |
+
proc ::tk::EntryNextWord {w start} {
|
| 617 |
+
# the check on [winfo class] is because the spinbox also uses this proc
|
| 618 |
+
if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} {
|
| 619 |
+
return end
|
| 620 |
+
}
|
| 621 |
+
set pos [tcl_endOfWord [$w get] [$w index $start]]
|
| 622 |
+
if {$pos < 0} {
|
| 623 |
+
return end
|
| 624 |
+
}
|
| 625 |
+
return $pos
|
| 626 |
+
}
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
# ::tk::EntryPreviousWord --
|
| 630 |
+
#
|
| 631 |
+
# Returns the index of the previous word position before a given
|
| 632 |
+
# position in the entry.
|
| 633 |
+
#
|
| 634 |
+
# Arguments:
|
| 635 |
+
# w - The entry window in which the cursor is to move.
|
| 636 |
+
# start - Position at which to start search.
|
| 637 |
+
|
| 638 |
+
proc ::tk::EntryPreviousWord {w start} {
|
| 639 |
+
# the check on [winfo class] is because the spinbox also uses this proc
|
| 640 |
+
if {[winfo class $w] eq "Entry" && [$w cget -show] ne ""} {
|
| 641 |
+
return 0
|
| 642 |
+
}
|
| 643 |
+
set pos [tcl_startOfPreviousWord [$w get] [$w index $start]]
|
| 644 |
+
if {$pos < 0} {
|
| 645 |
+
return 0
|
| 646 |
+
}
|
| 647 |
+
return $pos
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
# ::tk::EntryScanMark --
|
| 651 |
+
#
|
| 652 |
+
# Marks the start of a possible scan drag operation
|
| 653 |
+
#
|
| 654 |
+
# Arguments:
|
| 655 |
+
# w - The entry window from which the text to get
|
| 656 |
+
# x - x location on screen
|
| 657 |
+
|
| 658 |
+
proc ::tk::EntryScanMark {w x} {
|
| 659 |
+
$w scan mark $x
|
| 660 |
+
set ::tk::Priv(x) $x
|
| 661 |
+
set ::tk::Priv(y) 0 ; # not used
|
| 662 |
+
set ::tk::Priv(mouseMoved) 0
|
| 663 |
+
}
|
| 664 |
+
|
| 665 |
+
# ::tk::EntryScanDrag --
|
| 666 |
+
#
|
| 667 |
+
# Marks the start of a possible scan drag operation
|
| 668 |
+
#
|
| 669 |
+
# Arguments:
|
| 670 |
+
# w - The entry window from which the text to get
|
| 671 |
+
# x - x location on screen
|
| 672 |
+
|
| 673 |
+
proc ::tk::EntryScanDrag {w x} {
|
| 674 |
+
# Make sure these exist, as some weird situations can trigger the
|
| 675 |
+
# motion binding without the initial press. [Bug #220269]
|
| 676 |
+
if {![info exists ::tk::Priv(x)]} {set ::tk::Priv(x) $x}
|
| 677 |
+
# allow for a delta
|
| 678 |
+
if {abs($x-$::tk::Priv(x)) > 2} {
|
| 679 |
+
set ::tk::Priv(mouseMoved) 1
|
| 680 |
+
}
|
| 681 |
+
$w scan dragto $x
|
| 682 |
+
}
|
| 683 |
+
|
| 684 |
+
# ::tk::EntryGetSelection --
|
| 685 |
+
#
|
| 686 |
+
# Returns the selected text of the entry with respect to the -show option.
|
| 687 |
+
#
|
| 688 |
+
# Arguments:
|
| 689 |
+
# w - The entry window from which the text to get
|
| 690 |
+
|
| 691 |
+
proc ::tk::EntryGetSelection {w} {
|
| 692 |
+
set entryString [string range [$w get] [$w index sel.first] \
|
| 693 |
+
[$w index sel.last]-1]
|
| 694 |
+
if {[$w cget -show] ne ""} {
|
| 695 |
+
return [string repeat [string index [$w cget -show] 0] \
|
| 696 |
+
[string length $entryString]]
|
| 697 |
+
}
|
| 698 |
+
return $entryString
|
| 699 |
+
}
|
evalkit_llava/lib/tk8.6/fontchooser.tcl
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# fontchooser.tcl -
|
| 2 |
+
#
|
| 3 |
+
# A themeable Tk font selection dialog. See TIP #324.
|
| 4 |
+
#
|
| 5 |
+
# Copyright (C) 2008 Keith Vetter
|
| 6 |
+
# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
|
| 7 |
+
#
|
| 8 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 9 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 10 |
+
|
| 11 |
+
namespace eval ::tk::fontchooser {
|
| 12 |
+
variable S
|
| 13 |
+
|
| 14 |
+
set S(W) .__tk__fontchooser
|
| 15 |
+
set S(fonts) [lsort -dictionary -unique [font families]]
|
| 16 |
+
set S(styles) [list \
|
| 17 |
+
[::msgcat::mc Regular] \
|
| 18 |
+
[::msgcat::mc Italic] \
|
| 19 |
+
[::msgcat::mc Bold] \
|
| 20 |
+
[::msgcat::mc {Bold Italic}] \
|
| 21 |
+
]
|
| 22 |
+
set S(sizes) {8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72}
|
| 23 |
+
set S(strike) 0
|
| 24 |
+
set S(under) 0
|
| 25 |
+
set S(first) 1
|
| 26 |
+
set S(-parent) .
|
| 27 |
+
set S(-title) {}
|
| 28 |
+
set S(-command) ""
|
| 29 |
+
set S(-font) TkDefaultFont
|
| 30 |
+
set S(bad) [list ]
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
proc ::tk::fontchooser::Canonical {} {
|
| 34 |
+
variable S
|
| 35 |
+
|
| 36 |
+
foreach style $S(styles) {
|
| 37 |
+
lappend S(styles,lcase) [string tolower $style]
|
| 38 |
+
}
|
| 39 |
+
set S(sizes,lcase) $S(sizes)
|
| 40 |
+
set S(sampletext) [::msgcat::mc "AaBbYyZz01"]
|
| 41 |
+
|
| 42 |
+
# Canonical versions of font families, styles, etc. for easier searching
|
| 43 |
+
set S(fonts,lcase) {}
|
| 44 |
+
foreach font $S(fonts) {
|
| 45 |
+
lappend S(fonts,lcase) [string tolower $font]
|
| 46 |
+
}
|
| 47 |
+
set S(styles,lcase) {}
|
| 48 |
+
foreach style $S(styles) {
|
| 49 |
+
lappend S(styles,lcase) [string tolower $style]
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
proc ::tk::fontchooser::Setup {} {
|
| 54 |
+
variable S
|
| 55 |
+
|
| 56 |
+
Canonical
|
| 57 |
+
|
| 58 |
+
::ttk::style layout FontchooserFrame {
|
| 59 |
+
Entry.field -sticky news -border true -children {
|
| 60 |
+
FontchooserFrame.padding -sticky news
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
bind [winfo class .] <<ThemeChanged>> \
|
| 64 |
+
[list +ttk::style layout FontchooserFrame \
|
| 65 |
+
[ttk::style layout FontchooserFrame]]
|
| 66 |
+
|
| 67 |
+
namespace ensemble create -map {
|
| 68 |
+
show ::tk::fontchooser::Show
|
| 69 |
+
hide ::tk::fontchooser::Hide
|
| 70 |
+
configure ::tk::fontchooser::Configure
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
::tk::fontchooser::Setup
|
| 74 |
+
|
| 75 |
+
proc ::tk::fontchooser::Show {} {
|
| 76 |
+
variable S
|
| 77 |
+
|
| 78 |
+
Canonical
|
| 79 |
+
|
| 80 |
+
if {![winfo exists $S(W)]} {
|
| 81 |
+
Create
|
| 82 |
+
wm transient $S(W) [winfo toplevel $S(-parent)]
|
| 83 |
+
tk::PlaceWindow $S(W) widget $S(-parent)
|
| 84 |
+
if {[string trim $S(-title)] eq ""} {
|
| 85 |
+
wm title $S(W) [::msgcat::mc "Font"]
|
| 86 |
+
} else {
|
| 87 |
+
wm title $S(W) $S(-title)
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
set S(fonts) [lsort -dictionary -unique [font families]]
|
| 91 |
+
set S(fonts,lcase) {}
|
| 92 |
+
foreach font $S(fonts) {
|
| 93 |
+
lappend S(fonts,lcase) [string tolower $font]
|
| 94 |
+
}
|
| 95 |
+
wm deiconify $S(W)
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
proc ::tk::fontchooser::Hide {} {
|
| 99 |
+
variable S
|
| 100 |
+
wm withdraw $S(W)
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
proc ::tk::fontchooser::Configure {args} {
|
| 104 |
+
variable S
|
| 105 |
+
|
| 106 |
+
set specs {
|
| 107 |
+
{-parent "" "" . }
|
| 108 |
+
{-title "" "" ""}
|
| 109 |
+
{-font "" "" ""}
|
| 110 |
+
{-command "" "" ""}
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
if {[llength $args] == 0} {
|
| 114 |
+
set result {}
|
| 115 |
+
foreach spec $specs {
|
| 116 |
+
foreach {name xx yy default} $spec break
|
| 117 |
+
lappend result $name \
|
| 118 |
+
[expr {[info exists S($name)] ? $S($name) : $default}]
|
| 119 |
+
}
|
| 120 |
+
lappend result -visible \
|
| 121 |
+
[expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}]
|
| 122 |
+
return $result
|
| 123 |
+
}
|
| 124 |
+
if {[llength $args] == 1} {
|
| 125 |
+
set option [lindex $args 0]
|
| 126 |
+
if {[string equal $option "-visible"]} {
|
| 127 |
+
return [expr {[winfo exists $S(W)] && [winfo ismapped $S(W)]}]
|
| 128 |
+
} elseif {[info exists S($option)]} {
|
| 129 |
+
return $S($option)
|
| 130 |
+
}
|
| 131 |
+
return -code error -errorcode [list TK LOOKUP OPTION $option] \
|
| 132 |
+
"bad option \"$option\": must be\
|
| 133 |
+
-command, -font, -parent, -title or -visible"
|
| 134 |
+
}
|
| 135 |
+
set cache [dict create -parent $S(-parent) -title $S(-title) \
|
| 136 |
+
-font $S(-font) -command $S(-command)]
|
| 137 |
+
set r [tclParseConfigSpec [namespace which -variable S] $specs DONTSETDEFAULTS $args]
|
| 138 |
+
if {![winfo exists $S(-parent)]} {
|
| 139 |
+
set code [list TK LOOKUP WINDOW $S(-parent)]
|
| 140 |
+
set err "bad window path name \"$S(-parent)\""
|
| 141 |
+
array set S $cache
|
| 142 |
+
return -code error -errorcode $code $err
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
if {[winfo exists $S(W)]} {
|
| 146 |
+
if {{-font} in $args} {
|
| 147 |
+
Init $S(-font)
|
| 148 |
+
event generate $S(-parent) <<TkFontchooserFontChanged>>
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
if {[string trim $S(-title)] eq {}} {
|
| 152 |
+
wm title $S(W) [::msgcat::mc Font]
|
| 153 |
+
} else {
|
| 154 |
+
wm title $S(W) $S(-title)
|
| 155 |
+
}
|
| 156 |
+
$S(W).ok configure -state $S(nstate)
|
| 157 |
+
$S(W).apply configure -state $S(nstate)
|
| 158 |
+
}
|
| 159 |
+
return $r
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
proc ::tk::fontchooser::Create {} {
|
| 163 |
+
variable S
|
| 164 |
+
set windowName __tk__fontchooser
|
| 165 |
+
if {$S(-parent) eq "."} {
|
| 166 |
+
set S(W) .$windowName
|
| 167 |
+
} else {
|
| 168 |
+
set S(W) $S(-parent).$windowName
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
# Now build the dialog
|
| 172 |
+
if {![winfo exists $S(W)]} {
|
| 173 |
+
toplevel $S(W) -class TkFontDialog
|
| 174 |
+
if {[package provide tcltest] ne {}} {
|
| 175 |
+
set ::tk_dialog $S(W)
|
| 176 |
+
}
|
| 177 |
+
wm withdraw $S(W)
|
| 178 |
+
wm title $S(W) $S(-title)
|
| 179 |
+
wm transient $S(W) [winfo toplevel $S(-parent)]
|
| 180 |
+
|
| 181 |
+
set scaling [tk scaling]
|
| 182 |
+
set sizeWidth [expr {int([string length [::msgcat::mc "&Size:"]] * $scaling)}]
|
| 183 |
+
|
| 184 |
+
set outer [::ttk::frame $S(W).outer -padding {10 10}]
|
| 185 |
+
::tk::AmpWidget ::ttk::label $S(W).font -text [::msgcat::mc "&Font:"]
|
| 186 |
+
::tk::AmpWidget ::ttk::label $S(W).style -text [::msgcat::mc "Font st&yle:"]
|
| 187 |
+
::tk::AmpWidget ::ttk::label $S(W).size -text [::msgcat::mc "&Size:"] -width $sizeWidth
|
| 188 |
+
ttk::entry $S(W).efont -width 18 \
|
| 189 |
+
-textvariable [namespace which -variable S](font)
|
| 190 |
+
ttk::entry $S(W).estyle -width 10 \
|
| 191 |
+
-textvariable [namespace which -variable S](style)
|
| 192 |
+
ttk::entry $S(W).esize -textvariable [namespace which -variable S](size) \
|
| 193 |
+
-width 3 -validate key -validatecommand {regexp -- {^-*[0-9]*$} %P}
|
| 194 |
+
|
| 195 |
+
ttk_slistbox $S(W).lfonts -height 7 -exportselection 0 \
|
| 196 |
+
-selectmode browse -activestyle none \
|
| 197 |
+
-listvariable [namespace which -variable S](fonts)
|
| 198 |
+
ttk_slistbox $S(W).lstyles -width 5 -height 7 -exportselection 0 \
|
| 199 |
+
-selectmode browse -activestyle none \
|
| 200 |
+
-listvariable [namespace which -variable S](styles)
|
| 201 |
+
ttk_slistbox $S(W).lsizes -width 4 -height 7 -exportselection 0 \
|
| 202 |
+
-selectmode browse -activestyle none \
|
| 203 |
+
-listvariable [namespace which -variable S](sizes)
|
| 204 |
+
|
| 205 |
+
set WE $S(W).effects
|
| 206 |
+
::ttk::labelframe $WE -text [::msgcat::mc "Effects"]
|
| 207 |
+
::tk::AmpWidget ::ttk::checkbutton $WE.strike \
|
| 208 |
+
-variable [namespace which -variable S](strike) \
|
| 209 |
+
-text [::msgcat::mc "Stri&keout"] \
|
| 210 |
+
-command [namespace code [list Click strike]]
|
| 211 |
+
::tk::AmpWidget ::ttk::checkbutton $WE.under \
|
| 212 |
+
-variable [namespace which -variable S](under) \
|
| 213 |
+
-text [::msgcat::mc "&Underline"] \
|
| 214 |
+
-command [namespace code [list Click under]]
|
| 215 |
+
|
| 216 |
+
set bbox [::ttk::frame $S(W).bbox]
|
| 217 |
+
::ttk::button $S(W).ok -text [::msgcat::mc OK] -default active\
|
| 218 |
+
-command [namespace code [list Done 1]]
|
| 219 |
+
::ttk::button $S(W).cancel -text [::msgcat::mc Cancel] \
|
| 220 |
+
-command [namespace code [list Done 0]]
|
| 221 |
+
::tk::AmpWidget ::ttk::button $S(W).apply -text [::msgcat::mc "&Apply"] \
|
| 222 |
+
-command [namespace code [list Apply]]
|
| 223 |
+
wm protocol $S(W) WM_DELETE_WINDOW [namespace code [list Done 0]]
|
| 224 |
+
|
| 225 |
+
# Calculate minimum sizes
|
| 226 |
+
ttk::scrollbar $S(W).tmpvs
|
| 227 |
+
set scroll_width [winfo reqwidth $S(W).tmpvs]
|
| 228 |
+
destroy $S(W).tmpvs
|
| 229 |
+
set minsize(gap) 10
|
| 230 |
+
set minsize(bbox) [winfo reqwidth $S(W).ok]
|
| 231 |
+
set minsize(fonts) \
|
| 232 |
+
[expr {[font measure TkDefaultFont "Helvetica"] + $scroll_width}]
|
| 233 |
+
set minsize(styles) \
|
| 234 |
+
[expr {[font measure TkDefaultFont "Bold Italic"] + $scroll_width}]
|
| 235 |
+
set minsize(sizes) \
|
| 236 |
+
[expr {[font measure TkDefaultFont "-99"] + $scroll_width}]
|
| 237 |
+
set min [expr {$minsize(gap) * 4}]
|
| 238 |
+
foreach {what width} [array get minsize] {
|
| 239 |
+
incr min $width
|
| 240 |
+
}
|
| 241 |
+
wm minsize $S(W) $min 260
|
| 242 |
+
|
| 243 |
+
bind $S(W) <Return> [namespace code [list Done 1]]
|
| 244 |
+
bind $S(W) <Escape> [namespace code [list Done 0]]
|
| 245 |
+
bind $S(W) <Map> [namespace code [list Visibility %W 1]]
|
| 246 |
+
bind $S(W) <Unmap> [namespace code [list Visibility %W 0]]
|
| 247 |
+
bind $S(W) <Destroy> [namespace code [list Visibility %W 0]]
|
| 248 |
+
bind $S(W).lfonts.list <<ListboxSelect>> [namespace code [list Click font]]
|
| 249 |
+
bind $S(W).lstyles.list <<ListboxSelect>> [namespace code [list Click style]]
|
| 250 |
+
bind $S(W).lsizes.list <<ListboxSelect>> [namespace code [list Click size]]
|
| 251 |
+
bind $S(W) <Alt-Key> [list ::tk::AltKeyInDialog $S(W) %A]
|
| 252 |
+
bind $S(W).font <<AltUnderlined>> [list ::focus $S(W).efont]
|
| 253 |
+
bind $S(W).style <<AltUnderlined>> [list ::focus $S(W).estyle]
|
| 254 |
+
bind $S(W).size <<AltUnderlined>> [list ::focus $S(W).esize]
|
| 255 |
+
bind $S(W).apply <<AltUnderlined>> [namespace code [list Apply]]
|
| 256 |
+
bind $WE.strike <<AltUnderlined>> [list $WE.strike invoke]
|
| 257 |
+
bind $WE.under <<AltUnderlined>> [list $WE.under invoke]
|
| 258 |
+
|
| 259 |
+
set WS $S(W).sample
|
| 260 |
+
::ttk::labelframe $WS -text [::msgcat::mc "Sample"]
|
| 261 |
+
::ttk::label $WS.sample -relief sunken -anchor center \
|
| 262 |
+
-textvariable [namespace which -variable S](sampletext)
|
| 263 |
+
set S(sample) $WS.sample
|
| 264 |
+
grid $WS.sample -sticky news -padx 6 -pady 4
|
| 265 |
+
grid rowconfigure $WS 0 -weight 1
|
| 266 |
+
grid columnconfigure $WS 0 -weight 1
|
| 267 |
+
grid propagate $WS 0
|
| 268 |
+
|
| 269 |
+
grid $S(W).ok -in $bbox -sticky new -pady {0 2}
|
| 270 |
+
grid $S(W).cancel -in $bbox -sticky new -pady 2
|
| 271 |
+
grid $S(W).apply -in $bbox -sticky new -pady 2
|
| 272 |
+
grid columnconfigure $bbox 0 -weight 1
|
| 273 |
+
|
| 274 |
+
grid $WE.strike -sticky w -padx 10
|
| 275 |
+
grid $WE.under -sticky w -padx 10 -pady {0 30}
|
| 276 |
+
grid columnconfigure $WE 1 -weight 1
|
| 277 |
+
|
| 278 |
+
grid $S(W).font x $S(W).style x $S(W).size x -in $outer -sticky w
|
| 279 |
+
grid $S(W).efont x $S(W).estyle x $S(W).esize x $bbox -in $outer -sticky ew
|
| 280 |
+
grid $S(W).lfonts x $S(W).lstyles x $S(W).lsizes x ^ -in $outer -sticky news
|
| 281 |
+
grid $WE x $WS - - x ^ -in $outer -sticky news -pady {15 30}
|
| 282 |
+
grid configure $bbox -sticky n
|
| 283 |
+
grid rowconfigure $outer 2 -weight 1
|
| 284 |
+
grid columnconfigure $outer {1 3 5} -minsize $minsize(gap)
|
| 285 |
+
grid columnconfigure $outer {0 2 4} -weight 1
|
| 286 |
+
grid columnconfigure $outer 0 -minsize $minsize(fonts)
|
| 287 |
+
grid columnconfigure $outer 2 -minsize $minsize(styles)
|
| 288 |
+
grid columnconfigure $outer 4 -minsize $minsize(sizes)
|
| 289 |
+
grid columnconfigure $outer 6 -minsize $minsize(bbox)
|
| 290 |
+
|
| 291 |
+
grid $outer -sticky news
|
| 292 |
+
grid rowconfigure $S(W) 0 -weight 1
|
| 293 |
+
grid columnconfigure $S(W) 0 -weight 1
|
| 294 |
+
|
| 295 |
+
Init $S(-font)
|
| 296 |
+
|
| 297 |
+
trace add variable [namespace which -variable S](size) \
|
| 298 |
+
write [namespace code [list Tracer]]
|
| 299 |
+
trace add variable [namespace which -variable S](style) \
|
| 300 |
+
write [namespace code [list Tracer]]
|
| 301 |
+
trace add variable [namespace which -variable S](font) \
|
| 302 |
+
write [namespace code [list Tracer]]
|
| 303 |
+
trace add variable [namespace which -variable S](strike) \
|
| 304 |
+
write [namespace code [list Tracer]]
|
| 305 |
+
trace add variable [namespace which -variable S](under) \
|
| 306 |
+
write [namespace code [list Tracer]]
|
| 307 |
+
}
|
| 308 |
+
|
| 309 |
+
Init $S(-font)
|
| 310 |
+
|
| 311 |
+
return
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
# ::tk::fontchooser::Done --
|
| 315 |
+
#
|
| 316 |
+
# Handles teardown of the dialog, calling -command if needed
|
| 317 |
+
#
|
| 318 |
+
# Arguments:
|
| 319 |
+
# ok true if user pressed OK
|
| 320 |
+
#
|
| 321 |
+
proc ::tk::fontchooser::Done {ok} {
|
| 322 |
+
variable S
|
| 323 |
+
|
| 324 |
+
if {! $ok} {
|
| 325 |
+
set S(result) ""
|
| 326 |
+
}
|
| 327 |
+
trace remove variable S(size) write [namespace code [list Tracer]]
|
| 328 |
+
trace remove variable S(style) write [namespace code [list Tracer]]
|
| 329 |
+
trace remove variable S(font) write [namespace code [list Tracer]]
|
| 330 |
+
trace remove variable S(strike) write [namespace code [list Tracer]]
|
| 331 |
+
trace remove variable S(under) write [namespace code [list Tracer]]
|
| 332 |
+
destroy $S(W)
|
| 333 |
+
if {$ok} {
|
| 334 |
+
if {$S(-command) ne ""} {
|
| 335 |
+
uplevel #0 $S(-command) [list $S(result)]
|
| 336 |
+
}
|
| 337 |
+
event generate $S(-parent) <<TkFontchooserFontChanged>>
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
# ::tk::fontchooser::Apply --
|
| 342 |
+
#
|
| 343 |
+
# Call the -command procedure appending the current font
|
| 344 |
+
# Errors are reported via the background error mechanism
|
| 345 |
+
#
|
| 346 |
+
proc ::tk::fontchooser::Apply {} {
|
| 347 |
+
variable S
|
| 348 |
+
if {$S(-command) ne ""} {
|
| 349 |
+
if {[catch {uplevel #0 $S(-command) [list $S(result)]} err]} {
|
| 350 |
+
::bgerror $err
|
| 351 |
+
}
|
| 352 |
+
}
|
| 353 |
+
event generate $S(-parent) <<TkFontchooserFontChanged>>
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
# ::tk::fontchooser::Init --
|
| 357 |
+
#
|
| 358 |
+
# Initializes dialog to a default font
|
| 359 |
+
#
|
| 360 |
+
# Arguments:
|
| 361 |
+
# defaultFont font to use as the default
|
| 362 |
+
#
|
| 363 |
+
proc ::tk::fontchooser::Init {{defaultFont ""}} {
|
| 364 |
+
variable S
|
| 365 |
+
|
| 366 |
+
if {$S(first) || $defaultFont ne ""} {
|
| 367 |
+
Canonical
|
| 368 |
+
if {$defaultFont eq ""} {
|
| 369 |
+
set defaultFont [[entry .___e] cget -font]
|
| 370 |
+
destroy .___e
|
| 371 |
+
}
|
| 372 |
+
array set F [font actual $defaultFont]
|
| 373 |
+
set S(font) $F(-family)
|
| 374 |
+
set S(style) [::msgcat::mc "Regular"]
|
| 375 |
+
set S(size) $F(-size)
|
| 376 |
+
set S(strike) $F(-overstrike)
|
| 377 |
+
set S(under) $F(-underline)
|
| 378 |
+
if {$F(-weight) eq "bold" && $F(-slant) eq "italic"} {
|
| 379 |
+
set S(style) [::msgcat::mc "Bold Italic"]
|
| 380 |
+
} elseif {$F(-weight) eq "bold"} {
|
| 381 |
+
set S(style) [::msgcat::mc "Bold"]
|
| 382 |
+
} elseif {$F(-slant) eq "italic"} {
|
| 383 |
+
set S(style) [::msgcat::mc "Italic"]
|
| 384 |
+
}
|
| 385 |
+
set S(first) 0
|
| 386 |
+
}
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
# ::tk::fontchooser::Click --
|
| 390 |
+
#
|
| 391 |
+
# Handles all button clicks, updating the appropriate widgets
|
| 392 |
+
#
|
| 393 |
+
# Arguments:
|
| 394 |
+
# who which widget got pressed
|
| 395 |
+
#
|
| 396 |
+
proc ::tk::fontchooser::Click {who} {
|
| 397 |
+
variable S
|
| 398 |
+
if {$who eq "font"} {
|
| 399 |
+
set S(font) [$S(W).lfonts get [$S(W).lfonts curselection]]
|
| 400 |
+
} elseif {$who eq "style"} {
|
| 401 |
+
set S(style) [$S(W).lstyles get [$S(W).lstyles curselection]]
|
| 402 |
+
} elseif {$who eq "size"} {
|
| 403 |
+
set S(size) [$S(W).lsizes get [$S(W).lsizes curselection]]
|
| 404 |
+
}
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
# ::tk::fontchooser::Tracer --
|
| 408 |
+
#
|
| 409 |
+
# Handles traces on key variables, updating the appropriate widgets
|
| 410 |
+
#
|
| 411 |
+
# Arguments:
|
| 412 |
+
# standard trace arguments (not used)
|
| 413 |
+
#
|
| 414 |
+
proc ::tk::fontchooser::Tracer {var1 var2 op} {
|
| 415 |
+
variable S
|
| 416 |
+
# We don't need to process strike and under
|
| 417 |
+
if {$var2 ni [list strike under]} {
|
| 418 |
+
# Make selection in listbox
|
| 419 |
+
set value [string tolower $S($var2)]
|
| 420 |
+
$S(W).l${var2}s selection clear 0 end
|
| 421 |
+
set n [lsearch -exact $S(${var2}s,lcase) $value]
|
| 422 |
+
$S(W).l${var2}s selection set $n
|
| 423 |
+
if {$n >= 0} {
|
| 424 |
+
set S($var2) [lindex $S(${var2}s) $n]
|
| 425 |
+
$S(W).e$var2 icursor end
|
| 426 |
+
$S(W).e$var2 selection clear
|
| 427 |
+
if {[set i [lsearch $S(bad) $var2]] >= 0} {
|
| 428 |
+
set S(bad) [lreplace $S(bad) $i $i]
|
| 429 |
+
}
|
| 430 |
+
} else {
|
| 431 |
+
# No match, try prefix
|
| 432 |
+
set n [lsearch -glob $S(${var2}s,lcase) "$value*"]
|
| 433 |
+
if {$var2 ne "size" || !([regexp -- {^(-[0-9]+|[0-9]+)$} $value] && $value >= -4096 && $value <= 4096)} {
|
| 434 |
+
if {[lsearch $S(bad) $var2] < 0} {
|
| 435 |
+
lappend S(bad) $var2
|
| 436 |
+
}
|
| 437 |
+
} else {
|
| 438 |
+
if {[set i [lsearch $S(bad) $var2]] >= 0} {
|
| 439 |
+
set S(bad) [lreplace $S(bad) $i $i]
|
| 440 |
+
}
|
| 441 |
+
}
|
| 442 |
+
}
|
| 443 |
+
$S(W).l${var2}s see $n
|
| 444 |
+
}
|
| 445 |
+
if {[llength $S(bad)] == 0} {
|
| 446 |
+
set S(nstate) normal
|
| 447 |
+
Update
|
| 448 |
+
} else {
|
| 449 |
+
set S(nstate) disabled
|
| 450 |
+
}
|
| 451 |
+
$S(W).ok configure -state $S(nstate)
|
| 452 |
+
$S(W).apply configure -state $S(nstate)
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
# ::tk::fontchooser::Update --
|
| 456 |
+
#
|
| 457 |
+
# Shows a sample of the currently selected font
|
| 458 |
+
#
|
| 459 |
+
proc ::tk::fontchooser::Update {} {
|
| 460 |
+
variable S
|
| 461 |
+
|
| 462 |
+
set S(result) [list $S(font) $S(size)]
|
| 463 |
+
if {$S(style) eq [::msgcat::mc "Bold"]} {
|
| 464 |
+
lappend S(result) bold
|
| 465 |
+
}
|
| 466 |
+
if {$S(style) eq [::msgcat::mc "Italic"]} {
|
| 467 |
+
lappend S(result) italic
|
| 468 |
+
}
|
| 469 |
+
if {$S(style) eq [::msgcat::mc "Bold Italic"]} {
|
| 470 |
+
lappend S(result) bold italic
|
| 471 |
+
}
|
| 472 |
+
if {$S(strike)} {
|
| 473 |
+
lappend S(result) overstrike
|
| 474 |
+
}
|
| 475 |
+
if {$S(under)} {
|
| 476 |
+
lappend S(result) underline
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
$S(sample) configure -font $S(result)
|
| 480 |
+
set S(-font) $S(result)
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
# ::tk::fontchooser::Visibility --
|
| 484 |
+
#
|
| 485 |
+
# Notify the parent when the dialog visibility changes
|
| 486 |
+
#
|
| 487 |
+
proc ::tk::fontchooser::Visibility {w visible} {
|
| 488 |
+
variable S
|
| 489 |
+
if {$w eq $S(W)} {
|
| 490 |
+
event generate $S(-parent) <<TkFontchooserVisibility>>
|
| 491 |
+
}
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
+
# ::tk::fontchooser::ttk_slistbox --
|
| 495 |
+
#
|
| 496 |
+
# Create a properly themed scrolled listbox.
|
| 497 |
+
# This is exactly right on XP but may need adjusting on other platforms.
|
| 498 |
+
#
|
| 499 |
+
proc ::tk::fontchooser::ttk_slistbox {w args} {
|
| 500 |
+
set f [ttk::frame $w -style FontchooserFrame -padding 2]
|
| 501 |
+
if {[catch {
|
| 502 |
+
listbox $f.list -relief flat -highlightthickness 0 -borderwidth 0 {*}$args
|
| 503 |
+
ttk::scrollbar $f.vs -command [list $f.list yview]
|
| 504 |
+
$f.list configure -yscrollcommand [list $f.vs set]
|
| 505 |
+
grid $f.list $f.vs -sticky news
|
| 506 |
+
grid rowconfigure $f 0 -weight 1
|
| 507 |
+
grid columnconfigure $f 0 -weight 1
|
| 508 |
+
interp hide {} $w
|
| 509 |
+
interp alias {} $w {} $f.list
|
| 510 |
+
} err opt]} {
|
| 511 |
+
destroy $f
|
| 512 |
+
return -options $opt $err
|
| 513 |
+
}
|
| 514 |
+
return $w
|
| 515 |
+
}
|
evalkit_llava/lib/tk8.6/iconlist.tcl
ADDED
|
@@ -0,0 +1,715 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# iconlist.tcl
|
| 2 |
+
#
|
| 3 |
+
# Implements the icon-list megawidget used in the "Tk" standard file
|
| 4 |
+
# selection dialog boxes.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
|
| 7 |
+
# Copyright (c) 2009 Donal K. Fellows
|
| 8 |
+
#
|
| 9 |
+
# See the file "license.terms" for information on usage and redistribution of
|
| 10 |
+
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 11 |
+
#
|
| 12 |
+
# API Summary:
|
| 13 |
+
# tk::IconList <path> ?<option> <value>? ...
|
| 14 |
+
# <path> add <imageName> <itemList>
|
| 15 |
+
# <path> cget <option>
|
| 16 |
+
# <path> configure ?<option>? ?<value>? ...
|
| 17 |
+
# <path> deleteall
|
| 18 |
+
# <path> destroy
|
| 19 |
+
# <path> get <itemIndex>
|
| 20 |
+
# <path> index <index>
|
| 21 |
+
# <path> invoke
|
| 22 |
+
# <path> see <index>
|
| 23 |
+
# <path> selection anchor ?<int>?
|
| 24 |
+
# <path> selection clear <first> ?<last>?
|
| 25 |
+
# <path> selection get
|
| 26 |
+
# <path> selection includes <item>
|
| 27 |
+
# <path> selection set <first> ?<last>?
|
| 28 |
+
|
| 29 |
+
package require Tk
|
| 30 |
+
|
| 31 |
+
::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget {
|
| 32 |
+
variable w canvas sbar accel accelCB fill font index \
|
| 33 |
+
itemList itemsPerColumn list maxIH maxIW maxTH maxTW noScroll \
|
| 34 |
+
numItems oldX oldY options rect selected selection textList
|
| 35 |
+
constructor args {
|
| 36 |
+
next {*}$args
|
| 37 |
+
set accelCB {}
|
| 38 |
+
}
|
| 39 |
+
destructor {
|
| 40 |
+
my Reset
|
| 41 |
+
next
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
method GetSpecs {} {
|
| 45 |
+
concat [next] {
|
| 46 |
+
{-command "" "" ""}
|
| 47 |
+
{-font "" "" "TkIconFont"}
|
| 48 |
+
{-multiple "" "" "0"}
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
# ----------------------------------------------------------------------
|
| 53 |
+
|
| 54 |
+
method index i {
|
| 55 |
+
if {![info exist list]} {
|
| 56 |
+
set list {}
|
| 57 |
+
}
|
| 58 |
+
switch -regexp -- $i {
|
| 59 |
+
"^-?[0-9]+$" {
|
| 60 |
+
if {$i < 0} {
|
| 61 |
+
set i 0
|
| 62 |
+
}
|
| 63 |
+
if {$i >= [llength $list]} {
|
| 64 |
+
set i [expr {[llength $list] - 1}]
|
| 65 |
+
}
|
| 66 |
+
return $i
|
| 67 |
+
}
|
| 68 |
+
"^anchor$" {
|
| 69 |
+
return $index(anchor)
|
| 70 |
+
}
|
| 71 |
+
"^end$" {
|
| 72 |
+
return [llength $list]
|
| 73 |
+
}
|
| 74 |
+
"@-?[0-9]+,-?[0-9]+" {
|
| 75 |
+
scan $i "@%d,%d" x y
|
| 76 |
+
set item [$canvas find closest \
|
| 77 |
+
[$canvas canvasx $x] [$canvas canvasy $y]]
|
| 78 |
+
return [lindex [$canvas itemcget $item -tags] 1]
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
method selection {op args} {
|
| 84 |
+
switch -exact -- $op {
|
| 85 |
+
anchor {
|
| 86 |
+
if {[llength $args] == 1} {
|
| 87 |
+
set index(anchor) [$w index [lindex $args 0]]
|
| 88 |
+
} else {
|
| 89 |
+
return $index(anchor)
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
clear {
|
| 93 |
+
switch [llength $args] {
|
| 94 |
+
2 {
|
| 95 |
+
lassign $args first last
|
| 96 |
+
}
|
| 97 |
+
1 {
|
| 98 |
+
set first [set last [lindex $args 0]]
|
| 99 |
+
}
|
| 100 |
+
default {
|
| 101 |
+
return -code error -errorcode {TCL WRONGARGS} \
|
| 102 |
+
"wrong # args: should be\
|
| 103 |
+
\"[lrange [info level 0] 0 1] first ?last?\""
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
set first [$w index $first]
|
| 108 |
+
set last [$w index $last]
|
| 109 |
+
if {$first > $last} {
|
| 110 |
+
set tmp $first
|
| 111 |
+
set first $last
|
| 112 |
+
set last $tmp
|
| 113 |
+
}
|
| 114 |
+
set ind 0
|
| 115 |
+
foreach item $selection {
|
| 116 |
+
if {$item >= $first} {
|
| 117 |
+
set first $ind
|
| 118 |
+
break
|
| 119 |
+
}
|
| 120 |
+
incr ind
|
| 121 |
+
}
|
| 122 |
+
set ind [expr {[llength $selection] - 1}]
|
| 123 |
+
for {} {$ind >= 0} {incr ind -1} {
|
| 124 |
+
set item [lindex $selection $ind]
|
| 125 |
+
if {$item <= $last} {
|
| 126 |
+
set last $ind
|
| 127 |
+
break
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
if {$first > $last} {
|
| 132 |
+
return
|
| 133 |
+
}
|
| 134 |
+
set selection [lreplace $selection $first $last]
|
| 135 |
+
event generate $w <<ListboxSelect>>
|
| 136 |
+
my DrawSelection
|
| 137 |
+
}
|
| 138 |
+
get {
|
| 139 |
+
return $selection
|
| 140 |
+
}
|
| 141 |
+
includes {
|
| 142 |
+
return [expr {[lindex $args 0] in $selection}]
|
| 143 |
+
}
|
| 144 |
+
set {
|
| 145 |
+
switch [llength $args] {
|
| 146 |
+
2 {
|
| 147 |
+
lassign $args first last
|
| 148 |
+
}
|
| 149 |
+
1 {
|
| 150 |
+
set first [set last [lindex $args 0]]
|
| 151 |
+
}
|
| 152 |
+
default {
|
| 153 |
+
return -code error -errorcode {TCL WRONGARGS} \
|
| 154 |
+
"wrong # args: should be\
|
| 155 |
+
\"[lrange [info level 0] 0 1] first ?last?\""
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
set first [$w index $first]
|
| 160 |
+
set last [$w index $last]
|
| 161 |
+
if {$first > $last} {
|
| 162 |
+
set tmp $first
|
| 163 |
+
set first $last
|
| 164 |
+
set last $tmp
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
for {set i $first} {$i <= $last} {incr i} {
|
| 168 |
+
lappend selection $i
|
| 169 |
+
}
|
| 170 |
+
set selection [lsort -integer -unique $selection]
|
| 171 |
+
event generate $w <<ListboxSelect>>
|
| 172 |
+
my DrawSelection
|
| 173 |
+
}
|
| 174 |
+
}
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
method get item {
|
| 178 |
+
set rTag [lindex $list $item 2]
|
| 179 |
+
lassign $itemList($rTag) iTag tTag text serial
|
| 180 |
+
return $text
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
# Deletes all the items inside the canvas subwidget and reset the
|
| 184 |
+
# iconList's state.
|
| 185 |
+
#
|
| 186 |
+
method deleteall {} {
|
| 187 |
+
$canvas delete all
|
| 188 |
+
unset -nocomplain selected rect list itemList
|
| 189 |
+
set maxIW 1
|
| 190 |
+
set maxIH 1
|
| 191 |
+
set maxTW 1
|
| 192 |
+
set maxTH 1
|
| 193 |
+
set numItems 0
|
| 194 |
+
set noScroll 1
|
| 195 |
+
set selection {}
|
| 196 |
+
set index(anchor) ""
|
| 197 |
+
$sbar set 0.0 1.0
|
| 198 |
+
$canvas xview moveto 0
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
# Adds an icon into the IconList with the designated image and text
|
| 202 |
+
#
|
| 203 |
+
method add {image items} {
|
| 204 |
+
foreach text $items {
|
| 205 |
+
set iID item$numItems
|
| 206 |
+
set iTag [$canvas create image 0 0 -image $image -anchor nw \
|
| 207 |
+
-tags [list icon $numItems $iID]]
|
| 208 |
+
set tTag [$canvas create text 0 0 -text $text -anchor nw \
|
| 209 |
+
-font $options(-font) -fill $fill \
|
| 210 |
+
-tags [list text $numItems $iID]]
|
| 211 |
+
set rTag [$canvas create rect 0 0 0 0 -fill "" -outline "" \
|
| 212 |
+
-tags [list rect $numItems $iID]]
|
| 213 |
+
|
| 214 |
+
lassign [$canvas bbox $iTag] x1 y1 x2 y2
|
| 215 |
+
set iW [expr {$x2 - $x1}]
|
| 216 |
+
set iH [expr {$y2 - $y1}]
|
| 217 |
+
if {$maxIW < $iW} {
|
| 218 |
+
set maxIW $iW
|
| 219 |
+
}
|
| 220 |
+
if {$maxIH < $iH} {
|
| 221 |
+
set maxIH $iH
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
lassign [$canvas bbox $tTag] x1 y1 x2 y2
|
| 225 |
+
set tW [expr {$x2 - $x1}]
|
| 226 |
+
set tH [expr {$y2 - $y1}]
|
| 227 |
+
if {$maxTW < $tW} {
|
| 228 |
+
set maxTW $tW
|
| 229 |
+
}
|
| 230 |
+
if {$maxTH < $tH} {
|
| 231 |
+
set maxTH $tH
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
lappend list [list $iTag $tTag $rTag $iW $iH $tW $tH $numItems]
|
| 235 |
+
set itemList($rTag) [list $iTag $tTag $text $numItems]
|
| 236 |
+
set textList($numItems) [string tolower $text]
|
| 237 |
+
incr numItems
|
| 238 |
+
}
|
| 239 |
+
my WhenIdle Arrange
|
| 240 |
+
return
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
# Gets called when the user invokes the IconList (usually by
|
| 244 |
+
# double-clicking or pressing the Return key).
|
| 245 |
+
#
|
| 246 |
+
method invoke {} {
|
| 247 |
+
if {$options(-command) ne "" && [llength $selection]} {
|
| 248 |
+
uplevel #0 $options(-command)
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
# If the item is not (completely) visible, scroll the canvas so that it
|
| 253 |
+
# becomes visible.
|
| 254 |
+
#
|
| 255 |
+
method see rTag {
|
| 256 |
+
if {$noScroll} {
|
| 257 |
+
return
|
| 258 |
+
}
|
| 259 |
+
set sRegion [$canvas cget -scrollregion]
|
| 260 |
+
if {$sRegion eq ""} {
|
| 261 |
+
return
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
if {$rTag < 0 || $rTag >= [llength $list]} {
|
| 265 |
+
return
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
set bbox [$canvas bbox item$rTag]
|
| 269 |
+
set pad [expr {[$canvas cget -highlightthickness]+[$canvas cget -bd]}]
|
| 270 |
+
|
| 271 |
+
set x1 [lindex $bbox 0]
|
| 272 |
+
set x2 [lindex $bbox 2]
|
| 273 |
+
incr x1 [expr {$pad * -2}]
|
| 274 |
+
incr x2 [expr {$pad * -1}]
|
| 275 |
+
|
| 276 |
+
set cW [expr {[winfo width $canvas] - $pad*2}]
|
| 277 |
+
|
| 278 |
+
set scrollW [expr {[lindex $sRegion 2]-[lindex $sRegion 0]+1}]
|
| 279 |
+
set dispX [expr {int([lindex [$canvas xview] 0]*$scrollW)}]
|
| 280 |
+
set oldDispX $dispX
|
| 281 |
+
|
| 282 |
+
# check if out of the right edge
|
| 283 |
+
#
|
| 284 |
+
if {($x2 - $dispX) >= $cW} {
|
| 285 |
+
set dispX [expr {$x2 - $cW}]
|
| 286 |
+
}
|
| 287 |
+
# check if out of the left edge
|
| 288 |
+
#
|
| 289 |
+
if {($x1 - $dispX) < 0} {
|
| 290 |
+
set dispX $x1
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
if {$oldDispX ne $dispX} {
|
| 294 |
+
set fraction [expr {double($dispX) / double($scrollW)}]
|
| 295 |
+
$canvas xview moveto $fraction
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
|
| 299 |
+
# ----------------------------------------------------------------------
|
| 300 |
+
|
| 301 |
+
# Places the icons in a column-major arrangement.
|
| 302 |
+
#
|
| 303 |
+
method Arrange {} {
|
| 304 |
+
if {![info exists list]} {
|
| 305 |
+
if {[info exists canvas] && [winfo exists $canvas]} {
|
| 306 |
+
set noScroll 1
|
| 307 |
+
$sbar configure -command ""
|
| 308 |
+
}
|
| 309 |
+
return
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
set W [winfo width $canvas]
|
| 313 |
+
set H [winfo height $canvas]
|
| 314 |
+
set pad [expr {[$canvas cget -highlightthickness]+[$canvas cget -bd]}]
|
| 315 |
+
if {$pad < 2} {
|
| 316 |
+
set pad 2
|
| 317 |
+
}
|
| 318 |
+
|
| 319 |
+
incr W [expr {$pad*-2}]
|
| 320 |
+
incr H [expr {$pad*-2}]
|
| 321 |
+
|
| 322 |
+
set dx [expr {$maxIW + $maxTW + 8}]
|
| 323 |
+
if {$maxTH > $maxIH} {
|
| 324 |
+
set dy $maxTH
|
| 325 |
+
} else {
|
| 326 |
+
set dy $maxIH
|
| 327 |
+
}
|
| 328 |
+
incr dy 2
|
| 329 |
+
set shift [expr {$maxIW + 4}]
|
| 330 |
+
|
| 331 |
+
set x [expr {$pad * 2}]
|
| 332 |
+
set y [expr {$pad * 1}] ; # Why * 1 ?
|
| 333 |
+
set usedColumn 0
|
| 334 |
+
foreach sublist $list {
|
| 335 |
+
set usedColumn 1
|
| 336 |
+
lassign $sublist iTag tTag rTag iW iH tW tH
|
| 337 |
+
|
| 338 |
+
set i_dy [expr {($dy - $iH)/2}]
|
| 339 |
+
set t_dy [expr {($dy - $tH)/2}]
|
| 340 |
+
|
| 341 |
+
$canvas coords $iTag $x [expr {$y + $i_dy}]
|
| 342 |
+
$canvas coords $tTag [expr {$x + $shift}] [expr {$y + $t_dy}]
|
| 343 |
+
$canvas coords $rTag $x $y [expr {$x+$dx}] [expr {$y+$dy}]
|
| 344 |
+
|
| 345 |
+
incr y $dy
|
| 346 |
+
if {($y + $dy) > $H} {
|
| 347 |
+
set y [expr {$pad * 1}] ; # *1 ?
|
| 348 |
+
incr x $dx
|
| 349 |
+
set usedColumn 0
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
if {$usedColumn} {
|
| 354 |
+
set sW [expr {$x + $dx}]
|
| 355 |
+
} else {
|
| 356 |
+
set sW $x
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
if {$sW < $W} {
|
| 360 |
+
$canvas configure -scrollregion [list $pad $pad $sW $H]
|
| 361 |
+
$sbar configure -command ""
|
| 362 |
+
$canvas xview moveto 0
|
| 363 |
+
set noScroll 1
|
| 364 |
+
} else {
|
| 365 |
+
$canvas configure -scrollregion [list $pad $pad $sW $H]
|
| 366 |
+
$sbar configure -command [list $canvas xview]
|
| 367 |
+
set noScroll 0
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
set itemsPerColumn [expr {($H-$pad) / $dy}]
|
| 371 |
+
if {$itemsPerColumn < 1} {
|
| 372 |
+
set itemsPerColumn 1
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
my DrawSelection
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
method DrawSelection {} {
|
| 379 |
+
$canvas delete selection
|
| 380 |
+
$canvas itemconfigure selectionText -fill $fill
|
| 381 |
+
$canvas dtag selectionText
|
| 382 |
+
set cbg [ttk::style lookup TEntry -selectbackground focus]
|
| 383 |
+
set cfg [ttk::style lookup TEntry -selectforeground focus]
|
| 384 |
+
foreach item $selection {
|
| 385 |
+
set rTag [lindex $list $item 2]
|
| 386 |
+
foreach {iTag tTag text serial} $itemList($rTag) {
|
| 387 |
+
break
|
| 388 |
+
}
|
| 389 |
+
|
| 390 |
+
set bbox [$canvas bbox $tTag]
|
| 391 |
+
$canvas create rect $bbox -fill $cbg -outline $cbg \
|
| 392 |
+
-tags selection
|
| 393 |
+
$canvas itemconfigure $tTag -fill $cfg -tags selectionText
|
| 394 |
+
}
|
| 395 |
+
$canvas lower selection
|
| 396 |
+
return
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
# Creates an IconList widget by assembling a canvas widget and a
|
| 400 |
+
# scrollbar widget. Sets all the bindings necessary for the IconList's
|
| 401 |
+
# operations.
|
| 402 |
+
#
|
| 403 |
+
method Create {} {
|
| 404 |
+
variable hull
|
| 405 |
+
set sbar [ttk::scrollbar $hull.sbar -orient horizontal -takefocus 0]
|
| 406 |
+
catch {$sbar configure -highlightthickness 0}
|
| 407 |
+
set canvas [canvas $hull.canvas -highlightthick 0 -takefocus 1 \
|
| 408 |
+
-width 400 -height 120 -background white]
|
| 409 |
+
pack $sbar -side bottom -fill x -padx 2 -pady {0 2}
|
| 410 |
+
pack $canvas -expand yes -fill both -padx 2 -pady {2 0}
|
| 411 |
+
|
| 412 |
+
$sbar configure -command [list $canvas xview]
|
| 413 |
+
$canvas configure -xscrollcommand [list $sbar set]
|
| 414 |
+
|
| 415 |
+
# Initializes the max icon/text width and height and other variables
|
| 416 |
+
#
|
| 417 |
+
set maxIW 1
|
| 418 |
+
set maxIH 1
|
| 419 |
+
set maxTW 1
|
| 420 |
+
set maxTH 1
|
| 421 |
+
set numItems 0
|
| 422 |
+
set noScroll 1
|
| 423 |
+
set selection {}
|
| 424 |
+
set index(anchor) ""
|
| 425 |
+
set fill black
|
| 426 |
+
|
| 427 |
+
# Creates the event bindings.
|
| 428 |
+
#
|
| 429 |
+
bind $canvas <Configure> [namespace code {my WhenIdle Arrange}]
|
| 430 |
+
|
| 431 |
+
bind $canvas <Button-1> [namespace code {my Btn1 %x %y}]
|
| 432 |
+
bind $canvas <B1-Motion> [namespace code {my Motion1 %x %y}]
|
| 433 |
+
bind $canvas <B1-Leave> [namespace code {my Leave1 %x %y}]
|
| 434 |
+
bind $canvas <Control-Button-1> [namespace code {my CtrlBtn1 %x %y}]
|
| 435 |
+
bind $canvas <Shift-Button-1> [namespace code {my ShiftBtn1 %x %y}]
|
| 436 |
+
bind $canvas <B1-Enter> [list tk::CancelRepeat]
|
| 437 |
+
bind $canvas <ButtonRelease-1> [list tk::CancelRepeat]
|
| 438 |
+
bind $canvas <Double-ButtonRelease-1> \
|
| 439 |
+
[namespace code {my Double1 %x %y}]
|
| 440 |
+
|
| 441 |
+
bind $canvas <Control-B1-Motion> {;}
|
| 442 |
+
bind $canvas <Shift-B1-Motion> [namespace code {my ShiftMotion1 %x %y}]
|
| 443 |
+
|
| 444 |
+
if {[tk windowingsystem] eq "aqua"} {
|
| 445 |
+
bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel [expr {40 * (%D)}]}]
|
| 446 |
+
bind $canvas <Option-Shift-MouseWheel> [namespace code {my MouseWheel [expr {400 * (%D)}]}]
|
| 447 |
+
bind $canvas <Command-Key> {# nothing}
|
| 448 |
+
bind $canvas <Mod4-Key> {# nothing}
|
| 449 |
+
} else {
|
| 450 |
+
bind $canvas <Shift-MouseWheel> [namespace code {my MouseWheel %D}]
|
| 451 |
+
}
|
| 452 |
+
if {[tk windowingsystem] eq "x11"} {
|
| 453 |
+
bind $canvas <Shift-Button-4> [namespace code {my MouseWheel 120}]
|
| 454 |
+
bind $canvas <Shift-Button-5> [namespace code {my MouseWheel -120}]
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
bind $canvas <<PrevLine>> [namespace code {my UpDown -1}]
|
| 458 |
+
bind $canvas <<NextLine>> [namespace code {my UpDown 1}]
|
| 459 |
+
bind $canvas <<PrevChar>> [namespace code {my LeftRight -1}]
|
| 460 |
+
bind $canvas <<NextChar>> [namespace code {my LeftRight 1}]
|
| 461 |
+
bind $canvas <Return> [namespace code {my ReturnKey}]
|
| 462 |
+
bind $canvas <Key> [namespace code {my KeyPress %A}]
|
| 463 |
+
bind $canvas <Alt-Key> {# nothing}
|
| 464 |
+
bind $canvas <Meta-Key> {# nothing}
|
| 465 |
+
bind $canvas <Control-Key> {# nothing}
|
| 466 |
+
|
| 467 |
+
bind $canvas <FocusIn> [namespace code {my FocusIn}]
|
| 468 |
+
bind $canvas <FocusOut> [namespace code {my FocusOut}]
|
| 469 |
+
|
| 470 |
+
return $w
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
# This procedure is invoked when the mouse leaves an entry window with
|
| 474 |
+
# button 1 down. It scrolls the window up, down, left, or right,
|
| 475 |
+
# depending on where the mouse left the window, and reschedules itself
|
| 476 |
+
# as an "after" command so that the window continues to scroll until the
|
| 477 |
+
# mouse moves back into the window or the mouse button is released.
|
| 478 |
+
#
|
| 479 |
+
method AutoScan {} {
|
| 480 |
+
if {![winfo exists $w]} return
|
| 481 |
+
set x $oldX
|
| 482 |
+
set y $oldY
|
| 483 |
+
if {$noScroll} {
|
| 484 |
+
return
|
| 485 |
+
}
|
| 486 |
+
if {$x >= [winfo width $canvas]} {
|
| 487 |
+
$canvas xview scroll 1 units
|
| 488 |
+
} elseif {$x < 0} {
|
| 489 |
+
$canvas xview scroll -1 units
|
| 490 |
+
} elseif {$y >= [winfo height $canvas]} {
|
| 491 |
+
# do nothing
|
| 492 |
+
} elseif {$y < 0} {
|
| 493 |
+
# do nothing
|
| 494 |
+
} else {
|
| 495 |
+
return
|
| 496 |
+
}
|
| 497 |
+
my Motion1 $x $y
|
| 498 |
+
set ::tk::Priv(afterId) [after 50 [namespace code {my AutoScan}]]
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
# ----------------------------------------------------------------------
|
| 502 |
+
|
| 503 |
+
# Event handlers
|
| 504 |
+
method MouseWheel {amount} {
|
| 505 |
+
if {$noScroll || $::tk_strictMotif} {
|
| 506 |
+
return
|
| 507 |
+
}
|
| 508 |
+
if {$amount > 0} {
|
| 509 |
+
$canvas xview scroll [expr {(-119-$amount) / 120}] units
|
| 510 |
+
} else {
|
| 511 |
+
$canvas xview scroll [expr {-($amount / 120)}] units
|
| 512 |
+
}
|
| 513 |
+
}
|
| 514 |
+
method Btn1 {x y} {
|
| 515 |
+
focus $canvas
|
| 516 |
+
set i [$w index @$x,$y]
|
| 517 |
+
if {$i eq ""} {
|
| 518 |
+
return
|
| 519 |
+
}
|
| 520 |
+
$w selection clear 0 end
|
| 521 |
+
$w selection set $i
|
| 522 |
+
$w selection anchor $i
|
| 523 |
+
}
|
| 524 |
+
method CtrlBtn1 {x y} {
|
| 525 |
+
if {$options(-multiple)} {
|
| 526 |
+
focus $canvas
|
| 527 |
+
set i [$w index @$x,$y]
|
| 528 |
+
if {$i eq ""} {
|
| 529 |
+
return
|
| 530 |
+
}
|
| 531 |
+
if {[$w selection includes $i]} {
|
| 532 |
+
$w selection clear $i
|
| 533 |
+
} else {
|
| 534 |
+
$w selection set $i
|
| 535 |
+
$w selection anchor $i
|
| 536 |
+
}
|
| 537 |
+
}
|
| 538 |
+
}
|
| 539 |
+
method ShiftBtn1 {x y} {
|
| 540 |
+
if {$options(-multiple)} {
|
| 541 |
+
focus $canvas
|
| 542 |
+
set i [$w index @$x,$y]
|
| 543 |
+
if {$i eq ""} {
|
| 544 |
+
return
|
| 545 |
+
}
|
| 546 |
+
if {[$w index anchor] eq ""} {
|
| 547 |
+
$w selection anchor $i
|
| 548 |
+
}
|
| 549 |
+
$w selection clear 0 end
|
| 550 |
+
$w selection set anchor $i
|
| 551 |
+
}
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
# Gets called on button-1 motions
|
| 555 |
+
#
|
| 556 |
+
method Motion1 {x y} {
|
| 557 |
+
set oldX $x
|
| 558 |
+
set oldY $y
|
| 559 |
+
set i [$w index @$x,$y]
|
| 560 |
+
if {$i eq ""} {
|
| 561 |
+
return
|
| 562 |
+
}
|
| 563 |
+
$w selection clear 0 end
|
| 564 |
+
$w selection set $i
|
| 565 |
+
}
|
| 566 |
+
method ShiftMotion1 {x y} {
|
| 567 |
+
set oldX $x
|
| 568 |
+
set oldY $y
|
| 569 |
+
set i [$w index @$x,$y]
|
| 570 |
+
if {$i eq ""} {
|
| 571 |
+
return
|
| 572 |
+
}
|
| 573 |
+
$w selection clear 0 end
|
| 574 |
+
$w selection set anchor $i
|
| 575 |
+
}
|
| 576 |
+
method Double1 {x y} {
|
| 577 |
+
if {[llength $selection]} {
|
| 578 |
+
$w invoke
|
| 579 |
+
}
|
| 580 |
+
}
|
| 581 |
+
method ReturnKey {} {
|
| 582 |
+
$w invoke
|
| 583 |
+
}
|
| 584 |
+
method Leave1 {x y} {
|
| 585 |
+
set oldX $x
|
| 586 |
+
set oldY $y
|
| 587 |
+
my AutoScan
|
| 588 |
+
}
|
| 589 |
+
method FocusIn {} {
|
| 590 |
+
$w state focus
|
| 591 |
+
if {![info exists list]} {
|
| 592 |
+
return
|
| 593 |
+
}
|
| 594 |
+
if {[llength $selection]} {
|
| 595 |
+
my DrawSelection
|
| 596 |
+
}
|
| 597 |
+
}
|
| 598 |
+
method FocusOut {} {
|
| 599 |
+
$w state !focus
|
| 600 |
+
$w selection clear 0 end
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
# Moves the active element up or down by one element
|
| 604 |
+
#
|
| 605 |
+
# Arguments:
|
| 606 |
+
# amount - +1 to move down one item, -1 to move back one item.
|
| 607 |
+
#
|
| 608 |
+
method UpDown amount {
|
| 609 |
+
if {![info exists list]} {
|
| 610 |
+
return
|
| 611 |
+
}
|
| 612 |
+
set curr [$w selection get]
|
| 613 |
+
if {[llength $curr] == 0} {
|
| 614 |
+
set i 0
|
| 615 |
+
} else {
|
| 616 |
+
set i [$w index anchor]
|
| 617 |
+
if {$i eq ""} {
|
| 618 |
+
return
|
| 619 |
+
}
|
| 620 |
+
incr i $amount
|
| 621 |
+
}
|
| 622 |
+
$w selection clear 0 end
|
| 623 |
+
$w selection set $i
|
| 624 |
+
$w selection anchor $i
|
| 625 |
+
$w see $i
|
| 626 |
+
}
|
| 627 |
+
|
| 628 |
+
# Moves the active element left or right by one column
|
| 629 |
+
#
|
| 630 |
+
# Arguments:
|
| 631 |
+
# amount - +1 to move right one column, -1 to move left one
|
| 632 |
+
# column
|
| 633 |
+
#
|
| 634 |
+
method LeftRight amount {
|
| 635 |
+
if {![info exists list]} {
|
| 636 |
+
return
|
| 637 |
+
}
|
| 638 |
+
set curr [$w selection get]
|
| 639 |
+
if {[llength $curr] == 0} {
|
| 640 |
+
set i 0
|
| 641 |
+
} else {
|
| 642 |
+
set i [$w index anchor]
|
| 643 |
+
if {$i eq ""} {
|
| 644 |
+
return
|
| 645 |
+
}
|
| 646 |
+
incr i [expr {$amount * $itemsPerColumn}]
|
| 647 |
+
}
|
| 648 |
+
$w selection clear 0 end
|
| 649 |
+
$w selection set $i
|
| 650 |
+
$w selection anchor $i
|
| 651 |
+
$w see $i
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
# Gets called when user enters an arbitrary key in the listbox.
|
| 655 |
+
#
|
| 656 |
+
method KeyPress key {
|
| 657 |
+
append accel $key
|
| 658 |
+
my Goto $accel
|
| 659 |
+
after cancel $accelCB
|
| 660 |
+
set accelCB [after 500 [namespace code {my Reset}]]
|
| 661 |
+
}
|
| 662 |
+
|
| 663 |
+
method Goto text {
|
| 664 |
+
if {![info exists list]} {
|
| 665 |
+
return
|
| 666 |
+
}
|
| 667 |
+
if {$text eq "" || $numItems == 0} {
|
| 668 |
+
return
|
| 669 |
+
}
|
| 670 |
+
|
| 671 |
+
if {[llength [$w selection get]]} {
|
| 672 |
+
set start [$w index anchor]
|
| 673 |
+
} else {
|
| 674 |
+
set start 0
|
| 675 |
+
}
|
| 676 |
+
set theIndex -1
|
| 677 |
+
set less 0
|
| 678 |
+
set len [string length $text]
|
| 679 |
+
set len0 [expr {$len - 1}]
|
| 680 |
+
set i $start
|
| 681 |
+
|
| 682 |
+
# Search forward until we find a filename whose prefix is a
|
| 683 |
+
# case-insensitive match with $text
|
| 684 |
+
while {1} {
|
| 685 |
+
if {[string equal -nocase -length $len0 $textList($i) $text]} {
|
| 686 |
+
set theIndex $i
|
| 687 |
+
break
|
| 688 |
+
}
|
| 689 |
+
incr i
|
| 690 |
+
if {$i == $numItems} {
|
| 691 |
+
set i 0
|
| 692 |
+
}
|
| 693 |
+
if {$i == $start} {
|
| 694 |
+
break
|
| 695 |
+
}
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
if {$theIndex >= 0} {
|
| 699 |
+
$w selection clear 0 end
|
| 700 |
+
$w selection set $theIndex
|
| 701 |
+
$w selection anchor $theIndex
|
| 702 |
+
$w see $theIndex
|
| 703 |
+
}
|
| 704 |
+
}
|
| 705 |
+
method Reset {} {
|
| 706 |
+
unset -nocomplain accel
|
| 707 |
+
}
|
| 708 |
+
}
|
| 709 |
+
|
| 710 |
+
return
|
| 711 |
+
|
| 712 |
+
# Local Variables:
|
| 713 |
+
# mode: tcl
|
| 714 |
+
# fill-column: 78
|
| 715 |
+
# End:
|
evalkit_llava/lib/tk8.6/mkpsenc.tcl
ADDED
|
@@ -0,0 +1,1488 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mkpsenc.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file generates the postscript prolog used by Tk.
|
| 4 |
+
|
| 5 |
+
namespace eval ::tk {
|
| 6 |
+
# Creates Postscript encoding vector for ISO-8859-1 (could theoretically
|
| 7 |
+
# handle any 8-bit encoding, but Tk never generates characters outside
|
| 8 |
+
# ASCII).
|
| 9 |
+
#
|
| 10 |
+
proc CreatePostscriptEncoding {} {
|
| 11 |
+
variable psglyphs
|
| 12 |
+
# Now check for known. Even if it is known, it can be other than we
|
| 13 |
+
# need. GhostScript seems to be happy with such approach
|
| 14 |
+
set result "\[\n"
|
| 15 |
+
for {set i 0} {$i<256} {incr i 8} {
|
| 16 |
+
for {set j 0} {$j<8} {incr j} {
|
| 17 |
+
set enc [encoding convertfrom "iso8859-1" \
|
| 18 |
+
[format %c [expr {$i+$j}]]]
|
| 19 |
+
catch {
|
| 20 |
+
set hexcode {}
|
| 21 |
+
set hexcode [format %04X [scan $enc %c]]
|
| 22 |
+
}
|
| 23 |
+
if {[info exists psglyphs($hexcode)]} {
|
| 24 |
+
append result "/$psglyphs($hexcode)"
|
| 25 |
+
} else {
|
| 26 |
+
append result "/space"
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
append result "\n"
|
| 30 |
+
}
|
| 31 |
+
append result "\]"
|
| 32 |
+
return $result
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
# List of adobe glyph names. Converted from glyphlist.txt, downloaded from
|
| 36 |
+
# Adobe.
|
| 37 |
+
|
| 38 |
+
variable psglyphs
|
| 39 |
+
array set psglyphs {
|
| 40 |
+
0020 space
|
| 41 |
+
0021 exclam
|
| 42 |
+
0022 quotedbl
|
| 43 |
+
0023 numbersign
|
| 44 |
+
0024 dollar
|
| 45 |
+
0025 percent
|
| 46 |
+
0026 ampersand
|
| 47 |
+
0027 quotesingle
|
| 48 |
+
0028 parenleft
|
| 49 |
+
0029 parenright
|
| 50 |
+
002A asterisk
|
| 51 |
+
002B plus
|
| 52 |
+
002C comma
|
| 53 |
+
002D hyphen
|
| 54 |
+
002E period
|
| 55 |
+
002F slash
|
| 56 |
+
0030 zero
|
| 57 |
+
0031 one
|
| 58 |
+
0032 two
|
| 59 |
+
0033 three
|
| 60 |
+
0034 four
|
| 61 |
+
0035 five
|
| 62 |
+
0036 six
|
| 63 |
+
0037 seven
|
| 64 |
+
0038 eight
|
| 65 |
+
0039 nine
|
| 66 |
+
003A colon
|
| 67 |
+
003B semicolon
|
| 68 |
+
003C less
|
| 69 |
+
003D equal
|
| 70 |
+
003E greater
|
| 71 |
+
003F question
|
| 72 |
+
0040 at
|
| 73 |
+
0041 A
|
| 74 |
+
0042 B
|
| 75 |
+
0043 C
|
| 76 |
+
0044 D
|
| 77 |
+
0045 E
|
| 78 |
+
0046 F
|
| 79 |
+
0047 G
|
| 80 |
+
0048 H
|
| 81 |
+
0049 I
|
| 82 |
+
004A J
|
| 83 |
+
004B K
|
| 84 |
+
004C L
|
| 85 |
+
004D M
|
| 86 |
+
004E N
|
| 87 |
+
004F O
|
| 88 |
+
0050 P
|
| 89 |
+
0051 Q
|
| 90 |
+
0052 R
|
| 91 |
+
0053 S
|
| 92 |
+
0054 T
|
| 93 |
+
0055 U
|
| 94 |
+
0056 V
|
| 95 |
+
0057 W
|
| 96 |
+
0058 X
|
| 97 |
+
0059 Y
|
| 98 |
+
005A Z
|
| 99 |
+
005B bracketleft
|
| 100 |
+
005C backslash
|
| 101 |
+
005D bracketright
|
| 102 |
+
005E asciicircum
|
| 103 |
+
005F underscore
|
| 104 |
+
0060 grave
|
| 105 |
+
0061 a
|
| 106 |
+
0062 b
|
| 107 |
+
0063 c
|
| 108 |
+
0064 d
|
| 109 |
+
0065 e
|
| 110 |
+
0066 f
|
| 111 |
+
0067 g
|
| 112 |
+
0068 h
|
| 113 |
+
0069 i
|
| 114 |
+
006A j
|
| 115 |
+
006B k
|
| 116 |
+
006C l
|
| 117 |
+
006D m
|
| 118 |
+
006E n
|
| 119 |
+
006F o
|
| 120 |
+
0070 p
|
| 121 |
+
0071 q
|
| 122 |
+
0072 r
|
| 123 |
+
0073 s
|
| 124 |
+
0074 t
|
| 125 |
+
0075 u
|
| 126 |
+
0076 v
|
| 127 |
+
0077 w
|
| 128 |
+
0078 x
|
| 129 |
+
0079 y
|
| 130 |
+
007A z
|
| 131 |
+
007B braceleft
|
| 132 |
+
007C bar
|
| 133 |
+
007D braceright
|
| 134 |
+
007E asciitilde
|
| 135 |
+
00A0 space
|
| 136 |
+
00A1 exclamdown
|
| 137 |
+
00A2 cent
|
| 138 |
+
00A3 sterling
|
| 139 |
+
00A4 currency
|
| 140 |
+
00A5 yen
|
| 141 |
+
00A6 brokenbar
|
| 142 |
+
00A7 section
|
| 143 |
+
00A8 dieresis
|
| 144 |
+
00A9 copyright
|
| 145 |
+
00AA ordfeminine
|
| 146 |
+
00AB guillemotleft
|
| 147 |
+
00AC logicalnot
|
| 148 |
+
00AD hyphen
|
| 149 |
+
00AE registered
|
| 150 |
+
00AF macron
|
| 151 |
+
00B0 degree
|
| 152 |
+
00B1 plusminus
|
| 153 |
+
00B2 twosuperior
|
| 154 |
+
00B3 threesuperior
|
| 155 |
+
00B4 acute
|
| 156 |
+
00B5 mu
|
| 157 |
+
00B6 paragraph
|
| 158 |
+
00B7 periodcentered
|
| 159 |
+
00B8 cedilla
|
| 160 |
+
00B9 onesuperior
|
| 161 |
+
00BA ordmasculine
|
| 162 |
+
00BB guillemotright
|
| 163 |
+
00BC onequarter
|
| 164 |
+
00BD onehalf
|
| 165 |
+
00BE threequarters
|
| 166 |
+
00BF questiondown
|
| 167 |
+
00C0 Agrave
|
| 168 |
+
00C1 Aacute
|
| 169 |
+
00C2 Acircumflex
|
| 170 |
+
00C3 Atilde
|
| 171 |
+
00C4 Adieresis
|
| 172 |
+
00C5 Aring
|
| 173 |
+
00C6 AE
|
| 174 |
+
00C7 Ccedilla
|
| 175 |
+
00C8 Egrave
|
| 176 |
+
00C9 Eacute
|
| 177 |
+
00CA Ecircumflex
|
| 178 |
+
00CB Edieresis
|
| 179 |
+
00CC Igrave
|
| 180 |
+
00CD Iacute
|
| 181 |
+
00CE Icircumflex
|
| 182 |
+
00CF Idieresis
|
| 183 |
+
00D0 Eth
|
| 184 |
+
00D1 Ntilde
|
| 185 |
+
00D2 Ograve
|
| 186 |
+
00D3 Oacute
|
| 187 |
+
00D4 Ocircumflex
|
| 188 |
+
00D5 Otilde
|
| 189 |
+
00D6 Odieresis
|
| 190 |
+
00D7 multiply
|
| 191 |
+
00D8 Oslash
|
| 192 |
+
00D9 Ugrave
|
| 193 |
+
00DA Uacute
|
| 194 |
+
00DB Ucircumflex
|
| 195 |
+
00DC Udieresis
|
| 196 |
+
00DD Yacute
|
| 197 |
+
00DE Thorn
|
| 198 |
+
00DF germandbls
|
| 199 |
+
00E0 agrave
|
| 200 |
+
00E1 aacute
|
| 201 |
+
00E2 acircumflex
|
| 202 |
+
00E3 atilde
|
| 203 |
+
00E4 adieresis
|
| 204 |
+
00E5 aring
|
| 205 |
+
00E6 ae
|
| 206 |
+
00E7 ccedilla
|
| 207 |
+
00E8 egrave
|
| 208 |
+
00E9 eacute
|
| 209 |
+
00EA ecircumflex
|
| 210 |
+
00EB edieresis
|
| 211 |
+
00EC igrave
|
| 212 |
+
00ED iacute
|
| 213 |
+
00EE icircumflex
|
| 214 |
+
00EF idieresis
|
| 215 |
+
00F0 eth
|
| 216 |
+
00F1 ntilde
|
| 217 |
+
00F2 ograve
|
| 218 |
+
00F3 oacute
|
| 219 |
+
00F4 ocircumflex
|
| 220 |
+
00F5 otilde
|
| 221 |
+
00F6 odieresis
|
| 222 |
+
00F7 divide
|
| 223 |
+
00F8 oslash
|
| 224 |
+
00F9 ugrave
|
| 225 |
+
00FA uacute
|
| 226 |
+
00FB ucircumflex
|
| 227 |
+
00FC udieresis
|
| 228 |
+
00FD yacute
|
| 229 |
+
00FE thorn
|
| 230 |
+
00FF ydieresis
|
| 231 |
+
0100 Amacron
|
| 232 |
+
0101 amacron
|
| 233 |
+
0102 Abreve
|
| 234 |
+
0103 abreve
|
| 235 |
+
0104 Aogonek
|
| 236 |
+
0105 aogonek
|
| 237 |
+
0106 Cacute
|
| 238 |
+
0107 cacute
|
| 239 |
+
0108 Ccircumflex
|
| 240 |
+
0109 ccircumflex
|
| 241 |
+
010A Cdotaccent
|
| 242 |
+
010B cdotaccent
|
| 243 |
+
010C Ccaron
|
| 244 |
+
010D ccaron
|
| 245 |
+
010E Dcaron
|
| 246 |
+
010F dcaron
|
| 247 |
+
0110 Dcroat
|
| 248 |
+
0111 dcroat
|
| 249 |
+
0112 Emacron
|
| 250 |
+
0113 emacron
|
| 251 |
+
0114 Ebreve
|
| 252 |
+
0115 ebreve
|
| 253 |
+
0116 Edotaccent
|
| 254 |
+
0117 edotaccent
|
| 255 |
+
0118 Eogonek
|
| 256 |
+
0119 eogonek
|
| 257 |
+
011A Ecaron
|
| 258 |
+
011B ecaron
|
| 259 |
+
011C Gcircumflex
|
| 260 |
+
011D gcircumflex
|
| 261 |
+
011E Gbreve
|
| 262 |
+
011F gbreve
|
| 263 |
+
0120 Gdotaccent
|
| 264 |
+
0121 gdotaccent
|
| 265 |
+
0122 Gcommaaccent
|
| 266 |
+
0123 gcommaaccent
|
| 267 |
+
0124 Hcircumflex
|
| 268 |
+
0125 hcircumflex
|
| 269 |
+
0126 Hbar
|
| 270 |
+
0127 hbar
|
| 271 |
+
0128 Itilde
|
| 272 |
+
0129 itilde
|
| 273 |
+
012A Imacron
|
| 274 |
+
012B imacron
|
| 275 |
+
012C Ibreve
|
| 276 |
+
012D ibreve
|
| 277 |
+
012E Iogonek
|
| 278 |
+
012F iogonek
|
| 279 |
+
0130 Idotaccent
|
| 280 |
+
0131 dotlessi
|
| 281 |
+
0132 IJ
|
| 282 |
+
0133 ij
|
| 283 |
+
0134 Jcircumflex
|
| 284 |
+
0135 jcircumflex
|
| 285 |
+
0136 Kcommaaccent
|
| 286 |
+
0137 kcommaaccent
|
| 287 |
+
0138 kgreenlandic
|
| 288 |
+
0139 Lacute
|
| 289 |
+
013A lacute
|
| 290 |
+
013B Lcommaaccent
|
| 291 |
+
013C lcommaaccent
|
| 292 |
+
013D Lcaron
|
| 293 |
+
013E lcaron
|
| 294 |
+
013F Ldot
|
| 295 |
+
0140 ldot
|
| 296 |
+
0141 Lslash
|
| 297 |
+
0142 lslash
|
| 298 |
+
0143 Nacute
|
| 299 |
+
0144 nacute
|
| 300 |
+
0145 Ncommaaccent
|
| 301 |
+
0146 ncommaaccent
|
| 302 |
+
0147 Ncaron
|
| 303 |
+
0148 ncaron
|
| 304 |
+
0149 napostrophe
|
| 305 |
+
014A Eng
|
| 306 |
+
014B eng
|
| 307 |
+
014C Omacron
|
| 308 |
+
014D omacron
|
| 309 |
+
014E Obreve
|
| 310 |
+
014F obreve
|
| 311 |
+
0150 Ohungarumlaut
|
| 312 |
+
0151 ohungarumlaut
|
| 313 |
+
0152 OE
|
| 314 |
+
0153 oe
|
| 315 |
+
0154 Racute
|
| 316 |
+
0155 racute
|
| 317 |
+
0156 Rcommaaccent
|
| 318 |
+
0157 rcommaaccent
|
| 319 |
+
0158 Rcaron
|
| 320 |
+
0159 rcaron
|
| 321 |
+
015A Sacute
|
| 322 |
+
015B sacute
|
| 323 |
+
015C Scircumflex
|
| 324 |
+
015D scircumflex
|
| 325 |
+
015E Scedilla
|
| 326 |
+
015F scedilla
|
| 327 |
+
0160 Scaron
|
| 328 |
+
0161 scaron
|
| 329 |
+
0162 Tcommaaccent
|
| 330 |
+
0163 tcommaaccent
|
| 331 |
+
0164 Tcaron
|
| 332 |
+
0165 tcaron
|
| 333 |
+
0166 Tbar
|
| 334 |
+
0167 tbar
|
| 335 |
+
0168 Utilde
|
| 336 |
+
0169 utilde
|
| 337 |
+
016A Umacron
|
| 338 |
+
016B umacron
|
| 339 |
+
016C Ubreve
|
| 340 |
+
016D ubreve
|
| 341 |
+
016E Uring
|
| 342 |
+
016F uring
|
| 343 |
+
0170 Uhungarumlaut
|
| 344 |
+
0171 uhungarumlaut
|
| 345 |
+
0172 Uogonek
|
| 346 |
+
0173 uogonek
|
| 347 |
+
0174 Wcircumflex
|
| 348 |
+
0175 wcircumflex
|
| 349 |
+
0176 Ycircumflex
|
| 350 |
+
0177 ycircumflex
|
| 351 |
+
0178 Ydieresis
|
| 352 |
+
0179 Zacute
|
| 353 |
+
017A zacute
|
| 354 |
+
017B Zdotaccent
|
| 355 |
+
017C zdotaccent
|
| 356 |
+
017D Zcaron
|
| 357 |
+
017E zcaron
|
| 358 |
+
017F longs
|
| 359 |
+
0192 florin
|
| 360 |
+
01A0 Ohorn
|
| 361 |
+
01A1 ohorn
|
| 362 |
+
01AF Uhorn
|
| 363 |
+
01B0 uhorn
|
| 364 |
+
01E6 Gcaron
|
| 365 |
+
01E7 gcaron
|
| 366 |
+
01FA Aringacute
|
| 367 |
+
01FB aringacute
|
| 368 |
+
01FC AEacute
|
| 369 |
+
01FD aeacute
|
| 370 |
+
01FE Oslashacute
|
| 371 |
+
01FF oslashacute
|
| 372 |
+
0218 Scommaaccent
|
| 373 |
+
0219 scommaaccent
|
| 374 |
+
021A Tcommaaccent
|
| 375 |
+
021B tcommaaccent
|
| 376 |
+
02BC afii57929
|
| 377 |
+
02BD afii64937
|
| 378 |
+
02C6 circumflex
|
| 379 |
+
02C7 caron
|
| 380 |
+
02C9 macron
|
| 381 |
+
02D8 breve
|
| 382 |
+
02D9 dotaccent
|
| 383 |
+
02DA ring
|
| 384 |
+
02DB ogonek
|
| 385 |
+
02DC tilde
|
| 386 |
+
02DD hungarumlaut
|
| 387 |
+
0300 gravecomb
|
| 388 |
+
0301 acutecomb
|
| 389 |
+
0303 tildecomb
|
| 390 |
+
0309 hookabovecomb
|
| 391 |
+
0323 dotbelowcomb
|
| 392 |
+
0384 tonos
|
| 393 |
+
0385 dieresistonos
|
| 394 |
+
0386 Alphatonos
|
| 395 |
+
0387 anoteleia
|
| 396 |
+
0388 Epsilontonos
|
| 397 |
+
0389 Etatonos
|
| 398 |
+
038A Iotatonos
|
| 399 |
+
038C Omicrontonos
|
| 400 |
+
038E Upsilontonos
|
| 401 |
+
038F Omegatonos
|
| 402 |
+
0390 iotadieresistonos
|
| 403 |
+
0391 Alpha
|
| 404 |
+
0392 Beta
|
| 405 |
+
0393 Gamma
|
| 406 |
+
0394 Delta
|
| 407 |
+
0395 Epsilon
|
| 408 |
+
0396 Zeta
|
| 409 |
+
0397 Eta
|
| 410 |
+
0398 Theta
|
| 411 |
+
0399 Iota
|
| 412 |
+
039A Kappa
|
| 413 |
+
039B Lambda
|
| 414 |
+
039C Mu
|
| 415 |
+
039D Nu
|
| 416 |
+
039E Xi
|
| 417 |
+
039F Omicron
|
| 418 |
+
03A0 Pi
|
| 419 |
+
03A1 Rho
|
| 420 |
+
03A3 Sigma
|
| 421 |
+
03A4 Tau
|
| 422 |
+
03A5 Upsilon
|
| 423 |
+
03A6 Phi
|
| 424 |
+
03A7 Chi
|
| 425 |
+
03A8 Psi
|
| 426 |
+
03A9 Omega
|
| 427 |
+
03AA Iotadieresis
|
| 428 |
+
03AB Upsilondieresis
|
| 429 |
+
03AC alphatonos
|
| 430 |
+
03AD epsilontonos
|
| 431 |
+
03AE etatonos
|
| 432 |
+
03AF iotatonos
|
| 433 |
+
03B0 upsilondieresistonos
|
| 434 |
+
03B1 alpha
|
| 435 |
+
03B2 beta
|
| 436 |
+
03B3 gamma
|
| 437 |
+
03B4 delta
|
| 438 |
+
03B5 epsilon
|
| 439 |
+
03B6 zeta
|
| 440 |
+
03B7 eta
|
| 441 |
+
03B8 theta
|
| 442 |
+
03B9 iota
|
| 443 |
+
03BA kappa
|
| 444 |
+
03BB lambda
|
| 445 |
+
03BC mu
|
| 446 |
+
03BD nu
|
| 447 |
+
03BE xi
|
| 448 |
+
03BF omicron
|
| 449 |
+
03C0 pi
|
| 450 |
+
03C1 rho
|
| 451 |
+
03C2 sigma1
|
| 452 |
+
03C3 sigma
|
| 453 |
+
03C4 tau
|
| 454 |
+
03C5 upsilon
|
| 455 |
+
03C6 phi
|
| 456 |
+
03C7 chi
|
| 457 |
+
03C8 psi
|
| 458 |
+
03C9 omega
|
| 459 |
+
03CA iotadieresis
|
| 460 |
+
03CB upsilondieresis
|
| 461 |
+
03CC omicrontonos
|
| 462 |
+
03CD upsilontonos
|
| 463 |
+
03CE omegatonos
|
| 464 |
+
03D1 theta1
|
| 465 |
+
03D2 Upsilon1
|
| 466 |
+
03D5 phi1
|
| 467 |
+
03D6 omega1
|
| 468 |
+
0401 afii10023
|
| 469 |
+
0402 afii10051
|
| 470 |
+
0403 afii10052
|
| 471 |
+
0404 afii10053
|
| 472 |
+
0405 afii10054
|
| 473 |
+
0406 afii10055
|
| 474 |
+
0407 afii10056
|
| 475 |
+
0408 afii10057
|
| 476 |
+
0409 afii10058
|
| 477 |
+
040A afii10059
|
| 478 |
+
040B afii10060
|
| 479 |
+
040C afii10061
|
| 480 |
+
040E afii10062
|
| 481 |
+
040F afii10145
|
| 482 |
+
0410 afii10017
|
| 483 |
+
0411 afii10018
|
| 484 |
+
0412 afii10019
|
| 485 |
+
0413 afii10020
|
| 486 |
+
0414 afii10021
|
| 487 |
+
0415 afii10022
|
| 488 |
+
0416 afii10024
|
| 489 |
+
0417 afii10025
|
| 490 |
+
0418 afii10026
|
| 491 |
+
0419 afii10027
|
| 492 |
+
041A afii10028
|
| 493 |
+
041B afii10029
|
| 494 |
+
041C afii10030
|
| 495 |
+
041D afii10031
|
| 496 |
+
041E afii10032
|
| 497 |
+
041F afii10033
|
| 498 |
+
0420 afii10034
|
| 499 |
+
0421 afii10035
|
| 500 |
+
0422 afii10036
|
| 501 |
+
0423 afii10037
|
| 502 |
+
0424 afii10038
|
| 503 |
+
0425 afii10039
|
| 504 |
+
0426 afii10040
|
| 505 |
+
0427 afii10041
|
| 506 |
+
0428 afii10042
|
| 507 |
+
0429 afii10043
|
| 508 |
+
042A afii10044
|
| 509 |
+
042B afii10045
|
| 510 |
+
042C afii10046
|
| 511 |
+
042D afii10047
|
| 512 |
+
042E afii10048
|
| 513 |
+
042F afii10049
|
| 514 |
+
0430 afii10065
|
| 515 |
+
0431 afii10066
|
| 516 |
+
0432 afii10067
|
| 517 |
+
0433 afii10068
|
| 518 |
+
0434 afii10069
|
| 519 |
+
0435 afii10070
|
| 520 |
+
0436 afii10072
|
| 521 |
+
0437 afii10073
|
| 522 |
+
0438 afii10074
|
| 523 |
+
0439 afii10075
|
| 524 |
+
043A afii10076
|
| 525 |
+
043B afii10077
|
| 526 |
+
043C afii10078
|
| 527 |
+
043D afii10079
|
| 528 |
+
043E afii10080
|
| 529 |
+
043F afii10081
|
| 530 |
+
0440 afii10082
|
| 531 |
+
0441 afii10083
|
| 532 |
+
0442 afii10084
|
| 533 |
+
0443 afii10085
|
| 534 |
+
0444 afii10086
|
| 535 |
+
0445 afii10087
|
| 536 |
+
0446 afii10088
|
| 537 |
+
0447 afii10089
|
| 538 |
+
0448 afii10090
|
| 539 |
+
0449 afii10091
|
| 540 |
+
044A afii10092
|
| 541 |
+
044B afii10093
|
| 542 |
+
044C afii10094
|
| 543 |
+
044D afii10095
|
| 544 |
+
044E afii10096
|
| 545 |
+
044F afii10097
|
| 546 |
+
0451 afii10071
|
| 547 |
+
0452 afii10099
|
| 548 |
+
0453 afii10100
|
| 549 |
+
0454 afii10101
|
| 550 |
+
0455 afii10102
|
| 551 |
+
0456 afii10103
|
| 552 |
+
0457 afii10104
|
| 553 |
+
0458 afii10105
|
| 554 |
+
0459 afii10106
|
| 555 |
+
045A afii10107
|
| 556 |
+
045B afii10108
|
| 557 |
+
045C afii10109
|
| 558 |
+
045E afii10110
|
| 559 |
+
045F afii10193
|
| 560 |
+
0462 afii10146
|
| 561 |
+
0463 afii10194
|
| 562 |
+
0472 afii10147
|
| 563 |
+
0473 afii10195
|
| 564 |
+
0474 afii10148
|
| 565 |
+
0475 afii10196
|
| 566 |
+
0490 afii10050
|
| 567 |
+
0491 afii10098
|
| 568 |
+
04D9 afii10846
|
| 569 |
+
05B0 afii57799
|
| 570 |
+
05B1 afii57801
|
| 571 |
+
05B2 afii57800
|
| 572 |
+
05B3 afii57802
|
| 573 |
+
05B4 afii57793
|
| 574 |
+
05B5 afii57794
|
| 575 |
+
05B6 afii57795
|
| 576 |
+
05B7 afii57798
|
| 577 |
+
05B8 afii57797
|
| 578 |
+
05B9 afii57806
|
| 579 |
+
05BB afii57796
|
| 580 |
+
05BC afii57807
|
| 581 |
+
05BD afii57839
|
| 582 |
+
05BE afii57645
|
| 583 |
+
05BF afii57841
|
| 584 |
+
05C0 afii57842
|
| 585 |
+
05C1 afii57804
|
| 586 |
+
05C2 afii57803
|
| 587 |
+
05C3 afii57658
|
| 588 |
+
05D0 afii57664
|
| 589 |
+
05D1 afii57665
|
| 590 |
+
05D2 afii57666
|
| 591 |
+
05D3 afii57667
|
| 592 |
+
05D4 afii57668
|
| 593 |
+
05D5 afii57669
|
| 594 |
+
05D6 afii57670
|
| 595 |
+
05D7 afii57671
|
| 596 |
+
05D8 afii57672
|
| 597 |
+
05D9 afii57673
|
| 598 |
+
05DA afii57674
|
| 599 |
+
05DB afii57675
|
| 600 |
+
05DC afii57676
|
| 601 |
+
05DD afii57677
|
| 602 |
+
05DE afii57678
|
| 603 |
+
05DF afii57679
|
| 604 |
+
05E0 afii57680
|
| 605 |
+
05E1 afii57681
|
| 606 |
+
05E2 afii57682
|
| 607 |
+
05E3 afii57683
|
| 608 |
+
05E4 afii57684
|
| 609 |
+
05E5 afii57685
|
| 610 |
+
05E6 afii57686
|
| 611 |
+
05E7 afii57687
|
| 612 |
+
05E8 afii57688
|
| 613 |
+
05E9 afii57689
|
| 614 |
+
05EA afii57690
|
| 615 |
+
05F0 afii57716
|
| 616 |
+
05F1 afii57717
|
| 617 |
+
05F2 afii57718
|
| 618 |
+
060C afii57388
|
| 619 |
+
061B afii57403
|
| 620 |
+
061F afii57407
|
| 621 |
+
0621 afii57409
|
| 622 |
+
0622 afii57410
|
| 623 |
+
0623 afii57411
|
| 624 |
+
0624 afii57412
|
| 625 |
+
0625 afii57413
|
| 626 |
+
0626 afii57414
|
| 627 |
+
0627 afii57415
|
| 628 |
+
0628 afii57416
|
| 629 |
+
0629 afii57417
|
| 630 |
+
062A afii57418
|
| 631 |
+
062B afii57419
|
| 632 |
+
062C afii57420
|
| 633 |
+
062D afii57421
|
| 634 |
+
062E afii57422
|
| 635 |
+
062F afii57423
|
| 636 |
+
0630 afii57424
|
| 637 |
+
0631 afii57425
|
| 638 |
+
0632 afii57426
|
| 639 |
+
0633 afii57427
|
| 640 |
+
0634 afii57428
|
| 641 |
+
0635 afii57429
|
| 642 |
+
0636 afii57430
|
| 643 |
+
0637 afii57431
|
| 644 |
+
0638 afii57432
|
| 645 |
+
0639 afii57433
|
| 646 |
+
063A afii57434
|
| 647 |
+
0640 afii57440
|
| 648 |
+
0641 afii57441
|
| 649 |
+
0642 afii57442
|
| 650 |
+
0643 afii57443
|
| 651 |
+
0644 afii57444
|
| 652 |
+
0645 afii57445
|
| 653 |
+
0646 afii57446
|
| 654 |
+
0647 afii57470
|
| 655 |
+
0648 afii57448
|
| 656 |
+
0649 afii57449
|
| 657 |
+
064A afii57450
|
| 658 |
+
064B afii57451
|
| 659 |
+
064C afii57452
|
| 660 |
+
064D afii57453
|
| 661 |
+
064E afii57454
|
| 662 |
+
064F afii57455
|
| 663 |
+
0650 afii57456
|
| 664 |
+
0651 afii57457
|
| 665 |
+
0652 afii57458
|
| 666 |
+
0660 afii57392
|
| 667 |
+
0661 afii57393
|
| 668 |
+
0662 afii57394
|
| 669 |
+
0663 afii57395
|
| 670 |
+
0664 afii57396
|
| 671 |
+
0665 afii57397
|
| 672 |
+
0666 afii57398
|
| 673 |
+
0667 afii57399
|
| 674 |
+
0668 afii57400
|
| 675 |
+
0669 afii57401
|
| 676 |
+
066A afii57381
|
| 677 |
+
066D afii63167
|
| 678 |
+
0679 afii57511
|
| 679 |
+
067E afii57506
|
| 680 |
+
0686 afii57507
|
| 681 |
+
0688 afii57512
|
| 682 |
+
0691 afii57513
|
| 683 |
+
0698 afii57508
|
| 684 |
+
06A4 afii57505
|
| 685 |
+
06AF afii57509
|
| 686 |
+
06BA afii57514
|
| 687 |
+
06D2 afii57519
|
| 688 |
+
06D5 afii57534
|
| 689 |
+
1E80 Wgrave
|
| 690 |
+
1E81 wgrave
|
| 691 |
+
1E82 Wacute
|
| 692 |
+
1E83 wacute
|
| 693 |
+
1E84 Wdieresis
|
| 694 |
+
1E85 wdieresis
|
| 695 |
+
1EF2 Ygrave
|
| 696 |
+
1EF3 ygrave
|
| 697 |
+
200C afii61664
|
| 698 |
+
200D afii301
|
| 699 |
+
200E afii299
|
| 700 |
+
200F afii300
|
| 701 |
+
2012 figuredash
|
| 702 |
+
2013 endash
|
| 703 |
+
2014 emdash
|
| 704 |
+
2015 afii00208
|
| 705 |
+
2017 underscoredbl
|
| 706 |
+
2018 quoteleft
|
| 707 |
+
2019 quoteright
|
| 708 |
+
201A quotesinglbase
|
| 709 |
+
201B quotereversed
|
| 710 |
+
201C quotedblleft
|
| 711 |
+
201D quotedblright
|
| 712 |
+
201E quotedblbase
|
| 713 |
+
2020 dagger
|
| 714 |
+
2021 daggerdbl
|
| 715 |
+
2022 bullet
|
| 716 |
+
2024 onedotenleader
|
| 717 |
+
2025 twodotenleader
|
| 718 |
+
2026 ellipsis
|
| 719 |
+
202C afii61573
|
| 720 |
+
202D afii61574
|
| 721 |
+
202E afii61575
|
| 722 |
+
2030 perthousand
|
| 723 |
+
2032 minute
|
| 724 |
+
2033 second
|
| 725 |
+
2039 guilsinglleft
|
| 726 |
+
203A guilsinglright
|
| 727 |
+
203C exclamdbl
|
| 728 |
+
2044 fraction
|
| 729 |
+
2070 zerosuperior
|
| 730 |
+
2074 foursuperior
|
| 731 |
+
2075 fivesuperior
|
| 732 |
+
2076 sixsuperior
|
| 733 |
+
2077 sevensuperior
|
| 734 |
+
2078 eightsuperior
|
| 735 |
+
2079 ninesuperior
|
| 736 |
+
207D parenleftsuperior
|
| 737 |
+
207E parenrightsuperior
|
| 738 |
+
207F nsuperior
|
| 739 |
+
2080 zeroinferior
|
| 740 |
+
2081 oneinferior
|
| 741 |
+
2082 twoinferior
|
| 742 |
+
2083 threeinferior
|
| 743 |
+
2084 fourinferior
|
| 744 |
+
2085 fiveinferior
|
| 745 |
+
2086 sixinferior
|
| 746 |
+
2087 seveninferior
|
| 747 |
+
2088 eightinferior
|
| 748 |
+
2089 nineinferior
|
| 749 |
+
208D parenleftinferior
|
| 750 |
+
208E parenrightinferior
|
| 751 |
+
20A1 colonmonetary
|
| 752 |
+
20A3 franc
|
| 753 |
+
20A4 lira
|
| 754 |
+
20A7 peseta
|
| 755 |
+
20AA afii57636
|
| 756 |
+
20AB dong
|
| 757 |
+
20AC Euro
|
| 758 |
+
2105 afii61248
|
| 759 |
+
2111 Ifraktur
|
| 760 |
+
2113 afii61289
|
| 761 |
+
2116 afii61352
|
| 762 |
+
2118 weierstrass
|
| 763 |
+
211C Rfraktur
|
| 764 |
+
211E prescription
|
| 765 |
+
2122 trademark
|
| 766 |
+
2126 Omega
|
| 767 |
+
212E estimated
|
| 768 |
+
2135 aleph
|
| 769 |
+
2153 onethird
|
| 770 |
+
2154 twothirds
|
| 771 |
+
215B oneeighth
|
| 772 |
+
215C threeeighths
|
| 773 |
+
215D fiveeighths
|
| 774 |
+
215E seveneighths
|
| 775 |
+
2190 arrowleft
|
| 776 |
+
2191 arrowup
|
| 777 |
+
2192 arrowright
|
| 778 |
+
2193 arrowdown
|
| 779 |
+
2194 arrowboth
|
| 780 |
+
2195 arrowupdn
|
| 781 |
+
21A8 arrowupdnbse
|
| 782 |
+
21B5 carriagereturn
|
| 783 |
+
21D0 arrowdblleft
|
| 784 |
+
21D1 arrowdblup
|
| 785 |
+
21D2 arrowdblright
|
| 786 |
+
21D3 arrowdbldown
|
| 787 |
+
21D4 arrowdblboth
|
| 788 |
+
2200 universal
|
| 789 |
+
2202 partialdiff
|
| 790 |
+
2203 existential
|
| 791 |
+
2205 emptyset
|
| 792 |
+
2206 Delta
|
| 793 |
+
2207 gradient
|
| 794 |
+
2208 element
|
| 795 |
+
2209 notelement
|
| 796 |
+
220B suchthat
|
| 797 |
+
220F product
|
| 798 |
+
2211 summation
|
| 799 |
+
2212 minus
|
| 800 |
+
2215 fraction
|
| 801 |
+
2217 asteriskmath
|
| 802 |
+
2219 periodcentered
|
| 803 |
+
221A radical
|
| 804 |
+
221D proportional
|
| 805 |
+
221E infinity
|
| 806 |
+
221F orthogonal
|
| 807 |
+
2220 angle
|
| 808 |
+
2227 logicaland
|
| 809 |
+
2228 logicalor
|
| 810 |
+
2229 intersection
|
| 811 |
+
222A union
|
| 812 |
+
222B integral
|
| 813 |
+
2234 therefore
|
| 814 |
+
223C similar
|
| 815 |
+
2245 congruent
|
| 816 |
+
2248 approxequal
|
| 817 |
+
2260 notequal
|
| 818 |
+
2261 equivalence
|
| 819 |
+
2264 lessequal
|
| 820 |
+
2265 greaterequal
|
| 821 |
+
2282 propersubset
|
| 822 |
+
2283 propersuperset
|
| 823 |
+
2284 notsubset
|
| 824 |
+
2286 reflexsubset
|
| 825 |
+
2287 reflexsuperset
|
| 826 |
+
2295 circleplus
|
| 827 |
+
2297 circlemultiply
|
| 828 |
+
22A5 perpendicular
|
| 829 |
+
22C5 dotmath
|
| 830 |
+
2302 house
|
| 831 |
+
2310 revlogicalnot
|
| 832 |
+
2320 integraltp
|
| 833 |
+
2321 integralbt
|
| 834 |
+
2329 angleleft
|
| 835 |
+
232A angleright
|
| 836 |
+
2500 SF100000
|
| 837 |
+
2502 SF110000
|
| 838 |
+
250C SF010000
|
| 839 |
+
2510 SF030000
|
| 840 |
+
2514 SF020000
|
| 841 |
+
2518 SF040000
|
| 842 |
+
251C SF080000
|
| 843 |
+
2524 SF090000
|
| 844 |
+
252C SF060000
|
| 845 |
+
2534 SF070000
|
| 846 |
+
253C SF050000
|
| 847 |
+
2550 SF430000
|
| 848 |
+
2551 SF240000
|
| 849 |
+
2552 SF510000
|
| 850 |
+
2553 SF520000
|
| 851 |
+
2554 SF390000
|
| 852 |
+
2555 SF220000
|
| 853 |
+
2556 SF210000
|
| 854 |
+
2557 SF250000
|
| 855 |
+
2558 SF500000
|
| 856 |
+
2559 SF490000
|
| 857 |
+
255A SF380000
|
| 858 |
+
255B SF280000
|
| 859 |
+
255C SF270000
|
| 860 |
+
255D SF260000
|
| 861 |
+
255E SF360000
|
| 862 |
+
255F SF370000
|
| 863 |
+
2560 SF420000
|
| 864 |
+
2561 SF190000
|
| 865 |
+
2562 SF200000
|
| 866 |
+
2563 SF230000
|
| 867 |
+
2564 SF470000
|
| 868 |
+
2565 SF480000
|
| 869 |
+
2566 SF410000
|
| 870 |
+
2567 SF450000
|
| 871 |
+
2568 SF460000
|
| 872 |
+
2569 SF400000
|
| 873 |
+
256A SF540000
|
| 874 |
+
256B SF530000
|
| 875 |
+
256C SF440000
|
| 876 |
+
2580 upblock
|
| 877 |
+
2584 dnblock
|
| 878 |
+
2588 block
|
| 879 |
+
258C lfblock
|
| 880 |
+
2590 rtblock
|
| 881 |
+
2591 ltshade
|
| 882 |
+
2592 shade
|
| 883 |
+
2593 dkshade
|
| 884 |
+
25A0 filledbox
|
| 885 |
+
25A1 H22073
|
| 886 |
+
25AA H18543
|
| 887 |
+
25AB H18551
|
| 888 |
+
25AC filledrect
|
| 889 |
+
25B2 triagup
|
| 890 |
+
25BA triagrt
|
| 891 |
+
25BC triagdn
|
| 892 |
+
25C4 triaglf
|
| 893 |
+
25CA lozenge
|
| 894 |
+
25CB circle
|
| 895 |
+
25CF H18533
|
| 896 |
+
25D8 invbullet
|
| 897 |
+
25D9 invcircle
|
| 898 |
+
25E6 openbullet
|
| 899 |
+
263A smileface
|
| 900 |
+
263B invsmileface
|
| 901 |
+
263C sun
|
| 902 |
+
2640 female
|
| 903 |
+
2642 male
|
| 904 |
+
2660 spade
|
| 905 |
+
2663 club
|
| 906 |
+
2665 heart
|
| 907 |
+
2666 diamond
|
| 908 |
+
266A musicalnote
|
| 909 |
+
266B musicalnotedbl
|
| 910 |
+
F6BE dotlessj
|
| 911 |
+
F6BF LL
|
| 912 |
+
F6C0 ll
|
| 913 |
+
F6C1 Scedilla
|
| 914 |
+
F6C2 scedilla
|
| 915 |
+
F6C3 commaaccent
|
| 916 |
+
F6C4 afii10063
|
| 917 |
+
F6C5 afii10064
|
| 918 |
+
F6C6 afii10192
|
| 919 |
+
F6C7 afii10831
|
| 920 |
+
F6C8 afii10832
|
| 921 |
+
F6C9 Acute
|
| 922 |
+
F6CA Caron
|
| 923 |
+
F6CB Dieresis
|
| 924 |
+
F6CC DieresisAcute
|
| 925 |
+
F6CD DieresisGrave
|
| 926 |
+
F6CE Grave
|
| 927 |
+
F6CF Hungarumlaut
|
| 928 |
+
F6D0 Macron
|
| 929 |
+
F6D1 cyrBreve
|
| 930 |
+
F6D2 cyrFlex
|
| 931 |
+
F6D3 dblGrave
|
| 932 |
+
F6D4 cyrbreve
|
| 933 |
+
F6D5 cyrflex
|
| 934 |
+
F6D6 dblgrave
|
| 935 |
+
F6D7 dieresisacute
|
| 936 |
+
F6D8 dieresisgrave
|
| 937 |
+
F6D9 copyrightserif
|
| 938 |
+
F6DA registerserif
|
| 939 |
+
F6DB trademarkserif
|
| 940 |
+
F6DC onefitted
|
| 941 |
+
F6DD rupiah
|
| 942 |
+
F6DE threequartersemdash
|
| 943 |
+
F6DF centinferior
|
| 944 |
+
F6E0 centsuperior
|
| 945 |
+
F6E1 commainferior
|
| 946 |
+
F6E2 commasuperior
|
| 947 |
+
F6E3 dollarinferior
|
| 948 |
+
F6E4 dollarsuperior
|
| 949 |
+
F6E5 hypheninferior
|
| 950 |
+
F6E6 hyphensuperior
|
| 951 |
+
F6E7 periodinferior
|
| 952 |
+
F6E8 periodsuperior
|
| 953 |
+
F6E9 asuperior
|
| 954 |
+
F6EA bsuperior
|
| 955 |
+
F6EB dsuperior
|
| 956 |
+
F6EC esuperior
|
| 957 |
+
F6ED isuperior
|
| 958 |
+
F6EE lsuperior
|
| 959 |
+
F6EF msuperior
|
| 960 |
+
F6F0 osuperior
|
| 961 |
+
F6F1 rsuperior
|
| 962 |
+
F6F2 ssuperior
|
| 963 |
+
F6F3 tsuperior
|
| 964 |
+
F6F4 Brevesmall
|
| 965 |
+
F6F5 Caronsmall
|
| 966 |
+
F6F6 Circumflexsmall
|
| 967 |
+
F6F7 Dotaccentsmall
|
| 968 |
+
F6F8 Hungarumlautsmall
|
| 969 |
+
F6F9 Lslashsmall
|
| 970 |
+
F6FA OEsmall
|
| 971 |
+
F6FB Ogoneksmall
|
| 972 |
+
F6FC Ringsmall
|
| 973 |
+
F6FD Scaronsmall
|
| 974 |
+
F6FE Tildesmall
|
| 975 |
+
F6FF Zcaronsmall
|
| 976 |
+
F721 exclamsmall
|
| 977 |
+
F724 dollaroldstyle
|
| 978 |
+
F726 ampersandsmall
|
| 979 |
+
F730 zerooldstyle
|
| 980 |
+
F731 oneoldstyle
|
| 981 |
+
F732 twooldstyle
|
| 982 |
+
F733 threeoldstyle
|
| 983 |
+
F734 fouroldstyle
|
| 984 |
+
F735 fiveoldstyle
|
| 985 |
+
F736 sixoldstyle
|
| 986 |
+
F737 sevenoldstyle
|
| 987 |
+
F738 eightoldstyle
|
| 988 |
+
F739 nineoldstyle
|
| 989 |
+
F73F questionsmall
|
| 990 |
+
F760 Gravesmall
|
| 991 |
+
F761 Asmall
|
| 992 |
+
F762 Bsmall
|
| 993 |
+
F763 Csmall
|
| 994 |
+
F764 Dsmall
|
| 995 |
+
F765 Esmall
|
| 996 |
+
F766 Fsmall
|
| 997 |
+
F767 Gsmall
|
| 998 |
+
F768 Hsmall
|
| 999 |
+
F769 Ismall
|
| 1000 |
+
F76A Jsmall
|
| 1001 |
+
F76B Ksmall
|
| 1002 |
+
F76C Lsmall
|
| 1003 |
+
F76D Msmall
|
| 1004 |
+
F76E Nsmall
|
| 1005 |
+
F76F Osmall
|
| 1006 |
+
F770 Psmall
|
| 1007 |
+
F771 Qsmall
|
| 1008 |
+
F772 Rsmall
|
| 1009 |
+
F773 Ssmall
|
| 1010 |
+
F774 Tsmall
|
| 1011 |
+
F775 Usmall
|
| 1012 |
+
F776 Vsmall
|
| 1013 |
+
F777 Wsmall
|
| 1014 |
+
F778 Xsmall
|
| 1015 |
+
F779 Ysmall
|
| 1016 |
+
F77A Zsmall
|
| 1017 |
+
F7A1 exclamdownsmall
|
| 1018 |
+
F7A2 centoldstyle
|
| 1019 |
+
F7A8 Dieresissmall
|
| 1020 |
+
F7AF Macronsmall
|
| 1021 |
+
F7B4 Acutesmall
|
| 1022 |
+
F7B8 Cedillasmall
|
| 1023 |
+
F7BF questiondownsmall
|
| 1024 |
+
F7E0 Agravesmall
|
| 1025 |
+
F7E1 Aacutesmall
|
| 1026 |
+
F7E2 Acircumflexsmall
|
| 1027 |
+
F7E3 Atildesmall
|
| 1028 |
+
F7E4 Adieresissmall
|
| 1029 |
+
F7E5 Aringsmall
|
| 1030 |
+
F7E6 AEsmall
|
| 1031 |
+
F7E7 Ccedillasmall
|
| 1032 |
+
F7E8 Egravesmall
|
| 1033 |
+
F7E9 Eacutesmall
|
| 1034 |
+
F7EA Ecircumflexsmall
|
| 1035 |
+
F7EB Edieresissmall
|
| 1036 |
+
F7EC Igravesmall
|
| 1037 |
+
F7ED Iacutesmall
|
| 1038 |
+
F7EE Icircumflexsmall
|
| 1039 |
+
F7EF Idieresissmall
|
| 1040 |
+
F7F0 Ethsmall
|
| 1041 |
+
F7F1 Ntildesmall
|
| 1042 |
+
F7F2 Ogravesmall
|
| 1043 |
+
F7F3 Oacutesmall
|
| 1044 |
+
F7F4 Ocircumflexsmall
|
| 1045 |
+
F7F5 Otildesmall
|
| 1046 |
+
F7F6 Odieresissmall
|
| 1047 |
+
F7F8 Oslashsmall
|
| 1048 |
+
F7F9 Ugravesmall
|
| 1049 |
+
F7FA Uacutesmall
|
| 1050 |
+
F7FB Ucircumflexsmall
|
| 1051 |
+
F7FC Udieresissmall
|
| 1052 |
+
F7FD Yacutesmall
|
| 1053 |
+
F7FE Thornsmall
|
| 1054 |
+
F7FF Ydieresissmall
|
| 1055 |
+
F8E5 radicalex
|
| 1056 |
+
F8E6 arrowvertex
|
| 1057 |
+
F8E7 arrowhorizex
|
| 1058 |
+
F8E8 registersans
|
| 1059 |
+
F8E9 copyrightsans
|
| 1060 |
+
F8EA trademarksans
|
| 1061 |
+
F8EB parenlefttp
|
| 1062 |
+
F8EC parenleftex
|
| 1063 |
+
F8ED parenleftbt
|
| 1064 |
+
F8EE bracketlefttp
|
| 1065 |
+
F8EF bracketleftex
|
| 1066 |
+
F8F0 bracketleftbt
|
| 1067 |
+
F8F1 bracelefttp
|
| 1068 |
+
F8F2 braceleftmid
|
| 1069 |
+
F8F3 braceleftbt
|
| 1070 |
+
F8F4 braceex
|
| 1071 |
+
F8F5 integralex
|
| 1072 |
+
F8F6 parenrighttp
|
| 1073 |
+
F8F7 parenrightex
|
| 1074 |
+
F8F8 parenrightbt
|
| 1075 |
+
F8F9 bracketrighttp
|
| 1076 |
+
F8FA bracketrightex
|
| 1077 |
+
F8FB bracketrightbt
|
| 1078 |
+
F8FC bracerighttp
|
| 1079 |
+
F8FD bracerightmid
|
| 1080 |
+
F8FE bracerightbt
|
| 1081 |
+
FB00 ff
|
| 1082 |
+
FB01 fi
|
| 1083 |
+
FB02 fl
|
| 1084 |
+
FB03 ffi
|
| 1085 |
+
FB04 ffl
|
| 1086 |
+
FB1F afii57705
|
| 1087 |
+
FB2A afii57694
|
| 1088 |
+
FB2B afii57695
|
| 1089 |
+
FB35 afii57723
|
| 1090 |
+
FB4B afii57700
|
| 1091 |
+
}
|
| 1092 |
+
|
| 1093 |
+
variable ps_preamble {}
|
| 1094 |
+
|
| 1095 |
+
namespace eval ps {
|
| 1096 |
+
namespace ensemble create
|
| 1097 |
+
namespace export {[a-z]*}
|
| 1098 |
+
proc literal {string} {
|
| 1099 |
+
upvar 0 ::tk::ps_preamble preamble
|
| 1100 |
+
foreach line [split $string \n] {
|
| 1101 |
+
set line [string trim $line]
|
| 1102 |
+
if {$line eq ""} continue
|
| 1103 |
+
append preamble $line \n
|
| 1104 |
+
}
|
| 1105 |
+
return
|
| 1106 |
+
}
|
| 1107 |
+
proc variable {name value} {
|
| 1108 |
+
upvar 0 ::tk::ps_preamble preamble
|
| 1109 |
+
append preamble "/$name $value def\n"
|
| 1110 |
+
return
|
| 1111 |
+
}
|
| 1112 |
+
proc function {name body} {
|
| 1113 |
+
upvar 0 ::tk::ps_preamble preamble
|
| 1114 |
+
append preamble "/$name \{"
|
| 1115 |
+
foreach line [split $body \n] {
|
| 1116 |
+
set line [string trim $line]
|
| 1117 |
+
# Strip blank lines and comments from the bodies of functions
|
| 1118 |
+
if {$line eq "" } continue
|
| 1119 |
+
if {[string match {[%#]*} $line]} continue
|
| 1120 |
+
append preamble $line " "
|
| 1121 |
+
}
|
| 1122 |
+
append preamble "\} bind def\n"
|
| 1123 |
+
return
|
| 1124 |
+
}
|
| 1125 |
+
}
|
| 1126 |
+
|
| 1127 |
+
ps literal {
|
| 1128 |
+
%%BeginProlog
|
| 1129 |
+
% This is a standard prolog for Postscript generated by Tk's canvas
|
| 1130 |
+
% widget.
|
| 1131 |
+
}
|
| 1132 |
+
ps variable CurrentEncoding [CreatePostscriptEncoding]
|
| 1133 |
+
ps literal {50 dict begin}
|
| 1134 |
+
|
| 1135 |
+
# The definitions below just define all of the variables used in any of
|
| 1136 |
+
# the procedures here. This is needed for obscure reasons explained on
|
| 1137 |
+
# p. 716 of the Postscript manual (Section H.2.7, "Initializing
|
| 1138 |
+
# Variables," in the section on Encapsulated Postscript).
|
| 1139 |
+
ps variable baseline 0
|
| 1140 |
+
ps variable stipimage 0
|
| 1141 |
+
ps variable height 0
|
| 1142 |
+
ps variable justify 0
|
| 1143 |
+
ps variable lineLength 0
|
| 1144 |
+
ps variable spacing 0
|
| 1145 |
+
ps variable stipple 0
|
| 1146 |
+
ps variable strings 0
|
| 1147 |
+
ps variable xoffset 0
|
| 1148 |
+
ps variable yoffset 0
|
| 1149 |
+
ps variable tmpstip null
|
| 1150 |
+
ps variable baselineSampler "( TXygqPZ)"
|
| 1151 |
+
# Put an extra-tall character in; done this way to avoid encoding trouble
|
| 1152 |
+
ps literal {baselineSampler 0 196 put}
|
| 1153 |
+
|
| 1154 |
+
ps function cstringshow {
|
| 1155 |
+
{
|
| 1156 |
+
dup type /stringtype eq
|
| 1157 |
+
{ show } { glyphshow }
|
| 1158 |
+
ifelse
|
| 1159 |
+
} forall
|
| 1160 |
+
}
|
| 1161 |
+
|
| 1162 |
+
ps function cstringwidth {
|
| 1163 |
+
0 exch 0 exch
|
| 1164 |
+
{
|
| 1165 |
+
dup type /stringtype eq
|
| 1166 |
+
{ stringwidth } {
|
| 1167 |
+
currentfont /Encoding get exch 1 exch put (\001)
|
| 1168 |
+
stringwidth
|
| 1169 |
+
}
|
| 1170 |
+
ifelse
|
| 1171 |
+
exch 3 1 roll add 3 1 roll add exch
|
| 1172 |
+
} forall
|
| 1173 |
+
}
|
| 1174 |
+
|
| 1175 |
+
# font ISOEncode font
|
| 1176 |
+
#
|
| 1177 |
+
# This procedure changes the encoding of a font from the default
|
| 1178 |
+
# Postscript encoding to current system encoding. It's typically invoked
|
| 1179 |
+
# just before invoking "setfont". The body of this procedure comes from
|
| 1180 |
+
# Section 5.6.1 of the Postscript book.
|
| 1181 |
+
ps function ISOEncode {
|
| 1182 |
+
dup length dict begin
|
| 1183 |
+
{1 index /FID ne {def} {pop pop} ifelse} forall
|
| 1184 |
+
/Encoding CurrentEncoding def
|
| 1185 |
+
currentdict
|
| 1186 |
+
end
|
| 1187 |
+
% I'm not sure why it's necessary to use "definefont" on this new
|
| 1188 |
+
% font, but it seems to be important; just use the name "Temporary"
|
| 1189 |
+
% for the font.
|
| 1190 |
+
/Temporary exch definefont
|
| 1191 |
+
}
|
| 1192 |
+
|
| 1193 |
+
# StrokeClip
|
| 1194 |
+
#
|
| 1195 |
+
# This procedure converts the current path into a clip area under the
|
| 1196 |
+
# assumption of stroking. It's a bit tricky because some Postscript
|
| 1197 |
+
# interpreters get errors during strokepath for dashed lines. If this
|
| 1198 |
+
# happens then turn off dashes and try again.
|
| 1199 |
+
ps function StrokeClip {
|
| 1200 |
+
{strokepath} stopped {
|
| 1201 |
+
(This Postscript printer gets limitcheck overflows when) =
|
| 1202 |
+
(stippling dashed lines; lines will be printed solid instead.) =
|
| 1203 |
+
[] 0 setdash strokepath} if
|
| 1204 |
+
clip
|
| 1205 |
+
}
|
| 1206 |
+
|
| 1207 |
+
# desiredSize EvenPixels closestSize
|
| 1208 |
+
#
|
| 1209 |
+
# The procedure below is used for stippling. Given the optimal size of a
|
| 1210 |
+
# dot in a stipple pattern in the current user coordinate system, compute
|
| 1211 |
+
# the closest size that is an exact multiple of the device's pixel
|
| 1212 |
+
# size. This allows stipple patterns to be displayed without aliasing
|
| 1213 |
+
# effects.
|
| 1214 |
+
ps function EvenPixels {
|
| 1215 |
+
% Compute exact number of device pixels per stipple dot.
|
| 1216 |
+
dup 0 matrix currentmatrix dtransform
|
| 1217 |
+
dup mul exch dup mul add sqrt
|
| 1218 |
+
% Round to an integer, make sure the number is at least 1, and
|
| 1219 |
+
% compute user coord distance corresponding to this.
|
| 1220 |
+
dup round dup 1 lt {pop 1} if
|
| 1221 |
+
exch div mul
|
| 1222 |
+
}
|
| 1223 |
+
|
| 1224 |
+
# width height string StippleFill --
|
| 1225 |
+
#
|
| 1226 |
+
# Given a path already set up and a clipping region generated from it,
|
| 1227 |
+
# this procedure will fill the clipping region with a stipple pattern.
|
| 1228 |
+
# "String" contains a proper image description of the stipple pattern and
|
| 1229 |
+
# "width" and "height" give its dimensions. Each stipple dot is assumed to
|
| 1230 |
+
# be about one unit across in the current user coordinate system. This
|
| 1231 |
+
# procedure trashes the graphics state.
|
| 1232 |
+
ps function StippleFill {
|
| 1233 |
+
% The following code is needed to work around a NeWSprint bug.
|
| 1234 |
+
/tmpstip 1 index def
|
| 1235 |
+
% Change the scaling so that one user unit in user coordinates
|
| 1236 |
+
% corresponds to the size of one stipple dot.
|
| 1237 |
+
1 EvenPixels dup scale
|
| 1238 |
+
% Compute the bounding box occupied by the path (which is now the
|
| 1239 |
+
% clipping region), and round the lower coordinates down to the
|
| 1240 |
+
% nearest starting point for the stipple pattern. Be careful about
|
| 1241 |
+
% negative numbers, since the rounding works differently on them.
|
| 1242 |
+
pathbbox
|
| 1243 |
+
4 2 roll
|
| 1244 |
+
5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll
|
| 1245 |
+
6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll
|
| 1246 |
+
% Stack now: width height string y1 y2 x1 x2
|
| 1247 |
+
% Below is a doubly-nested for loop to iterate across this area
|
| 1248 |
+
% in units of the stipple pattern size, going up columns then
|
| 1249 |
+
% across rows, blasting out a stipple-pattern-sized rectangle at
|
| 1250 |
+
% each position
|
| 1251 |
+
6 index exch {
|
| 1252 |
+
2 index 5 index 3 index {
|
| 1253 |
+
% Stack now: width height string y1 y2 x y
|
| 1254 |
+
gsave
|
| 1255 |
+
1 index exch translate
|
| 1256 |
+
5 index 5 index true matrix tmpstip imagemask
|
| 1257 |
+
grestore
|
| 1258 |
+
} for
|
| 1259 |
+
pop
|
| 1260 |
+
} for
|
| 1261 |
+
pop pop pop pop pop
|
| 1262 |
+
}
|
| 1263 |
+
|
| 1264 |
+
# -- AdjustColor --
|
| 1265 |
+
#
|
| 1266 |
+
# Given a color value already set for output by the caller, adjusts that
|
| 1267 |
+
# value to a grayscale or mono value if requested by the CL variable.
|
| 1268 |
+
ps function AdjustColor {
|
| 1269 |
+
CL 2 lt {
|
| 1270 |
+
currentgray
|
| 1271 |
+
CL 0 eq {
|
| 1272 |
+
.5 lt {0} {1} ifelse
|
| 1273 |
+
} if
|
| 1274 |
+
setgray
|
| 1275 |
+
} if
|
| 1276 |
+
}
|
| 1277 |
+
|
| 1278 |
+
# x y strings spacing xoffset yoffset justify stipple DrawText --
|
| 1279 |
+
#
|
| 1280 |
+
# This procedure does all of the real work of drawing text. The color and
|
| 1281 |
+
# font must already have been set by the caller, and the following
|
| 1282 |
+
# arguments must be on the stack:
|
| 1283 |
+
#
|
| 1284 |
+
# x, y - Coordinates at which to draw text.
|
| 1285 |
+
# strings - An array of strings, one for each line of the text item, in
|
| 1286 |
+
# order from top to bottom.
|
| 1287 |
+
# spacing - Spacing between lines.
|
| 1288 |
+
# xoffset - Horizontal offset for text bbox relative to x and y: 0 for
|
| 1289 |
+
# nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se.
|
| 1290 |
+
# yoffset - Vertical offset for text bbox relative to x and y: 0 for
|
| 1291 |
+
# nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se.
|
| 1292 |
+
# justify - 0 for left justification, 0.5 for center, 1 for right justify.
|
| 1293 |
+
# stipple - Boolean value indicating whether or not text is to be drawn in
|
| 1294 |
+
# stippled fashion. If text is stippled, function StippleText
|
| 1295 |
+
# must have been defined to call StippleFill in the right way.
|
| 1296 |
+
#
|
| 1297 |
+
# Also, when this procedure is invoked, the color and font must already
|
| 1298 |
+
# have been set for the text.
|
| 1299 |
+
ps function DrawText {
|
| 1300 |
+
/stipple exch def
|
| 1301 |
+
/justify exch def
|
| 1302 |
+
/yoffset exch def
|
| 1303 |
+
/xoffset exch def
|
| 1304 |
+
/spacing exch def
|
| 1305 |
+
/strings exch def
|
| 1306 |
+
% First scan through all of the text to find the widest line.
|
| 1307 |
+
/lineLength 0 def
|
| 1308 |
+
strings {
|
| 1309 |
+
cstringwidth pop
|
| 1310 |
+
dup lineLength gt {/lineLength exch def} {pop} ifelse
|
| 1311 |
+
newpath
|
| 1312 |
+
} forall
|
| 1313 |
+
% Compute the baseline offset and the actual font height.
|
| 1314 |
+
0 0 moveto baselineSampler false charpath
|
| 1315 |
+
pathbbox dup /baseline exch def
|
| 1316 |
+
exch pop exch sub /height exch def pop
|
| 1317 |
+
newpath
|
| 1318 |
+
% Translate and rotate coordinates first so that the origin is at
|
| 1319 |
+
% the upper-left corner of the text's bounding box. Remember that
|
| 1320 |
+
% angle for rotating, and x and y for positioning are still on the
|
| 1321 |
+
% stack.
|
| 1322 |
+
translate
|
| 1323 |
+
rotate
|
| 1324 |
+
lineLength xoffset mul
|
| 1325 |
+
strings length 1 sub spacing mul height add yoffset mul translate
|
| 1326 |
+
% Now use the baseline and justification information to translate
|
| 1327 |
+
% so that the origin is at the baseline and positioning point for
|
| 1328 |
+
% the first line of text.
|
| 1329 |
+
justify lineLength mul baseline neg translate
|
| 1330 |
+
% Iterate over each of the lines to output it. For each line,
|
| 1331 |
+
% compute its width again so it can be properly justified, then
|
| 1332 |
+
% display it.
|
| 1333 |
+
strings {
|
| 1334 |
+
dup cstringwidth pop
|
| 1335 |
+
justify neg mul 0 moveto
|
| 1336 |
+
stipple {
|
| 1337 |
+
% The text is stippled, so turn it into a path and print
|
| 1338 |
+
% by calling StippledText, which in turn calls
|
| 1339 |
+
% StippleFill. Unfortunately, many Postscript interpreters
|
| 1340 |
+
% will get overflow errors if we try to do the whole
|
| 1341 |
+
% string at once, so do it a character at a time.
|
| 1342 |
+
gsave
|
| 1343 |
+
/char (X) def
|
| 1344 |
+
{
|
| 1345 |
+
dup type /stringtype eq {
|
| 1346 |
+
% This segment is a string.
|
| 1347 |
+
{
|
| 1348 |
+
char 0 3 -1 roll put
|
| 1349 |
+
currentpoint
|
| 1350 |
+
gsave
|
| 1351 |
+
char true charpath clip StippleText
|
| 1352 |
+
grestore
|
| 1353 |
+
char stringwidth translate
|
| 1354 |
+
moveto
|
| 1355 |
+
} forall
|
| 1356 |
+
} {
|
| 1357 |
+
% This segment is glyph name
|
| 1358 |
+
% Temporary override
|
| 1359 |
+
currentfont /Encoding get exch 1 exch put
|
| 1360 |
+
currentpoint
|
| 1361 |
+
gsave (\001) true charpath clip StippleText
|
| 1362 |
+
grestore
|
| 1363 |
+
(\001) stringwidth translate
|
| 1364 |
+
moveto
|
| 1365 |
+
} ifelse
|
| 1366 |
+
} forall
|
| 1367 |
+
grestore
|
| 1368 |
+
} {cstringshow} ifelse
|
| 1369 |
+
0 spacing neg translate
|
| 1370 |
+
} forall
|
| 1371 |
+
}
|
| 1372 |
+
|
| 1373 |
+
# Define the "TkPhoto" function variants, which are modified versions
|
| 1374 |
+
# of the original "transparentimage" function posted by ian@five-d.com
|
| 1375 |
+
# (Ian Kemmish) to comp.lang.postscript. For a monochrome colorLevel
|
| 1376 |
+
# this is a slightly different version that uses the imagemask command
|
| 1377 |
+
# instead of image.
|
| 1378 |
+
|
| 1379 |
+
ps function TkPhotoColor {
|
| 1380 |
+
gsave
|
| 1381 |
+
32 dict begin
|
| 1382 |
+
/tinteger exch def
|
| 1383 |
+
/transparent 1 string def
|
| 1384 |
+
transparent 0 tinteger put
|
| 1385 |
+
/olddict exch def
|
| 1386 |
+
olddict /DataSource get dup type /filetype ne {
|
| 1387 |
+
olddict /DataSource 3 -1 roll
|
| 1388 |
+
0 () /SubFileDecode filter put
|
| 1389 |
+
} {
|
| 1390 |
+
pop
|
| 1391 |
+
} ifelse
|
| 1392 |
+
/newdict olddict maxlength dict def
|
| 1393 |
+
olddict newdict copy pop
|
| 1394 |
+
/w newdict /Width get def
|
| 1395 |
+
/crpp newdict /Decode get length 2 idiv def
|
| 1396 |
+
/str w string def
|
| 1397 |
+
/pix w crpp mul string def
|
| 1398 |
+
/substrlen 2 w log 2 log div floor exp cvi def
|
| 1399 |
+
/substrs [ {
|
| 1400 |
+
substrlen string
|
| 1401 |
+
0 1 substrlen 1 sub {
|
| 1402 |
+
1 index exch tinteger put
|
| 1403 |
+
} for
|
| 1404 |
+
/substrlen substrlen 2 idiv def
|
| 1405 |
+
substrlen 0 eq {exit} if
|
| 1406 |
+
} loop ] def
|
| 1407 |
+
/h newdict /Height get def
|
| 1408 |
+
1 w div 1 h div matrix scale
|
| 1409 |
+
olddict /ImageMatrix get exch matrix concatmatrix
|
| 1410 |
+
matrix invertmatrix concat
|
| 1411 |
+
newdict /Height 1 put
|
| 1412 |
+
newdict /DataSource pix put
|
| 1413 |
+
/mat [w 0 0 h 0 0] def
|
| 1414 |
+
newdict /ImageMatrix mat put
|
| 1415 |
+
0 1 h 1 sub {
|
| 1416 |
+
mat 5 3 -1 roll neg put
|
| 1417 |
+
olddict /DataSource get str readstring pop pop
|
| 1418 |
+
/tail str def
|
| 1419 |
+
/x 0 def
|
| 1420 |
+
olddict /DataSource get pix readstring pop pop
|
| 1421 |
+
{
|
| 1422 |
+
tail transparent search dup /done exch not def
|
| 1423 |
+
{exch pop exch pop} if
|
| 1424 |
+
/w1 exch length def
|
| 1425 |
+
w1 0 ne {
|
| 1426 |
+
newdict /DataSource
|
| 1427 |
+
pix x crpp mul w1 crpp mul getinterval put
|
| 1428 |
+
newdict /Width w1 put
|
| 1429 |
+
mat 4 x neg put
|
| 1430 |
+
/x x w1 add def
|
| 1431 |
+
newdict image
|
| 1432 |
+
/tail tail w1 tail length w1 sub getinterval def
|
| 1433 |
+
} if
|
| 1434 |
+
done {exit} if
|
| 1435 |
+
tail substrs {
|
| 1436 |
+
anchorsearch {pop} if
|
| 1437 |
+
} forall
|
| 1438 |
+
/tail exch def
|
| 1439 |
+
tail length 0 eq {exit} if
|
| 1440 |
+
/x w tail length sub def
|
| 1441 |
+
} loop
|
| 1442 |
+
} for
|
| 1443 |
+
end
|
| 1444 |
+
grestore
|
| 1445 |
+
}
|
| 1446 |
+
ps function TkPhotoMono {
|
| 1447 |
+
gsave
|
| 1448 |
+
32 dict begin
|
| 1449 |
+
/dummyInteger exch def
|
| 1450 |
+
/olddict exch def
|
| 1451 |
+
olddict /DataSource get dup type /filetype ne {
|
| 1452 |
+
olddict /DataSource 3 -1 roll
|
| 1453 |
+
0 () /SubFileDecode filter put
|
| 1454 |
+
} {
|
| 1455 |
+
pop
|
| 1456 |
+
} ifelse
|
| 1457 |
+
/newdict olddict maxlength dict def
|
| 1458 |
+
olddict newdict copy pop
|
| 1459 |
+
/w newdict /Width get def
|
| 1460 |
+
/pix w 7 add 8 idiv string def
|
| 1461 |
+
/h newdict /Height get def
|
| 1462 |
+
1 w div 1 h div matrix scale
|
| 1463 |
+
olddict /ImageMatrix get exch matrix concatmatrix
|
| 1464 |
+
matrix invertmatrix concat
|
| 1465 |
+
newdict /Height 1 put
|
| 1466 |
+
newdict /DataSource pix put
|
| 1467 |
+
/mat [w 0 0 h 0 0] def
|
| 1468 |
+
newdict /ImageMatrix mat put
|
| 1469 |
+
0 1 h 1 sub {
|
| 1470 |
+
mat 5 3 -1 roll neg put
|
| 1471 |
+
0.000 0.000 0.000 setrgbcolor
|
| 1472 |
+
olddict /DataSource get pix readstring pop pop
|
| 1473 |
+
newdict /DataSource pix put
|
| 1474 |
+
newdict imagemask
|
| 1475 |
+
1.000 1.000 1.000 setrgbcolor
|
| 1476 |
+
olddict /DataSource get pix readstring pop pop
|
| 1477 |
+
newdict /DataSource pix put
|
| 1478 |
+
newdict imagemask
|
| 1479 |
+
} for
|
| 1480 |
+
end
|
| 1481 |
+
grestore
|
| 1482 |
+
}
|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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# palette.tcl --
|
| 2 |
+
#
|
| 3 |
+
# This file contains procedures that change the color palette used
|
| 4 |
+
# by Tk.
|
| 5 |
+
#
|
| 6 |
+
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
|
| 7 |
+
#
|
| 8 |
+
# See the file "license.terms" for information on usage and redistribution
|
| 9 |
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
| 10 |
+
#
|
| 11 |
+
|
| 12 |
+
# ::tk_setPalette --
|
| 13 |
+
# Changes the default color scheme for a Tk application by setting
|
| 14 |
+
# default colors in the option database and by modifying all of the
|
| 15 |
+
# color options for existing widgets that have the default value.
|
| 16 |
+
#
|
| 17 |
+
# Arguments:
|
| 18 |
+
# The arguments consist of either a single color name, which
|
| 19 |
+
# will be used as the new background color (all other colors will
|
| 20 |
+
# be computed from this) or an even number of values consisting of
|
| 21 |
+
# option names and values. The name for an option is the one used
|
| 22 |
+
# for the option database, such as activeForeground, not -activeforeground.
|
| 23 |
+
|
| 24 |
+
proc ::tk_setPalette {args} {
|
| 25 |
+
if {[winfo depth .] == 1} {
|
| 26 |
+
# Just return on monochrome displays, otherwise errors will occur
|
| 27 |
+
return
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
# Create an array that has the complete new palette. If some colors
|
| 31 |
+
# aren't specified, compute them from other colors that are specified.
|
| 32 |
+
|
| 33 |
+
if {[llength $args] == 1} {
|
| 34 |
+
set new(background) [lindex $args 0]
|
| 35 |
+
} else {
|
| 36 |
+
array set new $args
|
| 37 |
+
}
|
| 38 |
+
if {![info exists new(background)]} {
|
| 39 |
+
return -code error -errorcode {TK SET_PALETTE BACKGROUND} \
|
| 40 |
+
"must specify a background color"
|
| 41 |
+
}
|
| 42 |
+
set bg [winfo rgb . $new(background)]
|
| 43 |
+
if {![info exists new(foreground)]} {
|
| 44 |
+
# Note that the range of each value in the triple returned by
|
| 45 |
+
# [winfo rgb] is 0-65535, and your eyes are more sensitive to
|
| 46 |
+
# green than to red, and more to red than to blue.
|
| 47 |
+
foreach {r g b} $bg {break}
|
| 48 |
+
if {$r+1.5*$g+0.5*$b > 100000} {
|
| 49 |
+
set new(foreground) black
|
| 50 |
+
} else {
|
| 51 |
+
set new(foreground) white
|
| 52 |
+
}
|
| 53 |
+
}
|
| 54 |
+
lassign [winfo rgb . $new(foreground)] fg_r fg_g fg_b
|
| 55 |
+
lassign $bg bg_r bg_g bg_b
|
| 56 |
+
set darkerBg [format #%02x%02x%02x [expr {(9*$bg_r)/2560}] \
|
| 57 |
+
[expr {(9*$bg_g)/2560}] [expr {(9*$bg_b)/2560}]]
|
| 58 |
+
|
| 59 |
+
foreach i {activeForeground insertBackground selectForeground \
|
| 60 |
+
highlightColor} {
|
| 61 |
+
if {![info exists new($i)]} {
|
| 62 |
+
set new($i) $new(foreground)
|
| 63 |
+
}
|
| 64 |
+
}
|
| 65 |
+
if {![info exists new(disabledForeground)]} {
|
| 66 |
+
set new(disabledForeground) [format #%02x%02x%02x \
|
| 67 |
+
[expr {(3*$bg_r + $fg_r)/1024}] \
|
| 68 |
+
[expr {(3*$bg_g + $fg_g)/1024}] \
|
| 69 |
+
[expr {(3*$bg_b + $fg_b)/1024}]]
|
| 70 |
+
}
|
| 71 |
+
if {![info exists new(highlightBackground)]} {
|
| 72 |
+
set new(highlightBackground) $new(background)
|
| 73 |
+
}
|
| 74 |
+
if {![info exists new(activeBackground)]} {
|
| 75 |
+
# Pick a default active background that islighter than the
|
| 76 |
+
# normal background. To do this, round each color component
|
| 77 |
+
# up by 15% or 1/3 of the way to full white, whichever is
|
| 78 |
+
# greater.
|
| 79 |
+
|
| 80 |
+
foreach i {0 1 2} color $bg {
|
| 81 |
+
set light($i) [expr {$color/256}]
|
| 82 |
+
set inc1 [expr {($light($i)*15)/100}]
|
| 83 |
+
set inc2 [expr {(255-$light($i))/3}]
|
| 84 |
+
if {$inc1 > $inc2} {
|
| 85 |
+
incr light($i) $inc1
|
| 86 |
+
} else {
|
| 87 |
+
incr light($i) $inc2
|
| 88 |
+
}
|
| 89 |
+
if {$light($i) > 255} {
|
| 90 |
+
set light($i) 255
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
set new(activeBackground) [format #%02x%02x%02x $light(0) \
|
| 94 |
+
$light(1) $light(2)]
|
| 95 |
+
}
|
| 96 |
+
if {![info exists new(selectBackground)]} {
|
| 97 |
+
set new(selectBackground) $darkerBg
|
| 98 |
+
}
|
| 99 |
+
if {![info exists new(troughColor)]} {
|
| 100 |
+
set new(troughColor) $darkerBg
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
# let's make one of each of the widgets so we know what the
|
| 104 |
+
# defaults are currently for this platform.
|
| 105 |
+
toplevel .___tk_set_palette
|
| 106 |
+
wm withdraw .___tk_set_palette
|
| 107 |
+
foreach q {
|
| 108 |
+
button canvas checkbutton entry frame label labelframe
|
| 109 |
+
listbox menubutton menu message radiobutton scale scrollbar
|
| 110 |
+
spinbox text
|
| 111 |
+
} {
|
| 112 |
+
$q .___tk_set_palette.$q
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
# Walk the widget hierarchy, recoloring all existing windows.
|
| 116 |
+
# The option database must be set according to what we do here,
|
| 117 |
+
# but it breaks things if we set things in the database while
|
| 118 |
+
# we are changing colors...so, ::tk::RecolorTree now returns the
|
| 119 |
+
# option database changes that need to be made, and they
|
| 120 |
+
# need to be evalled here to take effect.
|
| 121 |
+
# We have to walk the whole widget tree instead of just
|
| 122 |
+
# relying on the widgets we've created above to do the work
|
| 123 |
+
# because different extensions may provide other kinds
|
| 124 |
+
# of widgets that we don't currently know about, so we'll
|
| 125 |
+
# walk the whole hierarchy just in case.
|
| 126 |
+
|
| 127 |
+
eval [tk::RecolorTree . new]
|
| 128 |
+
|
| 129 |
+
destroy .___tk_set_palette
|
| 130 |
+
|
| 131 |
+
# Change the option database so that future windows will get the
|
| 132 |
+
# same colors.
|
| 133 |
+
|
| 134 |
+
foreach option [array names new] {
|
| 135 |
+
option add *$option $new($option) widgetDefault
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
# Save the options in the variable ::tk::Palette, for use the
|
| 139 |
+
# next time we change the options.
|
| 140 |
+
|
| 141 |
+
array set ::tk::Palette [array get new]
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
# ::tk::RecolorTree --
|
| 145 |
+
# This procedure changes the colors in a window and all of its
|
| 146 |
+
# descendants, according to information provided by the colors
|
| 147 |
+
# argument. This looks at the defaults provided by the option
|
| 148 |
+
# database, if it exists, and if not, then it looks at the default
|
| 149 |
+
# value of the widget itself.
|
| 150 |
+
#
|
| 151 |
+
# Arguments:
|
| 152 |
+
# w - The name of a window. This window and all its
|
| 153 |
+
# descendants are recolored.
|
| 154 |
+
# colors - The name of an array variable in the caller,
|
| 155 |
+
# which contains color information. Each element
|
| 156 |
+
# is named after a widget configuration option, and
|
| 157 |
+
# each value is the value for that option.
|
| 158 |
+
|
| 159 |
+
proc ::tk::RecolorTree {w colors} {
|
| 160 |
+
upvar $colors c
|
| 161 |
+
set result {}
|
| 162 |
+
set prototype .___tk_set_palette.[string tolower [winfo class $w]]
|
| 163 |
+
if {![winfo exists $prototype]} {
|
| 164 |
+
unset prototype
|
| 165 |
+
}
|
| 166 |
+
foreach dbOption [array names c] {
|
| 167 |
+
set option -[string tolower $dbOption]
|
| 168 |
+
set class [string replace $dbOption 0 0 [string toupper \
|
| 169 |
+
[string index $dbOption 0]]]
|
| 170 |
+
if {![catch {$w configure $option} value]} {
|
| 171 |
+
# if the option database has a preference for this
|
| 172 |
+
# dbOption, then use it, otherwise use the defaults
|
| 173 |
+
# for the widget.
|
| 174 |
+
set defaultcolor [option get $w $dbOption $class]
|
| 175 |
+
if {$defaultcolor eq "" || \
|
| 176 |
+
([info exists prototype] && \
|
| 177 |
+
[$prototype cget $option] ne "$defaultcolor")} {
|
| 178 |
+
set defaultcolor [lindex $value 3]
|
| 179 |
+
}
|
| 180 |
+
if {$defaultcolor ne ""} {
|
| 181 |
+
set defaultcolor [winfo rgb . $defaultcolor]
|
| 182 |
+
}
|
| 183 |
+
set chosencolor [lindex $value 4]
|
| 184 |
+
if {$chosencolor ne ""} {
|
| 185 |
+
set chosencolor [winfo rgb . $chosencolor]
|
| 186 |
+
}
|
| 187 |
+
if {[string match $defaultcolor $chosencolor]} {
|
| 188 |
+
# Change the option database so that future windows will get
|
| 189 |
+
# the same colors.
|
| 190 |
+
append result ";\noption add [list \
|
| 191 |
+
*[winfo class $w].$dbOption $c($dbOption) 60]"
|
| 192 |
+
$w configure $option $c($dbOption)
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
}
|
| 196 |
+
foreach child [winfo children $w] {
|
| 197 |
+
append result ";\n[::tk::RecolorTree $child c]"
|
| 198 |
+
}
|
| 199 |
+
return $result
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
# ::tk::Darken --
|
| 203 |
+
# Given a color name, computes a new color value that darkens (or
|
| 204 |
+
# brightens) the given color by a given percent.
|
| 205 |
+
#
|
| 206 |
+
# Arguments:
|
| 207 |
+
# color - Name of starting color.
|
| 208 |
+
# percent - Integer telling how much to brighten or darken as a
|
| 209 |
+
# percent: 50 means darken by 50%, 110 means brighten
|
| 210 |
+
# by 10%.
|
| 211 |
+
|
| 212 |
+
proc ::tk::Darken {color percent} {
|
| 213 |
+
if {$percent < 0} {
|
| 214 |
+
return #000000
|
| 215 |
+
} elseif {$percent > 200} {
|
| 216 |
+
return #ffffff
|
| 217 |
+
} elseif {$percent <= 100} {
|
| 218 |
+
lassign [winfo rgb . $color] r g b
|
| 219 |
+
set r [expr {($r/256)*$percent/100}]
|
| 220 |
+
set g [expr {($g/256)*$percent/100}]
|
| 221 |
+
set b [expr {($b/256)*$percent/100}]
|
| 222 |
+
} elseif {$percent > 100} {
|
| 223 |
+
lassign [winfo rgb . $color] r g b
|
| 224 |
+
set r [expr {255 - ((65535-$r)/256)*(200-$percent)/100}]
|
| 225 |
+
set g [expr {255 - ((65535-$g)/256)*(200-$percent)/100}]
|
| 226 |
+
set b [expr {255 - ((65535-$b)/256)*(200-$percent)/100}]
|
| 227 |
+
}
|
| 228 |
+
return [format #%02x%02x%02x $r $g $b]
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
# ::tk_bisque --
|
| 232 |
+
# Reset the Tk color palette to the old "bisque" colors.
|
| 233 |
+
#
|
| 234 |
+
# Arguments:
|
| 235 |
+
# None.
|
| 236 |
+
|
| 237 |
+
proc ::tk_bisque {} {
|
| 238 |
+
tk_setPalette activeBackground #e6ceb1 activeForeground black \
|
| 239 |
+
background #ffe4c4 disabledForeground #b0b0b0 foreground black \
|
| 240 |
+
highlightBackground #ffe4c4 highlightColor black \
|
| 241 |
+
insertBackground black \
|
| 242 |
+
selectBackground #e6ceb1 selectForeground black \
|
| 243 |
+
troughColor #cdb79e
|
| 244 |
+
}
|