[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"
|
---|
[2141] | 28 | #include "pi3dwdg.h"
|
---|
[165] | 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 |
|
---|
[2188] | 61 | // Specification (de l'exterieur) de commande a executer
|
---|
| 62 | inline void SubmitCommand(string const& cmd)
|
---|
| 63 | { exc_command = cmd; fg_exc_cmd = true; }
|
---|
| 64 | // Execution de commande soumis de l'exterieur
|
---|
| 65 | int ExecuteExtCommand();
|
---|
| 66 |
|
---|
[1642] | 67 | // Fonction d'ajout de texte (provisoire - Aout 99)
|
---|
[1971] | 68 | void AddText(string const & txt, double xp, double yp, string const& opt);
|
---|
[1642] | 69 | // Ajout de lignes, rectangles, cercles (provisoires - Aout 2001)
|
---|
[1971] | 70 | void AddLine(double xp1, double yp1, double xp2, double yp2, string const& opt);
|
---|
| 71 | void AddRectangle(double xp1, double yp1, double xp2, double yp2, string const& opt,
|
---|
| 72 | bool fgfill=false);
|
---|
| 73 | void AddCircle(double xc, double yc, double r, string const& opt,
|
---|
| 74 | bool fgfill=false);
|
---|
[1642] | 75 |
|
---|
[1131] | 76 | // Fonction Ajout de titre de trace
|
---|
[2165] | 77 | void SetTitle(string const & titleup, string const & titledown, string const& opt);
|
---|
| 78 | // Fonction d'Ajout label d'axe X,Y
|
---|
| 79 | void SetAxeLabels(string const & xLabel, string const & yLabel, string const& opt);
|
---|
[349] | 80 |
|
---|
[1642] | 81 | // Acces au BaseDrawer (PIElDrawer) du PIBaseWdg courant
|
---|
[2165] | 82 | PIDrawer* CurrentElDrawer();
|
---|
[349] | 83 |
|
---|
[165] | 84 | void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
|
---|
| 85 | void CreateStackWin(int sx=0, int sy = 0);
|
---|
[1971] | 86 | PIWindow * GetWindow(DispWinEnum typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
|
---|
[165] | 87 | void SetZone(int nzx=1, int nzy=1);
|
---|
| 88 | void StackWinNext();
|
---|
| 89 |
|
---|
| 90 | void DeleteWindow(PIWindow* w);
|
---|
| 91 | void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
|
---|
| 92 | void DelWRsId(int k);
|
---|
[368] | 93 | bool CheckWRsId(int k);
|
---|
[165] | 94 | void CloseAllWindows();
|
---|
| 95 |
|
---|
| 96 | inline NamedObjMgr* ObjMgr() { return mObjMgr; }
|
---|
| 97 | inline PIACmd* CmdInterpreter() { return mCmd; }
|
---|
| 98 |
|
---|
| 99 | PIWindow* CurrentWindow() { return (mCurWin); };
|
---|
| 100 | PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
|
---|
| 101 |
|
---|
| 102 | inline PIPixmap* ZoomW() { return zoom; }
|
---|
| 103 | inline PIPixmap* GloVW() { return gimv; }
|
---|
| 104 | inline PICMapView* CMapVW() { return cmapv; }
|
---|
| 105 | inline PIConsole* GetConsole() { return mCons; }
|
---|
| 106 |
|
---|
[293] | 107 | inline PIMenu* SpecialMenu() { return m[5]; }
|
---|
| 108 | inline PIMenu* ModulesMenu() { return m[6]; }
|
---|
[165] | 109 |
|
---|
| 110 | inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
|
---|
| 111 | inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
|
---|
| 112 |
|
---|
[1971] | 113 | // Gestion (show/hide) de la fenetre Stat/ZoomWindow
|
---|
| 114 | void StatZoomWindowSetVisible(bool fg=true);
|
---|
| 115 |
|
---|
[2106] | 116 | // Update de l'info de la fenetre stats/ressources
|
---|
| 117 | void UpdateStatResourceInfo();
|
---|
| 118 |
|
---|
[165] | 119 | // Redirection ou Non de StdOut/StdErr
|
---|
| 120 | void RedirectStdOutErr(bool fg = true);
|
---|
[293] | 121 | inline bool HasRedirectedStdOutErr() { return(redirecout); }
|
---|
[165] | 122 | // Gestion des signaux
|
---|
[374] | 123 | void CatchSignals(bool fgfpe=true, bool fgsegv=true);
|
---|
[165] | 124 |
|
---|
[548] | 125 | void SetInsetLimits(double xmin=0.4, double xmax=0.6, double ymin=0.4, double ymax=0.6);
|
---|
[1131] | 126 | inline void SetAutoAddTitle(bool aatit=true) { mAddTitle = aatit; }
|
---|
[1971] | 127 | void SetAxesAtt(unsigned int axfl) { mAxesFlags = axfl; }
|
---|
| 128 | // void SaveGraphicAtt();
|
---|
| 129 | // void RestoreGraphicAtt();
|
---|
| 130 | void SetDefaultGraphicAttributes(string const & opt);
|
---|
| 131 | void SetDefaultAxesAttributes(string const & opt);
|
---|
| 132 | DispWinEnum ParseDisplayOption(string const & opt, vector<string>& opts);
|
---|
[506] | 133 |
|
---|
[165] | 134 | // Gestion fichiers PS
|
---|
| 135 | int num_eps;
|
---|
| 136 | PSFile *mpsfile;
|
---|
| 137 | string name_ps;
|
---|
| 138 |
|
---|
| 139 | // Gestion OUT-PPF
|
---|
| 140 | POutPersist* mPpfout;
|
---|
| 141 | string name_outppf;
|
---|
| 142 |
|
---|
| 143 | private:
|
---|
| 144 | void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 145 | void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 146 | void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 147 | void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 148 | void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 149 | void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 150 |
|
---|
[1971] | 151 |
|
---|
[165] | 152 |
|
---|
| 153 | NamedObjMgr* mObjMgr;
|
---|
| 154 | PIACmd* mCmd;
|
---|
| 155 |
|
---|
[293] | 156 | PIMenu* m[7];
|
---|
[165] | 157 | PIMenu* mc;
|
---|
| 158 |
|
---|
[1971] | 159 | PIContainer* statcont; // Container pour les widgets zoom, gimv, cmapv ...
|
---|
[165] | 160 | PIPixmap* zoom;
|
---|
| 161 | PIPixmap* gimv;
|
---|
| 162 | PICMapView* cmapv;
|
---|
[2106] | 163 | // Pour afficher des stats
|
---|
| 164 | PILabel* lab_mem;
|
---|
| 165 | PIThermometer* therm_mem;
|
---|
| 166 | PILabel* lab_cpu;
|
---|
| 167 | PIThermometer* therm_cpu;
|
---|
[165] | 168 |
|
---|
[685] | 169 | PIFileChooser * pfc_fits; // Pour les fichiers FITS
|
---|
| 170 | PIFileChooser * pfc_ppf; // Pour les PPF
|
---|
| 171 | PIFileChooser * pfc_ps; // Pour les PostScript
|
---|
[165] | 172 |
|
---|
[1971] | 173 | PIContainer* consolecont; // Container pour la PIConsole
|
---|
[165] | 174 | PIConsole* mCons;
|
---|
[293] | 175 | bool redirecout; // true if stdout/err redirected to mCons;
|
---|
[165] | 176 |
|
---|
| 177 | WindMList mWList;
|
---|
| 178 | BWMList mBWList;
|
---|
| 179 | DrwMList mDrwList;
|
---|
| 180 |
|
---|
| 181 | int mWId,mDId,mBWId;
|
---|
| 182 |
|
---|
| 183 | PIBaseWdg* mCurWdg;
|
---|
| 184 | PIBaseWdg* mLastWdg;
|
---|
| 185 | PIWindow* mCurWin;
|
---|
| 186 | PIZoneWindow* mGrW;
|
---|
| 187 | PIStackWindow* mStW;
|
---|
| 188 | int mGrIdx;
|
---|
| 189 | int mStIdx;
|
---|
| 190 |
|
---|
| 191 | ObjMgrWind* mObjmgrw;
|
---|
| 192 | PPInMgrWind* mPpinmgrw;
|
---|
| 193 |
|
---|
[1971] | 194 | // Attributs graphiques, etc ...
|
---|
[548] | 195 | double mIXmin, mIXmax, mIYmin, mIYmax;
|
---|
[1971] | 196 | bool mAddTitle;
|
---|
| 197 | unsigned int mAxesFlags;
|
---|
[165] | 198 |
|
---|
[1971] | 199 | vector<string> mDefaultAtt;
|
---|
| 200 | vector<string> mAxesAtt;
|
---|
| 201 |
|
---|
| 202 | // Controles et gestion divers
|
---|
[165] | 203 | PIMessage mFCMsg; // Message for processing FileOpen
|
---|
[1971] | 204 | int mFgScSz; // Flag ScreenSize
|
---|
[165] | 205 | bool mFgCWImg; // true -> Current Widget is PIImage
|
---|
[2106] | 206 |
|
---|
| 207 | // Pour comptabiliser l'utilisation des ressources
|
---|
| 208 | ResourceUsage resusg;
|
---|
| 209 | PIPeriodic* resupd_periodic;
|
---|
[2188] | 210 |
|
---|
| 211 | // Commande specifie de l'exterieur a executer
|
---|
| 212 | // Pris en charge par resupd_periodic
|
---|
| 213 | string exc_command;
|
---|
| 214 | bool fg_exc_cmd;
|
---|
[165] | 215 | };
|
---|
| 216 |
|
---|
| 217 | #endif
|
---|