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