[10] | 1 | #!/usr/local/bin/wish |
---|
| 2 | set expgui(Revision) {$Revision: 16 $ $Date: 2009-12-04 22:58:57 +0000 (Fri, 04 Dec 2009) $} |
---|
| 3 | |
---|
| 4 | # to do: |
---|
| 5 | # |
---|
| 6 | # global background editing & profile work differently: should both |
---|
| 7 | # start out blank with a "load from option"? |
---|
| 8 | # |
---|
[14] | 9 | # access to GENLES & EXPEDT (merge in tkGSAS) |
---|
| 10 | # |
---|
| 11 | # look for external changes to the EXP file and warn/reload |
---|
| 12 | # add a mtime to loadexp and chain a routine to check the mtime for a new value |
---|
| 13 | # reset the mtime in SaveAsFile |
---|
| 14 | # |
---|
[10] | 15 | # idea: |
---|
| 16 | # a scroll list for all histogram refinement flags ; click on takes you to the |
---|
| 17 | # appropriate menu. |
---|
| 18 | # |
---|
| 19 | # to allow global access on phase page |
---|
| 20 | # change buttons from radio to multiple |
---|
| 21 | # -- or display all 9 cell flag/damps and all atoms |
---|
| 22 | # make editMultipleRecords work with multiple phases, also cell flag/damp |
---|
| 23 | # blank cell entries |
---|
| 24 | # add phase to atom number in listing |
---|
| 25 | # DisplayAllAtoms needs to loop over phases: expgui(curPhase) |
---|
| 26 | |
---|
[16] | 27 | if {$tcl_version < 8.0} { |
---|
| 28 | tk_dialog .expFileErrorMsg "Version Error" \ |
---|
| 29 | "The program requires Tcl/Tk version 8.0 or higher" error 0 "Exit" |
---|
| 30 | exit |
---|
| 31 | } |
---|
| 32 | |
---|
[10] | 33 | if {$argv != ""} { |
---|
| 34 | set expfile [lindex $argv 0] |
---|
| 35 | if {[string toupper [file extension $expfile]] != ".EXP"} { |
---|
| 36 | append expfile ".EXP" |
---|
| 37 | } |
---|
| 38 | } else { |
---|
| 39 | # windows needs this update or focus gets screwed up after tk_getOpenFile |
---|
| 40 | update |
---|
| 41 | set expfile [tk_getOpenFile -defaultextension .EXP \ |
---|
| 42 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent .] |
---|
| 43 | } |
---|
| 44 | if {$expfile == ""} exit |
---|
| 45 | if ![file exists $expfile] { |
---|
| 46 | tk_dialog .expFileErrorMsg "File Open Error" \ |
---|
| 47 | "File $expfile does not exist" error 0 "Exit" |
---|
| 48 | exit |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | set expgui(debug) 0 |
---|
| 52 | catch {if $env(DEBUG) {set expgui(debug) 1}} |
---|
| 53 | #set expgui(debug) 1 |
---|
| 54 | |
---|
| 55 | set expgui(havetix) 1 |
---|
| 56 | # for debugging non-Tix version set environment variable NOTIX |
---|
| 57 | catch {if $env(NOTIX) {set expgui(havetix) 0}} |
---|
| 58 | if $expgui(havetix) { |
---|
| 59 | if [catch {package require Tix}] {set expgui(havetix) 0} |
---|
| 60 | } |
---|
| 61 | # default is archive = on |
---|
| 62 | set expgui(archive) 1 |
---|
| 63 | #---------------------------------------------------------------- |
---|
| 64 | # where are we? |
---|
| 65 | set expgui(script) [info script] |
---|
| 66 | # translate links -- go six levels deep |
---|
| 67 | foreach i {1 2 3 4 5 6} { |
---|
| 68 | if {[file type $expgui(script)] == "link"} { |
---|
| 69 | set link [file readlink $expgui(script)] |
---|
| 70 | if { [file pathtype $link] == "absolute" } { |
---|
| 71 | h set expgui(script) $link |
---|
| 72 | } { |
---|
| 73 | set expgui(script) [file dirname $expgui(script)]/$link |
---|
| 74 | } |
---|
| 75 | } else { |
---|
| 76 | break |
---|
| 77 | } |
---|
| 78 | } |
---|
| 79 | set expgui(scriptdir) [file dirname $expgui(script) ] |
---|
| 80 | #---------------------------------------------------------------- |
---|
| 81 | # fetch EXP routines |
---|
| 82 | source [file join $expgui(scriptdir) readexp.tcl] |
---|
| 83 | |
---|
| 84 | # constants |
---|
| 85 | set expgui(coordfont) "-*-courier-bold-r-normal--12-*" |
---|
| 86 | set expgui(histfont) "-*-courier-bold-r-normal--12-*" |
---|
| 87 | |
---|
| 88 | #============================================================================= |
---|
| 89 | # Store names of profile terms. |
---|
| 90 | array set expgui { |
---|
| 91 | prof-T-1 {TOF-type1 alp-0 bet-0 sig-0 alp-1 bet-1 sig-1 rstr rsta \ |
---|
| 92 | sig-2 rsca s1ec s2ec } |
---|
| 93 | prof-T-2 {TOF-type2 alp-0 sig-0 gam-0 alp-1 sig-1 gam-1 beta sig-2 \ |
---|
| 94 | gam-2 switch ptec stec difc difa zero } |
---|
| 95 | prof-T-3 {TOF-type3 alp bet-0 bet-1 sig-0 sig-1 sig-2 gam-0 gam-1 \ |
---|
| 96 | gam-2 gsf g1ec g2ec rstr rsta rsca L11 L22 L33 L12 L13 L23 } |
---|
| 97 | prof-T-4 {TOF-type4 alp bet-0 bet-1 sig-1 sig-2 gam-2 g2ec gsf \ |
---|
| 98 | rstr rsta rsca eta} |
---|
| 99 | prof-C-1 {CW-type U V W asym F1 F2 } |
---|
| 100 | prof-C-2 {CW-type2 GU GV GW LX LY trns asym shft GP stec ptec sfec \ |
---|
| 101 | L11 L22 L33 L12 L13 L23 } |
---|
| 102 | prof-C-3 {CW-type3 GU GV GW GP LX LY S/L H/L trns shft stec ptec sfec \ |
---|
| 103 | L11 L22 L33 L12 L13 L23 } |
---|
| 104 | prof-C-4 {CW-type4 GU GV GW GP LX ptec trns shft sfec S/L H/L eta} |
---|
| 105 | } |
---|
| 106 | # >>>>>>>>>>>>>>>> End of Profile Terms >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 107 | # |
---|
| 108 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 109 | # <<<<<<<<<< BEGINNING OF MAIN: GLOBAL AREA FOR DATA EXTRACTION >>>>>>>>>>> |
---|
| 110 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 111 | # load exp file and set up dialogs |
---|
| 112 | proc loadexp {expfile} { |
---|
| 113 | global expgui expmap entryvar entrycmd |
---|
| 114 | global exparray |
---|
| 115 | catch { |
---|
| 116 | unset exparray |
---|
| 117 | unset expmap |
---|
| 118 | } |
---|
| 119 | expload $expfile |
---|
| 120 | set expgui(changed) 0 |
---|
| 121 | mapexp |
---|
[16] | 122 | set expgui(expModifiedLast) [file mtime $expfile] |
---|
| 123 | set expgui(last_History) [string trim [lindex [exphistory last] 1]] |
---|
[10] | 124 | # set the window/icon title |
---|
| 125 | wm title . $expfile |
---|
[16] | 126 | set expgui(titleunchanged) 1 |
---|
[10] | 127 | wm iconname . [file tail $expfile] |
---|
| 128 | |
---|
| 129 | set expgui(curPhase) "" |
---|
| 130 | # set the number of phases on the phase page |
---|
| 131 | setphases |
---|
| 132 | |
---|
| 133 | set expgui(pagenow) "" |
---|
| 134 | |
---|
| 135 | # update the histogram list |
---|
| 136 | sethistlist |
---|
| 137 | |
---|
| 138 | if !$expgui(havetix) { |
---|
[16] | 139 | RaisePage lsFrame |
---|
[10] | 140 | } else { |
---|
[16] | 141 | .n raise lsPane |
---|
| 142 | set expgui(pagenow) lsFrame |
---|
[10] | 143 | } |
---|
| 144 | # select the 1st phase |
---|
| 145 | SelectOnePhase [lindex $expmap(phaselist) 0] |
---|
| 146 | # disable the "global options" that don't make sense |
---|
| 147 | foreach num {1 2 3 4 5} { |
---|
| 148 | set flag($num) 0 |
---|
| 149 | } |
---|
| 150 | foreach h $expmap(powderlist) { |
---|
| 151 | if {[string range $expmap(htype_$h) 2 2] == "T"} {set flag(1) 1} |
---|
| 152 | if {[string range $expmap(htype_$h) 1 2] == "NC"} {set flag(2) 1} |
---|
| 153 | if {[string range $expmap(htype_$h) 1 2] == "XC" && \ |
---|
| 154 | [histinfo $h lam2] != 0.0} {set flag(3) 1} |
---|
| 155 | if {[string range $expmap(htype_$h) 1 2] == "XC" && \ |
---|
| 156 | [histinfo $h lam2] == 0.0} {set flag(4) 1} |
---|
| 157 | if {[string range $expmap(htype_$h) 1 2] == "XE"} {set flag(5) 1} |
---|
| 158 | } |
---|
| 159 | foreach num {1 2 3 4 5} \ |
---|
| 160 | lbl {TOF "CW Neutron" "Alpha12 Xray" "Monochromatic Xray" \ |
---|
| 161 | "Energy Disp Xray"} { |
---|
| 162 | if $flag($num) { |
---|
[16] | 163 | $expgui(fm).option.menu.editmode entryconfigure $lbl -state normal |
---|
[10] | 164 | } else { |
---|
[16] | 165 | $expgui(fm).option.menu.editmode entryconfigure $lbl -state disabled |
---|
[10] | 166 | } |
---|
| 167 | } |
---|
[12] | 168 | # disable traces on entryvar until we are ready |
---|
| 169 | set entrycmd(trace) 0 |
---|
| 170 | |
---|
[10] | 171 | # least squares page |
---|
| 172 | set entryvar(cycles) [expinfo cycles] |
---|
| 173 | set entrycmd(cycles) "expinfo cycles" |
---|
| 174 | set expgui(globalmode) 0 |
---|
| 175 | set expgui(printopt) "Print Options ([expinfo print])" |
---|
| 176 | global printopts |
---|
| 177 | foreach num [array names printopts] { |
---|
| 178 | set entrycmd(printopt$num) "printsetting $num" |
---|
| 179 | set entryvar(printopt$num) [printsetting $num] |
---|
| 180 | } |
---|
[12] | 181 | # enable traces on entryvar |
---|
| 182 | set entrycmd(trace) 1 |
---|
[16] | 183 | # start checking for external changes |
---|
| 184 | afterawhile |
---|
[10] | 185 | } |
---|
| 186 | |
---|
| 187 | # called to reread the .EXP file -- use after another program |
---|
| 188 | # has changed the experiment file |
---|
| 189 | proc rereadexp {expfile} { |
---|
| 190 | global expgui |
---|
| 191 | if $expgui(changed) { |
---|
| 192 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
| 193 | {You have made changes to the Experiment. Rereading will cause the changes to be lost. Select an option:} \ |
---|
| 194 | {} 0 "Save and reread" "Reread without Save" "Cancel reread command"] |
---|
| 195 | switch $decision { |
---|
[14] | 196 | 0 { savearchiveexp $expfile } |
---|
| 197 | 1 { } |
---|
| 198 | 2 { return } |
---|
[10] | 199 | } |
---|
| 200 | } |
---|
| 201 | loadexp $expfile |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | proc SaveAsFile {} { |
---|
| 205 | global expfile expgui |
---|
| 206 | set newexpfile [tk_getSaveFile -defaultextension .EXP \ |
---|
| 207 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ |
---|
| 208 | -initialdir [file dirname $expfile] \ |
---|
| 209 | -initialfile [file tail $expfile] ] |
---|
| 210 | if {$newexpfile == ""} return |
---|
| 211 | set expfile $newexpfile |
---|
| 212 | expwrite $expfile |
---|
| 213 | set expgui(changed) 0 |
---|
[16] | 214 | set expgui(expModifiedLast) [file mtime $expfile] |
---|
| 215 | set expgui(last_History) [string trim [lindex [exphistory last] 1]] |
---|
[10] | 216 | # set the window/icon title |
---|
| 217 | wm title . $expfile |
---|
[16] | 218 | set expgui(titleunchanged) 1 |
---|
[10] | 219 | wm iconname . [file tail $expfile] |
---|
| 220 | } |
---|
| 221 | |
---|
| 222 | # called to read a different .EXP file |
---|
| 223 | proc readnewexp {} { |
---|
| 224 | global expgui expfile |
---|
| 225 | if $expgui(changed) { |
---|
| 226 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
| 227 | {You have made changes to the Experiment. Reading a different file will cause the changes to be lost. Select an option:} \ |
---|
| 228 | {} 0 "Save and read" "Read without Save" "Cancel read command"] |
---|
| 229 | switch $decision { |
---|
[14] | 230 | 0 { savearchiveexp $expfile } |
---|
| 231 | 1 { } |
---|
| 232 | 2 { return } |
---|
[10] | 233 | } |
---|
| 234 | } |
---|
| 235 | set newexpfile [tk_getOpenFile -defaultextension .EXP \ |
---|
| 236 | -filetypes {{"GSAS Experiment" ".EXP"}} -parent . \ |
---|
| 237 | -initialdir [file dirname $expfile] ] |
---|
| 238 | if {$newexpfile == ""} return |
---|
| 239 | set expfile $newexpfile |
---|
| 240 | loadexp $expfile |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | #------------- set up data read/write layer ---------------------- |
---|
| 244 | # trace routine on entryvar |
---|
| 245 | proc entvartrace {array elem action} { |
---|
| 246 | global expgui entrycmd entryvar |
---|
| 247 | if !$entrycmd(trace) return |
---|
| 248 | |
---|
| 249 | catch { |
---|
| 250 | incr expgui(changed) |
---|
| 251 | if $expgui(debug) {puts "$entrycmd($elem) set $entryvar($elem) "} |
---|
| 252 | if {$entrycmd($elem) == ""} return |
---|
| 253 | if [catch { |
---|
| 254 | eval $entrycmd($elem) set $entryvar($elem) |
---|
| 255 | if {[lindex $entrycmd($elem) 0] == "atominfo"} { |
---|
| 256 | after idle {DisplayAllAtoms noreset} |
---|
| 257 | } |
---|
| 258 | } errmsg] {puts "entvartrace error: $errmsg"} |
---|
| 259 | } |
---|
| 260 | } |
---|
| 261 | |
---|
| 262 | # disable traces on entryvar until we are ready |
---|
| 263 | set entrycmd(trace) 0 |
---|
| 264 | trace variable entryvar w entvartrace |
---|
| 265 | |
---|
| 266 | # |
---|
| 267 | # |
---|
| 268 | # |
---|
| 269 | ############################################################################## |
---|
| 270 | ##### ##################################################### |
---|
| 271 | ##### PROCEDURES SECTION ##################################################### |
---|
| 272 | ##### ##################################################### |
---|
| 273 | ############################################################################## |
---|
| 274 | # reset routine is used for debugging |
---|
| 275 | proc reset {} { |
---|
| 276 | global expgui script argv expfile |
---|
| 277 | set script $expgui(script) |
---|
| 278 | set argv $expfile |
---|
| 279 | # remove traces |
---|
| 280 | global entryvar |
---|
| 281 | foreach cmd [trace vinfo entryvar] { |
---|
| 282 | eval trace vdelete entryvar $cmd |
---|
| 283 | } |
---|
| 284 | global expgui |
---|
| 285 | foreach cmd [trace vinfo expgui(backterms)] { |
---|
| 286 | eval trace vdelete entryvar $cmd |
---|
| 287 | } |
---|
| 288 | foreach cmd [trace vinfo expgui(backtype)] { |
---|
| 289 | eval trace vdelete entryvar $cmd |
---|
| 290 | } |
---|
| 291 | foreach a {exparray expmap expgui entryvar entrycmd} { |
---|
| 292 | global $a |
---|
| 293 | catch {unset $a} |
---|
| 294 | } |
---|
| 295 | foreach w [winfo children .] { |
---|
| 296 | destroy $w |
---|
| 297 | } |
---|
| 298 | |
---|
| 299 | uplevel #0 {source $script} |
---|
| 300 | } |
---|
| 301 | |
---|
| 302 | proc About { } { |
---|
| 303 | global expgui expmap |
---|
| 304 | tk_dialog .about {About...} \ |
---|
| 305 | "EXPGUI\n\ |
---|
| 306 | Jonathan Wasserman and Brian Toby\n\ |
---|
| 307 | NIST Center for Neutron Research\n\n\ |
---|
| 308 | 1998, Not subject to copyright\n\n\ |
---|
| 309 | Revision [lindex $expgui(Revision) 1] (readexp.tcl [lindex $expmap(Revision) 1])" \ |
---|
| 310 | info 0 OK |
---|
| 311 | } |
---|
| 312 | |
---|
[16] | 313 | # wait until idle |
---|
| 314 | proc afterawhile {} { |
---|
| 315 | # cancel any other instances of this loop |
---|
| 316 | after cancel afterawhile |
---|
| 317 | after cancel whenidle |
---|
| 318 | after cancel whenidle |
---|
| 319 | after idle whenidle |
---|
| 320 | } |
---|
| 321 | |
---|
| 322 | proc whenidle {} { |
---|
| 323 | global expgui expfile |
---|
| 324 | if $expgui(titleunchanged) { |
---|
| 325 | if {$expgui(changed) != 0} { |
---|
| 326 | wm title . "$expfile (modified)" |
---|
| 327 | set expgui(titleunchanged) 0 |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | #puts whenidle |
---|
| 331 | if {[file mtime $expfile] != $expgui(expModifiedLast)} { |
---|
| 332 | if {$expgui(changed) == 0} { |
---|
| 333 | set ans [tk_dialog .expFileErrorMsg "Reload?" \ |
---|
| 334 | "File $expfile has been modified by another program. \ |
---|
| 335 | Do you want to load the newer version or loose the modifications \ |
---|
| 336 | by editing the current version?" \ |
---|
| 337 | warning 0 "Load new" "Continue editing"] |
---|
| 338 | } else { |
---|
| 339 | set ans [tk_dialog .expFileErrorMsg "Reload?" \ |
---|
| 340 | "File $expfile has been modified by another program \ |
---|
| 341 | and you have made $expgui(changed) changes to this version. \ |
---|
| 342 | Do you want to load the newer version or loose the modifications \ |
---|
| 343 | by continuing to edit the current version?" \ |
---|
| 344 | warning 0 "Load new" "Continue editing" "Save edited version"] |
---|
| 345 | } |
---|
| 346 | if {$ans == 0} { |
---|
| 347 | loadexp $expfile |
---|
| 348 | } elseif {$ans == 1} { |
---|
| 349 | # reset the time to the next version |
---|
| 350 | set expgui(expModifiedLast) [file mtime $expfile] |
---|
| 351 | } elseif {$ans == 2} { |
---|
| 352 | savearchiveexp $expfile |
---|
| 353 | } |
---|
| 354 | } |
---|
| 355 | after 2000 afterawhile |
---|
| 356 | } |
---|
[10] | 357 | # -------- called to confirm before exiting |
---|
| 358 | proc catchQuit {} { |
---|
| 359 | if {[confirmBeforeSave] == "Continue"} { |
---|
| 360 | destroy . |
---|
| 361 | } |
---|
| 362 | } |
---|
| 363 | # save the .EXP file before exiting? |
---|
| 364 | proc confirmBeforeSave {} { |
---|
| 365 | global expgui expfile |
---|
| 366 | if !$expgui(changed) { |
---|
| 367 | return "Continue" |
---|
| 368 | } |
---|
| 369 | set decision [tk_dialog .instrSaveData {Save .EXP changes} \ |
---|
| 370 | {You have made changes to the Experiment, but the changes are not saved. Select an option:} \ |
---|
| 371 | {} 0 "Save and Exit" "Exit without Save" "Cancel exit command"] |
---|
| 372 | switch $decision { |
---|
[14] | 373 | 0 { savearchiveexp $expfile; return "Continue" } |
---|
| 374 | 1 { return "Continue" } |
---|
| 375 | 2 { return "Cancel" } |
---|
[10] | 376 | } |
---|
| 377 | } |
---|
| 378 | |
---|
[14] | 379 | # save and optionally archive the expfile |
---|
| 380 | proc savearchiveexp {expfile} { |
---|
[16] | 381 | global expgui tcl_platform expmap |
---|
[10] | 382 | if !$expgui(changed) return |
---|
| 383 | if $expgui(archive) { |
---|
| 384 | catch { |
---|
| 385 | set expnam [file rootname $expfile] |
---|
| 386 | if {$tcl_platform(platform) == "windows"} { |
---|
| 387 | if ![file executable [file join $expgui(scriptdir) pkzip.exe]] { |
---|
| 388 | # archive w/o pkzip |
---|
| 389 | set files [glob -nocomplain ${expnam}!*.exp] |
---|
| 390 | if {$files == ""} { |
---|
| 391 | set num -1 |
---|
| 392 | } else { |
---|
| 393 | set file [lindex [lsort -decreasing $files] 0] |
---|
| 394 | regexp {!([0-9]+)\.EXP} [string toupper $file] a num |
---|
| 395 | } |
---|
| 396 | set file $expnam![format "%3.3d" [incr num]].EXP |
---|
| 397 | file copy $expnam.EXP $file |
---|
| 398 | set fp [open $expnam.lst a] |
---|
| 399 | puts $fp "\n--------------------------------------------------------------" |
---|
| 400 | puts $fp "Archiving $expnam.EXP as $file" |
---|
| 401 | puts $fp "--------------------------------------------------------------\n" |
---|
| 402 | close $fp |
---|
| 403 | } else { |
---|
| 404 | # archive with PKZIP |
---|
| 405 | # need to limit expnam to 8 characters |
---|
| 406 | set sexp [string toupper [string range [file root [file tail $expnam] ] 0 7]] |
---|
| 407 | # PKZIP can't handle long dir names either |
---|
| 408 | cd [set dir [file dirname $expnam]] |
---|
| 409 | set num -1 |
---|
| 410 | # get the versions from the listing |
---|
| 411 | if [file exists $sexp.zip] { |
---|
| 412 | set fp [open "| [file join $expgui(scriptdir) pkzip.exe] -vb $sexp" r] |
---|
| 413 | while {[gets $fp line] >= 0} { |
---|
| 414 | regexp "$sexp\.0?0?(\[0-9\]+)" [string toupper $line] junk n |
---|
| 415 | catch {if {$n > $num} {set num $n}} |
---|
| 416 | } |
---|
| 417 | close $fp |
---|
| 418 | } |
---|
| 419 | incr num |
---|
| 420 | set file $sexp.[format "%3.3d" $num] |
---|
| 421 | file copy -force $expnam.EXP $file |
---|
| 422 | exec [file join $expgui(scriptdir) pkzip.exe] -m $expnam $file > x.x & |
---|
| 423 | set fp [open $expnam.lst a] |
---|
| 424 | puts $fp "\n--------------------------------------------------------------" |
---|
| 425 | puts $fp "Archiving $expnam.EXP as $file in [file join $dir $sexp.ZIP]" |
---|
| 426 | puts $fp "--------------------------------------------------------------\n" |
---|
| 427 | close $fp |
---|
| 428 | } |
---|
| 429 | } else { |
---|
| 430 | set files [glob -nocomplain $expnam.EXP.*] |
---|
| 431 | if {$files == ""} { |
---|
| 432 | set file $expnam.EXP.000 |
---|
| 433 | } else { |
---|
| 434 | set file [lindex [lsort -decreasing $files] 0] |
---|
| 435 | regexp {.*\.EXP.0?0?([0-9]*).*} $file junk number |
---|
| 436 | incr number |
---|
| 437 | set file $expnam.EXP.[format "%3.3d" $number] |
---|
| 438 | } |
---|
| 439 | exec cp $expfile $file |
---|
| 440 | if [catch {exec gzip $file}] { |
---|
| 441 | exec echo "\n----------------------------------------------" >> $expnam.LST |
---|
| 442 | exec echo " Archiving $expnam.EXP as $file " >> $expnam.LST |
---|
| 443 | exec echo "----------------------------------------------\n" >> $expnam.LST |
---|
| 444 | } else { |
---|
| 445 | exec echo "\n----------------------------------------------" >> $expnam.LST |
---|
| 446 | exec echo " Archiving $expnam.EXP as $file.gz " >> $expnam.LST |
---|
| 447 | exec echo "----------------------------------------------\n" >> $expnam.LST |
---|
| 448 | } |
---|
| 449 | } |
---|
| 450 | } errmsg |
---|
| 451 | if {$errmsg != ""} { |
---|
| 452 | tk_dialog .warn Confirm "Error in archive: $errmsg" warning 0 OK |
---|
| 453 | } |
---|
| 454 | } |
---|
[16] | 455 | # add a header |
---|
| 456 | exphistory add " EXPGUI [lindex $expgui(Revision) 1] [lindex $expmap(Revision) 1] ($expgui(changed) changes) -- [clock format [clock seconds]]" |
---|
[10] | 457 | # now save the file |
---|
| 458 | expwrite $expfile |
---|
[14] | 459 | set expgui(changed) 0 |
---|
[16] | 460 | set expgui(expModifiedLast) [file mtime $expfile] |
---|
| 461 | set expgui(last_History) [string trim [lindex [exphistory last] 1]] |
---|
| 462 | wm title . $expfile |
---|
| 463 | set expgui(titleunchanged) 1 |
---|
[10] | 464 | } |
---|
| 465 | |
---|
| 466 | # set the number of phases on the phase page |
---|
| 467 | proc setphases {} { |
---|
| 468 | global expgui expmap |
---|
| 469 | eval destroy [pack slaves $expgui(phaseFrame).top.ps] |
---|
| 470 | foreach num $expmap(phaselist) { |
---|
| 471 | pack [button $expgui(phaseFrame).top.ps.$num -text $num \ |
---|
| 472 | -command "SelectOnePhase $num"] -side left |
---|
| 473 | } |
---|
| 474 | # set the default data to be the first phase and the first histogram |
---|
| 475 | set expgui(lasthist) [lindex $expmap(powderlist) 0] |
---|
| 476 | } |
---|
| 477 | |
---|
| 478 | # Procedure to respond to changes the phase. |
---|
| 479 | # This loads the "phases" widgets with data corresponding to the selected phase. |
---|
| 480 | proc SelectOnePhase {num} { |
---|
| 481 | global entryvar entrycmd expmap expgui |
---|
| 482 | foreach n $expmap(phaselist) { |
---|
| 483 | if {$n == $num} { |
---|
| 484 | $expgui(phaseFrame).top.ps.$num config -relief sunken |
---|
| 485 | } else { |
---|
| 486 | $expgui(phaseFrame).top.ps.$n config -relief raised |
---|
| 487 | } |
---|
| 488 | } |
---|
| 489 | set crsPhase $num |
---|
| 490 | if {$crsPhase == ""} return |
---|
| 491 | set expgui(curPhase) $crsPhase |
---|
| 492 | # we have a phase |
---|
| 493 | |
---|
| 494 | # disable traces on entryvar for right now |
---|
| 495 | set entrycmd(trace) 0 |
---|
| 496 | |
---|
| 497 | ########################################################## |
---|
| 498 | ###### SECTION: ASSIGNMENT OF DATA VARIABLES ########## |
---|
| 499 | ########################################################## |
---|
| 500 | # phase title |
---|
| 501 | set entrycmd(phasename) {} |
---|
| 502 | set entryvar(phasename) [phaseinfo $crsPhase name] |
---|
| 503 | # cell parameters & flags |
---|
| 504 | foreach ent {a b c alpha beta gamma cellref celldamp} { |
---|
| 505 | set entrycmd($ent) "phaseinfo $crsPhase $ent" |
---|
| 506 | set entryvar($ent) [phaseinfo $crsPhase $ent] |
---|
| 507 | } |
---|
| 508 | |
---|
| 509 | #Procedure call: DisplayU -- Display Anisotropic/Isotropic widget or disable |
---|
| 510 | # initialize to diasbled |
---|
| 511 | DisplayAtom 0 0 |
---|
| 512 | DisplayU 0 0 |
---|
| 513 | DisplayRefFlags 0 0 |
---|
| 514 | $expgui(EditingAtoms) config -text "" |
---|
| 515 | |
---|
| 516 | DisplayAllAtoms |
---|
| 517 | |
---|
| 518 | # enable traces on entryvar now |
---|
| 519 | set entrycmd(trace) 1 |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | set expgui(noreenterDisplayAllAtoms) 0 |
---|
| 523 | # Populate expgui(atomlistbox) (ScrolledListBox) with atoms from selected phase. |
---|
| 524 | proc DisplayAllAtoms {"mode reset"} { |
---|
| 525 | global entryvar entrycmd expmap expgui |
---|
| 526 | # if it does not show, dont bother |
---|
| 527 | if {$expgui(pagenow) != "phaseFrame"} return |
---|
| 528 | if {$expgui(curPhase) == ""} return |
---|
| 529 | if $expgui(noreenterDisplayAllAtoms) return |
---|
| 530 | |
---|
| 531 | set expgui(noreenterDisplayAllAtoms) 1 |
---|
| 532 | if {$mode != "reset"} { |
---|
| 533 | set selectlist [$expgui(atomlistbox) curselection] |
---|
| 534 | set pos [lindex [$expgui(atomlistbox) yview] 0] |
---|
| 535 | } |
---|
| 536 | $expgui(atomlistbox) delete 0 end |
---|
| 537 | # loop over atoms |
---|
| 538 | set maxline I |
---|
| 539 | set phase $expgui(curPhase) |
---|
| 540 | set atomlist {} |
---|
| 541 | if {$expgui(asorttype) == "type"} { |
---|
| 542 | # sort on atom type |
---|
| 543 | foreach atom $expmap(atomlist_$phase) { |
---|
| 544 | lappend atomlist "$atom [atominfo $phase $atom type] $phase" |
---|
| 545 | } |
---|
| 546 | set expmap(atomlistboxcontents) [lsort -ascii -index 1 $atomlist] |
---|
| 547 | } elseif {$expgui(asorttype) == "number"} { |
---|
| 548 | # sort on atom number |
---|
| 549 | foreach atom $expmap(atomlist_$phase) { |
---|
| 550 | lappend atomlist "$atom $atom $phase" |
---|
| 551 | } |
---|
| 552 | set expmap(atomlistboxcontents) [lsort -integer -index 1 $atomlist] |
---|
| 553 | } elseif {$expgui(asorttype) == "x"} { |
---|
| 554 | # sort on x |
---|
| 555 | foreach atom $expmap(atomlist_$phase) { |
---|
| 556 | lappend atomlist "$atom [atominfo $phase $atom x] $phase" |
---|
| 557 | } |
---|
| 558 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
| 559 | } elseif {$expgui(asorttype) == "y"} { |
---|
| 560 | # sort on y |
---|
| 561 | foreach atom $expmap(atomlist_$phase) { |
---|
| 562 | lappend atomlist "$atom [atominfo $phase $atom y] $phase" |
---|
| 563 | } |
---|
| 564 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
| 565 | } elseif {$expgui(asorttype) == "z"} { |
---|
| 566 | # sort on z |
---|
| 567 | foreach atom $expmap(atomlist_$phase) { |
---|
| 568 | lappend atomlist "$atom [atominfo $phase $atom z] $phase" |
---|
| 569 | } |
---|
| 570 | set expmap(atomlistboxcontents) [lsort -real -index 1 $atomlist] |
---|
| 571 | } else { |
---|
| 572 | error "Bad expgui(asorttype = $expgui(asorttype)" |
---|
| 573 | } |
---|
| 574 | |
---|
| 575 | foreach tuple $expmap(atomlistboxcontents) { |
---|
| 576 | set atom [lindex $tuple 0] |
---|
| 577 | set phase [lindex $tuple 2] |
---|
| 578 | set refflag {} |
---|
| 579 | foreach type {x u f} { |
---|
| 580 | if {[atominfo $phase $atom ${type}ref]} { |
---|
| 581 | append refflag "[string toupper $type][atominfo $phase $atom ${type}damp] " |
---|
| 582 | } else { |
---|
| 583 | append refflag " [atominfo $phase $atom ${type}damp] " |
---|
| 584 | } |
---|
| 585 | } |
---|
| 586 | set line [format "%3d %-6s %-6s %8s %10.6f%10.6f%10.6f%9.4f" \ |
---|
| 587 | $atom \ |
---|
| 588 | [atominfo $phase $atom label] \ |
---|
| 589 | [atominfo $phase $atom type] \ |
---|
| 590 | $refflag \ |
---|
| 591 | [atominfo $phase $atom x] \ |
---|
| 592 | [atominfo $phase $atom y] \ |
---|
| 593 | [atominfo $phase $atom z] \ |
---|
| 594 | [atominfo $phase $atom frac] |
---|
| 595 | ] |
---|
| 596 | # add temperature factors (iso/anoiso) |
---|
| 597 | if {[atominfo $phase $atom temptype] == "A"} { |
---|
| 598 | set maxline A |
---|
| 599 | append line [format " %9.5f%9.5f%9.5f%9.5f%9.5f%9.5f" \ |
---|
| 600 | [atominfo $phase $atom U11] \ |
---|
| 601 | [atominfo $phase $atom U22] \ |
---|
| 602 | [atominfo $phase $atom U33] \ |
---|
| 603 | [atominfo $phase $atom U12] \ |
---|
| 604 | [atominfo $phase $atom U23] \ |
---|
| 605 | [atominfo $phase $atom U13] |
---|
| 606 | ] |
---|
| 607 | } else { |
---|
| 608 | append line [format " %9.5f" \ |
---|
| 609 | [atominfo $phase $atom Uiso] |
---|
| 610 | ] |
---|
| 611 | } |
---|
| 612 | $expgui(atomlistbox) insert end $line |
---|
| 613 | } |
---|
| 614 | $expgui(atomtitle) delete 0 end |
---|
| 615 | if {$maxline == "A"} { |
---|
| 616 | $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s %s" \ |
---|
| 617 | " name " "type " "ref/damp " "fractional coordinates " \ |
---|
| 618 | " Occupancy" \ |
---|
| 619 | "Uiso/Uij "] |
---|
| 620 | } else { |
---|
| 621 | $expgui(atomtitle) insert end [format "%10s %6s %8s %30s%9s %s" \ |
---|
| 622 | " name " "type " "ref/damp " "fractional coordinates " \ |
---|
| 623 | " Occupancy" \ |
---|
| 624 | "Uiso"] |
---|
| 625 | } |
---|
| 626 | if {$mode != "reset"} { |
---|
| 627 | foreach i $selectlist { |
---|
| 628 | $expgui(atomlistbox) selection set $i |
---|
| 629 | $expgui(atomlistbox) yview moveto $pos |
---|
| 630 | } |
---|
| 631 | } |
---|
| 632 | set expgui(noreenterDisplayAllAtoms) 0 |
---|
| 633 | } |
---|
| 634 | |
---|
| 635 | # Procedure to select all atoms in response to a right-click |
---|
| 636 | proc SelectAllAtoms {} { |
---|
| 637 | global expgui |
---|
| 638 | $expgui(atomlistbox) selection set 0 end |
---|
| 639 | # just in case this was called at the wrong time: |
---|
| 640 | editRecord |
---|
| 641 | } |
---|
| 642 | |
---|
| 643 | # Procedure to respond to left mouse release in the atoms Pane |
---|
| 644 | proc editRecord { args } { |
---|
| 645 | global entrycmd expgui |
---|
| 646 | set selectIndex [$expgui(atomlistbox) curselection] |
---|
| 647 | # disable traces on entryvar for right now |
---|
| 648 | set entrycmd(trace) 0 |
---|
| 649 | |
---|
| 650 | if {[llength $selectIndex] == 0} { |
---|
| 651 | puts "How did this happen: [$expgui(atomlistbox) curselection]" |
---|
| 652 | } elseif {[llength $selectIndex] == 1} { |
---|
| 653 | editOneRecord $selectIndex |
---|
| 654 | } else { |
---|
| 655 | editMultipleRecords $selectIndex |
---|
| 656 | } |
---|
| 657 | # reenable traces on entryvar |
---|
| 658 | set entrycmd(trace) 1 |
---|
| 659 | # repaint the atoms box in case anything was changed |
---|
| 660 | # DisplayAllAtoms noreset |
---|
| 661 | } |
---|
| 662 | |
---|
| 663 | proc editOneRecord { AtomIndex } { |
---|
| 664 | global expmap expgui |
---|
| 665 | # get atom number & phase |
---|
| 666 | set tuple [lindex $expmap(atomlistboxcontents) $AtomIndex] |
---|
| 667 | set atomnum [lindex $tuple 0] |
---|
| 668 | set p [lindex $tuple 2] |
---|
| 669 | DisplayU $atomnum $p |
---|
| 670 | DisplayAtom $atomnum $p |
---|
| 671 | DisplayRefFlags $atomnum $p |
---|
| 672 | $expgui(EditingAtoms) config -text "Editing atom #$atomnum -- [atominfo $p $atomnum label]" |
---|
| 673 | } |
---|
| 674 | |
---|
| 675 | # this will not work for a multi-phase list of atoms (yet) |
---|
| 676 | proc editMultipleRecords { AtomIndexList } { |
---|
| 677 | global expmap expgui |
---|
| 678 | set numberList {} |
---|
| 679 | # current phase |
---|
| 680 | set p $expgui(curPhase) |
---|
| 681 | foreach AtomIndex $AtomIndexList { |
---|
| 682 | # get atom number & phase |
---|
| 683 | set tuple [lindex $expmap(atomlistboxcontents) $AtomIndex] |
---|
| 684 | lappend numberList [lindex $tuple 0] |
---|
| 685 | # set p [lindex $tuple 2] |
---|
| 686 | } |
---|
| 687 | # this needs to track by phase |
---|
| 688 | $expgui(EditingAtoms) config -text \ |
---|
| 689 | "Set refinement options: atoms [CompressList $numberList]" |
---|
| 690 | DisplayU 0 0 |
---|
| 691 | DisplayAtom 0 0 |
---|
| 692 | # this needs to track by phase |
---|
| 693 | DisplayRefFlags $numberList $p |
---|
| 694 | } |
---|
| 695 | |
---|
| 696 | # format a string of numbers to save space, e.g. "1 2 3 4 6 7 19 13 14 15" |
---|
| 697 | # becomes "1-4,6,7,13-15,19" |
---|
| 698 | proc CompressList {numberList} { |
---|
| 699 | # format the number list to save space |
---|
| 700 | set lastnum -99 |
---|
| 701 | set flist {} |
---|
| 702 | set count 0 |
---|
| 703 | foreach num [lsort -integer $numberList] { |
---|
| 704 | set next [expr $lastnum+1] |
---|
| 705 | if {$num != $next} { |
---|
| 706 | if {$count == 0 && $flist != ""} { |
---|
| 707 | append flist ",$num" |
---|
| 708 | } elseif {$count == 1 && $flist != ""} { |
---|
| 709 | append flist ",$lastnum,$num" |
---|
| 710 | } elseif {$flist != ""} { |
---|
| 711 | append flist "-$lastnum,$num" |
---|
| 712 | } else { |
---|
| 713 | append flist "$num" |
---|
| 714 | } |
---|
| 715 | set lastnum $num |
---|
| 716 | set count 0 |
---|
| 717 | } else { |
---|
| 718 | incr count |
---|
| 719 | incr lastnum |
---|
| 720 | } |
---|
| 721 | } |
---|
| 722 | if {$count == 1 && $flist != ""} { |
---|
| 723 | append flist ",$lastnum" |
---|
| 724 | } elseif {$flist != "" && $count > 1} { |
---|
| 725 | append flist "-$lastnum" |
---|
| 726 | } |
---|
| 727 | return $flist |
---|
| 728 | } |
---|
| 729 | |
---|
| 730 | # Procedure to display Isotropic or Anisotropic temperature factors |
---|
| 731 | # Changes the display to one entry widget for Isotropic motion OR |
---|
| 732 | # 6 entry widgets for Anisotropic motion in Frame3. |
---|
| 733 | # or disables the widet entirly if atom = 0 |
---|
| 734 | proc DisplayU { atomnum p} { |
---|
| 735 | global expgui entryvar entrycmd |
---|
| 736 | if {$atomnum == 0} { |
---|
| 737 | set iOrA disable |
---|
| 738 | } else { |
---|
| 739 | set iOrA [atominfo $p $atomnum temptype] |
---|
| 740 | } |
---|
| 741 | |
---|
| 742 | set firstbox [lindex $expgui(anisolabels) 0] |
---|
| 743 | if { $iOrA == "A" } { |
---|
| 744 | $firstbox config -text "U11 " |
---|
| 745 | foreach item $expgui(anisolabels) { |
---|
| 746 | $item config -fg black |
---|
| 747 | } |
---|
| 748 | foreach item $expgui(anisoentry) var {U11 U22 U33 U12 U13 U23} { |
---|
| 749 | set entrycmd($var) "atominfo $p $atomnum $var" |
---|
| 750 | set entryvar($var) [eval $entrycmd($var)] |
---|
| 751 | $item config -fg black -state normal -bg white |
---|
| 752 | } |
---|
| 753 | } elseif { $iOrA == "I" || $iOrA == "disable"} { |
---|
| 754 | foreach item $expgui(anisolabels) { |
---|
| 755 | # $item config -fg grey |
---|
| 756 | $item config -fg beige |
---|
| 757 | } |
---|
| 758 | foreach item [lrange $expgui(anisoentry) 1 end] \ |
---|
| 759 | var {U22 U33 U12 U13 U23} { |
---|
| 760 | set entrycmd($var) "" |
---|
| 761 | set entryvar($var) "" |
---|
| 762 | $item config -fg beige -bg beige -state disabled |
---|
| 763 | } |
---|
| 764 | if { $iOrA == "disable"} { |
---|
| 765 | set entrycmd($var) "" |
---|
| 766 | set entryvar($var) "" |
---|
| 767 | # [lindex $expgui(anisoentry) 0] config -fg white -state disabled |
---|
| 768 | [lindex $expgui(anisoentry) 0] config -fg beige -bg beige -state disabled |
---|
| 769 | } else { |
---|
| 770 | set entrycmd(U11) "atominfo $p $atomnum Uiso" |
---|
| 771 | set entryvar(U11) [eval $entrycmd(U11)] |
---|
| 772 | $firstbox config -text Uiso -fg black |
---|
| 773 | [lindex $expgui(anisoentry) 0] config -fg black -bg white -state normal |
---|
| 774 | } |
---|
| 775 | } |
---|
| 776 | } |
---|
| 777 | |
---|
| 778 | # need to think about multiple phases |
---|
| 779 | |
---|
| 780 | # Procedure to display refinement flags |
---|
| 781 | proc DisplayRefFlags { atomnum p} { |
---|
| 782 | global expgui entryvar entrycmd |
---|
| 783 | if {$atomnum == 0} { |
---|
| 784 | foreach label $expgui(atomreflbl) { |
---|
| 785 | $label config -fg beige |
---|
| 786 | } |
---|
| 787 | foreach entry $expgui(atomref) { |
---|
| 788 | $entry config -state disabled -fg beige -bg beige |
---|
| 789 | } |
---|
| 790 | return |
---|
| 791 | } |
---|
| 792 | foreach label $expgui(atomreflbl) { |
---|
| 793 | $label config -fg black |
---|
| 794 | } |
---|
| 795 | foreach entry $expgui(atomref) { |
---|
| 796 | $entry config -state normal -fg black -bg beige |
---|
| 797 | } |
---|
| 798 | foreach var {xref uref fref xdamp udamp fdamp} { |
---|
| 799 | set entrycmd($var) "atominfo $p [list $atomnum] $var" |
---|
| 800 | set entryvar($var) [eval $entrycmd($var)] |
---|
| 801 | } |
---|
| 802 | } |
---|
| 803 | |
---|
| 804 | # Procedure to display an atom in the atom edit boxes |
---|
| 805 | proc DisplayAtom { atomnum p} { |
---|
| 806 | global expgui entryvar entrycmd |
---|
| 807 | if {$atomnum == 0} { |
---|
| 808 | foreach label $expgui(atomlabels) { |
---|
| 809 | $label config -fg beige |
---|
| 810 | } |
---|
| 811 | foreach entry $expgui(atomentry) { |
---|
| 812 | $entry config -state disabled -fg beige -bg beige |
---|
| 813 | } |
---|
| 814 | return |
---|
| 815 | } |
---|
| 816 | foreach label $expgui(atomlabels) { |
---|
| 817 | $label config -fg black |
---|
| 818 | } |
---|
| 819 | foreach entry $expgui(atomentry) { |
---|
| 820 | $entry config -state normal -fg black -bg white |
---|
| 821 | } |
---|
| 822 | foreach var {x y z label frac } { |
---|
| 823 | set entrycmd($var) "atominfo $p $atomnum $var" |
---|
| 824 | set entryvar($var) [eval $entrycmd($var)] |
---|
| 825 | } |
---|
| 826 | } |
---|
| 827 | |
---|
| 828 | # update the histogram list |
---|
| 829 | # to do: show histogram ref flags? |
---|
| 830 | proc sethistlist {} { |
---|
| 831 | global expgui expmap |
---|
| 832 | set expgui(curhist) 0 |
---|
| 833 | foreach lbox $expgui(HistSelectList) { |
---|
| 834 | $lbox.title delete 0 end |
---|
| 835 | $lbox.lbox delete 0 end |
---|
| 836 | if {$expgui(globalmode) != 0} { |
---|
| 837 | $lbox.lbox config -selectmode extended |
---|
| 838 | } else { |
---|
| 839 | $lbox.lbox config -selectmode browse |
---|
| 840 | } |
---|
| 841 | } |
---|
| 842 | # disable the unallowed pages in all mode |
---|
| 843 | if {$expgui(globalmode) == 6} { |
---|
| 844 | foreach pair $expgui(GlobalModeAllDisable) { |
---|
| 845 | if {$expgui(pagenow) == [lindex $pair 0]} { |
---|
| 846 | if !$expgui(havetix) { |
---|
[16] | 847 | RaisePage lsFrame |
---|
[10] | 848 | } else { |
---|
[16] | 849 | .n raise lsPane |
---|
| 850 | set expgui(pagenow) lsFrame |
---|
[10] | 851 | } |
---|
| 852 | } |
---|
| 853 | eval [lindex $pair 1] -state disabled |
---|
| 854 | } |
---|
| 855 | } else { |
---|
| 856 | foreach pair $expgui(GlobalModeAllDisable) { |
---|
| 857 | eval [lindex $pair 1] -state normal |
---|
| 858 | } |
---|
| 859 | } |
---|
| 860 | if {$expgui(hsorttype) == "type"} { |
---|
| 861 | # sort on histogram type |
---|
| 862 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
| 863 | lappend histlist "$h [string range $expmap(htype_$h) 1 2]" |
---|
| 864 | } |
---|
| 865 | set expmap(histlistboxcontents) [lsort -ascii -index 1 $histlist] |
---|
| 866 | } elseif {$expgui(hsorttype) == "number"} { |
---|
| 867 | # sort on histogram number |
---|
| 868 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
| 869 | lappend histlist "$h $h" |
---|
| 870 | } |
---|
| 871 | set expmap(histlistboxcontents) [lsort -integer -index 1 $histlist] |
---|
| 872 | } elseif {$expgui(hsorttype) == "bank"} { |
---|
| 873 | # sort on original bank number |
---|
| 874 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
| 875 | lappend histlist "$h [histinfo $h bank]" |
---|
| 876 | } |
---|
| 877 | set expmap(histlistboxcontents) [lsort -integer -index 1 $histlist] |
---|
| 878 | } elseif {$expgui(hsorttype) == "angle"} { |
---|
| 879 | # sort on wavelength (CW) or angle (E disp.) |
---|
| 880 | foreach h [lsort -integer -increasing $expmap(powderlist)] { |
---|
| 881 | if {[string range $expmap(htype_$h) 2 2] == "T"} { |
---|
| 882 | set det [format %8.2f [histinfo $h tofangle]] |
---|
| 883 | } elseif {[string range $expmap(htype_$h) 2 2] == "C"} { |
---|
| 884 | set det [format %8.5f [histinfo $h lam1]] |
---|
| 885 | } elseif {[string range $expmap(htype_$h) 2 2] == "E"} { |
---|
| 886 | set det [format %8.2f [histinfo $h lam1]] |
---|
| 887 | } else { |
---|
| 888 | set det {} |
---|
| 889 | } |
---|
| 890 | lappend histlist "$h $det" |
---|
| 891 | } |
---|
| 892 | set expmap(histlistboxcontents) [lsort -real -index 1 $histlist] |
---|
| 893 | } |
---|
| 894 | # title field needs to match longest title |
---|
| 895 | foreach lbox $expgui(HistSelectList) { |
---|
| 896 | $lbox.title insert end [format "%2s %s %4s %8s %-67s" \ |
---|
| 897 | "h#" \ |
---|
| 898 | type \ |
---|
| 899 | bank \ |
---|
| 900 | "ang/wave" \ |
---|
| 901 | " title" \ |
---|
| 902 | ] |
---|
| 903 | } |
---|
| 904 | foreach tuple $expmap(histlistboxcontents) { |
---|
| 905 | set h [lindex $tuple 0] |
---|
| 906 | |
---|
| 907 | if {$expgui(globalmode) == 1} { |
---|
| 908 | if {[string range $expmap(htype_$h) 2 2] != "T"} continue |
---|
| 909 | } elseif {$expgui(globalmode) == 2} { |
---|
| 910 | if {[string range $expmap(htype_$h) 1 2] != "NC"} continue |
---|
| 911 | } elseif {$expgui(globalmode) == 3} { |
---|
| 912 | if {[string range $expmap(htype_$h) 1 2] != "XC" || \ |
---|
| 913 | [histinfo $h lam2] == 0.0} continue |
---|
| 914 | } elseif {$expgui(globalmode) == 4} { |
---|
| 915 | if {[string range $expmap(htype_$h) 1 2] != "XC" || \ |
---|
| 916 | [histinfo $h lam2] != 0.0} continue |
---|
| 917 | } elseif {$expgui(globalmode) == 5} { |
---|
| 918 | if {[string range $expmap(htype_$h) 1 2] != "XE"} continue |
---|
| 919 | } |
---|
| 920 | |
---|
| 921 | if {[string range $expmap(htype_$h) 2 2] == "T"} { |
---|
| 922 | set det [format %8.2f [histinfo $h tofangle]] |
---|
| 923 | } elseif {[string range $expmap(htype_$h) 2 2] == "C"} { |
---|
| 924 | set det [format %8.5f [histinfo $h lam1]] |
---|
| 925 | } elseif {[string range $expmap(htype_$h) 2 2] == "E"} { |
---|
| 926 | set det [format %8.2f [histinfo $h lam1]] |
---|
| 927 | } else { |
---|
| 928 | set det {} |
---|
| 929 | } |
---|
| 930 | foreach lbox $expgui(HistSelectList) { |
---|
| 931 | $lbox.lbox insert end [format "%2d %s %4d %8s %-67s" \ |
---|
| 932 | $h \ |
---|
| 933 | [string range $expmap(htype_$h) 1 2] \ |
---|
| 934 | [histinfo $h bank] \ |
---|
| 935 | $det \ |
---|
| 936 | [string range [histinfo $h title] 0 66] \ |
---|
| 937 | ] |
---|
| 938 | } |
---|
| 939 | } |
---|
| 940 | foreach set $expgui(frameactionlist) { |
---|
| 941 | if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1] |
---|
| 942 | } |
---|
| 943 | } |
---|
| 944 | |
---|
| 945 | #----------------------------------------------------------------------- |
---|
| 946 | # ----------- draw Histogram page |
---|
| 947 | #----------------------------------------------------------------------- |
---|
| 948 | proc DisplayHistogram {} { |
---|
| 949 | global expgui entrycmd entryvar expmap |
---|
| 950 | |
---|
| 951 | # display the selected histograms |
---|
| 952 | $expgui(histFrame).hs.lbox selection clear 0 end |
---|
| 953 | foreach h $expgui(curhist) { |
---|
| 954 | $expgui(histFrame).hs.lbox selection set $h |
---|
| 955 | } |
---|
| 956 | |
---|
| 957 | # disable traces on entryvar for right now |
---|
| 958 | set entrycmd(trace) 0 |
---|
| 959 | |
---|
| 960 | # get histogram list |
---|
| 961 | set histlist {} |
---|
| 962 | foreach item $expgui(curhist) { |
---|
| 963 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
| 964 | } |
---|
| 965 | if {$expgui(globalmode) != 0} { |
---|
| 966 | set expgui(backtermlbl) "" |
---|
| 967 | set expgui(backtypelbl) "" |
---|
[14] | 968 | foreach var {bref bdamp} { |
---|
[10] | 969 | set entrycmd($var) "histinfo [list $histlist] $var" |
---|
| 970 | set entryvar($var) [histinfo [lindex $histlist 0] $var] |
---|
| 971 | } |
---|
| 972 | } else { |
---|
| 973 | set hist $histlist |
---|
| 974 | set terms [histinfo $hist backterms] |
---|
| 975 | set expgui(backtermlbl) "($terms terms)" |
---|
| 976 | set expgui(backtypelbl) "Function type [histinfo $hist backtype]" |
---|
[14] | 977 | foreach var {bref bdamp} { |
---|
[10] | 978 | set entrycmd($var) "histinfo $hist $var" |
---|
| 979 | set entryvar($var) [eval $entrycmd($var)] |
---|
| 980 | } |
---|
| 981 | } |
---|
[14] | 982 | # Top box |
---|
[10] | 983 | if {$expgui(globalmode) != 0} { |
---|
| 984 | $expgui(histFrame).top.txt config \ |
---|
| 985 | -text "Selected Histograms: [CompressList $histlist]" |
---|
| 986 | grid $expgui(histFrame).top -column 1 -row 0 -sticky nsew |
---|
| 987 | set expgui(bkglbl) "Globally Edit Background" |
---|
| 988 | } else { |
---|
| 989 | grid forget $expgui(histFrame).top |
---|
| 990 | set expgui(bkglbl) "Edit Background" |
---|
| 991 | } |
---|
| 992 | |
---|
| 993 | # diffractometer constants |
---|
| 994 | foreach var {lam1 lam2 kratio pola ipola ddamp zero \ |
---|
| 995 | wref pref dcref daref ratref ttref zref } { |
---|
| 996 | set entrycmd($var) "histinfo [list $histlist] $var" |
---|
| 997 | set entryvar($var) [histinfo [lindex $histlist 0] $var] |
---|
| 998 | } |
---|
| 999 | |
---|
| 1000 | eval destroy [grid slaves $expgui(diffBox)] |
---|
| 1001 | if {$expgui(globalmode) == 0} { |
---|
| 1002 | if {[string range $expmap(htype_$hist) 2 2] == "T"} { |
---|
| 1003 | #------ |
---|
| 1004 | # TOF | |
---|
| 1005 | #------ |
---|
| 1006 | grid [ label $expgui(diffBox).lDCrc -text "Refine DIFC" ] \ |
---|
| 1007 | -column 1 -row 1 |
---|
| 1008 | grid [ checkbutton $expgui(diffBox).rfDCrc -variable entryvar(dcref) ] \ |
---|
| 1009 | -column 2 -row 1 |
---|
| 1010 | grid [ label $expgui(diffBox).lDCdifc -text DIFC ] \ |
---|
| 1011 | -column 3 -row 1 -sticky w |
---|
| 1012 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
| 1013 | -width 15 ] -column 4 -row 1 |
---|
| 1014 | # |
---|
| 1015 | grid [ label $expgui(diffBox).lDCra -text "Refine DIFA" ] \ |
---|
| 1016 | -column 1 -row 2 |
---|
| 1017 | grid [ checkbutton $expgui(diffBox).rfDCra -variable entryvar(daref) ] \ |
---|
| 1018 | -column 2 -row 2 |
---|
| 1019 | grid [ label $expgui(diffBox).lDCdifa -text DIFA ] \ |
---|
| 1020 | -column 3 -row 2 |
---|
| 1021 | grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \ |
---|
| 1022 | -width 15 ] -column 4 -row 2 |
---|
| 1023 | # |
---|
| 1024 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
| 1025 | -column 3 -row 3 |
---|
| 1026 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
| 1027 | -width 15 ] -column 4 -row 3 |
---|
| 1028 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1029 | -column 1 -row 3 -sticky w |
---|
| 1030 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1031 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1032 | } elseif {[string range $expmap(htype_$hist) 1 2] == "NC"} { |
---|
| 1033 | #--------------- |
---|
| 1034 | # CW - neutron | |
---|
| 1035 | #--------------- |
---|
| 1036 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
| 1037 | -column 1 -row 1 |
---|
| 1038 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
| 1039 | -column 2 -row 1 |
---|
| 1040 | grid [ label $expgui(diffBox).lDCdifc -text wave ] \ |
---|
| 1041 | -column 3 -row 1 -sticky w |
---|
| 1042 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
| 1043 | -width 15 ] -column 4 -row 1 |
---|
| 1044 | # |
---|
| 1045 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1046 | -column 1 -row 3 -sticky w |
---|
| 1047 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1048 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1049 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
| 1050 | -column 3 -row 3 |
---|
| 1051 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
| 1052 | -width 15 ] -column 4 -row 3 |
---|
| 1053 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XC" && \ |
---|
| 1054 | [histinfo $hist lam2] == 0.0} { |
---|
| 1055 | #-------------------------- |
---|
| 1056 | # CW - x-ray 1 wavelength | |
---|
| 1057 | #-------------------------- |
---|
| 1058 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
| 1059 | -column 1 -row 1 |
---|
| 1060 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
| 1061 | -column 2 -row 1 |
---|
| 1062 | grid [ label $expgui(diffBox).lDCdifc -text wave ] \ |
---|
| 1063 | -column 3 -row 1 -sticky w |
---|
| 1064 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
| 1065 | -width 15 ] -column 4 -row 1 |
---|
| 1066 | # |
---|
| 1067 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1068 | -column 1 -row 3 -sticky w |
---|
| 1069 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1070 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1071 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
| 1072 | -column 3 -row 3 |
---|
| 1073 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
| 1074 | -width 15 ] -column 4 -row 3 |
---|
| 1075 | # |
---|
| 1076 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1077 | -column 1 -row 4 -sticky w |
---|
| 1078 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1079 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1080 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
| 1081 | -column 3 -row 4 |
---|
| 1082 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
| 1083 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
| 1084 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
| 1085 | -column 5 -row 4 |
---|
| 1086 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
| 1087 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
| 1088 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XC"} { |
---|
| 1089 | #--------------------------- |
---|
| 1090 | # CW - x-ray 2 wavelengths | |
---|
| 1091 | #--------------------------- |
---|
| 1092 | grid [ label $expgui(diffBox).lDCdifc -text wavelengths ] \ |
---|
| 1093 | -column 3 -row 1 -sticky w |
---|
| 1094 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
| 1095 | -width 15 ] -column 4 -row 1 |
---|
| 1096 | grid [ entry $expgui(diffBox).eDCdifa -textvariable entryvar(lam2) \ |
---|
| 1097 | -width 15 ] -column 5 -row 1 |
---|
| 1098 | # |
---|
| 1099 | grid [ label $expgui(diffBox).lDCrref -text "Refine ratio" ] \ |
---|
| 1100 | -column 1 -row 2 -sticky w |
---|
| 1101 | grid [ checkbutton $expgui(diffBox).rfDCrref \ |
---|
| 1102 | -variable entryvar(ratref) ] -column 2 -row 2 |
---|
| 1103 | grid [ label $expgui(diffBox).lDCratio -text Ratio ] \ |
---|
| 1104 | -column 3 -row 2 |
---|
| 1105 | grid [ entry $expgui(diffBox).eDCkratio \ |
---|
| 1106 | -textvariable entryvar(kratio) \ |
---|
| 1107 | -width 15 ] -column 4 -row 2 |
---|
| 1108 | # |
---|
| 1109 | grid [ label $expgui(diffBox).lDCzero -text "Zero"] \ |
---|
| 1110 | -column 3 -row 3 |
---|
| 1111 | grid [ entry $expgui(diffBox).eDCzero -textvariable entryvar(zero) \ |
---|
| 1112 | -width 15 ] -column 4 -row 3 |
---|
| 1113 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1114 | -column 1 -row 3 -sticky w |
---|
| 1115 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1116 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1117 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1118 | -column 1 -row 4 -sticky w |
---|
| 1119 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1120 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1121 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
| 1122 | -column 3 -row 4 |
---|
| 1123 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
| 1124 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
| 1125 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
| 1126 | -column 5 -row 4 |
---|
| 1127 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
| 1128 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
| 1129 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1130 | } elseif {[string range $expmap(htype_$hist) 1 2] == "XE"} { |
---|
| 1131 | #------------- |
---|
| 1132 | # ED - x-ray | |
---|
| 1133 | #------------- |
---|
| 1134 | grid [ label $expgui(diffBox).lDC1 -text "Refine 2theta" ] \ |
---|
| 1135 | -column 1 -row 1 |
---|
| 1136 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(ttref) ] \ |
---|
| 1137 | -column 2 -row 1 |
---|
| 1138 | grid [ label $expgui(diffBox).lDCdifc -text 2Theta ] \ |
---|
| 1139 | -column 3 -row 1 -sticky w |
---|
| 1140 | grid [ entry $expgui(diffBox).eDCdifc -textvariable entryvar(lam1) \ |
---|
| 1141 | -width 15 ] -column 4 -row 1 |
---|
| 1142 | # |
---|
| 1143 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1144 | -column 1 -row 4 -sticky w |
---|
| 1145 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1146 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1147 | grid [ label $expgui(diffBox).lDCpola -text POLA ] \ |
---|
| 1148 | -column 3 -row 4 |
---|
| 1149 | grid [ entry $expgui(diffBox).eDCpola \ |
---|
| 1150 | -textvariable entryvar(pola) -width 15 ] -column 4 -row 4 |
---|
| 1151 | grid [ label $expgui(diffBox).lDCipola -text "IPOLA" ] \ |
---|
| 1152 | -column 5 -row 4 |
---|
| 1153 | grid [ entry $expgui(diffBox).eDCipola -width 2 \ |
---|
| 1154 | -textvariable entryvar(ipola)] -column 6 -row 4 |
---|
| 1155 | } |
---|
| 1156 | } elseif {$expgui(globalmode) == 1} { |
---|
| 1157 | #------------- |
---|
| 1158 | # Global TOF | |
---|
| 1159 | #------------- |
---|
| 1160 | grid [ label $expgui(diffBox).lDCrc -text "Refine DIFC" ] \ |
---|
| 1161 | -column 1 -row 1 |
---|
| 1162 | grid [ checkbutton $expgui(diffBox).rfDCrc -variable entryvar(dcref) ] \ |
---|
| 1163 | -column 2 -row 1 |
---|
| 1164 | grid [button $expgui(diffBox).bDCdifc -text "Set DIFC Globally" \ |
---|
| 1165 | -command "editglobalparm histinfo difc {DIFC}"] -column 3 -row 1 |
---|
| 1166 | # |
---|
| 1167 | grid [ label $expgui(diffBox).lDCra -text "Refine DIFA" ] \ |
---|
| 1168 | -column 1 -row 2 |
---|
| 1169 | grid [ checkbutton $expgui(diffBox).rfDCra -variable entryvar(daref) ] \ |
---|
| 1170 | -column 2 -row 2 |
---|
| 1171 | grid [ button $expgui(diffBox).bDCdifa -text "Set DIFA Globally" \ |
---|
| 1172 | -command "editglobalparm histinfo difa {DIFA}"] -column 3 -row 2 |
---|
| 1173 | # |
---|
| 1174 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1175 | -column 1 -row 3 -sticky w |
---|
| 1176 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1177 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1178 | grid [ button $expgui(diffBox).bDCzero -text "Set ZERO Globally" \ |
---|
| 1179 | -command "editglobalparm histinfo zero {Zero}"] -column 3 -row 3 |
---|
| 1180 | } elseif {$expgui(globalmode) == 2} { |
---|
| 1181 | #-------------------- |
---|
| 1182 | # Global CW neutron | |
---|
| 1183 | #-------------------- |
---|
| 1184 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
| 1185 | -column 1 -row 1 |
---|
| 1186 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
| 1187 | -column 2 -row 1 |
---|
| 1188 | grid [button $expgui(diffBox).bDCdifc -text "Set Wave Globally" \ |
---|
| 1189 | -command "editglobalparm histinfo lam1 Wavelength"] \ |
---|
| 1190 | -column 3 -row 1 |
---|
| 1191 | # |
---|
| 1192 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1193 | -column 1 -row 3 -sticky w |
---|
| 1194 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1195 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1196 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
| 1197 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
| 1198 | } elseif {$expgui(globalmode) == 4} { |
---|
| 1199 | #---------------------- |
---|
| 1200 | # Global CW mono xray | |
---|
| 1201 | #---------------------- |
---|
| 1202 | grid [ label $expgui(diffBox).lDC1 -text "Refine wave" ] \ |
---|
| 1203 | -column 1 -row 1 |
---|
| 1204 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(wref) ] \ |
---|
| 1205 | -column 2 -row 1 |
---|
| 1206 | grid [button $expgui(diffBox).bDCdifc -text "Set Wave Globally" \ |
---|
| 1207 | -command "editglobalparm histinfo lam1 Wavelength"] \ |
---|
| 1208 | -column 3 -row 1 |
---|
| 1209 | # |
---|
| 1210 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1211 | -column 1 -row 3 -sticky w |
---|
| 1212 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1213 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1214 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
| 1215 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
| 1216 | # |
---|
| 1217 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1218 | -column 1 -row 4 -sticky w |
---|
| 1219 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1220 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1221 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
| 1222 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
| 1223 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
| 1224 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
| 1225 | } elseif {$expgui(globalmode) == 3} { |
---|
| 1226 | #------------------------ |
---|
| 1227 | # Global alpha 1,2 xray | |
---|
| 1228 | #------------------------ |
---|
| 1229 | grid [button $expgui(diffBox).bDCl1 -text "Set Wave1 Globally" \ |
---|
| 1230 | -command "editglobalparm histinfo lam1 {Wavelength 1}"] \ |
---|
| 1231 | -column 3 -row 1 |
---|
| 1232 | grid [button $expgui(diffBox).bDCl2 -text "Set Wave2 Globally" \ |
---|
| 1233 | -command "editglobalparm histinfo lam2 {Wavelength 2}"] \ |
---|
| 1234 | -column 4 -row 1 |
---|
| 1235 | # |
---|
| 1236 | grid [ label $expgui(diffBox).lDCratref -text "Refine Ratio" ] \ |
---|
| 1237 | -column 1 -row 3 -sticky w |
---|
| 1238 | grid [ checkbutton $expgui(diffBox).rfDCratref \ |
---|
| 1239 | -variable entryvar(ratref) ] -column 2 -row 3 |
---|
| 1240 | grid [button $expgui(diffBox).bDCrrat -text "Set Ratio Globally" \ |
---|
| 1241 | -command "editglobalparm histinfo ratio {Wavelength Ratio}"] \ |
---|
| 1242 | -column 3 -row 3 |
---|
| 1243 | # |
---|
| 1244 | grid [ label $expgui(diffBox).lDCzref -text "Refine zero" ] \ |
---|
| 1245 | -column 1 -row 3 -sticky w |
---|
| 1246 | grid [ checkbutton $expgui(diffBox).rfDCzref \ |
---|
| 1247 | -variable entryvar(zref) ] -column 2 -row 3 |
---|
| 1248 | grid [button $expgui(diffBox).bDCzero -text "Set Zero Globally" \ |
---|
| 1249 | -command "editglobalparm histinfo zero Zero"] -column 3 -row 3 |
---|
| 1250 | # |
---|
| 1251 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1252 | -column 1 -row 4 -sticky w |
---|
| 1253 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1254 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1255 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
| 1256 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
| 1257 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
| 1258 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
| 1259 | } elseif {$expgui(globalmode) == 5} { |
---|
| 1260 | #----------------- |
---|
| 1261 | # Global ED xray | |
---|
| 1262 | #----------------- |
---|
| 1263 | grid [ label $expgui(diffBox).lDC1 -text "Refine 2theta" ] \ |
---|
| 1264 | -column 1 -row 1 |
---|
| 1265 | grid [ checkbutton $expgui(diffBox).rfDC1 -variable entryvar(ttref) ] \ |
---|
| 1266 | -column 2 -row 1 |
---|
| 1267 | grid [button $expgui(diffBox).bDCdifc -text "Set 2Theta Globally" \ |
---|
| 1268 | -command "editglobalparm histinfo ratio {Fixed 2Theta}"] \ |
---|
| 1269 | -column 3 -row 1 |
---|
| 1270 | # |
---|
| 1271 | grid [ label $expgui(diffBox).lDCpref -text "Refine POLA" ] \ |
---|
| 1272 | -column 1 -row 4 -sticky w |
---|
| 1273 | grid [ checkbutton $expgui(diffBox).rfDCpref \ |
---|
| 1274 | -variable entryvar(pref) ] -column 2 -row 4 |
---|
| 1275 | grid [button $expgui(diffBox).bDCpola -text "Set POLA Globally" \ |
---|
| 1276 | -command "editglobalparm histinfo pola POLA"] -column 3 -row 4 |
---|
| 1277 | grid [button $expgui(diffBox).bDCipola -text "Set IPOLA Globally" \ |
---|
| 1278 | -command "editglobalparm histinfo ipola IPOLA"] -column 4 -row 4 |
---|
| 1279 | } |
---|
| 1280 | if {$expgui(globalmode) == 0} { |
---|
| 1281 | grid [frame $expgui(diffBox).d] -column 5 -row 5 \ |
---|
| 1282 | -columnspan 2 -sticky e |
---|
| 1283 | } else { |
---|
| 1284 | grid [frame $expgui(diffBox).d] -column 4 -row 5 \ |
---|
| 1285 | -columnspan 2 -sticky e |
---|
| 1286 | } |
---|
| 1287 | grid [label $expgui(diffBox).d.lDamp -text "Damping "] \ |
---|
| 1288 | -column 1 -row 1 |
---|
| 1289 | tk_optionMenu $expgui(diffBox).d.om entryvar(ddamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 1290 | grid $expgui(diffBox).d.om -column 2 -row 1 |
---|
| 1291 | grid columnconfigure $expgui(diffBox) 9 -weight 1 |
---|
| 1292 | grid columnconfigure $expgui(diffBox) 0 -weight 1 |
---|
| 1293 | update idletasks |
---|
| 1294 | # enable traces on entryvar now |
---|
| 1295 | set entrycmd(trace) 1 |
---|
| 1296 | } |
---|
| 1297 | |
---|
| 1298 | #----------------------------------------------------------------------- |
---|
[14] | 1299 | # populate the Scaling page |
---|
[10] | 1300 | #----------------------------------------------------------------------- |
---|
| 1301 | proc DisplayFrac {} { |
---|
| 1302 | global expgui entrycmd entryvar expmap |
---|
| 1303 | |
---|
| 1304 | # display the selected histograms |
---|
| 1305 | $expgui(fracFrame).hs.lbox selection clear 0 end |
---|
| 1306 | foreach h $expgui(curhist) { |
---|
| 1307 | $expgui(fracFrame).hs.lbox selection set $h |
---|
| 1308 | } |
---|
| 1309 | |
---|
| 1310 | # disable traces on entryvar |
---|
| 1311 | set entrycmd(trace) 0 |
---|
| 1312 | |
---|
| 1313 | # get histogram list |
---|
| 1314 | set histlist {} |
---|
| 1315 | foreach item $expgui(curhist) { |
---|
| 1316 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
| 1317 | } |
---|
| 1318 | |
---|
[14] | 1319 | #-------------- |
---|
| 1320 | # Scale factor |
---|
| 1321 | #-------------- |
---|
| 1322 | if {$expgui(globalmode) != 0} { |
---|
| 1323 | foreach var {scale sref sdamp} { |
---|
| 1324 | set entrycmd($var) "histinfo [list $histlist] $var" |
---|
| 1325 | set entryvar($var) [histinfo [lindex $histlist 0] $var] |
---|
| 1326 | } |
---|
| 1327 | set parm [grid info $expgui(scaleBox).ent1] |
---|
| 1328 | if {$parm != ""} { |
---|
| 1329 | grid forget $expgui(scaleBox).ent1 |
---|
| 1330 | eval grid $expgui(scaleBox).but1 $parm |
---|
| 1331 | } |
---|
| 1332 | } else { |
---|
| 1333 | set hist $histlist |
---|
| 1334 | foreach var {scale sref sdamp} { |
---|
| 1335 | set entrycmd($var) "histinfo $hist $var" |
---|
| 1336 | set entryvar($var) [eval $entrycmd($var)] |
---|
| 1337 | } |
---|
| 1338 | set parm [grid info $expgui(scaleBox).but1] |
---|
| 1339 | if {$parm != ""} { |
---|
| 1340 | grid forget $expgui(scaleBox).but1 |
---|
| 1341 | eval grid $expgui(scaleBox).ent1 $parm |
---|
| 1342 | } |
---|
| 1343 | } |
---|
| 1344 | |
---|
| 1345 | #---------------- |
---|
| 1346 | # Phase Fractions |
---|
| 1347 | #---------------- |
---|
| 1348 | set phaseFractf1 $expgui(FracBox).f |
---|
[10] | 1349 | # destroy the contents of the frame |
---|
[14] | 1350 | eval destroy [grid slaves $phaseFractf1] |
---|
[10] | 1351 | if {$expgui(globalmode) != 0} { |
---|
[14] | 1352 | grid [label $phaseFractf1.txt -anchor center \ |
---|
| 1353 | -text "Phase Fractions for Histograms: [CompressList $histlist]"] \ |
---|
| 1354 | -column 0 -row 0 -sticky news |
---|
| 1355 | } else { |
---|
| 1356 | grid [label $phaseFractf1.txt -anchor center \ |
---|
| 1357 | -text "Phase Fractions"] -column 0 -row 0 -sticky news |
---|
[10] | 1358 | } |
---|
| 1359 | # Create the frame inside the canvas, One frame for each Phase. |
---|
| 1360 | foreach i {1 2 3 4 5 6 7 8 9} {set phasehistlist($i) ""} |
---|
| 1361 | foreach hist $histlist { |
---|
| 1362 | foreach i $expmap(phaselist_$hist) { |
---|
| 1363 | lappend phasehistlist($i) $hist |
---|
| 1364 | } |
---|
| 1365 | } |
---|
| 1366 | foreach i {1 2 3 4 5 6 7 8 9} { |
---|
| 1367 | if {[llength $phasehistlist($i)] == 0} continue |
---|
| 1368 | set framePF [frame $phaseFractf1.pF$i -relief groove -bd 4] |
---|
[14] | 1369 | grid $framePF -column 0 -row $i -sticky ew |
---|
[10] | 1370 | # Label Heading for each phase. |
---|
| 1371 | if {$expgui(globalmode) != 0} { |
---|
| 1372 | grid [label $framePF.l1 \ |
---|
[14] | 1373 | -text "Phase $i Hist: [CompressList $phasehistlist($i)] Fraction"] \ |
---|
[10] | 1374 | -column 0 -row 0 -sticky nws |
---|
| 1375 | grid [button $framePF.but1 -text "Set Globally" \ |
---|
| 1376 | -command "editglobalparm hapinfo frac \"Phase $i Fraction\" \ |
---|
| 1377 | [list $phasehistlist($i)] $i" \ |
---|
| 1378 | ] -column 1 -row 0 |
---|
| 1379 | } else { |
---|
[14] | 1380 | grid [label $framePF.l1 -text "Phase $i fraction"] \ |
---|
[10] | 1381 | -column 0 -row 0 -sticky nws |
---|
| 1382 | grid [entry $framePF.ent -textvariable entryvar(frac$i) -width 15]\ |
---|
| 1383 | -column 1 -row 0 |
---|
| 1384 | } |
---|
| 1385 | set entrycmd(frac$i) "hapinfo $hist $i frac" |
---|
| 1386 | set entryvar(frac$i) [hapinfo $hist $i frac] |
---|
| 1387 | grid [label $framePF.l2 -text " Refine"] \ |
---|
| 1388 | -column 2 -row 0 -sticky nws |
---|
| 1389 | grid [checkbutton $framePF.cb -variable entryvar(frref$i)] \ |
---|
| 1390 | -column 3 -row 0 -sticky nws |
---|
| 1391 | set entrycmd(frref$i) "hapinfo $hist $i frref" |
---|
| 1392 | set entryvar(frref$i) [hapinfo $hist $i frref] |
---|
| 1393 | grid [label $framePF.l3 -text " Damping"] \ |
---|
| 1394 | -column 4 -row 0 -sticky nws |
---|
| 1395 | tk_optionMenu $framePF.tkOptDamp entryvar(frdamp$i) \ |
---|
| 1396 | 0 1 2 3 4 5 6 7 8 9 |
---|
| 1397 | set entrycmd(frdamp$i) "hapinfo $hist $i frdamp" |
---|
| 1398 | set entryvar(frdamp$i) [hapinfo $hist $i frdamp] |
---|
| 1399 | grid $framePF.tkOptDamp -row 0 -sticky nsw -column 5 |
---|
| 1400 | } |
---|
[14] | 1401 | # resize the scroll window to match the actual |
---|
[10] | 1402 | update idletasks |
---|
[14] | 1403 | $expgui(FracBox) config -scrollregion [grid bbox $expgui(FracBox).f] |
---|
| 1404 | $expgui(FracBox) config -width [lindex [grid bbox $expgui(FracBox).f] 2] |
---|
| 1405 | update idletasks |
---|
[10] | 1406 | # enable traces on entryvar now |
---|
| 1407 | set entrycmd(trace) 1 |
---|
| 1408 | } |
---|
| 1409 | |
---|
| 1410 | #----------------------------------------------------------------------- |
---|
| 1411 | # display the profile page |
---|
| 1412 | #----------------------------------------------------------------------- |
---|
| 1413 | proc DisplayProfile {} { |
---|
| 1414 | global expgui entrycmd entryvar expmap |
---|
| 1415 | $expgui(profFrame).hs.lbox selection clear 0 end |
---|
| 1416 | foreach h $expgui(curhist) { |
---|
| 1417 | $expgui(profFrame).hs.lbox selection set $h |
---|
| 1418 | } |
---|
| 1419 | |
---|
| 1420 | # disable traces on entryvar for right now |
---|
| 1421 | set entrycmd(trace) 0 |
---|
| 1422 | # destroy the contents of the frame |
---|
| 1423 | eval destroy [grid slaves $expgui(ProfileBox).f] |
---|
| 1424 | |
---|
| 1425 | if {$expgui(globalmode) == 0} { |
---|
| 1426 | set hist [lindex $expmap(powderlist) $expgui(curhist)] |
---|
| 1427 | # Create one frame for each Phase. |
---|
| 1428 | set ind -1 |
---|
| 1429 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
| 1430 | foreach i $expmap(phaselist_$hist) { |
---|
| 1431 | incr ind |
---|
| 1432 | grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \ |
---|
| 1433 | -column 0 -row $ind -sticky ew |
---|
| 1434 | grid [frame $expgui(ProfileBox).f.$i.1] \ |
---|
| 1435 | -column 0 -row 0 -columnspan 10 -sticky ew |
---|
| 1436 | # Label Heading for each phase. |
---|
| 1437 | set ptype [string trim [hapinfo $hist $i proftype]] |
---|
| 1438 | pack [label $expgui(ProfileBox).f.$i.1.l \ |
---|
| 1439 | -text "Phase $i -- type $ptype Damping"]\ |
---|
| 1440 | -side left |
---|
| 1441 | tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp entryvar(pdamp_$i) \ |
---|
| 1442 | 0 1 2 3 4 5 6 7 8 9 |
---|
| 1443 | set entrycmd(pdamp_$i) "hapinfo $hist $i pdamp" |
---|
| 1444 | set entryvar(pdamp_$i) [hapinfo $hist $i pdamp] |
---|
| 1445 | pack $expgui(ProfileBox).f.$i.1.tkOptDamp -side left |
---|
| 1446 | pack [label $expgui(ProfileBox).f.$i.1.l1 \ |
---|
| 1447 | -text " Peak cutoff"]\ |
---|
| 1448 | -side left |
---|
| 1449 | pack [entry $expgui(ProfileBox).f.$i.1.e1 \ |
---|
| 1450 | -width 10 -textvariable entryvar(pcut_$i)]\ |
---|
| 1451 | -side left |
---|
| 1452 | set entrycmd(pcut_$i) "hapinfo $hist $i pcut" |
---|
| 1453 | set entryvar(pcut_$i) [hapinfo $hist $i pcut] |
---|
| 1454 | |
---|
| 1455 | set col -1 |
---|
| 1456 | set row 1 |
---|
| 1457 | set nterms [hapinfo $hist $i profterms] |
---|
| 1458 | set lbls $expgui(prof-$htype-$ptype) |
---|
| 1459 | # for type 4, add extra terms depending on the cell type |
---|
| 1460 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]} |
---|
| 1461 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
| 1462 | set term {} |
---|
| 1463 | catch {set term [lindex $lbls $num]} |
---|
| 1464 | if {$term == ""} {set term $num} |
---|
| 1465 | incr col |
---|
| 1466 | grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \ |
---|
| 1467 | -row $row -column $col |
---|
| 1468 | incr col |
---|
| 1469 | grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \ |
---|
| 1470 | -variable entryvar(pref${num}_$i)] -row $row -column $col |
---|
| 1471 | set entrycmd(pref${num}_$i) "hapinfo $hist $i pref$num" |
---|
| 1472 | set entryvar(pref${num}_$i) [hapinfo $hist $i pref$num] |
---|
| 1473 | incr col |
---|
| 1474 | grid [entry $expgui(ProfileBox).f.$i.ent${num}_${i} \ |
---|
| 1475 | -textvariable entryvar(pterm${num}_$i)\ |
---|
| 1476 | -width 14] -row $row -column $col |
---|
| 1477 | set entrycmd(pterm${num}_$i) "hapinfo $hist $i pterm$num" |
---|
| 1478 | set entryvar(pterm${num}_$i) [hapinfo $hist $i pterm$num] |
---|
| 1479 | if {$col > 6} {set col -1; incr row} |
---|
| 1480 | } |
---|
| 1481 | } |
---|
| 1482 | grid columnconfigure $expgui(ProfileBox).f 0 -weight 1 |
---|
| 1483 | } else { |
---|
| 1484 | # get histogram list |
---|
| 1485 | set histlist {} |
---|
| 1486 | foreach item $expgui(curhist) { |
---|
| 1487 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
| 1488 | } |
---|
| 1489 | # loop through histograms & phases, set up an array by type |
---|
| 1490 | catch {unset ptypearray histarray phasearray} |
---|
| 1491 | foreach hist $histlist { |
---|
| 1492 | foreach i $expmap(phaselist_$hist) { |
---|
| 1493 | set ptype [string trim [hapinfo $hist $i proftype]] |
---|
| 1494 | lappend ptypearray(${ptype}_$i) $hist |
---|
| 1495 | lappend histarray($ptype) $hist |
---|
| 1496 | lappend phasearray($ptype) $i |
---|
| 1497 | } |
---|
| 1498 | } |
---|
| 1499 | |
---|
| 1500 | set ptype "" |
---|
| 1501 | set title "" |
---|
| 1502 | set ind -1 |
---|
| 1503 | foreach key "[lsort [array names ptypearray]] 0_0" { |
---|
| 1504 | # split key |
---|
| 1505 | scan $key %d_%d type p |
---|
| 1506 | # 1st time through |
---|
| 1507 | if {$ptype == ""} {set ptype $type} |
---|
| 1508 | if {$ptype == $type} { |
---|
| 1509 | # we've seen this one before |
---|
| 1510 | if {$title != ""} {append title "\n"} |
---|
| 1511 | append title "Phase $p, hist [CompressList $ptypearray($key)]" |
---|
| 1512 | } else { |
---|
| 1513 | set hist [lindex $histarray($ptype) 0] |
---|
| 1514 | set phase [lindex $phasearray($ptype) 0] |
---|
| 1515 | set nterms [hapinfo $hist $phase profterms] |
---|
| 1516 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
| 1517 | set lbls $expgui(prof-$htype-$ptype) |
---|
| 1518 | set i $ptype |
---|
| 1519 | # Create one frame for this type |
---|
| 1520 | incr ind |
---|
| 1521 | grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \ |
---|
| 1522 | -column 0 -row $ind -sticky ew |
---|
| 1523 | grid [frame $expgui(ProfileBox).f.$i.0] \ |
---|
| 1524 | -column 0 -row 0 -columnspan 20 -sticky ew |
---|
| 1525 | grid [label $expgui(ProfileBox).f.$i.0.0 \ |
---|
| 1526 | -text "Profile Type $ptype "] -row 0 -column 0 |
---|
| 1527 | grid [label $expgui(ProfileBox).f.$i.0.1 \ |
---|
| 1528 | -text $title -anchor w] -row 0 -column 1 |
---|
| 1529 | grid [frame $expgui(ProfileBox).f.$i.1] \ |
---|
| 1530 | -column 0 -row 1 -columnspan 20 -sticky ew |
---|
| 1531 | grid [label $expgui(ProfileBox).f.$i.1.2 \ |
---|
| 1532 | -text "Damping"] -row 0 -column 2 |
---|
| 1533 | tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp \ |
---|
| 1534 | entryvar(pdamp_$ptype) 0 1 2 3 4 5 6 7 8 9 |
---|
| 1535 | set entrycmd(pdamp_$ptype) "hapinfo \ |
---|
| 1536 | [list $histarray($ptype)] \ |
---|
| 1537 | [list $phasearray($ptype)] pdamp" |
---|
| 1538 | set entryvar(pdamp_$ptype) [hapinfo $hist $phase pdamp] |
---|
| 1539 | grid $expgui(ProfileBox).f.$i.1.tkOptDamp -row 0 -column 3 |
---|
| 1540 | grid [button $expgui(ProfileBox).f.$i.1.edit \ |
---|
| 1541 | -text "Global Edit" \ |
---|
| 1542 | -command "EditProfile [list $title] \ |
---|
| 1543 | [list $histarray($ptype)] [list $phasearray($ptype)] " \ |
---|
| 1544 | ] -row 0 -column 4 -sticky w |
---|
| 1545 | # for type 4, add extra terms depending on the cell type |
---|
| 1546 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $phase]} |
---|
| 1547 | set col -1 |
---|
| 1548 | set row 2 |
---|
| 1549 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
| 1550 | set term {} |
---|
| 1551 | catch {set term [lindex $lbls $num]} |
---|
| 1552 | if {$term == ""} {set term $num} |
---|
| 1553 | incr col |
---|
| 1554 | grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \ |
---|
| 1555 | -row $row -column $col |
---|
| 1556 | incr col |
---|
| 1557 | grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \ |
---|
| 1558 | -variable entryvar(pref${num}_$i)] \ |
---|
| 1559 | -row $row -column $col |
---|
| 1560 | set entrycmd(pref${num}_$i) "hapinfo \ |
---|
| 1561 | [list $histarray($ptype)] \ |
---|
| 1562 | [list $phasearray($ptype)] pref$num" |
---|
| 1563 | set entryvar(pref${num}_$i) [hapinfo $hist $phase pref$num] |
---|
| 1564 | if {$col > 10} {set col -1; incr row} |
---|
| 1565 | } |
---|
| 1566 | grid columnconfigure $expgui(ProfileBox).f 0 -weight 1 |
---|
| 1567 | set ptype "" |
---|
| 1568 | } |
---|
| 1569 | } |
---|
| 1570 | } |
---|
| 1571 | |
---|
| 1572 | # resize the scroll window to match the actual |
---|
| 1573 | update idletasks |
---|
| 1574 | $expgui(ProfileBox) config -scrollregion [grid bbox $expgui(ProfileBox).f] |
---|
| 1575 | $expgui(ProfileBox) config -width [lindex [grid bbox $expgui(ProfileBox).f] 2] |
---|
| 1576 | update idletasks |
---|
| 1577 | # enable traces on entryvar now |
---|
| 1578 | set entrycmd(trace) 1 |
---|
| 1579 | } |
---|
| 1580 | |
---|
| 1581 | # profile labels for type 4 profile |
---|
| 1582 | proc type4lbls {lbls nterms phase} { |
---|
| 1583 | if {$nterms == 14} { |
---|
| 1584 | # cubic |
---|
| 1585 | lappend lbls S400 S220 |
---|
| 1586 | } elseif {$nterms == 15} { |
---|
| 1587 | # hexagonal |
---|
| 1588 | lappend lbls S400 S004 S202 |
---|
| 1589 | } elseif {$nterms == 16} { |
---|
| 1590 | # tetragonal or rhombohedral |
---|
| 1591 | if {[phaseinfo $phase a] == [phaseinfo $phase c]} { |
---|
| 1592 | # rhombohedral |
---|
| 1593 | lappend lbls S400 S220 S310 S211 |
---|
| 1594 | } else { |
---|
| 1595 | lappend lbls S400 S004 S220 S202 |
---|
| 1596 | } |
---|
| 1597 | } elseif {$nterms == 18} { |
---|
| 1598 | # orthorhombic |
---|
| 1599 | lappend lbls S400 S040 S004 S220 S202 S022 |
---|
| 1600 | } elseif {$nterms == 21} { |
---|
| 1601 | # monoclinic |
---|
| 1602 | lappend lbls S400 S040 S004 S220 S202 S022 S301 S103 S121 |
---|
| 1603 | } elseif {$nterms == 25} { |
---|
| 1604 | # triclinic |
---|
| 1605 | lappend lbls S400 S040 S004 S220 S202 S022 S310 S103 S031 \ |
---|
| 1606 | S130 S301 S013 S211 S121 S112 |
---|
| 1607 | } |
---|
| 1608 | return $lbls |
---|
| 1609 | } |
---|
| 1610 | |
---|
| 1611 | # process the bit settings in the print options |
---|
| 1612 | # bitnum -- the number of the bit to be tested/set starting at 0 for the LSBit |
---|
| 1613 | proc printsetting {bitnum "action get" "value {}"} { |
---|
| 1614 | global entryvar expgui |
---|
| 1615 | if {$action == "get"} { |
---|
| 1616 | return [expr ([expinfo print] & int(pow(2,$bitnum))) != 0] |
---|
| 1617 | } elseif $value { |
---|
| 1618 | set newval [expr ([expinfo print] | int(pow(2,$bitnum)))] |
---|
| 1619 | } else { |
---|
| 1620 | set newval [expr ([expinfo print] & ~int(pow(2,$bitnum)))] |
---|
| 1621 | } |
---|
| 1622 | expinfo print set $newval |
---|
| 1623 | set expgui(printopt) "Print Options ([expinfo print])" |
---|
| 1624 | } |
---|
| 1625 | #---------------------------- Global Edit Functions ------------------------ |
---|
| 1626 | proc editbackground {} { |
---|
| 1627 | global expgui expmap entrycmd |
---|
| 1628 | set w .back |
---|
| 1629 | catch {destroy $w} |
---|
| 1630 | toplevel $w -bg beige |
---|
| 1631 | set histlist {} |
---|
| 1632 | foreach n $expgui(curhist) { |
---|
| 1633 | lappend histlist [lindex $expmap(powderlist) $n] |
---|
| 1634 | } |
---|
| 1635 | if {$expgui(globalmode) != 0} { |
---|
| 1636 | wm title $w "Edit Background" |
---|
| 1637 | } else { |
---|
| 1638 | wm title $w "Global Edit Background" |
---|
| 1639 | } |
---|
| 1640 | |
---|
| 1641 | pack [frame $w.0 -bd 6 -relief groove -bg beige \ |
---|
| 1642 | ] -side top -expand yes -fill both |
---|
| 1643 | if {[llength $histlist] > 1} { |
---|
| 1644 | grid [label $w.0.a \ |
---|
| 1645 | -text "Setting background terms for histograms [CompressList $histlist]" \ |
---|
| 1646 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
| 1647 | } else { |
---|
| 1648 | grid [label $w.0.a \ |
---|
| 1649 | -text "Setting background terms for histogram $histlist" \ |
---|
| 1650 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
| 1651 | } |
---|
| 1652 | set hist [lindex $histlist 0] |
---|
| 1653 | grid [label $w.0.b -text "Function type" -bg beige] -row 1 -column 0 |
---|
| 1654 | |
---|
| 1655 | # disable traces on expgui(backtype) & expgui(backterms) now |
---|
| 1656 | set entrycmd(trace) 0 |
---|
| 1657 | |
---|
| 1658 | # number of terms |
---|
| 1659 | set expgui(backtype) [histinfo $hist backtype] |
---|
| 1660 | set expgui(orig_backtype) $expgui(backtype) |
---|
| 1661 | set expgui(prev_backtype) $expgui(backtype) |
---|
| 1662 | eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6} |
---|
| 1663 | grid $w.0.type -row 1 -column 1 |
---|
| 1664 | grid [label $w.0.c -text " Number of terms" -bg beige] -row 1 -column 2 |
---|
| 1665 | |
---|
| 1666 | # function type |
---|
| 1667 | set expgui(backterms) [histinfo $hist backterms] |
---|
| 1668 | set expgui(orig_backterms) $expgui(backterms) |
---|
| 1669 | set list {}; for {set i 1} {$i <= 36} {incr i} {lappend list $i} |
---|
| 1670 | eval tk_optionMenu $w.0.terms expgui(backterms) $list |
---|
| 1671 | grid $w.0.terms -row 1 -column 3 |
---|
| 1672 | # enable traces on expgui(backtype) & expgui(backterms) now |
---|
| 1673 | set entrycmd(trace) 1 |
---|
| 1674 | |
---|
| 1675 | #set background terms |
---|
| 1676 | for {set num 1 } { $num <= 36 } { incr num } { |
---|
| 1677 | set var "bterm$num" |
---|
| 1678 | set expgui($var) {} |
---|
| 1679 | set expgui(orig_$var) {} |
---|
| 1680 | } |
---|
| 1681 | if {[llength $histlist] == 1} { |
---|
| 1682 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
| 1683 | set var "bterm$num" |
---|
| 1684 | set expgui($var) [histinfo $histlist $var] |
---|
| 1685 | set expgui(orig_$var) $expgui($var) |
---|
| 1686 | } |
---|
| 1687 | } |
---|
| 1688 | |
---|
| 1689 | pack [frame $w.1 -bd 6 -relief groove -bg beige] -side top \ |
---|
| 1690 | -expand yes -fill both |
---|
| 1691 | ShowBackTerms $w.1 |
---|
| 1692 | |
---|
| 1693 | set expgui(temp) {} |
---|
| 1694 | pack [frame $w.b] -side top |
---|
| 1695 | pack [button $w.b.2 -text Set -command "destroy $w"] -side left |
---|
| 1696 | pack [button $w.b.3 -text Quit \ |
---|
| 1697 | -command "QuitEditBackground $w"] -side left |
---|
| 1698 | # force the window to stay on top |
---|
| 1699 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
| 1700 | |
---|
| 1701 | bind $w <Return> "destroy $w" |
---|
| 1702 | wm withdraw $w |
---|
| 1703 | update idletasks |
---|
| 1704 | # center the new window in the middle of the parent |
---|
| 1705 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
| 1706 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
| 1707 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
| 1708 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
| 1709 | wm geom $w +$x+$y |
---|
| 1710 | wm deiconify $w |
---|
| 1711 | |
---|
| 1712 | set oldFocus [focus] |
---|
| 1713 | set oldGrab [grab current $w] |
---|
| 1714 | if {$oldGrab != ""} { |
---|
| 1715 | set grabStatus [grab status $oldGrab] |
---|
| 1716 | } |
---|
| 1717 | grab $w |
---|
| 1718 | focus $w.b.2 |
---|
| 1719 | tkwait window $w |
---|
| 1720 | |
---|
| 1721 | catch {focus $oldFocus} |
---|
| 1722 | if {$oldGrab != ""} { |
---|
| 1723 | if {$grabStatus == "global"} { |
---|
| 1724 | grab -global $oldGrab |
---|
| 1725 | } else { |
---|
| 1726 | grab $oldGrab |
---|
| 1727 | } |
---|
| 1728 | } |
---|
| 1729 | |
---|
| 1730 | if {$expgui(temp) != ""} return |
---|
| 1731 | |
---|
| 1732 | if {$expgui(orig_backtype) != $expgui(backtype)} { |
---|
| 1733 | histinfo $histlist backtype set $expgui(backtype) |
---|
| 1734 | } |
---|
| 1735 | if {$expgui(orig_backterms) != $expgui(backterms)} { |
---|
| 1736 | histinfo $histlist backterms set $expgui(backterms) |
---|
| 1737 | } |
---|
| 1738 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
| 1739 | set var "bterm$num" |
---|
| 1740 | if {$expgui(orig_$var) != $expgui($var)} { |
---|
| 1741 | histinfo $histlist $var set $expgui($var) |
---|
| 1742 | } |
---|
| 1743 | } |
---|
| 1744 | |
---|
| 1745 | if {$expgui(globalmode) == 0} { |
---|
| 1746 | set expgui(backtypelbl) "Function type [histinfo $hist backtype]" |
---|
| 1747 | set expgui(backtermlbl) "([histinfo $hist backterms] terms)" |
---|
| 1748 | } |
---|
| 1749 | } |
---|
| 1750 | |
---|
| 1751 | trace variable expgui(backterms) w ChangeBackTerms |
---|
| 1752 | proc ChangeBackTerms {a b c} { |
---|
| 1753 | global entrycmd expgui |
---|
| 1754 | if !$entrycmd(trace) return |
---|
| 1755 | ShowBackTerms .back.1 |
---|
| 1756 | } |
---|
| 1757 | |
---|
| 1758 | trace variable expgui(backtype) w ChangeBackType |
---|
| 1759 | # reset the terms to 1, 0, 0... when the number of terms increase |
---|
| 1760 | proc ChangeBackType {a b c} { |
---|
| 1761 | global entrycmd expgui |
---|
| 1762 | if !$entrycmd(trace) return |
---|
| 1763 | if {$expgui(prev_backtype) == $expgui(backtype)} return |
---|
| 1764 | set expgui(prev_backtype) $expgui(backtype) |
---|
| 1765 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
| 1766 | set var "bterm$num" |
---|
| 1767 | if {$num == 1} { |
---|
| 1768 | set expgui($var) 1.0 |
---|
| 1769 | } else { |
---|
| 1770 | set expgui($var) 0.0 |
---|
| 1771 | } |
---|
| 1772 | } |
---|
| 1773 | } |
---|
| 1774 | |
---|
| 1775 | proc ShowBackTerms {w } { |
---|
| 1776 | global expgui expmap |
---|
| 1777 | # destroy the contents of the frame |
---|
| 1778 | eval destroy [grid slaves $w] |
---|
| 1779 | set histlist {} |
---|
| 1780 | foreach n $expgui(curhist) { |
---|
| 1781 | lappend histlist [lindex $expmap(powderlist) $n] |
---|
| 1782 | } |
---|
| 1783 | set widgetsPerRow 4 |
---|
| 1784 | for {set rows 2; set num 1 } { $num <= $expgui(backterms) } { incr rows } { |
---|
| 1785 | for {set cols 0} { (2*$widgetsPerRow > $cols) && ($num <= $expgui(backterms)) } { incr num } { |
---|
| 1786 | set var "bterm$num" |
---|
| 1787 | grid [label $w.l$num -text $num -bg beige] \ |
---|
| 1788 | -row $rows -column $cols -sticky nes |
---|
| 1789 | incr cols |
---|
| 1790 | grid [entry $w.e$num -width 15 -textvariable expgui($var) \ |
---|
| 1791 | ] -row $rows -column $cols -sticky news |
---|
| 1792 | incr cols |
---|
| 1793 | } |
---|
| 1794 | } |
---|
| 1795 | } |
---|
| 1796 | |
---|
| 1797 | proc QuitEditBackground {w} { |
---|
| 1798 | global expgui |
---|
| 1799 | # lets find out if anything changed |
---|
| 1800 | set changed 0 |
---|
| 1801 | if {$expgui(orig_backtype) != $expgui(backtype)} { |
---|
| 1802 | set changed 1 |
---|
| 1803 | } |
---|
| 1804 | if {$expgui(orig_backterms) != $expgui(backterms)} { |
---|
| 1805 | set changed 1 |
---|
| 1806 | } |
---|
| 1807 | for {set num 1 } { $num <= $expgui(backterms) } { incr num } { |
---|
| 1808 | set var "bterm$num" |
---|
| 1809 | if {$expgui(orig_$var) != $expgui($var)} { |
---|
| 1810 | set changed 1 |
---|
| 1811 | break |
---|
| 1812 | } |
---|
| 1813 | } |
---|
| 1814 | if $changed { |
---|
| 1815 | set decision [tk_dialog .changes "Abandon Changes" \ |
---|
| 1816 | "You have made changes to the background. Ok to abandon changes?" \ |
---|
| 1817 | warning 0 Abandon Keep] |
---|
| 1818 | if !$decision { |
---|
| 1819 | set expgui(temp) "Quit" |
---|
| 1820 | destroy $w |
---|
| 1821 | } |
---|
| 1822 | } else { |
---|
| 1823 | set expgui(temp) "Quit" |
---|
| 1824 | destroy $w |
---|
| 1825 | } |
---|
| 1826 | } |
---|
| 1827 | |
---|
| 1828 | # this probably needs work |
---|
| 1829 | proc editglobalparm {cmd variable title "histlist {}" "phase {}"} { |
---|
| 1830 | global expgui expmap |
---|
| 1831 | set w .global |
---|
| 1832 | catch {destroy $w} |
---|
| 1833 | toplevel $w -bg beige |
---|
| 1834 | wm title $w "Edit Global Parameter" |
---|
| 1835 | set expgui(temp) {} |
---|
| 1836 | if {[llength $histlist] == 0} { |
---|
| 1837 | set hist {} |
---|
| 1838 | foreach n $expgui(curhist) { |
---|
| 1839 | lappend hist [lindex $expmap(powderlist) $n] |
---|
| 1840 | } |
---|
| 1841 | } else { |
---|
| 1842 | set hist $histlist |
---|
| 1843 | } |
---|
| 1844 | pack [frame $w.0 -bd 6 -relief groove -bg beige] \ |
---|
| 1845 | -side top -expand yes -fill both |
---|
| 1846 | grid [label $w.0.a -text "Setting $title for histograms [CompressList $hist]"\ |
---|
| 1847 | -bg beige] \ |
---|
| 1848 | -row 0 -column 0 -columnspan 10 |
---|
| 1849 | grid [entry $w.0.b -textvariable expgui(temp)] \ |
---|
| 1850 | -row 1 -column 0 |
---|
| 1851 | |
---|
| 1852 | |
---|
| 1853 | pack [frame $w.b] -side top |
---|
| 1854 | pack [button $w.b.2 -text Set -command "destroy $w"] -side left |
---|
| 1855 | pack [button $w.b.3 -text Quit -command "set expgui(temp) {}; destroy $w"] -side left |
---|
| 1856 | # force the window to stay on top |
---|
| 1857 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
| 1858 | |
---|
| 1859 | bind $w <Return> "destroy $w" |
---|
| 1860 | wm withdraw $w |
---|
| 1861 | update idletasks |
---|
| 1862 | # center the new window in the middle of the parent |
---|
| 1863 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
| 1864 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
| 1865 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
| 1866 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
| 1867 | wm geom $w +$x+$y |
---|
| 1868 | wm deiconify $w |
---|
| 1869 | |
---|
| 1870 | set oldFocus [focus] |
---|
| 1871 | set oldGrab [grab current $w] |
---|
| 1872 | if {$oldGrab != ""} { |
---|
| 1873 | set grabStatus [grab status $oldGrab] |
---|
| 1874 | } |
---|
| 1875 | grab $w |
---|
| 1876 | focus $w.b.2 |
---|
| 1877 | tkwait window $w |
---|
| 1878 | if {$expgui(temp) != ""} { |
---|
| 1879 | foreach h $hist { |
---|
| 1880 | if {$cmd == "histinfo"} { |
---|
| 1881 | histinfo $h $variable set $expgui(temp) |
---|
| 1882 | if $expgui(debug) { |
---|
| 1883 | puts "histinfo $h $variable set $expgui(temp)" |
---|
| 1884 | } |
---|
| 1885 | } elseif {$cmd == "hapinfo"} { |
---|
| 1886 | hapinfo $h $phase $variable set $expgui(temp) |
---|
| 1887 | if $expgui(debug) { |
---|
| 1888 | puts "hapinfo $phase $h $variable set $expgui(temp)" |
---|
| 1889 | } |
---|
| 1890 | } else { |
---|
| 1891 | error "$cmd unimplemented" |
---|
| 1892 | } |
---|
| 1893 | } |
---|
| 1894 | } |
---|
| 1895 | catch {focus $oldFocus} |
---|
| 1896 | if {$oldGrab != ""} { |
---|
| 1897 | if {$grabStatus == "global"} { |
---|
| 1898 | grab -global $oldGrab |
---|
| 1899 | } else { |
---|
| 1900 | grab $oldGrab |
---|
| 1901 | } |
---|
| 1902 | } |
---|
| 1903 | } |
---|
| 1904 | |
---|
| 1905 | proc EditProfile {title histlist phaselist} { |
---|
| 1906 | global expgui expmap entrycmd |
---|
| 1907 | set w .back |
---|
| 1908 | catch {destroy $w} |
---|
| 1909 | toplevel $w -bg beige |
---|
| 1910 | wm title $w "Global Edit Profile" |
---|
| 1911 | set hist [lindex $histlist 0] |
---|
| 1912 | set phase [lindex $phaselist 0] |
---|
| 1913 | set ptype [string trim [hapinfo $hist $phase proftype]] |
---|
| 1914 | set htype [string range $expmap(htype_$hist) 2 2] |
---|
| 1915 | set nterms [hapinfo $hist $phase profterms] |
---|
| 1916 | |
---|
| 1917 | pack [frame $w.0 -bd 6 -relief groove -bg beige \ |
---|
| 1918 | ] -side top -expand yes -fill both |
---|
| 1919 | grid [label $w.0.a \ |
---|
| 1920 | -text "Setting profile terms: $title" \ |
---|
| 1921 | -bg beige] -row 0 -column 0 -columnspan 10 |
---|
| 1922 | grid [label $w.0.b -text "Function type $ptype" -bg beige] -row 1 -column 0 |
---|
| 1923 | |
---|
| 1924 | # number of terms |
---|
| 1925 | # set expgui(backtype) [histinfo $hist backtype] |
---|
| 1926 | # set expgui(orig_backtype) $expgui(backtype) |
---|
| 1927 | # set expgui(prev_backtype) $expgui(backtype) |
---|
| 1928 | # eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6} |
---|
| 1929 | # grid $w.0.type -row 1 -column 1 |
---|
| 1930 | |
---|
| 1931 | grid [label $w.0.c -text " Peak cutoff" -bg beige] -row 1 -column 3 |
---|
| 1932 | grid [entry $w.0.d -width 10 ] -row 1 -column 4 |
---|
| 1933 | set entrylist {} |
---|
| 1934 | lappend entrylist "pcut $w.0.d" |
---|
| 1935 | |
---|
| 1936 | set col -1 |
---|
| 1937 | set row 1 |
---|
| 1938 | set lbls $expgui(prof-$htype-$ptype) |
---|
| 1939 | # for type 4, add extra terms depending on the cell type |
---|
| 1940 | if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $i]} |
---|
| 1941 | pack [frame $w.1 -bd 6 -relief groove -bg beige \ |
---|
| 1942 | ] -side top -expand yes -fill both |
---|
| 1943 | for { set num 1 } { $num <= $nterms } { incr num } { |
---|
| 1944 | set term {} |
---|
| 1945 | catch {set term [lindex $lbls $num]} |
---|
| 1946 | if {$term == ""} {set term $num} |
---|
| 1947 | incr col |
---|
| 1948 | grid [label $w.1.l${num} -text "$term" -bg beige] \ |
---|
| 1949 | -row $row -column $col |
---|
| 1950 | incr col |
---|
| 1951 | grid [entry $w.1.ent${num} \ |
---|
| 1952 | -width 14] -row $row -column $col |
---|
| 1953 | lappend entrylist "pterm$num $w.1.ent${num}" |
---|
| 1954 | if {$col > 6} {set col -1; incr row} |
---|
| 1955 | } |
---|
| 1956 | pack [frame $w.b] -side top |
---|
| 1957 | pack [button $w.b.2 -text Set \ |
---|
| 1958 | -command "SetEditProfile [list $entrylist] [list $phaselist] \ |
---|
| 1959 | [list $histlist] $w"] -side left |
---|
| 1960 | pack [button $w.b.3 -text Quit \ |
---|
| 1961 | -command "QuitEditProfile $w [list $entrylist]"] -side left |
---|
| 1962 | # force the window to stay on top |
---|
| 1963 | wm transient $w [winfo toplevel [winfo parent $w]] |
---|
| 1964 | |
---|
| 1965 | bind $w <Return> "destroy $w" |
---|
| 1966 | wm withdraw $w |
---|
| 1967 | update idletasks |
---|
| 1968 | # center the new window in the middle of the parent |
---|
| 1969 | set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ |
---|
| 1970 | [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] |
---|
| 1971 | set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ |
---|
| 1972 | [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] |
---|
| 1973 | wm geom $w +$x+$y |
---|
| 1974 | wm deiconify $w |
---|
| 1975 | |
---|
| 1976 | set oldFocus [focus] |
---|
| 1977 | set oldGrab [grab current $w] |
---|
| 1978 | if {$oldGrab != ""} { |
---|
| 1979 | set grabStatus [grab status $oldGrab] |
---|
| 1980 | } |
---|
| 1981 | grab $w |
---|
| 1982 | focus $w.b.2 |
---|
| 1983 | tkwait window $w |
---|
| 1984 | |
---|
| 1985 | catch {focus $oldFocus} |
---|
| 1986 | if {$oldGrab != ""} { |
---|
| 1987 | if {$grabStatus == "global"} { |
---|
| 1988 | grab -global $oldGrab |
---|
| 1989 | } else { |
---|
| 1990 | grab $oldGrab |
---|
| 1991 | } |
---|
| 1992 | } |
---|
| 1993 | } |
---|
| 1994 | |
---|
| 1995 | proc SetEditProfile {entrylist phaselist histlist w} { |
---|
| 1996 | global expgui |
---|
| 1997 | foreach item $entrylist { |
---|
| 1998 | set value [ [lindex $item 1] get ] |
---|
| 1999 | if {$value != ""} { |
---|
| 2000 | hapinfo $histlist $phaselist [lindex $item 0] set $value |
---|
| 2001 | if $expgui(debug) { |
---|
| 2002 | puts "hapinfo [list $phaselist] [list $histlist] [lindex $item 0] set $value" |
---|
| 2003 | } |
---|
| 2004 | } |
---|
| 2005 | } |
---|
| 2006 | destroy $w |
---|
| 2007 | } |
---|
| 2008 | |
---|
| 2009 | proc QuitEditProfile {w entrylist} { |
---|
| 2010 | global expgui |
---|
| 2011 | # lets find out if anything changed |
---|
| 2012 | set changed 0 |
---|
| 2013 | foreach item $entrylist { |
---|
| 2014 | if {[ [lindex $item 1] get ] != ""} {set changed 1; break} |
---|
| 2015 | } |
---|
| 2016 | if $changed { |
---|
| 2017 | set decision [tk_dialog .changes "Abandon Changes" \ |
---|
| 2018 | "You have made changes to the Profile. Ok to abandon changes?" \ |
---|
| 2019 | warning 0 Abandon Keep] |
---|
| 2020 | if !$decision {destroy $w} |
---|
| 2021 | } else { |
---|
| 2022 | destroy $w |
---|
| 2023 | } |
---|
| 2024 | } |
---|
| 2025 | |
---|
| 2026 | ############################################################################## |
---|
| 2027 | ## ############################################# |
---|
| 2028 | ## END OF THE PROCEDURES SECTION ############################################# |
---|
| 2029 | ## ############################################# |
---|
| 2030 | ############################################################################## |
---|
| 2031 | |
---|
| 2032 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 2033 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<< |
---|
| 2034 | # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< BEGIN: GUI SECTION >>>>>>>>>>>>>>>>>>> |
---|
| 2035 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>> |
---|
| 2036 | # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 2037 | # A frame for menu items at top of display |
---|
| 2038 | set expgui(fm) [frame .fm -relief raised -borderwidth 2 -width 150 -height 40] |
---|
| 2039 | # Pack the menu frame. |
---|
| 2040 | pack $expgui(fm) -fill x -side top -anchor n |
---|
| 2041 | |
---|
[14] | 2042 | # Creating the notebook with 5 panes: Phase, Histogram, Scaling, Profile |
---|
[10] | 2043 | # & LS controls |
---|
| 2044 | if $expgui(havetix) { |
---|
| 2045 | pack [tixNoteBook .n] -expand yes -fill both |
---|
[16] | 2046 | .n add lsPane -label "LS Controls" -underline 0 |
---|
| 2047 | .n pageconfigure lsPane -raisecmd \ |
---|
| 2048 | "set expgui(pagenow) lsFrame; SetupExtractHist" |
---|
| 2049 | lappend expgui(frameactionlist) "lsFrame SetupExtractHist" |
---|
[10] | 2050 | .n add phasePane -label "Phase" -underline 0 |
---|
| 2051 | .n pageconfigure phasePane -raisecmd \ |
---|
| 2052 | "set expgui(pagenow) phaseFrame; DisplayAllAtoms noreset" |
---|
| 2053 | .n add histPane -label "Histogram" -underline 0 |
---|
| 2054 | .n pageconfigure histPane -raisecmd \ |
---|
| 2055 | "set expgui(pagenow) histFrame; DisplayHistogram" |
---|
| 2056 | lappend expgui(frameactionlist) "histFrame DisplayHistogram" |
---|
| 2057 | lappend expgui(GlobalModeAllDisable) "histFrame {.n pageconfigure histPane}" |
---|
[14] | 2058 | .n add fracPane -label "Scaling" -underline 6 |
---|
[10] | 2059 | .n pageconfigure fracPane -raisecmd \ |
---|
| 2060 | "set expgui(pagenow) fracFrame; DisplayFrac" |
---|
| 2061 | lappend expgui(frameactionlist) "fracFrame DisplayFrac" |
---|
| 2062 | .n add profPane -label Profile -underline 1 |
---|
| 2063 | .n pageconfigure profPane -raisecmd \ |
---|
| 2064 | "set expgui(pagenow) profFrame; DisplayProfile" |
---|
| 2065 | lappend expgui(frameactionlist) "profFrame DisplayProfile" |
---|
| 2066 | lappend expgui(GlobalModeAllDisable) "profFrame {.n pageconfigure profPane}" |
---|
| 2067 | # Finding the pathname to the subwidget frames. |
---|
| 2068 | set expgui(phaseFrame) [.n subwidget phasePane] |
---|
| 2069 | set expgui(histFrame) [.n subwidget histPane] |
---|
| 2070 | set expgui(fracFrame) [.n subwidget fracPane] |
---|
| 2071 | set expgui(profFrame) [.n subwidget profPane] |
---|
| 2072 | set expgui(lsFrame) [.n subwidget lsPane] |
---|
| 2073 | } else { |
---|
| 2074 | pack [frame .bar] -side top -anchor w |
---|
| 2075 | pack [frame .n] -anchor w -fill both -expand yes |
---|
[16] | 2076 | foreach item {lsFrame phaseFrame histFrame fracFrame profFrame} \ |
---|
[14] | 2077 | page {Phase Histogram Scaling Profile "LS Controls"} { |
---|
[10] | 2078 | pack [button .bar.$item -text $page -bd 2 \ |
---|
| 2079 | -command "RaisePage $item"] -side left |
---|
| 2080 | set expgui($item) [frame .n.$item -relief flat] |
---|
| 2081 | } |
---|
[16] | 2082 | lappend expgui(frameactionlist) "lsFrame SetupExtractHist" |
---|
[10] | 2083 | lappend expgui(frameactionlist) "histFrame DisplayHistogram" |
---|
| 2084 | lappend expgui(frameactionlist) "fracFrame DisplayFrac" |
---|
| 2085 | lappend expgui(frameactionlist) "profFrame DisplayProfile" |
---|
| 2086 | lappend expgui(GlobalModeAllDisable) "histFrame {.bar.histFrame config}" |
---|
| 2087 | lappend expgui(GlobalModeAllDisable) "profFrame {.bar.profFrame config}" |
---|
| 2088 | } |
---|
| 2089 | |
---|
| 2090 | # this is used in the non-tix notebook to bring up the selected frame |
---|
| 2091 | proc RaisePage {nextpage} { |
---|
| 2092 | global expgui |
---|
| 2093 | set expgui(pagenow) $nextpage |
---|
| 2094 | foreach item {phaseFrame histFrame fracFrame profFrame lsFrame} { |
---|
| 2095 | if {$item == $nextpage} { |
---|
| 2096 | .bar.$item config -relief flat |
---|
| 2097 | } else { |
---|
| 2098 | .bar.$item config -relief raised |
---|
| 2099 | } |
---|
| 2100 | } |
---|
| 2101 | # forget all other pages |
---|
| 2102 | foreach child [pack slaves .n] { |
---|
| 2103 | pack forget $child |
---|
| 2104 | } |
---|
| 2105 | pack .n.$nextpage -anchor w -fill both -expand yes |
---|
| 2106 | foreach set $expgui(frameactionlist) { |
---|
| 2107 | if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1] |
---|
| 2108 | } |
---|
| 2109 | } |
---|
| 2110 | #---------------------------------------------------------------------------- |
---|
| 2111 | #\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/ \/ \/ |
---|
| 2112 | # Setup major frames here |
---|
| 2113 | frame $expgui(phaseFrame).top |
---|
| 2114 | set frameLatt [frame $expgui(phaseFrame).frameLatt] |
---|
| 2115 | # This is a big frame in the Phase notebook pane to hold a list of CRS data. |
---|
| 2116 | set fbig [frame $expgui(phaseFrame).fbig -width 180 -relief raised -borderwidth 4 -bg beige] |
---|
| 2117 | # This is a frame just below the big frame: fbig to allow edit of CRS data, One record at a time. |
---|
| 2118 | set frame3 [frame $expgui(phaseFrame).frame3 -width 100 -relief raised -borderwidth 4 -bg beige] |
---|
| 2119 | |
---|
| 2120 | grid $expgui(phaseFrame).top -sticky nws -row 0 -column 0 |
---|
| 2121 | grid $frameLatt -sticky news -row 2 -column 0 |
---|
| 2122 | grid $fbig -sticky news -row 3 -column 0 |
---|
| 2123 | # give extra space to the atoms box |
---|
| 2124 | grid columnconfigure $expgui(phaseFrame) 0 -weight 1 |
---|
| 2125 | grid rowconfigure $expgui(phaseFrame) 3 -weight 1 |
---|
| 2126 | grid $frame3 -sticky news -row 4 -column 0 |
---|
| 2127 | grid columnconfigure $expgui(phaseFrame) 0 -weight 1 |
---|
| 2128 | grid rowconfigure $expgui(phaseFrame) 3 -weight 1 |
---|
| 2129 | grid [frame $expgui(phaseFrame).top.ps] -column 0 -row 0 |
---|
| 2130 | # this is where the buttons will go |
---|
| 2131 | pack [label $expgui(phaseFrame).top.ps.0 -text "Phases: "] -side left |
---|
| 2132 | |
---|
| 2133 | |
---|
| 2134 | grid [label $expgui(phaseFrame).top.lA -textvariable entryvar(phasename) \ |
---|
| 2135 | -fg blue -anchor center] -column 1 -row 0 |
---|
| 2136 | grid columnconfigure $expgui(phaseFrame).top 1 -weight 1 |
---|
| 2137 | # ------------- Lattice Parameter Box ------------------ |
---|
| 2138 | set e1 [entry $frameLatt.e1 -textvariable entryvar(a) -width 10] |
---|
| 2139 | set e2 [entry $frameLatt.e2 -textvariable entryvar(b) -width 10] |
---|
| 2140 | set e3 [entry $frameLatt.e3 -textvariable entryvar(c) -width 10] |
---|
| 2141 | set e4 [entry $frameLatt.e4 -textvariable entryvar(alpha) -width 10] |
---|
| 2142 | set e5 [entry $frameLatt.e5 -textvariable entryvar(beta) -width 10] |
---|
| 2143 | set e6 [entry $frameLatt.e6 -textvariable entryvar(gamma) -width 10] |
---|
| 2144 | set l1 [label $frameLatt.l1 -text "a"] |
---|
| 2145 | set l2 [label $frameLatt.l2 -text "b"] |
---|
| 2146 | set l3 [label $frameLatt.l3 -text "c"] |
---|
| 2147 | set l4 [label $frameLatt.l4 -text "alpha"] |
---|
| 2148 | set l5 [label $frameLatt.l5 -text "beta"] |
---|
| 2149 | set l6 [label $frameLatt.l6 -text "gamma"] |
---|
| 2150 | grid $e1 -column 1 -row 0 -padx 5 |
---|
| 2151 | grid $e2 -column 3 -row 0 -padx 5 |
---|
| 2152 | grid $e3 -column 5 -row 0 -padx 5 |
---|
| 2153 | grid $e4 -column 1 -row 1 -padx 5 |
---|
| 2154 | grid $e5 -column 3 -row 1 -padx 5 |
---|
| 2155 | grid $e6 -column 5 -row 1 -padx 5 |
---|
| 2156 | grid $l1 -column 0 -row 0 -padx 5 -sticky e |
---|
| 2157 | grid $l2 -column 2 -row 0 -padx 5 -sticky e |
---|
| 2158 | grid $l3 -column 4 -row 0 -padx 5 -sticky e |
---|
| 2159 | grid $l4 -column 0 -row 1 -padx 5 -sticky e |
---|
| 2160 | grid $l5 -column 2 -row 1 -padx 5 -sticky e |
---|
| 2161 | grid $l6 -column 4 -row 1 -padx 5 -sticky e |
---|
| 2162 | |
---|
| 2163 | grid [label $frameLatt.lr -text "Refine Cell"] -column 6 -row 0 -padx 5 -sticky e |
---|
| 2164 | grid [label $frameLatt.ld -text "Cell damping"] -column 6 -row 1 -padx 5 -sticky e |
---|
| 2165 | set cFlag [checkbutton $frameLatt.c -text "" -variable entryvar(cellref)] |
---|
| 2166 | grid $cFlag -column 7 -row 0 -padx 5 -sticky e |
---|
| 2167 | tk_optionMenu $frameLatt.om entryvar(celldamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2168 | grid $frameLatt.om -column 7 -row 1 -padx 5 -sticky e |
---|
| 2169 | |
---|
| 2170 | #-------------- Begin Atom Coordinates Box --------------------------------- |
---|
| 2171 | grid [listbox $fbig.title -height 1 -relief flat] \ |
---|
| 2172 | -row 0 -column 0 -sticky ew |
---|
| 2173 | set expgui(atomtitle) $fbig.title |
---|
| 2174 | $expgui(atomtitle) configure -font $expgui(coordfont) -selectmode extended |
---|
| 2175 | grid [listbox $fbig.lbox -height 10 \ |
---|
| 2176 | -xscrollcommand " $fbig.bscr set"\ |
---|
| 2177 | -yscrollcommand " $fbig.rscr set"\ |
---|
| 2178 | ] -row 1 -column 0 -sticky news |
---|
| 2179 | set expgui(atomlistbox) $fbig.lbox |
---|
| 2180 | $expgui(atomlistbox) configure -font $expgui(coordfont) -selectmode extended |
---|
| 2181 | grid [scrollbar $fbig.bscr -orient horizontal \ |
---|
| 2182 | -command "move2boxes \" $fbig.title $fbig.lbox \" " |
---|
| 2183 | ] -row 2 -column 0 -sticky ew |
---|
| 2184 | grid [scrollbar $fbig.rscr -command "$fbig.lbox yview" \ |
---|
| 2185 | ] -row 1 -column 1 -sticky ns |
---|
| 2186 | # give extra space to the atoms box |
---|
| 2187 | grid columnconfigure $fbig 0 -weight 1 |
---|
| 2188 | grid rowconfigure $fbig 1 -weight 1 |
---|
| 2189 | |
---|
| 2190 | proc move2boxes {boxlist args} { |
---|
| 2191 | foreach listbox $boxlist { |
---|
| 2192 | eval $listbox xview $args |
---|
| 2193 | } |
---|
| 2194 | } |
---|
| 2195 | # BIND mouse in editbox |
---|
| 2196 | bind $expgui(atomlistbox) <ButtonRelease-1> editRecord |
---|
| 2197 | bind $expgui(atomlistbox) <Button-3> SelectAllAtoms |
---|
| 2198 | |
---|
| 2199 | #-------------- End Atoms Section --------------------------------- |
---|
| 2200 | |
---|
| 2201 | # --------------------------- Begin Edit Box ------------------------------- |
---|
| 2202 | grid [set expgui(EditingAtoms) [label $frame3.top -bg beige -fg blue]] \ |
---|
| 2203 | -column 0 -row 0 -padx 2 -pady 3 -columnspan 12 -sticky w |
---|
| 2204 | |
---|
| 2205 | set f3l1 [label $frame3.l1 -text "Refinement Flags " -bg beige] |
---|
| 2206 | grid $f3l1 -column 0 -row 1 -padx 2 -sticky nsw -pady 3 |
---|
| 2207 | |
---|
| 2208 | set f3cFlag1 [checkbutton $frame3.cf1 -text "X" -variable entryvar(xref) -bg beige] |
---|
| 2209 | set f3cFlag2 [checkbutton $frame3.cf2 -text "U" -variable entryvar(uref) -bg beige] |
---|
| 2210 | set f3cFlag3 [checkbutton $frame3.cf3 -text "F" -variable entryvar(fref) -bg beige] |
---|
| 2211 | grid $f3cFlag1 -column 1 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2212 | grid $f3cFlag2 -column 2 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2213 | grid $f3cFlag3 -column 3 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2214 | |
---|
| 2215 | set f3l4 [label $frame3.l4 -text "Damping Factors " -bg beige] |
---|
| 2216 | grid $f3l4 -column 4 -row 1 -padx 2 -sticky nsw -pady 3 |
---|
| 2217 | |
---|
| 2218 | tk_optionMenu $frame3.om2 entryvar(xdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2219 | tk_optionMenu $frame3.om3 entryvar(udamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2220 | tk_optionMenu $frame3.om4 entryvar(fdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2221 | grid [label $frame3.lom2 -text X -bg beige] -column 5 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2222 | grid $frame3.om2 -column 6 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2223 | grid [label $frame3.lom3 -text U -bg beige] -column 7 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2224 | grid $frame3.om3 -column 8 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2225 | grid [label $frame3.lom4 -text F -bg beige] -column 9 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2226 | grid $frame3.om4 -column 10 -row 1 -padx 2 -pady 3 -sticky w |
---|
| 2227 | |
---|
| 2228 | set expgui(atomreflbl) "$frame3.l1 $frame3.l4 $frame3.lom2 $frame3.lom3 $frame3.lom4 " |
---|
| 2229 | set expgui(atomref) "$frame3.cf1 $frame3.cf2 $frame3.cf3 $frame3.om2 $frame3.om3 $frame3.om4" |
---|
| 2230 | |
---|
| 2231 | set coords [frame $frame3.coords -width 100 -borderwidth 0 -bg beige] |
---|
| 2232 | grid $coords -column 0 -row 6 -columnspan 12 -sticky nsew |
---|
| 2233 | |
---|
| 2234 | set f3l1 [label $frame3.coords.l1 -text "Label" -bg beige] |
---|
| 2235 | set f3e1 [entry $frame3.coords.e1 -textvariable entryvar(label) -width 6] |
---|
| 2236 | set f3l8 [label $frame3.coords.l8 -text "Coordinates" -bg beige] |
---|
| 2237 | set f3e8 [entry $frame3.coords.e8 -textvariable entryvar(x) -width 10] |
---|
| 2238 | set f3e9 [entry $frame3.coords.e9 -textvariable entryvar(y) -width 10] |
---|
| 2239 | set f3e10 [entry $frame3.coords.e10 -textvariable entryvar(z) -width 10] |
---|
| 2240 | set f3l11 [label $frame3.coords.l11 -text "Occupancy" -bg beige] |
---|
| 2241 | set f3e11 [entry $frame3.coords.e11 -textvariable entryvar(frac) -width 10] |
---|
| 2242 | set expgui(atomlabels) "$frame3.coords.l1 $frame3.coords.l8 $frame3.coords.l11" |
---|
| 2243 | set expgui(atomentry) "$frame3.coords.e1 $frame3.coords.e8 $frame3.coords.e9 $frame3.coords.e10 $frame3.coords.e11" |
---|
| 2244 | |
---|
| 2245 | grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2246 | grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2247 | grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2248 | grid $f3e8 -column 3 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2249 | grid $f3e9 -column 4 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2250 | grid $f3e10 -column 5 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2251 | grid $f3l11 -column 6 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2252 | grid $f3e11 -column 7 -row 4 -padx 2 -sticky nsw -pady 3 |
---|
| 2253 | |
---|
| 2254 | |
---|
| 2255 | set f3f31 [frame $frame3.f3f31 -width 100 -borderwidth 0 -bg beige] |
---|
| 2256 | grid $f3f31 -column 0 -row 7 -columnspan 12 |
---|
| 2257 | set expgui(anisolabels) {} |
---|
| 2258 | lappend expgui(anisolabels) [label $f3f31.l13 -text "Uiso" -bg beige] |
---|
| 2259 | lappend expgui(anisolabels) [label $f3f31.l14 -text "U22" -bg beige] |
---|
| 2260 | lappend expgui(anisolabels) [label $f3f31.l15 -text "U33" -bg beige] |
---|
| 2261 | lappend expgui(anisolabels) [label $f3f31.l16 -text "U12" -bg beige] |
---|
| 2262 | lappend expgui(anisolabels) [label $f3f31.l17 -text "U13" -bg beige] |
---|
| 2263 | lappend expgui(anisolabels) [label $f3f31.l18 -text "U23" -bg beige] |
---|
| 2264 | |
---|
| 2265 | set expgui(anisoentry) {} |
---|
| 2266 | lappend expgui(anisoentry) [entry $f3f31.e13 -textvariable entryvar(U11) -width 10] |
---|
| 2267 | lappend expgui(anisoentry) [entry $f3f31.e14 -textvariable entryvar(U22) -width 10] |
---|
| 2268 | lappend expgui(anisoentry) [entry $f3f31.e15 -textvariable entryvar(U33) -width 10] |
---|
| 2269 | lappend expgui(anisoentry) [entry $f3f31.e16 -textvariable entryvar(U12) -width 10] |
---|
| 2270 | lappend expgui(anisoentry) [entry $f3f31.e17 -textvariable entryvar(U13) -width 10] |
---|
| 2271 | lappend expgui(anisoentry) [entry $f3f31.e18 -textvariable entryvar(U23) -width 10] |
---|
| 2272 | |
---|
| 2273 | set col 0 |
---|
| 2274 | foreach item1 $expgui(anisolabels) item2 $expgui(anisoentry) { |
---|
| 2275 | grid $item1 -column $col -row 0 -sticky nsw -pady 3 |
---|
| 2276 | incr col |
---|
| 2277 | grid $item2 -column $col -row 0 -sticky nsw -pady 3 |
---|
| 2278 | incr col |
---|
| 2279 | } |
---|
| 2280 | # --------------------------- End Edit Box -------------------------------- |
---|
| 2281 | |
---|
| 2282 | #/\ /\ /\ /\ /\ /\ /\ END OF PHASE PANE CODE /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ |
---|
| 2283 | #----------------------------------------------------------------------------- |
---|
| 2284 | #v v v v v v v v v v BEGINNING OF HISTOGRAM PANE CODE v v v v v v v v v v v v |
---|
| 2285 | grid [frame $expgui(histFrame).hs] \ |
---|
| 2286 | -column 0 -row 0 -rowspan 10 -sticky nsew |
---|
| 2287 | grid columnconfigure $expgui(histFrame) 0 -weight 1 |
---|
| 2288 | grid rowconfigure $expgui(histFrame) 1 -weight 1 |
---|
| 2289 | grid rowconfigure $expgui(histFrame) 2 -weight 1 |
---|
| 2290 | grid rowconfigure $expgui(histFrame) 3 -weight 1 |
---|
| 2291 | grid [listbox $expgui(histFrame).hs.title -height 1 -relief flat \ |
---|
| 2292 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
| 2293 | grid [listbox $expgui(histFrame).hs.lbox -height 10 -width 25 \ |
---|
| 2294 | -font $expgui(histfont) \ |
---|
| 2295 | -xscrollcommand "$expgui(histFrame).hs.x set" \ |
---|
| 2296 | -yscrollcommand "$expgui(histFrame).hs.y set" \ |
---|
| 2297 | ] -row 1 -column 0 -sticky news |
---|
| 2298 | lappend expgui(HistSelectList) $expgui(histFrame).hs |
---|
| 2299 | grid [scrollbar $expgui(histFrame).hs.x -orient horizontal \ |
---|
| 2300 | -command "move2boxes \" $expgui(histFrame).hs.title $expgui(histFrame).hs.lbox \" " |
---|
| 2301 | ] -row 2 -column 0 -sticky ew |
---|
| 2302 | grid [scrollbar $expgui(histFrame).hs.y \ |
---|
| 2303 | -command "$expgui(histFrame).hs.lbox yview"] \ |
---|
| 2304 | -row 1 -column 1 -sticky ns |
---|
| 2305 | grid columnconfigure $expgui(histFrame).hs 0 -weight 1 |
---|
| 2306 | grid rowconfigure $expgui(histFrame).hs 1 -weight 1 |
---|
| 2307 | bind $expgui(histFrame).hs.lbox <ButtonRelease-1> { |
---|
| 2308 | set expgui(curhist) [$expgui(histFrame).hs.lbox curselection] |
---|
| 2309 | DisplayHistogram |
---|
| 2310 | } |
---|
| 2311 | bind $expgui(histFrame).hs.lbox <Button-3> { |
---|
| 2312 | if $expgui(globalmode) { |
---|
| 2313 | $expgui(histFrame).hs.lbox selection set 0 end |
---|
| 2314 | set expgui(curhist) [$expgui(histFrame).hs.lbox curselection] |
---|
| 2315 | DisplayHistogram |
---|
| 2316 | } |
---|
| 2317 | } |
---|
| 2318 | |
---|
| 2319 | |
---|
| 2320 | frame $expgui(histFrame).top -borderwidth 4 -relief groove |
---|
| 2321 | grid [label $expgui(histFrame).top.txt] -row 0 -column 0 |
---|
| 2322 | if $expgui(havetix) { |
---|
[14] | 2323 | foreach item {backBox diffBox} num {2 3} \ |
---|
| 2324 | title {Background "Diffractometer Constants"} { |
---|
[10] | 2325 | tixLabelFrame $expgui(histFrame).$item \ |
---|
| 2326 | -borderwidth 4 -width 600 -height 100 -label $title |
---|
| 2327 | grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew |
---|
| 2328 | set expgui($item) [$expgui(histFrame).$item subwidget frame] |
---|
| 2329 | } |
---|
| 2330 | } else { |
---|
[14] | 2331 | foreach item {backBox diffBox} num {1 2} \ |
---|
| 2332 | title {Background "Diffractometer Constants"} { |
---|
[10] | 2333 | frame $expgui(histFrame).$item -borderwidth 4 -relief groove |
---|
| 2334 | grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew |
---|
| 2335 | set expgui($item) $expgui(histFrame).$item |
---|
[14] | 2336 | grid [label $expgui(histFrame).$item.title -text $title] \ |
---|
| 2337 | -row 0 -column 0 -columnspan 10 -sticky nw |
---|
[10] | 2338 | } |
---|
| 2339 | } |
---|
| 2340 | |
---|
| 2341 | # BACKGROUND information. |
---|
| 2342 | # <<<<<<<<<<<<<<<<<<<<<<<<< BACKGROUND <<<<<<<<<<<<<<<<<<<<< |
---|
| 2343 | grid [ frame $expgui(backBox).f ] -row 0 -column 0 -columnspan 11 |
---|
| 2344 | grid [ label $expgui(backBox).f.lBGType -textvariable expgui(backtypelbl)] \ |
---|
| 2345 | -row 1 -column 0 -sticky nws -padx 2 -pady 3 |
---|
| 2346 | grid [ label $expgui(backBox).f.lBGTerms -textvariable expgui(backtermlbl)] \ |
---|
| 2347 | -row 1 -column 1 -sticky nws -padx 2 -pady 3 |
---|
| 2348 | grid [ button $expgui(backBox).f.edit -textvariable expgui(bkglbl) \ |
---|
| 2349 | -command editbackground] \ |
---|
| 2350 | -row 1 -column 2 -columnspan 3 -sticky w -padx 2 -pady 3 |
---|
| 2351 | grid [ frame $expgui(backBox).f1 ] -row 1 -column 0 -columnspan 11 -sticky e |
---|
| 2352 | grid [ label $expgui(backBox).f1.lfBG -text " Refine background" ] \ |
---|
| 2353 | -row 2 -column 1 -sticky news -padx 4 -pady 3 |
---|
| 2354 | grid [ checkbutton $expgui(backBox).f1.rfBG -text "" \ |
---|
| 2355 | -variable entryvar(bref) ] \ |
---|
| 2356 | -row 2 -column 2 -sticky news -padx 4 -pady 3 |
---|
| 2357 | grid [ label $expgui(backBox).f1.lBGDamp -text Damping ] \ |
---|
| 2358 | -row 2 -column 3 -sticky w -padx 2 -pady 3 |
---|
| 2359 | tk_optionMenu $expgui(backBox).f1.om entryvar(bdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2360 | grid $expgui(backBox).f1.om \ |
---|
| 2361 | -row 2 -column 4 -sticky news -padx 4 -pady 3 -sticky e |
---|
| 2362 | |
---|
| 2363 | # DIFFRACTOMETER CONSTANTS SECTION |
---|
| 2364 | |
---|
| 2365 | #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
| 2366 | ############################################################################### |
---|
[14] | 2367 | #v v v v v v v v v v BEGINNING OF SCALING PANE CODE v v v v v v v v v v |
---|
[10] | 2368 | |
---|
| 2369 | pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both |
---|
| 2370 | grid [listbox $expgui(fracFrame).hs.title -height 1 -relief flat \ |
---|
| 2371 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
| 2372 | grid [listbox $expgui(fracFrame).hs.lbox -height 10 -width 25 \ |
---|
| 2373 | -font $expgui(histfont) \ |
---|
| 2374 | -xscrollcommand "$expgui(fracFrame).hs.x set" \ |
---|
| 2375 | -yscrollcommand "$expgui(fracFrame).hs.y set" \ |
---|
| 2376 | ] -row 1 -column 0 -sticky news |
---|
| 2377 | lappend expgui(HistSelectList) $expgui(fracFrame).hs |
---|
| 2378 | grid [scrollbar $expgui(fracFrame).hs.x -orient horizontal \ |
---|
| 2379 | -command "move2boxes \" $expgui(fracFrame).hs.title $expgui(fracFrame).hs.lbox \" " |
---|
| 2380 | ] -row 2 -column 0 -sticky ew |
---|
| 2381 | grid [scrollbar $expgui(fracFrame).hs.y \ |
---|
| 2382 | -command "$expgui(fracFrame).hs.lbox yview"] \ |
---|
| 2383 | -row 1 -column 1 -sticky ns |
---|
| 2384 | grid columnconfigure $expgui(fracFrame).hs 0 -weight 1 |
---|
| 2385 | grid rowconfigure $expgui(fracFrame).hs 1 -weight 1 |
---|
| 2386 | bind $expgui(fracFrame).hs.lbox <ButtonRelease-1> { |
---|
| 2387 | set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection] |
---|
| 2388 | DisplayFrac |
---|
| 2389 | } |
---|
| 2390 | bind $expgui(fracFrame).hs.lbox <Button-3> { |
---|
| 2391 | if $expgui(globalmode) { |
---|
| 2392 | $expgui(fracFrame).hs.lbox selection set 0 end |
---|
| 2393 | set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection] |
---|
| 2394 | DisplayFrac |
---|
| 2395 | } |
---|
| 2396 | } |
---|
| 2397 | pack [frame $expgui(fracFrame).f1] -fill both -expand true |
---|
[14] | 2398 | # Create a large canvas area containing a frame for each phase in the data set. |
---|
| 2399 | # The canvas and vertical scrollbar are inside a frame called f1 |
---|
| 2400 | if $expgui(havetix) { |
---|
| 2401 | tixLabelFrame $expgui(fracFrame).f1.scaleBox \ |
---|
| 2402 | -borderwidth 4 -width 600 -height 100 -label "Scale Factor" |
---|
| 2403 | grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2 |
---|
| 2404 | set expgui(scaleBox) [$expgui(fracFrame).f1.scaleBox subwidget frame] |
---|
| 2405 | } else { |
---|
| 2406 | frame $expgui(fracFrame).f1.scaleBox -borderwidth 4 -relief groove |
---|
| 2407 | grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2 |
---|
| 2408 | set expgui(scaleBox) $expgui(fracFrame).f1.scaleBox |
---|
| 2409 | } |
---|
| 2410 | grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \ |
---|
| 2411 | -row 1 -column 0 -sticky nws -padx 2 -pady 3 |
---|
| 2412 | grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \ |
---|
| 2413 | -row 1 -column 1 -sticky ew -padx 4 -pady 3 |
---|
| 2414 | button $expgui(scaleBox).but1 -text "Set Globally" \ |
---|
| 2415 | -command "editglobalparm histinfo scale {Scale Factor}" |
---|
[10] | 2416 | |
---|
[14] | 2417 | grid [label $expgui(scaleBox).histSFRLabel -text " Refine"] \ |
---|
| 2418 | -row 1 -column 2 -sticky nws -padx 2 -pady 3 |
---|
| 2419 | grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \ |
---|
| 2420 | -row 1 -column 3 -sticky news -padx 4 -pady 3 |
---|
| 2421 | grid [label $expgui(scaleBox).lD1 -text "Damping"] \ |
---|
| 2422 | -row 1 -column 4 -sticky w -padx 2 -pady 3 |
---|
| 2423 | tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9 |
---|
| 2424 | grid $expgui(scaleBox).om \ |
---|
| 2425 | -row 1 -column 5 -sticky news -padx 4 -pady 3 |
---|
| 2426 | grid columnconfigure $expgui(scaleBox) 6 -weight 1 |
---|
| 2427 | |
---|
| 2428 | grid [set expgui(FracBox) [canvas $expgui(fracFrame).f1.fracBox \ |
---|
| 2429 | -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \ |
---|
| 2430 | -sticky news -row 1 -column 0 |
---|
| 2431 | grid [scrollbar $expgui(fracFrame).f1.yscroll -orient vertical] \ |
---|
| 2432 | -sticky ns -row 1 -column 1 |
---|
| 2433 | |
---|
| 2434 | $expgui(FracBox) config -yscrollcommand "$expgui(fracFrame).f1.yscroll set" |
---|
| 2435 | $expgui(fracFrame).f1.yscroll config -command { $expgui(FracBox) yview } |
---|
| 2436 | |
---|
| 2437 | grid columnconfigure $expgui(fracFrame).f1 0 -weight 1 |
---|
| 2438 | grid rowconfigure $expgui(fracFrame).f1 0 -weight 1 |
---|
| 2439 | frame $expgui(FracBox).f -bd 0 |
---|
| 2440 | $expgui(FracBox) create window 0 0 -anchor nw -window $expgui(FracBox).f |
---|
| 2441 | |
---|
[10] | 2442 | # the rest of the page is created in DisplayFrac |
---|
[14] | 2443 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF SCALING PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
[10] | 2444 | ############################################################################### |
---|
| 2445 | # v v v v v v v v v v BEGINNING OF PROFILE PANE CODE v v v v v v v v v v v v v |
---|
| 2446 | pack [frame $expgui(profFrame).hs] -side left -expand y -fill both |
---|
| 2447 | grid [listbox $expgui(profFrame).hs.title -height 1 -relief flat \ |
---|
| 2448 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
| 2449 | grid [listbox $expgui(profFrame).hs.lbox -height 10 -width 25 \ |
---|
| 2450 | -font $expgui(histfont) \ |
---|
| 2451 | -xscrollcommand "$expgui(profFrame).hs.x set" \ |
---|
| 2452 | -yscrollcommand "$expgui(profFrame).hs.y set" \ |
---|
| 2453 | ] -row 1 -column 0 -sticky news |
---|
| 2454 | lappend expgui(HistSelectList) $expgui(profFrame).hs |
---|
| 2455 | grid [scrollbar $expgui(profFrame).hs.x -orient horizontal \ |
---|
| 2456 | -command "move2boxes \" $expgui(profFrame).hs.title $expgui(profFrame).hs.lbox \" " |
---|
| 2457 | ] -row 2 -column 0 -sticky ew |
---|
| 2458 | grid [scrollbar $expgui(profFrame).hs.y \ |
---|
| 2459 | -command "$expgui(profFrame).hs.lbox yview"] \ |
---|
| 2460 | -row 1 -column 1 -sticky ns |
---|
| 2461 | grid columnconfigure $expgui(profFrame).hs 0 -weight 1 |
---|
| 2462 | grid rowconfigure $expgui(profFrame).hs 1 -weight 1 |
---|
| 2463 | bind $expgui(profFrame).hs.lbox <ButtonRelease-1> { |
---|
| 2464 | set expgui(curhist) [$expgui(profFrame).hs.lbox curselection] |
---|
| 2465 | DisplayProfile |
---|
| 2466 | } |
---|
| 2467 | bind $expgui(profFrame).hs.lbox <Button-3> { |
---|
| 2468 | if $expgui(globalmode) { |
---|
| 2469 | $expgui(profFrame).hs.lbox selection set 0 end |
---|
| 2470 | set expgui(curhist) [$expgui(profFrame).hs.lbox curselection] |
---|
| 2471 | DisplayProfile |
---|
| 2472 | } |
---|
| 2473 | } |
---|
| 2474 | |
---|
| 2475 | # Create a large canvas area containing a frame for each phase in the data set. |
---|
| 2476 | # The canvas and vertical scrollbar are inside a frame called f1 |
---|
| 2477 | pack [frame $expgui(profFrame).f1] -fill both -expand true |
---|
| 2478 | grid [set expgui(ProfileBox) [canvas $expgui(profFrame).f1.profileBox \ |
---|
| 2479 | -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \ |
---|
| 2480 | -sticky news -row 0 -column 0 |
---|
| 2481 | grid [scrollbar $expgui(profFrame).f1.yscroll -orient vertical] \ |
---|
| 2482 | -sticky ns -row 0 -column 1 |
---|
| 2483 | |
---|
| 2484 | $expgui(ProfileBox) config -yscrollcommand "$expgui(profFrame).f1.yscroll set" |
---|
| 2485 | $expgui(profFrame).f1.yscroll config -command { $expgui(ProfileBox) yview } |
---|
| 2486 | |
---|
| 2487 | grid columnconfigure $expgui(profFrame).f1 1 -weight 1 |
---|
| 2488 | grid rowconfigure $expgui(profFrame).f1 0 -weight 1 |
---|
| 2489 | frame $expgui(ProfileBox).f -bd 0 |
---|
| 2490 | $expgui(ProfileBox) create window 0 0 -anchor nw -window $expgui(ProfileBox).f |
---|
| 2491 | |
---|
| 2492 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PROFILE PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
| 2493 | ############################################################################## |
---|
| 2494 | # v v v v v v v v v v BEGINNING OF LS PANE CODE v v v v v v v v v v v v v |
---|
| 2495 | array set printopts { |
---|
| 2496 | 0 "Print the reciprocal metric tensor changes" |
---|
| 2497 | 1 "Print the correlation matrix" |
---|
| 2498 | 2 "Print the Least-Squares matrices and vectors" |
---|
| 2499 | 4 "Print the linear constraint matrices" |
---|
| 2500 | 5 "Print the applied shifts and shift factors" |
---|
| 2501 | 6 "Print the reciprocal metric tensor Var-Covar terms" |
---|
| 2502 | 7 "Print all parameters for each cycle" |
---|
| 2503 | 8 "Print summary shift/esd data after last cycle" |
---|
| 2504 | 9 "Print zero/unit pole figure constraint terms" |
---|
| 2505 | } |
---|
| 2506 | pack [frame $expgui(lsFrame).hs] -side left -expand y -fill both |
---|
| 2507 | grid [listbox $expgui(lsFrame).hs.title -height 1 -relief flat \ |
---|
| 2508 | -font $expgui(histfont) ] -row 0 -column 0 -sticky ew |
---|
| 2509 | grid [listbox $expgui(lsFrame).hs.lbox -height 10 -width 25 \ |
---|
| 2510 | -font $expgui(histfont) \ |
---|
| 2511 | -xscrollcommand "$expgui(lsFrame).hs.x set" \ |
---|
| 2512 | -yscrollcommand "$expgui(lsFrame).hs.y set" \ |
---|
| 2513 | ] -row 1 -column 0 -sticky news |
---|
| 2514 | lappend expgui(HistSelectList) $expgui(lsFrame).hs |
---|
| 2515 | grid [scrollbar $expgui(lsFrame).hs.x -orient horizontal \ |
---|
| 2516 | -command "move2boxes \" $expgui(lsFrame).hs.title $expgui(lsFrame).hs.lbox \" " |
---|
| 2517 | ] -row 2 -column 0 -sticky ew |
---|
| 2518 | grid [scrollbar $expgui(lsFrame).hs.y \ |
---|
| 2519 | -command "$expgui(lsFrame).hs.lbox yview"] \ |
---|
| 2520 | -row 1 -column 1 -sticky ns |
---|
| 2521 | grid columnconfigure $expgui(lsFrame).hs 0 -weight 1 |
---|
| 2522 | grid rowconfigure $expgui(lsFrame).hs 1 -weight 1 |
---|
| 2523 | bind $expgui(lsFrame).hs.lbox <ButtonRelease-1> { |
---|
| 2524 | set expgui(curhist) [$expgui(lsFrame).hs.lbox curselection] |
---|
| 2525 | SetupExtractHist |
---|
| 2526 | } |
---|
| 2527 | bind $expgui(lsFrame).hs.lbox <Button-3> { |
---|
| 2528 | if $expgui(globalmode) { |
---|
| 2529 | $expgui(lsFrame).hs.lbox selection set 0 end |
---|
| 2530 | set expgui(curhist) [$expgui(lsFrame).hs.lbox curselection] |
---|
| 2531 | SetupExtractHist |
---|
| 2532 | } |
---|
| 2533 | } |
---|
| 2534 | # need to respond to mouse presses -- control variable associated with extract Fobs |
---|
| 2535 | # and set the LeBail extraction flags |
---|
| 2536 | proc SetupExtractHist {} { |
---|
| 2537 | global expgui entrycmd entryvar expmap |
---|
| 2538 | |
---|
| 2539 | # display the selected histograms |
---|
| 2540 | $expgui(lsFrame).hs.lbox selection clear 0 end |
---|
| 2541 | foreach h $expgui(curhist) { |
---|
| 2542 | $expgui(lsFrame).hs.lbox selection set $h |
---|
| 2543 | } |
---|
| 2544 | # disable traces on entryvar for right now |
---|
| 2545 | set entrycmd(trace) 0 |
---|
| 2546 | |
---|
| 2547 | # get histogram list |
---|
| 2548 | set histlist {} |
---|
| 2549 | foreach item $expgui(curhist) { |
---|
| 2550 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
| 2551 | } |
---|
| 2552 | set entrycmd(fobsextract) "histinfo [list $histlist] foextract" |
---|
| 2553 | if {[llength $histlist] == 1} { |
---|
| 2554 | set entryvar(fobsextract) [histinfo $histlist foextract] |
---|
| 2555 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
| 2556 | # is the phase present? |
---|
| 2557 | if {[lsearch -exact $expmap(phaselist_$histlist) $phase] == -1} { |
---|
| 2558 | $expgui(lsFrame).f1.a.l$phase config -fg grey |
---|
| 2559 | set expgui(Fextract$phase) {} |
---|
[12] | 2560 | # foreach item "a.ca$phase a.cb$phase a.cc$phase" |
---|
| 2561 | foreach item "a.ca$phase a.cc$phase" { |
---|
[10] | 2562 | $expgui(lsFrame).f1.$item config -state disabled -bd 1 |
---|
| 2563 | } |
---|
| 2564 | } else { |
---|
| 2565 | $expgui(lsFrame).f1.a.l$phase config -fg black |
---|
[12] | 2566 | # foreach item "a.ca$phase a.cb$phase a.cc$phase" |
---|
| 2567 | foreach item "a.ca$phase a.cc$phase" { |
---|
[10] | 2568 | $expgui(lsFrame).f1.$item config -state normal -bd 2 |
---|
| 2569 | } |
---|
| 2570 | set expgui(Fextract$phase) [hapinfo $histlist $phase extmeth] |
---|
| 2571 | } |
---|
| 2572 | } |
---|
| 2573 | } else { |
---|
| 2574 | # multiple histograms need phases in any histogram |
---|
| 2575 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
| 2576 | set gotphase($phase) 0 |
---|
| 2577 | } |
---|
| 2578 | foreach hist $histlist { |
---|
| 2579 | foreach phase $expmap(phaselist_$hist) { |
---|
| 2580 | set gotphase($phase) 1 |
---|
| 2581 | } |
---|
| 2582 | } |
---|
| 2583 | foreach phase {1 2 3 4 5 6 7 8 9} { |
---|
| 2584 | set expgui(Fextract$phase) {} |
---|
| 2585 | if $gotphase($phase) { |
---|
| 2586 | $expgui(lsFrame).f1.a.l$phase config -fg black |
---|
| 2587 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
| 2588 | $expgui(lsFrame).f1.$item config -state normal -bd 2 |
---|
| 2589 | } |
---|
| 2590 | } else { |
---|
| 2591 | $expgui(lsFrame).f1.a.l$phase config -fg grey |
---|
| 2592 | foreach item "a.ca$phase a.cb$phase a.cc$phase" { |
---|
| 2593 | $expgui(lsFrame).f1.$item config -state disabled -bd 1 |
---|
| 2594 | } |
---|
| 2595 | } |
---|
| 2596 | } |
---|
| 2597 | } |
---|
| 2598 | # reenable traces |
---|
| 2599 | set entrycmd(trace) 1 |
---|
| 2600 | } |
---|
| 2601 | # respond to a change in the fobs extraction method for a phase |
---|
| 2602 | # force the main extraction flag on, if fobs extraction is selected for any phase |
---|
| 2603 | proc HistExtractSet {phase} { |
---|
| 2604 | global expgui entryvar expmap |
---|
| 2605 | foreach item $expgui(curhist) { |
---|
| 2606 | lappend histlist [lindex $expmap(powderlist) $item] |
---|
| 2607 | } |
---|
| 2608 | hapinfo $histlist $phase extmeth set $expgui(Fextract$phase) |
---|
| 2609 | if {$expgui(Fextract$phase) != 0} {set entryvar(fobsextract) 1} |
---|
| 2610 | } |
---|
| 2611 | |
---|
| 2612 | pack [frame $expgui(lsFrame).f1] -fill both -expand true |
---|
| 2613 | grid rowconfigure $expgui(lsFrame).f1 4 -weight 1 |
---|
[16] | 2614 | grid [label $expgui(lsFrame).f1.his1 -pady 6 -text "Last History:"] -row 0 -column 0 |
---|
| 2615 | grid [label $expgui(lsFrame).f1.his2 -relief sunken -bd 2 -pady 6 \ |
---|
| 2616 | -textvariable expgui(last_History)] \ |
---|
| 2617 | -row 0 -column 1 -columnspan 5 -sticky w |
---|
| 2618 | grid [frame $expgui(lsFrame).f1.b -bd 4 -relief groove] \ |
---|
| 2619 | -row 1 -column 0 -columnspan 2 -pady 3 |
---|
[10] | 2620 | grid [label $expgui(lsFrame).f1.b.lcyc -text "Number of Cycles"] -row 0 -column 0 |
---|
| 2621 | grid [entry $expgui(lsFrame).f1.b.ecyc -width 3 \ |
---|
| 2622 | -textvariable entryvar(cycles)] -row 0 -column 1 |
---|
| 2623 | grid [menubutton $expgui(lsFrame).f1.lprint -textvariable expgui(printopt) \ |
---|
| 2624 | -menu $expgui(lsFrame).f1.lprint.menu -bd 4 -relief raised \ |
---|
[16] | 2625 | ] -row 1 -column 2 |
---|
[10] | 2626 | menu $expgui(lsFrame).f1.lprint.menu |
---|
| 2627 | foreach num [lsort [array names printopts]] { |
---|
| 2628 | $expgui(lsFrame).f1.lprint.menu add checkbutton \ |
---|
| 2629 | -label "$printopts($num) ([expr int(pow(2,$num))])"\ |
---|
| 2630 | -variable entryvar(printopt$num) |
---|
| 2631 | } |
---|
[16] | 2632 | grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row 1 -column 3 |
---|
[10] | 2633 | grid [label $expgui(lsFrame).f1.c.fol -text "Extract Fobs"] -row 0 -column 2 |
---|
| 2634 | grid [checkbutton $expgui(lsFrame).f1.c.foc -variable entryvar(fobsextract)] -row 0 -column 3 |
---|
| 2635 | |
---|
| 2636 | grid [frame $expgui(lsFrame).f1.a -bd 4 -relief groove] -row 3 -column 0 -columnspan 6 |
---|
| 2637 | foreach num {1 2 3 4 5 6 7 8 9} { |
---|
| 2638 | grid [label $expgui(lsFrame).f1.a.l$num -text $num] -row 1 -column $num |
---|
| 2639 | grid [radiobutton $expgui(lsFrame).f1.a.cc$num \ |
---|
| 2640 | -command "HistExtractSet $num" \ |
---|
| 2641 | -variable expgui(Fextract$num) -value 0] \ |
---|
| 2642 | -row 2 -column $num |
---|
| 2643 | grid [radiobutton $expgui(lsFrame).f1.a.ca$num \ |
---|
| 2644 | -command "HistExtractSet $num" \ |
---|
| 2645 | -variable expgui(Fextract$num) -value 1] \ |
---|
| 2646 | -row 3 -column $num |
---|
[12] | 2647 | # grid [radiobutton $expgui(lsFrame).f1.a.cb$num \ |
---|
| 2648 | # -command "HistExtractSet $num" \ |
---|
| 2649 | # -variable expgui(Fextract$num) -value 2] \ |
---|
| 2650 | # -row 4 -column $num |
---|
[10] | 2651 | } |
---|
| 2652 | grid [label $expgui(lsFrame).f1.a.t -text "Intensity Extraction Method" -anchor c] \ |
---|
| 2653 | -column 0 -columnspan 11 -row 0 |
---|
| 2654 | grid [label $expgui(lsFrame).f1.a.t0 -text "Histogram #" -anchor c] -column 0 -row 1 |
---|
| 2655 | grid [label $expgui(lsFrame).f1.a.t1 -text "Rietveld" -anchor c] -column 0 -row 2 |
---|
| 2656 | grid [label $expgui(lsFrame).f1.a.t2 -text "F(calc) Weighted" -anchor c] -column 0 -row 3 |
---|
[12] | 2657 | #grid [label $expgui(lsFrame).f1.a.t3 -text "Equally Weighted" -anchor c] -column 0 -row 4 |
---|
[10] | 2658 | grid [label $expgui(lsFrame).f1.a.t2a -text "(Model biased)" -anchor c] -column 10 -row 3 |
---|
[12] | 2659 | #grid [label $expgui(lsFrame).f1.a.t3a -text "(Le Bail method)" -anchor c] -column 10 -row 4 |
---|
[10] | 2660 | # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF LS PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
---|
| 2661 | #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv THE MENU BAR vvvvvvvvvvvvvvvvvvvvvv |
---|
| 2662 | |
---|
| 2663 | #---- file menu button |
---|
| 2664 | menubutton $expgui(fm).file -text File -underline 0 -menu $expgui(fm).file.menu |
---|
| 2665 | menu $expgui(fm).file.menu |
---|
| 2666 | if $expgui(debug) { |
---|
| 2667 | $expgui(fm).file.menu add command -label "Reset" -underline 0 \ |
---|
| 2668 | -command "reset" |
---|
| 2669 | } |
---|
| 2670 | $expgui(fm).file.menu add command -label "Save" -underline 0 \ |
---|
[14] | 2671 | -command {savearchiveexp $expfile} |
---|
[10] | 2672 | $expgui(fm).file.menu add command -label "Save As" -underline 1 \ |
---|
| 2673 | -command "SaveAsFile" |
---|
| 2674 | $expgui(fm).file.menu add command -label "Reread .EXP file" -underline 0 \ |
---|
| 2675 | -command {rereadexp $expfile} |
---|
| 2676 | $expgui(fm).file.menu add command -label "Other .EXP file" -underline 0 \ |
---|
| 2677 | -command {readnewexp} |
---|
| 2678 | #$expgui(fm).file.menu add command -label "Close" -underline 0 |
---|
| 2679 | $expgui(fm).file.menu add command -label "Exit" -underline 1 -command catchQuit |
---|
| 2680 | |
---|
| 2681 | #---- help menu button |
---|
| 2682 | menubutton $expgui(fm).help -text Help -underline 0 -menu $expgui(fm).help.menu |
---|
| 2683 | menu $expgui(fm).help.menu |
---|
| 2684 | $expgui(fm).help.menu add command -label "About..." -underline 0 -command { About } |
---|
| 2685 | #$expgui(fm).help.menu add command -label "GSAStk" -underline 0 -command { GSAStkHelp } |
---|
| 2686 | |
---|
| 2687 | #---- options menu button |
---|
[16] | 2688 | menubutton $expgui(fm).option -text Options -underline 0 \ |
---|
| 2689 | -menu $expgui(fm).option.menu |
---|
| 2690 | menu $expgui(fm).option.menu |
---|
| 2691 | |
---|
| 2692 | $expgui(fm).option.menu add checkbutton -label "Archive EXP" \ |
---|
| 2693 | -variable expgui(archive) -underline 0 |
---|
| 2694 | |
---|
| 2695 | $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.asort \ |
---|
[10] | 2696 | -label "Sort atoms by" |
---|
| 2697 | |
---|
| 2698 | set expgui(asorttype) number |
---|
[16] | 2699 | menu $expgui(fm).option.menu.asort |
---|
| 2700 | $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
[10] | 2701 | -label number -value number -variable expgui(asorttype) |
---|
[16] | 2702 | $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
[10] | 2703 | -label type -value type -variable expgui(asorttype) |
---|
[16] | 2704 | $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
[10] | 2705 | -label x -value x -variable expgui(asorttype) |
---|
[16] | 2706 | $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
[10] | 2707 | -label y -value y -variable expgui(asorttype) |
---|
[16] | 2708 | $expgui(fm).option.menu.asort add radiobutton -command DisplayAllAtoms \ |
---|
[10] | 2709 | -label z -value z -variable expgui(asorttype) |
---|
| 2710 | |
---|
| 2711 | |
---|
[16] | 2712 | $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.hsort \ |
---|
[10] | 2713 | -label "Sort histograms by" |
---|
| 2714 | |
---|
| 2715 | set expgui(hsorttype) number |
---|
[16] | 2716 | menu $expgui(fm).option.menu.hsort |
---|
| 2717 | $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ |
---|
[10] | 2718 | -label number -value number -variable expgui(hsorttype) |
---|
[16] | 2719 | $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ |
---|
[10] | 2720 | -label "Histogram type" -value type -variable expgui(hsorttype) |
---|
[16] | 2721 | $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ |
---|
[10] | 2722 | -label "Bank #" -value bank -variable expgui(hsorttype) |
---|
[16] | 2723 | $expgui(fm).option.menu.hsort add radiobutton -command sethistlist \ |
---|
[10] | 2724 | -label "Angle/Wavelength" -value angle -variable expgui(hsorttype) |
---|
| 2725 | |
---|
[16] | 2726 | #---- Global mode menu button |
---|
| 2727 | $expgui(fm).option.menu add cascade -menu $expgui(fm).option.menu.editmode \ |
---|
| 2728 | -label "Global mode" |
---|
| 2729 | menu $expgui(fm).option.menu.editmode |
---|
| 2730 | $expgui(fm).option.menu.editmode add radiobutton -label "Off" \ |
---|
| 2731 | -variable expgui(globalmode) -underline 0 -value 0\ |
---|
| 2732 | -command sethistlist |
---|
| 2733 | $expgui(fm).option.menu.editmode add radiobutton -label "All" \ |
---|
| 2734 | -variable expgui(globalmode) -underline 0 -value 6 \ |
---|
| 2735 | -command sethistlist |
---|
| 2736 | $expgui(fm).option.menu.editmode add radiobutton -label "TOF" \ |
---|
| 2737 | -variable expgui(globalmode) -underline 0 -value 1 \ |
---|
| 2738 | -command sethistlist |
---|
| 2739 | $expgui(fm).option.menu.editmode add radiobutton -label "CW Neutron" \ |
---|
| 2740 | -variable expgui(globalmode) -underline 0 -value 2 \ |
---|
| 2741 | -command sethistlist |
---|
| 2742 | $expgui(fm).option.menu.editmode add radiobutton -label "Alpha12 Xray" \ |
---|
| 2743 | -variable expgui(globalmode) -underline 0 -value 3 \ |
---|
| 2744 | -command sethistlist |
---|
| 2745 | $expgui(fm).option.menu.editmode add radiobutton -label "Monochromatic Xray" \ |
---|
| 2746 | -variable expgui(globalmode) -underline 0 -value 4 \ |
---|
| 2747 | -command sethistlist |
---|
| 2748 | $expgui(fm).option.menu.editmode add radiobutton -label "Energy Disp Xray" \ |
---|
| 2749 | -variable expgui(globalmode) -underline 0 -value 5 \ |
---|
| 2750 | -command sethistlist |
---|
| 2751 | set expgui(globalmode) 0 |
---|
| 2752 | |
---|
| 2753 | pack $expgui(fm).file $expgui(fm).option -side left -in $expgui(fm) |
---|
[10] | 2754 | pack $expgui(fm).help -side right -in $expgui(fm) |
---|
| 2755 | |
---|
| 2756 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF MENU DEFINITION ^^^^^^^^^^^^^^^^^^^ |
---|
| 2757 | |
---|
| 2758 | # handle indirect exits |
---|
| 2759 | wm protocol . WM_DELETE_WINDOW catchQuit |
---|
| 2760 | bind . <Control-c> catchQuit |
---|
| 2761 | |
---|
| 2762 | loadexp $expfile |
---|