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.19 2001/01/30 10:58:13 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"
43 class ProjectionFileView;
44 class PhantomFileView;
48 class Graph3dFileView;
50 class ImageFileDocument: public wxDocument
53 DECLARE_DYNAMIC_CLASS(ImageFileDocument)
54 ImageFile* m_pImageFile;
58 virtual bool OnSaveDocument (const wxString& filename);
59 virtual bool OnOpenDocument (const wxString& filename);
60 virtual bool IsModified () const;
61 virtual bool Revert ();
62 virtual void Modify (bool mod);
65 : m_bBadFileOpen(false)
67 m_pImageFile = new ImageFile;
70 virtual ~ImageFileDocument ()
75 const ImageFile& getImageFile() const { return *m_pImageFile; }
76 ImageFile& getImageFile() { return *m_pImageFile; }
77 void setImageFile (ImageFile* pImageFile)
80 m_pImageFile = pImageFile;
83 ImageFileView* getView() const;
84 bool getBadFileOpen() const { return m_bBadFileOpen; }
85 void setBadFileOpen() { m_bBadFileOpen = true; }
89 class ProjectionFileDocument: public wxDocument
92 DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
93 Projections* m_pProjectionFile;
97 virtual bool OnSaveDocument (const wxString& filename);
98 virtual bool OnOpenDocument (const wxString& filename);
99 virtual bool IsModified () const;
100 virtual void Modify (bool mod);
102 ProjectionFileDocument ()
103 : m_bBadFileOpen(false)
105 m_pProjectionFile = new Projections;
108 virtual ~ProjectionFileDocument ()
110 delete m_pProjectionFile;
113 const Projections& getProjections () const { return *m_pProjectionFile; }
114 Projections& getProjections () { return *m_pProjectionFile; }
116 void setProjections (Projections* pProjections)
117 { delete m_pProjectionFile;
118 m_pProjectionFile = pProjections;
121 ProjectionFileView* getView() const;
122 bool getBadFileOpen() const { return m_bBadFileOpen; }
123 void setBadFileOpen() { m_bBadFileOpen = true; }
127 class PhantomFileDocument: public wxDocument
130 DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
133 wxString m_namePhantom;
137 PhantomFileDocument ()
138 : m_idPhantom(Phantom::PHM_INVALID), m_bBadFileOpen(false)
141 virtual ~PhantomFileDocument ()
144 const int getPhantomID () const { return m_idPhantom; }
146 const wxString& getPhantomName () const { return m_namePhantom; }
148 const Phantom& getPhantom () const { return m_phantom; }
150 Phantom& getPhantom () { return m_phantom; }
152 virtual bool OnOpenDocument (const wxString& filename);
153 virtual bool OnSaveDocument (const wxString& filename);
154 virtual bool IsModified () const;
155 virtual void Modify (bool mod);
156 PhantomFileView* getView() const;
157 bool getBadFileOpen() const { return m_bBadFileOpen; }
158 void setBadFileOpen() { m_bBadFileOpen = true; }
162 class PlotFileDocument: public wxDocument
165 DECLARE_DYNAMIC_CLASS(PlotFileDocument)
172 : m_bBadFileOpen(false)
175 virtual ~PlotFileDocument ()
178 const wxString& getPlotName () const
179 { return m_namePlot; }
181 const PlotFile& getPlotFile () const
184 PlotFile& getPlotFile ()
187 virtual bool OnOpenDocument (const wxString& filename);
188 virtual bool OnSaveDocument (const wxString& filename);
189 virtual bool IsModified () const;
190 virtual void Modify (bool mod);
191 PlotFileView* getView() const;
192 bool getBadFileOpen() const { return m_bBadFileOpen; }
193 void setBadFileOpen() { m_bBadFileOpen = true; }
197 class TextFileDocument: public wxDocument
200 DECLARE_DYNAMIC_CLASS(TextFileDocument)
204 TextFileDocument(void)
205 : m_bBadFileOpen(false)
208 virtual ~TextFileDocument(void) {}
210 virtual bool OnSaveDocument(const wxString& filename);
211 virtual bool OnOpenDocument(const wxString& filename);
212 virtual bool IsModified(void) const;
214 wxTextCtrl* getTextCtrl();
216 TextFileView* getView() const;
217 bool getBadFileOpen() const { return m_bBadFileOpen; }
218 void setBadFileOpen() { m_bBadFileOpen = true; }
226 typedef GLfloat glTripleFloat[3];
228 class Graph3dFileDocument: public wxDocument
230 friend Graph3dFileView;
233 DECLARE_DYNAMIC_CLASS(Graph3dFileDocument)
236 glTripleFloat* m_pVertices;
237 glTripleFloat* m_pNormals;
240 ImageFileArray m_array;
243 Graph3dFileDocument(void);
244 virtual ~Graph3dFileDocument(void);
246 virtual bool OnSaveDocument (const wxString& filename);
247 virtual bool OnOpenDocument (const wxString& filename);
248 virtual bool IsModified () const;
250 Graph3dFileView* getView() const;
251 bool getBadFileOpen() const { return m_bBadFileOpen; }
252 void setBadFileOpen() { m_bBadFileOpen = true; }
253 bool createFromImageFile (const ImageFile& rImageFile);