1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
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.
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.
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,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
29
/*******************************************************************************
35
*******************************************************************************/
46
/*******************************************************************************
47
Includes, Defines, and Global variables from the Declarations Editor:
48
*******************************************************************************/
50
#include <ExternResources.h>
52
/*******************************************************************************
53
The definition of the context structure:
54
If you create multiple instances of your interface, the context
55
structure ensures that your callbacks use the variables for the
58
For each swidget in the interface, each argument to the Interface
59
function, and each variable in the Instance Specific section of the
60
Declarations Editor, there is an entry in the context structure.
61
and a #define. The #define makes the variable name refer to the
62
corresponding entry in the context structure.
63
*******************************************************************************/
67
swidget Uxresid_dialog;
70
swidget UxpushButton29;
71
swidget UxpushButton36;
73
swidget Uxtf_residual;
74
swidget Uxtg_residual;
77
#define resid_dialog UxResid_dialogContext->Uxresid_dialog
78
#define form18 UxResid_dialogContext->Uxform18
79
#define form19 UxResid_dialogContext->Uxform19
80
#define pushButton29 UxResid_dialogContext->UxpushButton29
81
#define pushButton36 UxResid_dialogContext->UxpushButton36
82
#define label25 UxResid_dialogContext->Uxlabel25
83
#define tf_residual UxResid_dialogContext->Uxtf_residual
84
#define tg_residual UxResid_dialogContext->Uxtg_residual
86
static _UxCresid_dialog *UxResid_dialogContext;
88
extern int AppendDialogText();
91
/*******************************************************************************
92
Forward declarations of functions that are defined later in this file.
93
*******************************************************************************/
95
swidget create_resid_dialog();
97
/*******************************************************************************
98
The following are callback functions.
99
*******************************************************************************/
101
static void activateCB_pushButton29( UxWidget, UxClientData, UxCallbackArg )
103
XtPointer UxClientData, UxCallbackArg;
105
_UxCresid_dialog *UxSaveCtx, *UxContext;
106
swidget UxThisWidget;
108
UxThisWidget = UxWidgetToSwidget( UxWidget );
109
UxSaveCtx = UxResid_dialogContext;
110
UxResid_dialogContext = UxContext =
111
(_UxCresid_dialog *) UxGetContext( UxThisWidget );
113
#include <spec_comm.h>
117
extern char Plotmode[];
119
strcpy(Plotmode, C_PLOT_RESID);
120
if ( XmToggleButtonGetState(UxGetWidget(UxFindSwidget("tg_residual"))))
121
sprintf(command, "%sALL", C_PLOT_RESID);
123
text = XmTextGetString(UxGetWidget(UxFindSwidget("tf_residual")));
124
sprintf(command, "%s%s", C_PLOT_RESID, text);
127
AppendDialogText(command);
128
UxPopdownInterface(UxFindSwidget("resid_dialog"));
130
UxResid_dialogContext = UxSaveCtx;
133
static void activateCB_pushButton36( UxWidget, UxClientData, UxCallbackArg )
135
XtPointer UxClientData, UxCallbackArg;
137
_UxCresid_dialog *UxSaveCtx, *UxContext;
138
swidget UxThisWidget;
140
UxThisWidget = UxWidgetToSwidget( UxWidget );
141
UxSaveCtx = UxResid_dialogContext;
142
UxResid_dialogContext = UxContext =
143
(_UxCresid_dialog *) UxGetContext( UxThisWidget );
145
UxPopdownInterface(UxFindSwidget("resid_dialog"));
147
UxResid_dialogContext = UxSaveCtx;
150
static void valueChangedCB_tg_residual( UxWidget, UxClientData, UxCallbackArg )
152
XtPointer UxClientData, UxCallbackArg;
154
_UxCresid_dialog *UxSaveCtx, *UxContext;
155
swidget UxThisWidget;
157
UxThisWidget = UxWidgetToSwidget( UxWidget );
158
UxSaveCtx = UxResid_dialogContext;
159
UxResid_dialogContext = UxContext =
160
(_UxCresid_dialog *) UxGetContext( UxThisWidget );
162
extern int AllResidual;
164
AllResidual = XmToggleButtonGetState(UxWidget);
165
XtSetSensitive(UxGetWidget(UxFindSwidget("tf_residual")), !AllResidual);
167
UxResid_dialogContext = UxSaveCtx;
170
/*******************************************************************************
171
The 'init_' function sets the private properties for all the
172
swidgets to the values specified in the Property Table.
173
Some properties need to be set after the X widgets have been
174
created and the setting of these properties is done in the
175
'build_' function after the UxCreateWidget call.
176
*******************************************************************************/
178
static void _Uxinit_resid_dialog()
180
UxPutBackground( resid_dialog, WindowBackground );
181
UxPutGeometry( resid_dialog, "+180+360" );
182
UxPutKeyboardFocusPolicy( resid_dialog, "pointer" );
183
UxPutTitle( resid_dialog, "Residuals plot" );
184
UxPutHeight( resid_dialog, 105 );
185
UxPutWidth( resid_dialog, 246 );
186
UxPutY( resid_dialog, 121 );
187
UxPutX( resid_dialog, 102 );
189
UxPutBackground( form18, WindowBackground );
190
UxPutHeight( form18, 348 );
191
UxPutWidth( form18, 408 );
194
UxPutUnitType( form18, "pixels" );
195
UxPutResizePolicy( form18, "resize_none" );
197
UxPutBackground( form19, ButtonBackground );
198
UxPutHeight( form19, 40 );
199
UxPutWidth( form19, 452 );
200
UxPutY( form19, 62 );
202
UxPutResizePolicy( form19, "resize_none" );
204
UxPutLabelString( pushButton29, "Ok" );
205
UxPutForeground( pushButton29, ApplyForeground );
206
UxPutFontList( pushButton29, BoldTextFont );
207
UxPutBackground( pushButton29, ButtonBackground );
208
UxPutHeight( pushButton29, 30 );
209
UxPutWidth( pushButton29, 80 );
210
UxPutY( pushButton29, 4 );
211
UxPutX( pushButton29, 8 );
213
UxPutLabelString( pushButton36, "Cancel" );
214
UxPutForeground( pushButton36, CancelForeground );
215
UxPutFontList( pushButton36, BoldTextFont );
216
UxPutBackground( pushButton36, ButtonBackground );
217
UxPutHeight( pushButton36, 30 );
218
UxPutWidth( pushButton36, 80 );
219
UxPutY( pushButton36, 4 );
220
UxPutX( pushButton36, 100 );
222
UxPutForeground( label25, TextForeground );
223
UxPutAlignment( label25, "alignment_beginning" );
224
UxPutLabelString( label25, "Row number :" );
225
UxPutFontList( label25, TextFont );
226
UxPutBackground( label25, LabelBackground );
227
UxPutHeight( label25, 36 );
228
UxPutWidth( label25, 94 );
229
UxPutY( label25, 10 );
230
UxPutX( label25, 22 );
232
UxPutForeground( tf_residual, TextForeground );
233
UxPutHighlightOnEnter( tf_residual, "true" );
234
UxPutFontList( tf_residual, TextFont );
235
UxPutBackground( tf_residual, TextBackground );
236
UxPutHeight( tf_residual, 40 );
237
UxPutWidth( tf_residual, 54 );
238
UxPutY( tf_residual, 8 );
239
UxPutX( tf_residual, 120 );
241
UxPutIndicatorSize( tg_residual, 16 );
242
UxPutHighlightOnEnter( tg_residual, "true" );
243
UxPutForeground( tg_residual, TextForeground );
244
UxPutSelectColor( tg_residual, SelectColor );
245
UxPutSet( tg_residual, "false" );
246
UxPutLabelString( tg_residual, "ALL" );
247
UxPutFontList( tg_residual, TextFont );
248
UxPutBackground( tg_residual, WindowBackground );
249
UxPutHeight( tg_residual, 36 );
250
UxPutWidth( tg_residual, 60 );
251
UxPutY( tg_residual, 10 );
252
UxPutX( tg_residual, 176 );
256
/*******************************************************************************
257
The 'build_' function creates all the swidgets and X widgets,
258
and sets their properties to the values specified in the
260
*******************************************************************************/
262
static swidget _Uxbuild_resid_dialog()
264
/* Create the swidgets */
266
resid_dialog = UxCreateApplicationShell( "resid_dialog", NO_PARENT );
267
UxPutContext( resid_dialog, UxResid_dialogContext );
269
form18 = UxCreateForm( "form18", resid_dialog );
270
form19 = UxCreateForm( "form19", form18 );
271
pushButton29 = UxCreatePushButton( "pushButton29", form19 );
272
pushButton36 = UxCreatePushButton( "pushButton36", form19 );
273
label25 = UxCreateLabel( "label25", form18 );
274
tf_residual = UxCreateTextField( "tf_residual", form18 );
275
tg_residual = UxCreateToggleButton( "tg_residual", form18 );
277
_Uxinit_resid_dialog();
279
/* Create the X widgets */
281
UxCreateWidget( resid_dialog );
282
UxCreateWidget( form18 );
283
UxCreateWidget( form19 );
284
UxCreateWidget( pushButton29 );
285
UxCreateWidget( pushButton36 );
286
UxCreateWidget( label25 );
287
UxCreateWidget( tf_residual );
288
UxCreateWidget( tg_residual );
290
UxAddCallback( pushButton29, XmNactivateCallback,
291
activateCB_pushButton29,
292
(XtPointer) UxResid_dialogContext );
294
UxAddCallback( pushButton36, XmNactivateCallback,
295
activateCB_pushButton36,
296
(XtPointer) UxResid_dialogContext );
298
UxAddCallback( tg_residual, XmNvalueChangedCallback,
299
valueChangedCB_tg_residual,
300
(XtPointer) UxResid_dialogContext );
303
/* Finally, call UxRealizeInterface to create the X windows
304
for the widgets created above. */
306
UxRealizeInterface( resid_dialog );
308
return ( resid_dialog );
311
/*******************************************************************************
312
The following function includes the code that was entered
313
in the 'Initial Code' and 'Final Code' sections of the
314
Declarations Editor. This function is called from the
315
'Interface function' below.
316
*******************************************************************************/
318
static swidget _Ux_create_resid_dialog()
321
_UxCresid_dialog *UxContext;
323
UxResid_dialogContext = UxContext =
324
(_UxCresid_dialog *) UxMalloc( sizeof(_UxCresid_dialog) );
326
rtrn = _Uxbuild_resid_dialog();
331
/*******************************************************************************
332
The following is the 'Interface function' which is the
333
external entry point for creating this interface.
334
This function should be called from your application or from
336
*******************************************************************************/
338
swidget create_resid_dialog()
342
_Uxrtrn = _Ux_create_resid_dialog();
347
/*******************************************************************************
349
*******************************************************************************/