00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "../Include/FlyLegacy.h"
00025 #include "../Include/Globals.h"
00026 #include "../Include/Ui.h"
00027 #include "../Include/Fui.h"
00028 #include "../Include/Database.h"
00029 #include "../Include/Utility.h"
00030 #include "../Include/TimeManager.h"
00031 #include "../Include/Situation.h"
00032
00033
00034 static void toggle_window (FuiEventNoticeCb handler, Tag id, const char* winFilename)
00035 {
00036 if (globals->fuimgr) {
00037 if (globals->fuimgr->IsWindowCreated (id)) {
00038
00039 globals->fuimgr->DestroyFuiWindow (id);
00040 } else {
00041
00042 globals->fuimgr->CreateFuiWindow (handler, id, winFilename);
00043 }
00044 }
00045 }
00046
00047
00048
00049
00050
00051 static void open_window (FuiEventNoticeCb handler, Tag id, const char* winFilename)
00052 {
00053 if (globals->fuimgr) {
00054 if (!globals->fuimgr->IsWindowCreated (id)) {
00055
00056 globals->fuimgr->CreateFuiWindow (handler, id, winFilename);
00057 }
00058 }
00059 }
00060
00061
00062
00063
00064 static void close_window (Tag id)
00065 {
00066 if (globals->fuimgr) {
00067 if (globals->fuimgr->IsWindowCreated (id)) {
00068 globals->fuimgr->DestroyFuiWindow (id);
00069 }
00070 }
00071 }
00072
00073
00074
00075
00076 void FileLoadEventNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00077 {
00078 switch (event) {
00079 case EVENT_OPENWINDOW:
00080 globals->fuimgr->SetWindowTitle (id, "Load Situation");
00081 break;
00082
00083 case EVENT_BUTTONPRESSED:
00084 switch (component) {
00085 case 'okok':
00086
00088 globals->fuimgr->DestroyFuiWindow (id);
00089 break;
00090
00091 case 'canc':
00092
00093 globals->fuimgr->DestroyFuiWindow (id);
00094 }
00095 break;
00096
00097 default:
00098
00099 ;
00100 }
00101 }
00102
00103
00104
00105
00106
00107 void FileSaveEventNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00108 {
00109 switch (event) {
00110 case EVENT_OPENWINDOW:
00111 globals->fuimgr->SetWindowTitle (id, "Save Situation");
00112 break;
00113
00114 case EVENT_BUTTONPRESSED:
00115 switch (component) {
00116 case 'okok':
00117
00119 globals->fuimgr->DestroyFuiWindow (id);
00120 break;
00121
00122 case 'canc':
00123
00124 globals->fuimgr->DestroyFuiWindow (id);
00125 }
00126 break;
00127
00128 default:
00129
00130 ;
00131 }
00132 }
00133
00134
00135
00136
00137
00138 void FileSaveAsEventNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00139 {
00140 switch (event) {
00141 case EVENT_OPENWINDOW:
00142 globals->fuimgr->SetWindowTitle (id, "Save Situation As");
00143 break;
00144
00145 case EVENT_CLOSEWINDOW:
00146 DrawNoticeToUser ("Close File SaveAs", 5);
00147 break;
00148
00149 case EVENT_BUTTONPRESSED:
00150 switch (component) {
00151 case 'okok':
00152
00154 globals->fuimgr->DestroyFuiWindow (id);
00155 break;
00156
00157 case 'canc':
00158
00159 globals->fuimgr->DestroyFuiWindow (id);
00160 }
00161 break;
00162
00163 default:
00164
00165 ;
00166 }
00167 }
00168
00169
00170
00171
00172
00173 void FileQuitEventNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00174 {
00175 switch (event) {
00176 case EVENT_OPENWINDOW:
00177 globals->fuimgr->SetWindowTitle (id, "Confirm Program Quit");
00178 globals->fuimgr->SetComponentText (id, 'mesg',
00179 "Are you sure you want to quit?");
00180 break;
00181
00182 case EVENT_BUTTONPRESSED:
00183 switch (component) {
00184 case 'okok':
00185
00186
00187 globals->appState = APP_EXIT_SCREEN;
00188 break;
00189
00190 case 'canc':
00191
00192 globals->fuimgr->DestroyFuiWindow (id);
00193 }
00194 break;
00195
00196 default:
00197
00198 ;
00199 }
00200 }
00201
00202
00203
00204
00205
00206 void file_load_situation_cb (puObject* obj)
00207 {
00208 open_window (FileLoadEventNotify,
00209 FUI_WINDOW_SITUATION_LOAD,
00210 "UI\\TEMPLATES\\OPENFILE.WIN");
00211 }
00212
00213 void file_save_situation_cb (puObject* obj)
00214 {
00215 open_window (FileSaveEventNotify,
00216 FUI_WINDOW_SITUATION_SAVE,
00217 "UI\\TEMPLATES\\OPENFILE.WIN");
00218 }
00219
00220 void file_save_situation_as_cb (puObject* obj)
00221 {
00222 open_window (FileSaveAsEventNotify,
00223 FUI_WINDOW_SITUATION_SAVE_AS,
00224 "UI\\TEMPLATES\\OPENFILE.WIN");
00225 }
00226
00227 void file_quit_cb (puObject* obj)
00228 {
00229 open_window (FileQuitEventNotify,
00230 FUI_WINDOW_QUIT,
00231 "UI\\TEMPLATES\\YESNO.WIN");
00232 }
00233
00234 char *file_legends[] =
00235 {
00236 "Quit",
00237 "--------------------",
00238 "Save Situation As...",
00239 "Save Situation...",
00240 "Load Situation...",
00241 NULL
00242 };
00243
00244 puCallback file_cb[] =
00245 {
00246 file_quit_cb,
00247 NULL,
00248 file_save_situation_as_cb,
00249 file_save_situation_cb,
00250 file_load_situation_cb,
00251 NULL
00252 };
00253
00254
00255
00256
00257
00258 void options_mute_cb (puObject* obj)
00259 {
00260 DrawNoticeToUser ("Options -> Mute", 5);
00261 }
00262
00263 void options_pause_cb (puObject* obj)
00264 {
00265 if (globals->timemgr->GetPauseState ()) {
00266 globals->timemgr->Pause ();
00267 } else {
00268 globals->timemgr->Unpause ();
00269 }
00270 }
00271
00272 static void OptionsSceneryNotify (Tag id,
00273 Tag component,
00274 EFuiEvents event,
00275 EFuiEvents subevent)
00276 {
00277 switch (event) {
00278 case EVENT_BUTTONPRESSED:
00279 switch (component) {
00280 case 'okok':
00281
00283 globals->fuimgr->DestroyFuiWindow (id);
00284 break;
00285
00286 case 'canc':
00287
00288 globals->fuimgr->DestroyFuiWindow (id);
00289 break;
00290
00291 default:
00292 {
00293
00294 char s[8];
00295 char debug[80];
00296 TagToString (s, component);
00297 sprintf (debug, "Button : %s", s);
00298 DrawNoticeToUser (debug, 3);
00299 }
00300 }
00301 break;
00302
00303 default:
00304
00305 ;
00306 }
00307 }
00308
00309 void options_scenery_cb (puObject* obj)
00310 {
00311 open_window (OptionsSceneryNotify,
00312 FUI_WINDOW_OPTIONS_SCENERY,
00313 "UI\\TEMPLATES\\SCENERY.WIN");
00314 }
00315
00316 static void OptionsRealismNotify (Tag id,
00317 Tag component,
00318 EFuiEvents event,
00319 EFuiEvents subevent)
00320 {
00321 switch (event) {
00322 case EVENT_BUTTONPRESSED:
00323 switch (component) {
00324 case 'okok':
00325
00327 globals->fuimgr->DestroyFuiWindow (id);
00328 break;
00329
00330 case 'canc':
00331
00332 globals->fuimgr->DestroyFuiWindow (id);
00333 break;
00334
00335 default:
00336 {
00337
00338 char s[8];
00339 char debug[80];
00340 TagToString (s, component);
00341 sprintf (debug, "Button : %s", s);
00342 DrawNoticeToUser (debug, 3);
00343 }
00344 }
00345 break;
00346
00347 default:
00348
00349 ;
00350 }
00351 }
00352
00353 void options_realism_cb (puObject* obj)
00354 {
00355 open_window (OptionsRealismNotify,
00356 FUI_WINDOW_OPTIONS_REALISM,
00357 "UI\\TEMPLATES\\REALISM.WIN");
00358 }
00359
00360 static void OptionsStartupNotify (Tag id,
00361 Tag component,
00362 EFuiEvents event,
00363 EFuiEvents subevent)
00364 {
00365 switch (event) {
00366 case EVENT_BUTTONPRESSED:
00367 switch (component) {
00368 case 'okok':
00369
00371 globals->fuimgr->DestroyFuiWindow (id);
00372 break;
00373
00374 case 'canc':
00375
00376 globals->fuimgr->DestroyFuiWindow (id);
00377 break;
00378
00379 default:
00380 {
00381
00382 char s[8];
00383 char debug[80];
00384 TagToString (s, component);
00385 sprintf (debug, "Button : %s", s);
00386 DrawNoticeToUser (debug, 3);
00387 }
00388 }
00389 break;
00390
00391 default:
00392
00393 ;
00394 }
00395 }
00396
00397 void options_startup_cb (puObject* obj)
00398 {
00399 open_window (OptionsStartupNotify,
00400 FUI_WINDOW_OPTIONS_STARTUP,
00401 "UI\\TEMPLATES\\STARTUP.WIN");
00402 }
00403
00404 static void OptionsCockpitNotify (Tag id,
00405 Tag component,
00406 EFuiEvents event,
00407 EFuiEvents subevent)
00408 {
00409 char s[8];
00410 char debug[80];
00411
00412 switch (event) {
00413 case EVENT_BUTTONPRESSED:
00414
00415 TagToString (s, component);
00416 sprintf (debug, "Button : %s", s);
00417 DrawNoticeToUser (debug, 3);
00418 break;
00419
00420 default:
00421
00422 ;
00423 }
00424 }
00425
00426 void options_cockpit_cb (puObject* obj)
00427 {
00428 open_window (OptionsCockpitNotify,
00429 FUI_WINDOW_OPTIONS_COCKPIT,
00430 "UI\\TEMPLATES\\COCKPIT.WIN");
00431 }
00432
00433 static void OptionsTestControlsNotify (Tag id,
00434 Tag component,
00435 EFuiEvents event,
00436 EFuiEvents subevent)
00437 {
00438 switch (event) {
00439 case EVENT_BUTTONPRESSED:
00440 switch (component) {
00441 case 'dump':
00443 globals->fuimgr->DestroyFuiWindow (id);
00444 break;
00445
00446 default:
00447 {
00448
00449 char s[8];
00450 char debug[80];
00451 TagToString (s, component);
00452 sprintf (debug, "Button : %s", s);
00453 DrawNoticeToUser (debug, 3);
00454 }
00455 }
00456 break;
00457
00458 default:
00459
00460 ;
00461 }
00462 }
00463
00464 void options_test_controls_cb (puObject* obj)
00465 {
00466 open_window (OptionsTestControlsNotify,
00467 FUI_WINDOW_OPTIONS_TEST_CONTROLS,
00468 "UI\\TEMPLATES\\TESTCONTROLS.WIN");
00469 }
00470
00471 static void OptionsSetupAxesNotify (Tag id,
00472 Tag component,
00473 EFuiEvents event,
00474 EFuiEvents subevent)
00475 {
00476 switch (event) {
00477 case EVENT_BUTTONPRESSED:
00478 switch (component) {
00479 case 'test':
00481 globals->fuimgr->DestroyFuiWindow (id);
00482 break;
00483
00484 case 'clra':
00486 globals->fuimgr->DestroyFuiWindow (id);
00487 break;
00488
00489 case 'defa':
00491 globals->fuimgr->DestroyFuiWindow (id);
00492 break;
00493
00494 default:
00495 {
00496
00497 char s[8];
00498 char debug[80];
00499 TagToString (s, component);
00500 sprintf (debug, "Button : %s", s);
00501 DrawNoticeToUser (debug, 3);
00502 }
00503 }
00504 break;
00505
00506 default:
00507
00508 ;
00509 }
00510 }
00511
00512 void options_setup_axes_cb (puObject* obj)
00513 {
00514 open_window (OptionsSetupAxesNotify, 'axes', "UI\\TEMPLATES\\AXES.WIN");
00515 }
00516
00517 static void OptionsKeysButtonsNotify (Tag id,
00518 Tag component,
00519 EFuiEvents event,
00520 EFuiEvents subevent)
00521 {
00522 switch (event) {
00523 case EVENT_BUTTONPRESSED:
00524 switch (component) {
00525 case 'clrk':
00527 globals->fuimgr->DestroyFuiWindow (id);
00528 break;
00529
00530 case 'clrb':
00532 globals->fuimgr->DestroyFuiWindow (id);
00533 break;
00534
00535 case 'defk':
00537 globals->fuimgr->DestroyFuiWindow (id);
00538 break;
00539
00540 case 'defb':
00542 globals->fuimgr->DestroyFuiWindow (id);
00543 break;
00544
00545 default:
00546 {
00547
00548 char s[8];
00549 char debug[80];
00550 TagToString (s, component);
00551 sprintf (debug, "Button : %s", s);
00552 DrawNoticeToUser (debug, 3);
00553 }
00554 }
00555 break;
00556
00557 default:
00558
00559 ;
00560 }
00561 }
00562
00563 void options_keys_buttons_cb (puObject* obj)
00564 {
00565 open_window (OptionsKeysButtonsNotify,
00566 FUI_WINDOW_OPTIONS_KEYS_BUTTONS,
00567 "UI\\TEMPLATES\\KEYS.WIN");
00568 }
00569
00570 static void OptionsDateTimeNotify (Tag id,
00571 Tag component,
00572 EFuiEvents event,
00573 EFuiEvents subevent)
00574 {
00575 switch (event) {
00576 case EVENT_OPENWINDOW:
00577 break;
00578
00579 case EVENT_BUTTONPRESSED:
00580 switch (component) {
00581 case 'okok':
00582
00583
00584
00585 globals->fuimgr->DestroyFuiWindow (id);
00586 break;
00587
00588 case 'canc':
00589
00590 globals->fuimgr->DestroyFuiWindow (id);
00591 }
00592 break;
00593
00594 default:
00595
00596 ;
00597 }
00598 }
00599
00600 void options_date_time_cb (puObject* obj)
00601 {
00602 open_window (OptionsDateTimeNotify,
00603 FUI_WINDOW_OPTIONS_DATE_TIME,
00604 "UI\\TEMPLATES\\DATETIME.WIN");
00605 }
00606
00607 static void OptionsSoundsNotify (Tag id,
00608 Tag component,
00609 EFuiEvents event,
00610 EFuiEvents subevent)
00611 {
00612 switch (event) {
00613 case EVENT_BUTTONPRESSED:
00614 switch (component) {
00615 case 'okok':
00616
00618 globals->fuimgr->DestroyFuiWindow (id);
00619 break;
00620
00621 case 'canc':
00622
00623 globals->fuimgr->DestroyFuiWindow (id);
00624 break;
00625 }
00626 break;
00627
00628 default:
00629
00630 ;
00631 }
00632 }
00633
00634 void options_sound_cb (puObject* obj)
00635 {
00636 open_window (OptionsSoundsNotify,
00637 FUI_WINDOW_OPTIONS_SOUND,
00638 "UI\\TEMPLATES\\SOUNDS.WIN");
00639 }
00640
00641 char *options_legends[] =
00642 {
00643 "Mute",
00644 "--------------------",
00645 "Pause",
00646 "--------------------",
00647 "Scenery...",
00648 "Realism...",
00649 "--------------------",
00650 "Startup...",
00651 "--------------------",
00652 "Cockpit...",
00653 "--------------------",
00654 "Test Controls...",
00655 "Setup Axes...",
00656 "Keys & Buttons...",
00657 "--------------------",
00658 "Date & Time...",
00659 "Sound...",
00660 NULL
00661 };
00662
00663 puCallback options_cb[] =
00664 {
00665 options_mute_cb,
00666 NULL,
00667 options_pause_cb,
00668 NULL,
00669 options_scenery_cb,
00670 options_realism_cb,
00671 NULL,
00672 options_startup_cb,
00673 NULL,
00674 options_cockpit_cb,
00675 NULL,
00676 options_test_controls_cb,
00677 options_setup_axes_cb,
00678 options_keys_buttons_cb,
00679 NULL,
00680 options_date_time_cb,
00681 options_sound_cb,
00682 NULL
00683 };
00684
00685
00686
00687
00688
00689 static void AdventuresNotify (Tag id,
00690 Tag component,
00691 EFuiEvents event,
00692 EFuiEvents subevent)
00693 {
00694 }
00695
00696 void quickflight_adventures_cb (puObject* obj)
00697 {
00698 open_window (AdventuresNotify,
00699 FUI_WINDOW_ADVENTURES,
00700 "UI\\TEMPLATES\\ADVENTURES.WIN");
00701 }
00702
00703 static void QuickFlightNotify (Tag id,
00704 Tag component,
00705 EFuiEvents event,
00706 EFuiEvents subevent)
00707 {
00708 }
00709
00710 void quickflight_quickflight_cb (puObject* obj)
00711 {
00712 open_window (QuickFlightNotify,
00713 FUI_WINDOW_QUICKFLIGHT,
00714 "UI\\TEMPLATES\\QUICKFLIGHT.WIN");
00715 }
00716
00717 char *quickflight_legends[] =
00718 {
00719 "Adventures...",
00720 "QuickFlight...",
00721 NULL
00722 };
00723
00724 puCallback quickflight_cb[] =
00725 {
00726 quickflight_adventures_cb,
00727 quickflight_quickflight_cb,
00728 NULL
00729 };
00730
00731
00732
00733
00734
00735 void flightplan_logbook_cb (puObject* obj)
00736 {
00737 DrawNoticeToUser ("Aircraft -> Log Book", 5);
00738 }
00739
00740 void flightplan_checklist_cb (puObject* obj)
00741 {
00742 DrawNoticeToUser ("Aircraft -> Checklist", 5);
00743 }
00744
00745 void flightplan_navlog_cb (puObject* obj)
00746 {
00747 DrawNoticeToUser ("Aircraft -> Navigation Log", 5);
00748 }
00749
00750 void flightplan_directory_cb (puObject* obj)
00751 {
00752 DrawNoticeToUser ("Aircraft -> Directory", 5);
00753 }
00754
00755 void flightplan_waypoint_cb (puObject* obj)
00756 {
00757 DrawNoticeToUser ("Aircraft -> Current Waypoint", 5);
00758 }
00759
00760 void flightplanner_cb (puObject* obj)
00761 {
00762 DrawNoticeToUser ("Aircraft -> Flight Planner", 5);
00763 }
00764
00765 char *flightplan_legends[] =
00766 {
00767 "Log Book...",
00768 "--------------------",
00769 "Check List...",
00770 "Navigation Log...",
00771 "--------------------",
00772 "Directory...",
00773 "Current Waypoint...",
00774 "--------------------",
00775 "Flight Planner...",
00776 NULL
00777 };
00778
00779 puCallback flightplan_cb[] =
00780 {
00781 flightplan_logbook_cb,
00782 NULL,
00783 flightplan_checklist_cb,
00784 flightplan_navlog_cb,
00785 NULL,
00786 flightplan_directory_cb,
00787 flightplan_waypoint_cb,
00788 NULL,
00789 flightplanner_cb,
00790 NULL
00791 };
00792
00793
00794
00795
00796
00797 void aircraft_slew_cb (puObject* obj)
00798 {
00799 CSlewManager *slew = globals->slewmgr;
00800 if (slew->IsEnabled ()) {
00801 slew->Disable ();
00802 } else {
00803 slew->Enable ();
00804 }
00805 }
00806
00807 void LatArcsecToDMS (double lat, bool &n, float &d, float &m, float &s)
00808 {
00809 if (lat >= 0) {
00810 n = true;
00811 } else {
00812 n = false;
00813 lat = -lat;
00814 }
00815
00816 d = floor (lat / 3600.0);
00817 lat -= (d * 3600.0);
00818 m = floor (lat / 60.0);
00819 lat -= (m * 60.0);
00820 s = lat;
00821 }
00822
00823 void LonArcsecToDMS (double lon, bool &w, float &d, float &m, float &s)
00824 {
00825 if (lon >= (180.0 * 3600.0)) {
00826 w = true;
00827 lon = (360.0 * 3600.0) - lon;
00828 } else {
00829 w = false;
00830 }
00831
00832 d = floor (lon / 3600.0);
00833 lon -= (d * 3600.0);
00834 m = floor (lon / 60.0);
00835 lon -= (m * 60.0);
00836 s = lon;
00837 }
00838
00839 void TeleportDirectoryNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00840 {
00841 CFuiManager *fui = globals->fuimgr;
00842
00843 switch (event) {
00844 case EVENT_OPENWINDOW:
00845 {
00846
00847 fui->AddPopupItem (id, 'type', ENTRY_AIRPORT, "Airport");
00848 fui->AddPopupItem (id, 'type', ENTRY_NAVAID, "Navaid");
00849 fui->AddPopupItem (id, 'type', ENTRY_WAYPOINT, "Waypoint");
00850 fui->SelectPopupItem (id, 'type', ENTRY_AIRPORT);
00851
00852
00853 char sCountry[256];
00854 char sCountryKey[8];
00855 memset (sCountry, 0, 256);
00856 memset (sCountryKey, 0, 8);
00857 GetIniString ("UI", "defaultSearchCountry", sCountry, 256);
00858
00859 char sState[256];
00860 memset (sState, 0, 256);
00861 GetIniString ("UI", "defaultSearchState", sState, 256);
00862
00863 unsigned int iCountry = 0;
00864
00865
00866 unsigned long nCountries = dbCountry->GetNumRecords ();
00867 fui->AddListColumn (id, 'clst', -1, "Country");
00868 for (unsigned long i=0; i<nCountries; i++) {
00869 CDatabaseRecord *record = dbCountry->GetRecordByIndex (i);
00870 if (record != NULL) {
00871 CDatabaseField *field = record->GetField (1);
00872 if (field != NULL) {
00873 fui->AddListRow (id, 'clst', 12);
00874 fui->SetListCellText (id, 'clst', i, 0, field->data.charData);
00875
00876 if (stricmp (sCountry, field->data.charData) == 0) {
00877 iCountry = i;
00878
00879
00880 CDatabaseField *fCountry = record->GetField (0);
00881 if (fCountry != NULL) {
00882 strcpy (sCountryKey, fCountry->data.charData);
00883 }
00884 }
00885 }
00886 }
00887 }
00888 fui->ScrollListToRow (id, 'clst', iCountry);
00889 fui->SelectListRow (id, 'clst', iCountry);
00890
00892 fui->DeleteAllListRows (id, 'slst');
00893 fui->DeleteAllListColumns (id, 'slst');
00894 fui->AddListColumn (id, 'slst', -1, "State");
00895
00896 int iState = 0;
00897 unsigned long offset = dbState->Search ('sctr', sCountryKey);
00898 while (offset != 0) {
00899
00900 CDatabaseRecord *record = dbState->GetRecordByOffset (offset);
00901 CDatabaseField *f = record->GetField (3);
00902 if (f != NULL) {
00903 fui->AddListRow (id, 'slst', 12);
00904 fui->SetListCellText (id, 'slst', iState, 0, f->data.charData);
00905 }
00906
00907
00908 offset = dbState->SearchNext ();
00909 iState++;
00910 }
00911 }
00912 break;
00913
00914 case EVENT_BUTTONPRESSED:
00915 switch (component) {
00916 case 'warp':
00917 {
00918 DrawNoticeToUser ("Waypoint teleports", 5);
00919 }
00920 break;
00921 case 'wsel':
00922 {
00923 DrawNoticeToUser ("Waypoint select", 5);
00924 }
00925 break;
00926 case 'detl':
00927 {
00928 DrawNoticeToUser ("Waypoint details", 5);
00929 }
00930 break;
00931 case 'srch':
00932 {
00933 DrawNoticeToUser ("Waypoint search", 5);
00934 }
00935 break;
00936 }
00937
00938 default:
00939
00940 ;
00941 }
00942 }
00943
00944 void TeleportAlertNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00945 {
00946 CFuiManager *fui = globals->fuimgr;
00947
00948 switch (event) {
00949 case EVENT_OPENWINDOW:
00950
00951 fui->SetComponentText (id, 'mesg', "Teleporting...please wait");
00952 break;
00953
00954 default:
00955
00956 ;
00957 }
00958 }
00959
00960 void AircraftTeleportNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
00961 {
00962 CVehicleObject *user = globals->sit->GetUserVehicle ();
00963 CFuiManager *fui = globals->fuimgr;
00964
00965 DrawNoticeToUser ("Teleport event", 1);
00966 char t[8];
00967 TagToString (t, component);
00968
00969 switch (event) {
00970 case EVENT_OPENWINDOW:
00971 {
00972
00973 SPosition pos = user->GetPosition();
00974 bool hemi;
00975 float d, m, s;
00976
00977
00978 LatArcsecToDMS (pos.lat, hemi, d, m, s);
00979 char latd[8];
00980 sprintf (latd, "%02.0f", d);
00981 char latm[8];
00982 sprintf (latm, "%02.0f", m);
00983 char lats[8];
00984 sprintf (lats, "%02.0f", s);
00985
00986 if (hemi) {
00987
00988 fui->SetRadioState (id, 'dirN', 1);
00989 fui->SetRadioState (id, 'dirS', 0);
00990 } else {
00991
00992 fui->SetRadioState (id, 'dirN', 0);
00993 fui->SetRadioState (id, 'dirS', 1);
00994 }
00995 fui->SetTextText (id, 'lath', latd);
00996 fui->SetTextText (id, 'latm', latm);
00997 fui->SetTextText (id, 'lats', lats);
00998
00999
01000 LonArcsecToDMS (pos.lon, hemi, d, m, s);
01001 char lond[8];
01002 sprintf (lond, "%02.0f", d);
01003 char lonm[8];
01004 sprintf (lonm, "%02.0f", m);
01005 char lons[8];
01006 sprintf (lons, "%2.0f", s);
01007
01008 fui->SetTextText (id, 'lonh', lond);
01009 fui->SetTextText (id, 'lonm', lonm);
01010 fui->SetTextText (id, 'lons', lons);
01011
01012 if (hemi) {
01013
01014 fui->SetRadioState (id, 'dirE', 0);
01015 fui->SetRadioState (id, 'dirW', 1);
01016 } else {
01017
01018 fui->SetRadioState (id, 'dirE', 1);
01019 fui->SetRadioState (id, 'dirW', 0);
01020 }
01021 }
01022 break;
01023
01024 case EVENT_CHECKED:
01025 switch (component) {
01026 case 'dirN':
01027
01028 fui->SetRadioState (id, 'dirS', 0);
01029 break;
01030 case 'dirS':
01031
01032 fui->SetRadioState (id, 'dirN', 0);
01033 break;
01034 case 'dirW':
01035
01036 fui->SetRadioState (id, 'dirE', 0);
01037 break;
01038 case 'dirE':
01039
01040 fui->SetRadioState (id, 'dirW', 0);
01041 break;
01042 }
01043 break;
01044
01045 case EVENT_BUTTONPRESSED:
01046 switch (component) {
01047 case 'okok':
01048 {
01049
01050 SPosition pos = user->GetPosition();
01051 float d, m, s;
01052 char t[8];
01053 strcpy (t, fui->GetTextText (id, 'lath'));
01054 d = atof (t);
01055 strcpy (t, fui->GetTextText (id, 'latm'));
01056 m = atof (t);
01057 strcpy (t, fui->GetTextText (id, 'lats'));
01058 s = atof (t);
01059 pos.lat = (d * 3600.0) + (m * 60.0) + s;
01060 if (fui->GetRadioState (id, 'dirS') != 0) {
01061
01062 pos.lat = -pos.lat;
01063 }
01064
01065 strcpy (t, fui->GetTextText (id, 'lonh'));
01066 d = atof (t);
01067 strcpy (t, fui->GetTextText (id, 'lonm'));
01068 m = atof (t);
01069 strcpy (t, fui->GetTextText (id, 'lons'));
01070 s = atof (t);
01071 pos.lon = (d * 3600.0) + (m * 60.0) + s;
01072 if (fui->GetRadioState (id, 'dirW') != 0) {
01073
01074 pos.lon = (360.0 * 3600.0) - pos.lon;
01075 }
01076
01077
01078
01079
01080 open_window (TeleportAlertNotify,
01081 FUI_WINDOW_TELEPORT_ALERT,
01082 "UI\\TEMPLATES\\ALERT.WIN");
01083
01084
01085 DrawNoticeToUser ("Teleporting...", 5);
01086
01087
01088 user->SetPosition (pos);
01089
01090
01091 close_window (id);
01092 }
01093 break;
01094
01095 case 'dirc':
01096
01097 open_window (TeleportDirectoryNotify,
01098 FUI_WINDOW_TELEPORT_DIRECTORY,
01099 "UI\\TEMPLATES\\WAYPTDIR.WIN");
01100 break;
01101 }
01102 break;
01103
01104 default:
01105
01106 ;
01107 }
01108 }
01109
01110 void aircraft_teleport_cb (puObject* obj)
01111 {
01112 open_window (AircraftTeleportNotify,
01113 FUI_WINDOW_TELEPORT,
01114 "UI\\TEMPLATES\\TELEPORT.WIN");
01115 }
01116
01117 void AircraftOptionsNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01118 {
01119 }
01120
01121 void aircraft_options_cb (puObject* obj)
01122 {
01123 open_window (AircraftOptionsNotify,
01124 FUI_WINDOW_AIRCRAFT_OPTIONS,
01125 "UI\\TEMPLATES\\VEHOPTIONS.WIN");
01126 }
01127
01128 void AircraftCgNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01129 {
01130 }
01131
01132 void aircraft_cg_cb (puObject* obj)
01133 {
01134 open_window (AircraftCgNotify,
01135 FUI_WINDOW_AIRCRAFT_CG,
01136 "UI\\TEMPLATES\\CG.WIN");
01137 }
01138
01139 void AircraftTuneRadiosNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01140 {
01141 }
01142
01143 void aircraft_tune_radios_cb (puObject* obj)
01144 {
01145 open_window (AircraftTuneRadiosNotify,
01146 FUI_WINDOW_AIRCRAFT_AUTOTUNE,
01147 "UI\\TEMPLATES\\AUTOTUNE.WIN");
01148 }
01149
01150 void AircraftFuelNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01151 {
01152 }
01153
01154 void aircraft_fuel_loadout_cb (puObject* obj)
01155 {
01156 open_window (AircraftFuelNotify,
01157 FUI_WINDOW_AIRCRAFT_FUEL,
01158 "UI\\TEMPLATES\\FUEL.WIN");
01159 }
01160
01161 void AircraftWeightBalanceNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01162 {
01163 }
01164
01165 void aircraft_weight_balance_cb (puObject* obj)
01166 {
01167 open_window (AircraftWeightBalanceNotify,
01168 FUI_WINDOW_AIRCRAFT_WEIGHT_BALANCE,
01169 "UI\\TEMPLATES\\WEIGHT.WIN");
01170 }
01171
01172 void AircraftDamageNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01173 {
01174 }
01175
01176 void aircraft_damage_report_cb (puObject* obj)
01177 {
01178 open_window (AircraftDamageNotify,
01179 FUI_WINDOW_AIRCRAFT_DAMAGE,
01180 "UI\\TEMPLATES\\DAMAGE.WIN");
01181 }
01182
01183 void AircraftSelectNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01184 {
01185 }
01186
01187 void aircraft_select_cb (puObject* obj)
01188 {
01189 open_window (AircraftSelectNotify,
01190 FUI_WINDOW_AIRCRAFT_SELECT,
01191 "UI\\TEMPLATES\\SETUPAIR.WIN");
01192 }
01193
01194 char *aircraft_legends[] =
01195 {
01196 "Slew",
01197 "Teleport",
01198 "--------------------",
01199 "Options",
01200 "CG Indicator",
01201 "--------------------",
01202 "Tune Radios",
01203 "Fuel Loadout",
01204 "Weight & Balance",
01205 "--------------------",
01206 "Damage Report",
01207 "Select Aircraft",
01208 NULL
01209 };
01210
01211 puCallback aircraft_cb[] =
01212 {
01213 aircraft_slew_cb,
01214 aircraft_teleport_cb,
01215 NULL,
01216 aircraft_options_cb,
01217 aircraft_cg_cb,
01218 NULL,
01219 aircraft_tune_radios_cb,
01220 aircraft_fuel_loadout_cb,
01221 aircraft_weight_balance_cb,
01222 NULL,
01223 aircraft_damage_report_cb,
01224 aircraft_select_cb,
01225 NULL
01226 };
01227
01228
01229
01230
01231
01232 void WeatherMetarNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01233 {
01234 }
01235
01236 void weather_metar_cb (puObject* obj)
01237 {
01238 open_window (WeatherMetarNotify,
01239 FUI_WINDOW_WEATHER_METAR,
01240 "UI\\TEMPLATES\\METAR.WIN");
01241 }
01242
01243 void WeatherOtherNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01244 {
01245 }
01246
01247 void weather_other_cb (puObject* obj)
01248 {
01249 open_window (WeatherOtherNotify,
01250 FUI_WINDOW_WEATHER_OTHER,
01251 "UI\\TEMPLATES\\MOREENV.WIN");
01252 }
01253
01254 void WeatherWindsNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01255 {
01256 }
01257
01258 void weather_winds_cb (puObject* obj)
01259 {
01260 open_window (WeatherWindsNotify,
01261 FUI_WINDOW_WEATHER_WINDS,
01262 "UI\\TEMPLATES\\WINDS.WIN");
01263 }
01264
01265 void WeatherCloudsNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01266 {
01267 }
01268
01269 void weather_clouds_cb (puObject* obj)
01270 {
01271 open_window (WeatherCloudsNotify,
01272 FUI_WINDOW_WEATHER_WINDS,
01273 "UI\\TEMPLATES\\CLOUDS.WIN");
01274 }
01275
01276 void WeatherSkyTweakerNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01277 {
01278 }
01279
01280 void weather_sky_tweaker_cb (puObject* obj)
01281 {
01282 open_window (WeatherSkyTweakerNotify,
01283 FUI_WINDOW_WEATHER_SKY_TWEAKER,
01284 "UI\\TEMPLATES\\SKYTWEAK.WIN");
01285 }
01286
01287 void weather_almanac_cb (puObject* obj)
01288 {
01289 DrawNoticeToUser ("Weather -> Almanac not implemented", 5);
01290 }
01291
01292 void WeatherOverviewNotify (Tag id, Tag component, EFuiEvents event, EFuiEvents subevent)
01293 {
01294 }
01295
01296 void weather_overview_cb (puObject* obj)
01297 {
01298 open_window (WeatherOverviewNotify, 'envr', "UI\\TEMPLATES\\WEATHER.WIN");
01299 }
01300
01301 char *weather_legends[] =
01302 {
01303 "Load METAR...",
01304 "--------------------",
01305 "Other",
01306 "Winds",
01307 "Clouds",
01308 "--------------------",
01309 "Sky Tweaker",
01310 "--------------------",
01311 "Almanac",
01312 "Overview",
01313 NULL
01314 };
01315
01316 puCallback weather_cb[] =
01317 {
01318 weather_metar_cb,
01319 NULL,
01320 weather_other_cb,
01321 weather_winds_cb,
01322 weather_clouds_cb,
01323 NULL,
01324 weather_sky_tweaker_cb,
01325 NULL,
01326 weather_almanac_cb,
01327 weather_overview_cb,
01328 NULL
01329 };
01330
01331
01332
01333
01334
01335
01336 void multiplayer_connect_cb (puObject* obj)
01337 {
01338 DrawNoticeToUser ("Windows -> Connect", 5);
01339 }
01340
01341 void multiplayer_disconnect_cb (puObject* obj)
01342 {
01343 DrawNoticeToUser ("Windows -> Disconnect", 5);
01344 }
01345
01346 void multiplayer_chat_cb (puObject* obj)
01347 {
01348 DrawNoticeToUser ("Windows -> Chat", 5);
01349 }
01350
01351 void multiplayer_find_pilot_cb (puObject* obj)
01352 {
01353 DrawNoticeToUser ("Windows -> Find Pilot", 5);
01354 }
01355
01356 void multiplayer_motd_cb (puObject* obj)
01357 {
01358 DrawNoticeToUser ("Windows -> Show MOTD", 5);
01359 }
01360
01361 void multiplayer_sysop_cb (puObject* obj)
01362 {
01363 DrawNoticeToUser ("Windows -> Sysop", 5);
01364 }
01365
01366 char *multiplayer_legends[] =
01367 {
01368 "Sysop",
01369 "Show MOTD",
01370 "--------------------",
01371 "Find Pilot",
01372 "Chat Window",
01373 "--------------------",
01374 "Disconnect",
01375 "Connect",
01376 NULL
01377 };
01378
01379 puCallback multiplayer_cb[] =
01380 {
01381 multiplayer_sysop_cb,
01382 multiplayer_motd_cb,
01383 NULL,
01384 multiplayer_find_pilot_cb,
01385 multiplayer_chat_cb,
01386 NULL,
01387 multiplayer_disconnect_cb,
01388 multiplayer_connect_cb,
01389 NULL
01390 };
01391
01392
01393
01394
01395
01396 void windows_replay_cb (puObject* obj)
01397 {
01398 toggle_window (ReplayNotify,
01399 FUI_WINDOW_INSTANT_REPLAY,
01400 "UI\\TEMPLATES\\REPLAY.WIN");
01401 }
01402
01403 void windows_axis_cb (puObject* obj)
01404 {
01405 toggle_window (AxisNotify,
01406 FUI_WINDOW_AXIS,
01407 "UI\\TEMPLATES\\AXISIND.WIN");
01408 }
01409
01410 void windows_vector_cb (puObject* obj)
01411 {
01412 toggle_window (VectorMapNotify,
01413 FUI_WINDOW_VECTOR_MAP,
01414 "UI\\TEMPLATES\\RASTRMAP.WIN");
01415 }
01416
01417 void windows_map_cb (puObject* obj)
01418 {
01419 toggle_window (MapNotify,
01420 FUI_WINDOW_MAP,
01421 "UI\\TEMPLATES\\SLCTMAP.WIN");
01422 }
01423
01424 void windows_gps_cb (puObject* obj)
01425 {
01426 DrawNoticeToUser ("Windows -> GPS", 5);
01427 }
01428
01429 char *windows_legends[] =
01430 {
01431 "Instant Replay",
01432 "--------------------",
01433 "Axis Window",
01434 "--------------------",
01435 "Vector Window",
01436 "Map Window",
01437 "GPS Window",
01438 NULL
01439 };
01440
01441 puCallback windows_cb[] =
01442 {
01443 windows_replay_cb,
01444 NULL,
01445 windows_axis_cb,
01446 NULL,
01447 windows_vector_cb,
01448 windows_map_cb,
01449 windows_gps_cb,
01450 NULL
01451 };
01452
01453
01454
01455
01456
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481
01482
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493
01494
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541
01542
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553
01554
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565
01566
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576
01577
01578
01579
01580
01581 void debug_dump_fui_cb (puObject* obj)
01582 {
01583 const char *debugFilename = "Debug\\Fui.txt";
01584 FILE *f = fopen (debugFilename, "w");
01585 if (f) {
01586 globals->fuimgr->Print (f);
01587 fclose (f);
01588 }
01589
01590 char debug[80];
01591 sprintf (debug, "FUI Manager dumped to %s", debugFilename);
01592 DrawNoticeToUser (debug, 5);
01593 }
01594
01595 void debug_dump_system_pfs_cb (puObject* obj)
01596 {
01597 FILE *f = fopen ("Debug\\pfs.txt", "w");
01598 if (f) {
01599 pfsdump (&globals->pfs, f);
01600 fclose (f);
01601 }
01602
01603 DrawNoticeToUser ("Default POD filesystem dumped to \"pfs.txt\"", 5);
01604 }
01605
01606 void debug_messaging_cb (puObject* obj)
01607 {
01608 msg_debug_dlg_create ();
01609 }
01610
01611 void debug_dump_keymap_cb (puObject* obj)
01612 {
01613 FILE *f = fopen ("Debug\\keymap.txt", "w");
01614 if (f) {
01615 globals->keymap->Print (f);
01616 fclose (f);
01617 }
01618
01619 DrawNoticeToUser ("Key mappings dumped to \"keymap.txt\"", 5);
01620 }
01621
01622
01623
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661
01662
01663
01664
01665
01666
01667
01668
01669
01670
01671
01672
01673
01674
01675
01676
01677
01678
01679
01680
01681
01682
01683
01684
01685
01686
01687
01688
01689
01690
01691
01692
01693
01694
01695
01696
01697
01698
01699
01700
01701
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720
01721 void debug_dump_apdb_cb (puObject* obj)
01722 {
01723 FILE *f = fopen ("Debug\\airport.txt", "w");
01724 if (f) {
01725 dbAirport->Dump (f);
01726 fclose (f);
01727 }
01728
01729 DrawNoticeToUser ("Airport database dumped to \"airport.txt\"", 5);
01730 }
01731
01732 void debug_dump_time_cb (puObject* obj)
01733 {
01734 CTimeManager *time = globals->timemgr;
01735 if (time != NULL) {
01736 FILE *f = fopen ("Debug\\time.txt", "w");
01737 if (f) {
01738 time->Print (f);
01739 fclose (f);
01740 }
01741 }
01742
01743 DrawNoticeToUser ("Time manager dumped to \"time.txt\"", 5);
01744 }
01745
01746
01747 void debug_dump_camera_cb (puObject* obj)
01748 {
01749 CCameraManager *camera = globals->sit->GetUserVehicle()->GetCameraManager ();
01750 if (camera != NULL) {
01751 FILE *f = fopen ("Debug\\camera.txt", "w");
01752 if (f) {
01753 camera->Print (f);
01754 fclose (f);
01755 }
01756 }
01757
01758 DrawNoticeToUser ("Camera manager dumped to \"camera.txt\"", 5);
01759 }
01760
01761
01762 void debug_dump_terrain_cb (puObject* obj)
01763 {
01764 CTerrainManager *terrain = globals->terrainmgr;
01765 if (terrain != NULL) {
01766 FILE *f = fopen ("Debug\\terrain.txt", "w");
01767 if (f) {
01768 terrain->Print (f);
01769 fclose (f);
01770 }
01771 }
01772
01773 DrawNoticeToUser ("Terrain root dumped to \"terrain.txt\"", 5);
01774 }
01775
01776
01777 void debug_dump_sky_cb (puObject* obj)
01778 {
01779 CSkyManager *sky = globals->skymgr;
01780 if (sky != NULL) {
01781 FILE *f = fopen ("Debug\\sky.txt", "w");
01782 if (f) {
01783 sky->Print (f);
01784 fclose (f);
01785 }
01786 }
01787
01788 DrawNoticeToUser ("Sky root dumped to \"sky.txt\"", 5);
01789 }
01790
01791
01792 void debug_dump_user_cb (puObject* obj)
01793 {
01794 FILE *f = fopen ("Debug\\uservehicle.txt", "w");
01795 if (f) {
01796 globals->sit->PrintUserVehicle(f);
01797 fclose (f);
01798 }
01799
01800 DrawNoticeToUser ("User vehicle root dumped to \"uservehicle.txt\"", 5);
01801 }
01802
01803 #ifdef _DEBUG
01804 void debug_breakpoint_cb (puObject* obj)
01805 {
01806 #ifdef HAVE__ASM
01807 _asm { int 3 }
01808 #endif // HAVE__ASM
01809 }
01810 #endif // _DEBUG
01811
01812 void debug_dump_electrical_cb (puObject* obj)
01813 {
01814 CVehicleObject *user = globals->sit->GetUserVehicle ();
01815 if (user != NULL) {
01816 if (user->GetType () == TYPE_FLY_AIRPLANE) {
01817 CAirplaneObject *planeObject = (CAirplaneObject *)user;
01818 CAirplane *plane = planeObject->pAirplane;
01819 if (plane != NULL) {
01820 CElectricalSystem *amp = plane->amp;
01821 if (amp != NULL) {
01822 FILE *f = fopen ("Debug\\electrical.txt", "w");
01823 if (f) {
01824 amp->Print (f);
01825 fclose (f);
01826 }
01827 }
01828 }
01829 }
01830 }
01831
01832 DrawNoticeToUser ("Aircraft electrical system dumped to \"elecrical.txt\"", 5);
01833 }
01834
01835
01836 char *debug_legends[] =
01837 {
01838 "Dump FUI Manager",
01839 "Dump Electrical Systems",
01840 "Dump POD Filesystem",
01841 "Messaging",
01842 "Dump Key Mappings",
01843
01844
01845
01846
01847
01848
01849
01850
01851
01852
01853 "Dump Time Manager",
01854 "Dump Camera",
01855 "Dump Terrain",
01856 "Dump Sky",
01857 "Dump User Vehicle",
01858 #ifdef _DEBUG
01859 "Breakpoint",
01860 #endif
01861 NULL
01862 };
01863
01864 puCallback debug_cb[] =
01865 {
01866 debug_dump_fui_cb,
01867 debug_dump_electrical_cb,
01868 debug_dump_system_pfs_cb,
01869 debug_messaging_cb,
01870 debug_dump_keymap_cb,
01871
01872
01873
01874
01875
01876
01877
01878
01879
01880
01881 debug_dump_time_cb,
01882 debug_dump_camera_cb,
01883 debug_dump_terrain_cb,
01884 debug_dump_sky_cb,
01885 debug_dump_user_cb,
01886 #ifdef _DEBUG
01887 debug_breakpoint_cb,
01888 #endif
01889 NULL
01890 };
01891
01892
01893
01894
01895
01896 void helpAbout_cb (puObject* obj)
01897 {
01898 DrawNoticeToUser ("Help About callback", 5);
01899 }
01900
01901 char *help_legends[] =
01902 {
01903 "About...",
01904 NULL
01905 };
01906
01907 puCallback help_cb[] =
01908 {
01909 helpAbout_cb,
01910 NULL
01911 };
01912
01913
01914
01915
01916
01917 static puMenuBar *menu;
01918
01919 void init_menu (void)
01920 {
01921 menu = new puMenuBar(-1);
01922 menu->add_submenu ("File", file_legends, file_cb);
01923 menu->add_submenu ("Options", options_legends, options_cb);
01924 menu->add_submenu ("QuickFlight", quickflight_legends, quickflight_cb);
01925 menu->add_submenu ("Flight Plan", flightplan_legends, flightplan_cb);
01926 menu->add_submenu ("Aircraft", aircraft_legends, aircraft_cb);
01927 menu->add_submenu ("Weather", weather_legends, weather_cb);
01928 menu->add_submenu ("Multiplayer", multiplayer_legends, multiplayer_cb);
01929 menu->add_submenu ("Windows", windows_legends, windows_cb);
01930
01931 menu->add_submenu ("Debug", debug_legends, debug_cb);
01932 menu->add_submenu ("Help", help_legends, help_cb);
01933 menu->close ();
01934
01935
01936 hide_menu ();
01937 }
01938
01939 void cleanup_menu (void)
01940 {
01941 menu->empty();
01942 delete menu;
01943 }
01944
01945 void hide_menu (void)
01946 {
01947 menu->hide ();
01948 }
01949
01950 void show_menu (void)
01951 {
01952 menu->reveal ();
01953 }
01954
01955 void toggle_menu (void)
01956 {
01957 if (menu->isVisible()) {
01958 menu->hide ();
01959 } else {
01960 menu->reveal ();
01961 }
01962 }