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 Massachusetss Ave, Cambridge,
19
Corresponding 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
*******************************************************************************/
47
/*******************************************************************************
48
Includes, Defines, and Global variables from the Declarations Editor:
49
*******************************************************************************/
51
#include <ExternResources.h>
54
/*******************************************************************************
55
The definition of the context structure:
56
If you create multiple instances of your interface, the context
57
structure ensures that your callbacks use the variables for the
60
For each swidget in the interface, each argument to the Interface
61
function, and each variable in the Instance Specific section of the
62
Declarations Editor, there is an entry in the context structure.
63
and a #define. The #define makes the variable name refer to the
64
corresponding entry in the context structure.
65
*******************************************************************************/
72
swidget UxCancelWaveB;
82
swidget Uxtg_imaqual1;
85
#define form3 UxWaveBShellContext->Uxform3
86
#define form5 UxWaveBShellContext->Uxform5
87
#define ApplyWaveB UxWaveBShellContext->UxApplyWaveB
88
#define CancelWaveB UxWaveBShellContext->UxCancelWaveB
89
#define separator5 UxWaveBShellContext->Uxseparator5
90
#define label3 UxWaveBShellContext->Uxlabel3
91
#define label4 UxWaveBShellContext->Uxlabel4
92
#define textcwmin1 UxWaveBShellContext->Uxtextcwmin1
93
#define textcwmax1 UxWaveBShellContext->Uxtextcwmax1
94
#define label5 UxWaveBShellContext->Uxlabel5
95
#define label6 UxWaveBShellContext->Uxlabel6
96
#define textbwmin UxWaveBShellContext->Uxtextbwmin
97
#define textbwmax UxWaveBShellContext->Uxtextbwmax
98
#define tg_imaqual1 UxWaveBShellContext->Uxtg_imaqual1
100
static _UxCWaveBShell *UxWaveBShellContext;
102
extern void search_cwbw();
107
/*******************************************************************************
108
The following are translation tables.
109
*******************************************************************************/
111
static char *WBtext_tab = "#override\n\
112
<Key>Delete:delete-previous-character()\n\
113
<Key>BackSpace:delete-previous-character()\n\
114
<Key>osfBackSpace:delete-previous-character()\n\
115
<Key>osfDelete:delete-previous-character()\n";
117
/*******************************************************************************
118
Forward declarations of functions that are defined later in this file.
119
*******************************************************************************/
121
swidget create_WaveBShell();
123
/*******************************************************************************
124
The following are callback functions.
125
*******************************************************************************/
127
static void activateCB_ApplyWaveB( UxWidget, UxClientData, UxCallbackArg )
129
XtPointer UxClientData, UxCallbackArg;
131
_UxCWaveBShell *UxSaveCtx, *UxContext;
132
swidget UxThisWidget;
134
UxThisWidget = UxWidgetToSwidget( UxWidget );
135
UxSaveCtx = UxWaveBShellContext;
136
UxWaveBShellContext = UxContext =
137
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
139
extern float cw1,cw2,bw1,bw2;
141
search_cwbw(cw1,cw2,bw1,bw2);
143
UxPopdownInterface(WaveBShell);
145
UxWaveBShellContext = UxSaveCtx;
148
static void activateCB_CancelWaveB( UxWidget, UxClientData, UxCallbackArg )
150
XtPointer UxClientData, UxCallbackArg;
152
_UxCWaveBShell *UxSaveCtx, *UxContext;
153
swidget UxThisWidget;
155
UxThisWidget = UxWidgetToSwidget( UxWidget );
156
UxSaveCtx = UxWaveBShellContext;
157
UxWaveBShellContext = UxContext =
158
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
160
UxPopdownInterface(WaveBShell);
162
UxWaveBShellContext = UxSaveCtx;
165
static void losingFocusCB_textcwmin1( UxWidget, UxClientData, UxCallbackArg )
167
XtPointer UxClientData, UxCallbackArg;
169
_UxCWaveBShell *UxSaveCtx, *UxContext;
170
swidget UxThisWidget;
172
UxThisWidget = UxWidgetToSwidget( UxWidget );
173
UxSaveCtx = UxWaveBShellContext;
174
UxWaveBShellContext = UxContext =
175
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
183
nid=sscanf(UxGetText(UxFindSwidget("textcwmin1")),"%f",&minw);
186
if ((minw>=300.)&&(minw<=1100.))
194
sprintf(am,"%.1f",cw1);
195
UxPutText(UxFindSwidget("textcwmin1"),am);
199
UxWaveBShellContext = UxSaveCtx;
202
static void losingFocusCB_textcwmax1( UxWidget, UxClientData, UxCallbackArg )
204
XtPointer UxClientData, UxCallbackArg;
206
_UxCWaveBShell *UxSaveCtx, *UxContext;
207
swidget UxThisWidget;
209
UxThisWidget = UxWidgetToSwidget( UxWidget );
210
UxSaveCtx = UxWaveBShellContext;
211
UxWaveBShellContext = UxContext =
212
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
220
nid=sscanf(UxGetText(UxFindSwidget("textcwmax1")),"%f",&maxw);
223
if ((maxw>=400.)&&(maxw<=1200.))
231
sprintf(am,"%.1f",cw2);
232
UxPutText(UxFindSwidget("textcwmax1"),am);
236
UxWaveBShellContext = UxSaveCtx;
239
static void losingFocusCB_textbwmin( UxWidget, UxClientData, UxCallbackArg )
241
XtPointer UxClientData, UxCallbackArg;
243
_UxCWaveBShell *UxSaveCtx, *UxContext;
244
swidget UxThisWidget;
246
UxThisWidget = UxWidgetToSwidget( UxWidget );
247
UxSaveCtx = UxWaveBShellContext;
248
UxWaveBShellContext = UxContext =
249
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
256
nid=sscanf(UxGetText(UxFindSwidget("textbwmin")),"%f",&minw);
259
if ((minw>=0.)&&(minw<=500.))
267
sprintf(am,"%.1f",bw1);
268
UxPutText(UxFindSwidget("textbwmin"),am);
271
UxWaveBShellContext = UxSaveCtx;
274
static void losingFocusCB_textbwmax( UxWidget, UxClientData, UxCallbackArg )
276
XtPointer UxClientData, UxCallbackArg;
278
_UxCWaveBShell *UxSaveCtx, *UxContext;
279
swidget UxThisWidget;
281
UxThisWidget = UxWidgetToSwidget( UxWidget );
282
UxSaveCtx = UxWaveBShellContext;
283
UxWaveBShellContext = UxContext =
284
(_UxCWaveBShell *) UxGetContext( UxThisWidget );
293
nid=sscanf(UxGetText(UxFindSwidget("textbwmax")),"%f",&maxw);
296
if ((maxw>=5.)&&(maxw<=600.))
304
sprintf(am,"%.1f",bw2);
305
UxPutText(UxFindSwidget("textbwmax"),am);
308
UxWaveBShellContext = UxSaveCtx;
311
/*******************************************************************************
312
The 'init_' function sets the private properties for all the
313
swidgets to the values specified in the Property Table.
314
Some properties need to be set after the X widgets have been
315
created and the setting of these properties is done in the
316
'build_' function after the UxCreateWidget call.
317
*******************************************************************************/
319
static void _Uxinit_WaveBShell()
321
UxPutBackground( WaveBShell, WindowBackground );
322
UxPutBorderColor( WaveBShell, WindowBackground );
323
UxPutKeyboardFocusPolicy( WaveBShell, "pointer" );
324
UxPutIconName( WaveBShell, "Wavelength & Bandwith" );
325
UxPutHeight( WaveBShell, 260 );
326
UxPutWidth( WaveBShell, 325 );
327
UxPutY( WaveBShell, 275 );
328
UxPutX( WaveBShell, 619 );
330
UxPutBorderColor( form3, WindowBackground );
331
UxPutBackground( form3, WindowBackground );
332
UxPutHeight( form3, 548 );
333
UxPutWidth( form3, 490 );
336
UxPutUnitType( form3, "pixels" );
337
UxPutResizePolicy( form3, "resize_none" );
339
UxPutBorderColor( form5, ButtonBackground );
340
UxPutBackground( form5, ButtonBackground );
341
UxPutHeight( form5, 44 );
342
UxPutWidth( form5, 490 );
343
UxPutY( form5, 150 );
345
UxPutResizePolicy( form5, "resize_none" );
347
UxPutLabelString( ApplyWaveB, "Apply" );
348
UxPutForeground( ApplyWaveB, ApplyForeground );
349
UxPutFontList( ApplyWaveB, BoldTextFont );
350
UxPutBorderColor( ApplyWaveB, ButtonBackground );
351
UxPutBackground( ApplyWaveB, ButtonBackground );
352
UxPutHeight( ApplyWaveB, 30 );
353
UxPutWidth( ApplyWaveB, 80 );
354
UxPutY( ApplyWaveB, 6 );
355
UxPutX( ApplyWaveB, 10 );
357
UxPutLabelString( CancelWaveB, "Cancel" );
358
UxPutForeground( CancelWaveB, CancelForeground );
359
UxPutFontList( CancelWaveB, BoldTextFont );
360
UxPutBorderColor( CancelWaveB, ButtonBackground );
361
UxPutBackground( CancelWaveB, ButtonBackground );
362
UxPutHeight( CancelWaveB, 30 );
363
UxPutWidth( CancelWaveB, 86 );
364
UxPutY( CancelWaveB, 6 );
365
UxPutX( CancelWaveB, 110 );
367
UxPutBorderColor( separator5, WindowBackground );
368
UxPutBackground( separator5, WindowBackground );
369
UxPutHeight( separator5, 10 );
370
UxPutWidth( separator5, 492 );
371
UxPutY( separator5, 140 );
372
UxPutX( separator5, 0 );
374
UxPutForeground( label3, TextForeground );
375
UxPutAlignment( label3, "alignment_beginning" );
376
UxPutLabelString( label3, "Central Wavelenght min (nm) :" );
377
UxPutFontList( label3, TextFont );
378
UxPutBorderColor( label3, LabelBackground );
379
UxPutBackground( label3, LabelBackground );
380
UxPutHeight( label3, 30 );
381
UxPutWidth( label3, 220 );
382
UxPutY( label3, 10 );
383
UxPutX( label3, 10 );
385
UxPutForeground( label4, TextForeground );
386
UxPutAlignment( label4, "alignment_beginning" );
387
UxPutLabelString( label4, "Central Wavelenght max (nm) :" );
388
UxPutFontList( label4, TextFont );
389
UxPutBorderColor( label4, LabelBackground );
390
UxPutBackground( label4, LabelBackground );
391
UxPutHeight( label4, 28 );
392
UxPutWidth( label4, 220 );
393
UxPutY( label4, 52 );
394
UxPutX( label4, 10 );
396
UxPutTranslations( textcwmin1, WBtext_tab );
397
UxPutSelectionArrayCount( textcwmin1, 3 );
398
UxPutMaxLength( textcwmin1, 200 );
399
UxPutForeground( textcwmin1, TextForeground );
400
UxPutFontList( textcwmin1, TextFont );
401
UxPutBorderColor( textcwmin1, TextBackground );
402
UxPutBackground( textcwmin1, TextBackground );
403
UxPutHeight( textcwmin1, 35 );
404
UxPutWidth( textcwmin1, 80 );
405
UxPutY( textcwmin1, 8 );
406
UxPutX( textcwmin1, 236 );
408
UxPutTranslations( textcwmax1, WBtext_tab );
409
UxPutSelectionArrayCount( textcwmax1, 3 );
410
UxPutMaxLength( textcwmax1, 200 );
411
UxPutForeground( textcwmax1, TextForeground );
412
UxPutFontList( textcwmax1, TextFont );
413
UxPutBorderColor( textcwmax1, TextBackground );
414
UxPutBackground( textcwmax1, TextBackground );
415
UxPutHeight( textcwmax1, 35 );
416
UxPutWidth( textcwmax1, 80 );
417
UxPutY( textcwmax1, 48 );
418
UxPutX( textcwmax1, 236 );
420
UxPutForeground( label5, TextForeground );
421
UxPutAlignment( label5, "alignment_beginning" );
422
UxPutLabelString( label5, "Bandwidth min (nm) :" );
423
UxPutFontList( label5, TextFont );
424
UxPutBorderColor( label5, LabelBackground );
425
UxPutBackground( label5, LabelBackground );
426
UxPutHeight( label5, 30 );
427
UxPutWidth( label5, 220 );
428
UxPutY( label5, 90 );
429
UxPutX( label5, 10 );
431
UxPutForeground( label6, TextForeground );
432
UxPutAlignment( label6, "alignment_beginning" );
433
UxPutLabelString( label6, "Bandwidth max (nm) :" );
434
UxPutFontList( label6, TextFont );
435
UxPutBorderColor( label6, LabelBackground );
436
UxPutBackground( label6, LabelBackground );
437
UxPutHeight( label6, 30 );
438
UxPutWidth( label6, 220 );
439
UxPutY( label6, 130 );
440
UxPutX( label6, 10 );
442
UxPutTranslations( textbwmin, WBtext_tab );
443
UxPutSelectionArrayCount( textbwmin, 3 );
444
UxPutMaxLength( textbwmin, 200 );
445
UxPutForeground( textbwmin, TextForeground );
446
UxPutFontList( textbwmin, TextFont );
447
UxPutBorderColor( textbwmin, TextBackground );
448
UxPutBackground( textbwmin, TextBackground );
449
UxPutHeight( textbwmin, 35 );
450
UxPutWidth( textbwmin, 80 );
451
UxPutY( textbwmin, 88 );
452
UxPutX( textbwmin, 236 );
454
UxPutTranslations( textbwmax, WBtext_tab );
455
UxPutSelectionArrayCount( textbwmax, 3 );
456
UxPutMaxLength( textbwmax, 200 );
457
UxPutForeground( textbwmax, TextForeground );
458
UxPutFontList( textbwmax, TextFont );
459
UxPutBorderColor( textbwmax, TextBackground );
460
UxPutBackground( textbwmax, TextBackground );
461
UxPutHeight( textbwmax, 35 );
462
UxPutWidth( textbwmax, 80 );
463
UxPutY( textbwmax, 128 );
464
UxPutX( textbwmax, 236 );
466
UxPutHighlightOnEnter( tg_imaqual1, "true" );
467
UxPutForeground( tg_imaqual1, TextForeground );
468
UxPutSelectColor( tg_imaqual1, SelectColor );
469
UxPutSet( tg_imaqual1, "true" );
470
UxPutLabelString( tg_imaqual1, "Image Quality" );
471
UxPutFontList( tg_imaqual1, TextFont );
472
UxPutBorderColor( tg_imaqual1, WindowBackground );
473
UxPutBackground( tg_imaqual1, WindowBackground );
474
UxPutHeight( tg_imaqual1, 26 );
475
UxPutWidth( tg_imaqual1, 134 );
476
UxPutY( tg_imaqual1, 170 );
477
UxPutX( tg_imaqual1, 10 );
481
/*******************************************************************************
482
The 'build_' function creates all the swidgets and X widgets,
483
and sets their properties to the values specified in the
485
*******************************************************************************/
487
static swidget _Uxbuild_WaveBShell()
489
/* Create the swidgets */
491
WaveBShell = UxCreateApplicationShell( "WaveBShell", NO_PARENT );
492
UxPutContext( WaveBShell, UxWaveBShellContext );
494
form3 = UxCreateForm( "form3", WaveBShell );
495
form5 = UxCreateForm( "form5", form3 );
496
ApplyWaveB = UxCreatePushButton( "ApplyWaveB", form5 );
497
CancelWaveB = UxCreatePushButton( "CancelWaveB", form5 );
498
separator5 = UxCreateSeparator( "separator5", form3 );
499
label3 = UxCreateLabel( "label3", form3 );
500
label4 = UxCreateLabel( "label4", form3 );
501
textcwmin1 = UxCreateText( "textcwmin1", form3 );
502
textcwmax1 = UxCreateText( "textcwmax1", form3 );
503
label5 = UxCreateLabel( "label5", form3 );
504
label6 = UxCreateLabel( "label6", form3 );
505
textbwmin = UxCreateText( "textbwmin", form3 );
506
textbwmax = UxCreateText( "textbwmax", form3 );
507
tg_imaqual1 = UxCreateToggleButton( "tg_imaqual1", form3 );
509
_Uxinit_WaveBShell();
511
/* Create the X widgets */
513
UxCreateWidget( WaveBShell );
514
UxCreateWidget( form3 );
515
UxPutRightAttachment( form5, "attach_form" );
516
UxPutLeftAttachment( form5, "attach_form" );
517
UxPutBottomOffset( form5, 2 );
518
UxPutBottomAttachment( form5, "attach_form" );
519
UxCreateWidget( form5 );
521
UxCreateWidget( ApplyWaveB );
522
UxCreateWidget( CancelWaveB );
523
UxPutRightAttachment( separator5, "attach_form" );
524
UxPutLeftAttachment( separator5, "attach_form" );
525
UxPutBottomWidget( separator5, "form5" );
526
UxPutBottomOffset( separator5, 0 );
527
UxPutBottomAttachment( separator5, "attach_widget" );
528
UxCreateWidget( separator5 );
530
UxCreateWidget( label3 );
531
UxCreateWidget( label4 );
532
UxCreateWidget( textcwmin1 );
533
UxCreateWidget( textcwmax1 );
534
UxCreateWidget( label5 );
535
UxCreateWidget( label6 );
536
UxCreateWidget( textbwmin );
537
UxCreateWidget( textbwmax );
538
UxCreateWidget( tg_imaqual1 );
540
UxAddCallback( ApplyWaveB, XmNactivateCallback,
541
activateCB_ApplyWaveB,
542
(XtPointer) UxWaveBShellContext );
544
UxAddCallback( CancelWaveB, XmNactivateCallback,
545
activateCB_CancelWaveB,
546
(XtPointer) UxWaveBShellContext );
548
UxAddCallback( textcwmin1, XmNlosingFocusCallback,
549
losingFocusCB_textcwmin1,
550
(XtPointer) UxWaveBShellContext );
552
UxAddCallback( textcwmax1, XmNlosingFocusCallback,
553
losingFocusCB_textcwmax1,
554
(XtPointer) UxWaveBShellContext );
556
UxAddCallback( textbwmin, XmNlosingFocusCallback,
557
losingFocusCB_textbwmin,
558
(XtPointer) UxWaveBShellContext );
560
UxAddCallback( textbwmax, XmNlosingFocusCallback,
561
losingFocusCB_textbwmax,
562
(XtPointer) UxWaveBShellContext );
565
/* Finally, call UxRealizeInterface to create the X windows
566
for the widgets created above. */
568
UxRealizeInterface( WaveBShell );
570
return ( WaveBShell );
573
/*******************************************************************************
574
The following function includes the code that was entered
575
in the 'Initial Code' and 'Final Code' sections of the
576
Declarations Editor. This function is called from the
577
'Interface function' below.
578
*******************************************************************************/
580
static swidget _Ux_create_WaveBShell()
583
_UxCWaveBShell *UxContext;
585
UxWaveBShellContext = UxContext =
586
(_UxCWaveBShell *) UxMalloc( sizeof(_UxCWaveBShell) );
588
rtrn = _Uxbuild_WaveBShell();
593
/*******************************************************************************
594
The following is the 'Interface function' which is the
595
external entry point for creating this interface.
596
This function should be called from your application or from
598
*******************************************************************************/
600
swidget create_WaveBShell()
604
_Uxrtrn = _Ux_create_WaveBShell();
609
/*******************************************************************************
611
*******************************************************************************/