]> git.mxchange.org Git - flightgear.git/commitdiff
Issue 790, restore hiding of 2D panel by view.
authorJames Turner <zakalawe@mac.com>
Tue, 26 Jun 2012 10:24:10 +0000 (11:24 +0100)
committerJames Turner <zakalawe@mac.com>
Tue, 26 Jun 2012 10:24:10 +0000 (11:24 +0100)
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
src/Model/panelnode.hxx

index a58de344d1b680ba3f77569e024d025215ff22b7..ac4256c1d14b0b57d6a90c68c53e78d871da4db8 100644 (file)
@@ -26,6 +26,7 @@
 #include <Cockpit/panel.hxx>
 #include <Cockpit/panel_io.hxx>
 #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;
     }
index 83960cf03ce53811cae8db8359c34e3f6703705e..772ef9e328194c447a7a0b68f9ba196c2d9c4a25 100644 (file)
@@ -4,7 +4,9 @@
 #include <osg/Vec3>
 #include <osg/Matrix>
 #include <osg/Drawable>
+
 #include <simgear/structure/SGSharedPtr.hxx>
+#include <simgear/props/props.hxx>
 
 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;
 };