source: trunk/lstview @ 535

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

# on 2002/01/22 21:52:22, toby did:
Major revisions
add plot of R's & shifts
update parse routines to changes in .LST file
Add capability to delete sections of file

  • Property rcs:author set to toby
  • Property rcs:date set to 2002/01/22 21:52:22
  • Property rcs:lines set to +302 -79
  • Property rcs:rev set to 1.9
  • 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 535 2009-12-04 23:07:48Z toby $
3set Revision {$Revision: 535 $ $Date: 2009-12-04 23:07:48 +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    if {$fil == ""} {
283        after 5000 updatetext
284        set fil $lstfp
285    }
286    set txt {}
287    catch {set txt [read $fil]}
288    if {$txt == ""} return
289    .txt config -state normal
290    set oldend [.txt index end]
291    # truncate the text if too long
292    if {[string length $txt] > $txtvw(maxchars) && $repeat == 0} {
293        set beg [expr [string length $txt] - $txtvw(maxchars)]
294        .txt insert end "(first $beg characters in file skipped)\n"
295        .txt insert end [string range $txt $beg end]
296    } else {
297        .txt insert end $txt
298    }
299    # don't disable in Win as this prevents the highlighting of selected text
300    if {$tcl_platform(platform) != "windows"} {
301        .txt config -state disabled
302    }
303    update idletasks
304    findrun .txt .a.goto.menu.run $oldend
305    update
306    findcyc .txt .a.goto.menu.cyc $oldend
307    update
308    findsum .txt .a.goto.menu.sum $oldend
309    update
310   
311    if {$txtvw(string) != ""} {
312        findsetstring .txt $txtvw(string) .a.goto.menu.str $oldend
313        if {$txtvw(stringcount) > 0} {
314            .a.goto.menu entryconfigure 5 -state normal -label "$txtvw(string)..."
315        }
316    }
317}
318
319proc GetSearchString {} {
320    catch {destroy .str}
321    toplevel .str
322    grab .str
323    pack [frame .str.1] -side top
324    pack [frame .str.2] -side top
325    pack [label .str.1.l -text "Search String"] -side left
326    pack [entry .str.1.e -textvariable txtvw(entry) -width 12] -side left
327    pack [label .str.1.2 -text "(regexp)"] -side left
328    pack [button .str.2.ok -text "Search" -command \
329            "setsearchstring; destroy .str" ] -side left
330    pack [button .str.2.q -text "Quit" -command \
331            "destroy .str" ] -side left
332# bind to RETURN here   
333#    bind .str
334}
335
336proc findstring {win str1 {str2 ""}} {
337    set pos [$win search -backwards $str1 end]
338    if {$pos == "" && $str2 != ""} {
339        set pos [$win search -backwards $str2 end]
340    }
341    if {$pos == ""} return
342    $win see $pos
343}
344
345proc SaveOptions {} {
346    global txtvw
347    set fp [open [file join ~ .gsas_config] a]
348    puts $fp "set txtvw(followcycle) $txtvw(followcycle)"
349    puts $fp "set txtvw(font) [list $txtvw(font)]"
350    close $fp
351}
352
353proc aboutgsas {} {
354    global Revision
355    tk_dialog .warn About "
356GSAS\n\
357A. C. Larson and\n R. B. Von Dreele,\n LANSCE, Los Alamos\n\n\
358LSTVIEW\nB. Toby, NIST\nNot subject to copyright\n\n\
359$Revision\n\
360" {} 0 OK
361}
362
363#----------------------------------------------------------------
364# where are we?
365set expgui(script) [info script]
366# translate links -- go six levels deep
367foreach i {1 2 3 4 5 6} {
368    if {[file type $expgui(script)] == "link"} {
369        set link [file readlink $expgui(script)]
370        if { [file  pathtype  $link] == "absolute" } {
371h           set expgui(script) $link
372        } {
373            set expgui(script) [file dirname $expgui(script)]/$link
374        }
375    } else {
376        break
377    }
378}
379
380# fixup relative paths
381if {[file pathtype $expgui(script)] == "relative"} {
382    set expgui(script) [file join [pwd] $expgui(script)]
383}
384set expgui(scriptdir) [file dirname $expgui(script) ]
385
386source [file join $expgui(scriptdir) gsascmds.tcl]
387source [file join $expgui(scriptdir) opts.tcl]
388
389# override options with locally defined values
390if [file exists [file join $expgui(scriptdir) localconfig]] {
391    source [file join $expgui(scriptdir) localconfig]
392}
393if [file exists [file join ~ .gsas_config]] {
394    source [file join ~ .gsas_config]
395}
396
397
398set txtvw(lastchi) {}
399set txtvw(lastcycle) {}
400set txtvw(finalshift) {}
401text .txt -width 100 -wrap none \
402        -yscrollcommand ".yscroll set" \
403        -xscrollcommand ".xscroll set"
404if {$tcl_version >= 8.0} {.txt config -font $txtvw(font)}
405scrollbar .yscroll -command ".txt yview"
406scrollbar .xscroll -command ".txt xview" -orient horizontal
407grid .xscroll -column 0 -row 2 -sticky ew
408grid .txt -column 0 -row 1 -sticky nsew
409grid .yscroll -column 1 -row 1 -sticky ns
410grid columnconfigure . 0 -weight 1
411grid rowconfigure . 1 -weight 1
412wm title . "View $filename"
413wm iconname . $filename
414grid [frame .a -bd 2 -relief raised] -column 0 -row 0 -columnspan 2 -sticky ew
415pack [menubutton .a.file -text File -underline 0 -menu .a.file.menu] \
416            -side left
417menu .a.file.menu
418.a.file.menu add command -label "Delete $filename" -command KillLSTfile
419.a.file.menu add command -label "Trim $filename" -command TrimLSTfile
420.a.file.menu add command -label Exit -command "destroy ."
421
422# windows copy command. Should not be needed in X windows
423if {$tcl_platform(platform) == "windows"} {
424    pack [menubutton .a.edit -text Edit -underline 0 -menu .a.edit.menu] \
425            -side left
426    menu .a.edit.menu
427    .a.edit.menu add command -label copy \
428            -command {catch {clipboard append [selection get]}}
429}
430
431pack [menubutton .a.goto -text "Go To" -underline 0 -menu .a.goto.menu] \
432        -side left
433menu .a.goto.menu
434.a.goto.menu add cascade -label "Cycle #"  -menu .a.goto.menu.cyc \
435        -state disabled
436menu .a.goto.menu.cyc
437.a.goto.menu add cascade -label "Refinement Run #"  -menu .a.goto.menu.run \
438        -state disabled
439menu .a.goto.menu.run
440.a.goto.menu add cascade -label "Summary #"  -menu .a.goto.menu.sum \
441        -state disabled
442menu .a.goto.menu.sum
443.a.goto.menu add command -label "Set Search String" -command GetSearchString
444.a.goto.menu add cascade -label ""  -menu .a.goto.menu.str -state disabled
445menu .a.goto.menu.str
446
447pack [menubutton .a.options -text "Options" -underline 0 \
448        -menu .a.options.menu] \
449            -side left
450menu .a.options.menu
451.a.options.menu  add checkbutton -label "Auto Advance" -variable txtvw(followcycle)
452
453if {$tcl_version >= 8.0} {
454    pack [label .a.fontl -text "  Font:"] -side left
455    set fontbut [tk_optionMenu .a.fontb txtvw(font) ""]
456    pack .a.fontb -side left
457    $fontbut delete 0 end
458    foreach f {5 6 7 8 9 10 11 12 13 14 15 16} {
459        $fontbut add command -label "Courier $f" -font "Courier $f"\
460                -command "set txtvw(font) \"Courier $f\"; \
461                .txt config -font \$txtvw(font)"
462    }
463}
464
465.a.options.menu add command -label "Save Options" -underline 1 \
466        -command "SaveOptions"
467
468proc postingvars {} {
469    global trackinglist
470    eval destroy [winfo children .plot.c.f]
471    set i 0
472    foreach var [lsort [array names trackinglist]] {
473        grid [checkbutton .plot.c.f.$i -text $trackinglist($var) \
474                -pady 0 -command plotvars -variable plotlist($var)] \
475                -column 0 -row [incr i] -sticky w
476    }
477}
478
479proc makeplot {} {
480    # handle Tcl/Tk v8+ where BLT is in a namespace
481    #  use the command so that it is loaded
482    catch {blt::graph}
483    catch {
484        namespace import blt::graph
485    }
486    toplevel .plot
487    grid [graph .plot.g] -col 0 -row 0 -sticky news
488    canvas .plot.c \
489            -scrollregion {0 0 5000 1000} -width 40 -height 250 \
490            -yscrollcommand ".plot.s set"
491    scrollbar .plot.s -command ".plot.c yview"
492    grid .plot.c -col 1 -row 0 -sticky news
493        frame .plot.c.f -class SmallFont
494    .plot.c create window 0 0 -anchor nw -window .plot.c.f
495    grid columnconfigure .plot 0 -weight 1
496    grid rowconfigure .plot 0 -weight 1
497    Blt_ZoomStack .plot.g
498    Blt_ActiveLegend .plot.g
499    .plot.g config -title ""
500    .plot.g xaxis config -title "cycle"
501    .plot.g yaxis config -title ""
502    wm iconify .plot
503}
504
505proc plotvars {} {
506    raise .plot
507    eval .plot.g element delete [.plot.g element names]
508    global trackinglist
509    global plotlist
510    set num 0
511    foreach v [lsort [array names trackinglist]] {
512        set datalist {}
513        if $plotlist($v) {
514            incr num
515            set var tracklist_$v
516            global $var
517            set color [lindex {red green blue magenta cyan yellow} \
518                    [expr $num % 6]]
519            foreach n [lsort -integer [array names $var]] {
520                lappend datalist $n [set ${var}($n)]
521            }
522            .plot.g element create "$var" -data $datalist -color $color \
523                    -label $trackinglist($v)
524        }
525    }
526}
527
528proc hideplot {} {
529    global txtvw
530    if {![winfo exists .plot]} {
531        makeplot
532        postingvars
533    }
534    # hide or show the plot
535    if {$txtvw(hideplot) != 1} {
536        wm iconify .plot
537    } else {
538        wm deiconify .plot
539        update idletasks
540        # size the box width & scrollregion height
541        set sizes [grid bbox .plot.c.f]
542        .plot.c config -scrollregion $sizes -width [lindex $sizes 2]
543        # is the scroll bar needed?
544        if {[winfo height .plot.c] >= [lindex $sizes 3]} {
545            grid forget .plot.s
546        } else {
547            grid .plot.s -col 2 -row 0 -sticky news
548        }
549    }
550}
551
552
553proc KillLSTfile {} {
554    global filename lstfp tcl_platform
555    # confirm the delete
556    set ans [tk_dialog .warn Notify \
557            "OK to delete the contents of $filename?" "" 0 Yes No]
558    if {$ans != 0} return
559    # stop the updates
560    after cancel updatetext
561    # zero out the file
562    close $lstfp
563    set lstfp [open $filename w+]
564    .txt config -state normal
565    .txt delete 0.0 end
566    ClearMenus
567    updatetext
568}
569
570proc TrimLSTfile {} {
571    global filename lstfp tcl_platform txtvw
572   
573    # get the last refinement run position
574    set loc {}
575    # get the starting location
576    catch {
577        set loc [lindex [.a.goto.menu.run entrycget 1 -command] end]
578        set loc [.txt index "$loc - 2lines"]
579        set txtvw(delete) [expr {100.*$loc/[.txt index end]}]
580        .txt see $loc
581
582    }
583    if {$loc == ""} {
584        set txtvw(delete) [expr {50.* \
585                ([lindex [.txt yview] 0] + [lindex [.txt yview] 1])}]
586        set loc [expr {int(0.5+ $txtvw(delete) * [.txt index end]/100.)}].0
587    }
588
589    catch {toplevel .trim}
590    eval destroy [winfo children .trim]
591    wm title .trim "Trim $filename"
592    pack [label .trim.0 -text "File $filename has [expr {int([.txt index end])}] lines total."] -side top
593    pack [label .trim.1 -text "Select percentage of file to delete."] \
594            -anchor w -side top
595   
596    # set the slider resolution so that 1 division is on the
597    # order of 1-2 lines
598    set res .5
599    while {$res > 200./[.txt index end] && $res > 0.01} {
600        if {[string match *5* $res]} {
601            set res [expr $res/2.5]
602        } else {
603            set res [expr $res/2.]
604        }
605    }
606    pack [scale .trim.2 -command HighlightText -orient horizontal \
607            -variable txtvw(delete) \
608            -resolution $res] -expand yes -fill x
609    pack [frame .trim.3]
610    pack [button .trim.3.a -text Trim \
611            -command {DeleteSelectedText; destroy .trim} \
612            ] -side left
613    pack [button .trim.3.b -text Cancel -command {destroy .trim} ] -side left
614    # create a binding so that we can click on the text box
615    .txt tag delete b
616    .txt tag add b 0.0 end
617    .txt tag bind b <1> "ClickHighlightText %x %y"
618    # show the region pending delete
619    .txt tag delete pend
620    .txt tag add pend 0.0 $loc
621    .txt tag config pend -foreground grey
622}
623
624proc ClickHighlightText {x y} {
625    global txtvw
626    if {![winfo exists .trim]} return
627    set loc [.txt index "@$x,$y linestart"]
628    set txtvw(delete) [expr {100.*$loc/[.txt index end]}]
629    .txt tag delete pend
630    .txt tag add pend 0.0 $loc
631    .txt tag config pend -foreground grey
632}
633
634proc DeleteSelectedText {} {
635    global filename lstfp
636    .txt config -state normal
637    eval .txt delete [.txt tag nextrange pend 0.0]
638    # stop the updates
639    after cancel updatetext
640    # zero out the file
641    close $lstfp
642    set lstfp [open $filename w+]
643    puts $lstfp [.txt get 0.0 end]
644    .txt delete 0.0 end
645    ClearMenus
646    seek $lstfp 0
647    updatetext
648}
649
650proc ClearMenus {} {
651    foreach m {str run cyc sum} {
652        .a.goto.menu.$m delete 1 end
653    }
654    foreach num {1 2 3 5} {
655        .a.goto.menu entryconfigure $num -state disabled
656    }
657    global txtvw
658    set txtvw(runnumber) 0
659    set txtvw(sum) 0
660}
661
662proc HighlightText {args} {
663    global txtvw
664    set loc [expr {int(0.5+ $txtvw(delete) * [.txt index end]/100.)}].0
665    .txt tag delete pend
666    .txt tag add pend 0.0 $loc
667    .txt tag config pend -foreground grey
668    .txt see $loc
669}
670
671pack [menubutton .a.help -text Help -underline 0 -menu .a.help.menu] -side right
672menu .a.help.menu
673.a.help.menu add command -command aboutgsas -label "About"
674
675grid [frame .but ] -column 0 -row 3 -columnspan 2 -sticky ew
676pack [label .but.lbl2 -textvariable txtvw(lastcycle) \
677        -relief sunken -bd 2] -side left
678pack [label .but.lbl3 -textvariable txtvw(lastchi) \
679        -relief sunken -bd 2] -side left
680pack [label .but.lbl4 -textvariable txtvw(finalshift) \
681        -relief sunken -bd 2] -side left
682bind all <Control-KeyPress-c> {destroy .}
683bind . <KeyPress-Prior> ".txt yview scroll -1 page"
684bind . <KeyPress-Next> ".txt yview scroll 1 page"
685bind . <KeyPress-Up> ".txt yview scroll -1 unit"
686bind . <KeyPress-Down> ".txt yview scroll 1 unit"
687bind . <KeyPress-Home> ".txt yview 0"
688bind . <KeyPress-End> ".txt yview end"
689#pack [button .but.q -text close -command "destroy ." ] -side right
690.txt tag config cycle -background yellow
691.txt tag config rval -background  green
692.txt tag config chi -background  green
693if [file exists $filename] {
694    set lstfp [open $filename r]
695} else {
696    # create a file if it does not exist
697    set lstfp [open $filename w+]
698}
699donewaitmsg
700# read a file compressed file
701if {$zfil != ""} {updatetext $zfil 0; close $zfil}
702# read the initial file
703updatetext $lstfp
704# now start reading with updates
705updatetext
706
707if {$txtvw(plotvars) && ![catch {package require BLT}]} {
708    .a.options.menu add checkbutton -label "Show Plot" -command hideplot \
709            -variable txtvw(hideplot)
710}
Note: See TracBrowser for help on using the repository browser.