[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 |
|
---|
[1971] | 33 | enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset};
|
---|
[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 |
|
---|
[1971] | 49 | int DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt, int oid=0);
|
---|
| 50 | int DispScDrawer(PIDrawer* scd, string const & name, string const & opt,
|
---|
| 51 | string title="", int oid=0);
|
---|
| 52 | int Disp3DDrawer(PIDrawer3D* scd, string const & name, string const & opt,
|
---|
| 53 | string title="", int oid=0);
|
---|
[165] | 54 |
|
---|
[1642] | 55 | // Fonction d'ajout de texte (provisoire - Aout 99)
|
---|
[1971] | 56 | void AddText(string const & txt, double xp, double yp, string const& opt);
|
---|
[1642] | 57 | // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
|
---|
[1971] | 58 | void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt);
|
---|
| 59 | void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
|
---|
| 60 | bool fgfill=false);
|
---|
| 61 | void AddCircle(double xc, double yc, double r, string const& opt,
|
---|
| 62 | bool fgfill=false);
|
---|
[1642] | 63 |
|
---|
[1131] | 64 | // Fonction Ajout de titre de trace
|
---|
| 65 | void SetTitle(string const & titleup, string const & titledown);
|
---|
[349] | 66 |
|
---|
[1642] | 67 | // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
|
---|
| 68 | PIElDrawer* CurrentElDrawer();
|
---|
[349] | 69 |
|
---|
[165] | 70 | void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
|
---|
| 71 | void CreateStackWin(int sx=0, int sy = 0);
|
---|
[1971] | 72 | PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
|
---|
[165] | 73 | void SetZone(int nzx=1, int nzy=1);
|
---|
| 74 | void StackWinNext();
|
---|
| 75 |
|
---|
| 76 | void DeleteWindow(PIWindow* w);
|
---|
| 77 | void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
|
---|
| 78 | void DelWRsId(int k);
|
---|
[368] | 79 | bool CheckWRsId(int k);
|
---|
[165] | 80 | void CloseAllWindows();
|
---|
| 81 |
|
---|
| 82 | inline NamedObjMgr* ObjMgr() { return mObjMgr; }
|
---|
| 83 | inline PIACmd* CmdInterpreter() { return mCmd; }
|
---|
| 84 |
|
---|
| 85 | PIWindow* CurrentWindow() { return (mCurWin); };
|
---|
| 86 | PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
|
---|
| 87 |
|
---|
| 88 | inline PIPixmap* ZoomW() { return zoom; }
|
---|
| 89 | inline PIPixmap* GloVW() { return gimv; }
|
---|
| 90 | inline PICMapView* CMapVW() { return cmapv; }
|
---|
| 91 | inline PIConsole* GetConsole() { return mCons; }
|
---|
| 92 |
|
---|
[293] | 93 | inline PIMenu* SpecialMenu() { return m[5]; }
|
---|
| 94 | inline PIMenu* ModulesMenu() { return m[6]; }
|
---|
[165] | 95 |
|
---|
| 96 | inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
|
---|
| 97 | inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
|
---|
| 98 |
|
---|
[1971] | 99 | // Gestion (show/hide) de la fenetre Stat/ZoomWindow
|
---|
| 100 | void StatZoomWindowSetVisible(bool fg=true);
|
---|
| 101 |
|
---|
[165] | 102 | // Redirection ou Non de StdOut/StdErr
|
---|
| 103 | void RedirectStdOutErr(bool fg = true);
|
---|
[293] | 104 | inline bool HasRedirectedStdOutErr() { return(redirecout); }
|
---|
[165] | 105 | // Gestion des signaux
|
---|
[374] | 106 | void CatchSignals(bool fgfpe=true, bool fgsegv=true);
|
---|
[165] | 107 |
|
---|
[548] | 108 | void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
|
---|
[1131] | 109 | inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
|
---|
[1971] | 110 | void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; }
|
---|
| 111 | // void SaveGraphicAtt();
|
---|
| 112 | // void RestoreGraphicAtt();
|
---|
| 113 | void SetDefaultGraphicAttributes(string const & opt);
|
---|
| 114 | void SetDefaultAxesAttributes(string const & opt);
|
---|
| 115 | DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
|
---|
[506] | 116 |
|
---|
[165] | 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 |
|
---|
[1971] | 134 |
|
---|
[165] | 135 |
|
---|
| 136 | NamedObjMgr* mObjMgr;
|
---|
| 137 | PIACmd* mCmd;
|
---|
| 138 |
|
---|
[293] | 139 | PIMenu* m[7];
|
---|
[165] | 140 | PIMenu* mc;
|
---|
| 141 |
|
---|
[1971] | 142 | PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ...
|
---|
[165] | 143 | PIPixmap* zoom;
|
---|
| 144 | PIPixmap* gimv;
|
---|
| 145 | PICMapView* cmapv;
|
---|
[1971] | 146 | PILabel* labstat;
|
---|
[165] | 147 |
|
---|
[685] | 148 | PIFileChooser * pfc_fits; // Pour les fichiers FITS
|
---|
| 149 | PIFileChooser * pfc_ppf; // Pour les PPF
|
---|
| 150 | PIFileChooser * pfc_ps; // Pour les PostScript
|
---|
[165] | 151 |
|
---|
[1971] | 152 | PIContainer* consolecont; // Container pour la PIConsole
|
---|
[165] | 153 | PIConsole* mCons;
|
---|
[293] | 154 | bool redirecout; // true if stdout/err redirected to mCons;
|
---|
[165] | 155 |
|
---|
| 156 | WindMList mWList;
|
---|
| 157 | BWMList mBWList;
|
---|
| 158 | DrwMList mDrwList;
|
---|
| 159 |
|
---|
| 160 | int mWId,mDId,mBWId;
|
---|
| 161 |
|
---|
| 162 | PIBaseWdg* mCurWdg;
|
---|
| 163 | PIBaseWdg* mLastWdg;
|
---|
| 164 | PIWindow* mCurWin;
|
---|
| 165 | PIZoneWindow* mGrW;
|
---|
| 166 | PIStackWindow* mStW;
|
---|
| 167 | int mGrIdx;
|
---|
| 168 | int mStIdx;
|
---|
| 169 |
|
---|
| 170 | ObjMgrWind* mObjmgrw;
|
---|
| 171 | PPInMgrWind* mPpinmgrw;
|
---|
| 172 |
|
---|
[1971] | 173 | // Attributs graphiques, etc ...
|
---|
[548] | 174 | double mIXmin, mIXmax, mIYmin, mIYmax;
|
---|
[1971] | 175 | bool mAddTitle;
|
---|
| 176 | unsigned int mAxesFlags;
|
---|
[165] | 177 |
|
---|
[1971] | 178 | vector<string> mDefaultAtt;
|
---|
| 179 | vector<string> mAxesAtt;
|
---|
| 180 |
|
---|
| 181 | // Controles et gestion divers
|
---|
[165] | 182 | PIMessage mFCMsg; // Message for processing FileOpen
|
---|
[1971] | 183 | int mFgScSz; // Flag ScreenSize
|
---|
[165] | 184 | bool mFgCWImg; // true -> Current Widget is PIImage
|
---|
| 185 | };
|
---|
| 186 |
|
---|
| 187 | #endif
|
---|