r470: Fixed shutdown error, take 3
[ctsim.git] / src / docs.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          docs.h
5 **   Purpose:       Header file for Document 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-2001 Kevin Rosenberg
11 **
12 **  $Id: docs.h,v 1.16 2001/01/30 02:20:50 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 __DOCSH__
33 #define __DOCSH__
34
35 #include "wx/docview.h"
36
37 // #include "views.h"
38 #include "imagefile.h"
39 #include "phantom.h"
40 #include "projections.h"
41 #include "plotfile.h"
42
43 class ProjectionFileView;
44 class PhantomFileView;
45 class ImageFileView;
46 class PlotFileView;
47 class TextFileView;
48
49 class ImageFileDocument: public wxDocument
50 {
51 private:
52     DECLARE_DYNAMIC_CLASS(ImageFileDocument)
53     ImageFile m_imageFile;
54     bool m_bBadFileOpen;
55
56 public:
57     virtual bool OnSaveDocument (const wxString& filename);
58     virtual bool OnOpenDocument (const wxString& filename);
59     virtual bool IsModified () const;
60     virtual void Modify (bool mod);
61     
62     ImageFileDocument () 
63       : m_bBadFileOpen(false)
64     {}
65
66     virtual ~ImageFileDocument () {}
67
68     const ImageFile& getImageFile() const { return m_imageFile; }
69
70     ImageFile& getImageFile() { return m_imageFile; }
71     ImageFileView* getView() const;
72     bool getBadFileOpen() const { return m_bBadFileOpen; }
73 };
74
75
76 class ProjectionFileDocument: public wxDocument
77 {
78 private:
79     DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
80     Projections m_projectionFile;
81     bool m_bBadFileOpen;
82
83 public:
84     virtual bool OnSaveDocument (const wxString& filename);
85     virtual bool OnOpenDocument (const wxString& filename);
86     virtual bool IsModified () const;
87     virtual void Modify (bool mod);
88     
89     ProjectionFileDocument () 
90           : m_bBadFileOpen(false)
91     {}
92
93     virtual ~ProjectionFileDocument () {}
94
95     const Projections& getProjections () const  { return m_projectionFile; }
96     Projections& getProjections ()      { return m_projectionFile; }
97
98     ProjectionFileView* getView() const;
99     bool getBadFileOpen() const { return m_bBadFileOpen; }
100 };
101
102
103 class PhantomFileDocument: public wxDocument
104 {
105 private:
106     DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
107     Phantom m_phantom;
108     int m_idPhantom;
109     wxString m_namePhantom;
110     bool m_bBadFileOpen;
111
112 public:
113     PhantomFileDocument () 
114         : m_idPhantom(Phantom::PHM_INVALID), m_bBadFileOpen(false)
115     {}
116
117     virtual ~PhantomFileDocument () 
118     {}
119
120     const int getPhantomID () const { return m_idPhantom; }
121
122     const wxString& getPhantomName () const { return m_namePhantom; }
123
124     const Phantom& getPhantom () const  { return m_phantom; }
125
126     Phantom& getPhantom ()      { return m_phantom; }
127
128     virtual bool OnOpenDocument (const wxString& filename);
129     virtual bool OnSaveDocument (const wxString& filename);
130     virtual bool IsModified () const;
131     virtual void Modify (bool mod);
132     PhantomFileView* getView() const;
133     bool getBadFileOpen() const { return m_bBadFileOpen; }
134 };
135
136
137 class PlotFileDocument: public wxDocument
138 {
139 private:
140     DECLARE_DYNAMIC_CLASS(PlotFileDocument)
141     PlotFile m_plot;
142     wxString m_namePlot;
143     bool m_bBadFileOpen;
144
145 public:
146     PlotFileDocument () 
147       : m_bBadFileOpen(false)
148     {}
149
150     virtual ~PlotFileDocument () 
151         {}
152
153     const wxString& getPlotName () const
154         { return m_namePlot; }
155
156     const PlotFile& getPlotFile () const
157         { return m_plot; }
158
159     PlotFile& getPlotFile ()
160         { return m_plot; }
161
162     virtual bool OnOpenDocument (const wxString& filename);
163     virtual bool OnSaveDocument (const wxString& filename);
164     virtual bool IsModified () const;
165     virtual void Modify (bool mod);
166     PlotFileView* getView() const;
167     bool getBadFileOpen() const { return m_bBadFileOpen; }
168 };
169
170
171 class TextFileDocument: public wxDocument
172 {
173  private:
174   DECLARE_DYNAMIC_CLASS(TextFileDocument)
175   bool m_bBadFileOpen;
176
177  public:
178   TextFileDocument(void) 
179         : m_bBadFileOpen(false)
180   {}
181
182   virtual ~TextFileDocument(void) {}
183
184   virtual bool OnSaveDocument(const wxString& filename);
185   virtual bool OnOpenDocument(const wxString& filename);
186   virtual bool IsModified(void) const;
187
188   wxTextCtrl* getTextCtrl();
189
190   TextFileView* getView() const;
191   bool getBadFileOpen() const { return m_bBadFileOpen; }
192 };
193
194
195 #endif