1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _FREDDOC_H
13 #define _FREDDOC_H
14 
15 #include "ai/ailocal.h"
16 #include "MissionSave.h"
17 
18 #define MISSION_BACKUP_NAME	"Backup"
19 
20 #define	US_WORLD_CHANGED	0x01
21 #define	US_VIEW_CHANGED		0x02
22 
23 class CFREDDoc : public CDocument
24 {
25 protected: // create from serialization only
26 	CFREDDoc();
27 	DECLARE_DYNCREATE(CFREDDoc)
28 
29 // Attributes
30 public:
31 	int check_undo();
32 	int autoload();
33 	int load_mission(char *pathname, int flags = 0);
34 	int autosave(char *desc);
35 	int save_matrix(matrix &m, FILE *fp);
36 	int save_vector(vec3d &v, FILE *fp);
37 	BOOL confirm_deleting;
38 	BOOL show_capital_ships;
39 	BOOL show_elevations;
40 	BOOL show_fighters;
41 	BOOL show_grid;
42 	BOOL show_misc_objects;
43 	BOOL show_planets;
44 	BOOL show_waypoints;
45 	BOOL show_starfield;
46 	char mission_pathname[256];
47 
48 // Operations
49 public:
50 	CString undo_desc[BACKUP_DEPTH + 1];
51 
52 // Overrides
53 	// ClassWizard generated virtual function overrides
54 	//{{AFX_VIRTUAL(CFREDDoc)
55 	public:
56 	virtual BOOL OnNewDocument();
57 	virtual void Serialize(CArchive& ar);
58 	virtual void OnEditClearAll();
59 	virtual void DeleteContents();
60 	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
61 	virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
62 	//}}AFX_VIRTUAL
63 
64 // Implementation
65 public:
66 	virtual ~CFREDDoc();
67 	static void UpdateStatus(int flags = US_WORLD_CHANGED);
68 
69 #ifdef _DEBUG
70 	virtual void AssertValid() const;
71 	virtual void Dump(CDumpContext &dc) const;
72 #endif
73 
74 protected:
75 
76 // Generated message map functions
77 protected:
78 	//{{AFX_MSG(CFREDDoc)
79 	afx_msg void OnEditDelete();
80 	afx_msg void OnDuplicate();
81 	afx_msg void OnEditCopy();
82 	afx_msg void OnEditCut();
83 	afx_msg void OnEditHold();
84 	afx_msg void OnEditFetch();
85 	afx_msg void OnEditPaste();
86 	afx_msg void OnEditUndo();
87 	afx_msg void OnFilePreferences();
88 	afx_msg void OnFileSave();
89 	afx_msg void OnFileNew();
90 	afx_msg void editor_init_mission();
91 	afx_msg void OnFileImportFSM();
92 	afx_msg void OnFileImportWeapons();
93 	//}}AFX_MSG
94 	DECLARE_MESSAGE_MAP()
95 
96 private:
97 	int save_waypoint_list(waypoint_list &w, FILE *fp);
98 	int save_waypoints(FILE *fp);
99 	int save_goals(FILE *fp);
100 	int save_wings(FILE *fp);
101 	int save_objects(FILE *fp);
102 	int save_players(FILE *fp);
103 	int save_briefing_info(FILE *fp);
104 	int save_plot_info(FILE *fp);
105 	int save_mission_info(FILE *FP);
106 	void recreate_dialogs();
107 };
108 
109 extern int Local_modified;
110 extern int Undo_available;
111 extern int Undo_count;
112 extern CFREDDoc *FREDDoc_ptr;
113 
114 void set_modified(BOOL arg = TRUE);
115 
116 /////////////////////////////////////////////////////////////////////////////
117 
118 #endif
119