| [249] | 1 | #include "machdefs.h"
 | 
|---|
| [223] | 2 | #include <stdlib.h>
 | 
|---|
 | 3 | #include <stdio.h>
 | 
|---|
 | 4 | #include <string.h>
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 | #include <string>
 | 
|---|
 | 7 | #include <vector>
 | 
|---|
 | 8 | #if defined(__KCC__)
 | 
|---|
 | 9 | using std::string ;
 | 
|---|
 | 10 | #include <vector.h>
 | 
|---|
 | 11 | #endif
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | #include "strutil.h"
 | 
|---|
 | 15 | #include "timing.h"
 | 
|---|
 | 16 | #include "perrors.h"
 | 
|---|
 | 17 | #include "ctimer.h"
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | #include "psighand.h"
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | #include "cimage.h" // pour pouvoir faire extract 
 | 
|---|
 | 22 | 
 | 
|---|
 | 23 | #include "pistdimgapp.h"
 | 
|---|
 | 24 | #include "pihisto2d.h"
 | 
|---|
 | 25 | #include "psfile.h"
 | 
|---|
 | 26 | #include "piimgtools.h"
 | 
|---|
 | 27 | #include "pidrwtools.h"
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | #include "pistzwin.h"
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | //  Il faudra virer ca (?)  Reza 19/08/98 
 | 
|---|
 | 33 | // #include "parmst.h"
 | 
|---|
 | 34 | // #define  FLAG_MAINGLPARMPIA  1
 | 
|---|
 | 35 | // #include "glparmpia.h"
 | 
|---|
 | 36 | static char ImgDir[256];
 | 
|---|
 | 37 | static char WorkDir[256];
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | /* ........................................................... */
 | 
|---|
 | 41 | /*                    Classe PIStdImgApp                         */
 | 
|---|
 | 42 | /* ........................................................... */
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | /* --Methode-- */
 | 
|---|
 | 45 | PIStdImgApp::PIStdImgApp(int narg, char* arg[])
 | 
|---|
 | 46 | : PIApplication(420, 320, narg, arg)
 | 
|---|
 | 47 | {
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | // Les menus
 | 
|---|
 | 50 | m[0] = new PIMenu(Menubar(),"Fichier");
 | 
|---|
 | 51 | m[0]->AppendItem("Open-Fits", 10120);
 | 
|---|
 | 52 | m[0]->AppendItem("Open-PPF", 10130);
 | 
|---|
 | 53 | m[0]->AppendItem("Close", 10110);
 | 
|---|
 | 54 | m[0]->AppendItem("delete", 10111);
 | 
|---|
 | 55 | // m[0]->AppendItem("Options", 10101);
 | 
|---|
 | 56 | m[0]->AppendItem("Exit", 10105);
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | m[1] = new PIMenu(Menubar(),"Objets");
 | 
|---|
 | 59 | m[1]->AppendItem("ObjectManager", 10201);
 | 
|---|
 | 60 | m[1]->AppendItem("OpenOutPPF", 10220);
 | 
|---|
 | 61 | m[1]->AppendItem("CloseOutPPF", 10230);
 | 
|---|
 | 62 | 
 | 
|---|
 | 63 | m[2] = new PIMenu(Menubar(),"Tools");
 | 
|---|
 | 64 | m[2]->AppendItem("Show ImageTools", 10301);
 | 
|---|
 | 65 | m[2]->AppendItem("Show DrawerTools", 10302);
 | 
|---|
 | 66 | m[2]->AppendItem("Extract Pave", 10305);
 | 
|---|
 | 67 | m[2]->SetSensitivityMsg(10305, false);
 | 
|---|
 | 68 | mc = new PIMenu(m[2], "StackTools");
 | 
|---|
 | 69 | mc->AppendItem("DispNext", 10320);
 | 
|---|
 | 70 | mc->AppendItem("Blink 0.5s", 10321);
 | 
|---|
 | 71 | mc->AppendItem("Blink 1s", 10322);
 | 
|---|
 | 72 | mc->AppendItem("Blink 2s", 10324);
 | 
|---|
 | 73 | mc->AppendItem("Stop Blink", 10329);
 | 
|---|
 | 74 | mc->AppendItem("RemoveCurrent", 10330);
 | 
|---|
 | 75 | m[2]->AppendPDMenu(mc);
 | 
|---|
 | 76 | m[2]->SetSensitivity("StackTools", false);
 | 
|---|
 | 77 | 
 | 
|---|
 | 78 | m[3] = new PIMenu(Menubar(),"Window");
 | 
|---|
 | 79 | m[3]->AppendItem("StackWindow", 10400);
 | 
|---|
 | 80 | m[3]->AppendItem("Window", 10411);
 | 
|---|
 | 81 | m[3]->AppendItem("Window 2x1", 10421);
 | 
|---|
 | 82 | m[3]->AppendItem("Window 1x2", 10412);
 | 
|---|
 | 83 | m[3]->AppendItem("Window 2x2", 10422);
 | 
|---|
 | 84 | m[3]->AppendItem("Window 3x1", 10431);
 | 
|---|
 | 85 | m[3]->AppendItem("Window 3x3", 10433);
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 | m[4] = new PIMenu(Menubar(),"PostScript");
 | 
|---|
 | 88 | m[4]->AppendItem("OpenPS", 10501);
 | 
|---|
 | 89 | m[4]->AppendItem("ClosePS", 10505);
 | 
|---|
 | 90 | m[4]->AppendItem("Window->PS", 10511);
 | 
|---|
 | 91 | m[4]->AppendItem("Image->PS", 10515);
 | 
|---|
 | 92 | m[4]->AppendItem("Window->EPS", 10512);
 | 
|---|
 | 93 | m[4]->AppendItem("Image->EPS", 10516);
 | 
|---|
 | 94 | m[4]->SetSensitivityMsg(10515, false);
 | 
|---|
 | 95 | m[4]->SetSensitivityMsg(10516, false);
 | 
|---|
 | 96 | 
 | 
|---|
 | 97 | m[5] = new PIMenu(Menubar(),"Special");
 | 
|---|
 | 98 | m[5]->AppendItem("CloseAll", 10601);
 | 
|---|
 | 99 | m[5]->AppendCheckItem("Red.Out/Err", 10602);
 | 
|---|
 | 100 | m[5]->AppendCheckItem("Catch SigFPE/SEGV", 10603);
 | 
|---|
 | 101 | 
 | 
|---|
 | 102 | AppendMenu(m[0]);
 | 
|---|
 | 103 | AppendMenu(m[1]);
 | 
|---|
 | 104 | AppendMenu(m[2]);
 | 
|---|
 | 105 | AppendMenu(m[3]);
 | 
|---|
 | 106 | AppendMenu(m[4]);
 | 
|---|
 | 107 | AppendMenu(m[5]);
 | 
|---|
 | 108 | 
 | 
|---|
 | 109 | int scsx, scsy;
 | 
|---|
 | 110 | ScreenSz(scsx, scsy);
 | 
|---|
 | 111 | if (scsy <= 600)  mFgScSz = 0;
 | 
|---|
 | 112 | else if (scsy <= 800)  mFgScSz = 1;
 | 
|---|
 | 113 | else if (scsy <= 1024)  mFgScSz = 2;
 | 
|---|
 | 114 | else   mFgScSz = 3;
 | 
|---|
 | 115 | int msx = 420+mFgScSz*60;
 | 
|---|
 | 116 | int msy = 320+mFgScSz*40;
 | 
|---|
 | 117 | MainWin()->SetSize(msx, msy);
 | 
|---|
 | 118 | 
 | 
|---|
 | 119 | int bss = 100+mFgScSz*15;
 | 
|---|
 | 120 | gimv = new PIPixmap(MainWin(), "GloV", bss, bss, 5, 5);
 | 
|---|
 | 121 | gimv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free); 
 | 
|---|
 | 122 | zoom = new PIPixmap(MainWin(), "Zoom", bss, bss, bss+10, 5);
 | 
|---|
 | 123 | zoom->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_free, PIBK_free); 
 | 
|---|
 | 124 | cmapv = new PICMapView(MainWin(), "CMapView", msx-10, 14+mFgScSz*2, 5, bss+10); 
 | 
|---|
 | 125 | cmapv->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_free); 
 | 
|---|
 | 126 | 
 | 
|---|
 | 127 | int cpy = bss+10+14+mFgScSz*2+5;
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | // Creation d'une console avec gestion des commandes  
 | 
|---|
 | 130 | mCons = new PIConsole(MainWin(), "Console", 30200, 512, 132, msx, msy-cpy, 0, cpy );
 | 
|---|
 | 131 | mCons->SetBinding(PIBK_fixed,PIBK_fixed,PIBK_fixed, PIBK_fixed); 
 | 
|---|
 | 132 | mCons->AcceptCmd(true, 50);
 | 
|---|
 | 133 | // RedirectStdOutErr(true);  pas par defaut 
 | 
|---|
 | 134 | 
 | 
|---|
 | 135 | char buff[128];
 | 
|---|
 | 136 | sprintf(buff, "piapp V2.0   ---  PEIDA++ Version %5.3f \n", (float)PeidaVersion());
 | 
|---|
 | 137 | mCons->AddStr("  ............  starting piapp .............\n", PIVA_Blue );
 | 
|---|
 | 138 | mCons->AddStr(buff, PIVA_Blue );
 | 
|---|
 | 139 | mCons->AddStr("  ..........................................\n", PIVA_Blue );
 | 
|---|
 | 140 | // PrintPeidaVersion();
 | 
|---|
 | 141 | 
 | 
|---|
 | 142 |  
 | 
|---|
 | 143 | mObjMgr = new NamedObjMgr;
 | 
|---|
 | 144 | mObjMgr->SetImgApp(this);
 | 
|---|
 | 145 | mCmd = new PIACmd(mObjMgr, this);
 | 
|---|
 | 146 | 
 | 
|---|
 | 147 | char* varenv;
 | 
|---|
 | 148 | ImgDir[0] = WorkDir[0] = '\0';
 | 
|---|
 | 149 | if ( (varenv=getenv("PEIDA_IMAGES")) != NULL )   strncpy(ImgDir, varenv, 256);
 | 
|---|
 | 150 | if ( (varenv=getenv("PEIDA_WORK")) != NULL )  strncpy(WorkDir, varenv, 256);
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 | pfc = new PIFileChooser(this,"FileChooser", 5000); 
 | 
|---|
 | 153 | 
 | 
|---|
 | 154 | // mCutTC = new CutTools(this, this->MainWin());
 | 
|---|
 | 155 | 
 | 
|---|
 | 156 | mObjmgrw = new ObjMgrWind(this);
 | 
|---|
 | 157 | mPpinmgrw = new PPInMgrWind(this);
 | 
|---|
 | 158 | 
 | 
|---|
 | 159 | // Gestion des feneteres widgets et drawers
 | 
|---|
 | 160 | mWId = mDId = mBWId = 0;
 | 
|---|
 | 161 | mCurWin = NULL;  
 | 
|---|
 | 162 | mCurWdg = NULL;
 | 
|---|
 | 163 | mLastWdg = NULL;
 | 
|---|
 | 164 | mGrW = NULL;
 | 
|---|
 | 165 | mStW = NULL;
 | 
|---|
 | 166 | mGrIdx = mStIdx = -1;
 | 
|---|
 | 167 | 
 | 
|---|
 | 168 | mFCMsg = 0;
 | 
|---|
 | 169 | mFgCWImg = false;
 | 
|---|
 | 170 | 
 | 
|---|
 | 171 | // Gestion fichiers PS
 | 
|---|
 | 172 | num_eps = 0;
 | 
|---|
 | 173 | name_ps = "";
 | 
|---|
 | 174 | name_ps = "pia.ps";
 | 
|---|
 | 175 | mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
 | 
|---|
 | 176 | 
 | 
|---|
 | 177 | // Gestion OUT-PPF
 | 
|---|
 | 178 | mPpfout = NULL;
 | 
|---|
 | 179 | name_outppf = "";
 | 
|---|
 | 180 | 
 | 
|---|
 | 181 | // Attributs graphiques courants
 | 
|---|
 | 182 | mFCol = mBCol = PI_NotDefColor;
 | 
|---|
 | 183 | mLAtt = PI_NotDefLineAtt;
 | 
|---|
 | 184 | mFSz = PI_NotDefFontSize;
 | 
|---|
 | 185 | mFAtt = PI_NotDefFontAtt;
 | 
|---|
 | 186 | mMSz = -1;
 | 
|---|
 | 187 | mMrk = PI_NotDefMarker;
 | 
|---|
 | 188 | mCmapid = CMAP_OTHER;
 | 
|---|
 | 189 | mZoom = 0;
 | 
|---|
 | 190 | mAxesFlags = kBoxAxes | kExtTicks | kLabels;
 | 
|---|
 | 191 | SaveGraphicAtt();
 | 
|---|
 | 192 | 
 | 
|---|
 | 193 | SetReady();
 | 
|---|
 | 194 | }
 | 
|---|
 | 195 | 
 | 
|---|
 | 196 | /* --Methode-- */
 | 
|---|
 | 197 | PIStdImgApp::~PIStdImgApp()
 | 
|---|
 | 198 | {
 | 
|---|
 | 199 | int i;
 | 
|---|
 | 200 | 
 | 
|---|
 | 201 | delete mc;
 | 
|---|
 | 202 | for(i=0; i<6; i++)  
 | 
|---|
 | 203 |   if (m[i]) delete m[i];
 | 
|---|
 | 204 | 
 | 
|---|
 | 205 | WindMList::iterator it;
 | 
|---|
 | 206 | for(it = mWList.begin(); it != mWList.end(); it++)  delete (*it).second;
 | 
|---|
 | 207 | 
 | 
|---|
 | 208 | delete mObjMgr;
 | 
|---|
 | 209 | delete mCmd;
 | 
|---|
 | 210 | 
 | 
|---|
 | 211 | delete zoom;
 | 
|---|
 | 212 | delete gimv;
 | 
|---|
 | 213 | delete cmapv;
 | 
|---|
 | 214 | 
 | 
|---|
 | 215 | delete pfc;
 | 
|---|
 | 216 | 
 | 
|---|
 | 217 | delete mCons;
 | 
|---|
 | 218 | 
 | 
|---|
 | 219 | delete mObjmgrw;
 | 
|---|
 | 220 | delete mPpinmgrw;
 | 
|---|
 | 221 | 
 | 
|---|
 | 222 | // Les fichiers 
 | 
|---|
 | 223 | if (mpsfile) delete mpsfile;
 | 
|---|
 | 224 | if (mPpfout) delete mPpfout;
 | 
|---|
 | 225 | 
 | 
|---|
 | 226 | }  
 | 
|---|
 | 227 | 
 | 
|---|
 | 228 | /* --Methode-- */
 | 
|---|
 | 229 | void PIStdImgApp::Process(PIMessage msg, PIMsgHandler* sender, void* data)
 | 
|---|
 | 230 | {
 | 
|---|
 | 231 | PIWdg *sndw;
 | 
|---|
 | 232 | PIMessage tmsg, smm;
 | 
|---|
 | 233 | 
 | 
|---|
 | 234 | tmsg = msg;
 | 
|---|
 | 235 | msg = UserMsg(msg);
 | 
|---|
 | 236 | smm = ModMsg(tmsg);
 | 
|---|
 | 237 | 
 | 
|---|
 | 238 | //printf("SuperDebug: msg=%d Mod=%d  State=%d\n", (int)msg, (int)smm, (int)GetState());
 | 
|---|
 | 239 | if  ((GetState()) && (msg != mFCMsg)) { PIBeep(); return; }
 | 
|---|
 | 240 | 
 | 
|---|
 | 241 | //   Messages active-window
 | 
|---|
 | 242 | if (smm == PIMsg_Active)
 | 
|---|
 | 243 |   {
 | 
|---|
 | 244 |   sndw = (PIWdg *)sender;
 | 
|---|
 | 245 |   switch(sndw->kind())
 | 
|---|
 | 246 |     {
 | 
|---|
 | 247 |     case PIWindow::ClassId :
 | 
|---|
 | 248 |       mCurWin = (PIWindow *)sender;
 | 
|---|
 | 249 |       break;
 | 
|---|
 | 250 | 
 | 
|---|
 | 251 |     case PIScDrawWdg::ClassId :
 | 
|---|
 | 252 |     case PIDraw3DWdg::ClassId :
 | 
|---|
 | 253 |       mCurWdg = (PIBaseWdg *)sender;
 | 
|---|
 | 254 | //      cerr << "*DBG11* ImgTools -> NonSensitive " << sndw->kind() << endl;
 | 
|---|
 | 255 |       if (mFgCWImg) {
 | 
|---|
 | 256 | //        cerr << "*DBG* ImgTools -> NonSensitive " << endl;
 | 
|---|
 | 257 |         m[2]->SetSensitivityMsg(10305, false);
 | 
|---|
 | 258 |         m[4]->SetSensitivityMsg(10515, false);
 | 
|---|
 | 259 |         m[4]->SetSensitivityMsg(10516, false);
 | 
|---|
 | 260 |         mFgCWImg = false;
 | 
|---|
 | 261 |         }
 | 
|---|
 | 262 |       break;
 | 
|---|
 | 263 |     case PIImage::ClassId :
 | 
|---|
 | 264 |       mCurWdg = (PIBaseWdg *)sender;
 | 
|---|
 | 265 |       if (!mFgCWImg) {
 | 
|---|
 | 266 | //        cerr << "*DBG* ImgTools -> Sensitive " << endl;
 | 
|---|
 | 267 |         m[2]->SetSensitivityMsg(10305, true);
 | 
|---|
 | 268 |         m[4]->SetSensitivityMsg(10515, true);
 | 
|---|
 | 269 |         m[4]->SetSensitivityMsg(10516, true);
 | 
|---|
 | 270 |         mFgCWImg = true;
 | 
|---|
 | 271 |         }
 | 
|---|
 | 272 |       break;
 | 
|---|
 | 273 |     }
 | 
|---|
 | 274 |   }
 | 
|---|
 | 275 | //  Message window-close
 | 
|---|
 | 276 | else if (smm == PIMsg_Close)
 | 
|---|
 | 277 |   {
 | 
|---|
 | 278 |   sndw = (PIWdg *)sender;
 | 
|---|
 | 279 |   if(sndw->kind() == PIWindow::ClassId)
 | 
|---|
 | 280 |     {
 | 
|---|
 | 281 |     mCurWin = (PIWindow *)sender;
 | 
|---|
 | 282 |     if (mCurWin == mStW) m[2]->SetSensitivity("StackTools", false); 
 | 
|---|
 | 283 |     DeleteWindow(mCurWin);
 | 
|---|
 | 284 |     }
 | 
|---|
 | 285 |   else  
 | 
|---|
 | 286 |     printf("PIStdImgApp/Bug ? CloseMsd received from NonWindow (%d %d %lx) \n",
 | 
|---|
 | 287 |            (int)tmsg,  (int)sndw->kind(), (long)sender);       
 | 
|---|
 | 288 |   }
 | 
|---|
 | 289 | 
 | 
|---|
 | 290 | // Traitement des messages des menus 
 | 
|---|
 | 291 | else if ( (msg >= 10100) && (msg < 10200) )  MBProcess1(msg, sender, data);
 | 
|---|
 | 292 | else if ( (msg >= 10200) && (msg < 10300) )  MBProcess2(msg, sender, data);
 | 
|---|
 | 293 | else if ( (msg >= 10300) && (msg < 10400) )  MBProcess3(msg, sender, data);
 | 
|---|
 | 294 | else if ( (msg >= 10400) && (msg < 10500) )  MBProcess4(msg, sender, data);
 | 
|---|
 | 295 | else if ( (msg >= 10500) && (msg < 10600) )  MBProcess5(msg, sender, data);
 | 
|---|
 | 296 | else if ( (msg >= 10600) && (msg < 10700) )  MBProcess6(msg, sender, data);
 | 
|---|
 | 297 | else if ( msg == 30200  ) {    // Objet PIConsole 
 | 
|---|
 | 298 |   string s = mCons->GetCmdString();
 | 
|---|
 | 299 |   string s2 = "\nExecuting " + s + "\n";
 | 
|---|
 | 300 |   mCons->AddStr(s2.c_str(), PIVA_Blue, true);
 | 
|---|
 | 301 |   SetBusy();
 | 
|---|
 | 302 |   TRY {
 | 
|---|
 | 303 |     CmdInterpreter()->Do(s);
 | 
|---|
 | 304 |     }  CATCH(merr) { 
 | 
|---|
 | 305 |     fflush(stdout); 
 | 
|---|
 | 306 |     cout << endl; 
 | 
|---|
 | 307 |     cerr << endl;
 | 
|---|
 | 308 |     string es = PeidaExc(merr);
 | 
|---|
 | 309 |     cerr << "PIStdImgApp::Process()/ Cmd->Do() Exception :" << es << " (" << merr << ")" << endl ;    
 | 
|---|
 | 310 |   }
 | 
|---|
 | 311 | 
 | 
|---|
 | 312 |   SetReady();
 | 
|---|
 | 313 |   }
 | 
|---|
 | 314 | 
 | 
|---|
 | 315 | else printf("PIStdImgApp::Process() BUG?? Msg %d (%d-%d) \n", 
 | 
|---|
 | 316 |             (int)tmsg,(int)msg,(int)smm);
 | 
|---|
 | 317 | 
 | 
|---|
 | 318 | 
 | 
|---|
 | 319 | return;
 | 
|---|
 | 320 | }
 | 
|---|
 | 321 | 
 | 
|---|
 | 322 | /* --Methode-- */
 | 
|---|
 | 323 | void PIStdImgApp::SetReady()
 | 
|---|
 | 324 | {
 | 
|---|
 | 325 | mCons->SetSensitive();
 | 
|---|
 | 326 | gimv->SetSensitive();
 | 
|---|
 | 327 | PIApplication::SetReady();
 | 
|---|
 | 328 | }
 | 
|---|
 | 329 | 
 | 
|---|
 | 330 | /* --Methode-- */
 | 
|---|
 | 331 | void PIStdImgApp::SetBusy()
 | 
|---|
 | 332 | {
 | 
|---|
 | 333 | mCons->SetUnSensitive();
 | 
|---|
 | 334 | gimv->SetUnSensitive();
 | 
|---|
 | 335 | PIApplication::SetBusy();
 | 
|---|
 | 336 | }
 | 
|---|
 | 337 | 
 | 
|---|
 | 338 | /* --Methode-- */
 | 
|---|
 | 339 | void PIStdImgApp::SetBlocked()
 | 
|---|
 | 340 | {
 | 
|---|
 | 341 | mCons->SetUnSensitive();
 | 
|---|
 | 342 | gimv->SetUnSensitive();
 | 
|---|
 | 343 | PIApplication::SetBlocked();
 | 
|---|
 | 344 | }
 | 
|---|
 | 345 | 
 | 
|---|
 | 346 | 
 | 
|---|
 | 347 | /* --Methode-- */
 | 
|---|
 | 348 | int PIStdImgApp::DispImage(P2DArrayAdapter* nouv, string const & name, int opt)
 | 
|---|
 | 349 | {
 | 
|---|
 | 350 | PIImage* pii;
 | 
|---|
 | 351 | PIWindow* win;
 | 
|---|
 | 352 | int sx, sy, px, py, flag;
 | 
|---|
 | 353 | 
 | 
|---|
 | 354 | if (nouv == NULL)
 | 
|---|
 | 355 |   {
 | 
|---|
 | 356 |   printf("PIStdImgApp::DispImage_Error  Cannot Display  NULL image \n");
 | 
|---|
 | 357 |   return(-1);
 | 
|---|
 | 358 |   }
 | 
|---|
 | 359 | 
 | 
|---|
 | 360 | if ( (nouv->XSize() <= 0)  || (nouv->YSize() <= 0))
 | 
|---|
 | 361 |   {
 | 
|---|
 | 362 |   printf("PIStdImgApp::DispImage_Error Pb Size Sz=%d*%d  \n", 
 | 
|---|
 | 363 |           nouv->XSize(), nouv->YSize());
 | 
|---|
 | 364 |   return(-1);
 | 
|---|
 | 365 |   }
 | 
|---|
 | 366 | 
 | 
|---|
 | 367 | int zm = 1;
 | 
|---|
 | 368 | if (mZoom == 0) {  // Facteur de zoom auto 
 | 
|---|
 | 369 |   zm = (nouv->XSize() > nouv->YSize()) ? nouv->XSize() :  nouv->YSize();
 | 
|---|
 | 370 |   zm = (zm >= 250) ? 250/zm : 1;
 | 
|---|
 | 371 |   }
 | 
|---|
 | 372 | else zm = mZoom;
 | 
|---|
 | 373 | 
 | 
|---|
 | 374 | if (zm == 0)  zm = 1;
 | 
|---|
 | 375 | if (zm < -10)  zm = -10; 
 | 
|---|
 | 376 | if (zm > 10)  zm = 10;
 | 
|---|
 | 377 | 
 | 
|---|
 | 378 | if (zm > 0)  { sx = nouv->XSize()*zm;  sy = nouv->YSize()*zm; }
 | 
|---|
 | 379 | else  { 
 | 
|---|
 | 380 |   sx = (int)((float)nouv->XSize()*(-1./float(zm)));  
 | 
|---|
 | 381 |   sy = (int)((float)nouv->YSize()*(-1./float(zm))); 
 | 
|---|
 | 382 |   } 
 | 
|---|
 | 383 | if (sx > 400+mFgScSz*100) sx = 400+mFgScSz*100;
 | 
|---|
 | 384 | if (sy > 400+mFgScSz*100) sy = 400+mFgScSz*100;
 | 
|---|
 | 385 | px = py = 0;
 | 
|---|
 | 386 | win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
 | 
|---|
 | 387 | pii = new PIImage(win, (char *)name.c_str(), sx, sy, px,py);
 | 
|---|
 | 388 | pii->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 | 
|---|
 | 389 | pii->SetZoomWin(zoom, false);
 | 
|---|
 | 390 | pii->SetGloVWin(gimv, false);
 | 
|---|
 | 391 | pii->SetCMapWin(cmapv, false);
 | 
|---|
 | 392 | pii->SetZoom(zm, false);
 | 
|---|
 | 393 | if ( mCmapid != CMAP_OTHER ) pii->SetColMapId(mCmapid, false);
 | 
|---|
 | 394 | pii->ShowCursor(true);
 | 
|---|
 | 395 | pii->SetUserData(NULL, flag);
 | 
|---|
 | 396 | pii->SetImage(nouv, true);
 | 
|---|
 | 397 | // printf("!!DBG!! PIImage Pos= %d %d  Size= %d %d \n", pii->XPos(), pii->YPos(), pii->XSize(), pii->YSize()   );
 | 
|---|
 | 398 | mCurWin = win;
 | 
|---|
 | 399 | mCurWdg = pii;
 | 
|---|
 | 400 | mLastWdg = pii;
 | 
|---|
 | 401 | mBWId++;
 | 
|---|
 | 402 | mBWList[mBWId] = pii;
 | 
|---|
 | 403 | return(mBWId); 
 | 
|---|
 | 404 | }
 | 
|---|
 | 405 | 
 | 
|---|
 | 406 | 
 | 
|---|
 | 407 | /* --Methode-- */
 | 
|---|
 | 408 | int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, bool h2d)
 | 
|---|
 | 409 | {
 | 
|---|
 | 410 | if (scd == NULL)
 | 
|---|
 | 411 |   {
 | 
|---|
 | 412 |   printf("PIStdImgApp::DispScDrawer_Error  Cannot Add NULL ScDrawer \n");
 | 
|---|
 | 413 |   return(-1);
 | 
|---|
 | 414 |   }
 | 
|---|
 | 415 | 
 | 
|---|
 | 416 | // Changement d'attributs graphiques courants du drawer
 | 
|---|
 | 417 | if (mFCol != PI_NotDefColor) scd->SetColAtt(mFCol, mBCol);
 | 
|---|
 | 418 | if (mLAtt != PI_NotDefLineAtt) scd->SetLineAtt(mLAtt);
 | 
|---|
 | 419 | if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) scd->SetFontAtt(mFSz, mFAtt); 
 | 
|---|
 | 420 | if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) scd->SetMarkerAtt(mMSz, mMrk);
 | 
|---|
 | 421 | if ( mCmapid != CMAP_OTHER ) scd->SetColMapId(mCmapid);
 | 
|---|
 | 422 | 
 | 
|---|
 | 423 | if ( (opt == Disp_Same) && (mLastWdg) ) {
 | 
|---|
 | 424 |   if (mLastWdg->kind() == PIScDrawWdg::ClassId)  ((PIScDrawWdg*)mLastWdg)->AddScDrawer(scd, true);
 | 
|---|
 | 425 |   else mLastWdg->AddDrawer(scd, true, true, true);
 | 
|---|
 | 426 |   scd->Refresh();
 | 
|---|
 | 427 |   mDId++;
 | 
|---|
 | 428 |   mDrwList[mDId] = scd;
 | 
|---|
 | 429 |   return(-mDId);   
 | 
|---|
 | 430 | }
 | 
|---|
 | 431 | else if (opt == Disp_Same)  opt = Disp_Next;
 | 
|---|
 | 432 | 
 | 
|---|
 | 433 | PIWindow* win;
 | 
|---|
 | 434 | PIScDrawWdg* scw;
 | 
|---|
 | 435 | int sx, sy, px, py, flag;
 | 
|---|
 | 436 | sx = 200+mFgScSz*100;
 | 
|---|
 | 437 | sy = 200+mFgScSz*100;
 | 
|---|
 | 438 | win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
 | 
|---|
 | 439 | if (!h2d) scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
 | 
|---|
 | 440 | else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
 | 
|---|
 | 441 | scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 | 
|---|
 | 442 | scw->SetUserData(NULL, flag);
 | 
|---|
 | 443 | scw->SetAxesFlags(mAxesFlags);
 | 
|---|
 | 444 | 
 | 
|---|
 | 445 | if (!h2d) scw->AddScDrawer(scd, true);
 | 
|---|
 | 446 | else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
 | 
|---|
 | 447 | //   Titre du plot
 | 
|---|
 | 448 | if (title.length() <= 0)  title = name;  string t2="";   
 | 
|---|
 | 449 | scw->SetTitles(title, t2);    
 | 
|---|
 | 450 | // scw->Refresh();  Pas necessaire  Reza 19/08/98 $CHECK$ 
 | 
|---|
 | 451 | mCurWin = win;
 | 
|---|
 | 452 | mCurWdg = scw;
 | 
|---|
 | 453 | mLastWdg = scw;
 | 
|---|
 | 454 | mBWId++;
 | 
|---|
 | 455 | mBWList[mBWId] = scw;
 | 
|---|
 | 456 | return(mBWId); 
 | 
|---|
 | 457 | }
 | 
|---|
 | 458 | 
 | 
|---|
 | 459 | /* --Methode-- */
 | 
|---|
 | 460 | int PIStdImgApp::Disp3DDrawer(PIDrawer3D* dr3, string const & name, int opt, string title)
 | 
|---|
 | 461 | {
 | 
|---|
 | 462 | if (dr3 == NULL)
 | 
|---|
 | 463 |   {
 | 
|---|
 | 464 |   printf("PIStdImgApp::Disp3DDrawer_Error  Cannot Add NULL 3DDrawer \n");
 | 
|---|
 | 465 |   return(-1);
 | 
|---|
 | 466 |   }
 | 
|---|
 | 467 | 
 | 
|---|
 | 468 | // Changement d'attributs graphiques courants du drawer
 | 
|---|
 | 469 | if (mFCol != PI_NotDefColor) dr3->SetColAtt(mFCol, mBCol);
 | 
|---|
 | 470 | if (mLAtt != PI_NotDefLineAtt) dr3->SetLineAtt(mLAtt);
 | 
|---|
 | 471 | if ( (mFSz != PI_NotDefFontSize) && (mFAtt != PI_NotDefFontAtt) ) dr3->SetFontAtt(mFSz, mFAtt); 
 | 
|---|
 | 472 | if ( (mMrk != PI_NotDefMarker) && (mMSz >= 0) ) dr3->SetMarkerAtt(mMSz, mMrk);
 | 
|---|
 | 473 | if ( mCmapid != CMAP_OTHER ) dr3->SetColMapId(mCmapid);
 | 
|---|
 | 474 | 
 | 
|---|
 | 475 | if ( (opt == Disp_Same) && (mLastWdg) ) {
 | 
|---|
 | 476 |   if (mLastWdg->kind() == PIDraw3DWdg::ClassId)  ((PIDraw3DWdg*)mLastWdg)->AddDrawer3D(dr3, true);
 | 
|---|
 | 477 |   else mLastWdg->AddDrawer(dr3, true, true, true);
 | 
|---|
 | 478 |   dr3->Refresh();
 | 
|---|
 | 479 |   mDId++;
 | 
|---|
 | 480 |   mDrwList[mDId] = dr3;
 | 
|---|
 | 481 |   return(-mDId);   
 | 
|---|
 | 482 | }
 | 
|---|
 | 483 | else if (opt == Disp_Same)  opt = Disp_Next;
 | 
|---|
 | 484 | 
 | 
|---|
 | 485 | PIWindow* win;
 | 
|---|
 | 486 | int sx, sy, px, py, flag;
 | 
|---|
 | 487 | sx = 200+mFgScSz*100;
 | 
|---|
 | 488 | sy = 200+mFgScSz*100;
 | 
|---|
 | 489 | win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str());
 | 
|---|
 | 490 | PIDraw3DWdg* wd3 = new PIDraw3DWdg(win, (char *)name.c_str(), sx, sy, px, py);
 | 
|---|
 | 491 | wd3->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
 | 
|---|
 | 492 | wd3->SetUserData(NULL, flag);
 | 
|---|
 | 493 | wd3->AddDrawer3D(dr3, true);
 | 
|---|
 | 494 | //   Titre du plot
 | 
|---|
 | 495 | if (title.length() <= 0)  title = name;  string t2="";   
 | 
|---|
 | 496 | wd3->SetTitles(title, t2);    
 | 
|---|
 | 497 | // wd3->Refresh();  Pas necessaire   
 | 
|---|
 | 498 | mCurWin = win;
 | 
|---|
 | 499 | mCurWdg = wd3;
 | 
|---|
 | 500 | mLastWdg = wd3;
 | 
|---|
 | 501 | mBWId++;
 | 
|---|
 | 502 | mBWList[mBWId] = wd3;
 | 
|---|
 | 503 | return(mBWId); 
 | 
|---|
 | 504 | }
 | 
|---|
 | 505 | 
 | 
|---|
 | 506 | 
 | 
|---|
 | 507 | /* --Methode-- */
 | 
|---|
 | 508 | void PIStdImgApp::CreateGraphWin(int nx, int ny, int sx, int sy)
 | 
|---|
 | 509 | {
 | 
|---|
 | 510 | if (nx < 1)  nx = 1;
 | 
|---|
 | 511 | if (ny < 1)  ny = 1;
 | 
|---|
 | 512 | if (nx > 8)  nx = 8;    
 | 
|---|
 | 513 | if (ny > 8)  ny = 8;
 | 
|---|
 | 514 | if ( (sx < 50) && (sy < 50) )   sx = sy = 400+mFgScSz*100; 
 | 
|---|
 | 515 | char buff[64];
 | 
|---|
 | 516 | mWId++;
 | 
|---|
 | 517 | int px, py; 
 | 
|---|
 | 518 | MainWin()->GetScreenPos(px, py);
 | 
|---|
 | 519 | sprintf(buff, "PI-GraphicWin (%d)",mWId);
 | 
|---|
 | 520 | PIZoneWindow* win = new PIZoneWindow(this,  buff, PIWK_normal, nx, ny, sx, sy, px+MainWin()->XSize()+30, 0);
 | 
|---|
 | 521 | win->SetUserData(NULL, ny*10+nx);  // UserFlag= nY*10 + nX  
 | 
|---|
 | 522 | mWList[mWId*10+1] = (PIWindow*)win;
 | 
|---|
 | 523 | win->SetAutoDelChilds(true);
 | 
|---|
 | 524 | win->Show();
 | 
|---|
 | 525 | mGrW = win; 
 | 
|---|
 | 526 | mGrIdx = 0;
 | 
|---|
 | 527 | }
 | 
|---|
 | 528 | 
 | 
|---|
 | 529 | /* --Methode-- */
 | 
|---|
 | 530 | void PIStdImgApp::CreateStackWin(int sx, int sy)
 | 
|---|
 | 531 | {
 | 
|---|
 | 532 | if ( (sx < 50) && (sy < 50) )   sx = sy = 300+mFgScSz*100; 
 | 
|---|
 | 533 | char buff[64];
 | 
|---|
 | 534 | mWId++;
 | 
|---|
 | 535 | int px, py; 
 | 
|---|
 | 536 | MainWin()->GetScreenPos(px, py);
 | 
|---|
 | 537 | sprintf(buff, "PI-StackWin (%d)",mWId); 
 | 
|---|
 | 538 | PIStackWindow* win = new PIStackWindow(this,  buff, PIWK_normal, sx, sy, px+MainWin()->XSize()+30, 100);
 | 
|---|
 | 539 | win->SetUserData(NULL, 9999);  // UserFlag= 9999 
 | 
|---|
 | 540 | mWList[mWId*10+2] = (PIWindow*)win;
 | 
|---|
 | 541 | win->SetAutoDelChilds(true);
 | 
|---|
 | 542 | win->Show();
 | 
|---|
 | 543 | mStW = win;
 | 
|---|
 | 544 | m[2]->SetSensitivity("StackTools", true); 
 | 
|---|
 | 545 | mStIdx = 0;
 | 
|---|
 | 546 | }
 | 
|---|
 | 547 | 
 | 
|---|
 | 548 | /* --Methode-- */
 | 
|---|
 | 549 | PIWindow* PIStdImgApp::GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom)
 | 
|---|
 | 550 | {
 | 
|---|
 | 551 | PIWindow* rw;
 | 
|---|
 | 552 | 
 | 
|---|
 | 553 | switch (typ) {
 | 
|---|
 | 554 |   case Disp_Next :  // Fenetre graphique courante
 | 
|---|
 | 555 |     {
 | 
|---|
 | 556 |     if (mGrW == NULL) CreateGraphWin();
 | 
|---|
 | 557 |     int nx, ny;
 | 
|---|
 | 558 |     mGrW->NbZone(nx, ny);
 | 
|---|
 | 559 |     PIWdg* nw = mGrW->NextChildPosSize(px, py, sx, sy);
 | 
|---|
 | 560 | //    cerr << "**DBG** PIStdImgApp::GetWindow() DispNext : nw = " << (long)nw << endl;
 | 
|---|
 | 561 |     if (nw) DeleteBaseWidget((PIBaseWdg*)nw, false, false);
 | 
|---|
 | 562 |     flag = mGrIdx;
 | 
|---|
 | 563 |     mGrIdx = (mGrIdx+1)%(nx*ny);
 | 
|---|
 | 564 |     rw = mGrW;
 | 
|---|
 | 565 |     break;
 | 
|---|
 | 566 |     }
 | 
|---|
 | 567 | 
 | 
|---|
 | 568 |   case Disp_Stack :  // Fenetre de type stack (empilement)
 | 
|---|
 | 569 |     {
 | 
|---|
 | 570 |     if (mStW == NULL) CreateStackWin(sx, sy);
 | 
|---|
 | 571 |     px = py = 0;
 | 
|---|
 | 572 |     sx = mStW->XSize();
 | 
|---|
 | 573 |     sy = mStW->YSize();
 | 
|---|
 | 574 |     flag = mStIdx;
 | 
|---|
 | 575 |     mStIdx++;
 | 
|---|
 | 576 |     rw = mStW;
 | 
|---|
 | 577 |     }
 | 
|---|
 | 578 |     break;
 | 
|---|
 | 579 | 
 | 
|---|
 | 580 |   default :      // Fenetre ordinaire
 | 
|---|
 | 581 |     {
 | 
|---|
 | 582 |     int pwx, pwy; 
 | 
|---|
 | 583 |     MainWin()->GetScreenPos(pwx, pwy);
 | 
|---|
 | 584 |     if ( (sx < 50) && (sy < 50) )   sx = sy = 300+mFgScSz*100; 
 | 
|---|
 | 585 |     rw = new PIWindow(this,  nom, PIWK_normal, sx, sy, pwx+MainWin()->XSize()+30, 300);
 | 
|---|
 | 586 |     rw->SetUserData(NULL, 0);  // UserFlag= 0 
 | 
|---|
 | 587 |     mWId++;
 | 
|---|
 | 588 |     mWList[mWId*10] = rw;
 | 
|---|
 | 589 |     rw->SetAutoDelChilds(true);
 | 
|---|
 | 590 |     rw->Show();
 | 
|---|
 | 591 |     px = py = 0;
 | 
|---|
 | 592 |     flag = 0;
 | 
|---|
 | 593 |     break;
 | 
|---|
 | 594 |     }
 | 
|---|
 | 595 |   }
 | 
|---|
 | 596 | 
 | 
|---|
 | 597 | // rw->Show();
 | 
|---|
 | 598 | mCurWin = rw;
 | 
|---|
 | 599 | return(rw);
 | 
|---|
 | 600 | }
 | 
|---|
 | 601 | 
 | 
|---|
 | 602 | /* --Methode-- */
 | 
|---|
 | 603 | void PIStdImgApp::SetZone(int nzx, int nzy)
 | 
|---|
 | 604 | {
 | 
|---|
 | 605 | if (!mGrW) CreateGraphWin(nzx, nzy);
 | 
|---|
 | 606 | else { 
 | 
|---|
 | 607 |   int k;
 | 
|---|
 | 608 |   PIWdg* cwd;
 | 
|---|
 | 609 |   for(k=0; k<mGrW->NbChilds(); k++) {
 | 
|---|
 | 610 |     if ((cwd = mGrW->GetChild(k)) == NULL)  continue; 
 | 
|---|
 | 611 |     DeleteBaseWidget((PIBaseWdg*)cwd, false, false);
 | 
|---|
 | 612 |     }
 | 
|---|
 | 613 |   mGrW->SetZone(nzx, nzy);
 | 
|---|
 | 614 |   }
 | 
|---|
 | 615 | }
 | 
|---|
 | 616 | 
 | 
|---|
 | 617 | /* --Methode-- */
 | 
|---|
 | 618 | void PIStdImgApp::StackWinNext()
 | 
|---|
 | 619 | {
 | 
|---|
 | 620 | if (mStW)  mStW->DispNext();
 | 
|---|
 | 621 | }
 | 
|---|
 | 622 | 
 | 
|---|
 | 623 | /* --Methode-- */
 | 
|---|
 | 624 | void PIStdImgApp::DeleteWindow(PIWindow* w)
 | 
|---|
 | 625 | {
 | 
|---|
 | 626 | if (w == NULL)  return;
 | 
|---|
 | 627 | w->Hide();
 | 
|---|
 | 628 | WindMList::iterator it;
 | 
|---|
 | 629 | for(it = mWList.begin(); it != mWList.end(); it++) 
 | 
|---|
 | 630 |   if ((*it).second == w)  { mWList.erase(it);  break; }
 | 
|---|
 | 631 | if (w == mGrW) { mGrW = NULL;  mGrIdx = -1; }
 | 
|---|
 | 632 | if (w == mStW) { mStW = NULL;  mStIdx = -1; m[2]->SetSensitivity("StackTools", false); }
 | 
|---|
 | 633 | if (w == mCurWin) mCurWin = NULL;
 | 
|---|
 | 634 | int k;
 | 
|---|
 | 635 | PIWdg* cwd;
 | 
|---|
 | 636 | for(k=0; k<w->NbChilds(); k++) {
 | 
|---|
 | 637 |   if ((cwd = w->GetChild(k)) == NULL)  continue; 
 | 
|---|
 | 638 |   DeleteBaseWidget((PIBaseWdg*)cwd,false,false);
 | 
|---|
 | 639 |   }
 | 
|---|
 | 640 | delete w;
 | 
|---|
 | 641 | return;
 | 
|---|
 | 642 | }
 | 
|---|
 | 643 | 
 | 
|---|
 | 644 | /* --Methode-- */
 | 
|---|
 | 645 | void PIStdImgApp::DeleteBaseWidget(PIBaseWdg* w, bool dw, bool dwin)
 | 
|---|
 | 646 | {
 | 
|---|
 | 647 | if (w == NULL)  return;
 | 
|---|
 | 648 | BWMList::iterator it;
 | 
|---|
 | 649 | for(it = mBWList.begin(); it != mBWList.end(); it++) 
 | 
|---|
 | 650 |   if ((*it).second == w)  { mBWList.erase(it);  break; }
 | 
|---|
 | 651 | int k;
 | 
|---|
 | 652 | PIDrawer* drw;
 | 
|---|
 | 653 | for(k=0; k<w->NbDrawers(); k++) {
 | 
|---|
 | 654 |   if ((drw = w->GetDrawer(k)) == NULL)  continue; 
 | 
|---|
 | 655 |   DrwMList::iterator itt;
 | 
|---|
 | 656 |   for(itt = mDrwList.begin(); itt != mDrwList.end(); itt++) 
 | 
|---|
 | 657 |     if ((*itt).second == drw)  { mDrwList.erase(itt);  break; }
 | 
|---|
 | 658 |   }
 | 
|---|
 | 659 | 
 | 
|---|
 | 660 | if (w == mCurWdg) {  
 | 
|---|
 | 661 |   mCurWdg = NULL;
 | 
|---|
 | 662 |   if (mFgCWImg) {
 | 
|---|
 | 663 |     m[4]->SetSensitivityMsg(10515, false);
 | 
|---|
 | 664 |     m[4]->SetSensitivityMsg(10516, false);
 | 
|---|
 | 665 |     mFgCWImg = false;
 | 
|---|
 | 666 |     }
 | 
|---|
 | 667 |   }
 | 
|---|
 | 668 | 
 | 
|---|
 | 669 | if (w == mLastWdg)  mLastWdg = NULL;
 | 
|---|
 | 670 | 
 | 
|---|
 | 671 | PIWdg* pw=NULL;
 | 
|---|
 | 672 | if (dwin)  pw = (PIWdg*)(w->Parent());
 | 
|---|
 | 673 | //DBG printf("DeleteBaseWidget(%lx)-DBG kind = %d - %d %d \n", (long)w, w->kind(), (int)dw, (int)dwin); 
 | 
|---|
 | 674 | if (dw) delete w;
 | 
|---|
 | 675 | if (pw && (pw->kind() == PIWindow::ClassId )) {
 | 
|---|
 | 676 |  PIWindow* pww = (PIWindow*) pw;
 | 
|---|
 | 677 |  if ((pww != (PIWindow*)mGrW) && (pww != (PIWindow*)mStW) && (pww->NbChilds()==0)) 
 | 
|---|
 | 678 |     DeleteWindow((PIWindow*)pw);
 | 
|---|
 | 679 |  } 
 | 
|---|
 | 680 | return;
 | 
|---|
 | 681 | }
 | 
|---|
 | 682 | 
 | 
|---|
 | 683 | 
 | 
|---|
 | 684 | 
 | 
|---|
 | 685 | /* --Methode-- */
 | 
|---|
 | 686 | void PIStdImgApp::DelWRsId(int k)
 | 
|---|
 | 687 | {
 | 
|---|
 | 688 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId(" << k << ")" << endl; 
 | 
|---|
 | 689 | if (k > 0) { // C'est un BaseWidget
 | 
|---|
 | 690 |   BWMList::iterator it;
 | 
|---|
 | 691 |   it  = mBWList.find(k);
 | 
|---|
 | 692 |   if (it == mBWList.end())  return;
 | 
|---|
 | 693 |   PIBaseWdg* wd = (*it).second;
 | 
|---|
 | 694 | //DBG cerr << "-DBG- PIStdImgApp::DelWRsId Deleting BaseWidget " << (long)(wd) << endl ; 
 | 
|---|
 | 695 |   DeleteBaseWidget(wd, true, true);
 | 
|---|
 | 696 |   }
 | 
|---|
 | 697 | else {  // C'est un drawer
 | 
|---|
 | 698 |   DrwMList::iterator it;
 | 
|---|
 | 699 |   it  = mDrwList.find(-k);
 | 
|---|
 | 700 |   if (it == mDrwList.end())  return;
 | 
|---|
 | 701 |   delete (*it).second;  
 | 
|---|
 | 702 |   mDrwList.erase(it);
 | 
|---|
 | 703 | //  cerr << "+DBG+ PIStdImgApp::DelWRsId Deleting Drawer " << (long)((*it).second) << endl ; 
 | 
|---|
 | 704 |   }
 | 
|---|
 | 705 | }
 | 
|---|
 | 706 | 
 | 
|---|
 | 707 | 
 | 
|---|
 | 708 | /* --Methode-- */
 | 
|---|
 | 709 | void PIStdImgApp::RedirectStdOutErr(bool fg)
 | 
|---|
 | 710 | {
 | 
|---|
 | 711 | if (fg) { 
 | 
|---|
 | 712 |   RedirectOutStream(mCons);
 | 
|---|
 | 713 |   RedirectErrStream(mCons);
 | 
|---|
 | 714 |   m[5]->SetStateMsg(10602, true);
 | 
|---|
 | 715 |   }
 | 
|---|
 | 716 | else {
 | 
|---|
 | 717 |   RedirectOutStream(NULL);
 | 
|---|
 | 718 |   RedirectErrStream(NULL);
 | 
|---|
 | 719 |   m[5]->SetStateMsg(10602, false);
 | 
|---|
 | 720 |   }
 | 
|---|
 | 721 | return;
 | 
|---|
 | 722 | }
 | 
|---|
 | 723 | 
 | 
|---|
 | 724 | /* --Methode-- */
 | 
|---|
 | 725 | void PIStdImgApp::CatchSignals(bool fg)
 | 
|---|
 | 726 | {    
 | 
|---|
 | 727 | PeidaConfigureSignalhandling(fg, fg);  
 | 
|---|
 | 728 | m[5]->SetStateMsg(10603, fg);
 | 
|---|
 | 729 | }
 | 
|---|
 | 730 | 
 | 
|---|
 | 731 | /* --Methode-- */
 | 
|---|
 | 732 | void PIStdImgApp::CloseAllWindows()
 | 
|---|
 | 733 | {
 | 
|---|
 | 734 | WindMList::iterator it;
 | 
|---|
 | 735 | for(it = mWList.begin(); it != mWList.end(); it++)   delete (*it).second;
 | 
|---|
 | 736 | mWList.clear();
 | 
|---|
 | 737 | mBWList.clear();
 | 
|---|
 | 738 | mDrwList.clear(); 
 | 
|---|
 | 739 | }
 | 
|---|
 | 740 | 
 | 
|---|
 | 741 | /* --Methode-- */
 | 
|---|
 | 742 | void PIStdImgApp::MBProcess1(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
 | 
|---|
 | 743 | {
 | 
|---|
 | 744 | 
 | 
|---|
 | 745 |   switch(msg)
 | 
|---|
 | 746 |     {
 | 
|---|
 | 747 |     case 10120 :
 | 
|---|
 | 748 |       pfc->SetPath(ImgDir);
 | 
|---|
 | 749 |       pfc->AcceptNewFile(false);
 | 
|---|
 | 750 |       mFCMsg = 10125; 
 | 
|---|
 | 751 |       pfc->SetMsg(mFCMsg);
 | 
|---|
 | 752 |       SetBlocked();
 | 
|---|
 | 753 |       pfc->Show();
 | 
|---|
 | 754 |       break;
 | 
|---|
 | 755 | 
 | 
|---|
 | 756 |     case 10125 :
 | 
|---|
 | 757 |       SetBusy();
 | 
|---|
 | 758 |       if (data)  { 
 | 
|---|
 | 759 |         ObjMgr()->ReadFits(pfc->GetFileName());
 | 
|---|
 | 760 |         ObjMgr()->DisplayObj(ObjMgr()->LastObjName(), "win");
 | 
|---|
 | 761 |       }
 | 
|---|
 | 762 |       mFCMsg = 0;
 | 
|---|
 | 763 |       SetReady();
 | 
|---|
 | 764 |       break;
 | 
|---|
 | 765 | 
 | 
|---|
 | 766 |     case 10130 :
 | 
|---|
 | 767 |       pfc->SetPath(WorkDir);
 | 
|---|
 | 768 |       pfc->AcceptNewFile(false); 
 | 
|---|
 | 769 |       mFCMsg = 10135; 
 | 
|---|
 | 770 |       pfc->SetMsg(mFCMsg);
 | 
|---|
 | 771 |       SetBlocked();
 | 
|---|
 | 772 |       pfc->Show();
 | 
|---|
 | 773 |       break;
 | 
|---|
 | 774 | 
 | 
|---|
 | 775 |     case 10135 :
 | 
|---|
 | 776 |       mFCMsg = 0;
 | 
|---|
 | 777 |       if (data)  { 
 | 
|---|
 | 778 |         PPInMgrW()->SetFile(pfc->GetFileName());
 | 
|---|
 | 779 |         PPInMgrW()->Show();
 | 
|---|
 | 780 |       }
 | 
|---|
 | 781 |       SetReady();
 | 
|---|
 | 782 |       break;
 | 
|---|
 | 783 | 
 | 
|---|
 | 784 |     case 10110 :
 | 
|---|
 | 785 |       DeleteWindow(mCurWin);
 | 
|---|
 | 786 |       break;
 | 
|---|
 | 787 |         
 | 
|---|
 | 788 |     case 10111 :
 | 
|---|
 | 789 |       if (mCurWdg) {
 | 
|---|
 | 790 |         string no = mCurWdg->Nom();
 | 
|---|
 | 791 |         DeleteBaseWidget(mCurWdg);
 | 
|---|
 | 792 |         mObjMgr->DelObj(no);
 | 
|---|
 | 793 |         }
 | 
|---|
 | 794 |       break;
 | 
|---|
 | 795 | 
 | 
|---|
 | 796 |     case 10105:
 | 
|---|
 | 797 |       Stop();
 | 
|---|
 | 798 |       break;
 | 
|---|
 | 799 | 
 | 
|---|
 | 800 |   }
 | 
|---|
 | 801 | return;
 | 
|---|
 | 802 | }
 | 
|---|
 | 803 | 
 | 
|---|
 | 804 | 
 | 
|---|
 | 805 | 
 | 
|---|
 | 806 | /* --Methode-- */
 | 
|---|
 | 807 | void PIStdImgApp::MBProcess2(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
 | 
|---|
 | 808 | {
 | 
|---|
 | 809 | 
 | 
|---|
 | 810 | switch (msg)  { 
 | 
|---|
 | 811 |   case 10201 :
 | 
|---|
 | 812 |      ObjMgrW()->Show();
 | 
|---|
 | 813 |      break;
 | 
|---|
 | 814 | 
 | 
|---|
 | 815 |   case 10220 :
 | 
|---|
 | 816 |      pfc->SetPath(WorkDir);
 | 
|---|
 | 817 |      pfc->AcceptNewFile(true);
 | 
|---|
 | 818 |      mFCMsg = 10225;
 | 
|---|
 | 819 |      pfc->SetMsg(mFCMsg);
 | 
|---|
 | 820 |      SetBlocked();
 | 
|---|
 | 821 |      pfc->Show();
 | 
|---|
 | 822 |      break;
 | 
|---|
 | 823 | 
 | 
|---|
 | 824 |    case 10225 :
 | 
|---|
 | 825 |      SetBusy();
 | 
|---|
 | 826 |      if (data) {
 | 
|---|
 | 827 |        if (mPpfout) {  
 | 
|---|
 | 828 |          printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
 | 
|---|
 | 829 |          delete mPpfout;  
 | 
|---|
 | 830 |        }
 | 
|---|
 | 831 |        name_outppf = pfc->GetFileName();
 | 
|---|
 | 832 |        mPpfout = NULL;
 | 
|---|
 | 833 |        printf("PIStdImg/Info: Opening POutPersist-File %s \n", name_outppf.c_str());
 | 
|---|
 | 834 |        mPpfout = new POutPersist(name_outppf);
 | 
|---|
 | 835 |     }
 | 
|---|
 | 836 |     mFCMsg = 0;
 | 
|---|
 | 837 |     SetReady();
 | 
|---|
 | 838 |     break;
 | 
|---|
 | 839 | 
 | 
|---|
 | 840 |   case 10230 :
 | 
|---|
 | 841 |     if (!mPpfout)  break;
 | 
|---|
 | 842 |     printf("PIStdImg/Info: Closing POutPersist-File %s \n", name_outppf.c_str());
 | 
|---|
 | 843 |     delete mPpfout;  
 | 
|---|
 | 844 |     name_outppf = "";
 | 
|---|
 | 845 |     mPpfout = NULL;
 | 
|---|
 | 846 |     break;
 | 
|---|
 | 847 | 
 | 
|---|
 | 848 | 
 | 
|---|
 | 849 |   default:
 | 
|---|
 | 850 |     cerr << "PIStdImgApp::MBProcess2() BUG?? Msg= " <<  msg << endl;    
 | 
|---|
 | 851 |     break;
 | 
|---|
 | 852 | }
 | 
|---|
 | 853 | 
 | 
|---|
 | 854 | return;
 | 
|---|
 | 855 | }
 | 
|---|
 | 856 | 
 | 
|---|
 | 857 | /* --Methode-- */
 | 
|---|
 | 858 | void PIStdImgApp::MBProcess3(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
 | 
|---|
 | 859 | {
 | 
|---|
 | 860 | 
 | 
|---|
 | 861 | switch (msg)  { 
 | 
|---|
 | 862 |   case 10301 :
 | 
|---|
 | 863 |     PIImgTools::ShowPIImgTools();
 | 
|---|
 | 864 |     break; 
 | 
|---|
 | 865 |   case 10302 :
 | 
|---|
 | 866 |     PIDrwTools::ShowPIDrwTools();
 | 
|---|
 | 867 |     break;
 | 
|---|
 | 868 | 
 | 
|---|
 | 869 |   case 10305 :
 | 
|---|
 | 870 |     {
 | 
|---|
 | 871 |     PIImage* curpimg = NULL;
 | 
|---|
 | 872 |     if (!mCurWdg)  return;
 | 
|---|
 | 873 |     if (mCurWdg->kind() != PIImage::ClassId)  return;
 | 
|---|
 | 874 |     curpimg = (PIImage*)mCurWdg;
 | 
|---|
 | 875 |     if (curpimg == NULL)   return;
 | 
|---|
 | 876 |     P2DArrayAdapter* img = curpimg->Image();
 | 
|---|
 | 877 |     if (img == NULL) return;
 | 
|---|
 | 878 |     int dx = curpimg->XSzPave();
 | 
|---|
 | 879 |     int dy = curpimg->YSzPave();  
 | 
|---|
 | 880 |     int x0 = curpimg->XPave()-dx/2;
 | 
|---|
 | 881 |     int y0 = curpimg->YPave()-dy/2;
 | 
|---|
 | 882 |     if (x0 < 0)  x0 = 0;
 | 
|---|
 | 883 |     if (y0 < 0)  y0 = 0;
 | 
|---|
 | 884 |     int x1 = x0+dx;
 | 
|---|
 | 885 |     int y1 = y0+dy;
 | 
|---|
 | 886 |     if (x1 > img->XSize()) x1 = img->XSize();
 | 
|---|
 | 887 |     if (y1 > img->YSize()) y1 = img->YSize();
 | 
|---|
 | 888 |     dx = x1-x0;  dy = y1-y0;
 | 
|---|
 | 889 |     ImageR4* pim = new ImageR4(dx, dy); 
 | 
|---|
 | 890 |     int ii, jj;
 | 
|---|
 | 891 |     for(jj=0; jj<dy; jj++) 
 | 
|---|
 | 892 |       for(ii=0; ii<dx; ii++) (*pim)(ii,jj) = (*img)(ii+x0, jj+y0);
 | 
|---|
 | 893 |     string nom = mCurWdg->Nom() + "_pave";
 | 
|---|
 | 894 |     ObjMgr()->AddObj(pim, nom);
 | 
|---|
 | 895 |     ObjMgr()->DisplayObj(nom, "w");
 | 
|---|
 | 896 |     }
 | 
|---|
 | 897 | 
 | 
|---|
 | 898 |   case 10320 :
 | 
|---|
 | 899 |     if (mStW)  mStW->DispNext();
 | 
|---|
 | 900 |     break;
 | 
|---|
 | 901 | 
 | 
|---|
 | 902 |   case 10321 :
 | 
|---|
 | 903 |   case 10322 :
 | 
|---|
 | 904 |   case 10324 :
 | 
|---|
 | 905 | //  case 10328 :
 | 
|---|
 | 906 |     if (mStW) mStW->StartAutoDisp((msg-10320)*500);
 | 
|---|
 | 907 |     break;
 | 
|---|
 | 908 | 
 | 
|---|
 | 909 |   case 10329 :
 | 
|---|
 | 910 |     if (mStW) mStW->StopAutoDisp();
 | 
|---|
 | 911 |     break;
 | 
|---|
 | 912 | 
 | 
|---|
 | 913 |   case 103330 :
 | 
|---|
 | 914 |     if (mStW) {
 | 
|---|
 | 915 |       PIWdg* cw =  mStW->CurrentWdg();
 | 
|---|
 | 916 |       if (cw) DeleteBaseWidget((PIBaseWdg*)cw);
 | 
|---|
 | 917 |       }
 | 
|---|
 | 918 |     break;
 | 
|---|
 | 919 | 
 | 
|---|
 | 920 |   default:
 | 
|---|
 | 921 |     cerr << "PIStdImgApp::MBProcess3() BUG?? Msg= " <<  msg << endl;    
 | 
|---|
 | 922 |     break;
 | 
|---|
 | 923 |   }
 | 
|---|
 | 924 | return;
 | 
|---|
 | 925 | }
 | 
|---|
 | 926 | 
 | 
|---|
 | 927 | /* --Methode-- */
 | 
|---|
 | 928 | void PIStdImgApp::MBProcess4(PIMessage msg, PIMsgHandler* /*sender*/, void* /*data*/)
 | 
|---|
 | 929 | {
 | 
|---|
 | 930 | 
 | 
|---|
 | 931 | switch (msg)  { 
 | 
|---|
 | 932 | 
 | 
|---|
 | 933 |   case 10400 :
 | 
|---|
 | 934 |     CreateStackWin();
 | 
|---|
 | 935 |     break;
 | 
|---|
 | 936 | 
 | 
|---|
 | 937 |   case 10411 :
 | 
|---|
 | 938 |     CreateGraphWin(1,1);
 | 
|---|
 | 939 |     break;
 | 
|---|
 | 940 |   case 10421 :
 | 
|---|
 | 941 |     CreateGraphWin(1,2);
 | 
|---|
 | 942 |     break;
 | 
|---|
 | 943 |   case 10412 :
 | 
|---|
 | 944 |     CreateGraphWin(2,1);
 | 
|---|
 | 945 |     break;
 | 
|---|
 | 946 |   case 10422 :
 | 
|---|
 | 947 |     CreateGraphWin(2,2);
 | 
|---|
 | 948 |     break;
 | 
|---|
 | 949 |   case 10431 :
 | 
|---|
 | 950 |     CreateGraphWin(1,3);
 | 
|---|
 | 951 |     break;
 | 
|---|
 | 952 |   case 10433 :
 | 
|---|
 | 953 |     CreateGraphWin(3,3);
 | 
|---|
 | 954 |     break;
 | 
|---|
 | 955 | 
 | 
|---|
 | 956 |   default:
 | 
|---|
 | 957 |     cerr << "PIStdImgApp::MBProcess4() BUG?? Msg= " <<  msg << endl;    
 | 
|---|
 | 958 |     break;
 | 
|---|
 | 959 |   }
 | 
|---|
 | 960 | return;
 | 
|---|
 | 961 | }
 | 
|---|
 | 962 | 
 | 
|---|
 | 963 | 
 | 
|---|
 | 964 | /* --Methode-- */
 | 
|---|
 | 965 | void PIStdImgApp::MBProcess5(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
 | 
|---|
 | 966 | {
 | 
|---|
 | 967 | char nomps[64],strg[512];
 | 
|---|
 | 968 | PSFile *mps;
 | 
|---|
 | 969 | int sxt, syt, syo, syo1, sx[4], sy[4];
 | 
|---|
 | 970 | 
 | 
|---|
 | 971 | switch (msg)
 | 
|---|
 | 972 |   { 
 | 
|---|
 | 973 |   case 10501 :
 | 
|---|
 | 974 |      pfc->SetPath(WorkDir);
 | 
|---|
 | 975 |      pfc->AcceptNewFile(true); 
 | 
|---|
 | 976 |      mFCMsg = 10525; 
 | 
|---|
 | 977 |      pfc->SetMsg(mFCMsg);
 | 
|---|
 | 978 |      SetBlocked();
 | 
|---|
 | 979 |      pfc->Show();
 | 
|---|
 | 980 |      break;
 | 
|---|
 | 981 | 
 | 
|---|
 | 982 |    case 10525 :
 | 
|---|
 | 983 |      SetBusy();
 | 
|---|
 | 984 |      if (data) {
 | 
|---|
 | 985 |        if (mpsfile) {  
 | 
|---|
 | 986 |          printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
 | 
|---|
 | 987 |          delete mpsfile;  
 | 
|---|
 | 988 |          }
 | 
|---|
 | 989 |         name_ps = pfc->GetFileName();
 | 
|---|
 | 990 |         printf("PIStdImg/Info: Opening PS-File %s \n", name_ps.c_str());
 | 
|---|
 | 991 |         mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 2., 2.);
 | 
|---|
 | 992 |         }
 | 
|---|
 | 993 |       mFCMsg = 0;
 | 
|---|
 | 994 |       SetReady();
 | 
|---|
 | 995 |       break;
 | 
|---|
 | 996 | 
 | 
|---|
 | 997 |   case 10505 :
 | 
|---|
 | 998 |     if (!mpsfile)  break;
 | 
|---|
 | 999 |     printf("PIStdImg/Info: Closing PS-File %s \n", name_ps.c_str());
 | 
|---|
 | 1000 |     delete mpsfile;
 | 
|---|
 | 1001 |     mpsfile = NULL;
 | 
|---|
 | 1002 |     name_ps = "";
 | 
|---|
 | 1003 |     break;
 | 
|---|
 | 1004 | 
 | 
|---|
 | 1005 |   case 10511 :     // Window -> PS
 | 
|---|
 | 1006 |   case 10512 :     // Window -> EPS 
 | 
|---|
 | 1007 |     if (CurrentWindow() == NULL)  break;
 | 
|---|
 | 1008 |     if (msg == 10512) 
 | 
|---|
 | 1009 |       { 
 | 
|---|
 | 1010 |       num_eps++;
 | 
|---|
 | 1011 |       sprintf(nomps,"pia%d.eps", num_eps);
 | 
|---|
 | 1012 |       printf("PIStdImg/Info: Creating EPSFile %s (CurWin-> EPS) \n", nomps);
 | 
|---|
 | 1013 |       mps = new PSFile(nomps);
 | 
|---|
 | 1014 |       }
 | 
|---|
 | 1015 |     else {
 | 
|---|
 | 1016 |       if (mpsfile == NULL) {
 | 
|---|
 | 1017 |         name_ps = "pia.ps";
 | 
|---|
 | 1018 |         mpsfile = new PSFile(name_ps.c_str(), PI_Portrait, PI_A4, 0., 0.);
 | 
|---|
 | 1019 |         printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
 | 
|---|
 | 1020 |       }
 | 
|---|
 | 1021 |       printf("PIStdImg/Info: CurWin-> PSFile %s\n", name_ps.c_str());      
 | 
|---|
 | 1022 |       mps = mpsfile; 
 | 
|---|
 | 1023 |       }
 | 
|---|
 | 1024 |     CurrentWindow()->PSPrint(mps,0,0);
 | 
|---|
 | 1025 | 
 | 
|---|
 | 1026 |     if (msg == 10512)   delete mps;   // fichier eps
 | 
|---|
 | 1027 |     break;
 | 
|---|
 | 1028 | 
 | 
|---|
 | 1029 |   case 10515 :    // Image -> PS
 | 
|---|
 | 1030 |   case 10516 :    // Image -> EPS 
 | 
|---|
 | 1031 |      {
 | 
|---|
 | 1032 |      PIImage* curpimg = NULL;
 | 
|---|
 | 1033 |      if (!mCurWdg)  return;
 | 
|---|
 | 1034 |      if (mCurWdg->kind() != PIImage::ClassId)  return;
 | 
|---|
 | 1035 |      curpimg = (PIImage*)mCurWdg;
 | 
|---|
 | 1036 |      if (curpimg == NULL)   return;
 | 
|---|
 | 1037 |      if (msg == 10516) 
 | 
|---|
 | 1038 |       { 
 | 
|---|
 | 1039 |       num_eps++;
 | 
|---|
 | 1040 |       sprintf(nomps,"pia%d.eps", num_eps);
 | 
|---|
 | 1041 |       printf("PIStdImg/Info: Creating EPSFile %s (CurImage-> EPS)\n", nomps);
 | 
|---|
 | 1042 |       mps = new PSFile(nomps);
 | 
|---|
 | 1043 |       }
 | 
|---|
 | 1044 |     else {
 | 
|---|
 | 1045 |       if (mpsfile == NULL) {
 | 
|---|
 | 1046 |         name_ps = "pia.ps";
 | 
|---|
 | 1047 |         mpsfile = new PSFile(name_ps.c_str(),PI_Portrait, PI_A4, 2., 2.);
 | 
|---|
 | 1048 |         printf("PIStdImg/Info: File PS %s opened \n", name_ps.c_str());
 | 
|---|
 | 1049 |       }
 | 
|---|
 | 1050 |       printf("PIStdImg/Info: CurImage-> PSFile %s\n", name_ps.c_str());       
 | 
|---|
 | 1051 |       mps = mpsfile; 
 | 
|---|
 | 1052 |       }
 | 
|---|
 | 1053 | 
 | 
|---|
 | 1054 |     sx[0] = gimv->XSize(); 
 | 
|---|
 | 1055 |     sy[0] = gimv->YSize();
 | 
|---|
 | 1056 |     sx[1] = zoom->XSize(); 
 | 
|---|
 | 1057 |     sy[1] = zoom->YSize();
 | 
|---|
 | 1058 |     sx[2] = cmapv->XSize(); 
 | 
|---|
 | 1059 |     sy[2] = cmapv->YSize();
 | 
|---|
 | 1060 |     sx[3] = curpimg->XSize(); 
 | 
|---|
 | 1061 |     sy[3] = curpimg->YSize();
 | 
|---|
 | 1062 |     if (sy[1] > sy[0])  { syo1 = sy[1]+50;  syo = sy[1]+sy[2]+60; }
 | 
|---|
 | 1063 |     else  { syo1 = sy[0]+50;  syo = sy[0]+sy[2]+60; }
 | 
|---|
 | 1064 |     syt = sy[3]+syo;
 | 
|---|
 | 1065 |     sxt = sx[3];
 | 
|---|
 | 1066 |     if (sxt < (sx[0]+sx[1]+20))  sxt = sx[0]+sx[1]+20;
 | 
|---|
 | 1067 |     if (sxt < sx[2])  sxt = sx[2];
 | 
|---|
 | 1068 | 
 | 
|---|
 | 1069 |     // Pour ecrire le titre 
 | 
|---|
 | 1070 |     mps->NewPage((float)sxt, (float)syt, PI_Portrait);
 | 
|---|
 | 1071 |     mps->NewBloc(0,0, (float)sxt, 30., (float)sxt, 30.);
 | 
|---|
 | 1072 |     sprintf(strg,"Image: %s -  Pave %d %d \n",  curpimg->Nom().c_str(), 
 | 
|---|
 | 1073 |             curpimg->XPave(),  curpimg->YPave());     
 | 
|---|
 | 1074 |     mps->DrawString(10., 25., strg, PI_Black, PI_BoldFont, 20);
 | 
|---|
 | 1075 |     mps->EndBloc();
 | 
|---|
 | 1076 | 
 | 
|---|
 | 1077 |     // Les quatre fenetres glovimage, zoom, cmap, image 
 | 
|---|
 | 1078 |     gimv->PSPrint(mps, -gimv->XPos(), -gimv->YPos()+40);
 | 
|---|
 | 1079 |     zoom->PSPrint(mps, -zoom->XPos()+sx[0]+20, -zoom->YPos()+40);
 | 
|---|
 | 1080 |     cmapv->PSPrint(mps, -cmapv->XPos(), -cmapv->YPos()+syo1);
 | 
|---|
 | 1081 |     curpimg->PSPrint(mps, -curpimg->XPos(), -curpimg->YPos()+syo);
 | 
|---|
 | 1082 |      
 | 
|---|
 | 1083 |     if (msg == 10516)   delete mps;    // fichier eps
 | 
|---|
 | 1084 |     break;
 | 
|---|
 | 1085 |     }
 | 
|---|
 | 1086 | 
 | 
|---|
 | 1087 |   default:
 | 
|---|
 | 1088 |     cerr << "PIStdImgApp::MBProcess5() BUG?? Msg= " <<  msg << endl;    
 | 
|---|
 | 1089 |     break;
 | 
|---|
 | 1090 |   }
 | 
|---|
 | 1091 | 
 | 
|---|
 | 1092 | }
 | 
|---|
 | 1093 | 
 | 
|---|
 | 1094 | 
 | 
|---|
 | 1095 | /* --Methode-- */
 | 
|---|
 | 1096 | void PIStdImgApp::MBProcess6(PIMessage msg, PIMsgHandler* /*sender*/, void* data)
 | 
|---|
 | 1097 | {
 | 
|---|
 | 1098 | switch (msg)  { 
 | 
|---|
 | 1099 |   case 10601:
 | 
|---|
 | 1100 |     CloseAllWindows();
 | 
|---|
 | 1101 |     break;
 | 
|---|
 | 1102 |   case 10602:
 | 
|---|
 | 1103 |     RedirectStdOutErr(*((bool*)data));
 | 
|---|
 | 1104 |     break;
 | 
|---|
 | 1105 |   case 10603:
 | 
|---|
 | 1106 |     CatchSignals(*((bool*)data));
 | 
|---|
 | 1107 |     break;
 | 
|---|
 | 1108 |   default:
 | 
|---|
 | 1109 |     cerr << "PIStdImgApp::MBProcess6() BUG?? Msg= " <<  msg << endl;    
 | 
|---|
 | 1110 |     break;
 | 
|---|
 | 1111 |   }
 | 
|---|
 | 1112 | return;
 | 
|---|
 | 1113 | }
 | 
|---|
 | 1114 | 
 | 
|---|
 | 1115 | 
 | 
|---|
 | 1116 | /* --Methode-- */
 | 
|---|
 | 1117 | void PIStdImgApp::SetColAtt(PIColors fg, PIColors bg)
 | 
|---|
 | 1118 | {
 | 
|---|
 | 1119 |   mFCol = fg;
 | 
|---|
 | 1120 |   mBCol = bg;
 | 
|---|
 | 1121 | }
 | 
|---|
 | 1122 | /* --Methode-- */
 | 
|---|
 | 1123 | void PIStdImgApp::SetLineAtt(PILineAtt lat)
 | 
|---|
 | 1124 | {
 | 
|---|
 | 1125 |   mLAtt = lat;
 | 
|---|
 | 1126 | }
 | 
|---|
 | 1127 | /* --Methode-- */
 | 
|---|
 | 1128 | void PIStdImgApp::SetFontAtt(PIFontSize fsz, PIFontAtt fat)
 | 
|---|
 | 1129 | {
 | 
|---|
 | 1130 |   mFSz = fsz;
 | 
|---|
 | 1131 |   mFAtt = fat;
 | 
|---|
 | 1132 | }
 | 
|---|
 | 1133 | /* --Methode-- */
 | 
|---|
 | 1134 | void PIStdImgApp::SetMarkerAtt(int sz, PIMarker mrk)
 | 
|---|
 | 1135 | {
 | 
|---|
 | 1136 |   mMSz = sz;
 | 
|---|
 | 1137 |   mMrk = mrk;
 | 
|---|
 | 1138 | }
 | 
|---|
 | 1139 | /* --Methode-- */
 | 
|---|
 | 1140 | void PIStdImgApp::SetColMapId(CMapId cid)
 | 
|---|
 | 1141 | {
 | 
|---|
 | 1142 |   mCmapid = cid;
 | 
|---|
 | 1143 | }
 | 
|---|
 | 1144 | /* --Methode-- */
 | 
|---|
 | 1145 | void PIStdImgApp::SetZoomAtt(int zoom)
 | 
|---|
 | 1146 | {
 | 
|---|
 | 1147 |   if ( (zoom > 10) || (zoom < -10) ) zoom = 0;
 | 
|---|
 | 1148 |   mZoom = zoom;
 | 
|---|
 | 1149 | }
 | 
|---|
 | 1150 | /* --Methode-- */
 | 
|---|
 | 1151 | void PIStdImgApp::SetAxesAtt(unsigned int axfl)
 | 
|---|
 | 1152 | {
 | 
|---|
 | 1153 |   mAxesFlags = axfl; 
 | 
|---|
 | 1154 | }
 | 
|---|
 | 1155 | 
 | 
|---|
 | 1156 | /* --Methode-- */
 | 
|---|
 | 1157 | void PIStdImgApp::SaveGraphicAtt()
 | 
|---|
 | 1158 | {
 | 
|---|
 | 1159 |   mSFCol = mFCol;
 | 
|---|
 | 1160 |   mSBCol = mBCol;
 | 
|---|
 | 1161 |   mSLAtt = mLAtt;
 | 
|---|
 | 1162 |   mSFSz = mFSz;
 | 
|---|
 | 1163 |   mSFAtt = mFAtt;
 | 
|---|
 | 1164 |   mSMSz = mMSz;
 | 
|---|
 | 1165 |   mSMrk = mMrk;
 | 
|---|
 | 1166 |   mSCmapid = mCmapid;
 | 
|---|
 | 1167 |   mSZoom = mZoom;
 | 
|---|
 | 1168 |   mSAxesFlags = mAxesFlags;
 | 
|---|
 | 1169 | }
 | 
|---|
 | 1170 | 
 | 
|---|
 | 1171 | /* --Methode-- */
 | 
|---|
 | 1172 | void PIStdImgApp::RestoreGraphicAtt()
 | 
|---|
 | 1173 | {
 | 
|---|
 | 1174 |   mFCol = mSFCol;
 | 
|---|
 | 1175 |   mBCol = mSBCol;
 | 
|---|
 | 1176 |   mLAtt = mSLAtt;
 | 
|---|
 | 1177 |   mFSz = mSFSz;
 | 
|---|
 | 1178 |   mFAtt = mSFAtt;
 | 
|---|
 | 1179 |   mMSz = mSMSz;
 | 
|---|
 | 1180 |   mMrk = mSMrk;
 | 
|---|
 | 1181 |   mCmapid = mSCmapid;
 | 
|---|
 | 1182 |   mZoom = mSZoom;
 | 
|---|
 | 1183 |   mAxesFlags = mSAxesFlags;
 | 
|---|
 | 1184 | }
 | 
|---|