This commit is contained in:
ton
2024-10-07 10:13:40 +07:00
parent aa1631742f
commit 3a7d696db6
9729 changed files with 1832837 additions and 161742 deletions

View File

@@ -65,7 +65,7 @@ proc tristate_check {n1 n2 op} {
set in_check 0
}
trace variable wipers w tristate_check
trace variable brakes w tristate_check
trace variable sober w tristate_check
trace variable safety w tristate_check
trace add variable wipers write tristate_check
trace add variable brakes write tristate_check
trace add variable sober write tristate_check
trace add variable safety write tristate_check

View File

@@ -62,6 +62,7 @@ proc floorDisplay {w active} {
$w create window 600 100 -anchor w -window $w.entry
$w create text 600 100 -anchor e -text "Room: "
$w config -scrollregion [$w bbox all]
}
@@ -1368,4 +1369,4 @@ if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk]
}
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"
trace add variable currentRoom write "roomChanged $c"

View File

@@ -113,9 +113,9 @@ proc DoDisplay {w} {
DoCtrlFrame $w
DoDetailFrame $w
if {[tk windowingsystem] ne "aqua"} {
ttk::button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2
ttk::button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2
} else {
button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
button $w.show -text "\xbb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
}
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
update
@@ -153,9 +153,9 @@ proc DoCtrlFrame {w} {
raise $w.details
raise $w.details.cb
grid rowconfigure $w.ctrl 50 -weight 1
trace variable ::S(mode) w [list ActiveGUI $w]
trace variable ::S(details) w [list ActiveGUI $w]
trace variable ::S(speed) w [list ActiveGUI $w]
trace add variable ::S(mode) write [list ActiveGUI $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.e -sticky nsew
@@ -185,7 +185,6 @@ proc DoDetailFrame {w} {
set w2 $w.details.f
ttk::frame $w2
set bd 2
ttk::label $w2.l -textvariable S(cnt) -background white
grid $w2.l - - - -sticky ew -row 0
for {set i 1} {1} {incr i} {
@@ -204,10 +203,10 @@ proc DoDetailFrame {w} {
proc ShowCtrl {w} {
if {[winfo ismapped $w.ctrl]} {
pack forget $w.ctrl
$w.show config -text "\u00bb"
$w.show config -text "\xbb"
} else {
pack $w.ctrl -side right -fill both -ipady 5
$w.show config -text "\u00ab"
$w.show config -text "\xab"
}
}
@@ -272,7 +271,7 @@ proc Go {w {who {}}} {
set now [clock clicks -milliseconds]
catch {after cancel $animationCallbacks(goldberg)}
if {$who ne ""} { ;# Start here for debugging
set S(active) $who;
set S(active) $who
set S(mode) $MGO
}
if {$S(mode) == -1} return ;# Debugging

View File

@@ -82,8 +82,8 @@ proc showPendulum {canvas {at {}} {x {}} {y {}}} {
set y [expr {25 + $length*cos($angle)}]
}
$canvas coords rod $home 25 $x $y
$canvas coords bob \
[expr {$x-15}] [expr {$y-15}] [expr {$x+15}] [expr {$y+15}]
$canvas coords bob [expr {$x - 15}] [expr {$y - 15}] \
[expr {$x + 15}] [expr {$y + 15}]
}
showPendulum $w.c
@@ -92,7 +92,7 @@ showPendulum $w.c
# respect to time.)
proc showPhase {canvas} {
global Theta dTheta points psw psh
lappend points [expr {$Theta+$psw}] [expr {-20*$dTheta+$psh}]
lappend points [expr {$Theta + $psw}] [expr {-20*$dTheta + $psh}]
if {[llength $points] > 100} {
set points [lrange $points end-99 end]
}
@@ -127,15 +127,15 @@ bind $w.c <ButtonRelease-1> {
bind $w.c <Configure> {
%W coords plate 0 25 %w 25
set home [expr {%w/2}]
%W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30
%W coords pivot [expr {$home - 5}] 20 [expr {$home + 5}] 30
}
bind $w.k <Configure> {
set psh [expr {%h/2}]
set psw [expr {%w/2}]
%W coords x_axis 2 $psh [expr {%w-2}] $psh
%W coords y_axis $psw [expr {%h-2}] $psw 2
%W coords label_dtheta [expr {$psw-4}] 6
%W coords label_theta [expr {%w-6}] [expr {$psh+4}]
%W coords x_axis 2 $psh [expr {%w - 2}] $psh
%W coords y_axis $psw [expr {%h - 2}] $psw 2
%W coords label_dtheta [expr {$psw - 4}] 6
%W coords label_theta [expr {%w - 6}] [expr {$psh + 4}]
}
# This procedure is the "business" part of the simulation that does

View File

@@ -10,7 +10,7 @@ exec wish "$0" ${1+"$@"}
package require Tk
foreach i [winfo child .] {
foreach i [winfo children .] {
catch {destroy $i}
}

View File

@@ -13,7 +13,7 @@ exec wish "$0" ${1+"$@"}
package require Tk 8.5
package require msgcat
eval destroy [winfo child .]
destroy {*}[winfo children .]
set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
::msgcat::mcload $tk_demoDirectory
namespace import ::msgcat::mc