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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 **************************************************************************/
31 #include <simgear/compiler.h>
35 #include <simgear/structure/exception.hxx>
36 #include <simgear/misc/sg_path.hxx>
37 #include <simgear/props/props.hxx>
38 #include <simgear/props/props_io.hxx>
42 #include <Include/general.hxx>
43 #include <Main/main.hxx>
44 #include <Main/globals.hxx>
45 #include <Main/fg_props.hxx>
46 #include <Main/WindowSystemAdapter.hxx>
47 #include <GUI/new_gui.hxx>
52 #include <osg/GraphicsContext>
54 using namespace flightgear;
59 /* -------------------------------------------------------------------------
61 _____________________________________________________________________*/
65 class GUIInitOperation : public GraphicsContextOperation
68 GUIInitOperation() : GraphicsContextOperation(std::string("GUI init"))
71 void run(osg::GraphicsContext* gc)
73 WindowSystemAdapter* wsa = WindowSystemAdapter::getWSA();
75 puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ); //PUSTYLE_DEFAULT
76 puSetDefaultColourScheme (0.8, 0.8, 0.9, 1);
78 FGFontCache *fc = globals->get_fontcache();
79 fc->initializeFonts();
81 = fc->get(globals->get_locale()->getStringValue("font",
84 puSetDefaultFonts(*GuiFont, *GuiFont);
85 guiFnt = puGetDefaultLabelFont();
87 LayoutWidget::setDefaultFont(GuiFont, 15);
89 if (!fgHasNode("/sim/startup/mouse-pointer")) {
90 // no preference specified for mouse pointer
91 } else if ( !fgGetBool("/sim/startup/mouse-pointer") ) {
94 // force showing pointer
100 osg::ref_ptr<GUIInitOperation> initOp;
103 void guiStartInit(osg::GraphicsContext* gc)
106 initOp = new GUIInitOperation;
107 gc->add(initOp.get());
115 if (!initOp->isFinished())