1
0
Fork 0

More #ifdefs around PUI in the UI code

This commit is contained in:
James Turner 2022-03-09 16:46:13 +00:00
parent 7613cb3ce7
commit 0e079a7ebe
2 changed files with 26 additions and 14 deletions

View file

@ -24,9 +24,7 @@
**************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include <simgear/compiler.h>
@ -57,21 +55,27 @@
using namespace flightgear;
#if defined(HAVE_PUI)
puFont guiFnt = 0;
// this is declared in puLocal.h, re-declare here so we can call it ourselves
void puSetPasteBuffer ( const char *ch ) ;
#endif
/* -------------------------------------------------------------------------
init the gui
_____________________________________________________________________*/
namespace
{
class GUIInitOperation : public GraphicsContextOperation
#if defined(HAVE_PUI)
class PUIInitOperation : public GraphicsContextOperation
{
public:
GUIInitOperation() : GraphicsContextOperation(std::string("GUI init"))
PUIInitOperation() : GraphicsContextOperation(std::string("GUI init"))
{
}
void run(osg::GraphicsContext* gc)
@ -110,6 +114,10 @@ public:
}
};
osg::ref_ptr<PUIInitOperation> initOp;
#endif
// Operation for querying OpenGL parameters. This must be done in a
// valid OpenGL context, potentially in another thread.
@ -160,8 +168,6 @@ struct GeneralInitOperation : public GraphicsContextOperation
}
};
osg::ref_ptr<GUIInitOperation> initOp;
}
/** Initializes GUI.
@ -183,8 +189,10 @@ bool guiInit()
gc = guiCamera->getGraphicsContext();
if (gc) {
gc->add(genOp.get());
initOp = new GUIInitOperation;
#if defined(HAVE_PUI)
initOp = new PUIInitOperation;
gc->add(initOp.get());
#endif
} else {
wsa->windows[0]->gc->add(genOp.get());
}
@ -194,12 +202,14 @@ bool guiInit()
{
if (!genOp->isFinished())
return false;
#if defined(HAVE_PUI)
if (!initOp.valid())
return true;
if (!initOp->isFinished())
return false;
genOp = 0;
initOp = 0;
#endif
genOp = 0;
// we're done
return true;
}

View file

@ -1,8 +1,6 @@
// new_gui.cxx: implementation of XML-configurable GUI support.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include "new_gui.hxx"
@ -36,6 +34,10 @@
#include "FGWindowsMenuBar.hxx"
#endif
#if defined(HAVE_PUI)
#include <plib/puAux.h>
#endif
#if defined(ENABLE_PUICOMPAT)
#include "FGPUICompatDialog.hxx"
#include "PUICompatObject.hxx"
@ -595,7 +597,7 @@ NewGUI::setStyle (void)
}
FGColor *c = _colors["background"];
#if !defined(ENABLE_PUICOMPAT)
#if defined(HAVE_PUI)
puSetDefaultColourScheme(c->red(), c->green(), c->blue(), c->alpha());
#endif
}
@ -604,7 +606,7 @@ NewGUI::setStyle (void)
void
NewGUI::setupFont (SGPropertyNode *node)
{
#if !defined(ENABLE_PUICOMPAT)
#if defined(HAVE_PUI)
_font = FGFontCache::instance()->get(node);
puSetDefaultFonts(*_font, *_font);
#endif