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