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

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

modifs cosmetiques - Reza 5/11/99

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