| 1 | // This may look like C code, but it is really -*- C++ -*-
 | 
|---|
| 2 | // Standard Image App      R. Ansari  97-98
 | 
|---|
| 3 | // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #ifndef PISTIMGAPP_H_SEEN
 | 
|---|
| 6 | #define PISTIMGAPP_H_SEEN
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include <string.h>
 | 
|---|
| 9 | #include <string>
 | 
|---|
| 10 | #include <map>
 | 
|---|
| 11 | 
 | 
|---|
| 12 | #include "pisysdep.h"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | #include PIAPP_H
 | 
|---|
| 15 | #include PIWIN_H 
 | 
|---|
| 16 | #include PIMENU_H 
 | 
|---|
| 17 | #include PIOPTMENU_H 
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #include PISTDWDG_H 
 | 
|---|
| 20 | 
 | 
|---|
| 21 | #include PIFILECHO_H 
 | 
|---|
| 22 | #include "picons.h"
 | 
|---|
| 23 | 
 | 
|---|
| 24 | #include "piimage.h"
 | 
|---|
| 25 | #include "pi3ddrw.h"
 | 
|---|
| 26 | #include "nobjmgr.h"
 | 
|---|
| 27 | #include "piacmd.h"
 | 
|---|
| 28 | #include "pisiadw.h"
 | 
|---|
| 29 | #include "pistzwin.h"
 | 
|---|
| 30 | 
 | 
|---|
| 31 | 
 | 
|---|
| 32 | enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3};
 | 
|---|
| 33 | 
 | 
|---|
| 34 | typedef map<long, PIWindow*, less<long> > WindMList;
 | 
|---|
| 35 | typedef map<long, PIBaseWdg*, less<long> > BWMList;
 | 
|---|
| 36 | typedef map<long, PIDrawer*, less<long> > DrwMList;
 | 
|---|
| 37 | 
 | 
|---|
| 38 | class PIStdImgApp : public PIApplication  {
 | 
|---|
| 39 | public:
 | 
|---|
| 40 |      PIStdImgApp(int narg=0, char* arg[]=NULL);
 | 
|---|
| 41 |      ~PIStdImgApp();
 | 
|---|
| 42 | 
 | 
|---|
| 43 |      virtual void   Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 44 |      virtual void   SetReady();
 | 
|---|
| 45 |      virtual void   SetBusy(); 
 | 
|---|
| 46 |      virtual void   SetBlocked();
 | 
|---|
| 47 | 
 | 
|---|
| 48 |      int  DispImage(P2DArrayAdapter* nouv, string const & name, int opt);
 | 
|---|
| 49 |      int  DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", bool h2d=false);
 | 
|---|
| 50 |      int  Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="");
 | 
|---|
| 51 | 
 | 
|---|
| 52 |      void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
 | 
|---|
| 53 |      void CreateStackWin(int sx=0, int sy = 0);
 | 
|---|
| 54 |      PIWindow * GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
 | 
|---|
| 55 |      void SetZone(int nzx=1, int nzy=1);
 | 
|---|
| 56 |      void StackWinNext();
 | 
|---|
| 57 | 
 | 
|---|
| 58 |      void DeleteWindow(PIWindow* w);
 | 
|---|
| 59 |      void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
 | 
|---|
| 60 |      void DelWRsId(int k);
 | 
|---|
| 61 |      void CloseAllWindows();
 | 
|---|
| 62 | 
 | 
|---|
| 63 |      inline NamedObjMgr* ObjMgr() { return mObjMgr; }
 | 
|---|
| 64 |      inline PIACmd* CmdInterpreter() { return mCmd; }
 | 
|---|
| 65 | 
 | 
|---|
| 66 |      PIWindow* CurrentWindow() { return (mCurWin); };
 | 
|---|
| 67 |      PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
 | 
|---|
| 68 | 
 | 
|---|
| 69 |      inline PIPixmap* ZoomW() { return zoom; }
 | 
|---|
| 70 |      inline PIPixmap* GloVW() { return gimv; }
 | 
|---|
| 71 |      inline PICMapView* CMapVW() { return cmapv; }
 | 
|---|
| 72 |      inline PIConsole* GetConsole() { return mCons; }
 | 
|---|
| 73 | 
 | 
|---|
| 74 | //     inline CutTools*  CutTC()  { return mCutTC; }   A reactiver plus tard ?  Reza 08/98
 | 
|---|
| 75 | 
 | 
|---|
| 76 |      inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
 | 
|---|
| 77 |      inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
 | 
|---|
| 78 | 
 | 
|---|
| 79 | // Redirection ou Non de StdOut/StdErr
 | 
|---|
| 80 |      void  RedirectStdOutErr(bool fg = true);
 | 
|---|
| 81 | // Gestion des signaux
 | 
|---|
| 82 |      void  CatchSignals(bool fg = true);
 | 
|---|
| 83 | 
 | 
|---|
| 84 | //  Gestion d attributs graphiques courants
 | 
|---|
| 85 |      void  SetColAtt(PIColors fg=PI_NotDefColor, 
 | 
|---|
| 86 |                      PIColors bg=PI_NotDefColor);
 | 
|---|
| 87 |      void  SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
 | 
|---|
| 88 |      void  SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
 | 
|---|
| 89 |                       PIFontAtt fat=PI_NotDefFontAtt);
 | 
|---|
| 90 |      void  SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
 | 
|---|
| 91 |      void  SetColMapId(CMapId cid=CMAP_OTHER);
 | 
|---|
| 92 |      void  SetZoomAtt(int zoom=0);
 | 
|---|
| 93 |      void  SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels);
 | 
|---|
| 94 | // Pour sauvegarder-restauration de  l'etat des attributs graphiques
 | 
|---|
| 95 |      void  SaveGraphicAtt();   
 | 
|---|
| 96 |      void  RestoreGraphicAtt();   
 | 
|---|
| 97 | 
 | 
|---|
| 98 | // Gestion fichiers PS
 | 
|---|
| 99 |     int num_eps;
 | 
|---|
| 100 |     PSFile *mpsfile;
 | 
|---|
| 101 |     string name_ps;
 | 
|---|
| 102 | 
 | 
|---|
| 103 | // Gestion OUT-PPF
 | 
|---|
| 104 |     POutPersist* mPpfout;
 | 
|---|
| 105 |     string name_outppf;    
 | 
|---|
| 106 | 
 | 
|---|
| 107 | private:
 | 
|---|
| 108 |     void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 109 |     void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 110 |     void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 111 |     void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 112 |     void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 113 |     void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
 | 
|---|
| 114 | 
 | 
|---|
| 115 | 
 | 
|---|
| 116 |     NamedObjMgr* mObjMgr;
 | 
|---|
| 117 |     PIACmd* mCmd;
 | 
|---|
| 118 | 
 | 
|---|
| 119 |     PIMenu* m[6];
 | 
|---|
| 120 |     PIMenu* mc;
 | 
|---|
| 121 | 
 | 
|---|
| 122 |     PIPixmap* zoom;
 | 
|---|
| 123 |     PIPixmap* gimv;
 | 
|---|
| 124 |     PICMapView* cmapv;
 | 
|---|
| 125 | 
 | 
|---|
| 126 |     PIFileChooser * pfc;
 | 
|---|
| 127 | 
 | 
|---|
| 128 | //    CutTools* mCutTC;               // mTCId = 3   A reactiver plus tard ?  Reza 08/98
 | 
|---|
| 129 | //    PIContainer* mTC;   A reactiver plus tard ?  Reza 08/98 
 | 
|---|
| 130 | 
 | 
|---|
| 131 |     PIConsole* mCons;
 | 
|---|
| 132 | 
 | 
|---|
| 133 |     WindMList mWList;
 | 
|---|
| 134 |     BWMList mBWList;
 | 
|---|
| 135 |     DrwMList mDrwList;
 | 
|---|
| 136 | 
 | 
|---|
| 137 |     int mWId,mDId,mBWId;
 | 
|---|
| 138 | 
 | 
|---|
| 139 |     PIBaseWdg* mCurWdg;
 | 
|---|
| 140 |     PIBaseWdg* mLastWdg;
 | 
|---|
| 141 |     PIWindow* mCurWin;
 | 
|---|
| 142 |     PIZoneWindow* mGrW;
 | 
|---|
| 143 |     PIStackWindow* mStW;
 | 
|---|
| 144 |     int mGrIdx;
 | 
|---|
| 145 |     int mStIdx;
 | 
|---|
| 146 | 
 | 
|---|
| 147 |     ObjMgrWind* mObjmgrw;
 | 
|---|
| 148 |     PPInMgrWind* mPpinmgrw;
 | 
|---|
| 149 | 
 | 
|---|
| 150 | //  Gestion d attributs graphiques courants, etat sauvegarde
 | 
|---|
| 151 |     PIColors     mFCol, mBCol, mSFCol, mSBCol;
 | 
|---|
| 152 |     PILineAtt    mLAtt, mSLAtt;
 | 
|---|
| 153 |     PIFontSize   mFSz, mSFSz;
 | 
|---|
| 154 |     PIFontAtt    mFAtt, mSFAtt;
 | 
|---|
| 155 |     int          mMSz, mSMSz;
 | 
|---|
| 156 |     PIMarker     mMrk,mSMrk;  
 | 
|---|
| 157 |     CMapId       mCmapid, mSCmapid;
 | 
|---|
| 158 |     int          mZoom, mSZoom;
 | 
|---|
| 159 |     unsigned int mAxesFlags, mSAxesFlags;
 | 
|---|
| 160 | 
 | 
|---|
| 161 |     PIMessage mFCMsg;  // Message for processing FileOpen
 | 
|---|
| 162 |     int mFgScSz;   // Dlag ScreenSize
 | 
|---|
| 163 |     bool mFgCWImg; // true -> Current Widget is PIImage
 | 
|---|
| 164 | };
 | 
|---|
| 165 | 
 | 
|---|
| 166 | #endif
 | 
|---|