| 1 | # RCSid: $Id$ | 
| 2 | # | 
| 3 | # Create ZONE screen | 
| 4 | # | 
| 5 |  | 
| 6 | proc zonechange {nm el op} {            # record change in ZONE | 
| 7 | global radvar zonevar | 
| 8 | if {"$nm" == "radvar"} { | 
| 9 | if {"$op" == "u"} { | 
| 10 | set radvar(ZONE) {} | 
| 11 | trace variable radvar(ZONE) wu zonechange | 
| 12 | } | 
| 13 | trace vdelete zonevar w zonechange | 
| 14 | if {"$radvar(ZONE)" == {}} { | 
| 15 | set zonevar(IE) Interior | 
| 16 | set zonevar(xmin) {} | 
| 17 | set zonevar(xmax) {} | 
| 18 | set zonevar(ymin) {} | 
| 19 | set zonevar(ymax) {} | 
| 20 | set zonevar(zmin) {} | 
| 21 | set zonevar(zmax) {} | 
| 22 | } elseif {[llength $radvar(ZONE)] == 7} { | 
| 23 | if [string match {[Ii]*} $radvar(ZONE)] { | 
| 24 | set zonevar(IE) Interior | 
| 25 | } else { | 
| 26 | set zonevar(IE) Exterior | 
| 27 | } | 
| 28 | set zonevar(xmin) [lindex $radvar(ZONE) 1] | 
| 29 | set zonevar(xmax) [lindex $radvar(ZONE) 2] | 
| 30 | set zonevar(ymin) [lindex $radvar(ZONE) 3] | 
| 31 | set zonevar(ymax) [lindex $radvar(ZONE) 4] | 
| 32 | set zonevar(zmin) [lindex $radvar(ZONE) 5] | 
| 33 | set zonevar(zmax) [lindex $radvar(ZONE) 6] | 
| 34 | } | 
| 35 | trace variable zonevar w zonechange | 
| 36 | return | 
| 37 | } | 
| 38 | trace vdelete radvar(ZONE) wu zonechange | 
| 39 | set radvar(ZONE) "$zonevar(IE) $zonevar(xmin) $zonevar(xmax) $zonevar(ymin) $zonevar(ymax) $zonevar(zmin) $zonevar(zmax)" | 
| 40 | trace variable radvar(ZONE) wu zonechange | 
| 41 | } | 
| 42 |  | 
| 43 | proc indscale v {               # set indirect value | 
| 44 | global radvar | 
| 45 | set radvar(INDIRECT) $v | 
| 46 | } | 
| 47 |  | 
| 48 | proc copyzone rf {              # copy ZONE settings from another RIF | 
| 49 | load_vars [file tail $rf] {ZONE DETAIL INDIRECT VARIABILITY EXPOSURE} | 
| 50 | } | 
| 51 |  | 
| 52 | proc add2bb f { | 
| 53 | global bbargs | 
| 54 | lappend bbargs $f | 
| 55 | } | 
| 56 |  | 
| 57 | proc get_bbox {} { | 
| 58 | global radvar zonevar myglob bbargs curmess curpat | 
| 59 | set bbargs {} | 
| 60 | if [getfile -grab -perm -glob $myglob(scene) -view view_txt -send add2bb] { | 
| 61 | set curmess "Running getbbox..." | 
| 62 | update idletasks | 
| 63 | if [catch {eval exec getbbox -h $bbargs} bbout] { | 
| 64 | set curmess $bbout | 
| 65 | } else { | 
| 66 | set curmess "Done." | 
| 67 | set radvar(ZONE) "$zonevar(IE) $bbout" | 
| 68 | } | 
| 69 | } | 
| 70 | set myglob(scene) $curpat | 
| 71 | } | 
| 72 |  | 
| 73 | proc do_zone w {                # set up ZONE screen | 
| 74 | global radvar zonevar rifname | 
| 75 | if {"$w" == "done"} { | 
| 76 | trace vdelete radvar(ZONE) wu zonechange | 
| 77 | trace vdelete zonevar w zonechange | 
| 78 | unset zonevar | 
| 79 | return | 
| 80 | } | 
| 81 | frame $w | 
| 82 | # Zone fields | 
| 83 | label $w.zol -text ZONE | 
| 84 | place $w.zol -relx .0714 -rely .0610 | 
| 85 | radiobutton $w.zi -text Interior -anchor w -relief flat \ | 
| 86 | -variable zonevar(IE) -value Interior | 
| 87 | place $w.zi -relx .2857 -rely .0610 | 
| 88 | radiobutton $w.ze -text Exterior -anchor w -relief flat \ | 
| 89 | -variable zonevar(IE) -value Exterior | 
| 90 | place $w.ze -relx .5714 -rely .0610 | 
| 91 | helplink "$w.zi $w.ze" trad zone type | 
| 92 | label $w.maxl -text Maximum | 
| 93 | place $w.maxl -relx .0714 -rely .1829 | 
| 94 | label $w.minl -text Minimum | 
| 95 | place $w.minl -relx .0714 -rely .3049 | 
| 96 | button $w.bbox -text Auto -relief raised -command get_bbox | 
| 97 | place $w.bbox -relwidth .1071 -relheight .0610 -relx .0714 -rely .237 | 
| 98 | helplink $w.bbox trad zone auto | 
| 99 | label $w.xl -text X: | 
| 100 | place $w.xl -relx .2500 -rely .2439 | 
| 101 | entry $w.xmax -textvariable zonevar(xmax) -relief sunken | 
| 102 | place $w.xmax -relwidth .1786 -relheight .0610 -relx .2857 -rely .1829 | 
| 103 | entry $w.xmin -textvariable zonevar(xmin) -relief sunken | 
| 104 | place $w.xmin -relwidth .1786 -relheight .0610 -relx .2857 -rely .3049 | 
| 105 | label $w.yl -text Y: | 
| 106 | place $w.yl -relx .5000 -rely .2439 | 
| 107 | entry $w.ymax -textvariable zonevar(ymax) -relief sunken | 
| 108 | place $w.ymax -relwidth .1786 -relheight .0610 -relx .5357 -rely .1829 | 
| 109 | entry $w.ymin -textvariable zonevar(ymin) -relief sunken | 
| 110 | place $w.ymin -relwidth .1786 -relheight .0610 -relx .5357 -rely .3049 | 
| 111 | label $w.zl -text Z: | 
| 112 | place $w.zl -relx .7500 -rely .2439 | 
| 113 | entry $w.zmax -textvariable zonevar(zmax) -relief sunken | 
| 114 | place $w.zmax -relwidth .1786 -relheight .0610 -relx .7857 -rely .1829 | 
| 115 | entry $w.zmin -textvariable zonevar(zmin) -relief sunken | 
| 116 | place $w.zmin -relwidth .1786 -relheight .0610 -relx .7857 -rely .3049 | 
| 117 | helplink "$w.xmin $w.xmax $w.ymin $w.ymax $w.zmin $w.zmax" \ | 
| 118 | trad zone zone | 
| 119 | # Detail | 
| 120 | label $w.detl -text Detail: | 
| 121 | place $w.detl -relx .0714 -rely .4268 | 
| 122 | radiobutton $w.detH -text High -anchor w -relief flat \ | 
| 123 | -variable radvar(DETAIL) -value High | 
| 124 | place $w.detH -relx .2857 -rely .4268 | 
| 125 | radiobutton $w.detM -text Medium -anchor w -relief flat \ | 
| 126 | -variable radvar(DETAIL) -value Medium | 
| 127 | place $w.detM -relx .5357 -rely .4268 | 
| 128 | radiobutton $w.detL -text Low -anchor w -relief flat \ | 
| 129 | -variable radvar(DETAIL) -value Low | 
| 130 | place $w.detL -relx .7857 -rely .4268 | 
| 131 | helplink "$w.detH $w.detM $w.detL" trad zone detail | 
| 132 | # Indirect | 
| 133 | label $w.indl -text Indirect: | 
| 134 | place $w.indl -relx .0714 -rely .5488 | 
| 135 | scale $w.inds -showvalue yes -from 0 -to 5 \ | 
| 136 | -orient horizontal -command indscale | 
| 137 | $w.inds set $radvar(INDIRECT) | 
| 138 | place $w.inds -relx .2857 -rely .5488 -relwidth .6500 -relheight .1200 | 
| 139 | helplink $w.inds trad zone indirect | 
| 140 | # Variability | 
| 141 | label $w.varl -text Variability: | 
| 142 | place $w.varl -relx .0714 -rely .7317 | 
| 143 | radiobutton $w.varH -text High -anchor w -relief flat \ | 
| 144 | -variable radvar(VARIABILITY) -value High | 
| 145 | place $w.varH -relx .2857 -rely .7317 | 
| 146 | radiobutton $w.varM -text Medium -anchor w -relief flat \ | 
| 147 | -variable radvar(VARIABILITY) -value Medium | 
| 148 | place $w.varM -relx .5357 -rely .7317 | 
| 149 | radiobutton $w.varL -text Low -anchor w -relief flat \ | 
| 150 | -variable radvar(VARIABILITY) -value Low | 
| 151 | place $w.varL -relx .7857 -rely .7317 | 
| 152 | helplink "$w.varH $w.varM $w.varL" trad zone variability | 
| 153 | # Exposure | 
| 154 | label $w.expl -text Exposure: | 
| 155 | place $w.expl -relx .0714 -rely .8537 | 
| 156 | entry $w.expe -textvariable radvar(EXPOSURE) -relief sunken | 
| 157 | place $w.expe -relwidth .1786 -relheight .0610 -relx .2857 -rely .8537 | 
| 158 | helplink $w.expe trad zone exposure | 
| 159 | # Revert and Copy buttons | 
| 160 | button $w.revert -text Revert -relief raised \ | 
| 161 | -command "copyzone $rifname" | 
| 162 | place $w.revert -relwidth .1071 -relheight .0610 -relx .98 -rely .98 \ | 
| 163 | -anchor se | 
| 164 | helplink $w.revert trad zone revert | 
| 165 | button $w.copy -text Copy -relief raised -command {getfile -grab \ | 
| 166 | -send copyzone -view view_txt -glob $myglob(rif)} | 
| 167 | place $w.copy -relwidth .1071 -relheight .0610 -relx .98 -rely .90 \ | 
| 168 | -anchor se | 
| 169 | helplink $w.copy trad zone copy | 
| 170 | # Focusing | 
| 171 | focus $w.xmin | 
| 172 | bind $w.xmin <Return> "focus $w.xmax" | 
| 173 | bind $w.xmax <Return> "focus $w.ymin" | 
| 174 | bind $w.ymin <Return> "focus $w.ymax" | 
| 175 | bind $w.ymax <Return> "focus $w.zmin" | 
| 176 | bind $w.zmin <Return> "focus $w.zmax" | 
| 177 | bind $w.zmax <Return> "focus $w.expe" | 
| 178 | bind $w.expe <Return> {} | 
| 179 | # Track ZONE variable | 
| 180 | if [info exists radvar(ZONE)] { | 
| 181 | zonechange radvar ZONE w | 
| 182 | trace variable radvar(ZONE) wu zonechange | 
| 183 | } else { | 
| 184 | zonechange radvar ZONE u | 
| 185 | } | 
| 186 | } |