source: Sophya/trunk/SophyaPI/PIext/pistdimgapp.cc@ 2234

Last change on this file since 2234 was 2231, checked in by ansari, 23 years ago

Implementation de PIHisto2D::DeactivateControlWindow() + Refresh() Widget lors du delete de Drawer - Reza 25/10/2002

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