#include <Main/fg_io.hxx>
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
-#include <Main/options.hxx>
+#include <Main/viewmgr.hxx>
#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
#endif
-#if defined( WIN32 ) && !defined( __CYGWIN__ )
+#if defined( WIN32 ) && !defined( __CYGWIN__ ) && !defined(__MINGW32__)
# include <simgear/screen/win32-printer.h>
# include <simgear/screen/GlBitmaps.h>
#endif
#include "apt_dlg.hxx"
#include "net_dlg.hxx"
#include "sgVec3Slider.hxx"
+#include "prop_picker.hxx"
SG_USING_STD(string);
SG_USING_STD(cout);
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
#define snprintf _snprintf
#endif /* _MSC_VER */
FG_PUSH_PUI_DIALOG( dialogBox );
}
+// Message Box to report an error.
+void guiErrorMessage (const char *txt)
+{
+ SG_LOG(SG_GENERAL, SG_ALERT, txt);
+ if (dialogBox != 0)
+ mkDialog(txt);
+}
+
+// Message Box to report a throwable (usually an exception).
+void guiErrorMessage (const char *txt, const sg_throwable &throwable)
+{
+ string msg = txt;
+ msg += '\n';
+ msg += throwable.getFormattedMessage();
+ if (throwable.getOrigin() != (string)"") {
+ msg += "\n (reported by ";
+ msg += throwable.getOrigin();
+ msg += ')';
+ }
+ SG_LOG(SG_GENERAL, SG_ALERT, msg);
+ if (dialogBox != 0)
+ mkDialog(msg.c_str());
+}
+
// Toggle the Menu and Mouse display state
void guiToggleMenu(void)
{
if( gui_menu_on ) {
// printf("Hiding Menu\n");
mainMenuBar->hide ();
-#if defined(WIN32_CURSOR_TWEAKS)
+#if defined(WIN32_CURSOR_TWEAKS_OFF)
if( mouse_mode == MOUSE_POINTER )
TurnCursorOff();
-#endif // #ifdef WIN32_CURSOR_TWEAKS
+#endif // WIN32_CURSOR_TWEAKS_OFF
} else {
// printf("Showing Menu\n");
mainMenuBar->reveal();
#ifdef WIN32
TurnCursorOn();
-#endif // #ifdef WIN32
+#endif // WIN32
}
gui_menu_on = ~gui_menu_on;
}
SaveDialog = new puDialogBox (150, 50);
{
SaveDialogFrame = new puFrame (0,0,350, 150);
- SaveDialogMessage = new puText (
- (150 - puGetStringWidth( puGetDefaultLabelFont(), "File Name:" ) / 2), 110);
+ SaveDialogMessage
+ = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
SaveDialogMessage -> setLabel ("File Name:");
SaveDialogInput = new puInput (50, 70, 300, 100);
}
}
-// Do this is the person presses cancel
+// Do this if the person presses cancel
void LoadDialogCancel(puObject *) {
FG_POP_PUI_DIALOG( LoadDialog );
}
LoadDialog = new puDialogBox (150, 50);
{
LoadDialogFrame = new puFrame (0,0,350, 150);
- LoadDialogMessage = new puText (
- (150 - puGetStringWidth( puGetDefaultLabelFont(), "File Name:" ) / 2), 110);
+ LoadDialogMessage
+ = new puText( (150 - puGetDefaultLabelFont().getStringWidth( "File Name:" ) / 2), 110 );
LoadDialogMessage -> setLabel ("File Name:");
LoadDialogInput = new puInput (50, 70, 300, 100);
char *s;
// printf("ConfirmExitDialogInit\n");
- int len = 200 - puGetStringWidth( puGetDefaultLabelFont(), msg )/2;
+ int len = 200 - puGetDefaultLabelFont().getStringWidth ( msg ) / 2;
int x = (fgGetInt("/sim/startup/xsize")/2 - 400/2);
int y = (fgGetInt("/sim/startup/ysize")/2 - 100/2);
YNdialogBox = new puDialogBox (x, y); // 150, 50
- // YNdialogBox = new puDialogBox (150, 50);
{
YNdialogFrame = new puFrame (0,0,400, 100);
#if defined(FX) && !defined(WIN32)
# if defined(XMESA_FX_FULLSCREEN) && defined(XMESA_FX_WINDOW)
- if ( global_fullscreen ) {
- global_fullscreen = false;
+ if ( globals->get_fullscreen() ) {
+ globals->set_fullscreen(false);
XMesaSetFXmode( XMESA_FX_WINDOW );
}
# endif
SGPath path( globals->get_fg_root() );
path.append( "Docs/index.html" );
+#if !defined(WIN32)
string help_app = fgGetString("/sim/startup/browser-app");
if ( system("xwininfo -name Netscape > /dev/null 2>&1") == 0 ) {
command = help_app + " -remote \"openURL(" + path.str() + ")\"";
} else {
- command = help_app + path.str();
+ command = help_app + " " + path.str();
}
-#if !defined(WIN32)
command += " &";
+#else // WIN32
+ command = "start ";
+ command += path.str();
#endif
system( command.c_str() );
char *filename = new char [24];
static int count = 1;
- int freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
+ static const SGPropertyNode *master_freeze
+ = fgGetNode("/sim/freeze/master");
+
+ bool freeze = master_freeze->getBoolValue();
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", true);
+ }
if(gui_menu_on) {
show_menu = true;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
ssgSetCamera( (sgVec4 *)globals->get_current_view()->get_VIEW() );
- float fov = globals->get_current_view()->get_fov();
- ssgSetFOV(fov, fov * globals->get_current_view()->get_win_ratio());
+ ssgSetFOV( globals->get_current_view()->get_h_fov(),
+ globals->get_current_view()->get_v_fov() );
// ssgSetNearFar( 10.0f, 120000.0f );
ssgSetNearFar( 0.5f, 1200000.0f );
puShowCursor();
}
- if(!freeze)
- globals->set_freeze( false );
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", false);
+ }
}
#endif // #if defined( TR_HIRES_SNAP)
-#if defined( WIN32 ) && !defined( __CYGWIN__)
+#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
static void rotateView( double roll, double pitch, double yaw )
{
#endif
-#if defined( WIN32 ) && !defined( __CYGWIN__)
+#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
// win32 print screen function
void printScreen ( puObject *obj ) {
bool show_pu_cursor = false;
show_pu_cursor = true;
puHideCursor();
}
- BusyCursor( 0 );
+ // BusyCursor( 0 );
mainMenuBar->hide();
CGlPrinter p( CGlPrinter::PRINT_BITMAP );
if( gui_menu_on ) {
mainMenuBar->reveal();
}
- BusyCursor(1);
+ // BusyCursor(1);
if ( show_pu_cursor ) {
puShowCursor();
}
string message;
static int count = 1;
- int freeze = globals->get_freeze();
- if(!freeze)
- globals->set_freeze( true );
+ static const SGPropertyNode *master_freeze
+ = fgGetNode("/sim/freeze/master");
+
+ bool freeze = master_freeze->getBoolValue();
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", true);
+ }
mainMenuBar->hide();
TurnCursorOff();
mainMenuBar->reveal();
}
- if(!freeze)
- globals->set_freeze( false );
+ if ( !freeze ) {
+ fgSetBool("/sim/freeze/master", false);
+ }
}
#ifdef FG_NETWORK_OLK
---------------------------------------------------------------------*/
char *fileSubmenu [] = {
"Exit", /* "Close", "---------", */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
+#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
"Print",
#endif
"Snap Shot",
};
puCallback fileSubmenuCb [] = {
MayBeGoodBye, /* hideMenuCb, NULL, */
-#if defined( WIN32 ) && !defined( __CYGWIN__)
+#if defined( WIN32 ) && !defined( __CYGWIN__) && !defined(__MINGW32__)
printScreen,
#endif
/* NULL, notCb, */
extern void fgHUDalphaAdjust( puObject * );
char *viewSubmenu [] = {
+ "Properties",
"HUD Alpha",
"Pilot Offset",
/* "Cockpit View > ", "View >","------------", */
"Toggle Panel...", NULL
};
puCallback viewSubmenuCb [] = {
+ prop_pickerView,
fgHUDalphaAdjust,
PilotOffsetAdjust,
/* notCb, notCb, NULL, */
// Set up our Dialog Boxes
ConfirmExitDialogInit();
NewAirportInit();
+
#ifdef FG_NETWORK_OLK
NewNetIdInit();
NewNetFGDInit();
mainMenuBar-> close ();
// Set up menu bar toggle
gui_menu_on = ~0;
+
+ if (fgGetString("/sim/flight-model") == "ada") {
+ guiToggleMenu(); // Menu off by default
+ }
}