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

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

correction print pour Sophya - Reza 18/11/99

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