3 proc manyset {list args} {
4 foreach val $list var $args {
10 set progname ypp-chatlog-alerter
13 foreach w {file edit} l {File Edit} {
14 menu .mbar.$w -tearoff 0
15 .mbar add cascade -menu .mbar.$w -label $l
17 proc menuent {w l a x} {
18 set c [list .mbar.$w add command -label $l -command $x]
19 if {[string length $a]} { lappend c -accel Command-$a }
22 foreach l {Open Quit} a {O Q} x {newfile exit} {
25 foreach l {Cut Copy Paste Clear} a {X C V {}} {
26 menuent edit $l $a [list event generate {[focus]} <<$l>>]]
28 . configure -menu .mbar
30 switch -exact [tk windowingsystem] {
32 set defaultfile ~/Library/Preferences/$progname.prefs
35 set defaultfile ~/.$progname.rc
44 listbox .t -width 5 -height $height -borderwidth 0
45 listbox .p -width 14 -height $height -borderwidth 0
46 listbox .m -width 80 -height $height -borderwidth 0
47 pack .t .p .m -side left
50 global currentfile defaultfile
52 set newfile [tk_getOpenFile -multiple 0 -initialfile $currentfile \
53 -title "Select YPP log to track"]
54 if {![string length $newfile]} return
56 set currentfile $newfile
57 set newdefaults [open $defaultfile.new w]
58 puts $newdefaults "[list set currentfile $currentfile]"
60 file rename -force $defaultfile.new $defaultfile
64 proc for_ll {varname body} {
66 foreach l {times pirates messages} {
67 set rc [catch { uplevel 1 $body } emsg]
81 return -code $rc -errorinfo $errorInfo \
82 -errorcode $errorCode $emsg
91 set now [clock seconds]
92 foreach minfo $messages {
93 manyset $minfo then pirate msg
98 global currentfile height
99 global times pirates messages
102 foreach w {t p m} { .$w delete 0 end }
103 foreach l {times pirates messages}
104 for {set i 0} {$i<$height} {incr i} {
108 foreach w {t p m} { .$w insert end {} }
117 if {[file exists $defaultfile]} {