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