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.17 2001/01/30 05:05:41 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;
49 class ImageFileDocument: public wxDocument
52 DECLARE_DYNAMIC_CLASS(ImageFileDocument)
53 ImageFile* m_pImageFile;
57 virtual bool OnSaveDocument (const wxString& filename);
58 virtual bool OnOpenDocument (const wxString& filename);
59 virtual bool IsModified () const;
60 virtual bool Revert ();
61 virtual void Modify (bool mod);
64 : m_bBadFileOpen(false)
66 m_pImageFile = new ImageFile;
69 virtual ~ImageFileDocument ()
74 const ImageFile& getImageFile() const { return *m_pImageFile; }
75 ImageFile& getImageFile() { return *m_pImageFile; }
76 void setImageFile (ImageFile* pImageFile)
79 m_pImageFile = pImageFile;
82 ImageFileView* getView() const;
83 bool getBadFileOpen() const { return m_bBadFileOpen; }
84 void setBadFileOpen() { m_bBadFileOpen = true; }
88 class ProjectionFileDocument: public wxDocument
91 DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
92 Projections* m_pProjectionFile;
96 virtual bool OnSaveDocument (const wxString& filename);
97 virtual bool OnOpenDocument (const wxString& filename);
98 virtual bool IsModified () const;
99 virtual void Modify (bool mod);
101 ProjectionFileDocument ()
102 : m_bBadFileOpen(false)
104 m_pProjectionFile = new Projections;
107 virtual ~ProjectionFileDocument ()
109 delete m_pProjectionFile;
112 const Projections& getProjections () const { return *m_pProjectionFile; }
113 Projections& getProjections () { return *m_pProjectionFile; }
115 void setProjections (Projections* pProjections)
116 { delete m_pProjectionFile;
117 m_pProjectionFile = pProjections;
120 ProjectionFileView* getView() const;
121 bool getBadFileOpen() const { return m_bBadFileOpen; }
122 void setBadFileOpen() { m_bBadFileOpen = true; }
126 class PhantomFileDocument: public wxDocument
129 DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
132 wxString m_namePhantom;
136 PhantomFileDocument ()
137 : m_idPhantom(Phantom::PHM_INVALID), m_bBadFileOpen(false)
140 virtual ~PhantomFileDocument ()
143 const int getPhantomID () const { return m_idPhantom; }
145 const wxString& getPhantomName () const { return m_namePhantom; }
147 const Phantom& getPhantom () const { return m_phantom; }
149 Phantom& getPhantom () { return m_phantom; }
151 virtual bool OnOpenDocument (const wxString& filename);
152 virtual bool OnSaveDocument (const wxString& filename);
153 virtual bool IsModified () const;
154 virtual void Modify (bool mod);
155 PhantomFileView* getView() const;
156 bool getBadFileOpen() const { return m_bBadFileOpen; }
157 void setBadFileOpen() { m_bBadFileOpen = true; }
161 class PlotFileDocument: public wxDocument
164 DECLARE_DYNAMIC_CLASS(PlotFileDocument)
171 : m_bBadFileOpen(false)
174 virtual ~PlotFileDocument ()
177 const wxString& getPlotName () const
178 { return m_namePlot; }
180 const PlotFile& getPlotFile () const
183 PlotFile& getPlotFile ()
186 virtual bool OnOpenDocument (const wxString& filename);
187 virtual bool OnSaveDocument (const wxString& filename);
188 virtual bool IsModified () const;
189 virtual void Modify (bool mod);
190 PlotFileView* getView() const;
191 bool getBadFileOpen() const { return m_bBadFileOpen; }
192 void setBadFileOpen() { m_bBadFileOpen = true; }
196 class TextFileDocument: public wxDocument
199 DECLARE_DYNAMIC_CLASS(TextFileDocument)
203 TextFileDocument(void)
204 : m_bBadFileOpen(false)
207 virtual ~TextFileDocument(void) {}
209 virtual bool OnSaveDocument(const wxString& filename);
210 virtual bool OnOpenDocument(const wxString& filename);
211 virtual bool IsModified(void) const;
213 wxTextCtrl* getTextCtrl();
215 TextFileView* getView() const;
216 bool getBadFileOpen() const { return m_bBadFileOpen; }
217 void setBadFileOpen() { m_bBadFileOpen = true; }