Changeset 112 for trunk


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

# on 1999/10/11 19:48:35, toby did:
cleanup multiple histogram selection -> single histogram transition

rewrite global profile display code to group or not group phases together

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 1999/09/09 19:05:54 to 1999/10/11 19:48:35
    • Property rcs:lines changed from +3 -3 to +80 -48
    • Property rcs:rev changed from 1.18 to 1.19
    r100 r112  
    224224    set entryvar(cycles) [expinfo cycles]
    225225    set entrycmd(cycles) "expinfo cycles"
    226     set expgui(globalmode) 0
     226    # set expgui(globalmode) 0
    227227    set expgui(printopt) "Print Options ([expinfo print])"
    228228    set entryvar(title) [expinfo title]
     
    304304    set expgui(expfile) $newexpfile
    305305    catch {cd [string trim [file dirname $expgui(expfile)]]}
     306    set expgui(globalmode) 0
    306307    loadexp $expgui(expfile)
    307308
     
    10781079proc DisplayHistogram {} {
    10791080    global expgui entrycmd entryvar expmap
     1081
     1082    # trap if more than one histogram is selected unless global mode
     1083    if {$expgui(globalmode) == 0 && [llength $expgui(curhist)] > 1} {
     1084        set expgui(curhist) [lindex $expgui(curhist) 0]
     1085    }
    10801086
    10811087    # display the selected histograms
     
    14471453    global expgui entrycmd entryvar expmap
    14481454
     1455    # trap if more than one histogram is selected unless global mode
     1456    if {$expgui(globalmode) == 0 && [llength $expgui(curhist)] > 1} {
     1457        set expgui(curhist) [lindex $expgui(curhist) 0]
     1458    }
     1459
    14491460    # display the selected histograms
    14501461    $expgui(fracFrame).hs.lbox selection clear 0 end
     
    15771588proc DisplayProfile {} {
    15781589    global expgui entrycmd entryvar expmap
     1590
     1591    # trap if more than one histogram is selected unless global mode
     1592    if {$expgui(globalmode) == 0 && [llength $expgui(curhist)] > 1} {
     1593        set expgui(curhist) [lindex $expgui(curhist) 0]
     1594    }
     1595    # display the selected histograms
    15791596    $expgui(profFrame).hs.lbox selection clear 0 end
    15801597    foreach h $expgui(curhist) {
     
    16601677        # disable traces on entryvar for right now
    16611678        set entrycmd(trace) 0
    1662         # loop through histograms & phases, set up an array by type
    1663         catch {unset ptypearray histarray phasearray}
     1679        # loop through histograms & phases, set up an array by phase & profile type
     1680        catch {unset prtyparray histarray phasearray}
    16641681        foreach hist $histlist {
    1665             foreach i $expmap(phaselist_$hist) {
    1666                 set ptype [string trim [hapinfo $hist $i proftype]]
    1667                 lappend ptypearray(${ptype}_$i) $hist
    1668                 lappend histarray($ptype) $hist
    1669                 lappend phasearray($ptype) $i
     1682            foreach phase $expmap(phaselist_$hist) {
     1683                set prtyp [string trim [hapinfo $hist $phase proftype]]
     1684                set key ${prtyp}_$phase
     1685                lappend prtyparray($key) $hist
     1686                lappend histarray($key) $hist
     1687                lappend phasearray($key) $phase
    16701688            }
    16711689        }
    16721690       
    16731691        set ptype ""
    1674         set title ""
    1675         set ind -1
    1676         foreach key "[lsort [array names ptypearray]] 0_0" {
     1692        set i -1
     1693        # loop over all combined phases and profile types, sorted 1st by profile number
     1694        foreach key [lsort [array names prtyparray]] {
    16771695            # split key
    1678             scan $key %d_%d type p
    1679             # 1st time through
    1680             if {$ptype == ""} {set ptype $type}
    1681             if {$ptype == $type} {
    1682                 # we've seen this one before
    1683                 if {$title != ""} {append title "\n"}
    1684                 append title "Phase $p, hist [CompressList $ptypearray($key)]"
    1685             } else {
    1686                 set hist [lindex $histarray($ptype) 0]
    1687                 set phase [lindex $phasearray($ptype) 0]
    1688                 set nterms [hapinfo $hist $phase profterms]
    1689                 set htype [string range $expmap(htype_$hist) 2 2]
     1696            scan $key %d_%d prftyp p
     1697
     1698            if {$ptype != $prftyp || !$expgui(globalphasemode)} {
     1699                set ptype $prftyp
     1700                set curhistlist $histarray($key)
     1701                set curphaslist $phasearray($key)
     1702               
     1703                set hist1 [lindex $curhistlist 0]
     1704                set phase1 [lindex $curphaslist 0]
     1705                set nterms [hapinfo $hist1 $phase1 profterms]
     1706                set htype [string range $expmap(htype_$hist1) 2 2]
    16901707                set lbls $expgui(prof-$htype-$ptype)
    1691                 set i $ptype
    1692                 # Create one frame for this type
    1693                 incr ind
     1708                # for type 4, add extra terms depending on the cell type
     1709                if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $phase1]}
     1710                # Create a frame for this type
     1711                incr i
     1712                set boxtitle "Phase $p, hist [CompressList $histarray($key)]"
    16941713                grid [frame $expgui(ProfileBox).f.$i -relief groove -bd 4] \
    1695                         -column 0 -row $ind -sticky ew
     1714                        -column 0 -row $i -sticky ew
    16961715                grid [frame $expgui(ProfileBox).f.$i.0] \
    16971716                        -column 0 -row 0 -columnspan 20 -sticky ew
     
    16991718                        -text "Profile Type $ptype   "] -row 0 -column 0
    17001719                grid [label $expgui(ProfileBox).f.$i.0.1  \
    1701                         -text $title -anchor w] -row 0 -column 1
     1720                        -anchor w] -row 0 -column 1
    17021721                grid [frame $expgui(ProfileBox).f.$i.1] \
    17031722                        -column 0 -row 1 -columnspan 20 -sticky ew
     
    17051724                        -text "Damping"] -row 0 -column 2
    17061725                tk_optionMenu $expgui(ProfileBox).f.$i.1.tkOptDamp \
    1707                         entryvar(pdamp_$ptype) 0 1 2 3 4 5 6 7 8 9
    1708                 set entrycmd(pdamp_$ptype) "hapinfo \
    1709                         [list $histarray($ptype)] \
    1710                         [list $phasearray($ptype)] pdamp"
    1711                 set entryvar(pdamp_$ptype) [hapinfo $hist $phase pdamp]
     1726                        entryvar(pdamp_$i) 0 1 2 3 4 5 6 7 8 9
    17121727                grid $expgui(ProfileBox).f.$i.1.tkOptDamp -row 0 -column 3
    17131728                grid [button $expgui(ProfileBox).f.$i.1.edit \
    1714                         -text "Global Edit" \
    1715                         -command "EditProfile [list $title] \
    1716                         [list $histarray($ptype)]  [list $phasearray($ptype)] " \
    1717                         ] -row 0 -column 4 -sticky w
    1718                 # for type 4, add extra terms depending on the cell type
    1719                 if {$ptype == 4} {set lbls [type4lbls $lbls $nterms $phase]}
     1729                        -text "Global Edit"] -row 0 -column 4 -sticky w
     1730                set entryvar(pdamp_$i) [hapinfo $hist $phase pdamp]
    17201731                set col -1
    17211732                set row 2
     
    17251736                    if {$term == ""} {set term $num}
    17261737                    incr col
    1727                     grid [label $expgui(ProfileBox).f.$i.l${num}_${i} -text "$term"] \
    1728                             -row $row -column $col
     1738                    grid [label $expgui(ProfileBox).f.$i.l${num}_${i} \
     1739                            -text "$term"] -row $row -column $col
    17291740                    incr col
    17301741                    grid [checkbutton $expgui(ProfileBox).f.$i.ref${num}_${i} \
    17311742                            -variable entryvar(pref${num}_$i)] \
    17321743                            -row $row -column $col
    1733                     set entrycmd(pref${num}_$i) "hapinfo \
    1734                             [list $histarray($ptype)] \
    1735                             [list $phasearray($ptype)] pref$num"
    17361744                    set entryvar(pref${num}_$i) [hapinfo $hist $phase pref$num]
    17371745                    if {$col > 10} {set col -1; incr row}
    17381746                }
    17391747                grid columnconfigure $expgui(ProfileBox).f 0 -weight 1
    1740                 set ptype ""
     1748            } else {
     1749                # add to the current entry
     1750                eval lappend curhistlist $histarray($key)
     1751                eval lappend curphaslist $phasearray($key)
     1752                append boxtitle "\nPhase $p, hist [CompressList $histarray($key)]"
     1753            }
     1754            $expgui(ProfileBox).f.$i.0.1 config -text $boxtitle
     1755            $expgui(ProfileBox).f.$i.1.edit config -command "\
     1756                    EditProfile \"\n$boxtitle\" \
     1757                    [list $curhistlist] \
     1758                    [list $curphaslist]"
     1759            set entrycmd(pdamp_$i) "hapinfo \
     1760                    [list $curhistlist] \
     1761                    [list $curphaslist] pdamp"
     1762            for { set num 1 } { $num <= $nterms } { incr num } {
     1763                set entrycmd(pref${num}_$i) "hapinfo \
     1764                        [list $curhistlist] \
     1765                        [list $curphaslist] pref$num"
    17411766            }
    17421767        }
     
    29052930        -variable expgui(globalmode) -underline 0 -value 5 \
    29062931        -command sethistlist
    2907 set  expgui(globalmode) 0
     2932$expgui(fm).option.menu.editmode add separator
     2933$expgui(fm).option.menu.editmode add checkbutton \
     2934        -label "Group phases together" \
     2935        -variable expgui(globalphasemode) \
     2936        -command sethistlist
     2937
     2938set expgui(globalmode) 0
     2939set expgui(globalphasemode) 1
    29082940
    29092941if {$tcl_platform(platform) != "windows"} {
Note: See TracChangeset for help on using the changeset viewer.