File: eventeditor.h

package info (click to toggle)
freespace2 25.0.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 47,232 kB
  • sloc: cpp: 657,500; ansic: 22,305; sh: 293; python: 200; makefile: 198; xml: 181
file content (167 lines) | stat: -rw-r--r-- 4,483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * Copyright (C) Volition, Inc. 1999.  All rights reserved.
 *
 * All source code herein is the property of Volition, Inc. You may not sell 
 * or otherwise commercially exploit the source or things you created based on the 
 * source.
 *
*/



#ifndef _EVENTEDITOR_H
#define _EVENTEDITOR_H

#include "Sexp_tree.h"
#include "mission/missiongoals.h"
#include "mission/missionmessage.h"


class event_sexp_tree : public sexp_tree
{
public:
	// for tooltips
	INT_PTR OnToolHitTest(CPoint point, TOOLINFO *pTI) const;
	BOOL OnToolTipText(UINT id, NMHDR * pNMHDR, LRESULT *pResult);

	void edit_comment(HTREEITEM h);
	void edit_bg_color(HTREEITEM h);

protected:
	virtual void PreSubclassWindow();
	virtual void OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult);

	CStringA m_tooltiptextA;
	CStringW m_tooltiptextW;

	DECLARE_MESSAGE_MAP()
};

void event_annotation_prune();
int event_annotation_lookup(HTREEITEM handle);
void event_annotation_swap_image(event_sexp_tree *tree, HTREEITEM handle, int annotation_index);
void event_annotation_swap_image(event_sexp_tree *tree, HTREEITEM handle, event_annotation &ea);


/////////////////////////////////////////////////////////////////////////////
// event_editor dialog

class event_editor : public CDialog
{
// Construction
public:
	void update_persona();
	void save();
	char *current_message_name(int index);
	char *get_message_list_item(int i);
	int save_message(int num);
	void update_cur_message();
	HTREEITEM get_event_handle(int num);
	int get_event_num(HTREEITEM handle);
	void reset_event(int num, HTREEITEM after);
	void save_event(int e);
	void move_handler(int node1, int node2, bool insert_before);
	void insert_handler(int old, int node);
	int query_modified();
	void OnOK();		// default MFC OK behavior
	void OnCancel();	// default MFC Cancel behavior
	int handler(int code, int node, const char *str = nullptr);
	void create_tree();
	void load_tree();
	int modified;
	int select_sexp_node;
	event_editor(CWnd* pParent = NULL);   // standard constructor

	void populate_path(event_annotation &ea, HTREEITEM h);
	HTREEITEM traverse_path(const event_annotation &ea);

// Dialog Data
	//{{AFX_DATA(event_editor)
	enum { IDD = IDD_EVENT_EDITOR };
	event_sexp_tree	m_event_tree;
	int		m_repeat_count;
	int		m_trigger_count;
	UINT	m_interval;
	int		m_event_score;
	int		m_chain_delay;
	BOOL	m_chained;
	BOOL	m_use_msecs;
	CString	m_obj_text;
	CString	m_obj_key_text;
	CString	m_avi_filename;
	CString	m_message_name;
	CString	m_message_text;
	CString m_message_note;
	int		m_persona;
	CString	m_wave_filename;
	int		m_cur_msg, m_cur_msg_old;
	int		m_team;
	int		m_message_team;
	int		m_last_message_node;
	int		m_log_true;
	int		m_log_false;
	int		m_log_always_false;
	int		m_log_1st_repeat;
	int		m_log_last_repeat;
	int		m_log_1st_trigger;
	int		m_log_last_trigger;
	int		m_log_state_change;
	//}}AFX_DATA

	CBitmap m_play_bm;

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(event_editor)
	public:
	virtual BOOL DestroyWindow();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	// Generated message map functions
	//{{AFX_MSG(event_editor)
	virtual BOOL OnInitDialog();
	afx_msg void OnRclickEventTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnEndlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnButtonNewEvent();
	afx_msg void OnDelete();
	afx_msg void OnButtonOk();
	afx_msg void OnButtonCancel();
	afx_msg void OnClose();
	afx_msg void OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnUpdateRepeatCount();
	afx_msg void OnUpdateTriggerCount();
	afx_msg void OnChained();
	afx_msg void OnInsert();
	afx_msg void OnSelchangeMessageList();
	afx_msg void OnNewMsg();
	afx_msg void OnDeleteMsg();
	afx_msg void OnMsgNote();
	afx_msg void OnBrowseAvi();
	afx_msg void OnBrowseWave();
	afx_msg void OnSelchangeWaveFilename();
	afx_msg void OnPlay();
	afx_msg void OnUpdateStuff();
	afx_msg void OnSelchangeTeam();
	afx_msg void OnSelchangeMessageTeam();
	afx_msg void OnDblclkMessageList();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	int cur_event;
	void update_cur_event();
	SCP_vector<int> m_sig;
	SCP_vector<mission_event> m_events;
	SCP_vector<MMessage> m_messages;
	int m_wave_id;
};

extern event_editor *Event_editor_dlg; // global reference needed by event tree class

#endif