[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>
|
---|
[347] | 12 | #if defined(__KCC__)
|
---|
| 13 | using std::string ;
|
---|
| 14 | #include <map.h>
|
---|
[351] | 15 | #include <functional.h>
|
---|
[347] | 16 | #endif
|
---|
[165] | 17 |
|
---|
| 18 | #include "pisysdep.h"
|
---|
| 19 |
|
---|
| 20 | #include PIAPP_H
|
---|
| 21 | #include PIWIN_H
|
---|
| 22 | #include PIMENU_H
|
---|
| 23 | #include PIOPTMENU_H
|
---|
| 24 |
|
---|
| 25 | #include PISTDWDG_H
|
---|
| 26 |
|
---|
| 27 | #include PIFILECHO_H
|
---|
| 28 | #include "picons.h"
|
---|
| 29 |
|
---|
| 30 | #include "piimage.h"
|
---|
| 31 | #include "pi3ddrw.h"
|
---|
| 32 | #include "nobjmgr.h"
|
---|
| 33 | #include "piacmd.h"
|
---|
| 34 | #include "pisiadw.h"
|
---|
| 35 | #include "pistzwin.h"
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | enum {Disp_Next=0, Disp_Win=1, Disp_Same=2, Disp_Stack=3};
|
---|
| 39 |
|
---|
| 40 | typedef map<long, PIWindow*, less<long> > WindMList;
|
---|
| 41 | typedef map<long, PIBaseWdg*, less<long> > BWMList;
|
---|
| 42 | typedef map<long, PIDrawer*, less<long> > DrwMList;
|
---|
| 43 |
|
---|
| 44 | class PIStdImgApp : public PIApplication {
|
---|
| 45 | public:
|
---|
| 46 | PIStdImgApp(int narg=0, char* arg[]=NULL);
|
---|
| 47 | ~PIStdImgApp();
|
---|
| 48 |
|
---|
| 49 | virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
[194] | 50 | virtual void SetReady();
|
---|
| 51 | virtual void SetBusy();
|
---|
| 52 | virtual void SetBlocked();
|
---|
[165] | 53 |
|
---|
[331] | 54 | int DispImage(P2DArrayAdapter* nouv, string const & name, int opt, int oid=0);
|
---|
| 55 | int DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="", int oid=0);
|
---|
| 56 | int Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="", int oid=0);
|
---|
[165] | 57 |
|
---|
[349] | 58 | // Fonction d'ajout de texte (provisoire - Aout 99)
|
---|
| 59 | void AddText(string const & txt, double xp, double yp);
|
---|
| 60 |
|
---|
| 61 |
|
---|
[165] | 62 | void CreateGraphWin(int nx=1, int ny=1, int sx=0, int sy = 0);
|
---|
| 63 | void CreateStackWin(int sx=0, int sy = 0);
|
---|
| 64 | PIWindow * GetWindow(int typ, int& sx, int& sy, int& px, int& py, int& flag, char * nom);
|
---|
| 65 | void SetZone(int nzx=1, int nzy=1);
|
---|
| 66 | void StackWinNext();
|
---|
| 67 |
|
---|
| 68 | void DeleteWindow(PIWindow* w);
|
---|
| 69 | void DeleteBaseWidget(PIBaseWdg* w, bool dw=true, bool dwin=true);
|
---|
| 70 | void DelWRsId(int k);
|
---|
[368] | 71 | bool CheckWRsId(int k);
|
---|
[165] | 72 | void CloseAllWindows();
|
---|
| 73 |
|
---|
| 74 | inline NamedObjMgr* ObjMgr() { return mObjMgr; }
|
---|
| 75 | inline PIACmd* CmdInterpreter() { return mCmd; }
|
---|
| 76 |
|
---|
| 77 | PIWindow* CurrentWindow() { return (mCurWin); };
|
---|
| 78 | PIBaseWdg* CurrentBaseWdg() { return (mCurWdg); };
|
---|
| 79 |
|
---|
| 80 | inline PIPixmap* ZoomW() { return zoom; }
|
---|
| 81 | inline PIPixmap* GloVW() { return gimv; }
|
---|
| 82 | inline PICMapView* CMapVW() { return cmapv; }
|
---|
| 83 | inline PIConsole* GetConsole() { return mCons; }
|
---|
| 84 |
|
---|
[293] | 85 | inline PIMenu* SpecialMenu() { return m[5]; }
|
---|
| 86 | inline PIMenu* ModulesMenu() { return m[6]; }
|
---|
[165] | 87 |
|
---|
| 88 | inline ObjMgrWind* ObjMgrW() { return mObjmgrw; }
|
---|
| 89 | inline PPInMgrWind* PPInMgrW() { return mPpinmgrw; }
|
---|
| 90 |
|
---|
| 91 | // Redirection ou Non de StdOut/StdErr
|
---|
| 92 | void RedirectStdOutErr(bool fg = true);
|
---|
[293] | 93 | inline bool HasRedirectedStdOutErr() { return(redirecout); }
|
---|
[165] | 94 | // Gestion des signaux
|
---|
[374] | 95 | void CatchSignals(bool fgfpe=true, bool fgsegv=true);
|
---|
[165] | 96 |
|
---|
| 97 | // Gestion d attributs graphiques courants
|
---|
| 98 | void SetColAtt(PIColors fg=PI_NotDefColor,
|
---|
| 99 | PIColors bg=PI_NotDefColor);
|
---|
| 100 | void SetLineAtt(PILineAtt lat=PI_NotDefLineAtt);
|
---|
| 101 | void SetFontAtt(PIFontSize fsz=PI_NotDefFontSize,
|
---|
| 102 | PIFontAtt fat=PI_NotDefFontAtt);
|
---|
| 103 | void SetMarkerAtt(int sz=-1, PIMarker mrk=PI_NotDefMarker);
|
---|
| 104 | void SetColMapId(CMapId cid=CMAP_OTHER);
|
---|
| 105 | void SetZoomAtt(int zoom=0);
|
---|
[203] | 106 | void SetAxesAtt(unsigned int axfl=kBoxAxes | kExtTicks | kLabels);
|
---|
[331] | 107 | void SetXYLimits(double xmin=-1., double xmax=1., double ymin=-1., double ymax=1.);
|
---|
| 108 | inline void UseXYLimits(bool fg=false) { mFXYlim=fg; }
|
---|
[165] | 109 | // Pour sauvegarder-restauration de l'etat des attributs graphiques
|
---|
| 110 | void SaveGraphicAtt();
|
---|
| 111 | void RestoreGraphicAtt();
|
---|
| 112 |
|
---|
| 113 | // Gestion fichiers PS
|
---|
| 114 | int num_eps;
|
---|
| 115 | PSFile *mpsfile;
|
---|
| 116 | string name_ps;
|
---|
| 117 |
|
---|
| 118 | // Gestion OUT-PPF
|
---|
| 119 | POutPersist* mPpfout;
|
---|
| 120 | string name_outppf;
|
---|
| 121 |
|
---|
| 122 | private:
|
---|
| 123 | void MBProcess1(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 124 | void MBProcess2(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 125 | void MBProcess3(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 126 | void MBProcess4(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 127 | void MBProcess5(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 128 | void MBProcess6(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | NamedObjMgr* mObjMgr;
|
---|
| 132 | PIACmd* mCmd;
|
---|
| 133 |
|
---|
[293] | 134 | PIMenu* m[7];
|
---|
[165] | 135 | PIMenu* mc;
|
---|
| 136 |
|
---|
| 137 | PIPixmap* zoom;
|
---|
| 138 | PIPixmap* gimv;
|
---|
| 139 | PICMapView* cmapv;
|
---|
| 140 |
|
---|
| 141 | PIFileChooser * pfc;
|
---|
| 142 |
|
---|
| 143 | PIConsole* mCons;
|
---|
[293] | 144 | bool redirecout; // true if stdout/err redirected to mCons;
|
---|
[165] | 145 |
|
---|
| 146 | WindMList mWList;
|
---|
| 147 | BWMList mBWList;
|
---|
| 148 | DrwMList mDrwList;
|
---|
| 149 |
|
---|
| 150 | int mWId,mDId,mBWId;
|
---|
| 151 |
|
---|
| 152 | PIBaseWdg* mCurWdg;
|
---|
| 153 | PIBaseWdg* mLastWdg;
|
---|
| 154 | PIWindow* mCurWin;
|
---|
| 155 | PIZoneWindow* mGrW;
|
---|
| 156 | PIStackWindow* mStW;
|
---|
| 157 | int mGrIdx;
|
---|
| 158 | int mStIdx;
|
---|
| 159 |
|
---|
| 160 | ObjMgrWind* mObjmgrw;
|
---|
| 161 | PPInMgrWind* mPpinmgrw;
|
---|
| 162 |
|
---|
| 163 | // Gestion d attributs graphiques courants, etat sauvegarde
|
---|
| 164 | PIColors mFCol, mBCol, mSFCol, mSBCol;
|
---|
| 165 | PILineAtt mLAtt, mSLAtt;
|
---|
| 166 | PIFontSize mFSz, mSFSz;
|
---|
| 167 | PIFontAtt mFAtt, mSFAtt;
|
---|
| 168 | int mMSz, mSMSz;
|
---|
| 169 | PIMarker mMrk,mSMrk;
|
---|
| 170 | CMapId mCmapid, mSCmapid;
|
---|
| 171 | int mZoom, mSZoom;
|
---|
[203] | 172 | unsigned int mAxesFlags, mSAxesFlags;
|
---|
[331] | 173 | double mXmin, mXmax, mYmin, mYmax;
|
---|
| 174 | double mSXmin, mSXmax, mSYmin, mSYmax;
|
---|
| 175 | bool mFXYlim, mSFXYlim;
|
---|
[165] | 176 |
|
---|
| 177 | PIMessage mFCMsg; // Message for processing FileOpen
|
---|
| 178 | int mFgScSz; // Dlag ScreenSize
|
---|
| 179 | bool mFgCWImg; // true -> Current Widget is PIImage
|
---|
| 180 | };
|
---|
| 181 |
|
---|
| 182 | #endif
|
---|