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