1 /*****************************************************************************
5 ** Purpose: Header file for Document routines of CTSim program
6 ** Programmer: Kevin Rosenberg
7 ** Date Started: July 2000
9 ** This is part of the CTSim program
10 ** Copyright (c) 1983-2001 Kevin Rosenberg
12 ** $Id: docs.h,v 1.24 2001/02/23 21:58:31 kevin Exp $
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.
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.
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 ******************************************************************************/
35 #include "wx/docview.h"
38 #include "imagefile.h"
40 #include "projections.h"
42 #include "threadrecon.h"
44 class ProjectionFileView;
45 class PhantomFileView;
49 class Graph3dFileView;
51 class ImageFileDocument: public wxDocument
54 DECLARE_DYNAMIC_CLASS(ImageFileDocument)
55 ImageFile* m_pImageFile;
59 virtual bool OnSaveDocument (const wxString& filename);
60 virtual bool OnOpenDocument (const wxString& filename);
61 virtual bool IsModified () const;
62 virtual bool Revert ();
63 virtual void Modify (bool mod);
66 : m_bBadFileOpen(false)
68 m_pImageFile = new ImageFile;
71 virtual ~ImageFileDocument ()
76 const ImageFile& getImageFile() const { return *m_pImageFile; }
77 ImageFile& getImageFile() { return *m_pImageFile; }
78 void setImageFile (ImageFile* pImageFile)
81 m_pImageFile = pImageFile;
84 ImageFileView* getView() const;
85 bool getBadFileOpen() const { return m_bBadFileOpen; }
86 void setBadFileOpen() { m_bBadFileOpen = true; }
90 class ProjectionFileDocument: public wxDocument
93 DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
94 Projections* m_pProjectionFile;
96 typedef BackgroundSupervisor BackgroundObject;
97 typedef std::vector<BackgroundObject*> BackgroundContainer ;
98 BackgroundContainer m_vecpBackgroundSupervisors;
99 wxCriticalSection m_criticalSection;
102 virtual bool OnSaveDocument (const wxString& filename);
103 virtual bool OnOpenDocument (const wxString& filename);
104 virtual bool IsModified () const;
105 virtual void Modify (bool mod);
107 ProjectionFileDocument ()
108 : m_bBadFileOpen(false)
110 m_pProjectionFile = new Projections;
113 virtual ~ProjectionFileDocument ();
115 const Projections& getProjections () const { return *m_pProjectionFile; }
116 Projections& getProjections () { return *m_pProjectionFile; }
118 void setProjections (Projections* pProjections)
119 { delete m_pProjectionFile;
120 m_pProjectionFile = pProjections;
123 ProjectionFileView* getView() const;
124 bool getBadFileOpen() const { return m_bBadFileOpen; }
125 void setBadFileOpen() { m_bBadFileOpen = true; }
127 void OnAddBackground (wxCommandEvent& event);
128 void OnRemoveBackground (wxCommandEvent& event);
130 DECLARE_EVENT_TABLE()
134 class PhantomFileDocument: public wxDocument
137 DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
140 wxString m_namePhantom;
144 PhantomFileDocument ()
145 : m_idPhantom(Phantom::PHM_INVALID), m_bBadFileOpen(false)
148 virtual ~PhantomFileDocument ()
151 const int getPhantomID () const { return m_idPhantom; }
153 const wxString& getPhantomName () const { return m_namePhantom; }
155 const Phantom& getPhantom () const { return m_phantom; }
157 Phantom& getPhantom () { return m_phantom; }
159 virtual bool OnOpenDocument (const wxString& filename);
160 virtual bool OnSaveDocument (const wxString& filename);
161 virtual bool IsModified () const;
162 virtual void Modify (bool mod);
163 PhantomFileView* getView() const;
164 bool getBadFileOpen() const { return m_bBadFileOpen; }
165 void setBadFileOpen() { m_bBadFileOpen = true; }
169 class PlotFileDocument: public wxDocument
172 DECLARE_DYNAMIC_CLASS(PlotFileDocument)
179 : m_bBadFileOpen(false)
182 virtual ~PlotFileDocument ()
185 const wxString& getPlotName () const
186 { return m_namePlot; }
188 const PlotFile& getPlotFile () const
191 PlotFile& getPlotFile ()
194 virtual bool OnOpenDocument (const wxString& filename);
195 virtual bool OnSaveDocument (const wxString& filename);
196 virtual bool IsModified () const;
197 virtual void Modify (bool mod);
198 PlotFileView* getView() const;
199 bool getBadFileOpen() const { return m_bBadFileOpen; }
200 void setBadFileOpen() { m_bBadFileOpen = true; }
204 class TextFileDocument: public wxDocument
207 DECLARE_DYNAMIC_CLASS(TextFileDocument)
211 TextFileDocument(void)
212 : m_bBadFileOpen(false)
215 virtual ~TextFileDocument(void) {}
217 virtual bool OnSaveDocument(const wxString& filename);
218 virtual bool OnOpenDocument(const wxString& filename);
219 virtual bool IsModified(void) const;
221 wxTextCtrl* getTextCtrl();
223 TextFileView* getView() const;
224 bool getBadFileOpen() const { return m_bBadFileOpen; }
225 void setBadFileOpen() { m_bBadFileOpen = true; }
233 typedef GLfloat glTripleFloat[3];
235 class Graph3dFileDocument: public wxDocument
237 friend Graph3dFileView;
240 DECLARE_DYNAMIC_CLASS(Graph3dFileDocument)
243 glTripleFloat* m_pVertices;
244 glTripleFloat* m_pNormals;
247 ImageFileArray m_array;
250 Graph3dFileDocument(void);
251 virtual ~Graph3dFileDocument(void);
253 virtual bool OnSaveDocument (const wxString& filename);
254 virtual bool OnOpenDocument (const wxString& filename);
255 virtual bool IsModified () const;
257 Graph3dFileView* getView() const;
258 bool getBadFileOpen() const { return m_bBadFileOpen; }
259 void setBadFileOpen() { m_bBadFileOpen = true; }
260 bool createFromImageFile (const ImageFile& rImageFile);
262 int nx() const { return m_nx; }
263 int ny() const { return m_ny; }
264 ImageFileArray getArray() { return m_array; }
265 ImageFileArrayConst getArray() const { return m_array; }
267 #endif // wxUSE_GLCANVAS