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

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

correction centerimage + Makefile pour tag V_Nov99

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