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

« back to all changes in this revision

Viewing changes to prim/display/libsrc/submem.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) 1994-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
.IDENTIFIER  SUBMEM_C
 
30
.LANGUAGE    C
 
31
.AUTHOR      K. Banse                   IPG-ESO Garching
 
32
.KEYWORDS    ImageDisplay, memory control regs.
 
33
.PURPOSE     manipulate the memory control registers of a given channel
 
34
.ALGORITHM   use IDIs to do the job
 
35
.INPUT/OUTPUT
 
36
  The following keywords are used:
 
37
 
 
38
  DAZIN/I/1/2          LUT/ITT section no., flag for graphics memory
 
39
  or for ACTION = B:
 
40
  INPUTI/I/1/5         channel1, channel2, ..., -1, delay in 10th of seconds
 
41
 
 
42
  call as    SUBMEM_C( action, dazhld )
 
43
 
 
44
  input:
 
45
          char *action :        action flag:
 
46
                          B, for blinking between two image channels
 
47
                          C, for clearing the memory channel
 
48
                          D, display in a user friendly format
 
49
                             all image channel related info (SHOW/CHANNEL)
 
50
                          I, for setting ITT section
 
51
                          L, for setting LUT section
 
52
                          M, for loading an image/graphics memory into FCR's
 
53
                          R, for displaying the refscale/intensity_bar
 
54
                          S, startup afresh = initialize the ima_display
 
55
          int  *dazhld:
 
56
 
 
57
.RETURNS     nothing
 
58
.ENVIRONment MIDAS
 
59
             #include <midas_def.h>   Prototypes for MIDAS interfaces
 
60
             #include <idinumd.h>     Global variables for DISPLAY interfaces
 
61
 
 
62
.VERSIONS    1.00       940630  converted from IDAUXZ.FOR    R.M.van Hees
 
63
 
 
64
 090706         last modif
 
65
------------------------------------------------------------*/
 
66
 
 
67
/* Define _POSIX_SOURCE to indicate that this is a POSIX program */
 
68
 
 
69
#define  _POSIX_SOURCE 1
 
70
 
 
71
 
 
72
#include <stdio.h>
 
73
#include <midas_def.h>
 
74
#include <idinumd.h>
 
75
#include <proto_II.h>
 
76
 
 
77
#define  MAXCHN  40
 
78
 
 
79
/*
 
80
 
 
81
*/
 
82
 
 
83
void SUBMEM_C(action,dazhld)
 
84
char *action;
 
85
int  *dazhld;
 
86
 
 
87
{
 
88
int  actvals, inputi, itt, knul, lutno, lutvis, refsc;
 
89
int  actcha, splmod, unit, dazzin[2], jarea;
 
90
register int ii;
 
91
 
 
92
char output[84], frame[16];
 
93
char *info_usr = "switch cursor(s) on - next time we exit...",
 
94
     *str_chpi = "start channel pixels:     %8d%8d",
 
95
     *str_used = "channel pixels used:      %8d%8d",
 
96
     *str_frpi = "start frame pixels:       %8d%8d",
 
97
     *str_scal = "scaling factors:          %8d%8d",
 
98
     *str_scro = "scroll values:            %8d%8d",
 
99
     *str_zoom = "zoom factors:             %8d%8d",
 
100
     *str_chsz = "channel size:             %8d%8d",
 
101
     *war_lutno = "Invalid lut section - forced to section 0 ...";
 
102
 
 
103
void CONCHA_C();
 
104
 
 
105
 
 
106
 
 
107
 
 
108
splmod = dazhld[2];                     /* initialisation */
 
109
refsc  = dazhld[7];
 
110
lutno  = dazhld[9];
 
111
jarea = 0;
 
112
 
 
113
(void) SCKRDI("DAZIN",1,2,&actvals,dazzin,&unit,&knul);
 
114
inputi = *dazzin;
 
115
 
 
116
 
 
117
if (*action != 'S')                     /* not for CLEAR/DISPLAY */
 
118
   {
 
119
   if ((*action == 'L') && (inputi >= 0))               /* enable LUT */
 
120
      (void) SCKGETC("P2",1,10,&actvals,output);
 
121
   else
 
122
      (void) SCKGETC("P1",1,10,&actvals,output);
 
123
 
 
124
   (void) CGN_UPCOPY(frame,output,8);
 
125
   if (frame[0] == '+')
 
126
      actcha = QIMCH;
 
127
   else if (frame[0] == 'O')
 
128
      actcha = QOVCH;
 
129
   else
 
130
      {
 
131
      double  ddum;
 
132
      int     stat;
 
133
      float   rdum;
 
134
 
 
135
      stat = CGN_CNVT(frame,1,1,&actcha,&rdum,&ddum);
 
136
      if ((stat != 1) || (actcha < 0) || (actcha > QLSTCH))
 
137
         {
 
138
         char  cdum[64];
 
139
 
 
140
         (void)sprintf(cdum,"invalid image channel (= %s) ...",output);
 
141
         SCETER(5,cdum);
 
142
         }
 
143
      }
 
144
   }
 
145
 
 
146
 
 
147
/* branch to desired action */
 
148
 
 
149
if (*action == 'B')                              /* blink between channels */
 
150
   {
 
151
   int   ink[MAXCHN], maxchan, mm, dummy[4];
 
152
   float delay[MAXCHN], dt; 
 
153
 
 
154
   (void) SCKRDI("DAZDEVR",20,1,&actvals,&maxchan,&unit,&knul);  /* max chans */
 
155
   if (maxchan > MAXCHN) 
 
156
      SCETER(11,"Max. no. of channels out of sync with DAZDEVR(20)!");
 
157
 
 
158
   (void) SCKRDI("CHANLS",1,maxchan,&actvals,ink,&unit,&knul);
 
159
   mm = maxchan;
 
160
   for (ii=0; ii<maxchan; ii++)
 
161
      {
 
162
      if (ink[ii] == -1) 
 
163
         {
 
164
         mm = ii;
 
165
         break;
 
166
         }
 
167
      }
 
168
   if (mm < 2) (void) SCETER(11,"Bad (or not enough) channels entered...");
 
169
   QIMCH = ink[0];
 
170
   DCGICH(QIMCH);       
 
171
   (void) Cdazvis(QDSPNO,QIMCH,2,1);
 
172
 
 
173
 
 
174
   (void) SCKRDR("INPUTR",1,1,&actvals,&dt,&unit,&knul);
 
175
   for (ii=0; ii<mm; ii++) delay[ii] = dt;      /* DELAY is in seconds */
 
176
 
 
177
 
 
178
   /* check, what option for blinking area we have */
 
179
 
 
180
   (void) SCKGETC("P3",1,60,&actvals,output);
 
181
   if (output[0] == '+')
 
182
      jarea = 0;
 
183
   else
 
184
      {
 
185
      CGN_UPSTR(output);
 
186
      if (strcmp(output,"CURSOR") == 0)
 
187
         jarea = 1;
 
188
      }
 
189
 
 
190
   if (jarea == 1)
 
191
      {
 
192
      int   give_info, cooco, coords[4];
 
193
      int   worky, statA, statB, xwdim, ywdim, xwoff, ywoff;
 
194
      int   xya[5], xyb[5];
 
195
      void  Ccursin();
 
196
 
 
197
      for (ii=0; ii<4; ii++) coords[ii] = -1;
 
198
 
 
199
      CONCHA_C(QDSPNO,QOVCH,1,0);       /* Clear ov_chan if necessary */
 
200
      (void) SETCUR_C(QDSPNO,2,1,0,coords);     /* setup cursor rectange */
 
201
 
 
202
 
 
203
      /* read cursor position(s) */
 
204
 
 
205
      cooco = 0;                        /* counter for cursor reading */
 
206
      give_info = 0;
 
207
      worky = 1;
 
208
      Ccursin(QDSPNO,0,2,xya,&statA,xyb,&statB);
 
209
 
 
210
   Cursor_loop:
 
211
      Ccursin(QDSPNO,1,2,xya,&statA,xyb,&statB);
 
212
 
 
213
      if ((statA == 0) && (statB == 0))
 
214
         {
 
215
         if ((give_info == 0) && (cooco == 0))          /* EXIT (1) */
 
216
            {
 
217
            SCTDIS(output,-9);
 
218
            SCTDIS(info_usr,80);
 
219
            give_info = 1;
 
220
            Ccursin(QDSPNO,0,2,xya,&statA,xyb,&statB);
 
221
            goto Cursor_loop;
 
222
            }
 
223
         SCTDIS(" ",0);
 
224
         }
 
225
      else
 
226
         {
 
227
         if (cooco == 0)
 
228
            cooco = 1;
 
229
         else
 
230
            CONCHA_C(QDSPNO,QOVCH,1,0); 
 
231
         (void) IIISTI_C(QDSPNO);
 
232
 
 
233
         xwdim = xyb[0] - xya[0] + 1;
 
234
         ywdim = xyb[1] - xya[1] + 1;
 
235
         xwoff = xya[0];                /* rectangle offset in memory */
 
236
         ywoff = xya[1];
 
237
 
 
238
 
 
239
         /* 1. chanl -> full view, all other chanls -> rectangle only */
 
240
 
 
241
         (void) IIMSTW_C(QDSPNO,ink[0],-99,QMSZX,QMSZY,-99,0,0);
 
242
         for (ii=1; ii<mm; ii++)
 
243
            (void) IIMSTW_C(QDSPNO,ink[ii],-99,xwdim,ywdim,-99,xwoff,ywoff);
 
244
 
 
245
         (void) IIMBLM_C(QDSPNO,ink,mm,delay);
 
246
         DCGICH(QIMCH); 
 
247
         (void) Cdazvis(QDSPNO,QIMCH,2,1);
 
248
             
 
249
         SCTDIS(" Move to next rectangle, or push EXIT button",80);
 
250
         Ccursin(QDSPNO,0,2,xya,&statA,xyb,&statB);
 
251
         goto Cursor_loop;
 
252
         }
 
253
      }
 
254
 
 
255
   else
 
256
      {         /* do it via IIMBLM, we get out of there via Exit button */
 
257
      for (ii=0; ii<mm; ii++)
 
258
         (void) IIMSTW_C(QDSPNO,ink[ii],-99,QMSZX,QMSZY,-99,0,0);
 
259
 
 
260
      (void) IIMBLM_C(QDSPNO,ink,mm,delay);
 
261
 
 
262
      /*  get currently displayed channel */
 
263
 
 
264
      (void) IIDQDC_C(QDSPNO,0,1,1,dummy,ink,dummy,dummy,dummy,dummy,&mm);
 
265
      QIMCH = ink[0];
 
266
      DCGICH(QIMCH);                    /* update memory info */
 
267
      }
 
268
   }
 
269
 
 
270
else if (*action == 'C')             /* handle CLEAR/CHANNEL business here */
 
271
   { 
 
272
   CONCHA_C(QDSPNO,actcha,0,*dazzin);
 
273
   (void) strcpy(dzmemc,"   ");         /* prepare data for cleaned channel */
 
274
   LOADDR = 0;
 
275
   SSPX = SSPY = 0;
 
276
   NSX = QMSZX;                       /* nopix in image memory */
 
277
   NSY = QMSZY;
 
278
   SFPX  = SFPY  = 1;
 
279
   SCALX = SCALY = 1;
 
280
   SCROLX = 0;                   /* pixel 0 -> left edge of display screen */
 
281
   SCROLY = QMSZY - 1;          /* last chan line -> top line of display */
 
282
   ZOOMX = ZOOMY = 1;
 
283
   SOURCE = 0;
 
284
   ITTYES = 0;
 
285
   DZDRAW = 0;
 
286
   ZPLANE = 0;
 
287
 
 
288
   DCPICH(actcha);              /* store new setup of channel */
 
289
   }
 
290
 
 
291
else if (*action == 'D')                       /* handle SHOW/CHANNEL here */
 
292
   {
 
293
   char  mybuf[84];
 
294
 
 
295
   if ((actcha == QOVCH) && (IDINUM == 11))
 
296
      {
 
297
      (void) sprintf(mybuf,
 
298
      "Overlay channel (%d) is emulated by software for X11",actcha);
 
299
      SCTPUT(mybuf);
 
300
      }
 
301
   else
 
302
      {
 
303
      (void) DCGICH(actcha);            /* get info from IDI display */
 
304
 
 
305
      if (QRGBFL != 1)
 
306
         {
 
307
         if (actcha != QOVCH)                  /* display usage of channel */
 
308
            (void) sprintf(mybuf,"Image channel %d:",actcha);
 
309
         else
 
310
            (void) sprintf(mybuf,"Overlay channel %d:",actcha);
 
311
 
 
312
         if (SOURCE > 0)                              /* from LOAD/IMAGE */
 
313
            (void) sprintf(output,"%s   frame %s loaded",mybuf,dzmemc);
 
314
         else
 
315
            (void) sprintf(output,"%s   unused... ",mybuf);
 
316
         SCTPUT(output);
 
317
 
 
318
         if (ZPLANE > 0)
 
319
            {
 
320
            (void) sprintf(output,"plane_no. loaded:              %d",ZPLANE);
 
321
            SCTPUT(output);
 
322
            }
 
323
         }
 
324
      else                              /* RGB mode */
 
325
         {
 
326
         (void) sprintf(mybuf,"Image channel 0:");
 
327
         if (SOURCE > 0)                              /* from LOAD/IMAGE */
 
328
            (void) sprintf(output,"%s   frame %s loaded",mybuf,dzmemc);
 
329
         else
 
330
            (void) sprintf(output,"%s   unused... ",mybuf);
 
331
         SCTPUT(output);
 
332
 
 
333
         if (actcha == 0)
 
334
            SCTPUT("channel 0 used for red color");
 
335
         else if (actcha == 1)
 
336
            SCTPUT("channel 1 used for green color");
 
337
         else
 
338
            SCTPUT("channel 2 used for blue color");
 
339
         }  
 
340
 
 
341
 
 
342
      /* display channel size; */
 
343
 
 
344
      (void) sprintf( output, str_chsz, QMSZX, QMSZY );
 
345
      SCTPUT(output);
 
346
 
 
347
 
 
348
      /* display start screen pixels */
 
349
 
 
350
      (void) sprintf( output, str_chpi, SSPX, SSPY );
 
351
      SCTPUT(output);
 
352
 
 
353
 
 
354
      /* display no. of ima_mempixels */
 
355
 
 
356
      (void) sprintf( output, str_used, NSX, NSY );
 
357
      SCTPUT(output);
 
358
 
 
359
 
 
360
      /* display start frame pixels */
 
361
 
 
362
      (void) sprintf( output, str_frpi, SFPX, SFPY );
 
363
      SCTPUT(output);
 
364
 
 
365
 
 
366
      /* display scaling factors */
 
367
 
 
368
      if ( SCALX == 1 )
 
369
         *dazzin = SCALX;
 
370
      else
 
371
         *dazzin = -SCALX;
 
372
 
 
373
      if ( SCALY == 1 )
 
374
         dazzin[1] = SCALY;
 
375
      else
 
376
         dazzin[1] = -SCALY;
 
377
      (void) sprintf(output,str_scal,*dazzin,dazzin[1]);
 
378
      SCTPUT(output);
 
379
 
 
380
 
 
381
      /* display scroll values */
 
382
 
 
383
      (void) sprintf( output, str_scro, SCROLX, SCROLY );
 
384
      SCTPUT(output);
 
385
 
 
386
 
 
387
      /* display zoom factors */
 
388
 
 
389
      (void) sprintf( output, str_zoom,  ZOOMX, ZOOMY );
 
390
      SCTPUT(output);
 
391
 
 
392
      if (ITTYES == 1)
 
393
         {
 
394
         char cbuff[24];
 
395
 
 
396
         (void) SCKGETC("HCITTLUT",1,42,&actvals,output);
 
397
         (void) strncpy(cbuff, output, 20 );
 
398
         cbuff[20] = '\0';
 
399
         (void) sprintf(output,"current ITT = %s",cbuff);
 
400
         }
 
401
      else
 
402
         (void) strcpy(output,"no ITT used");
 
403
      SCTPUT(output);
 
404
 
 
405
      if ( DZDRAW == 0 )     
 
406
         (void) strcpy(output,"no graphics in channel ");
 
407
      else
 
408
         (void) strcpy(output,"graphics in channel ");
 
409
      SCTPUT(output);
 
410
      }
 
411
   }
 
412
 
 
413
 
 
414
else if (*action == 'I')                      /* handle ITT business here */
 
415
   {
 
416
   int ittno, ittvis;
 
417
 
 
418
   DCGICH(actcha);
 
419
 
 
420
   if ( inputi < 0 )                            /* clear ITT */ 
 
421
      ITTYES = 0; 
 
422
   else
 
423
      ITTYES = 1;                               /* set to visible */
 
424
 
 
425
   DCPICH(actcha);
 
426
   ittno = 0;                                   /* ITT section always = 0 */
 
427
   ittvis = ITTYES;
 
428
 
 
429
 
 
430
   /* Get last referenced LUT section no.
 
431
     LUTNO in [0,3] (enabled LUT_sect) or in [100,103] (disabled LUT_sect) */
 
432
 
 
433
   if ( lutno > 99 ) lutno -= 100;
 
434
 
 
435
 
 
436
   /* select desired ITT and same LUT + en/disable visibility */
 
437
 
 
438
   if (ittvis > 0) (void) IIMSLT_C(QDSPNO,actcha,lutno,ittno);
 
439
 
 
440
 
 
441
   /* leave lut visibility as it is */
 
442
 
 
443
   lutvis = -1;
 
444
   (void) IIDSDP_C(QDSPNO,&actcha,1,&lutvis,&ittvis);
 
445
   if (actcha == QIMCH)
 
446
      (void) Cdazvis(QDSPNO,QIMCH,2,1);
 
447
   }
 
448
 
 
449
else if (*action == 'L')                                 /* en/disable LUT */
 
450
   {
 
451
   if (inputi < 0)     
 
452
      {
 
453
      lutvis = 0;
 
454
      if (lutno < 100) lutno += 100;       /* force to 100,101,102,103 */
 
455
      }
 
456
   else
 
457
      {
 
458
      lutvis = 7;
 
459
      if (inputi == 99)                 /* if 99, use last lut_section */
 
460
         {
 
461
         if (lutno >= 100) lutno -= 100;           /* force to 0,1,2,3 */
 
462
         }
 
463
      else
 
464
         {
 
465
         if ( (inputi >= 0) && (inputi <= 3) )     
 
466
            lutno = inputi;
 
467
         else
 
468
            {
 
469
            (void) SCTDIS(war_lutno,0);
 
470
            lutno = 0;                       /* default to section 0 */
 
471
            }
 
472
         }
 
473
      inputi = lutno;
 
474
      }
 
475
   (void) SCKWRI("DAZHOLD",&lutno,10,1,&unit);
 
476
 
 
477
 
 
478
   /* select LUT + ITT section */
 
479
 
 
480
   itt = 0;
 
481
   (void) IIMSLT_C(QDSPNO,actcha,inputi,itt);
 
482
 
 
483
 
 
484
   /* set LUT + ITT visibility */
 
485
 
 
486
   (void) IIDSDP_C(QDSPNO,&actcha,1,&lutvis,&itt);
 
487
   if (actcha == QIMCH)
 
488
      (void) Cdazvis( QDSPNO,QIMCH,2,1);               /* display channel */
 
489
   }
 
490
 
 
491
else if ( *action == 'M' )                   /* load image memory into FCR's */
 
492
   {
 
493
   QIMCH = actcha;
 
494
 
 
495
   if (QIMCH == QOVCH)                  /* only for non-X11 */
 
496
      {
 
497
      if (IDINUM == 11) 
 
498
         (void)SCETER(5,"invalid image channel (= overlay channel) ...");
 
499
      else
 
500
         {
 
501
         (void) Cdazvis(QDSPNO,QIMCH,2,1);
 
502
         if (QRGBFL != 1) Alphamem(QIMCH);
 
503
         }
 
504
      return;
 
505
      }
 
506
 
 
507
   (void) DCGICH(QIMCH);
 
508
 
 
509
 
 
510
   /* handle pseudo-colour + RGB mode differently ...! */
 
511
 
 
512
   if (QRGBFL != 1)             /* here in non-RGB (3 channels) mode */
 
513
      {
 
514
      if (lutno < 100)     
 
515
         {
 
516
         lutvis = 7;                            /* use LUT... */
 
517
         if ( inputi >= 0  && inputi <= 3 )     
 
518
            {
 
519
            lutno = inputi;
 
520
            (void) SCKWRI("DAZHOLD",&lutno,10,1,&unit);
 
521
            }
 
522
         else
 
523
            inputi = lutno;
 
524
         }
 
525
      else
 
526
         {
 
527
         inputi = lutno;
 
528
         lutvis = 0;                            /* bypass LUT... */
 
529
         }
 
530
 
 
531
 
 
532
      /* select LUT + ITT section */
 
533
 
 
534
      itt = 0;
 
535
      (void) IIMSLT_C(QDSPNO,QIMCH,inputi,itt);
 
536
 
 
537
 
 
538
      /* display channel on screen + use given LUT section */
 
539
 
 
540
      (void) Cdazvis(QDSPNO,QIMCH,2,1);
 
541
      Alphamem( QIMCH );
 
542
      itt = ITTYES;
 
543
      (void) IIDSDP_C(QDSPNO,&QIMCH,1,&lutvis,&itt);
 
544
      }
 
545
 
 
546
   else                   /* RGB mode: only handle the alpha part */
 
547
      Alphamem(QIMCH);
 
548
   }
 
549
 
 
550
else if (*action == 'R')               /* handle DISPLAY/LUT business here */
 
551
   { 
 
552
   (void) Cdazvis(QDSPNO,QIMCH,1,refsc);
 
553
 
 
554
 
 
555
   /* draw outer rectangle and bars, if graphics channel exists */
 
556
 
 
557
   if ((QOVCH != -1) && (IDINUM != 11))
 
558
      {
 
559
      int   color, posx, posy, lrecx[18], lrecy[18];
 
560
      float factx, facty;
 
561
      static char *str[5] = { "50", "100", "150", "200", "250" };
 
562
 
 
563
 
 
564
      color = dazzin[1];
 
565
      factx = QDSZX / 512.;             /* these numbers were calculated */
 
566
      facty = QDSZY / 512.;             /* for 512*512 display initially */
 
567
 
 
568
      lrecx[0] = lrecx[1] = 0;
 
569
      lrecx[2] = CGN_NINT( 87 * factx );
 
570
      lrecy[0] = 0;
 
571
      lrecy[1] = lrecy[2] = CGN_NINT( 19 * facty );
 
572
      (void) IIGPLY_C(QDSPNO,QOVCH,lrecx,lrecy,3,color,1);
 
573
 
 
574
      lrecx[0] = CGN_NINT( 110 * factx );
 
575
      lrecx[1] = CGN_NINT( 183 * factx );
 
576
      (void) IIGPLY_C(QDSPNO,QOVCH,lrecx,lrecy+1,2, color,1);
 
577
 
 
578
      lrecx[0] = CGN_NINT( 216 * factx );
 
579
      lrecx[1] = CGN_NINT( 283 * factx );
 
580
      (void) IIGPLY_C( QDSPNO, QOVCH, lrecx, lrecy + 1, 2, color, 1 );
 
581
 
 
582
      lrecx[0] = CGN_NINT( 316 * factx );
 
583
      lrecx[1] = CGN_NINT( 383 * factx );
 
584
      (void) IIGPLY_C( QDSPNO, QOVCH, lrecx, lrecy + 1, 2, color, 1 );
 
585
 
 
586
      lrecx[0] = CGN_NINT( 416 * factx );
 
587
      lrecx[1] = CGN_NINT( 483 * factx );
 
588
      (void) IIGPLY_C( QDSPNO, QOVCH, lrecx, lrecy + 1, 2, color, 1 );
 
589
 
 
590
      lrecx[0]  = lrecx[1]  = CGN_NINT( 511 * factx );
 
591
      lrecx[2]  = lrecx[3]  = lrecx[4]  = CGN_NINT( 500 * factx );
 
592
      lrecx[5]  = lrecx[6]  = lrecx[7]  = CGN_NINT( 400 * factx );
 
593
      lrecx[8]  = lrecx[9]  = lrecx[10] = CGN_NINT( 300 * factx );
 
594
      lrecx[11] = lrecx[12] = lrecx[13] = CGN_NINT( 200 * factx );
 
595
      lrecx[14] = lrecx[15] = lrecx[16] = CGN_NINT( 100 * factx );
 
596
      lrecx[17] = 0;
 
597
      for ( ii = 0; ii < 18; ii++ ) lrecy[ii] = 0;
 
598
      lrecy[0] = CGN_NINT( 19 * facty );
 
599
      for ( ii = 3; ii < 18; ii += 3 ) lrecy[ii] = CGN_NINT( 8 * facty );
 
600
      (void) IIGPLY_C( QDSPNO, QOVCH, lrecx, lrecy , 18, color, 1 );
 
601
 
 
602
 
 
603
      /* draw numbers */
 
604
 
 
605
      posx = CGN_NINT( 94 * factx );
 
606
      posy = CGN_NINT( 12 * facty );
 
607
      (void) IIGTXT_C( QDSPNO, QOVCH, str[0], posx, posy, 0, 0, color, 0 );
 
608
 
 
609
      posx = CGN_NINT( 190 * factx );
 
610
      (void) IIGTXT_C( QDSPNO, QOVCH, str[1], posx, posy, 0, 0, color, 0 );
 
611
 
 
612
      posx = CGN_NINT( 290 * factx );
 
613
      (void) IIGTXT_C( QDSPNO, QOVCH, str[2], posx, posy, 0, 0, color, 0 );
 
614
 
 
615
      posx = CGN_NINT( 390 * factx );
 
616
      (void) IIGTXT_C( QDSPNO, QOVCH, str[3], posx, posy, 0, 0, color, 0 );
 
617
 
 
618
      posx = CGN_NINT( 490 * factx );
 
619
      (void) IIGTXT_C( QDSPNO, QOVCH, str[4], posx, posy, 0, 0, color, 0 );
 
620
      }
 
621
   }
 
622
 
 
623
else if (*action == 'S')                      /* handle CLEAR/DISPLAY here */
 
624
   { 
 
625
   QOVCH = QLSTCH;                  /* use last channel as overlay channel */
 
626
   QIMCH = 0;                        /* start with channel 0 for images... */
 
627
 
 
628
 
 
629
   /* Now use IIDSEL to do the default configuration */ 
 
630
 
 
631
   (void) IIDRST_C(QDSPNO);      /* this call needed on other devices... */
 
632
   (void) IIDSEL_C(QDSPNO,1);
 
633
 
 
634
 
 
635
   /* Initialize data for cleaned channels */
 
636
   
 
637
   (void) strcpy(dzmemc,"   ");
 
638
   LOADDR = 0;
 
639
   SSPX = SSPY = 0;
 
640
   NSX = QMSZX;                                   /* nopix in image memory */
 
641
   NSY = QMSZY;
 
642
   SFPX = SFPY = 1;
 
643
   SCALX = SCALY = 1;
 
644
   SCROLX = 0;                   /* pixel 0 -> left edge of display screen */
 
645
   SCROLY = QMSZY - 1;          /* last chan line -> top line of display */
 
646
   ZOOMX = ZOOMY = 1;
 
647
   SOURCE = 0;
 
648
   ITTYES = 0;
 
649
   DZDRAW = 0;
 
650
   ZPLANE = 0;
 
651
 
 
652
   for (ii=0; ii<=QLSTCH; ii++) DCPICH(ii);
 
653
 
 
654
 
 
655
   /* Set up values for key DAZHOLD */
 
656
 
 
657
   dazhld[0] = 0;                  /* cursor no. */
 
658
   dazhld[1] = -1;                 /* cursor form (-1 = disabled) */
 
659
   dazhld[2] = 0;                  /* user split mode (0 = off, 1 = on) */
 
660
   dazhld[3] = (QDSZX - 1) / 2;    /* split addresses in x,y */
 
661
   dazhld[4] = (QDSZY - 1) / 2;    /* set to center of display */
 
662
   dazhld[5] = 1;                  /* zoom factors in x,y */
 
663
   dazhld[6] = 1;
 
664
   dazhld[7] = 0;                  /* refscale flag */
 
665
   dazhld[8] = 1;                  /* overlay_set flag */
 
666
   dazhld[9] = 0;                  /* last referenced lut section */
 
667
   dazhld[10] = 1;                 /* no. of memory boards per channel */
 
668
   (void) SCKWRI( "DAZHOLD", dazhld, 1, 11, &unit );
 
669
 
 
670
   /* finally clear + enable also the overlay */
 
671
 
 
672
   (void) IIMCMY_C(QDSPNO,&QOVCH,1,0);
 
673
   (void) Cdazvis(QDSPNO,QOVCH,2,1);
 
674
   }
 
675
 
 
676
else
 
677
   SCETER(1,"SUBMEM: unknown option");
 
678
 
 
679
}
 
680
 
 
681
/*
 
682
 
 
683
*/
 
684
 
 
685
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
686
.COPYRIGHT   (c) 1994 European Southern Observatory
 
687
.IDENTIFIER  CONCHA_C
 
688
.LANGUAGE    C
 
689
.AUTHOR      K. Banse                           IPG-ESO Garching
 
690
.KEYWORDS    Image Display , memory board
 
691
.PURPOSE     fill the channel with a constant value
 
692
.ALGORITHM   use IDI interfaces
 
693
 
 
694
.INPUT/OUTPUT
 
695
  call as    CONCHA_C(display,chan,aux_flag,value)
 
696
 
 
697
  input:
 
698
         int  display           device id
 
699
         int  chan              memory channel no.
 
700
         int  aux_flag          if set to 1, check keyword AUX_MODE(9) first,
 
701
                                if we should update the channel;
 
702
                                AUX_MODE(9) = 1, yes do it
 
703
                                AUX_MODE(9) = 0, no don't do it
 
704
         int  value             constant to write into memory channel
 
705
 
 
706
.RETURNS     nothing
 
707
 
 
708
.VERSIONS    1.00       940325  F2C, taken from LOADWN.FOR   RvH
 
709
             1.10       960522  change meaning of parameter #3, KB
 
710
------------------------------------------------------------*/
 
711
 
 
712
 
 
713
void CONCHA_C(display,chan,aux_flag,value)
 
714
int display, chan, aux_flag, value;
 
715
 
 
716
{
 
717
if (aux_flag == 1)              /* check AUX_MODE(9) first ... */
 
718
   {
 
719
   int iav, knul, unit, doit;
 
720
 
 
721
   (void) SCKRDI("AUX_MODE",9,1,&iav,&doit,&unit,&knul);
 
722
   if (doit != 1) return;
 
723
   }
 
724
 
 
725
 
 
726
(void) IIMCMY_C(display,&chan,1,value);
 
727
}