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