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

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

Desaction SIGUSR1 ds appel SophyaConfigureSignalhandling() ds PIStdImgApp - suite gestion handler signal dans ZThread / Commander - Reza 29 mai 2005

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