Changeset 133 for trunk/expgui


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

# on 2000/05/17 16:17:21, toby did:
cleanup reading lowercase .exp files
remove Tix!!! replace with BWidget
use options (opt.tcl) to get Tix-like appearance
treat "fixed" .EXP files as changed (to force a write before use)
Add support for 2 "leBail" options in the '00 version of GSAS
Change display of update message when .EXP is changed (with attention
to Windows screen placement)
Ignore macromolecular phases; recognize & flag magnetic phases
Use BWidget frame labels where possible
Move pane drawing from global code to MakePhasePane?, MakeHistPane?, MakeScalingPane? {} {
Move pane drawing from global code to MakePhasePane?, MakeHistPane?, MakeScalingPane?, MakeProfilePane?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 1999/11/19 00:03:25 to 2000/05/17 16:17:21
    • Property rcs:lines changed from +15 -27 to +730 -518
    • Property rcs:rev changed from 1.22 to 1.23
    r123 r133  
    3838        append expgui(expfile) ".EXP"
    3939    }
    40     if {[file dirname $expgui(expfile)] == "."} {
    41         set expgui(expfile) [string toupper $expgui(expfile)]
    42     } else {
    43         set expgui(expfile) [file join \
    44                 [file dirname $expgui(expfile)] \
    45                 [file tail [string toupper $expgui(expfile)]]
    46         ]
    47     }
    4840} else {
    4941    set expgui(expfile) {}
     
    5446#set expgui(debug) 1
    5547
    56 set expgui(havetix) 1
    57 # for debugging non-Tix version set environment variable NOTIX
    58 catch {if $env(NOTIX) {set expgui(havetix) 0}}
    59 if $expgui(havetix) {
    60     if [catch {package require Tix}] {set expgui(havetix) 0}
    61 }
    6248# default for archive mode = on
    6349set expgui(archive) 1
     
    116102set expgui(gsasexe) [file join $expgui(gsasdir) exe]
    117103#----------------------------------------------------------------
     104lappend auto_path $expgui(scriptdir)
     105set expgui(havetix) 0
     106set expgui(haveBW) 1
     107# for debugging non-BWidget version set environment variable NOBWIDGET
     108catch {if $env(NOBWIDGET) {set expgui(haveBW) 0}}
     109if $expgui(haveBW) {
     110    if [catch {package require BWidget}] {set expgui(haveBW) 0}
     111}
     112# get the notebook widget if not using BWidgets
     113if {!$expgui(haveBW)} {source $expgui(scriptdir)/notebook.tcl}
     114#----------------------------------------------------------------
     115if [file exists [file join $expgui(scriptdir) opts.tcl]] {
     116    source [file join $expgui(scriptdir) opts.tcl]
     117}
    118118# fetch EXP file processing routines
    119119source [file join $expgui(scriptdir) readexp.tcl]
     
    124124# commands for adding phases, histograms & atoms
    125125source [file join $expgui(scriptdir) addcmds.tcl]
    126 # get the notebook widget if not using Tix
    127 if {!$expgui(havetix)} {source $expgui(scriptdir)/notebook.tcl}
    128126#---------------------------------------------------------------------------
    129127# override options with locally defined values
     
    178176# load exp file and set up dialogs
    179177proc loadexp {expfile} {
    180     global expgui expmap entryvar entrycmd
    181     global exparray
     178    global expgui expmap entryvar entrycmd tcl_platform
     179    set exploadtime [time {set fmt [expload $expfile]}]
     180    if $expgui(debug) {puts "expload $exploadtime"}
     181    # if the file was not in the correct format, force a rewrite before use
     182    if {$fmt < 0} {
     183        # read error
     184        return
     185    } elseif {$fmt == 0 && $tcl_platform(platform) == "windows"} {
     186        set expgui(changed) 1
     187    } elseif {$fmt == 1 && $tcl_platform(platform) == "unix"} {
     188        set expgui(changed) 1
     189    } else {
     190        set expgui(changed) 0
     191    }
     192
     193    # force exp files to be upper case, force save if name changes
     194    set filetail [file tail $expfile]
     195    set filetailcaps [string toupper $filetail]
     196    if {$tcl_platform(platform) == "unix" && $filetail != $filetailcaps} {
     197        set expgui(changed) 1
     198    }
     199    if {[file dirname $expfile] == "."} {
     200        set expgui(expfile) $filetailcaps
     201    } else {
     202        set expgui(expfile) [file join \
     203                [file dirname $expfile] $filetailcaps]
     204    }
     205
     206    mapexp
     207    set expgui(expModifiedLast) 0
    182208    catch {
    183         unset exparray
    184     }
    185     set exploadtime [time {expload $expfile}]
    186     if $expgui(debug) {puts "expload $exploadtime"}
    187     set expgui(changed) 0
    188     mapexp
    189     set expgui(expModifiedLast) [file mtime $expfile]
     209        set expgui(expModifiedLast) [file mtime $expgui(expfile)]
     210    }
    190211    set expgui(last_History) [string range [string trim [lindex [exphistory last] 1]] 0 50 ]
    191212    # set the window/icon title
     
    239260    trace variable entryvar w entvartrace
    240261
    241     # set fo extaction on LS page
     262    # set fo extraction on LS page
    242263    SetupExtractHist
    243264
     
    376397    }
    377398    foreach a {
    378         exparray expmap expgui entryvar entrycmd 
     399        expmap expgui entryvar entrycmd 
    379400        expgui_menulist expgui_cmdlist expgui_helplist
    380401    } {
     
    427448}
    428449
     450# This is called every 2 seconds to check for changes to the .EXP file
    429451proc whenidle {} {
    430452    global expgui
     
    435457        }
    436458    }
    437     if {[file mtime $expgui(expfile)] != $expgui(expModifiedLast) && \
    438         $expgui(expModifiedLast) != 0} {
    439         if {$expgui(changed) == 0} {
    440             set ans [tk_dialog .expFileErrorMsg "Reload?" \
    441                     "File [file tail $expgui(expfile)] has been modified by another program. \
    442 Do you want to load the newer version or lose the modifications \
    443 by editing the current version?" \
    444                     warning 0 "Load new" "Continue editing"]
    445         } else {
    446             set ans [tk_dialog .expFileErrorMsg "Reload?" \
    447                     "File [file tail $expgui(expfile)] has been modified by another program \
    448 and you have made $expgui(changed) changes to this version. \
    449 Do you want to load the newer version or lose the modifications \
    450 by continuing to edit the current version?" \
    451                     warning 0 "Load new" "Continue editing" "Save edited version"]
    452         }
     459    if {$expgui(expModifiedLast) == 0} {
     460        after 2000 afterawhile
     461        return
     462    }
     463    if {[file mtime $expgui(expfile)] != $expgui(expModifiedLast)} {
     464        set ans [ReloadExpMsg [file tail $expgui(expfile)] $expgui(changed)]
    453465        if {$ans == 0} {
    454466            loadexp $expgui(expfile)
     
    462474    after 2000 afterawhile
    463475}
     476
     477# place a message about changes over the main window
     478proc ReloadExpMsg {file changes} {
     479    global expgui tcl_platform
     480    set msg "File $file has been modified by another program"
     481    if {$changes == 1} {
     482        append msg " and you have made a change to this version.\n"
     483    } elseif {$changes > 0} {
     484        append msg " and you have made $changes changes to this version.\n"
     485    } else {
     486        append msg ".\n"
     487    }
     488    append msg "Do you want to load the newer version or lose the modification by editing the current version?"
     489    set w .ask
     490    catch {destroy $w}
     491    toplevel $w -class Dialog
     492    wm title $w "Reload?"
     493    wm iconname $w "Reload?"
     494    wm protocol $w WM_DELETE_WINDOW { }
     495    wm transient $w .
     496    frame $w.bot
     497    pack $w.bot -side bottom
     498    frame $w.top
     499    pack $w.top -side top -fill both -expand 1
     500    label $w.top.msg -justify left \
     501            -wraplength 5i -font {Times 18} \
     502            -text $msg
     503    if {$tcl_platform(platform) == "windows"} {
     504        $w.top.msg config -font {Times 14}
     505    }
     506    pack $w.top.msg  -side right -expand 1 -fill both -padx 3m -pady 3m
     507    pack [button $w.bot.1 -text "Load new" \
     508            -default active -command "set expgui(dialogbutton) 0" \
     509            ] -side left -expand 1 -padx 3m -pady 2m
     510    pack [button $w.bot.2 -text "Continue editing" \
     511            -command "set expgui(dialogbutton) 1"] \
     512            -side left -expand 1 -padx 3m -pady 2m
     513    if {$changes > 0} {
     514        pack [button $w.bot.3 -text "Save edited version" \
     515            -command "set expgui(dialogbutton) 2"] \
     516            -side left -expand 1 -padx 3m -pady 2m
     517    }
     518    # Create a binding for <Return> on the dialog
     519    bind $w <Return> "tkButtonInvoke $w.bot.1"
     520    wm withdraw $w
     521    update idletasks
     522
     523    # for windows put the box in the upper left, for
     524    # unix center it over the parent (in unix it appears later)
     525    #if {$tcl_platform(platform) == "windows"} {
     526        #wm geom $w +0+0
     527    #} else {
     528
     529        # for now, always center the message over the main window
     530        # center the new window in the middle of the parent
     531        set x [expr [winfo x .] + [winfo width .]/2 - \
     532                [winfo reqwidth $w]/2 - [winfo vrootx .]]
     533        set y [expr [winfo y .] + [winfo height .]/2 - \
     534                [winfo reqheight $w]/2 - [winfo vrooty .]]
     535        wm geom $w +$x+$y
     536    #}
     537    wm deiconify $w
     538
     539    # Grab the focus
     540    set oldFocus [focus]
     541    set oldGrab [grab current $w]
     542    if {[string compare $oldGrab ""]} {
     543        set grabStatus [grab status $oldGrab]
     544    }
     545    grab $w
     546    focus $w.bot.1
     547    # for windows rearrange window stacking
     548    if {$tcl_platform(platform) == "windows"} {
     549        lower .
     550        raise $w .
     551    }
     552    update idletasks
     553
     554    tkwait variable expgui(dialogbutton)
     555    catch {focus $oldFocus}
     556    destroy $w
     557    if {[string compare $oldGrab ""]} {
     558      if {![string compare $grabStatus "global"]} {
     559            grab -global $oldGrab
     560        } else {
     561            grab $oldGrab
     562        }
     563    }
     564    raise .
     565    return $expgui(dialogbutton)
     566}
     567
    464568# --------  called to confirm before exiting
    465569proc catchQuit {} {
     
    486590proc archiveexp {} {
    487591    global expgui tcl_platform
     592    # is there a file to archive
     593    if {![file exists $expgui(expfile)]} return
    488594    catch {
    489595        set expnam [file rootname $expgui(expfile)]
     
    562668}
    563669
    564 # set the number of phases on the phase page
     670# setup buttons for each phase on the phase page
    565671proc setphases {} {
    566672    global expgui expmap
    567673    eval destroy [pack slaves $expgui(phaseFrame).top.ps]
    568     foreach num $expmap(phaselist) {
     674    foreach num $expmap(phaselist) type $expmap(phasetype) {
    569675        pack [button $expgui(phaseFrame).top.ps.$num -text $num \
    570676                -command "SelectOnePhase $num"] -side left
     677        if {$type > 3} {
     678            $expgui(phaseFrame).top.ps.$num config -state disabled
     679        }
    571680    }
    572681}
     
    576685proc SelectOnePhase {num} {
    577686    global entryvar entrycmd expmap expgui
    578     foreach n $expmap(phaselist) {
    579         if {$n == $num} {
    580              $expgui(phaseFrame).top.ps.$num config -relief sunken
     687    set crsPhase {}
     688    foreach n $expmap(phaselist) type $expmap(phasetype) {
     689        if {$n == $num && $type <= 3} {
     690            $expgui(phaseFrame).top.ps.$num config -relief sunken
     691            set crsPhase $num
     692            if {$type == 3} {
     693                set expgui(phasetype) "Magnetic\nOnly"
     694            } elseif {$type == 2} {
     695                set expgui(phasetype) "Magnetic\n& Nuclear"
     696            } elseif {$type == 4} {
     697                # this is not used at present
     698                set expgui(phasetype) "Macromolecular"
     699            } else {
     700                set expgui(phasetype) ""
     701            }
    581702        } else {
    582703            $expgui(phaseFrame).top.ps.$n config -relief raised
    583704        }
    584705    }
    585     set crsPhase $num
    586706    # no phase is selected
    587707    if {$crsPhase == "" || [llength $expmap(phaselist)] == 0} {
     
    15111631    eval destroy [grid slaves $phaseFractf1]
    15121632    if {$expgui(globalmode) != 0} {
    1513         grid [label $phaseFractf1.txt -anchor center \
    1514                 -text "Phase Fractions for Histograms: [CompressList $histlist]"] \
     1633        set txt "Phase Fractions for Histograms: [CompressList $histlist]"
     1634    } else {
     1635        set txt "Phase Fractions"
     1636    }
     1637    if $expgui(haveBW) {
     1638        $expgui(fracFrame).f1.phaseFrac configure -text $txt
     1639    } else {
     1640        grid [label $phaseFractf1.txt -anchor center -text $txt] \
    15151641                -column 0 -row 0 -sticky news
    1516     } else {
    1517         grid [label $phaseFractf1.txt -anchor center \
    1518                 -text "Phase Fractions"] -column 0 -row 0 -sticky news
    15191642    }
    15201643    # Create the frame inside the canvas, One frame for each Phase.
     
    15321655        if {$expgui(globalmode) != 0} {
    15331656            grid [label $framePF.l1 \
    1534                     -text "Phase $i Hist: [CompressList $phasehistlist($i)] Fraction"] \
     1657                    -text "Phase $i Hist: [CompressList $phasehistlist($i)]"] \
    15351658                    -column 0 -row 0 -sticky nws
    15361659            grid [button $framePF.but1 -text "Set Globally" \
     
    15391662                    ] -column 1 -row 0
    15401663        } else {
    1541             grid [label $framePF.l1  -text "Phase $i fraction"] \
     1664            grid [label $framePF.l1  -text "Phase $i"] \
    15421665                    -column 0 -row 0 -sticky nws
    15431666            grid [entry $framePF.ent -textvariable entryvar(frac$i) -width 15]\
     
    16011724        foreach i $expmap(phaselist_$hist) {
    16021725            incr ind
    1603             grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \
    1604                     -column 0 -row $ind -sticky ew
    1605             grid [frame $expgui(ProfileBox).f.$i.1] \
    1606                     -column 0 -row 0 -columnspan 10 -sticky ew
    16071726            # Label Heading for each phase.
    16081727            set ptype [string trim [hapinfo $hist $i proftype]]
    1609             pack [label $expgui(ProfileBox).f.$i.1.l  \
    1610                     -text "Phase $i -- type $ptype    Damping"]\
    1611                     -side left
    1612             tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp entryvar(pdamp_$i) \
     1728            if {$expgui(haveBW)} {
     1729                grid [TitleFrame $expgui(ProfileBox).f.$i \
     1730                        -text "Hist $hist -- Phase $i (type $ptype)" \
     1731                        -relief groove -bd 2] \
     1732                        -column 0 -row $ind -sticky ew
     1733                set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
     1734                grid [frame $ProfileFrame.1] \
     1735                        -column 0 -row 0 -columnspan 10
     1736                pack [label $ProfileFrame.1.l  \
     1737                        -text Damping]\
     1738                        -side left
     1739            } else {
     1740                grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \
     1741                        -column 0 -row $ind -sticky ew
     1742                set ProfileFrame $expgui(ProfileBox).f.$i
     1743                grid [frame $ProfileFrame.1] \
     1744                        -column 0 -row 0 -columnspan 10 -sticky ew
     1745                pack [label $ProfileFrame.1.l  \
     1746                        -text "Phase $i (type $ptype)    Damping"]\
     1747                        -side left
     1748            }
     1749            tk_optionMenu $ProfileFrame.1.tkOptDamp entryvar(pdamp_$i) \
    16131750                    0 1 2 3 4 5 6 7 8 9
    16141751            set entrycmd(pdamp_$i) "hapinfo $hist $i pdamp"
    16151752            set entryvar(pdamp_$i) [hapinfo $hist $i pdamp]
    1616             pack $expgui(ProfileBox).f.$i.1.tkOptDamp -side left
    1617             pack [label $expgui(ProfileBox).f.$i.1.l1 \
     1753            pack $ProfileFrame.1.tkOptDamp -side left
     1754            pack [label $ProfileFrame.1.l1 \
    16181755                    -text "  Peak cutoff"]\
    16191756                    -side left
    1620             pack [entry $expgui(ProfileBox).f.$i.1.e1  \
     1757            pack [entry $ProfileFrame.1.e1  \
    16211758                    -width 10 -textvariable entryvar(pcut_$i)]\
    16221759                    -side left
     
    16361773                if {$term == ""} {set term $num}
    16371774                incr col
    1638                 grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \
     1775                grid [label $ProfileFrame.l${num}_${i} -text "$term"] \
    16391776                        -row $row -column $col
    16401777                incr col
    1641                 grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \
     1778                grid [checkbutton $ProfileFrame.ref${num}_${i} \
    16421779                        -variable entryvar(pref${num}_$i)] -row $row -column $col
    16431780                set entrycmd(pref${num}_$i) "hapinfo $hist $i pref$num"
    16441781                set entryvar(pref${num}_$i) [hapinfo $hist $i pref$num]
    16451782                incr col
    1646                 grid [entry $expgui(ProfileBox).f.$i.ent${num}_${i} \
     1783                grid [entry $ProfileFrame.ent${num}_${i} \
    16471784                        -textvariable entryvar(pterm${num}_$i)\
    16481785                        -width 12] -row $row -column $col
     
    16971834                incr i
    16981835                set boxtitle "Phase $p, hist [CompressList $histarray($key)]"
    1699                 grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \
    1700                         -column 0 -row $i -sticky ew
    1701                 grid [frame $expgui(ProfileBox).f.$i.0] \
    1702                         -column 0 -row 0 -columnspan 20 -sticky ew
    1703                 grid [label $expgui(ProfileBox).f.$i.0.0  \
    1704                         -text "Profile Type $ptype   "] -row 0 -column 0
    1705                 grid [label $expgui(ProfileBox).f.$i.0.1  \
     1836                if {$expgui(haveBW)} {
     1837                    grid [TitleFrame $expgui(ProfileBox).f.$i \
     1838                            -text "Histogram [CompressList $histarray($key)] (type $ptype)" \
     1839                            -relief groove -bd 2] \
     1840                            -column 0 -row $i -sticky ew
     1841                    set ProfileFrame [$expgui(ProfileBox).f.$i getframe]
     1842                    grid [frame $ProfileFrame.0] \
     1843                            -column 0 -row 0 -columnspan 20 -sticky ew
     1844                } else {
     1845                    grid [frame $expgui(ProfileBox).f.$i \
     1846                            -relief groove -bd 4] \
     1847                            -column 0 -row $i -sticky ew
     1848                    set ProfileFrame $expgui(ProfileBox).f.$i
     1849                    grid [frame $ProfileFrame.0] \
     1850                            -column 0 -row 0 -columnspan 20 -sticky ew
     1851                    grid [label $ProfileFrame.0.0  \
     1852                            -text "Profile Type $ptype   "] -row 0 -column 0
     1853                }
     1854                grid [label $ProfileFrame.0.1  \
    17061855                        -anchor w] -row 0 -column 1
    1707                 grid [frame $expgui(ProfileBox).f.$i.1] \
     1856                grid [frame $ProfileFrame.1] \
    17081857                        -column 0 -row 1 -columnspan 20 -sticky ew
    1709                 grid [label $expgui(ProfileBox).f.$i.1.2  \
     1858                grid [label $ProfileFrame.1.2  \
    17101859                        -text "Damping"] -row 0 -column 2
    1711                 tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp \
     1860                tk_optionMenu $ProfileFrame.1.tkOptDamp \
    17121861                        entryvar(pdamp_$i) 0 1 2 3 4 5 6 7 8 9
    1713                 grid $expgui(ProfileBox).f.$i.1.tkOptDamp -row 0 -column 3
    1714                 grid [button $expgui(ProfileBox).f.$i.1.edit \
     1862                grid $ProfileFrame.1.tkOptDamp -row 0 -column 3
     1863                grid [button $ProfileFrame.1.edit \
    17151864                        -text "Global Edit"] -row 0 -column 4 -sticky w
    17161865                set entryvar(pdamp_$i) [hapinfo $hist $phase pdamp]
     
    17221871                    if {$term == ""} {set term $num}
    17231872                    incr col
    1724                     grid [label $expgui(ProfileBox).f.$i.l${num}_${i} \
     1873                    grid [label $ProfileFrame.l${num}_${i} \
    17251874                            -text "$term"] -row $row -column $col
    17261875                    incr col
    1727                     grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \
     1876                    grid [checkbutton $ProfileFrame.ref${num}_${i} \
    17281877                            -variable entryvar(pref${num}_$i)] \
    17291878                            -row $row -column $col
     
    17381887                append boxtitle "\nPhase $p, hist [CompressList $histarray($key)]"
    17391888            }
    1740             $expgui(ProfileBox).f.$i.0.1 config -text $boxtitle
    1741             $expgui(ProfileBox).f.$i.1.edit config -command "\
     1889            $ProfileFrame.0.1 config -text $boxtitle
     1890            $ProfileFrame.1.edit config -command "\
    17421891                    EditProfile \"\n$boxtitle\" \
    17431892                    [list $curhistlist] \
     
    17591908    $expgui(ProfileBox) config -width [lindex [grid bbox $expgui(ProfileBox).f] 2]
    17601909    update idletasks
     1910    ResizeNotebook
    17611911    # enable traces on entryvar now
    17621912    set entrycmd(trace) 1
     
    18281978    if {[llength $histlist] == 0 || [string trim $histlist] == ""} {
    18291979        foreach phase {1 2 3 4 5 6 7 8 9} {
    1830             $expgui(lsFrame).f1.a.l$phase config -fg grey
     1980            $expgui(FobsExtractFrame).l$phase config -fg grey
    18311981            set expgui(Fextract$phase) {}
    18321982            foreach item $expgui(ExtractSettingsRadiobuttons) {
     
    18411991            # is the phase present?
    18421992            if {[lsearch -exact $expmap(phaselist_$histlist) $phase] == -1} {
    1843                 $expgui(lsFrame).f1.a.l$phase config -fg grey
     1993                $expgui(FobsExtractFrame).l$phase config -fg grey
    18441994                set expgui(Fextract$phase) {}
    18451995                foreach item $expgui(ExtractSettingsRadiobuttons) {
     
    18471997                }
    18481998            } else {
    1849                 $expgui(lsFrame).f1.a.l$phase config -fg black
     1999                $expgui(FobsExtractFrame).l$phase config -fg black
    18502000                foreach item $expgui(ExtractSettingsRadiobuttons) {
    18512001                    ${item}$phase config -state normal -bd 2
     
    18692019            set expgui(Fextract$phase) {}
    18702020            if $gotphase($phase) {
    1871                 $expgui(lsFrame).f1.a.l$phase config -fg black
     2021                $expgui(FobsExtractFrame).l$phase config -fg black
    18722022                foreach item $expgui(ExtractSettingsRadiobuttons) {
    18732023                    ${item}$phase config -state normal -bd 2
    18742024                }
    18752025            } else {
    1876                 $expgui(lsFrame).f1.a.l$phase config -fg grey
     2026                $expgui(FobsExtractFrame).l$phase config -fg grey
    18772027                foreach item $expgui(ExtractSettingsRadiobuttons) {
    18782028                    ${item}$phase config -state disabled -bd 1
     
    22562406# Creating the notebook with 5 panes: Phase, Histogram, Scaling, Profile
    22572407# & LS controls
    2258 if $expgui(havetix) {
    2259     pack [tixNoteBook .n] -expand yes -fill both
    2260     .n add lsFrame -label "LS Controls"
    2261     .n pageconfigure lsFrame -raisecmd \
    2262                 "set expgui(pagenow) lsFrame; SetupExtractHist"
     2408if $expgui(haveBW) {
     2409    pack [NoteBook .n -bd 2] -expand yes -fill both
     2410    set expgui(lsFrame) [\
     2411            .n insert end lsFrame -text "LS Controls" \
     2412            -raisecmd "set expgui(pagenow) lsFrame; SetupExtractHist"]
    22632413    lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
    2264     .n add phasePane -label "Phase"
    2265     .n pageconfigure phasePane -raisecmd \
    2266                 "set expgui(pagenow) phaseFrame; DisplayAllAtoms noreset"
     2414    set expgui(phaseFrame) [\
     2415            .n insert end phasePane -text "Phase" \
     2416            -raisecmd "set expgui(pagenow) phaseFrame; \
     2417            DisplayAllAtoms noreset"]
    22672418#    lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms noreset}"
    2268     .n add histPane -label "Histogram"
    2269     .n pageconfigure histPane -raisecmd \
    2270                 "set expgui(pagenow) histFrame; DisplayHistogram"
     2419    set expgui(histFrame) [\
     2420            .n insert end histPane -text "Histogram" \
     2421            -raisecmd "set expgui(pagenow) histFrame; DisplayHistogram" \
     2422            -createcmd MakeHistPane]
    22712423    lappend expgui(frameactionlist) "histFrame DisplayHistogram"
    2272     lappend expgui(GlobalModeAllDisable) "histFrame {.n pageconfigure histPane}"
    2273     .n add fracPane -label "Scaling"
    2274     .n pageconfigure fracPane -raisecmd \
    2275                 "set expgui(pagenow) fracFrame; DisplayFrac"
     2424    lappend expgui(GlobalModeAllDisable) "histFrame {.n itemconfigure histPane}"
     2425    set expgui(fracFrame) [\
     2426            .n insert end fracPane -text "Scaling" \
     2427            -raisecmd "set expgui(pagenow) fracFrame; DisplayFrac" \
     2428            -createcmd MakeScalingPane]
    22762429    lappend expgui(frameactionlist) "fracFrame DisplayFrac"
    2277     .n add profPane -label Profile
    2278     .n pageconfigure profPane -raisecmd \
    2279                 "set expgui(pagenow) profFrame; DisplayProfile"
     2430    set expgui(profFrame) [\
     2431            .n insert end profPane -text Profile \
     2432            -raisecmd "set expgui(pagenow) profFrame; DisplayProfile"\
     2433            -createcmd MakeProfilePane]
    22802434    lappend expgui(frameactionlist) "profFrame DisplayProfile"
    2281     lappend expgui(GlobalModeAllDisable) "profFrame {.n pageconfigure profPane}"
    2282     # Finding the pathname to the subwidget frames.
    2283     set expgui(phaseFrame) [.n subwidget phasePane]
    2284     set expgui(histFrame) [.n subwidget histPane]
    2285     set expgui(fracFrame) [.n subwidget fracPane]
    2286     set expgui(profFrame) [.n subwidget profPane]
    2287     set expgui(lsFrame) [.n subwidget lsFrame]
     2435    lappend expgui(GlobalModeAllDisable) "profFrame {.n itemconfigure profPane}"
    22882436} else {
    22892437    Notebook:create .n -pages {lsFrame phaseFrame histFrame fracFrame profFrame}
     
    23072455proc RaisePage {nextpage} {
    23082456    global expgui
    2309     if $expgui(havetix) {
     2457    if $expgui(haveBW) {
     2458        .n see $nextpage
    23102459        .n raise $nextpage
    23112460        set expgui(pagenow) $nextpage
     
    23152464    }
    23162465}
    2317 # this is only called when Tix is not present
     2466# this is only called when BWidget is not in use
    23182467proc InitPage {nextpage} {
    23192468    global expgui
    23202469    set expgui(pagenow) $nextpage
    23212470    foreach set $expgui(frameactionlist) {
    2322         if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1]
     2471        # don't worry about errors
     2472        catch {
     2473            if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1]
     2474        }
     2475    }
     2476}
     2477# resize the notebook to fit all the tabs and the largest page
     2478proc ResizeNotebook {} {
     2479    global expgui
     2480    if {$expgui(haveBW)} {
     2481        .n compute_size
     2482    } else {
     2483        Notebook:resize .n
    23232484    }
    23242485}
    23252486
    23262487#----------------------------------------------------------------------------
    2327 #\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/ \/ \/
    2328 #  Setup major frames here
    2329 frame $expgui(phaseFrame).top
    2330 set frameLatt [frame $expgui(phaseFrame).frameLatt]
    2331 #  This is a big frame in the Phase notebook pane to hold a list of CRS data.
    2332 set fbig [frame $expgui(phaseFrame).fbig -width 180 -relief raised -borderwidth 4 -bg beige]
    2333 #  This is a frame just below the big frame: fbig to allow edit of CRS data, One record at a time.
    2334 set frame3 [frame $expgui(phaseFrame).frame3 -width 100 -relief raised -borderwidth 4 -bg beige]
    2335 
    2336 grid $expgui(phaseFrame).top -sticky news -row 0 -column 0
    2337 grid $frameLatt -sticky news -row 2 -column 0
    2338 grid $fbig -sticky news -row 3 -column 0
    2339 # give extra space to the atoms box
    2340 grid columnconfigure $expgui(phaseFrame) 0 -weight 1
    2341 grid rowconfigure $expgui(phaseFrame) 3 -weight 1
    2342 grid $frame3 -sticky news -row 4 -column 0
    2343 grid columnconfigure $expgui(phaseFrame) 0 -weight 1
    2344 grid rowconfigure $expgui(phaseFrame) 3 -weight 1
    2345 grid [frame  $expgui(phaseFrame).top.ps] -column 0 -row 0 -sticky w
    2346 # this is where the buttons will go
    2347 pack [label $expgui(phaseFrame).top.ps.0 -text "Phases: "] -side left
    2348 
    2349 grid [label $expgui(phaseFrame).top.lA -text "  Phase name:" \
    2350         -fg blue ] -column 1 -row 0 -sticky e
    2351 grid [entry $expgui(phaseFrame).top.lB -textvariable entryvar(phasename) \
    2352         -fg blue -width 45] -column 2 -row 0 -sticky e
    2353 grid columnconfigure $expgui(phaseFrame).top 1 -weight 1
    2354 # ------------- Lattice Parameter Box ------------------
    2355 set e1 [entry $frameLatt.e1 -textvariable entryvar(a) -width 10]
    2356 set e2 [entry $frameLatt.e2 -textvariable entryvar(b) -width 10]
    2357 set e3 [entry $frameLatt.e3 -textvariable entryvar(c) -width 10]
    2358 set e4 [entry $frameLatt.e4 -textvariable entryvar(alpha) -width 10]
    2359 set e5 [entry $frameLatt.e5 -textvariable entryvar(beta) -width 10]
    2360 set e6 [entry $frameLatt.e6 -textvariable entryvar(gamma) -width 10]
    2361 set l1 [label $frameLatt.l1 -text "a"]
    2362 set l2 [label $frameLatt.l2 -text "b"]
    2363 set l3 [label $frameLatt.l3 -text "c"]
    2364 set l4 [label $frameLatt.l4 -text a -font symbol]
    2365 set l5 [label $frameLatt.l5 -text b -font symbol]
    2366 set l6 [label $frameLatt.l6 -text g -font symbol]
    2367 grid $e1 -column 1 -row 0 -padx 5
    2368 grid $e2 -column 3 -row 0 -padx 5
    2369 grid $e3 -column 5 -row 0 -padx 5
    2370 grid $e4 -column 1 -row 1 -padx 5
    2371 grid $e5 -column 3 -row 1 -padx 5
    2372 grid $e6 -column 5 -row 1 -padx 5
    2373 grid $l1 -column 0 -row 0 -padx 5 -sticky e
    2374 grid $l2 -column 2 -row 0 -padx 5 -sticky e
    2375 grid $l3 -column 4 -row 0 -padx 5 -sticky e
    2376 grid $l4 -column 0 -row 1 -padx 5 -sticky e
    2377 grid $l5 -column 2 -row 1 -padx 5 -sticky e
    2378 grid $l6 -column 4 -row 1 -padx 5 -sticky e
    2379 
    2380 grid [label $frameLatt.lr -text "Refine Cell"] -column 6 -row 0 -padx 5 -sticky e
    2381 grid [label $frameLatt.ld -text "Cell damping"] -column 6 -row 1 -padx 5 -sticky e
    2382 set cFlag [checkbutton $frameLatt.c -text "" -variable entryvar(cellref)]
    2383 grid $cFlag -column 7 -row 0 -padx 5 -sticky e
    2384 tk_optionMenu $frameLatt.om entryvar(celldamp) 0 1 2 3 4 5 6 7 8 9
    2385 grid $frameLatt.om -column 7 -row 1 -padx 5 -sticky e
    2386 if [file executable $expgui(exptool)] {
    2387     button $frameLatt.newp -text Add\nPhase -command MakeAddPhaseBox
    2388     grid $frameLatt.newp -column 0 -row 0 -rowspan 2 -sticky w
     2488proc MakePhasePane {} {
     2489    #\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/
     2490    global expgui
     2491    frame $expgui(phaseFrame).top
     2492    set frameLatt [frame $expgui(phaseFrame).frameLatt]
     2493    #  This is a big frame in the Phase notebook pane to hold atomic data.
     2494    set fbig [frame $expgui(phaseFrame).fbig -width 180 \
     2495            -relief raised -borderwidth 4 -bg beige]
     2496    #  This is a frame just below the big frame: for edits
     2497    set frame3 [frame $expgui(phaseFrame).frame3 -width 100 \
     2498            -relief raised -borderwidth 4 -bg beige]
     2499
     2500    grid $expgui(phaseFrame).top -sticky news -row 0 -column 0
     2501    grid $frameLatt -sticky news -row 2 -column 0
     2502    grid $fbig -sticky news -row 3 -column 0
     2503    # give extra space to the atoms box
     2504    grid columnconfigure $expgui(phaseFrame) 0 -weight 1
     2505    grid rowconfigure $expgui(phaseFrame) 3 -weight 1
     2506    grid $frame3 -sticky news -row 4 -column 0
     2507    grid columnconfigure $expgui(phaseFrame) 0 -weight 1
     2508    grid rowconfigure $expgui(phaseFrame) 3 -weight 1
     2509    grid [frame  $expgui(phaseFrame).top.ps] -column 0 -row 0 -sticky w
     2510    # this is where the buttons will go
     2511    pack [label $expgui(phaseFrame).top.ps.0 -text "No Phases"] -side left
     2512   
     2513    grid [label $expgui(phaseFrame).top.lA -text "  Phase name:" \
     2514            -fg blue ] -column 1 -row 0 -sticky e
     2515    grid [entry $expgui(phaseFrame).top.lB -textvariable entryvar(phasename) \
     2516            -fg blue -width 45] -column 2 -row 0 -sticky e
     2517    grid columnconfigure $expgui(phaseFrame).top 1 -weight 1
     2518    # ------------- Lattice Parameter Box ------------------
     2519    set row 0
     2520    foreach col {2 4 6} var {a b c} lbl {a b c} {
     2521        grid [label $frameLatt.l$var -text $lbl] \
     2522                -column $col -row $row -padx 5 -sticky e
     2523        incr col
     2524        grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \
     2525            -column $col -row $row -padx 5
     2526    }
     2527    incr row
     2528    foreach col {2 4 6} var {alpha beta gamma} lbl {a b g} {
     2529        grid [label $frameLatt.l$var -text $lbl -font symbol] \
     2530                -column $col -row $row -padx 5 -sticky e
     2531        incr col
     2532        grid [entry $frameLatt.e$var -textvariable entryvar($var) -width 10] \
     2533            -column $col -row $row -padx 5
     2534    }
     2535   
     2536    grid [label $frameLatt.lr -text "Refine Cell"] -column 8 -row 0 -padx 5 -sticky e
     2537    grid [label $frameLatt.ld -text "Cell damping"] -column 8 -row 1 -padx 5 -sticky e
     2538    set cFlag [checkbutton $frameLatt.c -text "" -variable entryvar(cellref)]
     2539    grid $cFlag -column 9 -row 0 -padx 5 -sticky e
     2540    tk_optionMenu $frameLatt.om entryvar(celldamp) 0 1 2 3 4 5 6 7 8 9
     2541    grid $frameLatt.om -column 9 -row 1 -padx 5 -sticky e
     2542    grid [label $frameLatt.phasetype -textvariable expgui(phasetype) -fg blue] \
     2543            -column 1 -row 0 -rowspan 2
     2544    if [file executable $expgui(exptool)] {
     2545        button $frameLatt.newp -text Add\nPhase -command MakeAddPhaseBox
     2546        grid $frameLatt.newp -column 0 -row 0 -rowspan 2 -sticky w
     2547    }
     2548    grid columnconfig $frameLatt  1 -weight 1
    23892549    grid columnconfig $frameLatt  0 -weight 1
    2390 }
    2391 #-------------- Begin Atom Coordinates Box  ---------------------------------
    2392 grid [listbox   $fbig.title -height 1 -relief flat] \
    2393         -row 0 -column 0 -sticky ew
    2394 set expgui(atomtitle) $fbig.title
    2395 $expgui(atomtitle) configure -font $expgui(coordfont) -selectmode extended
    2396 grid [listbox   $fbig.lbox -height 10 \
    2397         -xscrollcommand " $fbig.bscr set"\
    2398         -yscrollcommand " $fbig.rscr set"\
    2399         ] -row 1 -column 0 -sticky news
    2400 set expgui(atomlistbox) $fbig.lbox
    2401 $expgui(atomlistbox) configure -font $expgui(coordfont) -selectmode extended
    2402 grid [scrollbar $fbig.bscr -orient horizontal \
    2403         -command "move2boxes \" $fbig.title $fbig.lbox \" " \
    2404         ] -row 2 -column 0 -sticky ew
    2405 grid [scrollbar $fbig.rscr  -command "$fbig.lbox yview" \
    2406         ] -row 1 -column 1 -sticky ns
    2407 # give extra space to the atoms box
    2408 grid columnconfigure $fbig 0 -weight 1
    2409 grid rowconfigure $fbig 1 -weight 1
     2550    #-------------- Begin Atom Coordinates Box  ------------------------------
     2551    grid [listbox   $fbig.title -height 1 -relief flat] \
     2552            -row 0 -column 0 -sticky ew
     2553    set expgui(atomtitle) $fbig.title
     2554    $expgui(atomtitle) configure -font $expgui(coordfont) -selectmode extended
     2555    grid [listbox   $fbig.lbox -height 10 \
     2556            -xscrollcommand " $fbig.bscr set"\
     2557            -yscrollcommand " $fbig.rscr set"\
     2558            ] -row 1 -column 0 -sticky news
     2559    set expgui(atomlistbox) $fbig.lbox
     2560    $expgui(atomlistbox) configure -font $expgui(coordfont) -selectmode extended
     2561    grid [scrollbar $fbig.bscr -orient horizontal \
     2562            -command "move2boxes \" $fbig.title $fbig.lbox \" " \
     2563            ] -row 2 -column 0 -sticky ew
     2564    grid [scrollbar $fbig.rscr  -command "$fbig.lbox yview" \
     2565            ] -row 1 -column 1 -sticky ns
     2566    # give extra space to the atoms box
     2567    grid columnconfigure $fbig 0 -weight 1
     2568    grid rowconfigure $fbig 1 -weight 1
     2569   
     2570    #   BIND mouse in editbox
     2571    bind $expgui(atomlistbox) <ButtonRelease-1>   editRecord
     2572    bind $expgui(atomlistbox) <Button-3>   SelectAllAtoms
     2573   
     2574    #-------------- End Atoms Section  ---------------------------------
     2575
     2576    # --------------------------- Begin Edit Box ------------------------
     2577    grid [set expgui(EditingAtoms) [label $frame3.top -bg beige -fg blue]] \
     2578            -column 0 -row 0 -padx 2 -pady 3 -columnspan 10 -sticky w
     2579    if [file executable $expgui(exptool)] {
     2580        button $frame3.newa -text "Add New Atom" \
     2581                -command {MakeAddAtomsBox $expgui(curPhase)}
     2582        grid $frame3.newa -column 11 -row 0
     2583    }
     2584   
     2585    set f3l1 [label $frame3.l1 -text "Refinement Flags " -bg beige]
     2586    grid $f3l1 -column 0 -row 1 -padx 2 -sticky nsw -pady 3
     2587   
     2588    set f3cFlag1 [checkbutton $frame3.cf1 -text "X" -variable entryvar(xref) -bg beige]
     2589    set f3cFlag2 [checkbutton $frame3.cf2 -text "U" -variable entryvar(uref) -bg beige]
     2590    set f3cFlag3 [checkbutton $frame3.cf3 -text "F" -variable entryvar(fref) -bg beige]
     2591    grid $f3cFlag1 -column 1 -row 1 -padx 2 -pady 3 -sticky w
     2592    grid $f3cFlag2 -column 2 -row 1 -padx 2 -pady 3 -sticky w
     2593    grid $f3cFlag3 -column 3 -row 1 -padx 2 -pady 3 -sticky w
     2594   
     2595    set f3l4 [label $frame3.l4 -text "Damping Factors " -bg beige]
     2596    grid $f3l4 -column 4 -row 1 -padx 2 -sticky nsw -pady 3
     2597   
     2598    tk_optionMenu $frame3.om2 entryvar(xdamp) 0 1 2 3 4 5 6 7 8 9
     2599    tk_optionMenu $frame3.om3 entryvar(udamp) 0 1 2 3 4 5 6 7 8 9
     2600    tk_optionMenu $frame3.om4 entryvar(fdamp) 0 1 2 3 4 5 6 7 8 9
     2601    grid [label $frame3.lom2 -text X -bg beige] -column 5 -row 1 -padx 2 -pady 3 -sticky w
     2602    grid $frame3.om2 -column 6 -row 1 -padx 2 -pady 3 -sticky w
     2603    grid [label $frame3.lom3 -text U -bg beige] -column 7 -row 1 -padx 2 -pady 3 -sticky w
     2604    grid $frame3.om3 -column 8 -row 1 -padx 2 -pady 3 -sticky w
     2605    grid [label $frame3.lom4 -text F -bg beige] -column 9 -row 1 -padx 2 -pady 3 -sticky w
     2606    grid $frame3.om4 -column 10 -row 1 -padx 2 -pady 3 -sticky w
     2607
     2608    set expgui(atomreflbl) "$frame3.l1 $frame3.l4 $frame3.lom2 $frame3.lom3 $frame3.lom4 "
     2609    set expgui(atomref) "$frame3.cf1 $frame3.cf2 $frame3.cf3 $frame3.om2 $frame3.om3 $frame3.om4"
     2610   
     2611    set coords [frame $frame3.coords  -width 100 -borderwidth 0  -bg beige]
     2612    grid $coords -column 0 -row 6 -columnspan 12 -sticky nsew
     2613   
     2614    set f3l1 [label $frame3.coords.l1 -text "Label" -bg beige]
     2615    set f3e1  [entry  $frame3.coords.e1 -textvariable entryvar(label) -width 6]
     2616    set f3l8 [label $frame3.coords.l8 -text "Coordinates" -bg beige]
     2617    set f3e8  [entry  $frame3.coords.e8 -textvariable entryvar(x) -width 10]
     2618    set f3e9  [entry  $frame3.coords.e9 -textvariable entryvar(y) -width 10]
     2619    set f3e10 [entry $frame3.coords.e10 -textvariable entryvar(z) -width 10]
     2620    set f3l11 [label $frame3.coords.l11 -text "Occupancy" -bg beige]
     2621    set f3e11 [entry $frame3.coords.e11 -textvariable entryvar(frac) -width 10]
     2622    set expgui(atomlabels) "$frame3.coords.l1 $frame3.coords.l8 $frame3.coords.l11"
     2623    set expgui(atomentry)  "$frame3.coords.e1 $frame3.coords.e8 $frame3.coords.e9 $frame3.coords.e10 $frame3.coords.e11"
     2624   
     2625    grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3
     2626    grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3
     2627    grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3
     2628    grid $f3e8 -column 3 -row 4 -padx 2 -sticky nsw -pady 3
     2629    grid $f3e9 -column 4 -row 4 -padx 2 -sticky nsw -pady 3
     2630    grid $f3e10 -column 5 -row 4 -padx 2 -sticky nsw -pady 3
     2631    grid $f3l11 -column 6 -row 4 -padx 2 -sticky nsw -pady 3
     2632    grid $f3e11 -column 7 -row 4 -padx 2 -sticky nsw -pady 3
     2633
     2634    set f3f31 [frame $frame3.f3f31  -width 100 -borderwidth 0 -bg beige]
     2635    grid $f3f31 -column 0 -row 7 -columnspan 12
     2636    set expgui(anisolabels) {}
     2637    lappend expgui(anisolabels)  [label $f3f31.l13 -text "Uiso" -bg beige]
     2638    lappend expgui(anisolabels)  [label $f3f31.l14 -text "U22" -bg beige]
     2639    lappend expgui(anisolabels)  [label $f3f31.l15 -text "U33" -bg beige]
     2640    lappend expgui(anisolabels)  [label $f3f31.l16 -text "U12" -bg beige]
     2641    lappend expgui(anisolabels)  [label $f3f31.l17 -text "U13" -bg beige]
     2642    lappend expgui(anisolabels)  [label $f3f31.l18 -text "U23" -bg beige]
     2643
     2644    set expgui(anisoentry) {}
     2645    lappend expgui(anisoentry) [entry $f3f31.e13 -textvariable entryvar(U11) -width 10]
     2646    lappend expgui(anisoentry) [entry $f3f31.e14 -textvariable entryvar(U22) -width 10]
     2647    lappend expgui(anisoentry) [entry $f3f31.e15 -textvariable entryvar(U33) -width 10]
     2648    lappend expgui(anisoentry) [entry $f3f31.e16 -textvariable entryvar(U12) -width 10]
     2649    lappend expgui(anisoentry) [entry $f3f31.e17 -textvariable entryvar(U13) -width 10]
     2650    lappend expgui(anisoentry) [entry $f3f31.e18 -textvariable entryvar(U23) -width 10]
     2651   
     2652    set col 0
     2653    foreach item1 $expgui(anisolabels) item2 $expgui(anisoentry) {
     2654        grid $item1 -column $col -row 0 -sticky nsw -pady 3
     2655        incr col
     2656        grid $item2 -column $col -row 0 -sticky nsw -pady 3
     2657        incr col
     2658    }
     2659    # --------------------------- End Edit Box -------------------------
     2660   
     2661    #/\ /\ /\ /\ /\ /\ /\ END OF PHASE PANE CODE /\ /\ /\ /\ /\ /\ /\ /\ /
     2662    # resize in case the pane needs more space
     2663    ResizeNotebook
     2664}
    24102665
    24112666proc move2boxes {boxlist args} {
     
    24142669    }
    24152670}
    2416 #   BIND mouse in editbox
    2417 bind $expgui(atomlistbox) <ButtonRelease-1>   editRecord
    2418 bind $expgui(atomlistbox) <Button-3>   SelectAllAtoms
    2419 
    2420 #-------------- End Atoms Section  ---------------------------------
    2421 
    2422 # --------------------------- Begin Edit Box -------------------------------
    2423 grid [set expgui(EditingAtoms) [label $frame3.top -bg beige -fg blue]] \
    2424         -column 0 -row 0 -padx 2 -pady 3 -columnspan 10 -sticky w
    2425 if [file executable $expgui(exptool)] {
    2426     button $frame3.newa -text "Add New Atom" \
    2427             -command {MakeAddAtomsBox $expgui(curPhase)}
    2428     grid $frame3.newa -column 11 -row 0
    2429 }
    2430 
    2431 set f3l1 [label $frame3.l1 -text "Refinement Flags " -bg beige]
    2432 grid $f3l1 -column 0 -row 1 -padx 2 -sticky nsw -pady 3
    2433 
    2434 set f3cFlag1 [checkbutton $frame3.cf1 -text "X" -variable entryvar(xref) -bg beige]
    2435 set f3cFlag2 [checkbutton $frame3.cf2 -text "U" -variable entryvar(uref) -bg beige]
    2436 set f3cFlag3 [checkbutton $frame3.cf3 -text "F" -variable entryvar(fref) -bg beige]
    2437 grid $f3cFlag1 -column 1 -row 1 -padx 2 -pady 3 -sticky w
    2438 grid $f3cFlag2 -column 2 -row 1 -padx 2 -pady 3 -sticky w
    2439 grid $f3cFlag3 -column 3 -row 1 -padx 2 -pady 3 -sticky w
    2440 
    2441 set f3l4 [label $frame3.l4 -text "Damping Factors " -bg beige]
    2442 grid $f3l4 -column 4 -row 1 -padx 2 -sticky nsw -pady 3
    2443 
    2444 tk_optionMenu $frame3.om2 entryvar(xdamp) 0 1 2 3 4 5 6 7 8 9
    2445 tk_optionMenu $frame3.om3 entryvar(udamp) 0 1 2 3 4 5 6 7 8 9
    2446 tk_optionMenu $frame3.om4 entryvar(fdamp) 0 1 2 3 4 5 6 7 8 9
    2447 grid [label $frame3.lom2 -text X -bg beige] -column 5 -row 1 -padx 2 -pady 3 -sticky w
    2448 grid $frame3.om2 -column 6 -row 1 -padx 2 -pady 3 -sticky w
    2449 grid [label $frame3.lom3 -text U -bg beige] -column 7 -row 1 -padx 2 -pady 3 -sticky w
    2450 grid $frame3.om3 -column 8 -row 1 -padx 2 -pady 3 -sticky w
    2451 grid [label $frame3.lom4 -text F -bg beige] -column 9 -row 1 -padx 2 -pady 3 -sticky w
    2452 grid $frame3.om4 -column 10 -row 1 -padx 2 -pady 3 -sticky w
    2453 
    2454 set expgui(atomreflbl) "$frame3.l1 $frame3.l4 $frame3.lom2 $frame3.lom3 $frame3.lom4 "
    2455 set expgui(atomref) "$frame3.cf1 $frame3.cf2 $frame3.cf3 $frame3.om2 $frame3.om3 $frame3.om4"
    2456 
    2457 set coords [frame $frame3.coords  -width 100 -borderwidth 0  -bg beige]
    2458 grid $coords -column 0 -row 6 -columnspan 12 -sticky nsew
    2459 
    2460 set f3l1 [label $frame3.coords.l1 -text "Label" -bg beige]
    2461 set f3e1  [entry  $frame3.coords.e1 -textvariable entryvar(label) -width 6]
    2462 set f3l8 [label $frame3.coords.l8 -text "Coordinates" -bg beige]
    2463 set f3e8  [entry  $frame3.coords.e8 -textvariable entryvar(x) -width 10]
    2464 set f3e9  [entry  $frame3.coords.e9 -textvariable entryvar(y) -width 10]
    2465 set f3e10 [entry $frame3.coords.e10 -textvariable entryvar(z) -width 10]
    2466 set f3l11 [label $frame3.coords.l11 -text "Occupancy" -bg beige]
    2467 set f3e11 [entry $frame3.coords.e11 -textvariable entryvar(frac) -width 10]
    2468 set expgui(atomlabels) "$frame3.coords.l1 $frame3.coords.l8 $frame3.coords.l11"
    2469 set expgui(atomentry)  "$frame3.coords.e1 $frame3.coords.e8 $frame3.coords.e9 $frame3.coords.e10 $frame3.coords.e11"
    2470 
    2471 grid $f3l1 -column 0 -row 4 -padx 2 -sticky nsw -pady 3
    2472 grid $f3e1 -column 1 -row 4 -padx 2 -sticky nsw -pady 3
    2473 grid $f3l8 -column 2 -row 4 -padx 2 -sticky nsw -pady 3
    2474 grid $f3e8 -column 3 -row 4 -padx 2 -sticky nsw -pady 3
    2475 grid $f3e9 -column 4 -row 4 -padx 2 -sticky nsw -pady 3
    2476 grid $f3e10 -column 5 -row 4 -padx 2 -sticky nsw -pady 3
    2477 grid $f3l11 -column 6 -row 4 -padx 2 -sticky nsw -pady 3
    2478 grid $f3e11 -column 7 -row 4 -padx 2 -sticky nsw -pady 3
    2479 
    2480 
    2481 set f3f31 [frame $frame3.f3f31  -width 100 -borderwidth 0 -bg beige]
    2482 grid $f3f31 -column 0 -row 7 -columnspan 12
    2483 set expgui(anisolabels) {}
    2484 lappend expgui(anisolabels)  [label $f3f31.l13 -text "Uiso" -bg beige]
    2485 lappend expgui(anisolabels)  [label $f3f31.l14 -text "U22" -bg beige]
    2486 lappend expgui(anisolabels)  [label $f3f31.l15 -text "U33" -bg beige]
    2487 lappend expgui(anisolabels)  [label $f3f31.l16 -text "U12" -bg beige]
    2488 lappend expgui(anisolabels)  [label $f3f31.l17 -text "U13" -bg beige]
    2489 lappend expgui(anisolabels)  [label $f3f31.l18 -text "U23" -bg beige]
    2490 
    2491 set expgui(anisoentry) {}
    2492 lappend expgui(anisoentry) [entry $f3f31.e13 -textvariable entryvar(U11) -width 10]
    2493 lappend expgui(anisoentry) [entry $f3f31.e14 -textvariable entryvar(U22) -width 10]
    2494 lappend expgui(anisoentry) [entry $f3f31.e15 -textvariable entryvar(U33) -width 10]
    2495 lappend expgui(anisoentry) [entry $f3f31.e16 -textvariable entryvar(U12) -width 10]
    2496 lappend expgui(anisoentry) [entry $f3f31.e17 -textvariable entryvar(U13) -width 10]
    2497 lappend expgui(anisoentry) [entry $f3f31.e18 -textvariable entryvar(U23) -width 10]
    2498 
    2499 set col 0
    2500 foreach item1 $expgui(anisolabels) item2 $expgui(anisoentry) {
    2501     grid $item1 -column $col -row 0 -sticky nsw -pady 3
    2502     incr col
    2503     grid $item2 -column $col -row 0 -sticky nsw -pady 3
    2504     incr col
    2505 }
    2506 # --------------------------- End Edit Box --------------------------------
    2507 
    2508 #/\ /\ /\ /\ /\ /\ /\ END OF PHASE PANE CODE /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
     2671# make the phase pane
     2672MakePhasePane
    25092673#-----------------------------------------------------------------------------
    2510 #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
    2511 grid [frame $expgui(histFrame).hs] \
    2512         -column 0 -row 0 -rowspan 10 -sticky nsew
    2513 grid columnconfigure $expgui(histFrame) 0 -weight 1
    2514 grid rowconfigure $expgui(histFrame) 1 -weight 1
    2515 grid rowconfigure $expgui(histFrame) 2 -weight 1
    2516 grid rowconfigure $expgui(histFrame) 3 -weight 1
    2517 grid [listbox $expgui(histFrame).hs.title -height 1 -relief flat \
    2518         -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2519 grid [listbox $expgui(histFrame).hs.lbox -height 10 -width 25 \
    2520         -font $expgui(histfont) \
    2521         -xscrollcommand "$expgui(histFrame).hs.x set" \
    2522         -yscrollcommand "$expgui(histFrame).hs.y set" \
    2523         ] -row 1 -column 0 -sticky news
    2524 lappend expgui(HistSelectList) $expgui(histFrame).hs
    2525 grid [scrollbar $expgui(histFrame).hs.x -orient horizontal \
    2526         -command "move2boxes \" $expgui(histFrame).hs.title $expgui(histFrame).hs.lbox \" "
    2527         ] -row 2 -column 0 -sticky ew
    2528 grid [scrollbar $expgui(histFrame).hs.y \
    2529         -command "$expgui(histFrame).hs.lbox yview"] \
    2530         -row 1 -column 1 -sticky ns
    2531 grid columnconfigure $expgui(histFrame).hs 0 -weight 1
    2532 grid rowconfigure $expgui(histFrame).hs 1 -weight 1
    2533 bind $expgui(histFrame).hs.lbox <ButtonRelease-1>  {
    2534     set expgui(curhist) [$expgui(histFrame).hs.lbox curselection]
    2535     DisplayHistogram
    2536 }
    2537 bind $expgui(histFrame).hs.lbox <Button-3>  {
    2538     if $expgui(globalmode) {
    2539         $expgui(histFrame).hs.lbox selection set 0 end
     2674proc MakeHistPane {} {
     2675    #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
     2676    global expgui
     2677    grid [frame $expgui(histFrame).hs] \
     2678            -column 0 -row 0 -rowspan 10 -sticky nsew
     2679    grid columnconfigure $expgui(histFrame) 0 -weight 1
     2680    grid rowconfigure $expgui(histFrame) 1 -weight 1
     2681    grid rowconfigure $expgui(histFrame) 2 -weight 1
     2682    grid rowconfigure $expgui(histFrame) 3 -weight 1
     2683    grid [listbox $expgui(histFrame).hs.title -height 1 -relief flat \
     2684            -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
     2685    grid [listbox $expgui(histFrame).hs.lbox -height 10 -width 25 \
     2686            -font $expgui(histfont) \
     2687            -xscrollcommand "$expgui(histFrame).hs.x set" \
     2688            -yscrollcommand "$expgui(histFrame).hs.y set" \
     2689            ] -row 1 -column 0 -sticky news
     2690    lappend expgui(HistSelectList) $expgui(histFrame).hs
     2691    grid [scrollbar $expgui(histFrame).hs.x -orient horizontal \
     2692            -command "move2boxes \" $expgui(histFrame).hs.title $expgui(histFrame).hs.lbox \" "
     2693    ] -row 2 -column 0 -sticky ew
     2694    grid [scrollbar $expgui(histFrame).hs.y \
     2695            -command "$expgui(histFrame).hs.lbox yview"] \
     2696            -row 1 -column 1 -sticky ns
     2697    grid columnconfigure $expgui(histFrame).hs 0 -weight 1
     2698    grid rowconfigure $expgui(histFrame).hs 1 -weight 1
     2699    bind $expgui(histFrame).hs.lbox <ButtonRelease-1>  {
    25402700        set expgui(curhist) [$expgui(histFrame).hs.lbox curselection]
    25412701        DisplayHistogram
    25422702    }
    2543 }
    2544 
    2545 
    2546 frame $expgui(histFrame).top -borderwidth 4 -relief groove
    2547 grid [label $expgui(histFrame).top.txt] -row 0 -column 0
    2548 if $expgui(havetix) {
    2549     foreach item {backBox diffBox} num {2 3} \
    2550             title {Background "Diffractometer Constants"} {
    2551         tixLabelFrame $expgui(histFrame).$item  \
    2552                 -borderwidth 4 -width 600 -height 100 -label $title
    2553         grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
    2554         set expgui($item)  [$expgui(histFrame).$item subwidget frame]
    2555     }
    2556 } else {
    2557     foreach item {backBox diffBox} num {1 2} \
    2558             title {Background "Diffractometer Constants"} {
    2559         frame $expgui(histFrame).$item  -borderwidth 4 -relief groove
    2560         grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
    2561         set expgui($item)  $expgui(histFrame).$item
    2562         grid [label $expgui(histFrame).$item.title -text $title] \
    2563                 -row 0 -column 0 -columnspan 10 -sticky nw
    2564     }
    2565 }
    2566 if [file executable $expgui(exptool)] {
    2567     button $expgui(histFrame).newh -text "Add New Histogram" -command MakeAddHistBox
    2568     grid $expgui(histFrame).newh -column 1 -row 6
    2569 }
    2570 
    2571 # BACKGROUND information.
    2572 # <<<<<<<<<<<<<<<<<<<<<<<<< BACKGROUND  <<<<<<<<<<<<<<<<<<<<<
    2573 grid [ frame $expgui(backBox).f ] -row 0 -column 0  -columnspan 11
    2574 grid [ label $expgui(backBox).f.lBGType -textvariable expgui(backtypelbl)] \
    2575         -row 1 -column 0 -sticky nws  -padx 2 -pady 3
    2576 grid [ label $expgui(backBox).f.lBGTerms -textvariable expgui(backtermlbl)] \
    2577         -row 1 -column 1 -sticky nws  -padx 2 -pady 3
    2578 grid [ button $expgui(backBox).f.edit -textvariable expgui(bkglbl) \
    2579         -command editbackground] \
    2580         -row 1 -column 2 -columnspan 3 -sticky w    -padx 2 -pady 3
    2581 grid [ frame $expgui(backBox).f1 ] -row 1 -column 0  -columnspan 11 -sticky e
    2582 grid [ label $expgui(backBox).f1.lfBG -text "  Refine background" ] \
    2583         -row 2 -column 1 -sticky news -padx 4 -pady 3
    2584 grid [ checkbutton $expgui(backBox).f1.rfBG -text "" \
    2585         -variable  entryvar(bref) ] \
    2586         -row 2 -column 2 -sticky news -padx 4 -pady 3
    2587 grid [ label $expgui(backBox).f1.lBGDamp -text Damping ] \
    2588         -row 2 -column 3 -sticky w    -padx 2 -pady 3
    2589 tk_optionMenu $expgui(backBox).f1.om  entryvar(bdamp) 0 1 2 3 4 5 6 7 8 9
    2590 grid $expgui(backBox).f1.om \
    2591         -row 2 -column 4 -sticky news -padx 4 -pady 3 -sticky e
    2592 
    2593 # DIFFRACTOMETER CONSTANTS SECTION
    2594 
    2595 #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2703    bind $expgui(histFrame).hs.lbox <Button-3>  {
     2704        if $expgui(globalmode) {
     2705            $expgui(histFrame).hs.lbox selection set 0 end
     2706            set expgui(curhist) [$expgui(histFrame).hs.lbox curselection]
     2707            DisplayHistogram
     2708        }
     2709    }
     2710   
     2711    frame $expgui(histFrame).top -borderwidth 4 -relief groove
     2712    grid [label $expgui(histFrame).top.txt] -row 0 -column 0
     2713    if $expgui(haveBW) {
     2714        foreach item {backBox diffBox} num {2 3} \
     2715                title {Background "Diffractometer Constants"} {
     2716            TitleFrame $expgui(histFrame).$item  \
     2717                    -borderwidth 4 -side left -relief groove -text $title
     2718            set expgui($item) [$expgui(histFrame).$item getframe]
     2719            grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
     2720            grid rowconfigure $expgui(histFrame) $num -minsize 100
     2721        }
     2722    } else {
     2723        foreach item {backBox diffBox} num {1 2} \
     2724                title {Background "Diffractometer Constants"} {
     2725            frame $expgui(histFrame).$item  -borderwidth 4 -relief groove
     2726            grid $expgui(histFrame).$item -column 1 -row $num -sticky nsew
     2727            set expgui($item)  $expgui(histFrame).$item
     2728            grid [label $expgui(histFrame).$item.title -text $title] \
     2729                    -row 0 -column 0 -columnspan 10 -sticky nw
     2730        }
     2731    }
     2732    if [file executable $expgui(exptool)] {
     2733        button $expgui(histFrame).newh -text "Add New Histogram" -command MakeAddHistBox
     2734        grid $expgui(histFrame).newh -column 1 -row 6
     2735    }
     2736
     2737    # BACKGROUND information.
     2738    # <<<<<<<<<<<<<<<<<<<<<<<<< BACKGROUND  <<<<<<<<<<<<<<<<<<<<<
     2739    grid [frame $expgui(backBox).frm1 ] -row 0 -column 0  -columnspan 11
     2740    grid [label $expgui(backBox).frm1.lBGType \
     2741            -textvariable expgui(backtypelbl)] \
     2742            -row 1 -column 0 -sticky nws  -padx 2 -pady 3
     2743    grid [label $expgui(backBox).frm1.lBGTerms \
     2744            -textvariable expgui(backtermlbl)] \
     2745            -row 1 -column 1 -sticky nws  -padx 2 -pady 3
     2746    grid [button $expgui(backBox).frm1.edit -textvariable expgui(bkglbl) \
     2747            -command editbackground] \
     2748            -row 1 -column 2 -columnspan 3 -sticky w -padx 2 -pady 3
     2749    grid [frame $expgui(backBox).frm2 ] \
     2750            -row 1 -column 0 -columnspan 11 -sticky e
     2751    grid [label $expgui(backBox).frm2.lfBG -text "  Refine background" ] \
     2752            -row 2 -column 1 -sticky news -padx 4 -pady 3
     2753    grid [checkbutton $expgui(backBox).frm2.rfBG -text "" \
     2754            -variable  entryvar(bref) ] \
     2755            -row 2 -column 2 -sticky news -padx 4 -pady 3
     2756    grid [label $expgui(backBox).frm2.lBGDamp -text Damping ] \
     2757            -row 2 -column 3 -sticky w    -padx 2 -pady 3
     2758    tk_optionMenu $expgui(backBox).frm2.om  entryvar(bdamp) 0 1 2 3 4 5 6 7 8 9
     2759    grid $expgui(backBox).frm2.om \
     2760            -row 2 -column 4 -sticky news -padx 4 -pady 3 -sticky e
     2761    #^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^END OF HISTOGRAM PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2762    # insert the histograms & resize in case the pane needs more space
     2763    sethistlist
     2764    ResizeNotebook
     2765}
    25962766###############################################################################
    2597 #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
    2598 
    2599 pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both
    2600 grid [listbox $expgui(fracFrame).hs.title -height 1 -relief flat \
    2601         -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2602 grid [listbox $expgui(fracFrame).hs.lbox -height 10 -width 25 \
    2603         -font $expgui(histfont) \
    2604         -xscrollcommand "$expgui(fracFrame).hs.x set" \
    2605         -yscrollcommand "$expgui(fracFrame).hs.y set" \
    2606         ] -row 1 -column 0 -sticky news
    2607 lappend expgui(HistSelectList) $expgui(fracFrame).hs
    2608 grid [scrollbar $expgui(fracFrame).hs.x -orient horizontal \
    2609         -command "move2boxes \" $expgui(fracFrame).hs.title $expgui(fracFrame).hs.lbox \" "
    2610         ] -row 2 -column 0 -sticky ew
    2611 grid [scrollbar $expgui(fracFrame).hs.y \
    2612         -command "$expgui(fracFrame).hs.lbox yview"] \
    2613         -row 1 -column 1 -sticky ns
    2614 grid columnconfigure $expgui(fracFrame).hs 0 -weight 1
    2615 grid rowconfigure $expgui(fracFrame).hs 1 -weight 1
    2616 bind $expgui(fracFrame).hs.lbox <ButtonRelease-1> {
    2617     set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection]
    2618     DisplayFrac
    2619 }
    2620 bind $expgui(fracFrame).hs.lbox <Button-3>  {
    2621     if $expgui(globalmode) {
    2622         $expgui(fracFrame).hs.lbox selection set 0 end
     2767proc MakeScalingPane {} {
     2768    #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
     2769    global expgui
     2770    pack [frame $expgui(fracFrame).hs] -side left -expand y -fill both
     2771    grid [listbox $expgui(fracFrame).hs.title -height 1 -relief flat \
     2772            -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
     2773    grid [listbox $expgui(fracFrame).hs.lbox -height 10 -width 25 \
     2774            -font $expgui(histfont) \
     2775            -xscrollcommand "$expgui(fracFrame).hs.x set" \
     2776            -yscrollcommand "$expgui(fracFrame).hs.y set" \
     2777            ] -row 1 -column 0 -sticky news
     2778    lappend expgui(HistSelectList) $expgui(fracFrame).hs
     2779    grid [scrollbar $expgui(fracFrame).hs.x -orient horizontal \
     2780            -command "move2boxes \" $expgui(fracFrame).hs.title $expgui(fracFrame).hs.lbox \" "
     2781    ] -row 2 -column 0 -sticky ew
     2782    grid [scrollbar $expgui(fracFrame).hs.y \
     2783            -command "$expgui(fracFrame).hs.lbox yview"] \
     2784            -row 1 -column 1 -sticky ns
     2785    grid columnconfigure $expgui(fracFrame).hs 0 -weight 1
     2786    grid rowconfigure $expgui(fracFrame).hs 1 -weight 1
     2787    bind $expgui(fracFrame).hs.lbox <ButtonRelease-1> {
    26232788        set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection]
    26242789        DisplayFrac
    26252790    }
    2626 }
    2627 pack [frame $expgui(fracFrame).f1] -fill both -expand true
    2628 # Create a large canvas area containing a frame for each phase in the data set.
    2629 # The canvas and vertical scrollbar are inside a frame called f1
    2630 if $expgui(havetix) {
    2631     tixLabelFrame $expgui(fracFrame).f1.scaleBox \
    2632             -borderwidth 4 -width 600 -height 100 -label "Scale Factor"
    2633     grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
    2634     set expgui(scaleBox)  [$expgui(fracFrame).f1.scaleBox subwidget frame]
    2635 } else {
    2636     frame $expgui(fracFrame).f1.scaleBox  -borderwidth 4 -relief groove
     2791    bind $expgui(fracFrame).hs.lbox <Button-3>  {
     2792        if $expgui(globalmode) {
     2793            $expgui(fracFrame).hs.lbox selection set 0 end
     2794            set expgui(curhist) [$expgui(fracFrame).hs.lbox curselection]
     2795            DisplayFrac
     2796        }
     2797    }
     2798    pack [frame $expgui(fracFrame).f1] -fill both -expand true
     2799    # Create a large canvas area containing a frame for each phase in the data set.
     2800    # The canvas and vertical scrollbar are inside a frame called f1
     2801    if $expgui(haveBW) {
     2802        TitleFrame $expgui(fracFrame).f1.scaleBox \
     2803                -borderwidth 4 -text "Scale Factor"
     2804        #           -borderwidth 4 -width 600 -height 100 -label "Scale Factor"
     2805        grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
     2806        set expgui(scaleBox)  [$expgui(fracFrame).f1.scaleBox getframe]
     2807        grid [label $expgui(scaleBox).histSFLabel -text Scale] \
     2808                -row 1 -column 0 -sticky nws  -padx 2 -pady 3
     2809    } else {
     2810        frame $expgui(fracFrame).f1.scaleBox  -borderwidth 4 -relief groove
    26372811        grid $expgui(fracFrame).f1.scaleBox -column 0 -row 0 -sticky nsew -columnspan 2
    26382812        set expgui(scaleBox)  $expgui(fracFrame).f1.scaleBox
    2639 }
    2640 grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \
    2641         -row 1 -column 0 -sticky nws  -padx 2 -pady 3
    2642 grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \
    2643         -row 1 -column 1 -sticky ew -padx 4 -pady 3
    2644 button $expgui(scaleBox).but1 -text "Set Globally" \
    2645         -command "editglobalparm histinfo scale {Scale Factor}"
    2646 
    2647 grid [label $expgui(scaleBox).histSFRLabel -text " Refine"] \
    2648         -row 1 -column 2 -sticky nws  -padx 2 -pady 3
    2649 grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \
    2650         -row 1 -column 3 -sticky news -padx 4 -pady 3
    2651 grid [label $expgui(scaleBox).lD1 -text "Damping"] \
    2652         -row 1 -column 4 -sticky w    -padx 2 -pady 3
    2653 tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9
    2654 grid $expgui(scaleBox).om \
    2655         -row 1 -column 5 -sticky news -padx 4 -pady 3
    2656 grid columnconfigure $expgui(scaleBox) 6  -weight 1
    2657 
    2658 grid [set expgui(FracBox) [canvas $expgui(fracFrame).f1.fracBox \
    2659         -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \
    2660         -sticky  news -row 1 -column 0
    2661 grid [scrollbar $expgui(fracFrame).f1.yscroll -orient vertical] \
    2662         -sticky ns -row 1 -column 1
    2663 
    2664 $expgui(FracBox) config -yscrollcommand "$expgui(fracFrame).f1.yscroll set"
    2665 $expgui(fracFrame).f1.yscroll config -command { $expgui(FracBox) yview }
    2666 
    2667 grid columnconfigure $expgui(fracFrame).f1 0 -weight 1
    2668 grid rowconfigure $expgui(fracFrame).f1 0 -weight 1
    2669 frame $expgui(FracBox).f -bd 0
    2670 $expgui(FracBox) create window 0 0 -anchor nw  -window $expgui(FracBox).f
    2671 
    2672 # the rest of the page is created in DisplayFrac
    2673 # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF SCALING PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2813        grid [label $expgui(scaleBox).histSFLabel -text "Scale Factor"] \
     2814                -row 1 -column 0 -sticky nws  -padx 2 -pady 3
     2815    }
     2816    grid [entry $expgui(scaleBox).ent1 -textvariable entryvar(scale) -width 15] \
     2817            -row 1 -column 1 -sticky ew -padx 4 -pady 3
     2818    button $expgui(scaleBox).but1 -text "Set Globally" \
     2819            -command "editglobalparm histinfo scale {Scale Factor}"
     2820
     2821    grid [label $expgui(scaleBox).histSFRLabel -text " Refine"] \
     2822            -row 1 -column 2 -sticky nws  -padx 2 -pady 3
     2823    grid [checkbutton $expgui(scaleBox).rf -variable entryvar(sref)] \
     2824            -row 1 -column 3 -sticky news -padx 4 -pady 3
     2825    grid [label $expgui(scaleBox).lD1 -text "Damping"] \
     2826            -row 1 -column 4 -sticky w    -padx 2 -pady 3
     2827    tk_optionMenu $expgui(scaleBox).om entryvar(sdamp) 0 1 2 3 4 5 6 7 8 9
     2828    grid $expgui(scaleBox).om \
     2829            -row 1 -column 5 -sticky news -padx 4 -pady 3
     2830    grid columnconfigure $expgui(scaleBox) 6  -weight 1
     2831   
     2832    if $expgui(haveBW) {
     2833        grid [TitleFrame $expgui(fracFrame).f1.phaseFrac -bd 4 \
     2834                -text "Phase Fractions" -relief groove] \
     2835                -sticky news -row 1 -column 0 -columnspan 2
     2836        set PhaseFractBox [$expgui(fracFrame).f1.phaseFrac getframe]
     2837    } else {
     2838        set PhaseFractBox $expgui(fracFrame).f1
     2839    }
     2840    grid columnconfigure $expgui(fracFrame).f1 0 -weight 1
     2841    grid rowconfigure $expgui(fracFrame).f1 1 -weight 1
     2842   
     2843    grid [set expgui(FracBox) [canvas $PhaseFractBox.fracBox \
     2844            -scrollregion {0 0 5000 500} \
     2845            -yscrollcommand "$PhaseFractBox.yscroll set" \
     2846            -width 500 -height 350 -bg lightgrey]] \
     2847            -sticky  news -row 1 -column 0
     2848    grid [scrollbar $PhaseFractBox.yscroll \
     2849            -command "$expgui(FracBox) yview" \
     2850            -orient vertical] \
     2851            -sticky ns -row 1 -column 1
     2852    frame $expgui(FracBox).f -bd 0
     2853    $expgui(FracBox) create window 0 0 -anchor nw  -window $expgui(FracBox).f
     2854
     2855    # the rest of the page is created in DisplayFrac
     2856
     2857    # insert the histograms & resize in case the pane needs more space
     2858    sethistlist
     2859    ResizeNotebook
     2860    # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF SCALING PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2861}
    26742862###############################################################################
    2675 # 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
    2676 pack [frame $expgui(profFrame).hs] -side left -expand y -fill both
    2677 grid [listbox $expgui(profFrame).hs.title -height 1 -relief flat \
    2678         -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
    2679 grid [listbox $expgui(profFrame).hs.lbox -height 10 -width 25 \
    2680         -font $expgui(histfont) \
    2681         -xscrollcommand "$expgui(profFrame).hs.x set" \
    2682         -yscrollcommand "$expgui(profFrame).hs.y set" \
    2683         ] -row 1 -column 0 -sticky news
    2684 lappend expgui(HistSelectList) $expgui(profFrame).hs
    2685 grid [scrollbar $expgui(profFrame).hs.x -orient horizontal \
    2686         -command "move2boxes \" $expgui(profFrame).hs.title $expgui(profFrame).hs.lbox \" "
    2687         ] -row 2 -column 0 -sticky ew
    2688 grid [scrollbar $expgui(profFrame).hs.y \
    2689         -command "$expgui(profFrame).hs.lbox yview"] \
    2690         -row 1 -column 1 -sticky ns
    2691 grid columnconfigure $expgui(profFrame).hs 0 -weight 1
    2692 grid rowconfigure $expgui(profFrame).hs 1 -weight 1
    2693 bind $expgui(profFrame).hs.lbox <ButtonRelease-1> {
    2694     set expgui(curhist) [$expgui(profFrame).hs.lbox curselection]
    2695     DisplayProfile
    2696 }
    2697 bind $expgui(profFrame).hs.lbox <Button-3>  {
    2698     if $expgui(globalmode) {
    2699         $expgui(profFrame).hs.lbox selection set 0 end
     2863proc MakeProfilePane {} {
     2864    global expgui
     2865    # 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
     2866    pack [frame $expgui(profFrame).hs] -side left -expand y -fill both
     2867    grid [listbox $expgui(profFrame).hs.title -height 1 -relief flat \
     2868            -font $expgui(histfont) ] -row 0 -column 0 -sticky ew
     2869    grid [listbox $expgui(profFrame).hs.lbox -height 10 -width 25 \
     2870            -font $expgui(histfont) \
     2871            -xscrollcommand "$expgui(profFrame).hs.x set" \
     2872            -yscrollcommand "$expgui(profFrame).hs.y set" \
     2873            ] -row 1 -column 0 -sticky news
     2874    lappend expgui(HistSelectList) $expgui(profFrame).hs
     2875    grid [scrollbar $expgui(profFrame).hs.x -orient horizontal \
     2876            -command "move2boxes \" $expgui(profFrame).hs.title $expgui(profFrame).hs.lbox \" "
     2877    ] -row 2 -column 0 -sticky ew
     2878    grid [scrollbar $expgui(profFrame).hs.y \
     2879            -command "$expgui(profFrame).hs.lbox yview"] \
     2880            -row 1 -column 1 -sticky ns
     2881    grid columnconfigure $expgui(profFrame).hs 0 -weight 1
     2882    grid rowconfigure $expgui(profFrame).hs 1 -weight 1
     2883    bind $expgui(profFrame).hs.lbox <ButtonRelease-1> {
    27002884        set expgui(curhist) [$expgui(profFrame).hs.lbox curselection]
    27012885        DisplayProfile
    27022886    }
    2703 }
    2704 
    2705 # Create a large canvas area containing a frame for each phase in the data set.
    2706 # The canvas and vertical scrollbar are inside a frame called f1
    2707 pack [frame $expgui(profFrame).f1] -fill both -expand true
    2708 grid [set expgui(ProfileBox) [canvas $expgui(profFrame).f1.profileBox \
    2709         -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \
    2710         -sticky  news -row 0 -column 0
    2711 grid [scrollbar $expgui(profFrame).f1.yscroll -orient vertical] \
    2712         -sticky ns -row 0 -column 1
    2713 
    2714 $expgui(ProfileBox) config -yscrollcommand "$expgui(profFrame).f1.yscroll set"
    2715 $expgui(profFrame).f1.yscroll config -command { $expgui(ProfileBox) yview }
    2716 
    2717 grid columnconfigure $expgui(profFrame).f1 1 -weight 1
    2718 grid rowconfigure $expgui(profFrame).f1 0 -weight 1
    2719 frame $expgui(ProfileBox).f -bd 0
    2720 $expgui(ProfileBox) create window 0 0 -anchor nw  -window $expgui(ProfileBox).f
    2721 
    2722 # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PROFILE PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2887    bind $expgui(profFrame).hs.lbox <Button-3>  {
     2888        if $expgui(globalmode) {
     2889            $expgui(profFrame).hs.lbox selection set 0 end
     2890            set expgui(curhist) [$expgui(profFrame).hs.lbox curselection]
     2891            DisplayProfile
     2892        }
     2893    }
     2894
     2895    # Create a large canvas area containing a frame for each phase in the data set.
     2896    # The canvas and vertical scrollbar are inside a frame called f1
     2897    pack [frame $expgui(profFrame).f1] -fill both -expand true
     2898    grid [set expgui(ProfileBox) [canvas $expgui(profFrame).f1.profileBox \
     2899            -scrollregion {0 0 5000 500} -width 500 -height 350 -bg lightgrey]] \
     2900            -sticky  news -row 0 -column 0
     2901    grid [scrollbar $expgui(profFrame).f1.yscroll -orient vertical] \
     2902            -sticky ns -row 0 -column 1
     2903   
     2904    $expgui(ProfileBox) config -yscrollcommand "$expgui(profFrame).f1.yscroll set"
     2905    $expgui(profFrame).f1.yscroll config -command { $expgui(ProfileBox) yview }
     2906   
     2907    grid columnconfigure $expgui(profFrame).f1 1 -weight 1
     2908    grid rowconfigure $expgui(profFrame).f1 0 -weight 1
     2909    frame $expgui(ProfileBox).f -bd 0
     2910    $expgui(ProfileBox) create window 0 0 -anchor nw  -window $expgui(ProfileBox).f
     2911   
     2912    # insert the histograms & resize in case the pane needs more space
     2913    sethistlist
     2914    ResizeNotebook
     2915    # ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF PROFILE PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
     2916}
     2917
    27232918##############################################################################
    27242919# 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
     
    27672962set row 0
    27682963grid [label $expgui(lsFrame).f1.his1 -pady 6 -text "Last History:"] -row $row -column 0
    2769 grid [label $expgui(lsFrame).f1.his2 -relief sunken -bd 2 -pady 6 \
     2964grid [label $expgui(lsFrame).f1.his2 -relief raised -bd 2 -pady 6 \
    27702965        -textvariable expgui(last_History)] \
    27712966        -row $row -column 1 -columnspan 5 -sticky w
     
    27922987        -variable entryvar(printopt$num)
    27932988}
    2794 grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row $row -column 3
    2795 grid [label $expgui(lsFrame).f1.c.fol -text "Extract Fobs"] -row 0 -column 2
    2796 grid [checkbutton $expgui(lsFrame).f1.c.foc -variable entryvar(fobsextract)] -row 0 -column 3
     2989#grid [frame $expgui(lsFrame).f1.c -bd 4 -relief groove] -row $row -column 3
     2990#grid [label $expgui(lsFrame).f1.c.fol -text "Extract Fobs"] -row 0 -column 2
     2991#grid [checkbutton $expgui(lsFrame).f1.c.foc -variable entryvar(fobsextract)] -row 0 -column 3
    27972992incr row
    2798 grid [frame $expgui(lsFrame).f1.a -bd 4 -relief groove] -row $row -column 0 -columnspan 6
     2993if {$expgui(haveBW)} {
     2994    grid [TitleFrame $expgui(lsFrame).f1.a -bd 4 -relief groove \
     2995            -text "Reflection Intensity Extraction" \
     2996            ] -row $row -column 0 -columnspan 6
     2997    set expgui(FobsExtractFrame) [$expgui(lsFrame).f1.a getframe]
     2998} else {
     2999    grid [frame $expgui(lsFrame).f1.a -bd 4 -relief groove \
     3000            ] -row $row -column 0 -columnspan 6
     3001    set expgui(FobsExtractFrame) $expgui(lsFrame).f1.a
     3002}
     3003grid rowconfigure $expgui(lsFrame).f1 $row -pad 16
     3004grid [frame $expgui(FobsExtractFrame).c -bd 4 -relief groove] \
     3005        -row 0 -column 8 -columnspan 3 -sticky e
     3006grid [label $expgui(FobsExtractFrame).c.fol -text "Extract Fobs"] \
     3007        -row 0 -column 2
     3008grid [checkbutton $expgui(FobsExtractFrame).c.foc \
     3009        -variable entryvar(fobsextract)] -row 0 -column 3
    27993010foreach num {1 2 3 4 5 6 7 8 9} {
    2800     grid [label $expgui(lsFrame).f1.a.l$num -text $num] -row 1 -column $num
    2801     grid [radiobutton $expgui(lsFrame).f1.a.cc$num \
     3011    grid [label $expgui(FobsExtractFrame).l$num -text $num] -row 1 -column $num
     3012    grid [radiobutton $expgui(FobsExtractFrame).cc$num \
    28023013            -command "HistExtractSet $num" \
    28033014            -variable expgui(Fextract$num) -value 0] \
    28043015            -row 2 -column $num
    2805     grid [radiobutton $expgui(lsFrame).f1.a.ca$num \
     3016    grid [radiobutton $expgui(FobsExtractFrame).ca$num \
    28063017            -command "HistExtractSet $num" \
    28073018            -variable expgui(Fextract$num) -value 1] \
    28083019            -row 3 -column $num
    2809 #    grid [radiobutton $expgui(lsFrame).f1.a.cb$num \
    2810 #           -command "HistExtractSet $num" \
    2811 #           -variable expgui(Fextract$num) -value 2] \
    2812 #           -row 4 -column $num
    2813 }
    2814 set expgui(ExtractSettingsRadiobuttons) $expgui(lsFrame).f1.a.cc
    2815 lappend expgui(ExtractSettingsRadiobuttons) $expgui(lsFrame).f1.a.ca
    2816 #lappend expgui(ExtractSettingsRadiobuttons) $expgui(lsFrame).f1.a.cb
    2817 
    2818 grid [label $expgui(lsFrame).f1.a.t -text "Intensity Extraction Method" -anchor c] \
    2819         -column 0 -columnspan 11 -row 0
    2820 grid [label $expgui(lsFrame).f1.a.t0 -text "Phase #" -anchor c] -column 0 -row 1
    2821 grid [label $expgui(lsFrame).f1.a.t1 -text "Rietveld" -anchor c] -column 0 -row 2
    2822 grid [label $expgui(lsFrame).f1.a.t2 -text "F(calc) Weighted" -anchor c] -column 0 -row 3
    2823 #grid [label $expgui(lsFrame).f1.a.t3 -text "Equally Weighted" -anchor c] -column 0 -row 4
    2824 grid [label $expgui(lsFrame).f1.a.t2a -text "(Model biased)" -anchor c] -column 10 -row 3
    2825 #grid [label $expgui(lsFrame).f1.a.t3a -text "(Le Bail method)" -anchor c] -column 10 -row 4
     3020    grid [radiobutton $expgui(FobsExtractFrame).cb$num \
     3021            -command "HistExtractSet $num" \
     3022            -variable expgui(Fextract$num) -value 2] \
     3023            -row 4 -column $num
     3024}
     3025set expgui(ExtractSettingsRadiobuttons) $expgui(FobsExtractFrame).cc
     3026lappend expgui(ExtractSettingsRadiobuttons) $expgui(FobsExtractFrame).ca
     3027lappend expgui(ExtractSettingsRadiobuttons) $expgui(FobsExtractFrame).cb
     3028
     3029grid [label $expgui(FobsExtractFrame).t \
     3030        -text "Extraction\nMethod" -anchor c] \
     3031        -column 0 -row 0 -rowspan 2 -sticky s
     3032grid [label $expgui(FobsExtractFrame).t0 -text "Phase #" -anchor sw] \
     3033        -column 1 -row 0 -columnspan 7 -sticky sw
     3034grid [label $expgui(FobsExtractFrame).t1 -text "Rietveld" -anchor c] -column 0 -row 2
     3035grid [label $expgui(FobsExtractFrame).t2 -text "F(calc) Weighted" -anchor c] -column 0 -row 3
     3036grid [label $expgui(FobsExtractFrame).t3 -text "Equally Weighted" -anchor c] -column 0 -row 4
     3037grid [label $expgui(FobsExtractFrame).t2a -text "(Model biased)" -anchor c] -column 10 -row 3
     3038grid [label $expgui(FobsExtractFrame).t3a -text "(Le Bail method)" -anchor c] -column 10 -row 4
    28263039# ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ END OF LS PANE CODE ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
    28273040#-------------------------------------------------------------------------
     
    30133226
    30143227# resize the notebook to fit all the tabs and the largest page
    3015 if {!$expgui(havetix)} {
    3016     Notebook:resize .n
    3017 }
     3228ResizeNotebook
     3229
    30183230RaisePage lsFrame
    30193231if {[CountHistory] > 100} {
Note: See TracChangeset for help on using the changeset viewer.