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