Changeset 795


Ignore:
Timestamp:
Dec 4, 2009 5:12:09 PM (13 years ago)
Author:
toby
Message:

# on 2004/05/13 23:44:04, toby did:
add open console
deal with starkit problems
ignore bad element attributes (colors, marker types, sizes...)
update binding stuff (yet again!)
avoid bug on fit with no points (bkgfit)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/liveplot

    • Property rcs:date changed from 2004/04/27 14:07:39 to 2004/05/13 23:44:04
    • Property rcs:lines changed from +70 -9 to +74 -48
    • Property rcs:rev changed from 1.39 to 1.40
    r780 r795  
    2020}
    2121
     22# get name of script
     23set expgui(script) [info script]
     24# what are we running here?
    2225set program [file tail $argv0]
     26# fix up problem with starkit tcl
     27if {$program != "liveplot" && $program != "bkgedit"} {
     28        set program [file tail $expgui(script)]
     29}
     30# for debug
    2331#set program bkgedit
    2432
     
    137145
    138146#----------------------------------------------------------------
    139 # where are we?
    140 set expgui(script) [info script]
    141 # translate links -- go six levels deep
     147# find location of other files relative to the current script
     148# 1st, translate links -- go six levels deep
    142149foreach i {1 2 3 4 5 6} {
    143150    if {[file type $expgui(script)] == "link"} {
     
    574581    setlegend $box $graph(legend)
    575582    # reconfigure the data
    576     $box element configure 3 \
    577             -symbol $peakinfo(obssym) -color $graph(color_obs) \
    578             -pixels [expr 0.125 * $peakinfo(obssize)]i
     583    catch {$box element configure 3 -symbol $peakinfo(obssym)}
     584    catch {$box element configure 3 -color $graph(color_obs)}
     585    catch {$box element configure 3 -pixels [expr 0.125 * $peakinfo(obssize)]i}
    579586    if $graph(chi2) {
    580         $box element config 0 -dash 0 -line 3 -color $graph(color_chi2)
     587        $box element config 0 -dash 0 -line 3
     588        catch {$box element config 0 -color $graph(color_chi2)}
    581589    } else {
    582         $box element config 0 -dash 4 -line 2 -color $graph(color_OmCoS)
    583     }
    584     $box element config 1 -color $graph(color_bkg)
    585     $box element config 2 -color $graph(color_calc)
    586     $box element config 4 -color $graph(color_diff)
     590        $box element config 0 -dash 4 -line 2
     591        catch {$box element config 0 -color $graph(color_OmCoS)}
     592    }
     593    catch {$box element config 1 -color $graph(color_bkg)}
     594    catch {$box element config 2 -color $graph(color_calc)}
     595    catch {$box element config 4 -color $graph(color_diff)}
    587596    global program
    588597    if {$program == "bkgedit"}  {
    589         $box element config 12 -color $graph(color_input) \
    590                 -pixels [expr 0.125 * $peakinfo(inpsize)]i \
    591                 -symbol $peakinfo(inpsym)
    592         $box element config 11 -color $graph(color_fit)
     598        catch {$box element config 12 -color $graph(color_input)}
     599        catch {$box element config 12
     600            -pixels [expr 0.125 * $peakinfo(inpsize)]i}
     601        catch {$box element config 12 -symbol $peakinfo(inpsym)}
     602        catch {$box element config 11 -color $graph(color_fit)}
    593603    }
    594604    xvec notify now
     
    11221132# change the binding of the mouse, based on the selected mode
    11231133proc bkgEditMode {b} {
    1124     global zoomcommand box
    1125     # get binding
    1126     set bindtag $box
    1127     catch {
    1128         if {[bind bltZoomGraph] != ""} {
    1129             set bindtag bltZoomGraph
    1130         }
    1131     }
     1134    global zoomcommand graph box
    11321135    # save the zoom command
    11331136    if [catch {set zoomcommand}] {
    1134         set zoomcommand [bind $bindtag <1>]
     1137        set zoomcommand [bind $graph(bindtag) <1>]
    11351138        .bkg.f.fit1 config -state disabled
    11361139        .bkg.f.terms config -state disabled
     
    11531156    }
    11541157    if {$b == 2} {
    1155         bind $bindtag <1> "bkgAddPoint %x %y"
     1158        bind $graph(bindtag) <1> "bkgAddPoint %x %y"
    11561159        .g config -cursor arrow
    11571160    } elseif {$b == 3} {
    1158         bind $bindtag <1> "bkgDelPoint %x %y"
     1161        bind $graph(bindtag) <1> "bkgDelPoint %x %y"
    11591162        .g config -cursor circle
    11601163    } else {
    1161         bind $bindtag <1> $zoomcommand
     1164        bind $graph(bindtag) <1> $zoomcommand
    11621165        .g config -cursor crosshair
    11631166    }
     
    12791282proc bkgFit {button} {
    12801283    global bkglist termlist expgui
     1284    # if there <3 points, a fit is not possible
     1285    if {[llength $bkglist] < 3} {
     1286        bell
     1287        return
     1288    }
    12811289    # keep the button down while working
    12821290    $button config -relief sunken
     
    19881996    proc blt::PushZoom {graph} $b1
    19891997}
    1990 
    1991 $box element create 0 -xdata xvec -ydata wifdvec -color $graph(color_chi2) \
     1998# get binding for zoom
     1999set graph(bindtag) $box
     2000catch {
     2001    if {[bind zoom-$box] != ""} {
     2002        # blt2.4z
     2003        set graph(bindtag) zoom-$box
     2004    } elseif {[bind bltZoomGraph] != ""} {
     2005        # blt2.4?
     2006        set graph(bindtag) bltZoomGraph
     2007    }
     2008}
     2009
     2010$box element create 0 -xdata xvec -ydata wifdvec \
    19922011        -line 3 -symbol none -label "Chi2" -mapy y2
     2012catch {$box element config 0 -color $graph(color_chi2)}
     2013
    19932014$box element create 1 -label bckgr -symbol none 
    1994 $box element config 1 -xdata xvec -ydata bckvec -color $graph(color_bkg)
    1995 $box element create 3 -color $graph(color_obs) -linewidth 0 -label Obs \
    1996         -symbol $peakinfo(obssym) \
    1997         -pixels [expr 0.125 * $peakinfo(obssize)]i
    1998 $box element create 2 -label Calc -color $graph(color_calc) -symbol none 
    1999 $box element create 4 -label diff -color $graph(color_diff) -symbol none 
     2015$box element config 1 -xdata xvec -ydata bckvec
     2016catch {$box element config 1 -color $graph(color_bkg)}
     2017$box element create 3 -linewidth 0 -label Obs
     2018catch {$box element configure 3 -symbol $peakinfo(obssym)}
     2019catch {$box element configure 3 -color $graph(color_obs)}
     2020catch {$box element configure 3 -pixels [expr 0.125 * $peakinfo(obssize)]i}
     2021$box element create 2 -label Calc -symbol none 
     2022catch {$box element config 2 -color $graph(color_calc)}
     2023$box element create 4 -label diff -symbol none 
     2024catch {$box element config 4 -color $graph(color_diff)}
    20002025
    20012026if {$program == "liveplot"} {
     
    20122037    $box element create 11
    20132038    $box element create 12
    2014     $box element configure 12  -color $graph(color_input) \
    2015             -pixels [expr 0.125 * $peakinfo(inpsize)]i \
    2016             -line 0 -symbol $peakinfo(inpsym) -label "bkg pts"
    2017     $box element configure 11 -color $graph(color_fit) \
    2018             -symbol none -label "bkg fit" -dashes 5 -line 2
     2039    $box element configure 12 -line 0 -label "bkg pts"
     2040    catch {$box element config 12 -color $graph(color_input)}
     2041    catch {$box element config 12 -pixels [expr 0.125 * $peakinfo(inpsize)]i}
     2042    catch {$box element config 12 -symbol $peakinfo(inpsym)}
     2043    $box element configure 11 -symbol none -label "bkg fit" -dashes 5 -line 2
     2044    catch {$box element config 11 -color $graph(color_fit)}
    20192045    $box element show "3 2 11 12"
    20202046}
     
    20302056    bind . <Key-d> "delallhkllbl $box"
    20312057    bind . <Key-D> "delallhkllbl $box"
    2032     if {[bind bltZoomGraph] != ""} {
    2033         bind bltZoomGraph <Shift-Button-1> "lblhkl $box %x"
    2034         bind bltZoomGraph <Shift-Button-3> "delallhkllbl %W"
    2035     } else {
    2036         bind $box <Shift-Button-1> "lblhkl $box %x"
    2037         bind $box <Shift-Button-3> "delallhkllbl %W"
    2038     }
     2058    bind $graph(bindtag) <Shift-Button-1> "lblhkl $box %x"
     2059    bind $graph(bindtag) <Shift-Button-3> "delallhkllbl %W"
    20392060} else {
    20402061    $box element config 1 -label ""
     
    22552276            -label "Web page"
    22562277}
     2278if {![catch {package require tkcon} errmsg]} {
     2279    .a.help.menu add command -label "Open console" -command {tkcon show}
     2280} elseif {$tcl_platform(platform) == "windows"} {
     2281    .a.help.menu add command -label "Open console" -command {console show}
     2282}
    22572283.a.help.menu add command -command aboutliveplot -label About
    22582284
Note: See TracChangeset for help on using the changeset viewer.