Changeset 6


Ignore:
Timestamp:
Dec 4, 2009 4:58:47 PM (13 years ago)
Author:
toby
Message:

# on 1998/11/23 19:34:03, toby did:
Bug for cycles > 999 fixed
Added "Auto advance" feature

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lstview

    • Property rcs:date changed from 1998/11/23 17:57:08 to 1998/11/23 19:34:03
    • Property rcs:rev changed from 1.1 to 1.2
    • Property rcs:lines set to +23 -16
    r5 r6  
    11#!/usr/local/bin/wish
     2set Revision {$Revision$ $Date$}
    23# display a .LST file in a text box
    34# updates 8/26 add bindings for page-up, -down, uparrow, downarrow
     
    2728}
    2829set box {}
     30set txtvw(followcycle) 1
    2931# override options with locally defined values
    3032if [file exists ~/.textview_config] {
     
    6163    global txtvw valuelst
    6264    set i 0
     65    set lastpos {}
    6366    # loop over cycles
    6467    set startpos $pos
     
    7174        $win tag add cycle $line.1 $line.10
    7275        incr i
    73         scan [$win get $pos $line.end] %s%d x cycle
    74         set txtvw(lastcycle) "Cycle $cycle"
    75         .a.goto.menu entryconfigure 1 -state normal
    76         $menu insert 1 command \
    77                 -font 6x12 \
    78                 -label "Cycle $cycle" \
    79                 -command "$win see $pos"
    80         if {[$menu index end] > $txtvw(menulength)} {$menu delete end}
    81 
     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        }
    8288        # get next cycle number
    8389        set nextpos [$win search -regexp -count chars \
     
    135141        set pos $nextpos
    136142    }
     143    if {$txtvw(followcycle) && $lastpos != ""} {$win see $lastpos}
    137144}
    138145
     
    288295
    289296proc aboutgsas {} {
    290         tk_dialog .warn About {
    291 GSAS (Generalized Structure Analysis System)
    292 
    293 A. C. Larson and R. B. Von Dreele, LANSCE, Los Alamos
    294 
    295 GUI menu by B. Toby, NIST
    296 }  {} 0 OK
     297    tk_dialog .warn About "
     298GSAS\n\
     299A. C. Larson and\n R. B. Von Dreele,\n LANSCE, Los Alamos\n\n\
     300TEXTVIEW\nB. Toby, NIST\nNot subject to copyright\n\n\
     301$Revision\n\
     302" {} 0 OK
    297303}
    298304
     
    323329            -side left
    324330menu .a.goto.menu
     331.a.goto.menu  add checkbutton -label "Auto Advance" -variable txtvw(followcycle)
    325332.a.goto.menu add cascade -label "Cycle #"  -menu .a.goto.menu.cyc \
    326333        -state disabled
Note: See TracChangeset for help on using the changeset viewer.