]> icculus.org git repositories - taylor/freespace2.git/blob - include/eventeditor.h
Initial revision
[taylor/freespace2.git] / include / eventeditor.h
1 /*
2  * $Logfile: /Freespace2/code/Fred2/EventEditor.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Event editor dialog box class and event tree class (used for dialog)
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 5     8/26/99 8:52p Dave
15  * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
16  * 
17  * 4     5/04/99 5:21p Andsager
18  * 
19  * 3     2/17/99 2:11p Dave
20  * First full run of squad war. All freespace and tracker side stuff
21  * works.
22  * 
23  * 2     10/07/98 6:28p Dave
24  * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
25  * Fred. Globalized mission and campaign file extensions. Removed Silent
26  * Threat specific code.
27  * 
28  * 1     10/07/98 3:01p Dave
29  * 
30  * 1     10/07/98 3:00p Dave
31  * 
32  * 27    5/15/98 5:51p Hoffoss
33  * Fixed escape key and cancel button bugs.
34  * 
35  * 26    4/22/98 9:56a Sandeep
36  * 
37  * 25    4/20/98 4:40p Hoffoss
38  * Added a button to 4 editors to play the chosen wave file.
39  * 
40  * 24    4/03/98 5:20p Hoffoss
41  * Changed code so that changing a message's wave file will update the
42  * persona as well, if the wave file has the proper prefix.
43  * 
44  * 23    2/16/98 6:25p Hoffoss
45  * Did major rework of the whole right_clicked() handler to simplify it
46  * all, break it down and make it more flexible.  Should be a lot easier
47  * to work with from now on.
48  * 
49  * 22    2/16/98 2:42p Hoffoss
50  * Added new code in preparation to simplify the sexp_tree monster.
51  * Checking in code now as a good foundation point that I can revert back
52  * to if needed.
53  * 
54  * 21    1/08/98 11:18a Hoffoss
55  * Fixed several bugs in new Event Editor.
56  * 
57  * 20    1/07/98 5:58p Hoffoss
58  * Combined message editor into event editor.
59  * 
60  * 19    1/06/98 8:25p Hoffoss
61  * Added insert event functionality to event editor.
62  * 
63  * 18    10/10/97 6:21p Hoffoss
64  * Put in Fred support for training object list editing.
65  * 
66  * 17    10/09/97 1:03p Hoffoss
67  * Renaming events or goals now updates sexp references as well.
68  * 
69  * 16    9/30/97 10:01a Hoffoss
70  * Added event chaining support to Fred and FreeSpace.
71  * 
72  * 15    8/12/97 3:33p Hoffoss
73  * Fixed the "press cancel to go to reference" code to work properly.
74  * 
75  * 14    7/30/97 5:23p Hoffoss
76  * Removed Sexp tree verification code, since it duplicates normal sexp
77  * verification, and is just another set of code to keep maintained.
78  * 
79  * 13    7/25/97 3:05p Allender
80  * added score field to goals and events editor
81  * 
82  * 12    7/24/97 12:45p Hoffoss
83  * Added sexp help system to sexp trees and some dialog boxes.
84  * 
85  * 11    7/17/97 4:10p Hoffoss
86  * Added drag and drop to sexp trees for reordering root items.
87  * 
88  * 10    7/15/97 10:30a Allender
89  * added repeat count and interval time to event editor.  For use in
90  * repeating events at regular intervals
91  * 
92  * 9     6/02/97 8:47p Hoffoss
93  * Fixed bug with inserting an operator at root position, but under a
94  * label.
95  * 
96  * 8     5/20/97 2:28p Hoffoss
97  * Added message box queries for close window operation on all modal
98  * dialog boxes.
99  * 
100  * 7     5/01/97 4:12p Hoffoss
101  * Added return handling to dialogs.
102  * 
103  * 6     4/17/97 2:01p Hoffoss
104  * All dialog box window states are saved between sessions now.
105  * 
106  * 5     4/11/97 10:10a Hoffoss
107  * Name fields supported by Fred for Events and Mission Goals.
108  * 
109  * 4     4/07/97 3:48p Hoffoss
110  * Event editor now supports a sporty new delete button!
111  * 
112  * 3     1/22/97 11:01a Hoffoss
113  * Many bug fixes (those pointed out by Mark during Fred testing trying to
114  * make mission 5).
115  * 
116  * 2     1/13/97 4:54p Hoffoss
117  * Added event editor.
118  *
119  * $NoKeywords: $
120  */
121
122 #ifndef _EVENTEDITOR_H
123 #define _EVENTEDITOR_H
124
125 #include "sexp_tree.h"
126 #include "missiongoals.h"
127 #include "missionmessage.h"
128
129 #define MAX_SEARCH_MESSAGE_DEPTH                5               // maximum search number of event nodes with message text
130
131 class sexp_event_tree : public sexp_tree
132 {
133 public:
134         int load_sub_tree(int index);
135         int get_new_node_position();
136 };
137
138 /////////////////////////////////////////////////////////////////////////////
139 // event_editor dialog
140
141 class event_editor : public CDialog
142 {
143 // Construction
144 public:
145         void update_persona();
146         void save();
147         char *current_message_name(int index);
148         char *get_message_list_item(int i);
149         int save_message(int num);
150         void update_cur_message();
151         HTREEITEM get_event_handle(int num);
152         void reset_event(int num, HTREEITEM after);
153         void save_event(int e);
154         void swap_handler(int node1, int node2);
155         void insert_handler(int old, int node);
156         int query_modified();
157         void OnOK();
158         void OnCancel();
159         int handler(int code, int node, char *str = NULL);
160         void create_tree();
161         void load_tree();
162         int modified;
163         int select_sexp_node;
164         event_editor(CWnd* pParent = NULL);   // standard constructor
165
166 // Dialog Data
167         //{{AFX_DATA(event_editor)
168         enum { IDD = IDD_EVENT_EDITOR };
169         sexp_event_tree m_event_tree;
170         UINT    m_repeat_count;
171         UINT    m_interval;
172         int             m_event_score;
173         int             m_chain_delay;
174         BOOL    m_chained;
175         CString m_obj_text;
176         CString m_obj_key_text;
177         CString m_avi_filename;
178         CString m_message_name;
179         CString m_message_text;
180         int             m_persona;
181         CString m_wave_filename;
182         int             m_cur_msg;
183         int             m_team;
184         int             m_message_team;
185         int             m_last_message_node;
186         //}}AFX_DATA
187
188         CBitmap m_play_bm;
189
190 // Overrides
191         // ClassWizard generated virtual function overrides
192         //{{AFX_VIRTUAL(event_editor)
193         public:
194         virtual BOOL DestroyWindow();
195         protected:
196         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
197         //}}AFX_VIRTUAL
198
199 // Implementation
200 protected:
201
202         // Generated message map functions
203         //{{AFX_MSG(event_editor)
204         virtual BOOL OnInitDialog();
205         afx_msg void OnRclickEventTree(NMHDR* pNMHDR, LRESULT* pResult);
206         afx_msg void OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
207         afx_msg void OnEndlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
208         afx_msg void OnButtonNewEvent();
209         afx_msg void OnDelete();
210         afx_msg void OnOk();
211         afx_msg void OnClose();
212         afx_msg void OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult);
213         afx_msg void OnUpdateRepeatCount();
214         afx_msg void OnChained();
215         afx_msg void OnInsert();
216         afx_msg void OnSelchangeMessageList();
217         afx_msg void OnNewMsg();
218         afx_msg void OnDeleteMsg();
219         afx_msg void OnBrowseAvi();
220         afx_msg void OnBrowseWave();
221         afx_msg void OnSelchangeWaveFilename();
222         afx_msg void OnPlay();
223         afx_msg void OnUpdate();
224         afx_msg void On_Cancel();
225         afx_msg void OnSelchangeTeam();
226         afx_msg void OnSelchangeMessageTeam();
227         afx_msg void OnDblclkMessageList();
228         //}}AFX_MSG
229         DECLARE_MESSAGE_MAP()
230
231 private:
232         int cur_event;
233         void update_cur_event();
234         int m_num_events;
235         int m_sig[MAX_MISSION_EVENTS];
236         mission_event m_events[MAX_MISSION_EVENTS];
237         int m_num_messages;
238         MMessage m_messages[MAX_MISSION_MESSAGES];
239         int m_msg_sig[MAX_MISSION_MESSAGES];
240 };
241
242 extern event_editor *Event_editor_dlg; // global reference needed by event tree class
243
244 #endif
245