source: trunk/exclinit.tcl

Last change on this file was 1251, checked in by toby, 7 years ago

use svn ps svn:eol-style "native" * to change line ends

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Revision Id
File size: 2.9 KB
RevLine 
[474]1# $Id: exclinit.tcl 1251 2014-03-10 22:17:29Z toby $
2
3# excledt stuff to be read in at initialization time
4
5# default values
6set graph(legend) 1
7set graph(exclPrompt) 1
8set graph(outname) out.ps
9set graph(outcmd) lpr
10set graph(color_excl) orange
11set graph(color_calc) red
12set graph(color_obs) black
13set graph(xcaption) {}
14set graph(ycaption) {}
15set graph(xunits) 0
16set graph(yunits) 0
17set graph(autoraise) 1
18set graph(FillExclRegionBox) 1
19set expgui(autotick) 0
20
21set peakinfo(obssym) scross
22set peakinfo(obssize) 1.0
23set peakinfo(exclsym) scross
24set peakinfo(exclsize) 1.2
25# create a set of markers for each phase
26for {set i 1} {$i < 10} {incr i} {
27    set peakinfo(flag$i) 0
28    set peakinfo(max$i) Inf
29    set peakinfo(min$i) -Inf
30    set peakinfo(dashes$i) 1
31}
32# define colors
33array set peakinfo {
34    color1 magenta
35    color2 cyan
36    color3 yellow
37    color4 sienna
38    color5 orange
39    color6 DarkViolet
40    color7 HotPink
41    color8 salmon
42    color9 LimeGreen
43}
44if {$tcl_platform(platform) == "windows"} {
45    set graph(printout) 1
46} else {
47    set graph(printout) 0
48}
49
50proc StartExcl {} {
51    global graph
52    # has this been run?
53    set init ""
54    catch {set init $graph(InitExcl)}
55    if {$init != ""} {
56        ShowExcl
57        return
58    }
59    if [catch {package require BLT} errmsg] {
60        MyMessageBox -parent . -title "BLT Error" \
61                -message "Error -- Unable to load the BLT package; cannot run EXCLEDT" \
62                -helplink "expgui.html blt" \
63                -icon error -type Skip -default skip
64        return 0
65    }
66    # handle Tcl/Tk v8+ where BLT is in a namespace
67    #  use the command so that it is loaded
68    catch {blt::graph}
69    catch {
70        namespace import blt::graph
71        namespace import blt::vector
72    }
73    # old versions of blt don't report a version number
74    global blt_version graph
75    if [catch {set blt_version}] {set blt_version 0}
76    # option for coloring markers: note that GH keeps changing how to do this!
77    # also element -mapped => -show
78    if {$blt_version < 2.3 || $blt_version >= 8.0} {
79        # version 8.0 is ~same as 2.3
80        set graph(MarkerColorOpt) -fg
81        # mapped is needed in 8.0, both are OK in 2.3
82        set graph(ElementShowOption) "-mapped 1"
83        set graph(ElementHideOption) "-mapped 0"
84    } elseif {$blt_version >= 2.4} {
85        set graph(MarkerColorOpt) -outline
86        set graph(ElementShowOption) "-hide 0"
87        set graph(ElementHideOption) "-hide 1"
88    } else {
89        set graph(MarkerColorOpt) -color
90        set graph(ElementShowOption) "-mapped 1"
91        set graph(ElementHideOption) "-mapped 0"
92    }
93    # vectors
94    if [catch {
[827]95        foreach vec {allxvec xvec obsvec calcvec exxvec exobsvec} {
[474]96            vector $vec
97            $vec notify never
98        }
99    } errmsg] {
100        MyMessageBox -parent . -title "BLT Error" \
101                -message "BLT Setup Error: could not define vectors \
102(msg: $errmsg). \
103EXCLEDT cannot be run without vectors." \
104                -helplink "expgui.html blt" \
105                -icon error -type Skip -default skip
106        return 0
107    }
108    global expgui
109    source [file join $expgui(scriptdir) excledt.tcl]
110    set graph(InitExcl) 1
111    ShowExcl
112    return
113}
Note: See TracBrowser for help on using the repository browser.