--- ray/src/util/do_zone.tcl 1994/10/27 15:56:10 2.1 +++ ray/src/util/do_zone.tcl 2003/02/22 02:07:30 2.7 @@ -1,4 +1,4 @@ -# SCCSid "$SunId$ LBL" +# RCSid: $Id: do_zone.tcl,v 2.7 2003/02/22 02:07:30 greg Exp $ # # Create ZONE screen # @@ -36,7 +36,7 @@ proc zonechange {nm el op} { # record change in ZONE return } trace vdelete radvar(ZONE) wu zonechange - set radvar(ZONE) "$zonevar(IE) $zonevar(xmin) $zonevar(xmax) $zonevar(ymin) $zonevar(ymax) $zonevar(zmin) $zonevar(zmax)" + set radvar(ZONE) "$zonevar(IE) $zonevar(xmin) $zonevar(xmax) $zonevar(ymin) $zonevar(ymax) $zonevar(zmin) $zonevar(zmax)" trace variable radvar(ZONE) wu zonechange } @@ -49,8 +49,29 @@ proc copyzone rf { # copy ZONE settings from another load_vars [file tail $rf] {ZONE DETAIL INDIRECT VARIABILITY EXPOSURE} } +proc add2bb f { + global bbargs + lappend bbargs $f +} + +proc get_bbox {} { + global radvar zonevar myglob bbargs curmess curpat + set bbargs {} + if [getfile -grab -perm -glob $myglob(scene) -view view_txt -send add2bb] { + set curmess "Running getbbox..." + update idletasks + if [catch {eval exec getbbox -h $bbargs} bbout] { + set curmess $bbout + } else { + set curmess "Done." + set radvar(ZONE) "$zonevar(IE) $bbout" + } + } + set myglob(scene) $curpat +} + proc do_zone w { # set up ZONE screen - global radvar zonevar rifname rif_glob + global radvar zonevar rifname if {"$w" == "done"} { trace vdelete radvar(ZONE) wu zonechange trace vdelete zonevar w zonechange @@ -72,6 +93,9 @@ proc do_zone w { # set up ZONE screen place $w.maxl -relx .0714 -rely .1829 label $w.minl -text Minimum place $w.minl -relx .0714 -rely .3049 + button $w.bbox -text Auto -relief raised -command get_bbox + place $w.bbox -relwidth .1071 -relheight .0610 -relx .0714 -rely .237 + helplink $w.bbox trad zone auto label $w.xl -text X: place $w.xl -relx .2500 -rely .2439 entry $w.xmax -textvariable zonevar(xmax) -relief sunken @@ -109,10 +133,9 @@ proc do_zone w { # set up ZONE screen label $w.indl -text Indirect: place $w.indl -relx .0714 -rely .5488 scale $w.inds -showvalue yes -from 0 -to 5 \ - -orient horizontal -command indscale \ - -length 450 -width 25 + -orient horizontal -command indscale $w.inds set $radvar(INDIRECT) - place $w.inds -relx .2857 -rely .5488 + place $w.inds -relx .2857 -rely .5488 -relwidth .6500 -relheight .1200 helplink $w.inds trad zone indirect # Variability label $w.varl -text Variability: @@ -139,8 +162,8 @@ proc do_zone w { # set up ZONE screen place $w.revert -relwidth .1071 -relheight .0610 -relx .98 -rely .98 \ -anchor se helplink $w.revert trad zone revert - button $w.copy -text Copy -relief raised -command {getfile \ - -send copyzone -view view_txt -glob $rif_glob} + button $w.copy -text Copy -relief raised -command {getfile -grab \ + -send copyzone -view view_txt -glob $myglob(rif)} place $w.copy -relwidth .1071 -relheight .0610 -relx .98 -rely .90 \ -anchor se helplink $w.copy trad zone copy