DAS  3.1.6 - 18/09/2017
DAS_Spat_ConfCBs.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <windows.h>
5 #include <direct.h>
6 #include <math.h>
7 #include "mgui.h"
8 #include "DAS_Spatram.h"
9 #include "dcl.h"
10 #include "dil.h"
11 #include "bil.h"
12 #include "wsc.h"
13 #include "dxl.h"
14 #include "dscud.h"
15 #include "DOAS.h"
16 
17 
18 
29 //confp CONFP;
30 paramini PARAM; //Param.ini
31 //pbutt PBUTT; //Command Button
34 //db_options DB_O;
35 ccd DC_CCD; // CCD settings
36 ptf DC_HP; // Platform settings
37 config Cfg; // Camera controls & Options
38 flag FLAG; //flags structure
40 //stepm STEPM; //Stepper Motors
41 ids IDS; //ID tasks
44 mtcl MTCL; // MTColor
46 //omu OMU;
48 //hrizmeas HMEAS;
51 
53 
54 
55 /********************************************/
56 /*---------------------------------------------------------------------*/
57 /********************************************
58  * Select NOVA type callback
59  ********************************************/
60 void NovaTypeCB(MOBJECT p, void *od, void *ad)
61 {
62  int c = (int) ad, er;
63 // char buf[80];
64 
66  if (er)
67  {
68  switch(c)
69  {
70  case NOVA7892:
71  DAS.Nova.type = NOVA7892;
72  DAS.Nova.DigOut = 0;
73  DAS.Nova.DigIn = 0;
74  break;
75  case NOVA6612G2:
76  DAS.Nova.type = NOVA6612G2;
77  DAS.Nova.DigOut = 0;
78  break;
79  case NOVA945GSE:
80  DAS.Nova.type = NOVA945GSE;
81  DAS.Nova.DigOut = 15;
82  DAS.Nova.DigIn = 15;
83  break;
84  }
85  }
86 
87  //WriteHardwareiniCB();
88  //For checking
89  //sprintf(buf,"Nova Type=%d", novatype);
90  //MMessageDialog("Info", buf, "OK", NULL);
91 }
92 /********************************************/
93 /*---------------------------------------------------------------------*/
94 /********************************************
95 
96 
97 /********************* Start of COLORS CallBack *****************************/
98 int WriteColorsCB(MOBJECT o, void *a, void *v)
99 {
100  FILE *fs;
101  char str[80];
102  char buff[_MAX_PATH];
103 
104  sprintf(buff,"%s\\DASSysColor.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
105  fs = fopen(buff, "w");
106 
107  // if(fs == NULL) return 2;
108 
109  fprintf(fs, "%s\n", "###########################################");
110  fprintf(fs, "%s\n", "# DAS Default Color #");
111  fprintf(fs, "%s\n", "# by DanBo #");
112  fprintf(fs, "%s\n", "###########################################");
113  fprintf(fs, "%s\n", "# All these values can be modified, but #");
114  fprintf(fs, "%s\n", "# DO NOT Exchange the order #");
115  fprintf(fs, "%s\n", "###########################################");
116 
117 
118  fprintf(fs, "%s\n", "# Selected Buttons BG #");
119  fprintf(fs, "%d %d %d\n", DPAL.DB_Sel[0], DPAL.DB_Sel[1], DPAL.DB_Sel[2]);
120 
121  fprintf(fs, "%s\n", "# Unselected Buttons BG #");
122  fprintf(fs, "%d %d %d\n", DPAL.DB_UnSel[0], DPAL.DB_UnSel[1], DPAL.DB_UnSel[2]);
123 
124  fprintf(fs, "%s\n", "# UnSelected Buttons FG #");
125  fprintf(fs, "%d %d %d\n", DPAL.DB_UnSelFG[0], DPAL.DB_UnSelFG[1], DPAL.DB_UnSelFG[2]);
126 
127  fprintf(fs, "%s\n", "# Forms and shell Background #");
128  fprintf(fs, "%d %d %d\n", DPAL.DB_BG[0],DPAL.DB_BG[1],DPAL.DB_BG[2]);
129 
130  fprintf(fs, "%s\n", "# ACTIVE Labels Background #");
131  fprintf(fs, "%d %d %d\n", DPAL.DB_BG_Albl[0],DPAL.DB_BG_Albl[1],DPAL.DB_BG_Albl[2]);
132 
133  fprintf(fs, "%s\n", "# ACTIVE Labels Foreground #");
134  fprintf(fs, "%d %d %d\n", DPAL.DB_FG_Albl[0],DPAL.DB_FG_Albl[1],DPAL.DB_FG_Albl[2]);
135 
136  fprintf(fs, "%s\n", "# PASSIVE Labels Background #");
137  fprintf(fs, "%d %d %d\n", DPAL.DB_BG_Plbl[0],DPAL.DB_BG_Plbl[1],DPAL.DB_BG_Plbl[2]);
138 
139  fprintf(fs, "%s\n", "# PASSIVE Labels Foreground #");
140  fprintf(fs, "%d %d %d\n", DPAL.DB_FG_Plbl[0],DPAL.DB_FG_Plbl[1],DPAL.DB_FG_Plbl[2]);
141 
142  fprintf(fs, "%s\n", "# Capital Letters Labels Color UP BG #");
143  fprintf(fs, "%d %d %d\n", DPAL.DB_BG_lblUP[0],DPAL.DB_BG_lblUP[1],DPAL.DB_BG_lblUP[2]);
144 
145  fprintf(fs, "%s\n", "# Capital Letters Labels Color UP FG #");
146  fprintf(fs, "%d %d %d\n", DPAL.DB_FG_lblUP[0],DPAL.DB_FG_lblUP[1],DPAL.DB_FG_lblUP[2]);
147 
148  fprintf(fs, "%s\n", "# Radio Button BG #");
149  fprintf(fs, "%d %d %d\n", DPAL.DB_BG_RButt[0],DPAL.DB_BG_RButt[1],DPAL.DB_BG_RButt[2]);
150 
151  fprintf(fs, "%s\n", "# Radio Button FG #");
152  fprintf(fs, "%d %d %d\n", DPAL.DB_FG_RButt[0],DPAL.DB_FG_RButt[1],DPAL.DB_FG_RButt[2]);
153 
154  fprintf(fs, "%s\n", "###########################################");
155 
156  fclose(fs);
157 
158 
159  sprintf(str,"The colors have been saved in 'CONFIG\\DASSysColor.INI' file");
160  MMessageDialog("DAS information", str, " Ok ", NULL);
161 
162 
163  return 0;
164 
165 }
166 
167 void ColPickBackForeGCB(MOBJECT o, void *a, void *v)
168 {
169 //setta i flag foreground e background
170  int i;
171  switch ((int) v)
172  {
173  case 0:
174  FlgBG = True;
175  FlgFG = False;
176  break;
177  case 1:
178  FlgFG = True;
179  FlgBG = False;
180  break;
181  }
182  if (DAS.Flag.exemode == DOASMODE )
183  for (i = 0;i<7; i++)
184  ColObjCB(DAS.Gui.ConfigPanel.RBColObj[i], NULL, (void *) i);
185  else
186  for (i = 0;i<6; i++)
187  ColObjCB(DAS.Gui.ConfigPanel.RBColObj[i], NULL, (void *) i);
188 }
189 void DB_Undo2Do_Colors( short undocol[], short docol[])
190 {
191  int i;
192  for (i = 0; i < 3;i++)
193  {
194  undocol[i] = docol[i];
195  }
196 
197 
198  docol[0] = r_c;
199  docol[1] = g_c;
200  docol[2] = b_c;
201 
202 }
203 
204 void DB_ColorAssign(MOBJECT a[], int numel, short tc[])
205 {
206  int i;
207 
208  for (i=0; i < numel; i++)
209  {
210  if(FlgBG)
211  {
212  MObjectSetBackgroundRGB(a[i], tc[0], tc[1], tc[2]);
213  MObjectSetTransparency(a[i],0);
214  }
215  if(FlgFG)
216  {
217  MObjectSetForegroundRGB(a[i], tc[0], tc[1], tc[2]);
218  MObjectSetTransparency(a[i],0);
219  }
220  }
221 
222 }
223 extern MOBJECT CP_Sh;
224 
225 void D_UndoCB(MOBJECT o, void *a, void *v)
226 {
227 // int i;
228  // Unselected Buttons
229 /*
230  if(FlgBG && (FlgOBJ==0))
231  {
232  DB_Undo2Do_Colors( DPAL.DB_UnSel, UDPAL.DB_UnSel);
233 
234  if(DAS.Flag.exemode == DOASMODE)
235  DB_ColorAssign(LISTF.pb, sizeof LISTF.pb / sizeof LISTF.pb[0], DPAL.DB_UnSel);
236  else
237  {
238  DB_ColorAssign(PBUTT.KeyB, sizeof PBUTT.KeyB / sizeof PBUTT.KeyB[0], DPAL.DB_UnSel);
239  DB_ColorAssign(DAS.Gui.ContrPanel.pblamps, sizeof DAS.Gui.ContrPanel.pblamps / sizeof DAS.Gui.ContrPanel.pblamps[0], DPAL.DB_UnSel);
240  }
241 
242 
243  }
244  if(FlgFG && (FlgOBJ==0))
245  {
246  DB_Undo2Do_Colors( DPAL.DB_UnSelFG, UDPAL.DB_UnSelFG);
247 
248  if(DAS.Flag.exemode == DOASMODE)
249  DB_ColorAssign(LISTF.pb, sizeof LISTF.pb / sizeof LISTF.pb[0], DPAL.DB_UnSelFG);
250  else
251  {
252  DB_ColorAssign(PBUTT.KeyB, sizeof PBUTT.KeyB / sizeof PBUTT.KeyB[0], DPAL.DB_UnSelFG);
253  DB_ColorAssign(DAS.Gui.ContrPanel.pblamps, sizeof DAS.Gui.ContrPanel.pblamps / sizeof DAS.Gui.ContrPanel.pblamps[0], DPAL.DB_UnSelFG);
254  }
255 
256  }
257  // Selected Buttons
258  if (FlgBG && (FlgOBJ==1))
259  {
260  DB_Undo2Do_Colors(DPAL.DB_Sel, UDPAL.DB_Sel);
261 
262  MSelectObject(PBUTT.KeyB[0]);
263  MObjectSetBackgroundRGB(PBUTT.KeyB[0], DPAL.DB_Sel[0], DPAL.DB_Sel[1], DPAL.DB_Sel[2]);
264  }
265  //Active Labels BG
266  if (FlgBG && (FlgOBJ==2))
267  {
268  DB_Undo2Do_Colors(DPAL.DB_BG_Albl, UDPAL.DB_BG_Albl);
269 
270  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_Par, sizeof DAS.Gui.ContrPanel.lbl_Par / sizeof DAS.Gui.ContrPanel.lbl_Par[0], DPAL.DB_BG_Albl);
271  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_CS, sizeof DAS.Gui.ContrPanel.Albl_CS / sizeof DAS.Gui.ContrPanel.Albl_CS[0], DPAL.DB_BG_Albl);
272  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_IE, sizeof DAS.Gui.ContrPanel.Albl_IE / sizeof DAS.Gui.ContrPanel.Albl_IE[0], DPAL.DB_BG_Albl);
273  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_LS, sizeof DAS.Gui.ContrPanel.Albl_LS / sizeof DAS.Gui.ContrPanel.Albl_LS[0], DPAL.DB_BG_Albl);
274  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_LT, sizeof DAS.Gui.ContrPanel.Albl_LT / sizeof DAS.Gui.ContrPanel.Albl_LT[0], DPAL.DB_BG_Albl);
275  DB_ColorAssign(DAS.Gui.ContrPanel.cop, sizeof DAS.Gui.ContrPanel.cop / sizeof DAS.Gui.ContrPanel.cop[0] , DPAL.DB_BG_Albl);
276  DB_ColorAssign(DAS.Gui.ContrPanel.step, sizeof DAS.Gui.ContrPanel.step / sizeof DAS.Gui.ContrPanel.step[0] , DPAL.DB_BG_Albl);
277  DB_ColorAssign(DAS.Gui.ContrPanel.slope, sizeof DAS.Gui.ContrPanel.slope / sizeof DAS.Gui.ContrPanel.slope[0] , DPAL.DB_BG_Albl);
278  DB_ColorAssign(DAS.Gui.ContrPanel.speed, sizeof DAS.Gui.ContrPanel.speed / sizeof DAS.Gui.ContrPanel.speed[0] , DPAL.DB_BG_Albl);
279  MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.Albl_Status, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
280  MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.Albl_Script, DPAL.DB_BG_Albl[0], DPAL.DB_BG_Albl[1], DPAL.DB_BG_Albl[2]);
281  }
282 
283  //Active Labels FG
284  if (FlgFG && (FlgOBJ==2))
285  {
286 
287  DB_Undo2Do_Colors(DPAL.DB_FG_Albl, UDPAL.DB_FG_Albl);
288 
289  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_Par, sizeof DAS.Gui.ContrPanel.lbl_Par / sizeof DAS.Gui.ContrPanel.lbl_Par[0], DPAL.DB_FG_Albl);
290  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_CS, sizeof DAS.Gui.ContrPanel.Albl_CS / sizeof DAS.Gui.ContrPanel.Albl_CS[0], DPAL.DB_FG_Albl);
291  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_IE, sizeof DAS.Gui.ContrPanel.Albl_IE / sizeof DAS.Gui.ContrPanel.Albl_IE[0], DPAL.DB_FG_Albl);
292  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_LS, sizeof DAS.Gui.ContrPanel.Albl_LS / sizeof DAS.Gui.ContrPanel.Albl_LS[0], DPAL.DB_FG_Albl);
293  DB_ColorAssign(DAS.Gui.ContrPanel.Albl_LT, sizeof DAS.Gui.ContrPanel.Albl_LT / sizeof DAS.Gui.ContrPanel.Albl_LT[0], DPAL.DB_FG_Albl);
294  DB_ColorAssign(DAS.Gui.ContrPanel.cop, sizeof DAS.Gui.ContrPanel.cop / sizeof DAS.Gui.ContrPanel.cop[0] , DPAL.DB_FG_Albl);
295  DB_ColorAssign(DAS.Gui.ContrPanel.step, sizeof DAS.Gui.ContrPanel.step / sizeof DAS.Gui.ContrPanel.step[0] , DPAL.DB_FG_Albl);
296  DB_ColorAssign(DAS.Gui.ContrPanel.slope, sizeof DAS.Gui.ContrPanel.slope / sizeof DAS.Gui.ContrPanel.slope[0] , DPAL.DB_FG_Albl);
297  DB_ColorAssign(DAS.Gui.ContrPanel.speed, sizeof DAS.Gui.ContrPanel.speed / sizeof DAS.Gui.ContrPanel.speed[0] , DPAL.DB_FG_Albl);
298 
299  MObjectSetForegroundRGB(DAS.Gui.ContrPanel.Albl_Status, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
300  MObjectSetForegroundRGB(DAS.Gui.ContrPanel.Albl_Script, DPAL.DB_FG_Albl[0], DPAL.DB_FG_Albl[1], DPAL.DB_FG_Albl[2]);
301  }
302 
303  //Passive Labels BG
304  if (FlgBG && (FlgOBJ==3))
305  {
306  DB_Undo2Do_Colors(DPAL.DB_BG_Plbl, UDPAL.DB_BG_Plbl);
307 
308  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_NP, sizeof DAS.Gui.ContrPanel.lbl_NP / sizeof DAS.Gui.ContrPanel.lbl_NP[0], DPAL.DB_BG_Plbl);
309  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_CS, sizeof DAS.Gui.ContrPanel.Plbl_CS / sizeof DAS.Gui.ContrPanel.Plbl_CS[0], DPAL.DB_BG_Plbl);
310  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_IE, sizeof DAS.Gui.ContrPanel.Plbl_IE / sizeof DAS.Gui.ContrPanel.Plbl_IE[0], DPAL.DB_BG_Plbl);
311  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_LS, sizeof DAS.Gui.ContrPanel.Plbl_LS / sizeof DAS.Gui.ContrPanel.Plbl_LS[0], DPAL.DB_BG_Plbl);
312  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_LT, sizeof DAS.Gui.ContrPanel.Plbl_LT / sizeof DAS.Gui.ContrPanel.Plbl_LT[0], DPAL.DB_BG_Plbl);
313 
314  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_lamps, sizeof DAS.Gui.ContrPanel.lbl_lamps / sizeof DAS.Gui.ContrPanel.lbl_lamps[0], DPAL.DB_BG_Plbl);
315  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_SM, sizeof DAS.Gui.ContrPanel.Plbl_SM / sizeof DAS.Gui.ContrPanel.Plbl_SM[0], DPAL.DB_BG_Plbl);
316  DB_ColorAssign(DAS.Gui.ContrPanel.lbl, sizeof DAS.Gui.ContrPanel.lbl / sizeof DAS.Gui.ContrPanel.lbl[0] , DPAL.DB_BG_Plbl);
317 
318  MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.Plbl_Status, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
319  MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.Plbl_Script, DPAL.DB_BG_Plbl[0], DPAL.DB_BG_Plbl[1], DPAL.DB_BG_Plbl[2]);
320  }
321 
322  //Passive Labels FG
323  if (FlgFG && (FlgOBJ==3))
324  {
325  DB_Undo2Do_Colors(DPAL.DB_FG_Plbl, UDPAL.DB_FG_Plbl);
326 
327  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_NP, sizeof DAS.Gui.ContrPanel.lbl_NP / sizeof DAS.Gui.ContrPanel.lbl_NP[0], DPAL.DB_FG_Plbl);
328  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_CS, sizeof DAS.Gui.ContrPanel.Plbl_CS / sizeof DAS.Gui.ContrPanel.Plbl_CS[0], DPAL.DB_FG_Plbl);
329  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_IE, sizeof DAS.Gui.ContrPanel.Plbl_IE / sizeof DAS.Gui.ContrPanel.Plbl_IE[0], DPAL.DB_FG_Plbl);
330  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_LS, sizeof DAS.Gui.ContrPanel.Plbl_LS / sizeof DAS.Gui.ContrPanel.Plbl_LS[0], DPAL.DB_FG_Plbl);
331  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_LT, sizeof DAS.Gui.ContrPanel.Plbl_LT / sizeof DAS.Gui.ContrPanel.Plbl_LT[0], DPAL.DB_FG_Plbl);
332 
333  DB_ColorAssign(DAS.Gui.ContrPanel.lbl_lamps, sizeof DAS.Gui.ContrPanel.lbl_lamps / sizeof DAS.Gui.ContrPanel.lbl_lamps[0], DPAL.DB_FG_Plbl);
334  DB_ColorAssign(DAS.Gui.ContrPanel.Plbl_SM, sizeof DAS.Gui.ContrPanel.Plbl_SM / sizeof DAS.Gui.ContrPanel.Plbl_SM[0], DPAL.DB_FG_Plbl);
335  DB_ColorAssign(DAS.Gui.ContrPanel.lbl, sizeof DAS.Gui.ContrPanel.lbl / sizeof DAS.Gui.ContrPanel.lbl[0] , DPAL.DB_FG_Plbl);
336 
337  MObjectSetForegroundRGB(DAS.Gui.ContrPanel.Plbl_Status, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
338  MObjectSetForegroundRGB(DAS.Gui.ContrPanel.Plbl_Script, DPAL.DB_FG_Plbl[0], DPAL.DB_FG_Plbl[1], DPAL.DB_FG_Plbl[2]);
339 
340  }
341 
342  //Forms BG
343  if (FlgBG && (FlgOBJ==4))
344  {
345  DB_Undo2Do_Colors(DPAL.DB_BG, UDPAL.DB_BG);
346  MObjectUnmap(CP_Sh);
347  MObjectMap(CP_Sh);
348 // MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.RwFrm0, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
349 // MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.TbFrm0, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
350 // MObjectSetBackgroundRGB(DAS.Gui.ContrPanel.TbFrm1, DPAL.DB_BG[0], DPAL.DB_BG[1], DPAL.DB_BG[2]);
351  }
352 
353  // Kapital Labels UP BG
354  if (FlgBG && (FlgOBJ==5))
355  {
356  DB_Undo2Do_Colors(DPAL.DB_BG_lblUP, UDPAL.DB_BG_lblUP);
357  DB_ColorAssign(DAS.Gui.ContrPanel.lblK, sizeof DAS.Gui.ContrPanel.lblK / sizeof DAS.Gui.ContrPanel.lblK[0] , DPAL.DB_BG_lblUP);
358  }
359 
360  // Kapital Labels UP FG
361  if (FlgFG && (FlgOBJ==5))
362  {
363  DB_Undo2Do_Colors(DPAL.DB_FG_lblUP, UDPAL.DB_FG_lblUP);
364  DB_ColorAssign(DAS.Gui.ContrPanel.lblK, sizeof DAS.Gui.ContrPanel.lblK / sizeof DAS.Gui.ContrPanel.lblK[0] , DPAL.DB_FG_lblUP);
365  }
366 
367  // Radio Button BG
368  if (FlgBG && (FlgOBJ==6))
369  {
370  DB_Undo2Do_Colors(DPAL.DB_BG_RButt, UDPAL.DB_BG_RButt);
371  DB_ColorAssign(LISTF.rb, sizeof LISTF.rb / sizeof LISTF.rb[0] , DPAL.DB_BG_RButt);
372  }
373 
374 
375  // Radio Button FG
376  if (FlgFG && (FlgOBJ==6))
377  {
378  DB_Undo2Do_Colors(DPAL.DB_FG_RButt, UDPAL.DB_FG_RButt);
379  DB_ColorAssign(LISTF.rb, sizeof LISTF.rb / sizeof LISTF.rb[0] , DPAL.DB_FG_RButt);
380  }
381 */
382 
383 }
384 
385 
386 void ColorPickCB(MOBJECT o, void *o_data, void *a_data)
387 {
388  MOBJECT p = (MOBJECT) a_data;
389  int r, g, b;
390 
391  MQueryColor(MObjectBackgroundColor(p), &r, &g, &b);
392  MScrollBarSetPos(r_sbar, (long) r);
393  MScrollBarSetPos(g_sbar, (long) g);
394  MScrollBarSetPos(b_sbar, (long) b);
395 }
396 
398 {
399 
400  int r, g, b;
401 
402  if(FlgBG)
403  MQueryColor(MObjectBackgroundColor(o), &r, &g, &b);
404  if(FlgFG)
405  MQueryColor(MObjectForegroundColor(o), &r, &g, &b);
406 
407  MScrollBarSetPos(r_sbar, (long) r);
408  MScrollBarSetPos(g_sbar, (long) g);
409  MScrollBarSetPos(b_sbar, (long) b);
410 }
411 
412 
413 void ColObjCB(MOBJECT o, void *a, void *v)
414 {
415 //sceglie l'oggetto da considerare label, buttons....
416 
417  int c = (int) v;
418  int er = 0;
419  int r, g, b;
420 
422  if (er)
423  {
424  switch (c)
425  {
426  case 0:
427  FlgOBJ=0; //Unselected Command Button
428  if(FlgBG)
429  {
430  r = DPAL.DB_UnSel[0];
431  g = DPAL.DB_UnSel[1];
432  b = DPAL.DB_UnSel[2];
433  }
434  break;
435  case 1:
436  FlgOBJ=1; //Selected KeyCom
437  if(FlgBG)
438  {
439  r = DPAL.DB_Sel[0];
440  g = DPAL.DB_Sel[1];
441  b = DPAL.DB_Sel[2];
442  }
443  break;
444 
445  case 2:
446  FlgOBJ=2; //Active Labels
447  if (DAS.Flag.exemode != OFFLINEPLOT && DAS.Flag.exemode != DOASMODE )
448  {
449  if(FlgBG)
450  {
451  r = DPAL.DB_BG_Albl[0];
452  g = DPAL.DB_BG_Albl[1];
453  b = DPAL.DB_BG_Albl[2];
454  }
455  if(FlgFG)
456  {
457  r = DPAL.DB_FG_Albl[0];
458  g = DPAL.DB_FG_Albl[1];
459  b = DPAL.DB_FG_Albl[2];
460  }
461  break;
462  }
463  else
464  {
465  if(!MMessageDialog("DAS information", "Not Available in this Execution mode", " Ok ", NULL))
467  break;
468  }
469  case 3:
470  FlgOBJ=3; //Passive Labels
471  if (DAS.Flag.exemode != OFFLINEPLOT && DAS.Flag.exemode != DOASMODE )
472  {
473  if(FlgBG)
474  {
475  r = DPAL.DB_BG_Plbl[0];
476  g = DPAL.DB_BG_Plbl[1];
477  b = DPAL.DB_BG_Plbl[2];
478  }
479  if(FlgFG)
480  {
481  r = DPAL.DB_FG_Plbl[0];
482  g = DPAL.DB_FG_Plbl[1];
483  b = DPAL.DB_FG_Plbl[2];
484  }
485  break;
486  }
487  else
488  {
489  if(!MMessageDialog("DAS information", "Not Available in this Execution mode", " Ok ", NULL))
491  break;
492  }
493  case 4:
494  FlgOBJ=4; //Forms Background
495  if (DAS.Flag.exemode != OFFLINEPLOT && DAS.Flag.exemode != DOASMODE )
496  {
497  r = DPAL.DB_BG[0];
498  g = DPAL.DB_BG[1];
499  b = DPAL.DB_BG[2];
500 // DB_ColorPick(DAS.Gui.ContrPanel.RwFrm0);
501  break;
502  }
503  else
504  {
505  DB_ColorPick(LISTF.shell);
506  break;
507  }
508  case 5:
509  FlgOBJ=5; //Kapital Labels UP
510  if (DAS.Flag.exemode != OFFLINEPLOT && DAS.Flag.exemode != DOASMODE )
511  {
512  if(FlgBG)
513  {
514  r = DPAL.DB_BG_lblUP[0];
515  g = DPAL.DB_BG_lblUP[1];
516  b = DPAL.DB_BG_lblUP[2];
517  }
518  if(FlgFG)
519  {
520  r = DPAL.DB_FG_lblUP[0];
521  g = DPAL.DB_FG_lblUP[1];
522  b = DPAL.DB_FG_lblUP[2];
523  }
524  break;
525  }
526  else
527  {
528  DB_ColorPick(LISTF.lbl[0]);
529  break;
530  }
531  case 6:
532  FlgOBJ=6; //Radio Buttons
533  DB_ColorPick(LISTF.rb[0]);
534  break;
535  }
536 
537  MScrollBarSetPos(r_sbar, (long) r);
538  MScrollBarSetPos(g_sbar, (long) g);
539  MScrollBarSetPos(b_sbar, (long) b);
540  }
541 }
542 
543 void DB_ChangeColorCellCB(MOBJECT o, MVALUE o_data, void *a_data)
544 {
545  char str[16];
546 
547  switch ((int) a_data)
548  {
549  case 0:
550  r_c = (int) o_data;
551  sprintf(str, "%03d", r_c);
552  MObjectSetText(r_label, str);
553  break;
554  case 1:
555  g_c = (int) o_data;
556  sprintf(str, "%03d", g_c);
557  MObjectSetText(g_label, str);
558  break;
559  case 2:
560  b_c = (int) o_data;
561  sprintf(str, "%03d", b_c);
562  MObjectSetText(b_label, str);
563  break;
564  }
565  if (PaletteMode)
567  else
569 }
570 
571 
572 /****************************************************
573  1) Assign to the UNDO_Color structure the Color Values
574  of the DO_Color Structure
575  2) Assigne to the DO_Color structure the chosen
576  color values
577 *****************************************************/
578 void DB_Do2Undo_Colors( short docol[], short undocol[])
579 {
580 
581  int i;
582  for (i = 0; i < 3;i++)
583  {
584  undocol[i] = docol[i];
585  }
586 
587 
588  docol[0] = r_c;
589  docol[1] = g_c;
590  docol[2] = b_c;
591 
592 }
593 
594 
595 int LoadPaletteCB(MOBJECT o, void *o_data, void *a_data)
596 {
597 
598  char str[_MAX_PATH] ;
599  char fname[128], dirname[128];
600  int er;
601 
602  FB_PREFS fbp;
603  strcpy (dirname, MGetCurrentDirectory ());
604  fname[0] = '\0';
605  memset (&fbp, 0, sizeof (fbp));
606 
607  fbp.change_cwd = True;
608  fbp.allow_dir_create = True;
609  fbp.allow_dir_rename = True;
610  fbp.allow_dir_delete = True;
611  fbp.transparent_tree = False;
612  fbp.font = HELV_SMALL;
613  fbp.button_font = HELV_SMALL;
614  //Set Img file
615  sprintf(str, "%s\\%s", BIL.DFILEM.HOMEDIRECTORY, "sys\\Tile2.bmp" );
616  fbp.bg_image_file =str;
617 
618 
619  er = MFileBrowseExt ("Select File for Plotting", "*.MAP", fname, dirname, &fbp);
620  sprintf(BIL.DFILEM.DBFILENAME,"%s%s",dirname, fname);
621 
622  //BIL.DFILEM.DBFILENAME[0] = 0;
623 
624  //MDCreateFM_Shell(FOPEN, FMAP); //Open File, MAP ext.
625 
626  if(BIL.DFILEM.DBFILENAME[0] == 0)
627  return 1;
628 
630  return 0;
631 }
632 
633 //extern MOBJECT Mshell;
634 
635 void ColorAssignCB(MOBJECT o, void *o_data, void *a_data)
636 {
637 
638 // int i;
639  // Unselected Buttons BG
640  if(FlgBG && (FlgOBJ==0))
641  {
642  DPAL.DB_UnSel[0] = r_c;
643  DPAL.DB_UnSel[1] = g_c;
644  DPAL.DB_UnSel[2] = b_c;
645  }
646  // Unselected Buttons FG
647  if(FlgFG && (FlgOBJ==0))
648  {
649  DPAL.DB_UnSelFG[0] = r_c;
650  DPAL.DB_UnSelFG[1] = g_c;
651  DPAL.DB_UnSelFG[2] = b_c;
652  }
653  // Selected Buttons
654  if (FlgBG && (FlgOBJ==1))
655  {
656  DPAL.DB_Sel[0] = r_c;
657  DPAL.DB_Sel[1] = g_c;
658  DPAL.DB_Sel[2] = b_c;
659  }
660  //Active Labels BG
661  if (FlgBG && (FlgOBJ==2))
662  {
663  DPAL.DB_BG_Albl[0] = r_c;
664  DPAL.DB_BG_Albl[1] = g_c;
665  DPAL.DB_BG_Albl[2] = b_c;
666  }
667 
668  //Active Labels FG
669  if (FlgFG && (FlgOBJ==2))
670  {
671  DPAL.DB_FG_Albl[0] = r_c;
672  DPAL.DB_FG_Albl[1] = g_c;
673  DPAL.DB_FG_Albl[2] = b_c;
674 
675  }
676 
677  //Passive Labels BG
678  if (FlgBG && (FlgOBJ==3))
679  {
680  DPAL.DB_BG_Plbl[0] = r_c;
681  DPAL.DB_BG_Plbl[1] = g_c;
682  DPAL.DB_BG_Plbl[2] = b_c;
683  }
684 
685  //Passive Labels FG
686  if (FlgFG && (FlgOBJ==3))
687  {
688  DPAL.DB_FG_Plbl[0] = r_c;
689  DPAL.DB_FG_Plbl[1] = g_c;
690  DPAL.DB_FG_Plbl[2] = b_c;
691  }
692 
693  //Forms BG
694  if (FlgBG && (FlgOBJ==4))
695  {
696  DPAL.DB_BG[0] = r_c;
697  DPAL.DB_BG[1] = g_c;
698  DPAL.DB_BG[2] = b_c;
699  }
700 
701  // Kapital Labels UP BG
702  if (FlgBG && (FlgOBJ==5))
703  {
704  DPAL.DB_BG_lblUP[0] = r_c;
705  DPAL.DB_BG_lblUP[1] = g_c;
706  DPAL.DB_BG_lblUP[2] = b_c;
707  }
708 
709  // Kapital Labels UP FG
710  if (FlgFG && (FlgOBJ==5))
711  {
712  DPAL.DB_FG_lblUP[0] = r_c;
713  DPAL.DB_FG_lblUP[1] = g_c;
714  DPAL.DB_FG_lblUP[2] = b_c;
715  }
716 
717  // Radio Buttons DW BG
718  if (FlgBG && (FlgOBJ==6))
719  {
720  DPAL.DB_BG_RButt[0] = r_c;
721  DPAL.DB_BG_RButt[1] = g_c;
722  DPAL.DB_BG_RButt[2] = b_c;
723  }
724 
725 
726  // Radio Buttons FG
727  if (FlgFG && (FlgOBJ==6))
728  {
729  DPAL.DB_FG_RButt[0] = r_c;
730  DPAL.DB_FG_RButt[1] = g_c;
731  DPAL.DB_FG_RButt[2] = b_c;
732  }
733 
734 
738 
739 
740 
741 
742 }
743 
744 void TextColorAssignCB(MOBJECT o, MVALUE o_data, void *a_data)
745 {
746  if (o_data)
747  {
748  label_fgc = (a_data ? MTCL.white : MTCL.black);
750  }
751 }
752 
753 
754 void ColorSaveCB(MOBJECT o, void *o_data, void *a_data)
755 {
756  MAllocCell(r_c, g_c, b_c);
757 #ifdef WINDOWS
758 /*
759  * Windows palette is indirect, so it is
760  * necessary to redraw rectangles with a new color
761  */
762  if (PaletteMode)
763  ColorMapExposeCB(frm3_dr1, NULL, 0L);
764 #endif
765 }
766 
767 void ColorFreeCB(MOBJECT o, void *o_data, void *a_data)
768 {
769  if (sel_cell != (int) cell_color)
770  {
771  MSetCellColor(sel_cell, 0, 0, 0);
773  }
774 }
775 
776 void CloseColPickCB(MOBJECT obj, void *s, void *v)
777 {
778  MOBJECT p;
779 
782  p = MObjectShell(obj);
783 
784  MShellUnrealize(p);
785  MShellDestroy(p);
786 }
787 
788 void DB_CellExposeCB(MOBJECT obj, MEvent * pexp, void *a_data)
789 {
790  int hsize, wsize;
791 
792  wsize = MObjectGetWidth(obj);
793  hsize = MObjectGetHeight(obj);
794  if (PaletteMode)
795  MDrawFilledBox(obj, 0, 0, wsize, hsize, cell_color);
796 }
797 
798 void DB_CellResizeCB(MOBJECT obj, DRAWAREA_PREF * pref, void *a_data)
799 {
800  pref->new_h = pref->old_h;
801 }
802 
803 void ColorMapExposeCB(MOBJECT obj, MEvent * pexp, void *a_data)
804 {
805  int n, hsize, wsize, i, j;
806 
807  n = (DIL.Cfg.NColors == 16 ? 4 : 16);
808  wsize = MObjectGetWidth(obj) / n;
809  hsize = MObjectGetHeight(obj) / n;
810  for (i = 0; i < n; i++)
811  for (j = 0; j < n; j++)
812  MDrawFilledBox(obj, wsize * j + 1, hsize * i + 1, wsize - 2, hsize - 2, i * n + j);
813  MDrawBox(obj, sel_x, sel_y, wsize, hsize, MTCL.white);
814 }
815 
816 void ColorMapResizeCB(MOBJECT obj, DRAWAREA_PREF * pref, void *a_data)
817 {
818  int n, new_hsize, new_wsize, old_hsize, old_wsize;
819 
820  n = (DIL.Cfg.NColors == 16 ? 4 : 16);
821  old_wsize = pref->old_w / n;
822  old_hsize = pref->old_h / n;
823  new_wsize = pref->new_w / n;
824  new_hsize = pref->new_h / n;
825  sel_x = (sel_x * new_wsize) / old_wsize;
826  sel_y = (sel_y * new_hsize) / old_hsize;
827  pref->new_w = new_wsize * n;
828  pref->new_h = new_hsize * n;
829 }
830 
831 void ColorMapInputCB(MOBJECT obj, MEvent * pe, void *a_data)
832 {
833  int n, hsize, wsize;
834  int r, g, b, old_x, old_y;
835 
836  n = (DIL.Cfg.NColors == 16 ? 4 : 16);
837  wsize = MObjectGetWidth(obj) / n;
838  hsize = MObjectGetHeight(obj) / n;
839  old_x = sel_x;
840  old_y = sel_y;
841  if (pe->type == E_KEY_PRESS)
842  {
843  switch (pe->key.keycode)
844  {
845  case U_A:
846  sel_cell -= n;
847  if (sel_cell < 0)
848  sel_cell += (int) DIL.Cfg.NColors;
849  break;
850  case D_A:
851  sel_cell += n;
852  if (sel_cell > (int) DIL.Cfg.NColors)
853  sel_cell -= (int) DIL.Cfg.NColors;
854  break;
855  case R_A:
856  if (++sel_cell >= (int) DIL.Cfg.NColors)
857  sel_cell = 0;
858  break;
859  case L_A:
860  if (--sel_cell < 0)
861  sel_cell = (int) DIL.Cfg.NColors - 1;
862  break;
863  default:
864  return;
865  }
866  sel_x = (sel_cell % n) * wsize;
867  sel_y = (sel_cell / n) * hsize;
868  }
869  else if (pe->type == E_BUTTON_PRESS)
870  {
871  sel_x = (pe->mouse.x / wsize) * wsize;
872  sel_y = (pe->mouse.y / hsize) * hsize;
873  sel_cell = sel_x / wsize + sel_y / hsize * n;
874  }
875  else
876  return;
877  MDrawBox(obj, old_x, old_y, wsize, hsize, drawarea_bgc);
878  MDrawBox(obj, sel_x, sel_y, wsize, hsize, MTCL.white);
879  MQueryColor(sel_cell, &r, &g, &b);
880  MScrollBarSetPos(r_sbar, (long) r);
881  MScrollBarSetPos(g_sbar, (long) g);
882  MScrollBarSetPos(b_sbar, (long) b);
883 
884 }
885 
886 void ScreenInfoCB(MOBJECT o, void *s, void *v)
887 {
888  char buff[256];
889 
890  sprintf(buff, "Width: %d\nHeight: %d\nColors: %ld\nPlanes: %d",
891  MGetScreenWidth(),
893  MGetNColors(),
894  MGetNPlanes());
895  MMessageDialog("Screen Information", buff, " Ok ", NULL);
896 }
897 
898 
899 
900 /********************* End of COLORS CallBack *****************************/
901 /***************************************************************************/
902 /********************* Start of OPTIONS CallBack **************************/
903 
904 void DB_RadioAvgModeCB(MOBJECT o, void *id, void *a_data)
905 {
906  int c = (int) a_data;
907  char buf[80];
908 
909  switch(c)
910  {
911  case 0 :
912  DAS.DOption.avgmode=0;
913  sprintf(buf,"%d",N_AVG);
914  MObjectSetText(DAS.Gui.ConfigPanel.lblAvg, "Repeat measure for: ");
916 
917  break;
918  case 1:
919  DAS.DOption.avgmode=1;
920  sprintf(buf, "%d", TOTTEXP);
921  MObjectSetText(DAS.Gui.ConfigPanel.lblAvg, "TOT Exposure Time [s]:");
923 
924  break;
925 
926  }
927 }
928 
929 
930 
931 void DB_RadioPixCorrCB(MOBJECT o, void *id, void *a_data)
932 {
933  int c = (int) a_data;
934 // char buf[80];
935 
936  switch(c)
937  {
938  case 0 :
939  DAS.DOption.pixcorr=0; //Pixel correction disabled
942 
943  break;
944  case 1:
945  DAS.DOption.pixcorr=1; //Pixel correction ENABLED
949  break;
950 
951  }
952 }
953 
954 
955 void DB_RadioModeSelCB(MOBJECT o, void *id, void *a_data)
956 {
957  int c = (int) a_data;
958 // char buf[80];
959 
960  switch(c)
961  {
962  case 0 :
963  DAS.DOption.savingmode=0;
964  break;
965  case 1:
966  DAS.DOption.savingmode=1;
967  break;
968 
969  }
970 }
971 
972 void DB_RadioDarkCB(MOBJECT o, void *id, void *a_data)
973 {
974  int c = (int) a_data;
975 // char buf[80];
976 
977  switch(c)
978  {
979  case 0 :
980  DAS.DOption.darkremove=0;
983 
984  break;
985  case 1:
986  DAS.DOption.darkremove=1;
989 
990 /* if (DAS.DOption.flgdarksource)
991  MRButtonActivate(DAS.Gui.ConfigPanel.FFDark);
992  else
993  MRButtonActivate(DAS.Gui.ConfigPanel.BPDark);
994 */ break;
995 
996  }
997 }
998 
999 
1000 void DB_MIGE_CB(MOBJECT o, void *a, void *v)
1001 {
1002 
1003  int er = 0;
1004  int c = (int) v;
1005 
1006 
1008 
1009  if(er)
1010  {
1011  switch (c)
1012  {
1013  case 0:
1014  DAS.MIGE.linked = 0; //MIGE not Connected
1024 
1025  //MObjectSetUnsensitive(DAS.Gui.PushButt.KeyB[5]);
1026  break;
1027  case 1:
1028  DAS.MIGE.linked = 1; //
1038  break;
1039  }
1040  }
1041 }
1042 
1043 void DB_MIGEType_CB(MOBJECT o, void *a, void *v)
1044 {
1045 
1046  int er = 0;
1047  int c = (int) v;
1048 
1049 
1051 
1052  if(er)
1053  {
1054  switch (c)
1055  {
1056  case 0:
1057  DAS.MIGE.type = 0; //Old and Big Platform (not used anymore)
1058  break;
1059  case 1:
1060  DAS.MIGE.type = 1; //ISAC Version
1061  break;
1062  case 2:
1063  DAS.MIGE.type = 2; //COM Version (with slip ring)
1064  break;
1065  }
1066  }
1067 }
1068 
1069 
1070 
1071 void DB_MIGEopmode_CB(MOBJECT o, void *a, void *v)
1072 {
1073 
1074  int er = 0;
1075  int c = (int) v;
1076 
1077 
1079 
1080  if(er)
1081  {
1082  switch (c)
1083  {
1084  case 0:
1085  DAS.DOption.aaopmode = 0; //Solar Tracker
1086  if(DAS.Flag.exemode != DOASMODE)
1087  {
1091  //MObjectSetUnsensitive(DAS.Gui.PushButt.KeyB[4]);
1092  }
1093  break;
1094  case 1:
1095  DAS.DOption.aaopmode = 1; //Anti Solar Tracker
1096  if(DAS.Flag.exemode != DOASMODE)
1097  {
1101  //MObjectSetUnsensitive(DAS.Gui.PushButt.KeyB[4]);
1102  }
1103  break;
1104  case 2:
1105  DAS.DOption.aaopmode = 2; //Free Positioning
1106  if(DAS.Flag.exemode != DOASMODE)
1107  {
1111  //MObjectSetSensitive(DAS.Gui.PushButt.KeyB[4]);
1112  }
1113  break;
1114  }
1115  }
1116 }
1117 
1118 
1119 void DB_AMSProgBar_CB(MOBJECT o, void *a, void *v)
1120 {
1121 
1122  int er = 0;
1123  int c = (int) v;
1124 
1125 
1127 
1128  if(er)
1129  {
1130  switch (c)
1131  {
1132  case 0:
1133  DAS.DOption.amsprogbar = 0; //hide prog bars
1134  break;
1135  case 1:
1136  DAS.DOption.amsprogbar = 1; //show prog bars
1137  break;
1138  }
1139  }
1140 
1141 }
1142 
1143 
1144 
1145 void DB_ShutterType_CB(MOBJECT o, void *a, void *v)
1146 {
1147 
1148  int er = 0;
1149  int c = (int) v;
1150 
1151 
1153 
1154  if(er)
1155  {
1156  switch (c)
1157  {
1158  case VS25:
1159  DAS.DOption.shuttertype = VS25;
1160  break;
1161  case ROTSHUT:
1162  DAS.DOption.shuttertype = ROTSHUT;
1163  break;
1164  case TORQUEM:
1165  DAS.DOption.shuttertype = TORQUEM;
1166  break;
1167 
1168  }
1169  }
1170 
1171 }
1172 
1173 
1174 void DB_FilterType_CB(MOBJECT o, void *a, void *v)
1175 {
1176 
1177  int er = 0;
1178  int c = (int) v;
1179 
1180 
1182 
1183  if(er)
1184  {
1185  switch (c)
1186  {
1187  case FSIMPLE:
1188  DAS.DOption.filtertype = FSIMPLE;
1189  break;
1190  case FDOUBLE:
1191  DAS.DOption.filtertype = FDOUBLE;
1192  break;
1193  case FPLUS:
1194  DAS.DOption.filtertype = FPLUS;
1195  break;
1196 
1197  }
1198  }
1199 
1200 }
1201 
1202 
1203 
1204 void DB_Shutter_CB(MOBJECT o, void *a, void *v)
1205 {
1206 
1207  int er = 0;
1208  int c = (int) v;
1209 
1210 
1212 
1213  if(er)
1214  {
1215  switch (c)
1216  {
1217  case 0:
1218  DAS.DOption.emshutter = 0; //Shutter not Installed
1222  break;
1223  case 1:
1224  DAS.DOption.emshutter = 1; //Shutter installed
1228  break;
1229  }
1230  }
1231 
1232 }
1233 
1234 void DB_AMSposmode_CB(MOBJECT o, void *a, void *v)
1235 {
1236 
1237  int er = 0;
1238  int c = (int) v;
1239 
1240 
1242 
1243  if(er)
1244  {
1245  switch (c)
1246  {
1247  case 0:
1248  DAS.DOption.smposmode = 1; //Simultaneous positioning
1249  break;
1250  case 1:
1251  DAS.DOption.smposmode = 0; //sequential positioning
1252  break;
1253  }
1254  }
1255 
1256 }
1257 
1258 
1259 void DB_MirrorImg_CB(MOBJECT o, void *a, void *v)
1260 {
1261 
1262  int er = 0;
1263  int c = (int) v;
1264 
1265 
1267 
1268  if(er)
1269  {
1270  switch (c)
1271  {
1272  case 0:
1273  DAS.DOption.mirrorimg[XAX] = 1; //Mirror image along X Axis
1274  break;
1275  case 1:
1276  DAS.DOption.mirrorimg[XAX] = 0; //Do NOT mirror image along X Axis ;
1277  break;
1278  case 2:
1279  DAS.DOption.mirrorimg[YAX] = 1; //Mirror image along Y Axis
1280  break;
1281  case 3:
1282  DAS.DOption.mirrorimg[YAX] = 0; //Do NOT mirror image along Y Axis ;
1283  break;
1284 
1285  }
1286  }
1287 
1288 }
1289 
1290 void DB_RadDrkSourceCB(MOBJECT o, void *a, void *v)
1291 {
1292  int er = 0;
1293  int c = (int) v;
1294 
1295 
1297 
1298  if(er)
1299  {
1300  switch (c)
1301  {
1302  case 0:
1303  DAS.DOption.darksource = 0;
1304  break;
1305  case 1:
1306  DAS.DOption.darksource = 1;
1307  break;
1308 
1309  }
1310  }
1311 
1312 }
1313 
1314 void DB_ImgTypeCB(MOBJECT o, void *id, void *a_data)
1315 {
1316 
1317  int c = (int) a_data;
1318 // char buf[80];
1319 
1320  switch(c)
1321  {
1322  case 0 :
1323  DAS.DOption.imgtype=0; //Mono
1324  break;
1325  case 1:
1326  DAS.DOption.imgtype=1; //RGB
1327  break;
1328 
1329  }
1330 
1331 
1332 
1333 
1334 }
1335 
1336 void DB_RadioFNSelCB(MOBJECT o, void *id, void *a_data)
1337 {
1338 
1339  int c = (int) a_data;
1340 // char buf[80];
1341 
1342  switch(c)
1343  {
1344  case 0 :
1345  DAS.DOption.filename=0; //free
1346  break;
1347  case 1:
1348  DAS.DOption.filename=1; //Automatico
1349  break;
1350 
1351  }
1352 
1353 }
1354 /********************* End of OPTION CallBack *****************************/
1355 /***************************************************************************/
1356 /********************* Start of FONTS CallBack ****************************/
1357 
1359 {
1360 
1361  undofont = dofont;
1362 
1363 }
1364 
1366 {
1367 
1368  dofont = undofont;
1369 
1370 }
1371 
1372 
1373 
1374 void DB_FontAssign(MOBJECT a[], int numel, MTFont fnt)
1375 {
1376  int i;
1377  for (i=0; i < numel; i++)
1378  {
1379  MObjectSetFont(a[i], fnt, True);
1380  }
1381 
1382 }
1383 
1384 
1385 void FontOBJSelCB(MOBJECT obj, void *a, void *v)
1386 {
1387 //sceglie l'oggetto da considerare label, buttons....
1388 
1389  switch ((int) v)
1390  {
1391  case 0:
1392  FlgOBJ=0; //Unselected KeyCom
1393  break;
1394  case 1:
1395  FlgOBJ=1; //Selected KeyCom
1396  break;
1397  case 2:
1398  FlgOBJ=2; //Active Labels
1399  break;
1400  case 3:
1401  FlgOBJ=3; //Passive Labels
1402  break;
1403  case 4:
1404  FlgOBJ=4; //Forms Background
1405  break;
1406  case 5:
1407  FlgOBJ=5; //Kapital Labels UP
1408  break;
1409  case 6:
1410  FlgOBJ=6; //Kapital Labels DW
1411  break;
1412  }
1413 }
1414 
1415 
1416 void WriteFontCB(MOBJECT obj, void *a, void *v)
1417 {
1418  MMessageDialog("DAS information", "The procedure is not yet implemented!!", " Ok ", NULL);
1419 }
1420 
1421 void UndoFCB(MOBJECT obj, void *a, void *v)
1422 {
1423 
1424 }
1425 void DB_TestF(void)
1426 {
1427  MTFont newfont;
1428  int size;
1429  char family[32], buff[8];
1430 /*
1431  * Get user preferences from the EDIT Objects
1432  */
1433  MObjectGetText (e_fname, family);
1434  MObjectGetText (e_fsize, buff);
1435  size = atoi (buff);
1436  newfont = MLoadFont (family, size, bold, italic);
1437 /*
1438  * The function returns FIXED_MEDIUM on failure
1439  */
1440  if (newfont != FIXED_MEDIUM)
1441  {
1442  if (font != FIXED_MEDIUM)
1443  MUnloadFont (font);
1444  font = newfont;
1446  }
1447  else
1448  MBeep ();
1449 
1450 
1451 }
1452 /***************************************************************
1453  * This callback toggles the Bold attribute
1454  ***************************************************************/
1455 void SetBoldCB(MOBJECT obj, MVALUE a, void *data)
1456 {
1457  bold = (int) a;
1458  DB_TestF();
1459 }
1460 
1461 /***************************************************************
1462  * This callback toggles the Italic attribute
1463  ***************************************************************/
1464 void SetItalicCB(MOBJECT obj, MVALUE a, void *data)
1465 {
1466  italic = (int) a;
1467  DB_TestF();
1468 }
1469 
1470 /***************************************************************
1471  * This callback Unloads the latest loaded font and
1472  * destroys the dialog
1473  ***************************************************************/
1474 void CloseFontViewCB(MOBJECT p, void *a, void *data)
1475 {
1476  if (font != FIXED_MEDIUM)
1477  MUnloadFont(font);
1478  font = FIXED_MEDIUM;
1479  p = MObjectShell(p);
1480 
1481  MShellUnrealize(p);
1482  MShellDestroy(p);
1483 }
1484 
1485 
1486 /***************************************************************
1487  * This callback tries to load the specified font
1488  ***************************************************************/
1489 void TestFontCB(MOBJECT obj, void *a, void *data)
1490 {
1491 
1492  DB_TestF();
1493 
1494 
1495 }
1496 
1497 
1498 
1499 int undofont = 15;
1500 /***************************************************************
1501  * This callback tries to load the specified font
1502  ***************************************************************/
1503 void LoadFontCB(MOBJECT obj, void *a, void *data)
1504 {
1505 /*
1506  MTFont newfont;
1507  int size;
1508 // int i;
1509  char family[32], buff[8];
1510 /*
1511  * Get user preferences from the EDIT Objects
1512  *
1513  MObjectGetText(e_fname, family);
1514  MObjectGetText(e_fsize, buff);
1515  size = atoi(buff);
1516  newfont = MLoadFont(family, size, bold, italic);
1517 /*
1518  * Apply the selected fonts to the selected object
1519  *
1520  // KeyCom Unselected
1521  if(FlgOBJ==0)
1522  {
1523  DB_Do2Undo_Fonts( newfont, undofont);
1524  DB_FontAssign(PBUTT.KeyB, sizeof PBUTT.KeyB / sizeof PBUTT.KeyB[0], newfont);
1525 
1526  }
1527  // KeyCom Selected
1528  if (FlgOBJ==1)
1529  {
1530  DB_Do2Undo_Fonts( newfont, undofont);
1531  MObjectSetFont(PBUTT.KeyB[0], newfont, True);
1532  }
1533  //Active Labels
1534  if (FlgOBJ==2)
1535  {
1536  DB_Do2Undo_Fonts( newfont, undofont);
1537  DB_FontAssign(DAS.Gui.ContrPanel.lbl_Par, sizeof DAS.Gui.ContrPanel.lbl_Par / sizeof DAS.Gui.ContrPanel.lbl_Par[0], newfont);
1538  DB_FontAssign(DAS.Gui.ContrPanel.Albl_CS, sizeof DAS.Gui.ContrPanel.Albl_CS / sizeof DAS.Gui.ContrPanel.Albl_CS[0], newfont);
1539  DB_FontAssign(DAS.Gui.ContrPanel.Albl_IE, sizeof DAS.Gui.ContrPanel.Albl_IE / sizeof DAS.Gui.ContrPanel.Albl_IE[0], newfont);
1540  DB_FontAssign(DAS.Gui.ContrPanel.Albl_LS, sizeof DAS.Gui.ContrPanel.Albl_LS / sizeof DAS.Gui.ContrPanel.Albl_LS[0], newfont);
1541  DB_FontAssign(DAS.Gui.ContrPanel.Albl_LT, sizeof DAS.Gui.ContrPanel.Albl_LT / sizeof DAS.Gui.ContrPanel.Albl_LT[0], newfont);
1542  DB_FontAssign(DAS.Gui.ContrPanel.cop, sizeof DAS.Gui.ContrPanel.cop / sizeof DAS.Gui.ContrPanel.cop[0] , newfont);
1543  DB_FontAssign(DAS.Gui.ContrPanel.step, sizeof DAS.Gui.ContrPanel.step / sizeof DAS.Gui.ContrPanel.step[0] , newfont);
1544  DB_FontAssign(DAS.Gui.ContrPanel.slope, sizeof DAS.Gui.ContrPanel.slope / sizeof DAS.Gui.ContrPanel.slope[0] , newfont);
1545  DB_FontAssign(DAS.Gui.ContrPanel.speed, sizeof DAS.Gui.ContrPanel.speed / sizeof DAS.Gui.ContrPanel.speed[0] , newfont);
1546  MObjectSetFont(DAS.Gui.ContrPanel.Albl_Status, newfont, True);
1547  MObjectSetFont(DAS.Gui.ContrPanel.Albl_Script, newfont, True);
1548 
1549  }
1550 
1551  //Passive Labels BG
1552  if (FlgOBJ==3)
1553  {
1554  DB_Do2Undo_Fonts( newfont, undofont);
1555  DB_FontAssign(DAS.Gui.ContrPanel.lbl_NP, sizeof DAS.Gui.ContrPanel.lbl_NP / sizeof DAS.Gui.ContrPanel.lbl_NP[0], newfont);
1556  DB_FontAssign(DAS.Gui.ContrPanel.Plbl_CS, sizeof DAS.Gui.ContrPanel.Plbl_CS / sizeof DAS.Gui.ContrPanel.Plbl_CS[0], newfont);
1557  DB_FontAssign(DAS.Gui.ContrPanel.Plbl_IE, sizeof DAS.Gui.ContrPanel.Plbl_IE / sizeof DAS.Gui.ContrPanel.Plbl_IE[0], newfont);
1558  DB_FontAssign(DAS.Gui.ContrPanel.Plbl_LS, sizeof DAS.Gui.ContrPanel.Plbl_LS / sizeof DAS.Gui.ContrPanel.Plbl_LS[0], newfont);
1559  DB_FontAssign(DAS.Gui.ContrPanel.Plbl_LT, sizeof DAS.Gui.ContrPanel.Plbl_LT / sizeof DAS.Gui.ContrPanel.Plbl_LT[0], newfont);
1560 
1561  DB_FontAssign(DAS.Gui.ContrPanel.lbl_lamps, sizeof DAS.Gui.ContrPanel.lbl_lamps / sizeof DAS.Gui.ContrPanel.lbl_lamps[0], newfont);
1562  DB_FontAssign(DAS.Gui.ContrPanel.Plbl_SM, sizeof DAS.Gui.ContrPanel.Plbl_SM / sizeof DAS.Gui.ContrPanel.Plbl_SM[0], newfont);
1563  DB_FontAssign(DAS.Gui.ContrPanel.lbl, sizeof DAS.Gui.ContrPanel.lbl / sizeof DAS.Gui.ContrPanel.lbl[0] , newfont);
1564 
1565  MObjectSetFont(DAS.Gui.ContrPanel.Plbl_Status, newfont, True);
1566  MObjectSetFont(DAS.Gui.ContrPanel.Plbl_Script, newfont, True);
1567 
1568 
1569  }
1570 
1571 
1572 
1573 
1574  // Kapital Labels UP BG
1575  if (FlgOBJ==4)
1576  {
1577  DB_Do2Undo_Fonts( newfont, undofont);
1578  DB_FontAssign(DAS.Gui.ContrPanel.lblK, sizeof DAS.Gui.ContrPanel.lblK / sizeof DAS.Gui.ContrPanel.lblK[0], newfont);
1579 
1580  }
1581 
1582 
1583  // Kapital Labels DW BG
1584  if (FlgOBJ==5)
1585  {
1586  DB_Do2Undo_Fonts( newfont, undofont);
1587  DB_FontAssign(DAS.Gui.ContrPanel.lblK_DW, sizeof DAS.Gui.ContrPanel.lblK_DW / sizeof DAS.Gui.ContrPanel.lblK_DW[0], newfont);
1588 
1589  }
1590 
1591 
1592 
1593 
1594 
1595 /**************************************************************/
1596 /*
1597  * The function returns FIXED_MEDIUM on failure
1598 
1599  if (newfont != FIXED_MEDIUM)
1600  {
1601 // if (font != FIXED_MEDIUM)
1602 // MUnloadFont(font);
1603 // font = newfont;
1604  MObjectRedraw(DAS.Gui.ConfigPanel.frm4_dr1);
1605  }
1606  else
1607  MBeep();
1608 
1609 */
1610 }
1611 
1612 /***************************************************************
1613  * This callback draws strings using the selected font
1614  ***************************************************************/
1615 void DrawAreaExpFontCB(MOBJECT obj, MEvent * pe, void *data)
1616 {
1617  MDrawText(obj,
1618  0, 0, MObjectGetWidth(obj), MObjectGetHeight(obj)/2,
1619  "AaBbCcDdEeFfGgHhIiJjKkLl",
1620  font, MTCL.black, CENTER_ALIGN);
1621  MDrawText(obj,
1622  0, MObjectGetHeight(obj) / 2, MObjectGetWidth(obj), MObjectGetHeight(obj) / 2,
1623  "MmOoPpQqRrSsTtUuVvWwXxYyZz",
1624  font, MTCL.black, CENTER_ALIGN);
1625 }
1626 
1627 
1628 /********************* End of FONTS CallBack *****************************/
1629 /***************************************************************************/
1630 /********************* Start of OPTIONS EDITS CallBack **************************/
1631 
1632 void ValidateCB(MOBJECT edit, EDIT_VAL *ev, void *ii)
1633 {
1634  int c = (int) ii;
1635 // int x,y;
1636 // div_t div_result;
1637 
1638  switch (c)
1639  {
1640  case 1:
1641  {
1642  DAS.Paramini.ITemp = strtod( ev->text, &ev->text );
1643  if (DAS.Paramini.ITemp < -40 || DAS.Paramini.ITemp > 30)
1644  {
1645  ev->focus_leave = False;
1646 
1647  }
1648  break;
1649  }
1650  case 2:
1651  {
1652  DAS.Paramini.CoolPw = (int) (strtod(ev->text, &ev->text ) * 10);
1653  if (DAS.Paramini.CoolPw < 0 || DAS.Paramini.CoolPw > 1000)
1654  {
1655  ev->focus_leave = False;
1656  }
1657  break;
1658  }
1659 
1660  case 3:
1661  {
1662  DAS.Paramini.TPelt = strtod( ev->text, &ev->text );
1663  if (DAS.Paramini.TPelt < 0 || DAS.Paramini.TPelt > 30)
1664  {
1665  ev->focus_leave = False;
1666  }
1667  break;
1668  }
1669  case 2000:
1670  {
1671  OMUTHR.PCPower = (int) (strtod(ev->text, &ev->text ) * 10);
1672  if (OMUTHR.PCPower < 0 || OMUTHR.PCPower > 1000)
1673  {
1674  ev->focus_leave = False;
1675  }
1676  break;
1677  }
1678 
1679  case 4:
1680  {
1681 
1682  DAS.Paramini.ccdXoff = (int) strtol( ev->text, &ev->text, 10 );
1683  if (DAS.Paramini.ccdXoff < 0 || DAS.Paramini.ccdXoff > DC_CCD.dx)
1684  {
1685  ev->focus_leave = False;
1686  }
1687  break;
1688  }
1689  case 5:
1690  {
1691  DAS.Paramini.ccdWx = (int) strtol( ev->text, &ev->text, 10 );
1692  if (DAS.Paramini.ccdWx < 0 || DAS.Paramini.ccdWx > DC_CCD.dx)
1693  {
1694  ev->focus_leave = False;
1695  }
1696  break;
1697  }
1698  case 6:
1699  {
1700 
1701  DAS.Paramini.ccdYoff = (int) strtol( ev->text, &ev->text, 10 );
1702  if (DAS.Paramini.ccdYoff < 0 || DAS.Paramini.ccdYoff > DC_CCD.dy)
1703  {
1704  ev->focus_leave = False;
1705  }
1706  break;
1707  }
1708  case 7:
1709  {
1710  DAS.Paramini.ccdWy = (int) strtol( ev->text, &ev->text, 10 );
1711  if (DAS.Paramini.ccdWy < 0 || DAS.Paramini.ccdWy > DC_CCD.dy)
1712  {
1713  ev->focus_leave = False;
1714  }
1715  break;
1716  }
1717 
1718  case 8:
1719  {
1720  DAS.Paramini.VBin = (int) strtol( ev->text, &ev->text, 10 );
1721 // x = DAS.Paramini.ccdWy - DAS.Paramini.ccdYoff;
1722 // y = DAS.Paramini.VBin;
1723 // div_result = div( x, y );
1724 // if (div_result.rem)
1725 // ev->focus_leave = False;
1726  break;
1727  }
1728 // SM1
1729 /* case 9:
1730  {
1731  DAS.StepM.cop[0] = (int) strtol( ev->text, &ev->text, 10 );
1732  if (DAS.StepM.cop[0] < 0 || DAS.StepM.cop[0] > 100)
1733  {
1734  ev->focus_leave = False;
1735  }
1736  break;
1737  }
1738  case 10:
1739  {
1740  DAS.StepM.step[0] = (int) strtol( ev->text, &ev->text, 10 );
1741  if (DAS.StepM.step[0] < 0 || DAS.StepM.step[0] > 13)
1742  {
1743  ev->focus_leave = False;
1744  }
1745  break;
1746  }
1747  case 11:
1748  {
1749  DAS.StepM.slope[0] = (int) strtol( ev->text, &ev->text, 10 );
1750  if (DAS.StepM.slope[0] < 0 || DAS.StepM.slope[0] > 255)
1751  {
1752  ev->focus_leave = False;
1753  }
1754  break;
1755  }
1756  case 12:
1757  {
1758  DAS.StepM.speed[0] = (int) strtol( ev->text, &ev->text, 10 );
1759  if (DAS.StepM.speed[0] < 1 || DAS.StepM.speed[0] > 50000)
1760  {
1761  ev->focus_leave = False;
1762  }
1763  break;
1764  }
1765 // SM2
1766  case 13:
1767  {
1768  DAS.StepM.cop[1] = (int) strtol( ev->text, &ev->text, 10 );
1769  if (DAS.StepM.cop[1] < 0 || DAS.StepM.cop[1] > 100)
1770  {
1771  ev->focus_leave = False;
1772  }
1773  break;
1774  }
1775  case 14:
1776  {
1777  DAS.StepM.step[1] = (int) strtol( ev->text, &ev->text, 10 );
1778  if (DAS.StepM.step[1] < 0 || DAS.StepM.step[1] > 13)
1779  {
1780  ev->focus_leave = False;
1781  }
1782  break;
1783  }
1784  case 15:
1785  {
1786  DAS.StepM.slope[1] = (int) strtol( ev->text, &ev->text, 10 );
1787  if (DAS.StepM.slope[1] < 0 || DAS.StepM.slope[1] > 255)
1788  {
1789  ev->focus_leave = False;
1790  }
1791  break;
1792  }
1793  case 16:
1794  {
1795  DAS.StepM.speed[1] = (int) strtol( ev->text, &ev->text, 10 );
1796  if (DAS.StepM.speed[1] < 1 || DAS.StepM.speed[1] > 50000)
1797  {
1798  ev->focus_leave = False;
1799  }
1800  break;
1801  }
1802 // SM3
1803  case 17:
1804  {
1805  DAS.StepM.cop[2] = (int) strtol( ev->text, &ev->text, 10 );
1806  if (DAS.StepM.cop[2] < 0 || DAS.StepM.cop[2] > 100)
1807  {
1808  ev->focus_leave = False;
1809  }
1810  break;
1811  }
1812  case 18:
1813  {
1814  DAS.StepM.step[2] = (int) strtol( ev->text, &ev->text, 10 );
1815  if (DAS.StepM.step[2] < 0 || DAS.StepM.step[2] > 13)
1816  {
1817  ev->focus_leave = False;
1818  }
1819  break;
1820  }
1821  case 19:
1822  {
1823  DAS.StepM.slope[2] = (int) strtol( ev->text, &ev->text, 10 );
1824  if (DAS.StepM.slope[2] < 0 || DAS.StepM.slope[2] > 255)
1825  {
1826  ev->focus_leave = False;
1827  }
1828  break;
1829  }
1830  case 20:
1831  {
1832  DAS.StepM.speed[2] = (int) strtol( ev->text, &ev->text, 10 );
1833  if (DAS.StepM.speed[2] < 1 || DAS.StepM.speed[2] > 50000)
1834  {
1835  ev->focus_leave = False;
1836  }
1837  break;
1838  }
1839 
1840 
1841  case 111:
1842  {
1843 
1844  break;
1845  }
1846 */
1847  case 123:
1848  {
1849  DAS.Paramini.maxtexp = strtod( ev->text, &ev->text );
1850  if (DAS.Paramini.maxtexp < 0 || DAS.Paramini.maxtexp > 1000)
1851  {
1852  ev->focus_leave = False;
1853  }
1854  break;
1855  }
1856 
1857  case 600:
1858  {
1859  DAS.DOption.maxlvlar = strtol( ev->text, &ev->text, 10 );
1860  if(DAS.DOption.maxlvlar < 5000 || DAS.DOption.maxlvlar > 63000)
1861  {
1862  ev->focus_leave = False;
1863  MMessageDialog("DAS information", "Value Outside Limits" , "OK", NULL);
1864 
1865  }
1866  break;
1867  }
1868 
1869 
1870  }
1871 
1872 
1873 
1874 }
1875 
1876 
1877 void ActEditCB(MOBJECT edit, char *text, void *ed)
1878 {
1879 
1880  int c = (int) ed;
1881 
1882  switch (c)
1883  {
1884 
1885  case 1:
1886  {
1887  DAS.Paramini.ITemp = strtod( text, &text );
1888  break;
1889  }
1890  case 2:
1891  {
1892  DAS.Paramini.CoolPw = (int) (strtod( text, &text ) * 10);
1893  break;
1894  }
1895  case 3:
1896  {
1897  DAS.Paramini.TPelt = strtod( text, &text );
1898  break;
1899  }
1900  case 2000:
1901  {
1902  OMUTHR.PCPower = (int) (strtod( text, &text ) * 10);
1903  break;
1904  }
1905 
1906  case 4:
1907  {
1908  DAS.Paramini.ccdXoff = (int) strtol( text, &text, 10 );
1909  break;
1910  }
1911  case 5:
1912  {
1913  DAS.Paramini.ccdWx = (int) strtol( text, &text, 10 );
1914  break;
1915  }
1916  case 6:
1917  {
1918  DAS.Paramini.ccdYoff = (int) strtol( text, &text, 10 );
1919  break;
1920  }
1921  case 7:
1922  {
1923  DAS.Paramini.ccdWy = (int) strtol( text, &text, 10 );
1924  break;
1925  }
1926  case 8:
1927  {
1928  DAS.Paramini.VBin = (int) strtol( text, &text, 10 );
1929  break;
1930  }
1931 /*
1932  case 9:
1933  {
1934 
1935  DAS.StepM.cop[0] = (int) strtol( text, &text, 10 );
1936  break;
1937  }
1938  case 10:
1939  {
1940  DAS.StepM.step[0] = (int) strtol( text, &text, 10 );
1941  break;
1942  }
1943  case 11:
1944  {
1945  DAS.StepM.slope[0] = (int) strtol( text, &text, 10 );
1946  break;
1947  }
1948  case 12:
1949  {
1950  DAS.StepM.speed[0] = (int) strtol( text, &text, 10 );
1951  break;
1952  }
1953 
1954  case 13:
1955  {
1956  DAS.StepM.cop[1] = (int) strtol( text, &text, 10 );
1957  break;
1958  }
1959  case 14:
1960  {
1961  DAS.StepM.step[1] = (int) strtol( text, &text, 10 );
1962  break;
1963  }
1964  case 15:
1965  {
1966  DAS.StepM.slope[1] = (int) strtol( text, &text, 10 );
1967  break;
1968  }
1969  case 16:
1970  {
1971  DAS.StepM.speed[1] = (int) strtol( text, &text, 10 );
1972  break;
1973  }
1974 
1975  case 17:
1976  {
1977  DAS.StepM.cop[2] = (int) strtol( text, &text, 10 );
1978  break;
1979  }
1980  case 18:
1981  {
1982  DAS.StepM.step[2] = (int) strtol( text, &text, 10 );
1983  break;
1984  }
1985  case 19:
1986  {
1987  DAS.StepM.slope[2] = (int) strtol( text, &text, 10 );
1988  break;
1989  }
1990  case 20:
1991  {
1992  DAS.StepM.speed[2] = (int) strtol( text, &text, 10 );
1993  break;
1994  }
1995 */
1996  case 111:
1997  {
1998  if(DAS.DOption.avgmode)
1999  {
2000  TOTTEXP = (int) strtol( text, &text, 10 );
2001  }
2002  else
2003  N_AVG = (int) strtol( text, &text, 10 );
2004  break;
2005  }
2006  case 120:
2007  {
2008  SZAMax = (int) strtol( text, &text, 10 );
2009  break;
2010  }
2011  case 130:
2012  {
2013  DAS.DOption.hlinebefore = (int) strtol( text, &text, 10 );
2014  break;
2015  }
2016  case 135:
2017  {
2018  DAS.DOption.hlineafter = (int) strtol( text, &text, 10 );
2019  break;
2020  }
2021 
2022  case 140:
2023  {
2024  LevelDefPix = (int) strtol( text, &text, 10 );
2025  break;
2026  }
2027  case 150:
2028  {
2029  DOAS.FFTFilter = (int) strtol( text, &text, 10 );
2031  break;
2032  }
2033  case 151:
2034  {
2035  DOAS.FFTFilter = (int) strtol( text, &text, 10 );
2036  break;
2037  }
2038 
2039  case 200:
2040  {
2041  sprintf(DFTP.ftpserver, "%s", text);
2042  break;
2043  }
2044  case 210:
2045  {
2046  sprintf(DFTP.ftpuser, "%s", text);
2047  break;
2048  }
2049  case 220:
2050  {
2051  sprintf(DFTP.ftppwd, "%s", text);
2052  break;
2053  }
2054 
2055 // for DEVICES OFFSETS
2056  case 300:
2057  {
2058  DAS.Paramini.Offset[0] = (int) strtol( text, &text, 10 );
2059  break;
2060  }
2061  case 301:
2062  {
2063  DAS.Paramini.Offset[1] = (int) strtol( text, &text, 10 );
2064  break;
2065  }
2066  case 302:
2067  {
2068  DAS.Paramini.Offset[2] = (int) strtol( text, &text, 10 );
2069  break;
2070  }
2071  case 303:
2072  {
2073  DAS.Paramini.Offset[3] = (int) strtol( text, &text, 10 );
2074  break;
2075  }
2076  case 304:
2077  {
2078  DAS.Paramini.Offset[4] = (int) strtol( text, &text, 10 );
2079  break;
2080  }
2081  case 123:
2082  {
2083  DAS.Paramini.maxtexp = strtod( text, &text);
2084  break;
2085  }
2086  /********************************************************/
2087  //PID Parameters
2088  case 500: //kp
2089  {
2090  OMUTHR.PID_kp = (float)strtod( text, &text);
2091  }
2092  case 501: //ki
2093  {
2094  OMUTHR.PID_ki = (float)strtod( text, &text);
2095  }
2096  case 502: //kd
2097  {
2098  OMUTHR.PID_kd = (float)strtod( text, &text);
2099  }
2100 
2101  /********************************************************/
2102  case 600: //Autoranging max level
2103  {
2104  DAS.DOption.maxlvlar = strtol( text, &text, 10);
2105  }
2106 
2107 
2108 
2109 
2110  }
2111 
2112 }
2113 
2114 
2115 
2116 void ApplyImgCB(MOBJECT shell, void *od, void *ad)
2117 {
2118 
2119 // int er;
2120  char buf[64];
2121 
2122  IDX = DC_CCD.dx;
2123  IDY = DC_CCD.dy/DAS.Paramini.VBin ;
2124 
2125  //sprintf(buf, "Marconi %s %d x %d Image",DC_CCD.name, IDX, IDY);
2126  sprintf(buf, "Marconi %d %d x %d Image",DC_CCD.kind , IDX, IDY);
2127  Server = DI_OpenImage((unsigned short)IDX, (unsigned short)IDY, (unsigned short)DAS.DOption.imgtype, 1, buf);
2128  DI_RunHisto();
2129 
2130  if(Server)
2131  {
2132  DIL.Img.Mat[Server - 1].attrib = 0;
2133  DI_CloseImage(Server - 1);
2134  }
2135 
2136  if(Server == 0)
2137  {
2138  DIL.Img.Mat[Server + 1].attrib = 0;
2139  DI_CloseImage(Server + 1);
2140  }
2141 
2142 
2143  /*
2144  er = DI_OpenImage(IDX, IDY, DAS.DOption.flgimgtype, 1, "NONAME");
2145  if(DAS.DOption.flgimgtype)
2146  er= DI_CloseImage(0);
2147  if(!DAS.DOption.flgimgtype)
2148  er= DI_CloseImage(1);
2149 */
2150 
2151 }
2152 
2153 void CloseConfigCB(MOBJECT shell, void *od, void *ad)
2154 {
2155 
2156  MOBJECT c;
2157  int i;
2158 
2159  DPWD.ROwnPwdOk = 1;
2160  DPWD.OwnPwdOk = 1;
2161 
2162 
2163  c = (MOBJECT) ad;
2164  if(FLAG.ADTempTest == 1)
2165  {
2166 
2167  MObjectSetText(ADTESTER.ADpb, "Start");
2168  FLAG.ADTempTest = 0;
2170  for (i=0; i<16; i++)
2171  MObjectSetText(ADTESTER.lblADvalue[i], "0.0");
2172 
2173 
2174 
2175  }
2176 
2177 
2178  MShellUnrealize(c);
2179  MShellDestroy(c);
2180 }
2181 
2182 void ConfigCB(MOBJECT p, void *od, void *ad)
2183 {
2184  MDCreateDASConfig();
2185 }
2186 /*****************************************/
2187 /* Modules for Stepper motors parameters*/
2188 /*++++++++++++
2189 int perc2int() --> translate the percent power in AMS digit unit
2190 ++++++++++++++*/
2191 int perc2int(int mod, char *string)
2192 {
2193  int c;
2194 
2195  c = (int) (atof(string) * 76.0 / 100.0);
2196  return c;
2197 }
2198 
2199 /*++++++++++++
2200 double int2perc() --> translate the AMS digit unit in percent power
2201 ++++++++++++++*/
2202 double int2perc(int mod, int k)
2203 {
2204  double c;
2205 
2206  c = (1.0 - (76.0 - (double) k ) / 76.0) * 100.0;
2207  return c;
2208 }
2209 
2210 /*++++++++++++
2211 int int2hertz() --> translate the AMS digit unit in hertz speed
2212 ++++++++++++++*/
2213 double int2hertz(int mod, int k)
2214 {
2215  double c;
2216 
2217  c = (125 * ((double) k + 1.0)) / 1000 ;
2218 
2219  return c;
2220 }
2221 
2222 
2223 /*++++++++++++
2224 int hertz2int() --> translate the hertz speed in AMS digit unit
2225 ++++++++++++++*/
2226 int hertz2int(int mod, char *string)
2227 {
2228  int c;
2229 
2230  c = (int) (((atof(string)*1000) - 125.0) / 125.0) ;
2231 
2232  return c;
2233 }
2234 
2235 //char lfraz[6];
2236 void listval2fraz(int mod, int val)
2237 {
2238 
2239 
2240  int c = (int) val;
2241 
2242  switch (c)
2243  {
2244  case 0:
2245  {
2246  sprintf(lfraz, " 1/2");
2247  break;
2248  }
2249  case 1:
2250  {
2251  sprintf(lfraz, " 1/4");
2252 
2253  break;
2254  }
2255  case 2:
2256  {
2257  sprintf(lfraz, " 1/5");
2258 
2259  break;
2260  }
2261  case 3:
2262  {
2263  sprintf(lfraz, " 1/8");
2264 
2265  break;
2266  }
2267  case 4:
2268  {
2269  sprintf(lfraz, " 1/10");
2270 
2271  break;
2272  }
2273  case 5:
2274  {
2275  sprintf(lfraz, " 1/16");
2276 
2277  break;
2278  }
2279  case 6:
2280  {
2281  sprintf(lfraz, " 1/25");
2282 
2283  break;
2284  }
2285  case 7:
2286  {
2287  sprintf(lfraz, " 1/32");
2288 
2289  break;
2290  }
2291  case 8:
2292  {
2293  sprintf(lfraz, " 1/50");
2294 
2295  break;
2296  }
2297  case 9:
2298  {
2299 
2300  sprintf(lfraz, " 1/64");
2301  break;
2302  }
2303  case 10:
2304  {
2305  sprintf(lfraz, "1/125");
2306 
2307  break;
2308  }
2309  case 11:
2310  {
2311  sprintf(lfraz, "1/128");
2312  ;
2313  break;
2314  }
2315  case 12:
2316  {
2317  sprintf(lfraz, "1/250");
2318 
2319  break;
2320  }
2321  case 13:
2322  {
2323  sprintf(lfraz, "1/256");
2324 
2325  break;
2326  }
2327 
2328  }
2329 
2330 }
2331 
2332 
2333 void val2fraz(int id, int sn, int val)
2334 {
2335 
2336  char xx[10];
2337  int c = (int) val;
2338 
2339  switch (c)
2340  {
2341  case 0:
2342  {
2343  sprintf(xx, " 1/2");
2344  break;
2345  }
2346  case 1:
2347  {
2348  sprintf(xx, " 1/4");
2349 
2350  break;
2351  }
2352  case 2:
2353  {
2354  sprintf(xx, " 1/5");
2355 
2356  break;
2357  }
2358  case 3:
2359  {
2360  sprintf(xx, " 1/8");
2361 
2362  break;
2363  }
2364  case 4:
2365  {
2366  sprintf(xx, " 1/10");
2367 
2368  break;
2369  }
2370  case 5:
2371  {
2372  sprintf(xx, " 1/16");
2373 
2374  break;
2375  }
2376  case 6:
2377  {
2378  sprintf(xx, " 1/25");
2379 
2380  break;
2381  }
2382  case 7:
2383  {
2384  sprintf(xx, " 1/32");
2385 
2386  break;
2387  }
2388  case 8:
2389  {
2390  sprintf(xx, " 1/50");
2391 
2392  break;
2393  }
2394  case 9:
2395  {
2396 
2397  sprintf(xx, " 1/64");
2398  break;
2399  }
2400  case 10:
2401  {
2402  sprintf(xx, "1/125");
2403 
2404  break;
2405  }
2406  case 11:
2407  {
2408  sprintf(xx, "1/128");
2409  ;
2410  break;
2411  }
2412  case 12:
2413  {
2414  sprintf(xx, "1/250");
2415 
2416  break;
2417  }
2418  case 13:
2419  {
2420  sprintf(xx, "1/256");
2421 
2422  break;
2423  }
2424 
2425  }
2426 
2427 
2428  for(c = 0; c < (int) strlen(xx); c++)
2429  DAS.StepM.step_fraz[id][sn][c] = xx[c];
2430 
2431 
2432 
2433 }
2434 
2435 int fraz2val(int mod, char *val)
2436 {
2437 
2438  int b = 0;
2439 
2440  if(strcmp( val, " 1/2") == 0)
2441  b = 0;
2442  if(strcmp( val, " 1/4") == 0)
2443  b = 1;
2444  if(strcmp( val, " 1/5") == 0)
2445  b = 2;
2446  if(strcmp( val, " 1/8") == 0)
2447  b = 3;
2448  if(strcmp( val, " 1/10") == 0)
2449  b = 4;
2450  if(strcmp( val, " 1/16") == 0)
2451  b = 5;
2452  if(strcmp( val, " 1/25") == 0)
2453  b = 6;
2454  if(strcmp( val, " 1/32") == 0)
2455  b = 7;
2456  if(strcmp( val, " 1/50") == 0)
2457  b = 8;
2458  if(strcmp( val, " 1/64") == 0)
2459  b = 9;
2460  if(strcmp( val, "1/125") == 0)
2461  b = 10;
2462  if(strcmp( val, "1/128") == 0)
2463  b = 11;
2464  if(strcmp( val, "1/250") == 0)
2465  b = 12;
2466  if(strcmp( val, "1/256") == 0)
2467  b = 13;
2468 
2469  return b;
2470 
2471 
2472 
2473 }
2474 
2475 
2476 int WritewlstepiniCB(MOBJECT shell, void *od, void *ad)
2477 {
2478 
2479 
2480 
2481  FILE *fc;
2482  char str[160];
2483  struct time adesso;
2484  struct date oggi;
2485  char buff[_MAX_PATH];
2486  int i, nitem = 18;
2487  struct tm today;
2488 
2489  GetDateTime(&oggi, &adesso, &today);
2490  //gettime(&adesso);
2491  //getdate(&oggi);
2492 
2493 
2494  sprintf(buff,"%s\\WlStep.ini", BIL.DFILEM.CONFIGDIREQUIPMENT);
2495  fc = fopen(buff, "w");
2496 
2497 
2498  if(fc == NULL)
2499  {
2500  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
2501  return 1;
2502  }
2503 
2504 
2505 
2506 
2507  sprintf(str, "####################################################\n");
2508  fprintf(fc,str);
2509  sprintf(str, "# WLSTEP.INI #\n");
2510  fprintf(fc,str);
2511  sprintf(str, "# Wavelengths <--> Steps #\n");
2512  fprintf(fc,str);
2513  sprintf(str, "####################################################\n");
2514  fprintf(fc,str);
2515  sprintf(str, "# ------------------------------------------------ #\n");
2516  fprintf(fc,str);
2517  sprintf(str, "# by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
2518  fprintf(fc,str);
2519  sprintf(str, "# ------------------------------------------------ #\n");
2520  fprintf(fc,str);
2521  sprintf(str, "%d\n", nitem);
2522  fprintf(fc,str);
2523  for (i=0;i<nitem;i++)
2524  {
2525  sprintf(str, "%d %d\n", wl[i], wav[i]);
2526  fprintf(fc,str);
2527  }
2528 
2529 
2530  fclose(fc);
2531 
2532  sprintf(str,"The current setting for Wavelength and stepper steps \n has been saved in '%s' file", buff);
2533  MMessageDialog("DAS information", str, " Ok ", NULL);
2534 
2535  return 0;
2536 
2537 
2538 
2539 }
2540 
2541 int WriteOptioniniCB(MOBJECT shell, void *od, void *ad)
2542 {
2543 
2544 
2545 
2546  FILE *fs;
2547  char str[_MAX_PATH];
2548  struct time adesso;
2549  struct date oggi;
2550  char buff[_MAX_PATH];
2551  struct tm today;
2552  sprintf(buff,"%s\\OPTIONS.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
2553  fs = fopen(buff, "w");
2554 
2555  GetDateTime(&oggi, &adesso, &today);
2556  //gettime(&adesso);
2557  //getdate(&oggi);
2558 
2559 /*********************************/
2560 
2561 
2562  if(fs == NULL)
2563  {
2564  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
2565  return 1;
2566  }
2567 
2568  sprintf(str, "####################################################\n");
2569  fprintf(fs,str);
2570  sprintf(str, "# Configuration file for OPTIONS Setting. #\n");
2571  fprintf(fs,str);
2572  sprintf(str, "# by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
2573  fprintf(fs,str);
2574  sprintf(str, "####################################################\n");
2575  fprintf(fs,str);
2576  sprintf(str, "# All these flags can be modified on line #\n");
2577  fprintf(fs,str);
2578  sprintf(str, "# in the CONFIG --> OPTION tabs #\n");
2579  fprintf(fs,str);
2580  sprintf(str, "#--------------------------------------------------#\n");
2581  fprintf(fs,str);
2582  sprintf(str, "# Please DO NOT change the order of the parameters #\n");
2583  fprintf(fs,str);
2584  sprintf(str, "#--------------------------------------------------#\n");
2585  fprintf(fs,str);
2586  sprintf(str, "# Saving Mode: 0 = ASCII, 1 = Binary #\n");
2587  fprintf(fs,str);
2588  sprintf(str, "%d\n", DAS.DOption.savingmode);
2589  fprintf(fs,str);
2590  sprintf(str, "# File Names:0 = free, 1 = automatic file names #\n");
2591  fprintf(fs,str);
2592  sprintf(str, "%d\n", DAS.DOption.filename);
2593  fprintf(fs,str);
2594  sprintf(str, "# Image Type:0=Mono, 1 = RGB #\n");
2595  fprintf(fs,str);
2596  sprintf(str, "%d\n", DAS.DOption.imgtype);
2597  fprintf(fs,str);
2598 
2599  sprintf(str, "# CCD Pix Correction: 0=NOT Corrected, 1=Corrected #\n");
2600  fprintf(fs,str);
2601  sprintf(str, "%d\n", DAS.DOption.pixcorr);
2602  fprintf(fs,str);
2603 
2604  sprintf(str, "# File Name for CCD Pix Correction #\n");
2605  fprintf(fs,str);
2606  sprintf(str, "%s\n", DAS.DOption.DEFPIXFILENAME);
2607  fprintf(fs,str);
2608 
2609  sprintf(str, "# Measuring Mode:0 = Single, 1 = Averaged #\n");
2610  fprintf(fs,str);
2611  sprintf(str, "%d\n", DAS.DOption.measmode);
2612  fprintf(fs,str);
2613 
2614  sprintf(str, "# Averaging Mode:0 = fixed number, 1 = fixed time #\n");
2615  fprintf(fs,str);
2616  sprintf(str, "%d\n", DAS.DOption.avgmode);
2617  fprintf(fs,str);
2618 
2619  sprintf(str, "# Avg Mode fixed Number of measurements #\n");
2620  fprintf(fs,str);
2621  sprintf(str, "%d\n", N_AVG);
2622  fprintf(fs,str);
2623 
2624  sprintf(str, "# Avg Mode fixed Time Exposure [sec] #\n");
2625  fprintf(fs,str);
2626  sprintf(str, "%d\n", TOTTEXP);
2627  fprintf(fs,str);
2628  sprintf(str, "# Remove Dark?: 0 = No, 1 = Yes #\n");
2629  fprintf(fs,str);
2630  sprintf(str, "%d\n", DAS.DOption.darkremove);
2631  fprintf(fs,str);
2632  sprintf(str, "# Dark source: 0 = Blind Pixels, 1 = Full Frame #\n");
2633  fprintf(fs,str);
2634  sprintf(str, "%d\n", DAS.DOption.darksource);
2635  fprintf(fs,str);
2636  sprintf(str, "# CCD Temp: 0 = Fixed, 1 = variation vs SZA #\n");
2637  fprintf(fs,str);
2638  sprintf(str, "%d\n", FLAG.settempvar);
2639  fprintf(fs,str);
2640 
2641 
2642  sprintf(str, "# Plot X Scale: 0 = Pixel #, 1 = Wl[A], 2 = wl[nm] #\n");
2643  fprintf(fs,str);
2644  sprintf(str, "%d\n", FLAG.Wl);
2645  fprintf(fs,str);
2646  sprintf(str, "# Plot display: 0 = NO, 1 = Yes #\n");
2647  fprintf(fs,str);
2648  sprintf(str, "%d\n", DAS.Flag.plotW);
2649  fprintf(fs,str);
2650  sprintf(str, "# Plot Y Scale: 0 = FullRange(0-65535), 1 = min/max#\n");
2651  fprintf(fs,str);
2652  sprintf(str, "%d\n", FLAG.plotYRange);
2653  fprintf(fs,str);
2654  sprintf(str, "# Measurements performed for SZA <= SZAMax #\n");
2655  fprintf(fs,str);
2656  sprintf(str, "%d\n", SZAMax);
2657  fprintf(fs,str);
2658 
2659 
2660  sprintf(str, "# Hidden Lines in Plot-Before and after Cent. line #\n");
2661  fprintf(fs,str);
2662  sprintf(str, "%d\n", DAS.DOption.hlinebefore);
2663  fprintf(fs,str);
2664  sprintf(str, "%d\n", DAS.DOption.hlineafter);
2665  fprintf(fs,str);
2666 
2667  sprintf(str, "# Display Blind Pixel: 0 = NO, 1 = Yes #\n");
2668  fprintf(fs,str);
2669 
2670  sprintf(str, "%d\n", FLAG.DispBlindPix);
2671  fprintf(fs,str);
2672 
2673  sprintf(str, "# Perform FTP Back-UP: 0 = NO, 1 = Yes #\n");
2674  fprintf(fs,str);
2675 
2676  sprintf(str, "%d\n", DAS.DOption.ftpbackup);
2677  fprintf(fs,str);
2678 
2679  sprintf(str, "# Reference temperature for OMU Thermo-Regulation: #\n");
2680  fprintf(fs,str);
2681  sprintf(str, "# 0 = AVG Internal Peltier; 1 = Optic; 2 = Grating #\n");
2682  fprintf(fs,str);
2683 
2684  sprintf(str, "%d\n", DAS.DOption.refertemp);
2685  fprintf(fs,str);
2686 
2687  sprintf(str, "# OMU Thermo-Regulation mode: #\n");
2688  fprintf(fs,str);
2689  sprintf(str, "# 0 = Cold Only; 1 = Heat only; 2 = Cold/Heat #\n");
2690  fprintf(fs,str);
2691  sprintf(str, "%d\n", OMUTHR.TRType);
2692  fprintf(fs,str);
2693 
2694  sprintf(str, "# Mirroring CCD Image along X #\n");
2695  fprintf(fs,str);
2696  sprintf(str, "# 0 = NO Mirroring; 1 = Mirror image #\n");
2697  fprintf(fs,str);
2698  sprintf(str, "%d\n", DAS.DOption.mirrorimg[XAX]);
2699  fprintf(fs,str);
2700 
2701  sprintf(str, "# Mirroring CCD Image along Y #\n");
2702  fprintf(fs,str);
2703  sprintf(str, "# 0 = NO Mirroring; 1 = Mirror image #\n");
2704  fprintf(fs,str);
2705  sprintf(str, "%d\n", DAS.DOption.mirrorimg[YAX]);
2706  fprintf(fs,str);
2707 
2708  sprintf(str, "# AMS Option - Stepper motor Positioning mode #\n");
2709  fprintf(fs,str);
2710  sprintf(str, "# 0 = Sequential; 1 = Simultaneous #\n");
2711  fprintf(fs,str);
2712  sprintf(str, "%d\n", DAS.DOption.smposmode);
2713  fprintf(fs,str);
2714 
2715  sprintf(str, "# AMS Option - Progressive bar #\n");
2716  fprintf(fs,str);
2717  sprintf(str, "# 0 = DO NOT show ; 1 = Show #\n");
2718  fprintf(fs,str);
2719  sprintf(str, "%d\n", DAS.DOption.amsprogbar);
2720  fprintf(fs,str);
2721 
2722 
2723  sprintf(str,"# Autorange before Average #\n");
2724  fprintf(fs,str);
2725  sprintf(str,"# 0 = NO Autoranging, 1 = Autoranging #\n");
2726  fprintf(fs,str);
2727  sprintf(str, "%d\n", DAS.DOption.avgautor);
2728  fprintf(fs,str);
2729 
2730  sprintf(str,"# MIGE Platform connection #\n");
2731  fprintf(fs,str);
2732  sprintf(str,"# 0 = NOT Connected, 1 = Connected #\n");
2733  fprintf(fs,str);
2734  sprintf(str, "%d\n", DAS.MIGE.linked);
2735  fprintf(fs,str);
2736 
2737  sprintf(str,"# MIGE Platform Type #\n");
2738  fprintf(fs,str);
2739  sprintf(str,"# 0 = AltAz V 0.5, 1 = MIGE V. 3 #\n");
2740  fprintf(fs,str);
2741  sprintf(str, "%d\n", DAS.MIGE.type);
2742  fprintf(fs,str);
2743 
2744 
2745  sprintf(str,"# MIGE Platform operating mode #\n");
2746  fprintf(fs,str);
2747  sprintf(str,"# 0 = Sun Track, 1 = AntiSunTrack, 2 = FreePos #\n");
2748  fprintf(fs,str);
2749  sprintf(str, "%d\n", DAS.DOption.aaopmode);
2750  fprintf(fs,str);
2751 
2752  sprintf(str,"# EMShutter #\n");
2753  fprintf(fs,str);
2754  sprintf(str,"# 0 = NOT installed, 1 = Installed #\n");
2755  fprintf(fs,str);
2756  sprintf(str, "%d\n", DAS.DOption.emshutter);
2757  fprintf(fs,str);
2758 
2759  sprintf(str,"# Shutter Type #\n");
2760  fprintf(fs,str);
2761  sprintf(str,"# 0 = VS25, 1 = ROTSHUT, 2 = TORQUEM #\n");
2762  fprintf(fs,str);
2763  sprintf(str, "%d\n", DAS.DOption.shuttertype);
2764  fprintf(fs,str);
2765 
2766 
2767 
2768  sprintf(str,"# Measurements driven by SZA #\n");
2769  fprintf(fs,str);
2770  sprintf(str,"# Format: a, b, c, d where: #\n");
2771  fprintf(fs,str);
2772  sprintf(str,"# a = Flag; 0 = NOT Active, 1 = Active #\n");
2773  fprintf(fs,str);
2774  sprintf(str,"# b = DeltaSZA, value of Delta SZA (x.x deg) #\n");
2775  fprintf(fs,str);
2776  sprintf(str,"# c = MinSZA, value of Min SZA (xx deg) #\n");
2777  fprintf(fs,str);
2778  sprintf(str,"# d = MaxSZA, value of Max SZA (xx deg) #\n");
2779  fprintf(fs,str);
2780  sprintf(str, "%d %.2lf %.2lf %.2lf\n", DAS.Flag.DeltaSZA, SZADelta.DeltaSZA, SZADelta.MinSZA, SZADelta.MaxSZA);
2781  fprintf(fs,str);
2782 
2783 
2784  sprintf(str,"# Filter Wheel type #\n");
2785  fprintf(fs,str);
2786  sprintf(str,"# 0=simple, 1= double, 2= simple +TorqueM #\n");
2787  fprintf(fs,str);
2788  sprintf(str, "%d\n", DAS.DOption.filtertype);
2789  fprintf(fs,str);
2790 
2791  sprintf(str,"#PID Parameters #\n");
2792  fprintf(fs,str);
2793  sprintf(str,"#PID_kp PID_ki PID_kd #\n");
2794  fprintf(fs,str);
2795  sprintf(str, "%.3f %.3f %.3f\n", OMUTHR.PID_kp, OMUTHR.PID_ki, OMUTHR.PID_kd);
2796  fprintf(fs,str);
2797 
2798  //RESET PARAMETERS
2799  sprintf(str,"#DAS/Windows Reset: Enabled = 1, Disabled = 0 #\n");
2800  fprintf(fs,str);
2801  sprintf(str, "%d\n", DAS.DOption.resetEnabled);
2802  fprintf(fs,str);
2803  //RESET Type
2804  sprintf(str,"#Reset Type: Hourly = 0, Daily= 1 #\n");
2805  fprintf(fs,str);
2806  sprintf(str, "%d\n", DAS.DOption.resetType);
2807  fprintf(fs,str);
2808  //RESET Frequency
2809  sprintf(str,"#Reset frequency: Hourly=1 to 23, Daily=1 to 365 #\n");
2810  fprintf(fs,str);
2811  sprintf(str, "%d\n", DAS.DOption.resetFreq);
2812  fprintf(fs,str);
2813 
2814  //AUTORANGING MAX VALUE
2815  sprintf(str,"#AUTORANGING MAX VALUE ( < 63000 #\n");
2816  fprintf(fs,str);
2817  sprintf(str, "%d\n", DAS.DOption.maxlvlar);
2818  fprintf(fs,str);
2819 
2820 
2821  sprintf(str, "####################################################\n");
2822  fprintf(fs,str);
2823 
2824  fclose(fs);
2825 
2826  sprintf(str,"The current options has been saved in '%s\\OPTIONS.INI' file", BIL.DFILEM.CONFIGDIREQUIPMENT);
2827  MMessageDialog("DAS information", str, " Ok ", NULL);
2828 
2829  return 0;
2830 
2831 
2832 }
2833 
2834 int WriteAMSCB(MOBJECT shell, void *od, void *ad)
2835 {
2836  FILE *fs;
2837  char str[80];
2838  char buf[16];
2839  struct time adesso;
2840  struct date oggi;
2841  struct tm today;
2842  int c,i, k, t;
2843  char buff[_MAX_PATH];
2844 
2845 
2846  sprintf(buff,"%s\\AMS.INI", BIL.DFILEM.CONFIGDIREQUIPMENT);
2847  fs = fopen(buff, "w");
2848 
2849  GetDateTime(&oggi, &adesso, &today);
2850  //gettime(&adesso);
2851  //getdate(&oggi);
2852 
2853 
2854  if(fs == NULL)
2855  {
2856  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
2857  return 1;
2858  }
2859 
2860 
2861 
2862  sprintf(str, "###############################################\n");
2863  fprintf(fs,str);
2864  sprintf(str, "# AMS.INI #\n");
2865  fprintf(fs,str);
2866  sprintf(str, "# Main configuration file for AMS Devices #\n");
2867  fprintf(fs,str);
2868  sprintf(str, "###############################################\n");
2869  fprintf(fs,str);
2870  sprintf(str, "# ------------------------------------------- #\n");
2871  fprintf(fs,str);
2872  sprintf(str, "# by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
2873  fprintf(fs,str);
2874  sprintf(str, "# ------------------------------------------- #\n");
2875  fprintf(fs,str);
2876 
2877 
2878 
2879  for (i=0;i<DAS.StepM.NAMS;i++)
2880  {
2881  for(k=0;k<2;k++)
2882  {
2883  /*
2884  * Get user preferences from the EDIT Objects for Power SMx
2885  */
2886  //Power
2887  MObjectGetText(DAS.Gui.ConfigPanel.SM_power[i][k], str);
2888  DAS.StepM.cop_perc[i][k] = atof(str);
2889  DAS.StepM.power[i][k] = perc2int(0, str);
2890  MObjectSetText(DAS.Gui.ContrPanel.power[i][k], str);
2891 
2892  /*
2893  * Get user preferences from the EDIT Objects for Step SMx
2894  */
2895  //Step
2896  MObjectGetText(DAS.Gui.ConfigPanel.SM_step[i][k], str);
2897  DAS.StepM.step[i][k] = fraz2val(0, str);
2898  val2fraz(i, k, DAS.StepM.step[i][k]);
2899  sprintf(str, "%s", DAS.StepM.step_fraz[i][k]);
2900  MObjectSetText(DAS.Gui.ContrPanel.step[i][k], str);
2901 
2902  // Slope
2903  MObjectGetText(DAS.Gui.ConfigPanel.SM_slope[i][k], str);
2904  DAS.StepM.slope[i][k] = atoi(str);
2905  sprintf(str, "%d", DAS.StepM.slope[i][k]);
2906  MObjectSetText(DAS.Gui.ContrPanel.slope[i][k], str);
2907 
2908  //speed
2909  MObjectGetText(DAS.Gui.ConfigPanel.SM_speed[i][k], str);
2910  DAS.StepM.speed_Hz[i][k] = atof(str);
2911  DAS.StepM.speed[i][k] = hertz2int(0, str);
2912  MObjectSetText(DAS.Gui.ContrPanel.speed[i][k], str);
2913 
2914  //multiplier
2915  MObjectGetText(DAS.Gui.ConfigPanel.SM_multiplier[i][k], str);
2916  DAS.StepM.multiplier[i][k] = atof(str);
2917 
2918  }
2919  }
2920 
2921 
2922  sprintf(str, "# Number of AMS # \n");
2923  fprintf(fs,str);
2924 
2925  sprintf(str, "%d\n", DAS.StepM.NAMS);
2926  fprintf(fs,str);
2927 
2928 
2929 /*
2930  //SM
2931  for (i=0;i<(DAS.StepM.NAMS*2);i++)
2932  {
2933  sprintf(buf,"SM%d", i+1);
2934 
2935  switch (i)
2936  {
2937  case 0:
2938  sprintf(str, "# Input Mirror Stepper Motor - %s #\n", buf);
2939  break;
2940  case 1:
2941  sprintf(str, "# Grating Stepper Motor - %s #\n", buf);
2942  break;
2943  case 2:
2944  sprintf(str, "# Filter Wheel Stepper Motor - %s #\n", buf);
2945  break;
2946  case 3:
2947  sprintf(str, "# Not Connected Stepper Motor - %s #\n", buf);
2948  break;
2949  case 4:
2950  sprintf(str, "# Zenith Axis Stepper Motor - %s #\n", buf);
2951  break;
2952  case 5:
2953  sprintf(str, "# Azimuth Axis Stepper Motor - %s #\n", buf);
2954  break;
2955 
2956  }
2957 
2958  fprintf(fs,str);
2959  }
2960 */
2961  for (i=0;i<DAS.StepM.NAMS;i++)
2962  {
2963  for (k=0;k<2;k++)
2964  {
2965 
2966  t=2*i+k;
2967  sprintf(buf,"SM%d", t+1);
2968  switch (t)
2969  {
2970  case 0:
2971  sprintf(str, "# Input Mirror Stepper Motor - %s #\n", buf);
2972  fprintf(fs,str);
2973  break;
2974  case 1:
2975  sprintf(str, "# Grating Stepper Motor - %s #\n", buf);
2976  fprintf(fs,str);
2977  break;
2978  case 2:
2979  sprintf(str, "# Filter Wheel Stepper Motor - %s #\n", buf);
2980  fprintf(fs,str);
2981  break;
2982  case 3:
2983  sprintf(str, "# Not Connected Stepper Motor - %s #\n", buf);
2984  fprintf(fs,str);
2985  break;
2986  case 4:
2987  sprintf(str, "# Zenith Axis Stepper Motor - %s #\n", buf);
2988  fprintf(fs,str);
2989  break;
2990  case 5:
2991  sprintf(str, "# Azimuth Axis Stepper Motor - %s #\n", buf);
2992  fprintf(fs,str);
2993  break;
2994  }
2995 
2996  sprintf(str, "# %s Power (0 = 0A - 76 = 1.52A) #\n", buf);
2997  fprintf(fs,str);
2998  sprintf(str,"%d\n", DAS.StepM.power[i][k]);
2999  fprintf(fs,str);
3000  sprintf(str, "# %s Step (0=400s/r, 1=800s/r,2=1000/sr) #\n", buf);
3001  fprintf(fs,str);
3002  sprintf(str,"%d\n", DAS.StepM.step[i][k]);
3003  fprintf(fs,str);
3004  sprintf(str, "# %s Slope (0 - 255) #\n", buf);
3005  fprintf(fs,str);
3006  sprintf(str,"%d\n", DAS.StepM.slope[i][k]);
3007  fprintf(fs,str);
3008  sprintf(str, "# %s Speed Hz (PS = 125*(n+1), n=0,1..255) #\n", buf);
3009  fprintf(fs,str);
3010  sprintf(str,"%d\n", DAS.StepM.speed[i][k]);
3011  fprintf(fs,str);
3012  sprintf(str, "# %s Multiplier #\n", buf);
3013  fprintf(fs,str);
3014  sprintf(str,"%.1f\n", DAS.StepM.multiplier[i][k]);
3015  fprintf(fs,str);
3016 
3017 
3018  }
3019  }
3020 
3021 
3022  sprintf(str, "# OFFSETS #\n");
3023  fprintf(fs,str);
3024  sprintf(str, "# HMir, Mir0, Mir1, Mir2, Mir3, Mir4, Grat, FW#\n");
3025  fprintf(fs,str);
3026  for(c = 0; c < 9; c++)
3027  {
3028  sprintf(str,"%d ", DAS.Paramini.Offset[c]);
3029  fprintf(fs,str);
3030  }
3031 
3032  sprintf(str, "\nHome Type Mode for Steppers #\n");
3033  fprintf(fs,str);
3034 
3035  sprintf(str, "SM1 SM2 SM3 SM4 SM5 SM6 #\n");
3036  fprintf(fs,str);
3037 
3038  for(c = 0; c < DAS.StepM.NAMS; c++)
3039  {
3040  for(k = 0; k < 2; k++)
3041  {
3042  sprintf(str,"%d ", DAS.StepM.hometype[c][k]);
3043  //sprintf(str,"%d ", 2);
3044  fprintf(fs,str);
3045  }
3046 
3047  }
3048 
3049  sprintf(str, "\n###############################################\n");
3050  fprintf(fs,str);
3051 
3052  fclose(fs);
3053 
3054  sprintf(buff,"The current parameters has been saved in '%s\\AMS.INI' file", BIL.DFILEM.CONFIGDIREQUIPMENT);
3055  MMessageDialog("DAS information", buff, " Ok ", NULL);
3056 
3057  return 0;
3058 
3059 
3060 }
3061 
3062 
3063 
3064 int WriteHardwareiniCB(MOBJECT shell, void *od, void *ad)
3065 {
3066 
3067  FILE *fs;
3068  char str[80];
3069 // char buf[16];
3070  char buff[_MAX_PATH];
3071 // int c,i;
3072 
3073  sprintf(buff,"%s\\Hardware.ini", BIL.DFILEM.CONFIGDIREQUIPMENT );
3074  fs = fopen(buff, "w");
3075  if(fs == NULL)
3076  {
3077  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
3078  return 1;
3079  }
3080 
3081 
3082  sprintf(str, "###############################################\n");
3083  fprintf(fs,str);
3084  sprintf(str, "# Hardware .INI #\n");
3085  fprintf(fs,str);
3086  sprintf(str, "###############################################\n");
3087  fprintf(fs,str);
3088  sprintf(str, "# Type of motherboard installed #\n");
3089  fprintf(fs,str);
3090  sprintf(str, "# 0 = NOVA7892; 1 = NOVA6612; 2 = NOVA945GSE #\n");
3091  fprintf(fs,str);
3092  sprintf(str, "###############################################\n");
3093  fprintf(fs,str);
3094 
3095 
3096 
3097  sprintf(str, "%d\n", DAS.Nova.type );
3098  fprintf(fs,str);
3099 
3100  fclose(fs);
3101 
3102  sprintf(buff,"The selected instrument has been saved in '%s\\Hardware.ini' file\n ", BIL.DFILEM.CONFIGDIREQUIPMENT);
3103  MMessageDialog("DAS information", buff, " Ok ", NULL);
3104 
3105 
3106  return 0;
3107 
3108 }
3109 
3110 
3111 int WriteEquipini(void)
3112 {
3113 
3114  FILE *fs;
3115  char str[80];
3116 // char buf[16];
3117  char buff[_MAX_PATH];
3118 // int c,i;
3119 
3120  sprintf(buff,"%s\\Equipment.ini", BIL.DFILEM.CONFIGDIRCOMMON);
3121  fs = fopen(buff, "w");
3122  if(fs == NULL)
3123  {
3124  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
3125  return 1;
3126  }
3127 
3128 
3129  sprintf(str, "###############################################\n");
3130  fprintf(fs,str);
3131  sprintf(str, "# Equipment.INI #\n");
3132  fprintf(fs,str);
3133  sprintf(str, "# Configuration file setting equipment type #\n");
3134  fprintf(fs,str);
3135  sprintf(str, "###############################################\n");
3136  fprintf(fs,str);
3137  sprintf(str, "# 0 = SPATRAM, 1 = TROPOGAS, 2 = LIS #\n");
3138  fprintf(fs,str);
3139  sprintf(str, "# 3 = SPATRAMPLUS, 4 = GASCODNG1, 5=GASCOD/OA #\n");
3140  fprintf(fs,str);
3141  sprintf(str, "# 6 = GASCODNG2, 7 = GASCODNG3, 8 = GASCODNG4 #\n");
3142  fprintf(fs,str);
3143  sprintf(str, "# 9 = SPATRAM2, #\n");
3144  fprintf(fs,str);
3145  sprintf(str, "###############################################\n");
3146  fprintf(fs,str);
3147 
3148 
3149 
3150  sprintf(str, "%d\n", DAS.Paramini.EqType); // Instrument Type(0 = SPATRAM, 1 = TROPOGAS, 2 = LIS, 3 = SPATRAMPLUS, 4 = GASCODNG1)
3151  fprintf(fs,str);
3152 
3153  fclose(fs);
3154 
3155 // sprintf(buff,"The selected instrument has been saved in '%s\\Equipment.ini' file\n ", BIL.DFILEM.CONFIGDIRCOMMON);
3156 // MMessageDialog("DAS information", buff, " Ok ", NULL);
3157 
3158 
3159  return 0;
3160 
3161 }
3162 
3163 char* EquipCode2Name(int eqcode, char *src, char *dest)
3164 {
3165 
3166  char str[32];
3167 
3168  switch (eqcode)
3169  {
3170  case TROPOGAS:
3171  sprintf(str,"TROPOGAS");
3172  break;
3173  case SPATRAM:
3174  sprintf(str,"SPATRAM");
3175  break;
3176  case LIS_:
3177  sprintf(str,"LIS");
3178  break;
3179  case SPATRAMPLUS:
3180  sprintf(str,"SPATRAMPLUS");
3181  break;
3182  case GASCODNG1:
3183  sprintf(str,"GASCODNG1");
3184  break;
3185  case GASCODNG2:
3186  sprintf(str,"GASCODNG2");
3187  break;
3188  case GASCODNG3:
3189  sprintf(str,"GASCODNG3");
3190  break;
3191  case GASCODNG4:
3192  sprintf(str,"GASCODNG4");
3193  break;
3194  case SPATRAM2:
3195  sprintf(str,"SPATRAM2");
3196  break;
3197  case SPATRAM3:
3198  sprintf(str,"SPATRAM3");
3199  break;
3200 
3201  default:
3202  sprintf(str,"UNKNOWN");
3203  break;
3204  }
3205 
3206  strcat(dest,str);
3207  return dest;
3208 
3209  }
3210 
3211 /*****************************************/
3212 int WriteParaminiCB(MOBJECT shell, void *od, void *ad)
3213 {
3214 
3215  //MMessageDialog("DAS information", "The procedure is not yet implemented!!", " Ok ", NULL);
3216 
3217  FILE *fs;
3218  char str[_MAX_PATH];
3219  char buf[_MAX_PATH];
3220  struct time adesso;
3221  struct date oggi;
3222  struct tm today;
3223  int er;
3224  char buff[_MAX_PATH];
3225 
3226 // char streqtype[32]= {'\0'};
3227 
3228  GetDateTime(&oggi, &adesso, &today);
3229  //gettime(&adesso);
3230  //getdate(&oggi);
3231 
3232 
3233  sprintf(buff,"%s\\Param.ini", BIL.DFILEM.CONFIGDIREQUIPMENT);
3234 
3235 
3236  fs = fopen(buff, "w");
3237  if(fs == NULL)
3238  {
3239  MMessageDialog("DAS information", "Problems in opening file", " Ok ", NULL);
3240  return 1;
3241  }
3242 
3243 
3244  //sprintf(buff, "%s",EquipCode2Name(DAS.Paramini.EqType, "", streqtype ));
3245 
3246 
3247  sprintf(str, "###############################################\n");
3248  fprintf(fs,str);
3249  sprintf(str, "# Param.INI #\n");
3250  fprintf(fs,str);
3251 // sprintf(str, "# Main configuration file for %s #\n", EquipCode2Name(DAS.Paramini.EqType, "", streqtype ));
3252  sprintf(str, "# Main configuration file for %s #\n", CodeEq2Name(DAS.Paramini.EqType));
3253  fprintf(fs,str);
3254  sprintf(str, "# equipment #\n");
3255  fprintf(fs,str);
3256  sprintf(str, "###############################################\n");
3257  fprintf(fs,str);
3258  sprintf(str, "# ------------------------------------------- #\n");
3259  fprintf(fs,str);
3260  sprintf(str, "# by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
3261  fprintf(fs,str);
3262  sprintf(str, "# ------------------------------------------- #\n");
3263  fprintf(fs,str);
3264 
3265  sprintf(str, "# CCD Temp (°C) ----------------------------- #\n");
3266  fprintf(fs,str);
3267  sprintf(str, "%.1lf\n",DAS.Paramini.ITemp);
3268  fprintf(fs,str);
3269  sprintf(str, "# CCD Peltier Init Power X 10 (150 = %.1lf%%) #\n",(double) 15);
3270  fprintf(fs,str);
3271  sprintf(str, "%d\n",DAS.Paramini.CoolPw);
3272  fprintf(fs,str);
3273  sprintf(str, "# Optical Unit Target Temperature ------------#\n");
3274  fprintf(fs,str);
3275  sprintf(str, "%.1lf\n",DAS.Paramini.TPelt);
3276  fprintf(fs,str);
3277 
3278  sprintf(str, "# OMU Peltier Init Power X 10 (500 = %.1lf%%) #\n",(double) 50);
3279  fprintf(fs,str);
3280 
3281  sprintf(str, "%d\n", OMUTHR.PCPower);
3282  fprintf(fs,str);
3283 
3284  sprintf(str, "# CCD Window (xstart ys xend ye) -------------#\n");
3285  fprintf(fs,str);
3286  sprintf(str,"%d %d %d %d\n", DAS.Paramini.ccdXoff, DAS.Paramini.ccdYoff, DAS.Paramini.ccdWx, DAS.Paramini.ccdWy);
3287  fprintf(fs,str);
3288  sprintf(str, "# Vertical Binning ---------------------------#\n");
3289  fprintf(fs,str);
3290  sprintf(str,"%d\n", DAS.Paramini.VBin);
3291  fprintf(fs,str);
3292 
3293  sprintf(str, "# Max Exposure Time s (=0 --> free exposure) #\n");
3294  fprintf(fs,str);
3295  sprintf(str,"%.1lf\n", DAS.Paramini.maxtexp);
3296  fprintf(fs,str);
3297 
3298 
3299  sprintf(str, "###############################################\n");
3300  fprintf(fs,str);
3301 
3302  fclose(fs);
3303 
3304  if(CCD_SetupFlg)
3305  {
3306  CCD_SetupFlg = 0;
3307 
3308 
3309 // sprintf(buff, "%s\\%s.cfg", BIL.DFILEM.CONFIGDIREQUIPMENT, CodeEq2Name(DAS.Paramini.EqType));
3310 
3311  //Copy camera.cfg and rename in 'equipment'.cfg
3312  sprintf(buf, "copy %s\\camera.cfg %s", BIL.DFILEM.DIRDCL, BIL.DFILEM.CONFIGDIREQUIPMENT);
3313  er = system(buf);
3314  sprintf(buf, "ren %s\\camera.cfg %s.cfg", BIL.DFILEM.CONFIGDIREQUIPMENT, CodeEq2Name(DAS.Paramini.EqType));
3315  er = system(buf);
3316 
3317  sprintf(str,"The current parameters has been saved in '%s\\Param.ini' file\n The %s\\camera.cfg file was copied in %s folder and renamed as %s.cfg'.",
3318  BIL.DFILEM.DIRDCL,
3321  MMessageDialog("DAS information", str, " Ok ", NULL);
3322 
3323  }
3324  else
3325  {
3326  sprintf(str,"The current parameters has been saved in '%s\\Param.ini' file", BIL.DFILEM.CONFIGDIREQUIPMENT);
3327  MMessageDialog("DAS information", str, " Ok ", NULL);
3328 
3329  }
3330 
3331 
3332 
3334  //CCD and OMU Parameters
3335  if(DAS.Flag.exemode != DOASMODE )
3336  {
3337  sprintf(str, "%.1lf", DAS.Paramini.ITemp);
3338  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[0], str);
3339  sprintf(str,"%.1lf%%",(double)DAS.Paramini.CoolPw / 10);
3340  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[1], str);
3341  sprintf(str,"%.1lf", DAS.Paramini.TPelt);
3342  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[2], str);
3343  sprintf(str,"%d", DAS.Paramini.ccdXoff);
3344  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[5], str);
3345  sprintf(str,"%d", DAS.Paramini.ccdYoff);
3346  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[6], str);
3347  sprintf(str,"%d", DAS.Paramini.ccdWx);
3348  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[7], str);
3349  sprintf(str,"%d", DAS.Paramini.ccdWy);
3350  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[8], str);
3351  sprintf(str, "%d", DAS.Paramini.VBin);
3352  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[9], str);
3353  }
3354 
3355  return 0;
3356 
3357 
3358 
3359 }
3360 
3361 
3362 
3363 void PB_H_CB(MOBJECT p, void *od, void *ad)
3364 {
3365 
3366  int c = (int) ad;
3367  char buf[1024];
3368 
3369  switch(c)
3370  {
3371  case 0:
3372  sprintf(buf,"In this text box the user can specify \nthe Maximum Exposure Time (MEXT) \
3373 (s) that will be used in the AutoRange() Procedure.\n The Maximum time allowed \
3374 is 999s.\n If the MEXT is set to 0.0, the Autoranging procedure will ignore the \n\
3375 limitations and the calculated exposure time will be used.");
3376  MMessageDialog("DAS Quick Help:", buf, "ok", NULL);
3377  break;
3378  case 2:
3379  break;
3380 
3381  }
3382 }
3383 
3384 
3385 void CCDSetupCB(MOBJECT shell, void *od, void *ad)
3386 {
3387 
3388  int er = 0;
3389  char str[_MAX_PATH];
3390 // char buf[_MAX_PATH];
3391  char buff[_MAX_PATH];
3392 
3393  CCD_SetupFlg = 1;
3394 /*
3395  //Set path for the DCL
3396  sprintf(buff, "%s\\dcl\\", BIL.DFILEM.CONFIGDIREQUIPMENT );
3397  // Return: 1 if PATH exist, else return 0
3398  er = DI_PathExist(buff);
3399  if (er)
3400  {
3401  //Set path for the DCL
3402  DC_SetPathName(buff);
3403  }
3404  else
3405  {
3406  sprintf(buf,"Path '%s' deos not exist,\nPlease create and fill ", buff);
3407  MMessageDialog ("DAS ERROR ", buf, "OK",NULL);
3408  return 1001;
3409 
3410  }
3411 
3412  sprintf(str, "%s%s", buff , "dcs.exe -f ");
3413 */
3414 
3415 
3416 
3417 
3418  sprintf(buff, "%s\\%s.cfg", BIL.DFILEM.CONFIGDIREQUIPMENT,CodeEq2Name(DAS.Paramini.EqType));
3419 
3420  //Return: 1 if file exist, else return 0
3421  er = DI_FileExist(buff);
3422  if (er)
3423  {
3424  sprintf(str, "%s\\%s -f %s", BIL.DFILEM.HOMEDIRECTORY , "dcs.exe", buff);
3425 
3426  }
3427  else
3428  {
3429  sprintf(buff,"File'%s\\%s.cfg' not found,\n\
3430 Now 'dcs.exe' will load the standard 'camera.cfg' configuration file\n\
3431 Set the camera parameters, copy the '%s\\dcl\\camera.cfg' file in the %s folder\n\
3432 and rename in '%s.cfg'", BIL.DFILEM.CONFIGDIREQUIPMENT, CodeEq2Name(DAS.Paramini.EqType),
3434  MMessageDialog ("DAS ERROR ", buff, "OK",NULL);
3435  sprintf(str, "%s//%s", BIL.DFILEM.HOMEDIRECTORY , "dcs.exe");
3436 
3437  }
3438 
3439  er = WinExec(str, SW_SHOW);
3440 
3441 
3442 }
3443 
3444 
3445 
3446 void ApplyChCB(MOBJECT shell, void *od, void *ad)
3447 {
3448  int c = (int) ad, i;
3449  char str[16];
3450  int er, nummot = 0;
3451  int ans = 0, k;
3452 
3453 // char destination[_MAX_PATH];
3454 // char working_dir[_MAX_PATH];
3455 // char source[_MAX_PATH];
3456  char buf[_MAX_PATH];
3457 
3458  sprintf(str, "%.1lf", DAS.Paramini.ITemp);
3459  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[0], str);
3460 
3461  sprintf(str,"%.1lf%%",(double)DAS.Paramini.CoolPw / 10);
3462  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[1], str);
3463 
3464  sprintf(str,"%.1lf", DAS.Paramini.TPelt);
3465  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[2], str);
3466 
3467 
3468  sprintf(str,"%.1lf%%",(double)OMUTHR.PCPower / 10);
3469  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[10], str);
3470 
3471 
3472 /*
3473  sprintf(str,"%d", DAS.Paramini.ccdXoff);
3474  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[3], str);
3475 
3476  sprintf(str,"%d", DAS.Paramini.ccdYoff);
3477  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[4], str);
3478 
3479  sprintf(str,"%d", DAS.Paramini.ccdWx);
3480  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[5], str);
3481 
3482  sprintf(str,"%d", DAS.Paramini.ccdWy);
3483  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[6], str);
3484 */
3485 
3486  sprintf(str, "%d", DAS.Paramini.VBin);
3487  MObjectSetText(DAS.Gui.ContrPanel.lbl_Par[9], str);
3488 
3489 
3490  if(CCD_SetupFlg)
3491  {
3492  CCD_SetupFlg = 0;
3493 
3494  //Copy camera.cfg
3495  sprintf(buf, "copy %s\\camera.cfg %s\\", BIL.DFILEM.DIRDCL, BIL.DFILEM.CONFIGDIREQUIPMENT);
3496  er = system(buf);
3497  //sprintf(buf, "copy %s\\dcl.cfg %s\\dcl", BIL.DFILEM.DIRDCL, BIL.DFILEM.CONFIGDIREQUIPMENT);
3498  //er = system(buf);
3499 
3500  }
3501 
3502 
3503 // Stepper Motors Parameters
3504  for (i=0;i<DAS.StepM.NAMS;i++)
3505  {
3506  for(k=0;k<2;k++)
3507  {
3508  /*
3509  * Get user preferences from the EDIT Objects for Power SMx
3510  */
3511  //Power
3512  MObjectGetText(DAS.Gui.ConfigPanel.SM_power[i][k], str);
3513  DAS.StepM.cop_perc[i][k] = atof(str);
3514  DAS.StepM.power[i][k] = perc2int(0, str);
3515  MObjectSetText(DAS.Gui.ContrPanel.power[i][k], str);
3516 
3517  /*
3518  * Get user preferences from the EDIT Objects for Step SMx
3519  */
3520  //Step
3521  MObjectGetText(DAS.Gui.ConfigPanel.SM_step[i][k], str);
3522  DAS.StepM.step[i][k] = fraz2val(0, str);
3523  val2fraz(i, k, DAS.StepM.step[i][k]);
3524  sprintf(str, "%s", DAS.StepM.step_fraz[i][k]);
3525  MObjectSetText(DAS.Gui.ContrPanel.step[i][k], str);
3526 
3527  // Slope
3528  MObjectGetText(DAS.Gui.ConfigPanel.SM_slope[i][k], str);
3529  DAS.StepM.slope[i][k] = atoi(str);
3530  sprintf(str, "%d", DAS.StepM.slope[i][k]);
3531  MObjectSetText(DAS.Gui.ContrPanel.slope[i][k], str);
3532 
3533  //speed
3534  MObjectGetText(DAS.Gui.ConfigPanel.SM_speed[i][k], str);
3535  DAS.StepM.speed_Hz[i][k] = atof(str);
3536  DAS.StepM.speed[i][k] = hertz2int(0, str);
3537  MObjectSetText(DAS.Gui.ContrPanel.speed[i][k], str);
3538 
3539  //multiplier
3540  MObjectGetText(DAS.Gui.ConfigPanel.SM_multiplier[i][k], str);
3541  DAS.StepM.multiplier[i][k] = atof(str);
3542 
3543  }
3544  }
3545 
3546  if (c == 0)
3547  {
3548  er = DB_InitCamera(1);
3549 
3550 
3551  }
3552  if (c)
3553  {
3554  //Disattiva i pulsanti sulla keyboard
3555  DB_KB_ButtonActive(0);
3556 
3557 
3558  //er = DB_CloseCOM();
3559  //if(er)
3560  // ComErrors(er);
3561 
3562 
3563  er = DB_InitMotor(0);
3564  //Attiva i pulsanti sulla keyboard
3565  DB_KB_ButtonActive(1);
3566 
3567 
3568  }
3569 
3570 
3571 
3572 }
3573 
3574 
3575 
3576 void ADTesterCB(MOBJECT shell, void *od, void *ad)
3577 {
3578 
3579  int PowerOn, PowerOff,i;
3580 
3581  if(FLAG.ADTempTest == 0)
3582  {
3583 
3584  MObjectSetText(ADTESTER.ADpb, "AD_Testing");
3585  MObjectSetText(ADTESTER.ADInflbl, "Click AD_Test to stop ");
3586  if(FLAG.ADPC104 == 0)
3587  {
3588  FLAG.ADTempTest = 1;
3589  PowerOn = 1;
3590  PowerOff = LISTEMP_TASK_TIME ;
3591  AMS_PWM(AMS2, PowerOn, PowerOff);//Peltier Power a 0
3592  Peltier(0); //Peltier Off
3593  FANPeltier(0);
3594  }
3595  else
3596  MMessageDialog("ADTEST","AD Test Not possible \n Check the PC104 Connection","OK", NULL);
3597 
3598  }
3599  else if(FLAG.ADTempTest == 1)
3600  {
3601 
3602  MObjectSetText(ADTESTER.ADpb, "Start");
3603  MObjectSetText(ADTESTER.ADInflbl, "Click Start to Test ");
3604 
3605  FLAG.ADTempTest = 0;
3606 
3608  for (i=0; i<16; i++)
3609  {
3610  MObjectSetText(ADTESTER.lblADvalue[i], "0.0");
3611  }
3612 
3613 
3614  }
3615 
3616 
3617 }
3618 
3619 
3620 
3621 
3622 void DB_SelOutModeCB(MOBJECT o, void *id, void *a_data)
3623 {
3624  int c = (int) a_data;
3625 // char buf[80];
3626 
3627  switch(c)
3628  {
3629  case 0 :
3630  ADTESTER.OutputMode = 0;
3631  break;
3632  case 1:
3633  ADTESTER.OutputMode = 1;
3634  break;
3635 
3636  }
3637 }
3638 
3639 
3640 
3641 
3642 void DB_SetCCDTargetTempCB(MOBJECT o, void *id, void *a_data)
3643 {
3644  int c = (int) a_data;
3645 
3646  switch(c)
3647  {
3648  case 0 :
3649  FLAG.settempvar = 0;
3650  break;
3651  case 1:
3652  FLAG.settempvar = 1;
3653  break;
3654  }
3655 }
3656 
3657 
3658 
3659 void DB_SetXUnitsCB(MOBJECT o, void *id, void *a_data)
3660 {
3661  int c = (int) a_data;
3662 
3663  switch(c)
3664  {
3665  case 0 :
3666  FLAG.Wl = 0;
3667  break;
3668  case 1:
3669  FLAG.Wl = 1;
3670  break;
3671  case 2:
3672  FLAG.Wl = 2;
3673  break;
3674 
3675  }
3676 }
3677 
3678 void DB_PlotYAxisCB(MOBJECT o, void *id, void *a_data)
3679 {
3680  int c = (int) a_data;
3681 
3682  switch(c)
3683  {
3684  case 0 :
3685  FLAG.plotYRange = 0;
3686  break;
3687  case 1:
3688  FLAG.plotYRange = 1;
3689  break;
3690 
3691  }
3692 
3693 
3694 
3695 }
3696 
3697 void DB_DispBlindPixCB(MOBJECT o, void *id, void *a_data)
3698 {
3699  int c = (int) a_data;
3700 
3701  switch(c)
3702  {
3703  case 0 :
3704  FLAG.DispBlindPix = 0;
3705  break;
3706  case 1:
3707  FLAG.DispBlindPix = 1;
3708  break;
3709 
3710  }
3711 }
3712 
3713 
3714 void DB_PlotDisplayCB(MOBJECT o, void *id, void *a_data)
3715 {
3716  int c = (int) a_data;
3717 
3718  switch(c)
3719  {
3720  case 0 :
3721  DAS.Flag.plotW = 0;
3722  break;
3723  case 1:
3724  DAS.Flag.plotW = 1;
3725  break;
3726 
3727  }
3728 }
3729 
3730 unsigned char Port = 0;
3731 
3732 
3733 
3734 void print2file(FILE *ff, int x, int y, unsigned int m)
3735 {
3736 
3737  char str[80];
3738 
3739 
3740  //sprintf(str, "x, y, val: %d %d %u\n", x, y, m);
3741  //sprintf(str, "%d %d %u 1 1 0 0\n", x, y, m);
3742  sprintf(str, "%d %d 1 1 0 0\n", x, y);
3743 
3744  fprintf(ff,str);
3745 
3746 
3747 
3748 }
3749 
3750 
3751 //mod = 1 --> OVER Exposed
3752 //mod = 0 --> UNDER exposed
3753 //mod = 2 --> OVER Exposed with TExp = 5
3754 
3755 int GetDefPix(int mod)
3756 {
3757 
3758 
3759  FILE *fs;
3760  char str[80];
3761  char buff[_MAX_PATH];
3762  int i, t, j;
3763  unsigned int mx;
3764  unsigned short temp, *matdefpix;
3765  struct time adesso;
3766  struct date oggi;
3767  struct tm today;
3768  int NumOverExP = 0;
3769  int NumUnderExP = 0;
3770 
3771 
3772  GetDateTime(&oggi, &adesso, &today);
3773  //gettime(&adesso);
3774  //getdate(&oggi);
3775 
3776 
3777  if (mod ==1)
3778  {
3779  sprintf(buff, "%s\\OverExpPix.dat", BIL.DFILEM.CONFIGDIREQUIPMENT);
3780 
3781  fs = fopen(buff, "w");
3782  if(fs == NULL) return 1;
3783 
3784  sprintf(str, "DREM #######################################################\n");
3785  fprintf(fs,str,NULL);
3786  sprintf(str, "DREM # OVER EXPOSED DEFECTIVE PIXELS: #\n");
3787  fprintf(fs,str);
3788  sprintf(str, "DREM # by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
3789  fprintf(fs,str);
3790  sprintf(str, "DREM #######################################################\n");
3791  fprintf(fs,str,NULL);
3792  fclose(fs);
3793 
3794 
3795  }
3796  if (mod == 0)
3797  {
3798  sprintf(buff, "%s\\UnderExpPix.dat", BIL.DFILEM.CONFIGDIREQUIPMENT);
3799 
3800  fs = fopen(buff, "w");
3801  if(fs == NULL) return 1;
3802 
3803  sprintf(str, "DREM #######################################################\n");
3804  fprintf(fs,str,NULL);
3805  sprintf(str, "DREM # UNDER EXPOSED DEFECTIVE PIXELS: #\n");
3806  fprintf(fs,str);
3807  sprintf(str, "DREM # by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
3808  fprintf(fs,str);
3809  sprintf(str, "DREM #######################################################\n");
3810  fprintf(fs,str,NULL);
3811 
3812  fclose(fs);
3813 
3814  }
3815  if (mod == 2)
3816  {
3817  sprintf(buff, "%s\\OverExpPix5.dat", BIL.DFILEM.CONFIGDIREQUIPMENT);
3818 
3819  fs = fopen(buff, "w");
3820  if(fs == NULL) return 1;
3821 
3822  sprintf(str, "DREM #######################################################\n");
3823  fprintf(fs,str,NULL);
3824  sprintf(str, "DREM # OVER EXPOSED DEFECTIVE PIXELS: #\n");
3825  fprintf(fs,str);
3826  sprintf(str, "DREM # by DanBo %02u/%02u/%d at %02u:%02u:%02u #\n", oggi.da_day,oggi.da_mon,oggi.da_year, adesso.ti_hour, adesso.ti_min,adesso.ti_min);
3827  fprintf(fs,str);
3828  sprintf(str, "DREM #######################################################\n");
3829  fprintf(fs,str,NULL);
3830  fclose(fs);
3831 
3832 
3833  }
3834 
3835 
3836  if (IDX != 0)
3837  {
3838  mx = (unsigned long) IDX * (unsigned long) IDY;
3839  BIL.DPLOT.ImatGraf = (unsigned short *) calloc( mx, sizeof(unsigned short));
3840 
3841  mx = (unsigned long) IDX * (unsigned long) IDY;
3842  matdefpix = (unsigned short *) calloc( mx, sizeof(unsigned short));
3843 
3844  }
3845  else
3846  {
3847  MMessageDialog("ALERT", "CCD Not Initialized" , "Ok", NULL);
3848  return 1;
3849 
3850  }
3851 
3852  if (mod == 1)
3853  {
3854  TExp = 0;
3855  for (i= 0; i<3; i++)
3856  DB_GetCCD(0);
3857  }
3858  if (mod == 0)
3859  {
3860  TExp = 0;
3861  DB_GetCCD(0);
3862  QjLamp(1);
3863  SD_Mirror(2);
3864  AutoRange(0);
3865  DB_GetCCD(1);
3866  }
3867 
3868  if (mod == 2)
3869  {
3870  TExp = 5;
3871  for (i= 0; i<3; i++)
3872  DB_GetCCD(0);
3873  }
3874 
3875 
3876  for(t = 0 ; t < IDY ; t++)
3877  {
3878  for(j = 0; j < IDX; j++)
3879  {
3880  if(DIL.Img.Mat[Server].Imat[t * IDX + j] > LevelDefPix)
3881  {
3882  NumOverExP++;
3883  //NumUnderExP++;
3884  }
3885  else
3886  {
3887  NumUnderExP++;
3888  //NumOverExP++;
3889  }
3890 
3891  }
3892  }
3893 
3894  fs = fopen(buff, "a");
3895  if(fs == NULL) return 1;
3896 
3897 
3898  if (mod==1 || mod==2)
3899  {
3900 
3901  sprintf(str, "DREM Start of pixel section\n");
3902  fprintf(fs,str);
3903  sprintf(str, "PIX\n");
3904  fprintf(fs,str);
3905  sprintf(str, "DREM Number of items of pixel correction\n");
3906  fprintf(fs,str);
3907  sprintf(str, "PITM %d\n", NumOverExP);
3908  fprintf(fs,str);
3909  }
3910 
3911  if (mod==0)
3912  {
3913 
3914  sprintf(str, "DREM Start of pixel section\n");
3915  fprintf(fs,str);
3916  sprintf(str, "PIX\n");
3917  fprintf(fs,str);
3918  sprintf(str, "DREM Number of items of pixel correction\n");
3919  fprintf(fs,str);
3920  sprintf(str, "PITM %d\n", NumUnderExP);
3921  fprintf(fs,str);
3922  }
3923 
3924  for(t = 0 ; t < IDY ; t++)
3925  {
3926  for(j = 0; j < IDX; j++)
3927  {
3928 
3929 
3930  if (mod==1 || mod==2)
3931  {
3932  if(DIL.Img.Mat[Server].Imat[t * IDX + j] >= LevelDefPix)
3933  {
3934  temp = 100;
3935  matdefpix[t * IDX + j] = temp;
3936  print2file(fs, j, t,DIL.Img.Mat[Server].Imat[t * IDX + j]);
3937  }
3938  }
3939 
3940  if (mod==0)
3941  {
3942  if(DIL.Img.Mat[Server].Imat[t * IDX + j] < LevelDefPix)
3943  {
3944  temp = 100;
3945  matdefpix[t * IDX + j] = temp;
3946  print2file(fs, j, t,DIL.Img.Mat[Server].Imat[t * IDX + j]);
3947  }
3948  }
3949  BIL.DPLOT.ImatGraf[t * IDX + j] = temp;
3950 
3951  }
3952  }
3953 /*
3954  if(DIL.Img.Mat[Server].Imat[t * IDX + j] < LevelDefPix)
3955  {
3956  temp = 100;
3957  matdefpix[t * IDX + j] = temp;
3958  if (mod==1 || mod==2)
3959  {
3960 
3961  }
3962  else
3963  {
3964  print2file(fs, j, t,DIL.Img.Mat[Server].Imat[t * IDX + j]);
3965  }
3966 
3967  }
3968  if(DIL.Img.Mat[Server].Imat[t * IDX + j] >= LevelDefPix)
3969  {
3970  temp =40000;
3971  matdefpix[t * IDX + j] = temp;
3972  if (mod==1 || mod==2)
3973  {
3974  print2file(fs, j, t,DIL.Img.Mat[Server].Imat[t * IDX + j]);
3975  }
3976  else
3977  {
3978 
3979  }
3980 
3981  }
3982  BIL.DPLOT.ImatGraf[t * IDX + j] = temp;
3983  }
3984  }
3985 */
3986  sprintf(str, "DEND\n");
3987  fprintf(fs,str);
3988 
3989  fclose(fs);
3990 
3991  D_Saving(); //Save the measured image
3992 
3993  for(t = 0 ; t < IDY ; t++)
3994  {
3995  for(j = 0; j < IDX; j++)
3996  {
3997  DIL.Img.Mat[Server].Imat[t * IDX + j] = matdefpix[t * IDX + j];
3998  }
3999  }
4000 
4001  D_Saving(); //Save the image of defective pixels
4002 
4003 
4004 
4005  free(matdefpix);
4006 
4007  return 0;
4008 }
4009 
4010 void MAPDefPixCB(MOBJECT o, void *id, void *a_data)
4011 {
4012 
4013  int c = (int) a_data;
4014 
4015  GetDefPix(c);
4016 /* switch (c)
4017  {
4018  case 0:
4019  GetDefPix(0);
4020  break;
4021  case 1:
4022  GetDefPix(1);
4023  break;
4024  case 2:
4025  GetDefPix(2);
4026  break;
4027 
4028  }
4029 */
4030 }
4031 
4032 
4033 //mod = 1 --> OVER Exposed
4034 //mod = 0 --> UNDER exposed
4035 
4036 void MAPDefPix(int mod)
4037 {
4038 
4039  MOBJECT sh, rowf, lbl,lbl1,lbl2, tb, level, pb;
4040  char str[80];
4041  int *p, k;
4042 
4043  sh = MCreateShell("MAP DEFECTIVE PIXELS", 0);
4044 // MObjectSetCompositeWidth(sh, 670);
4045 // MObjectSetCompositeHeight(sh, 483);
4046 
4047  rowf = MCreateRowForm(sh);
4048  MObjectSetBackgroundRGB(rowf, 112, 128, 112);
4049  MObjectSetResize(rowf, True, True);
4050 // MObjectSetCompositeWidth(rowf, 357);
4052 
4053  if(mod==1)
4054  sprintf(str, "This procedure allows for the mapping of the\n OVER exposed pixels of the CCD sensor");
4055 
4056  if(mod==0)
4057  sprintf(str, "This procedure allows for the mapping of the\n UNDER exposed pixels of the CCD sensor");
4058 
4059  if(mod==2)
4060  sprintf(str, "This procedure allows for the mapping of the\n OVER exposed pixels of the CCD sensor");
4061 
4062  lbl = MCreateLabel(rowf, str, FIXED_SMALL);
4063  MObjectSetResize(lbl, True, True);
4064  MObjectSetForegroundRGB(lbl, 255, 255, 255);
4065  MObjectSetBackgroundRGB(lbl, 96, 132, 152);
4066  MObjectSetTransparency(lbl, 0);
4067 
4068  if(mod==1)
4069  sprintf(str, "3 Flat Measurements (Texp = 0) will be porformed\n in order to identify the defective pixels");
4070 
4071  if(mod==0)
4072  sprintf(str, "3 Measurements of QJ lamp will be porformed\n in order to identify the defective pixels");
4073 
4074  if(mod==2)
4075  sprintf(str, "3 Flat Measurements (Texp = 5s) will be porformed\n in order to identify the defective pixels");
4076 
4077 
4078  lbl1 = MCreateLabel(rowf, str, FIXED_SMALL);
4079  MObjectSetResize(lbl1, True, True);
4080  MObjectSetForegroundRGB(lbl1, 255, 255, 255);
4081  MObjectSetBackgroundRGB(lbl1, 96, 132, 152);
4082  MObjectSetTransparency(lbl1, 0);
4083 
4084 
4085  if(mod==1)
4086  sprintf(str, " You have to set the maximum level in\norder to consider the pixel as good");
4087 
4088  if(mod==0)
4089  sprintf(str, " You have to set the minimum level in\norder to consider the pixel as good");
4090 
4091  if(mod==2)
4092  sprintf(str, " You have to set the maximum level in\norder to consider the pixel as good");
4093 
4094  lbl2 = MCreateLabel(rowf, str, FIXED_SMALL);
4095  MObjectSetForegroundRGB(lbl2, 255, 255, 255);
4096  MObjectSetBackgroundRGB(lbl2, 96, 132, 152);
4097  MObjectSetTransparency(lbl2, 0);
4098 
4099 
4100 
4101 /**************************************/
4102  tb = MCreateTableForm(rowf, 3);
4103  MObjectSetBackgroundRGB(tb, 56, 112, 112);
4105 // MObjectSetCompositeWidth(tb, 347);
4106 
4107  if(mod==1)
4108  sprintf(str, "Pix with values higher than");
4109 
4110  if(mod==0)
4111  sprintf(str, "Pix with values lower than");
4112 
4113  if(mod==2)
4114  sprintf(str, "Pix with values higher than");
4115 
4116  lbl = MCreateLabel(tb, str, FIXED_SMALL);
4118  MObjectSetForegroundRGB(lbl, 255, 255, 255);
4119  MObjectSetTransparency(lbl, 0);
4120  MObjectSetResize(lbl, False, False);
4122 
4123  level = MCreateClippedEdit(tb, " ", 10, 5, FIXED_SMALL);
4124  MObjectSetForegroundRGB(level, 255, 255, 255);
4125  MObjectSetBackgroundRGB(level, 40, 96, 72);
4126 // MObjectSetCompositeWidth(level, 35);
4128  k = 140;
4129  p = (void *) k;
4130  MEditSetValCallback(level, ValidateCB, p);
4131  MEditSetActCallback(level, ActEditCB, p);
4132 
4133  lbl1 = MCreateLabel(tb, "will be marked as defective", FIXED_SMALL);
4135  MObjectSetForegroundRGB(lbl1, 255, 255, 255);
4136  MObjectSetTransparency(lbl1, 0);
4137  MObjectSetResize(lbl1, False, False);
4139 
4140  tb = MCreateTableForm(rowf, 2);
4141  MObjectSetBackgroundRGB(tb, 56, 112, 112);
4143 
4144 
4145  pb = MCreatePButton(tb ,"Execute", FIXED_SMALL);
4146  MPButtonSetCallback(pb, MAPDefPixCB, (void *) mod);
4147  MObjectSetBackgroundRGB(pb, 224, 224, 176);
4148  MObjectSetCompositeWidth(pb, 100);
4149 /*
4150  pb = MCreatePButton(tb, "Close", FIXED_SMALL);
4151  MPButtonSetCallback(pb, MDQuitCB, (void *) 0);
4152  MObjectSetBackgroundRGB(pb, 224, 224, 176);
4153  MObjectSetCompositeWidth(pb, 100);
4154 */
4155 
4156 /************************************/
4157  MShellRealize(sh);
4159 }
4160 
4161 
4162 void UnderOverPixCB(MOBJECT o, void *id, void *a_data)
4163 {
4164 
4165  int c = (int) a_data;
4166 
4167  MAPDefPix(c);
4168 /* switch (c)
4169  {
4170  case 0:
4171  MAPDefPix(0);
4172  break;
4173  case 1:
4174  MAPDefPix(1);
4175  break;
4176  case 2:
4177  MAPDefPix(2);
4178  break;
4179 
4180 
4181  }
4182 */
4183 }
4184 void DB_VMRsfCB(MOBJECT o, void *id, void *a_data)
4185 {
4186 
4187  int c = (int) a_data;
4188  switch (c)
4189  {
4190  case 0:
4191  FLAG.VMRsf = 0;
4192  break;
4193  case 1:
4194  FLAG.VMRsf = 1;
4195  break;
4196 
4197  }
4198 
4199 }
4200 
4201 
4202 
4203 void ModifyConfFileCB(MOBJECT o, void *id, void *a_data)
4204 {
4205  char buff[80];
4206  char str[MAX_PATH];
4207  int c = (int) a_data, er;
4208 
4209  if(FLAG.VMRsf == 0)
4210  {
4211  switch (c)
4212  {
4213  case 0:
4214  case 1:
4215  case 2:
4216  case 3:
4217  case 4:
4218  case 6:
4219  case 8:
4220  MObjectGetText(o, buff);
4221  sprintf(str,"%s %s\\%s","MEDIT.EXE", BIL.DFILEM.CONFIGDIREQUIPMENT, buff);
4222  er = WinExec(str, SW_SHOW);
4223  //If you want you can use the DED Library
4224  //In my opinion MEDIT is better
4225  //sprintf(str,"%s\\Config\\%s", BIL.DFILEM.HOMEDIRECTORY,buff);
4226  //DED(str);
4227  break;
4228  case 5:
4229  sprintf(str,"%s %s\\Config\\%s","MEDIT.EXE", BIL.DFILEM.HOMEDIRECTORY,"NoName.txt");
4230  er = WinExec(str, SW_SHOW);
4231  //sprintf(str,"%s\\%s", BIL.DFILEM.HOMEDIRECTORY,"NoName.txt");
4232  //DED(str);
4233  break;
4234  case 7:
4235  MObjectGetText(o, buff);
4236  sprintf(str,"%s %s\\%s","MEDIT.EXE", BIL.DFILEM.CONFIGDIRCOMMON , buff);
4237  er = WinExec(str, SW_SHOW);
4238  //If you want you can use the DED Library
4239  //In my opinion MEDIT is better
4240  //sprintf(str,"%s\\Config\\%s", BIL.DFILEM.HOMEDIRECTORY,buff);
4241  //DED(str);
4242  break;
4243 
4244  }
4245  }
4246  else if(FLAG.VMRsf == 1)
4247  {
4248  switch (c)
4249  {
4250  case 0:
4251  break;
4252  case 1:
4253  LoadDasSysCol();
4254 // MObjectRedraw(CP_Sh);
4255 // MObjectRedraw(LIS.Sh_KeyB);
4256  break;
4257  case 2:
4258  LoadDB_Options();
4259  break;
4260  case 3:
4261  break;
4262  case 4:
4263  break;
4264  case 5:
4265  sprintf(str,"%s %s\\Config\\%s","MEDIT.EXE", BIL.DFILEM.HOMEDIRECTORY,"NoName.txt");
4266  er = WinExec(str, SW_SHOW);
4267  //sprintf(str,"%s\\%s", BIL.DFILEM.HOMEDIRECTORY,"NoName.txt");
4268  //DED(str);
4269  break;
4270  }
4271  }
4272 
4273 }
4274 
void MObjectSetColor(MOBJECT obj, MTColor bgc, MTColor fgc)
void DB_MIGEopmode_CB(MOBJECT o, void *a, void *v)
callback selecting the operation mode for the AltAzPlatform
int PaletteMode
Definition: DAS_Spat.c:158
dpwd DPWD
Definition: CreateForms.c:79
void DB_Undo2Do_Colors(short undocol[], short docol[])
Assign to the DO_Color structure the Color Values of the UNDO_Color Structure.
short DB_BG_lblUP[3]
Background Capital Letters Labels Color UP.
stepm StepM
Stepper motors parameters structure.
void MQueryColor(MTColor col, int *pr, int *pg, int *pb)
cfg Cfg
Definition: Dildef.h:678
#define SPATRAM
SPectrometer for Atmospheric TRAcers Measurements - CGE-UE Portugal.
ccd DC_CCD
DXL_par DXL
MTFont newfont
Definition: CreateForms.c:95
void ADTesterCB(MOBJECT shell, void *od, void *ad)
Test Temperature AD Converter callback.
void FANPeltier(int mod)
FAN ON/OFF .
Definition: Spat_Device.c:2652
void MObjectSetBackgroundRGB(MOBJECT obj, int r, int g, int b)
gui Gui
Graphic User Interface Structure.
void ColPickBackForeGCB(MOBJECT o, void *a, void *v)
select if the foreground or background color of the selected object will be picked ...
void DB_KB_ButtonActive(int mod)
Enable/Disable Push buttons on the Control Panel.
Definition: CreateForms.c:3810
int hometype[AMSMAX][2]
MOBJECT rb[10]
Definition: DOASdef.h:62
void GrafoIMG(int mode)
Definition: Spat_Plot.c:1242
void MRefreshTimeout(TIMEOUT_ID *pid, CARD32 msec, TIMEOUT_CB cb, void *ud)
int WriteEquipini(void)
Write equipment.ini file .
MOBJECT lblAvg
int SD_Mirror(int where)
Positioning Input Mirror. The Input Mirror reaches the position specified by where.
Definition: Spat_Device.c:1898
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
void DB_RadioModeSelCB(MOBJECT o, void *id, void *a_data)
Set the saving mode.
shells Shells
Shells structure.
int DB_InitMotor(int mod)
Initialize AMS. Procedure that initialize the parameters for the AMS&#39;s devices.
Definition: Init.c:1584
unsigned int keycode
Code for the pressed key.
Definition: Mguidefs.h:541
MOBJECT lbl
Definition: DFileMan.c:42
MTColor MAllocCell(int r, int g, int b)
MOBJECT cell_label
Definition: DAS_Spatram.h:3057
int MGetNPlanes(void)
int LoadPaletteCB(MOBJECT o, void *o_data, void *a_data)
Callback for LoadTestPalette.
void PB_H_CB(MOBJECT p, void *od, void *ad)
Quick Help Callback.
MOBJECT r_label
Definition: DAS_Spatram.h:3058
void ColorAssignCB(MOBJECT o, void *o_data, void *a_data)
int Server
Definition: DAS_Spat.c:253
int DB_InitCamera(int mod)
Initialize Camera Parameters. Procedure that initialize the CCD Camera.
Definition: Init.c:170
Definition: DOASdef.h:16
MOBJECT speed[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "speed".
short DB_FG_Plbl[3]
Foreground PASSIVE Label Colors.
void DB_CellExposeCB(MOBJECT obj, MEvent *pexp, void *a_data)
display selected Color
void DB_AMSposmode_CB(MOBJECT o, void *a, void *v)
callback selecting the positioning mode for stepper motors ( sequential or simulaneaous) ...
optionini DOption
Options for DAS execution.
void DB_ChangeColorCellCB(MOBJECT o, MVALUE o_data, void *a_data)
draw the object &#39;o&#39; with the selected color
INT32 MVALUE
Definition: Mguidefs.h:1422
int savingmode
Flag to set saving mode: 0=ASCII, 1=Binary.
#define AMS2
AMS2 address.
int OwnPwdOk
void CloseFontViewCB(MOBJECT p, void *a, void *data)
This callback Unloads the latest loaded font and destroys the dialog.
MOBJECT b_sbar
Definition: DAS_Spatram.h:3057
void MShellRealize(MOBJECT obj)
void LoadFontCB(MOBJECT obj, void *a, void *data)
This callback tries to load the specified font.
dsza SZADelta
Definition: DAS_Spat.c:76
MOBJECT KeyB[28]
Keyboard Buttons.
int NAMS
Number of AMSs Devices.
CARD8 change_cwd
Definition: Mguidefs.h:1485
int TRType
Type of thermo regulation (0=TRTCOOL, 1 = TRTHEAT, 2= TRTBOTH)
MOBJECT SM_multiplier[AMSMAX][2]
char * text
Definition: Mguidefs.h:1389
void MObjectSetUnsensitive(MOBJECT obj)
#define TORQUEM
Torque Motor.
int PCPower
Power to the Peltier for Cooling.
int Wl
Flag for the units on the X scale plot.
void MDrawFilledBox(MOBJECT p, int x, int y, int w, int h, MTColor bgc)
void WriteFontCB(MOBJECT obj, void *a, void *v)
This callback write on file the selected font (Not implemented yet)
MOBJECT r_sbar
Definition: DAS_Spatram.h:3057
int WritewlstepiniCB(MOBJECT shell, void *od, void *ad)
Write wlstep.ini file .
DXL structure. Structure for the serial communication with the AMS adapter.
Definition: DXL.H:16
U8 da_mon
Definition: Dildef.h:243
int plotW
Flag for the plot display.
das structure (contain all the previous structures) .
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 ...
Definition: DSCUD.H:340
void D_UndoCB(MOBJECT o, void *a, void *v)
Undo the previous color setting operation.
int VMRsf
ViewModifyReloadsystemfile: 0 = ViewModify, 1 = Reload.
void DB_AMSProgBar_CB(MOBJECT o, void *a, void *v)
callback selecting if show or not the progress bar for motor positioning
MTColor black
int MObjectGetHeight(MOBJECT obj)
int ccdWx
CCD X End.
MOBJECT MCreateLabel(MOBJECT parent, const char *text, MTFont font)
Control Panel and push buttons colors .
void DB_Shutter_CB(MOBJECT o, void *a, void *v)
callback selecting if the shutter is installed or not
mtcl MTCL
MTColor.
void MObjectSetResize(MOBJECT obj, int resize_w, int resize_h)
MTColor white
#define DOASMODE
execution for DOAS Processing
Union for MGui events.
Definition: Mguidefs.h:828
MTFont button_font
Definition: Mguidefs.h:1501
CARD8 allow_dir_delete
Definition: Mguidefs.h:1493
flag Flag
Structure for different flags.
MOBJECT Sh_Main
Main shell for control panel.
void NovaTypeCB(MOBJECT p, void *od, void *ad)
Callback for NOVA selection.
int darkremove
Flag to set Dark Removal from measurements; motors0 = No Dark Removal, 1 = Dark Removal.
structure for FTP setting
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 False
Definition: Mguidefs.h:236
void MObjectAlign(MOBJECT obj, int h_align, int v_align)
#define XAX
X Axis.
#define R_A
Definition: KEYCODES.H:280
int Offset[16]
Offset of the hardware devices (Input Mirror (5), Grating, Filter Wheel...)
void ModifyConfFileCB(MOBJECT o, void *id, void *a_data)
Modification DAS Configuration files Callback Set if the blind pixels will be displayed or not on the...
unsigned short DigOut
Digital Output.
#define NOVA945GSE
NOVA945GSE (SPATRAM2, GASCODNG1, GASCODNG4)
config Cfg
int slope[AMSMAX][2]
Stepper Motors Slope.
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 ...
#define NOVA6612G2
NOVA6612G2 (not used in TROPOGAS, LIS, GASCODNG2/3)
void ConfigCB(MOBJECT p, void *od, void *ad)
DAS Configuration shell creation callback.
int ccdXoff
CCD X Start.
DSCCB dsccb
void DB_SetXUnitsCB(MOBJECT o, void *id, void *a_data)
Select the X axis Unit mode .
MOBJECT frm4_dr1
MOBJECT step[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "step".
MOBJECT lbl_Par[11]
Parametric Labels of the Control Panel.
char * CodeEq2Name(int code)
code Equipment to Name
Definition: Load.c:371
short DB_Sel[3]
Selected Buttons Colors.
void DB_DispBlindPixCB(MOBJECT o, void *id, void *a_data)
Display Blind Pixel Callback Set if the blind pixels will be displayed or not on the plot window...
void MUnloadFont(MTFont font)
void AMS_PWM(int id, int on, int off)
set the on/off time on the PWM set the on/off time on the PWM.
Definition: Dxl.c:492
int perc2int(int mod, char *string)
translate the percent power in AMS digit unit. The percent power assigned to the motor trough the AMS...
void DB_SetCCDTargetTempCB(MOBJECT o, void *id, void *a_data)
Select the CCD temperature mode .
char * MObjectGetText(MOBJECT obj, char *text)
C_DEF int DI_CloseImage(int s)
MTColor MObjectBackgroundColor(MOBJECT obj)
#define ROTSHUT
Rotating Shutter.
U32 NColors
Definition: Dildef.h:648
int type
int avgautor
autoranging for averaged measurement, 0 = NO AutoR before average; 1 = AutoR before average; ...
S16 dx
Num. of X pixels.
Definition: dcldef.h:1022
MOBJECT MCreateClippedEdit(MOBJECT parent, const char *text, int len, int clip_len, MTFont font)
void SetItalicCB(MOBJECT obj, MVALUE a, void *data)
This callback toggles the Italic attribute.
int FlgBG
Definition: DAS_Spat_Conf.c:91
S16 kind
CCD manufacturer codes CCD code definitions.
Definition: dcldef.h:1021
img Mat[MAXIMG]
Definition: Dildef.h:552
void DB_VMRsfCB(MOBJECT o, void *id, void *a_data)
Set the flag for modification or reload of DAS configuration files Set the VMRsf (View Modify Re-load...
float multiplier[AMSMAX][2]
multiplier, > 0 multiplier, < 0 demultiplier
void MShellUnrealize(MOBJECT obj)
void Peltier(int mod)
Peltier ON/OFF .
Definition: Spat_Device.c:2597
omuthr OMUTHR
void ApplyChCB(MOBJECT shell, void *od, void *ad)
Apply changes in DAS Config callback.
int LoadDB_Options(void)
Load Options. Procedure that load the Options in the file {homedir}/config/Options.INI.
Definition: Load.c:390
void MObjectSetText(MOBJECT obj, const char *text)
void QjLamp(int mod)
QJ Lamp ON/OFF .
Definition: Spat_Device.c:2724
MOBJECT e_fsize
Definition: DAS_Spatram.h:3064
void print2file(FILE *ff, int x, int y, unsigned int m)
Print to file the defective pixel.
void DB_CellResizeCB(MOBJECT obj, DRAWAREA_PREF *pref, void *a_data)
display selected Color
int SZAMax
Maximum SZA for performing measurements.
Definition: DAS_Spat.c:116
MOBJECT g_label
Definition: DAS_Spatram.h:3058
void ColorMapInputCB(MOBJECT obj, MEvent *pe, void *a_data)
Declared but not used.
ids IDS
ID tasks.
int WriteOptioniniCB(MOBJECT shell, void *od, void *ad)
Write Options.ini file .
void TextColorAssignCB(MOBJECT o, MVALUE o_data, void *a_data)
void DB_ShutterType_CB(MOBJECT o, void *a, void *v)
callback selecting the type of installed shutter
image Img
Definition: Dildef.h:675
S16 da_year
Definition: Dildef.h:241
#define U_A
Definition: KEYCODES.H:278
short DB_BG_RButt[3]
Background Radio Buttons.
MTColor MObjectForegroundColor(MOBJECT obj)
MTColor label_fgc
Definition: DAS_Spatram.h:3059
MMouseEvent mouse
Definition: Mguidefs.h:832
MOBJECT shell
Definition: DOASdef.h:66
int MObjectGetWidth(MOBJECT obj)
MOBJECT CP_Sh
Definition: CreateForms.c:85
MOBJECT slope[AMSMAX][2]
Active Control Panel Labels for Stepper Motors "Slope".
void MShellDestroy(MOBJECT obj)
U8 da_day
Definition: Dildef.h:242
int MRButtonGetActivationStatus(MOBJECT o)
MOBJECT MObjectShell(MOBJECT obj)
void UndoFCB(MOBJECT obj, void *a, void *v)
This callback UnDo the font choice (Not implemented yet)
MOBJECT SM_power[AMSMAX][2]
#define LIS_
Lampedusa Island Spectrometer - ENEA.
MOBJECT RBColObj[7]
MOBJECT MCreateTableForm(MOBJECT parent, int n_cols)
#define FIXED_MEDIUM
Definition: Mguidefs.h:879
#define L_A
Definition: KEYCODES.H:281
void DB_Do2Undo_Colors(short docol[], short undocol[])
Control Flags.
void DB_RadioDarkCB(MOBJECT o, void *id, void *a_data)
Set the dark removing from the measurements.
int ccdWy
CCD Y End.
char * EquipCode2Name(int eqcode, char *src, char *dest)
translate the Equipment Code in the Equipment Name
U8 ti_hour
Definition: Dildef.h:236
int ROwnPwdOk
void DB_SelOutModeCB(MOBJECT o, void *id, void *a_data)
Select the Output for the Temperature AD Converter .
#define TROPOGAS
TROPOspheric Gas Analyzer Spectrometer.
File Browser Preferences. Used by the Utility functions MFileBowserExt() and MDirBowserExt().
Definition: Mguidefs.h:1482
int WriteColorsCB(MOBJECT o, void *a, void *v)
Write selected color in DASSysColor.INI.
void Task_LIS_Temp(TIMEOUT_ID id, void *data)
OMU Thermoregulation Task. Provide the thermoregulation of the Optical Mechanical Unit In addition al...
Definition: Chktemp.c:873
void D_Saving(void)
Saving image. Procedure for saving the CCD Image Used since version 2.1.0. The coiche between binary ...
Definition: Procedures.c:1369
int hlinebefore
Number of HiddenLines before the central line in Plot.
void ColorMapResizeCB(MOBJECT obj, DRAWAREA_PREF *pref, void *a_data)
Declared but not used.
MOBJECT lblADvalue[16]
#define E_BUTTON_PRESS
Definition: Mguidefs.h:275
void MDQuitCB(MOBJECT shell, void *od, void *ad)
callback for closing a generic MGUI shell
Definition: REQ.C:40
unsigned int data[576]
Conversion data buffer 64 samples * 8 channels * 2 bytes.
MOBJECT MCreatePButton(MOBJECT parent, const char *text, MTFont font)
int ADTempTest
= 0 -> AD Converter results on the Control Panel; = 1 -> AD Converter Testing Phase(results on the co...
#define FDOUBLE
double filter wheel
void DB_MIGE_CB(MOBJECT o, void *a, void *v)
callback selecting the operation mode for the AltAzPlatform
#define FPLUS
Filter Wheel Torque Motor.
float PID_ki
CARD8 transparent_tree
Definition: Mguidefs.h:1495
d_fileman DFILEM
Definition: bildef.h:257
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
int WriteParaminiCB(MOBJECT shell, void *od, void *ad)
Write Param.ini file .
void FontOBJSelCB(MOBJECT obj, void *a, void *v)
This callback select the object for applying font.
#define CENTER_ALIGN
Definition: Mguidefs.h:917
#define GASCODNG2
GASCODNG 2 (with ATX power supply & HiresIV)
MTFont font
Definition: DAS_Spatram.h:3066
void DB_PlotDisplayCB(MOBJECT o, void *id, void *a_data)
Select if the PLOT will be displayed after the measurement .
d_view DPLOT
Definition: bildef.h:254
DrawArea Object&#39;s resize data.
Definition: Mguidefs.h:1122
#define HELV_SMALL
Definition: Mguidefs.h:881
long MGetNColors(void)
char DIRDCL[_MAX_PATH]
Definition: bildef.h:210
int VBin
CCD Vertical Binning.
paramini structure . It contains some of the parameters defined in the file PARAM.INI .
#define SPATRAM2
SPATRAM2 (with ATX power supply & HiresV)
void MEditSetActCallback(MOBJECT edit, OBJ_STRING_CB cb, void *data)
int CoolPw
CCD Init Power.
#define E_KEY_PRESS
Definition: Mguidefs.h:274
MKeyEvent key
Definition: Mguidefs.h:831
#define FIXED_SMALL
Definition: Mguidefs.h:878
void MDrawText(MOBJECT p, int x, int y, int w, int h, const char *text, MTFont font, MTColor fgc, int align)
int MTFont
Definition: Mguidefs.h:175
void MScrollBarSetPos(MOBJECT p, long pos)
undopal UDPAL
void DB_RadDrkSourceCB(MOBJECT o, void *a, void *v)
Set the dark source.
#define SPATRAMPLUS
As SPATRAM plus AltAzimuth platform.
void MRButtonDeactivate(MOBJECT o)
id&#39;s for different tasks .
MOBJECT SM_step[AMSMAX][2]
void MBeep(void)
void MDrawBox(MOBJECT p, int x, int y, int w, int h, MTColor bgc)
char CONFIGDIREQUIPMENT[_MAX_PATH]
Definition: bildef.h:208
MOBJECT ADInflbl
double MaxSZA
Maximum SZA.
int hertz2int(int mod, char *string)
translate the Hertz speed in AMS digit unit.
const char * MGetCurrentDirectory(void)
int ON_OFFLINEPLOT
Definition: DAS_Spat.c:117
void SetBoldCB(MOBJECT obj, MVALUE a, void *data)
This callback toggles the Bold attribute.
void DB_ColorPick(MOBJECT o)
int sel_cell
Definition: DAS_Spatram.h:3060
void DrawAreaExpFontCB(MOBJECT obj, MEvent *pe, void *data)
This callback draws strings using the selected font.
MTFont MLoadFont(const char *family, int h, int bold, int italic)
int emshutter
Presence of the CCD Shutter, emshutter = 1 –> Shutter IS Installed, = 0 –> Shutter NOT Installed...
mige MIGE
void DB_PlotYAxisCB(MOBJECT o, void *id, void *a_data)
Select the Y axis Unit mode .
int b_c
Definition: DAS_Spatram.h:3060
int FlgFG
Definition: DAS_Spat_Conf.c:92
double DeltaSZA
DeltaSZA.
int DeltaSZA
= 1 Delta SZA measurements activated, = 0 Continous measurements
void ValidateCB(MOBJECT edit, EDIT_VAL *ev, void *ii)
Text Validation callback Validation callback for the text typed in different text box...
short DB_FG_Albl[3]
Foreground ACTIVE Label Colors.
void MEditSetValCallback(MOBJECT edit, EDIT_VAL_CB cb, void *data)
Definition: Dildef.h:240
dftp DFTP
char DBFILENAME[_MAX_PATH]
Definition: bildef.h:204
void CloseColPickCB(MOBJECT obj, void *s, void *v)
Declared but not used.
#define LISTEMP_TASK_TIME
spectrometer termoregulation
#define GASCODNG3
GASCODNG 3 (with ATX power supply & HiresIV)
int GetDefPix(int mod)
Maps the defective pixel.
char ftpuser[32]
FTP server users.
int plotYRange
0 –> full range; 1 –> min/max
int bold
Definition: DAS_Spat_Conf.c:88
int resetFreq
frequency of DAS/Windows Reset
int MFileBrowseExt(const char *t, const char *ext, char *fname, char *dname, FB_PREFS *prefs)
#define VS25
Uniblitz Shutter VS25.
MOBJECT SM_slope[AMSMAX][2]
void MObjectRedraw(MOBJECT obj)
int r_c
Definition: DAS_Spatram.h:3060
ccd cc
double AutoRange(int mod)
Calculate the exposure time The optimum exposure time (TExp) is calculated with an initial TExpAR=0...
Definition: Procedures.c:899
short DB_BG_Plbl[3]
Background PASSIVE Label Colors.
double int2hertz(int mod, int k)
void DB_MIGEType_CB(MOBJECT o, void *a, void *v)
int ADPC104
0 –> Device PC104 exist, 1 –> PC104 DOESN&#39;T exist
pushbutt PushButt
Push buttons.
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
#define GASCODNG1
GASCODNG 1 (with ATX power supply & HiresIV)
Function prototypes.
#define GASCODNG4
GASCODNG 4.
int LoadDasSysCol(void)
Load system colors. Procedure that load the DAS colors in the file {homedir}/config/DASSysColor.INI.
Definition: Load.c:811
double cop_perc[AMSMAX][2]
Stepper Motors Power percent.
unsigned char Port
void DB_RadioFNSelCB(MOBJECT o, void *id, void *a_data)
Set the file name mode.
ptf DC_HP
int TOTTEXP
Total Exposure time in Averaging mode.
Definition: DAS_Spat.c:115
const char * bg_image_file
Definition: Mguidefs.h:1519
int amsprogbar
display/hide prograssion bar, 0 = Hide, 1 = display
MOBJECT g_sbar
Definition: DAS_Spatram.h:3057
char ftpserver[32]
FTP server address.
#define FSIMPLE
simple filter wheel
#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)
doas DOAS
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,...)
S16 dy
Num. of Y pixels.
Definition: dcldef.h:1023
int fraz2val(int mod, char *val)
ratio value to decimal value opposite than listval2fraz or val2fraz
int linked
char lfraz[6]
Definition: DAS_Spat_Conf.c:94
void DB_Do2Undo_Fonts(MTFont dofont, MTFont undofont)
MTColor cell_color
Definition: DAS_Spatram.h:3059
C_DEF void DI_RunHisto(void)
#define YAX
Y Axis.
das DAS
#define SPATRAM3
SPATRAM3.
short DB_BG[3]
Default Background Color.
unsigned short * ImatGraf
Definition: bildef.h:176
double TExp
CCD Exposure time.
Definition: DAS_Spat.c:130
MOBJECT frm3_dr1
Definition: DAS_Spatram.h:3058
void MObjectUnmap(MOBJECT obj)
int FlgOBJ
Definition: DAS_Spat_Conf.c:93
Definition: DOASdef.h:54
short DB_FG_RButt[3]
Foreground Radio Buttons.
nova Nova
NOVA structure.
configpanel ConfigPanel
Configuration panel structure.
double int2perc(int mod, int k)
translate the AMS digit unit in text. The power assigned to the motor trough the AMS, is translated in text
Function prototypes.
structure for AD Tester
void ColObjCB(MOBJECT o, void *a, void *v)
select the object to consider for color picking
Validation data for the EditField Object.
Definition: Mguidefs.h:1387
void DB_TestF(void)
static double p
Definition: SOLPOS.C:131
void ScreenInfoCB(MOBJECT o, void *s, void *v)
int mirrorimg[2]
Flag to set the mirroring of the CCD image: 0 = NO Mirroring, 1= YES Mirroring (element 0 for X axis;...
int LISTEMP
Lis Temperature ID.
char step_fraz[AMSMAX][2][6]
Stepper Motors Step fraction.
void val2fraz(int id, int sn, int val)
Decimal value to ratio value Similar to listval2fraz The decimal value indicating the fractioning of ...
void GetDateTime(struct date *dp, struct time *tp, struct tm *when)
Definition: Save.c:43
void MLabelSetAlignment(MOBJECT p, int align)
int wl[]
WaveLength definition - for SD_Grating.
Definition: DAS_Spat.c:182
int MGetScreenWidth(void)
U8 ti_min
Definition: Dildef.h:235
int pixcorr
Flag to set defective pixel correction: 0=NOT Corrected, 1=Corrected.
controlpanel ContrPanel
Control Panel Structure.
void DB_MirrorImg_CB(MOBJECT o, void *a, void *v)
callback selecting the activation of the mirroring of the CCD image along the X or Y axis ...
int ftpbackup
Flag to set back up: 0 = NO FTP Back-UP; 1 = Perform FTP Back-UP.
void DB_Undo2Do_Fonts(MTFont undofont, MTFont dofont)
int LoadTestPalette(char *nf)
Load a test palette. Procedure that load a test palette.
Definition: Load.c:908
Bortul Image Library Structure .
Definition: bildef.h:250
int CCD_SetupFlg
Definition: DAS_Spat.c:138
Definition: Dildef.h:674
int imgtype
Flag to set Image type: 0=MONOINT, 1=RGB.
MOBJECT rbSHUTType[3]
radio button for SHUTTER type
MOBJECT lbl[5]
Definition: DOASdef.h:60
void ColorSaveCB(MOBJECT o, void *o_data, void *a_data)
Declared but not used.
void ColorMapExposeCB(MOBJECT obj, MEvent *pexp, void *a_data)
Declared but not used.
void MPButtonSetCallback(MOBJECT button, MGUI_CB cb, void *data)
#define D_A
Definition: KEYCODES.H:279
int measmode
measuring mode: 0 = Single; 1 = Averaged
void MAPDefPix(int mod)
create the Under/Over exposed pixels window At the pression of the button in DAS_Config the appropri...
MOBJECT BPDark
void TestFontCB(MOBJECT obj, void *a, void *data)
This callback tries to load the specified font.
void MObjectSetCompositeWidth(MOBJECT obj, int w)
short DB_UnSelFG[3]
Unselected Buttons Colors.
int g_c
Definition: DAS_Spatram.h:3060
MOBJECT rbMIGEtype[5]
radio button for MIGE type
void ColorPickCB(MOBJECT o, void *o_data, void *a_data)
palette DPAL
int settempvar
int speed[AMSMAX][2]
Stepper Motors Speed.
float PID_kp
int step[AMSMAX][2]
Stepper Motors Step.
short DB_UnSel[3]
Unselected Buttons Colors.
void * MOBJECT
Definition: Mguidefs.h:192
Definition: Dildef.h:234
#define True
Definition: Mguidefs.h:235
MOBJECT e_fname
Definition: DAS_Spatram.h:3064
#define LEFT_ALIGN
Definition: Mguidefs.h:915
double speed_Hz[AMSMAX][2]
Stepper Motors Speed [Hz].
MOBJECT b_label
Definition: DAS_Spatram.h:3058
double maxtexp
Maximum exposure time (used in Autorange())
MOBJECT ADpb
int aaopmode
operation mode for the Alt Az Platform, 0 = solar Traxker; 1 = Anti-Solar Tracker; 2 = Free Positioni...
Definition: dcldef.h:1020
unsigned int LevelDefPix
Definition: DAS_Spat.c:126
char ftppwd[32]
FTP server pwd.
void DB_RadioPixCorrCB(MOBJECT o, void *id, void *a_data)
Set the image Correction flag.
Definition: dcldef.h:1043
dil DIL
void ColorFreeCB(MOBJECT o, void *o_data, void *a_data)
Declared but not used.
adtester ADTESTER
void MObjectSetFont(MOBJECT obj, MTFont font, int resize)
void listval2fraz(int mod, int val)
Decimal value to ratio value The decimal value indicating the fractioning of the step is translated i...
flag FLAG
int smposmode
positioning mode for stepper , 0 = sequential mode; 1 = simoultaneous mode
void DB_ColorAssign(MOBJECT a[], int numel, short tc[])
Assign to the selected object the chosen color.
void MObjectMap(MOBJECT obj)
void MAPDefPixCB(MOBJECT o, void *id, void *a_data)
GetDefPix(mod) Callback At the pression of the &#39;Execute&#39; button in the appropriate shell the GetDefPi...
int filename
Flag to set file name mode 0=Free choice, 1 = Automatic.
void MFreeCell(MTColor c)
int MGetScreenHeight(void)
void DB_RadioAvgModeCB(MOBJECT o, void *id, void *a_data)
Set the Averaging mode flag.
int EqType
Spectrometer Type.
void DB_ImgTypeCB(MOBJECT o, void *id, void *a_data)
Set the Image type.
CARD8 allow_dir_rename
Definition: Mguidefs.h:1490
void ApplyImgCB(MOBJECT shell, void *od, void *ad)
Image type Application callback Apply to the CCD buffer the selected type of image (MONO or RGB) ...
#define NOVA7892
NOVA7892 monoboard (old)
MOBJECT rbMIGEopmode[3]
radio button for MIGE operating mode
char CONFIGDIRCOMMON[_MAX_PATH]
Definition: bildef.h:206
unsigned char DigIn
Digital Input.
void DB_FilterType_CB(MOBJECT o, void *a, void *v)
callback selecting the type of installed filter wheel module
void MFreeColor(MTColor col)
void MObjectSetTransparency(MOBJECT obj, CARD8 level)
void MObjectSetForegroundRGB(MOBJECT obj, int r, int g, int b)
void MSetCellColor(MTColor c, int r, int g, int b)
int WriteHardwareiniCB(MOBJECT shell, void *od, void *ad)
Write hardware.ini file .
unsigned focus_leave
Definition: Mguidefs.h:1397
int N_AVG
Number of measurements for Averaging mode in fixed number of meas. mode.
Definition: DAS_Spat.c:113
paramini PARAM
int darksource
Flag to set Dark source: 0 = Blind Pixels, 1 = Full Frame.
int resetEnabled
DAS/Windows reset option (1 = Enabled; 0 = disabled)
int refertemp
Flag to set the reference temp for thermo-regulation: 0 = AVGPINT; 1 = OPTIC; 2 = GRATING...
long wav[]
Step Number definition - for SD_Grating.
Definition: DAS_Spat.c:195
void MShellSetWMCloseCallback(MOBJECT p, WM_CLOSE_CB cb, void *a_data)
C_DEF int DI_FileExist(char *tit)
void MObjectSetSensitive(MOBJECT obj)
int type
type of NOVA monoboard used (7892 or 945GSE)
int resetType
type of period for DAS Reset: 0=Hours, 1=Days
MOBJECT lblCorrPixF
label for name file used for defec pix correction
MOBJECT SM_speed[AMSMAX][2]
int DispBlindPix
Display Blind Pix: 0 = NO, 1 = Yes.
int type
Definition: Mguidefs.h:829
MOBJECT MCreateRowForm(MOBJECT parent)
int x
pointer x, y coordinates in event window
Definition: Mguidefs.h:616
MOBJECT pbBrowseCorrPixF
Push button for file selection.
int ccdYoff
CCD Y Start.
int shuttertype
type of installed shutter: 0 = VS25, 1 = Rotating Shutter, 2 = TorqueMotor
double ITemp
CCD Target Temperature.
unsigned int maxlvlar
maximum level of autoranging (max 65000)
UNDO Control Panel and push buttons colors .
MOBJECT FFDark
MOBJECT power[AMSMAX][2]
active Control Panel Labels for Stepper Motors "power"
#define TOP_ALIGN
Definition: Mguidefs.h:918
void DB_FontAssign(MOBJECT a[], int numel, MTFont fnt)
This callback assign font to the selected object.
int exemode
Set the Execution MODE (Execution modes)
double TPelt
OMU Target Temperature.
void CloseConfigCB(MOBJECT shell, void *od, void *ad)
Close DAS-Config callback close the DAS_Config window. If the testing of the ADConverter is running i...
listf LISTF
void CCDSetupCB(MOBJECT shell, void *od, void *ad)
CCD setup Callback. Execute DCS.exe (DTA Camera Select)
OMU Thermoregulation structure .
int DB_GetCCD(int mod)
Get CCD Image. .
Definition: Procedures.c:1749
MTColor drawarea_bgc
Definition: DAS_Spatram.h:3062
bil BIL
int sel_x
Definition: DAS_Spatram.h:3060
double MinSZA
Minimum SZA.
int undofont
short DB_FG_lblUP[3]
Foreground Capital Letters Labels Color UP.
int WriteAMSCB(MOBJECT shell, void *od, void *ad)
Write AMS.ini file .
C_DEF int DI_OpenImage(U16 dx, U16 dy, U16 ifmt, U16 type, char *tit)
S16 attrib
Definition: Dildef.h:279
void UnderOverPixCB(MOBJECT o, void *id, void *a_data)
Under/Over exposed pixels Callback At the pression of the button in DAS_Config the appropriate shell...
char DEFPIXFILENAME[_MAX_PATH]
defective pixel filename with path
int sel_y
Definition: DAS_Spatram.h:3060
int power[AMSMAX][2]
Stepper Motors Power.
float PID_kd
int italic
Definition: DAS_Spat_Conf.c:89
paramini Paramini
structure for the parameters defined in param.ini configuration file
______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:44:07 for DAS - Rel. 3.1.6 - 18/09/2017.