[293] | 1 | #include "machdefs.h"
|
---|
[165] | 2 | #include <stdlib.h>
|
---|
| 3 | #include <stdio.h>
|
---|
| 4 | #include <string.h>
|
---|
| 5 |
|
---|
[295] | 6 | #include <typeinfo>
|
---|
| 7 |
|
---|
[165] | 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"
|
---|
[1856] | 21 | // #include "pihisto2d.h"
|
---|
[165] | 22 | #include "psfile.h"
|
---|
| 23 | #include "piimgtools.h"
|
---|
| 24 | #include "pidrwtools.h"
|
---|
[1590] | 25 | #include "piaxestools.h"
|
---|
[165] | 26 |
|
---|
| 27 | #include "pistzwin.h"
|
---|
| 28 |
|
---|
[295] | 29 | #include "piinit.h"
|
---|
[374] | 30 | #include "piversion.h"
|
---|
| 31 | #include "piaversion.h"
|
---|
[165] | 32 |
|
---|
[295] | 33 |
|
---|
[165] | 34 | static char ImgDir[256];
|
---|
| 35 | static char WorkDir[256];
|
---|
[692] | 36 | // Initialiseur
|
---|
| 37 | static PIAppInitiator * glst_piai = NULL;
|
---|
[165] | 38 |
|
---|
[686] | 39 | // Pour la creation de fenetre info (about piapp)
|
---|
| 40 | static void createInfoWindow(PIStdImgApp* app);
|
---|
| 41 | static void deleteInfoWindow();
|
---|
| 42 | static void showInfoWindow(PIStdImgApp* app);
|
---|
| 43 | static void hideInfoWindow(PIStdImgApp* app);
|
---|
[165] | 44 |
|
---|
[2106] | 45 |
|
---|
[165] | 46 | /* ........................................................... */
|
---|
[2106] | 47 | /* Classe SIA_RU__Periodic : mise a jour periodique de */
|
---|
| 48 | /* la fenetre Stat/Ressource info */
|
---|
| 49 | /* ........................................................... */
|
---|
| 50 |
|
---|
| 51 | class SIA_RU__Periodic : public PIPeriodic
|
---|
| 52 | {
|
---|
| 53 | public:
|
---|
| 54 | SIA_RU__Periodic(PIStdImgApp* app);
|
---|
| 55 | virtual ~SIA_RU__Periodic();
|
---|
| 56 | virtual void DoPeriodic();
|
---|
| 57 | private:
|
---|
| 58 | PIStdImgApp* _app;
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 | SIA_RU__Periodic::SIA_RU__Periodic(PIStdImgApp* app)
|
---|
| 62 | : PIPeriodX(1)
|
---|
| 63 | {
|
---|
| 64 | _app = app;
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | SIA_RU__Periodic::~SIA_RU__Periodic()
|
---|
| 68 | {
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | void SIA_RU__Periodic::DoPeriodic()
|
---|
| 72 | {
|
---|
| 73 | if (_app) _app->UpdateStatResourceInfo();
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | /* ............................................................. */
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | /* ........................................................... */
|
---|
[165] | 80 | /* Classe PIStdImgApp */
|
---|
| 81 | /* ........................................................... */
|
---|
| 82 |
|
---|
| 83 | /* --Methode-- */
|
---|
| 84 | PIStdImgApp::PIStdImgApp(int narg, char* arg[])
|
---|
| 85 | : PIApplication(420, 320, narg, arg)
|
---|
| 86 | {
|
---|
| 87 |
|
---|
| 88 | // Les menus
|
---|
| 89 | m[0] = new PIMenu(Menubar(),"Fichier");
|
---|
[686] | 90 | m[0]->AppendItem("About piapp", 10150);
|
---|
[165] | 91 | m[0]->AppendItem("Open-Fits", 10120);
|
---|
| 92 | m[0]->AppendItem("Open-PPF", 10130);
|
---|
| 93 | // m[0]->AppendItem("Options", 10101);
|
---|
[686] | 94 | m[0]->AppendItem("Help", 10100);
|
---|
[1513] | 95 | m[0]->AppendSeparator();
|
---|
[165] | 96 | m[0]->AppendItem("Exit", 10105);
|
---|
| 97 |
|
---|
| 98 | m[1] = new PIMenu(Menubar(),"Objets");
|
---|
| 99 | m[1]->AppendItem("ObjectManager", 10201);
|
---|
| 100 | m[1]->AppendItem("OpenOutPPF", 10220);
|
---|
| 101 | m[1]->AppendItem("CloseOutPPF", 10230);
|
---|
[686] | 102 | m[1]->AppendItem("Delete CurWdg", 10270);
|
---|
[165] | 103 |
|
---|
| 104 | m[2] = new PIMenu(Menubar(),"Tools");
|
---|
| 105 | m[2]->AppendItem("Show ImageTools", 10301);
|
---|
| 106 | m[2]->AppendItem("Show DrawerTools", 10302);
|
---|
[1590] | 107 | m[2]->AppendItem("Show AxesTools", 10303);
|
---|
| 108 | m[2]->AppendItem("CxxExecutorWindow", 10304);
|
---|
| 109 | m[2]->AppendItem("Ext.Pave", 10311);
|
---|
| 110 | m[2]->SetSensitivityMsg(10311, false);
|
---|
| 111 | m[2]->AppendItem("Ext.Pave+Org", 10312);
|
---|
| 112 | m[2]->SetSensitivityMsg(10312, false);
|
---|
| 113 | m[2]->AppendItem("Cuts X,Y", 10313);
|
---|
| 114 | m[2]->SetSensitivityMsg(10313, false);
|
---|
[165] | 115 | mc = new PIMenu(m[2], "StackTools");
|
---|
| 116 | mc->AppendItem("DispNext", 10320);
|
---|
[191] | 117 | mc->AppendItem("Blink 0.5s", 10321);
|
---|
| 118 | mc->AppendItem("Blink 1s", 10322);
|
---|
| 119 | mc->AppendItem("Blink 2s", 10324);
|
---|
[165] | 120 | mc->AppendItem("Stop Blink", 10329);
|
---|
| 121 | mc->AppendItem("RemoveCurrent", 10330);
|
---|
| 122 | m[2]->AppendPDMenu(mc);
|
---|
| 123 | m[2]->SetSensitivity("StackTools", false);
|
---|
| 124 |
|
---|
| 125 | m[3] = new PIMenu(Menubar(),"Window");
|
---|
| 126 | m[3]->AppendItem("StackWindow", 10400);
|
---|
| 127 | m[3]->AppendItem("Window", 10411);
|
---|
| 128 | m[3]->AppendItem("Window 2x1", 10421);
|
---|
[1971] | 129 | // m[3]->AppendItem("Window 1x2", 10412);
|
---|
[165] | 130 | m[3]->AppendItem("Window 2x2", 10422);
|
---|
[1971] | 131 | // m[3]->AppendItem("Window 3x1", 10431);
|
---|
[165] | 132 | m[3]->AppendItem("Window 3x3", 10433);
|
---|
[558] | 133 | m[3]->AppendItem("Cur->LastWdg", 10441);
|
---|
[686] | 134 | m[3]->AppendItem("Close CurWin", 10460);
|
---|
[1971] | 135 | m[3]->AppendCheckItem("StatZoomWin", 10470);
|
---|
| 136 | m[3]->SetStateMsg(10470, true);
|
---|
[165] | 137 |
|
---|
| 138 | m[4] = new PIMenu(Menubar(),"PostScript");
|
---|
| 139 | m[4]->AppendItem("OpenPS", 10501);
|
---|
| 140 | m[4]->AppendItem("ClosePS", 10505);
|
---|
| 141 | m[4]->AppendItem("Window->PS", 10511);
|
---|
| 142 | m[4]->AppendItem("Image->PS", 10515);
|
---|
| 143 | m[4]->AppendItem("Window->EPS", 10512);
|
---|
| 144 | m[4]->AppendItem("Image->EPS", 10516);
|
---|
| 145 | m[4]->SetSensitivityMsg(10515, false);
|
---|
| 146 | m[4]->SetSensitivityMsg(10516, false);
|
---|
| 147 |
|
---|
| 148 | m[5] = new PIMenu(Menubar(),"Special");
|
---|
| 149 | m[5]->AppendItem("CloseAll", 10601);
|
---|
| 150 | m[5]->AppendCheckItem("Red.Out/Err", 10602);
|
---|
[374] | 151 | m[5]->AppendCheckItem("Catch SigFPE", 10603);
|
---|
| 152 | m[5]->AppendCheckItem("Catch SigSEGV", 10604);
|
---|
[449] | 153 | m[5]->AppendCheckItem("ObjMgr Verb", 10605);
|
---|
[1319] | 154 | m[5]->AppendItem("CxxExecOption", 10606);
|
---|
[165] | 155 |
|
---|
[293] | 156 | m[6] = new PIMenu(Menubar(),"Modules");
|
---|
| 157 |
|
---|
[165] | 158 | AppendMenu(m[0]);
|
---|
| 159 | AppendMenu(m[1]);
|
---|
| 160 | AppendMenu(m[2]);
|
---|
| 161 | AppendMenu(m[3]);
|
---|
| 162 | AppendMenu(m[4]);
|
---|
| 163 | AppendMenu(m[5]);
|
---|
[374] | 164 | // AppendMenu(m[6]); Menu Modules vide pour le moment
|
---|
[165] | 165 |
|
---|
| 166 | int scsx, scsy;
|
---|
[1593] | 167 | ScreenSize(scsx, scsy);
|
---|
[165] | 168 | if (scsy <= 600) mFgScSz = 0;
|
---|
| 169 | else if (scsy <= 800) mFgScSz = 1;
|
---|
| 170 | else if (scsy <= 1024) mFgScSz = 2;
|
---|
| 171 | else mFgScSz = 3;
|
---|
| 172 | int msx = 420+mFgScSz*60;
|
---|
| 173 | int msy = 320+mFgScSz*40;
|
---|
| 174 | MainWin()->SetSize(msx, msy);
|
---|
| 175 |
|
---|
[1971] | 176 | //------------------------------------------------------
|
---|
| 177 | // On cree un container intermediaire permettant de gerer
|
---|
| 178 | // le widget zoom, colormap, stats, ...
|
---|
| 179 |
|
---|
[165] | 180 | int bss = 100+mFgScSz*15;
|
---|
[1971] | 181 |
|
---|
| 182 | int statc_szy = bss+10+14+mFgScSz*2+5;
|
---|
| 183 | statcont = new PIContainer(MainWin(), "ZGCSCont", msx, statc_szy, 0, 0);
|
---|
| 184 | statcont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
| 185 |
|
---|
| 186 | gimv = new PIPixmap(statcont, "GloV", bss, bss, 5, 5);
|
---|
[165] | 187 | gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
|
---|
[1971] | 188 | zoom = new PIPixmap(statcont, "Zoom", bss, bss, bss+10, 5);
|
---|
[165] | 189 | zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free);
|
---|
[1971] | 190 | cmapv = new PICMapView(statcont, "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10);
|
---|
[165] | 191 | cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
[2106] | 192 |
|
---|
| 193 | // Widget pour affichage des stats / ressources
|
---|
| 194 | lab_mem = new PILabel(statcont, "memlab", msx-2*(bss+20), 20, 2*bss+20, 10);
|
---|
| 195 | lab_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
| 196 | lab_mem->SetLabel("MemoryUsage");
|
---|
| 197 | lab_mem->SetForegroundColor(PI_Red);
|
---|
| 198 | lab_mem->SetBorderWidth(1);
|
---|
| 199 | therm_mem = new PIThermometer(statcont, "memtherm", msx-2*(bss+20), 20, 2*bss+20, 35);
|
---|
| 200 | therm_mem->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
| 201 | therm_mem->SetThreshold(0.5, 0.75);
|
---|
| 202 |
|
---|
| 203 | lab_cpu = new PILabel(statcont, "cpulab", msx-2*(bss+20), 20, 2*bss+20, 60);
|
---|
| 204 | lab_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
| 205 | lab_cpu->SetLabel("CPUUsage");
|
---|
| 206 | lab_cpu->SetForegroundColor(PI_Black);
|
---|
| 207 | lab_cpu->SetBorderWidth(1);
|
---|
| 208 | therm_cpu = new PIThermometer(statcont, "cputherm", msx-2*(bss+20), 20, 2*bss+20, 85);
|
---|
| 209 | therm_cpu->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free);
|
---|
| 210 | therm_cpu->SetThreshold(0.75, 0.90);
|
---|
| 211 |
|
---|
| 212 | UpdateStatResourceInfo();
|
---|
| 213 | resupd_periodic = new SIA_RU__Periodic(this);
|
---|
| 214 | //resupd_periodic->SetIntervalms(500);
|
---|
| 215 | resupd_periodic->Start();
|
---|
| 216 |
|
---|
[1971] | 217 | statcont->Show();
|
---|
| 218 | // StatZoomWindowSetVisible(true);
|
---|
| 219 | //------------------------------------------------------
|
---|
[165] | 220 |
|
---|
[1971] | 221 | //int cpy = bss+10+14+mFgScSz*2+5;
|
---|
| 222 | int cpy = statc_szy;
|
---|
[165] | 223 |
|
---|
| 224 | // Creation d'une console avec gestion des commandes
|
---|
[1971] | 225 | consolecont = new PIContainer(MainWin(), "ConsoleCont", msx, msy-cpy, 0, cpy );
|
---|
| 226 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
| 227 | mCons = new PIConsole(consolecont, "Console", 30200, 512, 132, msx, msy-cpy, 0, 0 );
|
---|
[165] | 228 | mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
| 229 | mCons->AcceptCmd(true, 50);
|
---|
[1971] | 230 | consolecont->Show();
|
---|
[293] | 231 | redirecout = false;
|
---|
[165] | 232 | // RedirectStdOutErr(true); pas par defaut
|
---|
| 233 |
|
---|
| 234 | mObjMgr = new NamedObjMgr;
|
---|
| 235 | mCmd = new PIACmd(mObjMgr, this);
|
---|
| 236 |
|
---|
[449] | 237 | // Pas trop de message de la part de NamedObjMgr
|
---|
| 238 | m[5]->SetStateMsg(10605, false);
|
---|
| 239 | mObjMgr->SetVerbose(false);
|
---|
| 240 |
|
---|
[165] | 241 | char* varenv;
|
---|
| 242 | ImgDir[0] = WorkDir[0] = '\0';
|
---|
| 243 | if ( (varenv=getenv("PEIDA_IMAGES")) != NULL ) strncpy(ImgDir, varenv, 256);
|
---|
| 244 | if ( (varenv=getenv("PEIDA_WORK")) != NULL ) strncpy(WorkDir, varenv, 256);
|
---|
| 245 |
|
---|
[685] | 246 | pfc_fits = new PIFileChooser(this,"FITS-FileChooser", 10125);
|
---|
| 247 | pfc_ppf = new PIFileChooser(this,"PPF-FileChooser", 10135);
|
---|
| 248 | pfc_ps = new PIFileChooser(this,"PS-FileChooser", 10525);
|
---|
[165] | 249 |
|
---|
| 250 | mObjmgrw = new ObjMgrWind(this);
|
---|
| 251 | mPpinmgrw = new PPInMgrWind(this);
|
---|
| 252 |
|
---|
[333] | 253 | // Attention : A faire apres creation de ObjMgrWind !!!
|
---|
| 254 | mObjMgr->SetImgApp(this);
|
---|
| 255 |
|
---|
[165] | 256 | // Gestion des feneteres widgets et drawers
|
---|
| 257 | mWId = mDId = mBWId = 0;
|
---|
| 258 | mCurWin = NULL;
|
---|
| 259 | mCurWdg = NULL;
|
---|
| 260 | mLastWdg = NULL;
|
---|
| 261 | mGrW = NULL;
|
---|
| 262 | mStW = NULL;
|
---|
| 263 | mGrIdx = mStIdx = -1;
|
---|
| 264 |
|
---|
| 265 | mFCMsg = 0;
|
---|
| 266 | mFgCWImg = false;
|
---|
| 267 |
|
---|
| 268 | // Gestion fichiers PS
|
---|
| 269 | num_eps = 0;
|
---|
| 270 | name_ps = "";
|
---|
| 271 | name_ps = "pia.ps";
|
---|
| 272 | mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
|
---|
| 273 |
|
---|
| 274 | // Gestion OUT-PPF
|
---|
| 275 | mPpfout = NULL;
|
---|
| 276 | name_outppf = "";
|
---|
| 277 |
|
---|
| 278 | // Attributs graphiques courants
|
---|
[203] | 279 | mAxesFlags = kBoxAxes | kExtTicks | kLabels;
|
---|
[548] | 280 | SetInsetLimits(0.4, 0.6, 0.4, 0.6);
|
---|
[1131] | 281 | mAddTitle = true;
|
---|
[165] | 282 |
|
---|
[295] | 283 | // Initialisation
|
---|
[692] | 284 | glst_piai = new PIAppInitiator(this);
|
---|
[600] | 285 |
|
---|
| 286 | char buff[128];
|
---|
| 287 | mCons->AddStr(" ............ starting piapp .............\n", PIVA_Blue );
|
---|
| 288 | #ifdef SANS_EVOLPLANCK
|
---|
| 289 | sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
| 290 | (double)PI_VERSIONNUMBER, (float)PeidaVersion());
|
---|
| 291 | #else
|
---|
| 292 | sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
[692] | 293 | (double)PI_VERSIONNUMBER, glst_piai->Version());
|
---|
[600] | 294 | #endif
|
---|
| 295 | mCons->AddStr(buff, PIVA_Blue );
|
---|
| 296 | mCons->AddStr(" ..........................................\n", PIVA_Blue );
|
---|
| 297 | // PrintPeidaVersion();
|
---|
| 298 |
|
---|
[685] | 299 | pfc_fits->SetPath(ImgDir);
|
---|
| 300 | pfc_ppf->SetPath(WorkDir);
|
---|
| 301 | pfc_ps->SetPath(WorkDir);
|
---|
| 302 |
|
---|
[165] | 303 | SetReady();
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | /* --Methode-- */
|
---|
| 307 | PIStdImgApp::~PIStdImgApp()
|
---|
| 308 | {
|
---|
| 309 | int i;
|
---|
| 310 |
|
---|
[1075] | 311 | // On inactive la fenetre principale
|
---|
| 312 | // Sinon, ca peut provoquer un SEGV ds delete de console ?? - Reza 07/2000
|
---|
| 313 | MainWin()->Hide();
|
---|
| 314 |
|
---|
[558] | 315 | // Destrucion de tous les objets de NameObjMgr
|
---|
| 316 | string patt = "/*/*";
|
---|
| 317 | mObjMgr->DelObjects(patt, true);
|
---|
| 318 |
|
---|
[205] | 319 | delete mc;
|
---|
[293] | 320 | for(i=0; i<7; i++)
|
---|
[165] | 321 | if (m[i]) delete m[i];
|
---|
| 322 |
|
---|
| 323 | WindMList::iterator it;
|
---|
| 324 | for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
|
---|
| 325 |
|
---|
| 326 | delete mObjMgr;
|
---|
| 327 | delete mCmd;
|
---|
| 328 |
|
---|
| 329 | delete zoom;
|
---|
| 330 | delete gimv;
|
---|
| 331 | delete cmapv;
|
---|
| 332 |
|
---|
[2106] | 333 | delete lab_mem;
|
---|
| 334 | delete therm_mem;
|
---|
| 335 | delete lab_cpu;
|
---|
| 336 | delete therm_cpu;
|
---|
| 337 |
|
---|
[1971] | 338 | delete statcont;
|
---|
| 339 |
|
---|
[685] | 340 | delete pfc_fits;
|
---|
| 341 | delete pfc_ppf;
|
---|
| 342 | delete pfc_ps;
|
---|
[165] | 343 |
|
---|
| 344 | delete mCons;
|
---|
[2106] | 345 | delete consolecont;
|
---|
[165] | 346 |
|
---|
| 347 | delete mObjmgrw;
|
---|
| 348 | delete mPpinmgrw;
|
---|
| 349 |
|
---|
[686] | 350 | deleteInfoWindow();
|
---|
| 351 |
|
---|
[165] | 352 | // Les fichiers
|
---|
| 353 | if (mpsfile) delete mpsfile;
|
---|
| 354 | if (mPpfout) delete mPpfout;
|
---|
| 355 |
|
---|
[2106] | 356 | if (resupd_periodic) delete resupd_periodic;
|
---|
| 357 |
|
---|
[692] | 358 | if (glst_piai) delete glst_piai; glst_piai = NULL;
|
---|
[2106] | 359 |
|
---|
[165] | 360 | }
|
---|
| 361 |
|
---|
| 362 | /* --Methode-- */
|
---|
| 363 | void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
|
---|
| 364 | {
|
---|
| 365 | PIWdg *sndw;
|
---|
| 366 | PIMessage tmsg, smm;
|
---|
| 367 |
|
---|
| 368 | tmsg = msg;
|
---|
| 369 | msg = UserMsg(msg);
|
---|
| 370 | smm = ModMsg(tmsg);
|
---|
| 371 |
|
---|
| 372 | //printf("SuperDebug: msg=%d Mod=%d State=%d\n", (int)msg, (int)smm, (int)GetState());
|
---|
| 373 | if ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
|
---|
| 374 |
|
---|
| 375 | // Messages active-window
|
---|
| 376 | if (smm == PIMsg_Active)
|
---|
| 377 | {
|
---|
[293] | 378 | sndw = dynamic_cast<PIWdg *>(sender);
|
---|
[165] | 379 | switch(sndw->kind())
|
---|
| 380 | {
|
---|
| 381 | case PIWindow::ClassId :
|
---|
[293] | 382 | mCurWin = dynamic_cast<PIWindow *>(sndw);
|
---|
[165] | 383 | break;
|
---|
| 384 |
|
---|
| 385 | case PIScDrawWdg::ClassId :
|
---|
| 386 | case PIDraw3DWdg::ClassId :
|
---|
[293] | 387 | mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
|
---|
[165] | 388 | // cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
|
---|
| 389 | if (mFgCWImg) {
|
---|
| 390 | // cerr << "*DBG* ImgTools -> NonSensitive " << endl;
|
---|
[1590] | 391 | m[2]->SetSensitivityMsg(10311, false);
|
---|
| 392 | m[2]->SetSensitivityMsg(10312, false);
|
---|
| 393 | m[2]->SetSensitivityMsg(10313, false);
|
---|
[165] | 394 | m[4]->SetSensitivityMsg(10515, false);
|
---|
| 395 | m[4]->SetSensitivityMsg(10516, false);
|
---|
| 396 | mFgCWImg = false;
|
---|
| 397 | }
|
---|
| 398 | break;
|
---|
| 399 | case PIImage::ClassId :
|
---|
[293] | 400 | mCurWdg = dynamic_cast<PIBaseWdg *>(sender);
|
---|
[165] | 401 | if (!mFgCWImg) {
|
---|
| 402 | // cerr << "*DBG* ImgTools -> Sensitive " << endl;
|
---|
[1590] | 403 | m[2]->SetSensitivityMsg(10311, true);
|
---|
| 404 | m[2]->SetSensitivityMsg(10312, true);
|
---|
| 405 | m[2]->SetSensitivityMsg(10313, true);
|
---|
[165] | 406 | m[4]->SetSensitivityMsg(10515, true);
|
---|
| 407 | m[4]->SetSensitivityMsg(10516, true);
|
---|
| 408 | mFgCWImg = true;
|
---|
| 409 | }
|
---|
| 410 | break;
|
---|
[293] | 411 | /*
|
---|
| 412 | default :
|
---|
| 413 | mCurWdg = NULL;
|
---|
| 414 | if (mFgCWImg) {
|
---|
[1590] | 415 | m[2]->SetSensitivityMsg(10311, false);
|
---|
| 416 | m[2]->SetSensitivityMsg(10312, false);
|
---|
| 417 | m[2]->SetSensitivityMsg(10313, false);
|
---|
[293] | 418 | m[4]->SetSensitivityMsg(10515, false);
|
---|
| 419 | m[4]->SetSensitivityMsg(10516, false);
|
---|
| 420 | mFgCWImg = false;
|
---|
| 421 | }
|
---|
| 422 | break;
|
---|
| 423 | */
|
---|
[165] | 424 | }
|
---|
| 425 | }
|
---|
| 426 | // Message window-close
|
---|
| 427 | else if (smm == PIMsg_Close)
|
---|
| 428 | {
|
---|
| 429 | sndw = (PIWdg *)sender;
|
---|
| 430 | if(sndw->kind() == PIWindow::ClassId)
|
---|
| 431 | {
|
---|
| 432 | mCurWin = (PIWindow *)sender;
|
---|
| 433 | if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false);
|
---|
| 434 | DeleteWindow(mCurWin);
|
---|
| 435 | }
|
---|
| 436 | else
|
---|
| 437 | printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
|
---|
| 438 | (int)tmsg, (int)sndw->kind(), (long)sender);
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | // Traitement des messages des menus
|
---|
| 442 | else if ( (msg >= 10100) && (msg < 10200) ) MBProcess1(msg, sender, data);
|
---|
| 443 | else if ( (msg >= 10200) && (msg < 10300) ) MBProcess2(msg, sender, data);
|
---|
| 444 | else if ( (msg >= 10300) && (msg < 10400) ) MBProcess3(msg, sender, data);
|
---|
| 445 | else if ( (msg >= 10400) && (msg < 10500) ) MBProcess4(msg, sender, data);
|
---|
| 446 | else if ( (msg >= 10500) && (msg < 10600) ) MBProcess5(msg, sender, data);
|
---|
| 447 | else if ( (msg >= 10600) && (msg < 10700) ) MBProcess6(msg, sender, data);
|
---|
| 448 | else if ( msg == 30200 ) { // Objet PIConsole
|
---|
| 449 | string s = mCons->GetCmdString();
|
---|
[1265] | 450 | // string s2 = "\nExecuting " + s + "\n";
|
---|
| 451 | mCons->AddStr("Cmd> ", PIVA_Blue, false);
|
---|
| 452 | // s2 = s + "\n";
|
---|
| 453 | mCons->AddStr(s.c_str(), PIVA_Blue|PIVA_Bold, false);
|
---|
| 454 | mCons->AddChar('\n', PIVA_Def, true);
|
---|
[165] | 455 | SetBusy();
|
---|
[495] | 456 | #ifdef SANS_EVOLPLANCK
|
---|
[165] | 457 | TRY {
|
---|
[293] | 458 | mCmd->Interpret(s);
|
---|
[165] | 459 | } CATCH(merr) {
|
---|
| 460 | fflush(stdout);
|
---|
| 461 | cout << endl;
|
---|
| 462 | cerr << endl;
|
---|
| 463 | string es = PeidaExc(merr);
|
---|
[495] | 464 | cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;
|
---|
| 465 | }
|
---|
| 466 | #else
|
---|
| 467 | try {
|
---|
| 468 | mCmd->Interpret(s);
|
---|
| 469 | }
|
---|
[1276] | 470 | catch ( PThrowable & exc ) {
|
---|
| 471 | cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Exception :"
|
---|
| 472 | << (string)typeid(exc).name() << " Msg= "
|
---|
| 473 | << exc.Msg() << endl;
|
---|
[495] | 474 | cout << endl;
|
---|
[165] | 475 | }
|
---|
[1276] | 476 | catch ( ... ) {
|
---|
| 477 | cerr << "\n PIStdImgApp::Process()/ Cmd->Interpret() Catched Exception ..."
|
---|
| 478 | << endl;
|
---|
| 479 | cout << endl;
|
---|
| 480 | }
|
---|
| 481 |
|
---|
[495] | 482 | #endif
|
---|
[165] | 483 | SetReady();
|
---|
| 484 | }
|
---|
| 485 |
|
---|
| 486 | else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n",
|
---|
| 487 | (int)tmsg,(int)msg,(int)smm);
|
---|
| 488 |
|
---|
| 489 |
|
---|
| 490 | return;
|
---|
| 491 | }
|
---|
| 492 |
|
---|
[194] | 493 | /* --Methode-- */
|
---|
| 494 | void PIStdImgApp::SetReady()
|
---|
| 495 | {
|
---|
| 496 | mCons->SetSensitive();
|
---|
| 497 | gimv->SetSensitive();
|
---|
| 498 | PIApplication::SetReady();
|
---|
| 499 | }
|
---|
[165] | 500 |
|
---|
[194] | 501 | /* --Methode-- */
|
---|
| 502 | void PIStdImgApp::SetBusy()
|
---|
| 503 | {
|
---|
| 504 | mCons->SetUnSensitive();
|
---|
| 505 | gimv->SetUnSensitive();
|
---|
| 506 | PIApplication::SetBusy();
|
---|
[1321] | 507 | // Attention : Appel XSync specifique X11 - en attendant multi-thread
|
---|
| 508 | XSync(PIXDisplay(), False);
|
---|
[194] | 509 | }
|
---|
[165] | 510 |
|
---|
[194] | 511 | /* --Methode-- */
|
---|
| 512 | void PIStdImgApp::SetBlocked()
|
---|
| 513 | {
|
---|
| 514 | mCons->SetUnSensitive();
|
---|
| 515 | gimv->SetUnSensitive();
|
---|
| 516 | PIApplication::SetBlocked();
|
---|
[1321] | 517 | // Attention : Appel XSync specifique X11 - en attendant multi-thread
|
---|
| 518 | XSync(PIXDisplay(), False);
|
---|
[194] | 519 | }
|
---|
[165] | 520 |
|
---|
[194] | 521 |
|
---|
[165] | 522 | /* --Methode-- */
|
---|
[1971] | 523 | int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, string const& sop, int oid)
|
---|
[165] | 524 | {
|
---|
| 525 | PIImage* pii;
|
---|
| 526 | PIWindow* win;
|
---|
| 527 | int sx, sy, px, py, flag;
|
---|
| 528 |
|
---|
| 529 | if (nouv == NULL)
|
---|
| 530 | {
|
---|
| 531 | printf("PIStdImgApp::DispImage_Error Cannot Display NULL image \n");
|
---|
| 532 | return(-1);
|
---|
| 533 | }
|
---|
| 534 |
|
---|
| 535 | if ( (nouv->XSize() <= 0) || (nouv->YSize() <= 0))
|
---|
| 536 | {
|
---|
| 537 | printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d \n",
|
---|
| 538 | nouv->XSize(), nouv->YSize());
|
---|
| 539 | return(-1);
|
---|
| 540 | }
|
---|
| 541 |
|
---|
[1971] | 542 | // On decode les options graphiques
|
---|
| 543 | vector<string> opts;
|
---|
| 544 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
[165] | 545 |
|
---|
[1971] | 546 | // Pas de same ou inset pour DispImage
|
---|
| 547 | if ((dwopt == Disp_Same) || (dwopt == Disp_Inset) ) dwopt = Disp_Next;
|
---|
[165] | 548 |
|
---|
[1971] | 549 | // Choix de la taille de fenetre
|
---|
| 550 | #define MINPIIMGSIZE 100
|
---|
| 551 | sx = (nouv->XSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
|
---|
| 552 | sy = (nouv->YSize() > MINPIIMGSIZE) ? nouv->XSize() : MINPIIMGSIZE;
|
---|
[165] | 553 | if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
|
---|
| 554 | if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
|
---|
| 555 | px = py = 0;
|
---|
[1971] | 556 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
[165] | 557 | pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
|
---|
| 558 | pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
| 559 | pii->SetZoomWin(zoom, false);
|
---|
| 560 | pii->SetGloVWin(gimv, false);
|
---|
| 561 | pii->SetCMapWin(cmapv, false);
|
---|
| 562 | pii->ShowCursor(true);
|
---|
[331] | 563 | pii->SetUserData(NULL, oid);
|
---|
[1971] | 564 |
|
---|
| 565 | // decode des options en chaine de caracteres
|
---|
| 566 | pii->DecodeOptionString(mDefaultAtt, false); // d'abord les options par defaut
|
---|
| 567 | pii->DecodeOptionString(opts); // ensuite, les options specifies en argument
|
---|
| 568 |
|
---|
| 569 |
|
---|
| 570 | // On recalcule la taille de la fenetre si Disp_Win
|
---|
| 571 | if (dwopt == Disp_Win) {
|
---|
| 572 | int sx2 = (int)((float)nouv->XSize()*pii->GetZoomF());
|
---|
| 573 | int sy2 = (int)((float)nouv->YSize()*pii->GetZoomF());
|
---|
| 574 |
|
---|
| 575 | if (sx2 > 400+mFgScSz*100) sx2 = 400+mFgScSz*100;
|
---|
| 576 | if (sy2 > 400+mFgScSz*100) sy2 = 400+mFgScSz*100;
|
---|
| 577 | if (sx2 < MINPIIMGSIZE) sx = MINPIIMGSIZE;
|
---|
| 578 | if (sy2 < MINPIIMGSIZE) sy = MINPIIMGSIZE;
|
---|
| 579 | if ((sx2 != sx) || (sy2 != sy)) win->SetSize(sx2, sy2);
|
---|
| 580 | }
|
---|
| 581 |
|
---|
| 582 | pii->SetImage(nouv, false);
|
---|
| 583 |
|
---|
[165] | 584 | // printf("!!DBG!! PIImage Pos= %d %d Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize() );
|
---|
| 585 | mCurWin = win;
|
---|
| 586 | mCurWdg = pii;
|
---|
| 587 | mLastWdg = pii;
|
---|
| 588 | mBWId++;
|
---|
| 589 | mBWList[mBWId] = pii;
|
---|
[1971] | 590 | pii->Refresh();
|
---|
[165] | 591 | return(mBWId);
|
---|
| 592 | }
|
---|
| 593 |
|
---|
| 594 |
|
---|
| 595 | /* --Methode-- */
|
---|
[1971] | 596 | int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, string const& sop,
|
---|
| 597 | string title, int oid)
|
---|
[165] | 598 | {
|
---|
| 599 | if (scd == NULL)
|
---|
| 600 | {
|
---|
| 601 | printf("PIStdImgApp::DispScDrawer_Error Cannot Add NULL ScDrawer \n");
|
---|
| 602 | return(-1);
|
---|
| 603 | }
|
---|
| 604 |
|
---|
[1971] | 605 | // On decode les options graphiques
|
---|
| 606 | vector<string> opts;
|
---|
| 607 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
| 608 | if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
|
---|
| 609 | // Trace en superpoistion
|
---|
| 610 | if ( (dwopt == Disp_Same) && (mLastWdg) ) {
|
---|
| 611 | // Les options
|
---|
| 612 | scd->DecodeOptionString(mDefaultAtt, false);
|
---|
| 613 | scd->DecodeOptionString(opts, true);
|
---|
[165] | 614 |
|
---|
| 615 | if (mLastWdg->kind() == PIScDrawWdg::ClassId) ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
|
---|
| 616 | else mLastWdg->AddDrawer(scd, true, true, true);
|
---|
[548] | 617 | scd->Refresh();
|
---|
| 618 | mDId++;
|
---|
| 619 | mDrwList[mDId] = scd;
|
---|
| 620 | return(-mDId);
|
---|
| 621 | }
|
---|
| 622 | // Trace en medaillon
|
---|
[1971] | 623 | else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
|
---|
[548] | 624 | PIGrCoord x1, x2, y1, y2;
|
---|
| 625 | x1 = mIXmin; x2 = mIXmax;
|
---|
| 626 | y2 = 1.-mIYmin; y1 = 1.-mIYmax;
|
---|
[1971] | 627 | // Les options
|
---|
| 628 | scd->DecodeOptionString(mDefaultAtt, false);
|
---|
| 629 | scd->DecodeOptionString(opts, true);
|
---|
| 630 |
|
---|
[548] | 631 | scd->SetAxesFlags(mAxesFlags);
|
---|
[1971] | 632 | scd->UpdateLimits();
|
---|
[548] | 633 | mLastWdg->AddDrawer(scd, x1, y1, x2, y2, true, false, true);
|
---|
[165] | 634 | scd->Refresh();
|
---|
| 635 | mDId++;
|
---|
| 636 | mDrwList[mDId] = scd;
|
---|
| 637 | return(-mDId);
|
---|
| 638 | }
|
---|
| 639 |
|
---|
[1971] | 640 | // Creation d'un nouveau PIScDrawWdg
|
---|
[165] | 641 | PIWindow* win;
|
---|
| 642 | PIScDrawWdg* scw;
|
---|
| 643 | int sx, sy, px, py, flag;
|
---|
| 644 | sx = 200+mFgScSz*100;
|
---|
| 645 | sy = 200+mFgScSz*100;
|
---|
[1971] | 646 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
| 647 |
|
---|
[1856] | 648 | scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
|
---|
[165] | 649 | scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
[331] | 650 | scw->SetUserData(NULL, oid);
|
---|
[1971] | 651 |
|
---|
| 652 | // Decodage des options :
|
---|
| 653 | vector<string> scwatt;
|
---|
[203] | 654 | scw->SetAxesFlags(mAxesFlags);
|
---|
[1971] | 655 | if ( mDefaultAtt.size() > 0) {
|
---|
| 656 | scwatt = mDefaultAtt;
|
---|
| 657 | scw->DecodeOptionString(scwatt, true);
|
---|
| 658 | }
|
---|
| 659 | if ( mAxesAtt.size() > 0) {
|
---|
| 660 | scwatt = mAxesAtt;
|
---|
| 661 | scw->DecodeOptionString(scwatt, true);
|
---|
| 662 | }
|
---|
| 663 | if (opts.size() > 0)
|
---|
| 664 | scd->DecodeOptionString(opts, true);
|
---|
| 665 | if (opts.size() > 0)
|
---|
| 666 | scw->DecodeOptionString(opts, false);
|
---|
| 667 |
|
---|
[165] | 668 | // Titre du plot
|
---|
[1131] | 669 | if (mAddTitle) {
|
---|
| 670 | if (title.length() <= 0) title = name; string t2="";
|
---|
| 671 | scw->SetTitles(title, t2);
|
---|
| 672 | }
|
---|
[1569] | 673 |
|
---|
[1971] | 674 | scw->AddScDrawer(scd, true);
|
---|
[293] | 675 | // scw->Refresh(); ? Pas necessaire Reza 19/08/98, 05/05/99 $CHECK$
|
---|
[1971] | 676 |
|
---|
[165] | 677 | mCurWin = win;
|
---|
| 678 | mCurWdg = scw;
|
---|
| 679 | mLastWdg = scw;
|
---|
| 680 | mBWId++;
|
---|
| 681 | mBWList[mBWId] = scw;
|
---|
| 682 | return(mBWId);
|
---|
| 683 | }
|
---|
| 684 |
|
---|
| 685 | /* --Methode-- */
|
---|
[1971] | 686 | int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, string const& sop,
|
---|
| 687 | string title, int oid)
|
---|
[165] | 688 | {
|
---|
| 689 | if (dr3 == NULL)
|
---|
| 690 | {
|
---|
| 691 | printf("PIStdImgApp::Disp3DDrawer_Error Cannot Add NULL 3DDrawer \n");
|
---|
| 692 | return(-1);
|
---|
| 693 | }
|
---|
| 694 |
|
---|
[1971] | 695 | // On decode les options graphiques
|
---|
| 696 | vector<string> opts;
|
---|
| 697 | DispWinEnum dwopt = ParseDisplayOption(sop, opts);
|
---|
[165] | 698 |
|
---|
[1971] | 699 | if ( (!mLastWdg) && ( (dwopt == Disp_Same) || (dwopt == Disp_Inset) ) ) dwopt = Disp_Next;
|
---|
[548] | 700 | // Trace en superpoistion
|
---|
[1971] | 701 | if ( (dwopt == Disp_Same) && (mLastWdg) ) {
|
---|
| 702 | // Les options
|
---|
| 703 | dr3->DecodeOptionString(mDefaultAtt, false);
|
---|
| 704 | dr3->DecodeOptionString(opts, true);
|
---|
| 705 |
|
---|
[165] | 706 | if (mLastWdg->kind() == PIDraw3DWdg::ClassId) ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
|
---|
| 707 | else mLastWdg->AddDrawer(dr3, true, true, true);
|
---|
| 708 | dr3->Refresh();
|
---|
| 709 | mDId++;
|
---|
| 710 | mDrwList[mDId] = dr3;
|
---|
| 711 | return(-mDId);
|
---|
| 712 | }
|
---|
[548] | 713 | // Trace en medaillon
|
---|
[1971] | 714 | else if ( (dwopt == Disp_Inset) && (mLastWdg) ) {
|
---|
[548] | 715 | PIGrCoord x1, x2, y1, y2;
|
---|
| 716 | x1 = mIXmin; x2 = mIXmax;
|
---|
| 717 | y2 = 1.-mIYmin; y1 = 1.-mIYmax;
|
---|
[1971] | 718 | // Les options
|
---|
| 719 | dr3->DecodeOptionString(mDefaultAtt, false);
|
---|
| 720 | dr3->DecodeOptionString(opts, true);
|
---|
| 721 |
|
---|
[548] | 722 | dr3->SetAxesFlags(mAxesFlags);
|
---|
| 723 | dr3->UpdateLimits();
|
---|
| 724 | mLastWdg->AddDrawer(dr3, x1, y1, x2, y2, true, false, true);
|
---|
| 725 | dr3->Refresh();
|
---|
| 726 | mDId++;
|
---|
| 727 | mDrwList[mDId] = dr3;
|
---|
| 728 | return(-mDId);
|
---|
| 729 | }
|
---|
[165] | 730 |
|
---|
[548] | 731 |
|
---|
[165] | 732 | PIWindow* win;
|
---|
| 733 | int sx, sy, px, py, flag;
|
---|
| 734 | sx = 200+mFgScSz*100;
|
---|
| 735 | sy = 200+mFgScSz*100;
|
---|
[1971] | 736 | win = GetWindow(dwopt, sx, sy, px, py, flag, (char *)name.c_str());
|
---|
[165] | 737 | PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
|
---|
| 738 | wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
|
---|
[331] | 739 | wd3->SetUserData(NULL, oid);
|
---|
[1971] | 740 |
|
---|
| 741 | // Decodage des options :
|
---|
| 742 | vector<string> scwatt;
|
---|
| 743 | // wd3->SetAxesFlags(mAxesFlags); Attributs d'axes 3D a faire
|
---|
| 744 | if ( mDefaultAtt.size() > 0) {
|
---|
| 745 | scwatt = mDefaultAtt;
|
---|
| 746 | wd3->DecodeOptionString(scwatt, true);
|
---|
| 747 | }
|
---|
| 748 | if ( mAxesAtt.size() > 0) {
|
---|
| 749 | scwatt = mAxesAtt;
|
---|
| 750 | wd3->DecodeOptionString(scwatt, true);
|
---|
| 751 | }
|
---|
| 752 | if (opts.size() > 0)
|
---|
| 753 | dr3->DecodeOptionString(opts, true);
|
---|
| 754 | if (opts.size() > 0)
|
---|
| 755 | wd3->DecodeOptionString(opts, false);
|
---|
| 756 |
|
---|
[165] | 757 | // Titre du plot
|
---|
[1131] | 758 | if (mAddTitle) {
|
---|
| 759 | if (title.length() <= 0) title = name; string t2="";
|
---|
| 760 | wd3->SetTitles(title, t2);
|
---|
| 761 | }
|
---|
[1971] | 762 |
|
---|
| 763 | wd3->AddDrawer3D(dr3, true);
|
---|
[293] | 764 | // wd3->Refresh(); ?Pas necessaire $CHECK$ 05/05/99
|
---|
[1971] | 765 |
|
---|
[165] | 766 | mCurWin = win;
|
---|
| 767 | mCurWdg = wd3;
|
---|
| 768 | mLastWdg = wd3;
|
---|
| 769 | mBWId++;
|
---|
| 770 | mBWList[mBWId] = wd3;
|
---|
| 771 | return(mBWId);
|
---|
| 772 | }
|
---|
| 773 |
|
---|
[349] | 774 | /* --Methode-- */
|
---|
[1971] | 775 | void PIStdImgApp::AddText(string const & txt, double xp, double yp, string const& sop)
|
---|
[349] | 776 | {
|
---|
[1642] | 777 | PIElDrawer *eld=CurrentElDrawer();
|
---|
| 778 | if (eld == NULL) return;
|
---|
| 779 |
|
---|
[1971] | 780 | vector<string> opts;
|
---|
| 781 | ParseDisplayOption(sop, opts);
|
---|
| 782 | PIGraphicAtt gratt(opts);
|
---|
| 783 | eld->ElAddText(xp,yp,txt.c_str(), gratt.GetColor());
|
---|
[1642] | 784 | eld->Refresh();
|
---|
[349] | 785 | }
|
---|
[1642] | 786 |
|
---|
[1131] | 787 | /* --Methode-- */
|
---|
[1971] | 788 | void PIStdImgApp::AddLine(double xp1, double yp1, double xp2, double yp2, string const& sop)
|
---|
[1642] | 789 | {
|
---|
| 790 | PIElDrawer *eld=CurrentElDrawer();
|
---|
| 791 | if (eld == NULL) return;
|
---|
| 792 |
|
---|
[1971] | 793 | vector<string> opts;
|
---|
| 794 | ParseDisplayOption(sop, opts);
|
---|
| 795 | PIGraphicAtt gratt(opts);
|
---|
| 796 | eld->ElAddLine(xp1, yp1, xp2, yp2, gratt.GetColor());
|
---|
[1642] | 797 | eld->Refresh();
|
---|
| 798 | }
|
---|
| 799 |
|
---|
| 800 | /* --Methode-- */
|
---|
[1971] | 801 | void PIStdImgApp::AddRectangle(double xp1, double yp1, double xp2, double yp2,
|
---|
| 802 | string const& sop, bool fgfill)
|
---|
[1642] | 803 | {
|
---|
| 804 | PIElDrawer *eld=CurrentElDrawer();
|
---|
| 805 | if (eld == NULL) return;
|
---|
| 806 |
|
---|
| 807 | double xp,yp;
|
---|
| 808 | double dx, dy;
|
---|
| 809 | if (xp1 < xp2) {
|
---|
| 810 | xp = xp1; dx = xp2-xp1;
|
---|
| 811 | }
|
---|
| 812 | else {
|
---|
| 813 | xp = xp2; dx = xp1-xp2;
|
---|
| 814 | }
|
---|
| 815 | if (yp1 < yp2) {
|
---|
| 816 | yp = yp1; dy = yp2-yp1;
|
---|
| 817 | }
|
---|
| 818 | else {
|
---|
| 819 | yp = yp2; dy = yp1-yp2;
|
---|
| 820 | }
|
---|
[1971] | 821 |
|
---|
| 822 | vector<string> opts;
|
---|
| 823 | ParseDisplayOption(sop, opts);
|
---|
| 824 | PIGraphicAtt gratt(opts);
|
---|
| 825 |
|
---|
| 826 | if (fgfill) eld->ElAddFRect(xp, yp, dx, dy, gratt.GetColor());
|
---|
| 827 | else eld->ElAddRect(xp, yp, dx, dy, gratt.GetColor());
|
---|
[1642] | 828 | eld->Refresh();
|
---|
| 829 | }
|
---|
| 830 |
|
---|
| 831 | /* --Methode-- */
|
---|
[1971] | 832 | void PIStdImgApp::AddCircle(double xc, double yc, double r, string const& sop, bool fgfill)
|
---|
[1642] | 833 | {
|
---|
| 834 | PIElDrawer *eld=CurrentElDrawer();
|
---|
| 835 | if (eld == NULL) return;
|
---|
| 836 |
|
---|
[1971] | 837 | vector<string> opts;
|
---|
| 838 | ParseDisplayOption(sop, opts);
|
---|
| 839 | PIGraphicAtt gratt(opts);
|
---|
| 840 |
|
---|
| 841 | if (fgfill) eld->ElAddFCirc(xc, yc, r, gratt.GetColor());
|
---|
| 842 | else eld->ElAddCirc(xc, yc, r, gratt.GetColor());
|
---|
[1642] | 843 | eld->Refresh();
|
---|
| 844 | }
|
---|
| 845 |
|
---|
| 846 | /* --Methode-- */
|
---|
[1131] | 847 | void PIStdImgApp::SetTitle(string const & titletop, string const & titlebottom)
|
---|
| 848 | {
|
---|
[1642] | 849 | PIElDrawer *eld=CurrentElDrawer();
|
---|
| 850 | if (eld == NULL) return;
|
---|
| 851 |
|
---|
| 852 | eld->SetTitles(titletop, titlebottom);
|
---|
| 853 | eld->Refresh();
|
---|
| 854 | }
|
---|
| 855 |
|
---|
| 856 | /* --Methode-- */
|
---|
| 857 | PIElDrawer* PIStdImgApp::CurrentElDrawer()
|
---|
| 858 | {
|
---|
[1131] | 859 | PIElDrawer *eld=NULL;
|
---|
[1642] | 860 | if (!mLastWdg) return(eld);
|
---|
[1131] | 861 | PIScDrawWdg* sdw=NULL;
|
---|
| 862 | PIDraw3DWdg* w3d=NULL;
|
---|
| 863 | PIImage* imgw;
|
---|
| 864 | switch(mLastWdg->kind()) {
|
---|
| 865 | case PIScDrawWdg::ClassId :
|
---|
| 866 | sdw = dynamic_cast<PIScDrawWdg *>(mLastWdg);
|
---|
| 867 | if (sdw) eld = sdw->BaseDrawer();
|
---|
| 868 | break;
|
---|
| 869 | case PIDraw3DWdg::ClassId :
|
---|
| 870 | w3d = dynamic_cast<PIDraw3DWdg *>(mLastWdg);
|
---|
| 871 | if (w3d) eld = w3d->BaseDrawer();
|
---|
| 872 | break;
|
---|
| 873 | case PIImage::ClassId :
|
---|
| 874 | imgw = dynamic_cast<PIImage *>(mLastWdg);
|
---|
[1642] | 875 | if (imgw) eld = imgw->BaseDrawer();
|
---|
[1131] | 876 | break;
|
---|
| 877 | default :
|
---|
| 878 | break;
|
---|
| 879 | }
|
---|
[1642] | 880 | return(eld);
|
---|
[1131] | 881 | }
|
---|
[165] | 882 |
|
---|
| 883 | /* --Methode-- */
|
---|
| 884 | void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
|
---|
| 885 | {
|
---|
| 886 | if (nx < 1) nx = 1;
|
---|
| 887 | if (ny < 1) ny = 1;
|
---|
| 888 | if (nx > 8) nx = 8;
|
---|
| 889 | if (ny > 8) ny = 8;
|
---|
| 890 | if ( (sx < 50) && (sy < 50) ) sx = sy = 400+mFgScSz*100;
|
---|
| 891 | char buff[64];
|
---|
| 892 | mWId++;
|
---|
[210] | 893 | int px, py;
|
---|
| 894 | MainWin()->GetScreenPos(px, py);
|
---|
| 895 | sprintf(buff, "PI-GraphicWin (%d)",mWId);
|
---|
| 896 | PIZoneWindow* win = new PIZoneWindow(this, buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
|
---|
[165] | 897 | win->SetUserData(NULL, ny*10+nx); // UserFlag= nY*10 + nX
|
---|
| 898 | mWList[mWId*10+1] = (PIWindow*)win;
|
---|
| 899 | win->SetAutoDelChilds(true);
|
---|
[293] | 900 | // win->Show();
|
---|
[165] | 901 | mGrW = win;
|
---|
| 902 | mGrIdx = 0;
|
---|
| 903 | }
|
---|
| 904 |
|
---|
| 905 | /* --Methode-- */
|
---|
| 906 | void PIStdImgApp::CreateStackWin(int sx, int sy)
|
---|
| 907 | {
|
---|
| 908 | if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
|
---|
| 909 | char buff[64];
|
---|
| 910 | mWId++;
|
---|
[210] | 911 | int px, py;
|
---|
| 912 | MainWin()->GetScreenPos(px, py);
|
---|
[165] | 913 | sprintf(buff, "PI-StackWin (%d)",mWId);
|
---|
[210] | 914 | PIStackWindow* win = new PIStackWindow(this, buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
|
---|
[165] | 915 | win->SetUserData(NULL, 9999); // UserFlag= 9999
|
---|
| 916 | mWList[mWId*10+2] = (PIWindow*)win;
|
---|
| 917 | win->SetAutoDelChilds(true);
|
---|
[293] | 918 | // win->Show();
|
---|
[165] | 919 | mStW = win;
|
---|
| 920 | m[2]->SetSensitivity("StackTools", true);
|
---|
| 921 | mStIdx = 0;
|
---|
| 922 | }
|
---|
| 923 |
|
---|
| 924 | /* --Methode-- */
|
---|
[1971] | 925 | PIWindow* PIStdImgApp::GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
|
---|
[165] | 926 | {
|
---|
| 927 | PIWindow* rw;
|
---|
| 928 |
|
---|
| 929 | switch (typ) {
|
---|
| 930 | case Disp_Next : // Fenetre graphique courante
|
---|
[1971] | 931 | case Disp_Default :
|
---|
[165] | 932 | {
|
---|
| 933 | if (mGrW == NULL) CreateGraphWin();
|
---|
| 934 | int nx, ny;
|
---|
| 935 | mGrW->NbZone(nx, ny);
|
---|
| 936 | PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
|
---|
| 937 | // cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
|
---|
| 938 | if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
|
---|
| 939 | flag = mGrIdx;
|
---|
| 940 | mGrIdx = (mGrIdx+1)%(nx*ny);
|
---|
| 941 | rw = mGrW;
|
---|
| 942 | break;
|
---|
| 943 | }
|
---|
| 944 |
|
---|
| 945 | case Disp_Stack : // Fenetre de type stack (empilement)
|
---|
| 946 | {
|
---|
| 947 | if (mStW == NULL) CreateStackWin(sx, sy);
|
---|
| 948 | px = py = 0;
|
---|
| 949 | sx = mStW->XSize();
|
---|
| 950 | sy = mStW->YSize();
|
---|
| 951 | flag = mStIdx;
|
---|
| 952 | mStIdx++;
|
---|
| 953 | rw = mStW;
|
---|
| 954 | }
|
---|
| 955 | break;
|
---|
| 956 |
|
---|
| 957 | default : // Fenetre ordinaire
|
---|
| 958 | {
|
---|
[210] | 959 | int pwx, pwy;
|
---|
| 960 | MainWin()->GetScreenPos(pwx, pwy);
|
---|
[165] | 961 | if ( (sx < 50) && (sy < 50) ) sx = sy = 300+mFgScSz*100;
|
---|
[210] | 962 | rw = new PIWindow(this, nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
|
---|
[165] | 963 | rw->SetUserData(NULL, 0); // UserFlag= 0
|
---|
| 964 | mWId++;
|
---|
| 965 | mWList[mWId*10] = rw;
|
---|
| 966 | rw->SetAutoDelChilds(true);
|
---|
[293] | 967 | // rw->Show();
|
---|
[165] | 968 | px = py = 0;
|
---|
| 969 | flag = 0;
|
---|
| 970 | break;
|
---|
| 971 | }
|
---|
| 972 | }
|
---|
| 973 |
|
---|
[293] | 974 | rw->Show();
|
---|
[165] | 975 | mCurWin = rw;
|
---|
| 976 | return(rw);
|
---|
| 977 | }
|
---|
| 978 |
|
---|
| 979 | /* --Methode-- */
|
---|
| 980 | void PIStdImgApp::SetZone(int nzx, int nzy)
|
---|
| 981 | {
|
---|
| 982 | if (!mGrW) CreateGraphWin(nzx, nzy);
|
---|
| 983 | else {
|
---|
| 984 | int k;
|
---|
| 985 | PIWdg* cwd;
|
---|
| 986 | for(k=0; k<mGrW->NbChilds(); k++) {
|
---|
| 987 | if ((cwd = mGrW->GetChild(k)) == NULL) continue;
|
---|
| 988 | DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
|
---|
| 989 | }
|
---|
| 990 | mGrW->SetZone(nzx, nzy);
|
---|
| 991 | }
|
---|
| 992 | }
|
---|
| 993 |
|
---|
| 994 | /* --Methode-- */
|
---|
| 995 | void PIStdImgApp::StackWinNext()
|
---|
| 996 | {
|
---|
| 997 | if (mStW) mStW->DispNext();
|
---|
| 998 | }
|
---|
| 999 |
|
---|
| 1000 | /* --Methode-- */
|
---|
| 1001 | void PIStdImgApp::DeleteWindow(PIWindow* w)
|
---|
| 1002 | {
|
---|
| 1003 | if (w == NULL) return;
|
---|
| 1004 | w->Hide();
|
---|
[344] | 1005 | bool ownwindow=false; // To Check if this is one of our windows
|
---|
[165] | 1006 | WindMList::iterator it;
|
---|
| 1007 | for(it = mWList.begin(); it != mWList.end(); it++)
|
---|
[344] | 1008 | if ((*it).second == w) { mWList.erase(it); ownwindow = true; break; }
|
---|
[165] | 1009 | if (w == mGrW) { mGrW = NULL; mGrIdx = -1; }
|
---|
| 1010 | if (w == mStW) { mStW = NULL; mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
|
---|
| 1011 | if (w == mCurWin) mCurWin = NULL;
|
---|
[344] | 1012 |
|
---|
| 1013 | if (!ownwindow) return; // We do nothing if this is not a window we have created ...
|
---|
| 1014 |
|
---|
[165] | 1015 | int k;
|
---|
| 1016 | PIWdg* cwd;
|
---|
| 1017 | for(k=0; k<w->NbChilds(); k++) {
|
---|
| 1018 | if ((cwd = w->GetChild(k)) == NULL) continue;
|
---|
| 1019 | DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
|
---|
| 1020 | }
|
---|
| 1021 | delete w;
|
---|
| 1022 | return;
|
---|
| 1023 | }
|
---|
| 1024 |
|
---|
| 1025 | /* --Methode-- */
|
---|
| 1026 | void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
|
---|
| 1027 | {
|
---|
| 1028 | if (w == NULL) return;
|
---|
| 1029 | BWMList::iterator it;
|
---|
| 1030 | for(it = mBWList.begin(); it != mBWList.end(); it++)
|
---|
| 1031 | if ((*it).second == w) { mBWList.erase(it); break; }
|
---|
| 1032 | int k;
|
---|
| 1033 | PIDrawer* drw;
|
---|
| 1034 | for(k=0; k<w->NbDrawers(); k++) {
|
---|
| 1035 | if ((drw = w->GetDrawer(k)) == NULL) continue;
|
---|
| 1036 | DrwMList::iterator itt;
|
---|
| 1037 | for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++)
|
---|
| 1038 | if ((*itt).second == drw) { mDrwList.erase(itt); break; }
|
---|
| 1039 | }
|
---|
| 1040 |
|
---|
| 1041 | if (w == mCurWdg) {
|
---|
| 1042 | mCurWdg = NULL;
|
---|
| 1043 | if (mFgCWImg) {
|
---|
| 1044 | m[4]->SetSensitivityMsg(10515, false);
|
---|
| 1045 | m[4]->SetSensitivityMsg(10516, false);
|
---|
| 1046 | mFgCWImg = false;
|
---|
| 1047 | }
|
---|
| 1048 | }
|
---|
| 1049 |
|
---|
| 1050 | if (w == mLastWdg) mLastWdg = NULL;
|
---|
| 1051 |
|
---|
| 1052 | PIWdg* pw=NULL;
|
---|
| 1053 | if (dwin) pw = (PIWdg*)(w->Parent());
|
---|
| 1054 | //DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin);
|
---|
| 1055 | if (dw) delete w;
|
---|
| 1056 | if (pw && (pw->kind() == PIWindow::ClassId )) {
|
---|
| 1057 | PIWindow* pww = (PIWindow*) pw;
|
---|
| 1058 | if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0))
|
---|
| 1059 | DeleteWindow((PIWindow*)pw);
|
---|
| 1060 | }
|
---|
| 1061 | return;
|
---|
| 1062 | }
|
---|
| 1063 |
|
---|
| 1064 |
|
---|
| 1065 |
|
---|
| 1066 | /* --Methode-- */
|
---|
| 1067 | void PIStdImgApp::DelWRsId(int k)
|
---|
| 1068 | {
|
---|
| 1069 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl;
|
---|
| 1070 | if (k > 0) { // C'est un BaseWidget
|
---|
| 1071 | BWMList::iterator it;
|
---|
| 1072 | it = mBWList.find(k);
|
---|
| 1073 | if (it == mBWList.end()) return;
|
---|
| 1074 | PIBaseWdg* wd = (*it).second;
|
---|
| 1075 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ;
|
---|
| 1076 | DeleteBaseWidget(wd, true, true);
|
---|
| 1077 | }
|
---|
| 1078 | else { // C'est un drawer
|
---|
| 1079 | DrwMList::iterator it;
|
---|
| 1080 | it = mDrwList.find(-k);
|
---|
| 1081 | if (it == mDrwList.end()) return;
|
---|
| 1082 | delete (*it).second;
|
---|
| 1083 | mDrwList.erase(it);
|
---|
| 1084 | // cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ;
|
---|
| 1085 | }
|
---|
| 1086 | }
|
---|
[368] | 1087 | /* --Methode-- */
|
---|
| 1088 | bool PIStdImgApp::CheckWRsId(int k)
|
---|
| 1089 | {
|
---|
| 1090 | if (k > 0) { // C'est un BaseWidget
|
---|
| 1091 | BWMList::iterator it;
|
---|
| 1092 | it = mBWList.find(k);
|
---|
| 1093 | if (it == mBWList.end()) return(false);
|
---|
| 1094 | else return(true);
|
---|
| 1095 | }
|
---|
| 1096 | else { // C'est un drawer
|
---|
| 1097 | DrwMList::iterator it;
|
---|
| 1098 | it = mDrwList.find(-k);
|
---|
| 1099 | if (it == mDrwList.end()) return(false);
|
---|
| 1100 | else return(true);
|
---|
| 1101 | }
|
---|
| 1102 | }
|
---|
[165] | 1103 |
|
---|
[1971] | 1104 | /* --Methode-- */
|
---|
| 1105 | void PIStdImgApp::StatZoomWindowSetVisible(bool fg)
|
---|
| 1106 | {
|
---|
[165] | 1107 |
|
---|
[1971] | 1108 | if (fg) {
|
---|
| 1109 | consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
|
---|
| 1110 | int szy = MainWin()->YSize();
|
---|
| 1111 | MainWin()->SetSize(MainWin()->XSize(), szy+statcont->YSize());
|
---|
| 1112 | consolecont->SetPos(0, statcont->YSize());
|
---|
| 1113 | consolecont->SetSize(MainWin()->XSize(), szy);
|
---|
| 1114 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
| 1115 | statcont->Show();
|
---|
| 1116 | m[3]->SetStateMsg(10470, true);
|
---|
| 1117 | }
|
---|
| 1118 | else {
|
---|
| 1119 | statcont->Hide();
|
---|
| 1120 | consolecont->SetBinding(PIBK_free,PIBK_free,PIBK_free, PIBK_free);
|
---|
| 1121 | MainWin()->SetSize(MainWin()->XSize(), MainWin()->YSize()-statcont->YSize());
|
---|
| 1122 | consolecont->SetPos(0, 0);
|
---|
| 1123 | consolecont->SetSize(MainWin()->XSize(), MainWin()->YSize());
|
---|
| 1124 | consolecont->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed);
|
---|
| 1125 | m[3]->SetStateMsg(10470, false);
|
---|
| 1126 | }
|
---|
| 1127 |
|
---|
| 1128 | }
|
---|
| 1129 |
|
---|
[165] | 1130 | /* --Methode-- */
|
---|
[2106] | 1131 | void PIStdImgApp::UpdateStatResourceInfo()
|
---|
| 1132 | {
|
---|
| 1133 | resusg.Update();
|
---|
| 1134 | char buff[256];
|
---|
| 1135 | string lab;
|
---|
| 1136 | double frac;
|
---|
| 1137 | sprintf(buff, "Mem: %ld/Max= %ld kb" , resusg.getMemorySize(),
|
---|
| 1138 | resusg.getMaxMemorySize());
|
---|
| 1139 | lab = buff;
|
---|
| 1140 | lab_mem->SetLabel(lab);
|
---|
| 1141 | frac = (double)resusg.getMemorySize()/(double)resusg.getMaxMemorySize();
|
---|
| 1142 | therm_mem->SetValue(frac);
|
---|
| 1143 |
|
---|
| 1144 | sprintf(buff, "CPU: %ld/elap= %ld ms" , resusg.getCPUTime(),
|
---|
| 1145 | resusg.getElapsedTime());
|
---|
| 1146 | lab = buff;
|
---|
| 1147 | lab_cpu->SetLabel(lab);
|
---|
| 1148 | therm_cpu->SetValue(resusg.getAverageCPULoad());
|
---|
| 1149 |
|
---|
| 1150 | }
|
---|
| 1151 |
|
---|
| 1152 | /* --Methode-- */
|
---|
[165] | 1153 | void PIStdImgApp::RedirectStdOutErr(bool fg)
|
---|
| 1154 | {
|
---|
| 1155 | if (fg) {
|
---|
| 1156 | RedirectOutStream(mCons);
|
---|
| 1157 | RedirectErrStream(mCons);
|
---|
| 1158 | m[5]->SetStateMsg(10602, true);
|
---|
[293] | 1159 | redirecout = true;
|
---|
[165] | 1160 | }
|
---|
| 1161 | else {
|
---|
| 1162 | RedirectOutStream(NULL);
|
---|
| 1163 | RedirectErrStream(NULL);
|
---|
| 1164 | m[5]->SetStateMsg(10602, false);
|
---|
[293] | 1165 | redirecout = false;
|
---|
[165] | 1166 | }
|
---|
| 1167 | return;
|
---|
| 1168 | }
|
---|
| 1169 |
|
---|
| 1170 | /* --Methode-- */
|
---|
[374] | 1171 | void PIStdImgApp::CatchSignals(bool fgfpe, bool fgsegv)
|
---|
[165] | 1172 | {
|
---|
[912] | 1173 | #ifdef SANS_EVOLPLANCK
|
---|
[374] | 1174 | PeidaConfigureSignalhandling(fgfpe, fgsegv, true, true);
|
---|
[912] | 1175 | #else
|
---|
| 1176 | SophyaConfigureSignalhandling(fgfpe, fgsegv, true, true);
|
---|
| 1177 | #endif
|
---|
[374] | 1178 | m[5]->SetStateMsg(10603, fgfpe);
|
---|
| 1179 | m[5]->SetStateMsg(10604, fgsegv);
|
---|
[165] | 1180 | }
|
---|
| 1181 |
|
---|
| 1182 | /* --Methode-- */
|
---|
| 1183 | void PIStdImgApp::CloseAllWindows()
|
---|
| 1184 | {
|
---|
| 1185 | WindMList::iterator it;
|
---|
| 1186 | for(it = mWList.begin(); it != mWList.end(); it++) delete (*it).second;
|
---|
| 1187 | mWList.clear();
|
---|
| 1188 | mBWList.clear();
|
---|
| 1189 | mDrwList.clear();
|
---|
[454] | 1190 | mGrW = NULL;
|
---|
| 1191 | mStW = NULL;
|
---|
| 1192 | mCurWin = NULL;
|
---|
| 1193 | mCurWdg = NULL;
|
---|
| 1194 | mLastWdg = NULL;
|
---|
| 1195 | m[4]->SetSensitivityMsg(10515, false);
|
---|
| 1196 | m[4]->SetSensitivityMsg(10516, false);
|
---|
[165] | 1197 | }
|
---|
| 1198 |
|
---|
[1971] | 1199 | //---------------------------------------------------------------------------
|
---|
| 1200 | //--------- Gestion des attributs graphiques et autres options de trace -----
|
---|
| 1201 |
|
---|
[165] | 1202 | /* --Methode-- */
|
---|
[1971] | 1203 | void PIStdImgApp::SetInsetLimits(double xmin, double xmax, double ymin, double ymax)
|
---|
| 1204 | {
|
---|
| 1205 | mIXmin = xmin; mIXmax= xmax;
|
---|
| 1206 | mIYmin = ymin; mIYmax= ymax;
|
---|
| 1207 | }
|
---|
| 1208 |
|
---|
| 1209 | /* --Methode-- */
|
---|
| 1210 | void PIStdImgApp::SetDefaultGraphicAttributes(string const & opt)
|
---|
| 1211 | {
|
---|
| 1212 | ParseDisplayOption(opt, mDefaultAtt);
|
---|
| 1213 | }
|
---|
| 1214 |
|
---|
| 1215 | /* --Methode-- */
|
---|
| 1216 | void PIStdImgApp::SetDefaultAxesAttributes(string const & opt)
|
---|
| 1217 | {
|
---|
| 1218 | ParseDisplayOption(opt, mAxesAtt);
|
---|
| 1219 | }
|
---|
| 1220 |
|
---|
| 1221 | /* --Methode-- */
|
---|
| 1222 | DispWinEnum PIStdImgApp::ParseDisplayOption(string const & sop, vector<string>& opts)
|
---|
| 1223 | {
|
---|
| 1224 | DispWinEnum rc = Disp_Next;
|
---|
| 1225 | //DBG cerr << " DBG-Parse-A sop=" << sop << " sop.length()= " << sop.length() << endl;
|
---|
| 1226 | if (opts.size() > 0) opts.erase(opts.begin(), opts.end());
|
---|
| 1227 | if (sop.length() < 1) return(rc);
|
---|
| 1228 | string gratt = sop;
|
---|
| 1229 | for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
|
---|
| 1230 | if ( (gratt == "def") || (gratt == "default") ) return(rc);
|
---|
| 1231 | // On separe en mots espaces par des blancs ou tabulation
|
---|
| 1232 | size_t p = 0;
|
---|
| 1233 | size_t q = 0;
|
---|
| 1234 | size_t l = gratt.length();
|
---|
| 1235 | string token;
|
---|
| 1236 | while (q < l) {
|
---|
| 1237 | p = gratt.find_first_not_of(" \t",q); // au debut d'un token
|
---|
| 1238 | if (p >= l) break;
|
---|
| 1239 | q = gratt.find_first_of(" \t",p); // Premier blanc ou tab suivant
|
---|
| 1240 | if (q<l) token = gratt.substr(p,q-p);
|
---|
| 1241 | else token = gratt.substr(p);
|
---|
| 1242 | if (token == "") continue;
|
---|
| 1243 | // Decodage option fenetre d'affichage (win, next, ...)
|
---|
| 1244 | if (token == "win") rc = Disp_Win;
|
---|
| 1245 | else if (token == "same") rc = Disp_Same;
|
---|
| 1246 | else if (token == "inset") rc = Disp_Inset;
|
---|
| 1247 | else if (token == "stack") rc = Disp_Stack;
|
---|
| 1248 | // Option a etre decode par les drawers, etc ...
|
---|
| 1249 | else opts.push_back(token);
|
---|
| 1250 | }
|
---|
| 1251 |
|
---|
| 1252 | //DBG cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl;
|
---|
| 1253 | return (rc);
|
---|
| 1254 | }
|
---|
| 1255 |
|
---|
| 1256 | //---------------------------------------------------------------------------
|
---|
| 1257 | //------------ Methodes privees (MBProcessx, ...) ----------
|
---|
| 1258 |
|
---|
| 1259 | /* --Methode-- */
|
---|
[165] | 1260 | void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
| 1261 | {
|
---|
| 1262 |
|
---|
| 1263 | switch(msg)
|
---|
| 1264 | {
|
---|
[686] | 1265 | case 10150 :
|
---|
| 1266 | showInfoWindow(this);
|
---|
| 1267 | break;
|
---|
| 1268 |
|
---|
| 1269 | case 10155 :
|
---|
| 1270 | hideInfoWindow(this);
|
---|
| 1271 | break;
|
---|
| 1272 |
|
---|
[293] | 1273 | case 10100 :
|
---|
| 1274 | mCmd->ShowHelpWindow();
|
---|
| 1275 | break;
|
---|
| 1276 |
|
---|
[165] | 1277 | case 10120 :
|
---|
[685] | 1278 | pfc_fits->AcceptNewFile(false);
|
---|
[165] | 1279 | mFCMsg = 10125;
|
---|
[685] | 1280 | pfc_fits->SetMsg(mFCMsg);
|
---|
[165] | 1281 | SetBlocked();
|
---|
[685] | 1282 | pfc_fits->Show();
|
---|
[165] | 1283 | break;
|
---|
| 1284 |
|
---|
| 1285 | case 10125 :
|
---|
| 1286 | SetBusy();
|
---|
| 1287 | if (data) {
|
---|
[331] | 1288 | string nomobj="";
|
---|
[685] | 1289 | ObjMgr()->ReadFits(pfc_fits->GetFileName(), nomobj);
|
---|
[331] | 1290 | ObjMgr()->DisplayObj(nomobj, "win");
|
---|
[165] | 1291 | }
|
---|
| 1292 | mFCMsg = 0;
|
---|
| 1293 | SetReady();
|
---|
| 1294 | break;
|
---|
| 1295 |
|
---|
| 1296 | case 10130 :
|
---|
[685] | 1297 | pfc_ppf->AcceptNewFile(false);
|
---|
[165] | 1298 | mFCMsg = 10135;
|
---|
[685] | 1299 | pfc_ppf->SetMsg(mFCMsg);
|
---|
[165] | 1300 | SetBlocked();
|
---|
[685] | 1301 | pfc_ppf->Show();
|
---|
[165] | 1302 | break;
|
---|
| 1303 |
|
---|
| 1304 | case 10135 :
|
---|
| 1305 | mFCMsg = 0;
|
---|
| 1306 | if (data) {
|
---|
[685] | 1307 | PPInMgrW()->SetFile(pfc_ppf->GetFileName());
|
---|
[165] | 1308 | PPInMgrW()->Show();
|
---|
| 1309 | }
|
---|
| 1310 | SetReady();
|
---|
| 1311 | break;
|
---|
| 1312 |
|
---|
| 1313 | case 10105:
|
---|
| 1314 | Stop();
|
---|
| 1315 | break;
|
---|
| 1316 |
|
---|
| 1317 | }
|
---|
| 1318 | return;
|
---|
| 1319 | }
|
---|
| 1320 |
|
---|
| 1321 |
|
---|
| 1322 |
|
---|
| 1323 | /* --Methode-- */
|
---|
| 1324 | void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
| 1325 | {
|
---|
| 1326 |
|
---|
| 1327 | switch (msg) {
|
---|
| 1328 | case 10201 :
|
---|
| 1329 | ObjMgrW()->Show();
|
---|
| 1330 | break;
|
---|
| 1331 |
|
---|
| 1332 | case 10220 :
|
---|
[685] | 1333 | pfc_ppf->AcceptNewFile(true);
|
---|
[165] | 1334 | mFCMsg = 10225;
|
---|
[685] | 1335 | pfc_ppf->SetMsg(mFCMsg);
|
---|
[165] | 1336 | SetBlocked();
|
---|
[685] | 1337 | pfc_ppf->Show();
|
---|
[165] | 1338 | break;
|
---|
| 1339 |
|
---|
| 1340 | case 10225 :
|
---|
| 1341 | SetBusy();
|
---|
| 1342 | if (data) {
|
---|
| 1343 | if (mPpfout) {
|
---|
| 1344 | printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
|
---|
| 1345 | delete mPpfout;
|
---|
| 1346 | }
|
---|
[685] | 1347 | name_outppf = pfc_ppf->GetFileName();
|
---|
[165] | 1348 | mPpfout = NULL;
|
---|
| 1349 | printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
|
---|
| 1350 | mPpfout = new POutPersist(name_outppf);
|
---|
| 1351 | }
|
---|
| 1352 | mFCMsg = 0;
|
---|
| 1353 | SetReady();
|
---|
| 1354 | break;
|
---|
| 1355 |
|
---|
| 1356 | case 10230 :
|
---|
| 1357 | if (!mPpfout) break;
|
---|
| 1358 | printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
|
---|
| 1359 | delete mPpfout;
|
---|
| 1360 | name_outppf = "";
|
---|
| 1361 | mPpfout = NULL;
|
---|
| 1362 | break;
|
---|
| 1363 |
|
---|
[686] | 1364 | case 10270 :
|
---|
| 1365 | if (mCurWdg) {
|
---|
| 1366 | int oid = mCurWdg->UserFlag();
|
---|
| 1367 | DeleteBaseWidget(mCurWdg);
|
---|
| 1368 | mObjMgr->DelObj_Id(oid);
|
---|
| 1369 | }
|
---|
| 1370 | break;
|
---|
[165] | 1371 |
|
---|
| 1372 | default:
|
---|
| 1373 | cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " << msg << endl;
|
---|
| 1374 | break;
|
---|
| 1375 | }
|
---|
| 1376 |
|
---|
| 1377 | return;
|
---|
| 1378 | }
|
---|
| 1379 |
|
---|
| 1380 | /* --Methode-- */
|
---|
| 1381 | void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
|
---|
| 1382 | {
|
---|
| 1383 |
|
---|
| 1384 | switch (msg) {
|
---|
| 1385 | case 10301 :
|
---|
| 1386 | PIImgTools::ShowPIImgTools();
|
---|
| 1387 | break;
|
---|
| 1388 | case 10302 :
|
---|
| 1389 | PIDrwTools::ShowPIDrwTools();
|
---|
| 1390 | break;
|
---|
[1590] | 1391 | case 10303 :
|
---|
| 1392 | PIAxesTools::ShowPIAxesTools();
|
---|
| 1393 | break;
|
---|
[165] | 1394 |
|
---|
[1590] | 1395 | case 10304 :
|
---|
[1251] | 1396 | mCmd->ShowCxxExecWindow();
|
---|
| 1397 | break;
|
---|
| 1398 |
|
---|
[1590] | 1399 | case 10311 :
|
---|
| 1400 | case 10312 :
|
---|
[165] | 1401 | {
|
---|
| 1402 | PIImage* curpimg = NULL;
|
---|
| 1403 | if (!mCurWdg) return;
|
---|
| 1404 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
| 1405 | curpimg = (PIImage*)mCurWdg;
|
---|
| 1406 | if (curpimg == NULL) return;
|
---|
| 1407 | P2DArrayAdapter* img = curpimg->Image();
|
---|
| 1408 | if (img == NULL) return;
|
---|
| 1409 | int dx = curpimg->XSzPave();
|
---|
| 1410 | int dy = curpimg->YSzPave();
|
---|
| 1411 | int x0 = curpimg->XPave()-dx/2;
|
---|
| 1412 | int y0 = curpimg->YPave()-dy/2;
|
---|
| 1413 | if (x0 < 0) x0 = 0;
|
---|
| 1414 | if (y0 < 0) y0 = 0;
|
---|
| 1415 | int x1 = x0+dx;
|
---|
| 1416 | int y1 = y0+dy;
|
---|
| 1417 | if (x1 > img->XSize()) x1 = img->XSize();
|
---|
| 1418 | if (y1 > img->YSize()) y1 = img->YSize();
|
---|
| 1419 | dx = x1-x0; dy = y1-y0;
|
---|
| 1420 | ImageR4* pim = new ImageR4(dx, dy);
|
---|
| 1421 | int ii, jj;
|
---|
| 1422 | for(jj=0; jj<dy; jj++)
|
---|
| 1423 | for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
|
---|
[338] | 1424 | if (msg == 10305) { // Calcul des coordonnees du sous-pave
|
---|
| 1425 | double xc1, yc1;
|
---|
| 1426 | img->Coord(x0, y0, xc1, yc1);
|
---|
| 1427 | pim->SetOrg((int)xc1, (int)yc1);
|
---|
| 1428 | }
|
---|
[165] | 1429 | string nom = mCurWdg->Nom() + "_pave";
|
---|
| 1430 | ObjMgr()->AddObj(pim, nom);
|
---|
| 1431 | ObjMgr()->DisplayObj(nom, "w");
|
---|
[293] | 1432 | break;
|
---|
[165] | 1433 | }
|
---|
| 1434 |
|
---|
[1590] | 1435 | case 10313 :
|
---|
[293] | 1436 | {
|
---|
| 1437 | PIImage* curpimg = NULL;
|
---|
| 1438 | if (!mCurWdg) return;
|
---|
| 1439 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
| 1440 | curpimg = (PIImage*)mCurWdg;
|
---|
| 1441 | if (curpimg == NULL) return;
|
---|
| 1442 | curpimg->ShowCuts(true);
|
---|
| 1443 | break;
|
---|
| 1444 | }
|
---|
| 1445 |
|
---|
[165] | 1446 | case 10320 :
|
---|
| 1447 | if (mStW) mStW->DispNext();
|
---|
| 1448 | break;
|
---|
| 1449 |
|
---|
| 1450 | case 10321 :
|
---|
| 1451 | case 10322 :
|
---|
| 1452 | case 10324 :
|
---|
| 1453 | // case 10328 :
|
---|
[191] | 1454 | if (mStW) mStW->StartAutoDisp((msg-10320)*500);
|
---|
[165] | 1455 | break;
|
---|
| 1456 |
|
---|
| 1457 | case 10329 :
|
---|
| 1458 | if (mStW) mStW->StopAutoDisp();
|
---|
| 1459 | break;
|
---|
| 1460 |
|
---|
| 1461 | case 103330 :
|
---|
| 1462 | if (mStW) {
|
---|
| 1463 | PIWdg* cw = mStW->CurrentWdg();
|
---|
| 1464 | if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
|
---|
| 1465 | }
|
---|
| 1466 | break;
|
---|
| 1467 |
|
---|
| 1468 | default:
|
---|
| 1469 | cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " << msg << endl;
|
---|
| 1470 | break;
|
---|
| 1471 | }
|
---|
| 1472 | return;
|
---|
| 1473 | }
|
---|
| 1474 |
|
---|
| 1475 | /* --Methode-- */
|
---|
| 1476 | void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
|
---|
| 1477 | {
|
---|
| 1478 |
|
---|
| 1479 | switch (msg) {
|
---|
| 1480 |
|
---|
| 1481 | case 10400 :
|
---|
| 1482 | CreateStackWin();
|
---|
| 1483 | break;
|
---|
| 1484 |
|
---|
| 1485 | case 10411 :
|
---|
| 1486 | CreateGraphWin(1,1);
|
---|
| 1487 | break;
|
---|
| 1488 | case 10421 :
|
---|
| 1489 | CreateGraphWin(1,2);
|
---|
| 1490 | break;
|
---|
| 1491 | case 10412 :
|
---|
| 1492 | CreateGraphWin(2,1);
|
---|
| 1493 | break;
|
---|
| 1494 | case 10422 :
|
---|
| 1495 | CreateGraphWin(2,2);
|
---|
| 1496 | break;
|
---|
| 1497 | case 10431 :
|
---|
| 1498 | CreateGraphWin(1,3);
|
---|
| 1499 | break;
|
---|
| 1500 | case 10433 :
|
---|
| 1501 | CreateGraphWin(3,3);
|
---|
| 1502 | break;
|
---|
[558] | 1503 | case 10441 :
|
---|
| 1504 | if (mCurWdg) {
|
---|
| 1505 | mLastWdg = mCurWdg;
|
---|
| 1506 | cout << " Using current widget as last-widget (display same) " << endl;
|
---|
| 1507 | }
|
---|
| 1508 | else cout << " No current widget - select widget with mouse " << endl;
|
---|
| 1509 | break;
|
---|
[686] | 1510 | case 10460 :
|
---|
| 1511 | DeleteWindow(mCurWin);
|
---|
| 1512 | break;
|
---|
[1971] | 1513 | case 10470 :
|
---|
| 1514 | StatZoomWindowSetVisible(m[3]->GetStateMsg(10470));
|
---|
| 1515 | break;
|
---|
[165] | 1516 | default:
|
---|
| 1517 | cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " << msg << endl;
|
---|
| 1518 | break;
|
---|
| 1519 | }
|
---|
| 1520 | return;
|
---|
| 1521 | }
|
---|
| 1522 |
|
---|
| 1523 |
|
---|
| 1524 | /* --Methode-- */
|
---|
| 1525 | void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
| 1526 | {
|
---|
| 1527 | char nomps[64],strg[512];
|
---|
| 1528 | PSFile *mps;
|
---|
| 1529 | int sxt, syt, syo, syo1, sx[4], sy[4];
|
---|
| 1530 |
|
---|
| 1531 | switch (msg)
|
---|
| 1532 | {
|
---|
| 1533 | case 10501 :
|
---|
[685] | 1534 | pfc_ps->AcceptNewFile(true);
|
---|
[165] | 1535 | mFCMsg = 10525;
|
---|
[685] | 1536 | pfc_ps->SetMsg(mFCMsg);
|
---|
[165] | 1537 | SetBlocked();
|
---|
[685] | 1538 | pfc_ps->Show();
|
---|
[165] | 1539 | break;
|
---|
| 1540 |
|
---|
| 1541 | case 10525 :
|
---|
| 1542 | SetBusy();
|
---|
| 1543 | if (data) {
|
---|
| 1544 | if (mpsfile) {
|
---|
| 1545 | printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
|
---|
| 1546 | delete mpsfile;
|
---|
| 1547 | }
|
---|
[685] | 1548 | name_ps = pfc_ps->GetFileName();
|
---|
[165] | 1549 | printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
|
---|
| 1550 | mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
|
---|
| 1551 | }
|
---|
| 1552 | mFCMsg = 0;
|
---|
| 1553 | SetReady();
|
---|
| 1554 | break;
|
---|
| 1555 |
|
---|
| 1556 | case 10505 :
|
---|
| 1557 | if (!mpsfile) break;
|
---|
| 1558 | printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
|
---|
| 1559 | delete mpsfile;
|
---|
| 1560 | mpsfile = NULL;
|
---|
| 1561 | name_ps = "";
|
---|
| 1562 | break;
|
---|
| 1563 |
|
---|
| 1564 | case 10511 : // Window -> PS
|
---|
| 1565 | case 10512 : // Window -> EPS
|
---|
| 1566 | if (CurrentWindow() == NULL) break;
|
---|
| 1567 | if (msg == 10512)
|
---|
| 1568 | {
|
---|
| 1569 | num_eps++;
|
---|
| 1570 | sprintf(nomps,"pia%d.eps", num_eps);
|
---|
| 1571 | printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
|
---|
| 1572 | mps = new PSFile(nomps);
|
---|
| 1573 | }
|
---|
| 1574 | else {
|
---|
| 1575 | if (mpsfile == NULL) {
|
---|
| 1576 | name_ps = "pia.ps";
|
---|
| 1577 | mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
|
---|
| 1578 | printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
|
---|
| 1579 | }
|
---|
| 1580 | printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());
|
---|
| 1581 | mps = mpsfile;
|
---|
| 1582 | }
|
---|
| 1583 | CurrentWindow()->PSPrint(mps,0,0);
|
---|
| 1584 |
|
---|
| 1585 | if (msg == 10512) delete mps; // fichier eps
|
---|
| 1586 | break;
|
---|
| 1587 |
|
---|
| 1588 | case 10515 : // Image -> PS
|
---|
| 1589 | case 10516 : // Image -> EPS
|
---|
| 1590 | {
|
---|
| 1591 | PIImage* curpimg = NULL;
|
---|
| 1592 | if (!mCurWdg) return;
|
---|
| 1593 | if (mCurWdg->kind() != PIImage::ClassId) return;
|
---|
| 1594 | curpimg = (PIImage*)mCurWdg;
|
---|
| 1595 | if (curpimg == NULL) return;
|
---|
| 1596 | if (msg == 10516)
|
---|
| 1597 | {
|
---|
| 1598 | num_eps++;
|
---|
| 1599 | sprintf(nomps,"pia%d.eps", num_eps);
|
---|
| 1600 | printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
|
---|
| 1601 | mps = new PSFile(nomps);
|
---|
| 1602 | }
|
---|
| 1603 | else {
|
---|
| 1604 | if (mpsfile == NULL) {
|
---|
| 1605 | name_ps = "pia.ps";
|
---|
| 1606 | mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
|
---|
| 1607 | printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
|
---|
| 1608 | }
|
---|
| 1609 | printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());
|
---|
| 1610 | mps = mpsfile;
|
---|
| 1611 | }
|
---|
| 1612 |
|
---|
| 1613 | sx[0] = gimv->XSize();
|
---|
| 1614 | sy[0] = gimv->YSize();
|
---|
| 1615 | sx[1] = zoom->XSize();
|
---|
| 1616 | sy[1] = zoom->YSize();
|
---|
| 1617 | sx[2] = cmapv->XSize();
|
---|
| 1618 | sy[2] = cmapv->YSize();
|
---|
| 1619 | sx[3] = curpimg->XSize();
|
---|
| 1620 | sy[3] = curpimg->YSize();
|
---|
| 1621 | if (sy[1] > sy[0]) { syo1 = sy[1]+50; syo = sy[1]+sy[2]+60; }
|
---|
| 1622 | else { syo1 = sy[0]+50; syo = sy[0]+sy[2]+60; }
|
---|
| 1623 | syt = sy[3]+syo;
|
---|
| 1624 | sxt = sx[3];
|
---|
| 1625 | if (sxt < (sx[0]+sx[1]+20)) sxt = sx[0]+sx[1]+20;
|
---|
| 1626 | if (sxt < sx[2]) sxt = sx[2];
|
---|
| 1627 |
|
---|
| 1628 | // Pour ecrire le titre
|
---|
| 1629 | mps->NewPage((float)sxt, (float)syt, PI_Portrait);
|
---|
| 1630 | mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
|
---|
| 1631 | sprintf(strg,"Image: %s - Pave %d %d \n", curpimg->Nom().c_str(),
|
---|
| 1632 | curpimg->XPave(), curpimg->YPave());
|
---|
[384] | 1633 | mps->DrawString(10., 25., strg, PI_Black, PI_DefaultFont, PI_BoldFont, 20);
|
---|
[165] | 1634 | mps->EndBloc();
|
---|
| 1635 |
|
---|
| 1636 | // Les quatre fenetres glovimage, zoom, cmap, image
|
---|
| 1637 | gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
|
---|
| 1638 | zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
|
---|
| 1639 | cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
|
---|
| 1640 | curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
|
---|
| 1641 |
|
---|
| 1642 | if (msg == 10516) delete mps; // fichier eps
|
---|
| 1643 | break;
|
---|
| 1644 | }
|
---|
| 1645 |
|
---|
| 1646 | default:
|
---|
| 1647 | cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " << msg << endl;
|
---|
| 1648 | break;
|
---|
| 1649 | }
|
---|
| 1650 |
|
---|
| 1651 | }
|
---|
| 1652 |
|
---|
| 1653 |
|
---|
| 1654 | /* --Methode-- */
|
---|
| 1655 | void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
|
---|
| 1656 | {
|
---|
| 1657 | switch (msg) {
|
---|
| 1658 | case 10601:
|
---|
| 1659 | CloseAllWindows();
|
---|
| 1660 | break;
|
---|
| 1661 | case 10602:
|
---|
| 1662 | RedirectStdOutErr(*((bool*)data));
|
---|
| 1663 | break;
|
---|
| 1664 | case 10603:
|
---|
[374] | 1665 | case 10604:
|
---|
| 1666 | CatchSignals(m[5]->GetStateMsg(10603), m[5]->GetStateMsg(10604));
|
---|
[165] | 1667 | break;
|
---|
[449] | 1668 | case 10605:
|
---|
| 1669 | mObjMgr->SetVerbose(m[5]->GetStateMsg(10605));
|
---|
| 1670 | break;
|
---|
[1251] | 1671 | case 10606:
|
---|
| 1672 | mCmd->ShowCxxOptionWindow();
|
---|
| 1673 | break;
|
---|
[165] | 1674 | default:
|
---|
| 1675 | cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " << msg << endl;
|
---|
| 1676 | break;
|
---|
| 1677 | }
|
---|
| 1678 | return;
|
---|
| 1679 | }
|
---|
| 1680 |
|
---|
| 1681 |
|
---|
[1569] | 1682 |
|
---|
[686] | 1683 | // -------------------------------------------------
|
---|
| 1684 | // Fenetre info piapp (About piapp)
|
---|
| 1685 | // -------------------------------------------------
|
---|
| 1686 | static PIWindow* infow_win = NULL;
|
---|
| 1687 | static PIText* infow_txt = NULL;
|
---|
| 1688 | static PICMapView* infow_cmap = NULL;
|
---|
| 1689 | static PIButton* infow_but = NULL;
|
---|
| 1690 |
|
---|
| 1691 | /* Nouvelle-Fonction */
|
---|
| 1692 | static void createInfoWindow(PIStdImgApp* app)
|
---|
| 1693 | {
|
---|
| 1694 | if (infow_win) return;
|
---|
| 1695 |
|
---|
| 1696 | int bsx, bsy;
|
---|
| 1697 | PIApplicationPrefCompSize(bsx, bsy);
|
---|
| 1698 | int spx, spy;
|
---|
| 1699 | spx = bsx/6; spy = bsy/6;
|
---|
| 1700 |
|
---|
| 1701 | infow_win = new PIWindow((PIMsgHandler *)app, "About piapp",
|
---|
| 1702 | PIWK_dialog, bsx*5+3*spx, bsy*4+spy*3, 200, 200);
|
---|
| 1703 | infow_win->SetAutoDelChilds(true);
|
---|
| 1704 | infow_txt = new PIText(infow_win,"about_piapp_text", bsx*5+spx, bsy*3, spx, spy);
|
---|
| 1705 | infow_txt->SetMutiLineMode(true);
|
---|
| 1706 | infow_txt->SetTextEditable(false);
|
---|
| 1707 | infow_txt->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
| 1708 | infow_cmap = new PICMapView(infow_win, "about_piapp_cmap", bsx*4, bsy*0.7, spx, 2*spy+bsy*3.15);
|
---|
| 1709 | infow_cmap->SetColMapId(CMAP_COLBR32, 1., -1., false);
|
---|
| 1710 | infow_cmap->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
| 1711 | infow_but = new PIButton(infow_win,"OK", 10155, bsx, bsy, bsx*4+2*spx, 2*spy+bsy*3);
|
---|
| 1712 | infow_but->SetMsgParent((PIMsgHandler *)app);
|
---|
| 1713 | infow_but->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
|
---|
| 1714 | char buff[128];
|
---|
| 1715 | #ifdef SANS_EVOLPLANCK
|
---|
| 1716 | sprintf(buff, "Version: piapp=%g PI=%g PEIDA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
| 1717 | (double)PI_VERSIONNUMBER, (float)PeidaVersion());
|
---|
| 1718 | #else
|
---|
[692] | 1719 | {
|
---|
[686] | 1720 | sprintf(buff, "Version: piapp=%g PI=%g SOPHYA=%g \n", (double)PIAPP_VERSIONNUMBER,
|
---|
[692] | 1721 | (double)PI_VERSIONNUMBER, glst_piai->Version());
|
---|
| 1722 | }
|
---|
[686] | 1723 | #endif
|
---|
| 1724 | string info = "piapp : Interactive analysis program\n";
|
---|
| 1725 | info += buff;
|
---|
[1971] | 1726 | info += "(C) LAL-IN2P3/CNRS 1996-2002\n";
|
---|
| 1727 | info += "(C) SPP-DAPNIA/CEA 1996-2002\n";
|
---|
[686] | 1728 | infow_txt->SetText(info);
|
---|
| 1729 | }
|
---|
| 1730 |
|
---|
| 1731 | /* Nouvelle-Fonction */
|
---|
| 1732 | static void showInfoWindow(PIStdImgApp* app)
|
---|
| 1733 | {
|
---|
[692] | 1734 | if (!infow_win) createInfoWindow(app);
|
---|
| 1735 | if (infow_win) infow_win->Show();
|
---|
[686] | 1736 | }
|
---|
| 1737 | /* Nouvelle-Fonction */
|
---|
| 1738 | static void hideInfoWindow(PIStdImgApp* app)
|
---|
| 1739 | {
|
---|
[692] | 1740 | if (infow_win) infow_win->Hide();
|
---|
[686] | 1741 | }
|
---|
| 1742 |
|
---|
| 1743 | /* Nouvelle-Fonction */
|
---|
| 1744 | static void deleteInfoWindow()
|
---|
| 1745 | {
|
---|
| 1746 | if (!infow_win) return;
|
---|
| 1747 | delete infow_win;
|
---|
| 1748 | infow_win = NULL;
|
---|
| 1749 | infow_txt = NULL;
|
---|
| 1750 | infow_cmap = NULL;
|
---|
| 1751 | infow_but = NULL;
|
---|
| 1752 | }
|
---|
| 1753 |
|
---|
[2106] | 1754 |
|
---|