From 08e72f8bfcb6889614d1e01833ee84cf9635ce14 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 26 Jun 2012 11:24:10 +0100 Subject: [PATCH] Issue 790, restore hiding of 2D panel by view. Restore previous behaviour where the 2D panel is automatically hidden when the current view is != 0. Also add two property controls to alter this behaviour, and the 'autohide' behaviour at runtime. (Requires an fgdata update to get matching preferences.xml) https://code.google.com/p/flightgear-bugs/issues/detail?id=790 --- src/Model/panelnode.cxx | 17 ++++++++++++++++- src/Model/panelnode.hxx | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Model/panelnode.cxx b/src/Model/panelnode.cxx index a58de344d..ac4256c1d 100644 --- a/src/Model/panelnode.cxx +++ b/src/Model/panelnode.cxx @@ -26,6 +26,7 @@ #include #include #include "Viewer/viewer.hxx" +#include "Viewer/viewmgr.hxx" using std::vector; @@ -304,7 +305,21 @@ bool FGPanelNode::isVisible2d() const return false; } - if (_panel->getAutohide()) { + if (!_hideNonDefaultViews) { + _hideNonDefaultViews = fgGetNode("/sim/panel/hide-nonzero-view", true); + } + + if (_hideNonDefaultViews->getBoolValue()) { + if (globals->get_viewmgr()->get_current() != 0) { + return false; + } + } + + if (!_autoHide2d) { + _autoHide2d = fgGetNode("/sim/panel/hide-nonzero-heading-offset", true); + } + + if (_panel->getAutohide() && _autoHide2d->getBoolValue()) { if (!globals->get_current_view()) { return false; } diff --git a/src/Model/panelnode.hxx b/src/Model/panelnode.hxx index 83960cf03..772ef9e32 100644 --- a/src/Model/panelnode.hxx +++ b/src/Model/panelnode.hxx @@ -4,7 +4,9 @@ #include #include #include + #include +#include class FGPanel; class SGPropertyNode; @@ -66,6 +68,12 @@ private: // The matrix that results, which transforms 2D x/y panel // coordinates into 3D coordinates of the panel quadrilateral. osg::Matrix _xform; + + /// should the 2D panel auto-hide when the view orientation changes + mutable SGPropertyNode_ptr _autoHide2d; + + /// should the 2D panel be hidden in views other than the default (view 0) + mutable SGPropertyNode_ptr _hideNonDefaultViews; };