Changeset 476 for trunk/liveplot


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

# on 2001/10/31 20:02:37, toby did:
manual zoom option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/liveplot

    • Property rcs:date changed from 2001/10/18 23:23:58 to 2001/10/31 20:02:37
    • Property rcs:lines changed from +47 -18 to +59 -2
    • Property rcs:rev changed from 1.20 to 1.21
    r467 r476  
    13821382}
    13831383
     1384#-------------------------------------------------------------------------
     1385# manual zoom option
     1386proc BLTmanualZoom {} {
     1387    global graph
     1388    catch {toplevel .zoom}
     1389    eval destroy [grid slaves .zoom]
     1390    raise .zoom
     1391    wm title .zoom {Manual Scaling}
     1392    grid [label .zoom.l1 -text minimum] -row 1 -column 2
     1393    grid [label .zoom.l2 -text maximum] -row 1 -column 3
     1394    grid [label .zoom.l3 -text x] -row 2 -column 1
     1395    grid [label .zoom.l4 -text y] -row 3 -column 1
     1396    grid [entry .zoom.xmin -textvariable graph(xmin) -width 10] -row 2 -column 2
     1397    grid [entry .zoom.xmax -textvariable graph(xmax) -width 10] -row 2 -column 3
     1398    grid [entry .zoom.ymin -textvariable graph(ymin) -width 10] -row 3 -column 2
     1399    grid [entry .zoom.ymax -textvariable graph(ymax) -width 10] -row 3 -column 3
     1400    grid [frame .zoom.b] -row 4 -column 1 -columnspan 3
     1401    grid [button .zoom.b.1 -text "Set Scaling" \
     1402             -command "SetManualZoom set"]  -row 4 -column 1 -columnspan 2
     1403    grid [button .zoom.b.2 -text Reset \
     1404            -command "SetManualZoom clear"] -row 4 -column 3
     1405    grid [button .zoom.b.3 -text Close -command "destroy .zoom"] -row 4 -column 4
     1406    grid rowconfigure .zoom 1 -weight 1 -pad 5
     1407    grid rowconfigure .zoom 2 -weight 1 -pad 5
     1408    grid rowconfigure .zoom 3 -weight 1 -pad 5
     1409    grid rowconfigure .zoom 4 -weight 0 -pad 5
     1410    grid columnconfigure .zoom 1 -weight 1 -pad 20
     1411    grid columnconfigure .zoom 1 -weight 1
     1412    grid columnconfigure .zoom 3 -weight 1 -pad 10
     1413    foreach item {min min max max} \
     1414            format {3   2   3   2} \
     1415            axis   {x   y   x   y} {
     1416        set val [$graph(blt) ${axis}axis cget -${item}]
     1417        set graph(${axis}${item}) {(auto)}
     1418        catch {set graph(${axis}${item}) [format %.${format}f $val]}
     1419    }
     1420}
     1421
     1422proc SetManualZoom {mode} {
     1423    global graph
     1424    if {$mode == "clear"} {
     1425        foreach item {xmin ymin xmax ymax} {
     1426            set graph($item) {(auto)}
     1427        }
     1428    }
     1429    foreach item {xmin ymin xmax ymax} {
     1430        set $item {}
     1431        catch {set $item [expr $graph($item)]} 
     1432    }
     1433    # reset the zoomstack
     1434    catch {Blt_ZoomStack $graph(blt)}
     1435    catch {$graph(blt) xaxis config -min $xmin -max $xmax}
     1436    catch {$graph(blt) yaxis config -min $ymin -max $ymax}
     1437}
    13841438
    13851439source [file join $expgui(scriptdir) gsascmds.tcl]
     
    14861540    eval $box element config 4 $graph(ElementHideOption)
    14871541}
     1542bind . <Key-z> {BLTmanualZoom}
     1543bind . <Key-Z> {BLTmanualZoom}
     1544
    14881545$box yaxis config -title {}
    14891546setlegend $box $graph(legend)
Note: See TracChangeset for help on using the changeset viewer.