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