Debian Codegraph @

gui/XEchelle/src/misc.c

raw
1 /*===========================================================================
2 Copyright (C) 1993-2009 European Southern Observatory (ESO)
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this program; if not, write to the Free
16 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
17 MA 02139, USA.
18
19 Correspondence concerning ESO-MIDAS should be addressed as follows:
20 Internet e-mail: [email protected]
21 Postal address: European Southern Observatory
22 Data Management Division
23 Karl-Schwarzschild-Strasse 2
24 D 85748 Garching bei Muenchen
25 GERMANY
26 ===========================================================================*/
27
28 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
29 /* .IDENT midasutil.c */
30 /* .AUTHORS Pascal Ballester (ESO/Garching) */
31 /* Cristian Levin (ESO/La Silla) */
32 /* .KEYWORDS XLong, Spectroscopy, Long-Slit */
33 /* .PURPOSE */
34 /* .VERSION 1.0 Package Creation 17-MAR-1993
35
36 090825 last modif */
37 /* ------------------------------------------------------- */
38
39 #include <gl_defs.h>
40 #include <xm_defs.h>
41 #include <main_defs.h>
42 #include <spec_comm.h>
43 #include <UxLib.h>
44
45 #include <midas_def.h>
46
47
48 #define HELP_FILE "gui/XEchelle/incl/help.h"
49 #define HELP_DELIMITER '~'
50
51 static char help_text[4000]; /* Max of 50 lines */
52
53 void PopupLong( interface )
54 char *interface;
55 {
56 /*
57 UxPopdownInterface(UxFindSwidget("SearchShell"));
58 UxPopdownInterface(UxFindSwidget("CalibShell"));
59 UxPopdownInterface(UxFindSwidget("RebinShell"));
60 UxPopdownInterface(UxFindSwidget("ExtractShell"));
61 UxPopdownInterface(UxFindSwidget("FluxShell"));
62 */
63
64 UxPopupInterface(UxFindSwidget(interface), no_grab);
65 }
66
67 void DisplayShortHelp( sw )
68 Widget sw; /* current widget */
69 {
70 char s[256], s_help[32];
71
72 s[0] = '\0';
73
74 if ( sw == UxGetWidget(UxFindSwidget("tf_session")) ) {
75 strcpy(s,"Session name. The session can be saved using the \"File\" pulldown\nmenu");
76 strcpy(s_help, "shelp_main");
77 }
78 else if ( sw == UxGetWidget(UxFindSwidget("tf_wlc")) ) {
79 strcpy(s,"Wavelength calibration frame, assigned in the search line process");
80 strcpy(s_help, "shelp_main");
81 }
82 else if ( sw == UxGetWidget(UxFindSwidget("tf_instrume")) ) {
83 strcpy(s,"Instrument associated to the calibration frame");
84 strcpy(s_help, "shelp_main");
85 }
86 else if ( sw == UxGetWidget(UxFindSwidget("tf_ystart")) ) {
87 strcpy(s,"Starting row for the calibration (pixel value)");
88 strcpy(s_help, "shelp_main");
89 }
90 else if ( sw == UxGetWidget(UxFindSwidget("tf_lincat")) ) {
91 strcpy(s,"Line catalogue table");
92 strcpy(s_help, "shelp_main");
93 }
94 else if ( sw == UxGetWidget(UxFindSwidget("tf_wrang1")) ) {
95 strcpy(s,"Lower wavelength limit to be considered in the line catalogue");
96 strcpy(s_help, "shelp_main");
97 }
98 else if ( sw == UxGetWidget(UxFindSwidget("tf_wrang2")) ) {
99 strcpy(s,"Upper wavelength limit to be considered in the line catalogue");
100 strcpy(s_help, "shelp_main");
101 }
102 else if ( sw == UxGetWidget(UxFindSwidget("tf_imin")) ) {
103 strcpy(s,"Minimum strength (intensity) limit of the line catalogue");
104 strcpy(s_help, "shelp_main");
105 }
106 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_search")) ) {
107 strcpy(s,"Open the search line interface");
108 strcpy(s_help, "shelp_main");
109 }
110 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_ident")) ) {
111 strcpy(s,"Open the line identification interface");
112 strcpy(s_help, "shelp_main");
113 }
114 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_calib")) ) {
115 strcpy(s,"Open the wavelength calibration interface");
116 strcpy(s_help, "shelp_main");
117 }
118 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_rebin")) ) {
119 strcpy(s,"Open the rebinning interface");
120 strcpy(s_help, "shelp_main");
121 }
122 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_extract")) ) {
123 strcpy(s,"Open the spectrum extraction interface");
124 strcpy(s_help, "shelp_main");
125 }
126 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_flux")) ) {
127 strcpy(s,"Open the flux calibration interface");
128 strcpy(s_help, "shelp_main");
129 }
130 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_batch")) ) {
131 strcpy(s,"Open the batch reduction form");
132 strcpy(s_help, "shelp_main");
133 }
134 else if ( sw == UxGetWidget(UxFindSwidget("tf_thres")) ) {
135 strcpy(s,"Threshold for for line detection (above local median)");
136 strcpy(s_help, "shelp_search");
137 }
138 else if ( sw == UxGetWidget(UxFindSwidget("tf_width")) ) {
139 strcpy(s,"Window size in X for line detection (pixels)");
140 strcpy(s_help, "shelp_search");
141 }
142 else if ( sw == UxGetWidget(UxFindSwidget("tf_ywidth")) ) {
143 strcpy(s,"Window size in Y for line detection (pixels)");
144 strcpy(s_help, "shelp_search");
145 }
146 else if ( sw == UxGetWidget(UxFindSwidget("tf_ystep")) ) {
147 strcpy(s,"Step in Y for line searching (pixels)");
148 strcpy(s_help, "shelp_search");
149 }
150 else if ( sw == UxGetWidget(UxFindSwidget("pb_search_search")) ) {
151 strcpy(s,"Do the search");
152 strcpy(s_help, "shelp_search");
153 }
154 else if ( sw == UxGetWidget(UxFindSwidget("pb_search_plot")) ) {
155 strcpy(s,"Plot the lines found");
156 strcpy(s_help, "shelp_search");
157 }
158 else if ( sw == UxGetWidget(UxFindSwidget("tf_tol")) ) {
159 strcpy(s,"tolerance in Angstroms for wavelength ident.");
160 strcpy(s_help, "shelp_calib");
161 }
162 else if ( sw == UxGetWidget(UxFindSwidget("tf_dcx1")) ) {
163 strcpy(s,"fit degree of the dispersion coeff. in X");
164 strcpy(s_help, "shelp_calib");
165 }
166 else if ( sw == UxGetWidget(UxFindSwidget("tf_dcx2")) ) {
167 strcpy(s,"fit degree of the dispersion coeff. in Y");
168 strcpy(s_help, "shelp_calib");
169 }
170 else if ( sw == UxGetWidget(UxFindSwidget("tf_wlcniter1")) ) {
171 strcpy(s,"Minimum number of iterations");
172 strcpy(s_help, "shelp_calib");
173 }
174 else if ( sw == UxGetWidget(UxFindSwidget("tf_wlcniter2")) ) {
175 strcpy(s,"Maximum number of iterations");
176 strcpy(s_help, "shelp_calib");
177 }
178 else if ( sw == UxGetWidget(UxFindSwidget("tf_alpha")) ) {
179 strcpy(s,"Rejection parameter for lines matching");
180 strcpy(s_help, "shelp_calib");
181 }
182 else if ( sw == UxGetWidget(UxFindSwidget("tf_maxdev")) ) {
183 strcpy(s,"Maximum deviation (pixels)");
184 strcpy(s_help, "shelp_calib");
185 }
186 else if ( sw == UxGetWidget(UxFindSwidget("tf_guess")) ) {
187 strcpy(s,"Guess session name");
188 strcpy(s_help, "shelp_calib");
189 }
190 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_calibrate")) ) {
191 strcpy(s,"Do the calibration in the starting line");
192 strcpy(s_help, "shelp_calib");
193 }
194 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_edit")) ) {
195 strcpy(s,"Edit the results in the dispersion or spectrum plot");
196 strcpy(s_help, "shelp_calib");
197 }
198 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_getcur")) ) {
199 strcpy(s,"Get the cursor value (wavelength units) in the spectrum plot ");
200 strcpy(s_help, "shelp_calib");
201 }
202 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_all")) ) {
203 strcpy(s,"Do the calibration in the whole calibration frame");
204 strcpy(s_help, "shelp_calib");
205 }
206 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_twice")) ) {
207 strcpy(s,"Do the calibration in the whole calibration frame. It forces to find the same\nnumber of lines on each row");
208 strcpy(s_help, "shelp_calib");
209 }
210 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_disper")) ) {
211 strcpy(s,"Plot the dispersion (delta(wave) / wave)");
212 strcpy(s_help, "shelp_calib");
213 }
214 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_resid")) ) {
215 strcpy(s,"Plot the residuals (specific row or the whole frame)");
216 strcpy(s_help, "shelp_calib");
217 }
218 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_spec")) ) {
219 strcpy(s,"Plot the starting line with the lines found");
220 strcpy(s_help, "shelp_calib");
221 }
222 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_shape")) ) {
223 strcpy(s,"Plot the line shape or distortion associated to a wavelength value");
224 strcpy(s_help, "shelp_calib");
225 }
226 else if ( sw == UxGetWidget(UxFindSwidget("tf_rebstrt")) ) {
227 strcpy(s,"Starting wavelength for rebinning");
228 strcpy(s_help, "shelp_rebin");
229 }
230 else if ( sw == UxGetWidget(UxFindSwidget("tf_rebend")) ) {
231 strcpy(s,"Final wavelength for rebinning");
232 strcpy(s_help, "shelp_rebin");
233 }
234 else if ( sw == UxGetWidget(UxFindSwidget("tf_rebstp")) ) {
235 strcpy(s,"Wavelength step for rebinning");
236 strcpy(s_help, "shelp_rebin");
237 }
238 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_rbr")) ) {
239 strcpy(s,"Do the rebinning row by row");
240 strcpy(s_help, "shelp_rebin");
241 }
242 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_2d")) ) {
243 strcpy(s,"Do the rebinning using a 2-D solution. The output is a frame");
244 strcpy(s_help, "shelp_rebin");
245 }
246 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_table")) ) {
247 strcpy(s,"Do the rebinning using a 2-D solution. The output is a table");
248 strcpy(s_help, "shelp_rebin");
249 }
250 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_plot")) ) {
251 strcpy(s,"Plot the result of the \"rebin table\" command");
252 strcpy(s_help, "shelp_rebin");
253 }
254 else if ( sw == UxGetWidget(UxFindSwidget("tf_extin_tbl")) ) {
255 strcpy(s,"Extinction Table");
256 strcpy(s_help, "shelp_flux");
257 }
258 else if ( sw == UxGetWidget(UxFindSwidget("tf_flux_tbl")) ) {
259 strcpy(s,"Flux Table of the standard star");
260 strcpy(s_help, "shelp_flux");
261 }
262 else if ( sw == UxGetWidget(UxFindSwidget("tf_output_resp")) ) {
263 strcpy(s,"Response Image");
264 strcpy(s_help, "shelp_flux");
265 }
266 else if ( sw == UxGetWidget(UxFindSwidget("tf_fitd")) ) {
267 strcpy(s,"Degree of fit");
268 strcpy(s_help, "shelp_flux");
269 }
270 else if ( sw == UxGetWidget(UxFindSwidget("tf_smooth")) ) {
271 strcpy(s,"Smoothing factor for spline fitting");
272 strcpy(s_help, "shelp_flux");
273 }
274 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_extin")) ) {
275 strcpy(s,"Do the extinction correction");
276 strcpy(s_help, "shelp_flux");
277 }
278 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_integr")) ) {
279 strcpy(s,"Do the integration");
280 strcpy(s_help, "shelp_flux");
281 }
282 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_fit")) ) {
283 strcpy(s,"Do the fitting, generating the response curve");
284 strcpy(s_help, "shelp_flux");
285 }
286 else if ( sw == UxGetWidget(UxFindSwidget("pb_edit_flux")) ) {
287 strcpy(s,"Edit the table generated by the integration process");
288 strcpy(s_help, "shelp_flux");
289 }
290 else if ( sw == UxGetWidget(UxFindSwidget("pb_correct")) ) {
291 strcpy(s,"Calibrate the input image in flux, using the response curve generated");
292 strcpy(s_help, "shelp_flux");
293 }
294 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_filter")) ) {
295 strcpy(s,"Generates the response curve by filtering");
296 strcpy(s_help, "shelp_flux");
297 }
298 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_pflux")) ) {
299 strcpy(s,"Plot the Flux Table");
300 strcpy(s_help, "shelp_flux");
301 }
302 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_presp")) ) {
303 strcpy(s,"Plot the response curve");
304 strcpy(s_help, "shelp_flux");
305 }
306 else if ( sw == UxGetWidget(UxFindSwidget("tf_lowsky1")) ) {
307 strcpy(s,"Lower row number of lower sky");
308 strcpy(s_help, "shelp_extract");
309 }
310 else if ( sw == UxGetWidget(UxFindSwidget("tf_lowsky2")) ) {
311 strcpy(s,"Upper row number of lower sky");
312 strcpy(s_help, "shelp_extract");
313 }
314 else if ( sw == UxGetWidget(UxFindSwidget("tf_uppsky1")) ) {
315 strcpy(s,"Lower row number of upper sky");
316 strcpy(s_help, "shelp_extract");
317 }
318 else if ( sw == UxGetWidget(UxFindSwidget("tf_uppsky2")) ) {
319 strcpy(s,"Upper row number of upper sky");
320 strcpy(s_help, "shelp_extract");
321 }
322 else if ( sw == UxGetWidget(UxFindSwidget("tf_object1")) ) {
323 strcpy(s," Lower row number of object spectrum");
324 strcpy(s_help, "shelp_extract");
325 }
326 else if ( sw == UxGetWidget(UxFindSwidget("tf_object2")) ) {
327 strcpy(s," Upper row number of object spectrum");
328 strcpy(s_help, "shelp_extract");
329 }
330 else if ( sw == UxGetWidget(UxFindSwidget("tf_skyord")) ) {
331 strcpy(s,"Order for sky fit");
332 strcpy(s_help, "shelp_extract");
333 }
334 else if ( sw == UxGetWidget(UxFindSwidget("tf_order")) ) {
335 strcpy(s,"Order for optimal extraction");
336 strcpy(s_help, "shelp_extract");
337 }
338 else if ( sw == UxGetWidget(UxFindSwidget("tf_niter")) ) {
339 strcpy(s,"Number of iterations");
340 strcpy(s_help, "shelp_extract");
341 }
342 else if ( sw == UxGetWidget(UxFindSwidget("tf_ron")) ) {
343 strcpy(s,"Read-Out-Noise (ADU)");
344 strcpy(s_help, "shelp_extract");
345 }
346 else if ( sw == UxGetWidget(UxFindSwidget("tf_gain")) ) {
347 strcpy(s,"Gain (e-/ADU)");
348 strcpy(s_help, "shelp_extract");
349 }
350 else if ( sw == UxGetWidget(UxFindSwidget("tf_sigma")) ) {
351 strcpy(s,"Threshold for rejection of cosmics (std dev.)");
352 strcpy(s_help, "shelp_extract");
353 }
354 else if ( sw == UxGetWidget(UxFindSwidget("tf_radius")) ) {
355 strcpy(s,"Radius for cosmics rejection");
356 strcpy(s_help, "shelp_extract");
357 }
358 else if ( sw == UxGetWidget(UxFindSwidget("tf_sky")) ) {
359 strcpy(s,"Intermediate sky frame name or constant value");
360 strcpy(s_help, "shelp_extract");
361 }
362 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_sky")) ) {
363 strcpy(s,"Extract the sky coordinates from the image displayed (you have to enter\n4 points)");
364 strcpy(s_help, "shelp_extract");
365 }
366 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_object")) ) {
367 strcpy(s,"Extract the object coordinates from the image displayed (you have to\nenter 2 points)");
368 strcpy(s_help, "shelp_extract");
369 }
370 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_fit")) ) {
371 strcpy(s,"Generate the sky frame");
372 strcpy(s_help, "shelp_extract");
373 }
374 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_average")) ) {
375 strcpy(s,"Extract the spectrum by averaging");
376 strcpy(s_help, "shelp_extract");
377 }
378 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_weight")) ) {
379 strcpy(s,"Extract the spectrum by weighting");
380 strcpy(s_help, "shelp_extract");
381 }
382
383 if ( s[0] != '\0' )
384 UxPutText(UxFindSwidget(s_help), s);
385 }
386
387 void DisplayExtendedHelp( sw )
388 Widget sw; /* current widget */
389 {
390 char s[4000];
391 char *find_extended_help();
392
393 s[0] = '\0';
394
395 if ( sw == UxGetWidget(UxFindSwidget("menu_help_context")) )
396 strcpy(s, find_extended_help("HELP_CONTEXT"));
397 else if ( sw == UxGetWidget(UxFindSwidget("menu_help_help")) )
398 strcpy(s, find_extended_help("HELP_HELP"));
399 else if ( sw == UxGetWidget(UxFindSwidget("menu_help_tutorial")) )
400 strcpy(s, find_extended_help("HELP_TUTORIAL"));
401 else if ( sw == UxGetWidget(UxFindSwidget("menu_help_version")) )
402 strcpy(s, find_extended_help("HELP_VERSION"));
403 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_search")) )
404 strcpy(s, find_extended_help("MAIN_SEARCH"));
405 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_ident")) )
406 strcpy(s, find_extended_help("MAIN_IDENT"));
407 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_calib")) )
408 strcpy(s, find_extended_help("MAIN_CALIB"));
409 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_rebin")) )
410 strcpy(s, find_extended_help("MAIN_REBIN"));
411 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_extract")) )
412 strcpy(s, find_extended_help("MAIN_EXTRACT"));
413 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_flux")) )
414 strcpy(s, find_extended_help("MAIN_FLUX"));
415 else if ( sw == UxGetWidget(UxFindSwidget("pb_main_batch")) )
416 strcpy(s, find_extended_help("MAIN_BATCH"));
417 else if ( sw == UxGetWidget(UxFindSwidget("pb_search_search")) )
418 strcpy(s, find_extended_help("SEARCH_SEARCH"));
419 else if ( sw == UxGetWidget(UxFindSwidget("pb_search_plot")) )
420 strcpy(s, find_extended_help("SEARCH_PLOT"));
421 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_calibrate")) )
422 strcpy(s, find_extended_help("CALIB_CALIBRATE"));
423 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_edit")) )
424 strcpy(s, find_extended_help("CALIB_EDIT"));
425 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_getcur")) )
426 strcpy(s, find_extended_help("CALIB_GETCUR"));
427 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_all")) )
428 strcpy(s, find_extended_help("CALIB_ALL"));
429 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_twice")) )
430 strcpy(s, find_extended_help("CALIB_TWICE"));
431 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_disper")) )
432 strcpy(s, find_extended_help("CALIB_DISPER"));
433 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_resid")) )
434 strcpy(s, find_extended_help("CALIB_RESID"));
435 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_spec")) )
436 strcpy(s, find_extended_help("CALIB_SPEC"));
437 else if ( sw == UxGetWidget(UxFindSwidget("pb_calib_shape")) )
438 strcpy(s, find_extended_help("CALIB_SHAPE"));
439 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_rbr")) )
440 strcpy(s, find_extended_help("REBIN_RBR"));
441 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_2d")) )
442 strcpy(s, find_extended_help("REBIN_2D"));
443 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_table")) )
444 strcpy(s, find_extended_help("REBIN_TABLE"));
445 else if ( sw == UxGetWidget(UxFindSwidget("pb_rebin_plot")) )
446 strcpy(s, find_extended_help("REBIN_PLOT"));
447 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_sky")) )
448 strcpy(s, find_extended_help("EXTRACT_SKY"));
449 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_object")) )
450 strcpy(s, find_extended_help("EXTRACT_OBJECT"));
451 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_fit")) )
452 strcpy(s, find_extended_help("EXTRACT_FIT"));
453 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_average")) )
454 strcpy(s, find_extended_help("EXTRACT_AVERAGE"));
455 else if ( sw == UxGetWidget(UxFindSwidget("pb_ext_weight")) )
456 strcpy(s, find_extended_help("EXTRACT_WEIGHT"));
457 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_extin")) )
458 strcpy(s, find_extended_help("FLUX_EXTIN"));
459 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_integr")) )
460 strcpy(s, find_extended_help("FLUX_INTEGR"));
461 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_fit")) )
462 strcpy(s, find_extended_help("FLUX_FIT"));
463 else if ( sw == UxGetWidget(UxFindSwidget("pb_edit_flux")) )
464 strcpy(s, find_extended_help("EDIT_FLUX"));
465 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_filter")) )
466 strcpy(s, find_extended_help("FLUX_FILTER"));
467 else if ( sw == UxGetWidget(UxFindSwidget("pb_correct")) )
468 strcpy(s, find_extended_help("FLUX_CORRECT"));
469 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_pflux")) )
470 strcpy(s, find_extended_help("FLUX_PFLUX"));
471 else if ( sw == UxGetWidget(UxFindSwidget("pb_flux_presp")) )
472 strcpy(s, find_extended_help("FLUX_PRESP"));
473
474 if ( s[0] != '\0' ) {
475 UxPopupInterface(UxFindSwidget("HelpShell"), no_grab);
476 UxPutText(UxFindSwidget("tx_extended_help"), s);
477 }
478 }
479
480 char *find_extended_help( key )
481 char *key;
482 {
483 char midashome[512], midvers[80], help_pathname[512];
484 char c, h, s[MAXLINE];
485 FILE *fp;
486 int idx = 0;
487
488 osfphname("MIDVERS", midvers);
489 osfphname("MIDASHOME", midashome);
490 sprintf( help_pathname, "%s/%s/%s", midashome, midvers, HELP_FILE );
491 if ( (fp = fopen(help_pathname, "r")) == NULL ) {
492 sprintf(s, "XLong Help file [%s] not found.\r\n", help_pathname);
493 SCTPUT(s);
494 return("");
495 }
496
497 while ( (c = getc(fp)) != EOF )
498 if ( c == HELP_DELIMITER &&
499 !strncmp(key, fgets(s, MAXLINE, fp), strlen(key)) ) {
500 while ( (h = getc(fp)) != EOF && h != HELP_DELIMITER )
501 help_text[idx++] = h;
502 help_text[idx] = '\0';
503 fclose(fp);
504 return(help_text);
505 }
506 fclose(fp);
507 return("");
508
509 }