1 | #pragma rtGlobals=1 // Use modern global access method. |
---|
2 | |
---|
3 | // load/unload courtesy of Jan Ilavsky |
---|
4 | // June 2008 |
---|
5 | |
---|
6 | // - SRK Oct 2008 |
---|
7 | // rather than deleting the macros, it is preferable to simply hide the appropriate panels. |
---|
8 | // deleting the ipf files will break dependencies, leave panels hanging open without |
---|
9 | // their associated procedures, etc. |
---|
10 | |
---|
11 | // names of everything have been changed so I won't clash with Jan's code |
---|
12 | // |
---|
13 | // |
---|
14 | // - make this an independent module in case of bad compilation... |
---|
15 | |
---|
16 | |
---|
17 | Menu "Macros" |
---|
18 | StrVarOrDefault("root:Packages:NCNRItemStr1a","Load NCNR Analysis Macros"), NCNR_AnalysisLoader(StrVarOrDefault("root:Packages:NCNRItemStr1a","Load NCNR Analysis Macros")) |
---|
19 | StrVarOrDefault("root:Packages:NCNRItemStr1b","-"), NCNR_AnalysisLoader(StrVarOrDefault("root:Packages:NCNRItemStr1b","-")) |
---|
20 | |
---|
21 | StrVarOrDefault("root:Packages:NCNRItemStr2a","Load NCNR SANS Reduction Macros"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2a","Load NCNR SANS Reduction Macros")) |
---|
22 | StrVarOrDefault("root:Packages:NCNRItemStr2b","-"), NCNR_SANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr2b","-")) |
---|
23 | |
---|
24 | StrVarOrDefault("root:Packages:NCNRItemStr3a","Load NCNR USANS Reduction Macros"), NCNR_USANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr3a","Load NCNR USANS Reduction Macros")) |
---|
25 | StrVarOrDefault("root:Packages:NCNRItemStr3b","-"), NCNR_USANSReductionLoader(StrVarOrDefault("root:Packages:NCNRItemStr3b","-")) |
---|
26 | end |
---|
27 | |
---|
28 | Function NCNR_AnalysisLoader(itemStr) |
---|
29 | String itemStr |
---|
30 | |
---|
31 | if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.02) |
---|
32 | Abort "Your version of Igor is lower than 6.02, these macros need version 6.02 or higher.... " |
---|
33 | endif |
---|
34 | |
---|
35 | NewDataFolder/O root:Packages //create the folder for string variable |
---|
36 | String/G root:Packages:NCNRItemStr1a = itemStr |
---|
37 | String/G root:Packages:NCNRItemStr1b = itemStr |
---|
38 | SVAR gMenuStr1a = root:Packages:NCNRItemStr1a |
---|
39 | SVAR gMenuStr1b = root:Packages:NCNRItemStr1b |
---|
40 | |
---|
41 | strswitch(itemStr) // string switch |
---|
42 | case "Load NCNR Analysis Macros": |
---|
43 | Execute/P "INSERTINCLUDE \"SA_Includes_v400\"" |
---|
44 | Execute/P "INSERTINCLUDE \"PlotUtilsMacro_v40\"" |
---|
45 | Execute/P "INSERTINCLUDE \"GaussUtils_v40\"" |
---|
46 | Execute/P "INSERTINCLUDE \"WriteModelData_v40\"" |
---|
47 | Execute/P "INSERTINCLUDE \"USANS_SlitSmearing_v40\"" |
---|
48 | Execute/P "INSERTINCLUDE \"SANSModelPicker_v40\"" |
---|
49 | Execute/P "COMPILEPROCEDURES " |
---|
50 | Execute/P ("Init_WrapperPanel()") |
---|
51 | Execute/P ("ModelPicker_Panel()") |
---|
52 | |
---|
53 | gMenuStr1a = "Hide NCNR Analysis Macros" |
---|
54 | // gMenuStr1b = "Unload NCNR Analysis Macros" |
---|
55 | gMenuStr1b = "-" |
---|
56 | BuildMenu "Macros" |
---|
57 | |
---|
58 | break |
---|
59 | case "Unload NCNR Analysis Macros": |
---|
60 | // very dangerous - don't really want to implement this because it will surely crash |
---|
61 | Execute/P "DELETEINCLUDE \"SA_Includes_v400\"" |
---|
62 | Execute/P "DELETEINCLUDE \"PlotUtilsMacro_v40\"" |
---|
63 | Execute/P "DELETEINCLUDE \"GaussUtils_v40\"" |
---|
64 | Execute/P "DELETEINCLUDE \"WriteModelData_v40\"" |
---|
65 | Execute/P "DELETEINCLUDE \"USANS_SlitSmearing_v40\"" |
---|
66 | Execute/P "DELETEINCLUDE \"SANSModelPicker_v40\"" |
---|
67 | Execute/P "COMPILEPROCEDURES " |
---|
68 | DoWindow wrapperPanel |
---|
69 | if(V_Flag) |
---|
70 | DoWindow/K wrapperPanel |
---|
71 | endif |
---|
72 | DoWindow Procedure_List |
---|
73 | If(V_Flag) |
---|
74 | DoWindow/K Procedure_List |
---|
75 | endif |
---|
76 | |
---|
77 | gMenuStr1a = "Load NCNR Analysis Macros" |
---|
78 | gMenuStr1b = "-" |
---|
79 | |
---|
80 | BuildMenu "Macros" |
---|
81 | |
---|
82 | break |
---|
83 | case "Hide NCNR Analysis Macros": |
---|
84 | DoWindow wrapperPanel |
---|
85 | if(V_Flag) |
---|
86 | DoWindow/HIDE=1 wrapperPanel |
---|
87 | endif |
---|
88 | DoWindow Procedure_List |
---|
89 | If(V_Flag) |
---|
90 | DoWindow/HIDE=1 Procedure_List |
---|
91 | endif |
---|
92 | |
---|
93 | gMenuStr1a = "Show NCNR Analysis Macros" |
---|
94 | // gMenuStr1b = "Unload NCNR Analysis Macros" |
---|
95 | gMenuStr1b = "-" |
---|
96 | BuildMenu "Macros" |
---|
97 | |
---|
98 | break |
---|
99 | case "Show NCNR Analysis Macros": |
---|
100 | DoWindow wrapperPanel |
---|
101 | if(V_Flag) |
---|
102 | DoWindow/HIDE=0 wrapperPanel |
---|
103 | endif |
---|
104 | DoWindow Procedure_List |
---|
105 | If(V_Flag) |
---|
106 | DoWindow/HIDE=0 Procedure_List |
---|
107 | endif |
---|
108 | |
---|
109 | gMenuStr1a = "Hide NCNR Analysis Macros" |
---|
110 | // gMenuStr1b = "Unload NCNR Analysis Macros" |
---|
111 | gMenuStr1b = "-" |
---|
112 | BuildMenu "Macros" |
---|
113 | |
---|
114 | break |
---|
115 | default: |
---|
116 | Abort "Invalid Menu Selection" |
---|
117 | endswitch |
---|
118 | |
---|
119 | end |
---|
120 | |
---|
121 | |
---|
122 | // now add for the SANS Reduction |
---|
123 | Function NCNR_SANSReductionLoader(itemStr) |
---|
124 | String itemStr |
---|
125 | |
---|
126 | if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.02) |
---|
127 | Abort "Your version of Igor is lower than 6.02, these macros need version 6.02 or higher.... " |
---|
128 | endif |
---|
129 | |
---|
130 | NewDataFolder/O root:Packages //create the folder for string variable |
---|
131 | String/G root:Packages:NCNRItemStr2a = itemStr |
---|
132 | String/G root:Packages:NCNRItemStr2b = itemStr |
---|
133 | SVAR gMenuStr2a = root:Packages:NCNRItemStr2a |
---|
134 | SVAR gMenuStr2b = root:Packages:NCNRItemStr2b |
---|
135 | |
---|
136 | strswitch(itemStr) // string switch |
---|
137 | case "Load NCNR SANS Reduction Macros": |
---|
138 | Execute/P "INSERTINCLUDE \"Includes_v510\"" |
---|
139 | Execute/P "COMPILEPROCEDURES " |
---|
140 | Execute/P ("Initialize()") |
---|
141 | |
---|
142 | gMenuStr2a = "Hide NCNR SANS Reduction Macros" |
---|
143 | // gMenuStr2b = "Unload NCNR SANS Reduction Macros" |
---|
144 | gMenuStr2b = "-" |
---|
145 | BuildMenu "Macros" |
---|
146 | |
---|
147 | break |
---|
148 | case "Unload NCNR SANS Reduction Macros": |
---|
149 | // very dangerous - don't really want to implement this because it will surely crash |
---|
150 | Execute/P "DELETEINCLUDE \"Includes_v510\"" |
---|
151 | Execute/P "COMPILEPROCEDURES " |
---|
152 | DoWindow Main_Panel |
---|
153 | if(V_Flag) |
---|
154 | DoWindow/K Main_Panel |
---|
155 | endif |
---|
156 | |
---|
157 | gMenuStr2a = "Load NCNR SANS Reduction Macros" |
---|
158 | gMenuStr2b = "-" |
---|
159 | |
---|
160 | BuildMenu "Macros" |
---|
161 | |
---|
162 | break |
---|
163 | case "Hide NCNR SANS Reduction Macros": |
---|
164 | DoWindow Main_Panel |
---|
165 | if(V_Flag) |
---|
166 | DoWindow/HIDE=1 Main_Panel |
---|
167 | endif |
---|
168 | |
---|
169 | gMenuStr2a = "Show NCNR SANS Reduction Macros" |
---|
170 | // gMenuStr2b = "Unload NCNR SANS Reduction Macros" |
---|
171 | gMenuStr2b = "-" |
---|
172 | BuildMenu "Macros" |
---|
173 | |
---|
174 | break |
---|
175 | case "Show NCNR SANS Reduction Macros": |
---|
176 | DoWindow Main_Panel |
---|
177 | if(V_Flag) |
---|
178 | DoWindow/HIDE=0 Main_Panel |
---|
179 | endif |
---|
180 | |
---|
181 | gMenuStr2a = "Hide NCNR SANS Reduction Macros" |
---|
182 | // gMenuStr2b = "Unload NCNR SANS Reduction Macros" |
---|
183 | gMenuStr2b = "-" |
---|
184 | BuildMenu "Macros" |
---|
185 | |
---|
186 | break |
---|
187 | default: |
---|
188 | Abort "Invalid Menu Selection" |
---|
189 | endswitch |
---|
190 | |
---|
191 | end |
---|
192 | |
---|
193 | // now add for the SANS Reduction |
---|
194 | Function NCNR_USANSReductionLoader(itemStr) |
---|
195 | String itemStr |
---|
196 | |
---|
197 | if (str2num(stringByKey("IGORVERS",IgorInfo(0))) < 6.02) |
---|
198 | Abort "Your version of Igor is lower than 6.02, these macros need version 6.02 or higher.... " |
---|
199 | endif |
---|
200 | |
---|
201 | NewDataFolder/O root:Packages //create the folder for string variable |
---|
202 | String/G root:Packages:NCNRItemStr3a = itemStr |
---|
203 | String/G root:Packages:NCNRItemStr3b = itemStr |
---|
204 | SVAR gMenuStr3a = root:Packages:NCNRItemStr3a |
---|
205 | SVAR gMenuStr3b = root:Packages:NCNRItemStr3b |
---|
206 | |
---|
207 | strswitch(itemStr) // string switch |
---|
208 | case "Load NCNR USANS Reduction Macros": |
---|
209 | Execute/P "INSERTINCLUDE \"USANS_Includes\"" |
---|
210 | Execute/P "COMPILEPROCEDURES " |
---|
211 | Execute/P ("ShowUSANSPanel()") |
---|
212 | |
---|
213 | gMenuStr3a = "Hide NCNR USANS Reduction Macros" |
---|
214 | // gMenuStr3b = "Unload NCNR USANS Reduction Macros" |
---|
215 | gMenuStr3b = "-" |
---|
216 | BuildMenu "Macros" |
---|
217 | |
---|
218 | break |
---|
219 | case "Unload NCNR USANS Reduction Macros": |
---|
220 | // very dangerous - don't really want to implement this because it will surely crash |
---|
221 | Execute/P "DELETEINCLUDE \"USANS_Includes\"" |
---|
222 | Execute/P "COMPILEPROCEDURES " |
---|
223 | DoWindow USANS_Panel |
---|
224 | if(V_Flag) |
---|
225 | DoWindow/K USANS_Panel |
---|
226 | endif |
---|
227 | |
---|
228 | gMenuStr3a = "Load NCNR USANS Reduction Macros" |
---|
229 | gMenuStr3b = "-" |
---|
230 | |
---|
231 | BuildMenu "Macros" |
---|
232 | |
---|
233 | break |
---|
234 | case "Hide NCNR USANS Reduction Macros": |
---|
235 | DoWindow USANS_Panel |
---|
236 | if(V_Flag) |
---|
237 | DoWindow/HIDE=1 USANS_Panel |
---|
238 | endif |
---|
239 | |
---|
240 | gMenuStr3a = "Show NCNR USANS Reduction Macros" |
---|
241 | // gMenuStr3b = "Unload NCNR USANS Reduction Macros" |
---|
242 | gMenuStr3b = "-" |
---|
243 | BuildMenu "Macros" |
---|
244 | |
---|
245 | break |
---|
246 | case "Show NCNR USANS Reduction Macros": |
---|
247 | DoWindow USANS_Panel |
---|
248 | if(V_Flag) |
---|
249 | DoWindow/HIDE=0 USANS_Panel |
---|
250 | endif |
---|
251 | |
---|
252 | gMenuStr3a = "Hide NCNR USANS Reduction Macros" |
---|
253 | // gMenuStr3b = "Unload NCNR USANS Reduction Macros" |
---|
254 | gMenuStr3b = "-" |
---|
255 | BuildMenu "Macros" |
---|
256 | |
---|
257 | break |
---|
258 | default: |
---|
259 | Abort "Invalid Menu Selection" |
---|
260 | endswitch |
---|
261 | |
---|
262 | end |
---|
263 | |
---|