2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/FRED2/FREDDoc.h $
15 * FREDDoc.h : interface of the CFREDDoc class
16 * Document class for document/view architechure, which we don't really use in
17 * Fred, but MFC forces you do use like it or not. Handles loading/saving
18 * mainly. Most of the MFC related stuff is handled in FredView.
21 * Revision 1.2 2002/06/09 04:41:13 relnev
22 * added copyright header
24 * Revision 1.1.1.1 2002/05/03 03:28:12 root
28 * 2 10/07/98 6:28p Dave
29 * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
30 * Fred. Globalized mission and campaign file extensions. Removed Silent
31 * Threat specific code.
33 * 1 10/07/98 3:01p Dave
35 * 1 10/07/98 3:00p Dave
37 * 15 8/17/97 10:22p Hoffoss
38 * Fixed several bugs in Fred with Undo feature. In the process, recoded
41 * 14 8/13/97 5:49p Hoffoss
42 * Fixed bugs, made additions.
44 * 13 8/13/97 12:46p Hoffoss
45 * Added campaign error checker, accelerator table, and mission goal data
46 * listings to sexp tree right click menu.
48 * 12 6/09/97 4:57p Hoffoss
49 * Added autosave and undo to Fred.
51 * 11 6/05/97 6:10p Hoffoss
52 * Added features: Autosaving, object hiding. Also fixed some minor bugs.
54 * 10 5/21/97 5:42p Hoffoss
55 * Added features requested on Todo list.
57 * 9 2/20/97 4:03p Hoffoss
58 * Several ToDo items: new reinforcement clears arrival cue, reinforcement
59 * control from ship and wing dialogs, show grid toggle.
61 * 8 2/17/97 5:28p Hoffoss
62 * Checked RCS headers, added them were missing, changing description to
63 * something better, etc where needed.
65 * 14 2/12/97 12:25p Hoffoss
66 * Expanded on global error checker, added initial orders conflict
67 * checking and warning, added waypoint editor dialog and code.
69 * 13 1/30/97 2:24p Hoffoss
70 * Added remaining mission file structures and implemented load/save of
80 #include "missionsave.h"
82 #define MISSION_BACKUP_NAME "Backup"
84 #define US_WORLD_CHANGED 0x01
85 #define US_VIEW_CHANGED 0x02
87 class CFREDDoc : public CDocument
89 protected: // create from serialization only
91 DECLARE_DYNCREATE(CFREDDoc)
97 int load_mission(char *pathname);
98 int autosave(char *desc);
99 int save_matrix(matrix &m, FILE *fp);
100 int save_vector(vector &v, FILE *fp);
101 BOOL confirm_deleting;
102 BOOL show_capital_ships;
103 BOOL show_elevations;
106 BOOL show_misc_objects;
110 char mission_pathname[256];
114 CString undo_desc[BACKUP_DEPTH + 1];
117 // ClassWizard generated virtual function overrides
118 //{{AFX_VIRTUAL(CFREDDoc)
120 virtual BOOL OnNewDocument();
121 virtual void Serialize(CArchive& ar);
122 virtual void OnEditClearAll();
123 virtual void DeleteContents();
124 virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
125 virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
131 static void UpdateStatus(int flags = US_WORLD_CHANGED);
134 virtual void AssertValid() const;
135 virtual void Dump(CDumpContext &dc) const;
140 // Generated message map functions
142 //{{AFX_MSG(CFREDDoc)
143 afx_msg void OnEditDelete();
144 afx_msg void OnDuplicate();
145 afx_msg void OnEditCopy();
146 afx_msg void OnEditCut();
147 afx_msg void OnEditHold();
148 afx_msg void OnEditFetch();
149 afx_msg void OnEditPaste();
150 afx_msg void OnEditUndo();
151 afx_msg void OnFilePreferences();
152 afx_msg void OnFileSave();
153 afx_msg void OnFileNew();
154 afx_msg void editor_init_mission();
156 DECLARE_MESSAGE_MAP()
159 int save_waypoint_list(waypoint_list &w, FILE *fp);
160 int save_waypoints(FILE *fp);
161 int save_goals(FILE *fp);
162 int save_wings(FILE *fp);
163 int save_objects(FILE *fp);
164 int save_players(FILE *fp);
165 int save_briefing_info(FILE *fp);
166 int save_plot_info(FILE *fp);
167 int save_mission_info(FILE *FP);
170 extern int Local_modified;
171 extern int Undo_available;
172 extern int Undo_count;
173 extern CFREDDoc *FREDDoc_ptr;
175 void set_modified(BOOL arg = TRUE);
177 /////////////////////////////////////////////////////////////////////////////