source: trunk/lstview @ 560

Last change on this file since 560 was 560, checked in by toby, 11 years ago

# on 2002/02/11 17:32:15, toby did:
Bug fix -- repeat is was not set (error if .LST file is large)

  • Property rcs:author set to toby
  • Property rcs:date set to 2002/02/11 17:32:15
  • Property rcs:lines set to +4 -2
  • Property rcs:rev set to 1.10
  • Property rcs:state set to Exp
  • Property svn:keywords set to Author Date Revision Id
File size: 20.8 KB
Line 
1#!/usr/local/bin/wish
2# $Id: lstview 560 2009-12-04 23:08:13Z toby $
3set Revision {$Revision: 560 $ $Date: 2009-12-04 23:08:13 +0000 (Fri, 04 Dec 2009) $}
4# display a .LST file in a text box
5# updates 8/26 add bindings for page-up, -down, uparrow, downarrow
6# read from gzip .LST.gz files using gunzip and then append the .LST file
7# start work on plotting variables change next line to use
8set txtvw(plotvars) 1
9set txtvw(font) "Courier"
10set txtvw(menulength) 25
11set txtvw(stringcount) 0
12set txtvw(string) {}
13set txtvw(sum) 0
14set txtvw(hideplot) 0
15# maximum characters to read initially from a .LST file
16set txtvw(maxchars) 1000000
17if {$tcl_platform(platform) == "windows"} {
18   # windows is slow!
19   set txtvw(maxchars) 200000
20}
21if {[set expnam [lindex $argv 0]] == ""} {
22    tk_dialog .warn Notify "No filename specified" error 0 OK
23    destroy .
24}
25set filename $expnam.LST
26set zfil {}
27set lstfp {}
28# is there a compressed version of the file?
29if {[file exists $filename.gz] && $tcl_platform(platform) != "windows"} {
30    set zfil [open "|gunzip < $filename.gz" r]
31}
32set box {}
33set txtvw(followcycle) 1
34
35proc waitmsg {message} {
36    set w .wait
37    # kill any window/frame with this name
38    catch {destroy $w}
39    pack [frame $w]
40    frame $w.bot -relief raised -bd 1
41    pack $w.bot -side bottom -fill both
42    frame $w.top -relief raised -bd 1
43    pack $w.top -side top -fill both -expand 1
44    label $w.msg -justify left -text $message -wrap 3i
45    catch {$w.msg configure -font \
46                -Adobe-Times-Medium-R-Normal--*-180-*-*-*-*-*-*
47    }
48    pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
49    label $w.bitmap -bitmap info
50    pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
51    update
52}
53
54proc donewaitmsg {} {
55    catch {destroy .wait}
56}
57waitmsg "Reading $expnam.LST, Please wait"
58
59set txtvw(runnumber) 0
60
61proc findcyc {win menu {pos 0.0}} {
62    global txtvw
63    global trackinglist
64    set i 0
65    set lastpos {}
66    # loop over cycles
67    set startpos $pos
68    # get current cycle number
69    set pos [$win search -regexp -count chars \
70            {Cycle *[0-9]+ +There} $pos+1line end]
71    while {$pos != ""} {
72        # add the current cycle number to the menu
73        set line [lindex [split $pos .] 0]
74        $win tag add cycle $line.1 $line.10
75        incr i
76        set cycle {}
77        regexp {Cycle *([0-9]+) +There} [$win get $pos $line.end] x cycle
78        if {$cycle != ""} {
79            set lastpos $pos
80            set txtvw(lastcycle) "Cycle $cycle"
81            .a.goto.menu entryconfigure 1 -state normal
82            $menu insert 1 command \
83                    -font 6x12 \
84                    -label "Cycle $cycle" \
85                    -command "$win see $pos"
86            if {[$menu index end] > $txtvw(menulength)} {$menu delete end}
87        }
88        # get next cycle number
89        set nextpos [$win search -regexp -count chars \
90                {Cycle *[0-9]+ +There} $pos+1line end]
91        if {$nextpos == ""} {
92            set epos end
93        } else {
94            set epos $nextpos
95        }
96
97        # loop to highlight all Rwp & Rp values
98        set npos $startpos
99        set npos [$win search -regexp -count chars \
100                {Hstgm *[0-9]+} $npos+1line $pos]
101        while {$npos != ""} {
102            set line [lindex [split $npos .] 0]
103            set x [$win get $line.0 $line.end]
104            scan $x %s%d%s%d%d%f%f%f a hst c d e f rwp rp
105            foreach d {Rwp Rp} value "$rwp $rp" {
106                set v ${d}_$hst
107                set var tracklist_$v
108                set trackinglist($v) "$d hist $hst"
109                global $var
110                set ${var}($cycle) $value
111            }
112            $win tag add rval $npos $line.end
113            set npos [$win search -regexp -count chars \
114                {Hstgm *[0-9]+} $npos+1line $pos]
115        }
116        # get the CHI**2 value
117        set chipos [$win search {Reduced CHI**2 =} $pos $epos]
118        if {$chipos != ""} {
119            $win tag add chi $chipos+8chars $chipos+23chars
120            set chi [string trim [$win get $chipos+16chars $chipos+23chars]]
121            set txtvw(lastchi) "Chi**2 $chi"
122            set var tracklist_chi2
123            set trackinglist(chi2) "red. Chi squared"
124            global $var
125            set ${var}($cycle) $chi
126        }
127        set sumpos [$win search {Final variable sum} $pos $epos]
128        if {$sumpos != ""} {
129            set line [$win get $sumpos "$sumpos lineend"]
130            regexp {: *([0-9\.]+) } $line a finalshift
131            set txtvw(finalshift) "Shift/SU $finalshift"
132            set var tracklist_fshft2
133            set trackinglist(fshft2) "Sum((shft/su)**2)"
134            global $var
135            set ${var}($cycle) $finalshift
136        }
137        # loop to highlight all R(F**2) values
138        set npos $pos
139        set npos [$win search -regexp -count chars \
140                {Histogram *[0-9]+} $npos+1line $epos]
141        while {$npos != ""} {
142            set line [lindex [split $npos .] 0]
143            set x [$win get $line.0 $line.end]
144            catch {
145                regexp {gram *([0-9]+).*\) =(.*)} $x a hst rf2
146                set var tracklist_Rbragg_$hst
147                set trackinglist(Rbragg_$hst) "R(Bragg) hist $hst"
148                global $var
149                set ${var}($cycle) $rf2
150            }
151            $win tag add rval $npos $line.end
152            set npos [$win search -regexp -count chars \
153                    {Histogram *[0-9]+} $npos+1line $epos]
154        }
155        # get ready to loop again
156        set startpos $pos
157        set pos $nextpos
158    }
159    if {$txtvw(followcycle) && $lastpos != ""} {$win see $lastpos}
160}
161
162proc findrun {win {menu ""} {pos 0.0}} {
163    global txtvw
164    while {$pos != ""} {
165        set pos [$win search "Program GENLES" $pos+1line end]
166        if {$menu != "" && $pos != ""} {
167            incr txtvw(runnumber)
168            .a.goto.menu entryconfigure 2 -state normal
169            $menu insert 1 command \
170                    -font 6x12 \
171                    -label "Run $txtvw(runnumber)" \
172                    -command "$win see $pos"
173            if {[$menu index end] > $txtvw(menulength)} {$menu delete end}
174        }
175    }
176}
177
178
179proc findsum {win menu {pos 0.0}} {
180    global txtvw
181    global trackinglist
182    set pos [$win search {Summary table} $pos+1line end]
183    # found a summary, now search back for the cycle number
184    while {$pos != ""} {
185        # add it to the menu
186        incr txtvw(sum)
187        .a.goto.menu entryconfigure 3 -state normal
188        $menu insert 1 command \
189                -font 6x12 \
190                -label "Summary $txtvw(sum)" \
191                -command "$win see $pos"
192        if {[$menu index end] > $txtvw(menulength)} {$menu delete end}
193       
194        set npos [$win index "$pos+1line linestart"]
195        set fpos [$win index $pos-1line]
196        set pos [$win search {Summary table} $npos+1line end]
197       
198        if {!$txtvw(plotvars)} continue
199
200        # parse outs the last listed cycle number
201        set lstcyc {}
202        while {$fpos != "0.0" && $lstcyc == ""} {
203            set line [$win get $fpos "$fpos lineend"]
204            regexp {cycle *([0-9]+):} $line a lstcyc
205            set fpos [$win index $fpos-1line]
206        }
207        # get the cycle offset
208        set ncyc [lindex [$win get $npos "$npos lineend"] end]
209        set npos [$win index "$npos+1line linestart"]
210       
211        set end [$win index end]
212        # now read through the summary table
213        while {![string match *Fraction* \
214                [set line [$win get $npos "$npos lineend"]] \
215                ]} {
216            set v1 [string range $line 1 9]
217            # make a name without spaces
218            set v "zz$v1"
219            regsub -all " " $v "_" v
220            set var tracklist_$v
221            catch {
222                # are there any invalid numbers in the list?
223                foreach value [string range $line 10 end] {
224                    expr [string trim $value]
225                }
226
227                # passed syntax check, add to list
228                set trackinglist($v) "shift/SU $v1"
229                global $var
230               
231                set i 0
232                foreach value [string range $line 10 end] {
233                    incr i
234                    set cycle [expr {$lstcyc - $ncyc + $i}]
235                    set ${var}($cycle) $value
236                }
237            }
238            set npos [$win index "$npos+1line linestart"]
239            if {$npos == $end} break
240        }
241    }
242}
243
244proc findsetstring {win string {menu ""} {pos 0.0}} {
245    global txtvw
246    while {$pos != ""} {
247        set pos [$win search -regexp -count chars \
248                $string $pos+1line end]
249        if {$menu != "" && $pos != ""} {
250            $win tag add found $pos "$pos + $chars chars"
251            incr txtvw(stringcount)
252            $menu insert 1 command \
253                    -font 6x12 \
254                    -label "loc #$txtvw(stringcount)" \
255                    -command "$win see $pos"
256            if {[$menu index end] > $txtvw(menulength)} {$menu delete end}
257        }
258    }
259}
260
261proc setsearchstring { } {
262    global txtvw
263    set txtvw(stringcount) 0
264    .a.goto.menu entryconfigure 5 -state disabled -label ""
265    .a.goto.menu.str delete 1 end
266    catch {.txt tag delete found}
267    .txt tag config found -foreground red
268    if {[string trim $txtvw(entry)] == ""} {
269        set txtvw(string) {}
270        return
271    } else {
272        set txtvw(string) [string trim $txtvw(entry)]
273    }
274    findsetstring .txt $txtvw(string) .a.goto.menu.str
275    if {$txtvw(stringcount) > 0} {
276        .a.goto.menu entryconfigure 5 -state normal -label "$txtvw(string)..."
277    }
278}
279
280proc updatetext {"fil {}"} {
281    global txtvw filename tcl_platform lstfp
282    set repeat 0
283    if {$fil == ""} {
284        set repeat 1
285        after 5000 updatetext
286        set fil $lstfp
287    }
288    set txt {}
289    catch {set txt [read $fil]}
290    if {$txt == ""} return
291    .txt config -state normal
292    set oldend [.txt index end]
293    # truncate the text if too long
294    if {[string length $txt] > $txtvw(maxchars) && $repeat == 0} {
295        set beg [expr [string length $txt] - $txtvw(maxchars)]
296        .txt insert end "(first $beg characters in file skipped)\n"
297        .txt insert end [string range $txt $beg end]
298    } else {
299        .txt insert end $txt
300    }
301    # don't disable in Win as this prevents the highlighting of selected text
302    if {$tcl_platform(platform) != "windows"} {
303        .txt config -state disabled
304    }
305    update idletasks
306    findrun .txt .a.goto.menu.run $oldend
307    update
308    findcyc .txt .a.goto.menu.cyc $oldend
309    update
310    findsum .txt .a.goto.menu.sum $oldend
311    update
312   
313    if {$txtvw(string) != ""} {
314        findsetstring .txt $txtvw(string) .a.goto.menu.str $oldend
315        if {$txtvw(stringcount) > 0} {
316            .a.goto.menu entryconfigure 5 -state normal -label "$txtvw(string)..."
317        }
318    }
319}
320
321proc GetSearchString {} {
322    catch {destroy .str}
323    toplevel .str
324    grab .str
325    pack [frame .str.1] -side top
326    pack [frame .str.2] -side top
327    pack [label .str.1.l -text "Search String"] -side left
328    pack [entry .str.1.e -textvariable txtvw(entry) -width 12] -side left
329    pack [label .str.1.2 -text "(regexp)"] -side left
330    pack [button .str.2.ok -text "Search" -command \
331            "setsearchstring; destroy .str" ] -side left
332    pack [button .str.2.q -text "Quit" -command \
333            "destroy .str" ] -side left
334# bind to RETURN here   
335#    bind .str
336}
337
338proc findstring {win str1 {str2 ""}} {
339    set pos [$win search -backwards $str1 end]
340    if {$pos == "" && $str2 != ""} {
341        set pos [$win search -backwards $str2 end]
342    }
343    if {$pos == ""} return
344    $win see $pos
345}
346
347proc SaveOptions {} {
348    global txtvw
349    set fp [open [file join ~ .gsas_config] a]
350    puts $fp "set txtvw(followcycle) $txtvw(followcycle)"
351    puts $fp "set txtvw(font) [list $txtvw(font)]"
352    close $fp
353}
354
355proc aboutgsas {} {
356    global Revision
357    tk_dialog .warn About "
358GSAS\n\
359A. C. Larson and\n R. B. Von Dreele,\n LANSCE, Los Alamos\n\n\
360LSTVIEW\nB. Toby, NIST\nNot subject to copyright\n\n\
361$Revision\n\
362" {} 0 OK
363}
364
365#----------------------------------------------------------------
366# where are we?
367set expgui(script) [info script]
368# translate links -- go six levels deep
369foreach i {1 2 3 4 5 6} {
370    if {[file type $expgui(script)] == "link"} {
371        set link [file readlink $expgui(script)]
372        if { [file  pathtype  $link] == "absolute" } {
373h           set expgui(script) $link
374        } {
375            set expgui(script) [file dirname $expgui(script)]/$link
376        }
377    } else {
378        break
379    }
380}
381
382# fixup relative paths
383if {[file pathtype $expgui(script)] == "relative"} {
384    set expgui(script) [file join [pwd] $expgui(script)]
385}
386set expgui(scriptdir) [file dirname $expgui(script) ]
387
388source [file join $expgui(scriptdir) gsascmds.tcl]
389source [file join $expgui(scriptdir) opts.tcl]
390
391# override options with locally defined values
392if [file exists [file join $expgui(scriptdir) localconfig]] {
393    source [file join $expgui(scriptdir) localconfig]
394}
395if [file exists [file join ~ .gsas_config]] {
396    source [file join ~ .gsas_config]
397}
398
399
400set txtvw(lastchi) {}
401set txtvw(lastcycle) {}
402set txtvw(finalshift) {}
403text .txt -width 100 -wrap none \
404        -yscrollcommand ".yscroll set" \
405        -xscrollcommand ".xscroll set"
406if {$tcl_version >= 8.0} {.txt config -font $txtvw(font)}
407scrollbar .yscroll -command ".txt yview"
408scrollbar .xscroll -command ".txt xview" -orient horizontal
409grid .xscroll -column 0 -row 2 -sticky ew
410grid .txt -column 0 -row 1 -sticky nsew
411grid .yscroll -column 1 -row 1 -sticky ns
412grid columnconfigure . 0 -weight 1
413grid rowconfigure . 1 -weight 1
414wm title . "View $filename"
415wm iconname . $filename
416grid [frame .a -bd 2 -relief raised] -column 0 -row 0 -columnspan 2 -sticky ew
417pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] \
418            -side left
419menu .a.file.menu
420.a.file.menu add command -label "Delete $filename" -command KillLSTfile
421.a.file.menu add command -label "Trim $filename" -command TrimLSTfile
422.a.file.menu add command -label Exit -command "destroy ."
423
424# windows copy command. Should not be needed in X windows
425if {$tcl_platform(platform) == "windows"} {
426    pack [menubutton .a.edit -text Edit -underline 0 -menu .a.edit.menu] \
427            -side left
428    menu .a.edit.menu
429    .a.edit.menu add command -label copy \
430            -command {catch {clipboard append [selection get]}}
431}
432
433pack [menubutton .a.goto -text "Go To" -underline 0 -menu .a.goto.menu] \
434        -side left
435menu .a.goto.menu
436.a.goto.menu add cascade -label "Cycle #"  -menu .a.goto.menu.cyc \
437        -state disabled
438menu .a.goto.menu.cyc
439.a.goto.menu add cascade -label "Refinement Run #"  -menu .a.goto.menu.run \
440        -state disabled
441menu .a.goto.menu.run
442.a.goto.menu add cascade -label "Summary #"  -menu .a.goto.menu.sum \
443        -state disabled
444menu .a.goto.menu.sum
445.a.goto.menu add command -label "Set Search String" -command GetSearchString
446.a.goto.menu add cascade -label ""  -menu .a.goto.menu.str -state disabled
447menu .a.goto.menu.str
448
449pack [menubutton .a.options -text "Options" -underline 0 \
450        -menu .a.options.menu] \
451            -side left
452menu .a.options.menu
453.a.options.menu  add checkbutton -label "Auto Advance" -variable txtvw(followcycle)
454
455if {$tcl_version >= 8.0} {
456    pack [label .a.fontl -text "  Font:"] -side left
457    set fontbut [tk_optionMenu .a.fontb txtvw(font) ""]
458    pack .a.fontb -side left
459    $fontbut delete 0 end
460    foreach f {5 6 7 8 9 10 11 12 13 14 15 16} {
461        $fontbut add command -label "Courier $f" -font "Courier $f"\
462                -command "set txtvw(font) \"Courier $f\"; \
463                .txt config -font \$txtvw(font)"
464    }
465}
466
467.a.options.menu add command -label "Save Options" -underline 1 \
468        -command "SaveOptions"
469
470proc postingvars {} {
471    global trackinglist
472    eval destroy [winfo children .plot.c.f]
473    set i 0
474    foreach var [lsort [array names trackinglist]] {
475        grid [checkbutton .plot.c.f.$i -text $trackinglist($var) \
476                -pady 0 -command plotvars -variable plotlist($var)] \
477                -column 0 -row [incr i] -sticky w
478    }
479}
480
481proc makeplot {} {
482    # handle Tcl/Tk v8+ where BLT is in a namespace
483    #  use the command so that it is loaded
484    catch {blt::graph}
485    catch {
486        namespace import blt::graph
487    }
488    toplevel .plot
489    grid [graph .plot.g] -col 0 -row 0 -sticky news
490    canvas .plot.c \
491            -scrollregion {0 0 5000 1000} -width 40 -height 250 \
492            -yscrollcommand ".plot.s set"
493    scrollbar .plot.s -command ".plot.c yview"
494    grid .plot.c -col 1 -row 0 -sticky news
495        frame .plot.c.f -class SmallFont
496    .plot.c create window 0 0 -anchor nw -window .plot.c.f
497    grid columnconfigure .plot 0 -weight 1
498    grid rowconfigure .plot 0 -weight 1
499    Blt_ZoomStack .plot.g
500    Blt_ActiveLegend .plot.g
501    .plot.g config -title ""
502    .plot.g xaxis config -title "cycle"
503    .plot.g yaxis config -title ""
504    wm iconify .plot
505}
506
507proc plotvars {} {
508    raise .plot
509    eval .plot.g element delete [.plot.g element names]
510    global trackinglist
511    global plotlist
512    set num 0
513    foreach v [lsort [array names trackinglist]] {
514        set datalist {}
515        if $plotlist($v) {
516            incr num
517            set var tracklist_$v
518            global $var
519            set color [lindex {red green blue magenta cyan yellow} \
520                    [expr $num % 6]]
521            foreach n [lsort -integer [array names $var]] {
522                lappend datalist $n [set ${var}($n)]
523            }
524            .plot.g element create "$var" -data $datalist -color $color \
525                    -label $trackinglist($v)
526        }
527    }
528}
529
530proc hideplot {} {
531    global txtvw
532    if {![winfo exists .plot]} {
533        makeplot
534        postingvars
535    }
536    # hide or show the plot
537    if {$txtvw(hideplot) != 1} {
538        wm iconify .plot
539    } else {
540        wm deiconify .plot
541        update idletasks
542        # size the box width & scrollregion height
543        set sizes [grid bbox .plot.c.f]
544        .plot.c config -scrollregion $sizes -width [lindex $sizes 2]
545        # is the scroll bar needed?
546        if {[winfo height .plot.c] >= [lindex $sizes 3]} {
547            grid forget .plot.s
548        } else {
549            grid .plot.s -col 2 -row 0 -sticky news
550        }
551    }
552}
553
554
555proc KillLSTfile {} {
556    global filename lstfp tcl_platform
557    # confirm the delete
558    set ans [tk_dialog .warn Notify \
559            "OK to delete the contents of $filename?" "" 0 Yes No]
560    if {$ans != 0} return
561    # stop the updates
562    after cancel updatetext
563    # zero out the file
564    close $lstfp
565    set lstfp [open $filename w+]
566    .txt config -state normal
567    .txt delete 0.0 end
568    ClearMenus
569    updatetext
570}
571
572proc TrimLSTfile {} {
573    global filename lstfp tcl_platform txtvw
574   
575    # get the last refinement run position
576    set loc {}
577    # get the starting location
578    catch {
579        set loc [lindex [.a.goto.menu.run entrycget 1 -command] end]
580        set loc [.txt index "$loc - 2lines"]
581        set txtvw(delete) [expr {100.*$loc/[.txt index end]}]
582        .txt see $loc
583
584    }
585    if {$loc == ""} {
586        set txtvw(delete) [expr {50.* \
587                ([lindex [.txt yview] 0] + [lindex [.txt yview] 1])}]
588        set loc [expr {int(0.5+ $txtvw(delete) * [.txt index end]/100.)}].0
589    }
590
591    catch {toplevel .trim}
592    eval destroy [winfo children .trim]
593    wm title .trim "Trim $filename"
594    pack [label .trim.0 -text "File $filename has [expr {int([.txt index end])}] lines total."] -side top
595    pack [label .trim.1 -text "Select percentage of file to delete."] \
596            -anchor w -side top
597   
598    # set the slider resolution so that 1 division is on the
599    # order of 1-2 lines
600    set res .5
601    while {$res > 200./[.txt index end] && $res > 0.01} {
602        if {[string match *5* $res]} {
603            set res [expr $res/2.5]
604        } else {
605            set res [expr $res/2.]
606        }
607    }
608    pack [scale .trim.2 -command HighlightText -orient horizontal \
609            -variable txtvw(delete) \
610            -resolution $res] -expand yes -fill x
611    pack [frame .trim.3]
612    pack [button .trim.3.a -text Trim \
613            -command {DeleteSelectedText; destroy .trim} \
614            ] -side left
615    pack [button .trim.3.b -text Cancel -command {destroy .trim} ] -side left
616    # create a binding so that we can click on the text box
617    .txt tag delete b
618    .txt tag add b 0.0 end
619    .txt tag bind b <1> "ClickHighlightText %x %y"
620    # show the region pending delete
621    .txt tag delete pend
622    .txt tag add pend 0.0 $loc
623    .txt tag config pend -foreground grey
624}
625
626proc ClickHighlightText {x y} {
627    global txtvw
628    if {![winfo exists .trim]} return
629    set loc [.txt index "@$x,$y linestart"]
630    set txtvw(delete) [expr {100.*$loc/[.txt index end]}]
631    .txt tag delete pend
632    .txt tag add pend 0.0 $loc
633    .txt tag config pend -foreground grey
634}
635
636proc DeleteSelectedText {} {
637    global filename lstfp
638    .txt config -state normal
639    eval .txt delete [.txt tag nextrange pend 0.0]
640    # stop the updates
641    after cancel updatetext
642    # zero out the file
643    close $lstfp
644    set lstfp [open $filename w+]
645    puts $lstfp [.txt get 0.0 end]
646    .txt delete 0.0 end
647    ClearMenus
648    seek $lstfp 0
649    updatetext
650}
651
652proc ClearMenus {} {
653    foreach m {str run cyc sum} {
654        .a.goto.menu.$m delete 1 end
655    }
656    foreach num {1 2 3 5} {
657        .a.goto.menu entryconfigure $num -state disabled
658    }
659    global txtvw
660    set txtvw(runnumber) 0
661    set txtvw(sum) 0
662}
663
664proc HighlightText {args} {
665    global txtvw
666    set loc [expr {int(0.5+ $txtvw(delete) * [.txt index end]/100.)}].0
667    .txt tag delete pend
668    .txt tag add pend 0.0 $loc
669    .txt tag config pend -foreground grey
670    .txt see $loc
671}
672
673pack [menubutton .a.help -text Help -underline 0 -menu .a.help.menu] -side right
674menu .a.help.menu
675.a.help.menu add command -command aboutgsas -label "About"
676
677grid [frame .but ] -column 0 -row 3 -columnspan 2 -sticky ew
678pack [label .but.lbl2 -textvariable txtvw(lastcycle) \
679        -relief sunken -bd 2] -side left
680pack [label .but.lbl3 -textvariable txtvw(lastchi) \
681        -relief sunken -bd 2] -side left
682pack [label .but.lbl4 -textvariable txtvw(finalshift) \
683        -relief sunken -bd 2] -side left
684bind all <Control-KeyPress-c> {destroy .}
685bind . <KeyPress-Prior> ".txt yview scroll -1 page"
686bind . <KeyPress-Next> ".txt yview scroll 1 page"
687bind . <KeyPress-Up> ".txt yview scroll -1 unit"
688bind . <KeyPress-Down> ".txt yview scroll 1 unit"
689bind . <KeyPress-Home> ".txt yview 0"
690bind . <KeyPress-End> ".txt yview end"
691#pack [button .but.q -text close -command "destroy ." ] -side right
692.txt tag config cycle -background yellow
693.txt tag config rval -background  green
694.txt tag config chi -background  green
695if [file exists $filename] {
696    set lstfp [open $filename r]
697} else {
698    # create a file if it does not exist
699    set lstfp [open $filename w+]
700}
701donewaitmsg
702# read a file compressed file
703if {$zfil != ""} {updatetext $zfil 0; close $zfil}
704# read the initial file
705updatetext $lstfp
706# now start reading with updates
707updatetext
708
709if {$txtvw(plotvars) && ![catch {package require BLT}]} {
710    .a.options.menu add checkbutton -label "Show Plot" -command hideplot \
711            -variable txtvw(hideplot)
712}
Note: See TracBrowser for help on using the repository browser.