Debian Codegraph @

gui/XBatch/src/misc.c

raw
1 /*===========================================================================
2 Copyright (C) 1995-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 090819 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 #define HELP_FILE "gui/XBatch/help/batchred.hlp"
48 #define HELP_DELIMITER '~'
49
50 static char help_text[4000]; /* Max of 50 lines */
51
52 void DisplayShortHelp( sw )
53 Widget sw; /* current widget */
54 {
55 char s[256];
56
57 s[0] = '\0';
58
59 if ( sw == UxGetWidget(UxFindSwidget("tf_inputf")) )
60 strcpy(s,"Input catalog or prefix of file numbers entered in the \"Numbers\" field");
61 else if ( sw == UxGetWidget(UxFindSwidget("tf_inpnumb")) )
62 strcpy(s,"File numbers associated to the prefix entered, separated by\ncommas and/or dashes (range)");
63 else if ( sw == UxGetWidget(UxFindSwidget("tf_bias")) )
64 strcpy(s,"Bias image or value");
65 else if ( sw == UxGetWidget(UxFindSwidget("tf_dark")) )
66 strcpy(s,"Dark image");
67 else if ( sw == UxGetWidget(UxFindSwidget("tf_flat")) )
68 strcpy(s,"Flat image or value");
69 else if ( sw == UxGetWidget(UxFindSwidget("tf_rotstart")) )
70 strcpy(s,"New start value in Y direction if image is rotated");
71 else if ( sw == UxGetWidget(UxFindSwidget("tf_rotstep")) )
72 strcpy(s,"New step value in Y direction if image is rotated");
73 else if ( sw == UxGetWidget(UxFindSwidget("tf_trim1")) )
74 strcpy(s,"X-start of subimage to be extracted");
75 else if ( sw == UxGetWidget(UxFindSwidget("tf_trim2")) )
76 strcpy(s,"Y-start of subimage to be extracted");
77 else if ( sw == UxGetWidget(UxFindSwidget("tf_trim3")) )
78 strcpy(s,"X-end of subimage to be extracted");
79 else if ( sw == UxGetWidget(UxFindSwidget("tf_trim4")) )
80 strcpy(s,"Y-end of subimage to be extracted");
81 else if ( sw == UxGetWidget(UxFindSwidget("tf_longsess")) )
82 strcpy(s,"Parameters table saved in a previous LONG reduction session");
83 else if ( sw == UxGetWidget(UxFindSwidget("tf_redextab")) )
84 strcpy(s,"Extinction table");
85 else if ( sw == UxGetWidget(UxFindSwidget("tf_redresp")) )
86 strcpy(s,"Response curve (1-D or 2-D image)");
87 else if ( sw == UxGetWidget(UxFindSwidget("tf_outputf")) )
88 strcpy(s,"Prefix of the output images. If it is not filled, the output names will be\nthe input names plus the \"_red\" suffix");
89 else if ( sw == UxGetWidget(UxFindSwidget("tf_outnumb")) )
90 strcpy(s,"Initial output file number");
91 else if ( sw == UxGetWidget(UxFindSwidget("pb_airmass")) )
92 strcpy(s,"Open the form for edition of airmass values of the input images");
93 else if ( sw == UxGetWidget(UxFindSwidget("pb_execute")) )
94 strcpy(s,"Execute the batch reduction");
95
96 if ( s[0] != '\0' )
97 UxPutText(UxFindSwidget("short_help"), s);
98 }
99
100 void DisplayExtendedHelp( sw )
101 Widget sw; /* current widget */
102 {
103 char s[4000];
104 char *find_extended_help();
105
106 s[0] = '\0';
107
108 if ( sw == UxGetWidget(UxFindSwidget("menu_help_window")) )
109 strcpy(s, find_extended_help("HELP_WINDOW"));
110 else if ( sw == UxGetWidget(UxFindSwidget("pb_airmass")) )
111 strcpy(s, find_extended_help("AIRMASS"));
112 else if ( sw == UxGetWidget(UxFindSwidget("pb_execute")) )
113 strcpy(s, find_extended_help("EXECUTE"));
114
115 if ( s[0] != '\0' ) {
116 UxPopupInterface(UxFindSwidget("HelpShell"), no_grab);
117 UxPutText(UxFindSwidget("tx_extended_help"), s);
118 }
119 }
120
121 char *find_extended_help( key )
122 char *key;
123 {
124 char midashome[512], midvers[80], help_pathname[512];
125 char c, h, s[MAXLINE];
126 FILE *fp;
127 int idx = 0;
128
129 osfphname("MIDVERS", midvers);
130 osfphname("MIDASHOME", midashome);
131 sprintf( help_pathname, "%s/%s/%s", midashome, midvers, HELP_FILE );
132 if ( (fp = fopen(help_pathname, "r")) == NULL ) {
133 sprintf(s, "XBatch Help file [%s] not found.\r\n", help_pathname);
134 SCTPUT(s);
135 return("");
136 }
137
138 while ( (c = getc(fp)) != EOF )
139 if ( c == HELP_DELIMITER &&
140 !strncmp(key, fgets(s, MAXLINE, fp), strlen(key)) ) {
141 while ( (h = getc(fp)) != EOF && h != HELP_DELIMITER )
142 help_text[idx++] = h;
143 help_text[idx] = '\0';
144 fclose(fp);
145 return(help_text);
146 }
147 fclose(fp);
148 return("");
149
150 }