Changeset 118


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

# on 1999/11/16 15:59:22, toby did:
Switch over to use of pure Tk notebook widget when Tix is not present
define expgui(initstring) for user-defined initializations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/expgui

    • Property rcs:date changed from 1999/11/16 15:45:40 to 1999/11/16 15:59:22
    • Property rcs:lines changed from +13 -3 to +39 -46
    • Property rcs:rev changed from 1.20 to 1.21
    r117 r118  
    77# need to change heading and button label depending on where getExpFileName
    88# is called from
    9 #
    10 # fixup documentation and you are done!
    119#
    1210# global background editing & profile work differently: should both
     
    7472set liveplot(legend) 1
    7573set expgui(filesort) 1
     74set expgui(initstring) {}
    7675#=============================================================================
    7776# Store names of profile terms.
     
    125124# commands for adding phases, histograms & atoms
    126125source [file join $expgui(scriptdir) addcmds.tcl]
     126# get the notebook widget if not using Tix
     127if {!$expgui(havetix)} {source $expgui(scriptdir)/notebook.tcl}
    127128#---------------------------------------------------------------------------
    128129# override options with locally defined values
     
    319320        set expgui(curhist) {}
    320321    }
    321     if !$expgui(havetix) {
    322         RaisePage lsFrame
    323     } else {
    324         .n raise lsPane
    325         set expgui(pagenow) lsFrame
    326     }
     322    RaisePage lsFrame
    327323    if {[CountHistory] > 100} {
    328324        DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
     
    980976        foreach pair $expgui(GlobalModeAllDisable) {
    981977            if {$expgui(pagenow) == [lindex $pair 0]} {
    982                 if !$expgui(havetix) {
    983                     RaisePage lsFrame
    984                 } else {
    985                     .n raise lsPane
    986                     set expgui(pagenow) lsFrame
    987                 }
     978                RaisePage lsFrame
    988979            }
    989980            eval [lindex $pair 1] -state disabled
     
    22792270if $expgui(havetix) {
    22802271    pack [tixNoteBook .n] -expand yes -fill both
    2281     .n add lsPane -label "LS Controls" -underline 0
    2282     .n pageconfigure lsPane -raisecmd \
     2272    .n add lsFrame -label "LS Controls"
     2273    .n pageconfigure lsFrame -raisecmd \
    22832274                "set expgui(pagenow) lsFrame; SetupExtractHist"
    22842275    lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
    2285     .n add phasePane -label "Phase" -underline 0
     2276    .n add phasePane -label "Phase"
    22862277    .n pageconfigure phasePane -raisecmd \
    22872278                "set expgui(pagenow) phaseFrame; DisplayAllAtoms noreset"
    22882279#    lappend expgui(frameactionlist) "phaseFrame {DisplayAllAtoms noreset}"
    2289     .n add histPane -label "Histogram" -underline 0
     2280    .n add histPane -label "Histogram"
    22902281    .n pageconfigure histPane -raisecmd \
    22912282                "set expgui(pagenow) histFrame; DisplayHistogram"
    22922283    lappend expgui(frameactionlist) "histFrame DisplayHistogram"
    22932284    lappend expgui(GlobalModeAllDisable) "histFrame {.n pageconfigure histPane}"
    2294     .n add fracPane -label "Scaling" -underline 6
     2285    .n add fracPane -label "Scaling"
    22952286    .n pageconfigure fracPane -raisecmd \
    22962287                "set expgui(pagenow) fracFrame; DisplayFrac"
    22972288    lappend expgui(frameactionlist) "fracFrame DisplayFrac"
    2298     .n add profPane -label Profile -underline 1
     2289    .n add profPane -label Profile
    22992290    .n pageconfigure profPane -raisecmd \
    23002291                "set expgui(pagenow) profFrame; DisplayProfile"
     
    23062297    set expgui(fracFrame) [.n subwidget fracPane]
    23072298    set expgui(profFrame) [.n subwidget profPane]
    2308     set expgui(lsFrame) [.n subwidget lsPane]
     2299    set expgui(lsFrame) [.n subwidget lsFrame]
    23092300} else {
    2310     pack [frame .frmbar] -side top -anchor w
    2311     pack [frame .n] -anchor w -fill both -expand yes
     2301    Notebook:create .n -pages {lsFrame phaseFrame histFrame fracFrame profFrame}
     2302    pack .n -anchor w -fill both -expand yes
    23122303    foreach item {lsFrame phaseFrame histFrame fracFrame profFrame} \
    23132304            page {"LS Controls" Phase Histogram Scaling Profile } {
    2314         pack [button .frmbar.$item -text $page -bd 2 \
    2315                     -command "RaisePage $item"] -side left
    2316         set expgui($item) [frame .n.$item -relief flat]
     2305        set expgui($item) [Notebook:frame .n $item]
     2306        Notebook:pageconfig .n $item -command "InitPage $item" -title $page
    23172307    }
    23182308    lappend expgui(frameactionlist) "lsFrame SetupExtractHist"
     
    23212311    lappend expgui(frameactionlist) "fracFrame DisplayFrac"
    23222312    lappend expgui(frameactionlist) "profFrame DisplayProfile"
    2323     lappend expgui(GlobalModeAllDisable) "histFrame {.frmbar.histFrame config}"
    2324     lappend expgui(GlobalModeAllDisable) "profFrame {.frmbar.profFrame config}"
    2325 }
    2326 
    2327 # this is used in the non-tix notebook to bring up the selected frame
     2313    set expgui(GlobalModeAllDisable) {}
     2314    lappend expgui(GlobalModeAllDisable) "histFrame {Notebook:pageconfig .n histFrame}"
     2315    lappend expgui(GlobalModeAllDisable) "profFrame {Notebook:pageconfig .n profFrame}"
     2316}
     2317
     2318# this is used to bring up the selected frame
    23282319proc RaisePage {nextpage} {
    23292320    global expgui
     2321    if $expgui(havetix) {
     2322        .n raise $nextpage
     2323        set expgui(pagenow) $nextpage
     2324    } else {
     2325        Notebook:raise .n $nextpage
     2326        InitPage $nextpage
     2327    }
     2328}
     2329# this is only called when Tix is not present
     2330proc InitPage {nextpage} {
     2331    global expgui
    23302332    set expgui(pagenow) $nextpage
    2331     foreach item {phaseFrame histFrame fracFrame profFrame lsFrame} {
    2332         if {$item == $nextpage} {
    2333             .frmbar.$item config -relief flat
    2334         } else {
    2335             .frmbar.$item config -relief raised
    2336         }
    2337     }
    2338     # forget all other pages
    2339     foreach child [pack slaves .n] {
    2340         pack forget $child
    2341     }
    2342     pack .n.$nextpage -anchor w -fill both -expand yes
    23432333    foreach set $expgui(frameactionlist) {
    23442334        if {$expgui(pagenow) == [lindex $set 0]} [lindex $set 1]
    23452335    }
    23462336}
     2337
    23472338#----------------------------------------------------------------------------
    23482339#\/ \/ \/ \/ \/ \/ \/ BEGINNING OF PHASE PANE CODE \/ \/ \/ \/ \/ \/ \/ \/ \/
     
    30303021}
    30313022
    3032 if !$expgui(havetix) {
    3033     RaisePage lsFrame
    3034 } else {
    3035     .n raise lsPane
    3036     set expgui(pagenow) lsFrame
    3037 }
     3023# execute any local commands for final initialization
     3024eval $expgui(initstring)
     3025
     3026# resize the notebook to fit all the tabs and the largest page
     3027if {!$expgui(havetix)} {
     3028    Notebook:resize .n
     3029}
     3030RaisePage lsFrame
    30383031if {[CountHistory] > 100} {
    30393032    DeleteHistoryRecords "This .EXP file has [CountHistory] history records\nErasing most will speed EXPGUI"
Note: See TracChangeset for help on using the changeset viewer.