ZTWHHH commited on
Commit
db09d18
·
verified ·
1 Parent(s): ab5e885

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. falcon/lib/ossl-modules/legacy.so +3 -0
  3. falcon/lib/sqlite3.44.2/libsqlite3.44.2.so +3 -0
  4. falcon/lib/tk8.6/demos/README +44 -0
  5. falcon/lib/tk8.6/demos/anilabel.tcl +160 -0
  6. falcon/lib/tk8.6/demos/aniwave.tcl +104 -0
  7. falcon/lib/tk8.6/demos/arrow.tcl +241 -0
  8. falcon/lib/tk8.6/demos/bind.tcl +78 -0
  9. falcon/lib/tk8.6/demos/bitmap.tcl +52 -0
  10. falcon/lib/tk8.6/demos/browse +66 -0
  11. falcon/lib/tk8.6/demos/button.tcl +47 -0
  12. falcon/lib/tk8.6/demos/check.tcl +71 -0
  13. falcon/lib/tk8.6/demos/clrpick.tcl +54 -0
  14. falcon/lib/tk8.6/demos/colors.tcl +99 -0
  15. falcon/lib/tk8.6/demos/ctext.tcl +176 -0
  16. falcon/lib/tk8.6/demos/dialog1.tcl +25 -0
  17. falcon/lib/tk8.6/demos/dialog2.tcl +18 -0
  18. falcon/lib/tk8.6/demos/en.msg +97 -0
  19. falcon/lib/tk8.6/demos/entry1.tcl +34 -0
  20. falcon/lib/tk8.6/demos/filebox.tcl +81 -0
  21. falcon/lib/tk8.6/demos/floor.tcl +1372 -0
  22. falcon/lib/tk8.6/demos/fontchoose.tcl +67 -0
  23. falcon/lib/tk8.6/demos/goldberg.tcl +1834 -0
  24. falcon/lib/tk8.6/demos/hscale.tcl +45 -0
  25. falcon/lib/tk8.6/demos/icon.tcl +51 -0
  26. falcon/lib/tk8.6/demos/image1.tcl +35 -0
  27. falcon/lib/tk8.6/demos/image2.tcl +108 -0
  28. falcon/lib/tk8.6/demos/images/gray25.xbm +6 -0
  29. falcon/lib/tk8.6/demos/images/letters.xbm +27 -0
  30. falcon/lib/tk8.6/demos/images/ouster.png +3 -0
  31. falcon/lib/tk8.6/demos/ixset +328 -0
  32. falcon/lib/tk8.6/demos/knightstour.tcl +268 -0
  33. falcon/lib/tk8.6/demos/label.tcl +40 -0
  34. falcon/lib/tk8.6/demos/labelframe.tcl +76 -0
  35. falcon/lib/tk8.6/demos/license.terms +40 -0
  36. falcon/lib/tk8.6/demos/menu.tcl +177 -0
  37. falcon/lib/tk8.6/demos/menubu.tcl +87 -0
  38. falcon/lib/tk8.6/demos/nl.msg +125 -0
  39. falcon/lib/tk8.6/demos/paned1.tcl +32 -0
  40. falcon/lib/tk8.6/demos/paned2.tcl +74 -0
  41. falcon/lib/tk8.6/demos/pendulum.tcl +197 -0
  42. falcon/lib/tk8.6/demos/puzzle.tcl +82 -0
  43. falcon/lib/tk8.6/demos/radio.tcl +66 -0
  44. falcon/lib/tk8.6/demos/rolodex +204 -0
  45. falcon/lib/tk8.6/demos/ruler.tcl +175 -0
  46. falcon/lib/tk8.6/demos/sayings.tcl +44 -0
  47. falcon/lib/tk8.6/demos/search.tcl +139 -0
  48. falcon/lib/tk8.6/demos/spin.tcl +53 -0
  49. falcon/lib/tk8.6/demos/states.tcl +54 -0
  50. falcon/lib/tk8.6/demos/style.tcl +155 -0
.gitattributes CHANGED
@@ -577,3 +577,5 @@ falcon/lib/python3.10/site-packages/scipy/interpolate/_bspl.cpython-310-x86_64-l
577
  falcon/lib/python3.10/site-packages/scipy/interpolate/_ppoly.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
578
  falcon/lib/python3.10/site-packages/scipy/interpolate/_interpnd.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
579
  falcon/lib/python3.10/site-packages/scipy/interpolate/_dfitpack.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
577
  falcon/lib/python3.10/site-packages/scipy/interpolate/_ppoly.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
578
  falcon/lib/python3.10/site-packages/scipy/interpolate/_interpnd.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
579
  falcon/lib/python3.10/site-packages/scipy/interpolate/_dfitpack.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
580
+ falcon/lib/ossl-modules/legacy.so filter=lfs diff=lfs merge=lfs -text
581
+ falcon/lib/sqlite3.44.2/libsqlite3.44.2.so filter=lfs diff=lfs merge=lfs -text
falcon/lib/ossl-modules/legacy.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8b8163a4a4cea7693a8d64c064788cc830bfb72e5aae56e9432fee32f5f45a0
3
+ size 158976
falcon/lib/sqlite3.44.2/libsqlite3.44.2.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ccfe88e9e8b573a4d312a3cf85f51de60783ab649a4ca9a4ae69b13c3f87ef1
3
+ size 1596704
falcon/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.
falcon/lib/tk8.6/demos/anilabel.tcl ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # anilabel.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel 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+YCCOZEkyTKM2jOm66yPP
129
+ dF03bx7YcuHIDkGBR7SZeIyhTID4FZ+4Es8nQyCe2EeUNJ0peY2s9mi7PhAM
130
+ ngEAMGRbUpvzSxskLh1J+Hkg134OdDIDEB+GHxtYMEQMTjMGEYeGFoomezaC
131
+ DZGSHFmLXTQKkh8eNQVpZ2afmDQGHaOYSoEyhhcklzVmMpuHnaZmDqiGJbg0
132
+ qFqvh6UNAwB7VA+OwydEjgujkgrPNhbTI8dFvNgEYcHcHx0lB1kX2IYeA2G6
133
+ NN0YfkXJ2BsAMuAzHB9cZMk3qoEbRzUACsRCUBK5JxsC3iMiKd8GN088SIyT
134
+ 0RAFSROyeEg38caDiB/+JEgqxsODrZJ1BkT0oHKSmI0ceQxo94HDpg0qsuDk
135
+ UmRAMgu8OgwQ+uIJgUMVeGXA+IQkzEeHGvD8cIGlDXsLiRjQ+EHroQhea7xY
136
+ 8IQBSgYYDi1IS+OFBCgaDMGVS3fGi5BPJpBaENdQ0EomKGD56IHwO39EXiSC
137
+ Ysgxor5+Xfgq0qByYUpiXmwuoredB2aYH4gWWda0B7SeNENpEJHC1ghi+pS4
138
+ AJpIAwWvKPBi+8YEht5EriEqpFfMlhEdkBNpx0HUhwypx5T4IB1MBg/Ws2sn
139
+ wV3MSQOkzI8fUd48Aw3dOZto71x85hHtHijYv18Gf/3GqCdDCXHNoICBobSo
140
+ IqBqJLyCoH8JPrLgdh88CKCFD0CGmAiGYPgffwceZh6FC2ohIIklnkhehTNY
141
+ 4CIHHGzgwYw01ujBBhvAqKOLLq5AAk9kuSPkkKO40NB+h1gnypJIIvkBf09a
142
+ N5QIRz5p5ZJXJpmlIVhOGQA2TmIJZZhKKmmll2BqyWSXWUrZpQtpatlmk1c2
143
+ KaWRHeTZEJF8SqLDn/hhsOeQgBbqAh6DGqronxeARUIIACH5BAUeAAAALAUA
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
falcon/lib/tk8.6/demos/aniwave.tcl ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # aniwave.tcl --
2
+ #
3
+ # This demonstration script illustrates how to adjust canvas item
4
+ # coordinates in a way that does something fairly similar to waveform
5
+ # display.
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 .aniwave
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Animated Wave Demonstration"
17
+ wm iconname $w "aniwave"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration contains a canvas widget with a line item inside it. The animation routines work by adjusting the coordinates list of the line; a trace on a variable is used so updates to the variable result in a change of position of the line."
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
+ # Create a canvas large enough to hold the wave. In fact, the wave
28
+ # sticks off both sides of the canvas to prevent visual glitches.
29
+ pack [canvas $w.c -width 300 -height 200 -background black] -padx 10 -pady 10 -expand yes
30
+
31
+ # Ensure that this this is an array
32
+ array set animationCallbacks {}
33
+
34
+ # Creates a coordinates list of a wave. This code does a very sketchy
35
+ # job and relies on Tk's line smoothing to make things look better.
36
+ set waveCoords {}
37
+ for {set x -10} {$x<=300} {incr x 5} {
38
+ lappend waveCoords $x 100
39
+ }
40
+ lappend waveCoords $x 0 [incr x 5] 200
41
+
42
+ # Create a smoothed line and arrange for its coordinates to be the
43
+ # contents of the variable waveCoords.
44
+ $w.c create line $waveCoords -tags wave -width 1 -fill green -smooth 1
45
+ proc waveCoordsTracer {w args} {
46
+ global waveCoords
47
+ # Actual visual update will wait until we have finished
48
+ # processing; Tk does that for us automatically.
49
+ $w.c coords wave $waveCoords
50
+ }
51
+ trace add variable waveCoords write [list waveCoordsTracer $w]
52
+
53
+ # Basic motion handler. Given what direction the wave is travelling
54
+ # in, it advances the y coordinates in the coordinate-list one step in
55
+ # that direction.
56
+ proc basicMotion {} {
57
+ global waveCoords direction
58
+ set oc $waveCoords
59
+ for {set i 1} {$i<[llength $oc]} {incr i 2} {
60
+ if {$direction eq "left"} {
61
+ lset waveCoords $i [lindex $oc \
62
+ [expr {$i+2>[llength $oc] ? 1 : $i+2}]]
63
+ } else {
64
+ lset waveCoords $i \
65
+ [lindex $oc [expr {$i-2<0 ? "end" : $i-2}]]
66
+ }
67
+ }
68
+ }
69
+
70
+ # Oscillation handler. This detects whether to reverse the direction
71
+ # of the wave by checking to see if the peak of the wave has moved off
72
+ # the screen (whose size we know already.)
73
+ proc reverser {} {
74
+ global waveCoords direction
75
+ if {[lindex $waveCoords 1] < 10} {
76
+ set direction "right"
77
+ } elseif {[lindex $waveCoords end] < 10} {
78
+ set direction "left"
79
+ }
80
+ }
81
+
82
+ # Main animation "loop". This calls the two procedures that handle the
83
+ # movement repeatedly by scheduling asynchronous calls back to itself
84
+ # using the [after] command. This procedure is the fundamental basis
85
+ # for all animated effect handling in Tk.
86
+ proc move {} {
87
+ basicMotion
88
+ reverser
89
+
90
+ # Theoretically 100 frames-per-second (==10ms between frames)
91
+ global animationCallbacks
92
+ set animationCallbacks(simpleWave) [after 10 move]
93
+ }
94
+
95
+ # Initialise our remaining animation variables
96
+ set direction "left"
97
+ set animateAfterCallback {}
98
+ # Arrange for the animation loop to stop when the canvas is deleted
99
+ bind $w.c <Destroy> {
100
+ after cancel $animationCallbacks(simpleWave)
101
+ unset animationCallbacks(simpleWave)
102
+ }
103
+ # Start the animation processing
104
+ move
falcon/lib/tk8.6/demos/arrow.tcl ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # arrow.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget that displays a
4
+ # large line with an arrowhead whose shape can be edited interactively.
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
+ # arrowSetup --
13
+ # This procedure regenerates all the text and graphics in the canvas
14
+ # window. It's called when the canvas is initially created, and also
15
+ # whenever any of the parameters of the arrow head are changed
16
+ # interactively.
17
+ #
18
+ # Arguments:
19
+ # c - Name of the canvas widget.
20
+
21
+ proc arrowSetup c {
22
+ upvar #0 demo_arrowInfo v
23
+
24
+ # Remember the current box, if there is one.
25
+
26
+ set tags [$c gettags current]
27
+ if {$tags != ""} {
28
+ set cur [lindex $tags [lsearch -glob $tags box?]]
29
+ } else {
30
+ set cur ""
31
+ }
32
+
33
+ # Create the arrow and outline.
34
+
35
+ $c delete all
36
+ eval {$c create line $v(x1) $v(y) $v(x2) $v(y) -arrow last \
37
+ -width [expr {10*$v(width)}] -arrowshape [list \
38
+ [expr {10*$v(a)}] [expr {10*$v(b)}] [expr {10*$v(c)}]]} \
39
+ $v(bigLineStyle)
40
+ set xtip [expr {$v(x2)-10*$v(b)}]
41
+ set deltaY [expr {10*$v(c)+5*$v(width)}]
42
+ $c create line $v(x2) $v(y) $xtip [expr {$v(y)+$deltaY}] \
43
+ [expr {$v(x2)-10*$v(a)}] $v(y) $xtip [expr {$v(y)-$deltaY}] \
44
+ $v(x2) $v(y) -width 2 -capstyle round -joinstyle round
45
+
46
+ # Create the boxes for reshaping the line and arrowhead.
47
+
48
+ eval {$c create rect [expr {$v(x2)-10*$v(a)-5}] [expr {$v(y)-5}] \
49
+ [expr {$v(x2)-10*$v(a)+5}] [expr {$v(y)+5}] \
50
+ -tags {box1 box}} $v(boxStyle)
51
+ eval {$c create rect [expr {$xtip-5}] [expr {$v(y)-$deltaY-5}] \
52
+ [expr {$xtip+5}] [expr {$v(y)-$deltaY+5}] \
53
+ -tags {box2 box}} $v(boxStyle)
54
+ eval {$c create rect [expr {$v(x1)-5}] [expr {$v(y)-5*$v(width)-5}] \
55
+ [expr {$v(x1)+5}] [expr {$v(y)-5*$v(width)+5}] \
56
+ -tags {box3 box}} $v(boxStyle)
57
+ if {$cur != ""} {
58
+ eval $c itemconfigure $cur $v(activeStyle)
59
+ }
60
+
61
+ # Create three arrows in actual size with the same parameters
62
+
63
+ $c create line [expr {$v(x2)+50}] 0 [expr {$v(x2)+50}] 1000 \
64
+ -width 2
65
+ set tmp [expr {$v(x2)+100}]
66
+ $c create line $tmp [expr {$v(y)-125}] $tmp [expr {$v(y)-75}] \
67
+ -width $v(width) \
68
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
69
+ $c create line [expr {$tmp-25}] $v(y) [expr {$tmp+25}] $v(y) \
70
+ -width $v(width) \
71
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
72
+ $c create line [expr {$tmp-25}] [expr {$v(y)+75}] [expr {$tmp+25}] \
73
+ [expr {$v(y)+125}] -width $v(width) \
74
+ -arrow both -arrowshape "$v(a) $v(b) $v(c)"
75
+
76
+ # Create a bunch of other arrows and text items showing the
77
+ # current dimensions.
78
+
79
+ set tmp [expr {$v(x2)+10}]
80
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
81
+ $tmp [expr {$v(y)-$deltaY}] \
82
+ -arrow both -arrowshape $v(smallTips)
83
+ $c create text [expr {$v(x2)+15}] [expr {$v(y)-$deltaY+5*$v(c)}] \
84
+ -text $v(c) -anchor w
85
+ set tmp [expr {$v(x1)-10}]
86
+ $c create line $tmp [expr {$v(y)-5*$v(width)}] \
87
+ $tmp [expr {$v(y)+5*$v(width)}] \
88
+ -arrow both -arrowshape $v(smallTips)
89
+ $c create text [expr {$v(x1)-15}] $v(y) -text $v(width) -anchor e
90
+ set tmp [expr {$v(y)+5*$v(width)+10*$v(c)+10}]
91
+ $c create line [expr {$v(x2)-10*$v(a)}] $tmp $v(x2) $tmp \
92
+ -arrow both -arrowshape $v(smallTips)
93
+ $c create text [expr {$v(x2)-5*$v(a)}] [expr {$tmp+5}] \
94
+ -text $v(a) -anchor n
95
+ set tmp [expr {$tmp+25}]
96
+ $c create line [expr {$v(x2)-10*$v(b)}] $tmp $v(x2) $tmp \
97
+ -arrow both -arrowshape $v(smallTips)
98
+ $c create text [expr {$v(x2)-5*$v(b)}] [expr {$tmp+5}] \
99
+ -text $v(b) -anchor n
100
+
101
+ $c create text $v(x1) 310 -text "-width $v(width)" \
102
+ -anchor w -font {Helvetica 18}
103
+ $c create text $v(x1) 330 -text "-arrowshape {$v(a) $v(b) $v(c)}" \
104
+ -anchor w -font {Helvetica 18}
105
+
106
+ incr v(count)
107
+ }
108
+
109
+ set w .arrow
110
+ catch {destroy $w}
111
+ toplevel $w
112
+ wm title $w "Arrowhead Editor Demonstration"
113
+ wm iconname $w "arrow"
114
+ positionWindow $w
115
+ set c $w.c
116
+
117
+ label $w.msg -font $font -wraplength 5i -justify left -text "This widget allows you to experiment with different widths and arrowhead shapes for lines in canvases. To change the line width or the shape of the arrowhead, drag any of the three boxes attached to the oversized arrow. The arrows on the right give examples at normal scale. The text at the bottom shows the configuration options as you'd enter them for a canvas line item."
118
+ pack $w.msg -side top
119
+
120
+ ## See Code / Dismiss buttons
121
+ set btns [addSeeDismiss $w.buttons $w]
122
+ pack $btns -side bottom -fill x
123
+
124
+ canvas $c -width 500 -height 350 -relief sunken -borderwidth 2
125
+ pack $c -expand yes -fill both
126
+
127
+ set demo_arrowInfo(a) 8
128
+ set demo_arrowInfo(b) 10
129
+ set demo_arrowInfo(c) 3
130
+ set demo_arrowInfo(width) 2
131
+ set demo_arrowInfo(motionProc) arrowMoveNull
132
+ set demo_arrowInfo(x1) 40
133
+ set demo_arrowInfo(x2) 350
134
+ set demo_arrowInfo(y) 150
135
+ set demo_arrowInfo(smallTips) {5 5 2}
136
+ set demo_arrowInfo(count) 0
137
+ if {[winfo depth $c] > 1} {
138
+ if {[tk windowingsystem] eq "aqua"} {
139
+ set demo_arrowInfo(bigLineStyle) "-fill systemSelectedTextBackgroundColor"
140
+ } else {
141
+ set demo_arrowInfo(bigLineStyle) "-fill LightSeaGreen"
142
+ }
143
+ set demo_arrowInfo(boxStyle) "-fill {} -width 1"
144
+ set demo_arrowInfo(activeStyle) "-fill red -width 1"
145
+ } else {
146
+ # Main widget program sets variable tk_demoDirectory
147
+ set demo_arrowInfo(bigLineStyle) "-fill black \
148
+ -stipple @[file join $tk_demoDirectory images grey.25]"
149
+ set demo_arrowInfo(boxStyle) "-fill {} -outline black -width 1"
150
+ set demo_arrowInfo(activeStyle) "-fill black -outline black -width 1"
151
+ }
152
+ arrowSetup $c
153
+ $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
154
+ $c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
155
+ $c bind box <B1-Enter> " "
156
+ $c bind box <B1-Leave> " "
157
+ $c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
158
+ $c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
159
+ $c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
160
+ $c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
161
+ bind $c <ButtonRelease-1> "arrowSetup $c"
162
+
163
+ # arrowMove1 --
164
+ # This procedure is called for each mouse motion event on box1 (the
165
+ # one at the vertex of the arrow). It updates the controlling parameters
166
+ # for the line and arrowhead.
167
+ #
168
+ # Arguments:
169
+ # c - The name of the canvas window.
170
+ # x, y - The coordinates of the mouse.
171
+
172
+ proc arrowMove1 {c x y} {
173
+ upvar #0 demo_arrowInfo v
174
+ set newA [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
175
+ if {$newA < 0} {
176
+ set newA 0
177
+ }
178
+ if {$newA > 25} {
179
+ set newA 25
180
+ }
181
+ if {$newA != $v(a)} {
182
+ $c move box1 [expr {10*($v(a)-$newA)}] 0
183
+ set v(a) $newA
184
+ }
185
+ }
186
+
187
+ # arrowMove2 --
188
+ # This procedure is called for each mouse motion event on box2 (the
189
+ # one at the trailing tip of the arrowhead). It updates the controlling
190
+ # parameters for the line and arrowhead.
191
+ #
192
+ # Arguments:
193
+ # c - The name of the canvas window.
194
+ # x, y - The coordinates of the mouse.
195
+
196
+ proc arrowMove2 {c x y} {
197
+ upvar #0 demo_arrowInfo v
198
+ set newB [expr {($v(x2)+5-round([$c canvasx $x]))/10}]
199
+ if {$newB < 0} {
200
+ set newB 0
201
+ }
202
+ if {$newB > 25} {
203
+ set newB 25
204
+ }
205
+ set newC [expr {($v(y)+5-round([$c canvasy $y])-5*$v(width))/10}]
206
+ if {$newC < 0} {
207
+ set newC 0
208
+ }
209
+ if {$newC > 20} {
210
+ set newC 20
211
+ }
212
+ if {($newB != $v(b)) || ($newC != $v(c))} {
213
+ $c move box2 [expr {10*($v(b)-$newB)}] [expr {10*($v(c)-$newC)}]
214
+ set v(b) $newB
215
+ set v(c) $newC
216
+ }
217
+ }
218
+
219
+ # arrowMove3 --
220
+ # This procedure is called for each mouse motion event on box3 (the
221
+ # one that controls the thickness of the line). It updates the
222
+ # controlling parameters for the line and arrowhead.
223
+ #
224
+ # Arguments:
225
+ # c - The name of the canvas window.
226
+ # x, y - The coordinates of the mouse.
227
+
228
+ proc arrowMove3 {c x y} {
229
+ upvar #0 demo_arrowInfo v
230
+ set newWidth [expr {($v(y)+2-round([$c canvasy $y]))/5}]
231
+ if {$newWidth < 0} {
232
+ set newWidth 0
233
+ }
234
+ if {$newWidth > 20} {
235
+ set newWidth 20
236
+ }
237
+ if {$newWidth != $v(width)} {
238
+ $c move box3 0 [expr {5*($v(width)-$newWidth)}]
239
+ set v(width) $newWidth
240
+ }
241
+ }
falcon/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
falcon/lib/tk8.6/demos/bitmap.tcl ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # bitmap.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window that displays
4
+ # all of Tk's built-in bitmaps.
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
+ # bitmapRow --
13
+ # Create a row of bitmap items in a window.
14
+ #
15
+ # Arguments:
16
+ # w - The window that is to contain the row.
17
+ # args - The names of one or more bitmaps, which will be displayed
18
+ # in a new row across the bottom of w along with their
19
+ # names.
20
+
21
+ proc bitmapRow {w args} {
22
+ frame $w
23
+ pack $w -side top -fill both
24
+ set i 0
25
+ foreach bitmap $args {
26
+ frame $w.$i
27
+ pack $w.$i -side left -fill both -pady .25c -padx .25c
28
+ label $w.$i.bitmap -bitmap $bitmap
29
+ label $w.$i.label -text $bitmap -width 9
30
+ pack $w.$i.label $w.$i.bitmap -side bottom
31
+ incr i
32
+ }
33
+ }
34
+
35
+ set w .bitmap
36
+ catch {destroy $w}
37
+ toplevel $w
38
+ wm title $w "Bitmap Demonstration"
39
+ wm iconname $w "bitmap"
40
+ positionWindow $w
41
+
42
+ label $w.msg -font $font -wraplength 4i -justify left -text "This window displays all of Tk's built-in bitmaps, along with the names you can use for them in Tcl scripts."
43
+ pack $w.msg -side top
44
+
45
+ ## See Code / Dismiss buttons
46
+ set btns [addSeeDismiss $w.buttons $w]
47
+ pack $btns -side bottom -fill x
48
+
49
+ frame $w.frame
50
+ bitmapRow $w.frame.0 error gray12 gray25 gray50 gray75
51
+ bitmapRow $w.frame.1 hourglass info question questhead warning
52
+ pack $w.frame -side top -expand yes -fill both
falcon/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:
falcon/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
falcon/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
falcon/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
+ }
falcon/lib/tk8.6/demos/colors.tcl ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # colors.tcl --
2
+ #
3
+ # This demonstration script creates a listbox widget that displays
4
+ # many of the colors from the X color database. You can click on
5
+ # a color to change the application's palette.
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 .colors
14
+ catch {destroy $w}
15
+ toplevel $w
16
+ wm title $w "Listbox Demonstration (colors)"
17
+ wm iconname $w "Listbox"
18
+ positionWindow $w
19
+
20
+ label $w.msg -font $font -wraplength 4i -justify left -text "A listbox containing several color names is displayed below, along with a scrollbar. You can scan the list either using the scrollbar or by dragging in the listbox window with button 2 pressed. If you double-click button 1 on a color, then the application's color palette will be set to match that color"
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 y
29
+
30
+ scrollbar $w.frame.scroll -command "$w.frame.list yview"
31
+ listbox $w.frame.list -yscroll "$w.frame.scroll set" \
32
+ -width 20 -height 16 -setgrid 1
33
+ pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1
34
+
35
+ bind $w.frame.list <Double-Button-1> {
36
+ tk_setPalette [selection get]
37
+ }
38
+ $w.frame.list insert 0 gray60 gray70 gray80 gray85 gray90 gray95 \
39
+ snow1 snow2 snow3 snow4 seashell1 seashell2 \
40
+ seashell3 seashell4 AntiqueWhite1 AntiqueWhite2 AntiqueWhite3 \
41
+ AntiqueWhite4 bisque1 bisque2 bisque3 bisque4 PeachPuff1 \
42
+ PeachPuff2 PeachPuff3 PeachPuff4 NavajoWhite1 NavajoWhite2 \
43
+ NavajoWhite3 NavajoWhite4 LemonChiffon1 LemonChiffon2 \
44
+ LemonChiffon3 LemonChiffon4 cornsilk1 cornsilk2 cornsilk3 \
45
+ cornsilk4 ivory1 ivory2 ivory3 ivory4 honeydew1 honeydew2 \
46
+ honeydew3 honeydew4 LavenderBlush1 LavenderBlush2 \
47
+ LavenderBlush3 LavenderBlush4 MistyRose1 MistyRose2 \
48
+ MistyRose3 MistyRose4 azure1 azure2 azure3 azure4 \
49
+ SlateBlue1 SlateBlue2 SlateBlue3 SlateBlue4 RoyalBlue1 \
50
+ RoyalBlue2 RoyalBlue3 RoyalBlue4 blue1 blue2 blue3 blue4 \
51
+ DodgerBlue1 DodgerBlue2 DodgerBlue3 DodgerBlue4 SteelBlue1 \
52
+ SteelBlue2 SteelBlue3 SteelBlue4 DeepSkyBlue1 DeepSkyBlue2 \
53
+ DeepSkyBlue3 DeepSkyBlue4 SkyBlue1 SkyBlue2 SkyBlue3 \
54
+ SkyBlue4 LightSkyBlue1 LightSkyBlue2 LightSkyBlue3 \
55
+ LightSkyBlue4 SlateGray1 SlateGray2 SlateGray3 SlateGray4 \
56
+ LightSteelBlue1 LightSteelBlue2 LightSteelBlue3 \
57
+ LightSteelBlue4 LightBlue1 LightBlue2 LightBlue3 \
58
+ LightBlue4 LightCyan1 LightCyan2 LightCyan3 LightCyan4 \
59
+ PaleTurquoise1 PaleTurquoise2 PaleTurquoise3 PaleTurquoise4 \
60
+ CadetBlue1 CadetBlue2 CadetBlue3 CadetBlue4 turquoise1 \
61
+ turquoise2 turquoise3 turquoise4 cyan1 cyan2 cyan3 cyan4 \
62
+ DarkSlateGray1 DarkSlateGray2 DarkSlateGray3 \
63
+ DarkSlateGray4 aquamarine1 aquamarine2 aquamarine3 \
64
+ aquamarine4 DarkSeaGreen1 DarkSeaGreen2 DarkSeaGreen3 \
65
+ DarkSeaGreen4 SeaGreen1 SeaGreen2 SeaGreen3 SeaGreen4 \
66
+ PaleGreen1 PaleGreen2 PaleGreen3 PaleGreen4 SpringGreen1 \
67
+ SpringGreen2 SpringGreen3 SpringGreen4 green1 green2 \
68
+ green3 green4 chartreuse1 chartreuse2 chartreuse3 \
69
+ chartreuse4 OliveDrab1 OliveDrab2 OliveDrab3 OliveDrab4 \
70
+ DarkOliveGreen1 DarkOliveGreen2 DarkOliveGreen3 \
71
+ DarkOliveGreen4 khaki1 khaki2 khaki3 khaki4 \
72
+ LightGoldenrod1 LightGoldenrod2 LightGoldenrod3 \
73
+ LightGoldenrod4 LightYellow1 LightYellow2 LightYellow3 \
74
+ LightYellow4 yellow1 yellow2 yellow3 yellow4 gold1 gold2 \
75
+ gold3 gold4 goldenrod1 goldenrod2 goldenrod3 goldenrod4 \
76
+ DarkGoldenrod1 DarkGoldenrod2 DarkGoldenrod3 DarkGoldenrod4 \
77
+ RosyBrown1 RosyBrown2 RosyBrown3 RosyBrown4 IndianRed1 \
78
+ IndianRed2 IndianRed3 IndianRed4 sienna1 sienna2 sienna3 \
79
+ sienna4 burlywood1 burlywood2 burlywood3 burlywood4 wheat1 \
80
+ wheat2 wheat3 wheat4 tan1 tan2 tan3 tan4 chocolate1 \
81
+ chocolate2 chocolate3 chocolate4 firebrick1 firebrick2 \
82
+ firebrick3 firebrick4 brown1 brown2 brown3 brown4 salmon1 \
83
+ salmon2 salmon3 salmon4 LightSalmon1 LightSalmon2 \
84
+ LightSalmon3 LightSalmon4 orange1 orange2 orange3 orange4 \
85
+ DarkOrange1 DarkOrange2 DarkOrange3 DarkOrange4 coral1 \
86
+ coral2 coral3 coral4 tomato1 tomato2 tomato3 tomato4 \
87
+ OrangeRed1 OrangeRed2 OrangeRed3 OrangeRed4 red1 red2 red3 \
88
+ red4 DeepPink1 DeepPink2 DeepPink3 DeepPink4 HotPink1 \
89
+ HotPink2 HotPink3 HotPink4 pink1 pink2 pink3 pink4 \
90
+ LightPink1 LightPink2 LightPink3 LightPink4 PaleVioletRed1 \
91
+ PaleVioletRed2 PaleVioletRed3 PaleVioletRed4 maroon1 \
92
+ maroon2 maroon3 maroon4 VioletRed1 VioletRed2 VioletRed3 \
93
+ VioletRed4 magenta1 magenta2 magenta3 magenta4 orchid1 \
94
+ orchid2 orchid3 orchid4 plum1 plum2 plum3 plum4 \
95
+ MediumOrchid1 MediumOrchid2 MediumOrchid3 MediumOrchid4 \
96
+ DarkOrchid1 DarkOrchid2 DarkOrchid3 DarkOrchid4 purple1 \
97
+ purple2 purple3 purple4 MediumPurple1 MediumPurple2 \
98
+ MediumPurple3 MediumPurple4 thistle1 thistle2 thistle3 \
99
+ thistle4
falcon/lib/tk8.6/demos/ctext.tcl ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ctext.tcl --
2
+ #
3
+ # This demonstration script creates a canvas widget with a text
4
+ # item that can be edited and reconfigured in various ways.
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 .ctext
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Canvas Text Demonstration"
16
+ wm iconname $w "Text"
17
+ positionWindow $w
18
+ set c $w.c
19
+
20
+ label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification, and on a pie slice to change its angle. The text also supports the following simple bindings for editing:
21
+ 1. You can point, click, and type.
22
+ 2. You can also select with button 1.
23
+ 3. You can copy the selection to the mouse position with button 2.
24
+ 4. Backspace and Control+h delete the selection if there is one;
25
+ otherwise they delete the character just before the insertion cursor.
26
+ 5. Delete deletes the selection if there is one; otherwise it deletes
27
+ the character just after the insertion cursor."
28
+ pack $w.msg -side top
29
+
30
+ ## See Code / Dismiss buttons
31
+ set btns [addSeeDismiss $w.buttons $w]
32
+ pack $btns -side bottom -fill x
33
+
34
+ canvas $c -relief flat -borderwidth 0 -width 500 -height 350
35
+ pack $w.c -side top -expand yes -fill both
36
+
37
+ set textFont {Helvetica 24}
38
+
39
+ $c create rectangle 245 195 255 205 -outline black -fill red
40
+
41
+ # First, create the text item and give it bindings so it can be edited.
42
+
43
+ $c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
44
+ $c bind text <Button-1> "textB1Press $c %x %y"
45
+ $c bind text <B1-Motion> "textB1Move $c %x %y"
46
+ $c bind text <Shift-Button-1> "$c select adjust current @%x,%y"
47
+ $c bind text <Shift-B1-Motion> "textB1Move $c %x %y"
48
+ $c bind text <Key> "textInsert $c %A"
49
+ $c bind text <Return> "textInsert $c \\n"
50
+ $c bind text <Control-h> "textBs $c"
51
+ $c bind text <BackSpace> "textBs $c"
52
+ $c bind text <Delete> "textDel $c"
53
+ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
54
+ $c bind text <Button-3> "textPaste $c @%x,%y"
55
+ } else {
56
+ $c bind text <Button-2> "textPaste $c @%x,%y"
57
+ }
58
+
59
+ # Next, create some items that allow the text's anchor position
60
+ # to be edited.
61
+
62
+ proc mkTextConfigBox {w x y option value color} {
63
+ set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
64
+ -outline black -fill $color -width 1]
65
+ $w bind $item <Button-1> "$w itemconf text $option $value"
66
+ $w addtag config withtag $item
67
+ }
68
+ proc mkTextConfigPie {w x y a option value color} {
69
+ set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
70
+ -start [expr {$a-15}] -extent 30 -outline black -fill $color \
71
+ -width 1]
72
+ $w bind $item <Button-1> "$w itemconf text $option $value"
73
+ $w addtag config withtag $item
74
+ }
75
+
76
+ set x 50
77
+ set y 50
78
+ set color LightSkyBlue1
79
+ mkTextConfigBox $c $x $y -anchor se $color
80
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y }] -anchor s $color
81
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y }] -anchor sw $color
82
+ mkTextConfigBox $c [expr {$x }] [expr {$y+30}] -anchor e $color
83
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
84
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
85
+ mkTextConfigBox $c [expr {$x }] [expr {$y+60}] -anchor ne $color
86
+ mkTextConfigBox $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
87
+ mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
88
+ set item [$c create rect \
89
+ [expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
90
+ -outline black -fill red]
91
+ $c bind $item <Button-1> "$c itemconf text -anchor center"
92
+ $c create text [expr {$x+45}] [expr {$y-5}] \
93
+ -text {Text Position} -anchor s -font {Times 20} -fill brown
94
+
95
+ # Now create some items that allow the text's angle to be changed.
96
+
97
+ set x 205
98
+ set y 50
99
+ set color Yellow
100
+ mkTextConfigPie $c $x $y 0 -angle 90 $color
101
+ mkTextConfigPie $c $x $y 30 -angle 120 $color
102
+ mkTextConfigPie $c $x $y 60 -angle 150 $color
103
+ mkTextConfigPie $c $x $y 90 -angle 180 $color
104
+ mkTextConfigPie $c $x $y 120 -angle 210 $color
105
+ mkTextConfigPie $c $x $y 150 -angle 240 $color
106
+ mkTextConfigPie $c $x $y 180 -angle 270 $color
107
+ mkTextConfigPie $c $x $y 210 -angle 300 $color
108
+ mkTextConfigPie $c $x $y 240 -angle 330 $color
109
+ mkTextConfigPie $c $x $y 270 -angle 0 $color
110
+ mkTextConfigPie $c $x $y 300 -angle 30 $color
111
+ mkTextConfigPie $c $x $y 330 -angle 60 $color
112
+ $c create text [expr {$x+45}] [expr {$y-5}] \
113
+ -text {Text Angle} -anchor s -font {Times 20} -fill brown
114
+
115
+ # Lastly, create some items that allow the text's justification to be
116
+ # changed.
117
+
118
+ set x 350
119
+ set y 50
120
+ set color SeaGreen2
121
+ mkTextConfigBox $c $x $y -justify left $color
122
+ mkTextConfigBox $c [expr {$x+30}] $y -justify center $color
123
+ mkTextConfigBox $c [expr {$x+60}] $y -justify right $color
124
+ $c create text [expr {$x+45}] [expr {$y-5}] \
125
+ -text {Justification} -anchor s -font {Times 20} -fill brown
126
+
127
+ $c bind config <Enter> "textEnter $c"
128
+ $c bind config <Leave> "$c itemconf current -fill \$textConfigFill"
129
+
130
+ set textConfigFill {}
131
+
132
+ proc textEnter {w} {
133
+ global textConfigFill
134
+ set textConfigFill [lindex [$w itemconfig current -fill] 4]
135
+ $w itemconfig current -fill black
136
+ }
137
+
138
+ proc textInsert {w string} {
139
+ if {$string == ""} {
140
+ return
141
+ }
142
+ catch {$w dchars text sel.first sel.last}
143
+ $w insert text insert $string
144
+ }
145
+
146
+ proc textPaste {w pos} {
147
+ catch {
148
+ $w insert text $pos [selection get]
149
+ }
150
+ }
151
+
152
+ proc textB1Press {w x y} {
153
+ $w icursor current @$x,$y
154
+ $w focus current
155
+ focus $w
156
+ $w select from current @$x,$y
157
+ }
158
+
159
+ proc textB1Move {w x y} {
160
+ $w select to current @$x,$y
161
+ }
162
+
163
+ proc textBs {w} {
164
+ if {![catch {$w dchars text sel.first sel.last}]} {
165
+ return
166
+ }
167
+ set char [expr {[$w index text insert] - 1}]
168
+ if {$char >= 0} {$w dchar text $char}
169
+ }
170
+
171
+ proc textDel {w} {
172
+ if {![catch {$w dchars text sel.first sel.last}]} {
173
+ return
174
+ }
175
+ $w dchars text insert
176
+ }
falcon/lib/tk8.6/demos/dialog1.tcl ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dialog1.tcl --
2
+ #
3
+ # This demonstration script creates a dialog box with a local grab.
4
+
5
+ interp create child
6
+ load {} Tk child
7
+ child eval {
8
+ wm title . child
9
+ wm geometry . +700+30
10
+ pack [text .t -width 30 -height 10]
11
+ }
12
+
13
+ after idle {.dialog1.msg configure -wraplength 4i}
14
+ set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
15
+ info 0 OK Cancel {Show Code}]
16
+
17
+ switch $i {
18
+ 0 {puts "You pressed OK"}
19
+ 1 {puts "You pressed Cancel"}
20
+ 2 {showCode .dialog1}
21
+ }
22
+
23
+ if {[interp exists child]} {
24
+ interp delete child
25
+ }
falcon/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
+ }
falcon/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"
falcon/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."
falcon/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
+ }
falcon/lib/tk8.6/demos/floor.tcl ADDED
@@ -0,0 +1,1372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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"
falcon/lib/tk8.6/demos/fontchoose.tcl ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # fontchoose.tcl --
2
+ #
3
+ # Show off the stock font selector dialog
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 .fontchoose
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Font Selection Dialog"
15
+ wm iconname $w "fontchooser"
16
+ positionWindow $w
17
+
18
+ catch {font create FontchooseDemoFont {*}[font actual TkDefaultFont]}
19
+
20
+ # The font chooser needs to be configured and then shown.
21
+ proc SelectFont {parent} {
22
+ tk fontchooser configure -font FontchooseDemoFont \
23
+ -command ApplyFont -parent $parent
24
+ tk fontchooser show
25
+ }
26
+
27
+ proc ApplyFont {font} {
28
+ font configure FontchooseDemoFont {*}[font actual $font]
29
+ }
30
+
31
+ # When the visibility of the fontchooser changes, the following event is fired
32
+ # to the parent widget.
33
+ #
34
+ bind $w <<TkFontchooserVisibility>> {
35
+ if {[tk fontchooser configure -visible]} {
36
+ %W.f.font state disabled
37
+ } else {
38
+ %W.f.font state !disabled
39
+ }
40
+ }
41
+
42
+
43
+ set f [ttk::frame $w.f -relief sunken -padding 2]
44
+
45
+ text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \
46
+ -yscrollcommand [list $f.vs set]
47
+ ttk::scrollbar $f.vs -command [list $f.msg yview]
48
+
49
+ $f.msg insert end "Press the buttons below to choose a new font for the\
50
+ text shown in this window.\n" {}
51
+
52
+ ttk::button $f.font -text "Set font ..." -command [list SelectFont $w]
53
+
54
+ grid $f.msg $f.vs -sticky news
55
+ grid $f.font - -sticky e
56
+ grid columnconfigure $f 0 -weight 1
57
+ grid rowconfigure $f 0 -weight 1
58
+
59
+ ## See Code / Dismiss buttons
60
+ set btns [addSeeDismiss $w.buttons $w]
61
+
62
+ grid $f -sticky news
63
+ grid $btns -sticky ew
64
+ grid columnconfigure $w 0 -weight 1
65
+ grid rowconfigure $w 0 -weight 1
66
+ update idletasks
67
+ grid propagate $f 0
falcon/lib/tk8.6/demos/goldberg.tcl ADDED
@@ -0,0 +1,1834 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
falcon/lib/tk8.6/demos/hscale.tcl ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # hscale.tcl --
2
+ #
3
+ # This demonstration script shows an example with a horizontal 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 .hscale
12
+ catch {destroy $w}
13
+ toplevel $w
14
+ wm title $w "Horizontal Scale Demonstration"
15
+ wm iconname $w "hscale"
16
+ positionWindow $w
17
+
18
+ label $w.msg -font $font -wraplength 3.5i -justify left -text "An arrow and a horizontal scale are displayed below. If you click or drag mouse button 1 in the scale, you can change the length 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 -side top -fill x
27
+
28
+ canvas $w.frame.canvas -width 50 -height 50 -bd 0 -highlightthickness 0
29
+ $w.frame.canvas create polygon 0 0 1 1 2 2 -fill DeepSkyBlue3 -tags poly
30
+ $w.frame.canvas create line 0 0 1 1 2 2 0 0 -fill black -tags line
31
+ scale $w.frame.scale -orient horizontal -length 284 -from 0 -to 250 \
32
+ -command "setWidth $w.frame.canvas" -tickinterval 50
33
+ pack $w.frame.canvas -side top -expand yes -anchor s -fill x -padx 15
34
+ pack $w.frame.scale -side bottom -expand yes -anchor n
35
+ $w.frame.scale set 75
36
+
37
+ proc setWidth {w width} {
38
+ incr width 21
39
+ set x2 [expr {$width - 30}]
40
+ if {$x2 < 21} {
41
+ set x2 21
42
+ }
43
+ $w coords poly 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
44
+ $w coords line 20 15 20 35 $x2 35 $x2 45 $width 25 $x2 5 $x2 15 20 15
45
+ }
falcon/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
falcon/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
falcon/lib/tk8.6/demos/image2.tcl ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # image2.tcl --
2
+ #
3
+ # This demonstration script creates a simple collection of widgets
4
+ # that allow you to select and view images in a Tk label.
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
+ # loadDir --
13
+ # This procedure reloads the directory listbox from the directory
14
+ # named in the demo's entry.
15
+ #
16
+ # Arguments:
17
+ # w - Name of the toplevel window of the demo.
18
+
19
+ proc loadDir w {
20
+ global dirName
21
+
22
+ $w.f.list delete 0 end
23
+ foreach i [lsort [glob -type f -directory $dirName *]] {
24
+ $w.f.list insert end [file tail $i]
25
+ }
26
+ }
27
+
28
+ # selectAndLoadDir --
29
+ # This procedure pops up a dialog to ask for a directory to load into
30
+ # the listobx and (if the user presses OK) reloads the directory
31
+ # listbox from the directory named in the demo's entry.
32
+ #
33
+ # Arguments:
34
+ # w - Name of the toplevel window of the demo.
35
+
36
+ proc selectAndLoadDir w {
37
+ global dirName
38
+ set dir [tk_chooseDirectory -initialdir $dirName -parent $w -mustexist 1]
39
+ if {$dir ne ""} {
40
+ set dirName $dir
41
+ loadDir $w
42
+ }
43
+ }
44
+
45
+ # loadImage --
46
+ # Given the name of the toplevel window of the demo and the mouse
47
+ # position, extracts the directory entry under the mouse and loads
48
+ # that file into a photo image for display.
49
+ #
50
+ # Arguments:
51
+ # w - Name of the toplevel window of the demo.
52
+ # x, y- Mouse position within the listbox.
53
+
54
+ proc loadImage {w x y} {
55
+ global dirName
56
+
57
+ set file [file join $dirName [$w.f.list get @$x,$y]]
58
+ if {[catch {
59
+ image2a configure -file $file
60
+ }]} then {
61
+ # Mark the file as not loadable
62
+ $w.f.list itemconfigure @$x,$y -bg \#c00000 -selectbackground \#ff0000
63
+ }
64
+ }
65
+
66
+ set w .image2
67
+ catch {destroy $w}
68
+ toplevel $w
69
+ wm title $w "Image Demonstration #2"
70
+ wm iconname $w "Image2"
71
+ positionWindow $w
72
+
73
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration allows you to view images using a Tk \"photo\" image. First type a directory name in the listbox, then type Return to load the directory into the listbox. Then double-click on a file name in the listbox to see that image."
74
+ pack $w.msg -side top
75
+
76
+ ## See Code / Dismiss buttons
77
+ set btns [addSeeDismiss $w.buttons $w]
78
+ pack $btns -side bottom -fill x
79
+
80
+ frame $w.mid
81
+ pack $w.mid -fill both -expand 1
82
+
83
+ labelframe $w.dir -text "Directory:"
84
+ # Main widget program sets variable tk_demoDirectory
85
+ set dirName [file join $tk_demoDirectory images]
86
+ entry $w.dir.e -width 30 -textvariable dirName
87
+ button $w.dir.b -pady 0 -padx 2m -text "Select Dir." \
88
+ -command "selectAndLoadDir $w"
89
+ bind $w.dir.e <Return> "loadDir $w"
90
+ pack $w.dir.e -side left -fill both -padx 2m -pady 2m -expand true
91
+ pack $w.dir.b -side left -fill y -padx {0 2m} -pady 2m
92
+ labelframe $w.f -text "File:" -padx 2m -pady 2m
93
+
94
+ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
95
+ ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
96
+ pack $w.f.list $w.f.scroll -side left -fill y -expand 1
97
+ $w.f.list insert 0 earth.gif earthris.gif teapot.ppm
98
+ bind $w.f.list <Double-Button-1> "loadImage $w %x %y"
99
+
100
+ catch {image delete image2a}
101
+ image create photo image2a
102
+ labelframe $w.image -text "Image:"
103
+ label $w.image.image -image image2a
104
+ pack $w.image.image -padx 2m -pady 2m
105
+
106
+ grid $w.dir - -sticky ew -padx 1m -pady 1m -in $w.mid
107
+ grid $w.f $w.image -sticky nw -padx 1m -pady 1m -in $w.mid
108
+ grid columnconfigure $w.mid 1 -weight 1
falcon/lib/tk8.6/demos/images/gray25.xbm ADDED
falcon/lib/tk8.6/demos/images/letters.xbm ADDED
falcon/lib/tk8.6/demos/images/ouster.png ADDED

Git LFS Details

  • SHA256: a2fe354dfcb09b9eeb488128f4ac0b498766faf4a8becf65bbcd779bdb9c4c8f
  • Pointer size: 130 Bytes
  • Size of remote file: 54.3 kB
falcon/lib/tk8.6/demos/ixset ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # ixset --
6
+ # A nice interface to "xset" to change X server settings
7
+ #
8
+ # History :
9
+ # 91/11/23 : [email protected], [email protected] : design
10
+ # 92/08/01 : [email protected] : cleaning
11
+
12
+ package require Tk
13
+
14
+ #
15
+ # Button actions
16
+ #
17
+
18
+ proc quit {} {
19
+ destroy .
20
+ }
21
+
22
+ proc ok {} {
23
+ writesettings
24
+ quit
25
+ }
26
+
27
+ proc cancel {} {
28
+ readsettings
29
+ dispsettings
30
+ .buttons.apply configure -state disabled
31
+ .buttons.cancel configure -state disabled
32
+ }
33
+
34
+ proc apply {} {
35
+ writesettings
36
+ .buttons.apply configure -state disabled
37
+ .buttons.cancel configure -state disabled
38
+ }
39
+
40
+ #
41
+ # Read current settings
42
+ #
43
+
44
+ proc readsettings {} {
45
+ global kbdrep ; set kbdrep "on"
46
+ global kbdcli ; set kbdcli 0
47
+ global bellvol ; set bellvol 100
48
+ global bellpit ; set bellpit 440
49
+ global belldur ; set belldur 100
50
+ global mouseacc ; set mouseacc "3/1"
51
+ global mousethr ; set mousethr 4
52
+ global screenbla ; set screenbla "blank"
53
+ global screentim ; set screentim 600
54
+ global screencyc ; set screencyc 600
55
+
56
+ set xfd [open "|xset q" r]
57
+ while {[gets $xfd line] >= 0} {
58
+ switch -- [lindex $line 0] {
59
+ auto {
60
+ set rpt [lindex $line 1]
61
+ if {$rpt eq "repeat:"} {
62
+ set kbdrep [lindex $line 2]
63
+ set kbdcli [lindex $line 6]
64
+ }
65
+ }
66
+ bell {
67
+ set bellvol [lindex $line 2]
68
+ set bellpit [lindex $line 5]
69
+ set belldur [lindex $line 8]
70
+ }
71
+ acceleration: {
72
+ set mouseacc [lindex $line 1]
73
+ set mousethr [lindex $line 3]
74
+ }
75
+ prefer {
76
+ set bla [lindex $line 2]
77
+ set screenbla [expr {$bla eq "yes" ? "blank" : "noblank"}]
78
+ }
79
+ timeout: {
80
+ set screentim [lindex $line 1]
81
+ set screencyc [lindex $line 3]
82
+ }
83
+ }
84
+ }
85
+ close $xfd
86
+
87
+ # puts stdout [format "Key REPEAT = %s\n" $kbdrep]
88
+ # puts stdout [format "Key CLICK = %s\n" $kbdcli]
89
+ # puts stdout [format "Bell VOLUME = %s\n" $bellvol]
90
+ # puts stdout [format "Bell PITCH = %s\n" $bellpit]
91
+ # puts stdout [format "Bell DURATION = %s\n" $belldur]
92
+ # puts stdout [format "Mouse ACCELERATION = %s\n" $mouseacc]
93
+ # puts stdout [format "Mouse THRESHOLD = %s\n" $mousethr]
94
+ # puts stdout [format "Screen BLANCK = %s\n" $screenbla]
95
+ # puts stdout [format "Screen TIMEOUT = %s\n" $screentim]
96
+ # puts stdout [format "Screen CYCLE = %s\n" $screencyc]
97
+ }
98
+
99
+
100
+ #
101
+ # Write settings into the X server
102
+ #
103
+
104
+ proc writesettings {} {
105
+ global kbdrep kbdcli bellvol bellpit belldur
106
+ global mouseacc mousethr screenbla screentim screencyc
107
+
108
+ set bellvol [.bell.vol get]
109
+ set bellpit [.bell.val.pit.entry get]
110
+ set belldur [.bell.val.dur.entry get]
111
+
112
+ if {$kbdrep eq "on"} {
113
+ set kbdcli [.kbd.val.cli get]
114
+ } else {
115
+ set kbdcli "off"
116
+ }
117
+
118
+ set mouseacc [.mouse.hor.acc.entry get]
119
+ set mousethr [.mouse.hor.thr.entry get]
120
+
121
+ set screentim [.screen.tim.entry get]
122
+ set screencyc [.screen.cyc.entry get]
123
+
124
+ exec xset \
125
+ b $bellvol $bellpit $belldur \
126
+ c $kbdcli \
127
+ r $kbdrep \
128
+ m $mouseacc $mousethr \
129
+ s $screentim $screencyc \
130
+ s $screenbla
131
+ }
132
+
133
+
134
+ #
135
+ # Sends all settings to the window
136
+ #
137
+
138
+ proc dispsettings {} {
139
+ global kbdrep kbdcli bellvol bellpit belldur
140
+ global mouseacc mousethr screenbla screentim screencyc
141
+
142
+ .bell.vol set $bellvol
143
+ .bell.val.pit.entry delete 0 end
144
+ .bell.val.pit.entry insert 0 $bellpit
145
+ .bell.val.dur.entry delete 0 end
146
+ .bell.val.dur.entry insert 0 $belldur
147
+
148
+ .kbd.val.onoff [expr {$kbdrep eq "on" ? "select" : "deselect"}]
149
+ .kbd.val.cli set $kbdcli
150
+
151
+ .mouse.hor.acc.entry delete 0 end
152
+ .mouse.hor.acc.entry insert 0 $mouseacc
153
+ .mouse.hor.thr.entry delete 0 end
154
+ .mouse.hor.thr.entry insert 0 $mousethr
155
+
156
+ .screen.blank [expr {$screenbla eq "blank" ? "select" : "deselect"}]
157
+ .screen.pat [expr {$screenbla ne "blank" ? "select" : "deselect"}]
158
+ .screen.tim.entry delete 0 end
159
+ .screen.tim.entry insert 0 $screentim
160
+ .screen.cyc.entry delete 0 end
161
+ .screen.cyc.entry insert 0 $screencyc
162
+ }
163
+
164
+
165
+ #
166
+ # Create all windows, and pack them
167
+ #
168
+
169
+ proc labelentry {path text length {range {}}} {
170
+ frame $path
171
+ label $path.label -text $text
172
+ if {[llength $range]} {
173
+ spinbox $path.entry -width $length -relief sunken \
174
+ -from [lindex $range 0] -to [lindex $range 1]
175
+ } else {
176
+ entry $path.entry -width $length -relief sunken
177
+ }
178
+ pack $path.label -side left
179
+ pack $path.entry -side right -expand y -fill x
180
+ }
181
+
182
+ proc createwindows {} {
183
+ #
184
+ # Buttons
185
+ #
186
+
187
+ frame .buttons
188
+ button .buttons.ok -default active -command ok -text "Ok"
189
+ button .buttons.apply -default normal -command apply -text "Apply" \
190
+ -state disabled
191
+ button .buttons.cancel -default normal -command cancel -text "Cancel" \
192
+ -state disabled
193
+ button .buttons.quit -default normal -command quit -text "Quit"
194
+
195
+ pack .buttons.ok .buttons.apply .buttons.cancel .buttons.quit \
196
+ -side left -expand yes -pady 5
197
+
198
+ bind . <Return> {.buttons.ok flash; .buttons.ok invoke}
199
+ bind . <Escape> {.buttons.quit flash; .buttons.quit invoke}
200
+ bind . <Button-1> {
201
+ if {![string match .buttons* %W]} {
202
+ .buttons.apply configure -state normal
203
+ .buttons.cancel configure -state normal
204
+ }
205
+ }
206
+ bind . <Key> {
207
+ if {![string match .buttons* %W]} {
208
+ switch -glob %K {
209
+ Return - Escape - Tab - *Shift* {}
210
+ default {
211
+ .buttons.apply configure -state normal
212
+ .buttons.cancel configure -state normal
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ #
219
+ # Bell settings
220
+ #
221
+
222
+ labelframe .bell -text "Bell Settings" -padx 1.5m -pady 1.5m
223
+ scale .bell.vol \
224
+ -from 0 -to 100 -length 200 -tickinterval 20 \
225
+ -label "Volume (%)" -orient horizontal
226
+
227
+ frame .bell.val
228
+ labelentry .bell.val.pit "Pitch (Hz)" 6 {25 20000}
229
+ labelentry .bell.val.dur "Duration (ms)" 6 {1 10000}
230
+ pack .bell.val.pit -side left -padx 5
231
+ pack .bell.val.dur -side right -padx 5
232
+ pack .bell.vol .bell.val -side top -expand yes
233
+
234
+ #
235
+ # Keyboard settings
236
+ #
237
+
238
+ labelframe .kbd -text "Keyboard Repeat Settings" -padx 1.5m -pady 1.5m
239
+
240
+ frame .kbd.val
241
+ checkbutton .kbd.val.onoff \
242
+ -text "On" \
243
+ -onvalue "on" -offvalue "off" -variable kbdrep \
244
+ -relief flat
245
+ scale .kbd.val.cli \
246
+ -from 0 -to 100 -length 200 -tickinterval 20 \
247
+ -label "Click Volume (%)" -orient horizontal
248
+ pack .kbd.val.onoff -side left -fill x -expand yes -padx {0 1m}
249
+ pack .kbd.val.cli -side left -expand yes -fill x -padx {1m 0}
250
+
251
+ pack .kbd.val -side top -expand yes -pady 2 -fill x
252
+
253
+ #
254
+ # Mouse settings
255
+ #
256
+
257
+ labelframe .mouse -text "Mouse Settings" -padx 1.5m -pady 1.5m
258
+
259
+ frame .mouse.hor
260
+ labelentry .mouse.hor.acc "Acceleration" 5
261
+ labelentry .mouse.hor.thr "Threshold (pixels)" 3 {1 2000}
262
+
263
+ pack .mouse.hor.acc -side left -padx {0 1m}
264
+ pack .mouse.hor.thr -side right -padx {1m 0}
265
+
266
+ pack .mouse.hor -side top -expand yes
267
+
268
+ #
269
+ # Screen Saver settings
270
+ #
271
+
272
+ labelframe .screen -text "Screen-saver Settings" -padx 1.5m -pady 1.5m
273
+
274
+ radiobutton .screen.blank \
275
+ -variable screenblank -text "Blank" -relief flat \
276
+ -value "blank" -variable screenbla -anchor w
277
+ radiobutton .screen.pat \
278
+ -variable screenblank -text "Pattern" -relief flat \
279
+ -value "noblank" -variable screenbla -anchor w
280
+ labelentry .screen.tim "Timeout (s)" 5 {1 100000}
281
+ labelentry .screen.cyc "Cycle (s)" 5 {1 100000}
282
+
283
+ grid .screen.blank .screen.tim -sticky e
284
+ grid .screen.pat .screen.cyc -sticky e
285
+ grid configure .screen.blank .screen.pat -sticky ew
286
+
287
+ #
288
+ # Main window
289
+ #
290
+
291
+ pack .buttons -side top -fill both
292
+ pack .bell .kbd .mouse .screen -side top -fill both -expand yes \
293
+ -padx 1m -pady 1m
294
+
295
+ #
296
+ # Let the user resize our window
297
+ #
298
+ wm minsize . 10 10
299
+ }
300
+
301
+ ##############################################################################
302
+ # Main program
303
+
304
+ #
305
+ # Listen what "xset" tells us...
306
+ #
307
+
308
+ readsettings
309
+
310
+ #
311
+ # Create all windows
312
+ #
313
+
314
+ createwindows
315
+
316
+ #
317
+ # Write xset parameters
318
+ #
319
+
320
+ dispsettings
321
+
322
+ #
323
+ # Now, wait for user actions...
324
+ #
325
+
326
+ # Local Variables:
327
+ # mode: tcl
328
+ # End:
falcon/lib/tk8.6/demos/knightstour.tcl ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2008 Pat Thoyts <[email protected]>
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
+ }
falcon/lib/tk8.6/demos/label.tcl ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # label.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several 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 .label
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Label Demonstration"
16
+ wm iconname $w "label"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right. Labels are pretty boring because you can't do anything with them."
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.left
27
+ frame $w.right
28
+ pack $w.left $w.right -side left -expand yes -padx 10 -pady 10 -fill both
29
+
30
+ label $w.left.l1 -text "First label"
31
+ label $w.left.l2 -text "Second label, raised" -relief raised
32
+ label $w.left.l3 -text "Third label, sunken" -relief sunken
33
+ pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w
34
+
35
+ # Main widget program sets variable tk_demoDirectory
36
+ image create photo label.ousterhout \
37
+ -file [file join $tk_demoDirectory images ouster.png]
38
+ label $w.right.picture -borderwidth 2 -relief sunken -image label.ousterhout
39
+ label $w.right.caption -text "Tcl/Tk Creator"
40
+ pack $w.right.picture $w.right.caption -side top
falcon/lib/tk8.6/demos/labelframe.tcl ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # labelframe.tcl --
2
+ #
3
+ # This demonstration script creates a toplevel window containing
4
+ # several labelframe 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 .labelframe
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Labelframe Demonstration"
16
+ wm iconname $w "labelframe"
17
+ positionWindow $w
18
+
19
+ # Some information
20
+
21
+ label $w.msg -font $font -wraplength 4i -justify left -text "Labelframes are\
22
+ used to group related widgets together. The label may be either \
23
+ plain text or another widget."
24
+ pack $w.msg -side top
25
+
26
+ ## See Code / Dismiss buttons
27
+ set btns [addSeeDismiss $w.buttons $w]
28
+ pack $btns -side bottom -fill x
29
+
30
+ # Demo area
31
+
32
+ frame $w.f
33
+ pack $w.f -side bottom -fill both -expand 1
34
+ set w $w.f
35
+
36
+ # A group of radiobuttons in a labelframe
37
+
38
+ labelframe $w.f -text "Value" -padx 2 -pady 2
39
+ grid $w.f -row 0 -column 0 -pady 2m -padx 2m
40
+
41
+ foreach value {1 2 3 4} {
42
+ radiobutton $w.f.b$value -text "This is value $value" \
43
+ -variable lfdummy -value $value
44
+ pack $w.f.b$value -side top -fill x -pady 2
45
+ }
46
+
47
+
48
+ # Using a label window to control a group of options.
49
+
50
+ proc lfEnableButtons {w} {
51
+ foreach child [winfo children $w] {
52
+ if {$child == "$w.cb"} continue
53
+ if {$::lfdummy2} {
54
+ $child configure -state normal
55
+ } else {
56
+ $child configure -state disabled
57
+ }
58
+ }
59
+ }
60
+
61
+ labelframe $w.f2 -pady 2 -padx 2
62
+ checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \
63
+ -command "lfEnableButtons $w.f2" -padx 0
64
+ $w.f2 configure -labelwidget $w.f2.cb
65
+ grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m
66
+
67
+ set t 0
68
+ foreach str {Option1 Option2 Option3} {
69
+ checkbutton $w.f2.b$t -text $str
70
+ pack $w.f2.b$t -side top -fill x -pady 2
71
+ incr t
72
+ }
73
+ lfEnableButtons $w.f2
74
+
75
+
76
+ grid columnconfigure $w {0 1} -weight 1
falcon/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.
falcon/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
+ }
falcon/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
falcon/lib/tk8.6/demos/nl.msg ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ::msgcat::mcset nl "Widget Demonstration" "Demonstratie van widgets"
2
+ ::msgcat::mcset nl "tkWidgetDemo" "tkWidgetDemo"
3
+ ::msgcat::mcset nl "&File" "&Bestand"
4
+ ::msgcat::mcset nl "About..." "Info..."
5
+ ::msgcat::mcset nl "&About..." "&Info..."
6
+ ::msgcat::mcset nl "<F1>" "<F1>"
7
+ ::msgcat::mcset nl "&Quit" "&Einde"
8
+ ::msgcat::mcset nl "Meta+Q" "Meta+E" ;# Displayed hotkey
9
+ ::msgcat::mcset nl "Meta-q" "Meta-e" ;# Actual binding sequence
10
+ ::msgcat::mcset nl "Ctrl+Q" "Ctrl+E" ;# Displayed hotkey
11
+ ::msgcat::mcset nl "Control-q" "Control-e" ;# Actual binding sequence
12
+ ::msgcat::mcset nl "Dismiss" "Sluiten"
13
+ ::msgcat::mcset nl "See Variables" "Bekijk Variabelen"
14
+ ::msgcat::mcset nl "Variable Values" "Waarden Variabelen"
15
+ ::msgcat::mcset nl "OK" "OK"
16
+ ::msgcat::mcset nl "Run the \"%s\" sample program" "Start voorbeeld \"%s\""
17
+ ::msgcat::mcset nl "Print Code" "Code Afdrukken"
18
+ ::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
19
+ ::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
20
+ ::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
21
+ ::msgcat::mcset nl "Copyright © %s"
22
+
23
+ ::msgcat::mcset nl "Tk Widget Demonstrations" "Demonstratie van Tk widgets"
24
+ ::msgcat::mcset nl "This application provides a front end for several short scripts" \
25
+ "Dit programma is een schil rond enkele korte scripts waarmee"
26
+ ::msgcat::mcset nl "that demonstrate what you can do with Tk widgets. Each of the" \
27
+ "gedemonstreerd wordt wat je kunt doen met Tk widgets. Elk van de"
28
+ ::msgcat::mcset nl "numbered lines below describes a demonstration; you can click on" \
29
+ "genummerde regels hieronder omschrijft een demonstratie; je kunt de"
30
+ ::msgcat::mcset nl "it to invoke the demonstration. Once the demonstration window" \
31
+ "demonstratie starten door op de regel te klikken."
32
+ ::msgcat::mcset nl "appears, you can click the" \
33
+ "Zodra het nieuwe venster verschijnt, kun je op de knop"
34
+ ::msgcat::mcset nl "See Code" "Bekijk Code" ;# This is also button text!
35
+ ::msgcat::mcset nl "button to see the Tcl/Tk code that created the demonstration. If" \
36
+ "drukken om de achterliggende Tcl/Tk code te zien. Als je dat wilt,"
37
+ ::msgcat::mcset nl "you wish, you can edit the code and click the" \
38
+ "kun je de code wijzigen en op de knop"
39
+ ::msgcat::mcset nl "Rerun Demo" "Herstart Demo" ;# This is also button text!
40
+ ::msgcat::mcset nl "button in the code window to reinvoke the demonstration with the" \
41
+ "drukken in het codevenster om de demonstratie uit te voeren met de"
42
+ ::msgcat::mcset nl "modified code." \
43
+ "nieuwe code."
44
+
45
+ ::msgcat::mcset nl "Labels, buttons, checkbuttons, and radiobuttons" \
46
+ "Labels, knoppen, vinkjes/aankruishokjes en radioknoppen"
47
+
48
+ ::msgcat::mcset nl "Labels (text and bitmaps)" "Labels (tekst en plaatjes)"
49
+ ::msgcat::mcset nl "Labels and UNICODE text" "Labels en tekst in UNICODE"
50
+ ::msgcat::mcset nl "Buttons" "Buttons (drukknoppen)"
51
+ ::msgcat::mcset nl "Check-buttons (select any of a group)" \
52
+ "Check-buttons (een of meer uit een groep)"
53
+ ::msgcat::mcset nl "Radio-buttons (select one of a group)" \
54
+ "Radio-buttons (een van een groep)"
55
+ ::msgcat::mcset nl "A 15-puzzle game made out of buttons" \
56
+ "Een schuifpuzzel van buttons"
57
+ ::msgcat::mcset nl "Iconic buttons that use bitmaps" \
58
+ "Buttons met pictogrammen"
59
+ ::msgcat::mcset nl "Two labels displaying images" \
60
+ "Twee labels met plaatjes in plaats van tekst"
61
+ ::msgcat::mcset nl "A simple user interface for viewing images" \
62
+ "Een eenvoudige user-interface voor het bekijken van plaatjes"
63
+ ::msgcat::mcset nl "Labelled frames" \
64
+ "Kaders met bijschrift"
65
+
66
+ ::msgcat::mcset nl "Listboxes" "Keuzelijsten"
67
+ ::msgcat::mcset nl "The 50 states" "De 50 staten van de VS"
68
+ ::msgcat::mcset nl "Colors: change the color scheme for the application" \
69
+ "Kleuren: verander het kleurenschema voor het programma"
70
+ ::msgcat::mcset nl "A collection of famous and infamous sayings" \
71
+ "Beroemde en beruchte citaten en gezegden"
72
+
73
+ ::msgcat::mcset nl "Entries and Spin-boxes" "Invulvelden en Spinboxen"
74
+ ::msgcat::mcset nl "Entries without scrollbars" "Invulvelden zonder schuifbalk"
75
+ ::msgcat::mcset nl "Entries with scrollbars" "Invulvelden met schuifbalk"
76
+ ::msgcat::mcset nl "Validated entries and password fields" \
77
+ "Invulvelden met controle of wachtwoorden"
78
+ ::msgcat::mcset nl "Spin-boxes" "Spinboxen"
79
+ ::msgcat::mcset nl "Simple Rolodex-like form" "Simpel kaartsysteem"
80
+
81
+ ::msgcat::mcset nl "Text" "Tekst"
82
+ ::msgcat::mcset nl "Basic editable text" "Voorbeeld met te wijzigen tekst"
83
+ ::msgcat::mcset nl "Text display styles" "Tekst met verschillende stijlen"
84
+ ::msgcat::mcset nl "Hypertext (tag bindings)" \
85
+ "Hypertext (verwijzingen via \"tags\")"
86
+ ::msgcat::mcset nl "A text widget with embedded windows" \
87
+ "Tekstwidget met windows erin"
88
+ ::msgcat::mcset nl "A search tool built with a text widget" \
89
+ "Zoeken in tekst met behulp van een tekstwidget"
90
+
91
+ ::msgcat::mcset nl "Canvases" "Canvaswidgets"
92
+ ::msgcat::mcset nl "The canvas item types" "Objecten in een canvas"
93
+ ::msgcat::mcset nl "A simple 2-D plot" "Eenvoudige 2D-grafiek"
94
+ ::msgcat::mcset nl "Text items in canvases" "Tekstobjecten in een canvas"
95
+ ::msgcat::mcset nl "An editor for arrowheads on canvas lines" \
96
+ "Editor voor de vorm van de pijl (begin/eind van een lijn)"
97
+ ::msgcat::mcset nl "A ruler with adjustable tab stops" \
98
+ "Een meetlat met aanpasbare ruiters"
99
+ ::msgcat::mcset nl "A building floor plan" "Plattegrond van een gebouw"
100
+ ::msgcat::mcset nl "A simple scrollable canvas" "Een schuifbaar canvas"
101
+
102
+ ::msgcat::mcset nl "Scales" "Schaalverdelingen"
103
+ ::msgcat::mcset nl "Horizontal scale" "Horizontale schaal"
104
+ ::msgcat::mcset nl "Vertical scale" "Verticale schaal"
105
+
106
+ ::msgcat::mcset nl "Paned Windows" "Vensters opgedeeld in stukken"
107
+ ::msgcat::mcset nl "Horizontal paned window" "Horizontaal gedeeld venster"
108
+ ::msgcat::mcset nl "Vertical paned window" "Verticaal gedeeld venster"
109
+
110
+ ::msgcat::mcset nl "Menus" "Menu's"
111
+ ::msgcat::mcset nl "Menus and cascades (sub-menus)" \
112
+ "Menu's en cascades (submenu's)"
113
+ ::msgcat::mcset nl "Menu-buttons" "Menu-buttons"
114
+
115
+ ::msgcat::mcset nl "Common Dialogs" "Veel voorkomende dialoogvensters"
116
+ ::msgcat::mcset nl "Message boxes" "Mededeling (message box)"
117
+ ::msgcat::mcset nl "File selection dialog" "Selectie van bestanden"
118
+ ::msgcat::mcset nl "Color picker" "Kleurenpalet"
119
+
120
+ ::msgcat::mcset nl "Miscellaneous" "Diversen"
121
+ ::msgcat::mcset nl "The built-in bitmaps" "Ingebouwde plaatjes"
122
+ ::msgcat::mcset nl "A dialog box with a local grab" \
123
+ "Een dialoogvenster met een locale \"grab\""
124
+ ::msgcat::mcset nl "A dialog box with a global grab" \
125
+ "Een dialoogvenster met een globale \"grab\""
falcon/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
falcon/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
falcon/lib/tk8.6/demos/pendulum.tcl ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pendulum.tcl --
2
+ #
3
+ # This demonstration illustrates how Tcl/Tk can be used to construct
4
+ # simulations of physical systems.
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 .pendulum
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Pendulum Animation Demonstration"
16
+ wm iconname $w "pendulum"
17
+ positionWindow $w
18
+
19
+ label $w.msg -font $font -wraplength 4i -justify left -text "This demonstration shows how Tcl/Tk can be used to carry out animations that are linked to simulations of physical systems. In the left canvas is a graphical representation of the physical system itself, a simple pendulum, and in the right canvas is a graph of the phase space of the system, which is a plot of the angle (relative to the vertical) against the angular velocity. The pendulum bob may be repositioned by clicking and dragging anywhere on the left canvas."
20
+ pack $w.msg
21
+
22
+ ## See Code / Dismiss buttons
23
+ set btns [addSeeDismiss $w.buttons $w]
24
+ pack $btns -side bottom -fill x
25
+
26
+ # Create some structural widgets
27
+ pack [panedwindow $w.p] -fill both -expand 1
28
+ $w.p add [labelframe $w.p.l1 -text "Pendulum Simulation"]
29
+ $w.p add [labelframe $w.p.l2 -text "Phase Space"]
30
+
31
+ # Create the canvas containing the graphical representation of the
32
+ # simulated system.
33
+ canvas $w.c -width 320 -height 200 -background white -bd 2 -relief sunken
34
+ $w.c create text 5 5 -anchor nw -text "Click to Adjust Bob Start Position"
35
+ # Coordinates of these items don't matter; they will be set properly below
36
+ $w.c create line 0 25 320 25 -tags plate -fill grey50 -width 2
37
+ $w.c create oval 155 20 165 30 -tags pivot -fill grey50 -outline {}
38
+ $w.c create line 1 1 1 1 -tags rod -fill black -width 3
39
+ $w.c create oval 1 1 2 2 -tags bob -fill yellow -outline black
40
+ pack $w.c -in $w.p.l1 -fill both -expand true
41
+
42
+ # Create the canvas containing the phase space graph; this consists of
43
+ # a line that gets gradually paler as it ages, which is an extremely
44
+ # effective visual trick.
45
+ canvas $w.k -width 320 -height 200 -background white -bd 2 -relief sunken
46
+ $w.k create line 160 200 160 0 -fill grey75 -arrow last -tags y_axis
47
+ $w.k create line 0 100 320 100 -fill grey75 -arrow last -tags x_axis
48
+ for {set i 90} {$i>=0} {incr i -10} {
49
+ # Coordinates of these items don't matter; they will be set properly below
50
+ $w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
51
+ }
52
+
53
+ $w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
54
+ $w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
55
+ pack $w.k -in $w.p.l2 -fill both -expand true
56
+
57
+ # Initialize some variables
58
+ set points {}
59
+ set Theta 45.0
60
+ set dTheta 0.0
61
+ set pi 3.1415926535897933
62
+ set length 150
63
+ set home 160
64
+
65
+ # This procedure makes the pendulum appear at the correct place on the
66
+ # canvas. If the additional arguments "at $x $y" are passed (the 'at'
67
+ # is really just syntactic sugar) instead of computing the position of
68
+ # the pendulum from the length of the pendulum rod and its angle, the
69
+ # length and angle are computed in reverse from the given location
70
+ # (which is taken to be the centre of the pendulum bob.)
71
+ proc showPendulum {canvas {at {}} {x {}} {y {}}} {
72
+ global Theta dTheta pi length home
73
+ if {$at eq "at" && ($x!=$home || $y!=25)} {
74
+ set dTheta 0.0
75
+ set x2 [expr {$x - $home}]
76
+ set y2 [expr {$y - 25}]
77
+ set length [expr {hypot($x2, $y2)}]
78
+ set Theta [expr {atan2($x2, $y2) * 180/$pi}]
79
+ } else {
80
+ set angle [expr {$Theta * $pi/180}]
81
+ set x [expr {$home + $length*sin($angle)}]
82
+ set y [expr {25 + $length*cos($angle)}]
83
+ }
84
+ $canvas coords rod $home 25 $x $y
85
+ $canvas coords bob [expr {$x - 15}] [expr {$y - 15}] \
86
+ [expr {$x + 15}] [expr {$y + 15}]
87
+ }
88
+ showPendulum $w.c
89
+
90
+ # Update the phase-space graph according to the current angle and the
91
+ # rate at which the angle is changing (the first derivative with
92
+ # respect to time.)
93
+ proc showPhase {canvas} {
94
+ global Theta dTheta points psw psh
95
+ lappend points [expr {$Theta + $psw}] [expr {-20*$dTheta + $psh}]
96
+ if {[llength $points] > 100} {
97
+ set points [lrange $points end-99 end]
98
+ }
99
+ for {set i 0} {$i<100} {incr i 10} {
100
+ set list [lrange $points end-[expr {$i-1}] end-[expr {$i-12}]]
101
+ if {[llength $list] >= 4} {
102
+ $canvas coords graph$i $list
103
+ }
104
+ }
105
+ }
106
+
107
+ # Set up some bindings on the canvases. Note that when the user
108
+ # clicks we stop the animation until they release the mouse
109
+ # button. Also note that both canvases are sensitive to <Configure>
110
+ # events, which allows them to find out when they have been resized by
111
+ # the user.
112
+ bind $w.c <Destroy> {
113
+ after cancel $animationCallbacks(pendulum)
114
+ unset animationCallbacks(pendulum)
115
+ }
116
+ bind $w.c <Button-1> {
117
+ after cancel $animationCallbacks(pendulum)
118
+ showPendulum %W at %x %y
119
+ }
120
+ bind $w.c <B1-Motion> {
121
+ showPendulum %W at %x %y
122
+ }
123
+ bind $w.c <ButtonRelease-1> {
124
+ showPendulum %W at %x %y
125
+ set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]]
126
+ }
127
+ bind $w.c <Configure> {
128
+ %W coords plate 0 25 %w 25
129
+ set home [expr {%w/2}]
130
+ %W coords pivot [expr {$home - 5}] 20 [expr {$home + 5}] 30
131
+ }
132
+ bind $w.k <Configure> {
133
+ set psh [expr {%h/2}]
134
+ set psw [expr {%w/2}]
135
+ %W coords x_axis 2 $psh [expr {%w - 2}] $psh
136
+ %W coords y_axis $psw [expr {%h - 2}] $psw 2
137
+ %W coords label_dtheta [expr {$psw - 4}] 6
138
+ %W coords label_theta [expr {%w - 6}] [expr {$psh + 4}]
139
+ }
140
+
141
+ # This procedure is the "business" part of the simulation that does
142
+ # simple numerical integration of the formula for a simple rotational
143
+ # pendulum.
144
+ proc recomputeAngle {} {
145
+ global Theta dTheta pi length
146
+ set scaling [expr {3000.0/$length/$length}]
147
+
148
+ # To estimate the integration accurately, we really need to
149
+ # compute the end-point of our time-step. But to do *that*, we
150
+ # need to estimate the integration accurately! So we try this
151
+ # technique, which is inaccurate, but better than doing it in a
152
+ # single step. What we really want is bound up in the
153
+ # differential equation:
154
+ # .. - sin theta
155
+ # theta + theta = -----------
156
+ # length
157
+ # But my math skills are not good enough to solve this!
158
+
159
+ # first estimate
160
+ set firstDDTheta [expr {-sin($Theta * $pi/180)*$scaling}]
161
+ set midDTheta [expr {$dTheta + $firstDDTheta}]
162
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
163
+ # second estimate
164
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
165
+ set midDTheta [expr {$dTheta + ($firstDDTheta + $midDDTheta)/2}]
166
+ set midTheta [expr {$Theta + ($dTheta + $midDTheta)/2}]
167
+ # Now we do a double-estimate approach for getting the final value
168
+ # first estimate
169
+ set midDDTheta [expr {-sin($midTheta * $pi/180)*$scaling}]
170
+ set lastDTheta [expr {$midDTheta + $midDDTheta}]
171
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
172
+ # second estimate
173
+ set lastDDTheta [expr {-sin($lastTheta * $pi/180)*$scaling}]
174
+ set lastDTheta [expr {$midDTheta + ($midDDTheta + $lastDDTheta)/2}]
175
+ set lastTheta [expr {$midTheta + ($midDTheta + $lastDTheta)/2}]
176
+ # Now put the values back in our globals
177
+ set dTheta $lastDTheta
178
+ set Theta $lastTheta
179
+ }
180
+
181
+ # This method ties together the simulation engine and the graphical
182
+ # display code that visualizes it.
183
+ proc repeat w {
184
+ global animationCallbacks
185
+
186
+ # Simulate
187
+ recomputeAngle
188
+
189
+ # Update the display
190
+ showPendulum $w.c
191
+ showPhase $w.k
192
+
193
+ # Reschedule ourselves
194
+ set animationCallbacks(pendulum) [after 15 [list repeat $w]]
195
+ }
196
+ # Start the simulation after a short pause
197
+ set animationCallbacks(pendulum) [after 500 [list repeat $w]]
falcon/lib/tk8.6/demos/puzzle.tcl ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # puzzle.tcl --
2
+ #
3
+ # This demonstration script creates a 15-puzzle game using a collection
4
+ # of buttons.
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
+ # puzzleSwitch --
13
+ # This procedure is invoked when the user clicks on a particular button;
14
+ # if the button is next to the empty space, it moves the button into the
15
+ # empty space.
16
+
17
+ proc puzzleSwitch {w num} {
18
+ global xpos ypos
19
+ if {(($ypos($num) >= ($ypos(space) - .01))
20
+ && ($ypos($num) <= ($ypos(space) + .01))
21
+ && ($xpos($num) >= ($xpos(space) - .26))
22
+ && ($xpos($num) <= ($xpos(space) + .26)))
23
+ || (($xpos($num) >= ($xpos(space) - .01))
24
+ && ($xpos($num) <= ($xpos(space) + .01))
25
+ && ($ypos($num) >= ($ypos(space) - .26))
26
+ && ($ypos($num) <= ($ypos(space) + .26)))} {
27
+ set tmp $xpos(space)
28
+ set xpos(space) $xpos($num)
29
+ set xpos($num) $tmp
30
+ set tmp $ypos(space)
31
+ set ypos(space) $ypos($num)
32
+ set ypos($num) $tmp
33
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num)
34
+ }
35
+ }
36
+
37
+ set w .puzzle
38
+ catch {destroy $w}
39
+ toplevel $w
40
+ wm title $w "15-Puzzle Demonstration"
41
+ wm iconname $w "15-Puzzle"
42
+ positionWindow $w
43
+
44
+ label $w.msg -font $font -wraplength 4i -justify left -text "A 15-puzzle appears below as a collection of buttons. Click on any of the pieces next to the space, and that piece will slide over the space. Continue this until the pieces are arranged in numerical order from upper-left to lower-right."
45
+ pack $w.msg -side top
46
+
47
+ ## See Code / Dismiss buttons
48
+ set btns [addSeeDismiss $w.buttons $w]
49
+ pack $btns -side bottom -fill x
50
+
51
+ # Special trick: select a darker color for the space by creating a
52
+ # scrollbar widget and using its trough color.
53
+
54
+ scrollbar $w.s
55
+
56
+ # The button metrics are a bit bigger in Aqua, and since we are
57
+ # using place which doesn't autosize, then we need to have a
58
+ # slightly larger frame here...
59
+
60
+ if {[tk windowingsystem] eq "aqua"} {
61
+ set frameSize 168
62
+ } else {
63
+ set frameSize 120
64
+ }
65
+
66
+ frame $w.frame -width $frameSize -height $frameSize -borderwidth 2\
67
+ -relief sunken -bg [$w.s cget -troughcolor]
68
+ pack $w.frame -side top -pady 1c -padx 1c
69
+ destroy $w.s
70
+
71
+ set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12}
72
+ for {set i 0} {$i < 15} {set i [expr {$i+1}]} {
73
+ set num [lindex $order $i]
74
+ set xpos($num) [expr {($i%4)*.25}]
75
+ set ypos($num) [expr {($i/4)*.25}]
76
+ button $w.frame.$num -relief raised -text $num -bd 0 -highlightthickness 0 \
77
+ -command "puzzleSwitch $w $num"
78
+ place $w.frame.$num -relx $xpos($num) -rely $ypos($num) \
79
+ -relwidth .25 -relheight .25
80
+ }
81
+ set xpos(space) .75
82
+ set ypos(space) .75
falcon/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
falcon/lib/tk8.6/demos/rolodex ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # the next line restarts using wish \
3
+ exec wish8.6 "$0" ${1+"$@"}
4
+
5
+ # rolodex --
6
+ # This script was written as an entry in Tom LaStrange's rolodex
7
+ # benchmark. It creates something that has some of the look and
8
+ # feel of a rolodex program, although it's lifeless and doesn't
9
+ # actually do the rolodex application.
10
+
11
+ package require Tk
12
+
13
+ foreach i [winfo children .] {
14
+ catch {destroy $i}
15
+ }
16
+
17
+ set version 1.2
18
+
19
+ #------------------------------------------
20
+ # Phase 0: create the front end.
21
+ #------------------------------------------
22
+
23
+ frame .frame -relief flat
24
+ pack .frame -side top -fill y -anchor center
25
+
26
+ set names {{} Name: Address: {} {} {Home Phone:} {Work Phone:} Fax:}
27
+ foreach i {1 2 3 4 5 6 7} {
28
+ label .frame.label$i -text [lindex $names $i] -anchor e
29
+ entry .frame.entry$i -width 35
30
+ grid .frame.label$i .frame.entry$i -sticky ew -pady 2 -padx 1
31
+ }
32
+
33
+ frame .buttons
34
+ pack .buttons -side bottom -pady 2 -anchor center
35
+ button .buttons.clear -text Clear
36
+ button .buttons.add -text Add
37
+ button .buttons.search -text Search
38
+ button .buttons.delete -text "Delete ..."
39
+ pack .buttons.clear .buttons.add .buttons.search .buttons.delete \
40
+ -side left -padx 2
41
+
42
+ #------------------------------------------
43
+ # Phase 1: Add menus, dialog boxes
44
+ #------------------------------------------
45
+
46
+ # DKF - note that this is an old-style menu bar; I just have not yet
47
+ # got around to converting the context help code to work with the new
48
+ # menu system and its <<MenuSelect>> virtual event.
49
+
50
+ frame .menu -relief raised -borderwidth 1
51
+ pack .menu -before .frame -side top -fill x
52
+
53
+ menubutton .menu.file -text "File" -menu .menu.file.m -underline 0
54
+ menu .menu.file.m
55
+ .menu.file.m add command -label "Load ..." -command fileAction -underline 0
56
+ .menu.file.m add command -label "Exit" -command {destroy .} -underline 0
57
+ pack .menu.file -side left
58
+
59
+ menubutton .menu.help -text "Help" -menu .menu.help.m -underline 0
60
+ menu .menu.help.m
61
+ pack .menu.help -side right
62
+
63
+ proc deleteAction {} {
64
+ if {[tk_dialog .delete {Confirm Action} {Are you sure?} {} 0 Cancel]
65
+ == 0} {
66
+ clearAction
67
+ }
68
+ }
69
+ .buttons.delete config -command deleteAction
70
+
71
+ proc fileAction {} {
72
+ tk_dialog .fileSelection {File Selection} {This is a dummy file selection dialog box, which is used because there isn't a good file selection dialog built into Tk yet.} {} 0 OK
73
+ puts stderr {dummy file name}
74
+ }
75
+
76
+ #------------------------------------------
77
+ # Phase 3: Print contents of card
78
+ #------------------------------------------
79
+
80
+ proc addAction {} {
81
+ global names
82
+ foreach i {1 2 3 4 5 6 7} {
83
+ puts stderr [format "%-12s %s" [lindex $names $i] [.frame.entry$i get]]
84
+ }
85
+ }
86
+ .buttons.add config -command addAction
87
+
88
+ #------------------------------------------
89
+ # Phase 4: Miscellaneous other actions
90
+ #------------------------------------------
91
+
92
+ proc clearAction {} {
93
+ foreach i {1 2 3 4 5 6 7} {
94
+ .frame.entry$i delete 0 end
95
+ }
96
+ }
97
+ .buttons.clear config -command clearAction
98
+
99
+ proc fillCard {} {
100
+ clearAction
101
+ .frame.entry1 insert 0 "John Ousterhout"
102
+ .frame.entry2 insert 0 "CS Division, Department of EECS"
103
+ .frame.entry3 insert 0 "University of California"
104
+ .frame.entry4 insert 0 "Berkeley, CA 94720"
105
+ .frame.entry5 insert 0 "private"
106
+ .frame.entry6 insert 0 "510-642-0865"
107
+ .frame.entry7 insert 0 "510-642-5775"
108
+ }
109
+ .buttons.search config -command "addAction; fillCard"
110
+
111
+ #----------------------------------------------------
112
+ # Phase 5: Accelerators, mnemonics, command-line info
113
+ #----------------------------------------------------
114
+
115
+ .buttons.clear config -text "Clear Ctrl+C"
116
+ bind . <Control-c> clearAction
117
+ .buttons.add config -text "Add Ctrl+A"
118
+ bind . <Control-a> addAction
119
+ .buttons.search config -text "Search Ctrl+S"
120
+ bind . <Control-s> "addAction; fillCard"
121
+ .buttons.delete config -text "Delete... Ctrl+D"
122
+ bind . <Control-d> deleteAction
123
+
124
+ .menu.file.m entryconfig 1 -accel Ctrl+F
125
+ bind . <Control-f> fileAction
126
+ .menu.file.m entryconfig 2 -accel Ctrl+Q
127
+ bind . <Control-q> {destroy .}
128
+
129
+ focus .frame.entry1
130
+
131
+ #----------------------------------------------------
132
+ # Phase 6: help
133
+ #----------------------------------------------------
134
+
135
+ proc Help {topic {x 0} {y 0}} {
136
+ global helpTopics helpCmds
137
+ if {$topic == ""} return
138
+ while {[info exists helpCmds($topic)]} {
139
+ set topic [eval $helpCmds($topic)]
140
+ }
141
+ if [info exists helpTopics($topic)] {
142
+ set msg $helpTopics($topic)
143
+ } else {
144
+ set msg "Sorry, but no help is available for this topic"
145
+ }
146
+ tk_dialog .help {Rolodex Help} "Information on $topic:\n\n$msg" \
147
+ {} 0 OK
148
+ }
149
+
150
+ proc getMenuTopic {w x y} {
151
+ return $w.[$w index @[expr {$y-[winfo rooty $w]}]]
152
+ }
153
+
154
+ event add <<Help>> <F1> <Help>
155
+ bind . <<Help>> {Help [winfo containing %X %Y] %X %Y}
156
+ bind Menu <<Help>> {Help [winfo containing %X %Y] %X %Y}
157
+
158
+ # Help text and commands follow:
159
+
160
+ set helpTopics(.menu.file) {This is the "file" menu. It can be used to invoke some overall operations on the rolodex applications, such as loading a file or exiting.}
161
+
162
+ set helpCmds(.menu.file.m) {getMenuTopic $topic $x $y}
163
+ set helpTopics(.menu.file.m.1) {The "Load" entry in the "File" menu posts a dialog box that you can use to select a rolodex file}
164
+ set helpTopics(.menu.file.m.2) {The "Exit" entry in the "File" menu causes the rolodex application to terminate}
165
+ set helpCmds(.menu.file.m.none) {set topic ".menu.file"}
166
+
167
+ set helpTopics(.frame.entry1) {In this field of the rolodex entry you should type the person's name}
168
+ set helpTopics(.frame.entry2) {In this field of the rolodex entry you should type the first line of the person's address}
169
+ set helpTopics(.frame.entry3) {In this field of the rolodex entry you should type the second line of the person's address}
170
+ set helpTopics(.frame.entry4) {In this field of the rolodex entry you should type the third line of the person's address}
171
+ set helpTopics(.frame.entry5) {In this field of the rolodex entry you should type the person's home phone number, or "private" if the person doesn't want his or her number publicized}
172
+ set helpTopics(.frame.entry6) {In this field of the rolodex entry you should type the person's work phone number}
173
+ set helpTopics(.frame.entry7) {In this field of the rolodex entry you should type the phone number for the person's FAX machine}
174
+
175
+ set helpCmds(.frame.label1) {set topic .frame.entry1}
176
+ set helpCmds(.frame.label2) {set topic .frame.entry2}
177
+ set helpCmds(.frame.label3) {set topic .frame.entry3}
178
+ set helpCmds(.frame.label4) {set topic .frame.entry4}
179
+ set helpCmds(.frame.label5) {set topic .frame.entry5}
180
+ set helpCmds(.frame.label6) {set topic .frame.entry6}
181
+ set helpCmds(.frame.label7) {set topic .frame.entry7}
182
+
183
+ set helpTopics(context) {Unfortunately, this application doesn't support context-sensitive help in the usual way, because when this demo was written Tk didn't have a grab mechanism and this is needed for context-sensitive help. Instead, you can achieve much the same effect by simply moving the mouse over the window you're curious about and pressing the Help or F1 keys. You can do this anytime.}
184
+ set helpTopics(help) {This application provides only very crude help. Besides the entries in this menu, you can get help on individual windows by moving the mouse cursor over the window and pressing the Help or F1 keys.}
185
+ set helpTopics(window) {This window is a dummy rolodex application created as part of Tom LaStrange's toolkit benchmark. It doesn't really do anything useful except to demonstrate a few features of the Tk toolkit.}
186
+ set helpTopics(keys) "The following accelerator keys are defined for this application (in addition to those already available for the entry windows):\n\nCtrl+A:\t\tAdd\nCtrl+C:\t\tClear\nCtrl+D:\t\tDelete\nCtrl+F:\t\tEnter file name\nCtrl+Q:\t\tExit application (quit)\nCtrl+S:\t\tSearch (dummy operation)"
187
+ set helpTopics(version) "This is version $version."
188
+
189
+ # Entries in "Help" menu
190
+
191
+ .menu.help.m add command -label "On Context..." -command {Help context} \
192
+ -underline 3
193
+ .menu.help.m add command -label "On Help..." -command {Help help} \
194
+ -underline 3
195
+ .menu.help.m add command -label "On Window..." -command {Help window} \
196
+ -underline 3
197
+ .menu.help.m add command -label "On Keys..." -command {Help keys} \
198
+ -underline 3
199
+ .menu.help.m add command -label "On Version..." -command {Help version} \
200
+ -underline 3
201
+
202
+ # Local Variables:
203
+ # mode: tcl
204
+ # End:
falcon/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
+ }
falcon/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"
falcon/lib/tk8.6/demos/search.tcl ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # search.tcl --
2
+ #
3
+ # This demonstration script creates a collection of widgets that
4
+ # allow you to load a file into a text widget, then perform searches
5
+ # on that 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
+ # textLoadFile --
14
+ # This procedure below loads a file into a text widget, discarding
15
+ # the previous contents of the widget. Tags for the old widget are
16
+ # not affected, however.
17
+ #
18
+ # Arguments:
19
+ # w - The window into which to load the file. Must be a
20
+ # text widget.
21
+ # file - The name of the file to load. Must be readable.
22
+
23
+ proc textLoadFile {w file} {
24
+ set f [open $file]
25
+ $w delete 1.0 end
26
+ while {![eof $f]} {
27
+ $w insert end [read $f 10000]
28
+ }
29
+ close $f
30
+ }
31
+
32
+ # textSearch --
33
+ # Search for all instances of a given string in a text widget and
34
+ # apply a given tag to each instance found.
35
+ #
36
+ # Arguments:
37
+ # w - The window in which to search. Must be a text widget.
38
+ # string - The string to search for. The search is done using
39
+ # exact matching only; no special characters.
40
+ # tag - Tag to apply to each instance of a matching string.
41
+
42
+ proc textSearch {w string tag} {
43
+ $w tag remove search 0.0 end
44
+ if {$string == ""} {
45
+ return
46
+ }
47
+ set cur 1.0
48
+ while 1 {
49
+ set cur [$w search -count length $string $cur end]
50
+ if {$cur == ""} {
51
+ break
52
+ }
53
+ $w tag add $tag $cur "$cur + $length char"
54
+ set cur [$w index "$cur + $length char"]
55
+ }
56
+ }
57
+
58
+ # textToggle --
59
+ # This procedure is invoked repeatedly to invoke two commands at
60
+ # periodic intervals. It normally reschedules itself after each
61
+ # execution but if an error occurs (e.g. because the window was
62
+ # deleted) then it doesn't reschedule itself.
63
+ #
64
+ # Arguments:
65
+ # cmd1 - Command to execute when procedure is called.
66
+ # sleep1 - Ms to sleep after executing cmd1 before executing cmd2.
67
+ # cmd2 - Command to execute in the *next* invocation of this
68
+ # procedure.
69
+ # sleep2 - Ms to sleep after executing cmd2 before executing cmd1 again.
70
+
71
+ proc textToggle {cmd1 sleep1 cmd2 sleep2} {
72
+ catch {
73
+ eval $cmd1
74
+ after $sleep1 [list textToggle $cmd2 $sleep2 $cmd1 $sleep1]
75
+ }
76
+ }
77
+
78
+ set w .search
79
+ catch {destroy $w}
80
+ toplevel $w
81
+ wm title $w "Text Demonstration - Search and Highlight"
82
+ wm iconname $w "search"
83
+ positionWindow $w
84
+
85
+ ## See Code / Dismiss buttons
86
+ set btns [addSeeDismiss $w.buttons $w]
87
+ pack $btns -side bottom -fill x
88
+
89
+ frame $w.file
90
+ label $w.file.label -text "File name:" -width 13 -anchor w
91
+ entry $w.file.entry -width 40 -textvariable fileName
92
+ button $w.file.button -text "Load File" \
93
+ -command "textLoadFile $w.text \$fileName"
94
+ pack $w.file.label $w.file.entry -side left
95
+ pack $w.file.button -side left -pady 5 -padx 10
96
+ bind $w.file.entry <Return> "
97
+ textLoadFile $w.text \$fileName
98
+ focus $w.string.entry
99
+ "
100
+ focus $w.file.entry
101
+
102
+ frame $w.string
103
+ label $w.string.label -text "Search string:" -width 13 -anchor w
104
+ entry $w.string.entry -width 40 -textvariable searchString
105
+ button $w.string.button -text "Highlight" \
106
+ -command "textSearch $w.text \$searchString search"
107
+ pack $w.string.label $w.string.entry -side left
108
+ pack $w.string.button -side left -pady 5 -padx 10
109
+ bind $w.string.entry <Return> "textSearch $w.text \$searchString search"
110
+
111
+ text $w.text -yscrollcommand "$w.scroll set" -setgrid true
112
+ ttk::scrollbar $w.scroll -command "$w.text yview"
113
+ pack $w.file $w.string -side top -fill x
114
+ pack $w.scroll -side right -fill y
115
+ pack $w.text -expand yes -fill both
116
+
117
+ # Set up display styles for text highlighting.
118
+
119
+ if {[winfo depth $w] > 1} {
120
+ textToggle "$w.text tag configure search -background \
121
+ #ce5555 -foreground white" 800 "$w.text tag configure \
122
+ search -background {} -foreground {}" 200
123
+ } else {
124
+ textToggle "$w.text tag configure search -background \
125
+ black -foreground white" 800 "$w.text tag configure \
126
+ search -background {} -foreground {}" 200
127
+ }
128
+ $w.text insert 1.0 \
129
+ {This window demonstrates how to use the tagging facilities in text
130
+ widgets to implement a searching mechanism. First, type a file name
131
+ in the top entry, then type <Return> or click on "Load File". Then
132
+ type a string in the lower entry and type <Return> or click on
133
+ "Load File". This will cause all of the instances of the string to
134
+ be tagged with the tag "search", and it will arrange for the tag's
135
+ display attributes to change to make all of the strings blink.}
136
+ $w.text mark set insert 0.0
137
+
138
+ set fileName ""
139
+ set searchString ""
falcon/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."
falcon/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
falcon/lib/tk8.6/demos/style.tcl ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # style.tcl --
2
+ #
3
+ # This demonstration script creates a text widget that illustrates the
4
+ # various display styles that may be set for tags.
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 .style
13
+ catch {destroy $w}
14
+ toplevel $w
15
+ wm title $w "Text Demonstration - Display Styles"
16
+ wm iconname $w "style"
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
+ # Only set the font family in one place for simplicity and consistency
24
+
25
+ set family Courier
26
+
27
+ text $w.text -yscrollcommand "$w.scroll set" -setgrid true \
28
+ -width 70 -height 32 -wrap word -font "$family 12"
29
+ ttk::scrollbar $w.scroll -command "$w.text yview"
30
+ pack $w.scroll -side right -fill y
31
+ pack $w.text -expand yes -fill both
32
+
33
+ # Set up display styles
34
+
35
+ $w.text tag configure bold -font "$family 12 bold italic"
36
+ $w.text tag configure big -font "$family 14 bold"
37
+ $w.text tag configure verybig -font "Helvetica 24 bold"
38
+ $w.text tag configure tiny -font "Times 8 bold"
39
+ if {[winfo depth $w] > 1} {
40
+ $w.text tag configure color1 -background #a0b7ce
41
+ $w.text tag configure color2 -foreground red
42
+ $w.text tag configure raised -relief raised -borderwidth 1
43
+ $w.text tag configure sunken -relief sunken -borderwidth 1
44
+ } else {
45
+ $w.text tag configure color1 -background black -foreground white
46
+ $w.text tag configure color2 -background black -foreground white
47
+ $w.text tag configure raised -background white -relief raised \
48
+ -borderwidth 1
49
+ $w.text tag configure sunken -background white -relief sunken \
50
+ -borderwidth 1
51
+ }
52
+ $w.text tag configure bgstipple -background black -borderwidth 0 \
53
+ -bgstipple gray12
54
+ $w.text tag configure fgstipple -fgstipple gray50
55
+ $w.text tag configure underline -underline on
56
+ $w.text tag configure overstrike -overstrike on
57
+ $w.text tag configure right -justify right
58
+ $w.text tag configure center -justify center
59
+ $w.text tag configure super -offset 4p -font "$family 10"
60
+ $w.text tag configure sub -offset -2p -font "$family 10"
61
+ $w.text tag configure margins -lmargin1 12m -lmargin2 6m -rmargin 10m
62
+ $w.text tag configure spacing -spacing1 10p -spacing2 2p \
63
+ -lmargin1 12m -lmargin2 6m -rmargin 10m
64
+
65
+ $w.text insert end {Text widgets like this one allow you to display information in a
66
+ variety of styles. Display styles are controlled using a mechanism
67
+ called }
68
+ $w.text insert end tags bold
69
+ $w.text insert end {. Tags are just textual names that you can apply to one
70
+ or more ranges of characters within a text widget. You can configure
71
+ tags with various display styles. If you do this, then the tagged
72
+ characters will be displayed with the styles you chose. The
73
+ available display styles are:
74
+ }
75
+ $w.text insert end "\n1. Font." big
76
+ $w.text insert end " You can choose any system font, "
77
+ $w.text insert end large verybig
78
+ $w.text insert end " or "
79
+ $w.text insert end "small" tiny ".\n"
80
+ $w.text insert end "\n2. Color." big
81
+ $w.text insert end " You can change either the "
82
+ $w.text insert end background color1
83
+ $w.text insert end " or "
84
+ $w.text insert end foreground color2
85
+ $w.text insert end "\ncolor, or "
86
+ $w.text insert end both {color1 color2}
87
+ $w.text insert end ".\n"
88
+ $w.text insert end "\n3. Stippling." big
89
+ $w.text insert end " You can cause either the "
90
+ $w.text insert end background bgstipple
91
+ $w.text insert end " or "
92
+ $w.text insert end foreground fgstipple
93
+ $w.text insert end {
94
+ information to be drawn with a stipple fill instead of a solid fill.
95
+ }
96
+ $w.text insert end "\n4. Underlining." big
97
+ $w.text insert end " You can "
98
+ $w.text insert end underline underline
99
+ $w.text insert end " ranges of text.\n"
100
+ $w.text insert end "\n5. Overstrikes." big
101
+ $w.text insert end " You can "
102
+ $w.text insert end "draw lines through" overstrike
103
+ $w.text insert end " ranges of text.\n"
104
+ $w.text insert end "\n6. 3-D effects." big
105
+ $w.text insert end { You can arrange for the background to be drawn
106
+ with a border that makes characters appear either }
107
+ $w.text insert end raised raised
108
+ $w.text insert end " or "
109
+ $w.text insert end sunken sunken
110
+ $w.text insert end ".\n"
111
+ $w.text insert end "\n7. Justification." big
112
+ $w.text insert end " You can arrange for lines to be displayed\n"
113
+ $w.text insert end "left-justified,\n"
114
+ $w.text insert end "right-justified, or\n" right
115
+ $w.text insert end "centered.\n" center
116
+ $w.text insert end "\n8. Superscripts and subscripts." big
117
+ $w.text insert end " You can control the vertical\n"
118
+ $w.text insert end "position of text to generate superscript effects like 10"
119
+ $w.text insert end "n" super
120
+ $w.text insert end " or\nsubscript effects like X"
121
+ $w.text insert end "i" sub
122
+ $w.text insert end ".\n"
123
+ $w.text insert end "\n9. Margins." big
124
+ $w.text insert end " You can control the amount of extra space left"
125
+ $w.text insert end " on\neach side of the text:\n"
126
+ $w.text insert end "This paragraph is an example of the use of " margins
127
+ $w.text insert end "margins. It consists of a single line of text " margins
128
+ $w.text insert end "that wraps around on the screen. There are two " margins
129
+ $w.text insert end "separate left margin values, one for the first " margins
130
+ $w.text insert end "display line associated with the text line, " margins
131
+ $w.text insert end "and one for the subsequent display lines, which " margins
132
+ $w.text insert end "occur because of wrapping. There is also a " margins
133
+ $w.text insert end "separate specification for the right margin, " margins
134
+ $w.text insert end "which is used to choose wrap points for lines.\n" margins
135
+ $w.text insert end "\n10. Spacing." big
136
+ $w.text insert end " You can control the spacing of lines with three\n"
137
+ $w.text insert end "separate parameters. \"Spacing1\" tells how much "
138
+ $w.text insert end "extra space to leave\nabove a line, \"spacing3\" "
139
+ $w.text insert end "tells how much space to leave below a line,\nand "
140
+ $w.text insert end "if a text line wraps, \"spacing2\" tells how much "
141
+ $w.text insert end "space to leave\nbetween the display lines that "
142
+ $w.text insert end "make up the text line.\n"
143
+ $w.text insert end "These indented paragraphs illustrate how spacing " spacing
144
+ $w.text insert end "can be used. Each paragraph is actually a " spacing
145
+ $w.text insert end "single line in the text widget, which is " spacing
146
+ $w.text insert end "word-wrapped by the widget.\n" spacing
147
+ $w.text insert end "Spacing1 is set to 10 points for this text, " spacing
148
+ $w.text insert end "which results in relatively large gaps between " spacing
149
+ $w.text insert end "the paragraphs. Spacing2 is set to 2 points, " spacing
150
+ $w.text insert end "which results in just a bit of extra space " spacing
151
+ $w.text insert end "within a pararaph. Spacing3 isn't used " spacing
152
+ $w.text insert end "in this example.\n" spacing
153
+ $w.text insert end "To see where the space is, select ranges of " spacing
154
+ $w.text insert end "text within these paragraphs. The selection " spacing
155
+ $w.text insert end "highlight will cover the extra space." spacing