2 * $Logfile: /Freespace2/code/fred2/FREDView.h $
7 * View class for a document/view architechure design program, which we don't
8 * want or need, but MFC forces us to use. This is the main place we handle
9 * MFC messages, events, etc. Sort of the interface between our code and MFC.
10 * There is also a lot of our code in here related to these things.
13 * Revision 1.1 2002/05/03 03:28:12 root
17 * 6 6/04/99 2:20p Andsager
18 * Add dump stats basic functionality
20 * 5 3/26/99 4:49p Dave
21 * Made cruisers able to dock with stuff. Made docking points and paths
24 * 4 1/27/99 4:09p Andsager
25 * Added highlight to ship subsystems
27 * 3 10/13/98 9:27a Dave
28 * Started neatening up freespace.h
30 * 2 10/07/98 6:28p Dave
31 * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
32 * Fred. Globalized mission and campaign file extensions. Removed Silent
33 * Threat specific code.
35 * 1 10/07/98 3:01p Dave
37 * 1 10/07/98 3:00p Dave
39 * 84 5/21/98 11:48a Hoffoss
40 * Removed check in and check out options.
42 * 83 5/14/98 5:32p Hoffoss
43 * Added some more error checking.
45 * 82 4/01/98 10:48a Hoffoss
46 * Changed Fred to not allow command briefings in multiplayer missions.
48 * 81 3/25/98 4:14p Hoffoss
49 * Split ship editor up into ship editor and a misc dialog, which tracks
52 * 80 3/09/98 10:56a Hoffoss
53 * Added jump node objects to Fred.
55 * 79 3/05/98 3:59p Hoffoss
56 * Added a bunch of new command brief stuff, and asteroid initialization
59 * 78 1/29/98 5:14p Hoffoss
60 * Added error checking for more than 4 ships in a player starting wing.
62 * 77 10/30/97 3:30p Hoffoss
63 * Made anti-aliased gridlines an option in Fred.
65 * 76 10/14/97 10:59a Allender
66 * more persona work. Made global error checker call funciton to assign
69 * 75 9/06/97 2:13p Mike
70 * Replace support for TEAM_NEUTRAL
72 * 74 9/01/97 6:59p Hoffoss
73 * Added source safe checkin and checkout capabilities to Fred.
75 * 73 8/26/97 4:18p Hoffoss
76 * Added error checking to initial orders dialog when ok is clicked.
78 * 72 8/25/97 5:58p Hoffoss
79 * Created menu items for keypress functions in Fred, and fixed bug this
80 * uncovered with wing_delete function.
82 * 71 8/18/97 9:31p Hoffoss
83 * Added grid adjustment dialog and shield system editor dialog.
85 * 70 8/14/97 2:32p Hoffoss
86 * fixed bug where controlling an object doesn't cause screen updates, and
87 * added a number of cool features to viewpoint/control object code.
89 * 69 8/12/97 6:32p Hoffoss
90 * Added code to allow hiding of arrival and departure cues in editors.
92 * 68 8/11/97 6:54p Hoffoss
93 * Groups now supported in Fred.
95 * 67 8/11/97 11:51a Allender
96 * added stamp stuff to Fred
98 * 66 8/07/97 6:01p Hoffoss
99 * Added a rotate about selected object button to toolbar and
100 * functionality, as requested by Comet.
102 * 65 8/01/97 3:10p Hoffoss
103 * Made Sexp help hidable.
105 * 64 8/01/97 12:52p Hoffoss
106 * Added variable, fixed bug with global error check.
108 * 63 7/28/97 2:51p Hoffoss
109 * Re-evaluated and improved global error checker in Fred.
111 * 62 7/24/97 12:45p Hoffoss
112 * Added camera position save and restore.
114 * 61 7/08/97 2:03p Hoffoss
115 * Debriefing editor coded and implemented.
117 * 60 6/18/97 3:07p Hoffoss
118 * Wing ship names are 1 indexes instead of 0 indexed now.
120 * 59 6/09/97 4:57p Hoffoss
121 * Added autosave and undo to Fred.
123 * 58 6/05/97 6:10p Hoffoss
124 * Added features: Autosaving, object hiding. Also fixed some minor bugs.
126 * 57 6/02/97 11:52a Hoffoss
127 * Custom cursors displayed when over objects in different modes.
129 * 56 5/21/97 5:43p Hoffoss
130 * Added features requested on Todo list.
132 * 55 5/06/97 3:01p Hoffoss
133 * Added some accelerator keys.
135 * 54 5/05/97 5:44p Hoffoss
136 * Added specialized popup menu choices, save before running FreeSpace,
137 * and display filters.
139 * 53 5/05/97 9:42a Hoffoss
140 * Single axis contraint code changed to operate better.
142 * 52 4/24/97 5:15p Hoffoss
145 * 51 4/17/97 5:23p Hoffoss
146 * Implemented ability to run FreeSpace from Fred.
148 * 50 4/16/97 5:18p Hoffoss
149 * Moved Asteroid field editor stuff to a seperate dialog box.
151 * 49 4/11/97 4:22p Hoffoss
152 * Fixed bug in Sexp trees, moved Show starfield option to view menu and
153 * removed preferences dialog box.
155 * 48 3/12/97 12:40p Hoffoss
156 * Fixed bugs in wing object management functions, several small additions
157 * and rearrangements.
159 * 47 3/10/97 4:58p Hoffoss
160 * Added waypoint and start types to drop down toolbar combo box and fixed
161 * context menu new ship type selection to also work.
163 * 46 3/10/97 12:54p Hoffoss
164 * Added drop down combo box to toolbar and fixed compiling errors Mark
165 * (maybe Mike?) introduced to code.
167 * 45 3/06/97 3:35p Hoffoss
168 * Added Show_outline stuff, moved show options to the view menu, fixed a
169 * bug in message dialog editor.
171 * 44 3/04/97 6:27p Hoffoss
172 * Changes to Fred to handle new wing structure.
174 * 43 2/28/97 11:31a Hoffoss
175 * Implemented modeless dialog saving and restoring, and changed some
178 * 42 2/27/97 5:54p Hoffoss
179 * Implemented support for saving and restoring window positions.
181 * 41 2/17/97 5:28p Hoffoss
182 * Checked RCS headers, added them were missing, changing description to
183 * something better, etc where needed.
185 * 72 2/12/97 5:50p Hoffoss
186 * Expanded on error checking.
188 * 71 2/12/97 12:25p Hoffoss
189 * Expanded on global error checker, added initial orders conflict
190 * checking and warning, added waypoint editor dialog and code.
192 * 70 2/10/97 5:18p Hoffoss
193 * Global error checker work. Added checks for many things, but still
194 * more to add tomorrow!
196 * 69 2/04/97 3:09p Hoffoss
197 * Background bitmap editor implemented fully.
199 * 68 1/30/97 2:24p Hoffoss
200 * Added remaining mission file structures and implemented load/save of
206 #ifndef STAMPER_PROGRAM
210 #define WM_MENU_POPUP_SHIPS (WM_USER+6)
211 #define WM_MENU_POPUP_EDIT (WM_USER+7)
212 #define SEXP_HELP_BOX_SIZE 170
214 typedef struct Marking_box {
218 typedef struct subsys_to_render
222 ship_subsys *cur_subsys;
225 class CShipEditorDlg;
228 class CFREDView : public CView
232 int global_error_check_player_wings(int multi);
234 protected: // create from serialization only
236 DECLARE_DYNCREATE(CFREDView)
240 int global_error_check_mixed_player_wing(int w);
241 int fred_check_sexp(int sexp, int type, char *msg, ...);
242 int internal_error(char *msg, ...);
243 int error(char *msg, ...);
244 int global_error_check();
245 void place_background_bitmap(vector v);
246 void cycle_constraint();
247 CFREDDoc *GetDocument();
249 static CFREDView *GetView();
251 LONG OnGoodbye(UINT wParam, LONG lParam);
252 // LONG OnMenuPopupShips(CWnd *pWnd, CPoint point);
253 // LONG OnMenuPopupShips(UINT wParam, LONG lParam);
255 //BOOL m_ConfirmDeleting;
256 //BOOL m_ShowCapitalShips;
257 //BOOL m_ShowElevations;
258 //BOOL m_ShowFighters;
260 //BOOL m_ShowMiscObjects;
261 //BOOL m_ShowPlanets;
262 //BOOL m_ShowWaypoints;
268 // ClassWizard generated virtual function overrides
269 //{{AFX_VIRTUAL(CFREDView)
271 virtual void OnDraw(CDC* pDC); // overridden to draw this view
272 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
273 virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
274 virtual void OnInitialUpdate();
276 virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
277 virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
278 virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
283 virtual ~CFREDView();
285 virtual void AssertValid() const;
286 virtual void Dump(CDumpContext& dc) const;
289 // virtual void SEDlg_destroy();
291 // Generated message map functions
293 //{{AFX_MSG(CFREDView)
294 afx_msg void OnViewGrid();
295 afx_msg void OnUpdateViewGrid(CCmdUI* pCmdUI);
296 afx_msg void OnViewWaypoints();
297 afx_msg void OnUpdateViewWaypoints(CCmdUI* pCmdUI);
298 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
299 afx_msg void OnEditorsShips();
300 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
301 afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
302 afx_msg void OnSetFocus(CWnd* pOldWnd);
303 afx_msg void OnKillFocus(CWnd* pNewWnd);
304 afx_msg void OnSize(UINT nType, int cx, int cy);
305 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
306 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
307 afx_msg void OnMiscstuffShowshipsasicons();
308 afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
309 afx_msg void OnEditPopupShowShipIcons();
310 afx_msg void OnUpdateEditPopupShowShipIcons(CCmdUI* pCmdUI);
311 afx_msg void OnEditPopupShowShipModels();
312 afx_msg void OnUpdateEditPopupShowShipModels(CCmdUI* pCmdUI);
313 afx_msg void OnMiscStatistics();
314 afx_msg void OnEditPopupShowCompass();
315 afx_msg void OnUpdateEditPopupShowCompass(CCmdUI* pCmdUI);
316 afx_msg void OnUpdateChangeViewpointExternal(CCmdUI* pCmdUI);
317 afx_msg void OnChangeViewpointExternal();
318 afx_msg void OnUpdateChangeViewpointFollow(CCmdUI* pCmdUI);
319 afx_msg void OnChangeViewpointFollow();
320 afx_msg void OnEditorsGoals();
321 afx_msg void OnSpeed1();
322 afx_msg void OnSpeed2();
323 afx_msg void OnSpeed5();
324 afx_msg void OnSpeed10();
325 afx_msg void OnUpdateSpeed1(CCmdUI* pCmdUI);
326 afx_msg void OnSpeed3();
327 afx_msg void OnSpeed8();
328 afx_msg void OnRot1();
329 afx_msg void OnRot2();
330 afx_msg void OnRot3();
331 afx_msg void OnRot4();
332 afx_msg void OnRot5();
333 afx_msg void OnUpdateSpeed2(CCmdUI* pCmdUI);
334 afx_msg void OnUpdateSpeed3(CCmdUI* pCmdUI);
335 afx_msg void OnUpdateSpeed5(CCmdUI* pCmdUI);
336 afx_msg void OnUpdateSpeed8(CCmdUI* pCmdUI);
337 afx_msg void OnUpdateSpeed10(CCmdUI* pCmdUI);
338 afx_msg void OnUpdateRot1(CCmdUI* pCmdUI);
339 afx_msg void OnUpdateRot2(CCmdUI* pCmdUI);
340 afx_msg void OnUpdateRot3(CCmdUI* pCmdUI);
341 afx_msg void OnUpdateRot4(CCmdUI* pCmdUI);
342 afx_msg void OnUpdateRot5(CCmdUI* pCmdUI);
343 afx_msg void OnControlModeCamera();
344 afx_msg void OnUpdateControlModeCamera(CCmdUI* pCmdUI);
345 afx_msg void OnControlModeShip();
346 afx_msg void OnUpdateControlModeShip(CCmdUI* pCmdUI);
347 afx_msg void OnShowGridPositions();
348 afx_msg void OnUpdateShowGridPositions(CCmdUI* pCmdUI);
349 afx_msg void OnShowCoordinates();
350 afx_msg void OnUpdateShowCoordinates(CCmdUI* pCmdUI);
351 afx_msg void OnSpeed50();
352 afx_msg void OnUpdateSpeed50(CCmdUI* pCmdUI);
353 afx_msg void OnSpeed100();
354 afx_msg void OnUpdateSpeed100(CCmdUI* pCmdUI);
355 afx_msg void OnSelect();
356 afx_msg void OnUpdateSelect(CCmdUI* pCmdUI);
357 afx_msg void OnSelectAndMove();
358 afx_msg void OnUpdateSelectAndMove(CCmdUI* pCmdUI);
359 afx_msg void OnSelectAndRotate();
360 afx_msg void OnUpdateSelectAndRotate(CCmdUI* pCmdUI);
361 afx_msg void OnConstrainX();
362 afx_msg void OnUpdateConstrainX(CCmdUI* pCmdUI);
363 afx_msg void OnConstrainY();
364 afx_msg void OnUpdateConstrainY(CCmdUI* pCmdUI);
365 afx_msg void OnConstrainZ();
366 afx_msg void OnUpdateConstrainZ(CCmdUI* pCmdUI);
367 afx_msg void OnConstrainXz();
368 afx_msg void OnUpdateConstrainXz(CCmdUI* pCmdUI);
369 afx_msg void OnSelectionLock();
370 afx_msg void OnUpdateSelectionLock(CCmdUI* pCmdUI);
371 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
372 afx_msg void OnDoubleFineGridlines();
373 afx_msg void OnUpdateDoubleFineGridlines(CCmdUI* pCmdUI);
374 afx_msg void OnShowDistances();
375 afx_msg void OnUpdateShowDistances(CCmdUI* pCmdUI);
376 afx_msg void OnUniversalHeading();
377 afx_msg void OnUpdateUniversalHeading(CCmdUI* pCmdUI);
378 afx_msg void OnFlyingControls();
379 afx_msg void OnUpdateFlyingControls(CCmdUI* pCmdUI);
380 afx_msg void OnRotateLocally();
381 afx_msg void OnUpdateRotateLocally(CCmdUI* pCmdUI);
382 afx_msg void OnConstrainXy();
383 afx_msg void OnUpdateConstrainXy(CCmdUI* pCmdUI);
384 afx_msg void OnUpdateConstrainYz(CCmdUI* pCmdUI);
385 afx_msg void OnConstrainYz();
386 afx_msg void OnSelectList();
387 afx_msg void OnZoomExtents();
388 afx_msg void OnZoomSelected();
389 afx_msg void OnUpdateZoomSelected(CCmdUI* pCmdUI);
390 afx_msg void OnFormWing();
391 afx_msg void OnUpdateFormWing(CCmdUI* pCmdUI);
392 afx_msg void OnDisbandWing();
393 afx_msg void OnUpdateDisbandWing(CCmdUI* pCmdUI);
394 afx_msg void OnShowHorizon();
395 afx_msg void OnUpdateShowHorizon(CCmdUI* pCmdUI);
396 afx_msg void OnEditorsWing();
397 afx_msg void OnEditorsPlayer();
398 afx_msg void OnEditorsOrient();
399 afx_msg void OnEditorsEvents();
400 afx_msg void OnUpdateEditorsOrient(CCmdUI* pCmdUI);
401 afx_msg void OnEditorsMessage();
402 afx_msg void OnEditorsStarfield();
403 afx_msg void OnEditorsBgBitmaps();
404 afx_msg void OnEditorsReinforcement();
405 afx_msg void OnErrorChecker();
406 afx_msg void OnEditorsWaypoint();
407 afx_msg void OnViewOutlines();
408 afx_msg void OnUpdateViewOutlines(CCmdUI* pCmdUI);
409 afx_msg void OnUpdateNewShipType(CCmdUI* pCmdUI);
410 afx_msg void OnShowStarfield();
411 afx_msg void OnUpdateShowStarfield(CCmdUI* pCmdUI);
412 afx_msg void OnAsteroidEditor();
413 afx_msg void OnRunFreespace();
414 afx_msg void OnEditorCampaign();
415 afx_msg void OnShowShips();
416 afx_msg void OnUpdateShowShips(CCmdUI* pCmdUI);
417 afx_msg void OnShowStarts();
418 afx_msg void OnUpdateShowStarts(CCmdUI* pCmdUI);
419 afx_msg void OnShowFriendly();
420 afx_msg void OnUpdateShowFriendly(CCmdUI* pCmdUI);
421 afx_msg void OnShowHostile();
422 afx_msg void OnUpdateShowHostile(CCmdUI* pCmdUI);
423 afx_msg void OnToggleViewpoint();
424 afx_msg void OnRevert();
425 afx_msg void OnUpdateRevert(CCmdUI* pCmdUI);
426 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
427 afx_msg void OnHideObjects();
428 afx_msg void OnShowHiddenObjects();
429 afx_msg void OnEditUndo();
430 afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
431 afx_msg void OnEditorsBriefing();
432 afx_msg void OnEditorsDebriefing();
433 afx_msg void OnSaveCamera();
434 afx_msg void OnRestoreCamera();
435 afx_msg void OnUpdateRestoreCamera(CCmdUI* pCmdUI);
436 afx_msg void OnShowSexpHelp();
437 afx_msg void OnUpdateShowSexpHelp(CCmdUI* pCmdUI);
438 afx_msg void OnLookatObj();
439 afx_msg void OnUpdateLookatObj(CCmdUI* pCmdUI);
440 afx_msg void OnEditorsAdjustGrid();
441 afx_msg void OnEditorsShieldSys();
442 afx_msg void OnLevelObj();
443 afx_msg void OnAlignObj();
444 afx_msg void OnControlObj();
445 afx_msg void OnNextObj();
446 afx_msg void OnPrevObj();
447 afx_msg void OnEditDeleteWing();
448 afx_msg void OnMarkWing();
449 afx_msg void OnUpdateControlObj(CCmdUI* pCmdUI);
450 afx_msg void OnEditDelete();
451 afx_msg void OnAaGridlines();
452 afx_msg void OnUpdateAaGridlines(CCmdUI* pCmdUI);
453 afx_msg void OnCmdBrief();
454 afx_msg void OnDisableUndo();
455 afx_msg void OnUpdateDisableUndo(CCmdUI* pCmdUI);
456 afx_msg void OnUpdateCmdBrief(CCmdUI* pCmdUI);
457 afx_msg void OnNextSubsys();
458 afx_msg void OnPrevSubsys();
459 afx_msg void OnCancelSubsys();
460 afx_msg void OnDumpStats();
461 afx_msg void OnShowPaths();
462 afx_msg void OnUpdateShowPaths(CCmdUI* pCmdUI);
463 afx_msg void OnShowDockPoints();
464 afx_msg void OnUpdateShowDockPoints(CCmdUI* pCmdUI);
466 afx_msg void OnGroup(UINT nID);
467 afx_msg void OnSetGroup(UINT nID);
469 // LONG OnMenuPopupShips(CWnd *pWnd, CPoint point);
470 LONG OnMenuPopupShips(UINT wParam, LONG lParam);
471 LONG OnMenuPopupEdit(UINT wParam, LONG lParam);
473 DECLARE_MESSAGE_MAP()
476 #ifndef _DEBUG // debug version in FREDView.cpp
477 inline CFREDDoc* CFREDView::GetDocument()
478 { return (CFREDDoc*)m_pDocument; }
481 /////////////////////////////////////////////////////////////////////////////
484 char *error_check_initial_orders(ai_goal *goals, int ship, int wing);
485 extern void fred_check_message_personas();
487 extern int Autosave_disabled;
488 extern int Show_sexp_help;
489 extern int Show_ships;
490 extern int Show_starts;
491 extern int Show_friendly;
492 extern int Show_hostile;
493 extern int Show_neutral;
494 extern int physics_speed;
495 extern int physics_rot;
496 extern int viewpoint;
498 extern int box_marking; // Are we currently box marking? (i.e. draging out a box to mark)
499 extern int button_down; // Is the left mouse button down and we are handling it?
500 extern int Marked; // number of marked objects
501 extern int Show_compass;
502 extern int Show_ship_models;
503 extern int Show_ship_info;
504 extern int Show_dock_points;
505 extern int Show_paths_fred;
506 extern int Selection_lock;
507 extern int Cursor_over;
508 extern int Cur_bitmap;
509 extern int Id_select_type_jump_node;
510 extern int Id_select_type_start;
511 extern int Id_select_type_waypoint;
512 extern int Hide_ship_cues, Hide_wing_cues;
513 extern Marking_box marking_box;
514 extern object_orient_pos rotation_backup[MAX_OBJECTS];
516 extern CFREDView *Fred_view_wnd;
518 #endif // if #ifndef STAMPER_PROGRAM