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