[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
|
---|
[2106] | 23 | #include PIPERIODIC_H
|
---|
| 24 |
|
---|
[165] | 25 | #include "picons.h"
|
---|
| 26 |
|
---|
| 27 | #include "piimage.h"
|
---|
| 28 | #include "pi3ddrw.h"
|
---|
| 29 | #include "nobjmgr.h"
|
---|
| 30 | #include "piacmd.h"
|
---|
| 31 | #include "pisiadw.h"
|
---|
| 32 | #include "pistzwin.h"
|
---|
| 33 |
|
---|
[2106] | 34 | #include "pitherm.h"
|
---|
[165] | 35 |
|
---|
[2106] | 36 | #include "resusage.h"
|
---|
| 37 |
|
---|
| 38 |
|
---|
[1971] | 39 | enum DispWinEnum {Disp_Default, Disp_Next, Disp_Win, Disp_Same, Disp_Stack, Disp_Inset};
|
---|
[165] | 40 |
|
---|
| 41 | typedef map<long, PIWindow*, less<long> > WindMList;
|
---|
| 42 | typedef map<long, PIBaseWdg*, less<long> > BWMList;
|
---|
| 43 | typedef map<long, PIDrawer*, less<long> > DrwMList;
|
---|
| 44 |
|
---|
| 45 | class PIStdImgApp : public PIApplication {
|
---|
| 46 | public:
|
---|
| 47 | PIStdImgApp(int narg=0, char* arg[]=NULL);
|
---|
| 48 | ~PIStdImgApp();
|
---|
| 49 |
|
---|
| 50 | virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
[194] | 51 | virtual void SetReady();
|
---|
| 52 | virtual void SetBusy();
|
---|
| 53 | virtual void SetBlocked();
|
---|
[165] | 54 |
|
---|
[1971] | 55 | int DispImage(P2DArrayAdapter* nouv, string const & name, string const & opt, int oid=0);
|
---|
| 56 | int DispScDrawer(PIDrawer* scd, string const & name, string const & opt,
|
---|
| 57 | string title="", int oid=0);
|
---|
| 58 | int Disp3DDrawer(PIDrawer3D* scd, string const & name, string const & opt,
|
---|
| 59 | string title="", int oid=0);
|
---|
[165] | 60 |
|
---|
[1642] | 61 | // Fonction d'ajout de texte (provisoire - Aout 99)
|
---|
[1971] | 62 | void AddText(string const & txt, double xp, double yp, string const& opt);
|
---|
[1642] | 63 | // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
|
---|
[1971] | 64 | void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt);
|
---|
| 65 | void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
|
---|
| 66 | bool fgfill=false);
|
---|
| 67 | void AddCircle(double xc, double yc, double r, string const& opt,
|
---|
| 68 | bool fgfill=false);
|
---|
[1642] | 69 |
|
---|
[1131] | 70 | // Fonction Ajout de titre de trace
|
---|
| 71 | void SetTitle(string const & titleup, string const & titledown);
|
---|
[349] | 72 |
|
---|
[1642] | 73 | // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
|
---|
| 74 | PIElDrawer* CurrentElDrawer();
|
---|
[349] | 75 |
|
---|
[165] | 76 | void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
|
---|
| 77 | void CreateStackWin(int sx=0, int sy = 0);
|
---|
[1971] | 78 | PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
|
---|
[165] | 79 | void SetZone(int nzx=1, int nzy=1);
|
---|
| 80 | void StackWinNext();
|
---|
| 81 |
|
---|
| 82 | void DeleteWindow(PIWindow* w);
|
---|
| 83 | void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
|
---|
| 84 | void DelWRsId(int k);
|
---|
[368] | 85 | bool CheckWRsId(int k);
|
---|
[165] | 86 | void CloseAllWindows();
|
---|
| 87 |
|
---|
| 88 | inline NamedObjMgr* ObjMgr() { return mObjMgr; }
|
---|
| 89 | inline PIACmd* CmdInterpreter() { return mCmd; }
|
---|
| 90 |
|
---|
| 91 | PIWindow* CurrentWindow() { return (mCurWin); };
|
---|
| 92 | PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
|
---|
| 93 |
|
---|
| 94 | inline PIPixmap* ZoomW() { return zoom; }
|
---|
| 95 | inline PIPixmap* GloVW() { return gimv; }
|
---|
| 96 | inline PICMapView* CMapVW() { return cmapv; }
|
---|
| 97 | inline PIConsole* GetConsole() { return mCons; }
|
---|
| 98 |
|
---|
[293] | 99 | inline PIMenu* SpecialMenu() { return m[5]; }
|
---|
| 100 | inline PIMenu* ModulesMenu() { return m[6]; }
|
---|
[165] | 101 |
|
---|
| 102 | inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
|
---|
| 103 | inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
|
---|
| 104 |
|
---|
[1971] | 105 | // Gestion (show/hide) de la fenetre Stat/ZoomWindow
|
---|
| 106 | void StatZoomWindowSetVisible(bool fg=true);
|
---|
| 107 |
|
---|
[2106] | 108 | // Update de l'info de la fenetre stats/ressources
|
---|
| 109 | void UpdateStatResourceInfo();
|
---|
| 110 |
|
---|
[165] | 111 | // Redirection ou Non de StdOut/StdErr
|
---|
| 112 | void RedirectStdOutErr(bool fg = true);
|
---|
[293] | 113 | inline bool HasRedirectedStdOutErr() { return(redirecout); }
|
---|
[165] | 114 | // Gestion des signaux
|
---|
[374] | 115 | void CatchSignals(bool fgfpe=true, bool fgsegv=true);
|
---|
[165] | 116 |
|
---|
[548] | 117 | void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
|
---|
[1131] | 118 | inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
|
---|
[1971] | 119 | void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; }
|
---|
| 120 | // void SaveGraphicAtt();
|
---|
| 121 | // void RestoreGraphicAtt();
|
---|
| 122 | void SetDefaultGraphicAttributes(string const & opt);
|
---|
| 123 | void SetDefaultAxesAttributes(string const & opt);
|
---|
| 124 | DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
|
---|
[506] | 125 |
|
---|
[165] | 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 |
|
---|
[1971] | 143 |
|
---|
[165] | 144 |
|
---|
| 145 | NamedObjMgr* mObjMgr;
|
---|
| 146 | PIACmd* mCmd;
|
---|
| 147 |
|
---|
[293] | 148 | PIMenu* m[7];
|
---|
[165] | 149 | PIMenu* mc;
|
---|
| 150 |
|
---|
[1971] | 151 | PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ...
|
---|
[165] | 152 | PIPixmap* zoom;
|
---|
| 153 | PIPixmap* gimv;
|
---|
| 154 | PICMapView* cmapv;
|
---|
[2106] | 155 | // Pour afficher des stats
|
---|
| 156 | PILabel* lab_mem;
|
---|
| 157 | PIThermometer* therm_mem;
|
---|
| 158 | PILabel* lab_cpu;
|
---|
| 159 | PIThermometer* therm_cpu;
|
---|
[165] | 160 |
|
---|
[685] | 161 | PIFileChooser * pfc_fits; // Pour les fichiers FITS
|
---|
| 162 | PIFileChooser * pfc_ppf; // Pour les PPF
|
---|
| 163 | PIFileChooser * pfc_ps; // Pour les PostScript
|
---|
[165] | 164 |
|
---|
[1971] | 165 | PIContainer* consolecont; // Container pour la PIConsole
|
---|
[165] | 166 | PIConsole* mCons;
|
---|
[293] | 167 | bool redirecout; // true if stdout/err redirected to mCons;
|
---|
[165] | 168 |
|
---|
| 169 | WindMList mWList;
|
---|
| 170 | BWMList mBWList;
|
---|
| 171 | DrwMList mDrwList;
|
---|
| 172 |
|
---|
| 173 | int mWId,mDId,mBWId;
|
---|
| 174 |
|
---|
| 175 | PIBaseWdg* mCurWdg;
|
---|
| 176 | PIBaseWdg* mLastWdg;
|
---|
| 177 | PIWindow* mCurWin;
|
---|
| 178 | PIZoneWindow* mGrW;
|
---|
| 179 | PIStackWindow* mStW;
|
---|
| 180 | int mGrIdx;
|
---|
| 181 | int mStIdx;
|
---|
| 182 |
|
---|
| 183 | ObjMgrWind* mObjmgrw;
|
---|
| 184 | PPInMgrWind* mPpinmgrw;
|
---|
| 185 |
|
---|
[1971] | 186 | // Attributs graphiques, etc ...
|
---|
[548] | 187 | double mIXmin, mIXmax, mIYmin, mIYmax;
|
---|
[1971] | 188 | bool mAddTitle;
|
---|
| 189 | unsigned int mAxesFlags;
|
---|
[165] | 190 |
|
---|
[1971] | 191 | vector<string> mDefaultAtt;
|
---|
| 192 | vector<string> mAxesAtt;
|
---|
| 193 |
|
---|
| 194 | // Controles et gestion divers
|
---|
[165] | 195 | PIMessage mFCMsg; // Message for processing FileOpen
|
---|
[1971] | 196 | int mFgScSz; // Flag ScreenSize
|
---|
[165] | 197 | bool mFgCWImg; // true -> Current Widget is PIImage
|
---|
[2106] | 198 |
|
---|
| 199 | // Pour comptabiliser l'utilisation des ressources
|
---|
| 200 | ResourceUsage resusg;
|
---|
| 201 | PIPeriodic* resupd_periodic;
|
---|
[165] | 202 | };
|
---|
| 203 |
|
---|
| 204 | #endif
|
---|