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
This commit is contained in:
parent
1c83a15110
commit
08e72f8bfc
2 changed files with 24 additions and 1 deletions
src/Model
|
@ -26,6 +26,7 @@
|
||||||
#include <Cockpit/panel.hxx>
|
#include <Cockpit/panel.hxx>
|
||||||
#include <Cockpit/panel_io.hxx>
|
#include <Cockpit/panel_io.hxx>
|
||||||
#include "Viewer/viewer.hxx"
|
#include "Viewer/viewer.hxx"
|
||||||
|
#include "Viewer/viewmgr.hxx"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
|
@ -304,7 +305,21 @@ bool FGPanelNode::isVisible2d() const
|
||||||
return false;
|
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()) {
|
if (!globals->get_current_view()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
#include <osg/Vec3>
|
#include <osg/Vec3>
|
||||||
#include <osg/Matrix>
|
#include <osg/Matrix>
|
||||||
#include <osg/Drawable>
|
#include <osg/Drawable>
|
||||||
|
|
||||||
#include <simgear/structure/SGSharedPtr.hxx>
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
|
||||||
class FGPanel;
|
class FGPanel;
|
||||||
class SGPropertyNode;
|
class SGPropertyNode;
|
||||||
|
@ -66,6 +68,12 @@ private:
|
||||||
// The matrix that results, which transforms 2D x/y panel
|
// The matrix that results, which transforms 2D x/y panel
|
||||||
// coordinates into 3D coordinates of the panel quadrilateral.
|
// coordinates into 3D coordinates of the panel quadrilateral.
|
||||||
osg::Matrix _xform;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue