1 /**************************************************************************
4 * Written 1998 by Durk Talsma, started Juni, 1998. For the flight gear
7 * Additional mouse supported added by David Megginson, 1999.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of the
12 * License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 **************************************************************************/
31 #include <simgear/compiler.h>
37 #include <simgear/structure/exception.hxx>
38 #include <simgear/misc/sg_path.hxx>
39 #include <simgear/props/props.hxx>
40 #include <simgear/props/props_io.hxx>
44 #include <Include/general.hxx>
45 #include <Main/main.hxx>
46 #include <Main/globals.hxx>
47 #include <Main/fg_props.hxx>
50 #include "gui_local.hxx"
51 #include "net_dlg.hxx"
52 #include "preset_dlg.hxx"
55 extern void initDialog (void);
56 extern void mkDialogInit (void);
57 extern void ConfirmExitDialogInit(void);
61 fntTexFont *guiFntHandle = 0;
64 /* -------------------------------------------------------------------------
66 _____________________________________________________________________*/
75 puSetDefaultStyle ( PUSTYLE_SMALL_BEVELLED ); //PUSTYLE_DEFAULT
76 puSetDefaultColourScheme (0.8, 0.8, 0.9, 0.8);
80 // Next check home directory
82 char* envp = ::getenv( "FG_FONTS" );
86 fntpath.set( globals->get_fg_root() );
87 fntpath.append( "Fonts" );
90 // Install our fast fonts
91 SGPropertyNode *locale = globals->get_locale();
92 fntpath.append(locale->getStringValue("font", "typewriter.txf"));
93 guiFntHandle = new fntTexFont ;
94 guiFntHandle -> load ( (char *)fntpath.c_str() ) ;
95 puFont GuiFont ( guiFntHandle, 15 ) ;
96 puSetDefaultFonts( GuiFont, GuiFont ) ;
97 guiFnt = puGetDefaultLabelFont();
99 if (!fgHasNode("/sim/startup/mouse-pointer")) {
100 // no preference specified for mouse pointer, attempt to autodetect...
101 // Determine if we need to render the cursor, or if the windowing
102 // system will do it. First test if we are rendering with glide.
103 if ( strstr ( general.get_glRenderer(), "Glide" ) ) {
104 // Test for the MESA_GLX_FX env variable
105 if ( (mesa_win_state = getenv( "MESA_GLX_FX" )) != NULL) {
106 // test if we are fullscreen mesa/glide
107 if ( (mesa_win_state[0] == 'f') ||
108 (mesa_win_state[0] == 'F') ) {
113 // mouse_active = ~mouse_active;
114 } else if ( !fgGetBool("/sim/startup/mouse-pointer") ) {
115 // don't show pointer
117 // force showing pointer
119 // mouse_active = ~mouse_active;
122 // MOUSE_VIEW mode stuff
125 // Set up our Dialog Boxes
126 ConfirmExitDialogInit();
129 #ifdef FG_NETWORK_OLK