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