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

Last change on this file since 2947 was 2947, checked in by ansari, 19 years ago

ajout bloc gestion d'exception dans Reveil::run() pour tenter de faire marcher stopthr (envoi de SIGUSR1) sur Linux et Mac - Reza 26/4/2006

  • Property svn:executable set to *
File size: 62.8 KB
RevLine 
[2615]1#include "sopnamsp.h"
[293]2#include "machdefs.h"
[165]3#include <stdlib.h>
4#include <stdio.h>
[2492]5#include <unistd.h>
[165]6#include <string.h>
7
[295]8#include <typeinfo>
9
[165]10#include <string>
11#include <vector>
12
13#include "strutil.h"
14#include "timing.h"
15#include "perrors.h"
16#include "ctimer.h"
17
18#include "psighand.h"
19
20#include "cimage.h" // pour pouvoir faire extract
21
22#include "pistdimgapp.h"
[2263]23#include "servnobjm.h"
[1856]24// #include "pihisto2d.h"
[165]25#include "psfile.h"
26#include "piimgtools.h"
27#include "pidrwtools.h"
[1590]28#include "piaxestools.h"
[165]29
30#include "pistzwin.h"
31
[295]32#include "piinit.h"
[374]33#include "piversion.h"
34#include "piaversion.h"
[165]35
[295]36
[165]37static char ImgDir[256];
38static char WorkDir[256];
[692]39// Initialiseur
40static PIAppInitiator * glst_piai = NULL;
[165]41
[686]42// Pour la creation de fenetre info (about piapp)
43static void createInfoWindow(PIStdImgApp* app);
44static void deleteInfoWindow();
45static void showInfoWindow(PIStdImgApp* app);
46static void hideInfoWindow(PIStdImgApp* app);
[165]47
[2383]48// Pour compter le nombre de display same a la suite
49static int nb_disp_same = 0;
[2106]50
[165]51/* ........................................................... */
[2106]52/* Classe SIA_RU__Periodic : mise a jour periodique de */
53/* la fenetre Stat/Ressource info */
[2188]54/* + execution de commande soumis de l'exterieur */
[2106]55/* ........................................................... */
56
57class SIA_RU__Periodic : public PIPeriodic
58{
59public:
60 SIA_RU__Periodic(PIStdImgApp* app);
61 virtual ~SIA_RU__Periodic();
62 virtual void DoPeriodic();
63private:
64 PIStdImgApp* _app;
65};
66
67SIA_RU__Periodic::SIA_RU__Periodic(PIStdImgApp* app)
68 : PIPeriodX(1)
69{
70 _app = app;
71}
72
73SIA_RU__Periodic::~SIA_RU__Periodic()
74{
75}
76
77void SIA_RU__Periodic::DoPeriodic()
78{
[2188]79 if (_app) {
[2489]80 // RZDEL: Normalement, il ne devrait plus y avoir besoin de cette
81 // methode avec le thread separe de l'interpreteur - Reza 27/12/2003
82 // _app->ExecuteExtCommand();
[2188]83 _app->UpdateStatResourceInfo();
84 }
[2106]85}
86
87/* ............................................................. */
88
89
90/* ........................................................... */
[165]91/* Classe PIStdImgApp */
92/* ........................................................... */
93
94/* --Methode-- */
[2944]95PIStdImgApp::PIStdImgApp(bool fgsmall, int narg, char* arg[])
96 : PIApplication(420, (fgsmall)?320:220, narg, arg) , resusg(ResourceUsage::RU_All)
[165]97{
98
99// Les menus
100m[0] = new PIMenu(Menubar(),"Fichier");
[686]101m[0]->AppendItem("About piapp", 10150);
[165]102m[0]->AppendItem("Open-Fits", 10120);
103m[0]->AppendItem("Open-PPF", 10130);
[2263]104#ifndef SANS_EVOLPLANCK
105m[0]->AppendItem("Open-ASCII", 10140);
106#endif
[165]107// m[0]->AppendItem("Options", 10101);
[686]108m[0]->AppendItem("Help", 10100);
[1513]109m[0]->AppendSeparator();
[165]110m[0]->AppendItem("Exit", 10105);
111
112m[1] = new PIMenu(Menubar(),"Objets");
113m[1]->AppendItem("ObjectManager", 10201);
114m[1]->AppendItem("OpenOutPPF", 10220);
115m[1]->AppendItem("CloseOutPPF", 10230);
[686]116m[1]->AppendItem("Delete CurWdg", 10270);
[165]117
118m[2] = new PIMenu(Menubar(),"Tools");
119m[2]->AppendItem("Show ImageTools", 10301);
120m[2]->AppendItem("Show DrawerTools", 10302);
[1590]121m[2]->AppendItem("Show AxesTools", 10303);
122m[2]->AppendItem("CxxExecutorWindow", 10304);
123m[2]->AppendItem("Ext.Pave", 10311);
124m[2]->SetSensitivityMsg(10311, false);
125m[2]->AppendItem("Ext.Pave+Org", 10312);
126m[2]->SetSensitivityMsg(10312, false);
127m[2]->AppendItem("Cuts X,Y", 10313);
128m[2]->SetSensitivityMsg(10313, false);
[165]129mc = new PIMenu(m[2], "StackTools");
130mc->AppendItem("DispNext", 10320);
[191]131mc->AppendItem("Blink 0.5s", 10321);
132mc->AppendItem("Blink 1s", 10322);
133mc->AppendItem("Blink 2s", 10324);
[165]134mc->AppendItem("Stop Blink", 10329);
135mc->AppendItem("RemoveCurrent", 10330);
136m[2]->AppendPDMenu(mc);
137m[2]->SetSensitivity("StackTools", false);
138
139m[3] = new PIMenu(Menubar(),"Window");
140m[3]->AppendItem("StackWindow", 10400);
141m[3]->AppendItem("Window", 10411);
142m[3]->AppendItem("Window 2x1", 10421);
[1971]143// m[3]->AppendItem("Window 1x2", 10412);
[165]144m[3]->AppendItem("Window 2x2", 10422);
[1971]145// m[3]->AppendItem("Window 3x1", 10431);
[165]146m[3]->AppendItem("Window 3x3", 10433);
[558]147m[3]->AppendItem("Cur->LastWdg", 10441);
[686]148m[3]->AppendItem("Close CurWin", 10460);
[1971]149m[3]->AppendCheckItem("StatZoomWin", 10470);
150m[3]->SetStateMsg(10470, true);
[165]151
152m[4] = new PIMenu(Menubar(),"PostScript");
153m[4]->AppendItem("OpenPS", 10501);
154m[4]->AppendItem("ClosePS", 10505);
155m[4]->AppendItem("Window->PS", 10511);
156m[4]->AppendItem("Image->PS", 10515);
157m[4]->AppendItem("Window->EPS", 10512);
158m[4]->AppendItem("Image->EPS", 10516);
159m[4]->SetSensitivityMsg(10515, false);
160m[4]->SetSensitivityMsg(10516, false);
161
162m[5] = new PIMenu(Menubar(),"Special");
163m[5]->AppendItem("CloseAll", 10601);
164m[5]->AppendCheckItem("Red.Out/Err", 10602);
[374]165m[5]->AppendCheckItem("Catch SigFPE", 10603);
166m[5]->AppendCheckItem("Catch SigSEGV", 10604);
[449]167m[5]->AppendCheckItem("ObjMgr Verb", 10605);
[1319]168m[5]->AppendItem("CxxExecOption", 10606);
[165]169
[293]170m[6] = new PIMenu(Menubar(),"Modules");
171
[165]172AppendMenu(m[0]);
173AppendMenu(m[1]);
174AppendMenu(m[2]);
175AppendMenu(m[3]);
176AppendMenu(m[4]);
177AppendMenu(m[5]);
[374]178// AppendMenu(m[6]); Menu Modules vide pour le moment
[165]179
180int scsx, scsy;
[1593]181ScreenSize(scsx, scsy);
[165]182if (scsy <= 600) mFgScSz = 0;
183else if (scsy <= 800) mFgScSz = 1;
184else if (scsy <= 1024) mFgScSz = 2;
185else mFgScSz = 3;
186int msx = 420+mFgScSz*60;
187int msy = 320+mFgScSz*40;
[2944]188int sfgsz = mFgScSz;
189if (fgsmall) { // Flag petite taille de fenetre
190 if (mFgScSz > 1) mFgScSz = 1;
191 msx = 420+mFgScSz*40;
192 msy = 220+mFgScSz*20;
193}
[165]194MainWin()->SetSize(msx, msy);
195
[1971]196//------------------------------------------------------
197// On cree un container intermediaire permettant de gerer
198// le widget zoom, colormap, stats, ...
199
[2486]200int bss = 105+mFgScSz*15;
[1971]201
202int statc_szy = bss+10+14+mFgScSz*2+5;
203statcont = new PIContainer(MainWin(), "ZGCSCont", msx, statc_szy, 0, 0);
204statcont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
205
206gimv = new PIPixmap(statcont, "GloV", bss, bss, 5, 5);
[165]207gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
[1971]208zoom = new PIPixmap(statcont, "Zoom", bss, bss, bss+10, 5);
[165]209zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
[1971]210cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
[165]211cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
[2106]212
213// Widget pour affichage des stats / ressources
[2486]214lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 5);
[2106]215lab_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
216lab_mem->SetLabel("MemoryUsage");
217lab_mem->SetForegroundColor(PI_Red);
218lab_mem->SetBorderWidth(1);
[2486]219therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 15, 2*bss+20, 30);
[2106]220therm_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
221therm_mem->SetThreshold(0.5, 0.75);
222
[2486]223lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 50);
[2106]224lab_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
225lab_cpu->SetLabel("CPUUsage");
226lab_cpu->SetForegroundColor(PI_Black);
227lab_cpu->SetBorderWidth(1);
[2486]228therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 15, 2*bss+20, 75);
[2106]229therm_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
230therm_cpu->SetThreshold(0.75, 0.90);
[2486]231lab_thrcmd = new PILabel(statcont, "thrcmdlab", msx-2*(bss+20), 20, 2*bss+20, 95);
232lab_thrcmd->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
233lab_thrcmd->SetLabel("CommandThread");
234lab_thrcmd->SetForegroundColor(PI_Green);
235lab_thrcmd->SetBorderWidth(1);
[2106]236
[2486]237fg_exc_cmd = false;
238mCmd = NULL; // Avant d'appeler UpdateStatResource() si PIACmd non cree
[2106]239UpdateStatResourceInfo();
240resupd_periodic = new SIA_RU__Periodic(this);
241//resupd_periodic->SetIntervalms(500);
242resupd_periodic->Start();
243
[1971]244statcont->Show();
245// StatZoomWindowSetVisible(true);
246//------------------------------------------------------
[165]247
[1971]248//int cpy = bss+10+14+mFgScSz*2+5;
249int cpy = statc_szy;
[165]250
251// Creation d'une console avec gestion des commandes
[1971]252consolecont = new PIContainer(MainWin(), "ConsoleCont", msx, msy-cpy, 0, cpy );
253consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
254mCons = new PIConsole(consolecont, "Console", 30200, 512, 132, msx, msy-cpy, 0, 0 );
[165]255mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
256mCons->AcceptCmd(true, 50);
[1971]257consolecont->Show();
[293]258redirecout = false;
[165]259// RedirectStdOutErr(true); pas par defaut
[2944]260
261mFgScSz = sfgsz;
[165]262
[2490]263mObjMgr = new NamedObjMgr(true);
264mCmd = new PIACmd(this);
[165]265
[449]266// Pas trop de message de la part de NamedObjMgr
267m[5]->SetStateMsg(10605, false);
268mObjMgr->SetVerbose(false);
269
[165]270char* varenv;
271ImgDir[0] = WorkDir[0] = '\0';
272if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
273if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
274
[685]275pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
276pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
[2263]277pfc_ascii = new PIFileChooser(this,"ASCII-FileChooser", 10145);
[685]278pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
[165]279
280mObjmgrw = new ObjMgrWind(this);
281mPpinmgrw = new PPInMgrWind(this);
282
[333]283// Attention : A faire apres creation de ObjMgrWind !!!
284mObjMgr->SetImgApp(this);
285
[165]286// Gestion des feneteres widgets et drawers
287mWId = mDId = mBWId = 0;
288mCurWin = NULL;
289mCurWdg = NULL;
290mLastWdg = NULL;
291mGrW = NULL;
292mStW = NULL;
293mGrIdx = mStIdx = -1;
294
295mFCMsg = 0;
296mFgCWImg = false;
297
298// Gestion fichiers PS
299num_eps = 0;
300name_ps = "";
301name_ps = "pia.ps";
302mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
303
304// Gestion OUT-PPF
305mPpfout = NULL;
306name_outppf = "";
307
308// Attributs graphiques courants
[2350]309mAxesFlags = kAxesDflt;
[548]310SetInsetLimits(0.4, 0.6, 0.4, 0.6);
[1131]311mAddTitle = true;
[165]312
[295]313// Initialisation
[692]314glst_piai = new PIAppInitiator(this);
[600]315
316char buff[128];
317mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
318#ifdef SANS_EVOLPLANCK
319sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
320 (double)PI_VERSIONNUMBER, (float)PeidaVersion());
321#else
322sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
[692]323 (double)PI_VERSIONNUMBER, glst_piai->Version());
[600]324#endif
325mCons->AddStr(buff, PIVA_Blue );
326mCons->AddStr(" ..........................................\n", PIVA_Blue );
327// PrintPeidaVersion();
328
[685]329pfc_fits->SetPath(ImgDir);
330pfc_ppf->SetPath(WorkDir);
331pfc_ps->SetPath(WorkDir);
332
[165]333SetReady();
[2490]334fg_glsynlock = false;
[165]335}
336
337/* --Methode-- */
338PIStdImgApp::~PIStdImgApp()
339{
340int i;
341
[1075]342// On inactive la fenetre principale
343// Sinon, ca peut provoquer un SEGV ds delete de console ?? - Reza 07/2000
344MainWin()->Hide();
345
[558]346// Destrucion de tous les objets de NameObjMgr
347string patt = "/*/*";
348mObjMgr->DelObjects(patt, true);
349
[205]350delete mc;
[293]351for(i=0; i<7; i++)
[165]352 if (m[i]) delete m[i];
353
354WindMList::iterator it;
355for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
356
357delete mObjMgr;
358delete mCmd;
359
360delete zoom;
361delete gimv;
362delete cmapv;
363
[2106]364delete lab_mem;
365delete therm_mem;
366delete lab_cpu;
367delete therm_cpu;
[2486]368delete lab_thrcmd;
[2106]369
[1971]370delete statcont;
371
[685]372delete pfc_fits;
373delete pfc_ppf;
[2263]374delete pfc_ascii;
[685]375delete pfc_ps;
[165]376
377delete mCons;
[2106]378delete consolecont;
[165]379
380delete mObjmgrw;
381delete mPpinmgrw;
382
[686]383deleteInfoWindow();
384
[165]385// Les fichiers
386if (mpsfile) delete mpsfile;
387if (mPpfout) delete mPpfout;
388
[2106]389if (resupd_periodic) delete resupd_periodic;
390
[692]391if (glst_piai) delete glst_piai; glst_piai = NULL;
[2106]392
[165]393}
394
[2491]395/*
[2489]396class RunAlarm : public Periodic {
397public:
398 RunAlarm(PIStdImgApp* app) :
399 Periodic(1)
400 { _app = app; SetIntervalms(1); }
401 ~RunAlarm() { }
402 virtual void DoPeriodic()
403 { _app->getMutex().broadcast(); }
404 PIStdImgApp* _app;
405};
[2491]406*/
[2489]407
[2491]408class Reveil : public ZThread {
409public:
410 Reveil(PIStdImgApp* app) :
411 ZThread()
412 { _app = app; _fgstop = false; }
413 virtual ~Reveil() { }
414 inline void Stop() { _fgstop = true; }
415 virtual void run()
416 {
417 while (!_fgstop) {
[2947]418 try {
419 usleep(2000);
420 _app->LockMutex();
421 bool fgb = false;
422 if (_app->CheckPendingEvents() != 0) fgb = true;
423 _app->UnlockMutex(fgb);
424 }
425 catch ( PThrowable & exc ) {
426 cout << "Reveil::run() Exception catched Msg= " << exc.Msg() << endl;
427 }
428
[2491]429 }
430 }
431
432 PIStdImgApp* _app;
433 bool _fgstop;
434};
[2494]435
436int PIStdImgApp::CheckPendingEvents()
437{
438 return XtAppPending(*_appctx);
439}
440
[2800]441void PIStdImgApp::CkEvt_LockMutex()
442{
443 for(int i=0; i<5; i++) { // On tente 5 fois de vider le buffer d'evenements
444 LockMutex();
445 int nev = CheckPendingEvents();
446 bool fgbr = (nev > 0) ? true : false;
447 UnlockMutex(fgbr);
448 if (nev < 1) break;
449 }
450 LockMutex();
451}
452
[165]453/* --Methode-- */
[2486]454void PIStdImgApp::Run()
455{
456XEvent evt;
457int szx, szy, szf;
458XtAppContext * appctx = PIXtAppCtx(szx, szy, szf);
[2494]459_appctx = appctx; // Pour CheckPendingEvents()
[2486]460// Pour appeler FinishCreate() des objets dans la fenetre principale
461if (mStop) { // C'est la premiere fois
462 topcont->SetSize(topcont->XSize(), topcont->YSize());
463 MBCont()->FinishCreate();
464 }
465else mStop = true; // On rerentre apres un stop
466
[2489]467// Creation et demarrage de l'objet de reveil periodique
468// de la boucle d'evts
[2491]469/* RunAlarm * mru = new RunAlarm(this);
470 mru->Start(); */
471Reveil* mrv = new Reveil(this);
472mrv->start();
[2489]473// Demarrage du thread de l'interpreteur
474CmdInterpreter()->start();
[2486]475
[2489]476
[2490]477
[2491]478thr_glsyn.lock(); // <ZThread>
[2492]479//DEL-DBG int klp = 0;
[2486]480while (mStop) {
[2490]481 fg_glsynlock = true;
[2491]482 int nevtproc = 0;
[2701]483 while (XtAppPending(*appctx) != 0) { // Boucle XtAppPending()
484 try {
485 XtAppNextEvent(*appctx, &evt);
486 XtDispatchEvent(&evt);
487 // Soumission de la commande exterieur a executer
488 if (fg_exc_cmd) {
489 fg_exc_cmd = false;
490 CmdInterpreter()->AddInputLine(exc_command);
491 }
492 nevtproc++;
[2800]493 if (nevtproc >= 300) break;
[2673]494 }
[2701]495 catch ( PThrowable & exc ) {
496 cerr << "\nPIStdImgApp::Run()/ Exception catched in event loop: \n "
497 << (string)typeid(exc).name() << " Msg= " << exc.Msg() << endl;
498 cerr << " Trying to continue event loop ... " << endl;
499 }
500 catch ( std::exception & sexc ) {
501 cerr << "\nPIStdImgApp::Run()/ Exception catched in event loop: \n "
502 << (string)typeid(sexc).name() << " what()= " << sexc.what() << endl;
503 cerr << " Trying to continue event loop ... " << endl;
504 }
505 catch ( ... ) {
506 cerr << "\nPIStdImgApp::Run()/ Unknown Exception (...) catched in event loop ! " << endl;
507 cerr << " Trying to continue event loop ... " << endl;
508 }
509 } // FIN Boucle XtAppPending()
[2490]510 fg_glsynlock = false;
[2492]511 //DBG cout << " "DBG-Run:: Going to wait ... " << klp << endl;
[2491]512 thr_glsyn.wait(); // <ZThread>
[2492]513 //DBG cout << "DBG-Run:: Out of wait " << ++klp << endl;
[2491]514 // usleep(1000);
[2486]515}
[2489]516
[2491]517thr_glsyn.unlock(); // <ZThread>
518mrv->Stop();
519delete mrv;
520// delete mru;
[2486]521return;
522}
523
524/* --Methode-- */
[165]525void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
526{
527PIWdg *sndw;
528PIMessage tmsg, smm;
529
530tmsg = msg;
531msg = UserMsg(msg);
532smm = ModMsg(tmsg);
533
534//printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
535if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
536
[2606]537#ifdef SANS_EVOLPLANCK
538 TRY {
539#else
540 try {
541#endif
542
[165]543// Messages active-window
544if (smm == PIMsg_Active)
545 {
[293]546 sndw = dynamic_cast<PIWdg *>(sender);
[165]547 switch(sndw->kind())
548 {
549 case PIWindow::ClassId :
[293]550 mCurWin = dynamic_cast<PIWindow *>(sndw);
[165]551 break;
552
553 case PIScDrawWdg::ClassId :
554 case PIDraw3DWdg::ClassId :
[293]555 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
[165]556// cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
557 if (mFgCWImg) {
558// cerr << "*DBG* ImgTools -> NonSensitive " << endl;
[1590]559 m[2]->SetSensitivityMsg(10311, false);
560 m[2]->SetSensitivityMsg(10312, false);
561 m[2]->SetSensitivityMsg(10313, false);
[165]562 m[4]->SetSensitivityMsg(10515, false);
563 m[4]->SetSensitivityMsg(10516, false);
564 mFgCWImg = false;
565 }
566 break;
567 case PIImage::ClassId :
[293]568 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
[165]569 if (!mFgCWImg) {
570// cerr << "*DBG* ImgTools -> Sensitive " << endl;
[1590]571 m[2]->SetSensitivityMsg(10311, true);
572 m[2]->SetSensitivityMsg(10312, true);
573 m[2]->SetSensitivityMsg(10313, true);
[165]574 m[4]->SetSensitivityMsg(10515, true);
575 m[4]->SetSensitivityMsg(10516, true);
576 mFgCWImg = true;
577 }
578 break;
[293]579 /*
580 default :
581 mCurWdg = NULL;
582 if (mFgCWImg) {
[1590]583 m[2]->SetSensitivityMsg(10311, false);
584 m[2]->SetSensitivityMsg(10312, false);
585 m[2]->SetSensitivityMsg(10313, false);
[293]586 m[4]->SetSensitivityMsg(10515, false);
587 m[4]->SetSensitivityMsg(10516, false);
588 mFgCWImg = false;
589 }
590 break;
591 */
[165]592 }
593 }
594// Message window-close
595else if (smm == PIMsg_Close)
596 {
597 sndw = (PIWdg *)sender;
598 if(sndw->kind() == PIWindow::ClassId)
599 {
600 mCurWin = (PIWindow *)sender;
601 if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
602 DeleteWindow(mCurWin);
603 }
604 else
605 printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
606 (int)tmsg, (int)sndw->kind(), (long)sender);
607 }
608
609// Traitement des messages des menus
610else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
611else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
612else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
613else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
614else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
615else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
[2677]616else if ( (msg == 30200) && (smm == PIMsg_Cancel) ) // <Cntrl C> appuye sur Console
617 CmdInterpreter()->StopExecution();
618else if ( (msg == 30200 ) && (smm == PIMsg_OK) ){ // Objet PIConsole avec <Return>/<Enter>
[165]619 string s = mCons->GetCmdString();
[1265]620 // string s2 = "\nExecuting " + s + "\n";
621 mCons->AddStr("Cmd> ", PIVA_Blue, false);
622 // s2 = s + "\n";
623 mCons->AddStr(s.c_str(), PIVA_Blue|PIVA_Bold, false);
624 mCons->AddChar('\n', PIVA_Def, true);
[165]625 SetBusy();
[495]626#ifdef SANS_EVOLPLANCK
[165]627 TRY {
[293]628 mCmd->Interpret(s);
[165]629 } CATCH(merr) {
630 fflush(stdout);
631 cout << endl;
632 cerr << endl;
633 string es = PeidaExc(merr);
[495]634 cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
635 }
636#else
637 try {
[2486]638 // mCmd->Interpret(s);
[2489]639 CmdInterpreter()->AddInputLine(s);
[495]640 }
[1276]641 catch ( PThrowable & exc ) {
642 cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
643 << (string)typeid(exc).name() << " Msg= "
644 << exc.Msg() << endl;
[495]645 cout << endl;
[165]646 }
[1276]647 catch ( ... ) {
648 cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ..."
649 << endl;
650 cout << endl;
651 }
652
[495]653#endif
[165]654 SetReady();
655 }
656
657else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
658 (int)tmsg,(int)msg,(int)smm);
659
[2606]660#ifdef SANS_EVOLPLANCK
661} CATCH(merr) {
662 fflush(stdout);
663 cout << endl;
664 cerr << endl;
665 string es = PeidaExc(merr);
666 cerr << "PIStdImgApp::Process()/ Exception :" << es << " (" << merr << ")" << endl ;
667 SetReady();
668 }
669#else
670 }
671 catch ( PThrowable & exc ) {
672 cerr << "\n PIStdImgApp::Process() SOPHYA Exception :"
673 << (string)typeid(exc).name() << "\n Msg= "
674 << exc.Msg() << endl;
675 SetReady();
676 }
677 catch ( std::exception & sex ) {
678 cerr << "\n PIStdImgApp::Process() std::exception :"
679 << (string)typeid(sex).name() << "\n msg= "
680 << sex.what() << endl;
681 SetReady();
682 }
683 catch ( ... ) {
684 cerr << "\n PIStdImgApp::Process()/ Catched unknown (...) Exception " << endl;
685 SetReady();
686 }
[165]687
[2606]688#endif
689
[165]690return;
691}
692
[194]693/* --Methode-- */
694void PIStdImgApp::SetReady()
695{
696mCons->SetSensitive();
697gimv->SetSensitive();
698PIApplication::SetReady();
699}
[165]700
[194]701/* --Methode-- */
702void PIStdImgApp::SetBusy()
703{
704mCons->SetUnSensitive();
705gimv->SetUnSensitive();
706PIApplication::SetBusy();
[1321]707// Attention : Appel XSync specifique X11 - en attendant multi-thread
[2651]708// XSync(PIXDisplay(), False); RZDEL
[194]709}
[165]710
[194]711/* --Methode-- */
712void PIStdImgApp::SetBlocked()
713{
714mCons->SetUnSensitive();
715gimv->SetUnSensitive();
716PIApplication::SetBlocked();
[1321]717// Attention : Appel XSync specifique X11 - en attendant multi-thread
[2651]718// XSync(PIXDisplay(), False); RZDEL
[194]719}
[165]720
[2492]721class SyncPIS {
722public:
723 explicit SyncPIS(ZMutex & mtx, bool fglock=true, int sigbr=0)
724 {
725 _mtx = &mtx; _sigbr = sigbr;
726 _fglock = fglock;
727 if (_fglock) mtx.lock();
728 }
729 ~SyncPIS()
730 {
731 if (_fglock && (_mtx != NULL) ) {
732 if (_sigbr == 1) _mtx->signal();
733 else if (_sigbr == 2) _mtx->broadcast();
734 _mtx->unlock();
735 }
736 }
[194]737
[2492]738private:
739 ZMutex * _mtx;
740 int _sigbr;
741 bool _fglock;
742 inline SyncPIS() {_mtx = NULL; _sigbr = 0; _fglock = false; }
743};
744
745
[165]746/* --Methode-- */
[2491]747int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop,
[2651]748 bool fgimagnav, int oid, bool fglock)
[165]749{
[2651]750PIImage* pii=NULL;
751PIImageNavigator* piin=NULL;
[165]752PIWindow* win;
753int sx, sy, px, py, flag;
754
755if (nouv == NULL)
756 {
757 printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
758 return(-1);
759 }
760
761if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
762 {
763 printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
764 nouv->XSize(), nouv->YSize());
765 return(-1);
766 }
767
[1971]768// On decode les options graphiques
769vector<string> opts;
770DispWinEnum dwopt = ParseDisplayOption(sop, opts);
[165]771
[1971]772// Pas de same ou inset pour DispImage
773if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next;
[165]774
[2486]775// <ZThread> global PIApplication event loop synchronisation
[2492]776SyncPIS zs(getMutex(), fglock, 2);
[2486]777
[1971]778// Choix de la taille de fenetre
779#define MINPIIMGSIZE 100
780sx = (nouv->XSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
781sy = (nouv->YSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
[165]782if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
783if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
784px = py = 0;
[1971]785win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
[2651]786if (fgimagnav) { // Creation de naviguateur d'image
787 piin = new PIImageNavigator(win, (char *)name.c_str(), sx, sy, px,py);
788 piin->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
[2778]789 piin->Show();
[2651]790 piin->ImageWdg()->ShowCursor(true);
791 pii = piin->ImageWdg();
[2762]792 piin->SetUserData(NULL, oid);
[2651]793 pii->SetUserData(NULL, oid);
794}
795else { // Creation de widget PIImage normal
796 pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
797 pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
798 pii->SetZoomWin(zoom, false);
799 pii->SetGloVWin(gimv, false);
800 pii->SetCMapWin(cmapv, false);
801 pii->ShowCursor(true);
802 pii->SetUserData(NULL, oid);
803}
[1971]804
[2778]805
806pii->SetImage(nouv, true, false);
807
808// decode des options en chaine de caracteres
809if (mAxesAtt.size() > 0)
810 pii->DecodeOptionString(mAxesAtt, false); // Les options d'axe
811if (mDefaultAtt.size() > 0)
812 pii->DecodeOptionString(mDefaultAtt, false); // d'abord les options par defaut
813if (opts.size() > 0)
814 pii->DecodeOptionString(opts); // ensuite, les options specifies en argument
815
[1971]816// On recalcule la taille de la fenetre si Disp_Win
817if (dwopt == Disp_Win) {
818 int sx2 = (int)((float)nouv->XSize()*pii->GetZoomF());
819 int sy2 = (int)((float)nouv->YSize()*pii->GetZoomF());
820
821 if (sx2 > 400+mFgScSz*100) sx2 = 400+mFgScSz*100;
822 if (sy2 > 400+mFgScSz*100) sy2 = 400+mFgScSz*100;
823 if (sx2 < MINPIIMGSIZE) sx = MINPIIMGSIZE;
824 if (sy2 < MINPIIMGSIZE) sy = MINPIIMGSIZE;
825 if ((sx2 != sx) || (sy2 != sy)) win->SetSize(sx2, sy2);
826}
827
[165]828// printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
829mCurWin = win;
830mCurWdg = pii;
831mLastWdg = pii;
832mBWId++;
[2778]833if (fgimagnav) mBWList[mBWId] = piin;
[2762]834else mBWList[mBWId] = pii;
[2118]835// pii->Refresh();
[2651]836 pii->Apply(true);
837 // cmapv->Refresh(); Pas besoin ? , Reza Fev 2005
[165]838return(mBWId);
839}
840
841
842/* --Methode-- */
[1971]843int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, string const& sop,
[2491]844 string title, int oid, bool fglock)
[165]845{
846if (scd == NULL)
847 {
848 printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
849 return(-1);
850 }
851
[1971]852// On decode les options graphiques
853vector<string> opts;
854DispWinEnum dwopt = ParseDisplayOption(sop, opts);
855if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
[2486]856
857// <ZThread> global PIApplication event loop synchronisation
[2492]858SyncPIS zs(getMutex(), fglock, 2);
[2486]859
[1971]860// Trace en superpoistion
861if ( (dwopt == Disp_Same) && (mLastWdg) ) {
862 // Les options
863 scd->DecodeOptionString(mDefaultAtt, false);
[2383]864 if (nb_disp_same > 0) {
865 vector<string> ostatpos;
866 int spo = nb_disp_same%4;
867 if (spo == 1) ostatpos.push_back("statposoff=-0.01,-0.26");
868 else if (spo == 2) ostatpos.push_back("statposoff=-0.36,-0.01");
869 else ostatpos.push_back("statposoff=-0.36,-0.26");
870 scd->DecodeOptionString(ostatpos, true);
871 }
[1971]872 scd->DecodeOptionString(opts, true);
[165]873
874 if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
875 else mLastWdg->AddDrawer(scd, true, true, true);
[548]876 scd->Refresh();
877 mDId++;
878 mDrwList[mDId] = scd;
879 return(-mDId);
880}
881// Trace en medaillon
[1971]882else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
[548]883 PIGrCoord x1, x2, y1, y2;
884 x1 = mIXmin; x2 = mIXmax;
885 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
[1971]886 // Les options
887 scd->DecodeOptionString(mDefaultAtt, false);
888 scd->DecodeOptionString(opts, true);
889
[548]890 scd->SetAxesFlags(mAxesFlags);
[1971]891 scd->UpdateLimits();
[548]892 mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
[165]893 scd->Refresh();
894 mDId++;
895 mDrwList[mDId] = scd;
896 return(-mDId);
897}
898
[1971]899// Creation d'un nouveau PIScDrawWdg
[165]900PIWindow* win;
901PIScDrawWdg* scw;
902int sx, sy, px, py, flag;
903sx = 200+mFgScSz*100;
904sy = 200+mFgScSz*100;
[1971]905win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
906
[1856]907scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
[165]908scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
[331]909scw->SetUserData(NULL, oid);
[1971]910
911// Decodage des options :
912vector<string> scwatt;
[203]913scw->SetAxesFlags(mAxesFlags);
[1971]914if ( mDefaultAtt.size() > 0) {
915 scwatt = mDefaultAtt;
[2217]916 scd->DecodeOptionString(scwatt, true);
[1971]917 scw->DecodeOptionString(scwatt, true);
918}
919if ( mAxesAtt.size() > 0) {
920 scwatt = mAxesAtt;
921 scw->DecodeOptionString(scwatt, true);
922}
923if (opts.size() > 0)
924 scd->DecodeOptionString(opts, true);
925if (opts.size() > 0)
926 scw->DecodeOptionString(opts, false);
927
[165]928// Titre du plot
[1131]929if (mAddTitle) {
930 if (title.length() <= 0) title = name; string t2="";
931 scw->SetTitles(title, t2);
932}
[1569]933
[1971]934scw->AddScDrawer(scd, true);
[293]935// scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
[1971]936
[165]937mCurWin = win;
938mCurWdg = scw;
939mLastWdg = scw;
940mBWId++;
941mBWList[mBWId] = scw;
942return(mBWId);
943}
944
945/* --Methode-- */
[1971]946int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, string const& sop,
[2491]947 string title, int oid, bool fglock)
[165]948{
949if (dr3 == NULL)
950 {
951 printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
952 return(-1);
953 }
954
[1971]955// On decode les options graphiques
956vector<string> opts;
957DispWinEnum dwopt = ParseDisplayOption(sop, opts);
[165]958
[1971]959if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
[2486]960
961// <ZThread> global PIApplication event loop synchronisation
[2492]962SyncPIS zs(getMutex(), fglock, 2);
[2486]963
[548]964// Trace en superpoistion
[1971]965if ( (dwopt == Disp_Same) && (mLastWdg) ) {
966 // Les options
967 dr3->DecodeOptionString(mDefaultAtt, false);
[2383]968 if (nb_disp_same > 1) {
969 vector<string> ostatpos;
970 int spo = nb_disp_same%4;
971 if (spo == 1) ostatpos.push_back("statposoff=-0.01,-0.26");
972 else if (spo == 2) ostatpos.push_back("statposoff=-0.36,-0.01");
973 else ostatpos.push_back("statposoff=-0.36,-0.26");
974 dr3->DecodeOptionString(ostatpos, true);
975 }
976
[1971]977 dr3->DecodeOptionString(opts, true);
978
[165]979 if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
980 else mLastWdg->AddDrawer(dr3, true, true, true);
981 dr3->Refresh();
982 mDId++;
983 mDrwList[mDId] = dr3;
984 return(-mDId);
985}
[548]986// Trace en medaillon
[1971]987else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
[548]988 PIGrCoord x1, x2, y1, y2;
989 x1 = mIXmin; x2 = mIXmax;
990 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
[1971]991 // Les options
992 dr3->DecodeOptionString(mDefaultAtt, false);
993 dr3->DecodeOptionString(opts, true);
994
[548]995 dr3->SetAxesFlags(mAxesFlags);
996 dr3->UpdateLimits();
997 mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
998 dr3->Refresh();
999 mDId++;
1000 mDrwList[mDId] = dr3;
1001 return(-mDId);
1002}
[165]1003
[548]1004
[165]1005PIWindow* win;
1006int sx, sy, px, py, flag;
1007sx = 200+mFgScSz*100;
1008sy = 200+mFgScSz*100;
[1971]1009win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
[165]1010PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
1011wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
[331]1012wd3->SetUserData(NULL, oid);
[1971]1013
1014// Decodage des options :
1015vector<string> scwatt;
1016// wd3->SetAxesFlags(mAxesFlags); Attributs d'axes 3D a faire
1017if ( mDefaultAtt.size() > 0) {
1018 scwatt = mDefaultAtt;
[2217]1019 dr3->DecodeOptionString(scwatt, true);
[1971]1020 wd3->DecodeOptionString(scwatt, true);
1021}
1022if ( mAxesAtt.size() > 0) {
1023 scwatt = mAxesAtt;
1024 wd3->DecodeOptionString(scwatt, true);
1025}
1026if (opts.size() > 0)
1027 dr3->DecodeOptionString(opts, true);
1028if (opts.size() > 0)
1029 wd3->DecodeOptionString(opts, false);
1030
[165]1031// Titre du plot
[1131]1032if (mAddTitle) {
1033 if (title.length() <= 0) title = name; string t2="";
1034 wd3->SetTitles(title, t2);
1035}
[1971]1036
1037wd3->AddDrawer3D(dr3, true);
[293]1038// wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
[1971]1039
[165]1040mCurWin = win;
1041mCurWdg = wd3;
1042mLastWdg = wd3;
1043mBWId++;
1044mBWList[mBWId] = wd3;
1045return(mBWId);
1046}
1047
[2489]1048// RZDEL: Normalement, il ne devrait plus y avoir besoin de cette
1049// methode avec le thread separe de l'interpreteur - Reza 27/12/2003
[349]1050/* --Methode-- */
[2188]1051int PIStdImgApp::ExecuteExtCommand()
1052{
1053if (!fg_exc_cmd) return(0);
1054else {
1055 fg_exc_cmd = false;
1056 return CmdInterpreter()->Interpret(exc_command);
1057 }
1058}
1059
1060/* --Methode-- */
[2263]1061void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop, bool fgcn)
[349]1062{
[2489]1063// <ZThread> global PIApplication event loop synchronisation
[2755]1064ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1065
[2165]1066PIDrawer *eld=CurrentElDrawer();
[1642]1067if (eld == NULL) return;
[2165]1068PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1069PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1070if ((eld2 == NULL) && (eld3 == NULL)) return;
1071PIElDrwMgr* elmgr;
1072if (eld2) elmgr = &(eld2->ElDrwMgr());
1073else if (eld3) elmgr = &(eld3->ElDrwMgr());
1074if (elmgr == NULL) return;
[1642]1075
[1971]1076vector<string> opts;
1077ParseDisplayOption(sop, opts);
1078PIGraphicAtt gratt(opts);
[2243]1079unsigned long tpd = 0;
1080gratt.DecodeTextPosDirAtt(opts, tpd, false);
[2263]1081elmgr->ElAddText(xp,yp,txt.c_str(), gratt, tpd, fgcn);
[1642]1082eld->Refresh();
[349]1083}
[1642]1084
[1131]1085/* --Methode-- */
[2263]1086void PIStdImgApp::AddCompText(string const & txt, string const & txtup, string const & txtdn,
1087 double xp, double yp, string const& sop,
1088 string const& optss, bool fgcn)
1089{
[2489]1090// <ZThread> global PIApplication event loop synchronisation
[2755]1091ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1092
[2263]1093PIDrawer *eld=CurrentElDrawer();
1094if (eld == NULL) return;
1095PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1096PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1097if ((eld2 == NULL) && (eld3 == NULL)) return;
1098PIElDrwMgr* elmgr;
1099if (eld2) elmgr = &(eld2->ElDrwMgr());
1100else if (eld3) elmgr = &(eld3->ElDrwMgr());
1101if (elmgr == NULL) return;
1102
1103vector<string> opts;
1104ParseDisplayOption(sop, opts);
1105PIGraphicAtt gratt(opts);
1106unsigned long tpd = 0;
1107gratt.DecodeTextPosDirAtt(opts, tpd, false);
1108ParseDisplayOption(optss, opts);
1109PIGraphicAtt grattss(opts);
1110elmgr->ElAddCompText(xp,yp,txt.c_str(), gratt, txtup, txtdn, grattss, tpd, fgcn);
1111eld->Refresh();
1112}
1113
1114/* --Methode-- */
[2243]1115void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2,
[2263]1116 string const& sop, bool fgarrow, bool fgcn)
[1642]1117{
[2489]1118// <ZThread> global PIApplication event loop synchronisation
[2755]1119ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1120
[2165]1121PIDrawer *eld=CurrentElDrawer();
[1642]1122if (eld == NULL) return;
[2165]1123PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1124PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1125if ((eld2 == NULL) && (eld3 == NULL)) return;
1126PIElDrwMgr* elmgr = NULL;
1127if (eld2) elmgr = &(eld2->ElDrwMgr());
1128else if (eld3) elmgr = &(eld3->ElDrwMgr());
1129if (elmgr == NULL) return;
[1642]1130
[1971]1131vector<string> opts;
1132ParseDisplayOption(sop, opts);
1133PIGraphicAtt gratt(opts);
[2243]1134if (fgarrow)
[2263]1135 elmgr->ElAddArrow(xp1, yp1, xp2, yp2, gratt, fgcn);
1136else elmgr->ElAddLine(xp1, yp1, xp2, yp2, gratt, fgcn);
[1642]1137eld->Refresh();
1138}
1139
1140/* --Methode-- */
[1971]1141void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
[2263]1142 string const& sop, bool fgfill, bool fgcn)
[1642]1143{
[2489]1144// <ZThread> global PIApplication event loop synchronisation
[2755]1145ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1146
[2165]1147PIDrawer *eld=CurrentElDrawer();
[1642]1148if (eld == NULL) return;
[2165]1149PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1150PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1151if ((eld2 == NULL) && (eld3 == NULL)) return;
1152PIElDrwMgr* elmgr = NULL;
1153if (eld2) elmgr = &(eld2->ElDrwMgr());
1154else if (eld3) elmgr = &(eld3->ElDrwMgr());
[1642]1155
1156double xp,yp;
1157double dx, dy;
1158if (xp1 < xp2) {
1159 xp = xp1; dx = xp2-xp1;
1160}
1161else {
1162 xp = xp2; dx = xp1-xp2;
1163}
1164if (yp1 < yp2) {
1165 yp = yp1; dy = yp2-yp1;
1166}
1167else {
1168 yp = yp2; dy = yp1-yp2;
1169}
[1971]1170
1171vector<string> opts;
1172ParseDisplayOption(sop, opts);
1173PIGraphicAtt gratt(opts);
1174
[2263]1175if (fgfill) elmgr->ElAddFRect(xp, yp, dx, dy, gratt, fgcn);
1176else elmgr->ElAddRect(xp, yp, dx, dy, gratt, fgcn);
[1642]1177eld->Refresh();
1178}
1179
1180/* --Methode-- */
[2263]1181void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop,
1182 bool fgfill, bool fgcn)
[1642]1183{
[2489]1184// <ZThread> global PIApplication event loop synchronisation
[2755]1185ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1186
[2165]1187PIDrawer *eld=CurrentElDrawer();
[1642]1188if (eld == NULL) return;
[2165]1189PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1190PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1191if ((eld2 == NULL) && (eld3 == NULL)) return;
1192PIElDrwMgr* elmgr = NULL;
1193if (eld2) elmgr = &(eld2->ElDrwMgr());
1194else if (eld3) elmgr = &(eld3->ElDrwMgr());
[1642]1195
[1971]1196vector<string> opts;
1197ParseDisplayOption(sop, opts);
1198PIGraphicAtt gratt(opts);
[2243]1199if (r < -0.5)
1200 elmgr->ElAddMarker(xc, yc, gratt);
1201else {
[2263]1202 if (fgfill) elmgr->ElAddFCirc(xc, yc, r, gratt, fgcn);
1203 else elmgr->ElAddCirc(xc, yc, r, gratt, fgcn);
[2243]1204}
1205eld->Refresh();
1206}
[2265]1207/* --Methode-- */
[2638]1208void PIStdImgApp::AddOval(double xp, double yp, double dx, double dy,
1209 string const& sop, bool fgfill, bool fgcn)
1210{
1211// <ZThread> global PIApplication event loop synchronisation
[2755]1212ZSync zs(thr_glsyn, 2); zs.NOp();
[2638]1213
1214PIDrawer *eld=CurrentElDrawer();
1215if (eld == NULL) return;
1216PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1217PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1218if ((eld2 == NULL) && (eld3 == NULL)) return;
1219PIElDrwMgr* elmgr = NULL;
1220if (eld2) elmgr = &(eld2->ElDrwMgr());
1221else if (eld3) elmgr = &(eld3->ElDrwMgr());
1222
1223
1224vector<string> opts;
1225ParseDisplayOption(sop, opts);
1226PIGraphicAtt gratt(opts);
1227
1228if (fgfill) elmgr->ElAddFOval(xp, yp, dx, dy, gratt, fgcn);
1229else elmgr->ElAddOval(xp, yp, dx, dy, gratt, fgcn);
1230eld->Refresh();
1231}
1232
1233/* --Methode-- */
[2265]1234void PIStdImgApp::AddArc(double xc, double yc, double r, double a, double da,
1235 string const& sop, bool fgfill, bool fgcn)
1236{
[2489]1237// <ZThread> global PIApplication event loop synchronisation
[2755]1238ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1239
[2265]1240PIDrawer *eld=CurrentElDrawer();
1241if (eld == NULL) return;
1242PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1243PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1244if ((eld2 == NULL) && (eld3 == NULL)) return;
1245PIElDrwMgr* elmgr = NULL;
1246if (eld2) elmgr = &(eld2->ElDrwMgr());
1247else if (eld3) elmgr = &(eld3->ElDrwMgr());
[1971]1248
[2265]1249vector<string> opts;
1250ParseDisplayOption(sop, opts);
1251PIGraphicAtt gratt(opts);
1252if (fgfill) elmgr->ElAddFArc(xc, yc, r, a, da, gratt, fgcn);
1253else elmgr->ElAddArc(xc, yc, r, a, da, gratt, fgcn);
1254eld->Refresh();
1255}
1256
[2243]1257/* --Methode-- */
1258void PIStdImgApp::AddArc(double x1, double y1, double x2, double y2,
[2263]1259 double x3, double y3, string const& sop, bool fgfill, bool fgcn)
[2243]1260{
[2489]1261// <ZThread> global PIApplication event loop synchronisation
[2755]1262ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1263
[2243]1264PIDrawer *eld=CurrentElDrawer();
1265if (eld == NULL) return;
1266PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1267PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1268if ((eld2 == NULL) && (eld3 == NULL)) return;
1269PIElDrwMgr* elmgr = NULL;
1270if (eld2) elmgr = &(eld2->ElDrwMgr());
1271else if (eld3) elmgr = &(eld3->ElDrwMgr());
1272if (elmgr == NULL) return;
1273
1274vector<string> opts;
1275ParseDisplayOption(sop, opts);
1276PIGraphicAtt gratt(opts);
1277if (fgfill)
[2263]1278 elmgr->ElAddFArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
1279else elmgr->ElAddArc(x1, y1, x2, y2, x3, y3, gratt, fgcn);
[1642]1280eld->Refresh();
1281}
1282
1283/* --Methode-- */
[2263]1284void PIStdImgApp::AddPoly(vector<double>& xpol, vector<double>& ypol,
1285 string const& sop, bool fgfill, bool fgcn)
1286{
[2489]1287// <ZThread> global PIApplication event loop synchronisation
[2755]1288ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1289
[2263]1290PIDrawer *eld=CurrentElDrawer();
1291if (eld == NULL) return;
1292PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1293PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1294if ((eld2 == NULL) && (eld3 == NULL)) return;
1295PIElDrwMgr* elmgr = NULL;
1296if (eld2) elmgr = &(eld2->ElDrwMgr());
1297else if (eld3) elmgr = &(eld3->ElDrwMgr());
1298if (elmgr == NULL) return;
1299
1300vector<string> opts;
1301ParseDisplayOption(sop, opts);
1302PIGraphicAtt gratt(opts);
1303if (fgfill)
1304 elmgr->ElAddFPoly(xpol, ypol, gratt, fgcn);
1305else elmgr->ElAddPoly(xpol, ypol, gratt, fgcn);
1306eld->Refresh();
1307
1308}
1309
1310
1311/* --Methode-- */
[2165]1312void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom, string const& sop)
[1131]1313{
[2489]1314// <ZThread> global PIApplication event loop synchronisation
[2755]1315ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1316
[2165]1317PIDrawer *eld=CurrentElDrawer();
[1642]1318if (eld == NULL) return;
[2165]1319PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1320PIElDrawer3D* eld3 = dynamic_cast<PIElDrawer3D *>(eld);
1321if ((eld2 == NULL) && (eld3 == NULL)) return;
[1642]1322
[2165]1323vector<string> opts;
1324ParseDisplayOption(sop, opts);
1325PIGraphicAtt gratt(opts);
1326
1327if (eld2) {
1328 eld2->SetTitles(titletop, titlebottom, gratt);
1329 eld2->ShowTitles(true);
1330}
1331else if (eld3) {
1332 eld3->SetTitles(titletop, titlebottom, gratt);
1333 eld3->ShowTitles(true);
1334}
[1642]1335eld->Refresh();
1336}
[2165]1337/* --Methode-- */
1338void PIStdImgApp::SetAxeLabels(string const & xLabel, string const & yLabel, string const& sop)
1339{
[2489]1340// <ZThread> global PIApplication event loop synchronisation
[2755]1341ZSync zs(thr_glsyn, 2); zs.NOp();
[2489]1342
[2165]1343PIDrawer *eld=CurrentElDrawer();
1344if (eld == NULL) return;
1345PIElDrawer* eld2 = dynamic_cast<PIElDrawer *>(eld);
1346if (eld2 == NULL) return;
[1642]1347
[2165]1348vector<string> opts;
1349ParseDisplayOption(sop, opts);
1350PIGraphicAtt gratt(opts);
1351
1352eld2->SetAxesLabels(xLabel, yLabel, gratt);
1353eld2->ShowAxesLabels(true);
1354
1355eld->Refresh();
1356}
1357
[1642]1358/* --Methode-- */
[2165]1359PIDrawer* PIStdImgApp::CurrentElDrawer()
[1642]1360{
[2165]1361PIDrawer *eld=NULL;
[1642]1362if (!mLastWdg) return(eld);
[1131]1363PIScDrawWdg* sdw=NULL;
1364PIDraw3DWdg* w3d=NULL;
1365PIImage* imgw;
1366switch(mLastWdg->kind()) {
1367 case PIScDrawWdg::ClassId :
1368 sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
1369 if (sdw) eld = sdw->BaseDrawer();
1370 break;
1371 case PIDraw3DWdg::ClassId :
1372 w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
1373 if (w3d) eld = w3d->BaseDrawer();
1374 break;
1375 case PIImage::ClassId :
1376 imgw = dynamic_cast<PIImage *>(mLastWdg);
[1642]1377 if (imgw) eld = imgw->BaseDrawer();
[1131]1378 break;
1379 default :
1380 break;
1381 }
[1642]1382return(eld);
[1131]1383}
[165]1384
1385/* --Methode-- */
1386void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
1387{
1388if (nx < 1) nx = 1;
1389if (ny < 1) ny = 1;
1390if (nx > 8) nx = 8;
1391if (ny > 8) ny = 8;
1392if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
1393char buff[64];
1394mWId++;
[210]1395int px, py;
1396MainWin()->GetScreenPos(px, py);
1397sprintf(buff, "PI-GraphicWin (%d)",mWId);
1398PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
[165]1399win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
1400mWList[mWId*10+1] = (PIWindow*)win;
1401win->SetAutoDelChilds(true);
[293]1402// win->Show();
[165]1403mGrW = win;
1404mGrIdx = 0;
1405}
1406
1407/* --Methode-- */
1408void PIStdImgApp::CreateStackWin(int sx, int sy)
1409{
1410if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
1411char buff[64];
1412mWId++;
[210]1413int px, py;
1414MainWin()->GetScreenPos(px, py);
[165]1415sprintf(buff, "PI-StackWin (%d)",mWId);
[210]1416PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
[165]1417win->SetUserData(NULL, 9999); // UserFlag= 9999
1418mWList[mWId*10+2] = (PIWindow*)win;
1419win->SetAutoDelChilds(true);
[293]1420// win->Show();
[165]1421mStW = win;
1422m[2]->SetSensitivity("StackTools", true);
1423mStIdx = 0;
1424}
1425
1426/* --Methode-- */
[1971]1427PIWindow* PIStdImgApp::GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
[165]1428{
1429PIWindow* rw;
1430
1431switch (typ) {
1432 case Disp_Next : // Fenetre graphique courante
[1971]1433 case Disp_Default :
[165]1434 {
1435 if (mGrW == NULL) CreateGraphWin();
1436 int nx, ny;
1437 mGrW->NbZone(nx, ny);
1438 PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
1439// cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
[2651]1440 if (nw) DeleteWidget(nw, false, false);
[165]1441 flag = mGrIdx;
1442 mGrIdx = (mGrIdx+1)%(nx*ny);
1443 rw = mGrW;
1444 break;
1445 }
1446
1447 case Disp_Stack : // Fenetre de type stack (empilement)
1448 {
1449 if (mStW == NULL) CreateStackWin(sx, sy);
1450 px = py = 0;
1451 sx = mStW->XSize();
1452 sy = mStW->YSize();
1453 flag = mStIdx;
1454 mStIdx++;
1455 rw = mStW;
1456 }
1457 break;
1458
1459 default : // Fenetre ordinaire
1460 {
[210]1461 int pwx, pwy;
1462 MainWin()->GetScreenPos(pwx, pwy);
[165]1463 if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
[210]1464 rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
[165]1465 rw->SetUserData(NULL, 0); // UserFlag= 0
1466 mWId++;
1467 mWList[mWId*10] = rw;
1468 rw->SetAutoDelChilds(true);
[293]1469 // rw->Show();
[165]1470 px = py = 0;
1471 flag = 0;
1472 break;
1473 }
1474 }
1475
[293]1476rw->Show();
[165]1477mCurWin = rw;
1478return(rw);
1479}
1480
1481/* --Methode-- */
1482void PIStdImgApp::SetZone(int nzx, int nzy)
1483{
1484if (!mGrW) CreateGraphWin(nzx, nzy);
1485else {
1486 int k;
1487 PIWdg* cwd;
1488 for(k=0; k<mGrW->NbChilds(); k++) {
1489 if ((cwd = mGrW->GetChild(k)) == NULL) continue;
[2651]1490 DeleteWidget(cwd, false, false);
[165]1491 }
1492 mGrW->SetZone(nzx, nzy);
1493 }
1494}
1495
1496/* --Methode-- */
1497void PIStdImgApp::StackWinNext()
1498{
1499if (mStW) mStW->DispNext();
1500}
1501
1502/* --Methode-- */
1503void PIStdImgApp::DeleteWindow(PIWindow* w)
1504{
1505if (w == NULL) return;
1506w->Hide();
[344]1507bool ownwindow=false; // To Check if this is one of our windows
[165]1508WindMList::iterator it;
1509for(it = mWList.begin(); it != mWList.end(); it++)
[344]1510 if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
[165]1511if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
1512if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
1513if (w == mCurWin) mCurWin = NULL;
[344]1514
1515if (!ownwindow) return; // We do nothing if this is not a window we have created ...
1516
[165]1517int k;
1518PIWdg* cwd;
1519for(k=0; k<w->NbChilds(); k++) {
1520 if ((cwd = w->GetChild(k)) == NULL) continue;
[2651]1521 DeleteWidget(cwd,false,false);
[165]1522 }
1523delete w;
1524return;
1525}
1526
1527/* --Methode-- */
[2651]1528void PIStdImgApp::DeleteWidget(PIWdg* w, bool dw, bool dwin)
[165]1529{
1530if (w == NULL) return;
1531BWMList::iterator it;
1532for(it = mBWList.begin(); it != mBWList.end(); it++)
1533 if ((*it).second == w) { mBWList.erase(it); break; }
[2762]1534PIBaseWdg* bw = NULL;
1535if (w->kind() == PIImageNavigator::ClassId) {
1536 PIImageNavigator* piin = dynamic_cast<PIImageNavigator *>(w);
1537 if (piin) bw = piin->ImageWdg();
1538}
1539else bw = dynamic_cast<PIBaseWdg *>(w);
[2651]1540if (bw != NULL) {
1541 PIDrawer* drw;
1542 int k;
1543 for(k=0; k<bw->NbDrawers(); k++) {
1544 if ((drw = bw->GetDrawer(k)) == NULL) continue;
1545 DrwMList::iterator itt;
1546 for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
1547 if ((*itt).second == drw) { mDrwList.erase(itt); break; }
[165]1548 }
[2651]1549}
[165]1550
[2762]1551if ( (w == mCurWdg) || (bw == mCurWdg) ) {
[165]1552 mCurWdg = NULL;
1553 if (mFgCWImg) {
1554 m[4]->SetSensitivityMsg(10515, false);
1555 m[4]->SetSensitivityMsg(10516, false);
1556 mFgCWImg = false;
1557 }
1558 }
1559
[2762]1560if ( (w == mLastWdg) || (bw == mLastWdg) ) mLastWdg = NULL;
[165]1561
1562PIWdg* pw=NULL;
[2651]1563pw = (PIWdg*)(w->Parent());
1564//DBG printf("DeleteWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
[2762]1565if (dw) delete w;
1566
1567if (dwin && pw) {
1568 PIWindow* pww = dynamic_cast<PIWindow *>(pw);
1569 if (pww && (pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
[165]1570 DeleteWindow((PIWindow*)pw);
[2762]1571 }
[165]1572return;
1573}
1574
1575
1576
1577/* --Methode-- */
1578void PIStdImgApp::DelWRsId(int k)
1579{
1580//DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
1581if (k > 0) { // C'est un BaseWidget
1582 BWMList::iterator it;
1583 it = mBWList.find(k);
1584 if (it == mBWList.end()) return;
[2651]1585 PIWdg* wd = (*it).second;
[165]1586//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
[2651]1587 DeleteWidget(wd, true, true);
[165]1588 }
1589else { // C'est un drawer
1590 DrwMList::iterator it;
1591 it = mDrwList.find(-k);
1592 if (it == mDrwList.end()) return;
[2231]1593 (*it).second->SetAutoRefreshOnDelete(true);
[165]1594 delete (*it).second;
1595 mDrwList.erase(it);
[2402]1596 //DBG cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
[165]1597 }
1598}
[368]1599/* --Methode-- */
1600bool PIStdImgApp::CheckWRsId(int k)
1601{
1602if (k > 0) { // C'est un BaseWidget
1603 BWMList::iterator it;
1604 it = mBWList.find(k);
1605 if (it == mBWList.end()) return(false);
1606 else return(true);
1607 }
1608else { // C'est un drawer
1609 DrwMList::iterator it;
1610 it = mDrwList.find(-k);
1611 if (it == mDrwList.end()) return(false);
1612 else return(true);
1613 }
1614}
[165]1615
[1971]1616/* --Methode-- */
1617void PIStdImgApp::StatZoomWindowSetVisible(bool fg)
1618{
[165]1619
[1971]1620 if (fg) {
[2778]1621 consolecont->Hide();
[1971]1622 consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
1623 int szy = MainWin()->YSize();
1624 MainWin()->SetSize(MainWin()->XSize(), szy+statcont->YSize());
1625 consolecont->SetPos(0, statcont->YSize());
1626 consolecont->SetSize(MainWin()->XSize(), szy);
1627 consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
[2778]1628 consolecont->Show();
[1971]1629 statcont->Show();
1630 m[3]->SetStateMsg(10470, true);
1631 }
1632 else {
1633 statcont->Hide();
[2778]1634 consolecont->Hide();
[1971]1635 consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
1636 MainWin()->SetSize(MainWin()->XSize(), MainWin()->YSize()-statcont->YSize());
1637 consolecont->SetPos(0, 0);
1638 consolecont->SetSize(MainWin()->XSize(), MainWin()->YSize());
1639 consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
[2778]1640 consolecont->Show();
[1971]1641 m[3]->SetStateMsg(10470, false);
1642 }
1643
1644}
1645
[165]1646/* --Methode-- */
[2106]1647void PIStdImgApp::UpdateStatResourceInfo()
1648{
1649 resusg.Update();
1650 char buff[256];
1651 string lab;
1652 double frac;
[2158]1653 sprintf(buff, "Mem: %ld/Max= %ld kb" , (long)resusg.getMemorySize(),
1654 (long)resusg.getMaxMemorySize());
[2106]1655 lab = buff;
1656 lab_mem->SetLabel(lab);
1657 frac = (double)resusg.getMemorySize()/(double)resusg.getMaxMemorySize();
1658 therm_mem->SetValue(frac);
1659
[2158]1660 sprintf(buff, "CPU: %ld/elap= %ld ms" , (long)resusg.getCPUTime(),
1661 (long)resusg.getElapsedTime());
[2106]1662 lab = buff;
1663 lab_cpu->SetLabel(lab);
[2259]1664 if (resusg.getCPULoad() > resusg.getAverageCPULoad())
1665 therm_cpu->SetValue(resusg.getCPULoad());
1666 else
1667 therm_cpu->SetValue(resusg.getAverageCPULoad());
[2486]1668 int nlx = 0;
1669 bool fgx = false;
[2489]1670 if ( CmdInterpreter() ) fgx = CmdInterpreter()->isRunning(nlx);
[2486]1671 if (!fgx) {
1672 lab = "PIACmdThread Idle";
1673 lab_thrcmd->SetLabel(lab);
1674 lab_thrcmd->SetForegroundColor(PI_Green);
1675 }
1676 else {
1677 sprintf(buff, "PIACmdThread Running - NL=%d" , nlx);
1678 lab = buff;
1679 lab_thrcmd->SetLabel(lab);
1680 if (nlx < 3) lab_thrcmd->SetForegroundColor(PI_Yellow);
1681 else lab_thrcmd->SetForegroundColor(PI_Red);
1682 }
[2106]1683}
1684
1685/* --Methode-- */
[165]1686void PIStdImgApp::RedirectStdOutErr(bool fg)
1687{
1688if (fg) {
1689 RedirectOutStream(mCons);
1690 RedirectErrStream(mCons);
1691 m[5]->SetStateMsg(10602, true);
[293]1692 redirecout = true;
[165]1693 }
1694else {
1695 RedirectOutStream(NULL);
1696 RedirectErrStream(NULL);
1697 m[5]->SetStateMsg(10602, false);
[293]1698 redirecout = false;
[165]1699 }
1700return;
1701}
1702
1703/* --Methode-- */
[374]1704void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
[165]1705{
[912]1706#ifdef SANS_EVOLPLANCK
[374]1707PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
[912]1708#else
[2944]1709// On active aussi SIGUSR1 pour stopthr
1710SophyaConfigureSignalhandling(fgfpe, fgsegv, true, true, true);
[912]1711#endif
[374]1712m[5]->SetStateMsg(10603, fgfpe);
1713m[5]->SetStateMsg(10604, fgsegv);
[165]1714}
1715
1716/* --Methode-- */
1717void PIStdImgApp::CloseAllWindows()
1718{
1719WindMList::iterator it;
1720for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
1721mWList.clear();
1722mBWList.clear();
1723mDrwList.clear();
[454]1724mGrW = NULL;
1725mStW = NULL;
1726mCurWin = NULL;
1727mCurWdg = NULL;
1728mLastWdg = NULL;
1729m[4]->SetSensitivityMsg(10515, false);
1730m[4]->SetSensitivityMsg(10516, false);
[165]1731}
1732
[1971]1733//---------------------------------------------------------------------------
1734//--------- Gestion des attributs graphiques et autres options de trace -----
1735
[165]1736/* --Methode-- */
[1971]1737void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
1738{
1739 mIXmin = xmin; mIXmax= xmax;
1740 mIYmin = ymin; mIYmax= ymax;
1741}
1742
1743/* --Methode-- */
1744void PIStdImgApp::SetDefaultGraphicAttributes(string const & opt)
1745{
1746 ParseDisplayOption(opt, mDefaultAtt);
1747}
1748
1749/* --Methode-- */
1750void PIStdImgApp::SetDefaultAxesAttributes(string const & opt)
1751{
1752 ParseDisplayOption(opt, mAxesAtt);
1753}
1754
1755/* --Methode-- */
1756DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts)
1757{
1758 DispWinEnum rc = Disp_Next;
1759 //DBG cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl;
1760 if (opts.size() > 0) opts.erase(opts.begin(), opts.end());
1761 if (sop.length() < 1) return(rc);
1762 string gratt = sop;
1763 for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
1764 if ( (gratt == "def") || (gratt == "default") ) return(rc);
1765// On separe en mots espaces par des blancs ou tabulation
1766 size_t p = 0;
1767 size_t q = 0;
1768 size_t l = gratt.length();
1769 string token;
1770 while (q < l) {
1771 p = gratt.find_first_not_of(" \t",q); // au debut d'un token
1772 if (p >= l) break;
1773 q = gratt.find_first_of(" \t",p); // Premier blanc ou tab suivant
1774 if (q<l) token = gratt.substr(p,q-p);
1775 else token = gratt.substr(p);
1776 if (token == "") continue;
1777 // Decodage option fenetre d'affichage (win, next, ...)
1778 if (token == "win") rc = Disp_Win;
1779 else if (token == "same") rc = Disp_Same;
1780 else if (token == "inset") rc = Disp_Inset;
1781 else if (token == "stack") rc = Disp_Stack;
[2118]1782 else if (token == "next") rc = Disp_Next;
[1971]1783 // Option a etre decode par les drawers, etc ...
1784 else opts.push_back(token);
1785 }
1786
1787 //DBG cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl;
[2383]1788 if (rc == Disp_Same) nb_disp_same++;
1789 else nb_disp_same = 0;
[1971]1790 return (rc);
1791}
1792
1793//---------------------------------------------------------------------------
1794//------------ Methodes privees (MBProcessx, ...) ----------
1795
1796/* --Methode-- */
[165]1797void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1798{
1799
1800 switch(msg)
1801 {
[686]1802 case 10150 :
1803 showInfoWindow(this);
1804 break;
1805
1806 case 10155 :
1807 hideInfoWindow(this);
1808 break;
1809
[293]1810 case 10100 :
[2489]1811 CmdInterpreter()->ShowHelpWindow();
[293]1812 break;
1813
[165]1814 case 10120 :
[685]1815 pfc_fits->AcceptNewFile(false);
[165]1816 mFCMsg = 10125;
[685]1817 pfc_fits->SetMsg(mFCMsg);
[165]1818 SetBlocked();
[685]1819 pfc_fits->Show();
[165]1820 break;
1821
1822 case 10125 :
1823 SetBusy();
1824 if (data) {
[2904]1825 string cmd = "readfits ";
1826 cmd += pfc_fits->GetFileName();
1827 try {
1828 CmdInterpreter()->AddInputLine(cmd);
1829 // CmdInterpreter()->ExecuteCommand(kw, args, toks);
1830 }
1831 catch ( PThrowable & exc ) {
1832 cerr << "\n PIStdImgApp::Process()/ Cmd->ExecuteCommand(readfits) Exception :"
1833 << (string)typeid(exc).name() << " Msg= "
1834 << exc.Msg() << endl;
1835 cout << endl;
1836 }
1837 catch ( ... ) {
1838 cerr << "\n PIStdImgApp::Process()/ Cmd->ExecuteCommand(readfits) Catched Exception ... " << endl;
1839 cout << endl;
1840 }
[165]1841 }
1842 mFCMsg = 0;
1843 SetReady();
1844 break;
1845
1846 case 10130 :
[685]1847 pfc_ppf->AcceptNewFile(false);
[165]1848 mFCMsg = 10135;
[685]1849 pfc_ppf->SetMsg(mFCMsg);
[165]1850 SetBlocked();
[685]1851 pfc_ppf->Show();
[165]1852 break;
1853
1854 case 10135 :
1855 mFCMsg = 0;
1856 if (data) {
[685]1857 PPInMgrW()->SetFile(pfc_ppf->GetFileName());
[165]1858 PPInMgrW()->Show();
1859 }
1860 SetReady();
1861 break;
1862
[2263]1863#ifndef SANS_EVOLPLANCK
1864 case 10140 :
1865 pfc_ascii->AcceptNewFile(false);
1866 mFCMsg = 10145;
1867 pfc_ascii->SetMsg(mFCMsg);
1868 SetBlocked();
1869 pfc_ascii->Show();
1870 break;
1871
1872 case 10145 :
1873 SetBusy();
1874 if (data) {
1875 string afname = pfc_ascii->GetFileName();
1876 string nomobj = ObjMgr()->GetServiceObj()->FileName2Name(afname);
1877 string cmd = "mtxfrascii ";
1878 cmd += nomobj; cmd += " "; cmd += afname;
1879 try {
[2489]1880 CmdInterpreter()->AddInputLine(cmd);
1881 // mCmd->Interpret(cmd);
[2263]1882 }
1883 catch ( PThrowable & exc ) {
1884 cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
1885 << (string)typeid(exc).name() << " Msg= "
1886 << exc.Msg() << endl;
1887 cout << endl;
1888 }
1889 catch ( ... ) {
1890 cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ... " << endl;
1891 cout << endl;
1892 }
1893
1894 }
1895 mFCMsg = 0;
1896 SetReady();
1897 break;
1898#endif
1899
[165]1900 case 10105:
1901 Stop();
1902 break;
1903
1904 }
1905return;
1906}
1907
1908
1909
1910/* --Methode-- */
1911void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1912{
1913
1914switch (msg) {
1915 case 10201 :
1916 ObjMgrW()->Show();
1917 break;
1918
1919 case 10220 :
[685]1920 pfc_ppf->AcceptNewFile(true);
[165]1921 mFCMsg = 10225;
[685]1922 pfc_ppf->SetMsg(mFCMsg);
[165]1923 SetBlocked();
[685]1924 pfc_ppf->Show();
[165]1925 break;
1926
1927 case 10225 :
1928 SetBusy();
1929 if (data) {
1930 if (mPpfout) {
1931 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
1932 delete mPpfout;
1933 }
[685]1934 name_outppf = pfc_ppf->GetFileName();
[165]1935 mPpfout = NULL;
1936 printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
1937 mPpfout = new POutPersist(name_outppf);
1938 }
1939 mFCMsg = 0;
1940 SetReady();
1941 break;
1942
1943 case 10230 :
1944 if (!mPpfout) break;
1945 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
1946 delete mPpfout;
1947 name_outppf = "";
1948 mPpfout = NULL;
1949 break;
1950
[686]1951 case 10270 :
1952 if (mCurWdg) {
1953 int oid = mCurWdg->UserFlag();
[2762]1954 //RZDEL-Mai2005 DeleteWidget(mCurWdg);
[686]1955 mObjMgr->DelObj_Id(oid);
1956 }
1957 break;
[165]1958
1959 default:
1960 cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
1961 break;
1962}
1963
1964return;
1965}
1966
1967/* --Methode-- */
1968void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1969{
1970
1971switch (msg) {
1972 case 10301 :
1973 PIImgTools::ShowPIImgTools();
1974 break;
1975 case 10302 :
1976 PIDrwTools::ShowPIDrwTools();
1977 break;
[1590]1978 case 10303 :
1979 PIAxesTools::ShowPIAxesTools();
1980 break;
[165]1981
[1590]1982 case 10304 :
[2489]1983 CmdInterpreter()->ShowCxxExecWindow();
[1251]1984 break;
1985
[1590]1986 case 10311 :
1987 case 10312 :
[165]1988 {
1989 PIImage* curpimg = NULL;
1990 if (!mCurWdg) return;
1991 if (mCurWdg->kind() != PIImage::ClassId) return;
1992 curpimg = (PIImage*)mCurWdg;
1993 if (curpimg == NULL) return;
1994 P2DArrayAdapter* img = curpimg->Image();
1995 if (img == NULL) return;
1996 int dx = curpimg->XSzPave();
1997 int dy = curpimg->YSzPave();
1998 int x0 = curpimg->XPave()-dx/2;
1999 int y0 = curpimg->YPave()-dy/2;
2000 if (x0 < 0) x0 = 0;
2001 if (y0 < 0) y0 = 0;
2002 int x1 = x0+dx;
2003 int y1 = y0+dy;
2004 if (x1 > img->XSize()) x1 = img->XSize();
2005 if (y1 > img->YSize()) y1 = img->YSize();
2006 dx = x1-x0; dy = y1-y0;
2007 ImageR4* pim = new ImageR4(dx, dy);
2008 int ii, jj;
2009 for(jj=0; jj<dy; jj++)
2010 for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
[338]2011 if (msg == 10305) { // Calcul des coordonnees du sous-pave
2012 double xc1, yc1;
2013 img->Coord(x0, y0, xc1, yc1);
2014 pim->SetOrg((int)xc1, (int)yc1);
2015 }
[165]2016 string nom = mCurWdg->Nom() + "_pave";
2017 ObjMgr()->AddObj(pim, nom);
2018 ObjMgr()->DisplayObj(nom, "w");
[293]2019 break;
[165]2020 }
2021
[1590]2022 case 10313 :
[293]2023 {
2024 PIImage* curpimg = NULL;
2025 if (!mCurWdg) return;
2026 if (mCurWdg->kind() != PIImage::ClassId) return;
2027 curpimg = (PIImage*)mCurWdg;
2028 if (curpimg == NULL) return;
2029 curpimg->ShowCuts(true);
2030 break;
2031 }
2032
[165]2033 case 10320 :
2034 if (mStW) mStW->DispNext();
2035 break;
2036
2037 case 10321 :
2038 case 10322 :
2039 case 10324 :
2040// case 10328 :
[191]2041 if (mStW) mStW->StartAutoDisp((msg-10320)*500);
[165]2042 break;
2043
2044 case 10329 :
2045 if (mStW) mStW->StopAutoDisp();
2046 break;
2047
2048 case 103330 :
2049 if (mStW) {
2050 PIWdg* cw = mStW->CurrentWdg();
[2651]2051 if (cw) DeleteWidget(cw);
[165]2052 }
2053 break;
2054
2055 default:
2056 cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
2057 break;
2058 }
2059return;
2060}
2061
2062/* --Methode-- */
2063void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
2064{
2065
2066switch (msg) {
2067
2068 case 10400 :
2069 CreateStackWin();
2070 break;
2071
2072 case 10411 :
2073 CreateGraphWin(1,1);
2074 break;
2075 case 10421 :
2076 CreateGraphWin(1,2);
2077 break;
2078 case 10412 :
2079 CreateGraphWin(2,1);
2080 break;
2081 case 10422 :
2082 CreateGraphWin(2,2);
2083 break;
2084 case 10431 :
2085 CreateGraphWin(1,3);
2086 break;
2087 case 10433 :
2088 CreateGraphWin(3,3);
2089 break;
[558]2090 case 10441 :
2091 if (mCurWdg) {
2092 mLastWdg = mCurWdg;
2093 cout << " Using current widget as last-widget (display same) " << endl;
2094 }
2095 else cout << " No current widget - select widget with mouse " << endl;
2096 break;
[686]2097 case 10460 :
2098 DeleteWindow(mCurWin);
2099 break;
[1971]2100 case 10470 :
2101 StatZoomWindowSetVisible(m[3]->GetStateMsg(10470));
2102 break;
[165]2103 default:
2104 cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
2105 break;
2106 }
2107return;
2108}
2109
2110
2111/* --Methode-- */
2112void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
2113{
2114char nomps[64],strg[512];
2115PSFile *mps;
2116int sxt, syt, syo, syo1, sx[4], sy[4];
2117
2118switch (msg)
2119 {
2120 case 10501 :
[685]2121 pfc_ps->AcceptNewFile(true);
[165]2122 mFCMsg = 10525;
[685]2123 pfc_ps->SetMsg(mFCMsg);
[165]2124 SetBlocked();
[685]2125 pfc_ps->Show();
[165]2126 break;
2127
2128 case 10525 :
2129 SetBusy();
2130 if (data) {
2131 if (mpsfile) {
2132 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
2133 delete mpsfile;
2134 }
[685]2135 name_ps = pfc_ps->GetFileName();
[165]2136 printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
2137 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
2138 }
2139 mFCMsg = 0;
2140 SetReady();
2141 break;
2142
2143 case 10505 :
2144 if (!mpsfile) break;
2145 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
2146 delete mpsfile;
2147 mpsfile = NULL;
2148 name_ps = "";
2149 break;
2150
2151 case 10511 : // Window -> PS
2152 case 10512 : // Window -> EPS
2153 if (CurrentWindow() == NULL) break;
2154 if (msg == 10512)
2155 {
2156 num_eps++;
2157 sprintf(nomps,"pia%d.eps", num_eps);
2158 printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
2159 mps = new PSFile(nomps);
2160 }
2161 else {
2162 if (mpsfile == NULL) {
2163 name_ps = "pia.ps";
2164 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
2165 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
2166 }
2167 printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
2168 mps = mpsfile;
2169 }
2170 CurrentWindow()->PSPrint(mps,0,0);
2171
2172 if (msg == 10512) delete mps; // fichier eps
2173 break;
2174
2175 case 10515 : // Image -> PS
2176 case 10516 : // Image -> EPS
2177 {
2178 PIImage* curpimg = NULL;
2179 if (!mCurWdg) return;
2180 if (mCurWdg->kind() != PIImage::ClassId) return;
2181 curpimg = (PIImage*)mCurWdg;
2182 if (curpimg == NULL) return;
2183 if (msg == 10516)
2184 {
2185 num_eps++;
2186 sprintf(nomps,"pia%d.eps", num_eps);
2187 printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
2188 mps = new PSFile(nomps);
2189 }
2190 else {
2191 if (mpsfile == NULL) {
2192 name_ps = "pia.ps";
2193 mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
2194 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
2195 }
2196 printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
2197 mps = mpsfile;
2198 }
2199
2200 sx[0] = gimv->XSize();
2201 sy[0] = gimv->YSize();
2202 sx[1] = zoom->XSize();
2203 sy[1] = zoom->YSize();
2204 sx[2] = cmapv->XSize();
2205 sy[2] = cmapv->YSize();
2206 sx[3] = curpimg->XSize();
2207 sy[3] = curpimg->YSize();
2208 if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
2209 else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
2210 syt = sy[3]+syo;
2211 sxt = sx[3];
2212 if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
2213 if (sxt < sx[2]) sxt = sx[2];
2214
2215 // Pour ecrire le titre
2216 mps->NewPage((float)sxt, (float)syt, PI_Portrait);
2217 mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
2218 sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
2219 curpimg->XPave(), curpimg->YPave());
[384]2220 mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20);
[165]2221 mps->EndBloc();
2222
2223 // Les quatre fenetres glovimage, zoom, cmap, image
2224 gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
2225 zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
2226 cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
2227 curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
2228
2229 if (msg == 10516) delete mps; // fichier eps
2230 break;
2231 }
2232
2233 default:
2234 cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
2235 break;
2236 }
2237
2238}
2239
2240
2241/* --Methode-- */
2242void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
2243{
2244switch (msg) {
2245 case 10601:
2246 CloseAllWindows();
2247 break;
2248 case 10602:
2249 RedirectStdOutErr(*((bool*)data));
2250 break;
2251 case 10603:
[374]2252 case 10604:
2253 CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
[165]2254 break;
[449]2255 case 10605:
2256 mObjMgr->SetVerbose(m[5]->GetStateMsg(10605));
2257 break;
[1251]2258 case 10606:
[2489]2259 CmdInterpreter()->ShowCxxOptionWindow();
[1251]2260 break;
[165]2261 default:
2262 cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
2263 break;
2264 }
2265return;
2266}
2267
2268
[1569]2269
[686]2270// -------------------------------------------------
2271// Fenetre info piapp (About piapp)
2272// -------------------------------------------------
2273static PIWindow* infow_win = NULL;
2274static PIText* infow_txt = NULL;
2275static PICMapView* infow_cmap = NULL;
2276static PIButton* infow_but = NULL;
2277
2278/* Nouvelle-Fonction */
2279static void createInfoWindow(PIStdImgApp* app)
2280{
2281if (infow_win) return;
2282
2283int bsx, bsy;
2284PIApplicationPrefCompSize(bsx, bsy);
2285int spx, spy;
2286spx = bsx/6; spy = bsy/6;
2287
2288infow_win = new PIWindow((PIMsgHandler *)app, "About piapp",
2289 PIWK_dialog, bsx*5+3*spx, bsy*4+spy*3, 200, 200);
2290infow_win->SetAutoDelChilds(true);
2291infow_txt = new PIText(infow_win,"about_piapp_text", bsx*5+spx, bsy*3, spx, spy);
2292infow_txt->SetMutiLineMode(true);
2293infow_txt->SetTextEditable(false);
2294infow_txt->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
2295infow_cmap = new PICMapView(infow_win, "about_piapp_cmap", bsx*4, bsy*0.7, spx, 2*spy+bsy*3.15);
2296infow_cmap->SetColMapId(CMAP_COLBR32, 1., -1., false);
2297infow_cmap->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
2298infow_but = new PIButton(infow_win,"OK", 10155, bsx, bsy, bsx*4+2*spx, 2*spy+bsy*3);
2299infow_but->SetMsgParent((PIMsgHandler *)app);
2300infow_but->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
2301char buff[128];
2302#ifdef SANS_EVOLPLANCK
2303sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
2304 (double)PI_VERSIONNUMBER, (float)PeidaVersion());
2305#else
[692]2306{
[686]2307sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
[692]2308 (double)PI_VERSIONNUMBER, glst_piai->Version());
2309}
[686]2310#endif
2311string info = "piapp : Interactive analysis program\n";
2312info += buff;
[2427]2313info += "(C) LAL-IN2P3/CNRS 1996-2003\n";
2314info += "(C) SPP-DAPNIA/CEA 1996-2003\n";
2315#ifndef SANS_EVOLPLANCK
2316 info += "Check http://www.sophya.org for more information";
2317#endif
[686]2318infow_txt->SetText(info);
2319}
2320
2321/* Nouvelle-Fonction */
2322static void showInfoWindow(PIStdImgApp* app)
2323{
[692]2324if (!infow_win) createInfoWindow(app);
2325if (infow_win) infow_win->Show();
[686]2326}
2327/* Nouvelle-Fonction */
2328static void hideInfoWindow(PIStdImgApp* app)
2329{
[692]2330if (infow_win) infow_win->Hide();
[686]2331}
2332
2333/* Nouvelle-Fonction */
2334static void deleteInfoWindow()
2335{
2336if (!infow_win) return;
2337delete infow_win;
2338infow_win = NULL;
2339infow_txt = NULL;
2340infow_cmap = NULL;
2341infow_but = NULL;
2342}
2343
[2106]2344
Note: See TracBrowser for help on using the repository browser.