FS2_Open
Open source remastering of the Freespace 2 engine
frmfred2.cpp
Go to the documentation of this file.
1 /*
2  * Created by Ian "Goober5000" Warfield and "z64555" for the FreeSpace2 Source
3  * Code Project.
4  *
5  * You may not sell or otherwise commercially exploit the source or things you
6  * create based on the source.
7  */
8 
9 // Note: wxFormBuilder 3.3beta has a tendancy to use the ADJUST_MINSIZE macro (no longer existing)
10 // Just do a search&replace of "|wxADJUST_MINSIZE" and "|wxTE_LINEWRAP" to "" to delete all instances, and it'll work fine
11 
12 
13 #include "frmfred2.h"
14 #include "res/fred_app.xpm"
15 #include "res/fred_debug.xpm"
16 
17 #include "editors/frmshipseditor.h"
18 #include "editors/frmwingeditor.h"
36 
37 #include "misc/dlgmissionstats.h"
38 
39 #include "help/dlgaboutbox.h"
40 #include "help/dlgsexphelp.h"
41 
42 #include "base/wxfred_base.h"
43 
44 #include <globalincs/version.h>
45 #include <globalincs/pstypes.h>
46 
47 #include <wx/msgdlg.h>
48 #include <wx/wx.h>
49 #include <wx/glcanvas.h>
50 
51 // Public:
52 frmFRED2::frmFRED2( const wxChar *title, int xpos, int ypos, int width, int height )
53  : fredBase::frmFRED( NULL, wxID_ANY, wxEmptyString, wxPoint(xpos, ypos), wxSize(width, height) ),
54  currentFilename("Untitled"), fredName("FreeSpace 2 Mission Editor"),
55  frmShipsEditor_p(NULL), frmWingEditor_p(NULL), dlgObjectEditor_p(NULL),
56  frmWaypointEditor_p(NULL), dlgMissionObjectivesEditor_p(NULL), dlgEventsEditor_p(NULL),
57  frmTeamLoadoutEditor_p(NULL), dlgBackgroundEditor_p(NULL), dlgReinforcementsEditor_p(NULL),
58  dlgAsteroidFieldEditor_p(NULL), dlgMissionSpecsEditor_p(NULL), frmBriefingEditor_p(NULL),
59  frmDebriefingEditor_p(NULL), frmCommandBriefingEditor_p(NULL), dlgFictionViewer_p(NULL),
60  dlgShieldSystemEditor_p(NULL), dlgSetGlobalShipFlagsEditor_p(NULL), dlgVoiceActingManager_p(NULL),
61  frmCampaignEditor_p(NULL), dlgMissionStats_p(NULL), dlgAboutBox_p(NULL), dlgSexpHelp_p(NULL)
62 {
63  // Title bar setup
64  // z64: somewhat roundabout way to include the FS2 Open version number in the form title.
65 
66  wxSprintf( version, "v%i.%i.%i", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
67  this->SetFredTitle();
68 
69  // New Object Selection ListBox
70  cbNewObject = new wxChoice( tbrFRED, ID_TOOL_NEWOBJECTLIST, wxDefaultPosition, wxSize(193,-1), 0, NULL, wxCB_SORT );
71  // TODO: Auto-size the choice box to the longest string in the list.
72  // TODO: Grab the actual list of object classes
73  cbNewObject->Append(_T("GTF Ulysses"));
74  cbNewObject->SetSelection(0);
75 
76  tbrFRED->AddControl( cbNewObject );
77  tbrFRED->Realize();
78 
79  // Status Bar
80  sbFRED = this->CreateStatusBar( 5, wxSTB_DEFAULT_STYLE, wxID_ANY, "wxFRED2" );
81 
82  // The Viewport
83  wxBoxSizer* bSizerView = new wxBoxSizer( wxVERTICAL );
84  wxGLCanvas *TheViewport = new wxGLCanvas(this, wxID_ANY, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
85  bSizerView->Add( TheViewport );
86  this->SetSizer( bSizerView );
87  this->Layout();
88 
89  // Set the icon to use for the taskbar and titlebar of this frame
90 #ifdef NDEBUG
91  this->SetIcon(wxIcon(fred_app_xpm));
92 #else
93  this->SetIcon(wxIcon(fred_debug_xpm));
94 #endif
95 }
96 
98 {
99  if( sbFRED != NULL )
100  {
101  delete sbFRED;
102  }
103 }
104 
105 // Protected:
106 // Helpers.
107 /*
108  * Sets the string on the titlebar of frmFRED2.
109  * wxChar version[] and wxString fredName are initialized during the constructor, and shouldn't be altered elsewhere.
110  */
112 {
113  this->SetTitle( currentFilename + " - " + version + " - " + fredName );
114 }
115 
116 // Handlers for frmFRED events.
117 /*
118  * Checks to see if the user has made any modifications since the last save, and prompts them if they would like to
119  * save their changes before closing.
120  * Called by File->Exit and the Close button.
121  */
122 void frmFRED2::OnClose( wxCloseEvent &event )
123 {
124 // TODO: Implement OnClose
125  this->Destroy();
126 }
127 
128 void frmFRED2::OnSize( wxSizeEvent &event )
129 {
130 // TODO: Implement OnSize
131 }
132 
133 void frmFRED2::OnFileNew( wxCommandEvent &event )
134 {
135 // TODO: Implement OnFileNew
136 }
137 
138 void frmFRED2::OnFileOpen( wxCommandEvent &event )
139 {
140  wxFileDialog *dlg =
141  new wxFileDialog( this, "Open FreeSpace 2 Mission", wxGetCwd(), wxEmptyString, "FreeSpace2 Missions (*.fs2)|*.fs2| All Files (*.*)|*.*");
142 
143  if( dlg->ShowModal() != wxID_OK )
144  {
145  // User didn't click OK
146  return;
147  }
148 
149  currentFilename = dlg->GetFilename();
150  // TODO: actually (attempt) to open the file
151  SetFredTitle();
152 }
153 
154 void frmFRED2::OnFileSave( wxCommandEvent &event )
155 {
156 // TODO: Implement OnFileSave
157 }
158 
159 void frmFRED2::OnFileSaveAs( wxCommandEvent &event )
160 {
161 // TODO: Implement OnFileSaveAs
162 }
163 
164 void frmFRED2::OnFileRevert( wxCommandEvent &event )
165 {
166 // TODO: Implement OnFileRevert
167 }
168 
170 {
171 // TODO: Implement OnFileSaveFormatFs2Open
172 }
173 
175 {
176 // TODO: Implement OnFileSaveFormatFs2Retail
177 }
178 
180 {
181 // TODO: Implement OnFileImportFs1Mission
182 }
183 
185 {
186 // TODO: Implement OnFileImportFs1WeaponLoadouts
187 }
188 
189 void frmFRED2::OnFileRunFs2( wxCommandEvent &event )
190 {
191 // TODO: Implement OnFileRunFs2
192 }
193 
194 void frmFRED2::OnFileRecentFiles( wxCommandEvent &event )
195 {
196 // TODO: Implement OnFileRecentFiles
197 }
198 
199 void frmFRED2::OnFileExit( wxCommandEvent &event )
200 {
201 // TODO: Implement OnFileExit
202  this->Close();
203 }
204 
205 void frmFRED2::OnEditUndo( wxCommandEvent &event )
206 {
207 // TODO: Implement OnEditUndo
208 }
209 
210 void frmFRED2::OnEditDelete( wxCommandEvent &event )
211 {
212 // TODO: Implement OnEditDelete
213 }
214 
215 void frmFRED2::OnEditDeleteWing( wxCommandEvent &event )
216 {
217 // TODO: Implement OnEditDeleteWing
218 }
219 
220 void frmFRED2::OnEditDisableUndo( wxCommandEvent &event )
221 {
222 // TODO: Implement OnEditDisableUndo
223 }
224 
225 void frmFRED2::OnViewToolbar( wxCommandEvent &event )
226 {
227  if( event.IsChecked() == false )
228  {
229  // Control is cleared: User does not want to view the status bar
230  tbrFRED->Hide();
231  }
232  else
233  {
234  // Else, control is filled: User wants to view the status bar
235  tbrFRED->Show();
236  }
237 }
238 
239 void frmFRED2::OnViewStatusbar( wxCommandEvent &event )
240 {
241  if( event.IsChecked() == false )
242  {
243  // Control is cleared: User does not want to view the status bar
244  sbFRED->Hide();
245  }
246  else
247  {
248  // Else, control is filled: User wants to view the status bar
249  sbFRED->Show();
250  }
251 }
252 
254 {
255 // TODO: Implement OnViewDisplayFilterShowShips
256 }
257 
259 {
260 // TODO: Implement OnViewDisplayFilterShowPlayerStarts
261 }
262 
264 {
265 // TODO: Implement OnViewDisplayFilterShowWaypoints
266 }
267 
269 {
270 // TODO: Implement OnViewDisplayFilterShowFriendly
271 }
272 
274 {
275 // TODO: Implement OnViewDisplayFilterShowHostile
276 }
277 
279 {
280 // TODO: Implement OnViewHideMarkedObjects
281 }
282 
284 {
285 // TODO: Implement OnViewShowHiddenObjects
286 }
287 
288 void frmFRED2::OnViewShowShipModels( wxCommandEvent &event )
289 {
290 // TODO: Implement OnViewShowShipModels
291 }
292 
293 void frmFRED2::OnViewShowOutlines( wxCommandEvent &event )
294 {
295 // TODO: Implement OnViewShowOutlines
296 }
297 
298 void frmFRED2::OnViewShowShipInfo( wxCommandEvent &event )
299 {
300 // TODO: Implement OnViewShowShipInfo
301 }
302 
303 void frmFRED2::OnViewShowCoordinates( wxCommandEvent &event )
304 {
305 // TODO: Implement OnViewShowCoordinates
306 }
307 
309 {
310 // TODO: Implement OnViewShowGridPositions
311 }
312 
313 void frmFRED2::OnViewShowDistances( wxCommandEvent &event )
314 {
315 // TODO: Implement OnViewShowDistances
316 }
317 
318 void frmFRED2::OnViewShowModelPaths( wxCommandEvent &event )
319 {
320 // TODO: Implement OnViewShowModelPaths
321 }
322 
324 {
325 // TODO: Implement OnViewShowModelDockPoints
326 }
327 
328 void frmFRED2::OnViewShowGrid( wxCommandEvent &event )
329 {
330 // TODO: Implement OnViewShowGrid
331 }
332 
333 void frmFRED2::OnViewShowHorizon( wxCommandEvent &event )
334 {
335 // TODO: Implement OnViewShowHorizon
336 }
337 
339 {
340 // TODO: Implement OnViewDoubleFineGridlines
341 }
342 
344 {
345 // TODO: Implement OnViewAntiAliasedGridlines
346 }
347 
348 void frmFRED2::OnViewShow3DCompass( wxCommandEvent &event )
349 {
350 // TODO: Implement OnViewShow3DCompass
351 }
352 
353 void frmFRED2::OnViewShowBackground( wxCommandEvent &event )
354 {
355 // TODO: Implement OnViewShowBackground
356 }
357 
358 void frmFRED2::OnViewViewpointCamera( wxCommandEvent &event )
359 {
360 // TODO: Implement OnViewViewpointCamera
361 }
362 
364 {
365 // TODO: Implement OnViewViewpointCurrentShip
366 }
367 
368 void frmFRED2::OnViewSaveCameraPos( wxCommandEvent &event )
369 {
370 // TODO: Implement OnViewSaveCameraPos
371 }
372 
374 {
375 // TODO: Implement OnViewRestoreCameraPos
376 }
377 
379 {
380 // TODO: Implement OnViewLightingFromSuns
381 }
382 
383 void frmFRED2::OnSpeedMovement( wxCommandEvent &event )
384 {
385 // TODO: Implement OnViewSpeedMovement
386 }
387 
388 void frmFRED2::OnSpeedRotation( wxCommandEvent &event )
389 {
390 // TODO: Implement OnSpeedRotation
391 }
392 
393 void frmFRED2::OnEditorsShips( wxCommandEvent &event )
394 {
395  if( frmShipsEditor_p == NULL )
396  {
397  frmShipsEditor_p = new class frmShipsEditor( this, ID_frmShipsEditor );
398  }
399 
400  frmShipsEditor_p->Show();
401  frmShipsEditor_p->SetFocus();
402 }
403 
404 void frmFRED2::OnEditorsWings( wxCommandEvent &event )
405 {
406  if( frmWingEditor_p == NULL )
407  {
408  frmWingEditor_p = new class frmWingEditor( this, ID_frmWingEditor );
409  }
410 
411  frmWingEditor_p->Show();
412  frmWingEditor_p->SetFocus();
413 }
414 
415 void frmFRED2::OnEditorsObjects( wxCommandEvent &event )
416 {
417  if( dlgObjectEditor_p == NULL )
418  {
419  dlgObjectEditor_p = new class dlgObjectEditor( this, ID_dlgObjectEditor );
420  }
421 
422  dlgObjectEditor_p->Show();
423  dlgObjectEditor_p->SetFocus();
424 }
425 
427 {
428  if( frmWaypointEditor_p == NULL )
429  {
430  frmWaypointEditor_p = new class frmWaypointEditor( this, ID_frmWaypointEditor );
431  }
432 
433  frmWaypointEditor_p->Show();
434  frmWaypointEditor_p->SetFocus();
435 }
436 
438 {
439  if( dlgMissionObjectivesEditor_p == NULL )
440  {
441  dlgMissionObjectivesEditor_p = new class dlgMissionObjectivesEditor( this, ID_dlgMissionObjectivesEditor );
442  }
443 
444  dlgMissionObjectivesEditor_p->Show();
445  dlgMissionObjectivesEditor_p->SetFocus();
446 }
447 
448 void frmFRED2::OnEditorsEvents( wxCommandEvent &event )
449 {
450  if( dlgEventsEditor_p == NULL )
451  {
452  dlgEventsEditor_p = new class dlgEventsEditor( this, ID_dlgEventsEditor );
453  }
454 
455  dlgEventsEditor_p->Show();
456  dlgEventsEditor_p->SetFocus();
457 }
458 
459 void frmFRED2::OnEditorsTeamLoadout( wxCommandEvent &event )
460 {
461  if( frmTeamLoadoutEditor_p == NULL )
462  {
463  frmTeamLoadoutEditor_p = new class frmTeamLoadoutEditor( this, ID_frmTeamLoadoutEditor );
464  }
465 
466  frmTeamLoadoutEditor_p->Show();
467  frmTeamLoadoutEditor_p->SetFocus();
468 }
469 
470 void frmFRED2::OnEditorsBackground( wxCommandEvent &event )
471 {
472  if( dlgBackgroundEditor_p == NULL )
473  {
474  dlgBackgroundEditor_p = new class dlgBackgroundEditor( this, ID_dlgBackgroundEditor );
475  }
476 
477  dlgBackgroundEditor_p->Show();
478  dlgBackgroundEditor_p->SetFocus();
479 }
480 
482 {
483  if( dlgReinforcementsEditor_p == NULL )
484  {
485  dlgReinforcementsEditor_p = new class dlgReinforcementsEditor( this, ID_dlgReinforcementsEditor );
486  }
487 
488  dlgReinforcementsEditor_p->Show();
489  dlgReinforcementsEditor_p->SetFocus();
490 }
491 
493 {
494  if( dlgAsteroidFieldEditor_p == NULL )
495  {
496  dlgAsteroidFieldEditor_p = new class dlgAsteroidFieldEditor( this, ID_dlgAsteroidFieldEditor );
497  }
498 
499  dlgAsteroidFieldEditor_p->Show();
500  dlgAsteroidFieldEditor_p->SetFocus();
501 }
502 
503 void frmFRED2::OnEditorsMissionSpecs( wxCommandEvent &event )
504 {
505  if( dlgMissionSpecsEditor_p == NULL )
506  {
507  dlgMissionSpecsEditor_p = new class dlgMissionSpecsEditor( this, ID_dlgMissionSpecsEditor );
508  }
509 
510  dlgMissionSpecsEditor_p->Show();
511  dlgMissionSpecsEditor_p->SetFocus();
512 }
513 
514 void frmFRED2::OnEditorsBriefing( wxCommandEvent &event )
515 {
516  if( frmBriefingEditor_p == NULL )
517  {
518  frmBriefingEditor_p = new class frmBriefingEditor( this, ID_frmBriefingEditor );
519  }
520 
521  frmBriefingEditor_p->Show();
522  frmBriefingEditor_p->SetFocus();
523 }
524 
525 void frmFRED2::OnEditorsDebriefing( wxCommandEvent &event )
526 {
527  if( frmDebriefingEditor_p == NULL )
528  {
529  frmDebriefingEditor_p = new class frmDebriefingEditor( this, ID_frmDebriefingEditor );
530  }
531 
532  frmDebriefingEditor_p->Show();
533  frmDebriefingEditor_p->SetFocus();
534 }
535 
537 {
538  if( frmCommandBriefingEditor_p == NULL )
539  {
540  frmCommandBriefingEditor_p = new class frmCommandBriefingEditor( this, ID_frmCommandBriefingEditor );
541  }
542 
543  frmCommandBriefingEditor_p->Show();
544  frmCommandBriefingEditor_p->SetFocus();
545 }
546 
548 {
549  if( dlgFictionViewer_p == NULL )
550  {
551  dlgFictionViewer_p = new class dlgFictionViewer( this, ID_dlgFictionViewer );
552  }
553 
554  dlgFictionViewer_p->Show();
555  dlgFictionViewer_p->SetFocus();
556 }
557 
558 void frmFRED2::OnEditorsShieldSystem( wxCommandEvent &event )
559 {
560 if( dlgShieldSystemEditor_p == NULL )
561  {
562  dlgShieldSystemEditor_p = new class dlgShieldSystemEditor( this, ID_dlgShieldSystemEditor );
563  }
564 
565  dlgShieldSystemEditor_p->Show();
566  dlgShieldSystemEditor_p->SetFocus();
567 }
568 
570 {
571 if( dlgSetGlobalShipFlagsEditor_p == NULL )
572  {
573  dlgSetGlobalShipFlagsEditor_p = new class dlgSetGlobalShipFlagsEditor( this, ID_dlgSetGlobalShipFlagsEditor );
574  }
575 
576  dlgSetGlobalShipFlagsEditor_p->Show();
577  dlgSetGlobalShipFlagsEditor_p->SetFocus();
578 }
579 
581 {
582 if( dlgVoiceActingManager_p == NULL )
583  {
584  dlgVoiceActingManager_p = new class dlgVoiceActingManager( this, ID_dlgVoiceActingManager );
585  }
586 
587  dlgVoiceActingManager_p->Show();
588  dlgVoiceActingManager_p->SetFocus();
589 }
590 
591 void frmFRED2::OnEditorsCampaign( wxCommandEvent &event )
592 {
593 if( frmCampaignEditor_p == NULL )
594  {
595  frmCampaignEditor_p = new class frmCampaignEditor( this, ID_frmCampaignEditor );
596  }
597 
598  frmCampaignEditor_p->Show();
599  frmCampaignEditor_p->SetFocus();
600 }
601 
602 void frmFRED2::OnGroupsGroup( wxCommandEvent &event )
603 {
604 // TODO: Implement OnGroupsGroup
605 }
606 
607 void frmFRED2::OnGroupsSetGroup( wxCommandEvent &event )
608 {
609 // TODO: Implement OnGroupsSetGroup
610 }
611 
612 void frmFRED2::OnMiscLevelObject( wxCommandEvent &event )
613 {
614 // TODO: Implement OnMiscLevelObject
615 }
616 
617 void frmFRED2::OnMiscAlignObject( wxCommandEvent &event )
618 {
619 // TODO: Implement OnMiscAlignObject
620 }
621 
622 void frmFRED2::OnMiscMarkWing( wxCommandEvent &event )
623 {
624 // TODO: Implement OnMiscMarkWing
625 }
626 
627 void frmFRED2::OnMiscControlObject( wxCommandEvent &event )
628 {
629 // TODO: Implement OnMiscControlObject
630 }
631 
632 void frmFRED2::OnMiscNextObject( wxCommandEvent &event )
633 {
634 // TODO: Implement OnMiscNextObject
635 }
636 
637 void frmFRED2::OnMiscPreviousObject( wxCommandEvent &event )
638 {
639 // TODO: Implement OnMiscPreviousObject
640 }
641 
642 void frmFRED2::OnMiscAdjustGrid( wxCommandEvent &event )
643 {
644 // TODO: Implement OnMiscAdjustGrid
645 }
646 
647 void frmFRED2::OnMiscNextSubsystem( wxCommandEvent &event )
648 {
649 // TODO: Implement OnMiscNextSubsystem
650 }
651 
652 void frmFRED2::OnMiscPrevSubsystem( wxCommandEvent &event )
653 {
654 // TODO: Implement OnMiscPrevSubsystem
655 }
656 
657 void frmFRED2::OnMiscCancelSubsystem( wxCommandEvent &event )
658 {
659 // TODO: Implement OnMiscCancelSubsystem
660 }
661 
663 {
664 if( dlgMissionStats_p == NULL )
665  {
666  dlgMissionStats_p = new class dlgMissionStats( this, ID_dlgMissionStats );
667  }
668 
669  dlgMissionStats_p->Show();
670  dlgMissionStats_p->SetFocus();
671 }
672 
673 void frmFRED2::OnMiscErrorChecker( wxCommandEvent &event )
674 {
675 // TODO: Implement OnMiscErrorChecker
676 }
677 
678 void frmFRED2::OnHelpHelpTopics( wxCommandEvent &event )
679 {
680 // TODO: Implement OnMiscHelpHelpTopics
681 }
682 
683 void frmFRED2::OnHelpAbout( wxCommandEvent &event )
684 {
685 if( dlgAboutBox_p == NULL )
686  {
687  dlgAboutBox_p = new class dlgAboutBox( this, ID_dlgAboutBox );
688  }
689 
690  dlgAboutBox_p->Show();
691  dlgAboutBox_p->SetFocus();
692 }
693 
694 void frmFRED2::OnHelpShowSexpHelp( wxCommandEvent &event )
695 {
696 if( dlgSexpHelp_p == NULL )
697  {
698  dlgSexpHelp_p = new class dlgSexpHelp( this, ID_dlgSexpHelp );
699  }
700 
701  dlgSexpHelp_p->Show();
702  dlgSexpHelp_p->SetFocus();
703 }
704 
705 // Handlers for child dialogs & frames
706 bool frmFRED2::ChildIsOpen( const wxWindowID child_id )
707 {
708  switch( child_id )
709  {
710  case ID_frmShipsEditor:
711  return ( frmShipsEditor_p != NULL ) ? frmShipsEditor_p->IsShown() : false;
712 
713  case ID_frmWingEditor:
714  return ( frmWingEditor_p != NULL ) ? frmWingEditor_p->IsShown() : false;
715 
716  case ID_dlgObjectEditor:
717  return ( dlgObjectEditor_p != NULL ) ? dlgObjectEditor_p->IsShown() : false;
718 
720  return ( frmWaypointEditor_p != NULL ) ? frmWaypointEditor_p->IsShown() : false;
721 
723  return ( dlgMissionObjectivesEditor_p != NULL ) ? dlgMissionObjectivesEditor_p->IsShown() : false;
724 
725  case ID_dlgEventsEditor:
726  return ( dlgEventsEditor_p != NULL ) ? dlgEventsEditor_p->IsShown() : false;
727 
729  return ( frmTeamLoadoutEditor_p != NULL ) ? frmTeamLoadoutEditor_p->IsShown() : false;
730 
732  return ( dlgBackgroundEditor_p != NULL ) ? dlgBackgroundEditor_p->IsShown() : false;
733 
735  return ( dlgReinforcementsEditor_p != NULL ) ? dlgReinforcementsEditor_p->IsShown() : false;
736 
738  return ( dlgAsteroidFieldEditor_p != NULL ) ? dlgAsteroidFieldEditor_p->IsShown() : false;
739 
741  return ( dlgMissionSpecsEditor_p != NULL ) ? dlgMissionSpecsEditor_p->IsShown() : false;
742 
744  return ( frmBriefingEditor_p != NULL ) ? frmBriefingEditor_p->IsShown() : false;
745 
747  return ( frmDebriefingEditor_p != NULL ) ? frmDebriefingEditor_p->IsShown() : false;
748 
750  return ( frmCommandBriefingEditor_p != NULL ) ? frmCommandBriefingEditor_p->IsShown() : false;
751 
752  case ID_dlgFictionViewer:
753  return ( dlgFictionViewer_p != NULL ) ? dlgFictionViewer_p->IsShown() : false;
754 
756  return ( dlgShieldSystemEditor_p != NULL ) ? dlgShieldSystemEditor_p->IsShown() : false;
757 
759  return ( dlgSetGlobalShipFlagsEditor_p != NULL ) ? dlgSetGlobalShipFlagsEditor_p->IsShown() : false;
760 
762  return ( dlgVoiceActingManager_p != NULL ) ? dlgVoiceActingManager_p->IsShown() : false;
763 
765  return ( frmCampaignEditor_p != NULL ) ? frmCampaignEditor_p->IsShown() : false;
766 
767  case ID_dlgMissionStats:
768  return ( dlgMissionStats_p != NULL ) ? dlgMissionStats_p->IsShown() : false;
769 
770  case ID_dlgAboutBox:
771  return ( dlgAboutBox_p != NULL ) ? dlgAboutBox_p->IsShown() : false;
772 
773  case ID_dlgSexpHelp:
774  return ( dlgSexpHelp_p != NULL ) ? dlgSexpHelp_p->IsShown() : false;
775 
776  default:
777  // Maybe return debug dialog. "Unknown child id"
778  return false;
779  }
780 }
781 
782 void frmFRED2::OnChildClosed( wxWindow* const child )
783 {
784  wxWindowID child_id = child->GetId();
785 
786  switch( child_id )
787  {
788  case ID_frmShipsEditor:
789  frmShipsEditor_p = NULL;
790  break;
791 
792  case ID_frmWingEditor:
793  frmWingEditor_p = NULL;
794  break;
795 
796  case ID_dlgObjectEditor:
797  dlgObjectEditor_p = NULL;
798  break;
799 
801  frmWaypointEditor_p = NULL;
802  break;
803 
805  dlgMissionObjectivesEditor_p = NULL;
806  break;
807 
808  case ID_dlgEventsEditor:
809  dlgEventsEditor_p = NULL;
810  break;
811 
813  frmTeamLoadoutEditor_p = NULL;
814  break;
815 
817  dlgBackgroundEditor_p = NULL;
818  break;
819 
821  dlgReinforcementsEditor_p = NULL;
822  break;
823 
825  dlgAsteroidFieldEditor_p = NULL;
826  break;
827 
829  dlgMissionSpecsEditor_p = NULL;
830  break;
831 
833  frmBriefingEditor_p = NULL;
834  break;
835 
837  frmDebriefingEditor_p = NULL;
838  break;
839 
841  frmCommandBriefingEditor_p = NULL;
842  break;
843 
844  case ID_dlgFictionViewer:
845  dlgFictionViewer_p = NULL;
846  break;
847 
849  dlgShieldSystemEditor_p = NULL;
850  break;
851 
853  dlgSetGlobalShipFlagsEditor_p = NULL;
854  break;
855 
857  dlgVoiceActingManager_p = NULL;
858  break;
859 
861  frmCampaignEditor_p = NULL;
862  break;
863 
864  case ID_dlgMissionStats:
865  dlgMissionStats_p = NULL;
866  break;
867 
868  case ID_dlgAboutBox:
869  dlgAboutBox_p = NULL;
870  break;
871 
872  case ID_dlgSexpHelp:
873  dlgSexpHelp_p = NULL;
874  break;
875 
876  default:
877  // wxFRED must close in order to prevent anything from exploding.
878  // TODO: determine if any changes were made prior to the crash. If so, try to save the changes so the user's work won't be lost
879  wxChar message[255];
880  wxSprintf( message, "Child ID: %i \n\nwxFRED must now close, due to an unknown child window closing.\nPlease inform an SCP member of the Child ID number listed above.", child_id );
881  wxMessageBox( message, _T("Unknown child window closed"));
882  Close();
883  }
884 }
void OnFileOpen(wxCommandEvent &event)
Definition: frmfred2.cpp:138
void OnEditorsEvents(wxCommandEvent &event)
Definition: frmfred2.cpp:448
void OnSpeedRotation(wxCommandEvent &event)
Definition: frmfred2.cpp:388
void SetFredTitle(void)
Definition: frmfred2.cpp:111
void OnEditorsMissionObjectives(wxCommandEvent &event)
Definition: frmfred2.cpp:437
void OnViewSaveCameraPos(wxCommandEvent &event)
Definition: frmfred2.cpp:368
void OnViewShowHiddenObjects(wxCommandEvent &event)
Definition: frmfred2.cpp:283
void OnHelpShowSexpHelp(wxCommandEvent &event)
Definition: frmfred2.cpp:694
void OnMiscNextObject(wxCommandEvent &event)
Definition: frmfred2.cpp:632
void OnEditDelete(wxCommandEvent &event)
Definition: frmfred2.cpp:210
void OnMiscAlignObject(wxCommandEvent &event)
Definition: frmfred2.cpp:617
void OnEditorsVoiceActingManager(wxCommandEvent &event)
Definition: frmfred2.cpp:580
void OnViewHideMarkedObjects(wxCommandEvent &event)
Definition: frmfred2.cpp:278
void OnFileImportFs1WeaponLoadouts(wxCommandEvent &event)
Definition: frmfred2.cpp:184
void OnEditorsObjects(wxCommandEvent &event)
Definition: frmfred2.cpp:415
void OnEditorsShips(wxCommandEvent &event)
Definition: frmfred2.cpp:393
void OnViewDisplayFilterShowPlayerStarts(wxCommandEvent &event)
Definition: frmfred2.cpp:258
void OnHelpAbout(wxCommandEvent &event)
Definition: frmfred2.cpp:683
void OnViewShowShipInfo(wxCommandEvent &event)
Definition: frmfred2.cpp:298
void OnEditorsDebriefing(wxCommandEvent &event)
Definition: frmfred2.cpp:525
void OnMiscErrorChecker(wxCommandEvent &event)
Definition: frmfred2.cpp:673
void OnViewShowBackground(wxCommandEvent &event)
Definition: frmfred2.cpp:353
void OnEditorsAsteroidField(wxCommandEvent &event)
Definition: frmfred2.cpp:492
#define FS_VERSION_MAJOR
Definition: version.h:37
void OnViewShowModelPaths(wxCommandEvent &event)
Definition: frmfred2.cpp:318
void OnMiscMarkWing(wxCommandEvent &event)
Definition: frmfred2.cpp:622
bool ChildIsOpen(const wxWindowID child_id)
Definition: frmfred2.cpp:706
void OnEditDeleteWing(wxCommandEvent &event)
Definition: frmfred2.cpp:215
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: Glext.h:5156
void OnViewShowGridPositions(wxCommandEvent &event)
Definition: frmfred2.cpp:308
void OnEditorsBackground(wxCommandEvent &event)
Definition: frmfred2.cpp:470
void OnViewStatusbar(wxCommandEvent &event)
Definition: frmfred2.cpp:239
void OnMiscPreviousObject(wxCommandEvent &event)
Definition: frmfred2.cpp:637
void OnFileRunFs2(wxCommandEvent &event)
Definition: frmfred2.cpp:189
void OnViewAntiAliasedGridlines(wxCommandEvent &event)
Definition: frmfred2.cpp:343
void OnFileNew(wxCommandEvent &event)
Definition: frmfred2.cpp:133
void OnFileSaveAs(wxCommandEvent &event)
Definition: frmfred2.cpp:159
GLint GLsizei width
Definition: Gl.h:1505
void OnViewRestoreCameraPos(wxCommandEvent &event)
Definition: frmfred2.cpp:373
void OnViewToolbar(wxCommandEvent &event)
Definition: frmfred2.cpp:225
void OnMiscCancelSubsystem(wxCommandEvent &event)
Definition: frmfred2.cpp:657
void OnEditorsFictionViewer(wxCommandEvent &event)
Definition: frmfred2.cpp:547
void OnHelpHelpTopics(wxCommandEvent &event)
Definition: frmfred2.cpp:678
void OnViewShowCoordinates(wxCommandEvent &event)
Definition: frmfred2.cpp:303
void OnFileRevert(wxCommandEvent &event)
Definition: frmfred2.cpp:164
frmFRED2(void)
void OnViewShowDistances(wxCommandEvent &event)
Definition: frmfred2.cpp:313
void OnMiscAdjustGrid(wxCommandEvent &event)
Definition: frmfred2.cpp:642
void OnViewShowModelDockPoints(wxCommandEvent &event)
Definition: frmfred2.cpp:323
void OnViewDisplayFilterShowHostile(wxCommandEvent &event)
Definition: frmfred2.cpp:273
void OnFileSaveFormatFs2Retail(wxCommandEvent &event)
Definition: frmfred2.cpp:174
void OnMiscMissionStatistics(wxCommandEvent &event)
Definition: frmfred2.cpp:662
void OnFileExit(wxCommandEvent &event)
Definition: frmfred2.cpp:199
void OnChildClosed(wxWindow *child)
Definition: frmfred2.cpp:782
#define FS_VERSION_MINOR
Definition: version.h:38
void OnEditorsWaypointPaths(wxCommandEvent &event)
Definition: frmfred2.cpp:426
void OnEditorsShieldSystem(wxCommandEvent &event)
Definition: frmfred2.cpp:558
void OnEditorsTeamLoadout(wxCommandEvent &event)
Definition: frmfred2.cpp:459
void OnFileRecentFiles(wxCommandEvent &event)
Definition: frmfred2.cpp:194
void OnFileImportFs1Mission(wxCommandEvent &event)
Definition: frmfred2.cpp:179
void OnGroupsGroup(wxCommandEvent &event)
Definition: frmfred2.cpp:602
void OnGroupsSetGroup(wxCommandEvent &event)
Definition: frmfred2.cpp:607
void OnMiscLevelObject(wxCommandEvent &event)
Definition: frmfred2.cpp:612
void OnEditorsCampaign(wxCommandEvent &event)
Definition: frmfred2.cpp:591
void OnViewShowOutlines(wxCommandEvent &event)
Definition: frmfred2.cpp:293
void OnViewViewpointCamera(wxCommandEvent &event)
Definition: frmfred2.cpp:358
void OnEditUndo(wxCommandEvent &event)
Definition: frmfred2.cpp:205
void OnEditDisableUndo(wxCommandEvent &event)
Definition: frmfred2.cpp:220
void OnEditorsSetGlobalShipFlags(wxCommandEvent &event)
Definition: frmfred2.cpp:569
void OnViewDoubleFineGridlines(wxCommandEvent &event)
Definition: frmfred2.cpp:338
void OnClose(wxCloseEvent &event)
Definition: frmfred2.cpp:122
void OnMiscControlObject(wxCommandEvent &event)
Definition: frmfred2.cpp:627
void OnViewShowHorizon(wxCommandEvent &event)
Definition: frmfred2.cpp:333
GLint GLsizei GLsizei height
Definition: Gl.h:1505
void OnMiscPrevSubsystem(wxCommandEvent &event)
Definition: frmfred2.cpp:652
void OnEditorsCommandBriefing(wxCommandEvent &event)
Definition: frmfred2.cpp:536
void OnSpeedMovement(wxCommandEvent &event)
Definition: frmfred2.cpp:383
void OnEditorsBriefing(wxCommandEvent &event)
Definition: frmfred2.cpp:514
void OnMiscNextSubsystem(wxCommandEvent &event)
Definition: frmfred2.cpp:647
void OnViewViewpointCurrentShip(wxCommandEvent &event)
Definition: frmfred2.cpp:363
struct _cl_event * event
Definition: Glext.h:7296
void OnEditorsMissionSpecs(wxCommandEvent &event)
Definition: frmfred2.cpp:503
void OnViewShow3DCompass(wxCommandEvent &event)
Definition: frmfred2.cpp:348
void OnViewShowGrid(wxCommandEvent &event)
Definition: frmfred2.cpp:328
void OnViewDisplayFilterShowWaypoints(wxCommandEvent &event)
Definition: frmfred2.cpp:263
void OnSize(wxSizeEvent &event)
Definition: frmfred2.cpp:128
#define FS_VERSION_BUILD
Definition: version.h:39
void OnFileSaveFormatFs2Open(wxCommandEvent &event)
Definition: frmfred2.cpp:169
~frmFRED2(void)
Definition: frmfred2.cpp:97
false
Definition: lua.cpp:6789
void OnViewLightingFromSuns(wxCommandEvent &event)
Definition: frmfred2.cpp:378
void OnViewShowShipModels(wxCommandEvent &event)
Definition: frmfred2.cpp:288
wxToolBar * tbrFRED
Definition: wxfred_base.h:314
void OnViewDisplayFilterShowFriendly(wxCommandEvent &event)
Definition: frmfred2.cpp:268
void OnViewDisplayFilterShowShips(wxCommandEvent &event)
Definition: frmfred2.cpp:253
void OnEditorsWings(wxCommandEvent &event)
Definition: frmfred2.cpp:404
void OnFileSave(wxCommandEvent &event)
Definition: frmfred2.cpp:154
void OnEditorsReinforcements(wxCommandEvent &event)
Definition: frmfred2.cpp:481