~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to gui/XIrspec/src/SessionShell.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: midas@eso.org
 
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
/*******************************************************************************
 
30
        SessionShell.c
 
31
 
 
32
.VERSION
 
33
 090828         last modif
 
34
 
 
35
*******************************************************************************/
 
36
 
 
37
#include <stdio.h>
 
38
#include "UxLib.h"
 
39
#include "UxTextF.h"
 
40
#include "UxLabel.h"
 
41
#include "UxPushB.h"
 
42
#include "UxForm.h"
 
43
#include "UxApplSh.h"
 
44
 
 
45
/*******************************************************************************
 
46
        Includes, Defines, and Global variables from the Declarations Editor:
 
47
*******************************************************************************/
 
48
 
 
49
#include <ExternResources.h>
 
50
 
 
51
/*******************************************************************************
 
52
        The definition of the context structure:
 
53
        If you create multiple instances of your interface, the context
 
54
        structure ensures that your callbacks use the variables for the
 
55
        correct instance.
 
56
 
 
57
        For each swidget in the interface, each argument to the Interface
 
58
        function, and each variable in the Instance Specific section of the
 
59
        Declarations Editor, there is an entry in the context structure.
 
60
        and a #define.  The #define makes the variable name refer to the
 
61
        corresponding entry in the context structure.
 
62
*******************************************************************************/
 
63
 
 
64
typedef struct
 
65
{
 
66
        swidget Uxfile_dialog;
 
67
        swidget Uxform12;
 
68
        swidget Uxform13;
 
69
        swidget UxpushButton25;
 
70
        swidget UxpushButton26;
 
71
        swidget Uxlb_file_dialog;
 
72
        swidget Uxtf_file_dialog;
 
73
} _UxCfile_dialog;
 
74
 
 
75
#define file_dialog             UxFile_dialogContext->Uxfile_dialog
 
76
#define form12                  UxFile_dialogContext->Uxform12
 
77
#define form13                  UxFile_dialogContext->Uxform13
 
78
#define pushButton25            UxFile_dialogContext->UxpushButton25
 
79
#define pushButton26            UxFile_dialogContext->UxpushButton26
 
80
#define lb_file_dialog          UxFile_dialogContext->Uxlb_file_dialog
 
81
#define tf_file_dialog          UxFile_dialogContext->Uxtf_file_dialog
 
82
 
 
83
static _UxCfile_dialog  *UxFile_dialogContext;
 
84
 
 
85
extern void CallbackDialog();
 
86
 
 
87
 
 
88
/*******************************************************************************
 
89
        Forward declarations of functions that are defined later in this file.
 
90
*******************************************************************************/
 
91
 
 
92
swidget create_file_dialog();
 
93
 
 
94
/*******************************************************************************
 
95
        The following are callback functions.
 
96
*******************************************************************************/
 
97
 
 
98
static void     activateCB_pushButton25( UxWidget, UxClientData, UxCallbackArg )
 
99
        Widget          UxWidget;
 
100
        XtPointer       UxClientData, UxCallbackArg;
 
101
{
 
102
        _UxCfile_dialog         *UxSaveCtx, *UxContext;
 
103
        swidget                 UxThisWidget;
 
104
 
 
105
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
106
        UxSaveCtx = UxFile_dialogContext;
 
107
        UxFile_dialogContext = UxContext =
 
108
                        (_UxCfile_dialog *) UxGetContext( UxThisWidget );
 
109
        {
 
110
        CallbackDialog();
 
111
        }
 
112
        UxFile_dialogContext = UxSaveCtx;
 
113
}
 
114
 
 
115
static void     activateCB_pushButton26( UxWidget, UxClientData, UxCallbackArg )
 
116
        Widget          UxWidget;
 
117
        XtPointer       UxClientData, UxCallbackArg;
 
118
{
 
119
        _UxCfile_dialog         *UxSaveCtx, *UxContext;
 
120
        swidget                 UxThisWidget;
 
121
 
 
122
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
123
        UxSaveCtx = UxFile_dialogContext;
 
124
        UxFile_dialogContext = UxContext =
 
125
                        (_UxCfile_dialog *) UxGetContext( UxThisWidget );
 
126
        {
 
127
        UxPopdownInterface(UxFindSwidget("file_dialog"));
 
128
        }
 
129
        UxFile_dialogContext = UxSaveCtx;
 
130
}
 
131
 
 
132
static void     activateCB_tf_file_dialog( UxWidget, UxClientData, UxCallbackArg )
 
133
        Widget          UxWidget;
 
134
        XtPointer       UxClientData, UxCallbackArg;
 
135
{
 
136
        _UxCfile_dialog         *UxSaveCtx, *UxContext;
 
137
        swidget                 UxThisWidget;
 
138
 
 
139
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
140
        UxSaveCtx = UxFile_dialogContext;
 
141
        UxFile_dialogContext = UxContext =
 
142
                        (_UxCfile_dialog *) UxGetContext( UxThisWidget );
 
143
        {
 
144
        CallbackDialog();
 
145
        }
 
146
        UxFile_dialogContext = UxSaveCtx;
 
147
}
 
148
 
 
149
/*******************************************************************************
 
150
        The 'init_' function sets the private properties for all the
 
151
        swidgets to the values specified in the Property Table.
 
152
        Some properties need to be set after the X widgets have been
 
153
        created and the setting of these properties is done in the
 
154
        'build_' function after the UxCreateWidget call.
 
155
*******************************************************************************/
 
156
 
 
157
static void     _Uxinit_file_dialog()
 
158
{
 
159
        UxPutBackground( file_dialog, WindowBackground );
 
160
        UxPutGeometry( file_dialog, "+100+100" );
 
161
        UxPutKeyboardFocusPolicy( file_dialog, "pointer" );
 
162
        UxPutTitle( file_dialog, "" );
 
163
        UxPutHeight( file_dialog, 105 );
 
164
        UxPutWidth( file_dialog, 408 );
 
165
        UxPutY( file_dialog, 121 );
 
166
        UxPutX( file_dialog, 102 );
 
167
 
 
168
        UxPutBackground( form12, WindowBackground );
 
169
        UxPutHeight( form12, 348 );
 
170
        UxPutWidth( form12, 408 );
 
171
        UxPutY( form12, 0 );
 
172
        UxPutX( form12, 0 );
 
173
        UxPutUnitType( form12, "pixels" );
 
174
        UxPutResizePolicy( form12, "resize_none" );
 
175
 
 
176
        UxPutBackground( form13, ButtonBackground );
 
177
        UxPutHeight( form13, 40 );
 
178
        UxPutWidth( form13, 452 );
 
179
        UxPutY( form13, 62 );
 
180
        UxPutX( form13, 0 );
 
181
        UxPutResizePolicy( form13, "resize_none" );
 
182
 
 
183
        UxPutLabelString( pushButton25, "Apply" );
 
184
        UxPutForeground( pushButton25, ButtonForeground );
 
185
        UxPutFontList( pushButton25, BoldTextFont );
 
186
        UxPutBackground( pushButton25, ButtonBackground );
 
187
        UxPutHeight( pushButton25, 30 );
 
188
        UxPutWidth( pushButton25, 80 );
 
189
        UxPutY( pushButton25, 4 );
 
190
        UxPutX( pushButton25, 8 );
 
191
 
 
192
        UxPutLabelString( pushButton26, "Return" );
 
193
        UxPutForeground( pushButton26, CancelForeground );
 
194
        UxPutFontList( pushButton26, BoldTextFont );
 
195
        UxPutBackground( pushButton26, ButtonBackground );
 
196
        UxPutHeight( pushButton26, 30 );
 
197
        UxPutWidth( pushButton26, 80 );
 
198
        UxPutY( pushButton26, 4 );
 
199
        UxPutX( pushButton26, 100 );
 
200
 
 
201
        UxPutForeground( lb_file_dialog, TextForeground );
 
202
        UxPutAlignment( lb_file_dialog, "alignment_beginning" );
 
203
        UxPutLabelString( lb_file_dialog, "Normalized flat frame :" );
 
204
        UxPutFontList( lb_file_dialog, TextFont );
 
205
        UxPutBackground( lb_file_dialog, LabelBackground );
 
206
        UxPutHeight( lb_file_dialog, 30 );
 
207
        UxPutWidth( lb_file_dialog, 176 );
 
208
        UxPutY( lb_file_dialog, 12 );
 
209
        UxPutX( lb_file_dialog, 10 );
 
210
 
 
211
        UxPutForeground( tf_file_dialog, TextForeground );
 
212
        UxPutHighlightOnEnter( tf_file_dialog, "true" );
 
213
        UxPutFontList( tf_file_dialog, TextFont );
 
214
        UxPutBackground( tf_file_dialog, TextBackground );
 
215
        UxPutHeight( tf_file_dialog, 34 );
 
216
        UxPutWidth( tf_file_dialog, 210 );
 
217
        UxPutY( tf_file_dialog, 10 );
 
218
        UxPutX( tf_file_dialog, 190 );
 
219
 
 
220
}
 
221
 
 
222
/*******************************************************************************
 
223
        The 'build_' function creates all the swidgets and X widgets,
 
224
        and sets their properties to the values specified in the
 
225
        Property Editor.
 
226
*******************************************************************************/
 
227
 
 
228
static swidget  _Uxbuild_file_dialog()
 
229
{
 
230
        /* Create the swidgets */
 
231
 
 
232
        file_dialog = UxCreateApplicationShell( "file_dialog", NO_PARENT );
 
233
        UxPutContext( file_dialog, UxFile_dialogContext );
 
234
 
 
235
        form12 = UxCreateForm( "form12", file_dialog );
 
236
        form13 = UxCreateForm( "form13", form12 );
 
237
        pushButton25 = UxCreatePushButton( "pushButton25", form13 );
 
238
        pushButton26 = UxCreatePushButton( "pushButton26", form13 );
 
239
        lb_file_dialog = UxCreateLabel( "lb_file_dialog", form12 );
 
240
        tf_file_dialog = UxCreateTextField( "tf_file_dialog", form12 );
 
241
 
 
242
        _Uxinit_file_dialog();
 
243
 
 
244
        /* Create the X widgets */
 
245
 
 
246
        UxCreateWidget( file_dialog );
 
247
        UxCreateWidget( form12 );
 
248
        UxCreateWidget( form13 );
 
249
        UxCreateWidget( pushButton25 );
 
250
        UxCreateWidget( pushButton26 );
 
251
        UxCreateWidget( lb_file_dialog );
 
252
        UxCreateWidget( tf_file_dialog );
 
253
 
 
254
        UxAddCallback( pushButton25, XmNactivateCallback,
 
255
                        activateCB_pushButton25,
 
256
                        (XtPointer) UxFile_dialogContext );
 
257
 
 
258
        UxAddCallback( pushButton26, XmNactivateCallback,
 
259
                        activateCB_pushButton26,
 
260
                        (XtPointer) UxFile_dialogContext );
 
261
 
 
262
        UxAddCallback( tf_file_dialog, XmNactivateCallback,
 
263
                        activateCB_tf_file_dialog,
 
264
                        (XtPointer) UxFile_dialogContext );
 
265
 
 
266
 
 
267
        /* Finally, call UxRealizeInterface to create the X windows
 
268
           for the widgets created above. */
 
269
 
 
270
        UxRealizeInterface( file_dialog );
 
271
 
 
272
        return ( file_dialog );
 
273
}
 
274
 
 
275
/*******************************************************************************
 
276
        The following function includes the code that was entered
 
277
        in the 'Initial Code' and 'Final Code' sections of the
 
278
        Declarations Editor. This function is called from the
 
279
        'Interface function' below.
 
280
*******************************************************************************/
 
281
 
 
282
static swidget  _Ux_create_file_dialog()
 
283
{
 
284
        swidget                 rtrn;
 
285
        _UxCfile_dialog         *UxContext;
 
286
 
 
287
        UxFile_dialogContext = UxContext =
 
288
                (_UxCfile_dialog *) UxMalloc( sizeof(_UxCfile_dialog) );
 
289
 
 
290
        rtrn = _Uxbuild_file_dialog();
 
291
 
 
292
        return(rtrn);
 
293
}
 
294
 
 
295
/*******************************************************************************
 
296
        The following is the 'Interface function' which is the
 
297
        external entry point for creating this interface.
 
298
        This function should be called from your application or from
 
299
        a callback function.
 
300
*******************************************************************************/
 
301
 
 
302
swidget create_file_dialog()
 
303
{
 
304
        swidget                 _Uxrtrn;
 
305
 
 
306
        _Uxrtrn = _Ux_create_file_dialog();
 
307
 
 
308
        return ( _Uxrtrn );
 
309
}
 
310
 
 
311
/*******************************************************************************
 
312
        END OF FILE
 
313
*******************************************************************************/
 
314