summaryrefslogtreecommitdiffstats
path: root/library/demos/goldberg.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/demos/goldberg.tcl')
-rw-r--r--library/demos/goldberg.tcl770
1 files changed, 453 insertions, 317 deletions
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index e71b9d2..860d03c 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -50,27 +50,51 @@ wm iconname $w "goldberg"
wm resizable $w 0 0
#positionWindow $w
-label $w.msg -font {Arial 10} -wraplength 4i -justify left -text "This is a\
- demonstration of just how complex you can make your animations\
- become. Click the ball to start things moving!\n\n\"Man will always\
- find a difficult means to perform a simple task\"\n - Rube Goldberg"
-pack $w.msg -side top
-
+proc StartMessage {w} {
+ set msg1 "This\
+ is a demonstration of just how complex you can make your animations\
+ become. Close this dialog and click the ball to start things\
+ moving!\n\n\"Man will always find a difficult means to perform a\
+ simple task\"\n - Rube Goldberg"
+ PlacedDialog $w.c.messframe $msg1 {Helvetica 12}
+}
###--- End of Boilerplate ---###
-# Ensure that this this is an array
+array set BaseDimensions {
+ CanX 675
+ CanY 540
+ ScrX 750
+ ScrY 750
+ MsgX 338
+ MsgY 573
+ MovX 10
+ MovY -45
+}
+
+# The original value was 1.0 but this can make the demo
+# too large for the screen. Try a smaller value.
+set overallFactor 0.75
+
+foreach el [array names BaseDimensions] {
+ set Dims($el) [expr {$BaseDimensions($el) * $overallFactor}]p
+}
+
+set scaleFactor [expr {$::tk::scalingPct / 100.0 * $overallFactor}]
+
+# Ensure that this is an array
array set animationCallbacks {}
bind $w <Destroy> {
if {"%W" eq [winfo toplevel %W]} {
- unset S C speed
+ unset S C delays
}
}
set S(title) "Tk Goldberg"
set S(speed) 5
set S(cnt) 0
-set S(message) "\\nWelcome\\nto\\nTcl/Tk"
-array set speed {1 10 2 20 3 50 4 80 5 100 6 150 7 200 8 300 9 400 10 500}
+set S(message) "\\nWelcome\\nto\\nTcl/Tk!"
+array set delays \
+ {1 500 2 400 3 300 4 200 5 150 6 100 7 80 8 50 9 20 10 10}
set MSTART 0; set MGO 1; set MPAUSE 2; set MSSTEP 3; set MBSTEP 4; set MDONE 5
set S(mode) $::MSTART
@@ -94,17 +118,19 @@ set C(24a) red; set C(24b) white;
set C(24c) black; set C(26) $C(0);
proc DoDisplay {w} {
- global S C
+ global S C Dims
- ttk::frame $w.ctrl -relief ridge -borderwidth 2 -padding 5
- pack [frame $w.screen -bd 2 -relief raised] \
+ ttk::frame $w.ctrl -relief ridge -borderwidth 1 -padding 3p
+ pack [frame $w.screen -bd 1 -relief raised] \
-side left -fill both -expand 1
- canvas $w.c -width 860 -height 730 -bg $C(bg) -highlightthickness 0
- $w.c config -scrollregion {0 0 1000 1000} ;# Kludge: move everything up
- $w.c yview moveto .05
+ canvas $w.c -width $Dims(CanX) -height $Dims(CanY) -bg $C(bg) \
+ -highlightthickness 0
+ $w.c config -scrollregion [list 0 0 $Dims(ScrX) $Dims(ScrY)]
+ $w.c yview moveto .06 ;# Kludge: move everything up
pack $w.c -in $w.screen -side top -fill both -expand 1
+ bind $w.c <Configure> { %W yview moveto .06 }
bind $w.c <Button-3> [list $w.pause invoke]
bind $w.c <Destroy> {
after cancel $animationCallbacks(goldberg)
@@ -113,9 +139,11 @@ proc DoDisplay {w} {
DoCtrlFrame $w
DoDetailFrame $w
if {[tk windowingsystem] ne "aqua"} {
- ttk::button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2
+ ttk::button $w.show -text "▶" -command [list ShowCtrl $w] -width 2
} else {
- button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
+ button $w.show -text "▶" -command [list ShowCtrl $w] -width 1 \
+ -borderwidth 1 -highlightthickness 0 -padx 0 -pady 0 \
+ -highlightbackground $C(bg)
}
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
update
@@ -136,18 +164,19 @@ proc DoCtrlFrame {w} {
ttk::labelframe $w.message -text "Message"
ttk::entry $w.message.e -textvariable S(message) -justify center
ttk::labelframe $w.speed -text "Speed: 0"
- ttk::scale $w.speed.scale -orient horizontal -from 1 -to 10 -variable S(speed)
+ ttk::scale $w.speed.scale -orient horizontal -from 1 -to 10 \
+ -variable S(speed)
ttk::button $w.about -text About -command [list About $w]
grid $w.start -in $w.ctrl -row 0 -sticky ew
- grid rowconfigure $w.ctrl 1 -minsize 10
+ grid rowconfigure $w.ctrl 1 -minsize 3p
grid $w.pause -in $w.ctrl -row 2 -sticky ew
- grid $w.step -in $w.ctrl -sticky ew -pady 2
+ grid $w.step -in $w.ctrl -sticky ew -pady 1.5p
grid $w.bstep -in $w.ctrl -sticky ew
- grid $w.reset -in $w.ctrl -sticky ew -pady 2
- grid rowconfigure $w.ctrl 10 -minsize 18
+ grid $w.reset -in $w.ctrl -sticky ew -pady 1.5p
+ grid rowconfigure $w.ctrl 10 -minsize 3p
grid $w.details -in $w.ctrl -row 11 -sticky ew
- grid rowconfigure $w.ctrl 11 -minsize 20
+ grid rowconfigure $w.ctrl 11 -minsize 3p
$w.details configure -labelwidget $w.details.cb
grid [ttk::frame $w.details.b -height 1] ;# Work around minor bug
raise $w.details
@@ -157,25 +186,28 @@ proc DoCtrlFrame {w} {
trace add variable ::S(details) write [list ActiveGUI $w]
trace add variable ::S(speed) write [list ActiveGUI $w]
- grid $w.message -in $w.ctrl -row 98 -sticky ew -pady 5
+ grid $w.message -in $w.ctrl -row 98 -sticky ew -pady {0 3p}
grid $w.message.e -sticky nsew
- grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 5}
+ grid $w.speed -in $w.ctrl -row 99 -sticky ew -pady {0 3p}
pack $w.speed.scale -fill both -expand 1
grid $w.about -in $w.ctrl -row 100 -sticky ew
bind $w.reset <Button-3> {set S(mode) -1} ;# Debugging
## See Code / Dismiss buttons hack!
- set btns [addSeeDismiss $w.ctrl.buttons $w]
- grid [ttk::separator $w.ctrl.sep] -sticky ew -pady 4
- set i 0
- foreach b [winfo children $btns] {
+ grid [ttk::separator $w.ctrl.sep] -sticky ew -pady {3p 1.5p}
+ set btns {}
+ foreach b [winfo children [addSeeDismiss $w.ctrl.buttons $w]] {
if {[winfo class $b] eq "TButton"} {
- grid [set b2 [ttk::button $w.ctrl.b[incr i]]] -sticky ew
- foreach b3 [$b configure] {
- set b3 [lindex $b3 0]
- # Some options are read-only; ignore those errors
- catch {$b2 configure $b3 [$b cget $b3]}
- }
+ set btns [linsert $btns 0 $b] ;# Prepend
+ }
+ }
+ set i 0
+ foreach b $btns {
+ grid [set b2 [ttk::button $w.ctrl.b[incr i]]] -sticky ew -pady {1.5p 0}
+ foreach b3 [$b configure] {
+ set b3 [lindex $b3 0]
+ # Some options are read-only; ignore those errors
+ catch {$b2 configure $b3 [$b cget $b3]}
}
}
destroy $btns
@@ -203,14 +235,15 @@ proc DoDetailFrame {w} {
proc ShowCtrl {w} {
if {[winfo ismapped $w.ctrl]} {
pack forget $w.ctrl
- $w.show config -text "\xbb"
+ $w.show config -text "▶"
} else {
pack $w.ctrl -side right -fill both -ipady 5
- $w.show config -text "\xab"
+ $w.show config -text "◀"
}
}
proc DrawAll {w} {
+ global scaleFactor
ResetStep
$w.c delete all
for {set i 0} {1} {incr i} {
@@ -218,6 +251,40 @@ proc DrawAll {w} {
if {[info procs $p] eq ""} break
$p $w
}
+
+ $w.c scale all 0 0 $scaleFactor $scaleFactor
+
+ # Tile the strike box with a 4x4 bitmap image derived
+ # from Tk's built-in 16x16 bitmap gray25. Adjust
+ # x1, y2 to make dimensions multiples of 4 pixels.
+
+ image create bitmap smallGray25 -data {
+ #define smallGray25_width 4
+ #define smallGray25_height 4
+ static unsigned char smallGray25_bits[] = {
+ 0x08, 0x02, 0x08, 0x02};
+ } -foreground $::C(fg)
+
+ lassign [$w.c coords StrikeBox] x1 y1 x2 y2
+ set oldMidY [expr {round(($y1 + $y2) / 2.0)}]
+
+ set rowCount [expr {round(($y2 - $y1) / 4.0)}]
+ set colCount [expr {round(($x2 - $x1) / 4.0)}]
+ set x2 [expr {round($x2)}]
+ set x1 [expr {$x2 - $colCount * 4}]
+ set y1 [expr {round($y1)}]
+ set y2 [expr {$y1 + $rowCount * 4}]
+
+ set newMidY [expr {round(($y1 + $y2) / 2.0)}]
+ set deltaY [expr {$oldMidY - $newMidY}]
+ incr y1 $deltaY; incr y2 $deltaY
+ $w.c coords StrikeBox $x1 $y1 $x2 $y2
+
+ for {set row 0; set y $y1} {$row < $rowCount} {incr row; incr y 4} {
+ for {set col 0; set x $x1} {$col < $colCount} {incr col; incr x 4} {
+ $w.c create image $x $y -image smallGray25 -anchor nw
+ }
+ }
}
proc ActiveGUI {w var1 var2 op} {
@@ -266,7 +333,7 @@ proc DoButton {w what} {
}
proc Go {w {who {}}} {
- global S speed animationCallbacks MGO MPAUSE MSSTEP MBSTEP
+ global S delays animationCallbacks MGO MPAUSE MSSTEP MBSTEP
set now [clock clicks -milliseconds]
catch {after cancel $animationCallbacks(goldberg)}
@@ -287,7 +354,7 @@ proc Go {w {who {}}} {
}
set elapsed [expr {[clock click -milliseconds] - $now}]
- set delay [expr {$speed($S(speed)) - $elapsed}]
+ set delay [expr {$delays($S(speed)) - $elapsed}]
if {$delay <= 0} {
set delay 1
}
@@ -321,11 +388,13 @@ proc NextStep {w} {
set S(active) $alive
return $rval
}
+
proc About {w} {
set msg "$::S(title)\nby Keith Vetter, March 2003\n(Reproduced by kind\
permission of the author)\n\n\"Man will always find a difficult\
- means to perform a simple task.\"\nRube Goldberg"
- tk_messageBox -parent $w -message $msg -title About
+ means to perform a simple task.\"\n - Rube Goldberg"
+ PlacedDialog $w.c.messframe $msg {Helvetica 12 bold}
+ return
}
################################################################
#
@@ -335,12 +404,12 @@ proc About {w} {
# START HERE! banner
proc Draw0 {w} {
set color $::C(0)
- set xy {579 119}
- $w.c create text $xy -text "START HERE!" -fill $color -anchor w \
- -tag I0 -font {{Times Roman} 12 italic bold}
+ set xy {699 119}
+ $w.c create text $xy -text "START HERE!" -fill $color -anchor e \
+ -tag {I0 I0_0} -font {Times 12 italic bold}
set xy {719 119 763 119}
- $w.c create line $xy -tag I0 -fill $color -width 5 -arrow last \
- -arrowshape {18 18 5}
+ $w.c create line $xy -tag {I0 I0_1} -fill $color -width 3.75p -arrow last \
+ -arrowshape {13.5p 13.5p 3.75p}
$w.c bind I0 <Button-1> Start
}
proc Move0 {w {step {}}} {
@@ -351,12 +420,14 @@ proc Move0 {w {step {}}} {
return 2
}
- set pos {
- {673 119} {678 119} {683 119} {688 119}
- {693 119} {688 119} {683 119} {678 119}
- }
+ set pos [scl {
+ {719 119} {724 119} {729 119} {734 119}
+ {739 119} {734 119} {729 119} {724 119}
+ }]
set step [expr {$step % [llength $pos]}]
- MoveAbs $w I0 [lindex $pos $step]
+ lassign [lindex $pos $step] x y
+ $w.c coords I0_0 [expr {$x - [scl 20]}] $y
+ $w.c coords I0_1 $x $y [expr {$x + [scl 44]}] $y
return 1
}
@@ -365,9 +436,9 @@ proc Draw1 {w} {
set color $::C(1a)
set color2 $::C(1b)
set xy {844 133 800 133 800 346 820 346 820 168 844 168 844 133}
- $w.c create poly $xy -width 3 -fill $color -outline {}
+ $w.c create poly $xy -width 2.25p -fill $color -outline {}
set xy {771 133 685 133 685 168 751 168 751 346 771 346 771 133}
- $w.c create poly $xy -width 3 -fill $color -outline {}
+ $w.c create poly $xy -width 2.25p -fill $color -outline {}
set xy [box 812 122 9]
$w.c create oval $xy -tag I1 -fill $color2 -outline {}
@@ -375,11 +446,11 @@ proc Draw1 {w} {
}
proc Move1 {w {step {}}} {
set step [GetStep 1 $step]
- set pos {
+ set pos [scl {
{807 122} {802 122} {797 123} {793 124} {789 129} {785 153}
{785 203} {785 278 x} {785 367} {810 392} {816 438} {821 503}
{824 585 y} {838 587} {848 593} {857 601} {-100 -100}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
}
@@ -402,21 +473,14 @@ proc Draw2 {w} {
set xy {750 369 740 392 760 392} ;# Fulcrum
$w.c create poly $xy -fill $::C(fg) -outline $::C(fg)
set xy {628 335 660 383} ;# Strike box
- $w.c create rect $xy -fill {} -outline $::C(fg)
- for {set y 0} {$y < 3} {incr y} {
- set yy [expr {335+$y*16}]
- $w.c create bitmap 628 $yy -bitmap gray25 -anchor nw \
- -foreground $::C(fg)
- $w.c create bitmap 644 $yy -bitmap gray25 -anchor nw \
- -foreground $::C(fg)
- }
+ $w.c create rect $xy -fill {} -outline $::C(fg) -tag StrikeBox
set xy {702 366 798 366} ;# Lever
- $w.c create line $xy -fill $::C(fg) -width 6 -tag I2_0
+ $w.c create line $xy -fill $::C(fg) -width 5.25p -tag I2_0
set xy {712 363 712 355} ;# R strap
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I2_1
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I2_1
set xy {705 363 705 355} ;# L strap
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I2_2
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I2_2
set xy {679 356 679 360 717 360 717 356 679 356} ;# Match stick
$w.c create line $xy -fill $::C(fg) -tag I2_3
@@ -431,15 +495,16 @@ proc Move2 {w {step {}}} {
set step [GetStep 2 $step]
set stages {0 0 1 2 0 2 1 0 1 2 0 2 1}
- set xy(0) {
+ set xy(0) [scl {
686 333 692 323 682 316 674 309 671 295 668 307 662 318 662 328
671 336
- }
- set xy(1) {687 331 698 322 703 295 680 320 668 297 663 311 661 327 671 335}
- set xy(2) {
+ }]
+ set xy(1) [scl {
+ 687 331 698 322 703 295 680 320 668 297 663 311 661 327 671 335}]
+ set xy(2) [scl {
686 331 704 322 688 300 678 283 678 283 674 298 666 309 660 324
672 336
- }
+ }]
if {$step >= [llength $stages]} {
$w.c delete I2
@@ -467,24 +532,24 @@ proc Draw3 {w} {
set xy {602 296 577 174 518 174}
foreach {x y} $xy { ;# 3 Pulleys
$w.c create oval [box $x $y 13] -fill $color -outline $::C(fg) \
- -width 3
+ -width 2.25p
$w.c create oval [box $x $y 2] -fill $::C(fg) -outline $::C(fg)
}
set xy {750 309 670 309} ;# Wall to flame
- $w.c create line $xy -tag I3_s -width 3 -fill $::C(fg) -smooth 1
+ $w.c create line $xy -tag I3_s -width 2.25p -fill $::C(fg) -smooth 1
set xy {670 309 650 309} ;# Flame to pulley 1
- $w.c create line $xy -tag I3_0 -width 3 -fill $::C(fg)
+ $w.c create line $xy -tag I3_0 -width 2.25p -fill $::C(fg)
set xy {650 309 600 309} ;# Flame to pulley 1
- $w.c create line $xy -tag I3_1 -width 3 -fill $::C(fg)
+ $w.c create line $xy -tag I3_1 -width 2.25p -fill $::C(fg)
set xy {589 296 589 235} ;# Pulley 1 half way to 2
- $w.c create line $xy -tag I3_2 -width 3 -fill $::C(fg)
+ $w.c create line $xy -tag I3_2 -width 2.25p -fill $::C(fg)
set xy {589 235 589 174} ;# Pulley 1 other half to 2
- $w.c create line $xy -width 3 -fill $::C(fg)
+ $w.c create line $xy -width 2.25p -fill $::C(fg)
set xy {577 161 518 161} ;# Across the top
- $w.c create line $xy -width 3 -fill $::C(fg)
+ $w.c create line $xy -width 2.25p -fill $::C(fg)
set xy {505 174 505 205} ;# Down to weight
- $w.c create line $xy -tag I3_w -width 3 -fill $::C(fg)
+ $w.c create line $xy -tag I3_w -width 2.25p -fill $::C(fg)
# Draw the weight as 2 circles, two rectangles and 1 rounded rectangle
set xy {515 207 495 207}
@@ -501,19 +566,19 @@ proc Draw3 {w} {
set xy [RoundRect $w $xy 15]
$w.c create poly $xy -smooth 1 -tag I3_ -fill $color2 -outline $color2
set xy {500 217 511 217}
- $w.c create line $xy -tag I3_ -fill $color2 -width 10
+ $w.c create line $xy -tag I3_ -fill $color2 -width 7.5p
set xy {502 393 522 393 522 465} ;# Bottom weight target
- $w.c create line $xy -tag I3__ -fill $::C(fg) -join miter -width 10
+ $w.c create line $xy -tag I3__ -fill $::C(fg) -join miter -width 7.5p
}
proc Move3 {w {step {}}} {
set step [GetStep 3 $step]
- set pos {{505 247} {505 297} {505 386.5} {505 386.5}}
- set rope(0) {750 309 729 301 711 324 690 300}
- set rope(1) {750 309 737 292 736 335 717 315 712 320}
- set rope(2) {750 309 737 309 740 343 736 351 725 340}
- set rope(3) {750 309 738 321 746 345 742 356}
+ set pos [scl {{505 247} {505 297} {505 386.5} {505 386.5}}]
+ set rope(0) [scl {750 309 729 301 711 324 690 300}]
+ set rope(1) [scl {750 309 737 292 736 335 717 315 712 320}]
+ set rope(2) [scl {750 309 737 309 740 343 736 351 725 340}]
+ set rope(3) [scl {750 309 738 321 746 345 742 356}]
if {$step >= [llength $pos]} {
return 0
@@ -522,7 +587,7 @@ proc Move3 {w {step {}}} {
$w.c delete "I3_$step" ;# Delete part of the rope
MoveAbs $w I3_ [lindex $pos $step] ;# Move weight down
$w.c coords I3_s $rope($step) ;# Flapping rope end
- $w.c coords I3_w [concat 505 174 [lindex $pos $step]]
+ $w.c coords I3_w [concat [scl {505 174}] [lindex $pos $step]]
if {$step == 2} {
$w.c move I3__ 0 30
return 2
@@ -536,14 +601,14 @@ proc Draw4 {w} {
lassign {527 356 611 464} x0 y0 x1 y1
for {set y $y0} {$y <= $y1} {incr y 12} { ;# Horizontal bars
- $w.c create line $x0 $y $x1 $y -fill $color -width 1
+ $w.c create line $x0 $y $x1 $y -fill $color -width 0.75p
}
for {set x $x0} {$x <= $x1} {incr x 12} { ;# Vertical bars
- $w.c create line $x $y0 $x $y1 -fill $color -width 1
+ $w.c create line $x $y0 $x $y1 -fill $color -width 0.75p
}
set xy {518 464 518 428} ;# Swing gate
- $w.c create line $xy -tag I4 -fill $color -width 3
+ $w.c create line $xy -tag I4 -fill $color -width 2.25p
}
proc Move4 {w {step {}}} {
set step [GetStep 4 $step]
@@ -552,7 +617,7 @@ proc Move4 {w {step {}}} {
if {$step >= [llength $angles]} {
return 0
}
- RotateItem $w I4 518 464 [lindex $angles $step]
+ RotateItem $w I4 [scl 518] [scl 464] [lindex $angles $step]
$w.c raise I4
return [expr {$step == 3 ? 3 : 1}]
}
@@ -563,7 +628,7 @@ proc Draw5 {w} {
set color2 $::C(5b)
set xy {377 248 410 248 410 465 518 465} ;# Mouse course
lappend xy 518 428 451 428 451 212 377 212
- $w.c create poly $xy -fill $color2 -outline $::C(fg) -width 3
+ $w.c create poly $xy -fill $color2 -outline $::C(fg) -width 2.25p
set xy {
534.5 445.5 541 440 552 436 560 436 569 440 574 446 575 452 574 454
@@ -571,29 +636,29 @@ proc Draw5 {w} {
}
$w.c create poly $xy -tag {I5 I5_0} -fill $color
set xy {573 452 592 458 601 460 613 456} ;# Tail
- $w.c create line $xy -tag {I5 I5_1} -fill $color -smooth 1 -width 3
+ $w.c create line $xy -tag {I5 I5_1} -fill $color -smooth 1 -width 2.25p
set xy [box 540 446 2] ;# Eye
set xy {540 444 541 445 541 447 540 448 538 447 538 445}
#.c create oval $xy -tag {I5 I5_2} -fill $::C(bg) -outline {}
$w.c create poly $xy -tag {I5 I5_2} -fill $::C(bg) -outline {} -smooth 1
set xy {538 454 535 461} ;# Front leg
- $w.c create line $xy -tag {I5 I5_3} -fill $color -width 2
+ $w.c create line $xy -tag {I5 I5_3} -fill $color -width 1.5p
set xy {566 455 569 462} ;# Back leg
- $w.c create line $xy -tag {I5 I5_4} -fill $color -width 2
+ $w.c create line $xy -tag {I5 I5_4} -fill $color -width 1.5p
set xy {544 455 545 460} ;# 2nd front leg
- $w.c create line $xy -tag {I5 I5_5} -fill $color -width 2
+ $w.c create line $xy -tag {I5 I5_5} -fill $color -width 1.5p
set xy {560 455 558 460} ;# 2nd back leg
- $w.c create line $xy -tag {I5 I5_6} -fill $color -width 2
+ $w.c create line $xy -tag {I5 I5_6} -fill $color -width 1.5p
}
proc Move5 {w {step {}}} {
set step [GetStep 5 $step]
- set pos {
+ set pos [scl {
{553 452} {533 452} {513 452} {493 452} {473 452}
{463 442 30} {445.5 441.5 30} {425.5 434.5 30} {422 414} {422 394}
{422 374} {422 354} {422 334} {422 314} {422 294}
{422 274 -30} {422 260.5 -30 x} {422.5 248.5 -28} {425 237}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
}
@@ -630,22 +695,22 @@ proc Draw6 {w} {
set color $::C(6)
set xy {324 130 391 204} ;# Ball holder
set xy [RoundRect $w $xy 10]
- $w.c create poly $xy -smooth 1 -outline $::C(fg) -width 3 -fill $color
+ $w.c create poly $xy -smooth 1 -outline $::C(fg) -width 2.25p -fill $color
set xy {339 204 376 253} ;# Below the ball holder
- $w.c create rect $xy -fill {} -outline $::C(fg) -width 3 -fill $color \
+ $w.c create rect $xy -fill {} -outline $::C(fg) -width 2.25p -fill $color \
-tag I6c
set xy [box 346 339 28]
$w.c create oval $xy -fill $color -outline {} ;# Rotor
- $w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 1.5p -style arc \
-start 80 -extent 205
- $w.c create arc $xy -outline $::C(fg) -width 2 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 1.5p -style arc \
-start -41 -extent 85
set xy [box 346 339 15] ;# Center of rotor
$w.c create oval $xy -outline $::C(fg) -fill $::C(fg) -tag I6m
set xy {352 312 352 254 368 254 368 322} ;# Top drop to rotor
$w.c create poly $xy -fill $color -outline {}
- $w.c create line $xy -fill $::C(fg) -width 2
+ $w.c create line $xy -fill $::C(fg) -width 1.5p
set xy {353 240 367 300} ;# Poke bottom hole
$w.c create rect $xy -fill $color -outline {}
@@ -653,21 +718,21 @@ proc Draw6 {w} {
$w.c create rect $xy -fill $color -outline {}
set xy {368 356 368 403 389 403 389 464 320 464 320 403 352 403 352 366}
- $w.c create poly $xy -fill $color -outline {} -width 2 ;# Below rotor
- $w.c create line $xy -fill $::C(fg) -width 2
+ $w.c create poly $xy -fill $color -outline {} -width 1.5p ;# Below rotor
+ $w.c create line $xy -fill $::C(fg) -width 1.5p
set xy [box 275 342 7] ;# On/off rotor
$w.c create oval $xy -outline $::C(fg) -fill $::C(fg)
set xy {276 334 342 325} ;# Fan belt top
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy {276 349 342 353} ;# Fan belt bottom
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy {337 212 337 247} ;# What the mouse pushes
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I6_
set xy {392 212 392 247}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I6_
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I6_
set xy {337 230 392 230}
- $w.c create line $xy -fill $::C(fg) -width 7 -tag I6_
+ $w.c create line $xy -fill $::C(fg) -width 5.25p -tag I6_
set who -1 ;# All the balls
set colors {red cyan orange green blue darkblue}
@@ -681,15 +746,23 @@ proc Draw6 {w} {
}
Draw6a $w 12 ;# The wheel
}
-proc Draw6a {w beta} {
+proc Draw6a {w beta {scale 0}} {
$w.c delete I6_0
- lassign {346 339} Ox Oy
+ if {$scale} {
+ lassign [scl {346 339}] Ox Oy
+ } else {
+ lassign {346 339} Ox Oy
+ }
for {set i 0} {$i < 4} {incr i} {
set b [expr {$beta + $i * 45}]
- lassign [RotateC 28 0 0 0 $b] x y
+ if {$scale} {
+ lassign [RotateC [scl 28] 0 0 0 $b] x y
+ } else {
+ lassign [RotateC 28 0 0 0 $b] x y
+ }
set xy [list [expr {$Ox+$x}] [expr {$Oy+$y}] \
[expr {$Ox-$x}] [expr {$Oy-$y}]]
- $w.c create line $xy -tag I6_0 -fill $::C(fg) -width 2
+ $w.c create line $xy -tag I6_0 -fill $::C(fg) -width 1.5p
}
}
proc Move6 {w {step {}}} {
@@ -699,9 +772,9 @@ proc Move6 {w {step {}}} {
}
if {$step < 2} { ;# Open gate for balls to drop
- $w.c move I6_ -7 0
+ $w.c move I6_ -5.25p 0
if {$step == 1} { ;# Poke a hole
- set xy {348 226 365 240}
+ set xy [scl {348 226 365 240}]
$w.c create rect $xy -fill [$w.c itemcget I6c -fill] -outline {}
}
return 1
@@ -714,9 +787,9 @@ proc Move6 {w {step {}}} {
set loc [expr {$s - 3 * $i}]
if {[info exists ::XY6($loc,$i)]} {
- MoveAbs $w $tag $::XY6($loc,$i)
+ MoveAbs $w $tag [scl $::XY6($loc,$i)]
} elseif {[info exists ::XY6($loc)]} {
- MoveAbs $w $tag $::XY6($loc)
+ MoveAbs $w $tag [scl $::XY6($loc)]
}
}
if {($s % 3) == 1} {
@@ -725,13 +798,13 @@ proc Move6 {w {step {}}} {
set tag "I6_b$i"
if {[$w.c find withtag $tag] eq ""} break
set loc [expr {$first - $i}]
- MoveAbs $w $tag $::XY6($loc)
+ MoveAbs $w $tag [scl $::XY6($loc)]
}
}
if {$s >= 3} { ;# Rotate the motor
set idx [expr {$s % 3}]
#Draw6a $w [lindex {12 35 64} $idx]
- Draw6a $w [expr {12 + $s * 15}]
+ Draw6a $w [expr {12 + $s * 15}] 1
}
return [expr {$s == 3 ? 3 : 1}]
}
@@ -740,15 +813,15 @@ proc Move6 {w {step {}}} {
proc Draw7 {w} {
set color $::C(7)
set xy {198 306 277 374} ;# Box
- $w.c create rect $xy -outline $::C(fg) -width 2 -fill $color -tag I7z
+ $w.c create rect $xy -outline $::C(fg) -width 1.5p -fill $color -tag I7z
$w.c lower I7z
set xy {275 343 230 349}
$w.c create line $xy -tag I7 -fill $::C(fg) -arrow last \
- -arrowshape {23 23 8} -width 6
+ -arrowshape {17.25p 17.25p 6p} -width 4.5p
set xy {225 324} ;# On button
$w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
set xy {218 323} ;# On text
- set font {{Times Roman} 8}
+ set font {Times 8}
$w.c create text $xy -text "on" -anchor e -fill $::C(fg) -font $font
set xy {225 350} ;# Off button
$w.c create oval [box {*}$xy 3] -fill $::C(fg) -outline $::C(fg)
@@ -762,14 +835,14 @@ proc Move7 {w {step {}}} {
return 0
}
set beta [expr {30.0 / $numsteps}]
- RotateItem $w I7 275 343 $beta
+ RotateItem $w I7 [scl 275] [scl 343] $beta
return [expr {$step == $numsteps ? 3 : 1}]
}
# Electricity to the fan
proc Draw8 {w} {
- Sine $w 271 248 271 306 5 8 -tag I8_s -fill $::C(8) -width 3
+ Sine $w 271 248 271 306 5 8 -tag I8_s -fill $::C(8) -width 2.25p
}
proc Move8 {w {step {}}} {
set step [GetStep 8 $step]
@@ -805,24 +878,24 @@ proc Draw9 {w} {
$w.c create poly $xy -fill $color
set xy {255 206 265 234} ;# Fan blades
- $w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 2.25p -tag I9_0
set xy {255 176 265 204}
- $w.c create oval $xy -fill {} -outline $::C(fg) -width 3 -tag I9_0
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 2.25p -tag I9_0
set xy {255 206 265 220}
- $w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 0.75p -tag I9_1
set xy {255 190 265 204}
- $w.c create oval $xy -fill {} -outline $::C(fg) -width 1 -tag I9_1
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 0.75p -tag I9_1
}
proc Move9 {w {step {}}} {
set step [GetStep 9 $step]
if {$step & 1} {
- $w.c itemconfig I9_0 -width 4
- $w.c itemconfig I9_1 -width 1
+ $w.c itemconfig I9_0 -width 3p
+ $w.c itemconfig I9_1 -width 0.75p
$w.c lower I9_1 I9_0
} else {
- $w.c itemconfig I9_0 -width 1
- $w.c itemconfig I9_1 -width 4
+ $w.c itemconfig I9_0 -width 0.75p
+ $w.c itemconfig I9_1 -width 3p
$w.c lower I9_0 I9_1
}
if {$step == 0} {
@@ -836,47 +909,47 @@ proc Draw10 {w} {
set color $::C(10a)
set color2 $::C(10b)
set xy {191 230 233 230 233 178 191 178} ;# Sail
- $w.c create poly $xy -fill $color -width 3 -outline $::C(fg) -tag I10
+ $w.c create poly $xy -fill $color -width 2.25p -outline $::C(fg) -tag I10
set xy [box 209 204 31] ;# Front
$w.c create arc $xy -outline {} -fill $color -style pie \
-start 120 -extent 120 -tag I10
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \
-start 120 -extent 120 -tag I10
set xy [box 249 204 31] ;# Back
- $w.c create arc $xy -outline {} -fill $::C(bg) -width 3 -style pie \
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 2.25p -style pie \
-start 120 -extent 120 -tag I10
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \
-start 120 -extent 120 -tag I10
set xy {200 171 200 249} ;# Mast
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I10
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I10
set xy {159 234 182 234} ;# Bow sprit
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I10
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I10
set xy {180 234 180 251 220 251} ;# Hull
- $w.c create line $xy -fill $::C(fg) -width 6 -tag I10
+ $w.c create line $xy -fill $::C(fg) -width 4.5p -tag I10
set xy {92 255 221 255} ;# Waves
- Sine $w {*}$xy 2 25 -fill $color2 -width 1 -tag I10w
+ Sine $w {*}$xy 2 25 -fill $color2 -width 0.75p -tag I10w
set xy [lrange [$w.c coords I10w] 4 end-4] ;# Water
set xy [concat $xy 222 266 222 277 99 277]
$w.c create poly $xy -fill $color2 -outline $color2
set xy {222 266 222 277 97 277 97 266} ;# Water bottom
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy [box 239 262 17]
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \
-start 95 -extent 103
set xy [box 76 266 21]
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 190
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc -extent 190
}
proc Move10 {w {step {}}} {
set step [GetStep 10 $step]
- set pos {
+ set pos [scl {
{195 212} {193 212} {190 212} {186 212} {181 212} {176 212}
{171 212} {166 212} {161 212} {156 212} {151 212} {147 212} {142 212}
{137 212} {132 212 x} {127 212} {121 212} {116 212} {111 212}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
@@ -900,31 +973,31 @@ proc Draw11 {w} {
$w.c create oval $xy -fill $color -outline {}
set xy {55 264 55 458} ;# Top right side
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy {55 504 55 591} ;# Bottom right side
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy [box 71 460 48] ;# Outer loop
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \
-start 110 -extent -290 -tag I11i
set xy [box 71 460 16] ;# Inner loop
- $w.c create oval $xy -outline $::C(fg) -fill {} -width 3 -tag I11i
- $w.c create oval $xy -outline $::C(fg) -fill $::C(bg) -width 3
+ $w.c create oval $xy -outline $::C(fg) -fill {} -width 2.25p -tag I11i
+ $w.c create oval $xy -outline $::C(fg) -fill $::C(bg) -width 2.25p
set xy {23 264 23 591} ;# Left side
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy [box 1 266 23] ;# Top left curve
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc -extent 90
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc -extent 90
set xy [box 75 235 9] ;# The ball
- $w.c create oval $xy -fill $color2 -outline {} -width 3 -tag I11
+ $w.c create oval $xy -fill $color2 -outline {} -width 2.25p -tag I11
}
proc Move11 {w {step {}}} {
set step [GetStep 11 $step]
- set pos {
+ set pos [scl {
{75 235} {70 235} {65 237} {56 240} {46 247} {38 266} {38 296}
{38 333} {38 399} {38 475} {74 496} {105 472} {100 437} {65 423}
{-100 -100} {38 505} {38 527 x} {38 591}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
@@ -951,11 +1024,11 @@ proc Draw12 {w} {
lappend xy $x $y0 $x1 $y1 $x2 $y0
}
$w.c create poly $xy -fill $::C(12) -outline $::C(fg) -smooth 1 -tag I12 \
- -width 3
+ -width 2.25p
}
proc Move12 {w {step {}}} {
set step [GetStep 12 $step]
- set pos {{42.5 641 x}}
+ set pos [scl {{42 641 x}}]
if {$step >= [llength $pos]} {
return 0
}
@@ -975,29 +1048,27 @@ proc Draw13 {w} {
set xy2 {784 663 721 663 721 704 820 704 820 681 806 681 784 671}
set radii {2 9 9 8 5 5 2}
- RoundPoly $w.c $xy $radii -width 3 -outline $::C(fg) -fill $color
- RoundPoly $w.c $xy2 $radii -width 3 -outline $::C(fg) -fill $color
+ RoundPoly $w.c $xy $radii -width 2.25p -outline $::C(fg) -fill $color
+ RoundPoly $w.c $xy2 $radii -width 2.25p -outline $::C(fg) -fill $color
set xy {56 677}
- $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
+ $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 2.25p \
-tag I13
set xy {809 677}
- $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 3 \
+ $w.c create rect [box {*}$xy 4] -fill {} -outline $::C(fg) -width 2.25p \
-tag I13R
set xy {112 687} ;# Label
- $w.c create text $xy -text "FAX" -fill $::C(fg) \
- -font {{Times Roman} 12 bold}
+ $w.c create text $xy -text "FAX" -fill $::C(fg) -font {Times 12 bold}
set xy {762 687}
- $w.c create text $xy -text "FAX" -fill $::C(fg) \
- -font {{Times Roman} 12 bold}
+ $w.c create text $xy -text "FAX" -fill $::C(fg) -font {Times 12 bold}
set xy {138 663 148 636 178 636} ;# Paper guide
- $w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
+ $w.c create line $xy -smooth 1 -fill $::C(fg) -width 2.25p
set xy {732 663 722 636 692 636}
- $w.c create line $xy -smooth 1 -fill $::C(fg) -width 3
+ $w.c create line $xy -smooth 1 -fill $::C(fg) -width 2.25p
- Sine $w 149 688 720 688 5 15 -tag I13_s -fill $::C(fg) -width 3
+ Sine $w 149 688 720 688 5 15 -tag I13_s -fill $::C(fg) -width 2.25p
}
proc Move13 {w {step {}}} {
set step [GetStep 13 $step]
@@ -1005,7 +1076,7 @@ proc Move13 {w {step {}}} {
if {$step == $numsteps+2} {
MoveAbs $w I13_star {-100 -100}
- $w.c itemconfig I13R -fill $::C(13b) -width 2
+ $w.c itemconfig I13R -fill $::C(13b) -width 1.5p
return 2
}
if {$step == 0} { ;# Button down
@@ -1024,22 +1095,22 @@ proc Move13 {w {step {}}} {
proc Draw14 {w} {
set color $::C(14)
set xy {102 661 113 632 130 618} ;# Left paper edge
- $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_0
+ $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14L_0
set xy {148 629 125 640 124 662} ;# Right paper edge
- $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14L_1
+ $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14L_1
Draw14a $w L
set xy {
768.0 662.5 767.991316225 662.433786215 767.926187912 662.396880171
}
- $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_0
+ $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14R_0
$w.c lower I14R_0
# NB. these numbers are VERY sensitive, you must start with final size
# and shrink down to get the values
set xy {
745.947897349 662.428358855 745.997829056 662.452239237 746.0 662.5
}
- $w.c create line $xy -smooth 1 -fill $color -width 3 -tag I14R_1
+ $w.c create line $xy -smooth 1 -fill $color -width 2.25p -tag I14R_1
$w.c lower I14R_1
}
proc Draw14a {w side} {
@@ -1053,7 +1124,7 @@ proc Draw14a {w side} {
$x3 $y3 $x3 $y3 $xy2 $x5 $y5 $x5 $y5]
$w.c delete I14$side
$w.c create poly $zz -tag I14$side -smooth 1 -fill $color -outline $color \
- -width 3
+ -width 2.25p
$w.c lower I14$side
}
proc Move14 {w {step {}}} {
@@ -1089,28 +1160,28 @@ proc Move14 {w {step {}}} {
proc Draw15 {w} {
set color $::C(15a)
set xy {824 599 824 585 820 585 829 585}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I15a
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I15a
set xy {789 599 836 643}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
set xy {778 610 788 632}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
set xy {766 617 776 625}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
set xy {633 600 681 640}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 3
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
set xy {635 567 657 599}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 2
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
set xy {765 557 784 583}
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 2
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 2.25p
- Sine $w 658 580 765 580 3 15 -tag I15_s -fill $::C(fg) -width 3
+ Sine $w 658 580 765 580 3 15 -tag I15_s -fill $::C(fg) -width 2.25p
}
proc Move15a {w} {
set color $::C(15b)
- $w.c scale I15a 824 599 1 .3 ;# Button down
- set xy {765 621 681 621}
- $w.c create line $xy -dash "-" -width 3 -fill $color -tag I15
+ $w.c scale I15a [scl 824] [scl 599] 1 .3 ;# Button down
+ set xy [scl {765 621 681 621}]
+ $w.c create line $xy -dash "-" -width 2.25p -fill $color -tag I15
}
proc Move15 {w {step {}}} {
set step [GetStep 15 $step]
@@ -1122,7 +1193,7 @@ proc Move15 {w {step {}}} {
}
if {$step == 0} { ;# Break the light beam
Sparkle $w {-100 -100} I15_star
- set xy {765 621 745 621}
+ set xy [scl {765 621 745 621}]
$w.c coords I15 $xy
return 1
}
@@ -1137,14 +1208,14 @@ proc Move15 {w {step {}}} {
proc Draw16 {w} {
set color $::C(16)
set xy {722 485 791 556}
- $w.c create rect $xy -fill {} -outline $::C(fg) -width 3
+ $w.c create rect $xy -fill {} -outline $::C(fg) -width 2.25p
set xy [box 752 515 25] ;# Bell
- $w.c create oval $xy -fill $color -outline black -tag I16b -width 2
+ $w.c create oval $xy -fill $color -outline black -tag I16b -width 1.5p
set xy [box 752 515 5] ;# Bell button
$w.c create oval $xy -fill black -outline black -tag I16b
set xy {784 523 764 549} ;# Clapper
- $w.c create line $xy -width 3 -tag I16c -fill $::C(fg)
+ $w.c create line $xy -width 2.25p -tag I16c -fill $::C(fg)
set xy [box 784 523 4]
$w.c create oval $xy -fill $::C(fg) -outline $::C(fg) -tag I16d
}
@@ -1152,13 +1223,13 @@ proc Move16 {w {step {}}} {
set step [GetStep 16 $step]
# Note: we never stop
- lassign {760 553} Ox Oy
+ lassign [scl {760 553}] Ox Oy
if {$step & 1} {
set beta 12
- $w.c move I16b 3 0
+ $w.c move I16b 2.25p 0
} else {
set beta -12
- $w.c move I16b -3 0
+ $w.c move I16b -2.25p 0
}
RotateItem $w I16c $Ox $Oy $beta
RotateItem $w I16d $Ox $Oy $beta
@@ -1171,82 +1242,82 @@ proc Draw17 {w} {
set color $::C(17)
set xy {584 556 722 556}
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy {584 485 722 485}
- $w.c create line $xy -fill $::C(fg) -width 3
+ $w.c create line $xy -fill $::C(fg) -width 2.25p
set xy {664 523 717 549} ;# Body
- $w.c create arc $xy -outline $::C(fg) -fill $color -width 3 \
+ $w.c create arc $xy -outline $::C(fg) -fill $color -width 2.25p \
-style chord -start 128 -extent -260 -tag I17
set xy {709 554 690 543} ;# Paw
- $w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
+ $w.c create oval $xy -outline $::C(fg) -fill $color -width 2.25p -tag I17
set xy {657 544 676 555}
- $w.c create oval $xy -outline $::C(fg) -fill $color -width 3 -tag I17
+ $w.c create oval $xy -outline $::C(fg) -fill $color -width 2.25p -tag I17
set xy [box 660 535 15] ;# Lower face
- $w.c create arc $xy -outline $::C(fg) -width 3 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -style arc \
-start 150 -extent 240 -tag I17_
- $w.c create arc $xy -outline {} -fill $color -width 1 -style chord \
+ $w.c create arc $xy -outline {} -fill $color -width 0.75p -style chord \
-start 150 -extent 240 -tag I17_
set xy {674 529 670 513 662 521 658 521 650 513 647 529} ;# Ears
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
- $w.c create poly $xy -fill $color -outline {} -width 1 -tag {I17_ I17_c}
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
+ $w.c create poly $xy -fill $color -outline {} -width 0.75p -tag {I17_ I17_c}
set xy {652 542 628 539} ;# Whiskers
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
set xy {652 543 632 545}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
set xy {652 546 632 552}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
set xy {668 543 687 538}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w}
set xy {668 544 688 546}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w}
set xy {668 547 688 553}
- $w.c create line $xy -fill $::C(fg) -width 3 -tag {I17_ I17w}
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag {I17_ I17w}
set xy {649 530 654 538 659 530} ;# Left eye
- $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17
set xy {671 530 666 538 661 530} ;# Right eye
- $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17
set xy {655 543 660 551 665 543} ;# Mouth
- $w.c create line $xy -fill $::C(fg) -width 2 -smooth 1 -tag I17
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -smooth 1 -tag I17
}
proc Move17 {w {step {}}} {
set step [GetStep 17 $step]
if {$step == 0} {
$w.c delete I17 ;# Delete most of the cat
- set xy {655 543 660 535 665 543} ;# Mouth
- $w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
- set xy [box 654 530 4] ;# Left eye
- $w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
- set xy [box 666 530 4] ;# Right eye
- $w.c create oval $xy -outline $::C(fg) -width 3 -fill {} -tag I17_
-
- $w.c move I17_ 0 -20 ;# Move face up
- set xy {652 528 652 554} ;# Front leg
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
- set xy {670 528 670 554} ;# 2nd front leg
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
-
- set xy {
+ set xy [scl {655 543 660 535 665 543}] ;# Mouth
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -smooth 1 -tag I17_
+ set xy [box [scl 654] [scl 530] [scl 4]] ;# Left eye
+ $w.c create oval $xy -outline $::C(fg) -width 2.25p -fill {} -tag I17_
+ set xy [box [scl 666] [scl 530] [scl 4]] ;# Right eye
+ $w.c create oval $xy -outline $::C(fg) -width 2.25p -fill {} -tag I17_
+
+ $w.c move I17_ 0 -15p ;# Move face up
+ set xy [scl {652 528 652 554}] ;# Front leg
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
+ set xy [scl {670 528 670 554}] ;# 2nd front leg
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
+
+ set xy [scl {
675 506 694 489 715 513 715 513 715 513 716 525 716 525 716 525
706 530 695 530 679 535 668 527 668 527 668 527 675 522 676 517
677 512
- } ;# Body
+ }] ;# Body
$w.c create poly $xy -fill [$w.c itemcget I17_c -fill] \
- -outline $::C(fg) -width 3 -smooth 1 -tag I17_
- set xy {716 514 716 554} ;# Back leg
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
- set xy {694 532 694 554} ;# 2nd back leg
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I17_
- set xy {715 514 718 506 719 495 716 488};# Tail
- $w.c create line $xy -fill $::C(fg) -width 3 -smooth 1 -tag I17_
+ -outline $::C(fg) -width 2.25p -smooth 1 -tag I17_
+ set xy [scl {716 514 716 554}] ;# Back leg
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
+ set xy [scl {694 532 694 554}] ;# 2nd back leg
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I17_
+ set xy [scl {715 514 718 506 719 495 716 488}] ;# Tail
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -smooth 1 -tag I17_
$w.c raise I17w ;# Make whiskers visible
- $w.c move I17_ -5 0 ;# Move away from wall a bit
+ $w.c move I17_ -3.75p 0 ;# Move away from wall a bit
return 2
}
return 0
@@ -1256,31 +1327,31 @@ proc Move17 {w {step {}}} {
proc Draw18 {w} {
set color $::C(18)
set xy {721 506 627 506} ;# Sling hold
- $w.c create line $xy -width 4 -fill $::C(fg) -tag I18
+ $w.c create line $xy -width 3p -fill $::C(fg) -tag I18
set xy {607 500 628 513} ;# Sling rock
$w.c create oval $xy -fill $color -outline {} -tag I18a
set xy {526 513 606 507 494 502} ;# Sling band
- $w.c create line $xy -fill $::C(fg) -width 4 -tag I18b
+ $w.c create line $xy -fill $::C(fg) -width 3p -tag I18b
set xy { 485 490 510 540 510 575 510 540 535 491 } ;# Sling
- $w.c create line $xy -fill $::C(fg) -width 6
+ $w.c create line $xy -fill $::C(fg) -width 4.5p
}
proc Move18 {w {step {}}} {
set step [GetStep 18 $step]
- set pos {
+ set pos [scl {
{587 506} {537 506} {466 506} {376 506} {266 506 x} {136 506}
{16 506} {-100 -100}
- }
+ }]
- set b(0) {490 502 719 507 524 512} ;# Band collapsing
- set b(1) {
+ set b(0) [scl {490 502 719 507 524 512}] ;# Band collapsing
+ set b(1) [scl {
491 503 524 557 563 505 559 496 546 506 551 525 553 536 538 534
532 519 529 499
- }
- set b(2) {491 503 508 563 542 533 551 526 561 539 549 550 530 500}
- set b(3) {491 503 508 563 530 554 541 562 525 568 519 544 530 501}
+ }]
+ set b(2) [scl {491 503 508 563 542 533 551 526 561 539 549 550 530 500}]
+ set b(3) [scl {491 503 508 563 530 554 541 562 525 568 519 544 530 501}]
if {$step >= [llength $pos]} {
return 0
@@ -1308,67 +1379,67 @@ proc Draw19 {w} {
set xx {249 181 155 118 86 55 22 0}
foreach {x1 x2} $xx {
$w.c create rect $x1 453 $x2 467 -fill $color -outline {} -tag I19
- $w.c create line $x1 453 $x2 453 -fill $::C(fg) -width 1;# Pipe top
- $w.c create line $x1 467 $x2 467 -fill $::C(fg) -width 1;# Pipe bottom
+ $w.c create line $x1 453 $x2 453 -fill $::C(fg) -width 0.75p;# Pipe top
+ $w.c create line $x1 467 $x2 467 -fill $::C(fg) -width 0.75p;# Pipe btm
}
$w.c raise I11i
set xy [box 168 460 16] ;# Bulge by the joint
$w.c create oval $xy -fill $color -outline {}
- $w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p -style arc \
-start 21 -extent 136
- $w.c create arc $xy -outline $::C(fg) -width 1 -style arc \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p -style arc \
-start -21 -extent -130
set xy {249 447 255 473} ;# First joint 26x6
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy [box 257 433 34] ;# Bend up
- $w.c create arc $xy -outline {} -fill $color -width 1 \
+ $w.c create arc $xy -outline {} -fill $color -width 0.75p \
-style pie -start 0 -extent -91
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 0 -extent -90
set xy [box 257 433 20]
$w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
-style pie -start 0 -extent -92
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 0 -extent -90
set xy [box 257 421 34] ;# Bend left
- $w.c create arc $xy -outline {} -fill $color -width 1 \
+ $w.c create arc $xy -outline {} -fill $color -width 0.75p \
-style pie -start 1 -extent 91
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 0 -extent 90
set xy [box 257 421 20]
- $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 0.75p \
-style pie -start 0 -extent 90
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 0 -extent 90
set xy [box 243 421 34] ;# Bend down
- $w.c create arc $xy -outline {} -fill $color -width 1 \
+ $w.c create arc $xy -outline {} -fill $color -width 0.75p \
-style pie -start 90 -extent 90
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 90 -extent 90
set xy [box 243 421 20]
- $w.c create arc $xy -outline {} -fill $::C(bg) -width 1 \
+ $w.c create arc $xy -outline {} -fill $::C(bg) -width 0.75p \
-style pie -start 90 -extent 90
- $w.c create arc $xy -outline $::C(fg) -width 1 \
+ $w.c create arc $xy -outline $::C(fg) -width 0.75p \
-style arc -start 90 -extent 90
set xy {270 427 296 433} ;# 2nd joint bottom
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy {270 421 296 427} ;# 2nd joint top
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy {249 382 255 408} ;# Third joint right
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy {243 382 249 408} ;# Third joint left
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy {203 420 229 426} ;# Last joint
- $w.c create rect $xy -fill $color -outline $::C(fg) -width 1
+ $w.c create rect $xy -fill $color -outline $::C(fg) -width 0.75p
set xy [box 168 460 6] ;# Handle joint
$w.c create oval $xy -fill $::C(fg) -outline {} -tag I19a
set xy {168 460 168 512} ;# Handle bar
- $w.c create line $xy -fill $::C(fg) -width 5 -tag I19b
+ $w.c create line $xy -fill $::C(fg) -width 3.75p -tag I19b
}
proc Move19 {w {step {}}} {
set step [GetStep 19 $step]
@@ -1388,12 +1459,12 @@ proc Draw20 {w} {
proc Move20 {w {step {}}} {
set step [GetStep 20 $step]
- set pos {451 462 473 484 496 504 513 523 532}
+ set pos [scl {451 462 473 484 496 504 513 523 532}]
set freq {20 40 40 40 40 40 40 40 40}
- set pos {
+ set pos [scl {
{451 20} {462 40} {473 40} {484 40} {496 40} {504 40} {513 40}
{523 40} {532 40 x}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
}
@@ -1411,36 +1482,36 @@ proc H2O {w y f} {
set color $::C(20)
$w.c delete I20
- Sine $w 208 428 208 $y 4 $f -tag {I20 I20s} -width 3 -fill $color \
- -smooth 1
- $w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
+ Sine $w [scl 208] [scl 428] [scl 208] $y 4 $f -tag {I20 I20s} \
+ -width 2.25p -fill $color -smooth 1
+ $w.c create line [$w.c coords I20s] -width 2.25p -fill $color -smooth 1 \
-tag {I20 I20a}
- $w.c create line [$w.c coords I20s] -width 3 -fill $color -smooth 1 \
+ $w.c create line [$w.c coords I20s] -width 2.25p -fill $color -smooth 1 \
-tag {I20 I20b}
- $w.c move I20a 8 0
- $w.c move I20b 16 0
+ $w.c move I20a 6p 0
+ $w.c move I20b 12p 0
}
# Bucket
proc Draw21 {w} {
set color $::C(21)
set xy {217 451 244 490} ;# Right handle
- $w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21_a
set xy {201 467 182 490} ;# Left handle
- $w.c create line $xy -fill $::C(fg) -width 2 -tag I21_a
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21_a
set xy {245 490 237 535} ;# Right side
set xy2 {189 535 181 490} ;# Left side
$w.c create poly [concat $xy $xy2] -fill $color -outline {} \
-tag {I21 I21f}
- $w.c create line $xy -fill $::C(fg) -width 2 -tag I21
- $w.c create line $xy2 -fill $::C(fg) -width 2 -tag I21
+ $w.c create line $xy -fill $::C(fg) -width 1.5p -tag I21
+ $w.c create line $xy2 -fill $::C(fg) -width 1.5p -tag I21
set xy {182 486 244 498} ;# Top
- $w.c create oval $xy -fill $color -outline {} -width 2 -tag {I21 I21f}
- $w.c create oval $xy -fill {} -outline $::C(fg) -width 2 -tag {I21 I21t}
+ $w.c create oval $xy -fill $color -outline {} -width 1.5p -tag {I21 I21f}
+ $w.c create oval $xy -fill {} -outline $::C(fg) -width 1.5p -tag {I21 I21t}
set xy {189 532 237 540} ;# Bottom
- $w.c create oval $xy -fill $color -outline $::C(fg) -width 2 \
+ $w.c create oval $xy -fill $color -outline $::C(fg) -width 1.5p \
-tag {I21 I21b}
}
proc Move21 {w {step {}}} {
@@ -1453,10 +1524,10 @@ proc Move21 {w {step {}}} {
lassign [$w.c coords I21b] x1 y1 x2 y2
#lassign [$w.c coords I21t] X1 Y1 X2 Y2
- lassign {183 492 243 504} X1 Y1 X2 Y2
+ lassign [scl {183 492 243 504}] X1 Y1 X2 Y2
set f [expr {$step / double($numsteps)}]
- set y2 [expr {$y2 - 3}]
+ set y2 [expr {$y2 - [scl 3]}]
set xx1 [expr {$x1 + ($X1 - $x1) * $f}]
set yy1 [expr {$y1 + ($Y1 - $y1) * $f}]
set xx2 [expr {$x2 + ($X2 - $x2) * $f}]
@@ -1479,7 +1550,7 @@ proc Draw22 {w} {
}
proc Move22 {w {step {}}} {
set step [GetStep 22 $step]
- set pos {{213 513} {213 523} {213 543 x} {213 583} {213 593}}
+ set pos [scl {{213 513} {213 523} {213 543 x} {213 583} {213 593}}]
if {$step == 0} {$w.c itemconfig I21f -fill $::C(22)}
if {$step >= [llength $pos]} {
@@ -1503,31 +1574,31 @@ proc Draw23 {w} {
set color3 $::C(23c)
set xy {185 623 253 650} ;# Block
- $w.c create rect $xy -fill black -outline $::C(fg) -width 2 -tag I23a
+ $w.c create rect $xy -fill black -outline $::C(fg) -width 1.5p -tag I23a
set xy {187 592 241 623} ;# Balloon
$w.c create oval $xy -outline {} -fill $color -tag I23b
- $w.c create arc $xy -outline $::C(fg) -width 3 -tag I23b \
+ $w.c create arc $xy -outline $::C(fg) -width 2.25p -tag I23b \
-style arc -start 12 -extent 336
set xy {239 604 258 589 258 625 239 610} ;# Balloon nozzle
$w.c create poly $xy -outline {} -fill $color -tag I23b
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I23b
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23b
set xy {285 611 250 603} ;# Dart body
- $w.c create oval $xy -fill $color2 -outline $::C(fg) -width 3 -tag I23d
+ $w.c create oval $xy -fill $color2 -outline $::C(fg) -width 2.25p -tag I23d
set xy {249 596 249 618 264 607 249 596} ;# Dart tail
- $w.c create poly $xy -fill $color3 -outline $::C(fg) -width 3 -tag I23d
+ $w.c create poly $xy -fill $color3 -outline $::C(fg) -width 2.25p -tag I23d
set xy {249 607 268 607} ;# Dart detail
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23d
set xy {285 607 305 607} ;# Dart needle
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I23d
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I23d
}
proc Move23 {w {step {}}} {
set step [GetStep 23 $step]
- set pos {
+ set pos [scl {
{277 607} {287 607} {307 607 x} {347 607} {407 607} {487 607}
{587 607} {687 607} {787 607} {-100 -100}
- }
+ }]
if {$step >= [llength $pos]} {
return 0
@@ -1548,23 +1619,23 @@ proc Move23 {w {step {}}} {
proc Draw24 {w} {
set color $::C(24a)
set xy {366 518 462 665} ;# Balloon
- $w.c create oval $xy -fill $color -outline $::C(fg) -width 3 -tag I24
+ $w.c create oval $xy -fill $color -outline $::C(fg) -width 2.25p -tag I24
set xy {414 666 414 729} ;# String
- $w.c create line $xy -fill $::C(fg) -width 3 -tag I24
+ $w.c create line $xy -fill $::C(fg) -width 2.25p -tag I24
set xy {410 666 404 673 422 673 418 666} ;# Nozzle
- $w.c create poly $xy -fill $color -outline $::C(fg) -width 3 -tag I24
+ $w.c create poly $xy -fill $color -outline $::C(fg) -width 2.25p -tag I24
set xy {387 567 390 549 404 542} ;# Reflections
- $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24
set xy {395 568 399 554 413 547}
- $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24
set xy {403 570 396 555 381 553}
- $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24
set xy {408 564 402 547 386 545}
- $w.c create line $xy -fill $::C(fg) -smooth 1 -width 2 -tag I24
+ $w.c create line $xy -fill $::C(fg) -smooth 1 -width 1.5p -tag I24
}
proc Move24 {w {step {}}} {
- global S
+ global S Dims
set step [GetStep 24 $step]
if {$step > 4} {
@@ -1575,23 +1646,22 @@ proc Move24 {w {step {}}} {
if {$step == 0} {
$w.c delete I24 ;# Exploding balloon
- set xy {
+ set xy [scl {
347 465 361 557 271 503 272 503 342 574 259 594 259 593 362 626
320 737 320 740 398 691 436 738 436 739 476 679 528 701 527 702
494 627 548 613 548 613 480 574 577 473 577 473 474 538 445 508
431 441 431 440 400 502 347 465 347 465
- }
+ }]
$w.c create poly $xy -tag I24 -fill $::C(24b) -outline $::C(24a) \
- -width 10 -smooth 1
+ -width 7.5p -smooth 1
set msg [subst $S(message)]
$w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \
- -fill $::C(24c) \
- -justify center -font {{Times Roman} 18 bold}
+ -fill $::C(24c) -justify center -font {Times 18 bold}
return 1
}
- $w.c itemconfig I24t -font [list {Times Roman} [expr {18 + 6*$step}] bold]
- $w.c move I24 0 -60
+ $w.c itemconfig I24t -font [list Times [expr {18 + 6*$step}] bold]
+ $w.c move I24 $Dims(MovX) $Dims(MovY)
$w.c scale I24 {*}[Centroid $w I24] 1.25 1.25
return 1
}
@@ -1613,21 +1683,20 @@ proc Move25 {w {step {}}} {
# Collapsing balloon
proc Move26 {w {step {}}} {
- global S
+ global S Dims
set step [GetStep 26 $step]
if {$step >= 3} {
$w.c delete I24 I26
- $w.c create text 430 755 -anchor s -tag I26 \
- -fill $::C(26) \
- -text "click to continue" -font {{Times Roman} 24 bold}
+ $w.c create text $Dims(MsgX) $Dims(MsgY) -anchor s -tag I26 \
+ -fill $::C(26) -text "click to continue" -font {Times 24 bold}
bind $w.c <Button-1> [list Reset $w]
return 4
}
$w.c scale I24 {*}[Centroid $w I24] .8 .8
- $w.c move I24 0 60
- $w.c itemconfig I24t -font [list {Times Roman} [expr {30 - 6*$step}] bold]
+ $w.c move I24 0 45p
+ $w.c itemconfig I24t -font [list Times [expr {30 - 6*$step}] bold]
return 1
}
@@ -1829,6 +1898,73 @@ proc Anchor {w item where} {
return [list $x $y]
}
+proc scl {lst} {
+ global scaleFactor
+ set lst2 {}
+ foreach elem $lst {
+ set elem2 {}
+ set idx 0
+ foreach val $elem {
+ if {$idx < 2} {
+ set val [expr {round($val * $scaleFactor)}]
+ }
+ lappend elem2 $val
+ incr idx
+ }
+
+ lappend lst2 $elem2
+ }
+
+ return $lst2
+}
+
+# Simple placed dialog - stacked dialogs are not allowed,
+# the command does nothing if another grab already exists.
+
+proc PlacedDialog {w msg {labelFnt {Helvetica 10}}} {
+ if {[grab current] ne {}} {
+ return
+ }
+ destroy $w
+
+ frame $w -relief raised -bd 3p
+ label $w.lab -font $labelFnt -wraplength 3i -justify left -text $msg
+ ttk::button $w.but -text "OK" -underline 0 \
+ -command [list ClosePlacedDialog $w]
+
+ foreach key {Escape Return o O} {
+ bind $w.but "<KeyPress-${key}>" { ClosePlacedDialog [winfo parent %W] }
+ }
+ foreach child {{} .but .lab} {
+ bind $w$child <<NextWindow>> break
+ bind $w$child <<PrevWindow>> break
+ }
+
+ pack $w.lab -padx 10p -pady {10p 5p}
+ pack $w.but -padx 10p -pady {0p 10p}
+ place $w -anchor center -relx 0.5 -rely 0.5
+
+ set tl [winfo toplevel $w]
+ set ::PlacedDialogOldFocus [focus -lastfor $tl]
+ focus $w.but
+ grab set $w
+ return
+}
+
+proc ClosePlacedDialog {w} {
+ set tl [winfo toplevel $w]
+ if {![winfo exists $::PlacedDialogOldFocus]} {
+ set ::PlacedDialogOldFocus $tl
+ }
+ focus $::PlacedDialogOldFocus
+ set ::PlacedDialogOldFocus {}
+ grab release $w
+ destroy $w
+ return
+}
+
+
DoDisplay $w
Reset $w
Go $w ;# Start everything going
+StartMessage $w ;# Message box at startup