- if(!freeze)
- globals->set_freeze( false );
-}
-
-void AptDialog_Reset(puObject *)
-{
- // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
- sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
- AptDialogInput->setValue ( NewAirportId );
- AptDialogInput->setCursor( 0 ) ;
-}
-
-void NewAirport(puObject *cb)
-{
- // strncpy( NewAirportId, globals->get_options()->get_airport_id().c_str(), 16 );
- sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
-// cout << "NewAirport " << NewAirportId << endl;
- AptDialogInput->setValue( NewAirportId );
-
- FG_PUSH_PUI_DIALOG( AptDialog );
-}
-
-static void NewAirportInit(void)
-{
- sprintf( NewAirportId, "%s", globals->get_options()->get_airport_id().c_str() );
- int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
- NewAirportLabel ) / 2;
-
- AptDialog = new puDialogBox (150, 50);
- {
- AptDialogFrame = new puFrame (0,0,350, 150);
- AptDialogMessage = new puText (len, 110);
- AptDialogMessage -> setLabel (NewAirportLabel);
-
- AptDialogInput = new puInput (50, 70, 300, 100);
- AptDialogInput -> setValue (NewAirportId);
- AptDialogInput -> acceptInput();
-
- AptDialogOkButton = new puOneShot (50, 10, 110, 50);
- AptDialogOkButton -> setLegend (gui_msg_OK);
- AptDialogOkButton -> setCallback (AptDialog_OK);
- AptDialogOkButton -> makeReturnDefault(TRUE);
-
- AptDialogCancelButton = new puOneShot (140, 10, 210, 50);
- AptDialogCancelButton -> setLegend (gui_msg_CANCEL);
- AptDialogCancelButton -> setCallback (AptDialog_Cancel);
-
- AptDialogResetButton = new puOneShot (240, 10, 300, 50);
- AptDialogResetButton -> setLegend (gui_msg_RESET);
- AptDialogResetButton -> setCallback (AptDialog_Reset);
- }
- cout << "NewAirportInit " << NewAirportId << endl;
- FG_FINALIZE_PUI_DIALOG( AptDialog );
-}
-
-#ifdef FG_NETWORK_OLK
-
-/// The beginnings of networking :-)
-// Needs cleaning up but works
-// These statics should disapear when this is a class
-static puDialogBox *NetIdDialog = 0;
-static puFrame *NetIdDialogFrame = 0;
-static puText *NetIdDialogMessage = 0;
-static puInput *NetIdDialogInput = 0;
-
-static char NewNetId[16];
-static char NewNetIdLabel[] = "Enter New Callsign";
-extern char *fgd_callsign;
-
-static puOneShot *NetIdDialogOkButton = 0;
-static puOneShot *NetIdDialogCancelButton = 0;
-
-void NetIdDialog_Cancel(puObject *)
-{
- FG_POP_PUI_DIALOG( NetIdDialog );
-}
-
-void NetIdDialog_OK (puObject *)
-{
- string NetId;
-
- bool freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
-/*
- The following needs some cleanup because
- "string options.NetId" and "char *net_callsign"
-*/
- NetIdDialogInput->getValue(&net_callsign);
- NetId = net_callsign;
-
- NetIdDialog_Cancel( NULL );
- globals->get_options()->set_net_id( NetId.c_str() );
- strcpy( fgd_callsign, net_callsign);
-// strcpy( fgd_callsign, globals->get_options()->get_net_id().c_str());
-/* Entering a callsign indicates : user wants Net HUD Info */
- net_hud_display = 1;
-
- if(!freeze)
- globals->set_freeze( false );
-}
-
-void NewCallSign(puObject *cb)
-{
- sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
-// sprintf( NewNetId, "%s", fgd_callsign );
- NetIdDialogInput->setValue( NewNetId );
-
- FG_PUSH_PUI_DIALOG( NetIdDialog );
-}
-
-static void NewNetIdInit(void)
-{
- sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
-// sprintf( NewNetId, "%s", fgd_callsign );
- int len = 150 - puGetStringWidth( puGetDefaultLabelFont(),
- NewNetIdLabel ) / 2;
-
- NetIdDialog = new puDialogBox (150, 50);
- {
- NetIdDialogFrame = new puFrame (0,0,350, 150);
- NetIdDialogMessage = new puText (len, 110);
- NetIdDialogMessage -> setLabel (NewNetIdLabel);
-
- NetIdDialogInput = new puInput (50, 70, 300, 100);
- NetIdDialogInput -> setValue (NewNetId);
- NetIdDialogInput -> acceptInput();
-
- NetIdDialogOkButton = new puOneShot (50, 10, 110, 50);
- NetIdDialogOkButton -> setLegend (gui_msg_OK);
- NetIdDialogOkButton -> setCallback (NetIdDialog_OK);
- NetIdDialogOkButton -> makeReturnDefault(TRUE);
-
- NetIdDialogCancelButton = new puOneShot (240, 10, 300, 50);
- NetIdDialogCancelButton -> setLegend (gui_msg_CANCEL);
- NetIdDialogCancelButton -> setCallback (NetIdDialog_Cancel);
-
- }
- FG_FINALIZE_PUI_DIALOG( NetIdDialog );
-}
-
-static void net_display_toggle( puObject *cb)
-{
- net_hud_display = (net_hud_display) ? 0 : 1;
- printf("Toggle net_hud_display : %d\n", net_hud_display);
-}
-
-static void net_register( puObject *cb)
-{
- fgd_send_com( "1", FGFS_host );
- net_is_registered = 0;
- printf("Registering to deamon\n");
-}
-
-static void net_unregister( puObject *cb)
-{
- fgd_send_com( "8", FGFS_host );
- net_is_registered = -1;
- printf("Unregistering from deamon\n");
-}
-
-
-/*************** Deamon communication **********/
-
-// These statics should disapear when this is a class
-static puDialogBox *NetFGDDialog = 0;
-static puFrame *NetFGDDialogFrame = 0;
-static puText *NetFGDDialogMessage = 0;
-//static puInput *NetFGDDialogInput = 0;
-
-//static char NewNetId[16];
-static char NewNetFGDLabel[] = "Scan for deamon ";
-static char NewFGDHost[64] = "olk.mcp.de";
-static int NewFGDPortLo = 10000;
-static int NewFGDPortHi = 10001;
-
-//extern char *fgd_callsign;
-extern u_short base_port, end_port;
-extern int fgd_ip, verbose, current_port;
-extern char *fgd_host;
-
-
-static puOneShot *NetFGDDialogOkButton = 0;
-static puOneShot *NetFGDDialogCancelButton = 0;
-static puOneShot *NetFGDDialogScanButton = 0;
-
-static puInput *NetFGDHostDialogInput = 0;
-static puInput *NetFGDPortLoDialogInput = 0;
-static puInput *NetFGDPortHiDialogInput = 0;
-
-void NetFGDDialog_Cancel(puObject *)
-{
- FG_POP_PUI_DIALOG( NetFGDDialog );
-}
-
-void NetFGDDialog_OK (puObject *)
-{
- char *NetFGD;
-
- bool freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
- NetFGDHostDialogInput->getValue( &NetFGD );
- strcpy( fgd_host, NetFGD);
- NetFGDPortLoDialogInput->getValue( (int *) &base_port );
- NetFGDPortHiDialogInput->getValue( (int *) &end_port );
- NetFGDDialog_Cancel( NULL );
- if(!freeze)
- globals->set_freeze( false );
-}
-
-void NetFGDDialog_SCAN (puObject *)
-{
- char *NetFGD;
- int fgd_port;
-
- bool freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
-// printf("Vor getvalue %s\n");
- NetFGDHostDialogInput->getValue( &NetFGD );
-// printf("Vor strcpy %s\n", (char *) NetFGD);
- strcpy( fgd_host, NetFGD);
- NetFGDPortLoDialogInput->getValue( (int *) &base_port );
- NetFGDPortHiDialogInput->getValue( (int *) &end_port );
- printf("FGD: %s Port-Start: %d Port-End: %d\n", fgd_host,
- base_port, end_port);
- net_resolv_fgd(fgd_host);
- printf("Resolve : %d\n", net_r);
- if(!freeze)
- globals->set_freeze( false );
- if ( net_r == 0 ) {
- fgd_port = 10000;
- strcpy( fgd_name, "");
- for( current_port = base_port; ( current_port <= end_port); current_port++) {
- fgd_send_com("0" , FGFS_host);
- sprintf( NewNetFGDLabel , "Scanning for deamon Port: %d", current_port);
- printf("FGD: searching %s\n", fgd_name);
- if ( strcmp( fgd_name, "") != 0 ) {
- sprintf( NewNetFGDLabel , "Found %s at Port: %d",
- fgd_name, current_port);
- fgd_port = current_port;
- current_port = end_port+1;
- }
- }
- current_port = end_port = base_port = fgd_port;
- }
- NetFGDDialog_Cancel( NULL );
-}
-
-
-void net_fgd_scan(puObject *cb)
-{
- NewFGDPortLo = base_port;
- NewFGDPortHi = end_port;
- strcpy( NewFGDHost, fgd_host);
- NetFGDPortLoDialogInput->setValue( NewFGDPortLo );
- NetFGDPortHiDialogInput->setValue( NewFGDPortHi );
- NetFGDHostDialogInput->setValue( NewFGDHost );
-
- FG_PUSH_PUI_DIALOG( NetFGDDialog );
-}
-
-
-static void NewNetFGDInit(void)
-{
-// sprintf( NewNetId, "%s", globals->get_options()->get_net_id().c_str() );
-// sprintf( NewNetId, "%s", fgd_callsign );
- int len = 170 - puGetStringWidth( puGetDefaultLabelFont(),
- NewNetFGDLabel ) / 2;
-
- NetFGDDialog = new puDialogBox (310, 30);
- {
- NetFGDDialogFrame = new puFrame (0,0,320, 170);
- NetFGDDialogMessage = new puText (len, 140);
- NetFGDDialogMessage -> setLabel (NewNetFGDLabel);
-
- NetFGDPortLoDialogInput = new puInput (50, 70, 127, 100);
- NetFGDPortLoDialogInput -> setValue (NewFGDPortLo);
- NetFGDPortLoDialogInput -> acceptInput();
-
- NetFGDPortHiDialogInput = new puInput (199, 70, 275, 100);
- NetFGDPortHiDialogInput -> setValue (NewFGDPortHi);
- NetFGDPortHiDialogInput -> acceptInput();
-
- NetFGDHostDialogInput = new puInput (50, 100, 275, 130);
- NetFGDHostDialogInput -> setValue (NewFGDHost);
- NetFGDHostDialogInput -> acceptInput();
-
- NetFGDDialogScanButton = new puOneShot (130, 10, 200, 50);
- NetFGDDialogScanButton -> setLegend ("Scan");
- NetFGDDialogScanButton -> setCallback (NetFGDDialog_SCAN);
- NetFGDDialogScanButton -> makeReturnDefault(FALSE);
-
- NetFGDDialogOkButton = new puOneShot (50, 10, 120, 50);
- NetFGDDialogOkButton -> setLegend (gui_msg_OK);
- NetFGDDialogOkButton -> setCallback (NetFGDDialog_OK);
- NetFGDDialogOkButton -> makeReturnDefault(TRUE);
-
- NetFGDDialogCancelButton = new puOneShot (210, 10, 280, 50);
- NetFGDDialogCancelButton -> setLegend (gui_msg_CANCEL);
- NetFGDDialogCancelButton -> setCallback (NetFGDDialog_Cancel);
-
- }
- FG_FINALIZE_PUI_DIALOG( NetFGDDialog );
-}
-
-/*
-static void net_display_toggle( puObject *cb)
-{
- net_hud_display = (net_hud_display) ? 0 : 1;
- printf("Toggle net_hud_display : %d\n", net_hud_display);
-}
-
-*/
-
-#endif
-
-/*************** End Networking **************/
-
-
-
-/* -----------------------------------------------------------------------
-The menu stuff
----------------------------------------------------------------------*/
-char *fileSubmenu [] = {
- "Exit", /* "Close", "---------", */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
- "Print",
-#endif
- "Snap Shot",
- "---------",
- "Reset",
- "Load flight",
- "Save flight",
- NULL
-};
-puCallback fileSubmenuCb [] = {
- MayBeGoodBye, /* hideMenuCb, NULL, */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
- printScreen,
-#endif
- /* NULL, notCb, */
- dumpSnapShot,
- NULL,
- reInit,
- loadFlight,
- saveFlight,
- NULL