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