Debian Codegraph @

gui/XEchelle/libsrc/translations.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 .VERSION
28 090825 last modif
29
30 ===========================================================================*/
31
32 #include <Xm/Xm.h>
33 #include <Xm/Text.h>
34 #include <Xm/ToggleB.h>
35 #include <UxLib.h>
36 #include <midas_def.h>
37 #include <ctype.h>
38
39 extern int AppendDialogText(), SetFileList(), CallbackList();
40 extern int AppendDialogTextNoWait();
41
42 int FindLastIndex();
43
44 void InitField(), ImageOpen(), ImageClose();
45
46
47 int WIndex=-1, imno;
48 int IndexMemory = 0;
49 char CValue[100], NValue[100];
50 #define NB_KEY 205 /* Number of entries in the initialisation list */
51 int dbg=0; /* If dbg>=1, a number of internal check messages are displayed (Values 0,1,2,3) */
52
53 struct kiwi {
54
55 char keyword[9]; /* Midas Keyword */
56 char type; /* Keyword type */
57 int position; /* Position of the first element */
58 int length; /* Number of elements of the Keyword */
59 char shtext[128]; /* Short Help Text */
60 char shelpw[30]; /* Short Help swidget */
61 char widget[30]; /* Swidget */
62 char wtype; /* Text, Option, Radio, None: Not attached to a Midas keyword */
63 char midcom[30]; /* Associated Midas Command */
64 char assw[30]; /* Associated swidget */
65 /* The associated swidget gives the possibility to attach the same short help to a second swidget */
66 /* (label of a Text widget, parent of an OptionMenu of a RadioButton) */
67 } kiwitab[] = {
68
69 /* Panel: Rotation and Geometry (15 elements) */
70
71 {"CCDBIN", 'R', 1, 1 , "Binning Factor in X (usually 1.) ", "shelp_search2", "tf_alpha3", 'T', "CCDBIN=", ""},
72 {"CCDBIN", 'R', 2, 1 , "Binning Factor in Y (usually 1.) ", "shelp_search2", "tf_alpha5", 'T', "CCDBIN=,", ""},
73 {"IMSIZE", 'I', 1, 1 , "Number of columns, in pixel. ", "shelp_search2", "tf_alpha1", 'T', "IMSIZE=", ""},
74 {"IMSIZE", 'I', 2, 1 , "Number of rows, in pixel. ", "shelp_search2", "tf_alpha44", 'T', "IMSIZE=,", ""},
75 {"SCAN", 'I', 1, 1 , "Scan lower limit in pixels ", "shelp_search2", "tf_alpha2", 'T', "SCAN=", ""},
76 {"SCAN", 'I', 2, 1 , "Scan upper limit in pixels ", "shelp_search2", "tf_alpha4", 'T', "SCAN=,", ""},
77 {"DEFTIME", 'R', 1, 1, "Default exposure time (sec) ", "shelp_search2", "tf_alpha6", 'T', "DEFTIME = ", ""},
78 {"ORDREF", 'C', 1, 60, "Reference image for order definition ", "shelp_search2", "tf_alpha7", 'T', "ORDREF = ", ""},
79
80 /* Option Menu widgets */
81 {"FLIPAXIS", 'C', 1, 4, "Flip Axis for rotate/echelle (None, X, Y, XY) ", "shelp_search2", "mn_tol_angstroms3", 'O', "NONE", "mn_tol3"},
82 {"FLIPAXIS", 'C', 1, 4, "Flip Axis for rotate/echelle (None, X, Y, XY) ", "shelp_search2", "mn_tol_pixels3", 'O', "X", "mn_tol3"},
83 {"FLIPAXIS", 'C', 1, 4, "Flip Axis for rotate/echelle (None, X, Y, XY) ", "shelp_search2", "menu2_p3_b4", 'O', "Y", "mn_tol3"},
84 {"FLIPAXIS", 'C', 1, 4, "Flip Axis for rotate/echelle (None, X, Y, XY) ", "shelp_search2", "menu2_p3_b3", 'O', "XY", "mn_tol3"},
85 {"ROTANGLE", 'R', 1, 1, "Rotation angle for rotate/eche (0, 90, 180, 270) ", "shelp_search2", "mn_tol_angstroms5", 'O', "0", "mn_tol5"},
86 {"ROTANGLE", 'R', 1, 1, "Rotation angle for rotate/eche (0, 90, 180, 270) ", "shelp_search2", "mn_tol_pixels5", 'O', "90", "mn_tol5"},
87 {"ROTANGLE", 'R', 1, 1, "Rotation angle for rotate/eche (0, 90, 180, 270) ", "shelp_search2", "menu2_p5_b3", 'O', "180", "mn_tol5"},
88 {"ROTANGLE", 'R', 1, 1, "Rotation angle for rotate/eche (0, 90, 180, 270) ", "shelp_search2", "menu2_p5_b4", 'O', "270", "mn_tol5"},
89 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "mn_tol_angstroms2", 'O', "Emmi", "mn_tol2"},
90 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "mn_tol_pixels2", 'O', "Caspec", "mn_tol2"},
91 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "menu2_p2_b3", 'O', "Efosc", "mn_tol2"},
92 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "menu2_p2_b4", 'O', "Echelec", "mn_tol2"},
93
94 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "toggleButton15", 'R', "DEF", "rowColumn23"},
95 {"ROTMTD", 'C', 1, 12, "Rotation method ", "shelp_search2", "toggleButton14", 'U', "DEF", "rowColumn23"},
96
97 /* Widgets not linked to Midas keywords (Type N). Only the Short Help is used. */
98 {"NOMIDKEY", 'C', 1, 60, "Reference image for interactive scan determination ", "shelp_search2", "tf_alpha7", 'N', "INSTRUM = ", ""},
99 {"00000000", 'C', 1, 60, "File list of images in the current directory ", "shelp_search2", "pb_main_search32", 'L', "*.bdf", "tf_alpha7"},
100 {"NOMIDKEY", 'C', 1, 60, "Interactive determination of the scan limits ", "shelp_search2", "pb_search_search2", 'N', "INSTRUM = ", ""},
101 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search2", "pb_search_plot2", 'N', "INSTRUM = ", ""},
102 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search2", "pushButton2", 'N', "INSTRUM = ", ""},
103
104 /*****************************************/
105 /* Panel: Order Definition (14 elements) */
106 /* Unused keywords
107 "ORDTAB", 'C',1,12, "Table of order positions ", "shelp_main", "tf_range1", 'T', "ORDTAB = ", "",
108 "BAKTAB", 'C',1,12, "Table of background positions ", "shelp_main", "tf_range1", 'T', "BAKTAB = ", "",
109 "ECHORD", 'I',1,6, "Nb of orders (1), ", "shelp_main", "tf_range1", 'T', "ECHORD = ", "",
110 "DEFPOL", 'I',1,2, "Degrees of bivariate plynomial ", "shelp_main", "tf_range1", 'T', "DEFPOL = ", "",
111 "WIDTH1", 'I',1,1, "Order width ", "shelp_main", "tf_range1", 'T', "WIDTH1 = ", "",
112 "THRES1", 'R',1,1, "Threshold for order following ", "shelp_main", "tf_range1", 'T', "THRES1 = ", "",
113 */
114
115 {"ORDREF", 'C',1,60, "Reference image for order definition ", "shelp_search3", "tf_thres3", 'T', "ORDREF = ", ""},
116 {"NBORDI", 'I',1,1, "Number of orders (automatic if null) ", "shelp_search3", "tf_thres2", 'T', "NBORDI = ", ""},
117 {"WIDTHI", 'I',1,1, "Order width (automatic if null) ", "shelp_search3", "tf_width2", 'T', "WIDTHI = ", ""},
118 {"THRESI", 'R',1,1, "Thresh. for order following (automatic if null) ", "shelp_search3", "tf_ywidth2", 'T', "THRESI = ", ""},
119 {"SLOPE", 'R',1,1, "Mean slope of orders ", "shelp_search3", "tf_ystep2", 'T', "SLOPE = ", ""},
120
121 /* Radio Buttons Short Help and link to Midas keywords */
122 {"DEFMTD", 'C',1,12, "Order definition methods: Hough transform detection ", "shelp_search3", "rb_seamtd_gaus2", 'R', "HOUGH", ""},
123 {"DEFMTD", 'C',1,12, "Order definition methods: Standard threshold based detection ", "shelp_search3", "rb_seamtd_grav2", 'R', "STD", ""},
124 {"DEFMTD", 'C',1,12, "Order definition methods: Complementary threshold based detection ", "shelp_search3", "rb_seamtd_maxi2", 'R', "COM", ""},
125
126 /* Widgets not linked to Midas keywords (Type N). Only the Short Help is used. */
127 {"00000000", 'C', 1, 60, "File list of images in the current directory ", "shelp_search3", "pb_main_search15", 'L', "*.bdf", "tf_thres3"},
128 {"NOMIDKEY", 'C', 1, 60, "Order Definition ", "shelp_search3", "pb_search_search3", 'N', "INSTRUM = ", ""},
129 {"NOMIDKEY", 'C', 1, 60, "Displays the defined orders ", "shelp_search3", "pb_search_plot3", 'N', "INSTRUM = ", ""},
130 {"NOMIDKEY", 'C', 1, 60, "Save the order definition solution ", "shelp_search3", "pb_search_plot4", 'N', "INSTRUM = ", ""},
131 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search3", "pb_search_plot5", 'N', "INSTRUM = ", ""},
132 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search3", "pushButton3", 'N', "INSTRUM = ", ""},
133
134 /* Panel: Lines Searching (14 elements) */
135
136 {"WLC", 'C',1,80, "Wavelength calibration spectrum ", "shelp_search1", "tf_thres4", 'T', "WLC = ", ""},
137 {"SLIT", 'R',1,1, "Slit height (pixel) ", "shelp_search1", "tf_thres1", 'T', "SLIT = ", ""},
138 {"OFFSET", 'R',1,1, "Offset to the order reference (pixel) ", "shelp_search1", "tf_width1", 'T', "OFFSET = ", ""},
139 {"WIDTH2", 'R',1,1, "Width of lines along X axis ", "shelp_search1", "tf_ywidth1", 'T', "WIDTH2 = ", ""},
140 {"THRES2", 'R',1,1, "Relative threshold above background. ", "shelp_search1", "tf_ystep1", 'T', "THRES2 = ", ""},
141 {"EXTMTD", 'C',1,12, "Extraction method. Can be set in Extraction Panel. Recommended: Average", "shelp_search1", "tf_thres12", 'T', "EXTMTD = ", ""},
142
143 /* Option Menus */
144
145 {"SEAMTD", 'C',1,8, "Line search method: Gaussian Centering (recommended) ", "shelp_search1", "mn_tol_angstroms6", 'O', "Gaussian", "mn_tol6"},
146 {"SEAMTD", 'C',1,8, "Line search method: Gravity Centering ", "shelp_search1", "mn_tol_pixels6", 'O', "Gravity", "mn_tol6"},
147
148 /* Widgets not linked to Midas keywords (Type N). Only the Short Help is used. */
149 {"00000000", 'C', 1, 60, "File list of images in the current directory ", "shelp_search1", "pb_main_search16", 'L', "*.bdf", "tf_thres4"},
150 {"NOMIDKEY", 'C', 1, 60, "Extracts arc spectrum and searches lines ", "shelp_search1", "pb_search_search1", 'N', "INSTRUM = ", ""},
151 {"NOMIDKEY", 'C', 1, 60, "Displays lines on the arc frames ", "shelp_search1", "pb_search_plot7", 'N', "INSTRUM = ", ""},
152 {"NOMIDKEY", 'C', 1, 60, "Saves the position of the arc lines ", "shelp_search1", "pb_search_plot8", 'N', "INSTRUM = ", ""},
153 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search1", "pb_search_plot6", 'N', "INSTRUM = ", ""},
154 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search1", "pushButton1", 'N', "INSTRUM = ", ""},
155
156 /* Panel Wavelength Calibration (27 elements) */
157
158 /* Unused
159 "LINTAB", 'C',1,60, "Table of line identifications ", "shelp_calib", "tf_range1", 'T', "LINTAB = ", "",
160 "WLCREG", 'C',1,12, "Regression mode (Standard, Robust) ", "shelp_calib", "tf_range1", 'T', "WLCREG = ", "",
161 "RELORD", 'I',1,1, "Relative order number used to center disp. relation ", "shelp_calib", "tf_range1", 'T', "RELORD = ", "",
162 "ABSORD", 'I',1,1, "Absolute order number corresponding to RELORD ", "shelp_calib", "tf_range1", 'T', "ABSORD = ", "",
163 "AVDISP", 'R', 1, 1, "Average dispersion (wavel. units per pixel) ", "shelp_main", "tf_range1", 'T', "AVDISP=", "",
164 "WCENTER", 'D', 1, 1, "Central wavelength ", "shelp_main", "tf_range1", 'T', "WCENTER=", "",
165 "BETA", 'R', 1, 1, "Non-Linearity to the dispersion relation ", "shelp_main", "tf_range1", 'T', "BETA = ", "",
166 */
167
168 {"LINCAT", 'C',1,80, "Line catalog for WLC ", "shelp_calib", "tf_guess1", 'T', "LINCAT = ", ""},
169 {"GUESS", 'C',1,60, "Name of guess session (if WLCMTD=GUESS) ", "shelp_calib", "tf_guess2", 'T', "GUESS = ", ""},
170 {"TOL", 'R',1,1, "Tolerance for single order calibration ", "shelp_calib", "tf_tol", 'T', "TOL = ", ""},
171 {"DC", 'I',1,1, "Degree for global identification [1,5] ", "shelp_calib", "tf_dcx1", 'T', "DC = ", ""},
172 {"WLCNITER", 'I',1,1, "Minimum number of iterations ", "shelp_calib", "tf_wlcniter1", 'T', "WLCNITER = ", ""},
173 {"WLCNITER", 'I',2,1, "Maximum number of iterations ", "shelp_calib", "tf_wlcniter2", 'T', "WLCNITER =, ", ""},
174 {"WLCITER", 'R',3,1, "Maximal error in pixels ", "shelp_calib", "tf_alpha", 'T', "WLCITER =,, ", ""},
175 {"WLCITER", 'R',2,1, "Matching parameter (alpha) ", "shelp_calib", "tf_maxdev2", 'T', "WLCITER =, ", ""},
176 {"WLCITER", 'R',1,1, "Initial tolerance (pixels) ", "shelp_calib", "tf_maxdev", 'T', "WLCITER = ", ""},
177 {"WLCITER", 'R',3,1, "Maximal error in pixels ", "shelp_calib", "tf_maxdev1", 'T', "WLCITER =,, ", ""},
178
179 /* Radio Buttons Short Help and link to Midas keywords */
180 {"WLCMTD", 'C',1,10, "Method PAIR: Identify two lines in two overlapped orders ", "shelp_calib", "rb_wlcmtd_iden1", 'R', "PAIR", "rowColumn24"},
181 {"WLCMTD", 'C',1,10, "Method ANGLE: Identify a minimum of 4 lines anywhere ", "shelp_calib", "rb_wlcmtd_gues4", 'R', "ANGLE", "rowColumn24"},
182 {"WLCMTD", 'C',1,10, "Method RESTART: After Pair or Angle, use previous identifications ", "shelp_calib", "rb_wlcmtd_gues5", 'R', "RESTART","rowColumn24"},
183 {"WLCMTD", 'C',1,10, "Method ORDER: Skip identification loop, recompute only dispersion rel.", "shelp_calib", "rb_wlcmtd_gues6", 'R', "ORDER", "rowColumn24"},
184 {"WLCMTD", 'C',1,10, "Method GUESS: Use a previously saved session to calibrate ", "shelp_calib", "rb_wlcmtd_gues7", 'R', "GUESS", "rowColumn24"},
185
186 {"WLCOPT", 'C',1,60, "Dispersion relation type 1D: order by order independent polynomials ", "shelp_calib", "rb_wlcmtd_iden2", 'R', "1D", ""},
187 {"WLCOPT", 'C',1,60, "Dispersion relation type 2D: global bivariate polynomial ", "shelp_calib", "rb_wlcmtd_gues1", 'R', "2D", ""},
188
189 {"WLCVISU", 'C',1,3, "Visualization of identifications (YES/NO) ", "shelp_calib", "rb_wlcmtd_iden", 'R', "YES", ""},
190 {"WLCVISU", 'C',1,3, "Visualization of identifications (YES/NO) ", "shelp_calib", "rb_wlcmtd_gues", 'R', "NO", ""},
191
192 /* Widgets Not linked to Midas Keywords */
193 {"NOMIDKEY", 'C', 1, 10, "Unit for the tolerance (pixel, wavel. units) ", "shelp_calib", "mn_tol_1", 'N', "WLCMTD = ", ""},
194 {"00000000", 'C', 1, 60, "File list of images in the current directory ", "shelp_calib", "pb_main_search33", 'L', "*.tbl", "tf_guess1"},
195 {"NOMIDKEY", 'C', 1, 60, "Performs wavelength calibration ", "shelp_calib", "pb_calib_calibrate", 'N', "INSTRUM = ", ""},
196 {"NOMIDKEY", 'C', 1, 60, "Plots residuals after calibration ", "shelp_calib", "pb_calib_resid", 'N', "INSTRUM = ", ""},
197 {"NOMIDKEY", 'C', 1, 60, "Displays identified lines after calibration ", "shelp_calib", "pb_calib_spec", 'N', "INSTRUM = ", ""},
198 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_calib", "pb_calib_disper", 'N', "INSTRUM = ", ""},
199 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_calib", "pushButton40", 'N', "INSTRUM = ", ""},
200
201 /* Interorder Background Panel */
202 {"BKGMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search4", "rb_seamtd_gaus1", 'R', "Spline", ""},
203 {"BKGMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search4", "rb_seamtd_grav1", 'R', "Poly", ""},
204 {"BKGMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search4", "rb_seamtd_maxi1", 'R', "Smooth", ""},
205 {"BKGVISU", 'C',1,3, "Backgr. visu (YES/NO) for LOAD/ECH,SUB/BACK ", "shelp_search4", "toggleButton17", 'G', "BKGVISU=", ""},
206 {"BKGSTEP", 'I',1,1, "Step along X. (Meth. SPLINE and POLY) ", "shelp_search4", "tf_alpha13", 'T', "BKGSTEP = ", ""},
207 {"BKGDEG", 'I',1,1, "Degree of spline polynomials (Meth. SPLINE) ", "shelp_search4", "tf_alpha16", 'T', "BKGDEG = ", ""},
208 {"BKGSMO", 'R',1,1, "Smoothing factor (Meth. SPLINE) ", "shelp_search4", "tf_alpha15", 'T', "BKGSMO = ", ""},
209 {"BKGPOL", 'I',1,1, "Degree in X and Y of polynomial (Meth. POLY) ", "shelp_search4", "tf_alpha14", 'T', "BKGPOL = ", ""},
210 {"BKGPOL", 'I',2,1, "Degree in X and Y of polynomial (Meth. POLY) ", "shelp_search4", "tf_alpha8", 'T', "BKGPOL =, ", ""},
211 {"BKGRAD", 'I',1,1, "Radius in X and Y (Meth. SPLINE and SMOOTH) ", "shelp_search4", "tf_alpha10", 'T', "BKGRAD = ", ""},
212 {"BKGRAD", 'I',2,1, "Radius in X and Y (Meth. SPLINE and SMOOTH) ", "shelp_search4", "tf_alpha12", 'T', "BKGRAD =, ", ""},
213 {"BKGNIT", 'I',1,1, "Number of iterations (Meth. SMOOTH) ", "shelp_search4", "tf_alpha9", 'T', "BKGNIT = ", ""},
214
215 /* Widgets not linked to Midas keywords */
216 {"NOMIDKEY", 'C', 1, 10, "Minimum cut value for the plot. ", "shelp_search4", "tf_alpha21", 'N', "WLCMTD = ", "label85"},
217 {"NOMIDKEY", 'C', 1, 10, "Maximum cut value for the plot. ", "shelp_search4", "tf_alpha20", 'N', "WLCMTD = ", "label86"},
218
219 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search4", "pb_main_search8", 'L', "*.bdf", "tf_alpha17"},
220 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search4", "pb_main_search17", 'L', "*.bdf", "tf_alpha18"},
221 {"00000000", 'C', 1, 10, "Pops up the file selection list ", "shelp_search4", "pb_main_search18", 'L', "*.bdf", "tf_alpha19"},
222 {"NOMIDKEY", 'C', 1, 60, "Displays file ", "shelp_search4", "pb_search_plot11", 'N', "INSTRUM = ", "pb_search_plot15"},
223 {"NOMIDKEY", 'C', 1, 60, "Displays file ", "shelp_search4", "pb_search_plot16", 'N', "INSTRUM = ", ""},
224
225 {"NOMIDKEY", 'C', 1, 10, "Displays the background reference positions ", "shelp_search4", "pb_search_plot9", 'N', "WLCMTD = ", ""},
226 {"NOMIDKEY", 'C', 1, 60, "Plots a cross-order trace of the background ", "shelp_search4", "pb_search_plot12", 'N', "INSTRUM = ", ""},
227 {"NOMIDKEY", 'C', 1, 60, "Subtracts background from input frame ", "shelp_search4", "pb_search_search6", 'N', "INSTRUM = ", ""},
228 {"NOMIDKEY", 'C', 1, 60, "Interactively unselect background ref. positions ", "shelp_search4", "pb_search_plot10", 'N', "INSTRUM = ", ""},
229
230 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search4", "pb_search_plot1", 'N', "INSTRUM = ", ""},
231 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search4", "pushButton4", 'N', "INSTRUM = ", ""},
232
233 /* Extraction Panel */
234
235 /* Widgets not linked to Midas keywords */
236 {"NOMIDKEY", 'C', 1, 10, "Minimum cut value for the plot. ", "shelp_search5", "pb_search_search7", 'N', "WLCMTD = ", ""},
237 {"NOMIDKEY", 'C', 1, 10, "Maximum cut value for the plot. ", "shelp_search5", "pb_search_plot_13", 'N', "WLCMTD = ", ""},
238 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search5", "pb_main_search19", 'L', "*.bdf", "tf_thres6"},
239 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search5", "pb_main_search20", 'L', "*.bdf", "tf_thres7"},
240 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search5", "pb_search_plot18", 'N', "INSTRUM = ", ""},
241 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search5", "pushButton5", 'N', "INSTRUM = ", ""},
242
243 {"EXTMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search5", "rb_seamtd_gaus3", 'R', "Average", "rowColumn27"},
244 {"EXTMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search5", "rb_seamtd_grav3", 'R', "Linear", "rowColumn27"},
245 {"EXTMTD", 'C',1,12, "Background method: POLY,SPLINE,SMOOTH ", "shelp_search5", "rb_seamtd_maxi3", 'R', "Optimal", "rowColumn27"},
246
247 {"SLIT", 'R',1,1, "Slit height (pixel) ", "shelp_search5", "tf_thres5", 'T', "SLIT = ", ""},
248 {"OFFSET", 'R',1,1, "Offset to the order reference (pixel) ", "shelp_search5", "tf_width3", 'T', "OFFSET = ", ""},
249 {"RON", 'R',1,1, "Read-out noise of the CCD (e-) ", "shelp_search5", "tf_ywidth3", 'T', "RON = ", ""},
250 {"GAIN", 'R',1,1, "Inverse gain factor of the CCD (e-/ADU ", "shelp_search5", "tf_ystep3", 'T', "GAIN = ", ""},
251 {"EXTSIGMA", 'R',1,1, "Threshold (in units of the ron) ", "shelp_search5", "tf_ystep4", 'T', "EXTSIGMA = ", ""},
252
253 /* Sky Extraction Panel */
254
255 /* Unused
256 "POSSKY", 'C',1,12, "Sky feature positioning mode. ", "shelp_search6", "tf_range1", 'T', "POSSKY = ", "",
257 */
258
259 {"NSKY", 'I',1,1, "Number of sky windows (1 or 2) ", "shelp_search6", "toggleButton16", 'R', "1", "rowColumn7"},
260 {"NSKY", 'I',1,1, "Number of sky windows (1 or 2) ", "shelp_search6", "toggleButton18", 'R', "2", "rowColumn7"},
261 {"SKYWIND", 'R',1,1, "Offset limits of sky windows ", "shelp_search6", "tf_alpha22", 'T', "SKYWIND = ", ""},
262 {"SKYWIND", 'R',2,1, "Offset limits of sky windows ", "shelp_search6", "tf_alpha23", 'T', "SKYWIND =, ", ""},
263 {"SKYWIND", 'R',3,1, "Offset limits of sky windows ", "shelp_search6", "tf_alpha24", 'T', "SKYWIND =,, ", ""},
264 {"SKYWIND", 'R',4,1, "Offset limits of sky windows ", "shelp_search6", "tf_alpha25", 'T', "SKYWIND =,,, ", ""},
265
266 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search6", "pb_main_search23", 'L', "*.bdf", "tf_thres9"},
267 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search6", "pb_main_search24", 'L', "*.bdf", "tf_thres10"},
268 {"NOMIDKEY", 'C', 1, 10, "Interactive determination of the window limits ", "shelp_search6", "pb_search_search8", 'N', "WLCMTD = ", ""},
269 {"NOMIDKEY", 'C', 1, 10, "Sky background extraction ", "shelp_search6", "pb_search_search9", 'N', "WLCMTD = ", ""},
270 {"NOMIDKEY", 'C', 1, 10, "Plots extracted sky background ", "shelp_search6", "pb_search_plot_19", 'N', "WLCMTD = ", ""},
271 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search6", "pb_search_plot20", 'N', "INSTRUM = ", ""},
272 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search6", "pushButton6", 'N', "INSTRUM = ", ""},
273
274 /* Rebin Shell */
275
276 {"SAMPLE", 'C', 1, 60, "Step in wavelength ", "shelp_rebin", "tf_rebstp", 'T', "SAMPLE = ", ""},
277 {"NOMIDKEY", 'C', 1, 10, "Resamples the spectrum ", "shelp_rebin", "pb_rebin_rbr", 'N', "WLCMTD = ", ""},
278 {"NOMIDKEY", 'C', 1, 10, "Plots the resampled orders ", "shelp_rebin", "pb_rebin_plot", 'N', "WLCMTD = ", ""},
279 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_rebin", "pb_main_search21", 'L', "*.bdf", "tf_rebstrt"},
280 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_rebin", "pb_main_search22", 'L', "*.bdf", "tf_rebend"},
281 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_rebin", "pb_search_plot17", 'N', "INSTRUM = ", ""},
282 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_rebin", "pushButton13", 'N', "INSTRUM = ", ""},
283
284 /* Unused
285 "REBMTD", 'C',1,2, "Rebin method: NONLINEAR (for REBIN/ECHELLE). ", "shelp_main", "tf_range1", 'T', "REBMTD = ", "",
286 */
287
288 /* Flat Shell */
289 {"FLAT", 'C',1,60, "Flat field (Order Definition: see ORDREF) ", "shelp_search7", "tf_alpha35", 'T', "FLAT = ", ""},
290 {"CORRECT", 'C',1,60, "Flat field corrected for background ", "shelp_search7", "tf_alpha37", 'T', "CORRECT = ", ""},
291 {"BLAZE", 'C',1,60, "Blaze function estimated from flat-field ", "shelp_search7", "tf_alpha11", 'T', "BLAZE = ", ""},
292
293 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search7", "pb_main_search25", 'L', "*.bdf", "tf_alpha35"},
294 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search7", "pb_main_search26", 'L', "*.bdf", "tf_alpha36"},
295 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search7", "pb_main_search27", 'L', "*.bdf", "tf_alpha37"},
296 {"NOMIDKEY", 'C', 1, 10, "Displays the frame ", "shelp_search7", "pb_search_plot26", 'N', "WLCMTD = ", "pb_search_plot27"},
297
298 {"NOMIDKEY", 'C', 1, 10, "Fits the blaze function ", "shelp_search7", "pb_search_search10",'N', "WLCMTD = ", ""},
299 {"NOMIDKEY", 'C', 1, 10, "Plots the blaze function. ", "shelp_search7", "pb_search_plot24", 'N', "WLCMTD = ", ""},
300
301 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search7", "pb_search_plot21", 'N', "INSTRUM = ", ""},
302 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search7", "pushButton7", 'N', "INSTRUM = ", ""},
303
304 /* Resp Shell */
305
306 {"STD", 'C',1,60, "Name of standard star spectrum ", "shelp_search8", "tf_alpha38", 'T', "STD = ", ""},
307 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search8", "pb_main_search28", 'L', "*.bdf", "tf_alpha38"},
308
309 {"RESPMTD", 'C',1,12, "Instrum. response corr. methods: STD, IUE ", "shelp_search8", "rb_seamtd_gaus4", 'R', "STD", "rowColumn3"},
310 {"RESPMTD", 'C',1,12, "Instrum. response corr. methods: STD, IUE ", "shelp_search8", "rb_seamtd_grav4", 'R', "IUE", "rowColumn3"},
311
312 {"FLUXTAB", 'C',1,60, "Flux table associated to STD ", "shelp_search8", "tf_alpha39", 'T', "FLUXTAB = ", ""},
313 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search8", "pb_main_search29", 'L', "*.tbl", "tf_alpha39"},
314
315 {"FILTMED", 'I',1,1, "Response median filtering (see FILTER/MED) ", "shelp_search8", "tf_alpha32", 'T', "FILTMED = ", ""},
316 {"FILTMED", 'I',2,1, "Response median filtering (see FILTER/MED) ", "shelp_search8", "tf_alpha26", 'T', "FILTMED =,", ""},
317
318 {"FILTSMO", 'I',1,1, "Response Smoothing filtering (see FILTER/SMO) ", "shelp_search8", "tf_alpha28", 'T', "FILTSMO = ", ""},
319 {"FILTSMO", 'I',2,1, "Response Smoothing filtering (see FILTER/SMO) ", "shelp_search8", "tf_alpha30", 'T', "FILTSMO =, ", ""},
320
321 {"PIXNUL", 'I',1,1, "No. of pixels zeroed on left and right edges ", "shelp_search8", "tf_alpha27", 'T', "PIXNUL = ", ""},
322 {"PIXNUL", 'I',2,1, "No. of pixels zeroed on left and right edges ", "shelp_search8", "tf_alpha29", 'T', "PIXNUL =,", ""},
323
324 {"RIPMTD", 'C',1,12, "Ripple method (if RESPMTD=IUE): SINC, OVER, FIT ", "shelp_search8", "rb_seamtd_gaus5", 'R', "Fit", "rowColumn28"},
325 {"RIPMTD", 'C',1,12, "Ripple method (if RESPMTD=IUE): SINC, OVER, FIT ", "shelp_search8", "rb_seamtd_grav5", 'R', "Over", "rowColumn28"},
326 {"RIPMTD", 'C',1,12, "Ripple method (if RESPMTD=IUE): SINC, OVER, FIT ", "shelp_search8", "rb_seamtd_maxi5", 'R', "Sinc", "rowColumn28"},
327
328 {"RIPK", 'R',1,1, "Grating constant ", "shelp_search8", "tf_alpha43", 'T', "RIPK = ", ""},
329 {"ALPHA", 'R',1,1, "Broadening factor [0,1] ", "shelp_search8", "tf_alpha34", 'T', "ALPHA = ", ""},
330 {"LAMBDA1", 'R',1,1, "Delta in wavelength unit ", "shelp_search8", "tf_alpha33", 'T', "LAMBDA1 = ", ""},
331 {"LAMBDA2", 'R',1,1, "Overlap in wavelength unit ", "shelp_search8", "tf_alpha41", 'T', "LAMBDA2 = ", ""},
332
333 {"NOMIDKEY", 'C', 1, 10, "Fits the response function ", "shelp_search8", "pb_search_search12",'N', "WLCMTD = ", ""},
334 {"NOMIDKEY", 'C', 1, 10, "Plots the response function ", "shelp_search8", "pb_search_plot23", 'N', "WLCMTD = ", ""},
335
336 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search8", "pb_search_plot22", 'N', "INSTRUM = ", ""},
337 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search8", "pushButton8", 'N', "INSTRUM = ", ""},
338
339 /* Unused
340 "FILTMED", 'I',3,1, "Response median filtering (see FILTER/MED) ", "shelp_search8", "tf_range1", 'T', "FILTMED =,, ", "",
341 "FILTSMO", 'I',3,1, "Response Smoothing filtering (see FILTER/SMO) ", "shelp_search8", "tf_range1", 'T', "FILTSMO =,, ", "",
342 "RESPONSE", 'C',1,60, "Name of output response function ", "shelp_main", "tf_range1", 'T', "RESPONSE = ", "",
343 "RIPFRZ", 'C',1,3, "Freeze values K and Alpha [YES/NO] ", "shelp_main", "tf_range1", 'T', "RIPFRZ = ", "",
344 "RIPRAD", 'I',1,2, "X radius for median and smoothing. ", "shelp_main", "tf_range1", 'T', "RIPRAD = ", "",
345 */
346
347 /* Merge Shell */
348
349 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search9", "pb_main_search30", 'L', "*.bdf", "tf_thres8"},
350 {"00000000", 'C', 1, 10, "Pops up file selection list ", "shelp_search9", "pb_main_search31", 'L', "*.bdf", "tf_thres11"},
351
352 {"MRGMTD", 'C',1,12, "Merging methods: NOAPPEND,AVERAGE ", "shelp_search9","rb_seamtd_gaus6", 'R', "Average", "rowColumn6"},
353 {"MRGMTD", 'C',1,12, "Merging methods: NOAPPEND,AVERAGE ", "shelp_search9","rb_seamtd_grav6", 'R', "NoAppend", "rowColumn6"},
354
355 {"DELTA", 'R',1,1, "Wav. interval to be skipped (MRGMTD=AVERAGE) ", "shelp_search9","tf_alpha42", 'T', "DELTA = ", ""},
356 {"MRGORD", 'I',1,1, "Ord1,Ord2 (MRGMTD=NOAPP). 0,0:all orders ", "shelp_search9","tf_alpha31", 'T', "MRGORD = ", ""},
357 {"MRGORD", 'I',2,1, "Ord1,Ord2 (MRGMTD=NOAPP). 0,0:all orders ", "shelp_search9","tf_alpha40", 'T', "MRGORD =, ", ""},
358
359 {"NOMIDKEY", 'C', 1, 10, "Merge the orders ", "shelp_search9", "pb_search_search13",'N', "WLCMTD = ", ""},
360 {"NOMIDKEY", 'C', 1, 10, "Plot Overlaps ", "shelp_search9", "pb_search_plot25",'N', "WLCMTD = ", ""},
361 {"NOMIDKEY", 'C', 1, 10, "Plots the merged spectrum ", "shelp_search9", "pb_search_plot28", 'N', "WLCMTD = ", ""},
362
363 {"NOMIDKEY", 'C', 1, 60, "Extended Help message on this panel ", "shelp_search9", "pb_search_plot29", 'N', "INSTRUM = ", ""},
364 {"NOMIDKEY", 'C', 1, 60, "Closes this window. ", "shelp_search9", "pushButton10", 'N', "INSTRUM = ", ""},
365
366 /* Main Panel */
367
368 {"ROTOPT", 'C',1,3, "Rotation/Flip option (Yes/No) ", "shelp_main", "toggleButton3", 'G', "YES", ""},
369 {"BKGOPT", 'C',1,3, "Interorder Background subtraction option ", "shelp_main", "toggleButton10", 'G', "YES", ""},
370 {"EXTOPT", 'C',1,3, "Spectrum extraction option (Yes/No) ", "shelp_main", "toggleButton11", 'G', "YES", ""},
371 {"SKYOPT", 'C',1,3, "Sky extraction option (Yes/No) ", "shelp_main", "toggleButton12", 'G', "YES", ""},
372 {"REBOPT", 'C',1,3, "Rebin option (Yes/No) ", "shelp_main", "toggleButton1", 'G', "YES", ""},
373 {"FFOPT", 'C',1,3, "Optional flat-fielding ", "shelp_main", "toggleButton2", 'G', "YES", ""},
374 {"RESPOPT", 'C',1,3, "Optional Response Correction ", "shelp_main", "toggleButton4", 'G', "YES", ""},
375 {"MGOPT", 'C',1,3, "Optional merge ", "shelp_main", "toggleButton13", 'G', "YES", ""},
376
377 {"0000000", 'C',1,3, "Applies reduction scheme to selected images", "shelp_main", "pb_main_batch", 'N', "STD = ", ""},
378 {"0000000", 'C',1,3, "Applies rotation to selected images ", "shelp_main", "pb_main_ident", 'N', "STD = ", ""},
379 {"0000000", 'C',1,3, "Loads and traces orders on the first selected image", "shelp_main", "pb_main_batch1", 'N', "STD = ", ""},
380 {"0000000", 'C',1,3, "Saves the echelle session (under the name sess)", "shelp_main", "pb_main_batch2", 'N', "STD = ", ""},
381
382 /* Option Menu */
383 {"NOMIDKEY", 'C', 1, 10, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "toggleButton9", 'N', "EMMI", "mn_tol7"},
384
385 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "mn_tol_angstroms7", 'O', "\"EMMI Grat. 9 CD 3\"", "mn_tol7"},
386 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "mn_tol_pixels7", 'O', "\"EMMI Grat. 9 CD 4\"", "mn_tol7"},
387 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "menu2_p7_b3", 'O', "\"EMMI Grat. 10 CD 3\"", "mn_tol7"},
388 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "menu2_p7_b4", 'O', "\"EMMI Grat. 10 CD 4\"", "mn_tol7"},
389 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "menu2_p7_b5", 'O', "\"EMMI Grat. 10 CD 5\"", "mn_tol7"},
390 {"0000000", 'C',1,60, "Selection of an EMMI pre-calibrated solution ", "shelp_main", "menu2_p7_b6", 'O', "\"EMMI Grat. 10 CD 6\"", "mn_tol7"},
391
392 /* Unused (command FILTER/ECHELLE)
393 "CROPT", 'C',1,3, "Cosmic rays filtering option (Yes/No) ", "shelp_main", "toggleButton10", 'T', "CROPT = ", "",
394 */
395
396 {"ZLASTKEY", 'C', 1, 60, "*The* last keyword of the list ", "shelp_calib", "pushButton40", 'N', "INSTRUM = ", ""},
397
398 /*
399 "OBJ", 'C',1,60, "Object spectrum ", "shelp_main", "tf_range1", 'T', "OBJ = ", "",
400 "GRATING", 'C',1,60, "Disperser name ", "shelp_main", "tf_range1", 'T', "GRATING = ", "",
401 "CROSS", 'C',1,60, "Cross disperser name ", "shelp_main", "tf_range1", 'T', "CROSS = ", "",
402 "CCD", 'C',1,60, "CCD Name ", "shelp_main", "tf_range1", 'T', "CCD = ", "",
403 "OBSTAB", 'C',1,60, "List of observations ", "shelp_main", "tf_range1", 'T', "OBSTAB = ", "",
404 "WLRANGE", 'R',1,2, "Wavelength range ", "shelp_main", "tf_range1", 'T', "WLRANGE = ", "",
405 "CRFILT", 'I',1,3, "Cosmic rays filtering: widx, widy, no_iter ", "shelp_main", "tf_range1", 'T', "CRFILT = ", "",
406 "MEDFILT", 'R',1,3, "Median filtering : radx, rady, mthresh ", "shelp_main", "tf_range1", 'T', "MEDFILT = ", "",
407 "CCDFILT", 'R',1,3, "CCD parameters : ron, g, ethresh ", "shelp_main", "tf_range1", 'T', "CCDFILT = ", "",
408
409 "RIPORD", 'I',1,1, "Order currently processed ", "shelp_main", "tf_range1", 'T', "RIPORD = ", "",
410 "RIPLIM", 'I',1,2, "Order limits in pixels (0,0: all) ", "shelp_main", "tf_range1", 'T', "RIPLIM = ", "",
411 "RIPBIN", 'R',1,1, "Bin of histogram for normalization ", "shelp_main", "tf_range1", 'T', "RIPBIN = ", "",
412 "ROTAXIS", 'C',1,3, "Mode of rotation or flip ", "shelp_main", "tf_range1", 'T', "ROTAXIS = ", "",
413 */
414
415 };
416
417 void InitSession(s)
418 char *s;
419
420 {
421 int i;
422 char name[100];
423
424 strcpy(name,s);
425 strcat(name,"ORDE.tbl");
426
427 if (dbg == 1) printf("Last Index: %d. NB_KEY= %d\n",FindLastIndex(), NB_KEY);
428 SCFOPN(name, D_R4_FORMAT, 1, F_TBL_TYPE, &imno);
429 for (i=0; i<NB_KEY; i++) InitField(i);
430 SCFCLO(imno);
431 }
432
433 void InitAllFields()
434 {
435 int i;
436 if (dbg == 1) printf("Last Index: %d. NB_KEY= %d\n",FindLastIndex(), NB_KEY);
437 ImageOpen();
438 for (i=0; i<NB_KEY; i++) InitField(i);
439 ImageClose();
440 }
441
442
443 void ImageOpen()
444 {
445 /* Open Midas Image: middummgui.bdf */
446 char name[400];
447 strcpy(name,UxGetText(UxFindSwidget("tf_session1")));
448 strcat(name,"/middummgui.bdf");
449 SCFOPN(name, D_R4_FORMAT, 1, F_IMA_TYPE, &imno);
450 }
451
452 void ImageClose()
453 {
454 SCFCLO(imno);
455 }
456
457 int FindIndex(sw)
458 Widget sw;
459 {
460 int index=0;
461 int found=0;
462
463 while (index < NB_KEY) {
464 if (sw == (Widget) UxGetWidget(UxFindSwidget(kiwitab[index].widget))) found = 1;
465 if ((int) strlen(kiwitab[index].assw) > 0)
466 if (sw == (Widget) UxGetWidget(UxFindSwidget(kiwitab[index].assw))) found = 1;
467 if (found == 1) break;
468 else index++;
469 }
470
471 return(index);
472
473 }
474
475 int FindLastIndex()
476 {
477 int index;
478 for(index=0; (kiwitab[index].keyword[0] != 'Z'); index++);
479 return(index);
480 }
481
482 void WidgetEnter(sw)
483 Widget sw;
484
485 {
486 int index;
487
488 if (dbg >= 3) printf("Entered widget\n");
489
490 if ( (index=FindIndex(sw)) >= NB_KEY) return;
491 UxPutText(UxFindSwidget(kiwitab[index].shelpw), kiwitab[index].shtext);
492 if (kiwitab[index].wtype == 'T')
493 strcpy(CValue, XmTextGetString(UxGetWidget(UxFindSwidget(kiwitab[index].widget))));
494 }
495
496 void WidgetLeave(w)
497 Widget w;
498
499 {
500 char command[50];
501 int index;
502
503 if (dbg >= 3) printf("Left widget\n");
504
505 /* Determines Widget Index */
506 if ( (index=FindIndex(w)) >= NB_KEY) return;
507
508 if (dbg >= 2) printf("Index %d, Type %c, Name %s\n",index,kiwitab[index].wtype,kiwitab[index].widget);
509
510 /* Empty Short Help Field */
511 UxPutText(UxFindSwidget(kiwitab[index].shelpw), " ");
512
513 strcpy(command,"Set/Echel ");
514
515 if (kiwitab[index].wtype == 'T') {
516 strcpy(NValue, XmTextGetString(UxGetWidget(UxFindSwidget(kiwitab[index].widget))));
517 if (dbg >=2) printf("Old value: %s, New Value: %s, index %d\n",CValue,NValue,index);
518 if (strcmp(CValue, NValue) != 0) {
519 strcat(command,kiwitab[index].midcom);
520 strcat(command,XmTextGetString(w));
521 AppendDialogTextNoWait(command);
522 }}
523
524 /* Additional operations for a few widgets (Slit/Offset in both Search and Extraction Panels) */
525 if (strcmp(kiwitab[index].widget,"tf_thres1") == 0)
526 UxPutText(UxFindSwidget("tf_thres5"),NValue);
527 if (strcmp(kiwitab[index].widget,"tf_thres5") == 0)
528 UxPutText(UxFindSwidget("tf_thres1"),NValue);
529 if (strcmp(kiwitab[index].widget,"tf_width1") == 0)
530 UxPutText(UxFindSwidget("tf_width3"),NValue);
531 if (strcmp(kiwitab[index].widget,"tf_width3") == 0)
532 UxPutText(UxFindSwidget("tf_width1"),NValue);
533
534 }
535
536
537 void InitField(index)
538 int index;
539
540 {
541 int unit, null, ival, actvals;
542 float rval;
543 double dval;
544 char field[100];
545
546 /* Widgets not linked to Midas keywords are not processed */
547 if (kiwitab[index].wtype == 'N' || kiwitab[index].keyword[0] == '0') return;
548
549 /* Reads Midas keyword value */
550
551 if (dbg > 1) printf("Read key %s, type %c, index %d\n",kiwitab[index].keyword,kiwitab[index].type,index);
552
553 if (kiwitab[index].type == 'I') {
554 SCDRDI(imno, kiwitab[index].keyword, kiwitab[index].position, 1, &actvals, &ival, &unit, &null);
555 sprintf(field, "%d", ival);
556 }
557 if (kiwitab[index].type == 'R') {
558 SCDRDR(imno, kiwitab[index].keyword, kiwitab[index].position, 1, &actvals, &rval, &unit, &null);
559 sprintf(field, "%f", rval);
560 }
561 if (kiwitab[index].type == 'D') {
562 SCDRDD(imno, kiwitab[index].keyword, kiwitab[index].position, 1, &actvals, &dval, &unit, &null);
563 sprintf(field, "%f", dval);
564 }
565 if (kiwitab[index].type == 'C') {
566 SCDGETC(imno, kiwitab[index].keyword, kiwitab[index].position, kiwitab[index].length, &actvals, field);
567 }
568
569 /* Text widgets */
570 if (kiwitab[index].wtype == 'T')
571 UxPutText(UxFindSwidget(kiwitab[index].widget), field);
572
573 /* Toggle Buttons linked to a Yes/No Midas keyword */
574 /* So far only one case in the Interorder Background Panel */
575 if (kiwitab[index].wtype == 'G') {
576 if (toupper(field[0]) == 'Y') XmToggleButtonSetState(UxGetWidget(UxFindSwidget(kiwitab[index].widget)), TRUE, FALSE);
577 else XmToggleButtonSetState(UxGetWidget(UxFindSwidget(kiwitab[index].widget)), FALSE, FALSE);
578 }
579
580 /* Radio-Buttons and Option Menus */
581
582 if (toupper(field[0]) == toupper(kiwitab[index].midcom[0]) && toupper(field[1]) == toupper(kiwitab[index].midcom[1]) ) {
583 /* Case Insensitive match on the two first letters of the value */
584
585 if (kiwitab[index].wtype == 'R')
586 XmToggleButtonSetState(UxGetWidget(UxFindSwidget(kiwitab[index].widget)), TRUE, FALSE);
587
588 if (kiwitab[index].wtype == 'O') {
589 if (toupper(field[0]) == toupper(kiwitab[index].midcom[0])) {
590 if (dbg > 2) printf("Now matched with %s\n",kiwitab[index].midcom);
591 UxPutMenuHistory(
592 UxFindSwidget(kiwitab[index].assw),
593 kiwitab[index].widget);
594 /* Special Case: In Rotation panel, also set the Radio Button */
595 if (strcmp(kiwitab[index].assw, "mn_tol2") == 0) {
596 XmToggleButtonSetState(UxGetWidget(UxFindSwidget("toggleButton14")), TRUE, FALSE);
597 XmToggleButtonSetState(UxGetWidget(UxFindSwidget("toggleButton15")), FALSE,FALSE);
598 }
599 }}
600 }
601
602 else { /* No match */
603 if (kiwitab[index].wtype == 'R')
604 XmToggleButtonSetState(UxGetWidget(UxFindSwidget(kiwitab[index].widget)), FALSE, FALSE);
605 }
606 }
607
608
609 int RadioSet(sw)
610
611 Widget sw;
612
613 {
614 char command[50];
615 int index, grat, gris;
616
617 if ( (index=FindIndex(sw)) >= NB_KEY) return 1;
618
619 /* Special Case: EMMI Pre-Calibrated solutions */
620 if (strcmp(kiwitab[index].assw, "mn_tol7") == 0) {
621 strcpy(command,
622 UxGetLabelString(UxFindSwidget(UxGetMenuHistory(UxFindSwidget("mn_tol7")))));
623 sscanf(command,"#%dCD%d",&grat,&gris);
624 sprintf(command,"INITIAL/EMMI %d %d", grat, gris);
625 AppendDialogText(command);
626 AppendDialogText("SYNCHRO/ECHELLE");
627 InitAllFields();
628 return(0);
629 }
630
631 /* General Code */
632
633 strcpy(command,"Set/Echel ");
634 strcat(command,kiwitab[index].keyword);
635 strcat(command," = ");
636
637 switch(kiwitab[index].wtype) {
638
639 case ('G'): /* Toggle Buttons */
640 if (XmToggleButtonGetState(UxGetWidget(UxFindSwidget(kiwitab[index].widget))) == TRUE)
641 strcat(command,"NO");
642 else
643 strcat(command,"YES");
644 AppendDialogTextNoWait(command);
645 break;
646
647 case ('U'): /* Case Undefined (no general processing, special cases are treated below) */
648 break;
649
650 default: /* Radio-Buttons and Option Menus (types R and O) */
651 strcat(command,kiwitab[index].midcom);
652 AppendDialogTextNoWait(command);
653 break;
654
655 }
656
657
658 /* Special Case: Radio Widget for WLCMTD (Handling of GUESS mode) */
659 if (strcmp(kiwitab[index].assw, "rowColumn24") == 0) {
660 if (strcmp(kiwitab[index].widget, "rb_wlcmtd_gues7") == 0) {
661 UxPutSensitive(UxFindSwidget("tf_guess2"), "true");
662 UxPutSensitive(UxFindSwidget("guess_session_label"), "true");
663 UxPutSensitive(UxFindSwidget("tg_coropt"), "true");
664 }
665 else {
666 UxPutSensitive(UxFindSwidget("tf_guess2"), "false");
667 UxPutSensitive(UxFindSwidget("guess_session_label"), "false");
668 UxPutSensitive(UxFindSwidget("tg_coropt"), "false");
669 }
670 }
671
672 /* Special Case: Extraction Method Radio-Button updates Search panel*/
673 if (strcmp(kiwitab[index].assw, "rowColumn27") == 0)
674 UxPutText(UxFindSwidget("tf_thres12"),kiwitab[index].midcom);
675
676 /* Special Case: Rotation Method Radio-Button for pre-defined Orientations */
677 if (strcmp(kiwitab[index].widget, "toggleButton14") == 0) {
678 strcat(command, UxGetLabelString(UxFindSwidget(UxGetMenuHistory(UxFindSwidget("mn_tol2")))));
679 AppendDialogTextNoWait(command);
680 }
681 if (strcmp(kiwitab[index].assw, "mn_tol2") == 0) {
682 XmToggleButtonSetState(UxGetWidget(UxFindSwidget("toggleButton14")), TRUE, FALSE);
683 XmToggleButtonSetState(UxGetWidget(UxFindSwidget("toggleButton15")), FALSE, FALSE);
684 strcat(command, UxGetLabelString(UxFindSwidget(UxGetMenuHistory(UxFindSwidget("mn_tol2")))));
685 AppendDialogTextNoWait(command);
686 }
687
688 return 0;
689 }
690
691 int StringToIndex(s)
692
693 char *s;
694
695 {
696 int index=0;
697 int found=0;
698
699 while (index < NB_KEY) {
700 if (strcmp(kiwitab[index].widget,s) == 0) found = 1;
701 if ((int) strlen(kiwitab[index].assw) > 0)
702 if (strcmp(kiwitab[index].assw,s) == 0) found = 1;
703 if (found == 1) break;
704 else index++;
705 }
706
707 if (dbg > 1) printf("Found swidget %s at index %d\n",s,index);
708
709 return(index);
710
711 }
712
713 void SelectList(sw)
714 swidget sw;
715
716 {
717 extern Widget FileListWidget;
718 extern char DirSpecs[];
719 extern swidget FileListInterface;
720
721 int strip = 1; /* Strips directories */
722 IndexMemory = FindIndex(sw);
723
724 strcpy(DirSpecs, kiwitab[IndexMemory].midcom);
725 SetFileList(FileListWidget, strip, DirSpecs);
726 UxPopupInterface(FileListInterface, exclusive_grab);
727
728 }
729
730 void ChoiceList(choice)
731 char *choice;
732
733 {
734 extern swidget FileListInterface;
735
736 if (IndexMemory != 0) {
737 strcpy(CValue,"");
738 UxPutText(UxFindSwidget(kiwitab[IndexMemory].assw), choice);
739 UxPopdownInterface(FileListInterface);
740 if (dbg >= 2) printf("Now call Widget Leave: %s\n",kiwitab[IndexMemory].assw);
741 WidgetLeave(UxGetWidget(UxFindSwidget(kiwitab[IndexMemory].assw)));
742 IndexMemory = 0;
743 }
744 else {
745 if (dbg >= 2) printf("Ignored: Attempted to write %s at index %d\n",choice,IndexMemory);
746 CallbackList(choice);
747 }
748 }
749