r322: *** 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.19 2000/12/29 20:18:59 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 OnFourier (wxCommandEvent& event);\r
75     void OnInverseFourier (wxCommandEvent& event);\r
76     void OnMagnitude (wxCommandEvent& event);\r
77     void OnPhase (wxCommandEvent& event);\r
78     void OnScaleAuto (wxCommandEvent& event);
79     void OnScaleMinMax (wxCommandEvent& event);
80           void OnPlotRow (wxCommandEvent& event);\r
81           void OnPlotCol (wxCommandEvent& event);\r
82     void OnCompareRow (wxCommandEvent& event);\r
83     void OnCompareCol (wxCommandEvent& event);\r
84 \r
85         wxFrame* getFrame()\r
86         { return m_frame; }\r
87
88     ImageFileDocument* GetDocument(void) 
89         { return dynamic_cast<ImageFileDocument*>(wxView::GetDocument()); }
90
91     DECLARE_EVENT_TABLE()
92 };
93
94 class ImageFileCanvas: public wxScrolledWindow
95 {
96 private:\r
97         int m_xCursor;\r
98         int m_yCursor;\r
99 \r
100 public:
101     ImageFileView* m_pView;
102     
103     ImageFileCanvas (ImageFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
104     virtual void OnDraw(wxDC& dc);
105     void OnMouseEvent(wxMouseEvent& event);
106 \r
107         void DrawRubberBandCursor (wxDC& dc, int x, int y);\r
108         bool GetCurrentCursor (int& x, int& y);\r
109
110     DECLARE_EVENT_TABLE()
111 };
112
113
114 class ProjectionFileCanvas;
115 class ProjectionFileView : public wxView
116 {
117     DECLARE_DYNAMIC_CLASS(ProjectionFileView)
118
119     wxMemoryDC m_memoryDC;
120     wxBitmap m_bitmap;
121
122 private:
123     ProjectionFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
124     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
125
126     ProjectionFileCanvas *m_canvas;
127     wxFrame *m_frame;
128
129     int m_iDefaultNX;
130     int m_iDefaultNY;
131     int m_iDefaultFilter;
132     int m_iDefaultFilterMethod;
133     double m_dDefaultFilterParam;
134     int m_iDefaultFilterGeneration;
135     int m_iDefaultZeropad;
136     int m_iDefaultInterpolation;
137     int m_iDefaultInterpParam;
138     int m_iDefaultBackprojector;
139     int m_iDefaultTrace;
140
141 public:
142     ProjectionFileView(void);
143     virtual ~ProjectionFileView(void);
144
145     bool OnCreate(wxDocument *doc, long flags);
146     void OnDraw(wxDC* dc);
147     void OnUpdate(wxView *sender, wxObject *hint = NULL);
148     bool OnClose (bool deleteWindow = true);
149     void OnProperties (wxCommandEvent& event);
150     void OnReconstruct (wxCommandEvent& event);
151 \r
152         wxFrame* getFrame ()\r
153         { return m_frame; }\r
154
155     ProjectionFileDocument* GetDocument(void) 
156         { return dynamic_cast<ProjectionFileDocument*>(wxView::GetDocument()); }
157     DECLARE_EVENT_TABLE()
158 };
159
160 class ProjectionFileCanvas: public wxScrolledWindow
161 {
162 public:
163     ProjectionFileView* m_pView;
164     
165     ProjectionFileCanvas (ProjectionFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
166     virtual void OnDraw(wxDC& dc);
167 };
168
169
170 class PhantomCanvas;
171 class PhantomView : public wxView
172 {
173     DECLARE_DYNAMIC_CLASS(PhantomView)
174
175 private:
176     PhantomCanvas *CreateCanvas(wxView *view, wxFrame *parent);
177     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
178
179     PhantomCanvas *m_canvas;
180     wxFrame *m_frame;
181
182     int m_iDefaultNDet;
183     int m_iDefaultNView;
184     int m_iDefaultNSample;
185     int m_iDefaultGeometry;
186     int m_iDefaultTrace;
187     double m_dDefaultRotation;
188     double m_dDefaultFocalLength;
189     double m_dDefaultFieldOfView;
190
191 public:
192     PhantomView(void);
193     virtual ~PhantomView(void);
194
195     bool OnCreate(wxDocument *doc, long flags);
196     void OnUpdate(wxView *sender, wxObject *hint = NULL);
197     bool OnClose (bool deleteWindow = true);
198     void OnDraw(wxDC* dc);
199     void OnProperties (wxCommandEvent& event);
200     void OnRasterize (wxCommandEvent& event);
201     void OnProjections (wxCommandEvent& event);
202
203     PhantomDocument* GetDocument(void) 
204         { return dynamic_cast<PhantomDocument*>(wxView::GetDocument()); }
205
206     DECLARE_EVENT_TABLE()
207 };
208
209 class PhantomCanvas: public wxScrolledWindow
210 {
211 public:
212     PhantomView* m_pView;
213     
214     PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
215
216     virtual void OnDraw(wxDC& dc);
217
218 };
219
220 class PlotFileCanvas;
221 class PlotFileView : public wxView
222 {
223     DECLARE_DYNAMIC_CLASS(PlotFileView)
224
225 private:
226     PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
227     wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
228
229     PlotFileCanvas *m_canvas;
230     wxFrame *m_frame;
231     EZPlot* m_pEZPlot;\r
232     bool m_bMinSpecified;\r
233     bool m_bMaxSpecified;\r
234     double m_dMinPixel;\r
235     double m_dMaxPixel;\r
236     double m_dAutoScaleFactor;\r
237
238 public:
239     PlotFileView(void);
240     virtual ~PlotFileView(void);
241
242     bool OnCreate(wxDocument *doc, long flags);
243     void OnDraw(wxDC* dc);
244     void OnUpdate(wxView *sender, wxObject *hint = NULL);
245     bool OnClose (bool deleteWindow = true);
246     void OnProperties (wxCommandEvent& event);
247     void OnScaleAuto (wxCommandEvent& event);\r
248     void OnScaleMinMax (wxCommandEvent& event);\r
249
250         wxFrame* getFrame ()
251         { return m_frame; }
252
253     PlotFileDocument* GetDocument(void) 
254         { return dynamic_cast<PlotFileDocument*>(wxView::GetDocument()); }
255
256     DECLARE_EVENT_TABLE()
257 };
258
259 class PlotFileCanvas: public wxScrolledWindow
260 {
261 public:
262     PlotFileView* m_pView;
263     
264     PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
265     virtual void OnDraw(wxDC& dc);
266 };
267
268
269
270 #endif
271