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

« back to all changes in this revision

Viewing changes to gui/XHelp/src/transientShell4.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
.VERSION
 
30
 090818         last modif
 
31
*/
 
32
 
 
33
/*******************************************************************************
 
34
        transientShell4.c
 
35
 
 
36
*******************************************************************************/
 
37
 
 
38
#include <stdio.h>
 
39
#include "UxLib.h"
 
40
#include "UxLabel.h"
 
41
#include "UxPushB.h"
 
42
#include "UxText.h"
 
43
#include "UxForm.h"
 
44
#include "UxTranSh.h"
 
45
 
 
46
/*******************************************************************************
 
47
        Includes, Defines, and Global variables from the Declarations Editor:
 
48
*******************************************************************************/
 
49
 
 
50
#include <ExternResources.h>
 
51
 
 
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
 
56
        correct instance.
 
57
 
 
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
*******************************************************************************/
 
64
 
 
65
typedef struct
 
66
{
 
67
        swidget UxtransientShell4;
 
68
        swidget UxworkArea4;
 
69
        swidget UxSHelp4;
 
70
        swidget UxNewsButton4;
 
71
        swidget UxPrintButton4;
 
72
        swidget Uxlabel5;
 
73
        swidget UxtextField4;
 
74
} _UxCtransientShell4;
 
75
 
 
76
#define transientShell4         UxTransientShell4Context->UxtransientShell4
 
77
#define workArea4               UxTransientShell4Context->UxworkArea4
 
78
#define SHelp4                  UxTransientShell4Context->UxSHelp4
 
79
#define NewsButton4             UxTransientShell4Context->UxNewsButton4
 
80
#define PrintButton4            UxTransientShell4Context->UxPrintButton4
 
81
#define label5                  UxTransientShell4Context->Uxlabel5
 
82
#define textField4              UxTransientShell4Context->UxtextField4
 
83
 
 
84
static _UxCtransientShell4      *UxTransientShell4Context;
 
85
 
 
86
extern void helpPR(), InitHelp(), WriteHelpAW(), makeReport(), SensMenu();
 
87
 
 
88
 
 
89
/*******************************************************************************
 
90
        The following are translation tables.
 
91
*******************************************************************************/
 
92
 
 
93
 
 
94
/*******************************************************************************
 
95
        Forward declarations of functions that are defined later in this file.
 
96
*******************************************************************************/
 
97
 
 
98
swidget create_transientShell4();
 
99
 
 
100
/*******************************************************************************
 
101
        The following are Action functions.
 
102
*******************************************************************************/
 
103
 
 
104
static void     action_WriteHelp( UxWidget, UxEvent, UxParams, p_UxNumParams )
 
105
        Widget          UxWidget;
 
106
        XEvent          *UxEvent;
 
107
        String          *UxParams;
 
108
        Cardinal        *p_UxNumParams;
 
109
{
 
110
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
111
        swidget                 UxThisWidget;
 
112
 
 
113
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
114
        UxSaveCtx = UxTransientShell4Context;
 
115
        UxTransientShell4Context = UxContext =
 
116
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
117
        {
 
118
        WriteHelpAW(UxWidget);
 
119
        helpPR(UxWidget);
 
120
        
 
121
        }
 
122
        UxTransientShell4Context = UxSaveCtx;
 
123
}
 
124
 
 
125
/*******************************************************************************
 
126
        The following are callback functions.
 
127
*******************************************************************************/
 
128
 
 
129
static void     mapCB_workArea4( UxWidget, UxClientData, UxCallbackArg )
 
130
        Widget          UxWidget;
 
131
        XtPointer       UxClientData, UxCallbackArg;
 
132
{
 
133
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
134
        swidget                 UxThisWidget;
 
135
 
 
136
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
137
        UxSaveCtx = UxTransientShell4Context;
 
138
        UxTransientShell4Context = UxContext =
 
139
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
140
        {
 
141
        
 
142
        }
 
143
        UxTransientShell4Context = UxSaveCtx;
 
144
}
 
145
 
 
146
static void     createCB_workArea4( UxWidget, UxClientData, UxCallbackArg )
 
147
        Widget          UxWidget;
 
148
        XtPointer       UxClientData, UxCallbackArg;
 
149
{
 
150
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
151
        swidget                 UxThisWidget;
 
152
 
 
153
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
154
        UxSaveCtx = UxTransientShell4Context;
 
155
        UxTransientShell4Context = UxContext =
 
156
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
157
        {
 
158
        
 
159
        }
 
160
        UxTransientShell4Context = UxSaveCtx;
 
161
}
 
162
 
 
163
static void     activateCB_SHelp4( UxWidget, UxClientData, UxCallbackArg )
 
164
        Widget          UxWidget;
 
165
        XtPointer       UxClientData, UxCallbackArg;
 
166
{
 
167
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
168
        swidget                 UxThisWidget;
 
169
 
 
170
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
171
        UxSaveCtx = UxTransientShell4Context;
 
172
        UxTransientShell4Context = UxContext =
 
173
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
174
        {
 
175
        
 
176
        }
 
177
        UxTransientShell4Context = UxSaveCtx;
 
178
}
 
179
 
 
180
static void     activateCB_NewsButton4( UxWidget, UxClientData, UxCallbackArg )
 
181
        Widget          UxWidget;
 
182
        XtPointer       UxClientData, UxCallbackArg;
 
183
{
 
184
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
185
        swidget                 UxThisWidget;
 
186
 
 
187
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
188
        UxSaveCtx = UxTransientShell4Context;
 
189
        UxTransientShell4Context = UxContext =
 
190
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
191
        {
 
192
         extern swidget save;
 
193
         char addr[100];
 
194
        
 
195
        
 
196
         strcpy(addr,UxGetText(textField4));
 
197
        
 
198
         makeReport(addr);
 
199
        
 
200
         UxPopdownInterface(save);
 
201
        
 
202
        }
 
203
        UxTransientShell4Context = UxSaveCtx;
 
204
}
 
205
 
 
206
static void     activateCB_PrintButton4( UxWidget, UxClientData, UxCallbackArg )
 
207
        Widget          UxWidget;
 
208
        XtPointer       UxClientData, UxCallbackArg;
 
209
{
 
210
        _UxCtransientShell4     *UxSaveCtx, *UxContext;
 
211
        swidget                 UxThisWidget;
 
212
 
 
213
        UxThisWidget = UxWidgetToSwidget( UxWidget );
 
214
        UxSaveCtx = UxTransientShell4Context;
 
215
        UxTransientShell4Context = UxContext =
 
216
                        (_UxCtransientShell4 *) UxGetContext( UxThisWidget );
 
217
        {
 
218
        extern swidget save;
 
219
        
 
220
        UxPopdownInterface(save);
 
221
        
 
222
        }
 
223
        UxTransientShell4Context = UxSaveCtx;
 
224
}
 
225
 
 
226
/*******************************************************************************
 
227
        The 'init_' function sets the private properties for all the
 
228
        swidgets to the values specified in the Property Table.
 
229
        Some properties need to be set after the X widgets have been
 
230
        created and the setting of these properties is done in the
 
231
        'build_' function after the UxCreateWidget call.
 
232
*******************************************************************************/
 
233
 
 
234
static void     _Uxinit_transientShell4()
 
235
{
 
236
        UxPutTitle( transientShell4, "Save Report" );
 
237
        UxPutHeight( transientShell4, 140 );
 
238
        UxPutWidth( transientShell4, 300 );
 
239
        UxPutY( transientShell4, 600 );
 
240
        UxPutX( transientShell4, 630 );
 
241
 
 
242
        UxPutResizePolicy( workArea4, "resize_none" );
 
243
        UxPutNoResize( workArea4, "true" );
 
244
        UxPutUnitType( workArea4, "pixels" );
 
245
        UxPutBackground( workArea4, WindowBackground );
 
246
        UxPutBorderWidth( workArea4, 0 );
 
247
        UxPutHeight( workArea4, 498 );
 
248
        UxPutWidth( workArea4, 600 );
 
249
        UxPutY( workArea4, 2 );
 
250
        UxPutX( workArea4, 20 );
 
251
 
 
252
        UxPutText( SHelp4, "Enter file name" );
 
253
        UxPutEditable( SHelp4, "false" );
 
254
        UxPutAccelerators( SHelp4, "" );
 
255
        UxPutWordWrap( SHelp4, "false" );
 
256
        UxPutHighlightOnEnter( SHelp4, "true" );
 
257
        UxPutEditMode( SHelp4, "single_line_edit" );
 
258
        UxPutBlinkRate( SHelp4, 500 );
 
259
        UxPutPendingDelete( SHelp4, "true" );
 
260
        UxPutTranslations( SHelp4, "" );
 
261
        UxPutCursorPositionVisible( SHelp4, "true" );
 
262
        UxPutFontList( SHelp4, TextFont );
 
263
        UxPutHighlightColor( SHelp4, ApplicBackground );
 
264
        UxPutForeground( SHelp4, TextForeground );
 
265
        UxPutBackground( SHelp4, SHelpBackground );
 
266
        UxPutHeight( SHelp4, 40 );
 
267
        UxPutWidth( SHelp4, 325 );
 
268
        UxPutY( SHelp4, 380 );
 
269
        UxPutX( SHelp4, 30 );
 
270
 
 
271
        UxPutHighlightColor( NewsButton4, "Black" );
 
272
        UxPutRecomputeSize( NewsButton4, "false" );
 
273
        UxPutFontList( NewsButton4, BoldTextFont );
 
274
        UxPutForeground( NewsButton4, ButtonForeground );
 
275
        UxPutLabelString( NewsButton4, "OK" );
 
276
        UxPutBackground( NewsButton4, ButtonBackground );
 
277
        UxPutHeight( NewsButton4, 30 );
 
278
        UxPutWidth( NewsButton4, 95 );
 
279
        UxPutY( NewsButton4, 630 );
 
280
        UxPutX( NewsButton4, 20 );
 
281
 
 
282
        UxPutHighlightColor( PrintButton4, "Black" );
 
283
        UxPutRecomputeSize( PrintButton4, "false" );
 
284
        UxPutFontList( PrintButton4, BoldTextFont );
 
285
        UxPutForeground( PrintButton4, ButtonForeground );
 
286
        UxPutLabelString( PrintButton4, "Cancel" );
 
287
        UxPutBackground( PrintButton4, ButtonBackground );
 
288
        UxPutHeight( PrintButton4, 30 );
 
289
        UxPutWidth( PrintButton4, 95 );
 
290
        UxPutY( PrintButton4, 330 );
 
291
        UxPutX( PrintButton4, 280 );
 
292
 
 
293
        UxPutLabelString( label5, "File Name" );
 
294
        UxPutForeground( label5, TextForeground );
 
295
        UxPutFontList( label5, BoldTextFont );
 
296
        UxPutBackground( label5, LabelBackground );
 
297
        UxPutHeight( label5, 20 );
 
298
        UxPutWidth( label5, 80 );
 
299
        UxPutY( label5, 10 );
 
300
        UxPutX( label5, 10 );
 
301
 
 
302
        UxPutText( textField4, "midas.report" );
 
303
        UxPutForeground( textField4, TextForeground );
 
304
        UxPutFontList( textField4, TextFont );
 
305
        UxPutBackground( textField4, TextBackground );
 
306
        UxPutHeight( textField4, 35 );
 
307
        UxPutWidth( textField4, 250 );
 
308
        UxPutY( textField4, 60 );
 
309
        UxPutX( textField4, 140 );
 
310
 
 
311
}
 
312
 
 
313
/*******************************************************************************
 
314
        The 'build_' function creates all the swidgets and X widgets,
 
315
        and sets their properties to the values specified in the
 
316
        Property Editor.
 
317
*******************************************************************************/
 
318
 
 
319
static swidget  _Uxbuild_transientShell4()
 
320
{
 
321
        /* Create the swidgets */
 
322
 
 
323
        transientShell4 = UxCreateTransientShell( "transientShell4", NO_PARENT );
 
324
        UxPutContext( transientShell4, UxTransientShell4Context );
 
325
 
 
326
        workArea4 = UxCreateForm( "workArea4", transientShell4 );
 
327
        SHelp4 = UxCreateText( "SHelp4", workArea4 );
 
328
        NewsButton4 = UxCreatePushButton( "NewsButton4", workArea4 );
 
329
        PrintButton4 = UxCreatePushButton( "PrintButton4", workArea4 );
 
330
        label5 = UxCreateLabel( "label5", workArea4 );
 
331
        textField4 = UxCreateText( "textField4", workArea4 );
 
332
 
 
333
        _Uxinit_transientShell4();
 
334
 
 
335
        /* Create the X widgets */
 
336
 
 
337
        UxCreateWidget( transientShell4 );
 
338
        UxCreateWidget( workArea4 );
 
339
        createCB_workArea4( UxGetWidget( workArea4 ),
 
340
                        (XtPointer) UxTransientShell4Context, (XtPointer) NULL );
 
341
 
 
342
        UxPutBottomOffset( SHelp4, 50 );
 
343
        UxPutBottomAttachment( SHelp4, "attach_form" );
 
344
        UxPutRightOffset( SHelp4, 5 );
 
345
        UxPutRightAttachment( SHelp4, "attach_form" );
 
346
        UxPutLeftOffset( SHelp4, 5 );
 
347
        UxPutLeftAttachment( SHelp4, "attach_form" );
 
348
        UxCreateWidget( SHelp4 );
 
349
 
 
350
        UxPutLeftOffset( NewsButton4, 50 );
 
351
        UxPutLeftAttachment( NewsButton4, "attach_form" );
 
352
        UxPutTopWidget( NewsButton4, "SHelp4" );
 
353
        UxPutTopOffset( NewsButton4, 10 );
 
354
        UxPutTopAttachment( NewsButton4, "attach_widget" );
 
355
        UxCreateWidget( NewsButton4 );
 
356
 
 
357
        UxPutLeftWidget( PrintButton4, "NewsButton4" );
 
358
        UxPutLeftOffset( PrintButton4, 40 );
 
359
        UxPutLeftAttachment( PrintButton4, "attach_widget" );
 
360
        UxPutTopWidget( PrintButton4, "SHelp4" );
 
361
        UxPutTopOffset( PrintButton4, 10 );
 
362
        UxPutTopAttachment( PrintButton4, "attach_widget" );
 
363
        UxCreateWidget( PrintButton4 );
 
364
 
 
365
        UxPutTopOffset( label5, 15 );
 
366
        UxPutTopAttachment( label5, "attach_form" );
 
367
        UxPutLeftOffset( label5, 5 );
 
368
        UxPutLeftAttachment( label5, "attach_form" );
 
369
        UxCreateWidget( label5 );
 
370
 
 
371
        UxPutTopOffset( textField4, 10 );
 
372
        UxPutTopAttachment( textField4, "attach_form" );
 
373
        UxPutRightOffset( textField4, 5 );
 
374
        UxPutRightAttachment( textField4, "attach_form" );
 
375
        UxPutLeftOffset( textField4, 90 );
 
376
        UxPutLeftAttachment( textField4, "attach_form" );
 
377
        UxCreateWidget( textField4 );
 
378
 
 
379
 
 
380
        UxAddCallback( workArea4, XmNmapCallback,
 
381
                        mapCB_workArea4,
 
382
                        (XtPointer) UxTransientShell4Context );
 
383
 
 
384
        UxAddCallback( SHelp4, XmNactivateCallback,
 
385
                        activateCB_SHelp4,
 
386
                        (XtPointer) UxTransientShell4Context );
 
387
 
 
388
        UxAddCallback( NewsButton4, XmNactivateCallback,
 
389
                        activateCB_NewsButton4,
 
390
                        (XtPointer) UxTransientShell4Context );
 
391
 
 
392
        UxAddCallback( PrintButton4, XmNactivateCallback,
 
393
                        activateCB_PrintButton4,
 
394
                        (XtPointer) UxTransientShell4Context );
 
395
 
 
396
 
 
397
        /* Finally, call UxRealizeInterface to create the X windows
 
398
           for the widgets created above. */
 
399
 
 
400
        UxRealizeInterface( transientShell4 );
 
401
 
 
402
        return ( transientShell4 );
 
403
}
 
404
 
 
405
/*******************************************************************************
 
406
        The following function includes the code that was entered
 
407
        in the 'Initial Code' and 'Final Code' sections of the
 
408
        Declarations Editor. This function is called from the
 
409
        'Interface function' below.
 
410
*******************************************************************************/
 
411
 
 
412
static swidget  _Ux_create_transientShell4()
 
413
{
 
414
        swidget                 rtrn;
 
415
        _UxCtransientShell4     *UxContext;
 
416
 
 
417
        UxTransientShell4Context = UxContext =
 
418
                (_UxCtransientShell4 *) UxMalloc( sizeof(_UxCtransientShell4) );
 
419
 
 
420
        rtrn = _Uxbuild_transientShell4();
 
421
 
 
422
        return(rtrn);
 
423
}
 
424
 
 
425
/*******************************************************************************
 
426
        The following is the 'Interface function' which is the
 
427
        external entry point for creating this interface.
 
428
        This function should be called from your application or from
 
429
        a callback function.
 
430
*******************************************************************************/
 
431
 
 
432
swidget create_transientShell4()
 
433
{
 
434
        swidget                 _Uxrtrn;
 
435
        static int              _Uxinit = 0;
 
436
 
 
437
        if ( ! _Uxinit )
 
438
        {
 
439
                static XtActionsRec     _Uxactions[] = {
 
440
                                { "WriteHelp", action_WriteHelp }
 
441
                                };
 
442
 
 
443
                XtAppAddActions( UxAppContext,
 
444
                                _Uxactions,
 
445
                                XtNumber(_Uxactions) );
 
446
 
 
447
                _Uxinit = 1;
 
448
        }
 
449
 
 
450
        _Uxrtrn = _Ux_create_transientShell4();
 
451
 
 
452
        return ( _Uxrtrn );
 
453
}
 
454
 
 
455
/*******************************************************************************
 
456
        END OF FILE
 
457
*******************************************************************************/
 
458