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