r318: *** empty log message ***
[ctsim.git] / src / views.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          view.h
5 **   Purpose:       Header file for View & Canvas routines of CTSim program
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  July 2000
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2000 Kevin Rosenberg
11 **
12 **  $Id: views.h,v 1.17 2000/12/29 15:45:06 kevin Exp $
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifdef __GNUG__
29 // #pragma interface
30 #endif
31
32 #ifndef __VIEWSH__
33 #define __VIEWSH__
34
35 #include "wx/wx.h"
36 #include "docs.h"
37 #include "imagefile.h"
38
39 class ImageFileCanvas;
40 class ImageFileView : public wxView
41 {
42     DECLARE_DYNAMIC_CLASS(ImageFileView)
43
44     wxMemoryDC m_memoryDC;
45     wxBitmap m_bitmap;
46
47 private:
48     ImageFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
49     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
50
51     ImageFileCanvas *m_canvas;
52     wxFrame *m_frame;
53     bool m_bMinSpecified;
54     bool m_bMaxSpecified;
55     double m_dMinPixel;
56     double m_dMaxPixel;
57     double m_dAutoScaleFactor;
58
59 public:
60     ImageFileView(void);
61     virtual ~ImageFileView(void);
62
63     bool OnCreate(wxDocument *doc, long flags);
64     void OnDraw(wxDC* dc);
65     void OnUpdate(wxView *sender, wxObject *hint = NULL);
66     bool OnClose (bool deleteWindow = true);
67     void OnProperties (wxCommandEvent& event);
68     void OnCompare (wxCommandEvent& event);\r
69     void OnInvertValues (wxCommandEvent& event);\r
70     void OnSquare (wxCommandEvent& event);\r
71     void OnSquareRoot (wxCommandEvent& event);\r
72     void OnLog (wxCommandEvent& event);\r
73     void OnExp (wxCommandEvent& event);\r
74     void OnFFTMagnitude (wxCommandEvent& event);\r
75     void OnFFTPhase (wxCommandEvent& event);\r
76     void OnScaleAuto (wxCommandEvent& event);
77     void OnScaleMinMax (wxCommandEvent& event);
78           void OnPlotRow (wxCommandEvent& event);\r
79           void OnPlotCol (wxCommandEvent& event);\r
80     void OnCompareRow (wxCommandEvent& event);\r
81     void OnCompareCol (wxCommandEvent& event);\r
82 \r
83         wxFrame* getFrame()\r
84         { return m_frame; }\r
85
86     ImageFileDocument* GetDocument(void) 
87         { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
88
89     DECLARE_EVENT_TABLE()
90 };
91
92 class ImageFileCanvas: public wxScrolledWindow
93 {
94 private:\r
95         int m_xCursor;\r
96         int m_yCursor;\r
97 \r
98 public:
99     ImageFileView* m_pView;
100     
101     ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
102     virtual void OnDraw(wxDC& dc);
103     void OnMouseEvent(wxMouseEvent& event);
104 \r
105         void DrawRubberBandCursor (wxDC& dc, int x, int y);\r
106         bool GetCurrentCursor (int& x, int& y);\r
107
108     DECLARE_EVENT_TABLE()
109 };
110
111
112 class ProjectionFileCanvas;
113 class ProjectionFileView : public wxView
114 {
115     DECLARE_DYNAMIC_CLASS(ProjectionFileView)
116
117     wxMemoryDC m_memoryDC;
118     wxBitmap m_bitmap;
119
120 private:
121     ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
122     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
123
124     ProjectionFileCanvas *m_canvas;
125     wxFrame *m_frame;
126
127     int m_iDefaultNX;
128     int m_iDefaultNY;
129     int m_iDefaultFilter;
130     int m_iDefaultFilterMethod;
131     double m_dDefaultFilterParam;
132     int m_iDefaultFilterGeneration;
133     int m_iDefaultZeropad;
134     int m_iDefaultInterpolation;
135     int m_iDefaultInterpParam;
136     int m_iDefaultBackprojector;
137     int m_iDefaultTrace;
138
139 public:
140     ProjectionFileView(void);
141     virtual ~ProjectionFileView(void);
142
143     bool OnCreate(wxDocument *doc, long flags);
144     void OnDraw(wxDC* dc);
145     void OnUpdate(wxView *sender, wxObject *hint = NULL);
146     bool OnClose (bool deleteWindow = true);
147     void OnProperties (wxCommandEvent& event);
148     void OnReconstruct (wxCommandEvent& event);
149 \r
150         wxFrame* getFrame ()\r
151         { return m_frame; }\r
152
153     ProjectionFileDocument* GetDocument(void) 
154         { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
155     DECLARE_EVENT_TABLE()
156 };
157
158 class ProjectionFileCanvas: public wxScrolledWindow
159 {
160 public:
161     ProjectionFileView* m_pView;
162     
163     ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
164     virtual void OnDraw(wxDC& dc);
165 };
166
167
168 class PhantomCanvas;
169 class PhantomView : public wxView
170 {
171     DECLARE_DYNAMIC_CLASS(PhantomView)
172
173 private:
174     PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
175     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
176
177     PhantomCanvas *m_canvas;
178     wxFrame *m_frame;
179
180     int m_iDefaultNDet;
181     int m_iDefaultNView;
182     int m_iDefaultNSample;
183     int m_iDefaultGeometry;
184     int m_iDefaultTrace;
185     double m_dDefaultRotation;
186     double m_dDefaultFocalLength;
187     double m_dDefaultFieldOfView;
188
189 public:
190     PhantomView(void);
191     virtual ~PhantomView(void);
192
193     bool OnCreate(wxDocument *doc, long flags);
194     void OnUpdate(wxView *sender, wxObject *hint = NULL);
195     bool OnClose (bool deleteWindow = true);
196     void OnDraw(wxDC* dc);
197     void OnProperties (wxCommandEvent& event);
198     void OnRasterize (wxCommandEvent& event);
199     void OnProjections (wxCommandEvent& event);
200
201     PhantomDocument* GetDocument(void) 
202         { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
203
204     DECLARE_EVENT_TABLE()
205 };
206
207 class PhantomCanvas: public wxScrolledWindow
208 {
209 public:
210     PhantomView* m_pView;
211     
212     PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
213
214     virtual void OnDraw(wxDC& dc);
215
216 };
217
218 class PlotFileCanvas;
219 class PlotFileView : public wxView
220 {
221     DECLARE_DYNAMIC_CLASS(PlotFileView)
222
223 private:
224     PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
225     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
226
227     EZPlot* m_pEZPlot;\r
228     PlotFileCanvas *m_canvas;
229     wxFrame *m_frame;
230     bool m_bMinSpecified;\r
231     bool m_bMaxSpecified;\r
232     double m_dMinPixel;\r
233     double m_dMaxPixel;\r
234     double m_dAutoScaleFactor;\r
235
236 public:
237     PlotFileView(void);
238     virtual ~PlotFileView(void);
239
240     bool OnCreate(wxDocument *doc, long flags);
241     void OnDraw(wxDC* dc);
242     void OnUpdate(wxView *sender, wxObject *hint = NULL);
243     bool OnClose (bool deleteWindow = true);
244     void OnProperties (wxCommandEvent& event);
245     void OnScaleAuto (wxCommandEvent& event);\r
246     void OnScaleMinMax (wxCommandEvent& event);\r
247
248         wxFrame* getFrame ()
249         { return m_frame; }
250
251     PlotFileDocument* GetDocument(void) 
252         { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
253
254     DECLARE_EVENT_TABLE()
255 };
256
257 class PlotFileCanvas: public wxScrolledWindow
258 {
259 public:
260     PlotFileView* m_pView;
261     
262     PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
263     virtual void OnDraw(wxDC& dc);
264 };
265
266
267
268 #endif
269