]> icculus.org git repositories - taylor/freespace2.git/blob - include/freddoc.h
Initial revision
[taylor/freespace2.git] / include / freddoc.h
1 /*
2  * $Logfile: /Freespace2/code/FRED2/FREDDoc.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * FREDDoc.h : interface of the CFREDDoc class
8  * Document class for document/view architechure, which we don't really use in
9  * Fred, but MFC forces you do use like it or not.  Handles loading/saving
10  * mainly.  Most of the MFC related stuff is handled in FredView.
11  *
12  * $Log$
13  * Revision 1.1  2002/05/03 03:28:12  root
14  * Initial revision
15  *
16  * 
17  * 2     10/07/98 6:28p Dave
18  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
19  * Fred. Globalized mission and campaign file extensions. Removed Silent
20  * Threat specific code.
21  * 
22  * 1     10/07/98 3:01p Dave
23  * 
24  * 1     10/07/98 3:00p Dave
25  * 
26  * 15    8/17/97 10:22p Hoffoss
27  * Fixed several bugs in Fred with Undo feature.  In the process, recoded
28  * a lot of CFile.cpp.
29  * 
30  * 14    8/13/97 5:49p Hoffoss
31  * Fixed bugs, made additions.
32  * 
33  * 13    8/13/97 12:46p Hoffoss
34  * Added campaign error checker, accelerator table, and mission goal data
35  * listings to sexp tree right click menu.
36  * 
37  * 12    6/09/97 4:57p Hoffoss
38  * Added autosave and undo to Fred.
39  * 
40  * 11    6/05/97 6:10p Hoffoss
41  * Added features: Autosaving, object hiding.  Also fixed some minor bugs.
42  * 
43  * 10    5/21/97 5:42p Hoffoss
44  * Added features requested on Todo list.
45  * 
46  * 9     2/20/97 4:03p Hoffoss
47  * Several ToDo items: new reinforcement clears arrival cue, reinforcement
48  * control from ship and wing dialogs, show grid toggle.
49  * 
50  * 8     2/17/97 5:28p Hoffoss
51  * Checked RCS headers, added them were missing, changing description to
52  * something better, etc where needed.
53  * 
54  * 14    2/12/97 12:25p Hoffoss
55  * Expanded on global error checker, added initial orders conflict
56  * checking and warning, added waypoint editor dialog and code.
57  * 
58  * 13    1/30/97 2:24p Hoffoss
59  * Added remaining mission file structures and implemented load/save of
60  * them.
61  *
62  * $NoKeywords: $
63  */
64
65 #ifndef _FREDDOC_H
66 #define _FREDDOC_H
67
68 #include "ailocal.h"
69 #include "missionsave.h"
70
71 #define MISSION_BACKUP_NAME     "Backup"
72
73 #define US_WORLD_CHANGED        0x01
74 #define US_VIEW_CHANGED         0x02
75
76 class CFREDDoc : public CDocument
77 {
78 protected: // create from serialization only
79         CFREDDoc();
80         DECLARE_DYNCREATE(CFREDDoc)
81
82 // Attributes
83 public:
84         int check_undo();
85         int autoload();
86         int load_mission(char *pathname);
87         int autosave(char *desc);
88         int save_matrix(matrix &m, FILE *fp);
89         int save_vector(vector &v, FILE *fp);
90         BOOL confirm_deleting;
91         BOOL show_capital_ships;
92         BOOL show_elevations;
93         BOOL show_fighters;
94         BOOL show_grid;
95         BOOL show_misc_objects;
96         BOOL show_planets;
97         BOOL show_waypoints;
98         BOOL show_starfield;
99         char mission_pathname[256];
100
101 // Operations
102 public:
103         CString undo_desc[BACKUP_DEPTH + 1];
104
105 // Overrides
106         // ClassWizard generated virtual function overrides
107         //{{AFX_VIRTUAL(CFREDDoc)
108         public:
109         virtual BOOL OnNewDocument();
110         virtual void Serialize(CArchive& ar);
111         virtual void OnEditClearAll();
112         virtual void DeleteContents();
113         virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
114         virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
115         //}}AFX_VIRTUAL
116
117 // Implementation
118 public:
119         virtual ~CFREDDoc();
120         static void UpdateStatus(int flags = US_WORLD_CHANGED);
121
122 #ifdef _DEBUG
123         virtual void AssertValid() const;
124         virtual void Dump(CDumpContext &dc) const;
125 #endif
126
127 protected:
128
129 // Generated message map functions
130 protected:
131         //{{AFX_MSG(CFREDDoc)
132         afx_msg void OnEditDelete();
133         afx_msg void OnDuplicate();
134         afx_msg void OnEditCopy();
135         afx_msg void OnEditCut();
136         afx_msg void OnEditHold();
137         afx_msg void OnEditFetch();
138         afx_msg void OnEditPaste();
139         afx_msg void OnEditUndo();
140         afx_msg void OnFilePreferences();
141         afx_msg void OnFileSave();
142         afx_msg void OnFileNew();
143         afx_msg void editor_init_mission();
144         //}}AFX_MSG
145         DECLARE_MESSAGE_MAP()
146
147 private:
148         int save_waypoint_list(waypoint_list &w, FILE *fp);
149         int save_waypoints(FILE *fp);
150         int save_goals(FILE *fp);
151         int save_wings(FILE *fp);
152         int save_objects(FILE *fp);
153         int save_players(FILE *fp);
154         int save_briefing_info(FILE *fp);
155         int save_plot_info(FILE *fp);
156         int save_mission_info(FILE *FP);
157 };
158
159 extern int Local_modified;
160 extern int Undo_available;
161 extern int Undo_count;
162 extern CFREDDoc *FREDDoc_ptr;
163
164 void set_modified(BOOL arg = TRUE);
165
166 /////////////////////////////////////////////////////////////////////////////
167
168 #endif
169