| [165] | 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> | 
|---|
| [351] | 11 | #include <functional> | 
|---|
| [165] | 12 |  | 
|---|
|  | 13 | #include "pisysdep.h" | 
|---|
|  | 14 |  | 
|---|
|  | 15 | #include PIAPP_H | 
|---|
|  | 16 | #include PIWIN_H | 
|---|
|  | 17 | #include PIMENU_H | 
|---|
|  | 18 | #include PIOPTMENU_H | 
|---|
|  | 19 |  | 
|---|
|  | 20 | #include PISTDWDG_H | 
|---|
|  | 21 |  | 
|---|
|  | 22 | #include PIFILECHO_H | 
|---|
|  | 23 | #include "picons.h" | 
|---|
|  | 24 |  | 
|---|
|  | 25 | #include "piimage.h" | 
|---|
|  | 26 | #include "pi3ddrw.h" | 
|---|
|  | 27 | #include "nobjmgr.h" | 
|---|
|  | 28 | #include "piacmd.h" | 
|---|
|  | 29 | #include "pisiadw.h" | 
|---|
|  | 30 | #include "pistzwin.h" | 
|---|
|  | 31 |  | 
|---|
|  | 32 |  | 
|---|
| [548] | 33 | enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3, Disp_Inset=4}; | 
|---|
| [165] | 34 |  | 
|---|
|  | 35 | typedef map<long, PIWindow*, less<long> > WindMList; | 
|---|
|  | 36 | typedef map<long, PIBaseWdg*, less<long> > BWMList; | 
|---|
|  | 37 | typedef map<long, PIDrawer*, less<long> > DrwMList; | 
|---|
|  | 38 |  | 
|---|
|  | 39 | class PIStdImgApp : public PIApplication  { | 
|---|
|  | 40 | public: | 
|---|
|  | 41 | PIStdImgApp(int narg=0, char* arg[]=NULL); | 
|---|
|  | 42 | ~PIStdImgApp(); | 
|---|
|  | 43 |  | 
|---|
|  | 44 | virtual void   Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
| [194] | 45 | virtual void   SetReady(); | 
|---|
|  | 46 | virtual void   SetBusy(); | 
|---|
|  | 47 | virtual void   SetBlocked(); | 
|---|
| [165] | 48 |  | 
|---|
| [331] | 49 | int  DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid=0); | 
|---|
|  | 50 | int  DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", int oid=0); | 
|---|
|  | 51 | int  Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0); | 
|---|
| [165] | 52 |  | 
|---|
| [349] | 53 | //  Fonction d'ajout de texte (provisoire - Aout 99) | 
|---|
|  | 54 | void AddText(string const & txt, double xp, double yp); | 
|---|
| [1131] | 55 | //  Fonction Ajout de titre de trace | 
|---|
|  | 56 | void SetTitle(string const & titleup, string const & titledown); | 
|---|
| [349] | 57 |  | 
|---|
|  | 58 |  | 
|---|
| [165] | 59 | void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0); | 
|---|
|  | 60 | void CreateStackWin(int sx=0, int sy = 0); | 
|---|
|  | 61 | PIWindow * GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom); | 
|---|
|  | 62 | void SetZone(int nzx=1, int nzy=1); | 
|---|
|  | 63 | void StackWinNext(); | 
|---|
|  | 64 |  | 
|---|
|  | 65 | void DeleteWindow(PIWindow* w); | 
|---|
|  | 66 | void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true); | 
|---|
|  | 67 | void DelWRsId(int k); | 
|---|
| [368] | 68 | bool CheckWRsId(int k); | 
|---|
| [165] | 69 | void CloseAllWindows(); | 
|---|
|  | 70 |  | 
|---|
|  | 71 | inline NamedObjMgr* ObjMgr() { return mObjMgr; } | 
|---|
|  | 72 | inline PIACmd* CmdInterpreter() { return mCmd; } | 
|---|
|  | 73 |  | 
|---|
|  | 74 | PIWindow* CurrentWindow() { return (mCurWin); }; | 
|---|
|  | 75 | PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); }; | 
|---|
|  | 76 |  | 
|---|
|  | 77 | inline PIPixmap* ZoomW() { return zoom; } | 
|---|
|  | 78 | inline PIPixmap* GloVW() { return gimv; } | 
|---|
|  | 79 | inline PICMapView* CMapVW() { return cmapv; } | 
|---|
|  | 80 | inline PIConsole* GetConsole() { return mCons; } | 
|---|
|  | 81 |  | 
|---|
| [293] | 82 | inline PIMenu* SpecialMenu() { return m[5]; } | 
|---|
|  | 83 | inline PIMenu* ModulesMenu() { return m[6]; } | 
|---|
| [165] | 84 |  | 
|---|
|  | 85 | inline ObjMgrWind* ObjMgrW() { return mObjmgrw; } | 
|---|
|  | 86 | inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; } | 
|---|
|  | 87 |  | 
|---|
|  | 88 | // Redirection ou Non de StdOut/StdErr | 
|---|
|  | 89 | void  RedirectStdOutErr(bool fg = true); | 
|---|
| [293] | 90 | inline bool HasRedirectedStdOutErr() { return(redirecout); } | 
|---|
| [165] | 91 | // Gestion des signaux | 
|---|
| [374] | 92 | void  CatchSignals(bool fgfpe=true, bool fgsegv=true); | 
|---|
| [165] | 93 |  | 
|---|
|  | 94 | //  Gestion d attributs graphiques courants | 
|---|
|  | 95 | void  SetColAtt(PIColors fg=PI_NotDefColor, | 
|---|
|  | 96 | PIColors bg=PI_NotDefColor); | 
|---|
|  | 97 | void  SetLineAtt(PILineAtt lat=PI_NotDefLineAtt); | 
|---|
|  | 98 | void  SetFontAtt(PIFontSize fsz=PI_NotDefFontSize, | 
|---|
|  | 99 | PIFontAtt fat=PI_NotDefFontAtt); | 
|---|
|  | 100 | void  SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker); | 
|---|
|  | 101 | void  SetColMapId(CMapId cid=CMAP_OTHER); | 
|---|
|  | 102 | void  SetZoomAtt(int zoom=0); | 
|---|
| [203] | 103 | void  SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels); | 
|---|
| [331] | 104 | void  SetXYLimits(double xmin=-1., double xmax=1., double ymin=-1., double ymax=1.); | 
|---|
| [548] | 105 | void  SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6); | 
|---|
| [558] | 106 | void  SetImageCenterPosition(int x=-1, int y=-1); | 
|---|
| [331] | 107 | inline void  UseXYLimits(bool fg=false) {  mFXYlim=fg; } | 
|---|
| [558] | 108 | inline void  UseImageCenter(bool fg=false) { mFImgCenter=fg; } | 
|---|
| [506] | 109 | inline void  SetXLogScale(bool logx=false) { maXlog = logx; } | 
|---|
|  | 110 | inline void  SetYLogScale(bool logy=false) { maYlog = logy; } | 
|---|
| [1131] | 111 | inline void  SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; } | 
|---|
| [506] | 112 |  | 
|---|
| [165] | 113 | // Pour sauvegarder-restauration de  l'etat des attributs graphiques | 
|---|
|  | 114 | void  SaveGraphicAtt(); | 
|---|
|  | 115 | void  RestoreGraphicAtt(); | 
|---|
|  | 116 |  | 
|---|
|  | 117 | // Gestion fichiers PS | 
|---|
|  | 118 | int num_eps; | 
|---|
|  | 119 | PSFile *mpsfile; | 
|---|
|  | 120 | string name_ps; | 
|---|
|  | 121 |  | 
|---|
|  | 122 | // Gestion OUT-PPF | 
|---|
|  | 123 | POutPersist* mPpfout; | 
|---|
|  | 124 | string name_outppf; | 
|---|
|  | 125 |  | 
|---|
|  | 126 | private: | 
|---|
|  | 127 | void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 128 | void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 129 | void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 130 | void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 131 | void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 132 | void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL); | 
|---|
|  | 133 |  | 
|---|
|  | 134 |  | 
|---|
|  | 135 | NamedObjMgr* mObjMgr; | 
|---|
|  | 136 | PIACmd* mCmd; | 
|---|
|  | 137 |  | 
|---|
| [293] | 138 | PIMenu* m[7]; | 
|---|
| [165] | 139 | PIMenu* mc; | 
|---|
|  | 140 |  | 
|---|
|  | 141 | PIPixmap* zoom; | 
|---|
|  | 142 | PIPixmap* gimv; | 
|---|
|  | 143 | PICMapView* cmapv; | 
|---|
|  | 144 |  | 
|---|
| [685] | 145 | PIFileChooser * pfc_fits;   // Pour les fichiers FITS | 
|---|
|  | 146 | PIFileChooser * pfc_ppf;    //  Pour les PPF | 
|---|
|  | 147 | PIFileChooser * pfc_ps;     // Pour les PostScript | 
|---|
| [165] | 148 |  | 
|---|
|  | 149 | PIConsole* mCons; | 
|---|
| [293] | 150 | bool redirecout;    // true if stdout/err redirected to mCons; | 
|---|
| [165] | 151 |  | 
|---|
|  | 152 | WindMList mWList; | 
|---|
|  | 153 | BWMList mBWList; | 
|---|
|  | 154 | DrwMList mDrwList; | 
|---|
|  | 155 |  | 
|---|
|  | 156 | int mWId,mDId,mBWId; | 
|---|
|  | 157 |  | 
|---|
|  | 158 | PIBaseWdg* mCurWdg; | 
|---|
|  | 159 | PIBaseWdg* mLastWdg; | 
|---|
|  | 160 | PIWindow* mCurWin; | 
|---|
|  | 161 | PIZoneWindow* mGrW; | 
|---|
|  | 162 | PIStackWindow* mStW; | 
|---|
|  | 163 | int mGrIdx; | 
|---|
|  | 164 | int mStIdx; | 
|---|
|  | 165 |  | 
|---|
|  | 166 | ObjMgrWind* mObjmgrw; | 
|---|
|  | 167 | PPInMgrWind* mPpinmgrw; | 
|---|
|  | 168 |  | 
|---|
|  | 169 | //  Gestion d attributs graphiques courants, etat sauvegarde | 
|---|
|  | 170 | PIColors     mFCol, mBCol, mSFCol, mSBCol; | 
|---|
|  | 171 | PILineAtt    mLAtt, mSLAtt; | 
|---|
|  | 172 | PIFontSize   mFSz, mSFSz; | 
|---|
|  | 173 | PIFontAtt    mFAtt, mSFAtt; | 
|---|
|  | 174 | int          mMSz, mSMSz; | 
|---|
|  | 175 | PIMarker     mMrk,mSMrk; | 
|---|
|  | 176 | CMapId       mCmapid, mSCmapid; | 
|---|
|  | 177 | int          mZoom, mSZoom; | 
|---|
| [203] | 178 | unsigned int mAxesFlags, mSAxesFlags; | 
|---|
| [331] | 179 | double       mXmin, mXmax, mYmin, mYmax; | 
|---|
|  | 180 | double       mSXmin, mSXmax, mSYmin, mSYmax; | 
|---|
| [548] | 181 | double       mIXmin, mIXmax, mIYmin, mIYmax; | 
|---|
|  | 182 | double       mSIXmin, mSIXmax, mSIYmin, mSIYmax; | 
|---|
| [558] | 183 | int          mXImgCenter, mYImgCenter; | 
|---|
|  | 184 | int          mSXImgCenter, mSYImgCenter; | 
|---|
| [331] | 185 | bool         mFXYlim, mSFXYlim; | 
|---|
| [558] | 186 | bool         mFImgCenter, mSFImgCenter; | 
|---|
| [506] | 187 | bool         maXlog, mSaXlog; | 
|---|
|  | 188 | bool         maYlog, mSaYlog; | 
|---|
| [1131] | 189 | bool         mAddTitle, mSAddTitle; | 
|---|
| [165] | 190 |  | 
|---|
|  | 191 | PIMessage mFCMsg;  // Message for processing FileOpen | 
|---|
|  | 192 | int mFgScSz;   // Dlag ScreenSize | 
|---|
|  | 193 | bool mFgCWImg; // true -> Current Widget is PIImage | 
|---|
|  | 194 | }; | 
|---|
|  | 195 |  | 
|---|
|  | 196 | #endif | 
|---|