3 proc manyset {list args} {
4 foreach val $list var $args {
10 set progname ypp-chatlog-alerter
13 proc menuent {w l a x} {
14 set c [list .mbar.$w add command -label $l -command $x]
15 if {[string length $a]} { lappend c -accel Command-$a }
22 foreach w {file edit} l {File Edit} {
23 menu .mbar.$w -tearoff 0
24 .mbar add cascade -menu .mbar.$w -label $l
26 foreach l {Open Quit} a {O Q} x {newfile exit} {
29 foreach l {Cut Copy Paste Clear} a {X C V {}} {
30 menuent edit $l $a [list event generate {[focus]} <<$l>>]]
32 . configure -menu .mbar
35 proc nonportability {} {
36 global progname defaultfile
38 switch -exact [tk windowingsystem] {
40 set defaultfile ~/Library/Preferences/$progname.prefs
43 set defaultfile ~/.$progname.rc
53 listbox .t -width 5 -height $height -borderwidth 0
54 listbox .p -width 14 -height $height -borderwidth 0
55 listbox .m -width 80 -height $height -borderwidth 0
56 pack .t .p .m -side left
60 global currentfile defaultfile
62 set newfile [tk_getOpenFile -multiple 0 -initialfile $currentfile \
63 -title "Select YPP log to track"]
64 if {![string length $newfile]} return
66 set currentfile $newfile
67 set newdefaults [open $defaultfile.new w]
68 puts $newdefaults "[list set currentfile $currentfile]"
70 file rename -force $defaultfile.new $defaultfile
75 set lw_ls {times pirates messages}
88 set tint_switched [expr { exp( -($tint_switch+0.0) / $e_life ) }]
93 set now [clock seconds]
96 exp( -($now >= $time ? $now-$time : 0) / $e_life )
101 proc tintentry {w y tint} {
103 #puts "$tint $tint_switched"
104 set yellow [format "%02x" [expr {round( 255 *
105 ( $tint >= $tint_switched ? $tint : 0 )
107 set black [format "%02x" [expr {round( 255 *
108 ( $tint >= $tint_switched ? 0 : ($tint / $tint_switched)*0.75 + 0.25 )
110 $w itemconfigure $y \
111 -foreground [format "#${black}${black}${black}"] \
112 -background [format "#${yellow}${yellow}00"]
117 global times pirates messages
120 for_lw { .$w delete 0 end; set $l {} }
121 for {set i 0} {$i<$height} {incr i} {
122 for_lw { lappend $l {}; .$w insert end {} }
129 listbox .tints -width 60 -height [expr {$divs+1}]
130 for {set y 0} {$y <= $divs} {incr y} {
131 set tint [expr {($y+0.0)/$divs}]
134 "[format "#%2d %6f %4ds" $y $tint [expr {round(
135 $tint > 0 ? -log($tint) * $e_life : "9999"
136 )}]] The quick brown fox jumped over the lazy dog"
137 tintentry .tints $y $tint
139 pack .tints -side bottom
145 if {![string compare $arg --test-tints]} {
148 error "unknown option $arg"
159 if {[file exists $defaultfile]} {