File: fred.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 (212 lines) | stat: -rw-r--r-- 5,819 bytes parent folder | download | duplicates (2)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#ifndef _FRED_H
#define _FRED_H
/*
 * 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 __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif

#include "BgBitmapDlg.h"
#include "BriefingEditorDlg.h"
#include "resource.h"
#include "ShipEditorDlg.h"
#include "WaypointPathDlg.h"
#include "JumpNodeDlg.h"
#include "wing_editor.h"
#include "musicplayerdlg.h"
#include "customdatadlg.h"
#include "customstringsdlg.h"

#include "globalincs/systemvars.h"
#include "globalincs/systemvars.h"
#include "mission/missionparse.h"

#define MODIFY(a, b) do {   \
	if (a != (b)) {         \
		a = (b);            \
		set_modified();     \
	}                       \
} while(false)

#define F_RENDER_SHIP_MODELS 0x01
#define F_RENDER_SHIP_ICONS  0x02

// user interface types
#define HOFFOSS_INTERFACE  1
#define ALLENDER_INTERFACE 2

typedef struct window_data
{
	WINDOWPLACEMENT p;
	int visible;
	int valid;
	int processed;
} window_data;

/**
 * @class CFREDApp
 *
 * @breif The FRED Application class
 */
class CFREDApp : public CWinApp
{
public:
	/**
	 * @brief Record the relavent window data for the given window
	 *
	 * @param[out] wndd struct associated with the window
	 * @param[in]  wnd  Window to record data from
	 */
	void record_window_data(window_data *wndd, CWnd *wnd);

	/**
	 * @brief Initializes the given window
	 *
	 * @param[in,out] wndd   The input window's data
	 * @param[in,out] wnd    The window to init
	 * @param[in]     adjust Height, in pixels, to adjust the window by
	 * @param[in]     pre    Pre-placement?
	 *
	 * @returns  0 If successful, or
	 * @returns -1 If pre is nonzero and the window is not visible, or
	 * @returns -2 If the window has been already initialized
	 */
	int init_window(window_data *wndd, CWnd *wnd, int adjust = 0, int pre = 0);
	
	/**
	 * @brief Read window data from the .ini file
	 *
	 * @param[in]  Name of the window to read
	 * @param[out] wndd Window data to read to
	 */
	void read_window(char *name, window_data *wndd);

	/**
	 * @brief Write window data to the .ini file
	 * 
	 * @param[in] name Name of the window to write
	 * @param[in] wndd Window data to write from
	 */
	void write_window(char *name, window_data *wndd);

	/**
	 * @brief Writes preferences the to .ini file.
	 *
	 * @param[in] degree If nonzero, also write window data
	 */
	void write_ini_file(int degree = 0);

	/**
	 * @brief Constructor
	 */
	CFREDApp();

	/**
	 * @brief Deconstcutor
	 */
	~CFREDApp();

	//{{AFX_VIRTUAL(CFREDApp)
	/**
	 * @brief Handler for window initialization
	 */
	virtual BOOL InitInstance();
	
	/**
	 * @brief Idle handler
	 */
	virtual BOOL OnIdle(LONG lCount);
	
	/**
	 * @brief Exit handler
	 */
	virtual int ExitInstance();
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CFREDApp)
	/**
	 * @brief Help->About handler
	 */
	afx_msg void OnAppAbout();

	/**
	 * @brief Handler for opening a file
	 */
	afx_msg void OnFileOpen();

	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

private:
	int app_init;
	CString m_sInitialDir;
};

/**
 * @brief Add a message to be processed at the end of this frame.
 *
 * @details This is useful if you need the display to update before it's useful to process the message.  For example,
 * right click brings up a popup menu, but the menu it brings up depends on where you right clicked.  If you right
 * click on a ship, you get a message that pertains to the chosen ship.  It is useful to have a visual indication that
 * you have changed the current ship.
 *
 * @note z64: I get this feeling that this is a useful function.
 */
void add_pending_message(HWND hwnd, int id, WPARAM wparam, LPARAM lparam, int skip_count);

/**
 * @brief Initializes the message vector
 */
void init_pending_messages(void);

/**
 * @brief Refreshes the viewport
 */
void update_map_window();

extern bool Fred_active;    //!< True, if the main window is in-focus
extern int Update_window;   //!< Number of times we need to redraw the window. Usually just 1 or 0
extern HCURSOR h_cursor_move;   //!< Cursor resource (icon) used for translational movement of selected items
extern HCURSOR h_cursor_rotate; //!< Cursor resource (icon) used for rotational movement of selected items

extern CWnd*                Prev_window;            //!< The currently active window
extern CShipEditorDlg       Ship_editor_dialog;     //!< The ship editor instance
extern wing_editor          Wing_editor_dialog;     //!< The wing editor instance
extern waypoint_path_dlg    Waypoint_editor_dialog; //!< The waypoint editor instance
extern jumpnode_dlg			Jumpnode_editor_dialog; //!< The jumpnode editor instance
extern music_player_dlg		Music_player_dialog;    //!< The music player instance
extern bg_bitmap_dlg*       Bg_bitmap_dialog;       //!< The bitmap dialog instance
extern briefing_editor_dlg* Briefing_dialog;        //!< The briefing editor instance

extern CFREDApp theApp; //!< The application instance

extern window_data Main_wnd_data;
extern window_data Ship_wnd_data;
extern window_data Wing_wnd_data;
extern window_data Object_wnd_data;
extern window_data Mission_goals_wnd_data;
extern window_data Mission_cutscenes_wnd_data;
extern window_data Messages_wnd_data;
extern window_data Player_wnd_data;
extern window_data Events_wnd_data;
extern window_data Bg_wnd_data;
extern window_data Briefing_wnd_data;
extern window_data Reinforcement_wnd_data;
extern window_data Waypoint_wnd_data;
extern window_data Jumpnode_wnd_data;
extern window_data MusPlayer_wnd_data;
extern window_data Starfield_wnd_data;
extern window_data Asteroid_wnd_data;
extern window_data Mission_notes_wnd_data;
extern window_data Custom_data_wnd_data;

#endif // _FRED_H