1
0
Fork 0

GUI: more HAVE_PUI defines

Mostly done by Fernando to enable Core-profile testing
This commit is contained in:
James Turner 2023-10-05 15:55:02 +01:00
parent ee3bab3437
commit 3986508911
3 changed files with 25 additions and 10 deletions

View file

@ -143,8 +143,12 @@ private:
void NasalMenuItem::initFromNode(SGPropertyNode_ptr config) void NasalMenuItem::initFromNode(SGPropertyNode_ptr config)
{ {
auto n = config->getChild("name"); auto n = config->getChild("name");
_name = n->getStringValue(); if (!n) {
n->addChangeListener(this); SG_LOG(SG_GUI, SG_DEV_WARN, "menu item without <name> element:" << config->getLocation());
} else {
_name = n->getStringValue();
n->addChangeListener(this);
}
if (n->getBoolValue("seperator") || nameIsSeperator(_name)) { if (n->getBoolValue("seperator") || nameIsSeperator(_name)) {
_isSeperator = true; _isSeperator = true;
@ -177,7 +181,8 @@ void NasalMenuItem::initFromNode(SGPropertyNode_ptr config)
_shortcut = n->getStringValue(); _shortcut = n->getStringValue();
} }
_bindings = readBindingList(n->getChildren("binding"), globals->get_props()); auto bindingNodes = n->getChildren("binding");
_bindings = readBindingList(bindingNodes, globals->get_props());
n = config->getChild("menu"); n = config->getChild("menu");
if (n) { if (n) {

View file

@ -28,7 +28,10 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scripting/NasalSys.hxx> #include <Scripting/NasalSys.hxx>
#if defined(HAVE_PUI)
#include "PUIFileDialog.hxx" #include "PUIFileDialog.hxx"
#endif
#if defined(SG_MAC) #if defined(SG_MAC)
#include "CocoaFileDialog.hxx" #include "CocoaFileDialog.hxx"
@ -147,8 +150,11 @@ static naRef f_createFileDialog(const nasal::CallContext& ctx)
FileDialogPtr fd(new CocoaFileDialog(usage)); FileDialogPtr fd(new CocoaFileDialog(usage));
#elif defined(HAVE_QT) #elif defined(HAVE_QT)
FileDialogPtr fd(new QtFileDialog(usage)); FileDialogPtr fd(new QtFileDialog(usage));
#else #elif defined(HAVE_PUI)
FileDialogPtr fd(new PUIFileDialog(usage)); FileDialogPtr fd(new PUIFileDialog(usage));
#else
// we need a fallback implementation
FileDialogPtr fd;
#endif #endif
return ctx.to_nasal(fd); return ctx.to_nasal(fd);

View file

@ -28,7 +28,6 @@
#include "GL/glx.h" #include "GL/glx.h"
#endif #endif
#include "FGPUIMenuBar.hxx"
#if defined(SG_MAC) #if defined(SG_MAC)
#include "FGCocoaMenuBar.hxx" #include "FGCocoaMenuBar.hxx"
@ -54,6 +53,7 @@
#if defined(HAVE_PUI) #if defined(HAVE_PUI)
#include "FGPUIDialog.hxx" #include "FGPUIDialog.hxx"
#include "FGPUIMenuBar.hxx"
#endif #endif
#include "FGFontCache.hxx" #include "FGFontCache.hxx"
@ -177,7 +177,9 @@ NewGUI::shutdown()
_menubar.reset(); _menubar.reset();
_dialog_props.clear(); _dialog_props.clear();
#if defined(HAVE_PUI)
puCleanUpJunk(); puCleanUpJunk();
#endif
} }
void void
@ -208,12 +210,14 @@ NewGUI::createMenuBarImplementation()
// _menubar.reset(new FGWindowsMenuBar); // _menubar.reset(new FGWindowsMenuBar);
} }
#endif #endif
#if defined(HAVE_PUI)
if (!_menubar.get() && _usePUI) {
_menubar.reset(new FGPUIMenuBar);
}
#endif
if (!_menubar.get()) { if (!_menubar.get()) {
if (_usePUI) { _menubar.reset(new FGNasalMenuBar);
_menubar.reset(new FGPUIMenuBar);
} else {
_menubar.reset(new FGNasalMenuBar);
}
} }
} }