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