1 | # $Id: exclinit.tcl 474 2009-12-04 23:06:46Z toby $ |
---|
2 | |
---|
3 | # excledt stuff to be read in at initialization time |
---|
4 | |
---|
5 | # default values |
---|
6 | set graph(legend) 1 |
---|
7 | set graph(exclPrompt) 1 |
---|
8 | set graph(outname) out.ps |
---|
9 | set graph(outcmd) lpr |
---|
10 | set graph(color_excl) orange |
---|
11 | set graph(color_calc) red |
---|
12 | set graph(color_obs) black |
---|
13 | set graph(xcaption) {} |
---|
14 | set graph(ycaption) {} |
---|
15 | set graph(xunits) 0 |
---|
16 | set graph(yunits) 0 |
---|
17 | set graph(autoraise) 1 |
---|
18 | set graph(FillExclRegionBox) 1 |
---|
19 | set expgui(autotick) 0 |
---|
20 | |
---|
21 | set peakinfo(obssym) scross |
---|
22 | set peakinfo(obssize) 1.0 |
---|
23 | set peakinfo(exclsym) scross |
---|
24 | set peakinfo(exclsize) 1.2 |
---|
25 | # create a set of markers for each phase |
---|
26 | for {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 |
---|
33 | array 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 | } |
---|
44 | if {$tcl_platform(platform) == "windows"} { |
---|
45 | set graph(printout) 1 |
---|
46 | } else { |
---|
47 | set graph(printout) 0 |
---|
48 | } |
---|
49 | |
---|
50 | proc 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 { |
---|
95 | foreach vec {allxvec xvec obsvec calcvec diffvec exxvec exobsvec} { |
---|
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). \ |
---|
103 | EXCLEDT 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 | } |
---|