6db956883128ae8b115b89de9a7c9d9408e2d2ff
[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.15 2001/01/28 19:10:18 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
55 public:
56     virtual bool OnSaveDocument (const wxString& filename);
57     virtual bool OnOpenDocument (const wxString& filename);
58     virtual bool IsModified () const;
59     virtual void Modify (bool mod);
60     
61     ImageFileDocument () {}
62     virtual ~ImageFileDocument () {}
63
64     const ImageFile& getImageFile() const { return m_imageFile; }
65
66     ImageFile& getImageFile() { return m_imageFile; }
67     ImageFileView* getView() const;
68 };
69
70
71 class ProjectionFileDocument: public wxDocument
72 {
73 private:
74     DECLARE_DYNAMIC_CLASS(ProjectionFileDocument)
75     Projections m_projectionFile;
76
77 public:
78     virtual bool OnSaveDocument (const wxString& filename);
79     virtual bool OnOpenDocument (const wxString& filename);
80     virtual bool IsModified () const;
81     virtual void Modify (bool mod);
82     
83     ProjectionFileDocument () {}
84     virtual ~ProjectionFileDocument () {}
85
86     const Projections& getProjections () const  { return m_projectionFile; }
87     Projections& getProjections ()      { return m_projectionFile; }
88
89     ProjectionFileView* getView() const;
90 };
91
92
93 class PhantomFileDocument: public wxDocument
94 {
95 private:
96     DECLARE_DYNAMIC_CLASS(PhantomFileDocument)
97     Phantom m_phantom;
98     int m_idPhantom;
99     wxString m_namePhantom;
100
101 public:
102     PhantomFileDocument () 
103         : m_idPhantom(Phantom::PHM_INVALID)
104     {}
105
106     virtual ~PhantomFileDocument () 
107     {}
108
109     const int getPhantomID () const { return m_idPhantom; }
110
111     const wxString& getPhantomName () const { return m_namePhantom; }
112
113     const Phantom& getPhantom () const  { return m_phantom; }
114
115     Phantom& getPhantom ()      { return m_phantom; }
116
117     virtual bool OnOpenDocument (const wxString& filename);
118     virtual bool OnSaveDocument (const wxString& filename);
119     virtual bool IsModified () const;
120     virtual void Modify (bool mod);
121     PhantomFileView* getView() const;
122 };
123
124
125 class PlotFileDocument: public wxDocument
126 {
127 private:
128     DECLARE_DYNAMIC_CLASS(PlotFileDocument)
129     PlotFile m_plot;
130     wxString m_namePlot;
131
132 public:
133     PlotFileDocument () 
134         {}
135
136     virtual ~PlotFileDocument () 
137         {}
138
139     const wxString& getPlotName () const
140         { return m_namePlot; }
141
142     const PlotFile& getPlotFile () const
143         { return m_plot; }
144
145     PlotFile& getPlotFile ()
146         { return m_plot; }
147
148     virtual bool OnOpenDocument (const wxString& filename);
149     virtual bool OnSaveDocument (const wxString& filename);
150     virtual bool IsModified () const;
151     virtual void Modify (bool mod);
152     PlotFileView* getView() const;
153 };
154
155 #include "views.h"
156
157 class TextFileDocument: public wxDocument
158 {
159  private:
160   DECLARE_DYNAMIC_CLASS(TextFileDocument)
161
162  public:
163   TextFileDocument(void) {}
164   virtual ~TextFileDocument(void) {}
165
166   virtual bool OnSaveDocument(const wxString& filename);
167   virtual bool OnOpenDocument(const wxString& filename);
168   virtual bool IsModified(void) const;
169
170   wxTextCtrl* getTextCtrl()
171   { return dynamic_cast<TextFileView*>(GetFirstView())->getTextCtrl(); }
172
173   TextFileView* getView() const;
174 };
175
176
177 #endif