| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2007 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: [email protected] |
| 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 |
/* file iid2.c : contains the following routines |
| 31 |
* |
| 32 |
* IIDCLO_C : Close Display; |
| 33 |
* IIDRST_C : Reset Display; |
| 34 |
* IIDDEL_C : Delete Display; |
| 35 |
* IIDICO_C : Move Display to Icon (or back); |
| 36 |
* IIDQDV_C : Inquire Device Characteristics; |
| 37 |
* IIDQCI_C : Inquire Capability Integer; |
| 38 |
* IIDQCR_C : Inquire Capability Real; |
| 39 |
* IIDQDC_C : Inquire Defined Configuration; |
| 40 |
* IIDSDP_C : Select Display Path; |
| 41 |
* IIDSNP_C : Get Snapshot; |
| 42 |
* IIDSSS_C : Set Split Screen; |
| 43 |
* |
| 44 |
* IIDSEL_C : Select Defined Configuration; these routines |
| 45 |
* IIDUPD_C : Update Display; are not implemented |
| 46 |
* IIDIAG_C : Get Diagnostic; and already blocked |
| 47 |
* IIDERR_C : Get Error; on the client side... |
| 48 |
* |
| 49 |
************************************************************************* |
| 50 |
* V 1.1 871201: P. Santin - Trieste Astronomical Observatory |
| 51 |
* V 2.0 881130 Klaus Banse - ESO Garching |
| 52 |
|
| 53 |
070410 last modif |
| 54 |
|
| 55 |
************************************************************************* |
| 56 |
*/ |
| 57 |
|
| 58 |
# include <stdlib.h> |
| 59 |
|
| 60 |
# include <idi.h> |
| 61 |
# include <idistruct.h> |
| 62 |
# include <proto_idi.h> |
| 63 |
# include <osparms.h> |
| 64 |
|
| 65 |
/* |
| 66 |
|
| 67 |
*/ |
| 68 |
|
| 69 |
/************************************************************************ |
| 70 |
* IIDCLO_C routine : closes an opened display * |
| 71 |
* * |
| 72 |
* synopsis IIDCLO_C (display); * |
| 73 |
* * |
| 74 |
* int display; input display identifier * |
| 75 |
************************************************************************/ |
| 76 |
|
| 77 |
int IIDCLO_C (display) |
| 78 |
int display; |
| 79 |
|
| 80 |
{ |
| 81 |
int i, j; |
| 82 |
|
| 83 |
CURS_DATA *curs; |
| 84 |
ROI_DATA *roi; |
| 85 |
|
| 86 |
if (ididev[display].opened == 0) return (DEVNOTOP); |
| 87 |
|
| 88 |
/* erase any visible cursor and ROI */ |
| 89 |
|
| 90 |
j = 0; |
| 91 |
for (i=0; i<ididev[display].ncurs; i++) |
| 92 |
{ |
| 93 |
curs = ididev[display].cursor[i]; |
| 94 |
if (curs->vis != 0) |
| 95 |
{ |
| 96 |
curs->vis = 0; |
| 97 |
draw_curs(display,2,j,i,j,j,j,j); /* 'j' just dummy - not used */ |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
roi = ididev[display].roi; |
| 102 |
if ((roi->sh != -1) && (roi->vis != 0)) |
| 103 |
{ |
| 104 |
roi->vis = 0; |
| 105 |
if (roi->sh == 0) /* rectangle */ |
| 106 |
draw_rroi(display,2,j,j,j,j,j,j); |
| 107 |
else /* circle */ |
| 108 |
draw_croi(display,2,j,j,j,j,j,j,j); |
| 109 |
} |
| 110 |
|
| 111 |
if (ididev[display].n_inter != 0) |
| 112 |
IIISTI_C(display); |
| 113 |
|
| 114 |
sendX(display); /* make sure all requests are flushed */ |
| 115 |
ididev[display].opened = 0; |
| 116 |
|
| 117 |
return(II_SUCCESS); |
| 118 |
} |
| 119 |
|
| 120 |
/* |
| 121 |
|
| 122 |
*/ |
| 123 |
|
| 124 |
/************************************************************************ |
| 125 |
* IIDRST_C routine : resets an opened display * |
| 126 |
* * |
| 127 |
* synopsis IIDRST_C (display); * |
| 128 |
* * |
| 129 |
* int display; input display identifier * |
| 130 |
************************************************************************/ |
| 131 |
|
| 132 |
int IIDRST_C (display) |
| 133 |
int display; |
| 134 |
|
| 135 |
{ |
| 136 |
int j, k, m; |
| 137 |
int x0, y0; |
| 138 |
|
| 139 |
ITT_DATA *itt; |
| 140 |
CURS_DATA *curs; |
| 141 |
ROI_DATA *roi; |
| 142 |
CONF_DATA *conf; |
| 143 |
MEM_DATA *mem; |
| 144 |
ALPH_DATA *alph; |
| 145 |
|
| 146 |
/* check if ididev has been opened */ |
| 147 |
|
| 148 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 149 |
|
| 150 |
ididev[display].inter_mask = 0; |
| 151 |
IIISTI_C(display); /* reset pending interactions */ |
| 152 |
|
| 153 |
x0 = ididev[display].xsize / 2; |
| 154 |
y0 = ididev[display].ysize / 2; |
| 155 |
|
| 156 |
m = 0; /* dummy place holder */ |
| 157 |
for (j=0; j<ididev [display].ncurs; j++) /* disable cursors */ |
| 158 |
{ |
| 159 |
curs = ididev [display].cursor[j]; |
| 160 |
curs->sh = -1; |
| 161 |
curs->col = 0; |
| 162 |
curs->xpos = x0; |
| 163 |
curs->ypos = y0; |
| 164 |
if (curs->vis != 0) |
| 165 |
{ |
| 166 |
curs->vis = 0; |
| 167 |
draw_curs(display,2,m,j,m,m,m,m); /* 'm' just dummy par ... */ |
| 168 |
} |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
roi = ididev[display].roi; /* disable ROIs */ |
| 173 |
roi->sh = -1; |
| 174 |
roi->col = 0; |
| 175 |
roi->xmin = x0 - 20; |
| 176 |
roi->ymin = y0 - 20; |
| 177 |
roi->xmax = x0 + 20; |
| 178 |
roi->ymax = y0 + 20; |
| 179 |
roi->radiusi = 20; |
| 180 |
roi->radiusm = 0; |
| 181 |
roi->radiuso = 0; |
| 182 |
|
| 183 |
if (roi->vis != 0) |
| 184 |
{ |
| 185 |
roi->vis = 0; |
| 186 |
if (roi->sh == 0) /* rectangle */ |
| 187 |
draw_rroi(display,2,m,m,m,m,m,m); |
| 188 |
else /* circle */ |
| 189 |
draw_croi(display,2,m,m,m,m,m,m,m); |
| 190 |
} |
| 191 |
|
| 192 |
conf = ididev [display].confptr; /* reset config + mem structure */ |
| 193 |
if (conf->RGBmode == 1) |
| 194 |
{ |
| 195 |
mem = conf->memory[0]; |
| 196 |
clgraph(mem); |
| 197 |
clmem(mem); |
| 198 |
|
| 199 |
if (mem->mmbm != (char *) 0) |
| 200 |
{ |
| 201 |
k = 0; |
| 202 |
m = IIMCMY_C(display,&k,1,0); /* clear channel */ |
| 203 |
if (ididev[display].alpno >= 90) |
| 204 |
{ |
| 205 |
alph = conf->alpmem[0]; |
| 206 |
for (k=0; k<10; k++) alph->savx[k] = -1; |
| 207 |
if (mem->visibility == 1) clalph(display,0,0,0,0); |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
else |
| 213 |
{ |
| 214 |
for (k=0; k<conf->nmem; k++) |
| 215 |
{ |
| 216 |
mem = conf->memory[k]; |
| 217 |
if (mem->mmbm != (char *) 0) |
| 218 |
m = IIMCMY_C(display,&k,1,0); /* clear channel */ |
| 219 |
itt = mem->ittpntr; |
| 220 |
if (itt != (ITT_DATA *)0) itt->vis = 0; /* avoid it for overlay chan */ |
| 221 |
} |
| 222 |
|
| 223 |
/* clear also alpha numerics if it's main window */ |
| 224 |
|
| 225 |
if (ididev[display].alpno >= 90) |
| 226 |
m = IIMCMY_C(display,&ididev[display].alpno,1,0); |
| 227 |
} |
| 228 |
|
| 229 |
|
| 230 |
loc_zero(display); /* reset locators */ |
| 231 |
initgra(display); /* reset graphics functions */ |
| 232 |
|
| 233 |
return(m); |
| 234 |
} |
| 235 |
|
| 236 |
/* |
| 237 |
|
| 238 |
*/ |
| 239 |
|
| 240 |
void waste_disp(dspno) |
| 241 |
int dspno; |
| 242 |
|
| 243 |
{ |
| 244 |
int j, k; |
| 245 |
|
| 246 |
INTBAR *bar; |
| 247 |
CONF_DATA *conf; |
| 248 |
MEM_DATA *mem; |
| 249 |
GLIST *gr; |
| 250 |
|
| 251 |
|
| 252 |
/* |
| 253 |
printf("wasting display %d, links = %d,%d\n", |
| 254 |
dspno,ididev[dspno].link[0],ididev[dspno].link[1]); |
| 255 |
*/ |
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
if (ididev[dspno].hcopy != (char *) 0) /* see if we had a hardcopy */ |
| 260 |
destroy(dspno,"hcopy"); |
| 261 |
|
| 262 |
if (ididev[dspno].alpno >= 90) /* see if we have alpha memory */ |
| 263 |
destroy(dspno,"alpha"); |
| 264 |
|
| 265 |
bar = ididev[dspno].bar; |
| 266 |
if (bar != 0) |
| 267 |
{ |
| 268 |
if (bar->wp == 1) /* check if we already created the rest */ |
| 269 |
destroy(dspno,"lutbar"); |
| 270 |
free(ididev[dspno].bar); |
| 271 |
} |
| 272 |
|
| 273 |
if (ididev[dspno].lookup != 0) /* free LUT data structure */ |
| 274 |
free(ididev[dspno].lookup); |
| 275 |
|
| 276 |
for (j=0; j<ididev[dspno].ncurs; j++) /* kill cursor structs */ |
| 277 |
free(ididev[dspno].cursor[j]); |
| 278 |
|
| 279 |
free(ididev[dspno].roi); /* kill ROI struct */ |
| 280 |
|
| 281 |
if (ididev[dspno].devtyp != 'c') |
| 282 |
{ |
| 283 |
for (j=0; j<MAX_INTER; j++) |
| 284 |
free(ididev[dspno].inter[j]); |
| 285 |
|
| 286 |
for (j=0; j<intdevtable[dspno].nloc; j++) |
| 287 |
free(intdevtable[dspno].loc[j]); |
| 288 |
|
| 289 |
|
| 290 |
for (j=0; j<intdevtable[dspno].ntrig; j++) |
| 291 |
free(intdevtable[dspno].trig[j]); |
| 292 |
} |
| 293 |
else |
| 294 |
{ |
| 295 |
j = -ididev[dspno].curswin; |
| 296 |
ididev[j].curswin = -1; /* reset also main window */ |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
conf = ididev[dspno].confptr; |
| 301 |
destroy(dspno,"memory"); /* kill XImages of all memories */ |
| 302 |
|
| 303 |
for (k=0; k<conf->nmem; k++) |
| 304 |
{ |
| 305 |
mem = conf->memory[k]; |
| 306 |
if (mem->ittpntr != (ITT_DATA *)0) free((char *)mem->ittpntr); |
| 307 |
|
| 308 |
if ( (ididev[dspno].alpno >= 90) && (conf->overlay != k) ) |
| 309 |
free((char *)conf->alpmem[k]); |
| 310 |
|
| 311 |
if (mem->gpntr != (GLIST *)0) |
| 312 |
{ |
| 313 |
gr = mem->gpntr; |
| 314 |
free((char *)gr->x); |
| 315 |
free((char *)mem->gpntr); |
| 316 |
} |
| 317 |
if (mem->tpntr != (TLIST *)0) free((char *)mem->tpntr); |
| 318 |
|
| 319 |
free(mem); /* finally kill memory itself */ |
| 320 |
} |
| 321 |
free(conf); /* and configuration structure */ |
| 322 |
|
| 323 |
|
| 324 |
/* now get rid of the window */ |
| 325 |
|
| 326 |
destroy(dspno,"display"); |
| 327 |
sendX(dspno); /* Flush out */ |
| 328 |
|
| 329 |
|
| 330 |
/* finally free this entry in structure ididev */ |
| 331 |
|
| 332 |
ididev[dspno].devname[0] = '\0'; |
| 333 |
ididev[dspno].link[0] = 0; |
| 334 |
ididev[dspno].link[1] = -1; |
| 335 |
ididev[dspno].opened = 0; |
| 336 |
} |
| 337 |
|
| 338 |
/* |
| 339 |
|
| 340 |
*/ |
| 341 |
|
| 342 |
/************************************************************************ |
| 343 |
* IIDDEL_C routine : delete display device structures |
| 344 |
* |
| 345 |
* synopsis IIDDEL (display,nodels,imindx,grindx) |
| 346 |
* |
| 347 |
* char[] display; input device name |
| 348 |
* int *nodels; output no. of open display windows destroyed |
| 349 |
* int *imindx; output dspno of image display still left, |
| 350 |
* else -1 is returned |
| 351 |
* int *grindx; output dspno of graphics display still left, |
| 352 |
* else -1 is returned |
| 353 |
************************************************************************/ |
| 354 |
|
| 355 |
int IIDDEL_C (display,nodels,imindx,grindx) |
| 356 |
char display[]; |
| 357 |
int *nodels, *imindx, *grindx; |
| 358 |
|
| 359 |
{ |
| 360 |
char ct, cbuf[12]; |
| 361 |
|
| 362 |
int i, j, k, m, l, indx; |
| 363 |
int delcnt, imix, grix, shadow[MAX_DEV], allflg; |
| 364 |
int parent_window, devs[MAX_DEV]; |
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
*nodels = 0, shadow[0] = -1; |
| 369 |
allflg = 0; delcnt = 0; imix = -1; grix = -1; |
| 370 |
parent_window = -1, indx = MAX_DEV-1; |
| 371 |
|
| 372 |
for (i=0; i<MAX_DEV; i++) devs[i] = -1; /* init to no destroy */ |
| 373 |
|
| 374 |
|
| 375 |
/* if not wildcard, search for device with that name */ |
| 376 |
|
| 377 |
if (display[0] != '*') |
| 378 |
{ |
| 379 |
for (i=0; i<MAX_DEV; i++) |
| 380 |
{ |
| 381 |
if (strcmp(ididev[i].devname,display) == 0) |
| 382 |
{ |
| 383 |
devs[indx--] = i; /* enter indx in destr. list */ |
| 384 |
for (j=0; j<MAX_DEV; j++) |
| 385 |
{ |
| 386 |
k = ididev[i].shadow[j]; /* also all `shadows' */ |
| 387 |
if (k != -1) devs[indx--] = k; |
| 388 |
} |
| 389 |
goto entry_found; |
| 390 |
} |
| 391 |
} |
| 392 |
return(DEVNAMERR); /* no device to delete... */ |
| 393 |
|
| 394 |
|
| 395 |
entry_found: |
| 396 |
if (ididev[i].link[0] == 1) /* are we parent window? */ |
| 397 |
{ /* Yes. look for subwindows */ |
| 398 |
float rdum; |
| 399 |
|
| 400 |
do_misc(i,1,-1,cbuf,&k,&rdum); /* we have to reset rootw */ |
| 401 |
parent_window = i; |
| 402 |
|
| 403 |
for (i=0; i<MAX_DEV; i++) |
| 404 |
{ |
| 405 |
if (ididev[i].devname[0] != '\0') |
| 406 |
{ |
| 407 |
k = ididev[i].link[1]; |
| 408 |
if (k == parent_window) |
| 409 |
devs[indx--] = i; |
| 410 |
else if (k > -1) |
| 411 |
{ |
| 412 |
m = ididev[k].link[1]; |
| 413 |
if (m == parent_window) |
| 414 |
devs[indx--] = i; |
| 415 |
else if (m > -1) |
| 416 |
{ /* we only follow max 3 links */ |
| 417 |
j = ididev[m].link[1]; |
| 418 |
if (j == parent_window) devs[indx--] = i; |
| 419 |
} |
| 420 |
} |
| 421 |
} |
| 422 |
} |
| 423 |
} |
| 424 |
} |
| 425 |
|
| 426 |
else |
| 427 |
{ |
| 428 |
indx = 0; |
| 429 |
for (i=0; i<MAX_DEV; i++) |
| 430 |
{ |
| 431 |
/* |
| 432 |
printf("ididev[%d].devtyp = %c, devname = %s\n", |
| 433 |
i,ididev[i].devtyp,ididev[i].devname); |
| 434 |
*/ |
| 435 |
|
| 436 |
if ((ididev[i].devtyp == display[1]) && |
| 437 |
(ididev[i].devname[0] != '\0')) |
| 438 |
devs[indx++] = i; |
| 439 |
} |
| 440 |
} |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
/* now get rid of all structures for ididev[i] */ |
| 445 |
|
| 446 |
for (i=0; i<MAX_DEV; i++) |
| 447 |
{ |
| 448 |
if (devs[i] > -1) /* index of window to get rid of? */ |
| 449 |
{ |
| 450 |
k = devs[i]; |
| 451 |
allflg++; |
| 452 |
(void) strcpy(cbuf,ididev[k].devname); /* save name */ |
| 453 |
waste_disp(k); |
| 454 |
delcnt++; |
| 455 |
|
| 456 |
(void) strcat(cbuf,"z"); /* zoom window exists for display? */ |
| 457 |
for (j=0; j<MAX_DEV; j++) |
| 458 |
{ |
| 459 |
if (strcmp(ididev[j].devname,cbuf) == 0) |
| 460 |
{ |
| 461 |
waste_disp(j); /* also this one out */ |
| 462 |
delcnt++; |
| 463 |
devs[j] = -1; |
| 464 |
break; /* single zoom window only */ |
| 465 |
} |
| 466 |
} |
| 467 |
} |
| 468 |
} |
| 469 |
|
| 470 |
if (allflg == 0) return(DEVNAMERR); /* no device to delete... */ |
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
/* find out what is left, so we can assign it as display/graphics w. */ |
| 475 |
|
| 476 |
m = 0; l = 0; |
| 477 |
|
| 478 |
for (i=0; i<MAX_DEV; i++) |
| 479 |
{ |
| 480 |
ct = ididev[i].devname[5]; /* get display no */ |
| 481 |
if (ididev[i].devname[0] != '\0') |
| 482 |
{ |
| 483 |
if ((ididev[i].devtyp == 'i') && (m == 0)) |
| 484 |
{ |
| 485 |
if ((ct >= '0') && (ct <= '9')) |
| 486 |
imix = ct - 48; /* return image no. */ |
| 487 |
else |
| 488 |
imix = 0; |
| 489 |
m = 1; |
| 490 |
} |
| 491 |
else if ((ididev[i].devtyp == 'g') && (l == 0)) |
| 492 |
{ |
| 493 |
if ((ct >= '0') && (ct <= '9')) |
| 494 |
grix = ct - 48; /* return graphics no. */ |
| 495 |
else |
| 496 |
grix = 0; |
| 497 |
l = 1; |
| 498 |
} |
| 499 |
} |
| 500 |
} |
| 501 |
|
| 502 |
|
| 503 |
*imindx = imix; |
| 504 |
*grindx = grix; |
| 505 |
*nodels = delcnt; |
| 506 |
|
| 507 |
|
| 508 |
return(II_SUCCESS); |
| 509 |
} |
| 510 |
|
| 511 |
/* |
| 512 |
|
| 513 |
*/ |
| 514 |
|
| 515 |
/************************************************************************ |
| 516 |
* IIDQDV_C routine : inquire ididev characteristics * |
| 517 |
* * |
| 518 |
* synopsis IIDQDV_C (display , nconf , xdev , ydev , depthdev , * |
| 519 |
* maxlutn , maxittn , maxcurn); * |
| 520 |
* * |
| 521 |
* int display; input display identifier * |
| 522 |
* int *nconf; output no. of configurations * |
| 523 |
* int *xdev; output ididev X dimensions * |
| 524 |
* int *ydev; output ididev Y dimensions * |
| 525 |
* int *depthdev; output ididev depth * |
| 526 |
* int *maxlutn; output max no. of LUTs * |
| 527 |
* int *mmaxittn; output max no. of ITTs * |
| 528 |
* int *maxcurn; output max no. of cursors * |
| 529 |
************************************************************************/ |
| 530 |
|
| 531 |
int IIDQDV_C (display, nconf, xdev, ydev, depthdev, maxlutn, maxittn, |
| 532 |
maxcurn) |
| 533 |
int display , *nconf , *xdev , *ydev , *depthdev; |
| 534 |
int *maxlutn , *maxittn , *maxcurn; |
| 535 |
|
| 536 |
{ |
| 537 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 538 |
|
| 539 |
*nconf = 1; |
| 540 |
|
| 541 |
*xdev = ididev[display].xsize; |
| 542 |
*ydev = ididev[display].ysize; |
| 543 |
*depthdev = ididev[display].depth; |
| 544 |
|
| 545 |
*maxlutn = 1; |
| 546 |
*maxittn = 1; |
| 547 |
*maxcurn = ididev[display].ncurs; |
| 548 |
|
| 549 |
return(II_SUCCESS); |
| 550 |
} |
| 551 |
|
| 552 |
/* |
| 553 |
|
| 554 |
*/ |
| 555 |
|
| 556 |
/************************************************************************ |
| 557 |
* IIDQCI_C routine : inquire ididev capabilities integer * |
| 558 |
* * |
| 559 |
* synopsis IIDQCI_C (display , devcap , size , capdata , ncap) * |
| 560 |
* * |
| 561 |
* * |
| 562 |
* int display; input display identifier * |
| 563 |
* int devcap; input ididev capability integer code * |
| 564 |
* int size; input capability array size * |
| 565 |
* int capdata[]; output ididev capabilities array * |
| 566 |
* int *ncap; output ididev capabilities array size * |
| 567 |
************************************************************************/ |
| 568 |
|
| 569 |
int IIDQCI_C (display , devcap , size , capdata , ncap) |
| 570 |
int display , devcap , size , capdata[] , *ncap; |
| 571 |
|
| 572 |
{ |
| 573 |
int no; |
| 574 |
|
| 575 |
if (ididev[display].opened == 0) |
| 576 |
{ |
| 577 |
*ncap = 0; |
| 578 |
return(DEVNOTOP); |
| 579 |
} |
| 580 |
|
| 581 |
no = ididev[display].screen; |
| 582 |
if (devcap == 15) |
| 583 |
{ |
| 584 |
capdata[0] = Xworkst[no].nolut; |
| 585 |
*ncap = 1; |
| 586 |
} |
| 587 |
|
| 588 |
else if (devcap == 17) |
| 589 |
{ |
| 590 |
capdata[0] = 1; |
| 591 |
capdata[1] = MAX_ZOOM; |
| 592 |
*ncap = 2; |
| 593 |
} |
| 594 |
|
| 595 |
else if (devcap == 18) |
| 596 |
{ |
| 597 |
capdata[0] = Xworkst[no].nolut; |
| 598 |
capdata[1] = Xworkst[no].lutlen; |
| 599 |
capdata[2] = ididev[display].lutoff; |
| 600 |
capdata[3] = Xworkst[no].lutflag; |
| 601 |
if ((Xworkst[no].visual == 4) && (Xworkst[no].ownlut == 0)) |
| 602 |
capdata[4] = 5; /* Pseudo on TrueColor */ |
| 603 |
else |
| 604 |
capdata[4] = Xworkst[no].visual; /* 2, 3 or 4 */ |
| 605 |
capdata[5] = Xworkst[no].width; |
| 606 |
capdata[6] = Xworkst[no].height; |
| 607 |
*ncap = 7; |
| 608 |
} |
| 609 |
|
| 610 |
return(II_SUCCESS); |
| 611 |
|
| 612 |
} |
| 613 |
|
| 614 |
/* |
| 615 |
|
| 616 |
*/ |
| 617 |
/************************************************************************ |
| 618 |
* IIDQCR_C routine : inquire ididev capabilities real * |
| 619 |
* * |
| 620 |
* synopsis IIDQCR_C (display , devcap , size , capdata , ncap) * |
| 621 |
* * |
| 622 |
* int display; input display identifier * |
| 623 |
* int devcap; input ididev capability integer code * |
| 624 |
* int size; input capability array size * |
| 625 |
* float capdata[]; output ididev capabilities array * |
| 626 |
* int *ncap; output ididev capabilities number * |
| 627 |
************************************************************************/ |
| 628 |
|
| 629 |
int IIDQCR_C (display , devcap , size , capdata , ncap) |
| 630 |
int display , devcap , size , *ncap; |
| 631 |
float capdata[]; |
| 632 |
|
| 633 |
{ |
| 634 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 635 |
|
| 636 |
return(II_SUCCESS); |
| 637 |
} |
| 638 |
|
| 639 |
/* |
| 640 |
|
| 641 |
*/ |
| 642 |
|
| 643 |
/************************************************************************ |
| 644 |
* IIDQDC_C routine : inquire defined configuration * |
| 645 |
* * |
| 646 |
* synopsis IIDQDC_C (display , confn , memtyp , maxmem , confmode , * |
| 647 |
* mlist, mxsize , mysize , mdepth , ittdepth , * |
| 648 |
* nmem); * |
| 649 |
* * |
| 650 |
* * |
| 651 |
* int display; input display identifier * |
| 652 |
* int confn; input configuration number * |
| 653 |
* int memtyp; input memory type * |
| 654 |
* available types IMAGE = 1 * |
| 655 |
* TEXT = 2 * |
| 656 |
* GRAPH = 4 * |
| 657 |
* int maxmem; input max memory number * |
| 658 |
* int *confmode output configuration mode * |
| 659 |
* [1=mono - 2=pseudocolor - 3=RGB] * |
| 660 |
* int mlist[]; output memories id list * |
| 661 |
* int mxsize[]; output memories x size * |
| 662 |
* int mysize[]; output memories y size * |
| 663 |
* int mdepth[]; output memories depth * |
| 664 |
* int ittlen[]; output associated ITTs length * |
| 665 |
* int *nmem; output no. of memories in configuration * |
| 666 |
************************************************************************/ |
| 667 |
|
| 668 |
int IIDQDC_C (display , confn , memtyp , maxmem , confmode , |
| 669 |
mlist, mxsize , mysize , mdepth , ittlen , nmem) |
| 670 |
int display, confn , memtyp , maxmem , *confmode , *nmem; |
| 671 |
int mlist[] , mxsize[] , mysize[] , mdepth[] , ittlen[]; |
| 672 |
|
| 673 |
{ |
| 674 |
CONF_DATA *conf; |
| 675 |
MEM_DATA *mem; |
| 676 |
|
| 677 |
int m, no; |
| 678 |
|
| 679 |
|
| 680 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 681 |
|
| 682 |
conf = ididev[display].confptr; /* `confn' is ignored... */ |
| 683 |
if (memtyp == 4) /* graphics memory type */ |
| 684 |
m = conf->overlay; |
| 685 |
else if (memtyp == 1) |
| 686 |
m = conf->memid; |
| 687 |
else |
| 688 |
return (BADINPUT); |
| 689 |
|
| 690 |
*confmode = 2; |
| 691 |
mem = conf->memory[m]; |
| 692 |
mlist[0] = m; |
| 693 |
mxsize[0] = mem->xsize; |
| 694 |
mysize[0] = mem->ysize; |
| 695 |
mdepth[0] = mem->depth; |
| 696 |
no = ididev[display].screen; |
| 697 |
ittlen[0] = Xworkst[no].lutlen; |
| 698 |
*nmem = 1; |
| 699 |
|
| 700 |
return(II_SUCCESS); |
| 701 |
} |
| 702 |
|
| 703 |
/* |
| 704 |
|
| 705 |
*/ |
| 706 |
|
| 707 |
/************************************************************************ |
| 708 |
* IIDSDP_C routine : select display path * |
| 709 |
* * |
| 710 |
* synopsis IIDSDP_C (display , memlist , nmem , lutflag , ittflag) * |
| 711 |
* * |
| 712 |
* int display; input display identifier * |
| 713 |
* int memlist[]; input memory list * |
| 714 |
* int nmem; input no. of memories * |
| 715 |
* int lutflag[]; input LUT flags * |
| 716 |
* int ittflag[]; input ITT flags * |
| 717 |
************************************************************************/ |
| 718 |
|
| 719 |
int IIDSDP_C (display , memlist , nmem , lutflag , ittflag) |
| 720 |
int display , nmem; |
| 721 |
int memlist[] , lutflag[] , ittflag[]; |
| 722 |
|
| 723 |
{ |
| 724 |
CONF_DATA *conf; |
| 725 |
MEM_DATA *mem; |
| 726 |
LUT_DATA *lut; |
| 727 |
ITT_DATA *itt; |
| 728 |
|
| 729 |
int m, no; |
| 730 |
|
| 731 |
|
| 732 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 733 |
if (nmem > 1) return (FNCNOTIMPL); |
| 734 |
|
| 735 |
no = ididev[display].screen; |
| 736 |
if (Xworkst[no].ownlut != 1) return(II_SUCCESS); |
| 737 |
|
| 738 |
conf = ididev[display].confptr; |
| 739 |
m = memlist[0]; |
| 740 |
if (m != conf->overlay) conf->memid = m; /* update current memid */ |
| 741 |
|
| 742 |
mem = conf->memory[m]; |
| 743 |
itt = mem->ittpntr; |
| 744 |
|
| 745 |
lut = ididev[display].lookup; |
| 746 |
if (lutflag[0] != -1) lut->vis = lutflag[0]; |
| 747 |
if (ittflag[0] != -1) itt->vis = ittflag[0]; |
| 748 |
wr_lut(display,lut,lut->vis); |
| 749 |
|
| 750 |
return(II_SUCCESS); |
| 751 |
} |
| 752 |
|
| 753 |
/************************************************************************ |
| 754 |
* IIDSSS_C routine : set split screen * |
| 755 |
* synopsis IIDSSS_C (display,memid,xoff,yoff,splitf,splitx,splity) * |
| 756 |
* int display; input display identifier * |
| 757 |
* int memid[]; input memory id list * |
| 758 |
* int xoff[]; input X offsets * |
| 759 |
* int yoff[]; input Y offsets * |
| 760 |
* int splitf; input split flag * |
| 761 |
* int splitx; input X split location * |
| 762 |
* int splity; input Y split location * |
| 763 |
************************************************************************/ |
| 764 |
|
| 765 |
int IIDSSS_C (display, memid, xoff, yoff, splitf, splitx, splity) |
| 766 |
int display , splitf , splitx , splity; |
| 767 |
int *memid, *xoff, *yoff; |
| 768 |
|
| 769 |
{ |
| 770 |
return(FNCNOTIMPL); /* currently not implemented */ |
| 771 |
} |
| 772 |
|
| 773 |
/* |
| 774 |
|
| 775 |
*/ |
| 776 |
|
| 777 |
/*********************************************************************** |
| 778 |
* IIDSNP_C routine : create snapshot * |
| 779 |
* * |
| 780 |
* synopsis IIDSNP_C (display , colmode , npixel , xoff , yoff , * |
| 781 |
* depth , packf , data); * |
| 782 |
* * |
| 783 |
* int display input display identifier * |
| 784 |
* int colmode input color mode * |
| 785 |
* int npixel input no. of data pixel * |
| 786 |
* int xoff input X offset * |
| 787 |
* int yoff input Y offset * |
| 788 |
* int depth input data depth * |
| 789 |
* int packf input packing factor * |
| 790 |
* unsigned char data[] output out data * |
| 791 |
************************************************************************/ |
| 792 |
|
| 793 |
int IIDSNP_C (display , colmode , npixel , xoff , yoff , depth , packf , |
| 794 |
data) |
| 795 |
int display , colmode , npixel , xoff , yoff , depth , packf; |
| 796 |
unsigned char *data; |
| 797 |
|
| 798 |
{ |
| 799 |
MEM_DATA *mem; |
| 800 |
ITT_DATA *itt; |
| 801 |
CONF_DATA *conf; |
| 802 |
|
| 803 |
int j, xsize, ix, iy, dx, dy; |
| 804 |
|
| 805 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 806 |
|
| 807 |
conf = ididev[display].confptr; |
| 808 |
if (ididev[display].devtyp != 'g') |
| 809 |
{ |
| 810 |
if (conf->memid == conf->overlay) return(ILLMEMID); |
| 811 |
} |
| 812 |
|
| 813 |
dx = ididev[display].xsize; |
| 814 |
dy = ididev[display].ysize; |
| 815 |
iy = ((npixel-1) / dx) + 1; /* no. of rows to write */ |
| 816 |
ix = npixel / iy; |
| 817 |
if ((yoff + iy) > dy) return(IMGTOOBIG); |
| 818 |
|
| 819 |
yoff = (dy - 1 - yoff) * dx; |
| 820 |
xsize = -dx; |
| 821 |
mem = conf->memory[conf->memid]; |
| 822 |
|
| 823 |
|
| 824 |
/* get the hardcopy of the active window */ |
| 825 |
|
| 826 |
get_hcopy(display,mem,conf->memid); |
| 827 |
|
| 828 |
|
| 829 |
/* and now pull it over */ |
| 830 |
|
| 831 |
j = 0; |
| 832 |
if (conf->RGBmode == 0) /* plain Pseudocolor mode */ |
| 833 |
{ |
| 834 |
itt = mem->ittpntr; |
| 835 |
if (itt != (ITT_DATA *)0) j = itt->vis; |
| 836 |
rd_mem(display,0,mem,1,ididev[display].hcopy,xoff,yoff,xsize,ix,iy,j,data); |
| 837 |
} |
| 838 |
else /* all other need 3 planes */ |
| 839 |
rd_mem(display,1,mem,1,ididev[display].hcopy,xoff,yoff,xsize,ix,iy,j,data); |
| 840 |
|
| 841 |
return(II_SUCCESS); |
| 842 |
} |
| 843 |
|
| 844 |
/* |
| 845 |
|
| 846 |
*/ |
| 847 |
|
| 848 |
/************************************************************************ |
| 849 |
* IIDICO_C routine : moves an opened display to an icon (or back) * |
| 850 |
* * |
| 851 |
* synopsis IIDICO_C (display,flag); * |
| 852 |
* * |
| 853 |
* int display; input display identifier * |
| 854 |
* int flag; input 1 = window -> icon |
| 855 |
0 = icon -> window |
| 856 |
************************************************************************/ |
| 857 |
|
| 858 |
int IIDICO_C (display,flag) |
| 859 |
int display, flag; |
| 860 |
|
| 861 |
{ |
| 862 |
|
| 863 |
if (ididev[display].opened == 0) return(DEVNOTOP); |
| 864 |
|
| 865 |
iconify(display,flag); |
| 866 |
|
| 867 |
return 0; |
| 868 |
} |