Changeset 250 for trunk/expgui


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

# on 2000/07/28 20:29:34, toby did:
add phase flag box to histogram page when more than one phase is present
define GetPhaseFlags? & SetPhaseFlag? to implement above
fix title on edit background
label background type (as suggested by Barb & Lachlan)
start paring out "shell" capabilities for Mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 2000/07/20 22:13:40 to 2000/07/28 20:29:34
    • Property rcs:lines changed from +80 -57 to +117 -49
    • Property rcs:rev changed from 1.29 to 1.30
    r238 r250  
    424424Jonathan Wasserman and Brian Toby\n\
    425425NIST Center for Neutron Research\n\n\
    426 1998, Not subject to copyright\n\n\
     4262000, Not subject to copyright\n\n\
    427427Revision [lindex $expgui(Revision) 1] (readexp.tcl [lindex $expmap(Revision) 1])\n\n\
    428428Generalized Structure Analysis System (GSAS)\n\
     
    13031303    }
    13041304    # Top box
     1305    if $expgui(haveBW) {
     1306        catch {destroy $expgui(histFrame).pflag}
     1307    }
    13051308    if {$expgui(globalmode) != 0} {
    13061309        $expgui(histFrame).top.txt config \
     
    13111314        grid forget $expgui(histFrame).top
    13121315        set expgui(bkglbl) "Edit Background"
     1316        if {$expgui(haveBW) && [llength $expmap(phaselist)] > 1} {
     1317            TitleFrame $expgui(histFrame).pflag  \
     1318                    -borderwidth 4 -side left -relief groove \
     1319                    -text "Phase Flags"
     1320            set expgui(pflag) [$expgui(histFrame).pflag getframe]
     1321            grid $expgui(histFrame).pflag -column 1 -row 1 -sticky nsew
     1322            grid rowconfigure $expgui(histFrame) 2 -minsize 35
     1323            foreach p $expmap(phaselist) {
     1324                pack [checkbutton $expgui(pflag).$p \
     1325                        -command "GetPhaseFlags $hist" \
     1326                        -variable expgui(pflag$p) -text $p] -side left
     1327                if {[lsearch $expmap(phaselist_$hist) $p] == -1} {
     1328                    set expgui(pflag$p) 0
     1329                } else {
     1330                    set expgui(pflag$p) 1
     1331                }
     1332            }
     1333        }
    13131334    }
    13141335
     
    16171638}
    16181639
     1640proc GetPhaseFlags {hist} {
     1641    global expmap expgui
     1642    set plist {}
     1643    foreach p $expmap(phaselist) {
     1644        if {$expgui(pflag$p)} {lappend plist $p}
     1645    }
     1646    SetPhaseFlag $hist $plist
     1647    incr expgui(changed)
     1648    mapexp
     1649}
     1650
     1651proc SetPhaseFlag {hist plist} {
     1652    # make a 2 digit key -- hh
     1653    if {$hist < 10} {
     1654        set hh " $hist"
     1655    } else {
     1656        set hh $hist
     1657    }
     1658    set key "HST $hh NPHAS"
     1659    set str {}
     1660    foreach iph {1 2 3 4 5 6 7 8 9} {
     1661        if {[lsearch $plist $iph] != -1} {
     1662            append str {    1}
     1663        } else {
     1664            append str {    0}     
     1665        }
     1666    }
     1667    setexp $key $str 1 68
     1668}
     1669
    16191670#-----------------------------------------------------------------------
    16201671# populate the Scaling page
     
    20962147    toplevel $w -bg beige
    20972148    if {$expgui(globalmode) != 0} {
     2149        wm title $w "Global Edit Background"
     2150    } else {
    20982151        wm title $w "Edit Background"
    2099     } else {
    2100         wm title $w "Global Edit Background"
    21012152    }
    21022153   
     
    21222173    set expgui(orig_backtype) $expgui(backtype)
    21232174    set expgui(prev_backtype) $expgui(backtype)
    2124     eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6}
     2175    set typemenu [tk_optionMenu $w.0.type expgui(backtype) null]
     2176    $typemenu delete 0 end
     2177    foreach item {
     2178        "1 - Shifted Chebyshev"
     2179        "2 - Cosine Fourier series"
     2180        "3 - Radial distribution peaks"
     2181        "4 - Power series in Q**2n/n!"
     2182        "5 - Power series in n!/Q**2n"
     2183        "6 - Power series in Q**2n/n! and n!/Q**2n"
     2184        "7 - Linear interpolation function"
     2185        "8 - Reciprocal interpolation function"
     2186    } {
     2187        set val [lindex $item 0]
     2188        $typemenu insert end radiobutton -variable expgui(backtype) \
     2189                -label $item -value $val
     2190    }
     2191
    21252192    grid $w.0.type   -row 1 -column 1
    21262193    grid [label $w.0.c -text "  Number of terms"  -bg beige] -row 1 -column 2
     
    23432410            -bg beige] -row 0 -column 0 -columnspan 10
    23442411    grid [label $w.0.b -text "Function type $ptype"  -bg beige]  -row 1 -column 0
    2345 
    2346     # number of terms
    2347     #    set expgui(backtype) [histinfo $hist backtype]
    2348     #    set expgui(orig_backtype) $expgui(backtype)
    2349     #    set expgui(prev_backtype) $expgui(backtype)
    2350     #    eval tk_optionMenu $w.0.type expgui(backtype) {1 2 3 4 5 6}
    2351     #    grid $w.0.type   -row 1 -column 1
    2352 
    23532412    grid [label $w.0.c -text "  Peak cutoff" -bg beige] -row 1 -column 3
    23542413    grid [entry $w.0.d -width 10 ]  -row 1 -column 4
     
    30753134    $expgui(fm).file.menu add command -label "Reset" -command "reset"
    30763135}
    3077 $expgui(fm).file.menu add command -label "expnam" -command readnewexp
     3136if {$tcl_platform(platform) != "macintosh"} {
     3137    $expgui(fm).file.menu add command -label "expnam" -command readnewexp
     3138}
    30783139$expgui(fm).file.menu add command -label "Save" -underline 0 \
    30793140        -command savearchiveexp
     
    30973158menu $expgui(fm).option.menu
    30983159
    3099 $expgui(fm).option.menu add checkbutton  -label "Archive EXP" \
    3100         -variable expgui(archive)
    3101 $expgui(fm).option.menu add checkbutton  -label "Use DISAGL window" \
    3102         -variable expgui(disaglSeparateBox)
    3103 
     3160if {$tcl_platform(platform) != "macintosh"} {
     3161    $expgui(fm).option.menu add checkbutton  -label "Archive EXP" \
     3162            -variable expgui(archive)
     3163    $expgui(fm).option.menu add checkbutton  -label "Use DISAGL window" \
     3164            -variable expgui(disaglSeparateBox)
     3165}
    31043166$expgui(fm).option.menu add cascade -menu  $expgui(fm).option.menu.asort \
    31053167        -label "Sort atoms by"
     
    31603222set expgui(globalphasemode) 1
    31613223
    3162 if {$tcl_platform(platform) != "windows"} {
     3224if {$tcl_platform(platform) == "unix"} {
    31633225    $expgui(fm).option.menu  add checkbutton -label "Override backspace" \
    31643226            -variable env(GSASBACKSPACE)
     
    31723234pack $expgui(fm).file $expgui(fm).option -side left  -in $expgui(fm)
    31733235
    3174 foreach menu $expgui(menunames) {
    3175     set m [string tolower $menu]
    3176     pack [menubutton $expgui(fm).$m -text $menu \
    3177             -menu $expgui(fm).$m.menu] -side left
    3178     menu $expgui(fm).$m.menu
     3236if {$tcl_platform(platform) != "macintosh"} {
     3237    foreach menu $expgui(menunames) {
     3238        set m [string tolower $menu]
     3239        pack [menubutton $expgui(fm).$m -text $menu \
     3240                -menu $expgui(fm).$m.menu] -side left
     3241        menu $expgui(fm).$m.menu
     3242    }
    31793243}
    31803244pack $expgui(fm).help  -side right -in $expgui(fm)
    31813245
    3182 # add the commands in expgui_menulist
    3183 foreach menu [array names expgui_menulist ] {
    3184     foreach cmd $expgui_menulist($menu) {
    3185         set action {}
    3186         set opt {}
    3187         catch {set action [lindex $expgui_cmdlist($cmd) 0]}
    3188         catch {set opt [lindex $expgui_cmdlist($cmd) 2]}
    3189         if {$expgui(debug) && $action == ""} {puts "blank command for $cmd"}
    3190         if {$action != "" && $action != "-"} {
    3191             eval $expgui(fm).$menu.menu add command \
    3192                     -label $cmd $opt -command [list [subst $action]]
    3193             if {[lindex $opt 0] == "-underline"} {
    3194                 catch {
    3195                     set num [lindex $opt 1]
    3196                     set key [string range $cmd $num $num]
    3197                     bind . <Alt-[string tolower $key]> [subst $action]
    3198                     bind . <Alt-[string toupper $key]> [subst $action]
     3246if {$tcl_platform(platform) != "macintosh"} {
     3247    # add the commands in expgui_menulist
     3248    foreach menu [array names expgui_menulist ] {
     3249        foreach cmd $expgui_menulist($menu) {
     3250            set action {}
     3251            set opt {}
     3252            catch {set action [lindex $expgui_cmdlist($cmd) 0]}
     3253            catch {set opt [lindex $expgui_cmdlist($cmd) 2]}
     3254            if {$expgui(debug) && $action == ""} {puts "blank command for $cmd"}
     3255            if {$action != "" && $action != "-"} {
     3256                eval $expgui(fm).$menu.menu add command \
     3257                        -label $cmd $opt -command [list [subst $action]]
     3258                if {[lindex $opt 0] == "-underline"} {
     3259                    catch {
     3260                        set num [lindex $opt 1]
     3261                        set key [string range $cmd $num $num]
     3262                        bind . <Alt-[string tolower $key]> [subst $action]
     3263                        bind . <Alt-[string toupper $key]> [subst $action]
     3264                    }
    31993265                }
    32003266            }
     
    32193285    }
    32203286}
    3221 # set up button bar
    3222 foreach cmd $expgui(buttonlist) {
    3223     set action {}
    3224     catch {set action [lindex $expgui_cmdlist($cmd) 0]}
    3225     if {$expgui(debug) && $action == ""} {puts "blank command for $cmd"}
    3226     if {$action != ""} {
    3227         pack [eval button .bar.$cmd -bg beige -activebackground yellow \
    3228                 -text $cmd -command [list [subst $action]]] -side left
     3287if {$tcl_platform(platform) != "macintosh"} {
     3288    # set up button bar
     3289    foreach cmd $expgui(buttonlist) {
     3290        set action {}
     3291        catch {set action [lindex $expgui_cmdlist($cmd) 0]}
     3292        if {$expgui(debug) && $action == ""} {puts "blank command for $cmd"}
     3293        if {$action != ""} {
     3294            pack [eval button .bar.$cmd -bg beige -activebackground yellow \
     3295                    -text $cmd -command [list [subst $action]]] -side left
     3296        }
    32293297    }
    32303298}
Note: See TracChangeset for help on using the changeset viewer.