Changeset 778 for trunk/excledt.tcl


Ignore:
Timestamp:
Dec 4, 2009 5:11:52 PM (11 years ago)
Author:
toby
Message:

# on 2004/04/26 21:18:57, toby did:
Fix bug with OSX BLT (all new versions of BLT)?
Add ability to scan zoom region with arrow keys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/excledt.tcl

    • Property rcs:date changed from 2003/12/05 12:56:23 to 2004/04/26 21:18:57
    • Property rcs:lines changed from +17 -11 to +37 -4
    • Property rcs:rev changed from 1.11 to 1.12
    r759 r778  
    675675        # are there any points between the regions
    676676        if {$i != 0} {
    677             set seppts [allxvec search \
    678                     [expr -.00001+$low] [expr .00001+$prvhigh]]
     677            set x1 [expr {-.00001+$low}]
     678            set x2 [expr {.00001+$prvhigh}]
     679            if {$x1 < $x2} {
     680                set seppts [allxvec search $x1 $x2]
     681            } else {
     682                set seppts [allxvec search $x2 $x1]
     683            }
    679684            if {[llength $seppts] == 0} {
    680685                set exclist [lreplace $exclist $ip $i [list $prvlow $high]]
     
    12651270}
    12661271
     1272# move the zoom region around
     1273proc ScanZoom {box key frac} {
     1274    foreach var  {xl xh yl yh} axis {xaxis  xaxis  yaxis  yaxis} \
     1275            flg  {-min -max -min -max} {
     1276        set $var [$box $axis cget $flg]
     1277        if {$var == ""} return
     1278    }
     1279    catch {
     1280        switch -- $key {
     1281            Right {set a x; set l $xl; set h $xh; set d [expr {$frac*($h-$l)}]}
     1282            Left {set a x; set l $xl; set h $xh; set d [expr {-$frac*($h-$l)}]}
     1283            Up   {set a y; set l $yl; set h $yh; set d [expr {$frac*($h-$l)}]}
     1284            Down {set a y; set l $yl; set h $yh; set d [expr {-$frac*($h-$l)}]}
     1285        }
     1286        $box ${a}axis configure -min [expr {$l + $d}] -max [expr {$h + $d}]
     1287    }
     1288}
     1289
    12671290# code to create the EXCLEDT box
    12681291proc ShowExcl {} {
     
    13951418            -command setpostscriptout
    13961419    # phase options
     1420    set box $graph(plot)
     1421    set win [winfo toplevel $graph(plot)]
    13971422    foreach num $expmap(phaselist) {
    13981423        $graph(exclmenu).file.menu.tick add checkbutton -label "Phase $num" \
    13991424                -variable peakinfo(flag$num)
    1400         bind [winfo toplevel $graph(plot)] <Key-$num> \
     1425        bind $win <Key-$num> \
    14011426                "set peakinfo(flag$num) \[expr !\$peakinfo(flag$num)\]"
    14021427        $graph(exclmenu).options.menu.tick add command -label "Phase $num" \
    14031428                -command "minioptionsbox $num"
    14041429    }
     1430    bind $win <Key-Up> "ScanZoom $box %K .1"
     1431    bind $win <Key-Left> "ScanZoom $box %K .1"
     1432    bind $win <Key-Right> "ScanZoom $box %K .1"
     1433    bind $win <Key-Down> "ScanZoom $box %K .1"
     1434    bind $win <Control-Key-Up> "ScanZoom $box %K 1.0"
     1435    bind $win <Control-Key-Left> "ScanZoom $box %K 1.0"
     1436    bind $win <Control-Key-Right> "ScanZoom $box %K 1.0"
     1437    bind $win <Control-Key-Down> "ScanZoom $box %K 1.0"
    14051438
    14061439    set graph(bbox) [set bb $graph(exclbox).b]
Note: See TracChangeset for help on using the changeset viewer.