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/EventEditor.h $
15 * Event editor dialog box class and event tree class (used for dialog)
18 * Revision 1.2 2002/06/09 04:41:12 relnev
19 * added copyright header
21 * Revision 1.1.1.1 2002/05/03 03:28:12 root
25 * 5 8/26/99 8:52p Dave
26 * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
28 * 4 5/04/99 5:21p Andsager
30 * 3 2/17/99 2:11p Dave
31 * First full run of squad war. All freespace and tracker side stuff
34 * 2 10/07/98 6:28p Dave
35 * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
36 * Fred. Globalized mission and campaign file extensions. Removed Silent
37 * Threat specific code.
39 * 1 10/07/98 3:01p Dave
41 * 1 10/07/98 3:00p Dave
43 * 27 5/15/98 5:51p Hoffoss
44 * Fixed escape key and cancel button bugs.
46 * 26 4/22/98 9:56a Sandeep
48 * 25 4/20/98 4:40p Hoffoss
49 * Added a button to 4 editors to play the chosen wave file.
51 * 24 4/03/98 5:20p Hoffoss
52 * Changed code so that changing a message's wave file will update the
53 * persona as well, if the wave file has the proper prefix.
55 * 23 2/16/98 6:25p Hoffoss
56 * Did major rework of the whole right_clicked() handler to simplify it
57 * all, break it down and make it more flexible. Should be a lot easier
58 * to work with from now on.
60 * 22 2/16/98 2:42p Hoffoss
61 * Added new code in preparation to simplify the sexp_tree monster.
62 * Checking in code now as a good foundation point that I can revert back
65 * 21 1/08/98 11:18a Hoffoss
66 * Fixed several bugs in new Event Editor.
68 * 20 1/07/98 5:58p Hoffoss
69 * Combined message editor into event editor.
71 * 19 1/06/98 8:25p Hoffoss
72 * Added insert event functionality to event editor.
74 * 18 10/10/97 6:21p Hoffoss
75 * Put in Fred support for training object list editing.
77 * 17 10/09/97 1:03p Hoffoss
78 * Renaming events or goals now updates sexp references as well.
80 * 16 9/30/97 10:01a Hoffoss
81 * Added event chaining support to Fred and FreeSpace.
83 * 15 8/12/97 3:33p Hoffoss
84 * Fixed the "press cancel to go to reference" code to work properly.
86 * 14 7/30/97 5:23p Hoffoss
87 * Removed Sexp tree verification code, since it duplicates normal sexp
88 * verification, and is just another set of code to keep maintained.
90 * 13 7/25/97 3:05p Allender
91 * added score field to goals and events editor
93 * 12 7/24/97 12:45p Hoffoss
94 * Added sexp help system to sexp trees and some dialog boxes.
96 * 11 7/17/97 4:10p Hoffoss
97 * Added drag and drop to sexp trees for reordering root items.
99 * 10 7/15/97 10:30a Allender
100 * added repeat count and interval time to event editor. For use in
101 * repeating events at regular intervals
103 * 9 6/02/97 8:47p Hoffoss
104 * Fixed bug with inserting an operator at root position, but under a
107 * 8 5/20/97 2:28p Hoffoss
108 * Added message box queries for close window operation on all modal
111 * 7 5/01/97 4:12p Hoffoss
112 * Added return handling to dialogs.
114 * 6 4/17/97 2:01p Hoffoss
115 * All dialog box window states are saved between sessions now.
117 * 5 4/11/97 10:10a Hoffoss
118 * Name fields supported by Fred for Events and Mission Goals.
120 * 4 4/07/97 3:48p Hoffoss
121 * Event editor now supports a sporty new delete button!
123 * 3 1/22/97 11:01a Hoffoss
124 * Many bug fixes (those pointed out by Mark during Fred testing trying to
127 * 2 1/13/97 4:54p Hoffoss
128 * Added event editor.
133 #ifndef _EVENTEDITOR_H
134 #define _EVENTEDITOR_H
136 #include "sexp_tree.h"
137 #include "missiongoals.h"
138 #include "missionmessage.h"
140 #define MAX_SEARCH_MESSAGE_DEPTH 5 // maximum search number of event nodes with message text
142 class sexp_event_tree : public sexp_tree
145 int load_sub_tree(int index);
146 int get_new_node_position();
149 /////////////////////////////////////////////////////////////////////////////
150 // event_editor dialog
152 class event_editor : public CDialog
156 void update_persona();
158 char *current_message_name(int index);
159 char *get_message_list_item(int i);
160 int save_message(int num);
161 void update_cur_message();
162 HTREEITEM get_event_handle(int num);
163 void reset_event(int num, HTREEITEM after);
164 void save_event(int e);
165 void swap_handler(int node1, int node2);
166 void insert_handler(int old, int node);
167 int query_modified();
170 int handler(int code, int node, char *str = NULL);
174 int select_sexp_node;
175 event_editor(CWnd* pParent = NULL); // standard constructor
178 //{{AFX_DATA(event_editor)
179 enum { IDD = IDD_EVENT_EDITOR };
180 sexp_event_tree m_event_tree;
187 CString m_obj_key_text;
188 CString m_avi_filename;
189 CString m_message_name;
190 CString m_message_text;
192 CString m_wave_filename;
196 int m_last_message_node;
202 // ClassWizard generated virtual function overrides
203 //{{AFX_VIRTUAL(event_editor)
205 virtual BOOL DestroyWindow();
207 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
213 // Generated message map functions
214 //{{AFX_MSG(event_editor)
215 virtual BOOL OnInitDialog();
216 afx_msg void OnRclickEventTree(NMHDR* pNMHDR, LRESULT* pResult);
217 afx_msg void OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
218 afx_msg void OnEndlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
219 afx_msg void OnButtonNewEvent();
220 afx_msg void OnDelete();
222 afx_msg void OnClose();
223 afx_msg void OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult);
224 afx_msg void OnUpdateRepeatCount();
225 afx_msg void OnChained();
226 afx_msg void OnInsert();
227 afx_msg void OnSelchangeMessageList();
228 afx_msg void OnNewMsg();
229 afx_msg void OnDeleteMsg();
230 afx_msg void OnBrowseAvi();
231 afx_msg void OnBrowseWave();
232 afx_msg void OnSelchangeWaveFilename();
233 afx_msg void OnPlay();
234 afx_msg void OnUpdate();
235 afx_msg void On_Cancel();
236 afx_msg void OnSelchangeTeam();
237 afx_msg void OnSelchangeMessageTeam();
238 afx_msg void OnDblclkMessageList();
240 DECLARE_MESSAGE_MAP()
244 void update_cur_event();
246 int m_sig[MAX_MISSION_EVENTS];
247 mission_event m_events[MAX_MISSION_EVENTS];
249 MMessage m_messages[MAX_MISSION_MESSAGES];
250 int m_msg_sig[MAX_MISSION_MESSAGES];
253 extern event_editor *Event_editor_dlg; // global reference needed by event tree class