Debian Codegraph @

gui/XBatch/src/cb_list.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 cb_list.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
46
47 extern void ReadParamsReduce(), DisplayParamsReduce(), WriteKeyword();
48 extern void SetFileList();
49
50 extern int AppendDialogText();
51
52
53
54 int PopupList( list_type )
55 int list_type;
56 {
57 int strip = 1; /* strip off the directories */
58
59 extern swidget FileListInterface;
60 extern Widget FileListWidget;
61 extern char DirSpecs[];
62
63 ListType = list_type;
64
65 switch ( list_type ) {
66 case LIST_REDSESS:
67 SET_LIST_TITLE("Enter parameters table");
68 strcpy(DirSpecs, "*.brf");
69 break;
70 case LIST_INPUTF:
71 SET_LIST_TITLE("Enter catalog name");
72 strcpy(DirSpecs, "*.cat");
73 break;
74 case LIST_BIAS:
75 SET_LIST_TITLE("Enter bias image");
76 strcpy(DirSpecs, "*.bdf");
77 break;
78 case LIST_DARK:
79 SET_LIST_TITLE("Enter dark image");
80 strcpy(DirSpecs, "*.bdf");
81 break;
82 case LIST_FLAT:
83 SET_LIST_TITLE("Enter flat-field image");
84 strcpy(DirSpecs, "*.bdf");
85 break;
86 case LIST_LONGSESS:
87 SET_LIST_TITLE("Enter parameters table");
88 strcpy(DirSpecs, "*.tbl");
89 break;
90 case LIST_REDEXTAB:
91 SET_LIST_TITLE("Enter extinction table");
92 strcpy(DirSpecs, "*.tbl");
93 break;
94 case LIST_REDRESP:
95 SET_LIST_TITLE("Enter response curve");
96 strcpy(DirSpecs, "*.bdf");
97 break;
98 default:
99 break;
100 }
101 SetFileList(FileListWidget, strip, DirSpecs);
102 UxPopupInterface(FileListInterface, exclusive_grab);
103 return 0;
104 }
105
106 void CallbackList( choice )
107 char *choice;
108 {
109 char command[512];
110
111 extern swidget FileListInterface;
112 extern swidget TextFieldSwidget;
113
114 command[0] = '\0';
115
116 switch ( ListType ) {
117 case LIST_REDSESS:
118 ReadParamsReduce(choice);
119 DisplayParamsReduce();
120 sprintf(command, "%s%s", C_REDINIT, choice);
121 break;
122 case LIST_INPUTF:
123 UxPutValue(TextFieldSwidget, choice);
124 strcpy(Inputf, choice);
125 WriteKeyword(Inputf, K_INPUTF);
126 break;
127 case LIST_LONGSESS:
128 UxPutValue(TextFieldSwidget, choice);
129 strcpy(Longsess, choice);
130 WriteKeyword(Longsess, K_LONGSESS);
131 break;
132 case LIST_REDRESP:
133 UxPutValue(TextFieldSwidget, choice);
134 strcpy(Redresp, choice);
135 WriteKeyword(Redresp, K_REDRESP);
136 break;
137 case LIST_BIAS:
138 UxPutValue(TextFieldSwidget, choice);
139 strcpy(Bias, choice);
140 WriteKeyword(Bias, K_BIAS);
141 break;
142 case LIST_DARK:
143 UxPutValue(TextFieldSwidget, choice);
144 strcpy(Dark, choice);
145 WriteKeyword(Dark, K_DARK);
146 break;
147 case LIST_FLAT:
148 UxPutValue(TextFieldSwidget, choice);
149 strcpy(Flat, choice);
150 WriteKeyword(Flat, K_FLAT);
151 break;
152 case LIST_REDEXTAB:
153 UxPutValue(TextFieldSwidget, choice);
154 strcpy(Redextab, choice);
155 WriteKeyword(Redextab, K_REDEXTAB);
156 break;
157 }
158 XtFree(choice);
159
160 UxPopdownInterface(FileListInterface);
161
162 if ( command[0] != '\0' )
163 AppendDialogText(command);
164 }
165
166 void CallbackDialog()
167 {
168 char command[128];
169 char *out;
170 extern int DialogType;
171
172 out = XmTextGetString(UxGetWidget(UxFindSwidget("tf_file_dialog")));
173 switch ( DialogType ) {
174 case DIALOG_REDSESS:
175 strcpy(Redsess, out);
176 sprintf(command, "%s%s", C_REDSAVE, Redsess);
177 break;
178 }
179 AppendDialogText(command);
180 XtFree(out);
181 UxPopdownInterface(UxFindSwidget("file_dialog"));
182 }