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

Last change on this file since 685 was 685, checked in by ercodmgr, 26 years ago

FileChooser multiples ds PIStdImgApp, Correction Ndisp ds PINTuple, Fenetre NObjMgrWind non bloquant desormais ds piapp - Reza 12/12/99

  • Property svn:executable set to *
File size: 35.8 KB
Line 
1#include "machdefs.h"
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5
6#include <typeinfo>
7
8#include <string>
9#include <vector>
10
11#include "strutil.h"
12#include "timing.h"
13#include "perrors.h"
14#include "ctimer.h"
15
16#include "psighand.h"
17
18#include "cimage.h" // pour pouvoir faire extract
19
20#include "pistdimgapp.h"
21#include "pihisto2d.h"
22#include "psfile.h"
23#include "piimgtools.h"
24#include "pidrwtools.h"
25
26#include "pistzwin.h"
27
28#include "piinit.h"
29#include "piversion.h"
30#include "piaversion.h"
31
32
33static char ImgDir[256];
34static char WorkDir[256];
35
36
37/* ........................................................... */
38/* Classe PIStdImgApp */
39/* ........................................................... */
40
41/* --Methode-- */
42PIStdImgApp::PIStdImgApp(int narg, char* arg[])
43: PIApplication(420, 320, narg, arg)
44{
45
46// Les menus
47m[0] = new PIMenu(Menubar(),"Fichier");
48m[0]->AppendItem("Help", 10100);
49m[0]->AppendItem("Open-Fits", 10120);
50m[0]->AppendItem("Open-PPF", 10130);
51m[0]->AppendItem("Close", 10110);
52m[0]->AppendItem("delete", 10111);
53// m[0]->AppendItem("Options", 10101);
54m[0]->AppendItem("Exit", 10105);
55
56m[1] = new PIMenu(Menubar(),"Objets");
57m[1]->AppendItem("ObjectManager", 10201);
58m[1]->AppendItem("OpenOutPPF", 10220);
59m[1]->AppendItem("CloseOutPPF", 10230);
60
61m[2] = new PIMenu(Menubar(),"Tools");
62m[2]->AppendItem("Show ImageTools", 10301);
63m[2]->AppendItem("Show DrawerTools", 10302);
64m[2]->AppendItem("Ext.Pave", 10304);
65m[2]->AppendItem("Ext.Pave+Org", 10305);
66m[2]->SetSensitivityMsg(10305, false);
67m[2]->AppendItem("Cuts X,Y", 10306);
68m[2]->SetSensitivityMsg(10306, false);
69mc = new PIMenu(m[2], "StackTools");
70mc->AppendItem("DispNext", 10320);
71mc->AppendItem("Blink 0.5s", 10321);
72mc->AppendItem("Blink 1s", 10322);
73mc->AppendItem("Blink 2s", 10324);
74mc->AppendItem("Stop Blink", 10329);
75mc->AppendItem("RemoveCurrent", 10330);
76m[2]->AppendPDMenu(mc);
77m[2]->SetSensitivity("StackTools", false);
78
79m[3] = new PIMenu(Menubar(),"Window");
80m[3]->AppendItem("StackWindow", 10400);
81m[3]->AppendItem("Window", 10411);
82m[3]->AppendItem("Window 2x1", 10421);
83m[3]->AppendItem("Window 1x2", 10412);
84m[3]->AppendItem("Window 2x2", 10422);
85m[3]->AppendItem("Window 3x1", 10431);
86m[3]->AppendItem("Window 3x3", 10433);
87m[3]->AppendItem("Cur->LastWdg", 10441);
88
89m[4] = new PIMenu(Menubar(),"PostScript");
90m[4]->AppendItem("OpenPS", 10501);
91m[4]->AppendItem("ClosePS", 10505);
92m[4]->AppendItem("Window->PS", 10511);
93m[4]->AppendItem("Image->PS", 10515);
94m[4]->AppendItem("Window->EPS", 10512);
95m[4]->AppendItem("Image->EPS", 10516);
96m[4]->SetSensitivityMsg(10515, false);
97m[4]->SetSensitivityMsg(10516, false);
98
99m[5] = new PIMenu(Menubar(),"Special");
100m[5]->AppendItem("CloseAll", 10601);
101m[5]->AppendCheckItem("Red.Out/Err", 10602);
102m[5]->AppendCheckItem("Catch SigFPE", 10603);
103m[5]->AppendCheckItem("Catch SigSEGV", 10604);
104m[5]->AppendCheckItem("ObjMgr Verb", 10605);
105
106m[6] = new PIMenu(Menubar(),"Modules");
107
108AppendMenu(m[0]);
109AppendMenu(m[1]);
110AppendMenu(m[2]);
111AppendMenu(m[3]);
112AppendMenu(m[4]);
113AppendMenu(m[5]);
114// AppendMenu(m[6]); Menu Modules vide pour le moment
115
116int scsx, scsy;
117ScreenSz(scsx, scsy);
118if (scsy <= 600) mFgScSz = 0;
119else if (scsy <= 800) mFgScSz = 1;
120else if (scsy <= 1024) mFgScSz = 2;
121else mFgScSz = 3;
122int msx = 420+mFgScSz*60;
123int msy = 320+mFgScSz*40;
124MainWin()->SetSize(msx, msy);
125
126int bss = 100+mFgScSz*15;
127gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5);
128gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
129zoom = new PIPixmap(MainWin(), "Zoom", bss, bss, bss+10, 5);
130zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
131cmapv = new PICMapView(MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
132cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
133
134int cpy = bss+10+14+mFgScSz*2+5;
135
136// Creation d'une console avec gestion des commandes
137mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy );
138mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
139mCons->AcceptCmd(true, 50);
140redirecout = false;
141// RedirectStdOutErr(true); pas par defaut
142
143mObjMgr = new NamedObjMgr;
144mCmd = new PIACmd(mObjMgr, this);
145
146// Pas trop de message de la part de NamedObjMgr
147m[5]->SetStateMsg(10605, false);
148mObjMgr->SetVerbose(false);
149
150char* varenv;
151ImgDir[0] = WorkDir[0] = '\0';
152if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
153if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
154
155pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
156pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
157pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
158
159mObjmgrw = new ObjMgrWind(this);
160mPpinmgrw = new PPInMgrWind(this);
161
162// Attention : A faire apres creation de ObjMgrWind !!!
163mObjMgr->SetImgApp(this);
164
165// Gestion des feneteres widgets et drawers
166mWId = mDId = mBWId = 0;
167mCurWin = NULL;
168mCurWdg = NULL;
169mLastWdg = NULL;
170mGrW = NULL;
171mStW = NULL;
172mGrIdx = mStIdx = -1;
173
174mFCMsg = 0;
175mFgCWImg = false;
176
177// Gestion fichiers PS
178num_eps = 0;
179name_ps = "";
180name_ps = "pia.ps";
181mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
182
183// Gestion OUT-PPF
184mPpfout = NULL;
185name_outppf = "";
186
187// Attributs graphiques courants
188mFCol = mBCol = PI_NotDefColor;
189mLAtt = PI_NotDefLineAtt;
190mFSz = PI_NotDefFontSize;
191mFAtt = PI_NotDefFontAtt;
192mMSz = -1;
193mMrk = PI_NotDefMarker;
194mCmapid = CMAP_OTHER;
195mZoom = 0;
196mAxesFlags = kBoxAxes | kExtTicks | kLabels;
197SetXYLimits(-1, 1., -1., 1.);
198mFXYlim = false;
199SetInsetLimits(0.4, 0.6, 0.4, 0.6);
200SetImageCenterPosition(-1,-1);
201mFImgCenter = false;
202maXlog = maYlog = false;
203SaveGraphicAtt();
204
205// Initialisation
206PIAppInitiator * piai = new PIAppInitiator(this);
207
208char buff[128];
209mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
210#ifdef SANS_EVOLPLANCK
211sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
212 (double)PI_VERSIONNUMBER, (float)PeidaVersion());
213#else
214sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
215 (double)PI_VERSIONNUMBER, piai->Version());
216#endif
217mCons->AddStr(buff, PIVA_Blue );
218mCons->AddStr(" ..........................................\n", PIVA_Blue );
219// PrintPeidaVersion();
220
221pfc_fits->SetPath(ImgDir);
222pfc_ppf->SetPath(WorkDir);
223pfc_ps->SetPath(WorkDir);
224
225SetReady();
226}
227
228/* --Methode-- */
229PIStdImgApp::~PIStdImgApp()
230{
231int i;
232
233// Destrucion de tous les objets de NameObjMgr
234string patt = "/*/*";
235mObjMgr->DelObjects(patt, true);
236
237delete mc;
238for(i=0; i<7; i++)
239 if (m[i]) delete m[i];
240
241WindMList::iterator it;
242for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
243
244delete mObjMgr;
245delete mCmd;
246
247delete zoom;
248delete gimv;
249delete cmapv;
250
251delete pfc_fits;
252delete pfc_ppf;
253delete pfc_ps;
254
255delete mCons;
256
257delete mObjmgrw;
258delete mPpinmgrw;
259
260// Les fichiers
261if (mpsfile) delete mpsfile;
262if (mPpfout) delete mPpfout;
263
264}
265
266/* --Methode-- */
267void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
268{
269PIWdg *sndw;
270PIMessage tmsg, smm;
271
272tmsg = msg;
273msg = UserMsg(msg);
274smm = ModMsg(tmsg);
275
276//printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
277if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
278
279// Messages active-window
280if (smm == PIMsg_Active)
281 {
282 sndw = dynamic_cast<PIWdg *>(sender);
283 switch(sndw->kind())
284 {
285 case PIWindow::ClassId :
286 mCurWin = dynamic_cast<PIWindow *>(sndw);
287 break;
288
289 case PIScDrawWdg::ClassId :
290 case PIDraw3DWdg::ClassId :
291 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
292// cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
293 if (mFgCWImg) {
294// cerr << "*DBG* ImgTools -> NonSensitive " << endl;
295 m[2]->SetSensitivityMsg(10305, false);
296 m[2]->SetSensitivityMsg(10306, false);
297 m[4]->SetSensitivityMsg(10515, false);
298 m[4]->SetSensitivityMsg(10516, false);
299 mFgCWImg = false;
300 }
301 break;
302 case PIImage::ClassId :
303 mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
304 if (!mFgCWImg) {
305// cerr << "*DBG* ImgTools -> Sensitive " << endl;
306 m[2]->SetSensitivityMsg(10305, true);
307 m[2]->SetSensitivityMsg(10306, true);
308 m[4]->SetSensitivityMsg(10515, true);
309 m[4]->SetSensitivityMsg(10516, true);
310 mFgCWImg = true;
311 }
312 break;
313 /*
314 default :
315 mCurWdg = NULL;
316 if (mFgCWImg) {
317 m[2]->SetSensitivityMsg(10305, false);
318 m[2]->SetSensitivityMsg(10306, false);
319 m[4]->SetSensitivityMsg(10515, false);
320 m[4]->SetSensitivityMsg(10516, false);
321 mFgCWImg = false;
322 }
323 break;
324 */
325 }
326 }
327// Message window-close
328else if (smm == PIMsg_Close)
329 {
330 sndw = (PIWdg *)sender;
331 if(sndw->kind() == PIWindow::ClassId)
332 {
333 mCurWin = (PIWindow *)sender;
334 if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
335 DeleteWindow(mCurWin);
336 }
337 else
338 printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
339 (int)tmsg, (int)sndw->kind(), (long)sender);
340 }
341
342// Traitement des messages des menus
343else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
344else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
345else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
346else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
347else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
348else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
349else if ( msg == 30200 ) { // Objet PIConsole
350 string s = mCons->GetCmdString();
351 string s2 = "\nExecuting " + s + "\n";
352 mCons->AddStr(s2.c_str(), PIVA_Blue, true);
353 SetBusy();
354#ifdef SANS_EVOLPLANCK
355 TRY {
356 mCmd->Interpret(s);
357 } CATCH(merr) {
358 fflush(stdout);
359 cout << endl;
360 cerr << endl;
361 string es = PeidaExc(merr);
362 cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
363 }
364#else
365 try {
366 mCmd->Interpret(s);
367 }
368 catch ( PException exc ) {
369 fflush(stdout);
370 cout << endl;
371 cerr << endl;
372 cerr << "PIStdImgApp::Process()/ Cmd->Interpret() Exception :" << exc.Msg() << endl;
373 }
374#endif
375 SetReady();
376 }
377
378else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
379 (int)tmsg,(int)msg,(int)smm);
380
381
382return;
383}
384
385/* --Methode-- */
386void PIStdImgApp::SetReady()
387{
388mCons->SetSensitive();
389gimv->SetSensitive();
390PIApplication::SetReady();
391}
392
393/* --Methode-- */
394void PIStdImgApp::SetBusy()
395{
396mCons->SetUnSensitive();
397gimv->SetUnSensitive();
398PIApplication::SetBusy();
399}
400
401/* --Methode-- */
402void PIStdImgApp::SetBlocked()
403{
404mCons->SetUnSensitive();
405gimv->SetUnSensitive();
406PIApplication::SetBlocked();
407}
408
409
410/* --Methode-- */
411int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid)
412{
413PIImage* pii;
414PIWindow* win;
415int sx, sy, px, py, flag;
416
417if (nouv == NULL)
418 {
419 printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
420 return(-1);
421 }
422
423if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
424 {
425 printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
426 nouv->XSize(), nouv->YSize());
427 return(-1);
428 }
429
430int zm = 1;
431if (mZoom == 0) { // Facteur de zoom auto
432 zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() : nouv->YSize();
433 zm = (zm >= 250) ? 250/zm : 1;
434 }
435else zm = mZoom;
436
437if (zm == 0) zm = 1;
438if (zm < -10) zm = -10;
439if (zm > 10) zm = 10;
440
441if (zm > 0) { sx = nouv->XSize()*zm; sy = nouv->YSize()*zm; }
442else {
443 sx = (int)((float)nouv->XSize()*(-1./float(zm)));
444 sy = (int)((float)nouv->YSize()*(-1./float(zm)));
445 }
446if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
447if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
448px = py = 0;
449win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
450pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
451pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
452pii->SetZoomWin(zoom, false);
453pii->SetGloVWin(gimv, false);
454pii->SetCMapWin(cmapv, false);
455pii->SetZoom(zm, false);
456if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, false);
457pii->ShowCursor(true);
458pii->SetUserData(NULL, oid);
459// Centrage eventuel du pave
460if (mFImgCenter && (mXImgCenter > 0) && (mYImgCenter > 0)) {
461 pii->SetImage(nouv, false);
462 pii->SetPave(mXImgCenter, mYImgCenter, true, true);
463 }
464else pii->SetImage(nouv, true);
465// printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
466mCurWin = win;
467mCurWdg = pii;
468mLastWdg = pii;
469mBWId++;
470mBWList[mBWId] = pii;
471return(mBWId);
472}
473
474
475/* --Methode-- */
476int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, int oid)
477{
478if (scd == NULL)
479 {
480 printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
481 return(-1);
482 }
483
484// Changement d'attributs graphiques courants du drawer
485if (mFCol != PI_NotDefColor) scd->SetColAtt(mFCol, mBCol);
486if (mLAtt != PI_NotDefLineAtt) scd->SetLineAtt(mLAtt);
487if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) scd->SetFontAtt(mFSz, mFAtt);
488if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) scd->SetMarkerAtt(mMSz, mMrk);
489if ( mCmapid != CMAP_OTHER ) scd->SetColMapId(mCmapid);
490
491
492if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next;
493// Trace en superpoistion
494if ( (opt == Disp_Same) && (mLastWdg) ) {
495 if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
496 else mLastWdg->AddDrawer(scd, true, true, true);
497 scd->Refresh();
498 mDId++;
499 mDrwList[mDId] = scd;
500 return(-mDId);
501}
502// Trace en medaillon
503else if ( (opt == Disp_Inset) && (mLastWdg) ) {
504 PIGrCoord x1, x2, y1, y2;
505 x1 = mIXmin; x2 = mIXmax;
506 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
507 scd->SetAxesFlags(mAxesFlags);
508 if (maXlog || maYlog) scd->SetLogScale(maXlog, maYlog); // Echelle log
509 if (mFXYlim) // Forcage limites XY
510 scd->SetLimits(mXmin, mXmax, mYmin, mYmax);
511 else scd->UpdateLimits();
512 mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
513 scd->Refresh();
514 mDId++;
515 mDrwList[mDId] = scd;
516 return(-mDId);
517}
518
519PIWindow* win;
520PIScDrawWdg* scw;
521int sx, sy, px, py, flag;
522sx = 200+mFgScSz*100;
523sy = 200+mFgScSz*100;
524win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
525if (typeid(*scd) != typeid(PIHisto2D))
526 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
527else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
528scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
529scw->SetUserData(NULL, oid);
530if (maXlog || maYlog) scw->SetLogScale(maXlog, maYlog); // Echelle log
531if (mFXYlim) // Forcage limites XY
532 scw->SetLimits(mXmin, mXmax, mYmin, mYmax);
533scw->SetAxesFlags(mAxesFlags);
534
535if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
536else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
537// Titre du plot
538if (title.length() <= 0) title = name; string t2="";
539scw->SetTitles(title, t2);
540// scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
541mCurWin = win;
542mCurWdg = scw;
543mLastWdg = scw;
544mBWId++;
545mBWList[mBWId] = scw;
546return(mBWId);
547}
548
549/* --Methode-- */
550int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title, int oid)
551{
552if (dr3 == NULL)
553 {
554 printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
555 return(-1);
556 }
557
558// Changement d'attributs graphiques courants du drawer
559if (mFCol != PI_NotDefColor) dr3->SetColAtt(mFCol, mBCol);
560if (mLAtt != PI_NotDefLineAtt) dr3->SetLineAtt(mLAtt);
561if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) dr3->SetFontAtt(mFSz, mFAtt);
562if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) dr3->SetMarkerAtt(mMSz, mMrk);
563if ( mCmapid != CMAP_OTHER ) dr3->SetColMapId(mCmapid);
564
565if ( (!mLastWdg) && ( (opt == Disp_Same) || (opt == Disp_Inset) ) ) opt = Disp_Next;
566// Trace en superpoistion
567if ( (opt == Disp_Same) && (mLastWdg) ) {
568 if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
569 else mLastWdg->AddDrawer(dr3, true, true, true);
570 dr3->Refresh();
571 mDId++;
572 mDrwList[mDId] = dr3;
573 return(-mDId);
574}
575// Trace en medaillon
576else if ( (opt == Disp_Inset) && (mLastWdg) ) {
577 PIGrCoord x1, x2, y1, y2;
578 x1 = mIXmin; x2 = mIXmax;
579 y2 = 1.-mIYmin; y1 = 1.-mIYmax;
580 dr3->SetAxesFlags(mAxesFlags);
581 dr3->UpdateLimits();
582 mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
583 dr3->Refresh();
584 mDId++;
585 mDrwList[mDId] = dr3;
586 return(-mDId);
587}
588
589
590PIWindow* win;
591int sx, sy, px, py, flag;
592sx = 200+mFgScSz*100;
593sy = 200+mFgScSz*100;
594win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
595PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
596wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
597wd3->SetUserData(NULL, oid);
598wd3->AddDrawer3D(dr3, true);
599// Titre du plot
600if (title.length() <= 0) title = name; string t2="";
601wd3->SetTitles(title, t2);
602// wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
603mCurWin = win;
604mCurWdg = wd3;
605mLastWdg = wd3;
606mBWId++;
607mBWList[mBWId] = wd3;
608return(mBWId);
609}
610
611/* --Methode-- */
612void PIStdImgApp::AddText(string const & txt, double xp, double yp)
613{
614if (!mLastWdg) return;
615PIElDrawer *eld=NULL;
616PIScDrawWdg* sdw=NULL;
617PIDraw3DWdg* w3d=NULL;
618PIImage* imgw;
619switch(mLastWdg->kind()) {
620 case PIScDrawWdg::ClassId :
621 sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
622 if (sdw) eld = sdw->BaseDrawer();
623 break;
624 case PIDraw3DWdg::ClassId :
625 w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
626 if (w3d) eld = w3d->BaseDrawer();
627 break;
628 case PIImage::ClassId :
629 imgw = dynamic_cast<PIImage *>(mLastWdg);
630 if (imgw) eld = imgw->MyElDrawer();
631 break;
632 default :
633 break;
634 }
635if (eld) {
636 if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) eld->SetFontAtt(mFSz, mFAtt);
637 eld->ElAddText(xp,yp,txt.c_str(),mFCol);
638 eld->Refresh();
639 }
640}
641
642/* --Methode-- */
643void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
644{
645if (nx < 1) nx = 1;
646if (ny < 1) ny = 1;
647if (nx > 8) nx = 8;
648if (ny > 8) ny = 8;
649if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
650char buff[64];
651mWId++;
652int px, py;
653MainWin()->GetScreenPos(px, py);
654sprintf(buff, "PI-GraphicWin (%d)",mWId);
655PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
656win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
657mWList[mWId*10+1] = (PIWindow*)win;
658win->SetAutoDelChilds(true);
659// win->Show();
660mGrW = win;
661mGrIdx = 0;
662}
663
664/* --Methode-- */
665void PIStdImgApp::CreateStackWin(int sx, int sy)
666{
667if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
668char buff[64];
669mWId++;
670int px, py;
671MainWin()->GetScreenPos(px, py);
672sprintf(buff, "PI-StackWin (%d)",mWId);
673PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
674win->SetUserData(NULL, 9999); // UserFlag= 9999
675mWList[mWId*10+2] = (PIWindow*)win;
676win->SetAutoDelChilds(true);
677// win->Show();
678mStW = win;
679m[2]->SetSensitivity("StackTools", true);
680mStIdx = 0;
681}
682
683/* --Methode-- */
684PIWindow* PIStdImgApp::GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
685{
686PIWindow* rw;
687
688switch (typ) {
689 case Disp_Next : // Fenetre graphique courante
690 {
691 if (mGrW == NULL) CreateGraphWin();
692 int nx, ny;
693 mGrW->NbZone(nx, ny);
694 PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
695// cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
696 if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
697 flag = mGrIdx;
698 mGrIdx = (mGrIdx+1)%(nx*ny);
699 rw = mGrW;
700 break;
701 }
702
703 case Disp_Stack : // Fenetre de type stack (empilement)
704 {
705 if (mStW == NULL) CreateStackWin(sx, sy);
706 px = py = 0;
707 sx = mStW->XSize();
708 sy = mStW->YSize();
709 flag = mStIdx;
710 mStIdx++;
711 rw = mStW;
712 }
713 break;
714
715 default : // Fenetre ordinaire
716 {
717 int pwx, pwy;
718 MainWin()->GetScreenPos(pwx, pwy);
719 if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
720 rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
721 rw->SetUserData(NULL, 0); // UserFlag= 0
722 mWId++;
723 mWList[mWId*10] = rw;
724 rw->SetAutoDelChilds(true);
725 // rw->Show();
726 px = py = 0;
727 flag = 0;
728 break;
729 }
730 }
731
732rw->Show();
733mCurWin = rw;
734return(rw);
735}
736
737/* --Methode-- */
738void PIStdImgApp::SetZone(int nzx, int nzy)
739{
740if (!mGrW) CreateGraphWin(nzx, nzy);
741else {
742 int k;
743 PIWdg* cwd;
744 for(k=0; k<mGrW->NbChilds(); k++) {
745 if ((cwd = mGrW->GetChild(k)) == NULL) continue;
746 DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
747 }
748 mGrW->SetZone(nzx, nzy);
749 }
750}
751
752/* --Methode-- */
753void PIStdImgApp::StackWinNext()
754{
755if (mStW) mStW->DispNext();
756}
757
758/* --Methode-- */
759void PIStdImgApp::DeleteWindow(PIWindow* w)
760{
761if (w == NULL) return;
762w->Hide();
763bool ownwindow=false; // To Check if this is one of our windows
764WindMList::iterator it;
765for(it = mWList.begin(); it != mWList.end(); it++)
766 if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
767if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
768if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
769if (w == mCurWin) mCurWin = NULL;
770
771if (!ownwindow) return; // We do nothing if this is not a window we have created ...
772
773int k;
774PIWdg* cwd;
775for(k=0; k<w->NbChilds(); k++) {
776 if ((cwd = w->GetChild(k)) == NULL) continue;
777 DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
778 }
779delete w;
780return;
781}
782
783/* --Methode-- */
784void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
785{
786if (w == NULL) return;
787BWMList::iterator it;
788for(it = mBWList.begin(); it != mBWList.end(); it++)
789 if ((*it).second == w) { mBWList.erase(it); break; }
790int k;
791PIDrawer* drw;
792for(k=0; k<w->NbDrawers(); k++) {
793 if ((drw = w->GetDrawer(k)) == NULL) continue;
794 DrwMList::iterator itt;
795 for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
796 if ((*itt).second == drw) { mDrwList.erase(itt); break; }
797 }
798
799if (w == mCurWdg) {
800 mCurWdg = NULL;
801 if (mFgCWImg) {
802 m[4]->SetSensitivityMsg(10515, false);
803 m[4]->SetSensitivityMsg(10516, false);
804 mFgCWImg = false;
805 }
806 }
807
808if (w == mLastWdg) mLastWdg = NULL;
809
810PIWdg* pw=NULL;
811if (dwin) pw = (PIWdg*)(w->Parent());
812//DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
813if (dw) delete w;
814if (pw && (pw->kind() == PIWindow::ClassId )) {
815 PIWindow* pww = (PIWindow*) pw;
816 if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
817 DeleteWindow((PIWindow*)pw);
818 }
819return;
820}
821
822
823
824/* --Methode-- */
825void PIStdImgApp::DelWRsId(int k)
826{
827//DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
828if (k > 0) { // C'est un BaseWidget
829 BWMList::iterator it;
830 it = mBWList.find(k);
831 if (it == mBWList.end()) return;
832 PIBaseWdg* wd = (*it).second;
833//DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
834 DeleteBaseWidget(wd, true, true);
835 }
836else { // C'est un drawer
837 DrwMList::iterator it;
838 it = mDrwList.find(-k);
839 if (it == mDrwList.end()) return;
840 delete (*it).second;
841 mDrwList.erase(it);
842// cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
843 }
844}
845/* --Methode-- */
846bool PIStdImgApp::CheckWRsId(int k)
847{
848if (k > 0) { // C'est un BaseWidget
849 BWMList::iterator it;
850 it = mBWList.find(k);
851 if (it == mBWList.end()) return(false);
852 else return(true);
853 }
854else { // C'est un drawer
855 DrwMList::iterator it;
856 it = mDrwList.find(-k);
857 if (it == mDrwList.end()) return(false);
858 else return(true);
859 }
860}
861
862
863/* --Methode-- */
864void PIStdImgApp::RedirectStdOutErr(bool fg)
865{
866if (fg) {
867 RedirectOutStream(mCons);
868 RedirectErrStream(mCons);
869 m[5]->SetStateMsg(10602, true);
870 redirecout = true;
871 }
872else {
873 RedirectOutStream(NULL);
874 RedirectErrStream(NULL);
875 m[5]->SetStateMsg(10602, false);
876 redirecout = false;
877 }
878return;
879}
880
881/* --Methode-- */
882void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
883{
884PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
885m[5]->SetStateMsg(10603, fgfpe);
886m[5]->SetStateMsg(10604, fgsegv);
887}
888
889/* --Methode-- */
890void PIStdImgApp::CloseAllWindows()
891{
892WindMList::iterator it;
893for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
894mWList.clear();
895mBWList.clear();
896mDrwList.clear();
897mGrW = NULL;
898mStW = NULL;
899mCurWin = NULL;
900mCurWdg = NULL;
901mLastWdg = NULL;
902m[4]->SetSensitivityMsg(10515, false);
903m[4]->SetSensitivityMsg(10516, false);
904}
905
906/* --Methode-- */
907void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
908{
909
910 switch(msg)
911 {
912 case 10100 :
913 mCmd->ShowHelpWindow();
914 break;
915
916 case 10120 :
917 pfc_fits->AcceptNewFile(false);
918 mFCMsg = 10125;
919 pfc_fits->SetMsg(mFCMsg);
920 SetBlocked();
921 pfc_fits->Show();
922 break;
923
924 case 10125 :
925 SetBusy();
926 if (data) {
927 string nomobj="";
928 ObjMgr()->ReadFits(pfc_fits->GetFileName(), nomobj);
929 ObjMgr()->DisplayObj(nomobj, "win");
930 }
931 mFCMsg = 0;
932 SetReady();
933 break;
934
935 case 10130 :
936 pfc_ppf->AcceptNewFile(false);
937 mFCMsg = 10135;
938 pfc_ppf->SetMsg(mFCMsg);
939 SetBlocked();
940 pfc_ppf->Show();
941 break;
942
943 case 10135 :
944 mFCMsg = 0;
945 if (data) {
946 PPInMgrW()->SetFile(pfc_ppf->GetFileName());
947 PPInMgrW()->Show();
948 }
949 SetReady();
950 break;
951
952 case 10110 :
953 DeleteWindow(mCurWin);
954 break;
955
956 case 10111 :
957 if (mCurWdg) {
958 int oid = mCurWdg->UserFlag();
959 DeleteBaseWidget(mCurWdg);
960 mObjMgr->DelObj_Id(oid);
961 }
962 break;
963
964 case 10105:
965 Stop();
966 break;
967
968 }
969return;
970}
971
972
973
974/* --Methode-- */
975void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
976{
977
978switch (msg) {
979 case 10201 :
980 ObjMgrW()->Show();
981 break;
982
983 case 10220 :
984 pfc_ppf->AcceptNewFile(true);
985 mFCMsg = 10225;
986 pfc_ppf->SetMsg(mFCMsg);
987 SetBlocked();
988 pfc_ppf->Show();
989 break;
990
991 case 10225 :
992 SetBusy();
993 if (data) {
994 if (mPpfout) {
995 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
996 delete mPpfout;
997 }
998 name_outppf = pfc_ppf->GetFileName();
999 mPpfout = NULL;
1000 printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
1001 mPpfout = new POutPersist(name_outppf);
1002 }
1003 mFCMsg = 0;
1004 SetReady();
1005 break;
1006
1007 case 10230 :
1008 if (!mPpfout) break;
1009 printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
1010 delete mPpfout;
1011 name_outppf = "";
1012 mPpfout = NULL;
1013 break;
1014
1015
1016 default:
1017 cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
1018 break;
1019}
1020
1021return;
1022}
1023
1024/* --Methode-- */
1025void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1026{
1027
1028switch (msg) {
1029 case 10301 :
1030 PIImgTools::ShowPIImgTools();
1031 break;
1032 case 10302 :
1033 PIDrwTools::ShowPIDrwTools();
1034 break;
1035
1036 case 10304 :
1037 case 10305 :
1038 {
1039 PIImage* curpimg = NULL;
1040 if (!mCurWdg) return;
1041 if (mCurWdg->kind() != PIImage::ClassId) return;
1042 curpimg = (PIImage*)mCurWdg;
1043 if (curpimg == NULL) return;
1044 P2DArrayAdapter* img = curpimg->Image();
1045 if (img == NULL) return;
1046 int dx = curpimg->XSzPave();
1047 int dy = curpimg->YSzPave();
1048 int x0 = curpimg->XPave()-dx/2;
1049 int y0 = curpimg->YPave()-dy/2;
1050 if (x0 < 0) x0 = 0;
1051 if (y0 < 0) y0 = 0;
1052 int x1 = x0+dx;
1053 int y1 = y0+dy;
1054 if (x1 > img->XSize()) x1 = img->XSize();
1055 if (y1 > img->YSize()) y1 = img->YSize();
1056 dx = x1-x0; dy = y1-y0;
1057 ImageR4* pim = new ImageR4(dx, dy);
1058 int ii, jj;
1059 for(jj=0; jj<dy; jj++)
1060 for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
1061 if (msg == 10305) { // Calcul des coordonnees du sous-pave
1062 double xc1, yc1;
1063 img->Coord(x0, y0, xc1, yc1);
1064 pim->SetOrg((int)xc1, (int)yc1);
1065 }
1066 string nom = mCurWdg->Nom() + "_pave";
1067 ObjMgr()->AddObj(pim, nom);
1068 ObjMgr()->DisplayObj(nom, "w");
1069 break;
1070 }
1071
1072 case 10306 :
1073 {
1074 PIImage* curpimg = NULL;
1075 if (!mCurWdg) return;
1076 if (mCurWdg->kind() != PIImage::ClassId) return;
1077 curpimg = (PIImage*)mCurWdg;
1078 if (curpimg == NULL) return;
1079 curpimg->ShowCuts(true);
1080 break;
1081 }
1082
1083 case 10320 :
1084 if (mStW) mStW->DispNext();
1085 break;
1086
1087 case 10321 :
1088 case 10322 :
1089 case 10324 :
1090// case 10328 :
1091 if (mStW) mStW->StartAutoDisp((msg-10320)*500);
1092 break;
1093
1094 case 10329 :
1095 if (mStW) mStW->StopAutoDisp();
1096 break;
1097
1098 case 103330 :
1099 if (mStW) {
1100 PIWdg* cw = mStW->CurrentWdg();
1101 if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
1102 }
1103 break;
1104
1105 default:
1106 cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
1107 break;
1108 }
1109return;
1110}
1111
1112/* --Methode-- */
1113void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
1114{
1115
1116switch (msg) {
1117
1118 case 10400 :
1119 CreateStackWin();
1120 break;
1121
1122 case 10411 :
1123 CreateGraphWin(1,1);
1124 break;
1125 case 10421 :
1126 CreateGraphWin(1,2);
1127 break;
1128 case 10412 :
1129 CreateGraphWin(2,1);
1130 break;
1131 case 10422 :
1132 CreateGraphWin(2,2);
1133 break;
1134 case 10431 :
1135 CreateGraphWin(1,3);
1136 break;
1137 case 10433 :
1138 CreateGraphWin(3,3);
1139 break;
1140 case 10441 :
1141 if (mCurWdg) {
1142 mLastWdg = mCurWdg;
1143 cout << " Using current widget as last-widget (display same) " << endl;
1144 }
1145 else cout << " No current widget - select widget with mouse " << endl;
1146 break;
1147 default:
1148 cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
1149 break;
1150 }
1151return;
1152}
1153
1154
1155/* --Methode-- */
1156void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1157{
1158char nomps[64],strg[512];
1159PSFile *mps;
1160int sxt, syt, syo, syo1, sx[4], sy[4];
1161
1162switch (msg)
1163 {
1164 case 10501 :
1165 pfc_ps->AcceptNewFile(true);
1166 mFCMsg = 10525;
1167 pfc_ps->SetMsg(mFCMsg);
1168 SetBlocked();
1169 pfc_ps->Show();
1170 break;
1171
1172 case 10525 :
1173 SetBusy();
1174 if (data) {
1175 if (mpsfile) {
1176 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1177 delete mpsfile;
1178 }
1179 name_ps = pfc_ps->GetFileName();
1180 printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
1181 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
1182 }
1183 mFCMsg = 0;
1184 SetReady();
1185 break;
1186
1187 case 10505 :
1188 if (!mpsfile) break;
1189 printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
1190 delete mpsfile;
1191 mpsfile = NULL;
1192 name_ps = "";
1193 break;
1194
1195 case 10511 : // Window -> PS
1196 case 10512 : // Window -> EPS
1197 if (CurrentWindow() == NULL) break;
1198 if (msg == 10512)
1199 {
1200 num_eps++;
1201 sprintf(nomps,"pia%d.eps", num_eps);
1202 printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
1203 mps = new PSFile(nomps);
1204 }
1205 else {
1206 if (mpsfile == NULL) {
1207 name_ps = "pia.ps";
1208 mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
1209 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1210 }
1211 printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
1212 mps = mpsfile;
1213 }
1214 CurrentWindow()->PSPrint(mps,0,0);
1215
1216 if (msg == 10512) delete mps; // fichier eps
1217 break;
1218
1219 case 10515 : // Image -> PS
1220 case 10516 : // Image -> EPS
1221 {
1222 PIImage* curpimg = NULL;
1223 if (!mCurWdg) return;
1224 if (mCurWdg->kind() != PIImage::ClassId) return;
1225 curpimg = (PIImage*)mCurWdg;
1226 if (curpimg == NULL) return;
1227 if (msg == 10516)
1228 {
1229 num_eps++;
1230 sprintf(nomps,"pia%d.eps", num_eps);
1231 printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
1232 mps = new PSFile(nomps);
1233 }
1234 else {
1235 if (mpsfile == NULL) {
1236 name_ps = "pia.ps";
1237 mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
1238 printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
1239 }
1240 printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
1241 mps = mpsfile;
1242 }
1243
1244 sx[0] = gimv->XSize();
1245 sy[0] = gimv->YSize();
1246 sx[1] = zoom->XSize();
1247 sy[1] = zoom->YSize();
1248 sx[2] = cmapv->XSize();
1249 sy[2] = cmapv->YSize();
1250 sx[3] = curpimg->XSize();
1251 sy[3] = curpimg->YSize();
1252 if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
1253 else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
1254 syt = sy[3]+syo;
1255 sxt = sx[3];
1256 if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
1257 if (sxt < sx[2]) sxt = sx[2];
1258
1259 // Pour ecrire le titre
1260 mps->NewPage((float)sxt, (float)syt, PI_Portrait);
1261 mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
1262 sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
1263 curpimg->XPave(), curpimg->YPave());
1264 mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20);
1265 mps->EndBloc();
1266
1267 // Les quatre fenetres glovimage, zoom, cmap, image
1268 gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
1269 zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
1270 cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
1271 curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
1272
1273 if (msg == 10516) delete mps; // fichier eps
1274 break;
1275 }
1276
1277 default:
1278 cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
1279 break;
1280 }
1281
1282}
1283
1284
1285/* --Methode-- */
1286void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
1287{
1288switch (msg) {
1289 case 10601:
1290 CloseAllWindows();
1291 break;
1292 case 10602:
1293 RedirectStdOutErr(*((bool*)data));
1294 break;
1295 case 10603:
1296 case 10604:
1297 CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
1298 break;
1299 case 10605:
1300 mObjMgr->SetVerbose(m[5]->GetStateMsg(10605));
1301 break;
1302 default:
1303 cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
1304 break;
1305 }
1306return;
1307}
1308
1309
1310/* --Methode-- */
1311void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)
1312{
1313 mFCol = fg;
1314 mBCol = bg;
1315}
1316/* --Methode-- */
1317void PIStdImgApp::SetLineAtt(PILineAtt lat)
1318{
1319 mLAtt = lat;
1320}
1321/* --Methode-- */
1322void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
1323{
1324 mFSz = fsz;
1325 mFAtt = fat;
1326}
1327/* --Methode-- */
1328void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)
1329{
1330 mMSz = sz;
1331 mMrk = mrk;
1332}
1333/* --Methode-- */
1334void PIStdImgApp::SetColMapId(CMapId cid)
1335{
1336 mCmapid = cid;
1337}
1338/* --Methode-- */
1339void PIStdImgApp::SetZoomAtt(int zoom)
1340{
1341 if ( (zoom > 10) || (zoom < -10) ) zoom = 0;
1342 mZoom = zoom;
1343}
1344/* --Methode-- */
1345void PIStdImgApp::SetAxesAtt(unsigned int axfl)
1346{
1347 mAxesFlags = axfl;
1348}
1349/* --Methode-- */
1350void PIStdImgApp::SetXYLimits(double xmin, double xmax, double ymin, double ymax)
1351{
1352 mXmin = xmin; mXmax= xmax;
1353 mYmin = ymin; mYmax= ymax;
1354}
1355/* --Methode-- */
1356void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
1357{
1358 mIXmin = xmin; mIXmax= xmax;
1359 mIYmin = ymin; mIYmax= ymax;
1360}
1361/* --Methode-- */
1362void PIStdImgApp::SetImageCenterPosition(int x, int y)
1363{
1364 mXImgCenter = x; mYImgCenter = y;
1365}
1366
1367/* --Methode-- */
1368void PIStdImgApp::SaveGraphicAtt()
1369{
1370 mSFCol = mFCol;
1371 mSBCol = mBCol;
1372 mSLAtt = mLAtt;
1373 mSFSz = mFSz;
1374 mSFAtt = mFAtt;
1375 mSMSz = mMSz;
1376 mSMrk = mMrk;
1377 mSCmapid = mCmapid;
1378 mSZoom = mZoom;
1379 mSAxesFlags = mAxesFlags;
1380 mSXmin = mXmin; mSXmax = mXmax;
1381 mSYmin = mYmin; mSYmax = mYmax;
1382 mSIXmin = mIXmin; mSIXmax = mIXmax;
1383 mSIYmin = mIYmin; mSIYmax = mIYmax;
1384 mSFXYlim = mFXYlim;
1385 mSXImgCenter = mXImgCenter;
1386 mSYImgCenter = mYImgCenter;
1387 mSFImgCenter = mFImgCenter;
1388 mSaXlog = maXlog;
1389 mSaYlog = maYlog;
1390}
1391
1392/* --Methode-- */
1393void PIStdImgApp::RestoreGraphicAtt()
1394{
1395 mFCol = mSFCol;
1396 mBCol = mSBCol;
1397 mLAtt = mSLAtt;
1398 mFSz = mSFSz;
1399 mFAtt = mSFAtt;
1400 mMSz = mSMSz;
1401 mMrk = mSMrk;
1402 mCmapid = mSCmapid;
1403 mZoom = mSZoom;
1404 mAxesFlags = mSAxesFlags;
1405 mXmin = mSXmin; mXmax = mSXmax;
1406 mYmin = mSYmin; mYmax = mSYmax;
1407 mIXmin = mSIXmin; mIXmax = mSIXmax;
1408 mIYmin = mSIYmin; mIYmax = mSIYmax;
1409 mFXYlim = mSFXYlim;
1410 mXImgCenter = mSXImgCenter;
1411 mYImgCenter = mSYImgCenter;
1412 mFImgCenter = mSFImgCenter;
1413 maXlog = mSaXlog;
1414 maYlog = mSaYlog;
1415}
Note: See TracBrowser for help on using the repository browser.