DAS  3.1.6 - 18/09/2017
Spat_Plot.c
Go to the documentation of this file.
1 #include <windows.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <malloc.h>
6 #include <math.h>
7 #include <io.h>
8 #include <direct.h>
9 #include <fcntl.h>
10 #include <sys/stat.h>
11 #include "mgui.h"
12 #include "DAS_Spatram.h"
13 #include "dcl.h"
14 #include "dil.h"
15 #include "bil.h"
16 #include "DOAS.h"
17 
24 // CCD & Camera vars
25 ccd DC_CCD; // CCD settings
26 ptf DC_HP; // Platform settings
27 config Cfg; // Camera controls & Options
30 //flag FLAG; //flags structure
31 //paramini PARAM; //Param.ini
32 //marc MARC; // Marconi struct
33 //tools TOOLS; //tools structure
34 //d_geo DGEO; // geographical coordinates structure
35 bil BIL; //Bortul Library Structure
36 //GratingSt GRS; //Grating
38 
40 
42 
43 
44 
45 
48 
49 
50 
52 
53 /****************************************************/
54 
55 
56 void DrawButtons(int nhidlbef, int nhidlaft, int nr)
57 {
58 
59 
60  int i;
61  static int NewnR;
62  static x = 0;
63 
64  if(BIL.DPLOT.RowShell != 0)
65  {
68  BIL.DPLOT.RowShell = 0;
69  }
70 
71 
72 
73 /*
74  if(BIL.SPH.ccdnr != BIL.DPLOT.OLDnR + 1)
75  {
76  deallocamat();
77  allocamat();
78  }
79 */
80  if(nr != BIL.DPLOT.OLDnR + 1)
81  {
82 
83  if(nr < 16)
84  {
85 
86  //ButtFrmWidth = MObjectGetWidth(BIL.VFO.formbutt);
87  //ButtSpace = ButtFrmWidth/BIL.SPH.ccdnr;
88  //ButtWidth = 70;
89 
90 
91  for (i=nhidlbef; i < nr - nhidlaft; i++)
92  {
93  MObjectMap(BIL.DPLOT.pbr[i]);
94 // NewnR ++;
95  }
96 
97  if(nhidlaft > NewnR)
98  {
99  for (i= nr - nhidlaft; i<nr;i++)
100  MObjectUnmap(BIL.DPLOT.pbr[i]);
101  }
102 
103 
104 
105  NewnR = nr - nhidlaft - nhidlbef;
106 
107 // BIL.SPH.ccdnr;
108  }
109  else
110  {
111 // if(x == 0)
112 // {
113 // x=1;
114  MD_CreateBRowShell(nr);
115 // }
116  }
117  BIL.DPLOT.OLDnR= nr;
118  }
119 
120 }
121 
122 
123 /****************************************************************/
124 void AllocMat()
125 {
126 
127  unsigned long mx;
128 
129 
130 // IDX = (BIL.SPH.ccdex - BIL.SPH.ccdsx);
131 // IDY = (BIL.SPH.ccdey - BIL.SPH.ccdsy) / BIL.SPH.ccdvb;
132 
133  IDX = BIL.SPH.ccdwx ;
134  IDY = BIL.SPH.ccdnr +1;
135 
136 
137  mx = (unsigned long) IDX * (unsigned long) IDY;
138  BIL.DPLOT.ImatGraf = (unsigned short *) calloc( mx, sizeof(unsigned short));
139 
140  BIL.DPLOT.ImatOrig = (unsigned short *) calloc( mx, sizeof(unsigned short));
141 }
142 /****************************************************************/
143 
144 /****************************************************************/
145 unsigned short* DeallocUSMat(unsigned short *mat)
146 {
147  free(mat);
148  mat = 0;
149  return mat;
150 
151 }
152 
153 float* DeallocFloatMat(float *mat)
154 {
155  free(mat);
156  mat = 0;
157  return mat;
158 
159 }
160 
162 {
163 
164 // unsigned long mx;
165 
166  free(BIL.DPLOT.ImatGraf);
167  BIL.DPLOT.ImatGraf = 0;
168  free(BIL.DPLOT.ImatOrig);
169 }
170 
171 
172 
173 /*****************************************************/
174 /*****************************************************/
175 /*
176  Conversion of the x value of the draw area in CCD pixel
177 */
178 int X2Counts(int x)
179 {
180 
181  return (int)((x - BIL.DPLOT.oX) / BIL.DPLOT.COSTX);
182 
183 }
184 /*****************************************************/
185 /*****************************************************/
186 /*
187  Conversion of the y value of the draw area in ADU counts
188 */
189 
190 unsigned int Y2Counts(int y)
191 {
192 
193  return - (int)BIL.DPLOT.COSTY * (y - BIL.DPLOT.oY) + BIL.DPLOT.Imin;
194 
195 }
196 /*****************************************************/
197 
198 
199 /*****************************************************
200  * This Callback handles the mouse input events
201  * in the Object
202  *****************************************************/
203 void DB_AreaInput(MOBJECT obj, MEvent *pe, void *a_data)
204 {
205  static int x1, y1, x2, y2, dx, dy;
206  static int xp1, xp2, xp3, yp1, yp2, yp3, p, pol;
207  char buff[128];
208  static int s, f;
209 // int c;
210  MOBJECT shell;
211 
212  switch (pe->type)
213  {
214 
215  case E_SELECT:
216 
217  break;
218  case E_WINDOW_EXIT:
219 
220  break;
221  case E_BUTTON_PRESS:
222  break;
223  case E_WINDOW_ENTER:
224  case E_MOTION:
225  shell = MObjectShell(obj);
226  // Drag di un vertice del poligono
227  if((pe->mouse.state & Button1Mask) && pol)
228  {
229  if(pol == 2)
230  {
231  MDrawXorLine(obj, xp1, yp1, xp2, yp2);
232  MDrawXorLine(obj, xp1, yp1, xp3, yp3);
233  }
234  pol = 2;
235  xp1 = pe->mouse.x;
236  yp1 = pe->mouse.y;
237 
238  }
239  else
240  {
241  if((pe->mouse.state & Button1Mask) && x1 > 0 && f)
242  {
243  /*
244  * Erase the old line and draw the new one
245  * while dragging the mouse (draw in Xor mode)
246  */
247  if(f == 2)
248  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
249  f = 2;
250  MDrawXorBox(obj, x1, y1, (pe->mouse.x - x1), (pe->mouse.y - y1));
251  }
252  // Drag the box
253  if((pe->mouse.state & Button3Mask) && f == 4)
254  {
255  // Clear previous box
256  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
257  x1 += (pe->mouse.x - dx); x2 += (pe->mouse.x - dx);
258  y1 += (pe->mouse.y - dy); y2 += (pe->mouse.y - dy);
259  MDrawXorBox(obj, x1, y1, (x2 - x1), (y2 - y1));
260  dx = pe->mouse.x;
261  dy = pe->mouse.y;
262  }
263  else
264  {
265 // MDrawXorBox(obj, x2 - 25, y2 - 25, 50, 50);
266 
267  x2 = pe->mouse.x;
268  BIL.BLENS.LocX = x2 / (int) BIL.BLENS.Pix;
269  y2 = pe->mouse.y;
270  BIL.BLENS.LocY = y2 / (int) BIL.BLENS.Pix;
271 
272 // MDrawXorBox(obj, LocX[s] - 25, LocY[s] - 25, 50, 50);
273  if(BIL.BLENS.LocX >= 0 && BIL.BLENS.LocX < (unsigned int) MObjectGetWidth(obj) &&
274  BIL.BLENS.LocY >= 0 && BIL.BLENS.LocY < (unsigned int) MObjectGetHeight(obj) )
275  {
276  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
277  {
278 
279  if(BIL.DPLOT.ImatGraf != 0)
280  {
281 
282  if(FLAG.Wl == 0)
283  {
284  BIL.BLENS.S_LocX = X2Counts(BIL.BLENS.LocX);
285  sprintf(buff, "%5d", BIL.BLENS.S_LocX);
286  MObjectSetText(BIL.VFO.xloc, buff);
287 
288  sprintf(buff, "Dx = %.2lf", BIL.DPLOT.COSTX);
289  MObjectSetText(BIL.VFO.xincr, buff);
290  }
291  else if(FLAG.Wl == 1)
292  {
293  BIL.BLENS.S_LocX = (unsigned int)DOAS.lambda[X2Counts(BIL.BLENS.LocX)];
294  sprintf(buff, "%.1lf",DOAS.lambda[X2Counts(BIL.BLENS.LocX)] );
295  MObjectSetText(BIL.VFO.xloc, buff);
296 
297  sprintf(buff, "Dx = %.2lf", BIL.DPLOT.COSTX);
298  MObjectSetText(BIL.VFO.xincr, buff);
299  }
300  else if(FLAG.Wl == 2)
301  {
302  BIL.BLENS.S_LocX = (unsigned int)DOAS.lambda[X2Counts(BIL.BLENS.LocX)];
303  sprintf(buff, "%.2lf",DOAS.lambda[X2Counts(BIL.BLENS.LocX)]/10 );
304  MObjectSetText(BIL.VFO.xloc, buff);
305 
306  sprintf(buff, "Dx = %.2lf", BIL.DPLOT.COSTX);
307  MObjectSetText(BIL.VFO.xincr, buff);
308  }
309 
310 
311  BIL.BLENS.S_LocY = Y2Counts(BIL.BLENS.LocY);
312  sprintf(buff, "%5u", BIL.BLENS.S_LocY);
313  MObjectSetText(BIL.VFO.yloc, buff);
314 
315  sprintf(buff, "Dy = %.2lf", BIL.DPLOT.COSTY);
316  MObjectSetText(BIL.VFO.yincr, buff);
317 
318  }
319  }
320 
321  if(BIL.BLENS.LensON)
322  {
323  BIL.BLENS.S_LocX = X2Counts(BIL.BLENS.LocX);
324  sprintf(buff, "%5d, Wl: %.2lf", BIL.BLENS.S_LocX, DOAS.lambda[BIL.BLENS.S_LocX]);
325  MObjectSetText(BIL.BLENS.LensLblX, buff);
326 
327  //Wavelength
328  //sprintf(buff, "%5d", DOAS.lambda[BIL.BLENS.S_LocX]);
329  //MObjectSetText(BIL.BLENS.LensLblWl, buff);
330 
331  BIL.BLENS.S_LocY = Y2Counts(BIL.BLENS.LocY);
332  sprintf(buff, "%5u", BIL.BLENS.S_LocY);
333  MObjectSetText(BIL.BLENS.LensLblY, buff);
334 
335  sprintf(buff, "DY=%5u", (int) BIL.DPLOT.COSTY);
336  MObjectSetText(BIL.BLENS.LensLbl, buff);
337 
338  D_DoLens(BIL.BLENS.LensMim, BIL.BLENS.LensDraw, BIL.BLENS.LensWx, BIL.BLENS.LensWy, BIL.BLENS.LensPix, BIL.BLENS.LocX, BIL.BLENS.LocY);
339 
340  }
341 
342  }
343  }
344  }
345 
346  break;
347  case E_BUTTON_RELEASE:
348  break;
349  }
350 }
351 /*****************************************************/
352 
353 /*****************************************************/
354 void InitImage(MIMAGE img, int xd, int yd, int rb, int gb, int bb)
355 {
356  int i, k;
357 
358  for (i=0;i<xd;i++)
359  {
360  for (k=0;k<yd;k++)
361  {
362  MImageSetPixelRGB(img, i , k, rb, gb, bb);
363  }
364  }
365 
366 }
367 
368 
369 
370 void DrawImg(MIMAGE img, int a, int c, int x, int y)
371 {
372 
373  int r, g, b;
374 
375  switch(a)
376  {
377  //Gray
378  case 259:
379  r = 192;
380  g = 192;
381  b = 192;
382  break;
383  //colors
384  default:
385  r = MTCL.dr[a];
386  g = MTCL.dg[a];
387  b = MTCL.db[a];
388  break;
389  }
390 
391  MImageSetPixelRGB(img, x , y, r, g, b);
392 
393 }
394 /****************************************************************/
395 /*
396 Draw one Y line
397  input:
398  Destination image -> MIMAGE img
399  Fixed X value -> int xfix
400  Start Y value -> int ys
401  End Y value -> int ye
402  red, green, blue id -> int r, int g, int b
403 */
404 void DrawYLine(MIMAGE img, int xfix, int ys, int ye, int r, int g, int b)
405 {
406  int y;
407 
408  for(y = ys; y<ye; y++)
409  MImageSetPixelRGB(img, xfix , y, r, g, b);
410 
411 }
412 /****************************************************************/
413 /****************************************************************/
414 /*
415 Draw one X line
416  input:
417  Destination image -> MIMAGE img
418  Fixed Y value -> int yfix
419  Start X value -> int xs
420  End X value -> int xe
421  red, green, blue id -> int r, int g, int b
422 */
423 void DrawXLine(MIMAGE img, int yfix, int xs, int xe, int r, int g, int b)
424 {
425  int x;
426 
427  for(x = xs; x < xe; x++)
428  MImageSetPixelRGB(img, x , yfix, r, g, b);
429 
430 }
431 /****************************************************************/
433 {
434 
435  BIL.DPLOT.wsize = MObjectGetWidth(obj);
436  BIL.DPLOT.hsize = MObjectGetHeight(obj);
437 
438  BIL.DPLOT.oX = 10; //Origine asse X
439  BIL.DPLOT.oY = BIL.DPLOT.hsize - 10; //Origine asse Y
440  BIL.DPLOT.eX = BIL.DPLOT.wsize - 10; //Fine asse X
441  BIL.DPLOT.eY = 10; //Fine asse Y
442 
443 
444 }
445 /****************************************************************/
446 
447 /****************************************************************/
448 void D_PlotAxis(MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey, MTColor col)
449 {
450 
451  //Axis Y Left
452  //DrawArea
453  MDrawLine(ob, sx, sy, sx, ey, col);
454  //Image
455  DrawYLine(mim, sx, ey, sy, 0,0,0);
456 
457  //Axis X Down
458  //DrawArea
459  MDrawLine(ob, sx, sy, ex, sy, col);
460  DrawXLine(mim, sy, sx, ex + 1, 0,0,0);
461 
462  //Axis X Up
463  //DrawArea
464  MDrawLine(ob, sx, ey, ex, ey, col);
465  DrawXLine(mim, sx, sx, ex, 0,0,0);
466 
467  //Axis Y Right
468  //DrawArea
469  MDrawLine(ob, ex, sy, ex, ey, col);
470  DrawYLine(mim, ex, ey, sy, 0,0,0);
471 
472 }
473 /****************************************************************/
474 
475 /****************************************************************/
476 void D_PlotGrid(MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey)
477 {
478  int X1, X, Y1, Y;
479  int j;
480  double incry, incrx;
481  // Y Grid
482  incry = (sy - ey) / 10;
483  for(j = 1; j < 10; j++)
484  {
485  X = sx +1 ;
486  Y = sy - ((int)incry * j);
487  X1 = ex;
488  Y1 = sy - ((int)incry * j);
489  MDrawLine(ob, X, Y, X1, Y1, MTCL.white);
490  DrawXLine(mim, Y, X, X1, 255,255,255);
491 
492  }
493  //X Grid
494  incrx = (double)(ex - sx) / 16.0;
495  for(j = 1; j < 16; j++)
496  {
497  X = sx + 1 + ((int)incrx * j);
498  Y = sy;
499  X1 = sx + 1 + ((int)incrx * j);
500  Y1 = ey + 1;
501  if(j == 8)
502  {
503  MDrawLine(ob, X, Y, X1, Y1, MTCL.green);
504  DrawYLine(mim, X, Y1, Y, 0, 255, 0);
505  }
506  else
507  {
508  MDrawLine(ob, X, Y, X1, Y1, MTCL.white);
509  DrawYLine(mim, X, Y1, Y, 255,255,255);
510  }
511  }
512 }
513 /****************************************************************/
514 
515 /****************************************************************/
516 void PoslblX(MOBJECT lbl, int xs, int xe, int xc)
517 {
518  int xd, i,k, xinf,xsup;
519  char buf[16];
520  int linter;
521  double linterinf, lintersup;
522 
523 
524 
525  if (xc)
526  {
527  k = (sizeof BIL.VFO.lblX / sizeof BIL.VFO.lblX[0] ); // number of labels
528 
529  sprintf(buf,"%d", xs);
530  MObjectSetText(BIL.VFO.lblX[0], buf);
531 
532  sprintf(buf,"%d", xc);
533  MObjectSetText(BIL.VFO.lblX[k/2], buf);
534 
535  sprintf(buf,"%d", xe);
536  MObjectSetText(BIL.VFO.lblX[k -1], buf);
537 
538 
539  xinf = xc - xs;
540  xsup = xe - xc;
541 
542  linterinf = (double)xinf / (k/2);
543  lintersup = (double)xsup / (k/2);
544 
545  for (i = k/2 - 1 ;i> 0; i--)
546  {
547  sprintf(buf,"%.0lf", xc - ((k/2 - i) * linterinf) );
548 
549  MObjectSetText(BIL.VFO.lblX[i], buf);
550  }
551  for (i = k/2 + 1 ;i< k - 1; i++)
552  {
553  sprintf(buf,"%.0lf", xc + ((i - k/2) * lintersup) );
554 
555  MObjectSetText(BIL.VFO.lblX[i], buf);
556  }
557 
558  }
559  else
560  {
561  xd = xe - xs + 1;
562  linter = xd / (sizeof BIL.VFO.lblX / sizeof BIL.VFO.lblX[0] - 1);
563  k = (sizeof BIL.VFO.lblX / sizeof BIL.VFO.lblX[0] );
564 
565  xc = xd / 2;
566  sprintf(buf,"%d", xc);
567  MObjectSetText(BIL.VFO.lblX[k/2], buf);
568  }
569 
570 }
571 /****************************************************************/
572 
573 /****************************************************************/
574 
575 void PoslblY(unsigned int l, unsigned int h)
576 {
577 
578  unsigned int yd, i,k;
579  char buf[16];
580  unsigned int lintery;
581  yd = h - l;
582  lintery = yd / (sizeof BIL.VFO.lblY / sizeof BIL.VFO.lblY[0] - 1);
583 
584  k=sizeof BIL.VFO.lblY / sizeof BIL.VFO.lblY[0];
585  for (i =l;i<= h;i+=lintery)
586  {
587  sprintf(buf,"%u", i);
588  if(k==1)
589  sprintf(buf,"%u", h);
590  MObjectSetText(BIL.VFO.lblY[k-1], buf);
591  k--;
592  }
593 }
594 /****************************************************************/
595 double DB_FindMaxMin(int idx, int idy, unsigned int *mx, unsigned int *mi, int bp)
596 {
597  double l = 0;
598  int x, y, xi = idx , yi = idy;
599  U16 *m = BIL.DPLOT.ImatGraf;
600 // float *f = DIL.Img.Mat[w].Fmat;
601 
602 
603  *mx = 0; *mi = 65535;
604 // VRange("Find Max/Min", 0);
605  for(y = 0; y < yi; y++)
606  {
607  for(x = 3; x < xi; x++)
608  {
609  if (bp != 0)
610  {
611  if (x < xi - bp)
612  {
613  l += (double) *m;
614  *mi = min(*mi, *m);
615  *mx = max(*mx, *m);
616  m++;
617  }
618  }
619  else
620  {
621  l += (double) *m;
622  *mi = min(*mi, *m);
623  *mx = max(*mx, *m);
624  m++;
625  }
626  }
627 // if((y % 32) == 0 && y > 0)
628 // VRange(NULL, (long) y * 100 / idy);
629  }
630 // VRange(NULL, 100);
631  return l;
632 }
633 
634 /****************************************************************/
635 int D_findmaxmin(unsigned short plotmat[], int xinf, int xsup, int yinf, int ysup, int bp )
636 {
637 
638  int t, j;
639 
640  unsigned int low = 65535;
641  unsigned int high= 0;
642 
643  for(t = yinf; t < ysup; t++)
644  {
645  for(j = xinf; j < xsup; j++)
646  {
647  if (bp != 0)
648  {
649  if (j < xsup - bp)
650  {
651  if(plotmat[t * xsup + j] < low) low = plotmat[t * xsup + j];
652  if(plotmat[t * xsup + j] > high) high = plotmat[t * xsup + j];
653  }
654  }
655  else
656  {
657  if(plotmat[t * xsup + j] < low) low = plotmat[t * xsup + j];
658  if(plotmat[t * xsup + j] > high) high = plotmat[t * xsup + j];
659  }
660  }
661  }
662  BIL.DPLOT.Imin = low;
663  BIL.DPLOT.Imax = high;
664  return 0;
665 }
666 /****************************************************************/
667 
668 /****************************************************************/
669 void D_PlotOneLine(int n, int sel, MOBJECT obj, MOBJECT pb[], MIMAGE mim, unsigned short plotmat[], int idx,
670  int idy, unsigned long pe[], double costx, double costy, int min, int max,
671  int ox, int oy, int bp)
672 {
673 
674  int X1, X, Y1, Y, j;
675  if (sel)
677  else
678  MObjectSetColor(pb[n], pe[n], MTCL.white);
679 
680  for(j = 0; j < idx; j++)
681  {
682  if (bp != 0)
683  {
684  if (j < idx - bp)
685  {
686  X = (int) (ox + (j * costx));
687  Y = (int) (oy - abs((int)((double)(plotmat[n * idx + j] - min) / costy)));
688  X1 = (int) (ox + (j + 1) * costx);
689  Y1 = (int) (oy - abs((int)((double)(plotmat[n * idx + j + 1] - min) / costy)));
690  }
691  }
692  else
693  {
694  X = (int) (ox + (j * costx));
695  Y = (int) (oy - abs((int)((double)(plotmat[n * idx + j] - min) / costy)));
696  X1 = (int) (ox + (j + 1) * costx);
697  Y1 = (int) (oy - abs((int)((double)(plotmat[n * idx + j + 1] - min) / costy)));
698  }
699 
700  if (sel)
701  {
702  MDrawLine(obj, X, Y, X1, Y1, MTCL.yellow);
703  if (Y <= (int) mim->img_h)
704  DrawImg(mim, 10 , j, X, Y);
705 
706  }
707  else
708  {
709  MDrawLine(obj, X, Y, X1, Y1, pe[n]);
710 // DrawImg(mim, n + 2 , j, X, Y);
711  }
712  }
713 }
714 /****************************************************************/
715 
716 /****************************************************************/
717 void D_pbr_CB(MOBJECT p, void *od, void *ad)
718 {
719  int q = (int) ad;
720 // int t;
721 
722  //Assign limits to the Drawing coordinates
724  //Plot the axes
725  D_PlotAxis(BIL.DPLOT.drawapl, BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX, BIL.DPLOT.eY, MTCL.black);
726  //Plot grid
727  D_PlotGrid(BIL.DPLOT.drawapl, BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX, BIL.DPLOT.eY);
728 
729 
730  if(FLAG.plotYRange)
731  {
732  if(TOOLS.FlagFilter)
733  {
734  //Find Max & Min of the spectrum (BIL.DPLOT.Imax & BIL.DPLOT.Imin)
736  }
737  else
738  {
739  //Find Max & Min of the spectrum (BIL.DPLOT.Imax & BIL.DPLOT.Imin)
741  }
742  }
743  else
744  {
745  BIL.DPLOT.Imax = 65535;
746  BIL.DPLOT.Imin = 0;
747  }
748 
749 
750  if(FLAG.Wl == 0) //Pixel X Scale
751  {
752  //Positioning of X labels
753  PoslblX(BIL.VFO.lblX, 1, IDX, 0);
754  }
755  else if(FLAG.Wl == 1) //Wavelength X scale [A]
756  {
757  //CalcSpectrumLimits(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, 512);
758  Pix2Wl(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, &DOAS);
759 
760  //Positioning of X labels
761  PoslblX(BIL.VFO.lblX, (int)DOAS.lambda[0], (int)DOAS.lambda[IDX - 1], BIL.SPH.wavelen);
762  }
763  else if(FLAG.Wl == 2) //Pixel X Scale [nm]
764  {
765  //CalcSpectrumLimits(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, 512);
766  Pix2Wl(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, &DOAS);
767  //Positioning of X labels
768  PoslblX(BIL.VFO.lblX, (int)(DOAS.lambda[0]/10), (int)(DOAS.lambda[IDX - 1]/10), BIL.SPH.wavelen/10);
769  }
770  //Positioning of Y labels
771  PoslblY(BIL.DPLOT.Imin, BIL.DPLOT.Imax);
772 
773 /**********************/
774 /* Costruzione grafico dei dati ********************/
775  if(BIL.DPLOT.actimg[q])
776  {
777  D_PlotOneLine(q, BIL.DPLOT.actimg[q], BIL.DPLOT.drawapl, BIL.DPLOT.pbr, BIL.BLENS.Imim,
778  BIL.DPLOT.ImatGraf, IDX, IDY, MTCL.PLColor, BIL.DPLOT.COSTX,
779  BIL.DPLOT.COSTY, BIL.DPLOT.Imin, BIL.DPLOT.Imax, BIL.DPLOT.oX,
780  BIL.DPLOT.oY, BlindPix);
781  BIL.DPLOT.actimg[q] = 0;
782  }
783  else
784  {
785  D_PlotOneLine(q, BIL.DPLOT.actimg[q], BIL.DPLOT.drawapl, BIL.DPLOT.pbr, BIL.BLENS.Imim,
786  BIL.DPLOT.ImatGraf, IDX, IDY, MTCL.PLColor, BIL.DPLOT.COSTX,
787  BIL.DPLOT.COSTY, BIL.DPLOT.Imin, BIL.DPLOT.Imax, BIL.DPLOT.oX,
788  BIL.DPLOT.oY, BlindPix);
789  BIL.DPLOT.actimg[q] = 1;
790  }
791 
792 }
793 /****************************************************************/
794 
795 /****************************************************************/
796 void PlotSpectrum(MOBJECT obj, MOBJECT pb[], MIMAGE mim, unsigned short plotmat[], int idx,
797  int idy, unsigned long pe[], double costx, double costy, int min, int max,
798  int ox, int oy, int bp, int hlb, int hla)
799 {
800  int t, j;
801  int X1, X, Y1, Y;
802  MTColor temp;
803  for(t = hlb ; t < idy - hla ; t++)
804  {
805  temp = MObjectBackgroundColor(pb[t]);
806  if (temp != MTCL.yellow)
807  {
808  MObjectSetColor(pb[t], pe[t], MTCL.white);
809  for(j = 5; j < idx ; j++)
810  {
811  if (bp != 0)
812  {
813  if (j < idx - bp)
814  {
815  X = (int) (ox + (j * costx));
816  Y = (int) (oy - abs((int)((double)(plotmat[t * idx + j] - min) / costy)));
817  //Y = (int) (oy - ((plotmat[t * idx + j] - min) / costy));
818  X1 = (int) (ox + (j + 1) * costx);
819  Y1 = (int) (oy - abs((int)((double)(plotmat[t * idx + j + 1] - min) / costy)));
820  //Y1 = (int) (oy - ((plotmat[t * idx + j + 1] - min) / costy));
821  MDrawLine(obj, X, Y, X1, Y1, pe[t]);
822  if ((Y <= (int)mim->img_h) & (Y > 0))
823  DrawImg(mim, t , j, X, Y);
824 
825  }
826  }
827  else
828  {
829  X = (int) (ox + (j * costx));
830  Y = (int) (oy - abs((int)((double)(plotmat[t * idx + j] - min) / costy)));
831  //Y = (int) (oy - ((plotmat[t * idx + j] - min) / costy));
832  X1 = (int) (ox + (j + 1) * costx);
833  Y1 = (int) (oy - abs((int)((double)(plotmat[t * idx + j + 1] - min) / costy)));
834  //Y1 = (int) (oy - ((plotmat[t * idx + j + 1] - min) / costy));
835  MDrawLine(obj, X, Y, X1, Y1, pe[t]);
836  if ((Y <= (int)mim->img_h) & (Y > 0))
837  DrawImg(mim, t , j, X, Y);
838 
839  }
840  }
841  }
842  }
843 
844 }
845 /****************************************************************/
846 
847 void ImatInImatGraf(void)
848 {
849  int t, j;
850 
851  for(t = 0 ; t < IDY ; t++)
852  {
853  for(j = 0; j < IDX; j++)
854  {
855  BIL.DPLOT.ImatGraf[t * IDX + j] = (unsigned short) DIL.Img.Mat[Server].Imat[t * IDX + j];
856  }
857  }
858 }
859 
860 
861 void ImatGrafInImat(void)
862 {
863  int t, j;
864 
865  for(t = 0 ; t < IDY ; t++)
866  {
867  for(j = 0; j < IDX; j++)
868  {
869  DIL.Img.Mat[Server].Imat[t * IDX + j] = BIL.DPLOT.ImatGraf[t * IDX + j];
870  }
871  }
872 }
873 
874 
875 /****************************************************************/
876 int DrawAreaPlotCB(MOBJECT obj, MEvent *pexp, void *a_data)
877 {
878 
879  int i, BlindPix_1;
880  int t, j;
881  static int done = 0;
882 
883  if (DAS.Flag.exemode == DBDEMO)
884  for(t = 0; t < IDY; t++)
885  {
886  for(j = 0; j < IDX ; j++)
887  {
888  DIL.Img.Mat[Server].Imat[t * IDX + j] = (unsigned short) t+j*2;
889  }
890  }
891 
892  if (ON_OFFLINEPLOT) // If On LinePLOT
893  {
894  if(!DIL.Img.Mat[Server].Imat) //Se la matrice e' vuota o non e' inizializzata ESCE
895  {
896  //MObjectSetUnsensitive(BIL.VFO.selallpb);
897  //MObjectSetUnsensitive(BIL.VFO.YScalePB);
898  /*DIL.Img.Mat[Server].Imat = AllocUSMat(IDX, IDY); //Alloc the graph matrix
899  for(t = 0; t < IDY; t++)
900  {
901  for(j = 0; j < IDX ; j++)
902  {
903  DIL.Img.Mat[Server].Imat[t * IDX + j] = (unsigned short) t+j*2;
904  }
905  }
906  */
907  if(done == 0)
908  {
909  done = 1;
910  MMessageDialog("DAS Inf.", "CCD Array not allocated or empty", "OK", NULL);
911  }
912  return 1;
913  }
914  else
915  {
916  MObjectSetSensitive(BIL.VFO.cmdpb[0]); //Set Button "Open" Sensitive
917  MObjectSetText(BIL.VFO.cmdpb[0], "Save As");
918 
919  MObjectSetSensitive(BIL.VFO.cmdpb[7]);
920 
921  HeaderInPlot(); // it Shows the measurements parameters
922  BIL.DPLOT.ImatGraf = AllocUSMat(IDX, IDY); //Alloc the graph matrix
923  }
924 
925  }
926  else // If OFF LinePLOT
927  {
928  if(BIL.DPLOT.ImatGraf == 0)
929  return 1;
930  }
931 
932  maxplotw = MObjectGetWidth(obj);
933  maxploth = MObjectGetHeight(obj);
934 
935  MFreeImage(BIL.BLENS.Imim);
936  BIL.BLENS.Imim = MAllocImage(maxplotw, maxploth, 24);
937 
938  InitImage(BIL.BLENS.Imim, maxplotw, maxploth, 192, 192, 192);
939 
940  for(i=DAS.DOption.hlinebefore ; i < IDY - DAS.DOption.hlineafter ; i++)
941  BIL.DPLOT.actimg[i] = 1;
942 
943  //Assign limits to the Drawing coordinates
944  D_AssignOrigin(obj);
945  //Plot the axes
946  D_PlotAxis(obj, BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX,
947  BIL.DPLOT.eY, MTCL.black);
948  //Plot grid
949  D_PlotGrid(obj, BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX,
950  BIL.DPLOT.eY);
951 
952  //Filter section
953  if (ON_OFFLINEPLOT) //On LinePLOT
954  {
955 
956  if(FLAG.DispBlindPix)
957  BlindPix = 0;
958  else
959  {
960  if (DC_CCD.dx - (DAS.Paramini.ccdWx +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
961  BlindPix = DC_CCD.dx - DAS.Paramini.ccdWx-1 ;
962  }
963 
964  if(TOOLS.FlagFilter)
965  {
966  SwapMatrix(DIL.Img.Mat[Server].Imat, BIL.DPLOT.ImatGraf, IDX, IDY);
967  if (DC_CCD.dx - (DAS.Paramini.ccdWx +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
968  BlindPix_1 = DC_CCD.dx - DAS.Paramini.ccdWx-1 ;
969  FilterData(BIL.DPLOT.ImatGraf, IDX, IDY, DOAS.FFTFilter, BlindPix_1);
970  }
971  else
972  SwapMatrix(DIL.Img.Mat[Server].Imat, BIL.DPLOT.ImatGraf, IDX, IDY);
973 
974  }
975  else
976  {
977  //Display Blind pixel
978  if(FLAG.DispBlindPix)
979  BlindPix = 0;
980  else
981  {
982  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
983  BlindPix = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
984  }
985 
986 
987  //Remove Spikes and Filter data
989  {
990 
991  SwapMatrix(BIL.DPLOT.ImatOrig, BIL.DPLOT.ImatGraf, IDX, IDY);
992 
993  BlindPix_1 = 0;
994  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
995  BlindPix_1 = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
996 
997  RemoveSpikes(0, BIL.DPLOT.ImatGraf, IDX, IDY, BlindPix_1);
998  FilterData(BIL.DPLOT.ImatGraf, IDX, IDY, DOAS.FFTFilter, BlindPix_1);
999  }
1000  //Remove Spikes Only
1001  else if(!TOOLS.FlagFilter & TOOLS.FlagSpikes)
1002  {
1003 
1004  SwapMatrix(BIL.DPLOT.ImatOrig, BIL.DPLOT.ImatGraf, IDX, IDY);
1005 
1006  BlindPix_1 = 0;
1007  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1008  BlindPix_1 = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1009 
1010  RemoveSpikes(0, BIL.DPLOT.ImatGraf, IDX, IDY, BlindPix_1);
1011  }
1012  //Filter Only
1013  else if(TOOLS.FlagFilter & !TOOLS.FlagSpikes)
1014  {
1015 
1016  SwapMatrix(BIL.DPLOT.ImatOrig, BIL.DPLOT.ImatGraf, IDX, IDY);
1017 
1018  BlindPix_1 = 0;
1019  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1020  BlindPix_1 = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1021 
1022  FilterData(BIL.DPLOT.ImatGraf, IDX, IDY, DOAS.FFTFilter, BlindPix_1);
1023  }
1024  else
1025  SwapMatrix(BIL.DPLOT.ImatOrig, BIL.DPLOT.ImatGraf, IDX, IDY);
1026 
1027 
1028  }
1029  // Y Axis Range Section
1030  if(FLAG.plotYRange)
1031  {
1032  if(TOOLS.FlagFilter)
1033  {
1034  //Find Max & Min of the spectrum (BIL.DPLOT.Imax & BIL.DPLOT.Imin)
1036  IDY - DAS.DOption.hlineafter, BlindPix );
1037  }
1038  else
1039  {
1040  //Find Max & Min of the spectrum (BIL.DPLOT.Imax & BIL.DPLOT.Imin)
1042  IDY - DAS.DOption.hlineafter, BlindPix );
1043  }
1044  }
1045  else
1046  {
1047  BIL.DPLOT.Imax = 65535;
1048  BIL.DPLOT.Imin = 0;
1049  }
1050 
1051  // X Axis Mode visualization
1052  if(FLAG.Wl == 0) //Pixel X Scale
1053  {
1054  //Positioning of X labels
1055  PoslblX(BIL.VFO.lblX, 1, IDX - BlindPix, (IDX - BlindPix)/2);
1056  }
1057  else if(FLAG.Wl == 1) //Wavelength X scale [A]
1058  {
1059  //CalcSpectrumLimits(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, 424 );
1060  Pix2Wl(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, &DOAS);
1061  //Positioning of X labels
1062  PoslblX(BIL.VFO.lblX, (int)DOAS.lambda[0],
1063  (int)DOAS.lambda[IDX - 1 - BlindPix],BIL.SPH.wavelen);
1064  }
1065  else if(FLAG.Wl == 2) //Pixel X Scale [nm]
1066  {
1067  CalcSpectrumLimits(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, 424 );
1068  Pix2Wl(0, BIL.SPH.wavelen, DAS.Paramini.ccdXoff, DAS.Paramini.ccdWx + 1, &DOAS);
1069  //Positioning of X labels
1070  PoslblX(BIL.VFO.lblX, (int)(DOAS.lambda[0]/10),
1071  (int)(DOAS.lambda[IDX - 1 - BlindPix]/10), BIL.SPH.wavelen/10);
1072  }
1073 
1074  if(BIL.DPLOT.Imax - BIL.DPLOT.Imin <100)
1075  {
1076 // MShellSetTitle(BIL.VFO.View_Sh,"Min Max too close, Plotting is not possible");
1077  return 2;
1078  }
1079  else
1080  //Positioning of Y labels
1081  PoslblY(BIL.DPLOT.Imin, BIL.DPLOT.Imax);
1082 
1083  //Calculation of the adaptive parameters
1084  BIL.DPLOT.COSTY = (double)(BIL.DPLOT.Imax - BIL.DPLOT.Imin) / (double)(BIL.DPLOT.oY - BIL.DPLOT.eY);
1085  BIL.DPLOT.COSTX = (double)(BIL.DPLOT.eX - BIL.DPLOT.oX) / (double) (IDX - BlindPix);
1086 
1087  if (ON_OFFLINEPLOT) // If On LinePLOT
1088  {
1089  //Plot of the spectrum
1090  PlotSpectrum(obj, BIL.DPLOT.pbr, BIL.BLENS.Imim, BIL.DPLOT.ImatGraf, IDX ,
1091  IDY, MTCL.PLColor, BIL.DPLOT.COSTX, BIL.DPLOT.COSTY, BIL.DPLOT.Imin,
1092  BIL.DPLOT.Imax, BIL.DPLOT.oX, BIL.DPLOT.oY, BlindPix,
1094  }
1095  else
1096  {
1097  if(TOOLS.FlagDisplay == 2)
1098  {
1099  //Plot of the spectrum
1100  PlotSpectrum(obj, BIL.DPLOT.pbr, BIL.BLENS.Imim, BIL.DPLOT.ImatGraf, IDX ,
1101  IDY, MTCL.PLColor, BIL.DPLOT.COSTX, BIL.DPLOT.COSTY, BIL.DPLOT.Imin,
1102  BIL.DPLOT.Imax, BIL.DPLOT.oX, BIL.DPLOT.oY, BlindPix,
1104 
1105  PlotSpectrum(obj, BIL.DPLOT.pbr, BIL.BLENS.Imim, BIL.DPLOT.ImatOrig, IDX ,
1106  IDY, MTCL.PLColor, BIL.DPLOT.COSTX, BIL.DPLOT.COSTY, BIL.DPLOT.Imin,
1107  BIL.DPLOT.Imax, BIL.DPLOT.oX, BIL.DPLOT.oY, BlindPix,
1109  }
1110  else if(TOOLS.FlagDisplay == 1)
1111  {
1112  PlotSpectrum(obj, BIL.DPLOT.pbr, BIL.BLENS.Imim, BIL.DPLOT.ImatGraf, IDX ,
1113  IDY, MTCL.PLColor, BIL.DPLOT.COSTX, BIL.DPLOT.COSTY, BIL.DPLOT.Imin,
1114  BIL.DPLOT.Imax, BIL.DPLOT.oX, BIL.DPLOT.oY, BlindPix,
1116 
1117  }
1118  else if(TOOLS.FlagDisplay == 0)
1119  {
1120  PlotSpectrum(obj, BIL.DPLOT.pbr, BIL.BLENS.Imim, BIL.DPLOT.ImatOrig, IDX ,
1121  IDY, MTCL.PLColor, BIL.DPLOT.COSTX, BIL.DPLOT.COSTY, BIL.DPLOT.Imin,
1122  BIL.DPLOT.Imax, BIL.DPLOT.oX, BIL.DPLOT.oY, BlindPix,
1124 
1125  }
1126 
1127  }
1128 
1129  return 0;
1130 
1131 
1132 
1133 }
1134 
1135 /****************************************************************/
1136 void ReadIMG_old(FILE *file, int hp, int vp)
1137 {
1138 
1139 
1140  int x, y;
1141 
1142  for(y = 0; y < vp; y++)
1143  {
1144  for(x = 0; x < hp; x++)
1145  {
1146  fscanf(file, "%5u ", &BIL.DPLOT.ImatGraf[y * hp + x]);
1147  }
1148  }
1149 }
1150 
1151 
1152 
1153 void WriteIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
1154 {
1155  int x, y;
1156 
1157  for(x = 0; x < hp; x++)
1158  {
1159  for(y = 0; y < vp; y++)
1160  write(fd, &mat[y * hp + x], 2);
1161 
1162  }
1163 }
1164 
1165 
1166 void ReadIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
1167 {
1168  int x, y;
1169 
1170  for(x = 0; x < hp; x++)
1171  {
1172  for(y = 0; y < vp; y++)
1173  read(fd, &mat[y * hp + x], 2);
1174 
1175  }
1176 }
1177 
1178 void WriteIMG(FILE *file, unsigned short *mat, int hp, int vp)
1179 {
1180 
1181 
1182  int x, y;
1183 
1184  for(y = 0; y < vp; y++)
1185  {
1186  for(x = 0; x < hp; x++)
1187  {
1188  if((x % 10) == 0)
1189  {
1190  if(y == 0 && x == 0)
1191  {
1192  }
1193  else
1194  fprintf(file, "\n", NULL);
1195  }
1196  fprintf(file, "%5u ", mat[y * hp + x]);
1197 
1198  }
1199 
1200  }
1201  fprintf(file, "\n", NULL);
1202 
1203 
1204 }
1205 
1206 void ReadIMG(FILE *file, unsigned short *mat, int hp, int vp)
1207 {
1208 
1209 
1210  int x, y;
1211 
1212  for(y = 0; y < vp; y++)
1213  {
1214  for(x = 0; x < hp; x++)
1215  {
1216  fscanf(file, "%5u ", &mat[y * hp + x]);
1217  }
1218  }
1219 }
1220 /****************************************************************/
1221 
1222 /****************************************************************/
1223 void AssZeroMat(int hp, int vp)
1224 {
1225 
1226 
1227  int x, y;
1228 
1229  for(y = 0; y < vp; y++)
1230  {
1231  for(x = 0; x < hp; x++)
1232  {
1233  BIL.DPLOT.ImatGraf[y * hp + x] = x+y;
1234  }
1235  }
1236 }
1237 /****************************************************************/
1238 
1239 /****************************************************************/
1240 //mode = 0 --> offline plot
1241 //mode = 1 --> ONLINEPLOT
1242 void GrafoIMG(int mode)
1243 {
1244 
1246 /* if (mode)
1247  MDrawAreaSetExposeCallback(BIL.DPLOT.drawapl, DAExOnLineCB, NULL);
1248  else
1249  MDrawAreaSetExposeCallback(BIL.DPLOT.drawapl, DrawAreaExposeCB, NULL);
1250 */
1252  MObjectRedraw(BIL.DPLOT.drawapl);
1253 
1254 }
1255 /****************************************************************/
1256 
1257 int DB_CloseImage(int s)
1258 {
1259  int c;
1260 
1261 
1262  DIL.Img.Iacc[s] = 0;
1263  DIL.Img.LshX[s] = MObjectGetX(DIL.Img.Isrv[s]);
1264  DIL.Img.LshY[s] = MObjectGetY(DIL.Img.Isrv[s]);
1265  DIL.Img.DimX[s] = MObjectGetWidth(DIL.Img.Isrv[s]);
1266  DIL.Img.DimY[s] = MObjectGetHeight(DIL.Img.Isrv[s]);
1267 
1268  MShellUnrealize(DIL.Img.Isrv[s]);
1269  MShellDestroy(DIL.Img.Isrv[s]);
1270  MFreeImage(DIL.Img.Imim[s]);
1273 
1274 
1275  if(DIL.Img.Mat[s].col)
1276  {
1277  free(DIL.Img.Mat[s].Rmat);
1278  free(DIL.Img.Mat[s].Gmat);
1279  free(DIL.Img.Mat[s].Bmat);
1280  }
1281  if(DIL.Img.Mat[s].type == INTIMG)
1282  free(DIL.Img.Mat[s].Imat);
1283  if(DIL.Img.Mat[s].type == FLTIMG)
1284  free(DIL.Img.Mat[s].Fmat);
1285  free(DIL.Img.H.Histo[s]);
1286 
1287  // DeAlloc palette
1288  if(DIL.Img.Mat[s].col)
1289  for(c = 0; c < 256; c++)
1290  {
1291  MFreeColor(DIL.Img.RPAL[s][c]);
1292  MFreeColor(DIL.Img.GPAL[s][c]);
1293  MFreeColor(DIL.Img.BPAL[s][c]);
1294  }
1295  else
1296  for(c = 0; c < 256; c++)
1297  MFreeColor(DIL.Img.iPAL[s][c]);
1298 
1299  return 0;
1300 }
1301 
1302 
1303 /****************************************************************/
1304 void CloseFile(FILE *fd, int hp, int vp)
1305 {
1306 
1307  int i;
1308 
1309 
1310  fclose(fd); //Close Data file
1311 
1312 
1313 // MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 0, 0, 0);
1314 
1315  if(BIL.DPLOT.RowShell != 0)
1316  {
1319  BIL.DPLOT.RowShell = 0;
1322 
1323  }
1324  else
1325  {
1326  for (i=DAS.DOption.hlinebefore; i < BIL.SPH.ccdnr - DAS.DOption.hlineafter; i++)
1327  MObjectUnmap(BIL.DPLOT.pbr[i]);
1330 
1331 
1332  }
1333 
1334  MShellSetTitle(BIL.VFO.View_Sh,"PLOTTING File: None");
1335 
1336 
1337  MObjectSetText(BIL.VFO.cmdpb[0], "Open");
1338  MObjectSetSensitive(BIL.VFO.cmdpb[0]); //Set Button "Open" Sensitive
1339  MObjectSetUnsensitive(BIL.VFO.cmdpb[1]); //Set button "Next" Unsensitive
1340  MObjectSetUnsensitive(BIL.VFO.cmdpb[8]); //Set button "Previuos" Unsensitive
1341  MObjectSetUnsensitive(BIL.VFO.cmdpb[3]); // Set "CloseFile" button as Unsensitive
1342  MObjectSetUnsensitive(BIL.VFO.cmdpb[4]); // Set "Print" button as Unsensitive
1343  MObjectSetUnsensitive(BIL.VFO.cmdpb[7]);
1344  MObjectSetUnsensitive(BIL.VFO.cmdpb[6]);
1345  MObjectSetSensitive(BIL.VFO.cmdpb[5]); //Set Button "CloseWin" Sensitive
1346  MObjectSetUnsensitive(BIL.VFO.cmdpb[2]); // Set "Set as Io" button as Unsensitive
1347 
1348  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
1349  {
1352  }
1353 
1354  if (ContFP)
1355  ContFP = 0;
1356 
1357 
1358  if(DAS.Flag.exemode == OFFLINEPLOT )
1359  {
1367  }
1368  else if(DAS.Flag.exemode == DOASMODE)
1369  {
1376 
1377  }
1378 
1379 
1380 }
1381 /****************************************************************/
1382 void CloseFile_BIN(int fd, int hp, int vp)
1383 {
1384 
1385  int i;
1386 
1387 
1388  close(fd); //Close Data file
1389 
1390 
1391 // MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 0, 0, 0);
1392 
1393  if(BIL.DPLOT.RowShell != 0)
1394  {
1397  BIL.DPLOT.RowShell = 0;
1400 
1401  }
1402  else
1403  {
1404  for (i=DAS.DOption.hlinebefore; i < BIL.SPH.ccdnr - DAS.DOption.hlineafter; i++)
1405  MObjectUnmap(BIL.DPLOT.pbr[i]);
1408 
1409 
1410  }
1411 
1412  MShellSetTitle(BIL.VFO.View_Sh,"PLOTTING File: None");
1413 
1414 
1415  MObjectSetText(BIL.VFO.cmdpb[0], "Open");
1416  MObjectSetSensitive(BIL.VFO.cmdpb[0]); //Set Button "Open" Sensitive
1417  MObjectSetUnsensitive(BIL.VFO.cmdpb[1]); //Set button "Next" Unsensitive
1418  MObjectSetUnsensitive(BIL.VFO.cmdpb[8]); //Set button "Previuos" Unsensitive
1419  MObjectSetUnsensitive(BIL.VFO.cmdpb[3]); // Set "CloseFile" button as Unsensitive
1420  MObjectSetUnsensitive(BIL.VFO.cmdpb[4]); // Set "Print" button as Unsensitive
1421  MObjectSetUnsensitive(BIL.VFO.cmdpb[7]);
1422  MObjectSetUnsensitive(BIL.VFO.cmdpb[6]);
1423  MObjectSetSensitive(BIL.VFO.cmdpb[5]); //Set Button "CloseWin" Sensitive
1424  MObjectSetUnsensitive(BIL.VFO.cmdpb[2]); // Set "Set as Io" button as Unsensitive
1425 
1426  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
1427  {
1430  }
1431 
1432 
1433  if (ContFP)
1434  ContFP = 0;
1435 
1436 
1437 
1438  if(DAS.Flag.exemode == OFFLINEPLOT )
1439  {
1447  }
1448  else if(DAS.Flag.exemode == DOASMODE)
1449  {
1456  }
1457 
1458 
1459 }
1460 
1461 
1462 
1463 void DestroyArrayObj(MOBJECT obj[], int n)
1464 {
1465  int i;
1466  for (i=0; i < n ; i++)
1467  {
1468 
1469  MObjectDestroy(obj[i]);
1470  }
1471 }
1472 /****************************************************************/
1473 
1474 /****************************************************************/
1475 int HeaderInPlot(void)
1476 {
1477 
1478  char str[64], buf[16];
1479 
1480 
1481  MObjectSetText(BIL.VFO.lblloc, DAS.DGeo.s_name);
1482 
1483  sprintf(str,"%.2lf", DAS.DGeo.latitude);
1484  MObjectSetText(BIL.VFO.lbllat, str);
1485 
1486  sprintf(str,"%.2lf", DAS.DGeo.longitude);
1487  MObjectSetText(BIL.VFO.lbllong, str);
1488 
1489  sprintf(str,"%.0lf", DAS.DGeo.alititude);
1490  MObjectSetText(BIL.VFO.lblalt, str);
1491 
1492  sprintf(str,"%.2lf", S_zenetr);
1493  MObjectSetText(BIL.VFO.lblsza, str);
1494 
1495  sprintf(str,"%d/%02d/%02d", DIL.Img.Mat[Server].DATE.da_year,DIL.Img.Mat[Server].DATE.da_mon, DIL.Img.Mat[Server].DATE.da_day);
1496  MObjectSetText(BIL.VFO.lbldate, str);
1497 
1498  sprintf(str,"%2d:%02d:%02d", DIL.Img.Mat[Server].TIME.ti_hour, DIL.Img.Mat[Server].TIME.ti_min, DIL.Img.Mat[Server].TIME.ti_sec);
1499  MObjectSetText(BIL.VFO.lbltime, str);
1500 
1501 
1502 
1503  if (DAS.Paramini.EqType == TROPOGAS || DAS.Paramini.EqType == SPATRAM3 || DAS.Paramini.EqType == GASCODNG4)
1504  sprintf(buf, "%s",Mir_CodeTropo[MIS.Pos]);
1505  else
1506  sprintf(buf, "%s",Mir_Code[MIS.Pos]);
1507 
1508  MObjectSetText(BIL.VFO.lblmirpos, buf);
1509 
1510  sprintf(str,"%d", wl[GRS.Wl]);
1511  MObjectSetText(BIL.VFO.lblwaveleng, str);
1512  /***********************************************************************/
1513  //Filter wheel section
1514  if ( DAS.Paramini.EqType == LIS_)
1516  else
1517  {
1518  if(DAS.Paramini.EqType == TROPOGAS)
1520  else if (DAS.Paramini.EqType == GASCODNG2 || DAS.Paramini.EqType == GASCODNG3 || DAS.Paramini.EqType == GASCODNG4)
1522  else if (DAS.Paramini.EqType == GASCODNG1)
1524 
1525  else
1527  }
1528  /***********************************************************************/
1529  //Neutral Density Filter section
1530  if(DAS.DOption.filtertype == 1) // Double filter wheel
1531  {
1532 
1534 
1535 
1536  }
1537  if(DAS.DOption.filtertype == 2) // Filter Wheel + Torque motor
1538  {
1539  if (BIL.SPH.dummy3)
1540  MObjectSetText(BIL.VFO.lblndfilter, "ON");
1541  else
1542  MObjectSetText(BIL.VFO.lblndfilter, "OFF");
1543 
1544  }
1545 
1546 
1547 
1548  /***********************************************************************/
1549 
1550 
1551  sprintf(str,"%.2lf", DAS.Marconi.CCDTemp);
1552  MObjectSetText(BIL.VFO.lblccdtemp, str);
1553 
1554  sprintf(str,"%.3lf", TExp);
1555  MObjectSetText(BIL.VFO.lblccdtexp, str);
1556 
1557 
1558  if(DAS.DOption.measmode == 1) //measuring with average
1559  {
1560  if(DAS.DOption.avgmode == 0)
1561  sprintf(str,"%d", N_AVG); // number of measurements in fixed number of measurements
1562  else
1563  sprintf(str,"%d", N_RM); // number of measurements in fixed exposure time
1564  }
1565  else
1566  sprintf(str,"%d", "1");
1567 
1568  MObjectSetText(BIL.VFO.lblnummeas, str);
1569 
1570  sprintf(str,"%u", (unsigned int)DIL.Img.Mat[Server].High);
1571  MObjectSetText(BIL.VFO.lblmax, str);
1572 
1573  sprintf(str,"%u", (unsigned int)DIL.Img.Mat[Server].Low);
1574  MObjectSetText(BIL.VFO.lblmin, str);
1575 
1576  sprintf(str,"%d", DC_CCD.dx);
1577  MObjectSetText(BIL.VFO.lblccdwx, str);
1578 
1579  sprintf(str,"%d", DC_CCD.dy);
1580  MObjectSetText(BIL.VFO.lblccdwy, str);
1581 
1582 
1583 
1584  sprintf(str,"%d", DAS.Paramini.ccdXoff);
1585  MObjectSetText(BIL.VFO.lblccdsx, str);
1586 
1587  sprintf(str,"%d", DAS.Paramini.ccdYoff);
1588  MObjectSetText(BIL.VFO.lblccdsy, str);
1589 
1590  sprintf(str,"%d", DAS.Paramini.ccdWx);
1591  MObjectSetText(BIL.VFO.lblccdex, str);
1592 
1593  sprintf(str,"%d", DAS.Paramini.ccdWy);
1594  MObjectSetText(BIL.VFO.lblccdey, str);
1595 
1596  sprintf(str,"%d", DAS.Paramini.VBin);
1597  MObjectSetText(BIL.VFO.lblvb, str);
1598 
1599  sprintf(str,"%d", DC_CCD.dy/DAS.Paramini.VBin);
1600  MObjectSetText(BIL.VFO.lblnr, str);
1601 
1602 
1603  BIL.SPH.ccdwx = DC_CCD.dx;
1604  BIL.SPH.ccdwy = DC_CCD.dy;
1605  BIL.SPH.ccdnr = DC_CCD.dy/DAS.Paramini.VBin;
1606 
1607  BIL.SPH.ccdex = DAS.Paramini.ccdWx;//DC_CCD.dx;
1608  BIL.SPH.ccdsx = DAS.Paramini.ccdXoff;
1609  BIL.SPH.ccdey = DAS.Paramini.ccdWy; //DC_CCD.dy;
1610  BIL.SPH.ccdsy = DAS.Paramini.ccdYoff;
1611  BIL.SPH.ccdvb =DAS.Paramini.VBin;
1612 
1613  BIL.SPH.wavelen = wl[GRS.Wl];
1614 
1615 
1616  MObjectSetSensitive(BIL.VFO.cmdpb[4]); // Set "Print" button as sensitive
1617  MObjectSetSensitive(BIL.VFO.cmdpb[6]);
1618 
1619  return 0;
1620 
1621 
1622 }
1623 
1624 
1625 int MD_CreateBRowShell(int nrows)
1626 {
1627  int i, er = 0;
1628  MOBJECT _tablefrm000;
1629 // MOBJECT _shell001;
1630  char buf[64];
1631 // MOBJECT Esc_But;
1632 
1633  BIL.DPLOT.RowShell = MCreateShell("CCD ROWS", 0);
1634  MObjectSetBackgroundRGB(BIL.DPLOT.RowShell, 97, 105, 88);
1636 
1637  _tablefrm000 = MCreateTableForm(BIL.DPLOT.RowShell, 20);
1638  MObjectSetBackgroundRGB(_tablefrm000, 91, 74, 74);
1639  MObjectSetResize(_tablefrm000, True, True);
1640 
1641 
1642  for (i=DAS.DOption.hlinebefore; i < nrows - DAS.DOption.hlineafter; i++)
1643  {
1644  sprintf(buf,"r. %3d", i+1);
1645  BIL.DPLOT.pbr[i] = MCreatePButton(_tablefrm000, buf, HELV_SMALL);
1648  MPButtonSetCallback(BIL.DPLOT.pbr[i], D_pbr_CB, (void *) i);
1649  //MObjectSetBackgroundRGB(pbr[i], 197, 197, 144);
1650  MObjectSetShadow(BIL.DPLOT.pbr[i], WS_ETCHED_IN, 2, 1);
1651  }
1652 
1653  MShellRealizeXY(BIL.DPLOT.RowShell, 0, 0);
1654 
1655  return 0;
1656 
1657 }
1658 
1659 
1660 
1662 {
1663 
1664  unsigned char str[128];
1665 
1666 
1667  sprintf(str,"%s",BIL.SPH.location);
1668  MObjectSetText(BIL.VFO.lblloc, str);
1669 
1670  sprintf(str,"%.2lf", BIL.SPH.latitude);
1671  MObjectSetText(BIL.VFO.lbllat, str);
1672 
1673  sprintf(str,"%.2lf", BIL.SPH.longitude);
1674  MObjectSetText(BIL.VFO.lbllong, str);
1675 
1676  sprintf(str,"%u", BIL.SPH.altitude);
1677  MObjectSetText(BIL.VFO.lblalt, str);
1678 
1679  sprintf(str,"%.2lf", BIL.SPH.sza);
1680  MObjectSetText(BIL.VFO.lblsza, str);
1681 
1682  sprintf(str,"%.2lf", (float)BIL.SPH.dummy1/100);
1683  MObjectSetText(BIL.VFO.lblZenith, str);
1684 
1685  sprintf(str,"%.2lf", (float)BIL.SPH.dummy2/100);
1686  MObjectSetText(BIL.VFO.lblAzimuth, str);
1687 
1688 
1689 
1690  sprintf(str,"%d/%02d/%02d", BIL.SPH.DATE.da_year,BIL.SPH.DATE.da_mon, BIL.SPH.DATE.da_day);
1691  MObjectSetText(BIL.VFO.lbldate, str);
1692 
1693  sprintf(str,"%02d:%02d:%02d", BIL.SPH.TIME.ti_hour, BIL.SPH.TIME.ti_min, BIL.SPH.TIME.ti_sec);
1694  MObjectSetText(BIL.VFO.lbltime, str);
1695 
1697 
1698  sprintf(str,"%d", BIL.SPH.wavelen);
1699  MObjectSetText(BIL.VFO.lblwaveleng, str);
1700 
1702 
1703 
1704  /***********************************************************************/
1705  //Neutral Density Filter section
1706  if(DAS.DOption.filtertype == 1) // Double filter wheel
1707  {
1708 
1710 
1711 
1712  }
1713  if(DAS.DOption.filtertype == 2) // Filter Wheel + Torque motor
1714  {
1715  if (BIL.SPH.dummy3)
1716  MObjectSetText(BIL.VFO.lblndfilter, "ON");
1717  else
1718  MObjectSetText(BIL.VFO.lblndfilter, "OFF");
1719 
1720  }
1721 
1722 
1723 
1724  /***********************************************************************/
1725 
1726 
1727 
1728 
1729  sprintf(str,"%.2lf", BIL.SPH.ccdtemp);
1730  MObjectSetText(BIL.VFO.lblccdtemp, str);
1731 
1732  sprintf(str,"%.3lf", BIL.SPH.ccdtexp);
1733  MObjectSetText(BIL.VFO.lblccdtexp, str);
1734 
1735  sprintf(str,"%d", BIL.SPH.dummy4);
1736  MObjectSetText(BIL.VFO.lblnummeas, str);
1737 
1738  sprintf(str,"%u", BIL.SPH.ccdmax);
1739  MObjectSetText(BIL.VFO.lblmax, str);
1740 
1741  sprintf(str,"%u", BIL.SPH.ccdmin);
1742  MObjectSetText(BIL.VFO.lblmin, str);
1743 
1744 
1745  sprintf(str,"%d", BIL.SPH.ccdwx);
1746  MObjectSetText(BIL.VFO.lblccdwx, str);
1747 
1748  sprintf(str,"%d", BIL.SPH.ccdwy);
1749  MObjectSetText(BIL.VFO.lblccdwy, str);
1750 
1751 
1752 
1753  sprintf(str,"%d", BIL.SPH.ccdsx);
1754  MObjectSetText(BIL.VFO.lblccdsx, str);
1755 
1756  sprintf(str,"%d", BIL.SPH.ccdsy);
1757  MObjectSetText(BIL.VFO.lblccdsy, str);
1758 
1759  sprintf(str,"%d", BIL.SPH.ccdex);
1760  MObjectSetText(BIL.VFO.lblccdex, str);
1761 
1762  sprintf(str,"%d", BIL.SPH.ccdey);
1763  MObjectSetText(BIL.VFO.lblccdey, str);
1764 
1765  sprintf(str,"%d", BIL.SPH.ccdvb);
1766  MObjectSetText(BIL.VFO.lblvb, str);
1767 
1768  sprintf(str,"%d", BIL.SPH.ccdnr);
1769  MObjectSetText(BIL.VFO.lblnr, str);
1770 
1771  //IDX = BIL.SPH.ccdex - BIL.SPH.ccdsx + 1;
1772 
1773  IDX = BIL.SPH.ccdwx;
1775 
1776  //if (DAS.Paramini.EqType == SPATRAM2 || DAS.Paramini.EqType == GASCODNG3 || DAS.Paramini.EqType == GASCODNG4)
1777  if(BIL.SPH.ccdwy == 256)
1778  IDY = BIL.SPH.ccdnr + 1;
1779  else
1780  IDY = BIL.SPH.ccdnr;
1781 
1782  if(BIL.SPH.ccdnr == 253)
1783  {
1784  IDY = IDY + 1;
1785  }
1786 
1787  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1788  {
1789 
1790  BlindPix = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1791 
1792  }
1793 
1794 
1795 
1796 }
1797 
1798 int ReadHeader_BIN(int fd)
1799 {
1800 
1801  unsigned long info = 0;
1802 
1803 
1804 
1805  if(eof( fd ))
1806  {
1807  return 1;
1808  }
1809  else
1810  {
1811 
1812  info =0;
1813 
1814  info += read(fd, BIL.SPH.location, sizeof(BIL.SPH.location));
1815  info += read(fd, &BIL.SPH.latitude, sizeof(BIL.SPH.latitude));
1816  info += read(fd, &BIL.SPH.longitude, sizeof(BIL.SPH.longitude));
1817  info += read(fd, &BIL.SPH.altitude, sizeof(BIL.SPH.altitude));
1818  info += read(fd, &BIL.SPH.sza, sizeof(BIL.SPH.sza));
1819  info += read(fd, &BIL.SPH.DATE, sizeof(struct ddate));
1820  info += read(fd, &BIL.SPH.TIME, sizeof(struct dtime));
1821 
1822  info += read(fd, BIL.SPH.mirpos, sizeof(BIL.SPH.mirpos));
1823  info += read(fd, &BIL.SPH.wavelen, sizeof(BIL.SPH.wavelen));
1824  info += read(fd, BIL.SPH.filpos, sizeof(BIL.SPH.filpos));
1825 
1826  info += read(fd, &BIL.SPH.ccdtemp, sizeof(BIL.SPH.ccdtemp));
1827  info += read(fd, &BIL.SPH.ccdtexp, sizeof(BIL.SPH.ccdtexp));
1828  info += read(fd, &BIL.SPH.ccdmax, sizeof(BIL.SPH.ccdmax));
1829  //Attenzione - manca il valore del minimo ( anche nella routine di scrittura)
1830  info += read(fd, &BIL.SPH.imgtype, sizeof(BIL.SPH.imgtype));
1831  info += read(fd, &BIL.SPH.ccdwx, sizeof(BIL.SPH.ccdwx));
1832  info += read(fd, &BIL.SPH.ccdwy, sizeof(BIL.SPH.ccdwy));
1833  info += read(fd, &BIL.SPH.ccdsx, sizeof(BIL.SPH.ccdsx));
1834  info += read(fd, &BIL.SPH.ccdsy, sizeof(BIL.SPH.ccdsy));
1835  info += read(fd, &BIL.SPH.ccdex, sizeof(BIL.SPH.ccdex));
1836  info += read(fd, &BIL.SPH.ccdey, sizeof(BIL.SPH.ccdey));
1837  info += read(fd, &BIL.SPH.ccdvb, sizeof(BIL.SPH.ccdvb));
1838  info += read(fd, &BIL.SPH.ccdnr, sizeof(BIL.SPH.ccdnr));
1839  info += read(fd, &BIL.SPH.dummy1, sizeof(BIL.SPH.dummy1));
1840  info += read(fd, &BIL.SPH.dummy2, sizeof(BIL.SPH.dummy2));
1841  info += read(fd, &BIL.SPH.dummy3, sizeof(BIL.SPH.dummy3));
1842  info += read(fd, &BIL.SPH.dummy4, sizeof(BIL.SPH.dummy4));
1843  info += read(fd, &BIL.SPH.comment, sizeof(BIL.SPH.comment));
1844 
1845 
1846  IDX = BIL.SPH.ccdwx;
1847 
1848  // !!!!ATTENTION!!!! This is only for the CCD30-11 OE FI- Please check where is defined
1849  // the IDY in the Main Program for the Data Acquisition
1850  //if (DAS.Paramini.EqType == SPATRAM2 || DAS.Paramini.EqType == GASCODNG3 || DAS.Paramini.EqType == GASCODNG4)
1851  if(BIL.SPH.ccdwy == 256)
1852  IDY = BIL.SPH.ccdnr+1;
1853  else
1854  IDY = BIL.SPH.ccdnr;
1855  if(BIL.SPH.ccdnr == 253)
1856  {
1857  IDY = IDY + 1;
1858  }
1859 
1860  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1861  {
1862 
1863  BlindPix = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1864 
1865  }
1866 
1867 // D_AssignLabelPlot();
1868  }
1869  return 0;
1870 
1871 }
1872 
1873 /*
1874 mod = 1 --> Assign Header to plot labels
1875 mod = 0 --> Read header only
1876 */
1877 int ReadHeader_ASCII(int mod, FILE *fd)
1878 {
1879 
1880 
1881  int er = 0;
1882  unsigned char str[128], temp[12], buf[64];
1883  unsigned char ribuf[255];
1884  int NewnR = 0, l = 0 ;
1885  unsigned int i, ch;
1886 // long llong= 0;
1887 
1888  if(feof( fd ))
1889  {
1890  return 1;
1891  }
1892  else
1893  {
1894 
1895  er = fscanf(fd, "%s%s%s%f%s%f%s%u%s%f", temp, BIL.SPH.location, temp, &BIL.SPH.latitude,
1896  temp, &BIL.SPH.longitude, temp, &BIL.SPH.altitude, temp, &BIL.SPH.sza);
1897 
1898  er = fscanf(fd, "%s %s %s %s %d %s %f %f %u %u", BIL.SPH.StrDate, BIL.SPH.StrTime, temp, BIL.SPH.mirpos, &BIL.SPH.wavelen,
1899  BIL.SPH.filpos, &BIL.SPH.ccdtemp, &BIL.SPH.ccdtexp, &BIL.SPH.ccdmax,
1900  &BIL.SPH.ccdmin);
1901 
1902  /*********************************/
1903  // Build the Date
1904  strncpy(str,BIL.SPH.StrDate,4);
1905  BIL.SPH.DATE.da_year = atoi(str);
1906 
1907  strncpy(buf,BIL.SPH.StrDate + 5, 2);
1908  BIL.SPH.DATE.da_mon = atoi(buf);
1909 
1910  strncpy(buf, BIL.SPH.StrDate + 8, 2);
1911  BIL.SPH.DATE.da_day = atoi(buf);
1912  /*********************************/
1913  /*********************************/
1914  // Build the time
1915  strncpy(buf, BIL.SPH.StrTime,2);
1916  BIL.SPH.TIME.ti_hour = atoi(buf);
1917 
1918  strncpy(buf,BIL.SPH.StrTime + 3 ,2);
1919  BIL.SPH.TIME.ti_min = atoi(buf);
1920 
1921  strncpy(buf,BIL.SPH.StrTime + 6 ,2);
1922  BIL.SPH.TIME.ti_sec = atoi(buf);
1923  /*********************************/
1924 
1925  er = fscanf(fd, "%d%d%d%d%d%d%d%d%d%d%d%d%d", &BIL.SPH.imgtype, &BIL.SPH.ccdwx, &BIL.SPH.ccdwy,
1926  &BIL.SPH.ccdsx, &BIL.SPH.ccdsy, &BIL.SPH.ccdex, &BIL.SPH.ccdey, &BIL.SPH.ccdvb,
1927  &BIL.SPH.ccdnr, &BIL.SPH.dummy1, &BIL.SPH.dummy2, &BIL.SPH.dummy3, &BIL.SPH.dummy4);
1928 
1929  ch = getc(fd);
1930  ch = getc(fd);
1931  //er = fscanf(fd, "%s", BIL.SPH.comment);
1932  //fgets(str, 80, fd);
1933 
1934 
1935 
1936 //for( i = 0; (i < 255) && ((ch = getc(fd)) != EOF) && (ch != '\n'); i++ )
1937 // for( i = 0; i < 255; i++ )
1938  i=0;
1939  do
1940  {
1941 
1942  ribuf[i] = (unsigned char)ch;
1943  ch = getc(fd);
1944  i++;
1945  }while (ch != 10);
1946  /* Terminate string with null character: */
1947  ribuf[i] = '\0';
1948 
1949  sprintf(BIL.SPH.comment, "%s", ribuf);
1950 
1951  // MMessageDialog("DAS Alert", BIL.SPH.comment, "ok", NULL);
1952 
1953 
1954  if(mod)
1956 
1957  }
1958 
1959  IDX = BIL.SPH.ccdwx;
1960  IDY = BIL.SPH.ccdnr;
1961 
1962  if(BIL.SPH.ccdnr == 253)
1963  {
1964  IDY = IDY + 1;
1965  }
1966 
1967  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1968  {
1969 
1970  BlindPix = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1971 
1972  }
1973 // llong = ftell( fd );
1974 
1975 
1976  return 0;
1977 }
1978 
1979 void SwapMatrix(unsigned short *source, unsigned short *dest, int hp, int vp)
1980 {
1981 
1982  int t, j;
1983 
1984  for(t = 0 ; t < vp ; t++)
1985  {
1986  for(j = 0; j < hp; j++)
1987  {
1988  dest[t * hp + j] = source[t * hp + j];
1989  }
1990  }
1991 
1992 }
1993 /****************************************************************/
1994 unsigned short* AllocUSMat(int hp, int vp)
1995 {
1996 
1997  unsigned long mx;
1998  unsigned short *mat;
1999  mx = (unsigned long) hp * (unsigned long) vp;
2000  mat = (unsigned short *) calloc( mx, sizeof(unsigned short));
2001 // if(mat == NULL ) //Only for malloc
2002 // return 1;
2003 
2004  return mat;
2005 
2006 }
2007 /****************************************************************/
2008 /****************************************************************/
2009 float* AllocFloatMat(int hp, int vp)
2010 {
2011 
2012  unsigned long mx;
2013  float *mat;
2014  mx = (unsigned long) hp * (unsigned long) vp;
2015  mat = (float *) calloc( mx, sizeof(float));
2016 // if(mat == NULL ) //Only for malloc
2017 // return 1;
2018 
2019  return mat;
2020 
2021 }
2022 /****************************************************************/
2023 
2024 long* AllocLongMat(int hp, int vp)
2025 {
2026 
2027  unsigned long mx;
2028  long *mat;
2029  mx = (unsigned long) hp * (unsigned long) vp;
2030  mat = (long *) calloc( mx, sizeof(long));
2031 // if(mat == NULL ) //Only for malloc
2032 // return 1;
2033 
2034  return mat;
2035 
2036 }
2037 /****************************************************************/
2038 
2039 
2040 /**************************************************
2041  * This callback is called when the user
2042  * selects the menu item that makes itself unsensitive
2043  **************************************************/
2044 void MakeItemUnsensitiveCB (MOBJECT obj, void *item, void *udata)
2045 {
2046  MMenuItemSetUnsensitive (item);
2047 
2048 
2049 }
2050 /**************************************************
2051  * This callback is called when the user
2052  * selects the menu item that makes itself Sensitive
2053  **************************************************/
2054 void MakeItemSensitiveCB (MOBJECT obj, void *item, void *udata)
2055 {
2056  MMenuItemSetSensitive (item);
2057 
2058 
2059 }
2060 
2061 
2062 /****************************************************************/
2063 
2064 unsigned int *mattempbuff;
2065 
2066 /****************************************************************/
2067 //mod = 0 --> ASCII mode
2068 //mod = 1 --> BINARY mode
2069 int Visualizza(int mod, char *nomefile)
2070 {
2071 
2072  FILE *fd;
2073  int fn;
2074  char buf[128];
2075  int er=0;
2076 
2077  switch (mod)
2078  {
2079  case FBIF: //Bif Ext
2080  fn = open(nomefile, O_RDONLY | O_BINARY, S_IREAD );
2081  if(fn < 0) return(-1);
2082  break;
2083  case FDAT: //Dat Ext
2084  fd = fopen(nomefile, "r");
2085  if(fd < 0) return 1;
2086  break;
2087  }
2088 
2089 
2090 
2091  sprintf(buf,"PLOTTING File: %s", nomefile);
2092  MShellSetTitle(BIL.VFO.View_Sh, buf);
2093 
2094 // MObjectSetUnsensitive(BIL.VFO.cmdpb[0]); //Set Button "Open" Unsensitive
2095  MObjectSetText(BIL.VFO.cmdpb[0], "Save As");
2096 
2097 
2098 
2099 
2100  MObjectSetSensitive(BIL.VFO.cmdpb[1]); //Set Button "Next" Sensitive
2101  MObjectSetSensitive(BIL.VFO.cmdpb[2]); // Set "Set as Io" button as sensitive
2102  MObjectSetSensitive(BIL.VFO.cmdpb[3]); // Set "CloseFile" button as sensitive
2103  MObjectSetSensitive(BIL.VFO.cmdpb[4]); // Set "Print" button as sensitive
2104  MObjectSetSensitive(BIL.VFO.cmdpb[7]);
2105  MObjectSetSensitive(BIL.VFO.cmdpb[6]);
2106  MObjectSetUnsensitive(BIL.VFO.cmdpb[5]); //Set Button "CloseWin" Unsensitive
2107 
2108  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
2109  {
2112  }
2113 
2114 
2115  if( (DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
2116  {
2117  MakeItemUnsensitiveCB (Fmenu, Fitem[0], 0); //Open Unsensitive
2118  MakeItemSensitiveCB (Fmenu, Fitem[1], 0); //Next Sensitive
2119 // Fitem[2] = MMenuAddItem(Fmenu, "Previous", (MENU_ITEM_CB) MenuFileOLP_CB, (void *)2);
2121  MakeItemSensitiveCB (Fmenu, Fitem[3], 0); //Save as.. Sensitive
2122  MakeItemSensitiveCB (Fmenu, Fitem[4], 0); // Close Sensitive
2123  MakeItemUnsensitiveCB (Fmenu, Fitem[5], 0);// Close Plot Sensitive
2124 /*
2125  Tmenu = MCreateMenu(dmenu, "Tools");
2126  Titem[0] = MMenuAddItem(Tmenu, "Filter/Smooth", (MENU_ITEM_CB) MenuToolsOLP_CB, 0);
2127  Titem[1] = MMenuAddItem(Tmenu, "Zoom", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)1);
2128  Titem[2] = MMenuAddItem(Tmenu, "Sun calculator", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)2);
2129  Titem[3] = MMenuAddItem(Tmenu, "Print ", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)3);
2130 
2131  Optmenu = MCreateMenu(dmenu, "Options");
2132  item = MMenuAddItem(Optmenu, "X Units", (MENU_ITEM_CB) NULL, 0);
2133  item = MMenuAddItem(Optmenu, "Y Scale", (MENU_ITEM_CB) NULL, 0);
2134  item = MMenuAddItem(Optmenu, "Hidden Lines", (MENU_ITEM_CB) NULL, 0);
2135 
2136  menu = MCreateMenu(dmenu, "Help");
2137  item = MMenuAddItem(menu, "About", (MENU_ITEM_CB) NULL, 0);
2138 */
2139  }
2140 
2141 
2142 
2143 
2144  //MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
2145  if(DAS.Flag.exemode == OFFLINEPLOT)
2146  {
2147 
2153  }
2154 
2155  switch (mod)
2156  {
2157  case FBIF: //Bif Ext
2158  NFDATI = fn;
2159  er = ReadHeader_BIN(fn);
2161  break;
2162 
2163  case FDAT: //dat Ext
2164  NUMFDATI = fd;
2165  er = ReadHeader_ASCII(1, fd); //New Format (data after 10/12/03)
2166  break;
2167  }
2168 
2170 
2171 
2172  BIL.DPLOT.ImatOrig = AllocUSMat(IDX, IDY);
2173  BIL.DPLOT.ImatGraf = AllocUSMat(IDX, IDY);
2174  if (er)
2175  MMessageDialog("DAS PLOT Inf.", "Unable to allocate memory ...", "OK", NULL);
2176 
2177  REL_FILE_POS[0] = 0;
2178 
2179  switch (mod)
2180  {
2181  case FBIF: //Bif Ext
2183  break;
2184 
2185  case FDAT: //Dat Ext
2187  break;
2188  }
2189 
2190 
2192 
2193  sprintf(buf,"%u", BIL.DPLOT.Imin);
2194  MObjectSetText(BIL.VFO.lblmin, buf);
2195 
2196 
2197  if((DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
2198  {
2199  _chdir(BIL.DFILEM.HOMEDIRECTORY);
2200 
2201  DC_LoadCameraConfig("config\\camera.cfg", &Cfg);
2202  DC_OpenPar(Cfg.Platform, Cfg.CCDType, 0);
2203  DC_RWData(CCD_INFO, READ_DATA, &DC_CCD, 0);
2204  DC_RWData(PTF_INFO, READ_DATA, &DC_HP, 0);
2205 // strcpy(Cfg.PtfName, DC_PtfName(0));
2206 // DC_LoadPlatform(Cfg.PtfName);
2207 
2208 
2209 /*******************/
2210 /*** Init Dil ***/
2211  DB_InitDil();
2212 /*******************/
2213 
2214  _chdir(BIL.DFILEM.WORKDIRECTORY);
2215 
2216  SwapMatrix(BIL.DPLOT.ImatGraf, DIL.Img.Mat[Server].Imat, IDX, IDY);
2217 
2218  // Y Zoom for high vertical binning
2219  if((IDY) < 50)
2220  DI_ImageProperties(Server, (U16)IDX, (U16)IDY, (U16)IDX, (U16)IDY, 0, 0, NULL, 1, 100 / IDY, 0);
2221 // Image[Server].attrib = 1;
2222  DI_Regen(Server);
2223 
2224 
2225 
2226  DI_ScanMaxMin(Server, &DIL.Img.Mat[Server].High, &DIL.Img.Mat[Server].Low);
2227  DIL.Img.Mat[Server].ILow = DIL.Img.Mat[Server].Low ;
2228  DIL.Img.Mat[Server].IHigh = DIL.Img.Mat[Server].High ;
2229  DI_Regen(Server);
2230  }
2231  //The focus taken by the Plot shell
2232  MShellRaise(BIL.VFO.View_Sh);
2233 
2234  return 0;
2235 
2236 }
2237 
2238 /****************************************************************/
2239 
2240 /****************************************************************/
2241 int ViewPre(FILE *nf, long position)
2242 {
2243  int er = 0;
2244 
2245  er = fseek(nf, position, SEEK_SET);
2246  if (ContFP == 0)
2247  {
2248  er = MMessageDialog("DAS information", "Already at the beginning Of File.\n Please use the 'Next' Button ?" , "OK", NULL);
2249  return 1;
2250  }
2251  else
2252  {
2253  ContFP--;
2254  ContFP--;
2255  ViewNext(nf);
2256  return 0;
2257  }
2258  return 0;
2259 
2260 }
2261 
2262 
2263 int ViewPre_BIN(int nf, long position)
2264 {
2265  int er = 0;
2266 
2267  er = lseek(nf, position, SEEK_SET);
2268  if (ContFP == 0)
2269  {
2270  er = MMessageDialog("DAS information", "Already at the beginning Of File.\n Please use the 'Next' Button ?" , "OK", NULL);
2271  return 1;
2272  }
2273  else
2274  {
2275  ContFP--;
2276  ContFP--;
2277  ViewNext_BIN(nf);
2278  return 0;
2279  }
2280  return 0;
2281 
2282 }
2283 
2284 int ViewNext_BIN(int nf)
2285 {
2286 
2287  int er = 0, i;
2288  long XXX = 0;
2289  char str[32];
2290 
2291  MObjectSetSensitive(BIL.VFO.cmdpb[8]); //Set button "Previuos" Sensitive
2292  if((DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
2293  {
2295  }
2296 
2297  /********************************/
2298  AbsFilePos = tell( nf );
2299 
2300  for (i = ContFP; i>0; i--)
2301  {
2302  XXX = XXX + REL_FILE_POS[i];
2303  }
2304 
2305  ContFP++;
2307  /***************************************/
2308 
2309  er = ReadHeader_BIN(nf);
2311  if (er)
2312  {
2313  er = MMessageDialog("DAS information", "End Of File reached.\n Do you want to close the file ?" , "Yes", "No", NULL);
2314  if (er)
2315  return 1;
2316  else
2317  CloseFile_BIN(nf, IDX, IDY); //Raggiunta fine del file
2318  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
2319  }
2320  else
2321  {
2323 
2324  InitImage(BIL.BLENS.Imim, maxplotw, maxploth, 192, 192, 192);
2325 
2326 
2327 
2328  ReadIMG_BIN(nf, BIL.DPLOT.ImatOrig, IDX, IDY);
2329 
2330 
2332 
2333  sprintf(str,"%u", BIL.DPLOT.Imin);
2334  MObjectSetText(BIL.VFO.lblmin, str);
2335 
2336  if(DAS.Flag.exemode == OFFLINEPLOT)
2337  {
2339 
2340  _chdir(BIL.DFILEM.HOMEDIRECTORY);
2341  DB_InitDil();
2342  _chdir(BIL.DFILEM.WORKDIRECTORY);
2343 
2344  SwapMatrix(BIL.DPLOT.ImatGraf, DIL.Img.Mat[Server].Imat, IDX, IDY);
2345 
2346  // Y Zoom for high vertical binning
2347  if((IDY) < 50)
2348  DI_ImageProperties(Server, (U16)IDX, (U16)IDY, (U16)IDX, (U16)IDY, 0, 0, NULL, 1, 100 / IDY, 0);
2349 // Image[Server].attrib = 1;
2350  DI_Regen(Server);
2351 
2352  DI_ScanMaxMin(Server, &DIL.Img.Mat[Server].High, &DIL.Img.Mat[Server].Low);
2353  DIL.Img.Mat[Server].ILow = DIL.Img.Mat[Server].Low ;
2354  DIL.Img.Mat[Server].IHigh = DIL.Img.Mat[Server].High ;
2355  DI_Regen(Server);
2356  }
2357  }
2358 
2359  //The focus taken by the Plot shell
2360  MShellRaise(BIL.VFO.View_Sh);
2361 
2362  return 0;
2363 }
2364 
2365 int ViewNext(FILE *nf)
2366 {
2367 
2368  int er = 0, i;
2369  long XXX = 0;
2370 
2371  MObjectSetSensitive(BIL.VFO.cmdpb[8]); //Set button "Previuos" Sensitive
2372  if((DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
2373  {
2375  }
2376 
2377  /********************************/
2378  AbsFilePos = ftell( nf );
2379 
2380  for (i = ContFP; i>0; i--)
2381  {
2382  XXX = XXX + REL_FILE_POS[i];
2383  }
2384 
2385  ContFP++;
2387  /***************************************/
2388 
2389  er = ReadHeader_ASCII(1, nf);
2390  if (er)
2391  {
2392  er = MMessageDialog("DAS information", "End Of File reached.\n Do you want to close the file ?" , "Yes", "No", NULL);
2393  if (er)
2394  return 1;
2395  else
2396  CloseFile(nf, IDX, IDY); //Raggiunta fine del file
2397  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
2398  }
2399  else
2400  {
2402 
2403  InitImage(BIL.BLENS.Imim, maxplotw, maxploth, 192, 192, 192);
2404 
2405 
2406 
2407  ReadIMG(nf, BIL.DPLOT.ImatOrig, IDX, IDY);
2408 
2409 
2411 
2412  if((DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
2413  {
2415 
2416  _chdir(BIL.DFILEM.HOMEDIRECTORY);
2417  DB_InitDil();
2418  _chdir(BIL.DFILEM.WORKDIRECTORY);
2419 
2420  SwapMatrix(BIL.DPLOT.ImatGraf, DIL.Img.Mat[Server].Imat, IDX, IDY);
2421 
2422  // Y Zoom for high vertical binning
2423  if((IDY) < 50)
2424  DI_ImageProperties(Server, (U16)IDX, (U16)IDY, (U16)IDX, (U16)IDY, 0, 0, NULL, 1, 100 / IDY, 0);
2425 // Image[Server].attrib = 1;
2426  DI_Regen(Server);
2427 
2428 
2429  DI_ScanMaxMin(Server, &DIL.Img.Mat[Server].High, &DIL.Img.Mat[Server].Low);
2430  DIL.Img.Mat[Server].ILow = DIL.Img.Mat[Server].Low ;
2431  DIL.Img.Mat[Server].IHigh = DIL.Img.Mat[Server].High ;
2432  DI_Regen(Server);
2433  }
2434  }
2435  //The focus taken by the Plot shell
2436  MShellRaise(BIL.VFO.View_Sh);
2437 
2438  return 0;
2439 }
2440 /****************************************************************/
2441 void PBYScale_CB (MOBJECT p, void *od, void *ad)
2442 {
2443 
2444  int c = (int) ad;
2445 
2446  switch (c)
2447  {
2448  case 0:
2449  FLAG.plotYRange = 1;
2450  break;
2451  case 1:
2452  FLAG.plotYRange = 0;
2453  break;
2454 
2455 
2456 
2457  }
2458 /*
2459  if (FLAG.plotYRange == 0)
2460  {
2461  FLAG.plotYRange = 1;
2462  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
2463  MObjectSetText(BIL.VFO.YScalePB, "Min/Max");
2464  }
2465  else
2466  {
2467  FLAG.plotYRange = 0;
2468  if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
2469  MObjectSetText(BIL.VFO.YScalePB, "Full Range");
2470  }
2471 */
2472  if (BIL.DPLOT.ImatGraf)
2474 
2475 }
2476 void PButtSelAll_CB(MOBJECT p, void *od, void *ad)
2477 {
2478  int i;
2479  int c = (int) ad;
2480  for (i =DAS.DOption.hlinebefore; i < IDY - DAS.DOption.hlineafter ; i++)
2481  D_pbr_CB(BIL.DPLOT.pbr, NULL, (void *) i);
2482 
2483 }
2484 
2485 int SaveImage(int fmt, int imgw, int imgh, int np )
2486 {
2487 
2488 /*
2489 
2490  maxplotw = MObjectGetWidth(BIL.VFO.View_Sh);
2491  maxploth = MObjectGetHeight(BIL.VFO.View_Sh);
2492  BIL.VFO.dimg = MAllocImage(maxplotw, maxploth, 24);
2493 
2494  InitImage(BIL.VFO.dimg, maxplotw, maxploth, 192, 192, 192);
2495 
2496  for(x = 0; x < maxplotw ; maxplotw++)
2497  for(y = 0; y < maxploth ; maxploth++)
2498  {
2499  MObjectGetPixelRGB(BIL.VFO.View_Sh, r, g, b);
2500  MImageSetPixelRGB(BIL.VFO.dimg, x , y, r, g, b);
2501  }
2502  }
2503 
2504  MInstallImage(BIL.VFO.dimg);
2505  MDrawImage(lensdraw, lensmim, 0, 0, wx * p, wy * p, 0, 0);
2506  MUninstallImage(lensmim);
2507 
2508 
2509 */
2510 
2511  return 0;
2512 }
2513 
2514 void ClosePlotCB(MOBJECT p, void *od, void *ad)
2515 {
2516 
2517  if(BIL.DPLOT.RowShell != 0)
2518  {
2521  BIL.DPLOT.RowShell = 0;
2522  }
2523 
2524  MShellUnrealize(p);
2525  MShellDestroy(p);
2526 
2529  MFreeImage(BIL.BLENS.Imim);
2530 
2531  if (ContFP)
2532  ContFP = 0;
2533 
2534  if(DAS.Flag.exemode == OFFLINEPLOT)
2535  {
2536 
2537  MGUITerm();
2538  exit(0);
2539  }
2540 
2541 }
2542 
2543 /*
2544  Open file
2545  mode = 0 --> open file; mode = 1 --> save as
2546  fmt defined in bildef.h
2547  operations defined in bildef.h
2548 
2549 
2550 void D_OpenFile(int mode, int fmt, int operation)
2551 {
2552 
2553  int c = operation;
2554 
2555  BIL.DFILEM.DBFILENAME[0] = 0;
2556 
2557  MDCreateFM_Shell(mode, fmt); //Open File, Dat ext.
2558 
2559  if(BIL.DFILEM.DBFILENAME[0] == 0)
2560  return 0;
2561 
2562  switch (c)
2563  {
2564  case 0:
2565  Visualizza(BIL.DFILEM.DBFILENAME);
2566  break;
2567  case 1:
2568  DB_Column(BIL.DFILEM.DBFILENAME);
2569  break;
2570  case 2:
2571  LoadTestPalette(BIL.DFILEM.DBFILENAME);
2572  break;
2573  case 3:
2574  DT_CalcFluxI(BIL.DFILEM.DBFILENAME);
2575  break;
2576  case 4:
2577  break;
2578  case 5:
2579  break;
2580  case 6:
2581  break;
2582  case 7:
2583  break;
2584  case 8:
2585  break;
2586  }
2587 
2588 
2589 
2590 }
2591 */
2592 
2593 void DB_FilterCB(MOBJECT p, void *od, void *ad)
2594 {
2595 
2596  int er = 0;
2597  int c = (int) ad;
2598 
2599 
2601 
2602  if(er)
2603  {
2604  switch (c)
2605  {
2606  case 0:
2607  TOOLS.FlagFilter = 0;
2608  break;
2609  case 1:
2610  TOOLS.FlagFilter = 1;
2611  break;
2612  }
2613  }
2614 
2616 
2617 
2618 }
2619 
2620 void DB_SpikesCB(MOBJECT p, void *od, void *ad)
2621 {
2622  int er = 0;
2623  int c = (int) ad;
2624 
2625 
2627 
2628  if(er)
2629  {
2630  switch (c)
2631  {
2632  case 0:
2633  TOOLS.FlagSpikes = 0;
2634  break;
2635  case 1:
2636  TOOLS.FlagSpikes = 1;
2637  break;
2638  }
2639  }
2640 
2642 
2643 }
2644 
2645 
2646 void DB_DisplayCB(MOBJECT p, void *od, void *ad)
2647 {
2648 
2649  int er = 0;
2650  int c = (int) ad;
2651 
2652 
2654 
2655  if(er)
2656  {
2657  switch (c)
2658  {
2659  case 0 :
2660  TOOLS.FlagDisplay = 0;
2661  break;
2662  case 1:
2663  TOOLS.FlagDisplay = 1;
2664  break;
2665  case 2:
2666  TOOLS.FlagDisplay = 2;
2667  break;
2668  }
2669  }
2670 
2672 
2673 }
2674 
2675 
2676 
2677 
2678 void LoadIo(int mod, char *fname)
2679 {
2680 
2681  FILE *fs;
2682 // char temp[128];
2683 // int i, k,
2684  int er;
2685 
2686 /* fs = fopen(fname, "r");
2687 
2688  if(fs == NULL)
2689  {
2690  return 1;
2691  }
2692  ReadLine(str, 80, fs);
2693  ReadLine(str, 80, fs);
2694  ReadLine(str, 80, fs);
2695  ReadLine(str, 80, fs);
2696 
2697 
2698  k=0;
2699  do
2700  {
2701 
2702  k++;
2703  ReadLine(str, 80, fs);
2704 
2705 
2706  }while (!feof(fs));
2707 
2708  k--;
2709 
2710  fclose(fs);
2711 */
2712  fs = fopen(fname, "r");
2713 
2714  //ReadHeaderOnly(fs);
2715  //ReadHeader_Io(0, fs);
2716  er = ReadHeader_ASCII(0, fs);
2717 
2718 
2719 
2720  IDX = BIL.SPH.ccdwx;
2721  IDY = BIL.SPH.ccdnr;
2722 
2723  DOAS.IoMat = AllocUSMat(IDX, IDY);
2724 
2725  ReadIMG(fs, DOAS.IoMat, IDX, IDY + 1);
2726 
2727 /* for (i=0; i<IDX; i++)
2728  {
2729  for (i=0; i<IDY + 1; i++)
2730  fscanf(fs, "%lf%", &DOAS.wlc[i], &DOAS.k1[i], &DOAS.k2[i], &DOAS.wlref[i], &DOAS.pixref[i]);
2731 
2732  }
2733 
2734 */
2735  fclose(fs);
2736 
2737  if (mod)
2738  {
2739  maxplotw = MObjectGetWidth(DOAS.drwa[0]);
2740  maxploth = MObjectGetHeight(DOAS.drwa[0]);
2741 
2742  MFreeImage(BIL.BLENS.Imim);
2743  BIL.BLENS.Imim = MAllocImage(maxplotw, maxploth, 24);
2744 
2745  InitImage(BIL.BLENS.Imim, maxplotw, maxploth, 192, 192, 192);
2746 
2747 
2748  //Assign limits to the Drawing coordinates
2749  D_AssignOrigin(DOAS.drwa[0]);
2750  //Plot the axes
2751  D_PlotAxis(DOAS.drwa[0], BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX,
2752  BIL.DPLOT.eY, MTCL.black);
2753  //Plot grid
2754  D_PlotGrid(DOAS.drwa[0], BIL.BLENS.Imim, BIL.DPLOT.oX, BIL.DPLOT.oY, BIL.DPLOT.eX,
2755  BIL.DPLOT.eY);
2756 
2757 
2758 
2759  }
2760 
2761 
2762 }
2763 
2765 {
2766 
2767 
2768 
2769 
2770 }
2771 
2772 void PlotToolsPBs(MOBJECT o, void *id, void *a_data)
2773 {
2774  int c = (int) a_data, er =0;
2775 // int l;
2776  char buff[32],str[_MAX_PATH] ;
2777  char fname[128], dirname[128];
2778 
2779  FB_PREFS fbp;
2780  strcpy (dirname, MGetCurrentDirectory ());
2781  fname[0] = '\0';
2782  memset (&fbp, 0, sizeof (fbp));
2783 
2784  fbp.change_cwd = True;
2785  fbp.allow_dir_create = True;
2786  fbp.allow_dir_rename = True;
2787  fbp.allow_dir_delete = True;
2788  fbp.transparent_tree = False;
2789  fbp.font = HELV_SMALL;
2790  fbp.button_font = HELV_SMALL;
2791  //Set Img file
2792  sprintf(str, "%s\\%s", BIL.DFILEM.HOMEDIRECTORY, "sys\\Tile2.bmp" );
2793  fbp.bg_image_file =str;
2794 
2795 
2796  switch (c)
2797  {
2798  case 0:
2799  sprintf(buff,"1234");
2800  er = MFileBrowseExt ("Select Io File", "*.*", fname, dirname, &fbp);
2801  if(er)
2802  {
2803  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",dirname, fname);
2804  LoadIo(0,BIL.DFILEM.DBFILENAME);
2805  }
2806  break;
2807  case 1:
2808  break;
2809  case 2:
2810  BuildLogRatio();
2811  break;
2812  }
2813 
2814 }
2815 
2816 
2817 
2818 void D_PlotTools(void)
2819 {
2820 
2821  MOBJECT tb, rowf, lbl, lbl1, wfedt, rb, pb;
2822  char str[32];
2823  int k,*p;
2824 
2825  TOOLS.Sh_PlotTools = MCreateShell("PLOT TOOLS", 0);
2829 
2830 
2832  MFormSetSpacing(rowf, 1);
2833  MObjectSetBackgroundRGB(rowf, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
2834 
2835  lbl = MCreateLabel(rowf, "FILTER", FIXED_SMALL);
2837  MObjectSetForegroundRGB(lbl, 255, 255, 255);
2838  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
2839  MObjectSetTransparency(lbl, 0);
2840 
2841 
2842  tb = MCreateTableForm(rowf, 2);
2843  MObjectSetBackgroundRGB(tb, 112, 128, 112);
2844  MObjectSetResize(tb, True, False);
2846 
2847  rb = MCreateRButton(tb, "Disabled", FIXED_SMALL);
2848  MPButtonSetCallback(rb, DB_FilterCB, (void *) 0);
2850  MObjectSetForegroundRGB(rb, 255, 255, 255);
2851  MObjectSetCompositeWidth(rb, 85);
2852  if(TOOLS.FlagFilter == 0)
2853  MRButtonActivate(rb);
2854 
2855  rb= MCreateRButton(tb, "Enabled", FIXED_SMALL);
2856  MPButtonSetCallback(rb, DB_FilterCB, (void *) 1);
2858  MObjectSetForegroundRGB(rb, 255, 255, 255);
2859  MObjectSetCompositeWidth(rb, 123);
2860  if(TOOLS.FlagFilter == 1)
2861  MRButtonActivate(rb);
2862 
2863 
2864 
2865  lbl1 = MCreateLabel(tb, "Window Filter:", FIXED_SMALL);
2867  MObjectSetForegroundRGB(lbl1, 255, 255, 255);
2868  MObjectSetTransparency(lbl1, 0);
2869  MObjectSetResize(lbl1, False, False);
2871 
2872 
2873  sprintf(str,"%d",DOAS.FFTFilter);
2874  wfedt = MCreateClippedEdit(tb, str, 10, 5, FIXED_SMALL);
2875  MObjectSetForegroundRGB(wfedt, 255, 255, 255);
2876  MObjectSetBackgroundRGB(wfedt, 40, 96, 72);
2877 // MObjectSetCompositeWidth(level, 35);
2879  k = 150;
2880  p = (void *) k;
2881  MEditSetValCallback(wfedt, ValidateCB, p);
2882  MEditSetActCallback(wfedt, ActEditCB, p);
2883 
2884 
2885 
2886  lbl = MCreateLabel(rowf, "REMOVE SPIKES", FIXED_SMALL);
2888  MObjectSetForegroundRGB(lbl, 255, 255, 255);
2889  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
2890  MObjectSetTransparency(lbl, 0);
2891 
2892 
2893  tb = MCreateTableForm(rowf, 2);
2894  MObjectSetBackgroundRGB(tb, 112, 128, 112);
2895  MObjectSetResize(tb, True, False);
2897 
2898  rb = MCreateRButton(tb, "No", FIXED_SMALL);
2899  MPButtonSetCallback(rb, DB_SpikesCB, (void *) 0);
2901  MObjectSetForegroundRGB(rb, 255, 255, 255);
2902  MObjectSetCompositeWidth(rb, 85);
2903  if(TOOLS.FlagSpikes == 0)
2904  MRButtonActivate(rb);
2905 
2906  rb= MCreateRButton(tb, "Yes", FIXED_SMALL);
2907  MPButtonSetCallback(rb, DB_SpikesCB, (void *) 1);
2909  MObjectSetForegroundRGB(rb, 255, 255, 255);
2910  MObjectSetCompositeWidth(rb, 123);
2911  if(TOOLS.FlagSpikes == 1)
2912  MRButtonActivate(rb);
2913 
2914  /*
2915  TOOLS.Spikes[0] = MCreateRButton(tb, "No", FIXED_SMALL);
2916  MPButtonSetCallback(TOOLS.Spikes[0], DB_SpikesCB, (void *) 0);
2917  MObjectAlign(TOOLS.Spikes[0], LEFT_ALIGN, TOP_ALIGN);
2918  MObjectSetForegroundRGB(TOOLS.Spikes[0], 255, 255, 255);
2919  MObjectSetCompositeWidth(TOOLS.Spikes[0], 85);
2920 
2921  TOOLS.Spikes[1]= MCreateRButton(tb, "Yes", FIXED_SMALL);
2922  MPButtonSetCallback(TOOLS.Spikes[1], DB_SpikesCB, (void *) 1);
2923  MObjectAlign(TOOLS.Spikes[1], LEFT_ALIGN, TOP_ALIGN);
2924  MObjectSetForegroundRGB(TOOLS.Spikes[1], 255, 255, 255);
2925  MObjectSetCompositeWidth(TOOLS.Spikes[1], 123);
2926 
2927  if(TOOLS.FlagSpikes)
2928  MRButtonActivate(TOOLS.Spikes[1]);
2929  else
2930  MRButtonActivate(TOOLS.Spikes[0]);
2931 
2932 */
2933  lbl = MCreateLabel(rowf, "Display Spectrum", FIXED_SMALL);
2935  MObjectSetForegroundRGB(lbl, 255, 255, 255);
2936  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
2937  MObjectSetTransparency(lbl, 0);
2938 
2939 
2940  tb = MCreateTableForm(rowf, 1);
2941  MObjectSetBackgroundRGB(tb, 112, 128, 112);
2942  MObjectSetResize(tb, True, False);
2944 
2945  rb = MCreateRButton(tb, "Original", FIXED_SMALL);
2946  MPButtonSetCallback(rb, DB_DisplayCB, (void *) 0);
2948  MObjectSetForegroundRGB(rb, 255, 255, 255);
2949  MObjectSetCompositeWidth(rb, 85);
2950  if(TOOLS.FlagDisplay == 0)
2951  MRButtonActivate(rb);
2952 
2953  rb= MCreateRButton(tb, "Corrected", FIXED_SMALL);
2954  MPButtonSetCallback(rb, DB_DisplayCB, (void *) 1);
2956  MObjectSetForegroundRGB(rb, 255, 255, 255);
2957  MObjectSetCompositeWidth(rb, 123);
2958  if(TOOLS.FlagDisplay == 1)
2959  MRButtonActivate(rb);
2960 
2961  rb= MCreateRButton(tb, "Both", FIXED_SMALL);
2962  MPButtonSetCallback(rb, DB_DisplayCB, (void *) 2);
2964  MObjectSetForegroundRGB(rb, 255, 255, 255);
2965  MObjectSetCompositeWidth(rb, 123);
2966  if(TOOLS.FlagDisplay == 2)
2967  MRButtonActivate(rb);
2968 
2969 
2970  tb = MCreateTableForm(rowf, 1);
2971  MObjectSetBackgroundRGB(tb, 112, 128, 112);
2972  MObjectSetResize(tb, True, False);
2974 
2975  lbl = MCreateLabel(tb, "DOAS", FIXED_SMALL);
2977  MObjectSetForegroundRGB(lbl, 255, 255, 255);
2978  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
2979  MObjectSetTransparency(lbl, 0);
2980 
2981  pb= MCreatePButton(tb, "Load Io", FIXED_SMALL);
2982  MPButtonSetCallback(pb, PlotToolsPBs, (void *) 0);
2984  MObjectSetForegroundRGB(pb, 255, 255, 255);
2985  MObjectSetCompositeWidth(pb, 123);
2986 
2987  pb= MCreatePButton(tb, "Load ACS Matrix", FIXED_SMALL);
2988  MPButtonSetCallback(pb, PlotToolsPBs, (void *) 1);
2990  MObjectSetForegroundRGB(pb, 255, 255, 255);
2991 // MObjectSetCompositeWidth(pb, 123);
2992 
2993  pb= MCreatePButton(tb, "LogRatio (LR) Spectrum", FIXED_SMALL);
2994  MPButtonSetCallback(pb, PlotToolsPBs, (void *) 2);
2996  MObjectSetForegroundRGB(pb, 255, 255, 255);
2997 // MObjectSetCompositeWidth(pb, 123);
2998 
2999  pb= MCreatePButton(tb, "VarY(LR/smooth(LR))", FIXED_SMALL);
3000  MPButtonSetCallback(pb, PlotToolsPBs, (void *) 3);
3002  MObjectSetForegroundRGB(pb, 255, 255, 255);
3003 // MObjectSetCompositeWidth(pb, 123);
3004 
3005  pb= MCreatePButton(tb, "Results", FIXED_SMALL);
3006  MPButtonSetCallback(pb, PlotToolsPBs, (void *) 4);
3008  MObjectSetForegroundRGB(pb, 255, 255, 255);
3009  MObjectSetCompositeWidth(pb, 123);
3010 
3011 
3012  tb = MCreateTableForm(rowf, 3);
3013  MObjectSetBackgroundRGB(tb, 112, 128, 112);
3014  MObjectSetResize(tb, True, False);
3016 
3017  lbl = MCreateLabel(tb, "Shift", FIXED_SMALL);
3019  MObjectSetForegroundRGB(lbl, 255, 255, 255);
3020  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
3021  MObjectSetTransparency(lbl, 0);
3022 
3023  lbl = MCreateLabel(tb, "K1", FIXED_SMALL);
3025  MObjectSetForegroundRGB(lbl, 255, 255, 255);
3026  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
3027  MObjectSetTransparency(lbl, 0);
3028 
3029  lbl = MCreateLabel(tb, "K2", FIXED_SMALL);
3031  MObjectSetForegroundRGB(lbl, 255, 255, 255);
3032  MObjectSetBackgroundRGB(lbl, 48, 20, 255);
3033  MObjectSetTransparency(lbl, 0);
3034 
3035 
3036 /*
3037  TOOLS.Display[0] = MCreateRButton(tb, "Original", FIXED_SMALL);
3038  MPButtonSetCallback(TOOLS.Display[0], DB_DisplayCB, (void *) 0);
3039  MObjectAlign(TOOLS.Display[0], LEFT_ALIGN, TOP_ALIGN);
3040  MObjectSetForegroundRGB(TOOLS.Display[0], 255, 255, 255);
3041  MObjectSetCompositeWidth(TOOLS.Display[0], 85);
3042 
3043  TOOLS.Display[1]= MCreateRButton(tb, "Corrected", FIXED_SMALL);
3044  MPButtonSetCallback(TOOLS.Display[1], DB_DisplayCB, (void *) 1);
3045  MObjectAlign(TOOLS.Display[1], LEFT_ALIGN, TOP_ALIGN);
3046  MObjectSetForegroundRGB(TOOLS.Display[1], 255, 255, 255);
3047  MObjectSetCompositeWidth(TOOLS.Display[1], 123);
3048 
3049  TOOLS.Display[2]= MCreateRButton(tb, "Both", FIXED_SMALL);
3050  MPButtonSetCallback(TOOLS.Display[2], DB_DisplayCB, (void *) 2);
3051  MObjectAlign(TOOLS.Display[2], LEFT_ALIGN, TOP_ALIGN);
3052  MObjectSetForegroundRGB(TOOLS.Display[2], 255, 255, 255);
3053  MObjectSetCompositeWidth(TOOLS.Display[2], 123);
3054 
3055  if(TOOLS.FlagDisplay == 1)
3056  MRButtonActivate(TOOLS.Display[1]);
3057  else if(TOOLS.FlagDisplay == 2)
3058  MRButtonActivate(TOOLS.Display[2]);
3059  else if(TOOLS.FlagDisplay == 0)
3060  MRButtonActivate(TOOLS.Display[0]);
3061 */
3062 
3064 
3065 
3066 
3067 }
3068 
3069 int SaveIo(char *buff)
3070 {
3071  FILE *fs;
3072  int x, y;
3073 
3074  DOAS.IoMat = AllocUSMat(IDX, IDY);
3075 
3076  fs = fopen(buff, "w");
3077  if(fs < 0) return 1;
3078 
3079  // Print on file the header
3080  D_Print_BIL_H_ASCII(0, fs);
3081 
3082 
3083  for(y = 0; y < IDY; y++)
3084  {
3085  for(x = 0; x < IDX; x++)
3086  {
3087  if((x % 10) == 0)
3088  {
3089  if(y == 0 && x == 0)
3090  {
3091  }
3092  else
3093  fprintf(fs, "\n", NULL);
3094  }
3095  fprintf(fs, " %5u", BIL.DPLOT.ImatGraf[y * IDX + x]);
3096  }
3097 
3098  }
3099  fprintf(fs, "\n", NULL);
3100 
3101 /*
3102  for(x = 0; x < IDX ; x++)
3103  {
3104 
3105  fprintf(fs, " %7.3f", DOAS.lambda[x]);
3106  for(y = 0; y < IDY; y++)
3107  {
3108  fprintf(fs, " %5u", BIL.DPLOT.ImatGraf[y * IDX + x]);
3109 
3110  }
3111  fprintf(fs, "\n", NULL);
3112  }
3113 */
3114  fclose(fs);
3115 
3116 
3117  SwapMatrix(BIL.DPLOT.ImatGraf, DOAS.IoMat, IDX, IDY);
3118 // MMessageDialog("DAS information", buff, "ok", NULL);
3119  return 0;
3120 }
3121 
3122 
3123 
3124 
3125 
3126 int SetAsIo(void)
3127 {
3128 
3129  char buf[MAX_PATH],str[MAX_PATH];
3130  char filedatan[32];
3131  int er;
3132 
3133  sprintf(filedatan, "Io_%d.ref",BIL.SPH.wavelen);
3134 
3135  sprintf(buf,"\\%s\\%s\\%s", "DOAS", "Io",filedatan);
3136  strcpy(str, BIL.DFILEM.HOMEDIRECTORY);
3137  strcat(str,buf);
3138 
3139  sprintf(buf, "Do you want to save the Io file as:\n%s ?", str);
3140  er = MMessageDialog("DAS information", buf, "Yes", "No", "Cancel",NULL);
3141  if (er == 0)
3142  {
3143  SaveIo(str);
3144  sprintf(DOAS.IoFileNeme, "%s", str);
3145  return 2;
3146  }
3147  else if (er==1)
3148  {
3149  BIL.DFILEM.DBFILENAME[0] = 0;
3150  MDCreateFM_Shell(FSAVE, FDAT); //Save File as, Dat ext.
3151  SaveIo(BIL.DFILEM.DBFILENAME);
3152  sprintf(DOAS.IoFileNeme, "%s", BIL.DFILEM.DBFILENAME);
3153  return 1;
3154  }
3155  else
3156  return 0;
3157 
3158 
3159 }
3160 
3161 
3162 int SaveSpectrum(char *buff)
3163 {
3164  FILE *fs;
3165  char str[128];
3166 // int x, y;
3167  fs = fopen(buff, "a");
3168  if(fs < 0) return 1;
3169 
3170  //WriteColumn( FLAG.Wl ,fs);
3172  fclose(fs);
3173 
3174  sprintf(str, " Line # %d, saved on file %s .",IDY/2, buff);
3175  MMessageDialog ("DAS Info", str, "OK",NULL);
3176  return 0;
3177 }
3178 
3179 void MenuToolsOLP_CB(MOBJECT o, void *id, void *a_data)
3180 {
3181  int c = (int) a_data, er = 0;
3182 
3183  switch (c)
3184  {
3185  case 0:
3186  D_PlotTools();
3187  break;
3188  case 1:
3189  D_Lens();
3190  break;
3191  case 2:
3192  D_SunCalc();
3193  break;
3194 
3195  case 3:
3196  SetupPrinter();
3197 
3198  er = PrintObject(BIL.VFO.View_Sh, PM_FULL, -1, -1 );
3199  if (er)
3200  MMessageDialog("ALERT", "Print Problems", "Ok", NULL);
3201  break;
3202 
3203 
3204 
3205  }
3206 }
3207 
3208 
3209 void MenuFileOLP_CB(MOBJECT o, void *id, void *a_data)
3210 {
3211  int c = (int) a_data, er =0;
3212  int l;
3213  char buff[32],str[_MAX_PATH] ;
3214  char fname[128], dirname[128];
3215 
3216  FB_PREFS fbp;
3217  strcpy (dirname, MGetCurrentDirectory ());
3218  fname[0] = '\0';
3219  memset (&fbp, 0, sizeof (fbp));
3220 
3221  fbp.change_cwd = True;
3222  fbp.allow_dir_create = True;
3223  fbp.allow_dir_rename = True;
3224  fbp.allow_dir_delete = True;
3225  fbp.transparent_tree = False;
3226  fbp.font = HELV_SMALL;
3227  fbp.button_font = HELV_SMALL;
3228  //Set Img file
3229  sprintf(str, "%s\\%s", BIL.DFILEM.HOMEDIRECTORY, "sys\\Tile2.bmp" );
3230  fbp.bg_image_file =str;
3231 
3232 
3233  switch (c)
3234  {
3235  case 0:
3236  sprintf(buff,"1234");
3237  if(DAS.DOption.savingmode)
3238  er = MFileBrowseExt ("Select File for Plotting", "*.bif", fname, dirname, &fbp);
3239  else
3240  er = MFileBrowseExt ("Select File for Plotting", "*.dat", fname, dirname, &fbp);
3241  if(er)
3242  {
3243  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",dirname, fname);
3244  l = strlen(fname);
3245  strncpy(buff, fname+l-4, 4);
3246  if( (strcmp(buff,".dat") == 0) |(strcmp(buff,".Dat") == 0) )
3247  BIL.DFILEM.FKIND = FDAT;
3248  else if( (strcmp(buff,".bif") == 0) | (strcmp(buff,".Bif") == 0) )
3249  BIL.DFILEM.FKIND = FBIF;
3250  else if( (strcmp(buff,".bhg") == 0) | (strcmp(buff,".Bhg") == 0) )
3251  BIL.DFILEM.FKIND = FBIF;
3252  else
3253  {
3254  MMessageDialog("DAS information", "Unsupported format!!", " Ok ", NULL);
3255  break;
3256  }
3258  }
3259  else
3260  break;
3261  break;
3262 
3263  case 1:
3264  switch (BIL.DFILEM.FKIND)
3265  {
3266  case FDAT:
3267  ViewNext(NUMFDATI);
3268  break;
3269  case FBIF:
3271  break;
3272  }
3273  break;
3274 
3275  case 2:
3276  switch (BIL.DFILEM.FKIND)
3277  {
3278  case FDAT:
3280  break;
3281  case FBIF:
3283  break;
3284  }
3285  break;
3286 
3287  case 3:
3288  BIL.DFILEM.DBFILENAME[0] = 0;
3289  MDCreateFM_Shell(FSAVE, FDAT); //Save File as, Dat ext.
3290  if(BIL.DFILEM.DBFILENAME[0] == 0)
3291  {
3292  if (BIL.DPLOT.ImatGraf == 0)
3293  break;
3294  }
3295  else
3296  {
3298  }
3299  break;
3300 
3301  case 4:
3302  switch (BIL.DFILEM.FKIND)
3303  {
3304  case FDAT:
3306  break;
3307  case FBIF:
3309  break;
3310  }
3311  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
3312  break;
3313  case 5:
3314  ClosePlotCB(BIL.VFO.View_Sh, 0, 0);
3315  break;
3316 
3317  }
3318 }
3319 
3320 void D_PButt_CB(MOBJECT p, void *od, void *ad)
3321 {
3322 
3323  int c = (int) ad, er = 0;
3324  unsigned int *KDAT = 0;
3325  char buff[_MAX_PATH];
3326  char NFileNameF[_MAX_PATH];
3327  char str[_MAX_PATH];
3328  char fext[5];
3329  int l;
3330  char fname[128];
3331 
3332  FB_PREFS fbp;
3333 // strcpy (dirname, MGetCurrentDirectory ());
3334  fname[0] = '\0';
3335  NFileNameF[0]= '\0';
3336  memset (&fbp, 0, sizeof (fbp));
3337 
3338  fbp.change_cwd = True;
3339  fbp.allow_dir_create = True;
3340  fbp.allow_dir_rename = True;
3341  fbp.allow_dir_delete = True;
3342  fbp.transparent_tree = False;
3343  fbp.font = HELV_SMALL;
3344  fbp.button_font = HELV_SMALL;
3345  //Set Img file
3346  sprintf(str, "%s\\%s", BIL.DFILEM.HOMEDIRECTORY, "sys\\Tile2.bmp" );
3347  fbp.bg_image_file =str;
3348 
3349  switch (c)
3350  {
3351  case 0:
3352  MObjectGetText(p, buff);
3353  if(strcmp(buff,"Open")== 0)
3354  {
3355  //Open File For Plotting
3356  if(DAS.DOption.savingmode)
3357  er = MFileBrowseExt ("Select File for Plotting", "*.bif", fname, BIL.DFILEM.DATADIRECTORY, &fbp);
3358  else
3359  er = MFileBrowseExt ("Select File for Plotting", "*.dat", fname, BIL.DFILEM.DATADIRECTORY, &fbp);
3360  if(er)
3361  {
3362  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",BIL.DFILEM.DATADIRECTORY, fname);
3363  l = strlen(fname);
3364  strncpy(buff, fname+l-4, 4);
3365 
3366  if( (strcmp(buff,".dat") == 0) |(strcmp(buff,".Dat") == 0) )
3367  BIL.DFILEM.FKIND = FDAT;
3368  else if( (strcmp(buff,".bif") == 0) | (strcmp(buff,".Bif") == 0) )
3369  BIL.DFILEM.FKIND = FBIF;
3370  else if( (strcmp(buff,".bhg") == 0) | (strcmp(buff,".Bhg") == 0) )
3371  BIL.DFILEM.FKIND = FBIF;
3372  else
3373  {
3374  MMessageDialog("DAS information", "Unsupported format!!", " Ok ", NULL);
3375  break;
3376  }
3378  }
3379  else
3380  break;
3381  }
3382  else //Saving Image
3383  {
3384  //DB_SavingFile(.....)
3385  //NON PUO' SALVARE CON IL NOME AUTOMATICO
3386  if(DAS.DOption.filename) // Automatic file Names
3387  {
3388  er = MMessageDialog("DAS Information", "You can NOT save this spectrum with the Automatic File names mode.\nTo set the FREE FILE's NAME, please open DAS CONFIG-->\nOptions Tab-->Page1-->Saving File Names = FREE\n\nDO you want to Open the Config Panel? ", "Yes", "No", NULL);
3389  if (er == 0)
3390  //Open the Config
3391  MDCreateDASConfig();
3392  else if (er == 1)
3393  break;
3394 
3395  //D_Saving();
3396  }
3397  else // free choice
3398  {
3399  if(DAS.DOption.savingmode)
3400  er = MFileBrowseExt ("Save File as...", "*.bif", NFileNameF, BIL.DFILEM.DATADIRECTORY, &fbp);
3401  else
3402  er = MFileBrowseExt ("Save File as...", "*.dat", NFileNameF, BIL.DFILEM.DATADIRECTORY, &fbp);
3403  if(er)
3404  {
3405  //check the presence of the extension
3406  DI_FindExtName(NFileNameF, fext);
3407  if( strcmp(fext,"") == 0 )
3408  {
3409  if(DAS.DOption.savingmode)
3410  strcat(NFileNameF, ".bif");
3411  else
3412  strcat(NFileNameF, ".dat");
3413  }
3414  //check the the extension
3415  DI_FindExtName(NFileNameF, fext);
3416  if( (strcmp(fext,".dat") == 0) | (strcmp(fext,".Dat") == 0) )
3417  {
3418  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",BIL.DFILEM.DATADIRECTORY, NFileNameF);
3419  //Check the existence of the typed file
3420  if(DI_FileExist(BIL.DFILEM.DBFILENAME)) // DI_FileExist --> Return: 1 if PATH exist, else return 0
3421  {
3422  er = MMessageDialog("DAS Information", "The selected file already exists\nDo you want to ", "Overwrite", "Append", "Cancel", NULL);
3423  if (er == 0)
3424  {
3425 
3426  }
3427  else if (er == 1)
3428  {
3429  er = MMessageDialog("DAS Information", "In wich format do you want to save this file? ", "DAS Format", "Column Format" , NULL);
3430  if (er == 0)
3431  DB_Save(BIL.DFILEM.DBFILENAME, 0);
3432  else
3434 
3435  }
3436  else if (er == 2)
3437  break;
3438  }
3439  else
3440  {
3441  er = MMessageDialog("DAS Information", "In wich format do you want to save this file? ", "DAS Format", "Column Format" , NULL);
3442  if (er == 0)
3443  DB_Save(BIL.DFILEM.DBFILENAME, 0);
3444  else
3446 
3447 
3448 
3449  }
3450  }
3451  else if( (strcmp(fext,".bif") == 0) | (strcmp(fext,".Bif") == 0) )
3452  {
3453  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",BIL.DFILEM.DATADIRECTORY, NFileNameF);
3454  //Check the existence of the typed file
3455  if(DI_FileExist(BIL.DFILEM.DBFILENAME)) // DI_FileExist --> Return: 1 if PATH exist, else return 0
3456  {
3457  er = MMessageDialog("DAS Information", "The selected file already exists\nDo you want to ", "Overwrite", "Append", "Cancel", NULL);
3458  if (er == 0)
3459  {
3460 
3461  }
3462  else if (er == 1)
3463  DB_Save(BIL.DFILEM.DBFILENAME, 1);
3464  else if (er == 2)
3465  break;
3466 
3467 
3468  }
3469  else
3470  DB_Save(BIL.DFILEM.DBFILENAME, 1);
3471  }
3472  else
3473  {
3474  sprintf(buff, "The extension is not recognaized! Please re-type",fext);
3475  MMessageDialog("DAS information", buff, " Ok ", NULL);
3476  break;
3477  }
3478  }
3479  }
3480  }
3481  break;
3482  case 1:
3483  switch (BIL.DFILEM.FKIND)
3484  {
3485  case FDAT:
3486  ViewNext(NUMFDATI);
3487  break;
3488  case FBIF:
3490  break;
3491  }
3492  break;
3493  case 8:
3494  switch (BIL.DFILEM.FKIND)
3495  {
3496  case FDAT:
3498  break;
3499  case FBIF:
3501  break;
3502  }
3503  break;
3504 
3505  case 2:
3506  SetAsIo();
3507  break;
3508  case 3:
3509  switch (BIL.DFILEM.FKIND)
3510  {
3511  case FDAT:
3513  break;
3514  case FBIF:
3516  break;
3517  }
3518  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
3519  break;
3520  case 4:
3521  SetupPrinter();
3522 
3523  er = PrintObject(BIL.VFO.View_Sh, PM_FULL, -1, -1 );
3524  if (er)
3525  MMessageDialog("ALERT", "Print Problems", "Ok", NULL);
3526  break;
3527  case 5:
3528  ClosePlotCB(BIL.VFO.View_Sh, 0, 0);
3529  break;
3530  case 6:
3531 
3532  D_Lens();
3533  break;
3534  case 7:
3535  //SaveImage(DJPEG,0,0,0); //Save JPEG image
3536  D_PlotTools();
3537  break;
3538 // case 8:
3539 // break;
3540 
3541  }
3542 
3543 // return 0;
3544 
3545 }
3546 
3547 void DB_XUnitsCB(MOBJECT o, void *id, void *a_data)
3548 {
3549  int c = (int) a_data;
3550 
3551  switch(c)
3552  {
3553  case 0 :
3554  FLAG.Wl = 0;
3555  break;
3556  case 1:
3557  FLAG.Wl = 1;
3558  break;
3559  case 2:
3560  FLAG.Wl = 2;
3561  break;
3562 
3563  }
3564 
3565  if (BIL.DPLOT.ImatGraf)
3567 
3568 }
3569 
3572  char *ffilenames[] ={{"Empty"},
3573  {"Empty"},
3574  {"Empty"},
3575  {"Empty"},
3576  {"Empty"},
3577  {"Empty"},
3578  {"Clear List "}};
3579 
3580 
3581  int flagclear = 0;
3582  extern char NFileNameF[32];
3583 
3584 void PopUp_CB(MOBJECT obj, void *item, void *data)
3585 {
3586  int c = (int) data;
3587  char buf[32], str[_MAX_PATH];
3588  char fext[4];
3589 
3590  switch (c)
3591  {
3592  case 0:
3593  case 1:
3594  case 2:
3595  case 3:
3596  case 4:
3597  case 5:
3598 
3599  strcpy (buf, MMenuItemGetText (item));
3600  if(strcmp(buf, "Empty")==0)
3601  {
3602  if(MInputPrompt("Set File Name", "Type the new file name (with or without extension!)", buf, 31, "Exec", "Cancel"))
3603  {
3604  if(strcmp(buf, "Empty") != 0)
3605  {
3606  MMenuItemSetText (item, buf);
3607  MMessageDialog("DAS information", "Now you can save the spectrum.", " Ok ", NULL);
3608  }
3609  }
3610  }
3611  else
3612  {
3613  if (flagclear == 1)
3614  {
3615  flagclear = 0;
3616  MMenuItemSetText (item, "Empty" );
3617  }
3618  else
3619  {
3620  sprintf(NFileNameF,buf);
3621  //check the presence of the extension
3622  DI_FindExtName(NFileNameF, fext);
3623  if( strcmp(fext,"") == 0 )
3624  {
3625  if(DAS.DOption.savingmode)
3626  strcat(NFileNameF, ".bif");
3627  else
3628  strcat(NFileNameF, ".dat");
3629  }
3630  //check the the extension
3631  DI_FindExtName(NFileNameF, fext);
3632  if( (strcmp(fext,".dat") == 0) | (strcmp(fext,".Dat") == 0) | (strcmp(fext,".DAT") == 0) )
3633  {
3634  sprintf(BIL.DFILEM.DBFILENAME,"%s\\%s",BIL.DFILEM.DATADIRECTORY, NFileNameF);
3635  DB_Save(BIL.DFILEM.DBFILENAME, 0);
3636  sprintf(str, "Spectrum Saved on file %s", BIL.DFILEM.DBFILENAME);
3637  MMessageDialog("DAS Inf.", str, "OK", NULL);
3638 
3639  }
3640  else if( (strcmp(fext,".bif") == 0) | (strcmp(fext,".Bif") == 0)| (strcmp(fext,".BIF") == 0) )
3641  {
3642  sprintf(BIL.DFILEM.DBFILENAME,"%s\\%s",BIL.DFILEM.DATADIRECTORY, NFileNameF);
3643  DB_Save(BIL.DFILEM.DBFILENAME, 1);
3644  sprintf(str, "Spectrum Saved on file %s", BIL.DFILEM.DBFILENAME);
3645  MMessageDialog("DAS Inf.", str, "OK", NULL);
3646 
3647  }
3648  else
3649  {
3650  sprintf(buf, "The extension is not recognaized ",fext);
3651  MMessageDialog("DAS information", buf, " Ok ", NULL);
3652  break;
3653  }
3654  }
3655  }
3656  break;
3657  case 6:
3658  MObjectUnmap(obj);
3659  flagclear = 1;
3660 
3661 // for (i=0;i<6;i++)
3662 // MMenuItemSetText (item, );
3663  //item_pd = MMenuAddItemObsolete(popup_pd, ffilenames[i], PopUp_CB, (void *) i);
3664 
3665  MObjectRedraw(obj);
3666  MObjectMap(obj);
3667 /* MObjectUnmap(MOBJECT obj);
3668  void MObjectResize(MOBJECT obj, int w, int h);
3669  void MObjectDestroy(MOBJECT obj);
3670  MMenuItemSetText (item , "Empty");
3671 */
3672  break;
3673 
3674 
3675  }
3676 
3677 
3678 }
3679 
3680 
3681 /**************************************************
3682  * This callback opens a popup menu when the right
3683  * mouse button is pressed within the Object which
3684  * this callback is set to.
3685  * X and Y positions for this popup are those in the
3686  * mouse event.
3687  **************************************************/
3688 void PopupMenuCB (MOBJECT obj, MEvent * pe, void *pdown)
3689 {
3690 
3691  char buf[16];
3692 
3693  MObjectGetText(obj, buf);
3694  if(strcmp(buf,"Save As")== 0)
3695  {
3696  if (pe->mouse.button == Button3)
3697  MPopupMenu ((MOBJECT) pdown, pe->mouse.x_root, pe->mouse.y_root);
3698  }
3699 }
3700 
3701 
3702 
3703 
3704 void DB_EqTypePlotCB(MOBJECT o, void *a, void *v)
3705 {
3706 
3707  int er = 0;
3708  int c = (int) v;
3709 
3710 
3712 
3713  if(er)
3714  {
3715  switch (c)
3716  {
3717  case 0:
3718  DAS.Paramini.EqType = 0; //SPATRAM;
3719  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM",BIL.DFILEM.CONFIGDIRCOMMON);
3720  break;
3721  case 1:
3722  DAS.Paramini.EqType = 1; //TROPOGAS;
3723  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\TROPOGAS",BIL.DFILEM.CONFIGDIRCOMMON);
3724  break;
3725  case 2:
3726  DAS.Paramini.EqType = 2; //LIS;
3727  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\LIS",BIL.DFILEM.CONFIGDIRCOMMON);
3728  break;
3729  case 3:
3730  DAS.Paramini.EqType = 3; //SPATRAMPLUS;
3731  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAMPLUS",BIL.DFILEM.CONFIGDIRCOMMON);
3732  break;
3733  case 4:
3734  DAS.Paramini.EqType = 4; //GASCODNG1;
3735  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG1",BIL.DFILEM.CONFIGDIRCOMMON);
3736  break;
3737  case 5:
3738  DAS.Paramini.EqType = 5; //GASCODOffAxis;
3739  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODOA",BIL.DFILEM.CONFIGDIRCOMMON);
3740  break;
3741  case 6:
3742  DAS.Paramini.EqType = 6; //GASCODNG2;
3743  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG2",BIL.DFILEM.CONFIGDIRCOMMON);
3744  break;
3745  case 7:
3746  DAS.Paramini.EqType = 7; //GASCODNG3;
3747  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG3",BIL.DFILEM.CONFIGDIRCOMMON);
3748  break;
3749  case 8:
3750  DAS.Paramini.EqType = 8; //GASCODNG4;
3751  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\GASCODNG4",BIL.DFILEM.CONFIGDIRCOMMON);
3752  break;
3753  case 9:
3754  DAS.Paramini.EqType = 9; //SPATRAM2;
3755  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM2",BIL.DFILEM.CONFIGDIRCOMMON);
3756  break;
3757  case 10:
3758  DAS.Paramini.EqType = 10; //SPATRAM3;
3759  sprintf(BIL.DFILEM.CONFIGDIREQUIPMENT, "%s\\SPATRAM3",BIL.DFILEM.CONFIGDIRCOMMON);
3760  break;
3761  }
3762  }
3763  //write on equipment.ini the new setting
3764  WriteEquipini();
3765  //Load dispersion coefficients for the selected instrument
3766  er = LoadDB_DispCoeff();
3767  //refresh plot
3769 
3770 }
3771 
3772 
3773 
3774 
3775 int ViewPlot(int mod)
3776 {
3777  int i;
3778  int rformw,scrw;
3779  char buff[8];
3780  extern char PrgFile[_MAX_PATH];
3781 
3782  MOBJECT _tablefrm000;
3783  MOBJECT _rowform000;
3784  MOBJECT _tablefrm001;
3785  MOBJECT _colform000;
3786  MOBJECT _tablefrm002;
3787  MOBJECT _rowform001;
3788  MOBJECT _rowform002;
3789  MOBJECT _colform001;
3790  MOBJECT _colform002;
3791 
3792  MOBJECT _rowform003;
3793  MOBJECT _tablefrm003;
3794  MOBJECT _rowform004;
3795  MOBJECT _tablefrm004;
3796  MOBJECT _rowform005;
3797  MOBJECT _tablefrm005;
3798  MOBJECT _rowform006;
3799  MOBJECT _tablefrm006;
3800  MOBJECT lbl;
3801  MOBJECT tb, rb;
3802 
3803 
3804  plfont = FIXED_SMALL;
3805  alfont = HELV_SMALL;
3806 
3807 // plfont = MLoadFont("Times", 16, False, False);
3808 // alfont = MLoadFont("Arial", 16, False, False);
3809 
3810  if (mod)
3811  ON_OFFLINEPLOT = 1;
3812  else
3813  ON_OFFLINEPLOT = 0;
3814 
3815 
3816 
3817 
3818  BIL.VFO.View_Sh = MCreateShell("PLOTTING File: None", 0);
3819  MFormSetSpacing(BIL.VFO.View_Sh, 1);
3820  MObjectSetBackgroundRGB(BIL.VFO.View_Sh, 0, 0, 0);
3822 
3823 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
3824 //Menu
3825  if( (DAS.Flag.exemode == OFFLINEPLOT) | (DAS.Flag.exemode == DOASMODE))
3826  {
3827  MENU_ITEM item;
3829 
3830  dmenu = MCreateMenuBar(BIL.VFO.View_Sh, HELV_SMALL);
3831  MObjectSetBackgroundRGB(dmenu, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
3832  MObjectSetForegroundRGB(dmenu, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3833  MObjectSetFont(dmenu, alfont, True);
3834 
3835  MMenuBarSetAcc(dmenu, F10);
3836  Fmenu = MCreateMenu(dmenu, "File");
3837  Fitem[0] = MMenuAddItem(Fmenu, "Open", (MENU_ITEM_CB) MenuFileOLP_CB, 0);
3838  Fitem[1] = MMenuAddItem(Fmenu, "Next", (MENU_ITEM_CB) MenuFileOLP_CB, (void *) 1);
3840  Fitem[2] = MMenuAddItem(Fmenu, "Previous", (MENU_ITEM_CB) MenuFileOLP_CB, (void *)2);
3842  Fitem[3] = MMenuAddItem(Fmenu, "Save As...", (MENU_ITEM_CB) MenuFileOLP_CB, (void *)3);
3844  Fitem[4] = MMenuAddItem(Fmenu, "Close", (MENU_ITEM_CB) MenuFileOLP_CB, (void *)4);
3846  Fitem[5] = MMenuAddItem(Fmenu, "Close Plot", (MENU_ITEM_CB) MenuFileOLP_CB, (void *)5);
3847  //MakeItemUnsensitiveCB (Fmenu, Fitem[5], 0);
3848  Tmenu = MCreateMenu(dmenu, "Tools");
3849  Titem[0] = MMenuAddItem(Tmenu, "Filter/Smooth", (MENU_ITEM_CB) MenuToolsOLP_CB, 0);
3850  Titem[1] = MMenuAddItem(Tmenu, "Zoom", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)1);
3851  Titem[2] = MMenuAddItem(Tmenu, "Sun calculator", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)2);
3852  Titem[3] = MMenuAddItem(Tmenu, "Print ", (MENU_ITEM_CB) MenuToolsOLP_CB, (void *)3);
3853 
3854  Optmenu = MCreateMenu(dmenu, "Options");
3855  item = MMenuAddItem(Optmenu, "X Units", (MENU_ITEM_CB) NULL, 0);
3856  submenu = MCreateSubMenu(item);
3857  item = MMenuAddRadioItem(submenu, "Pixel", (MENU_ITEM_CB)DB_XUnitsCB, 0);
3858  if(FLAG.Wl == 0)
3859  MMenuItemSetCheckStatus (item, True);
3860  item = MMenuAddRadioItem(submenu, "Wl[A]", (MENU_ITEM_CB)DB_XUnitsCB, (void *)1);
3861  if(FLAG.Wl == 1)
3862  MMenuItemSetCheckStatus (item, True);
3863  item = MMenuAddRadioItem(submenu, "Wl[nm]", (MENU_ITEM_CB)DB_XUnitsCB, (void *)2);
3864  if(FLAG.Wl == 2)
3865  MMenuItemSetCheckStatus (item, True);
3866 /* if(FLAG.Wl == 0)
3867  MRButtonActivate(BIL.VFO.XAxisU[0]);
3868  else if(FLAG.Wl == 1)
3869  MRButtonActivate(BIL.VFO.XAxisU[1]);
3870  else if(FLAG.Wl == 2)
3871  MRButtonActivate(BIL.VFO.XAxisU[2]);
3872 
3873 */
3874  item = MMenuAddItem(Optmenu, "Y Scale", (MENU_ITEM_CB) NULL, 0);
3875  submenu = MCreateSubMenu(item);
3876  item = MMenuAddRadioItem(submenu, "Min/Max", (MENU_ITEM_CB)PBYScale_CB, 0);
3877  if(FLAG.plotYRange == 1)
3878  MMenuItemSetCheckStatus (item, True);
3879  item = MMenuAddRadioItem(submenu, "Full Range", (MENU_ITEM_CB)PBYScale_CB, (void *)1);
3880  if(FLAG.plotYRange == 0)
3881  MMenuItemSetCheckStatus (item, True);
3882 
3883  item = MMenuAddItem(Optmenu, "Hidden Lines", (MENU_ITEM_CB) NULL, 0);
3884 
3885  menu = MCreateMenu(dmenu, "Help");
3886  item = MMenuAddItem(menu, "About", (MENU_ITEM_CB) NULL, 0);
3887 
3888 
3889 
3890  }
3891 
3892 
3893 /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
3894 
3895  _tablefrm000 = MCreateTableForm(BIL.VFO.View_Sh, 2);
3896  MFormSetSpacing(_tablefrm000, 0);
3897 
3898  MTableFormSetColAlign(_tablefrm000, 1, CENTER_ALIGN);
3899  MObjectSetBackgroundRGB(_tablefrm000, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
3900  MObjectSetResize(_tablefrm000, True, True);
3901 
3902  _rowform000 = MCreateRowForm(_tablefrm000);
3903  MFormSetSpacing(_rowform000, 1);
3904  MObjectSetBackgroundRGB(_rowform000, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
3905 
3906  MObjectSetResize(_rowform000, True, True);
3907 
3908  _tablefrm001 = MCreateTableForm(_rowform000, 12);
3909  MFormSetSpacing(_tablefrm001, 2);
3910  MTableFormSetColAlign(_tablefrm001, 0, LEFT_ALIGN);
3911  MObjectSetBackgroundRGB(_tablefrm001, 184, 132, 0);
3912  MObjectSetBackgroundRGB(_tablefrm001, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
3913  MObjectSetResize(_tablefrm001, True, False);
3914 
3915  lbl = MCreateLabel(_tablefrm001, "Station:", plfont);
3916  //MLabelSetAlignment(lbl, LEFT_ALIGN);
3917  //MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
3918  //MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
3919  MObjectSetResize(lbl, True, True);
3920  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3921  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3922 
3923 
3924  lbl = MCreateLabel(_tablefrm001, "LAT:", plfont);
3925  //MLabelSetAlignment(lbl, LEFT_ALIGN);
3926  //MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
3927  //MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
3928  //MObjectSetCompositeWidth(lbl, 48);
3929  MObjectSetResize(lbl, True, True);
3930  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3931  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3932 
3933 
3934  lbl = MCreateLabel(_tablefrm001, "LON:", plfont);
3935  //MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
3936  //MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
3937  MObjectSetResize(lbl, True, True);
3938  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3939  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3940 
3941 
3942 
3943  lbl = MCreateLabel(_tablefrm001, "Date:", plfont);
3944  MObjectSetResize(lbl, True, True);
3945  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3946  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3947 
3948 
3949  lbl = MCreateLabel(_tablefrm001, "Time (LT):", plfont);
3950  MObjectSetResize(lbl, True, True);
3951  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3952  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3953 
3954  lbl = MCreateLabel(_tablefrm001, "Input Mirror:", plfont);
3955  MObjectSetResize(lbl, True, True);
3956  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3957  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3958 
3959  lbl = MCreateLabel(_tablefrm001, "Wavelength:", plfont);
3960  MObjectSetResize(lbl, True, True);
3961  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3962  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3963 
3964  lbl = MCreateLabel(_tablefrm001, "Filter:", plfont);
3965  MObjectSetResize(lbl, True, True);
3966  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3967  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3968 
3969  lbl = MCreateLabel(_tablefrm001, "NDFilter:", plfont);
3970  MObjectSetResize(lbl, True, True);
3971  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3972  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3973 
3974  lbl = MCreateLabel(_tablefrm001, "CCD Temp(ºC):", plfont);
3975  MObjectSetResize(lbl, True, True);
3976  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3977  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3978 
3979  lbl = MCreateLabel(_tablefrm001, "Exp.Time(sec):", plfont);
3980  MObjectSetResize(lbl, True, True);
3981  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3982  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3983 
3984  lbl = MCreateLabel(_tablefrm001, "Meas. N. :", plfont);
3985  MObjectSetResize(lbl, True, True);
3986  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
3987  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
3988 
3989  BIL.VFO.lblloc = MCreateLabel(_tablefrm001, "xxxxx", alfont);
3990  //MObjectSetShadow(BIL.VFO.lblloc, WS_SHADOW_IN, 1, 0);
3991  //MLabelSetAlignment(BIL.VFO.lblloc, RIGHT_ALIGN);
3993  MObjectSetForegroundRGB(BIL.VFO.lblloc, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
3994  MObjectSetBackgroundRGB(BIL.VFO.lblloc, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
3996 
3997  BIL.VFO.lbllat = MCreateLabel(_tablefrm001, "xxx.xx", alfont);
3998  //MObjectSetShadow(BIL.VFO.lbllat, WS_SHADOW_IN, 1, 0);
3999  //MLabelSetAlignment(BIL.VFO.lbllat, RIGHT_ALIGN);
4001  MObjectSetForegroundRGB(BIL.VFO.lbllat, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4002  MObjectSetBackgroundRGB(BIL.VFO.lbllat, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4004 
4005  BIL.VFO.lbllong = MCreateLabel(_tablefrm001, "xxx.xx", alfont);
4006  //MObjectSetShadow(BIL.VFO.lbllong, WS_SHADOW_IN, 1, 0);
4007  //MLabelSetAlignment(BIL.VFO.lbllong, RIGHT_ALIGN);
4009  MObjectSetForegroundRGB(BIL.VFO.lbllong, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4010  MObjectSetBackgroundRGB(BIL.VFO.lbllong, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4012 
4013 
4014  BIL.VFO.lbldate = MCreateLabel(_tablefrm001, "yyyy/mm/dd", alfont);
4016  MObjectSetForegroundRGB(BIL.VFO.lbldate, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4017  MObjectSetBackgroundRGB(BIL.VFO.lbldate, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4019 
4020  BIL.VFO.lbltime = MCreateLabel(_tablefrm001, "hh:mn:ss", alfont);
4022  MObjectSetForegroundRGB(BIL.VFO.lbltime, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4023  MObjectSetBackgroundRGB(BIL.VFO.lbltime, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4025 
4026  BIL.VFO.lblmirpos = MCreateLabel(_tablefrm001, "NULL", alfont);
4028  MObjectSetForegroundRGB(BIL.VFO.lblmirpos, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4029  MObjectSetBackgroundRGB(BIL.VFO.lblmirpos, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4031 
4032  BIL.VFO.lblwaveleng = MCreateLabel(_tablefrm001, "NULL", alfont);
4034  MObjectSetForegroundRGB(BIL.VFO.lblwaveleng, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4035  MObjectSetBackgroundRGB(BIL.VFO.lblwaveleng, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4037 
4038  BIL.VFO.lblfilter = MCreateLabel(_tablefrm001, "NULL", alfont);
4040  MObjectSetForegroundRGB(BIL.VFO.lblfilter, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4041  MObjectSetBackgroundRGB(BIL.VFO.lblfilter, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4043 
4044  BIL.VFO.lblndfilter = MCreateLabel(_tablefrm001, "NULL", alfont);
4046  MObjectSetForegroundRGB(BIL.VFO.lblndfilter, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4047  MObjectSetBackgroundRGB(BIL.VFO.lblndfilter, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4049 
4050  BIL.VFO.lblccdtemp = MCreateLabel(_tablefrm001, "+/- xx.xx", alfont);
4052  MObjectSetForegroundRGB(BIL.VFO.lblccdtemp, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4053  MObjectSetBackgroundRGB(BIL.VFO.lblccdtemp, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4055 
4056  BIL.VFO.lblccdtexp = MCreateLabel(_tablefrm001, "0.000", alfont);
4058  MObjectSetForegroundRGB(BIL.VFO.lblccdtexp, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4059  MObjectSetBackgroundRGB(BIL.VFO.lblccdtexp, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4061 
4062  BIL.VFO.lblnummeas = MCreateLabel(_tablefrm001, "0", alfont);
4064  MObjectSetForegroundRGB(BIL.VFO.lblnummeas, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4065  MObjectSetBackgroundRGB(BIL.VFO.lblnummeas, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4067 
4068 /****************/
4069 
4070  BIL.VFO.formbutt = MCreateColForm(_rowform000);
4071  MFormSetSpacing(BIL.VFO.formbutt, 1);
4072 // MObjectSetBackgroundRGB(BIL.VFO.formbutt, 64, 28, 128);
4073  MObjectSetBackgroundRGB(BIL.VFO.formbutt, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4074 
4075  if (mod)
4076  {
4077 
4078  if(IDY <= 16)
4079  {
4080  for (i=DAS.DOption.hlinebefore; i < IDY - DAS.DOption.hlineafter; i++)
4081  {
4082  sprintf(buff,"r. %d", i+1);
4083  BIL.DPLOT.pbr[i] = MCreatePButton(BIL.VFO.formbutt, buff, alfont);
4085  MObjectSetColor(BIL.DPLOT.pbr[i], MTCL.PLColor[i+2], MTCL.white);
4086  MPButtonSetCallback(BIL.DPLOT.pbr[i], D_pbr_CB, (void *) i);
4087  //MObjectSetBackgroundRGB(pbr[i], 197, 197, 144);
4088  MObjectSetShadow(BIL.DPLOT.pbr[i], WS_ETCHED_IN, 2, 1);
4089  }
4090  }
4091  else
4093  }
4094  else
4095  {
4096  BIL.DPLOT.OLDnR = 0;
4097 
4098  for (i=0; i < 16; i++)
4099  {
4100  sprintf(buff,"r. %d", i+1);
4101  BIL.DPLOT.pbr[i] = MCreatePButton(BIL.VFO.formbutt, buff, alfont);
4103  MObjectSetColor(BIL.DPLOT.pbr[i], MTCL.PLColor[i+2], MTCL.white);
4104  MPButtonSetCallback(BIL.DPLOT.pbr[i], D_pbr_CB, (void *) i);
4105  //MObjectSetBackgroundRGB(BIL.DPLOT.pbr[i], 197, 197, 144);
4106  MObjectSetShadow(BIL.DPLOT.pbr[i], WS_ETCHED_IN, 2, 1);
4107  MObjectUnmap(BIL.DPLOT.pbr[i]);
4108  }
4109 
4110 
4111  }
4112 
4113 //build the right column
4114 /************************************************/
4115 
4116  _rowform003 = MCreateRowForm(_tablefrm000);
4117  MFormSetSpacing(_rowform003, 0);
4118  MObjectAlign(_rowform003, LEFT_ALIGN, TOP_ALIGN);
4119 // MObjectSetBackgroundRGB(_rowform003, 175, 165, 75);
4120 // MObjectSetBackgroundRGB(_rowform003, 184, 132, 0);
4121  MObjectSetBackgroundRGB(_rowform003, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4122  MObjectSetResize(_rowform003, False, False);
4123 
4124  lbl = MCreateLabel(_rowform003, "Geo.Inf.", HELV_SMALL);
4126  MObjectSetBackgroundRGB(lbl, 144, 172, 184);
4127  MObjectSetTransparency(lbl, 0);
4128  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4129  MObjectSetResize(lbl, True, False);
4130 
4131  rformw = MObjectGetWidth(lbl);
4132 
4133  _tablefrm003 = MCreateTableForm(_rowform003, 2);
4134  MFormSetSpacing(_tablefrm003, 1);
4135  MTableFormSetColAlign(_tablefrm003, 0, LEFT_ALIGN);
4136 // MObjectAlign(_tablefrm003, LEFT_ALIGN, TOP_ALIGN);
4137 // MObjectSetForegroundRGB(_tablefrm003, 192, 192, 192);
4138 // MObjectSetBackgroundRGB(_tablefrm003, 184, 132, 0);
4139  MObjectSetBackgroundRGB(_tablefrm003, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4140  MObjectSetResize(_tablefrm003, False, False);
4141 /*
4142  lbl = MCreateLabel(_tablefrm003, "LOC: ", plfont);
4143  MLabelSetAlignment(lbl, LEFT_ALIGN);
4144  MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
4145  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4146  MObjectSetResize(lbl, True, True);
4147  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4148  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4149 
4150  BIL.VFO.lblloc = MCreateLabel(_tablefrm003, "xxxxx", alfont);
4151  MObjectSetShadow(BIL.VFO.lblloc, WS_SHADOW_IN, 1, 0);
4152  MLabelSetAlignment(BIL.VFO.lblloc, RIGHT_ALIGN);
4153  MObjectSetResize(BIL.VFO.lblloc, True, False);
4154  MObjectSetForegroundRGB(BIL.VFO.lblloc, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4155  MObjectSetBackgroundRGB(BIL.VFO.lblloc, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4156  MObjectSetTransparency(BIL.VFO.lblloc, 0);
4157 
4158  lbl = MCreateLabel(_tablefrm003, "LAT: ", plfont);
4159  MLabelSetAlignment(lbl, LEFT_ALIGN);
4160  MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
4161  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4162  MObjectSetCompositeWidth(lbl, 48);
4163  MObjectSetResize(lbl, True, True);
4164  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4165  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4166 
4167  BIL.VFO.lbllat = MCreateLabel(_tablefrm003, "xxx.xx", alfont);
4168  MObjectSetShadow(BIL.VFO.lbllat, WS_SHADOW_IN, 1, 0);
4169  MLabelSetAlignment(BIL.VFO.lbllat, RIGHT_ALIGN);
4170  MObjectSetResize(BIL.VFO.lbllat, True, False);
4171  MObjectSetForegroundRGB(BIL.VFO.lbllat, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4172  MObjectSetBackgroundRGB(BIL.VFO.lbllat, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4173  MObjectSetTransparency(BIL.VFO.lbllat, 0);
4174 
4175  lbl = MCreateLabel(_tablefrm003, "LON: ", plfont);
4176  MObjectAlign(lbl, LEFT_ALIGN, TOP_ALIGN);
4177  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4178  MObjectSetResize(lbl, True, True);
4179  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4180  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4181 
4182  BIL.VFO.lbllong = MCreateLabel(_tablefrm003, "xxx.xx", alfont);
4183  MObjectSetShadow(BIL.VFO.lbllong, WS_SHADOW_IN, 1, 0);
4184  MLabelSetAlignment(BIL.VFO.lbllong, RIGHT_ALIGN);
4185  MObjectSetResize(BIL.VFO.lbllong, False, False);
4186  MObjectSetForegroundRGB(BIL.VFO.lbllong, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4187  MObjectSetBackgroundRGB(BIL.VFO.lbllong, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4188  MObjectSetTransparency(BIL.VFO.lbllong, 0);
4189 */
4190  lbl = MCreateLabel(_tablefrm003, "ALT: ", plfont);
4192  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4193  MObjectSetResize(lbl, True, True);
4194  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4195  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4196 
4197  BIL.VFO.lblalt = MCreateLabel(_tablefrm003, "xxx", alfont);
4202  MObjectSetForegroundRGB(BIL.VFO.lblalt, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4203  MObjectSetBackgroundRGB(BIL.VFO.lblalt, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4205 
4206  lbl = MCreateLabel(_tablefrm003, "SZA: ", plfont);
4208  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4209  MObjectSetResize(lbl, True, True);
4210  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4211  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4212 
4213  BIL.VFO.lblsza = MCreateLabel(_tablefrm003, "xxx.xx", alfont);
4217  MObjectSetForegroundRGB(BIL.VFO.lblsza, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4218  MObjectSetBackgroundRGB(BIL.VFO.lblsza, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4220 
4221  lbl = MCreateLabel(_tablefrm003, "Zenith: ", plfont);
4223  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4224  MObjectSetResize(lbl, True, True);
4225  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4226  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4227 
4228  BIL.VFO.lblZenith = MCreateLabel(_tablefrm003, "xxx.xx", alfont);
4232  MObjectSetForegroundRGB(BIL.VFO.lblZenith, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4233  MObjectSetBackgroundRGB(BIL.VFO.lblZenith, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4235 
4236  lbl = MCreateLabel(_tablefrm003, "Azimuth: ", plfont);
4238  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4239  MObjectSetResize(lbl, True, True);
4240  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4241  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4242 
4243  BIL.VFO.lblAzimuth = MCreateLabel(_tablefrm003, "xxx.xx", alfont);
4247  MObjectSetForegroundRGB(BIL.VFO.lblAzimuth, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4248  MObjectSetBackgroundRGB(BIL.VFO.lblAzimuth, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4250 
4251  _rowform004 = MCreateRowForm(_rowform003);
4252  MFormSetSpacing(_rowform004, 0);
4253  MObjectSetBackgroundRGB(_rowform004, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4254 // MObjectSetBackgroundRGB(_rowform004, 184, 132, 0);
4255  MObjectSetResize(_rowform004, False, False);
4256 
4257  lbl = MCreateLabel(_rowform004, "Meas.Inf.", HELV_SMALL);
4259  MObjectSetBackgroundRGB(lbl, 144, 172, 184);
4260  MObjectSetTransparency(lbl, 0);
4261  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4262  MObjectSetResize(lbl, True, False);
4263 
4264  _tablefrm004 = MCreateTableForm(_rowform004, 2);
4265  MFormSetSpacing(_tablefrm004, 1);
4266  MTableFormSetColAlign(_tablefrm004, 0, LEFT_ALIGN);
4267  MObjectAlign(_tablefrm004, LEFT_ALIGN, TOP_ALIGN);
4268 // MObjectSetForegroundRGB(_tablefrm004, 192, 192, 192);
4269 // MObjectSetBackgroundRGB(_tablefrm004, 184, 132, 0);
4270  MObjectSetBackgroundRGB(_tablefrm004, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4271  MObjectSetResize(_tablefrm004, True, False);
4272 
4273  lbl = MCreateLabel(_tablefrm004, "Max:", plfont);
4275  MLabelSetMargin(lbl, 2, 2);
4277  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4278  MObjectSetResize(lbl, True, True);
4279  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4280  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4281 
4282  BIL.VFO.lblmax = MCreateLabel(_tablefrm004, "xxxxx", alfont);
4286  MObjectSetForegroundRGB(BIL.VFO.lblmax, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4287  MObjectSetBackgroundRGB(BIL.VFO.lblmax, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4289 
4290  lbl = MCreateLabel(_tablefrm004, "Min:", plfont);
4293  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4294  MObjectSetResize(lbl, True, True);
4295  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4296  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4297 
4298  BIL.VFO.lblmin = MCreateLabel(_tablefrm004, "xxxxx", alfont);
4302  MObjectSetForegroundRGB(BIL.VFO.lblmin, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4303  MObjectSetBackgroundRGB(BIL.VFO.lblmin, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4305 
4306 /******************************************/
4307 
4308  lbl = MCreateLabel(_tablefrm004, "ccdWx:", plfont);
4310  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4311  MObjectSetResize(lbl, True, True);
4312  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4313  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4314 
4315  BIL.VFO.lblccdwx = MCreateLabel(_tablefrm004, "xxxx", alfont);
4319  MObjectSetForegroundRGB(BIL.VFO.lblccdwx, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4320  MObjectSetBackgroundRGB(BIL.VFO.lblccdwx, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4322 
4323  lbl = MCreateLabel(_tablefrm004, "ccdWy:", plfont);
4325  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4326  MObjectSetResize(lbl, True, True);
4327  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4328  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4329 
4330  BIL.VFO.lblccdwy = MCreateLabel(_tablefrm004, "xxxx", alfont);
4334  MObjectSetForegroundRGB(BIL.VFO.lblccdwy, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4335  MObjectSetBackgroundRGB(BIL.VFO.lblccdwy, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4337 
4338 
4339 /*********************************************/
4340 
4341  lbl = MCreateLabel(_tablefrm004, "ccdSx:", plfont);
4343  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4344  MObjectSetResize(lbl, True, True);
4345  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4346  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4347 
4348  BIL.VFO.lblccdsx = MCreateLabel(_tablefrm004, "xxxx", alfont);
4352  MObjectSetForegroundRGB(BIL.VFO.lblccdsx, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4353  MObjectSetBackgroundRGB(BIL.VFO.lblccdsx, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4355 
4356  lbl = MCreateLabel(_tablefrm004, "ccdSy:", plfont);
4358  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4359  MObjectSetResize(lbl, True, True);
4360  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4361  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4362 
4363  BIL.VFO.lblccdsy = MCreateLabel(_tablefrm004, "xxxx", alfont);
4367  MObjectSetForegroundRGB(BIL.VFO.lblccdsy, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4368  MObjectSetBackgroundRGB(BIL.VFO.lblccdsy, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4370 
4371  lbl = MCreateLabel(_tablefrm004, "ccdEx:", plfont);
4373  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4374  MObjectSetResize(lbl, True, True);
4375  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4376  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4377 
4378  BIL.VFO.lblccdex = MCreateLabel(_tablefrm004, "xxxx", alfont);
4382  MObjectSetForegroundRGB(BIL.VFO.lblccdex, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4383  MObjectSetBackgroundRGB(BIL.VFO.lblccdex, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4385 
4386  lbl = MCreateLabel(_tablefrm004, "ccdEy:", plfont);
4387  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4388  MObjectSetResize(lbl, True, True);
4389  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4390  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4391 
4392  BIL.VFO.lblccdey = MCreateLabel(_tablefrm004, "xxxx", alfont);
4396  MObjectSetForegroundRGB(BIL.VFO.lblccdey, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4397  MObjectSetBackgroundRGB(BIL.VFO.lblccdey, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4399 
4400  lbl = MCreateLabel(_tablefrm004, "ccdVB:", plfont);
4401  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4402  MObjectSetResize(lbl, True, True);
4403  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4404  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4405 
4406  BIL.VFO.lblvb = MCreateLabel(_tablefrm004, "xxx",alfont);
4407  MObjectSetShadow(BIL.VFO.lblvb, WS_SHADOW_IN, 1, 0);
4410  MObjectSetForegroundRGB(BIL.VFO.lblvb, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4411  MObjectSetBackgroundRGB(BIL.VFO.lblvb, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4413 
4414  lbl = MCreateLabel(_tablefrm004, "Rows#", plfont);
4415  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4416  MObjectSetResize(lbl, True, True);
4417  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4418  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4419 
4420  BIL.VFO.lblnr = MCreateLabel(_tablefrm004, "xxx", alfont);
4421  MObjectSetShadow(BIL.VFO.lblnr, WS_SHADOW_IN, 1, 0);
4424  MObjectSetForegroundRGB(BIL.VFO.lblnr, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4425  MObjectSetBackgroundRGB(BIL.VFO.lblnr, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4427 
4428  _rowform005 = MCreateRowForm(_rowform004);
4429  MFormSetSpacing(_rowform005, 0);
4430  MObjectSetBackgroundRGB(_rowform005, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4431 // MObjectSetBackgroundRGB(_rowform005, 184, 132, 0);
4432  MObjectSetResize(_rowform005, True, False);
4433 
4434  lbl = MCreateLabel(_rowform005, "Command", HELV_SMALL);
4435  MObjectSetBackgroundRGB(lbl, 144, 172, 184);
4436  MObjectSetTransparency(lbl, 0);
4437  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4438  MObjectSetResize(lbl, True, False);
4439 
4440  _tablefrm005 = MCreateTableForm(_rowform005, 2);
4441  MFormSetSpacing(_tablefrm005, 0);
4442  MObjectSetBackgroundRGB(_tablefrm005, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4443 // MObjectSetBackgroundRGB(_tablefrm005, 184, 132, 0);
4444  MObjectSetResize(_tablefrm005, True, False);
4445 
4446  _rowform006 = MCreateRowForm(_tablefrm005);
4447  MFormSetSpacing(_rowform006, 0);
4448  MObjectSetBackgroundRGB(_rowform006, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4449 // MObjectSetBackgroundRGB(_rowform006, 184, 132, 0);
4450  MObjectSetResize(_rowform006, False, False);
4451 
4453  for (i=0;i<7;i++)
4454  //item_pd = MMenuAddItem(popup_pd, "Empty", (MENU_ITEM_CB) PopUp_CB, (void *) i);
4456 
4457  BIL.VFO.cmdpb[0] = MCreatePButton(_rowform006, "Open", alfont);
4458  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[0], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4459  MButtonSetOnMouseOverForegroundRGB(BIL.VFO.cmdpb[0], 0, 0, 255);
4460  MPButtonSetCallback(BIL.VFO.cmdpb[0], D_PButt_CB, (void *) 0);
4461  MObjectSetCompositeWidth(BIL.VFO.cmdpb[0], 90);
4463  if (mod)
4465 
4466 
4467  BIL.VFO.cmdpb[1] = MCreatePButton(_rowform006, "Next", alfont);
4468  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[1], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4469  MPButtonSetCallback(BIL.VFO.cmdpb[1], D_PButt_CB, (void *) 1);
4470  MObjectSetCompositeWidth(BIL.VFO.cmdpb[1], 90);
4472 
4473  BIL.VFO.cmdpb[8] = MCreatePButton(_rowform006, "Previous", alfont);
4474  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[8], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4475  MPButtonSetCallback(BIL.VFO.cmdpb[8], D_PButt_CB, (void *) 8);
4476  MObjectSetCompositeWidth(BIL.VFO.cmdpb[8], 90);
4478 
4479 
4480  BIL.VFO.cmdpb[2] = MCreatePButton(_rowform006, "Set as Io", alfont);
4481  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[2], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4482  MPButtonSetCallback(BIL.VFO.cmdpb[2], D_PButt_CB, (void *) 2);
4483  MObjectSetCompositeWidth(BIL.VFO.cmdpb[2], 90);
4485 
4486  BIL.VFO.cmdpb[3] = MCreatePButton(_rowform006, "Close File", alfont);
4487  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[3], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4488  MPButtonSetCallback(BIL.VFO.cmdpb[3], D_PButt_CB, (void *) 3);
4489  MObjectSetCompositeWidth(BIL.VFO.cmdpb[3], 90);
4490  MObjectSetUnsensitive(BIL.VFO.cmdpb[3]); // Set "CloseFile" button as Unsensitive
4491 
4492  BIL.VFO.cmdpb[4] = MCreatePButton(_rowform006, "Print", alfont);
4493  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[4], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4494  MObjectSetCompositeWidth(BIL.VFO.cmdpb[4], 90);
4495  MPButtonSetCallback(BIL.VFO.cmdpb[4], D_PButt_CB, (void *) 4);
4496  MObjectSetUnsensitive(BIL.VFO.cmdpb[4]); // Set "Print" button as Unsensitive
4497 
4498  BIL.VFO.cmdpb[6] = MCreatePButton(_rowform006, "Zoom", alfont);
4499  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[6], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4500  MPButtonSetCallback(BIL.VFO.cmdpb[6], D_PButt_CB, (void *) 6);
4501  MObjectSetCompositeWidth(BIL.VFO.cmdpb[6], 90);
4502  MObjectSetUnsensitive(BIL.VFO.cmdpb[6]);
4503 
4504  BIL.VFO.cmdpb[7] = MCreatePButton(_rowform006, "Tools", alfont);
4505  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[7], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4506  MPButtonSetCallback(BIL.VFO.cmdpb[7], D_PButt_CB, (void *) 7);
4507  MObjectSetCompositeWidth(BIL.VFO.cmdpb[7], 90);
4508  MObjectSetUnsensitive(BIL.VFO.cmdpb[7]);
4509 
4510  if(DAS.Flag.exemode == OFFLINEPLOT)
4511  BIL.VFO.cmdpb[5] = MCreatePButton(_rowform006, "Quit", alfont);
4512  else
4513  BIL.VFO.cmdpb[5] = MCreatePButton(_rowform006, "Close Win", alfont);
4514 
4515  MObjectSetBackgroundRGB(BIL.VFO.cmdpb[5], DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4516  MPButtonSetCallback(BIL.VFO.cmdpb[5], D_PButt_CB, (void *) 5);
4517  MObjectSetCompositeWidth(BIL.VFO.cmdpb[5], 90);
4518 
4519 
4520 /**********************************************/
4521 
4522 if( (!DAS.Flag.exemode == OFFLINEPLOT) | (!DAS.Flag.exemode == DOASMODE))
4523 {
4524 
4525 
4526  _colform002 = MCreateColForm(_rowform000);
4527  MFormSetSpacing(_colform002, 1);
4528 // MObjectSetBackgroundRGB(_colform002, 64, 28, 128);
4529  MObjectSetBackgroundRGB(_colform002, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4530 
4531  // MObjectSetResize(_colform002, True, True);
4532 
4533  _tablefrm006 = MCreateTableForm(_colform002, 7);
4534  MFormSetSpacing(_tablefrm006, 1);
4535 // MObjectSetBackgroundRGB(_tablefrm006, 64, 28, 128);
4536  MObjectSetBackgroundRGB(_tablefrm006, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4537  MObjectSetResize(_tablefrm006, False, False);
4538  MObjectAlign(_tablefrm006, CENTER_ALIGN, TOP_ALIGN);
4539 
4540  lbl = MCreateLabel(_tablefrm006, "X:", plfont);
4542  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4543  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4544  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4545  MObjectSetCompositeWidth(lbl, 30);
4546  //MObjectSetResize(lbl, True, True);
4547 
4548  BIL.VFO.xloc = MCreateLabel(_tablefrm006, "xxxxx", alfont);
4550  MObjectSetForegroundRGB(BIL.VFO.xloc, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4551  MObjectSetBackgroundRGB(BIL.VFO.xloc, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4552  MObjectSetShadow(BIL.VFO.xloc, WS_SHADOW_IN, 1, 0);
4555  //MObjectSetResize(BIL.VFO.xloc, True, True);
4556 
4557  BIL.VFO.xincr = MCreateLabel(_tablefrm006, "Dx = xx", alfont);
4559  MObjectSetForegroundRGB(BIL.VFO.xincr, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4560  MObjectSetBackgroundRGB(BIL.VFO.xincr, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4561  MObjectSetShadow(BIL.VFO.xincr, WS_SHADOW_IN, 1, 0);
4563  //MObjectSetResize(BIL.VFO.xincr, True, True);
4564 
4565 
4566  lbl = MCreateLabel(_tablefrm006, "Y:", plfont);
4568  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4569  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4570  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4571  MObjectSetCompositeWidth(lbl, 30);
4572 // MObjectSetResize(lbl, True, True);
4573 
4574 
4575  BIL.VFO.yloc = MCreateLabel(_tablefrm006, "xxxxx", alfont);
4577  MObjectSetShadow(BIL.VFO.yloc, WS_SHADOW_IN, 1, 0);
4578  MObjectSetForegroundRGB(BIL.VFO.yloc, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4579  MObjectSetBackgroundRGB(BIL.VFO.yloc, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4582  // MObjectSetResize(BIL.VFO.yloc, True, True);
4583 
4584 
4585  BIL.VFO.yincr = MCreateLabel(_tablefrm006, "Dy = xx", alfont);
4587  MObjectSetForegroundRGB(BIL.VFO.yincr, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4588  MObjectSetBackgroundRGB(BIL.VFO.yincr, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4589  MObjectSetShadow(BIL.VFO.yincr, WS_SHADOW_IN, 1, 0);
4590 // MObjectSetTransparency(BIL.VFO.yincr,0);
4592  // MObjectSetResize(BIL.VFO.xloc, True, True);
4593 
4594 
4595 
4596  BIL.VFO.selallpb = MCreatePButton(_tablefrm006, "Select All", alfont);
4597  MObjectSetBackgroundRGB(BIL.VFO.selallpb, DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4598  MPButtonSetCallback(BIL.VFO.selallpb, PButtSelAll_CB, (void *) 0);
4600  if(mod) //Onlineplot
4602  else
4604 
4605 
4606 /*****************/
4607 
4608  _tablefrm006 = MCreateTableForm(_colform002, 6);
4609  MFormSetSpacing(_tablefrm006, 1);
4610  MObjectSetBackgroundRGB(_tablefrm006, 64, 28, 128);
4611  MObjectSetBackgroundRGB(_tablefrm006, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4612  MObjectSetResize(_tablefrm006, False, False);
4613  MObjectAlign(_tablefrm006, CENTER_ALIGN, TOP_ALIGN);
4614 
4615  lbl = MCreateLabel(_tablefrm006, "Y Scale:", plfont);
4617  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4618  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4619  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4620 // MObjectSetCompositeWidth(lbl, 30);
4621 
4622  if (FLAG.plotYRange == 0)
4623  sprintf(buff,"Full Range");
4624  else
4625  sprintf(buff,"Min/Max");
4626 
4627  BIL.VFO.YScalePB = MCreatePButton(_tablefrm006, buff, alfont);
4628  MObjectSetBackgroundRGB(BIL.VFO.YScalePB, DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
4631  MPButtonSetCallback(BIL.VFO.YScalePB, PBYScale_CB, (void *) 0);
4632  if(mod) //Onlineplot
4634  else
4636 
4637 
4638  lbl = MCreateLabel(_tablefrm006, "X Units:", plfont);
4640  MObjectSetShadow(lbl, WS_SHADOW_IN, 1, 0);
4641  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4642  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4643 
4644 
4645  BIL.VFO.XAxisU[0] = MCreateRButton(_tablefrm006, "Pixel", alfont);
4646  MPButtonSetCallback(BIL.VFO.XAxisU[0], DB_XUnitsCB, (void *) 0);
4648  MObjectSetForegroundRGB(BIL.VFO.XAxisU[0], DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4649  MObjectSetBackgroundRGB(BIL.VFO.XAxisU[0], DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4650  MObjectSetTransparency(BIL.VFO.XAxisU[0],0);
4651 
4652  BIL.VFO.XAxisU[1] = MCreateRButton(_tablefrm006, "Wl [A]", alfont);
4653  MPButtonSetCallback(BIL.VFO.XAxisU[1], DB_XUnitsCB, (void *) 1);
4655  MObjectSetForegroundRGB(BIL.VFO.XAxisU[1], DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4656  MObjectSetBackgroundRGB(BIL.VFO.XAxisU[1], DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4657  MObjectSetTransparency(BIL.VFO.XAxisU[1],0);
4658 
4659  BIL.VFO.XAxisU[2] = MCreateRButton(_tablefrm006, "Wl [nm]", alfont);
4660  MPButtonSetCallback(BIL.VFO.XAxisU[2], DB_XUnitsCB, (void *) 2);
4662  MObjectSetForegroundRGB(BIL.VFO.XAxisU[2], DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
4663  MObjectSetBackgroundRGB(BIL.VFO.XAxisU[2], DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
4664  MObjectSetTransparency(BIL.VFO.XAxisU[2],0);
4665 
4666  if(FLAG.Wl == 0)
4667  MRButtonActivate(BIL.VFO.XAxisU[0]);
4668  else if(FLAG.Wl == 1)
4669  MRButtonActivate(BIL.VFO.XAxisU[1]);
4670  else if(FLAG.Wl == 2)
4671  MRButtonActivate(BIL.VFO.XAxisU[2]);
4672 }
4673 
4674 
4675 
4676 /*****************************/
4677 
4678  _colform000 = MCreateColForm(_rowform000);
4679  MFormSetSpacing(_colform000, 1);
4680  MObjectSetBackgroundRGB(_colform000, 64, 28, 128);
4681 
4682 
4683  _tablefrm002 = MCreateTableForm(_colform000, 2);
4684  MFormSetSpacing(_tablefrm002, 1);
4685  MTableFormSetColAlign(_tablefrm002, 0, LEFT_ALIGN);
4686  MTableFormSetColAlign(_tablefrm002, 1, LEFT_ALIGN);
4687  MTableFormSetRowAlign(_tablefrm002, 0, TOP_ALIGN);
4688  MObjectSetBackgroundRGB(_tablefrm002, 64, 28, 128);
4689  MObjectSetBackgroundRGB(_tablefrm002, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4690  MObjectSetResize(_tablefrm002, True, True);
4691 
4692  _rowform001 = MCreateRowForm(_tablefrm002);
4693  MFormSetSpacing(_rowform001, 1);
4694  MObjectSetBackgroundRGB(_rowform001, 184, 192, 240);
4695  MObjectSetResize(_rowform001, False, True);
4696 
4697 
4698  for (i=0; i<(sizeof(BIL.VFO.lblY)/sizeof(BIL.VFO.lblY[0])); i++)
4699  {
4700  BIL.VFO.lblY[i] = MCreateLabel(_rowform001, "-------", alfont);
4701  MObjectSetShadow(BIL.VFO.lblY[i], WS_NONE, 0, 0);
4702  if(i==0)
4704  if(i==sizeof(BIL.VFO.lblY)/sizeof(BIL.VFO.lblY[0])-1)
4706  MObjectSetResize(BIL.VFO.lblY[i], True, True);
4707  }
4708 
4709 /********************************************************************/
4710 /* DRAW AREA */
4711 /********************************************************************/
4712 
4713  rformw = MObjectGetWidth(_rowform003);
4714  scrw = MGetScreenWidth();
4715  maxplotw = scrw - 200;
4716  if (mod) //On line Plot
4717  {
4718  BIL.DPLOT.drawapl = MCreateDrawArea(_tablefrm002, maxplotw, 480); //1044 580
4720  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
4724  }
4725 
4726  else
4727  {
4728  BIL.DPLOT.drawapl = MCreateDrawArea(_tablefrm002, maxplotw, 480);
4730  MObjectSetBackgroundRGB(BIL.DPLOT.drawapl, 220, 220, 220);
4733  }
4734 
4735 
4736 /********************************************************************/
4737 
4740  BIL.BLENS.Imim = MAllocImage(maxplotw, maxploth, 24);
4741 
4742  InitImage(BIL.BLENS.Imim, maxplotw, maxploth, 192, 192, 192);
4743 
4744 
4745 
4746 
4747 
4748  _rowform002 = MCreateRowForm(_tablefrm002);
4749  MFormSetSpacing(_rowform002, 1);
4750  MObjectAlign(_rowform002, LEFT_ALIGN, BOTTOM_ALIGN);
4751  MObjectSetShadow(_rowform002, WS_SHADOW_IN, 1, 0);
4752  MObjectSetResize(_rowform002, False, False);
4753 
4754  _colform001 = MCreateColForm(_tablefrm002);
4755  MFormSetSpacing(_colform001, 1);
4756  MObjectAlign(_colform001, LEFT_ALIGN, BOTTOM_ALIGN);
4757  MObjectSetBackgroundRGB(_colform001, 184, 192, 240);
4758  MObjectSetResize(_colform001, True, True);
4759 
4760  for (i=0; i<17; i++)
4761  {
4762  BIL.VFO.lblX[i] = MCreateLabel(_colform001, "-----", alfont);
4763 // MObjectSetShadow(BIL.VFO.lblX[i], WS_SHADOW_IN, 1, 0);
4764  MObjectSetShadow(BIL.VFO.lblX[i], WS_NONE, 0, 0);
4765 
4766  MObjectSetResize(BIL.VFO.lblX[i], False, True);
4767  if(i==0)
4769  if(i==sizeof(BIL.VFO.lblX)/sizeof(BIL.VFO.lblX[0]) - 1)
4770  {
4772  //MLabelSetAlignment(BIL.VFO.lblX[i], RIGHT_ALIGN);
4773 
4774  }
4775  }
4776 
4777 
4778 
4779  tb = MCreateColForm(BIL.VFO.View_Sh);
4780  MFormSetSpacing(tb, 0);
4781  //MTableFormSetColAlign(tb, 0, LEFT_ALIGN);
4782  MObjectSetBackgroundRGB(tb, 184, 132, 0);
4783  MObjectSetBackgroundRGB(tb, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
4784  MObjectSetResize(tb, True, False);
4785 
4786  lbl = MCreateLabel(tb, "Equipment:", plfont);
4787  MObjectSetResize(lbl, False, True);
4789  MObjectSetForegroundRGB(lbl, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
4790  MObjectSetBackgroundRGB(lbl, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
4791 
4792  rb = MCreateRButton(tb, "SPATRAMPLUS", FIXED_SMALL);
4793  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 3);
4795  MObjectSetForegroundRGB(rb, 255, 255, 255);
4796  MObjectSetCompositeWidth(rb, 105);
4797  if(DAS.Paramini.EqType == 3)
4798  MRButtonActivate(rb);
4799 
4800  rb = MCreateRButton(tb, "SPATRAM2", FIXED_SMALL);
4801  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 9);
4803  MObjectSetForegroundRGB(rb, 255, 255, 255);
4804  MObjectSetCompositeWidth(rb, 105);
4805  if(DAS.Paramini.EqType == 9)
4806  MRButtonActivate(rb);
4807 
4808  rb = MCreateRButton(tb, "SPATRAM3", FIXED_SMALL);
4809  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 10);
4811  MObjectSetForegroundRGB(rb, 255, 255, 255);
4812  MObjectSetCompositeWidth(rb, 105);
4813  if(DAS.Paramini.EqType == 10)
4814  MRButtonActivate(rb);
4815 
4816  /* rb = MCreateRButton(tb, "SPATRAM", FIXED_SMALL);
4817  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 0);
4818  MObjectAlign(rb, LEFT_ALIGN, TOP_ALIGN);
4819  MObjectSetForegroundRGB(rb, 255, 255, 255);
4820  MObjectSetCompositeWidth(rb, 85);
4821  if( DAS.Paramini.EqType == 0)
4822  MRButtonActivate(rb);
4823  */
4824  rb = MCreateRButton(tb, "TROPOGAS", FIXED_SMALL);
4825  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 1);
4827  MObjectSetForegroundRGB(rb, 255, 255, 255);
4828  MObjectSetCompositeWidth(rb, 85);
4829  if(DAS.Paramini.EqType == 1)
4830  MRButtonActivate(rb);
4831 
4832  rb = MCreateRButton(tb, "LIS", FIXED_SMALL);
4833  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 2);
4835  MObjectSetForegroundRGB(rb, 255, 255, 255);
4836  MObjectSetCompositeWidth(rb, 85);
4837  if(DAS.Paramini.EqType == 2)
4838  MRButtonActivate(rb);
4839 
4840  rb = MCreateRButton(tb, "GASCODNG1", FIXED_SMALL);
4841  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 4);
4843  MObjectSetForegroundRGB(rb, 255, 255, 255);
4844  MObjectSetCompositeWidth(rb, 85);
4845  if(DAS.Paramini.EqType == 4)
4846  MRButtonActivate(rb);
4847 
4848  /* rb = MCreateRButton(tb, "GASCODOffAxis", FIXED_SMALL);
4849  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 5);
4850  MObjectAlign(rb, LEFT_ALIGN, UNDEF_ALIGN);
4851  MObjectSetForegroundRGB(rb, 255, 255, 255);
4852  MObjectSetCompositeWidth(rb, 105);
4853  if(DAS.Paramini.EqType == 5)
4854  MRButtonActivate(rb);
4855  */
4856 
4857 
4858  rb = MCreateRButton(tb, "GASCODNG2", FIXED_SMALL);
4859  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 6);
4861  MObjectSetForegroundRGB(rb, 255, 255, 255);
4862  MObjectSetCompositeWidth(rb, 105);
4863  if(DAS.Paramini.EqType == 6)
4864  MRButtonActivate(rb);
4865 
4866  rb = MCreateRButton(tb, "GASCODNG3", FIXED_SMALL);
4867  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 7);
4869  MObjectSetForegroundRGB(rb, 255, 255, 255);
4870  MObjectSetCompositeWidth(rb, 105);
4871  if(DAS.Paramini.EqType == 7)
4872  MRButtonActivate(rb);
4873 
4874  rb = MCreateRButton(tb, "GASCODNG4", FIXED_SMALL);
4875  MPButtonSetCallback(rb, DB_EqTypePlotCB, (void *) 8);
4877  MObjectSetForegroundRGB(rb, 255, 255, 255);
4878  MObjectSetCompositeWidth(rb, 105);
4879  if(DAS.Paramini.EqType == 8)
4880  MRButtonActivate(rb);
4881 
4882 
4883 
4884 
4885  MShellRealizeXY( BIL.VFO.View_Sh, 0, 0);
4886 
4887 // MUnloadFont(alfont);
4888 // MUnloadFont(plfont);
4889 
4890 
4891 // rformw = MObjectGetWidth(_rowform003);
4892 
4893 
4894  if( ((PrgFile[0] != 0) | (Master == 1)) & (FLAG.exec == 1) )
4895  {
4896  delay(4000);
4897  ClosePlotCB(BIL.VFO.View_Sh, 0, 0);
4898  }
4899 
4900 
4901 
4902  return 0;
4903 
4904 }
void MObjectSetColor(MOBJECT obj, MTColor bgc, MTColor fgc)
char PrgFile[16]
Name of the PRG file.
Definition: DAS_Spat.c:91
flag FLAG
Definition: CreateForms.c:84
struct ddate DATE
Definition: bildef.h:134
void MMenuItemSetText(MENU_ITEM item, const char *text)
#define E_BUTTON_RELEASE
Definition: Mguidefs.h:276
int ReadHeader_ASCII(int mod, FILE *fd)
Read ASCII Header of the measurement. .
Definition: Spat_Plot.c:1877
#define RIGHT_ALIGN
Definition: Mguidefs.h:916
mtcl MTCL
Definition: 2DPlot.c:30
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
unsigned int LocX
Definition: bildef.h:15
#define WS_NONE
Definition: Mguidefs.h:956
U16 DimY[MAXIMG]
Definition: Dildef.h:577
MOBJECT lblmin
Definition: bildef.h:54
MIMAGE Imim
Definition: bildef.h:14
char comment[255]
Definition: bildef.h:157
Definition: Dildef.h:277
MOBJECT selallpb
Definition: bildef.h:68
void WriteIMG(FILE *file, unsigned short *mat, int hp, int vp)
Definition: Spat_Plot.c:1178
MOBJECT YScalePB
Definition: bildef.h:70
unsigned int ccdmax
Definition: bildef.h:142
int WriteEquipini(void)
Write equipment.ini file .
double COSTX
Definition: bildef.h:181
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
MOBJECT lbl
Definition: DFileMan.c:42
double S_zenetr
Definition: SOLPOS.C:92
void CloseFile_BIN(int fd, int hp, int vp)
Definition: Spat_Plot.c:1382
MOBJECT cmdpb[10]
Definition: bildef.h:69
MOBJECT yincr
Definition: bildef.h:67
char StrTime[8]
Definition: bildef.h:136
int Server
Definition: DAS_Spat.c:253
#define WS_SHADOW_IN
Definition: Mguidefs.h:958
Definition: DOASdef.h:16
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
void SwapMatrix(unsigned short *source, unsigned short *dest, int hp, int vp)
Copy the source matrix in the Destination one .
Definition: Spat_Plot.c:1979
optionini DOption
Options for DAS execution.
void MMenuBarSetAcc(MOBJECT menu, int acc)
int savingmode
Flag to set saving mode: 0=ASCII, 1=Binary.
MIMAGE LensMim
Definition: bildef.h:12
U8 Iacc[MAXIMG]
Definition: Dildef.h:567
void MDrawXorLine(MOBJECT p, int x1, int y1, int x2, int y2)
double alititude
Station altitude.
unsigned int img_h
Definition: Mguidefs.h:447
void MObjectSetShadow(MOBJECT obj, int type, int in, int out)
const char * Mir_Code[]
const char array for the realisation of the Mirrors buttons in the Mirror shell
Definition: DAS_Spat.c:231
MOBJECT lblccdwx
Definition: bildef.h:55
MOBJECT lblccdtexp
Definition: bildef.h:44
int Master
Definition: DAS_Spat.c:100
palette DPAL
Definition: Spat_Plot.c:29
double COSTY
Definition: bildef.h:181
CARD8 change_cwd
Definition: Mguidefs.h:1485
void MenuFileOLP_CB(MOBJECT o, void *id, void *a_data)
Definition: Spat_Plot.c:3209
#define O_BINARY
Definition: Dildef.h:201
MTFont plfont
Definition: Spat_Plot.c:41
MTColor GPAL[MAXIMG][256]
Definition: Dildef.h:582
MTColor BPAL[MAXIMG][256]
Definition: Dildef.h:583
int ViewPre(FILE *nf, long position)
Definition: Spat_Plot.c:2241
void MObjectSetUnsensitive(MOBJECT obj)
void DrawXLine(MIMAGE img, int yfix, int xs, int xe, int r, int g, int b)
Definition: Spat_Plot.c:423
void MDrawLine(MOBJECT p, int x1, int y1, int x2, int y2, MTColor col)
C_DEF void DI_Regen(int s)
int MObjectGetX(MOBJECT obj)
MOBJECT LensLblY
Definition: bildef.h:11
int ContFP
Counter for File position.
Definition: DAS_Spat.c:123
void PBYScale_CB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:2441
das DAS
DAS structure.
Definition: Spat_Plot.c:39
int Wl
Flag for the units on the X scale plot.
#define FSAVE
Definition: bildef.h:218
MOBJECT lblndfilter
Definition: bildef.h:42
C_DEF double DI_ScanMaxMin(int w, float *mx, float *mi)
U8 da_mon
Definition: Dildef.h:243
MOBJECT lblmax
Definition: bildef.h:53
U8 ti_sec
Definition: Dildef.h:238
int ViewPre_BIN(int nf, long position)
Definition: Spat_Plot.c:2263
float * AllocFloatMat(int hp, int vp)
Definition: Spat_Plot.c:2009
das structure (contain all the previous structures) .
unsigned int Imax
Definition: bildef.h:177
int LensPix
Definition: bildef.h:9
CARD8 allow_dir_create
Definition: Mguidefs.h:1487
MOBJECT MDCreateDASConfig(void)
DAS Config shell. Procedure that build the shell for the DAS Config panels. The DAS Config allow for ...
U32 CCDType
(R/W) Used CCD CCD code definitions
Definition: dcldef.h:1066
void ReadIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
read the BINARY stored spectrum
Definition: Spat_Plot.c:1166
void(* MENU_ITEM_CB)(MENU_ITEM item, MVALUE status, void *ad)
Definition: Mguidefs.h:1468
MTColor black
int MObjectGetHeight(MOBJECT obj)
MOBJECT popup_pd
Definition: Spat_Plot.c:3570
void ReadIMG_old(FILE *file, int hp, int vp)
NOT Used .
Definition: Spat_Plot.c:1136
int ccdWx
CCD X End.
MTColor yellow
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
MENU_ITEM MMenuAddItem(MOBJECT pd, const char *item, MENU_ITEM_CB cb, void *ad)
Control Panel and push buttons colors .
MOBJECT lblfilter
Definition: bildef.h:41
double latitude
Station latitude.
unsigned short * AllocUSMat(int hp, int vp)
Definition: Spat_Plot.c:1994
void MObjectSetResize(MOBJECT obj, int resize_w, int resize_h)
Definition: bildef.h:83
MTColor white
const char * MMenuItemGetText(MENU_ITEM item)
float * Histo[MAXIMG]
Definition: Dildef.h:545
void D_PlotTools(void)
Definition: Spat_Plot.c:2818
#define DOASMODE
execution for DOAS Processing
int oY
Definition: bildef.h:183
double DB_FindMaxMin(int idx, int idy, unsigned int *mx, unsigned int *mi, int bp)
Definition: Spat_Plot.c:595
CTYPE void DLL DC_RWData(int LibraryVariable, int rw, void *data, int Camera)
Procedure that allows read/write operation on a variable used into the library.
Union for MGui events.
Definition: Mguidefs.h:828
int FilterData(unsigned short *mat, int horpix, int verpix, int filw, int bp)
Definition: FFT.c:250
MTFont button_font
Definition: Mguidefs.h:1501
int Pos
Mirror Current Position.
CARD8 allow_dir_delete
Definition: Mguidefs.h:1493
flag Flag
Structure for different flags.
#define FLTIMG
Definition: Dildef.h:12
#define F10
Definition: KEYCODES.H:346
int MD_CreateBRowShell(int nrows)
Create windows of buttons. During the plotting of the measurements, create a shell of buttons if the ...
Definition: Spat_Plot.c:1625
char HOMEDIRECTORY[_MAX_PATH]
Definition: bildef.h:200
int filtertype
type of installed filter module: 0=Simple-SM3, 1=Double-SM3+SM4, 2=simpleplus-SM3+TM) ...
U16 * Imat
Definition: Dildef.h:286
short DB_BG_Albl[3]
Background ACTIVE Label Colors.
MTFont font
Definition: Mguidefs.h:1499
#define DBDEMO
execution in demo mode
#define False
Definition: Mguidefs.h:236
void MObjectAlign(MOBJECT obj, int h_align, int v_align)
void SetupPrinter(void)
Definition: D_print.c:14
void InitImage(MIMAGE img, int xd, int yd, int rb, int gb, int bb)
Definition: Spat_Plot.c:354
U16 LshY[MAXIMG]
Definition: Dildef.h:578
void deallocamat()
Definition: Spat_Plot.c:161
int SaveImage(int fmt, int imgw, int imgh, int np)
Definition: Spat_Plot.c:2485
int flagclear
Definition: Spat_Plot.c:3581
void * MENU_ITEM
Definition: Mguidefs.h:1418
void ActEditCB(MOBJECT edit, char *text, void *ed)
Text Application callback Apply to the variables the text typed in various text box and validated by ...
MOBJECT MCreateSubMenu(MENU_ITEM item)
S16 type
Definition: Dildef.h:280
Definition: Dildef.h:392
#define READ_DATA
Read data.
Definition: dcldef.h:884
dil DIL
Definition: Spat_Plot.c:28
int ccdXoff
CCD X Start.
U16 * Gmat
Definition: Dildef.h:289
void PoslblY(unsigned int l, unsigned int h)
Definition: Spat_Plot.c:575
unsigned int altitude
Altitude of the Station.
Definition: bildef.h:131
void MTableFormSetColAlign(MOBJECT form, int col, int al)
char DATADIRECTORY[_MAX_PATH]
Definition: bildef.h:201
int oX
Definition: bildef.h:183
Definition: Dildef.h:423
void PlotToolsPBs(MOBJECT o, void *id, void *a_data)
Definition: Spat_Plot.c:2772
MOBJECT lblY[11]
Definition: bildef.h:46
char * MObjectGetText(MOBJECT obj, char *text)
MTColor MObjectBackgroundColor(MOBJECT obj)
U16 DimX[MAXIMG]
Definition: Dildef.h:577
FILE * NUMFDATI
Definition: Bil.h:26
MOBJECT lblccdsx
Definition: bildef.h:57
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
int y_root
Definition: Mguidefs.h:618
MOBJECT pbr[256]
Definition: bildef.h:170
S16 dx
Num. of X pixels.
Definition: dcldef.h:1022
MOBJECT MCreateClippedEdit(MOBJECT parent, const char *text, int len, int clip_len, MTFont font)
MENU_ITEM MMenuAddRadioItem(MOBJECT pd, const char *item, MENU_ITEM_CB cb, void *ad)
img Mat[MAXIMG]
Definition: Dildef.h:552
char * Fil_Code8H[]
const char array for the realisation of the Filters buttons in the Filter shell
Definition: DAS_Spat.c:204
#define PTF_INFO
R/W ptf internal library structure.
Definition: dcldef.h:876
MOBJECT lblccdey
Definition: bildef.h:60
int DrawAreaPlotCB(MOBJECT obj, MEvent *pexp, void *a_data)
Definition: Spat_Plot.c:876
void DB_AreaInput(MOBJECT obj, MEvent *pe, void *a_data)
Definition: Spat_Plot.c:203
void MShellUnrealize(MOBJECT obj)
void DB_Save(char *tit, int mod)
Save the acquired spectrum. Procedure that Save the acquired spectrum.
Definition: Save.c:552
unsigned int Imin
Definition: bildef.h:178
int PrintObject(MOBJECT obj, int mode, int x, int y)
Definition: D_print.c:37
unsigned char ti_hour
Definition: bildef.h:79
#define UNDEF_ALIGN
Definition: Mguidefs.h:920
long REL_FILE_POS[51]
relative File position
Definition: DAS_Spat.c:124
int DB_CloseImage(int s)
Definition: Spat_Plot.c:1257
struct date DATE
Definition: Dildef.h:348
void MObjectSetText(MOBJECT obj, const char *text)
#define FDAT
Definition: bildef.h:221
int OLDnR
Definition: bildef.h:185
U16 * Rmat
Definition: Dildef.h:288
void MenuToolsOLP_CB(MOBJECT o, void *id, void *a_data)
Definition: Spat_Plot.c:3179
unsigned int S_LocX
Definition: bildef.h:15
static double ch
Definition: SOLPOS.C:120
MIMAGE Imim[MAXIMG]
Definition: Dildef.h:563
int FKIND
Definition: bildef.h:211
MOBJECT lblnr
Definition: bildef.h:62
CARD32 MTColor
Definition: Mguidefs.h:183
image Img
Definition: Dildef.h:675
int Pos
Filter Wheel current Position.
S16 da_year
Definition: Dildef.h:241
void ImatInImatGraf(void)
Definition: Spat_Plot.c:847
void WriteIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
Definition: Spat_Plot.c:1153
MENU_ITEM MMenuAddItemObsolete(MOBJECT pd, const char *item, MGUI_CB cb, void *ad)
MMouseEvent mouse
Definition: Mguidefs.h:832
d_geo DGeo
struct for Station location
int MObjectGetWidth(MOBJECT obj)
MOBJECT lblX[17]
Definition: bildef.h:47
void MShellDestroy(MOBJECT obj)
char * ffilenames[]
Definition: Spat_Plot.c:3572
U8 da_day
Definition: Dildef.h:242
int MRButtonGetActivationStatus(MOBJECT o)
MOBJECT MObjectShell(MOBJECT obj)
MOBJECT Sh_PlotTools
Shell for plot tools.
void ClosePlotCB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:2514
#define LIS_
Lampedusa Island Spectrometer - ENEA.
short unsigned U16
2 byte without sign, range 0-65535
Definition: dcldef.h:375
MOBJECT menu
Definition: DOAS_FullProj.c:60
MOBJECT MCreateTableForm(MOBJECT parent, int n_cols)
MTColor green
MOBJECT lblloc
Definition: bildef.h:48
int dg[256]
MOBJECT lbllat
Definition: bildef.h:49
#define INTIMG
Definition: Dildef.h:10
unsigned int button
button pressed/released (Button1, Button2 or Button3), 0 if no button involved
Definition: Mguidefs.h:622
ptf DC_HP
Definition: Spat_Plot.c:26
int ccdWy
CCD Y End.
void D_pbr_CB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:717
U8 ti_hour
Definition: Dildef.h:236
int exec
= 0 -> PRG Execution Paused; = 1 -> PRG Execution Resumed
void WriteSelColandSmoothed(int mod, FILE *fd, int selcol)
write selected Column
Definition: Save.c:1060
int Wl
Grating Wavelength.
#define CCD_INFO
R/W ccd internal library structure.
Definition: dcldef.h:875
#define TROPOGAS
TROPOspheric Gas Analyzer Spectrometer.
File Browser Preferences. Used by the Utility functions MFileBowserExt() and MDirBowserExt().
Definition: Mguidefs.h:1482
void LoadIo(int mod, char *fname)
Definition: Spat_Plot.c:2678
long AbsFilePos
Absolute File position.
Definition: DAS_Spat.c:122
int hlinebefore
Number of HiddenLines before the central line in Plot.
char * Fil_CodeNG[]
const char array for the realisation of the Filters buttons in the Filter shell for GASCODNG2 and NG3...
Definition: DAS_Spat.c:216
MOBJECT lblccdtemp
Definition: bildef.h:43
#define E_BUTTON_PRESS
Definition: Mguidefs.h:275
char s_name[4]
Station name.
unsigned int data[576]
Conversion data buffer 64 samples * 8 channels * 2 bytes.
MOBJECT MCreatePButton(MOBJECT parent, const char *text, MTFont font)
float CCDTemp
Actual CCD Temperature.
void D_PButt_CB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:3320
MOBJECT lblZenith
Definition: bildef.h:72
CARD8 transparent_tree
Definition: Mguidefs.h:1495
d_fileman DFILEM
Definition: bildef.h:257
void D_DoLens(MIMAGE lensmim, MOBJECT lensdraw, int lenswx, int lenswy, int lenspix, int sx, int sy)
Definition: D_Zoom.c:29
int avgmode
Flag to set Averaging mode: 0 = Repeat measurements for fixed number, 1 = Repeat measurements for fix...
#define OFFLINEPLOT
execution for archived data visualisation
void MGUITerm(void)
MOBJECT lblalt
Definition: bildef.h:51
#define CENTER_ALIGN
Definition: Mguidefs.h:917
#define GASCODNG2
GASCODNG 2 (with ATX power supply & HiresIV)
#define EM_BUTTON_PRESS
Definition: Mguidefs.h:317
MTFont alfont
Definition: Spat_Plot.c:41
void DB_FilterCB(MOBJECT p, void *od, void *ad)
Filter positioning callback.
Definition: Spat_Plot.c:2593
MENU_ITEM item_pd
Definition: Spat_Plot.c:3571
void MPopupMenu(MOBJECT pm, int x, int y)
unsigned short * ImatOrig
Definition: bildef.h:180
int HeaderInPlot(void)
Shows the measurements parameters .
Definition: Spat_Plot.c:1475
config Cfg
Definition: Spat_Plot.c:27
unsigned char ti_sec
Definition: bildef.h:81
d_view DPLOT
Definition: bildef.h:254
MTFont newfont
Definition: Spat_Plot.c:41
void AssZeroMat(int hp, int vp)
Definition: Spat_Plot.c:1223
unsigned int * mattempbuff
Definition: Spat_Plot.c:2064
#define HELV_SMALL
Definition: Mguidefs.h:881
unsigned char LensON
Definition: bildef.h:8
void MImageSetPixelRGB(MIMAGE pmi, int x, int y, int r, int g, int b)
int VBin
CCD Vertical Binning.
char IoFileNeme[_MAX_PATH]
File name for Reference spectrum (Io)
Definition: DOASdef.h:26
char filpos[5]
Definition: bildef.h:139
void MEditSetActCallback(MOBJECT edit, OBJ_STRING_CB cb, void *data)
MOBJECT xloc
Definition: bildef.h:64
void DB_EqTypePlotCB(MOBJECT o, void *a, void *v)
Definition: Spat_Plot.c:3704
MOBJECT dmenu
int wsize
Definition: bildef.h:182
void PopUp_CB(MOBJECT obj, void *item, void *data)
Definition: Spat_Plot.c:3584
#define FIXED_SMALL
Definition: Mguidefs.h:878
MOBJECT HistoShell
Definition: Dildef.h:542
int MTFont
Definition: Mguidefs.h:175
void PButtSelAll_CB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:2476
unsigned short * DeallocUSMat(unsigned short *mat)
Definition: Spat_Plot.c:145
MOBJECT formbutt
Definition: bildef.h:65
double lambda[1055]
Wavelength series.
Definition: DOASdef.h:18
char CONFIGDIREQUIPMENT[_MAX_PATH]
Definition: bildef.h:208
const char * MGetCurrentDirectory(void)
int ON_OFFLINEPLOT
Definition: DAS_Spat.c:117
char StrDate[10]
Definition: bildef.h:135
U16 LshX[MAXIMG]
Definition: Dildef.h:578
char NFileNameF[32]
Definition: CreateForms.c:71
MOBJECT yloc
Definition: bildef.h:63
void delay(unsigned long d)
Pauses for a specified number of milliseconds. .
Definition: Dxl.c:1113
void PoslblX(MOBJECT lbl, int xs, int xe, int xc)
Definition: Spat_Plot.c:516
void ValidateCB(MOBJECT edit, EDIT_VAL *ev, void *ii)
Text Validation callback Validation callback for the text typed in different text box...
void MLabelSetMargin(MOBJECT p, int wm, int hm)
Image description.
Definition: Mguidefs.h:436
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
void MEditSetValCallback(MOBJECT edit, EDIT_VAL_CB cb, void *data)
int NFDATI
Definition: Bil.h:27
void MRButtonActivate(MOBJECT o)
char DBFILENAME[_MAX_PATH]
Definition: bildef.h:204
void MMenuItemSetSensitive(MENU_ITEM item)
histogram H
Definition: Dildef.h:559
MENU_ITEM Titem[4]
Definition: Spat_Plot.c:46
MOBJECT lblsza
Definition: bildef.h:52
void MFreeImage(MIMAGE data)
#define GASCODNG3
GASCODNG 3 (with ATX power supply & HiresIV)
void D_PlotAxis(MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey, MTColor col)
Definition: Spat_Plot.c:448
char mirpos[8]
Definition: bildef.h:137
long * AllocLongMat(int hp, int vp)
Definition: Spat_Plot.c:2024
void CloseFile(FILE *fd, int hp, int vp)
Definition: Spat_Plot.c:1304
int plotYRange
0 –> full range; 1 –> min/max
struct dtime TIME
Definition: bildef.h:133
MOBJECT MCreateDrawArea(MOBJECT parent, int width, int height)
float IHigh
Definition: Dildef.h:303
void LogRatioSpectrum(void)
Definition: Spat_Plot.c:2764
MOBJECT MDCreateFM_Shell(int mod, int fmt)
Definition: DFileMan.c:407
MOBJECT MCreateColForm(MOBJECT parent)
doas DOAS
Definition: Spat_Plot.c:37
int MFileBrowseExt(const char *t, const char *ext, char *fname, char *dname, FB_PREFS *prefs)
int actimg[256]
Definition: bildef.h:175
void MObjectAddEventNotifyCallback(MOBJECT obj, OBJ_EVENT_CB cb, CARD32 event_mask, void *a_data)
void MObjectRedraw(MOBJECT obj)
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
void DB_DisplayCB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:2646
MOBJECT Tmenu
Definition: Spat_Plot.c:47
unsigned int S_LocY
Definition: bildef.h:15
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
int Pix2Wl(int mod, int pos, int spix, int epix, struct doas *pd)
Definition: DOAS.c:26
#define GASCODNG1
GASCODNG 1 (with ATX power supply & HiresIV)
void MDrawAreaSetExposeCallback(MOBJECT obj, OBJ_EVENT_CB cb, void *ad)
void DestroyArrayObj(MOBJECT obj[], int n)
Definition: Spat_Plot.c:1463
void MShellRealizeXY(MOBJECT obj, int x, int y)
Function prototypes.
#define GASCODNG4
GASCODNG 4.
int ViewNext_BIN(int nf)
Definition: Spat_Plot.c:2284
Definition: bildef.h:77
char * Fil_CodeNG1[]
const char array for the realisation of the Filters buttons in the Filter shell for GASCODNG1 instrum...
Definition: DAS_Spat.c:213
MENU_ITEM Fitem[6]
Definition: Spat_Plot.c:46
S16 col
Definition: Dildef.h:284
int eX
Definition: bildef.h:183
void MDrawAreaSetInputCallback(MOBJECT obj, OBJ_EVENT_CB cb, void *ad)
const char * bg_image_file
Definition: Mguidefs.h:1519
MOBJECT View_Sh
Definition: bildef.h:35
#define _MAX_PATH
Definition: Dildef.h:202
int FFTFilter
Fast Fourier Trasform Filter windows.
Definition: DOASdef.h:25
MOBJECT MCreateShell(const char *title, int flags)
int FlagFilter
flag for filterinf
int hlineafter
Number of HiddenLines after the central line in Plot.
int MMessageDialog(const char *t, const char *msg, const char *btn1, const char *btn2,...)
void AllocMat()
Definition: Spat_Plot.c:124
void D_PlotOneLine(int n, int sel, MOBJECT obj, MOBJECT pb[], MIMAGE mim, unsigned short plotmat[], int idx, int idy, unsigned long pe[], double costx, double costy, int min, int max, int ox, int oy, int bp)
Definition: Spat_Plot.c:669
S16 dy
Num. of Y pixels.
Definition: dcldef.h:1023
void DB_SpikesCB(MOBJECT p, void *od, void *ad)
Definition: Spat_Plot.c:2620
void MMenuItemSetUnsensitive(MENU_ITEM item)
int BuildLogRatio(void)
first attempt to apply the DOAS algorithm (..on going!!!)
Definition: DOAS.c:178
void ReadIMG(FILE *file, unsigned short *mat, int hp, int vp)
Read ASCII Image (Spectral Data only) .
Definition: Spat_Plot.c:1206
MOBJECT lblccdwy
Definition: bildef.h:56
MOBJECT lbltime
Definition: bildef.h:38
#define SPATRAM3
SPATRAM3.
short DB_BG[3]
Default Background Color.
MOBJECT lblAzimuth
Definition: bildef.h:73
unsigned short * ImatGraf
Definition: bildef.h:176
double TExp
CCD Exposure time.
Definition: DAS_Spat.c:130
MirrorSt MIS
Mirror.
Definition: DAS_Spat.c:61
MOBJECT MCreateRButton(MOBJECT parent, const char *text, MTFont font)
void MShellRaise(MOBJECT obj)
void MDrawXorBox(MOBJECT p, int x, int y, int w, int h)
void MObjectUnmap(MOBJECT obj)
int eY
Definition: bildef.h:183
Function prototypes.
float ILow
Definition: Dildef.h:302
float ccdtexp
Definition: bildef.h:140
MOBJECT lblvb
Definition: bildef.h:61
MOBJECT submenu
Definition: DOAS_FullProj.c:61
int ViewPlot(int mod)
Create the plot shell. Procedure that build the plot shell for the data visualization.
Definition: Spat_Plot.c:3775
static double p
Definition: SOLPOS.C:131
void DrawImg(MIMAGE img, int a, int c, int x, int y)
Definition: Spat_Plot.c:370
MOBJECT Optmenu
Definition: Spat_Plot.c:47
char * Fil_Code[]
const char array for the realisation of the Filters buttons in the Filter shell
Definition: DAS_Spat.c:207
unsigned short * IoMat
Reference spectrum.
Definition: DOASdef.h:27
void ImatGrafInImat(void)
Definition: Spat_Plot.c:861
void D_AssignLabelPlot(void)
Definition: Spat_Plot.c:1661
int SaveIo(char *buff)
Definition: Spat_Plot.c:3069
void MTableFormSetRowAlign(MOBJECT form, int row, int al)
int MObjectGetY(MOBJECT obj)
int FlagDisplay
unsigned int LocY
Definition: bildef.h:15
int LoadDB_DispCoeff(void)
Load dispersion parameters. Procedure that load the dispersion parameters from file {homedir}/DOAS/Di...
Definition: Load.c:234
float * Fmat
Definition: Dildef.h:287
void DB_XUnitsCB(MOBJECT o, void *id, void *a_data)
Definition: Spat_Plot.c:3547
void MLabelSetAlignment(MOBJECT p, int align)
int wl[]
WaveLength definition - for SD_Grating.
Definition: DAS_Spat.c:182
CTYPE int DLL DC_OpenPar(int Platform, int Sensor, int Camera)
Procedure that initializes dcl internal data structure. Procedure that initializes the DC_HP and DC_C...
int MGetScreenWidth(void)
U8 ti_min
Definition: Dildef.h:235
MOBJECT lblccdsy
Definition: bildef.h:58
MTColor PLColor[264]
int D_findmaxmin(unsigned short plotmat[], int xinf, int xsup, int yinf, int ysup, int bp)
Definition: Spat_Plot.c:635
unsigned char ti_min
Definition: bildef.h:78
MOBJECT lbldate
Definition: bildef.h:37
int maxploth
Definition: Spat_Plot.c:51
Bortul Image Library Structure .
Definition: bildef.h:250
void PlotSpectrum(MOBJECT obj, MOBJECT pb[], MIMAGE mim, unsigned short plotmat[], int idx, int idy, unsigned long pe[], double costx, double costy, int min, int max, int ox, int oy, int bp, int hlb, int hla)
Definition: Spat_Plot.c:796
Definition: Dildef.h:674
int maxplotw
Definition: Spat_Plot.c:51
float longitude
Longitude of the Station.
Definition: bildef.h:130
void MFormSetSpacing(MOBJECT p, int offset)
double longitude
Station longitude.
unsigned char da_mon
Definition: bildef.h:86
void MPButtonSetCallback(MOBJECT button, MGUI_CB cb, void *data)
int measmode
measuring mode: 0 = Single; 1 = Averaged
bil BIL
Definition: Spat_Plot.c:35
int MMenuItemSetCheckStatus(MENU_ITEM item, int TrueFalse)
void PopupMenuCB(MOBJECT obj, MEvent *pe, void *pdown)
Definition: Spat_Plot.c:3688
void MObjectSetCompositeWidth(MOBJECT obj, int w)
char WORKDIRECTORY[_MAX_PATH]
Definition: bildef.h:202
MOBJECT RowShell
Definition: bildef.h:171
MOBJECT lbllong
Definition: bildef.h:50
int dr[256]
int DB_InitDil(void)
Initialize DIL. Procedure that initialize the DTA Imaging library.
Definition: Init.c:112
int ReadHeader_BIN(int fd)
read the BINARY header of the stored spectrum
Definition: Spat_Plot.c:1798
float latitude
Latitude of the Station.
Definition: bildef.h:129
void MShellSetTitle(MOBJECT obj, const char *title)
int Visualizza(int mod, char *nomefile)
Definition: Spat_Plot.c:2069
short DB_UnSel[3]
Unselected Buttons Colors.
MTColor iPAL[MAXIMG][256]
Definition: Dildef.h:580
void MakeItemUnsensitiveCB(MOBJECT obj, void *item, void *udata)
Definition: Spat_Plot.c:2044
void * MOBJECT
Definition: Mguidefs.h:192
unsigned char da_day
Definition: bildef.h:85
void CalcSpectrumLimits(int mod, int pos, int spix, int epix, int refpix)
Definition: DOAS.c:67
blens BLENS
Definition: bildef.h:252
#define BOTTOM_ALIGN
Definition: Mguidefs.h:919
#define True
Definition: Mguidefs.h:235
char location[4]
Name of the Station (BLQ, LPA, EVR, TNB, DMC.....)
Definition: bildef.h:128
#define LEFT_ALIGN
Definition: Mguidefs.h:915
viewformobj VFO
Definition: bildef.h:255
Definition: dcldef.h:1020
short int da_year
Definition: bildef.h:84
double Pix
Definition: bildef.h:16
MTColor RPAL[MAXIMG][256]
Definition: Dildef.h:581
C_DEF int DI_ImageProperties(int srv, U16 dx, U16 dy, U16 wx, U16 wy, U16 ifmt, U16 sts, char *tit, int pix, int pixy, int mode)
#define E_SELECT
Definition: Mguidefs.h:287
C_DEF void DI_FindExtName(char *fullname, char *fext)
Definition: dcldef.h:1043
void MObjectSetFont(MOBJECT obj, MTFont font, int resize)
CTYPE int DLL DC_LoadCameraConfig(const char *PathName, config *CameraConfig)
Load camera configuration from a specified file.
MOBJECT LensDraw
Definition: bildef.h:11
unsigned int state
buttons and key modifiers mask
Definition: Mguidefs.h:620
void DrawButtons(int nhidlbef, int nhidlaft, int nr)
Definition: Spat_Plot.c:56
int SetAsIo(void)
Definition: Spat_Plot.c:3126
void MButtonSetOnMouseOverForegroundRGB(MOBJECT button, int r, int g, int b)
char * Fil_CodeTropo[]
const char array for the realisation of the Filters buttons in the Filter shell for TROPOGAS instrume...
Definition: DAS_Spat.c:210
struct time TIME
Definition: Dildef.h:347
void MObjectMap(MOBJECT obj)
MOBJECT MCreateMenuBar(MOBJECT parent, MTFont font)
float ccdtemp
Definition: bildef.h:141
void D_Lens(void)
Definition: D_Zoom.c:138
char * NDFil_Code[]
const char array for the realisation of the Filters buttons in the ND Filter shell ...
Definition: DAS_Spat.c:219
int filename
Flag to set file name mode 0=Free choice, 1 = Automatic.
MOBJECT xincr
Definition: bildef.h:66
int EqType
Spectrometer Type.
int N_RM
Number of measurements for Averaging mode in fixed exposure time mode.
Definition: DAS_Spat.c:114
#define E_MOTION
Definition: Mguidefs.h:277
void D_AssignOrigin(MOBJECT obj)
Definition: Spat_Plot.c:432
CARD8 allow_dir_rename
Definition: Mguidefs.h:1490
int db[256]
void D_SunCalc(void)
Sun Calculator Callback.
char CONFIGDIRCOMMON[_MAX_PATH]
Definition: bildef.h:206
int MInputPrompt(const char *t, const char *msg, char *text, int len, const char *ok_btn, const char *canc_btn)
void D_PlotGrid(MOBJECT ob, MIMAGE mim, int sx, int sy, int ex, int ey)
Definition: Spat_Plot.c:476
void MFreeColor(MTColor col)
MIMAGE MAllocImage(int img_w, int img_h, int nplanes)
void MObjectSetTransparency(MOBJECT obj, CARD8 level)
void GrafoIMG(int mode)
Definition: Spat_Plot.c:1242
float * DeallocFloatMat(float *mat)
Definition: Spat_Plot.c:153
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
int LensWx
Definition: bildef.h:10
int BlindPix
Number of blind pixels (usefull for Dark Current)
Definition: DAS_Spat.c:120
int N_AVG
Number of measurements for Averaging mode in fixed number of meas. mode.
Definition: DAS_Spat.c:113
MOBJECT drawapl
Definition: bildef.h:172
MOBJECT Isrv[MAXIMG]
Definition: Dildef.h:565
U32 Platform
(R/W) Platform code Camera platform definitions
Definition: dcldef.h:1065
float Low
Definition: Dildef.h:294
MOBJECT LensLblX
Definition: bildef.h:11
void DrawYLine(MIMAGE img, int xfix, int ys, int ye, int r, int g, int b)
Definition: Spat_Plot.c:404
C_DEF int DI_FileExist(char *tit)
void MObjectSetSensitive(MOBJECT obj)
#define E_WINDOW_ENTER
Definition: Mguidefs.h:278
unsigned int ccdmin
Definition: bildef.h:143
MOBJECT drwa[8]
Definition: DOASdef.h:38
MOBJECT Fmenu
Definition: Spat_Plot.c:47
int DispBlindPix
Display Blind Pix: 0 = NO, 1 = Yes.
int type
Definition: Mguidefs.h:829
MOBJECT lblnummeas
Definition: bildef.h:45
void MObjectDestroy(MOBJECT obj)
MOBJECT MCreateRowForm(MOBJECT parent)
#define WS_ETCHED_IN
Definition: Mguidefs.h:959
int x
pointer x, y coordinates in event window
Definition: Mguidefs.h:616
int ccdYoff
CCD Y Start.
MOBJECT XAxisU[3]
Definition: bildef.h:71
int DB_Column(char *sourcefilename)
Column format.
Definition: Save.c:1109
U16 * Bmat
Definition: Dildef.h:290
tools TOOLS
Definition: CreateForms.c:81
int hsize
Definition: bildef.h:182
ccd DC_CCD
Definition: Spat_Plot.c:25
MOBJECT MCreatePopupMenu(MTFont font)
int LensWy
Definition: bildef.h:10
float High
Definition: Dildef.h:295
#define TOP_ALIGN
Definition: Mguidefs.h:918
int exemode
Set the Execution MODE (Execution modes)
MOBJECT LensLbl
Definition: bildef.h:11
int ViewNext(FILE *nf)
Definition: Spat_Plot.c:2365
FilterWheelSt FWS
Filter Wheel.
Definition: DAS_Spat.c:57
#define E_WINDOW_EXIT
Definition: Mguidefs.h:279
GratingSt GRS
Definition: CreateForms.c:82
MOBJECT MCreateMenu(MOBJECT menu, const char *text)
int x_root
coordinates relative to root
Definition: Mguidefs.h:618
int X2Counts(int x)
Definition: Spat_Plot.c:178
int SaveSpectrum(char *buff)
Definition: Spat_Plot.c:3162
unsigned int Y2Counts(int y)
Definition: Spat_Plot.c:190
void MakeItemSensitiveCB(MOBJECT obj, void *item, void *udata)
Definition: Spat_Plot.c:2054
int FlagSpikes
MOBJECT lblwaveleng
Definition: bildef.h:40
float sza
Solar Zenith Angle.
Definition: bildef.h:132
MOBJECT lblccdex
Definition: bildef.h:59
void D_Print_BIL_H_ASCII(int mod, FILE *fff)
Definition: Utils.c:621
marconi Marconi
CCD Sensor struct.
const char * Mir_CodeTropo[]
const char array for the realisation of the Mirrors buttons in the Mirror shell for TROPOGAS ...
Definition: DAS_Spat.c:234
paramini Paramini
structure for the parameters defined in param.ini configuration file
#define FBIF
Definition: bildef.h:229
int RemoveSpikes(int mod, unsigned short *mat, int horpix, int verpix, int blindpix)
Removes Spikes on a measure.
Definition: FFT.c:369
MOBJECT lblmirpos
Definition: bildef.h:39
______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:10 for DAS - Rel. 3.1.6 - 18/09/2017.