1 | #include "machdefs.h"
|
---|
2 | #include <stdlib.h>
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <string.h>
|
---|
5 |
|
---|
6 | #include <typeinfo>
|
---|
7 |
|
---|
8 | #include <string>
|
---|
9 | #include <vector>
|
---|
10 |
|
---|
11 | #include "strutil.h"
|
---|
12 | #include "timing.h"
|
---|
13 | #include "perrors.h"
|
---|
14 | #include "ctimer.h"
|
---|
15 |
|
---|
16 | #include "psighand.h"
|
---|
17 |
|
---|
18 | #include "cimage.h" // pour pouvoir faire extract
|
---|
19 |
|
---|
20 | #include "pistdimgapp.h"
|
---|
21 | // #include "pihisto2d.h"
|
---|
22 | #include "psfile.h"
|
---|
23 | #include "piimgtools.h"
|
---|
24 | #include "pidrwtools.h"
|
---|
25 | #include "piaxestools.h"
|
---|
26 |
|
---|
27 | #include "pistzwin.h"
|
---|
28 |
|
---|
29 | #include "piinit.h"
|
---|
30 | #include "piversion.h"
|
---|
31 | #include "piaversion.h"
|
---|
32 |
|
---|
33 |
|
---|
34 | static char ImgDir[256];
|
---|
35 | static char WorkDir[256];
|
---|
36 | // Initialiseur
|
---|
37 | static PIAppInitiator * glst_piai = NULL;
|
---|
38 |
|
---|
39 | // Pour la creation de fenetre info (about piapp)
|
---|
40 | static void createInfoWindow(PIStdImgApp* app);
|
---|
41 | static void deleteInfoWindow();
|
---|
42 | static void showInfoWindow(PIStdImgApp* app);
|
---|
43 | static void hideInfoWindow(PIStdImgApp* app);
|
---|
44 |
|
---|
45 |
|
---|
46 | /* ........................................................... */
|
---|
47 | /* Classe SIA_RU__Periodic : mise a jour periodique de */
|
---|
48 | /* la fenetre Stat/Ressource info */
|
---|
49 | /* + execution de commande soumis de l'exterieur */
|
---|
50 | /* ........................................................... */
|
---|
51 |
|
---|
52 | class SIA_RU__Periodic : public PIPeriodic
|
---|
53 | {
|
---|
54 | public:
|
---|
55 | SIA_RU__Periodic(PIStdImgApp* app);
|
---|
56 | virtual ~SIA_RU__Periodic();
|
---|
57 | virtual void DoPeriodic();
|
---|
58 | private:
|
---|
59 | PIStdImgApp* _app;
|
---|
60 | };
|
---|
61 |
|
---|
62 | SIA_RU__Periodic::SIA_RU__Periodic(PIStdImgApp* app)
|
---|
63 | : PIPeriodX(1)
|
---|
64 | {
|
---|
65 | _app = app;
|
---|
66 | }
|
---|
67 |
|
---|
68 | SIA_RU__Periodic::~SIA_RU__Periodic()
|
---|
69 | {
|
---|
70 | }
|
---|
71 |
|
---|
72 | void SIA_RU__Periodic::DoPeriodic()
|
---|
73 | {
|
---|
74 | if (_app) {
|
---|
75 | _app->ExecuteExtCommand();
|
---|
76 | _app->UpdateStatResourceInfo();
|
---|
77 | }
|
---|
78 | }
|
---|
79 |
|
---|
80 | /* ............................................................. */
|
---|
81 |
|
---|
82 |
|
---|
83 | /* ........................................................... */
|
---|
84 | /* Classe PIStdImgApp */
|
---|
85 | /* ........................................................... */
|
---|
86 |
|
---|
87 | /* --Methode-- */
|
---|
88 | PIStdImgApp::PIStdImgApp(int narg, char* arg[])
|
---|
89 | : PIApplication(420, 320, narg, arg)
|
---|
90 | {
|
---|
91 |
|
---|
92 | // Les menus
|
---|
93 | m[0] = new PIMenu(Menubar(),"Fichier");
|
---|
94 | m[0]->AppendItem("About piapp", 10150);
|
---|
95 | m[0]->AppendItem("Open-Fits", 10120);
|
---|
96 | m[0]->AppendItem("Open-PPF", 10130);
|
---|
97 | // m[0]->AppendItem("Options", 10101);
|
---|
98 | m[0]->AppendItem("Help", 10100);
|
---|
99 | m[0]->AppendSeparator();
|
---|
100 | m[0]->AppendItem("Exit", 10105);
|
---|
101 |
|
---|
102 | m[1] = new PIMenu(Menubar(),"Objets");
|
---|
103 | m[1]->AppendItem("ObjectManager", 10201);
|
---|
104 | m[1]->AppendItem("OpenOutPPF", 10220);
|
---|
105 | m[1]->AppendItem("CloseOutPPF", 10230);
|
---|
106 | m[1]->AppendItem("Delete CurWdg", 10270);
|
---|
107 |
|
---|
108 | m[2] = new PIMenu(Menubar(),"Tools");
|
---|
109 | m[2]->AppendItem("Show ImageTools", 10301);
|
---|
110 | m[2]->AppendItem("Show DrawerTools", 10302);
|
---|
111 | m[2]->AppendItem("Show AxesTools", 10303);
|
---|
112 | m[2]->AppendItem("CxxExecutorWindow", 10304);
|
---|
113 | m[2]->AppendItem("Ext.Pave", 10311);
|
---|
114 | m[2]->SetSensitivityMsg(10311, false);
|
---|
115 | m[2]->AppendItem("Ext.Pave+Org", 10312);
|
---|
116 | m[2]->SetSensitivityMsg(10312, false);
|
---|
117 | m[2]->AppendItem("Cuts X,Y", 10313);
|
---|
118 | m[2]->SetSensitivityMsg(10313, false);
|
---|
119 | mc = new PIMenu(m[2], "StackTools");
|
---|
120 | mc->AppendItem("DispNext", 10320);
|
---|
121 | mc->AppendItem("Blink 0.5s", 10321);
|
---|
122 | mc->AppendItem("Blink 1s", 10322);
|
---|
123 | mc->AppendItem("Blink 2s", 10324);
|
---|
124 | mc->AppendItem("Stop Blink", 10329);
|
---|
125 | mc->AppendItem("RemoveCurrent", 10330);
|
---|
126 | m[2]->AppendPDMenu(mc);
|
---|
127 | m[2]->SetSensitivity("StackTools", false);
|
---|
128 |
|
---|
129 | m[3] = new PIMenu(Menubar(),"Window");
|
---|
130 | m[3]->AppendItem("StackWindow", 10400);
|
---|
131 | m[3]->AppendItem("Window", 10411);
|
---|
132 | m[3]->AppendItem("Window 2x1", 10421);
|
---|
133 | // m[3]->AppendItem("Window 1x2", 10412);
|
---|
134 | m[3]->AppendItem("Window 2x2", 10422);
|
---|
135 | // m[3]->AppendItem("Window 3x1", 10431);
|
---|
136 | m[3]->AppendItem("Window 3x3", 10433);
|
---|
137 | m[3]->AppendItem("Cur->LastWdg", 10441);
|
---|
138 | m[3]->AppendItem("Close CurWin", 10460);
|
---|
139 | m[3]->AppendCheckItem("StatZoomWin", 10470);
|
---|
140 | m[3]->SetStateMsg(10470, true);
|
---|
141 |
|
---|
142 | m[4] = new PIMenu(Menubar(),"PostScript");
|
---|
143 | m[4]->AppendItem("OpenPS", 10501);
|
---|
144 | m[4]->AppendItem("ClosePS", 10505);
|
---|
145 | m[4]->AppendItem("Window->PS", 10511);
|
---|
146 | m[4]->AppendItem("Image->PS", 10515);
|
---|
147 | m[4]->AppendItem("Window->EPS", 10512);
|
---|
148 | m[4]->AppendItem("Image->EPS", 10516);
|
---|
149 | m[4]->SetSensitivityMsg(10515, false);
|
---|
150 | m[4]->SetSensitivityMsg(10516, false);
|
---|
151 |
|
---|
152 | m[5] = new PIMenu(Menubar(),"Special");
|
---|
153 | m[5]->AppendItem("CloseAll", 10601);
|
---|
154 | m[5]->AppendCheckItem("Red.Out/Err", 10602);
|
---|
155 | m[5]->AppendCheckItem("Catch SigFPE", 10603);
|
---|
156 | m[5]->AppendCheckItem("Catch SigSEGV", 10604);
|
---|
157 | m[5]->AppendCheckItem("ObjMgr Verb", 10605);
|
---|
158 | m[5]->AppendItem("CxxExecOption", 10606);
|
---|
159 |
|
---|
160 | m[6] = new PIMenu(Menubar(),"Modules");
|
---|
161 |
|
---|
162 | AppendMenu(m[0]);
|
---|
163 | AppendMenu(m[1]);
|
---|
164 | AppendMenu(m[2]);
|
---|
165 | AppendMenu(m[3]);
|
---|
166 | AppendMenu(m[4]);
|
---|
167 | AppendMenu(m[5]);
|
---|
168 | // AppendMenu(m[6]); Menu Modules vide pour le moment
|
---|
169 |
|
---|
170 | int scsx, scsy;
|
---|
171 | ScreenSize(scsx, scsy);
|
---|
172 | if (scsy <= 600) mFgScSz = 0;
|
---|
173 | else if (scsy <= 800) mFgScSz = 1;
|
---|
174 | else if (scsy <= 1024) mFgScSz = 2;
|
---|
175 | else mFgScSz = 3;
|
---|
176 | int msx = 420+mFgScSz*60;
|
---|
177 | int msy = 320+mFgScSz*40;
|
---|
178 | MainWin()->SetSize(msx, msy);
|
---|
179 |
|
---|
180 | //------------------------------------------------------
|
---|
181 | // On cree un container intermediaire permettant de gerer
|
---|
182 | // le widget zoom, colormap, stats, ...
|
---|
183 |
|
---|
184 | int bss = 100+mFgScSz*15;
|
---|
185 |
|
---|
186 | int statc_szy = bss+10+14+mFgScSz*2+5;
|
---|
187 | statcont = new PIContainer(MainWin(), "ZGCSCont", msx, statc_szy, 0, 0);
|
---|
188 | statcont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
189 |
|
---|
190 | gimv = new PIPixmap(statcont, "GloV", bss, bss, 5, 5);
|
---|
191 | gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
|
---|
192 | zoom = new PIPixmap(statcont, "Zoom", bss, bss, bss+10, 5);
|
---|
193 | zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
|
---|
194 | cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
|
---|
195 | cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
196 |
|
---|
197 | // Widget pour affichage des stats / ressources
|
---|
198 | lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 10);
|
---|
199 | lab_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
200 | lab_mem->SetLabel("MemoryUsage");
|
---|
201 | lab_mem->SetForegroundColor(PI_Red);
|
---|
202 | lab_mem->SetBorderWidth(1);
|
---|
203 | therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 20, 2*bss+20, 35);
|
---|
204 | therm_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
205 | therm_mem->SetThreshold(0.5, 0.75);
|
---|
206 |
|
---|
207 | lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 60);
|
---|
208 | lab_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
209 | lab_cpu->SetLabel("CPUUsage");
|
---|
210 | lab_cpu->SetForegroundColor(PI_Black);
|
---|
211 | lab_cpu->SetBorderWidth(1);
|
---|
212 | therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 20, 2*bss+20, 85);
|
---|
213 | therm_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
214 | therm_cpu->SetThreshold(0.75, 0.90);
|
---|
215 |
|
---|
216 | fg_exc_cmd = false;
|
---|
217 | UpdateStatResourceInfo();
|
---|
218 | resupd_periodic = new SIA_RU__Periodic(this);
|
---|
219 | //resupd_periodic->SetIntervalms(500);
|
---|
220 | resupd_periodic->Start();
|
---|
221 |
|
---|
222 | statcont->Show();
|
---|
223 | // StatZoomWindowSetVisible(true);
|
---|
224 | //------------------------------------------------------
|
---|
225 |
|
---|
226 | //int cpy = bss+10+14+mFgScSz*2+5;
|
---|
227 | int cpy = statc_szy;
|
---|
228 |
|
---|
229 | // Creation d'une console avec gestion des commandes
|
---|
230 | consolecont = new PIContainer(MainWin(), "ConsoleCont", msx, msy-cpy, 0, cpy );
|
---|
231 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
232 | mCons = new PIConsole(consolecont, "Console", 30200, 512, 132, msx, msy-cpy, 0, 0 );
|
---|
233 | mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
234 | mCons->AcceptCmd(true, 50);
|
---|
235 | consolecont->Show();
|
---|
236 | redirecout = false;
|
---|
237 | // RedirectStdOutErr(true); pas par defaut
|
---|
238 |
|
---|
239 | mObjMgr = new NamedObjMgr;
|
---|
240 | mCmd = new PIACmd(mObjMgr, this);
|
---|
241 |
|
---|
242 | // Pas trop de message de la part de NamedObjMgr
|
---|
243 | m[5]->SetStateMsg(10605, false);
|
---|
244 | mObjMgr->SetVerbose(false);
|
---|
245 |
|
---|
246 | char* varenv;
|
---|
247 | ImgDir[0] = WorkDir[0] = '\0';
|
---|
248 | if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
|
---|
249 | if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
|
---|
250 |
|
---|
251 | pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
|
---|
252 | pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
|
---|
253 | pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
|
---|
254 |
|
---|
255 | mObjmgrw = new ObjMgrWind(this);
|
---|
256 | mPpinmgrw = new PPInMgrWind(this);
|
---|
257 |
|
---|
258 | // Attention : A faire apres creation de ObjMgrWind !!!
|
---|
259 | mObjMgr->SetImgApp(this);
|
---|
260 |
|
---|
261 | // Gestion des feneteres widgets et drawers
|
---|
262 | mWId = mDId = mBWId = 0;
|
---|
263 | mCurWin = NULL;
|
---|
264 | mCurWdg = NULL;
|
---|
265 | mLastWdg = NULL;
|
---|
266 | mGrW = NULL;
|
---|
267 | mStW = NULL;
|
---|
268 | mGrIdx = mStIdx = -1;
|
---|
269 |
|
---|
270 | mFCMsg = 0;
|
---|
271 | mFgCWImg = false;
|
---|
272 |
|
---|
273 | // Gestion fichiers PS
|
---|
274 | num_eps = 0;
|
---|
275 | name_ps = "";
|
---|
276 | name_ps = "pia.ps";
|
---|
277 | mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
|
---|
278 |
|
---|
279 | // Gestion OUT-PPF
|
---|
280 | mPpfout = NULL;
|
---|
281 | name_outppf = "";
|
---|
282 |
|
---|
283 | // Attributs graphiques courants
|
---|
284 | mAxesFlags = kBoxAxes | kExtTicks | kLabels;
|
---|
285 | SetInsetLimits(0.4, 0.6, 0.4, 0.6);
|
---|
286 | mAddTitle = true;
|
---|
287 |
|
---|
288 | // Initialisation
|
---|
289 | glst_piai = new PIAppInitiator(this);
|
---|
290 |
|
---|
291 | char buff[128];
|
---|
292 | mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
|
---|
293 | #ifdef SANS_EVOLPLANCK
|
---|
294 | sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
295 | (double)PI_VERSIONNUMBER, (float)PeidaVersion());
|
---|
296 | #else
|
---|
297 | sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
298 | (double)PI_VERSIONNUMBER, glst_piai->Version());
|
---|
299 | #endif
|
---|
300 | mCons->AddStr(buff, PIVA_Blue );
|
---|
301 | mCons->AddStr(" ..........................................\n", PIVA_Blue );
|
---|
302 | // PrintPeidaVersion();
|
---|
303 |
|
---|
304 | pfc_fits->SetPath(ImgDir);
|
---|
305 | pfc_ppf->SetPath(WorkDir);
|
---|
306 | pfc_ps->SetPath(WorkDir);
|
---|
307 |
|
---|
308 | SetReady();
|
---|
309 | }
|
---|
310 |
|
---|
311 | /* --Methode-- */
|
---|
312 | PIStdImgApp::~PIStdImgApp()
|
---|
313 | {
|
---|
314 | int i;
|
---|
315 |
|
---|
316 | // On inactive la fenetre principale
|
---|
317 | // Sinon, ca peut provoquer un SEGV ds delete de console ?? - Reza 07/2000
|
---|
318 | MainWin()->Hide();
|
---|
319 |
|
---|
320 | // Destrucion de tous les objets de NameObjMgr
|
---|
321 | string patt = "/*/*";
|
---|
322 | mObjMgr->DelObjects(patt, true);
|
---|
323 |
|
---|
324 | delete mc;
|
---|
325 | for(i=0; i<7; i++)
|
---|
326 | if (m[i]) delete m[i];
|
---|
327 |
|
---|
328 | WindMList::iterator it;
|
---|
329 | for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
|
---|
330 |
|
---|
331 | delete mObjMgr;
|
---|
332 | delete mCmd;
|
---|
333 |
|
---|
334 | delete zoom;
|
---|
335 | delete gimv;
|
---|
336 | delete cmapv;
|
---|
337 |
|
---|
338 | delete lab_mem;
|
---|
339 | delete therm_mem;
|
---|
340 | delete lab_cpu;
|
---|
341 | delete therm_cpu;
|
---|
342 |
|
---|
343 | delete statcont;
|
---|
344 |
|
---|
345 | delete pfc_fits;
|
---|
346 | delete pfc_ppf;
|
---|
347 | delete pfc_ps;
|
---|
348 |
|
---|
349 | delete mCons;
|
---|
350 | delete consolecont;
|
---|
351 |
|
---|
352 | delete mObjmgrw;
|
---|
353 | delete mPpinmgrw;
|
---|
354 |
|
---|
355 | deleteInfoWindow();
|
---|
356 |
|
---|
357 | // Les fichiers
|
---|
358 | if (mpsfile) delete mpsfile;
|
---|
359 | if (mPpfout) delete mPpfout;
|
---|
360 |
|
---|
361 | if (resupd_periodic) delete resupd_periodic;
|
---|
362 |
|
---|
363 | if (glst_piai) delete glst_piai; glst_piai = NULL;
|
---|
364 |
|
---|
365 | }
|
---|
366 |
|
---|
367 | /* --Methode-- */
|
---|
368 | void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
|
---|
369 | {
|
---|
370 | PIWdg *sndw;
|
---|
371 | PIMessage tmsg, smm;
|
---|
372 |
|
---|
373 | tmsg = msg;
|
---|
374 | msg = UserMsg(msg);
|
---|
375 | smm = ModMsg(tmsg);
|
---|
376 |
|
---|
377 | //printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
|
---|
378 | if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
|
---|
379 |
|
---|
380 | // Messages active-window
|
---|
381 | if (smm == PIMsg_Active)
|
---|
382 | {
|
---|
383 | sndw = dynamic_cast<PIWdg *>(sender);
|
---|
384 | switch(sndw->kind())
|
---|
385 | {
|
---|
386 | case PIWindow::ClassId :
|
---|
387 | mCurWin = dynamic_cast<PIWindow *>(sndw);
|
---|
388 | break;
|
---|
389 |
|
---|
390 | case PIScDrawWdg::ClassId :
|
---|
391 | case PIDraw3DWdg::ClassId :
|
---|
392 | mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
|
---|
393 | // cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
|
---|
394 | if (mFgCWImg) {
|
---|
395 | // cerr << "*DBG* ImgTools -> NonSensitive " << endl;
|
---|
396 | m[2]->SetSensitivityMsg(10311, false);
|
---|
397 | m[2]->SetSensitivityMsg(10312, false);
|
---|
398 | m[2]->SetSensitivityMsg(10313, false);
|
---|
399 | m[4]->SetSensitivityMsg(10515, false);
|
---|
400 | m[4]->SetSensitivityMsg(10516, false);
|
---|
401 | mFgCWImg = false;
|
---|
402 | }
|
---|
403 | break;
|
---|
404 | case PIImage::ClassId :
|
---|
405 | mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
|
---|
406 | if (!mFgCWImg) {
|
---|
407 | // cerr << "*DBG* ImgTools -> Sensitive " << endl;
|
---|
408 | m[2]->SetSensitivityMsg(10311, true);
|
---|
409 | m[2]->SetSensitivityMsg(10312, true);
|
---|
410 | m[2]->SetSensitivityMsg(10313, true);
|
---|
411 | m[4]->SetSensitivityMsg(10515, true);
|
---|
412 | m[4]->SetSensitivityMsg(10516, true);
|
---|
413 | mFgCWImg = true;
|
---|
414 | }
|
---|
415 | break;
|
---|
416 | /*
|
---|
417 | default :
|
---|
418 | mCurWdg = NULL;
|
---|
419 | if (mFgCWImg) {
|
---|
420 | m[2]->SetSensitivityMsg(10311, false);
|
---|
421 | m[2]->SetSensitivityMsg(10312, false);
|
---|
422 | m[2]->SetSensitivityMsg(10313, false);
|
---|
423 | m[4]->SetSensitivityMsg(10515, false);
|
---|
424 | m[4]->SetSensitivityMsg(10516, false);
|
---|
425 | mFgCWImg = false;
|
---|
426 | }
|
---|
427 | break;
|
---|
428 | */
|
---|
429 | }
|
---|
430 | }
|
---|
431 | // Message window-close
|
---|
432 | else if (smm == PIMsg_Close)
|
---|
433 | {
|
---|
434 | sndw = (PIWdg *)sender;
|
---|
435 | if(sndw->kind() == PIWindow::ClassId)
|
---|
436 | {
|
---|
437 | mCurWin = (PIWindow *)sender;
|
---|
438 | if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
|
---|
439 | DeleteWindow(mCurWin);
|
---|
440 | }
|
---|
441 | else
|
---|
442 | printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
|
---|
443 | (int)tmsg, (int)sndw->kind(), (long)sender);
|
---|
444 | }
|
---|
445 |
|
---|
446 | // Traitement des messages des menus
|
---|
447 | else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
|
---|
448 | else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
|
---|
449 | else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
|
---|
450 | else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
|
---|
451 | else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
|
---|
452 | else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
|
---|
453 | else if ( msg == 30200 ) { // Objet PIConsole
|
---|
454 | string s = mCons->GetCmdString();
|
---|
455 | // string s2 = "\nExecuting " + s + "\n";
|
---|
456 | mCons->AddStr("Cmd> ", PIVA_Blue, false);
|
---|
457 | // s2 = s + "\n";
|
---|
458 | mCons->AddStr(s.c_str(), PIVA_Blue|PIVA_Bold, false);
|
---|
459 | mCons->AddChar('\n', PIVA_Def, true);
|
---|
460 | SetBusy();
|
---|
461 | #ifdef SANS_EVOLPLANCK
|
---|
462 | TRY {
|
---|
463 | mCmd->Interpret(s);
|
---|
464 | } CATCH(merr) {
|
---|
465 | fflush(stdout);
|
---|
466 | cout << endl;
|
---|
467 | cerr << endl;
|
---|
468 | string es = PeidaExc(merr);
|
---|
469 | cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
|
---|
470 | }
|
---|
471 | #else
|
---|
472 | try {
|
---|
473 | mCmd->Interpret(s);
|
---|
474 | }
|
---|
475 | catch ( PThrowable & exc ) {
|
---|
476 | cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
|
---|
477 | << (string)typeid(exc).name() << " Msg= "
|
---|
478 | << exc.Msg() << endl;
|
---|
479 | cout << endl;
|
---|
480 | }
|
---|
481 | catch ( ... ) {
|
---|
482 | cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ..."
|
---|
483 | << endl;
|
---|
484 | cout << endl;
|
---|
485 | }
|
---|
486 |
|
---|
487 | #endif
|
---|
488 | SetReady();
|
---|
489 | }
|
---|
490 |
|
---|
491 | else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
|
---|
492 | (int)tmsg,(int)msg,(int)smm);
|
---|
493 |
|
---|
494 |
|
---|
495 | return;
|
---|
496 | }
|
---|
497 |
|
---|
498 | /* --Methode-- */
|
---|
499 | void PIStdImgApp::SetReady()
|
---|
500 | {
|
---|
501 | mCons->SetSensitive();
|
---|
502 | gimv->SetSensitive();
|
---|
503 | PIApplication::SetReady();
|
---|
504 | }
|
---|
505 |
|
---|
506 | /* --Methode-- */
|
---|
507 | void PIStdImgApp::SetBusy()
|
---|
508 | {
|
---|
509 | mCons->SetUnSensitive();
|
---|
510 | gimv->SetUnSensitive();
|
---|
511 | PIApplication::SetBusy();
|
---|
512 | // Attention : Appel XSync specifique X11 - en attendant multi-thread
|
---|
513 | XSync(PIXDisplay(), False);
|
---|
514 | }
|
---|
515 |
|
---|
516 | /* --Methode-- */
|
---|
517 | void PIStdImgApp::SetBlocked()
|
---|
518 | {
|
---|
519 | mCons->SetUnSensitive();
|
---|
520 | gimv->SetUnSensitive();
|
---|
521 | PIApplication::SetBlocked();
|
---|
522 | // Attention : Appel XSync specifique X11 - en attendant multi-thread
|
---|
523 | XSync(PIXDisplay(), False);
|
---|
524 | }
|
---|
525 |
|
---|
526 |
|
---|
527 | /* --Methode-- */
|
---|
528 | int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop, int oid)
|
---|
529 | {
|
---|
530 | PIImage* pii;
|
---|
531 | PIWindow* win;
|
---|
532 | int sx, sy, px, py, flag;
|
---|
533 |
|
---|
534 | if (nouv == NULL)
|
---|
535 | {
|
---|
536 | printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
|
---|
537 | return(-1);
|
---|
538 | }
|
---|
539 |
|
---|
540 | if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
|
---|
541 | {
|
---|
542 | printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
|
---|
543 | nouv->XSize(), nouv->YSize());
|
---|
544 | return(-1);
|
---|
545 | }
|
---|
546 |
|
---|
547 | // On decode les options graphiques
|
---|
548 | vector<string> opts;
|
---|
549 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
550 |
|
---|
551 | // Pas de same ou inset pour DispImage
|
---|
552 | if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next;
|
---|
553 |
|
---|
554 | // Choix de la taille de fenetre
|
---|
555 | #define MINPIIMGSIZE 100
|
---|
556 | sx = (nouv->XSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
|
---|
557 | sy = (nouv->YSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
|
---|
558 | if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
|
---|
559 | if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
|
---|
560 | px = py = 0;
|
---|
561 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
562 | pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
|
---|
563 | pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
564 | pii->SetZoomWin(zoom, false);
|
---|
565 | pii->SetGloVWin(gimv, false);
|
---|
566 | pii->SetCMapWin(cmapv, false);
|
---|
567 | pii->ShowCursor(true);
|
---|
568 | pii->SetUserData(NULL, oid);
|
---|
569 |
|
---|
570 |
|
---|
571 | // On recalcule la taille de la fenetre si Disp_Win
|
---|
572 | if (dwopt == Disp_Win) {
|
---|
573 | int sx2 = (int)((float)nouv->XSize()*pii->GetZoomF());
|
---|
574 | int sy2 = (int)((float)nouv->YSize()*pii->GetZoomF());
|
---|
575 |
|
---|
576 | if (sx2 > 400+mFgScSz*100) sx2 = 400+mFgScSz*100;
|
---|
577 | if (sy2 > 400+mFgScSz*100) sy2 = 400+mFgScSz*100;
|
---|
578 | if (sx2 < MINPIIMGSIZE) sx = MINPIIMGSIZE;
|
---|
579 | if (sy2 < MINPIIMGSIZE) sy = MINPIIMGSIZE;
|
---|
580 | if ((sx2 != sx) || (sy2 != sy)) win->SetSize(sx2, sy2);
|
---|
581 | }
|
---|
582 |
|
---|
583 | pii->SetImage(nouv, true, false);
|
---|
584 |
|
---|
585 | // decode des options en chaine de caracteres
|
---|
586 | pii->DecodeOptionString(mDefaultAtt, false); // d'abord les options par defaut
|
---|
587 | pii->DecodeOptionString(opts); // ensuite, les options specifies en argument
|
---|
588 |
|
---|
589 | // printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
|
---|
590 | mCurWin = win;
|
---|
591 | mCurWdg = pii;
|
---|
592 | mLastWdg = pii;
|
---|
593 | mBWId++;
|
---|
594 | mBWList[mBWId] = pii;
|
---|
595 | // pii->Refresh();
|
---|
596 | pii->Apply();
|
---|
597 | cmapv->Refresh();
|
---|
598 | return(mBWId);
|
---|
599 | }
|
---|
600 |
|
---|
601 |
|
---|
602 | /* --Methode-- */
|
---|
603 | int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, string const& sop,
|
---|
604 | string title, int oid)
|
---|
605 | {
|
---|
606 | if (scd == NULL)
|
---|
607 | {
|
---|
608 | printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
|
---|
609 | return(-1);
|
---|
610 | }
|
---|
611 |
|
---|
612 | // On decode les options graphiques
|
---|
613 | vector<string> opts;
|
---|
614 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
615 | if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
|
---|
616 | // Trace en superpoistion
|
---|
617 | if ( (dwopt == Disp_Same) && (mLastWdg) ) {
|
---|
618 | // Les options
|
---|
619 | scd->DecodeOptionString(mDefaultAtt, false);
|
---|
620 | scd->DecodeOptionString(opts, true);
|
---|
621 |
|
---|
622 | if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
|
---|
623 | else mLastWdg->AddDrawer(scd, true, true, true);
|
---|
624 | scd->Refresh();
|
---|
625 | mDId++;
|
---|
626 | mDrwList[mDId] = scd;
|
---|
627 | return(-mDId);
|
---|
628 | }
|
---|
629 | // Trace en medaillon
|
---|
630 | else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
|
---|
631 | PIGrCoord x1, x2, y1, y2;
|
---|
632 | x1 = mIXmin; x2 = mIXmax;
|
---|
633 | y2 = 1.-mIYmin; y1 = 1.-mIYmax;
|
---|
634 | // Les options
|
---|
635 | scd->DecodeOptionString(mDefaultAtt, false);
|
---|
636 | scd->DecodeOptionString(opts, true);
|
---|
637 |
|
---|
638 | scd->SetAxesFlags(mAxesFlags);
|
---|
639 | scd->UpdateLimits();
|
---|
640 | mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
|
---|
641 | scd->Refresh();
|
---|
642 | mDId++;
|
---|
643 | mDrwList[mDId] = scd;
|
---|
644 | return(-mDId);
|
---|
645 | }
|
---|
646 |
|
---|
647 | // Creation d'un nouveau PIScDrawWdg
|
---|
648 | PIWindow* win;
|
---|
649 | PIScDrawWdg* scw;
|
---|
650 | int sx, sy, px, py, flag;
|
---|
651 | sx = 200+mFgScSz*100;
|
---|
652 | sy = 200+mFgScSz*100;
|
---|
653 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
654 |
|
---|
655 | scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
|
---|
656 | scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
657 | scw->SetUserData(NULL, oid);
|
---|
658 |
|
---|
659 | // Decodage des options :
|
---|
660 | vector<string> scwatt;
|
---|
661 | scw->SetAxesFlags(mAxesFlags);
|
---|
662 | if ( mDefaultAtt.size() > 0) {
|
---|
663 | scwatt = mDefaultAtt;
|
---|
664 | scw->DecodeOptionString(scwatt, true);
|
---|
665 | }
|
---|
666 | if ( mAxesAtt.size() > 0) {
|
---|
667 | scwatt = mAxesAtt;
|
---|
668 | scw->DecodeOptionString(scwatt, true);
|
---|
669 | }
|
---|
670 | if (opts.size() > 0)
|
---|
671 | scd->DecodeOptionString(opts, true);
|
---|
672 | if (opts.size() > 0)
|
---|
673 | scw->DecodeOptionString(opts, false);
|
---|
674 |
|
---|
675 | // Titre du plot
|
---|
676 | if (mAddTitle) {
|
---|
677 | if (title.length() <= 0) title = name; string t2="";
|
---|
678 | scw->SetTitles(title, t2);
|
---|
679 | }
|
---|
680 |
|
---|
681 | scw->AddScDrawer(scd, true);
|
---|
682 | // scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
|
---|
683 |
|
---|
684 | mCurWin = win;
|
---|
685 | mCurWdg = scw;
|
---|
686 | mLastWdg = scw;
|
---|
687 | mBWId++;
|
---|
688 | mBWList[mBWId] = scw;
|
---|
689 | return(mBWId);
|
---|
690 | }
|
---|
691 |
|
---|
692 | /* --Methode-- */
|
---|
693 | int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, string const& sop,
|
---|
694 | string title, int oid)
|
---|
695 | {
|
---|
696 | if (dr3 == NULL)
|
---|
697 | {
|
---|
698 | printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
|
---|
699 | return(-1);
|
---|
700 | }
|
---|
701 |
|
---|
702 | // On decode les options graphiques
|
---|
703 | vector<string> opts;
|
---|
704 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
705 |
|
---|
706 | if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
|
---|
707 | // Trace en superpoistion
|
---|
708 | if ( (dwopt == Disp_Same) && (mLastWdg) ) {
|
---|
709 | // Les options
|
---|
710 | dr3->DecodeOptionString(mDefaultAtt, false);
|
---|
711 | dr3->DecodeOptionString(opts, true);
|
---|
712 |
|
---|
713 | if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
|
---|
714 | else mLastWdg->AddDrawer(dr3, true, true, true);
|
---|
715 | dr3->Refresh();
|
---|
716 | mDId++;
|
---|
717 | mDrwList[mDId] = dr3;
|
---|
718 | return(-mDId);
|
---|
719 | }
|
---|
720 | // Trace en medaillon
|
---|
721 | else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
|
---|
722 | PIGrCoord x1, x2, y1, y2;
|
---|
723 | x1 = mIXmin; x2 = mIXmax;
|
---|
724 | y2 = 1.-mIYmin; y1 = 1.-mIYmax;
|
---|
725 | // Les options
|
---|
726 | dr3->DecodeOptionString(mDefaultAtt, false);
|
---|
727 | dr3->DecodeOptionString(opts, true);
|
---|
728 |
|
---|
729 | dr3->SetAxesFlags(mAxesFlags);
|
---|
730 | dr3->UpdateLimits();
|
---|
731 | mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
|
---|
732 | dr3->Refresh();
|
---|
733 | mDId++;
|
---|
734 | mDrwList[mDId] = dr3;
|
---|
735 | return(-mDId);
|
---|
736 | }
|
---|
737 |
|
---|
738 |
|
---|
739 | PIWindow* win;
|
---|
740 | int sx, sy, px, py, flag;
|
---|
741 | sx = 200+mFgScSz*100;
|
---|
742 | sy = 200+mFgScSz*100;
|
---|
743 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
744 | PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
|
---|
745 | wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
746 | wd3->SetUserData(NULL, oid);
|
---|
747 |
|
---|
748 | // Decodage des options :
|
---|
749 | vector<string> scwatt;
|
---|
750 | // wd3->SetAxesFlags(mAxesFlags); Attributs d'axes 3D a faire
|
---|
751 | if ( mDefaultAtt.size() > 0) {
|
---|
752 | scwatt = mDefaultAtt;
|
---|
753 | wd3->DecodeOptionString(scwatt, true);
|
---|
754 | }
|
---|
755 | if ( mAxesAtt.size() > 0) {
|
---|
756 | scwatt = mAxesAtt;
|
---|
757 | wd3->DecodeOptionString(scwatt, true);
|
---|
758 | }
|
---|
759 | if (opts.size() > 0)
|
---|
760 | dr3->DecodeOptionString(opts, true);
|
---|
761 | if (opts.size() > 0)
|
---|
762 | wd3->DecodeOptionString(opts, false);
|
---|
763 |
|
---|
764 | // Titre du plot
|
---|
765 | if (mAddTitle) {
|
---|
766 | if (title.length() <= 0) title = name; string t2="";
|
---|
767 | wd3->SetTitles(title, t2);
|
---|
768 | }
|
---|
769 |
|
---|
770 | wd3->AddDrawer3D(dr3, true);
|
---|
771 | // wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
|
---|
772 |
|
---|
773 | mCurWin = win;
|
---|
774 | mCurWdg = wd3;
|
---|
775 | mLastWdg = wd3;
|
---|
776 | mBWId++;
|
---|
777 | mBWList[mBWId] = wd3;
|
---|
778 | return(mBWId);
|
---|
779 | }
|
---|
780 |
|
---|
781 | /* --Methode-- */
|
---|
782 | int PIStdImgApp::ExecuteExtCommand()
|
---|
783 | {
|
---|
784 | if (!fg_exc_cmd) return(0);
|
---|
785 | else {
|
---|
786 | fg_exc_cmd = false;
|
---|
787 | return CmdInterpreter()->Interpret(exc_command);
|
---|
788 | }
|
---|
789 | }
|
---|
790 |
|
---|
791 | /* --Methode-- */
|
---|
792 | void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
|
---|
793 | {
|
---|
794 | PIDrawer *eld=CurrentElDrawer();
|
---|
795 | if (eld == NULL) return;
|
---|
796 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
797 | PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
|
---|
798 | if ((eld2 == NULL) && (eld3 == NULL)) return;
|
---|
799 | PIElDrwMgr* elmgr;
|
---|
800 | if (eld2) elmgr = &(eld2->ElDrwMgr());
|
---|
801 | else if (eld3) elmgr = &(eld3->ElDrwMgr());
|
---|
802 | if (elmgr == NULL) return;
|
---|
803 |
|
---|
804 | vector<string> opts;
|
---|
805 | ParseDisplayOption(sop, opts);
|
---|
806 | PIGraphicAtt gratt(opts);
|
---|
807 | elmgr->ElAddText(xp,yp,txt.c_str(), gratt);
|
---|
808 | eld->Refresh();
|
---|
809 | }
|
---|
810 |
|
---|
811 | /* --Methode-- */
|
---|
812 | void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop)
|
---|
813 | {
|
---|
814 | PIDrawer *eld=CurrentElDrawer();
|
---|
815 | if (eld == NULL) return;
|
---|
816 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
817 | PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
|
---|
818 | if ((eld2 == NULL) && (eld3 == NULL)) return;
|
---|
819 | PIElDrwMgr* elmgr = NULL;
|
---|
820 | if (eld2) elmgr = &(eld2->ElDrwMgr());
|
---|
821 | else if (eld3) elmgr = &(eld3->ElDrwMgr());
|
---|
822 | if (elmgr == NULL) return;
|
---|
823 |
|
---|
824 | vector<string> opts;
|
---|
825 | ParseDisplayOption(sop, opts);
|
---|
826 | PIGraphicAtt gratt(opts);
|
---|
827 | elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt);
|
---|
828 | eld->Refresh();
|
---|
829 | }
|
---|
830 |
|
---|
831 | /* --Methode-- */
|
---|
832 | void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
|
---|
833 | string const& sop, bool fgfill)
|
---|
834 | {
|
---|
835 | PIDrawer *eld=CurrentElDrawer();
|
---|
836 | if (eld == NULL) return;
|
---|
837 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
838 | PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
|
---|
839 | if ((eld2 == NULL) && (eld3 == NULL)) return;
|
---|
840 | PIElDrwMgr* elmgr = NULL;
|
---|
841 | if (eld2) elmgr = &(eld2->ElDrwMgr());
|
---|
842 | else if (eld3) elmgr = &(eld3->ElDrwMgr());
|
---|
843 |
|
---|
844 | double xp,yp;
|
---|
845 | double dx, dy;
|
---|
846 | if (xp1 < xp2) {
|
---|
847 | xp = xp1; dx = xp2-xp1;
|
---|
848 | }
|
---|
849 | else {
|
---|
850 | xp = xp2; dx = xp1-xp2;
|
---|
851 | }
|
---|
852 | if (yp1 < yp2) {
|
---|
853 | yp = yp1; dy = yp2-yp1;
|
---|
854 | }
|
---|
855 | else {
|
---|
856 | yp = yp2; dy = yp1-yp2;
|
---|
857 | }
|
---|
858 |
|
---|
859 | vector<string> opts;
|
---|
860 | ParseDisplayOption(sop, opts);
|
---|
861 | PIGraphicAtt gratt(opts);
|
---|
862 |
|
---|
863 | if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt);
|
---|
864 | else elmgr->ElAddRect(xp, yp, dx, dy, gratt);
|
---|
865 | eld->Refresh();
|
---|
866 | }
|
---|
867 |
|
---|
868 | /* --Methode-- */
|
---|
869 | void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
|
---|
870 | {
|
---|
871 | PIDrawer *eld=CurrentElDrawer();
|
---|
872 | if (eld == NULL) return;
|
---|
873 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
874 | PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
|
---|
875 | if ((eld2 == NULL) && (eld3 == NULL)) return;
|
---|
876 | PIElDrwMgr* elmgr = NULL;
|
---|
877 | if (eld2) elmgr = &(eld2->ElDrwMgr());
|
---|
878 | else if (eld3) elmgr = &(eld3->ElDrwMgr());
|
---|
879 |
|
---|
880 | vector<string> opts;
|
---|
881 | ParseDisplayOption(sop, opts);
|
---|
882 | PIGraphicAtt gratt(opts);
|
---|
883 |
|
---|
884 | if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt);
|
---|
885 | else elmgr->ElAddCirc(xc, yc, r, gratt);
|
---|
886 | eld->Refresh();
|
---|
887 | }
|
---|
888 |
|
---|
889 | /* --Methode-- */
|
---|
890 | void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom, string const& sop)
|
---|
891 | {
|
---|
892 | PIDrawer *eld=CurrentElDrawer();
|
---|
893 | if (eld == NULL) return;
|
---|
894 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
895 | PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
|
---|
896 | if ((eld2 == NULL) && (eld3 == NULL)) return;
|
---|
897 |
|
---|
898 | vector<string> opts;
|
---|
899 | ParseDisplayOption(sop, opts);
|
---|
900 | PIGraphicAtt gratt(opts);
|
---|
901 |
|
---|
902 | if (eld2) {
|
---|
903 | eld2->SetTitles(titletop, titlebottom, gratt);
|
---|
904 | eld2->ShowTitles(true);
|
---|
905 | }
|
---|
906 | else if (eld3) {
|
---|
907 | eld3->SetTitles(titletop, titlebottom, gratt);
|
---|
908 | eld3->ShowTitles(true);
|
---|
909 | }
|
---|
910 | eld->Refresh();
|
---|
911 | }
|
---|
912 | /* --Methode-- */
|
---|
913 | void PIStdImgApp::SetAxeLabels(string const & xLabel, string const & yLabel, string const& sop)
|
---|
914 | {
|
---|
915 | PIDrawer *eld=CurrentElDrawer();
|
---|
916 | if (eld == NULL) return;
|
---|
917 | PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
|
---|
918 | if (eld2 == NULL) return;
|
---|
919 |
|
---|
920 | vector<string> opts;
|
---|
921 | ParseDisplayOption(sop, opts);
|
---|
922 | PIGraphicAtt gratt(opts);
|
---|
923 |
|
---|
924 | eld2->SetAxesLabels(xLabel, yLabel, gratt);
|
---|
925 | eld2->ShowAxesLabels(true);
|
---|
926 |
|
---|
927 | eld->Refresh();
|
---|
928 | }
|
---|
929 |
|
---|
930 | /* --Methode-- */
|
---|
931 | PIDrawer* PIStdImgApp::CurrentElDrawer()
|
---|
932 | {
|
---|
933 | PIDrawer *eld=NULL;
|
---|
934 | if (!mLastWdg) return(eld);
|
---|
935 | PIScDrawWdg* sdw=NULL;
|
---|
936 | PIDraw3DWdg* w3d=NULL;
|
---|
937 | PIImage* imgw;
|
---|
938 | switch(mLastWdg->kind()) {
|
---|
939 | case PIScDrawWdg::ClassId :
|
---|
940 | sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
|
---|
941 | if (sdw) eld = sdw->BaseDrawer();
|
---|
942 | break;
|
---|
943 | case PIDraw3DWdg::ClassId :
|
---|
944 | w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
|
---|
945 | if (w3d) eld = w3d->BaseDrawer();
|
---|
946 | break;
|
---|
947 | case PIImage::ClassId :
|
---|
948 | imgw = dynamic_cast<PIImage *>(mLastWdg);
|
---|
949 | if (imgw) eld = imgw->BaseDrawer();
|
---|
950 | break;
|
---|
951 | default :
|
---|
952 | break;
|
---|
953 | }
|
---|
954 | return(eld);
|
---|
955 | }
|
---|
956 |
|
---|
957 | /* --Methode-- */
|
---|
958 | void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
|
---|
959 | {
|
---|
960 | if (nx < 1) nx = 1;
|
---|
961 | if (ny < 1) ny = 1;
|
---|
962 | if (nx > 8) nx = 8;
|
---|
963 | if (ny > 8) ny = 8;
|
---|
964 | if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
|
---|
965 | char buff[64];
|
---|
966 | mWId++;
|
---|
967 | int px, py;
|
---|
968 | MainWin()->GetScreenPos(px, py);
|
---|
969 | sprintf(buff, "PI-GraphicWin (%d)",mWId);
|
---|
970 | PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
|
---|
971 | win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
|
---|
972 | mWList[mWId*10+1] = (PIWindow*)win;
|
---|
973 | win->SetAutoDelChilds(true);
|
---|
974 | // win->Show();
|
---|
975 | mGrW = win;
|
---|
976 | mGrIdx = 0;
|
---|
977 | }
|
---|
978 |
|
---|
979 | /* --Methode-- */
|
---|
980 | void PIStdImgApp::CreateStackWin(int sx, int sy)
|
---|
981 | {
|
---|
982 | if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
|
---|
983 | char buff[64];
|
---|
984 | mWId++;
|
---|
985 | int px, py;
|
---|
986 | MainWin()->GetScreenPos(px, py);
|
---|
987 | sprintf(buff, "PI-StackWin (%d)",mWId);
|
---|
988 | PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
|
---|
989 | win->SetUserData(NULL, 9999); // UserFlag= 9999
|
---|
990 | mWList[mWId*10+2] = (PIWindow*)win;
|
---|
991 | win->SetAutoDelChilds(true);
|
---|
992 | // win->Show();
|
---|
993 | mStW = win;
|
---|
994 | m[2]->SetSensitivity("StackTools", true);
|
---|
995 | mStIdx = 0;
|
---|
996 | }
|
---|
997 |
|
---|
998 | /* --Methode-- */
|
---|
999 | PIWindow* PIStdImgApp::GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
|
---|
1000 | {
|
---|
1001 | PIWindow* rw;
|
---|
1002 |
|
---|
1003 | switch (typ) {
|
---|
1004 | case Disp_Next : // Fenetre graphique courante
|
---|
1005 | case Disp_Default :
|
---|
1006 | {
|
---|
1007 | if (mGrW == NULL) CreateGraphWin();
|
---|
1008 | int nx, ny;
|
---|
1009 | mGrW->NbZone(nx, ny);
|
---|
1010 | PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
|
---|
1011 | // cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
|
---|
1012 | if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
|
---|
1013 | flag = mGrIdx;
|
---|
1014 | mGrIdx = (mGrIdx+1)%(nx*ny);
|
---|
1015 | rw = mGrW;
|
---|
1016 | break;
|
---|
1017 | }
|
---|
1018 |
|
---|
1019 | case Disp_Stack : // Fenetre de type stack (empilement)
|
---|
1020 | {
|
---|
1021 | if (mStW == NULL) CreateStackWin(sx, sy);
|
---|
1022 | px = py = 0;
|
---|
1023 | sx = mStW->XSize();
|
---|
1024 | sy = mStW->YSize();
|
---|
1025 | flag = mStIdx;
|
---|
1026 | mStIdx++;
|
---|
1027 | rw = mStW;
|
---|
1028 | }
|
---|
1029 | break;
|
---|
1030 |
|
---|
1031 | default : // Fenetre ordinaire
|
---|
1032 | {
|
---|
1033 | int pwx, pwy;
|
---|
1034 | MainWin()->GetScreenPos(pwx, pwy);
|
---|
1035 | if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
|
---|
1036 | rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
|
---|
1037 | rw->SetUserData(NULL, 0); // UserFlag= 0
|
---|
1038 | mWId++;
|
---|
1039 | mWList[mWId*10] = rw;
|
---|
1040 | rw->SetAutoDelChilds(true);
|
---|
1041 | // rw->Show();
|
---|
1042 | px = py = 0;
|
---|
1043 | flag = 0;
|
---|
1044 | break;
|
---|
1045 | }
|
---|
1046 | }
|
---|
1047 |
|
---|
1048 | rw->Show();
|
---|
1049 | mCurWin = rw;
|
---|
1050 | return(rw);
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | /* --Methode-- */
|
---|
1054 | void PIStdImgApp::SetZone(int nzx, int nzy)
|
---|
1055 | {
|
---|
1056 | if (!mGrW) CreateGraphWin(nzx, nzy);
|
---|
1057 | else {
|
---|
1058 | int k;
|
---|
1059 | PIWdg* cwd;
|
---|
1060 | for(k=0; k<mGrW->NbChilds(); k++) {
|
---|
1061 | if ((cwd = mGrW->GetChild(k)) == NULL) continue;
|
---|
1062 | DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
|
---|
1063 | }
|
---|
1064 | mGrW->SetZone(nzx, nzy);
|
---|
1065 | }
|
---|
1066 | }
|
---|
1067 |
|
---|
1068 | /* --Methode-- */
|
---|
1069 | void PIStdImgApp::StackWinNext()
|
---|
1070 | {
|
---|
1071 | if (mStW) mStW->DispNext();
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | /* --Methode-- */
|
---|
1075 | void PIStdImgApp::DeleteWindow(PIWindow* w)
|
---|
1076 | {
|
---|
1077 | if (w == NULL) return;
|
---|
1078 | w->Hide();
|
---|
1079 | bool ownwindow=false; // To Check if this is one of our windows
|
---|
1080 | WindMList::iterator it;
|
---|
1081 | for(it = mWList.begin(); it != mWList.end(); it++)
|
---|
1082 | if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
|
---|
1083 | if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
|
---|
1084 | if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
|
---|
1085 | if (w == mCurWin) mCurWin = NULL;
|
---|
1086 |
|
---|
1087 | if (!ownwindow) return; // We do nothing if this is not a window we have created ...
|
---|
1088 |
|
---|
1089 | int k;
|
---|
1090 | PIWdg* cwd;
|
---|
1091 | for(k=0; k<w->NbChilds(); k++) {
|
---|
1092 | if ((cwd = w->GetChild(k)) == NULL) continue;
|
---|
1093 | DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
|
---|
1094 | }
|
---|
1095 | delete w;
|
---|
1096 | return;
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | /* --Methode-- */
|
---|
1100 | void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
|
---|
1101 | {
|
---|
1102 | if (w == NULL) return;
|
---|
1103 | BWMList::iterator it;
|
---|
1104 | for(it = mBWList.begin(); it != mBWList.end(); it++)
|
---|
1105 | if ((*it).second == w) { mBWList.erase(it); break; }
|
---|
1106 | int k;
|
---|
1107 | PIDrawer* drw;
|
---|
1108 | for(k=0; k<w->NbDrawers(); k++) {
|
---|
1109 | if ((drw = w->GetDrawer(k)) == NULL) continue;
|
---|
1110 | DrwMList::iterator itt;
|
---|
1111 | for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
|
---|
1112 | if ((*itt).second == drw) { mDrwList.erase(itt); break; }
|
---|
1113 | }
|
---|
1114 |
|
---|
1115 | if (w == mCurWdg) {
|
---|
1116 | mCurWdg = NULL;
|
---|
1117 | if (mFgCWImg) {
|
---|
1118 | m[4]->SetSensitivityMsg(10515, false);
|
---|
1119 | m[4]->SetSensitivityMsg(10516, false);
|
---|
1120 | mFgCWImg = false;
|
---|
1121 | }
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | if (w == mLastWdg) mLastWdg = NULL;
|
---|
1125 |
|
---|
1126 | PIWdg* pw=NULL;
|
---|
1127 | if (dwin) pw = (PIWdg*)(w->Parent());
|
---|
1128 | //DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
|
---|
1129 | if (dw) delete w;
|
---|
1130 | if (pw && (pw->kind() == PIWindow::ClassId )) {
|
---|
1131 | PIWindow* pww = (PIWindow*) pw;
|
---|
1132 | if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
|
---|
1133 | DeleteWindow((PIWindow*)pw);
|
---|
1134 | }
|
---|
1135 | return;
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 |
|
---|
1139 |
|
---|
1140 | /* --Methode-- */
|
---|
1141 | void PIStdImgApp::DelWRsId(int k)
|
---|
1142 | {
|
---|
1143 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
|
---|
1144 | if (k > 0) { // C'est un BaseWidget
|
---|
1145 | BWMList::iterator it;
|
---|
1146 | it = mBWList.find(k);
|
---|
1147 | if (it == mBWList.end()) return;
|
---|
1148 | PIBaseWdg* wd = (*it).second;
|
---|
1149 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
|
---|
1150 | DeleteBaseWidget(wd, true, true);
|
---|
1151 | }
|
---|
1152 | else { // C'est un drawer
|
---|
1153 | DrwMList::iterator it;
|
---|
1154 | it = mDrwList.find(-k);
|
---|
1155 | if (it == mDrwList.end()) return;
|
---|
1156 | delete (*it).second;
|
---|
1157 | mDrwList.erase(it);
|
---|
1158 | // cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
|
---|
1159 | }
|
---|
1160 | }
|
---|
1161 | /* --Methode-- */
|
---|
1162 | bool PIStdImgApp::CheckWRsId(int k)
|
---|
1163 | {
|
---|
1164 | if (k > 0) { // C'est un BaseWidget
|
---|
1165 | BWMList::iterator it;
|
---|
1166 | it = mBWList.find(k);
|
---|
1167 | if (it == mBWList.end()) return(false);
|
---|
1168 | else return(true);
|
---|
1169 | }
|
---|
1170 | else { // C'est un drawer
|
---|
1171 | DrwMList::iterator it;
|
---|
1172 | it = mDrwList.find(-k);
|
---|
1173 | if (it == mDrwList.end()) return(false);
|
---|
1174 | else return(true);
|
---|
1175 | }
|
---|
1176 | }
|
---|
1177 |
|
---|
1178 | /* --Methode-- */
|
---|
1179 | void PIStdImgApp::StatZoomWindowSetVisible(bool fg)
|
---|
1180 | {
|
---|
1181 |
|
---|
1182 | if (fg) {
|
---|
1183 | consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
|
---|
1184 | int szy = MainWin()->YSize();
|
---|
1185 | MainWin()->SetSize(MainWin()->XSize(), szy+statcont->YSize());
|
---|
1186 | consolecont->SetPos(0, statcont->YSize());
|
---|
1187 | consolecont->SetSize(MainWin()->XSize(), szy);
|
---|
1188 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
1189 | statcont->Show();
|
---|
1190 | m[3]->SetStateMsg(10470, true);
|
---|
1191 | }
|
---|
1192 | else {
|
---|
1193 | statcont->Hide();
|
---|
1194 | consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
|
---|
1195 | MainWin()->SetSize(MainWin()->XSize(), MainWin()->YSize()-statcont->YSize());
|
---|
1196 | consolecont->SetPos(0, 0);
|
---|
1197 | consolecont->SetSize(MainWin()->XSize(), MainWin()->YSize());
|
---|
1198 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
1199 | m[3]->SetStateMsg(10470, false);
|
---|
1200 | }
|
---|
1201 |
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | /* --Methode-- */
|
---|
1205 | void PIStdImgApp::UpdateStatResourceInfo()
|
---|
1206 | {
|
---|
1207 | resusg.Update();
|
---|
1208 | char buff[256];
|
---|
1209 | string lab;
|
---|
1210 | double frac;
|
---|
1211 | sprintf(buff, "Mem: %ld/Max= %ld kb" , (long)resusg.getMemorySize(),
|
---|
1212 | (long)resusg.getMaxMemorySize());
|
---|
1213 | lab = buff;
|
---|
1214 | lab_mem->SetLabel(lab);
|
---|
1215 | frac = (double)resusg.getMemorySize()/(double)resusg.getMaxMemorySize();
|
---|
1216 | therm_mem->SetValue(frac);
|
---|
1217 |
|
---|
1218 | sprintf(buff, "CPU: %ld/elap= %ld ms" , (long)resusg.getCPUTime(),
|
---|
1219 | (long)resusg.getElapsedTime());
|
---|
1220 | lab = buff;
|
---|
1221 | lab_cpu->SetLabel(lab);
|
---|
1222 | therm_cpu->SetValue(resusg.getCPULoad());
|
---|
1223 |
|
---|
1224 | }
|
---|
1225 |
|
---|
1226 | /* --Methode-- */
|
---|
1227 | void PIStdImgApp::RedirectStdOutErr(bool fg)
|
---|
1228 | {
|
---|
1229 | if (fg) {
|
---|
1230 | RedirectOutStream(mCons);
|
---|
1231 | RedirectErrStream(mCons);
|
---|
1232 | m[5]->SetStateMsg(10602, true);
|
---|
1233 | redirecout = true;
|
---|
1234 | }
|
---|
1235 | else {
|
---|
1236 | RedirectOutStream(NULL);
|
---|
1237 | RedirectErrStream(NULL);
|
---|
1238 | m[5]->SetStateMsg(10602, false);
|
---|
1239 | redirecout = false;
|
---|
1240 | }
|
---|
1241 | return;
|
---|
1242 | }
|
---|
1243 |
|
---|
1244 | /* --Methode-- */
|
---|
1245 | void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
|
---|
1246 | {
|
---|
1247 | #ifdef SANS_EVOLPLANCK
|
---|
1248 | PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
|
---|
1249 | #else
|
---|
1250 | SophyaConfigureSignalhandling(fgfpe, fgsegv, true, true);
|
---|
1251 | #endif
|
---|
1252 | m[5]->SetStateMsg(10603, fgfpe);
|
---|
1253 | m[5]->SetStateMsg(10604, fgsegv);
|
---|
1254 | }
|
---|
1255 |
|
---|
1256 | /* --Methode-- */
|
---|
1257 | void PIStdImgApp::CloseAllWindows()
|
---|
1258 | {
|
---|
1259 | WindMList::iterator it;
|
---|
1260 | for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
|
---|
1261 | mWList.clear();
|
---|
1262 | mBWList.clear();
|
---|
1263 | mDrwList.clear();
|
---|
1264 | mGrW = NULL;
|
---|
1265 | mStW = NULL;
|
---|
1266 | mCurWin = NULL;
|
---|
1267 | mCurWdg = NULL;
|
---|
1268 | mLastWdg = NULL;
|
---|
1269 | m[4]->SetSensitivityMsg(10515, false);
|
---|
1270 | m[4]->SetSensitivityMsg(10516, false);
|
---|
1271 | }
|
---|
1272 |
|
---|
1273 | //---------------------------------------------------------------------------
|
---|
1274 | //--------- Gestion des attributs graphiques et autres options de trace -----
|
---|
1275 |
|
---|
1276 | /* --Methode-- */
|
---|
1277 | void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
|
---|
1278 | {
|
---|
1279 | mIXmin = xmin; mIXmax= xmax;
|
---|
1280 | mIYmin = ymin; mIYmax= ymax;
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 | /* --Methode-- */
|
---|
1284 | void PIStdImgApp::SetDefaultGraphicAttributes(string const & opt)
|
---|
1285 | {
|
---|
1286 | ParseDisplayOption(opt, mDefaultAtt);
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | /* --Methode-- */
|
---|
1290 | void PIStdImgApp::SetDefaultAxesAttributes(string const & opt)
|
---|
1291 | {
|
---|
1292 | ParseDisplayOption(opt, mAxesAtt);
|
---|
1293 | }
|
---|
1294 |
|
---|
1295 | /* --Methode-- */
|
---|
1296 | DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts)
|
---|
1297 | {
|
---|
1298 | DispWinEnum rc = Disp_Next;
|
---|
1299 | //DBG cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl;
|
---|
1300 | if (opts.size() > 0) opts.erase(opts.begin(), opts.end());
|
---|
1301 | if (sop.length() < 1) return(rc);
|
---|
1302 | string gratt = sop;
|
---|
1303 | for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
|
---|
1304 | if ( (gratt == "def") || (gratt == "default") ) return(rc);
|
---|
1305 | // On separe en mots espaces par des blancs ou tabulation
|
---|
1306 | size_t p = 0;
|
---|
1307 | size_t q = 0;
|
---|
1308 | size_t l = gratt.length();
|
---|
1309 | string token;
|
---|
1310 | while (q < l) {
|
---|
1311 | p = gratt.find_first_not_of(" \t",q); // au debut d'un token
|
---|
1312 | if (p >= l) break;
|
---|
1313 | q = gratt.find_first_of(" \t",p); // Premier blanc ou tab suivant
|
---|
1314 | if (q<l) token = gratt.substr(p,q-p);
|
---|
1315 | else token = gratt.substr(p);
|
---|
1316 | if (token == "") continue;
|
---|
1317 | // Decodage option fenetre d'affichage (win, next, ...)
|
---|
1318 | if (token == "win") rc = Disp_Win;
|
---|
1319 | else if (token == "same") rc = Disp_Same;
|
---|
1320 | else if (token == "inset") rc = Disp_Inset;
|
---|
1321 | else if (token == "stack") rc = Disp_Stack;
|
---|
1322 | else if (token == "next") rc = Disp_Next;
|
---|
1323 | // Option a etre decode par les drawers, etc ...
|
---|
1324 | else opts.push_back(token);
|
---|
1325 | }
|
---|
1326 |
|
---|
1327 | //DBG cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl;
|
---|
1328 | return (rc);
|
---|
1329 | }
|
---|
1330 |
|
---|
1331 | //---------------------------------------------------------------------------
|
---|
1332 | //------------ Methodes privees (MBProcessx, ...) ----------
|
---|
1333 |
|
---|
1334 | /* --Methode-- */
|
---|
1335 | void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
1336 | {
|
---|
1337 |
|
---|
1338 | switch(msg)
|
---|
1339 | {
|
---|
1340 | case 10150 :
|
---|
1341 | showInfoWindow(this);
|
---|
1342 | break;
|
---|
1343 |
|
---|
1344 | case 10155 :
|
---|
1345 | hideInfoWindow(this);
|
---|
1346 | break;
|
---|
1347 |
|
---|
1348 | case 10100 :
|
---|
1349 | mCmd->ShowHelpWindow();
|
---|
1350 | break;
|
---|
1351 |
|
---|
1352 | case 10120 :
|
---|
1353 | pfc_fits->AcceptNewFile(false);
|
---|
1354 | mFCMsg = 10125;
|
---|
1355 | pfc_fits->SetMsg(mFCMsg);
|
---|
1356 | SetBlocked();
|
---|
1357 | pfc_fits->Show();
|
---|
1358 | break;
|
---|
1359 |
|
---|
1360 | case 10125 :
|
---|
1361 | SetBusy();
|
---|
1362 | if (data) {
|
---|
1363 | string nomobj="";
|
---|
1364 | ObjMgr()->ReadFits(pfc_fits->GetFileName(), nomobj);
|
---|
1365 | ObjMgr()->DisplayObj(nomobj, "win");
|
---|
1366 | }
|
---|
1367 | mFCMsg = 0;
|
---|
1368 | SetReady();
|
---|
1369 | break;
|
---|
1370 |
|
---|
1371 | case 10130 :
|
---|
1372 | pfc_ppf->AcceptNewFile(false);
|
---|
1373 | mFCMsg = 10135;
|
---|
1374 | pfc_ppf->SetMsg(mFCMsg);
|
---|
1375 | SetBlocked();
|
---|
1376 | pfc_ppf->Show();
|
---|
1377 | break;
|
---|
1378 |
|
---|
1379 | case 10135 :
|
---|
1380 | mFCMsg = 0;
|
---|
1381 | if (data) {
|
---|
1382 | PPInMgrW()->SetFile(pfc_ppf->GetFileName());
|
---|
1383 | PPInMgrW()->Show();
|
---|
1384 | }
|
---|
1385 | SetReady();
|
---|
1386 | break;
|
---|
1387 |
|
---|
1388 | case 10105:
|
---|
1389 | Stop();
|
---|
1390 | break;
|
---|
1391 |
|
---|
1392 | }
|
---|
1393 | return;
|
---|
1394 | }
|
---|
1395 |
|
---|
1396 |
|
---|
1397 |
|
---|
1398 | /* --Methode-- */
|
---|
1399 | void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
1400 | {
|
---|
1401 |
|
---|
1402 | switch (msg) {
|
---|
1403 | case 10201 :
|
---|
1404 | ObjMgrW()->Show();
|
---|
1405 | break;
|
---|
1406 |
|
---|
1407 | case 10220 :
|
---|
1408 | pfc_ppf->AcceptNewFile(true);
|
---|
1409 | mFCMsg = 10225;
|
---|
1410 | pfc_ppf->SetMsg(mFCMsg);
|
---|
1411 | SetBlocked();
|
---|
1412 | pfc_ppf->Show();
|
---|
1413 | break;
|
---|
1414 |
|
---|
1415 | case 10225 :
|
---|
1416 | SetBusy();
|
---|
1417 | if (data) {
|
---|
1418 | if (mPpfout) {
|
---|
1419 | printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
|
---|
1420 | delete mPpfout;
|
---|
1421 | }
|
---|
1422 | name_outppf = pfc_ppf->GetFileName();
|
---|
1423 | mPpfout = NULL;
|
---|
1424 | printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
|
---|
1425 | mPpfout = new POutPersist(name_outppf);
|
---|
1426 | }
|
---|
1427 | mFCMsg = 0;
|
---|
1428 | SetReady();
|
---|
1429 | break;
|
---|
1430 |
|
---|
1431 | case 10230 :
|
---|
1432 | if (!mPpfout) break;
|
---|
1433 | printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
|
---|
1434 | delete mPpfout;
|
---|
1435 | name_outppf = "";
|
---|
1436 | mPpfout = NULL;
|
---|
1437 | break;
|
---|
1438 |
|
---|
1439 | case 10270 :
|
---|
1440 | if (mCurWdg) {
|
---|
1441 | int oid = mCurWdg->UserFlag();
|
---|
1442 | DeleteBaseWidget(mCurWdg);
|
---|
1443 | mObjMgr->DelObj_Id(oid);
|
---|
1444 | }
|
---|
1445 | break;
|
---|
1446 |
|
---|
1447 | default:
|
---|
1448 | cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
|
---|
1449 | break;
|
---|
1450 | }
|
---|
1451 |
|
---|
1452 | return;
|
---|
1453 | }
|
---|
1454 |
|
---|
1455 | /* --Methode-- */
|
---|
1456 | void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
|
---|
1457 | {
|
---|
1458 |
|
---|
1459 | switch (msg) {
|
---|
1460 | case 10301 :
|
---|
1461 | PIImgTools::ShowPIImgTools();
|
---|
1462 | break;
|
---|
1463 | case 10302 :
|
---|
1464 | PIDrwTools::ShowPIDrwTools();
|
---|
1465 | break;
|
---|
1466 | case 10303 :
|
---|
1467 | PIAxesTools::ShowPIAxesTools();
|
---|
1468 | break;
|
---|
1469 |
|
---|
1470 | case 10304 :
|
---|
1471 | mCmd->ShowCxxExecWindow();
|
---|
1472 | break;
|
---|
1473 |
|
---|
1474 | case 10311 :
|
---|
1475 | case 10312 :
|
---|
1476 | {
|
---|
1477 | PIImage* curpimg = NULL;
|
---|
1478 | if (!mCurWdg) return;
|
---|
1479 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
1480 | curpimg = (PIImage*)mCurWdg;
|
---|
1481 | if (curpimg == NULL) return;
|
---|
1482 | P2DArrayAdapter* img = curpimg->Image();
|
---|
1483 | if (img == NULL) return;
|
---|
1484 | int dx = curpimg->XSzPave();
|
---|
1485 | int dy = curpimg->YSzPave();
|
---|
1486 | int x0 = curpimg->XPave()-dx/2;
|
---|
1487 | int y0 = curpimg->YPave()-dy/2;
|
---|
1488 | if (x0 < 0) x0 = 0;
|
---|
1489 | if (y0 < 0) y0 = 0;
|
---|
1490 | int x1 = x0+dx;
|
---|
1491 | int y1 = y0+dy;
|
---|
1492 | if (x1 > img->XSize()) x1 = img->XSize();
|
---|
1493 | if (y1 > img->YSize()) y1 = img->YSize();
|
---|
1494 | dx = x1-x0; dy = y1-y0;
|
---|
1495 | ImageR4* pim = new ImageR4(dx, dy);
|
---|
1496 | int ii, jj;
|
---|
1497 | for(jj=0; jj<dy; jj++)
|
---|
1498 | for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
|
---|
1499 | if (msg == 10305) { // Calcul des coordonnees du sous-pave
|
---|
1500 | double xc1, yc1;
|
---|
1501 | img->Coord(x0, y0, xc1, yc1);
|
---|
1502 | pim->SetOrg((int)xc1, (int)yc1);
|
---|
1503 | }
|
---|
1504 | string nom = mCurWdg->Nom() + "_pave";
|
---|
1505 | ObjMgr()->AddObj(pim, nom);
|
---|
1506 | ObjMgr()->DisplayObj(nom, "w");
|
---|
1507 | break;
|
---|
1508 | }
|
---|
1509 |
|
---|
1510 | case 10313 :
|
---|
1511 | {
|
---|
1512 | PIImage* curpimg = NULL;
|
---|
1513 | if (!mCurWdg) return;
|
---|
1514 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
1515 | curpimg = (PIImage*)mCurWdg;
|
---|
1516 | if (curpimg == NULL) return;
|
---|
1517 | curpimg->ShowCuts(true);
|
---|
1518 | break;
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 | case 10320 :
|
---|
1522 | if (mStW) mStW->DispNext();
|
---|
1523 | break;
|
---|
1524 |
|
---|
1525 | case 10321 :
|
---|
1526 | case 10322 :
|
---|
1527 | case 10324 :
|
---|
1528 | // case 10328 :
|
---|
1529 | if (mStW) mStW->StartAutoDisp((msg-10320)*500);
|
---|
1530 | break;
|
---|
1531 |
|
---|
1532 | case 10329 :
|
---|
1533 | if (mStW) mStW->StopAutoDisp();
|
---|
1534 | break;
|
---|
1535 |
|
---|
1536 | case 103330 :
|
---|
1537 | if (mStW) {
|
---|
1538 | PIWdg* cw = mStW->CurrentWdg();
|
---|
1539 | if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
|
---|
1540 | }
|
---|
1541 | break;
|
---|
1542 |
|
---|
1543 | default:
|
---|
1544 | cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
|
---|
1545 | break;
|
---|
1546 | }
|
---|
1547 | return;
|
---|
1548 | }
|
---|
1549 |
|
---|
1550 | /* --Methode-- */
|
---|
1551 | void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
|
---|
1552 | {
|
---|
1553 |
|
---|
1554 | switch (msg) {
|
---|
1555 |
|
---|
1556 | case 10400 :
|
---|
1557 | CreateStackWin();
|
---|
1558 | break;
|
---|
1559 |
|
---|
1560 | case 10411 :
|
---|
1561 | CreateGraphWin(1,1);
|
---|
1562 | break;
|
---|
1563 | case 10421 :
|
---|
1564 | CreateGraphWin(1,2);
|
---|
1565 | break;
|
---|
1566 | case 10412 :
|
---|
1567 | CreateGraphWin(2,1);
|
---|
1568 | break;
|
---|
1569 | case 10422 :
|
---|
1570 | CreateGraphWin(2,2);
|
---|
1571 | break;
|
---|
1572 | case 10431 :
|
---|
1573 | CreateGraphWin(1,3);
|
---|
1574 | break;
|
---|
1575 | case 10433 :
|
---|
1576 | CreateGraphWin(3,3);
|
---|
1577 | break;
|
---|
1578 | case 10441 :
|
---|
1579 | if (mCurWdg) {
|
---|
1580 | mLastWdg = mCurWdg;
|
---|
1581 | cout << " Using current widget as last-widget (display same) " << endl;
|
---|
1582 | }
|
---|
1583 | else cout << " No current widget - select widget with mouse " << endl;
|
---|
1584 | break;
|
---|
1585 | case 10460 :
|
---|
1586 | DeleteWindow(mCurWin);
|
---|
1587 | break;
|
---|
1588 | case 10470 :
|
---|
1589 | StatZoomWindowSetVisible(m[3]->GetStateMsg(10470));
|
---|
1590 | break;
|
---|
1591 | default:
|
---|
1592 | cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
|
---|
1593 | break;
|
---|
1594 | }
|
---|
1595 | return;
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 |
|
---|
1599 | /* --Methode-- */
|
---|
1600 | void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
1601 | {
|
---|
1602 | char nomps[64],strg[512];
|
---|
1603 | PSFile *mps;
|
---|
1604 | int sxt, syt, syo, syo1, sx[4], sy[4];
|
---|
1605 |
|
---|
1606 | switch (msg)
|
---|
1607 | {
|
---|
1608 | case 10501 :
|
---|
1609 | pfc_ps->AcceptNewFile(true);
|
---|
1610 | mFCMsg = 10525;
|
---|
1611 | pfc_ps->SetMsg(mFCMsg);
|
---|
1612 | SetBlocked();
|
---|
1613 | pfc_ps->Show();
|
---|
1614 | break;
|
---|
1615 |
|
---|
1616 | case 10525 :
|
---|
1617 | SetBusy();
|
---|
1618 | if (data) {
|
---|
1619 | if (mpsfile) {
|
---|
1620 | printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
|
---|
1621 | delete mpsfile;
|
---|
1622 | }
|
---|
1623 | name_ps = pfc_ps->GetFileName();
|
---|
1624 | printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
|
---|
1625 | mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
|
---|
1626 | }
|
---|
1627 | mFCMsg = 0;
|
---|
1628 | SetReady();
|
---|
1629 | break;
|
---|
1630 |
|
---|
1631 | case 10505 :
|
---|
1632 | if (!mpsfile) break;
|
---|
1633 | printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
|
---|
1634 | delete mpsfile;
|
---|
1635 | mpsfile = NULL;
|
---|
1636 | name_ps = "";
|
---|
1637 | break;
|
---|
1638 |
|
---|
1639 | case 10511 : // Window -> PS
|
---|
1640 | case 10512 : // Window -> EPS
|
---|
1641 | if (CurrentWindow() == NULL) break;
|
---|
1642 | if (msg == 10512)
|
---|
1643 | {
|
---|
1644 | num_eps++;
|
---|
1645 | sprintf(nomps,"pia%d.eps", num_eps);
|
---|
1646 | printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
|
---|
1647 | mps = new PSFile(nomps);
|
---|
1648 | }
|
---|
1649 | else {
|
---|
1650 | if (mpsfile == NULL) {
|
---|
1651 | name_ps = "pia.ps";
|
---|
1652 | mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
|
---|
1653 | printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
|
---|
1654 | }
|
---|
1655 | printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
|
---|
1656 | mps = mpsfile;
|
---|
1657 | }
|
---|
1658 | CurrentWindow()->PSPrint(mps,0,0);
|
---|
1659 |
|
---|
1660 | if (msg == 10512) delete mps; // fichier eps
|
---|
1661 | break;
|
---|
1662 |
|
---|
1663 | case 10515 : // Image -> PS
|
---|
1664 | case 10516 : // Image -> EPS
|
---|
1665 | {
|
---|
1666 | PIImage* curpimg = NULL;
|
---|
1667 | if (!mCurWdg) return;
|
---|
1668 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
1669 | curpimg = (PIImage*)mCurWdg;
|
---|
1670 | if (curpimg == NULL) return;
|
---|
1671 | if (msg == 10516)
|
---|
1672 | {
|
---|
1673 | num_eps++;
|
---|
1674 | sprintf(nomps,"pia%d.eps", num_eps);
|
---|
1675 | printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
|
---|
1676 | mps = new PSFile(nomps);
|
---|
1677 | }
|
---|
1678 | else {
|
---|
1679 | if (mpsfile == NULL) {
|
---|
1680 | name_ps = "pia.ps";
|
---|
1681 | mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
|
---|
1682 | printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
|
---|
1683 | }
|
---|
1684 | printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
|
---|
1685 | mps = mpsfile;
|
---|
1686 | }
|
---|
1687 |
|
---|
1688 | sx[0] = gimv->XSize();
|
---|
1689 | sy[0] = gimv->YSize();
|
---|
1690 | sx[1] = zoom->XSize();
|
---|
1691 | sy[1] = zoom->YSize();
|
---|
1692 | sx[2] = cmapv->XSize();
|
---|
1693 | sy[2] = cmapv->YSize();
|
---|
1694 | sx[3] = curpimg->XSize();
|
---|
1695 | sy[3] = curpimg->YSize();
|
---|
1696 | if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
|
---|
1697 | else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
|
---|
1698 | syt = sy[3]+syo;
|
---|
1699 | sxt = sx[3];
|
---|
1700 | if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
|
---|
1701 | if (sxt < sx[2]) sxt = sx[2];
|
---|
1702 |
|
---|
1703 | // Pour ecrire le titre
|
---|
1704 | mps->NewPage((float)sxt, (float)syt, PI_Portrait);
|
---|
1705 | mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
|
---|
1706 | sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
|
---|
1707 | curpimg->XPave(), curpimg->YPave());
|
---|
1708 | mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20);
|
---|
1709 | mps->EndBloc();
|
---|
1710 |
|
---|
1711 | // Les quatre fenetres glovimage, zoom, cmap, image
|
---|
1712 | gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
|
---|
1713 | zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
|
---|
1714 | cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
|
---|
1715 | curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
|
---|
1716 |
|
---|
1717 | if (msg == 10516) delete mps; // fichier eps
|
---|
1718 | break;
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | default:
|
---|
1722 | cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
|
---|
1723 | break;
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 | }
|
---|
1727 |
|
---|
1728 |
|
---|
1729 | /* --Methode-- */
|
---|
1730 | void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
1731 | {
|
---|
1732 | switch (msg) {
|
---|
1733 | case 10601:
|
---|
1734 | CloseAllWindows();
|
---|
1735 | break;
|
---|
1736 | case 10602:
|
---|
1737 | RedirectStdOutErr(*((bool*)data));
|
---|
1738 | break;
|
---|
1739 | case 10603:
|
---|
1740 | case 10604:
|
---|
1741 | CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
|
---|
1742 | break;
|
---|
1743 | case 10605:
|
---|
1744 | mObjMgr->SetVerbose(m[5]->GetStateMsg(10605));
|
---|
1745 | break;
|
---|
1746 | case 10606:
|
---|
1747 | mCmd->ShowCxxOptionWindow();
|
---|
1748 | break;
|
---|
1749 | default:
|
---|
1750 | cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
|
---|
1751 | break;
|
---|
1752 | }
|
---|
1753 | return;
|
---|
1754 | }
|
---|
1755 |
|
---|
1756 |
|
---|
1757 |
|
---|
1758 | // -------------------------------------------------
|
---|
1759 | // Fenetre info piapp (About piapp)
|
---|
1760 | // -------------------------------------------------
|
---|
1761 | static PIWindow* infow_win = NULL;
|
---|
1762 | static PIText* infow_txt = NULL;
|
---|
1763 | static PICMapView* infow_cmap = NULL;
|
---|
1764 | static PIButton* infow_but = NULL;
|
---|
1765 |
|
---|
1766 | /* Nouvelle-Fonction */
|
---|
1767 | static void createInfoWindow(PIStdImgApp* app)
|
---|
1768 | {
|
---|
1769 | if (infow_win) return;
|
---|
1770 |
|
---|
1771 | int bsx, bsy;
|
---|
1772 | PIApplicationPrefCompSize(bsx, bsy);
|
---|
1773 | int spx, spy;
|
---|
1774 | spx = bsx/6; spy = bsy/6;
|
---|
1775 |
|
---|
1776 | infow_win = new PIWindow((PIMsgHandler *)app, "About piapp",
|
---|
1777 | PIWK_dialog, bsx*5+3*spx, bsy*4+spy*3, 200, 200);
|
---|
1778 | infow_win->SetAutoDelChilds(true);
|
---|
1779 | infow_txt = new PIText(infow_win,"about_piapp_text", bsx*5+spx, bsy*3, spx, spy);
|
---|
1780 | infow_txt->SetMutiLineMode(true);
|
---|
1781 | infow_txt->SetTextEditable(false);
|
---|
1782 | infow_txt->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
1783 | infow_cmap = new PICMapView(infow_win, "about_piapp_cmap", bsx*4, bsy*0.7, spx, 2*spy+bsy*3.15);
|
---|
1784 | infow_cmap->SetColMapId(CMAP_COLBR32, 1., -1., false);
|
---|
1785 | infow_cmap->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
1786 | infow_but = new PIButton(infow_win,"OK", 10155, bsx, bsy, bsx*4+2*spx, 2*spy+bsy*3);
|
---|
1787 | infow_but->SetMsgParent((PIMsgHandler *)app);
|
---|
1788 | infow_but->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
1789 | char buff[128];
|
---|
1790 | #ifdef SANS_EVOLPLANCK
|
---|
1791 | sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
1792 | (double)PI_VERSIONNUMBER, (float)PeidaVersion());
|
---|
1793 | #else
|
---|
1794 | {
|
---|
1795 | sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
1796 | (double)PI_VERSIONNUMBER, glst_piai->Version());
|
---|
1797 | }
|
---|
1798 | #endif
|
---|
1799 | string info = "piapp : Interactive analysis program\n";
|
---|
1800 | info += buff;
|
---|
1801 | info += "(C) LAL-IN2P3/CNRS 1996-2002\n";
|
---|
1802 | info += "(C) SPP-DAPNIA/CEA 1996-2002\n";
|
---|
1803 | infow_txt->SetText(info);
|
---|
1804 | }
|
---|
1805 |
|
---|
1806 | /* Nouvelle-Fonction */
|
---|
1807 | static void showInfoWindow(PIStdImgApp* app)
|
---|
1808 | {
|
---|
1809 | if (!infow_win) createInfoWindow(app);
|
---|
1810 | if (infow_win) infow_win->Show();
|
---|
1811 | }
|
---|
1812 | /* Nouvelle-Fonction */
|
---|
1813 | static void hideInfoWindow(PIStdImgApp* app)
|
---|
1814 | {
|
---|
1815 | if (infow_win) infow_win->Hide();
|
---|
1816 | }
|
---|
1817 |
|
---|
1818 | /* Nouvelle-Fonction */
|
---|
1819 | static void deleteInfoWindow()
|
---|
1820 | {
|
---|
1821 | if (!infow_win) return;
|
---|
1822 | delete infow_win;
|
---|
1823 | infow_win = NULL;
|
---|
1824 | infow_txt = NULL;
|
---|
1825 | infow_cmap = NULL;
|
---|
1826 | infow_but = NULL;
|
---|
1827 | }
|
---|
1828 |
|
---|
1829 |
|
---|