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