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